Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

API returns incorrect Content-Length for elements that have 'gone' #537

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 7 comments
Closed

Comments

@openstreetmap-trac
Copy link

Reporter: rollercow[at]sucs.org
[Submitted to the original trac issue database at 4.44pm, Thursday, 13th September 2007]

API returns incorrect Content-Length for elements that have 'gone'

For example

If you request http://www.openstreetmap.org/api/0.4/way/4627408

The server returns

Content-Length: 1

Yet no content is returned, so it should return

Content-Length: 0

(or some content)

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 11.03am, Friday, 14th September 2007]

The code just does:

render :nothing => true, :status => :gone

so this must be a rails or lighttpd problem I think.

@openstreetmap-trac
Copy link
Author

Author: jburgess[at]uklinux.net
[Added to the original trac issue at 1.04am, Wednesday, 17th October 2007]

This appears to be a documented feature of rails, but fairly easy to workaround:-

"Rendering nothing

Rendering nothing is often convenient in combination with Ajax calls that perform their effect client-side or when you just want to communicate a status code. Due to a bug in Safari, nothing actually means a single space."

src/rails-1.2.3/actionpack/lib/action_controller/base.rb

   elsif options[:nothing]
            # Safari doesn't pass the headers of the return if the response is zero length
            render_text(" ", options[:status])

According to http://dev.rubyonrails.org/ticket/9481 this workaround even breaks Safari in other circumstances.

The attached patch makes the deleted ways return content-length:0

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 8.18am, Wednesday, 17th October 2007]

This doesn't make any sense though - the content length may be getting set to one, but it is also returning a space. Where is that space going? Something must be eating it...

@openstreetmap-trac
Copy link
Author

Author: jburgess[at]uklinux.net
[Added to the original trac issue at 5.58pm, Wednesday, 17th October 2007]

At least it explains the conten-length=1 and the workaround fixes it.

Since you really seem to be desperate to find what happens to the missing space, I'll try to find out. I suspect it could be related to Richards Actionscript problem where the final character was being deleted (I think this was yet another broken 'fix' done for Safari).

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 6.01pm, Wednesday, 17th October 2007]

I'm working on it right now - currently lighttpd is in the frame as I have an strace showing the space being included in the FCGI response from rails to lighttpd but not in the HTTP response from lighttpd to the client.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 11.15pm, Wednesday, 17th October 2007]

This is down to lighttpd - see http://trac.lighttpd.net/trac/ticket/1055 which appears to cover it.

@openstreetmap-trac
Copy link
Author

Author: tomhughes
[Added to the original trac issue at 11.22pm, Wednesday, 17th October 2007]

(In [5058]) Render an empty text string instead of nothing (which actually generate a
single space character) for 410 and 412 responses as there is a bug in
lighttpd (http://trac.lighttpd.net/trac/ticket/1055) that prevents it
passing on the response body for these codes, leading to the client blocking
waiting for the data until it times out. Closes #537.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant