LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > Rails + gzip: random content-length header

Reply
 
Thread Tools Display Modes
  #1  
Old 10-28-2007, 05:42 PM
andreas andreas is offline
Senior Member
 
Join Date: Aug 2006
Posts: 91
Default Rails + gzip: random content-length header

Hi,

I'm running Rails on LSWS with dynamic response gzip compression. I noticed that Safari would try to render even short pages before they were fully loaded, and blamed it on the missing content-length header. In order to get a content-length header I enabled response buffering. Unfortunately it doesn't work reliably; some responses have a content-length header, some just don't (for the same request). Any ideas why that might be?

Andreas
Reply With Quote
  #2  
Old 11-21-2007, 09:13 AM
andreas andreas is offline
Senior Member
 
Join Date: Aug 2006
Posts: 91
nothing?

Code:
$ lynx -mime-header http://www.mikrocontroller.net/topic/40008 | head -n 11
HTTP/1.0 200 OK
Content-Type: text/html; charset=utf-8
Set-Cookie: return_to=%2Ftopic%2F40008; path=/
Set-Cookie: _session_id=bfc34e7857d23aadab1f5492d2772c13; path=/; expires=Thu, 20 Nov 2008 22:44:19 GMT
Cache-Control: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Wed, 21 Nov 2007 17:11:19 GMT
Server: LiteSpeed
Connection: close

$ lynx -mime-header http://www.mikrocontroller.net/topic/40008 | head -n 11
HTTP/1.0 200 OK
Content-Type: text/html; charset=utf-8
Set-Cookie: return_to=%2Ftopic%2F40008; path=/
Set-Cookie: _session_id=18640c2e04e6d0173f024c0ebb0cb189; path=/; expires=Thu, 20 Nov 2008 22:44:19 GMT
Cache-Control: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 5289
Date: Wed, 21 Nov 2007 17:11:20 GMT
Server: LiteSpeed
Connection: close
Reply With Quote
  #3  
Old 11-21-2007, 01:28 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
It depends on the timing that LSWS receives the full response from backend application.
When Content-Length is not set, "Chunked" "Transfer-Encoding" should use for HTTP 1.1 client. lynx is a HTTP 1.0 client, so none of above header is set.
The problem with Safari might not be the header problem, maybe need to sniff the network traffic with tcpdump or something to figure it out.
Reply With Quote
  #4  
Old 11-21-2007, 02:05 PM
andreas andreas is offline
Senior Member
 
Join Date: Aug 2006
Posts: 91
Thanks, I understand now. I see the chunked header when I use
Code:
curl --compressed -D header http://www.mikrocontroller.net/topic/40003
.

Is there a way to enable response buffering for rails contexts (I guess this would disable chunked encoding)? Rails sends the response in one part anyway.
Reply With Quote
  #5  
Old 11-23-2007, 01:08 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
You can trun on response buffering under "Ruby Rails" tab, It won't work reliably for large pages though.
Reply With Quote
  #6  
Old 11-23-2007, 01:09 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
A HTTP/1.1 browser should support chunk encoding without any problem.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:43 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.