On Jul 19, 2010, at 4:28 PM, Timbo wrote:

> Whoa back up.  Rocket doesn't set the content-type at all, web2py
> takes care of that (streamer.py, line 63).  Actually, Rocket will send
> on whatever headers it gets,  I think Cherrypy was a little more
> selective, which may be one reason the Rocket switch would let this
> show up.

Something else is going on. For one thing, I don't see content-type via Apache. 
For another, I tried this:

    headers['Content-Type'] = contenttype(static_file)
    headers['Last-Modified'] = mtime
    headers['Pragma'] = 'cache'
    headers['Cache-Control'] = 'private'

    if request and request.env.http_if_modified_since == mtime:
        headers['Content-Type'] = 'text/cached'  <<<<<<<<<<<<<<<<<<<<<<<<
        raise HTTP(304)
    elif request and request.env.http_range:
        start_items = regex_start_range.findall(request.env.http_range)
        if not start_items:

And I don't see it: I still see text/html.

> 
> W.R.T. the slow requests, Rocket has some pretty verbose logging built-
> in that web2py doesn't expose (http://packages.python.org/rocket/
> usage.html#logging)  Can one of you who is experiencing this problem
> run web2py from this script:
> 
> -------------------
> import os
> import sys
> import logging
> import logging.handlers
> log = logging.getLogger('Rocket')
> log.setLevel(logging.DEBUG)
> log.addHandler(logging.handlers.FileHandler('rocket.log'))
> 
> try:
>    path = os.path.dirname(os.path.abspath(__file__))
> except NameError:
>    path=os.getcwd() # Seems necessary for py2exe
> 
> if not path in sys.path:
>    sys.path.append(path)
> os.chdir(path)
> 
> import gluon.import_all
> import gluon.widget
> 
> # Start Web2py and Web2py cron service!
> gluon.widget.start(cron=True)
> 
> -------------------------
> 
> Please use this to create a debug log of a delayed request (the more
> the merrier) and email it to me.  As a side-note, some of you have
> requested some features for Rocket.  I'm limiting development to
> essentials right now because of a case of dual-arm tendinitis.
> 
> Thanks.
> 
> On Jul 19, 12:11 pm, Jonathan Lundell <[email protected]> wrote:
>> On Jul 19, 2010, at 10:05 AM, Timbo wrote:
>> 
>>> It's defaulting to text/html since it's not actually sending a file.
>>> This is a section of the HTTP spec that I missed.
>>> http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.htmlsays that no
>>> entity headers (Content-* should be sent in a 304 instance)
>> 
>>> I think I can have a patch by this evening.
>> 
>>> However, I've never seen this behavior before so I'll need for someone
>>> to be able to test this to see if this is actually the cause of the
>>> problem.  Have we confirmed that the delay behavior happens in
>>> different browsers? I only see chrome above.
>> 
>> I'm doubtful that the content-type is related to the delay; it seems more 
>> like a cosmetic issue. Still, since Chrome complains about it....
>> 
>> 
>> 
>> 
>> 
>>> -tim
>> 
>>> On Jul 19, 9:54 am, Jonathan Lundell <[email protected]> wrote:
>>>> On Jul 18, 2010, at 4:10 PM, MikeEllis wrote:
>> 
>>>>> Here's the Header info from the long fetch on base.css:
>> 
>>>>> Request URL:http://192.168.253.105:8000/init/static/base.css
>>>>> Request Method:GET
>>>>> Status Code:304 Not Modified
>> 
>>>>> Request Headers
>>>>> Accept:text/css,*/*;q=0.1
>>>>> Cache-Control:max-age=0
>>>>> If-Modified-Since:Mon, 14 Jun 2010 23:30:00 GMT
>>>>> Referer:http://192.168.253.105:8000/init/editproblem/index
>>>>> User-Agent:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US)
>>>>> AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4
>> 
>>>>> Response Headers
>>>>> Connection:keep-alive
>>>>> Content-Type:text/html; charset=UTF-8
>>>>> Date:Sun, 18 Jul 2010 22:32:09 GMT
>>>>> Server:Rocket 1.0.5 Python/2.6.1
>> 
>>>> Notice that this is Rocket's cached response. I think you'll see the 
>>>> original file being served as text/css.
>> 
>>>> By comparison, I don't see a Content-Type in Apache's response (this is 
>>>> from Safari's debugger). Apache does include a couple of headers that 
>>>> Rocket does not.
>> 
>>>>         • Request URL:http://web2py.com/examples/static/styles.css
>>>>         • Request Method:GET
>>>>         • Status Code:
>> 
>>>>  warningOrangeDot.png
>>>> < 1KViewDownload
>> 
>>>> 304 Not Modified
>>>>         • Request Headers
>>>>                 • Accept:text/css,*/*;q=0.1
>>>>                 • Cache-Control:max-age=0
>>>>                 • If-Modified-Since:Sat, 17 Jul 2010 15:14:16 GMT
>>>>                 • If-None-Match:"42f90-d44-48b96c9edc200"
>>>>                 • Referer:http://web2py.com/
>>>>                 • User-Agent:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 
>>>> 10_6_4; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 
>>>> Safari/533.16
>>>>         • Response Headers
>>>>                 • Cache-Control:max-age=86400
>>>>                 • Connection:Keep-Alive
>>>>                 • Date:Mon, 19 Jul 2010 14:47:39 GMT
>>>>                 • Etag:"42f90-d44-48b96c9edc200"
>>>>                 • Expires:Tue, 20 Jul 2010 14:47:39 GMT
>>>>                 • Keep-Alive:timeout=2, max=15
>>>>                 • Server:Apache/2.2.8 (Ubuntu) mod_wsgi/3.2-BRANCH 
>>>> Python/2.5.2 mod_ssl/2.2.8 OpenSSL/0.9.8g


Reply via email to