Bug #2514
closedSCGI: lighttpd seems to add extra characters to HTTP response
Description
Environment: embedded product, running 3.4 kernel Linux. lighttpd v1.4.32 is running as an application. The product's main application is also running. I added some SCGI Server code (the "xamuel.com" scgilib shareware) to our main app. Mozilla Firefox, 3.6.3, also running on Linux (from a different IP than the product).
I configured lighttpd to locally handle the top-level index page request, which then provides a list of links which all have a .scgi extension, which is then routed to the SCGI Server in our main app. The main app creates a web page with a stylesheet reference on top and then some XML below. This is the top of the message which is sent back to lighttpd through the SCGI connection:
Status: 200 OK Content-Type: text/html <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="/xsl/adsr-video-ch-one.xslt"?> <TTCDB> (.....more XML follows...)
Then lighttpd gets this message and adds more headers and sends it to the FF browser like this:
HTTP/1.1 200 OK Status: 200 OK Content-Type: text/html Transfer-Encoding: chunked Date: Tue, 10 Sep 2013 17:10:53 GMT Server: lighttpd 414 <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="xsl/adsr-video-ch-one.xslt"?> <TTCDB> (.....more XML follows...)
...you'll notice no length field, and the extraneous "414" ASCII characters just before the start of the page. As a result, the browser just shows the source as text and does not try to GET the stylesheet.
By comparison, if I put the name of the created XML file (whose contents had been entirely sent via the SCGI message to lighttpd) into the browser window and just ask for it directly (i.e., not via SCGI), I get this result at the browser:
HTTP/1.1 200 OK Content-Type: text/xml Accept-Ranges: bytes ETag: "1563982617" Last-Modified: Tue, 10 Sep 2013 20:51:41 GMT Content-Length: 13359 Date: Tue, 10 Sep 2013 16:52:42 GMT Server: lighttpd <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="xsl/adsr-video-ch-one.xslt"?> <TTCDB> (.....more XML follows...)
So now the HTTP server is adding length and NOT adding the bogus "414" chars, and the webpage acts as expected.
My questions:
1. What headers does the SCGI Server need to fill in, aside from Status and Content-Type? Content-Length as well? Or should lighttpd be adding that?
2. What causes lighttpd to add the "414" characters in-between the headers and the payload for an SCGI-sourced response but NOT for a locally-handled response?
Thanks....
Updated by donaldgebbie over 10 years ago
I should add that, either way, the full contents of the XML file do get delivered to the browser. I.e., if you do a "show page source" you see the same thing in each case. But when the file is sourced from SCGI, the browser doesn't do a GET on the stylesheet, and thus you just see the XML data, unformatted, on the screen.
Updated by stbuehler over 10 years ago
- Status changed from New to Invalid
- This is not a support forum
- "Transfer-Encoding: chunked" - don't try reading HTTP if you don't know what this header does. Have fun reading the HTTP rfc(s)...
- Don't you see the wrong mime type in your SCGI response?...
Also available in: Atom