Opened 13 years ago

Closed 13 years ago

#537 closed defect (fixed)

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

Reported by: rollercow Owned by: Tom Hughes
Priority: trivial Milestone:
Component: api Version:
Keywords: Cc:


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

For example

If you request

The server returns

Content-Length: 1

Yet no content is returned, so it should return

Content-Length: 0

(or some content)

Attachments (1)

way-gone.patch (541 bytes) - added by jburgess@… 13 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 13 years ago by Tom Hughes

Priority: majortrivial

The code just does:

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

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

Changed 13 years ago by jburgess@…

Attachment: way-gone.patch added

comment:2 Changed 13 years ago by jburgess@…

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."


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

According to this workaround even breaks Safari in other circumstances.

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

comment:3 Changed 13 years ago by Tom Hughes

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...

comment:4 Changed 13 years ago by jburgess@…

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).

comment:5 Changed 13 years ago by Tom Hughes

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.

comment:6 Changed 13 years ago by Tom Hughes

This is down to lighttpd - see which appears to cover it.

comment:7 Changed 13 years ago by tomhughes

Resolution: fixed
Status: newclosed

(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 ( 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.

Note: See TracTickets for help on using tickets.