[mod_python] Can't get a 206 (partial content) response

Graham Dumpleton graham.dumpleton at gmail.com
Tue Jul 3 02:11:03 EDT 2007


On 03/07/07, yubing <trueice at gmail.com> wrote:
> BTW, how can I send a HTTP/1.0 response via a request handler ? the default
> is HTTP/1.1 :)
> thanks

What exactly do you mean? Are you simply wanting to disable keep
alive, or something more?

Please use reply-all to keep discussion in mailing list.

Graham

> On 7/3/07, Graham Dumpleton < graham.dumpleton at gmail.com> wrote:
> >
> > On 03/07/07, sliderw hotmail < sliderw at hotmail.com> wrote:
> > > I have this PythonHandler running on Apache 2.2.2 with mod_python 3.3.1:
> > >
> > > def handler(req):
> > >     req.headers_out["Content-Range"] = "bytes 0-9/1234"
> > >     req.set_content_length(10)
> > >     req.write("x" * 10)
> > >     return apache.HTTP_PARTIAL_CONTENT
> > >
> > > When I hit the URL, I expect the HTTP response code to be 206, but it is
> > > actually 200.
> > >
> > > Am I doing something wrong?
> >
> > Use:
> >
> >   def handler(req):
> >       req.status = apache.HTTP_PARTIAL_CONTENT
> >       req.headers_out["Content-Range"] = "bytes 0-9/1234"
> >       req.set_content_length(10)
> >       req.write("x" * 10)
> >       return apache.OK
> >
> > Calling req.write() flushes the response code and headers, so need to
> > supply status through req.status.
> >
> > Graham
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
>
>
>
> --
> truly yours
> ice


More information about the Mod_python mailing list