-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Status code not set to 304 #25
Comments
Interesting! I don't 100% understand either, but I'm glad you found this clue. If you feel like digging into it, the node.js api docs for the http module might mention the more subtle differences between res.writeHead and res.statusCode. |
That said, I would accept a pull request if everything seemed to be in (more or less) working order. |
Ok, I'll try to take a look next week. On 27 Jan 2012, at 17:41, Joshua Holbrookreply@reply.github.com wrote:
|
It seems to be related to the way that the Union module handles responses. If you take a look at this file in union https://github.com/flatiron/union/blob/master/lib/response-stream.js You will see that to set a response it actually uses this.response.statusCode. And if I change the code in status-handlers.js to be
that seems to work. But I think I prefer the res.writeHead() approach as it reads better. I'll make some changes along those lines and submit a pull request. Cheers, |
Interesting. I wonder if you can define the setter for res.statusCode to proxy properly... I haven't tried to do anything quite so tricksy with javascript. Either way, I approve of the writeHead approach. |
I'm sure you're right and union could be amended to allow the use of re.statusCode directly. But anyway I have submitted a pull request on issue 27 to use writeHead. Thanks. |
I merged your pull request afaik, and I made corresponding changes in the v0.2.x branch. Still, this is a bug with union imo. I'll file it. Thanks! |
Hi, I'm using 0.1.6 via npm. I've first checked the code and found a different fix, then I found this issue. I'm not sure this is the same thing but in effect I would have created an issue with a similar subject line, so I rather comment on this one. My test is: request a file, and request it again. Check the headers. Expected:
Actual Result
My setup looks like this:
Wenn I change the ecstatic.js code (lines 86pp) to check the 'if-modified-since' header than the status code is returned as I would expect it.
When I comment the date comparison of 'if-modified-since' I get back 200 every time with Firefox, if I uncomment it, I get 304. With Safari however, I always get 200: Safari does never send 'if-modified-since'. I controlled different pages and there this header is sent and 304 is returned, so in general it can work. I've tried adding the 'Expires' header but that did not help. EDIT: EDIT: Thanks, |
I have been having a problem in that the http response status code is 200 rather than 304 for files which have not changed. It works for me if I make the following change in status-handler.js
I don't really understand why and it could potentially need to be similarly changed in several other places in that file, so would rather see if anyone understands it before I submit a pull request.
Cheers,
Colin
The text was updated successfully, but these errors were encountered: