List Info

Thread: serve_file and 304 error code




serve_file and 304 error code
country flaguser name
United States
2007-10-04 18:14:56
In my application a function which handles a request
executes
something like:

    return cherrypy.lib.static.serve_file(path,"text/
html","inline",name)

It works when I send a request for the first time, but when
I click
the "reload" button I get an exception of the form
'([], 304)'. I am
completely ignorant of the HTTP protocol, but it seems that
this error
means that the file did not change and should be shown from
the cache
which does not happen. If I clean the cache the file appears
again but
the problem continues if I try to reload.

How do I change this behavior? I know very little about the
HTTP
protocol -- that's why I want to use CherryPy so that I do
not have to
learn too much about it!

-- tsf


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: serve_file and 304 error code
country flaguser name
United States
2007-10-04 18:19:46
Hi there,

This is not an error (in HTTP only code 40x are errors).
This is the 
correct behavior as it avoids sending the file every time
when it's not 
necessary.

Could you explain why you want to change that behavior?

- Sylvain

Tsf wrote:
> In my application a function which handles a request
executes
> something like:
> 
>     return
cherrypy.lib.static.serve_file(path,"text/
> html","inline",name)
> 
> It works when I send a request for the first time, but
when I click
> the "reload" button I get an exception of the
form '([], 304)'. I am
> completely ignorant of the HTTP protocol, but it seems
that this error
> means that the file did not change and should be shown
from the cache
> which does not happen. If I clean the cache the file
appears again but
> the problem continues if I try to reload.
> 
> How do I change this behavior? I know very little about
the HTTP
> protocol -- that's why I want to use CherryPy so that I
do not have to
> learn too much about it!
> 
> -- tsf
> 
> 
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: serve_file and 304 error code
country flaguser name
United States
2007-10-04 20:09:13
I think your question made me realize what was wrong: I was
catching
the 304 exception in my server function and returning an
error page
instead of just letting the browser handle this situation.
It seems to
work now!

Thanks,

-- tsf


On Oct 4, 8:19 pm, Sylvain Hellegouarch <s...defuze.org> wrote:
> Hi there,
>
> This is not an error (in HTTP only code 40x are
errors). This is the
> correct behavior as it avoids sending the file every
time when it's not
> necessary.
>
> Could you explain why you want to change that
behavior?
>
> - Sylvain
>
> Tsf wrote:
> > In my application a function which handles a
request executes
> > something like:
>
> >     return
cherrypy.lib.static.serve_file(path,"text/
> > html","inline",name)
>
> > It works when I send a request for the first time,
but when I click
> > the "reload" button I get an exception
of the form '([], 304)'. I am
> > completely ignorant of the HTTP protocol, but it
seems that this error
> > means that the file did not change and should be
shown from the cache
> > which does not happen. If I clean the cache the
file appears again but
> > the problem continues if I try to reload.
>
> > How do I change this behavior? I know very little
about the HTTP
> > protocol -- that's why I want to use CherryPy so
that I do not have to
> > learn too much about it!
>
> > -- tsf


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )