HTTPAPI missing HTTP headers?
#1
Hi -

I am running XBMC for Windows / Atlantis Beta 2

I have started to play around with the HTTPAPI ... My goal is to remote control XBMC from my Blackberry 9000 over Wifi (using a web page).
However, I have run into some strange issues: When I try to invoke any HTTPAPI function (e.g. /xbmcCmds/xbmcHttp?command=GetCurrentPlaylist) from the Blackberry Browser I receive the following error:
"HTTP Error 0: An error occurred while communicating with the origin server. Please try again."

On the other hand I have no problems opening a html page located in the XBMC/web directory (e.g. http://xbox/test.htm)

Looking at the HTTP Headers, I have noticed that the API does not return any response headers:

Code:
+++GET 554+++
GET /xbmcCmds/xbmcHttp?command=GetCurrentPlaylist HTTP/1.1
Accept: */*
Accept-Language: de
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)
Host: 192.168.123.155
Pragma: no-cache
Connection: keep-alive

+++RESP 554+++
[color=red]HTTP/1.1 200 (No headers)
Server: Unknown, missing HTTP headers[/color]
+++CLOSE 554+++

However, I do get proper headers when I open the HTML file:

Code:
+++GET 555+++
GET /test.htm HTTP/1.1
Accept: */*
Accept-Language: de
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)
Host: 192.168.123.155
Connection: keep-alive

+++RESP 555+++
[color=red]HTTP/1.1 200 OK
Date: Sat Oct 11 13:24:58 2008
Server: GoAhead-Webs
Last-modified: Sat Oct 11 11:39:54 2008
Content-length: 7730
Content-type: text/html[/color]
+++CLOSE 555+++

I am not 100% sure, but I am wondering if the missing headers are preventing the Blackberry Browser from loading the API function properly.

So my question is: Is it intentional that there are no headers, or is this a bug?

Thank you!
Reply
#2
This isn't actually a bug but just a shortcut - I haven't come across a client that complains about the lack of headers before.

You could try using the httpapi command SetResponseFormat(Header;fill_in_what_your_client_wants_here)

Reply
#3
Thumbs Up 
nad Wrote:This isn't actually a bug but just a shortcut - I haven't come across a client that complains about the lack of headers before.

You could try using the httpapi command SetResponseFormat(Header;fill_in_what_your_client_wants_here)

Ahh, thank you for pointing me in the right direction!

It was actually SetResponseFormat(WebHeader;True) that fixed my problem. I had it set to 'False' initially because I misread the documentation. Setting it to 'True' adds the correct HTTP Headers to the response.

The Blackberry Browser now handles all requests correctly.

Again, thank you Big Grin
Reply
#4
Okay, sorry, but I still think this is a bug.

When I set SetResponseFormat(WebHeader;True) then the server adds the <html> tag to the top of the response for all requests.
Similarly, when I set SetResponseFormat(WebFooter;True), I get the </html> tag at the bottom.

So far so good.

Question is: Why does it also toggle the the HTTP headers (e.g. Content-type: text/html; see above) along with the <html> tags?

Sorry, but that somehow makes no sense to me. Any idea?

Thank you!
Reply

Logout Mark Read Team Forum Stats Members Help
HTTPAPI missing HTTP headers?0