[mod_python] meets_conditions does not seem to work

Graham Dumpleton grahamd at dscpl.com.au
Wed Nov 22 01:37:41 EST 2006


sliderw hotmail wrote ..
> >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....

That is probably a reasonable assumption if the condition is based on a mtime
that you want to manipulate.

> BTW, when will 3.3 come out?

Hopefully a Christmas present for all. You can always check out current code
from subversion, or see:

  http://mail-archives.apache.org/mod_mbox/httpd-python-dev/200611.mbox/%[email protected]%3e

Any delays at this point are my fault as lagging on some documentation and
also not happy with a couple of issues I thought had been resolved. Been hard to
find good blocks of time to work on it as having to take over extra projects in
my real job because of people leaving.

Graham


More information about the Mod_python mailing list