[Web-SIG] Re: client-side http
gstein at lyra.org
Sat Nov 1 16:19:25 EST 2003
On Sat, Nov 01, 2003 at 12:50:25PM +0000, John J Lee wrote:
> On Fri, 31 Oct 2003, Greg Stein wrote:
> > On Fri, Oct 31, 2003 at 04:34:02PM +0000, John J Lee wrote:
> > > He was talking about the server side!
> > No, Greg Ward was talking about an http client. Otherwise, he would not
> > have mentioned PEP 268.
> OK. Personally, I don't think the client-side stuff particularly well
> bundled in with the server-side stuff, but I guess I'm not really
Agreed. Separation between client and server should be clear in the
> > more than "fetch the contents of this URL."
> Yes. And simultaneously far less, depending on how you look at it...
Yup. "Move this data from here to there. Thanks." Not a lot to it in some
> > > > I have an entirely separate module for the WebDAV stuff.
> > >
> > > How should it be integrated (if at all), in your opinion (assuming you
> > > want it in the standard library)?
> > See PEP 268.
> OK, I see it won't be part of httplib, but a separate module httpx. As
> long as you can send one HTTP request, and get back one HTTP response, and
> know that httplib isn't going to "swallow" any HTTP responses, no problem.
Agreed; sending in a response and getting nothing back would be... weird.
That said, the http code *could* automatically resend a request with new
credentials. It already attempts to resend when it sees a broken pipe (the
server closed its connection; usually from a timeout).
> But I see your PEP doesn't break that simple way of working (in fact I
> don't know why I was worried about that in the first place...). Is there
> any reason not to arrange your stuff in such a a way as to allow
> reimplementing a maximal part of urllib2's proxy / auth handlers in terms
> of your code?
The hope was to refactor all the authentication, proxy handling, and
proxy-auth handling down into "httpx" ("httplib extensions"). And then,
yes, urllib(2) would be reimplemented in terms of httpx.
> But perhaps I'm too concerned about the simplicity of the
> non-swallowing nature of the current httplib, in these particular cases of
> authentication and proxying -- maybe in practice that can be given up
> without ill-effects (not by changing httplib, but by deprecating the
> auth/proxy code in urllib2 (and urllib too I guess)). Not sure.
Yup. I wanted to leave httplib alone, or with just minimal changes, and
then to layer on new HTTP handling code via httpx. By refactoring that
stuff out of urllib, then it could be used for any HTTP code. For example,
if you wanted to write some GUI that interacted with a server via WebDAV,
then you'd be able to use cool auth, proxies, etc for those interactions.
> Where is this proxy / auth code? davlib?
I started on the work within the Python repository's sandbox. See
/nondist/sandbox/Lib/httpx.py. And holy crap... I don't remember writing
that much code. Woah!
It is mostly auth stuff right now. I never got to the proxy work, nor to
the DAV integration. A copy of my davlib.py is sitting in that sandbox
Greg Stein, http://www.lyra.org/
More information about the Web-SIG