Re: [google-appengine] Google Fronted, Content-Length and HEAD requests

2010-01-17 Thread Piotr Sikora
On Google App Engine, response headers are just a dictionary.  In order to 
delete the Content-Length response header, somewhere in your head request 
handler, add this line:


del self.response.headers['Content-Length']


Raj, thanks for reply, but you kind of missed my point. The problem is that 
Google Frontend (the web server) discards "Content-Length" header that 
you've set in your application (the dictionary) and it sets its own value 
based on the length of response body. This works fine for GET and other 
requests, but not for HEAD, since there is no body in its response and 
Google Frontend sets "Content-Length" to 0.


Best regards,
Piotr Sikora < piotr.sik...@frickle.com >

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




Re: [google-appengine] Google Fronted, Content-Length and HEAD requests

2010-01-17 Thread Mr. Rajiv Bakulesh Shah
Hi, Piotr.

On Google App Engine, response headers are just a dictionary.  In order to 
delete the Content-Length response header, somewhere in your head request 
handler, add this line:

del self.response.headers['Content-Length']

Good luck,
Raj

On Jan 17, 2010, at 2:55 AM, Piotr Sikora wrote:

> Hello,
> I noticed that Google Frontend overrides user-supplied "Content-Length" 
> header with its own. This is of course good idea, but I find this undesirable 
> for HEAD requests, especially when combined with Blobstore. For *every* HEAD 
> request Google Frontend returns response with "Content-Length: 0".
> 
> Would it be possible to disable this for HEAD requests or at least provide 
> way to conditionaly disable this based on user-supplied header (ie. 
> "X-AppEngine-Override: Content-Length")?
> 
> According to RFC 2616:
> 
> 9.4 HEAD
> The HEAD method is identical to GET except that the server MUST NOT return a 
> message-body in the response. The metainformation contained in the HTTP 
> headers in response to a HEAD request SHOULD be identical to the information 
> sent in response to a GET request. This method can be used for obtaining 
> metainformation about the entity implied by the request without transferring 
> the entity-body itself. This method is often used for testing hypertext links 
> for validity, accessibility, and recent modification.
> 
> The response to a HEAD request MAY be cacheable in the sense that the 
> information contained in the response MAY be used to update a previously 
> cached entity from that resource. If the new field values indicate that the 
> cached entity differs from the current entity (as would be indicated by a 
> change in Content-Length, Content-MD5, ETag or Last-Modified), then the cache 
> MUST treat the cache entry as stale.
> 
> Best regards,
> Piotr Sikora < piotr.sik...@frickle.com >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-appengine?hl=en.
> 
> 

-- 

You received this message because you are subscribed to the Google Groups "Google App Engine" group.

To post to this group, send email to google-appeng...@googlegroups.com.

To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Google Fronted, Content-Length and HEAD requests

2010-01-17 Thread Piotr Sikora

Hello,
I noticed that Google Frontend overrides user-supplied "Content-Length" 
header with its own. This is of course good idea, but I find this 
undesirable for HEAD requests, especially when combined with Blobstore. For 
*every* HEAD request Google Frontend returns response with "Content-Length: 
0".


Would it be possible to disable this for HEAD requests or at least provide 
way to conditionaly disable this based on user-supplied header (ie. 
"X-AppEngine-Override: Content-Length")?


According to RFC 2616:

9.4 HEAD
The HEAD method is identical to GET except that the server MUST NOT return a 
message-body in the response. The metainformation contained in the HTTP 
headers in response to a HEAD request SHOULD be identical to the information 
sent in response to a GET request. This method can be used for obtaining 
metainformation about the entity implied by the request without transferring 
the entity-body itself. This method is often used for testing hypertext 
links for validity, accessibility, and recent modification.


The response to a HEAD request MAY be cacheable in the sense that the 
information contained in the response MAY be used to update a previously 
cached entity from that resource. If the new field values indicate that the 
cached entity differs from the current entity (as would be indicated by a 
change in Content-Length, Content-MD5, ETag or Last-Modified), then the 
cache MUST treat the cache entry as stale.


Best regards,
Piotr Sikora < piotr.sik...@frickle.com >

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.