Forum

Symphony CMS and Status headers

David Oliver
15 December 2011, 02:49
Hugo, I've just opened an issue for Symphony CMS [github.com] concerning status response headers. As this is something which I've seen in the forums here and that you're familiar with, I wondered if you might want to check what I've written and correct/clarify anything, or to make a recommendation on how to handle the situation.

I guess it might end up reducing the queries you get here eventually.

Thanks again for hiawatha.
Hugo Leisink
15 December 2011, 09:14
I think the CGI RFC [tools.ietf.org] is clear enough about the subject. I've looked at it again and couldn't find anything that states that sending a line like "HTTP/1.1 304 Not Modified" is valid for a CGI application.


P.S., read the solution for your previous issue?
David Oliver
15 December 2011, 14:45
Update in case it's relevant to other applications or Banshee, too (although I guess nobody tries to use it in Apache?):

The following PHP function call seems to work for both CGI/FastCGI and Apache 2.0 Handler (mod_php5):

header('Status: 304 Not Modified', true, 304);

It also seems to work for both in the following form as the last parameter overrides the first:

header('any string', true, 304);

The first parameter has to have a string of some sort, though. The last parameter "only has an effect if the string is not empty." header [php.net]
Hugo Leisink
19 December 2011, 11:27
When using the Status CGI header, Hiawatha will ignore further content and send its own message to the client. In the past, there were several good technical reasons for it. I will take a look at it again to see if those reasons are still valid today.

My advice for now: don't use the Status CGI header unless you really need to.
David Oliver
19 December 2011, 16:04
Not sure I understand your last comment correctly, Hugo. Are you saying that if a web page sets a Status header, hiawatha won't serve the full web page and, instead, send its own status page to the browser?

Images served with status 304 seem to work fine in hiawatha, as per my message above, but I haven't tried a full page yet.
Hugo Leisink
19 December 2011, 16:18
If a CGI prints a Status header, Hiawatha ignores the body sent by the CGI. Hiawatha sends the header as sent by the CGI and Hiawatha's own body.

Example. A CGI sends this:
Content-Type: text/plain
Status: 404

Sorry, the requested page was not found.


Hiawatha will then send:
HTTP/1.0 404 Not Found
Date: Mon, 19 Dec 2011 15:17:44 GMT
Server: Hiawatha v7.8.2
Connection: close
Content-Length: 416
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>404 - Not Found</title>
<style type="text/css">BODY { color:#ffffff ; background-color:#00000a }
DIV { font-family:sans-serif ; font-size:30px ; letter-spacing:20px ; text-align:center ; position:relative ; top:250px }
</style>
</head>
<body>
<div>404 - Not Found</div>
</body>
</html>
This topic has been closed.