[mod_python] meets_conditions does not seem to work

sliderw hotmail sliderw at hotmail.com
Tue Nov 21 22:53:28 EST 2006


>Graham Dumpleton wrote ..
> >
> > What headers is your client sending which denote the condition that has
> > to be
> > satisfied. Ie., what headers are in req.headers_in such as:
> >
> >   If-Match
> >   If-Unmodified-Since
> >   If-None-Match
> >   Range
> >   If-Modified-Since
> >
> > If your client isn't sending any conditions, how can there be anything
> > to
> > check.
> >
> > Another issues is perhaps that 'Last-Modified' header isn't even 
>consulted
> > anyway. Instead it looks at req.mtime attribute for when resource was 
>last
> > modified. Getting this set to a sensible value in mod_python, because 
>output
> > is
> > generated dynamically, isn't that simple. In the version of mod_python
> > you are
> > using it probably isn't even possible as there is no way to update 
>req.mtime.
> >
> > In mod_python 3.3, req.mtime is still read only, but 
>req.set_last_modified()
> > is
> > provided which allows req.mtime to be set from the mtime in req.finfo 
>with
> > req.finfo being able to be updated by setting it to result of calling 
>the
> > apache.stat() method with a file name. Problem is that in mod_python the
> > mtime
> > may need to reflect changes across multiple files which comprise the 
>source
> > code used to fulfil a request. Thus, in some respects, req.mtime should
> > possibly
> > be directly modifiable to be of most use, but it isn't right now.
> >
> > Anyway, having said all that, what are you expecting to happen and how
> > do you expect to be able to use req.meets_condition()?
>
>Whoops. Forgot that in mod_python 3.3 there is req.update_mtime(), so
>req.mtime can be updated, you just don't do it directly but through a
>function.
>
>Graham

304 Not Modified should be expected because my client sends:

If-Modified-Since: Wed, 22 Nov 2006 01:00:00 GMT
If-None-Match: "12345"

I also suspect that mtime is the issue. The value of req.mtime is 0.0 just 
before the meets_conditions call. Although I'm not familiar with the 
internals of mod_python and Apache, I looked at Apache's 
ap_meets_conditions, which uses current time as mtime if req.mtime is 0.

So meets_conditions is unusable until 3.3? Hmm....

BTW, when will 3.3 come out?

_________________________________________________________________
All-in-one security and maintenance for your PC.  Get a free 90-day trial! 
http://clk.atdmt.com/MSN/go/msnnkwlo0050000002msn/direct/01/?href=http://clk.atdmt.com/MSN/go/msnnkwlo0050000001msn/direct/01/?href=http://www.windowsonecare.com/?sc_cid=msn_hotmail



More information about the Mod_python mailing list