HTTP authentication for twisted.web.client.Agent (#5148)
Hi all, I'm looking into Twisted for some projects at work and believe I may be able to work on #5148 http://twistedmatrix.com/trac/ticket/5148 to add HTTP authentication to twisted.web.client.Agent, since I need at least Basic support (and will probably just add Digest too while I'm at it.) I took a look at the branch changeset http://twistedmatrix.com/trac/changeset?new=32269%40branches%2Fhttp-client-auth-5148-2&old=32267%40trunk and it looks like what's been done so far is the addition of a basic agent that will eventually talk to an as-of-yet-uninvented responder that will provide the authentication. Is there any more than this at this point? Did anyone have ideas that they felt would work better? I'm pretty new to actually using Twisted, but I think I get it. I may need some help making the end result fit well, since I'm discovering a lot of new things as I dig into the source. (Obviously, step 1 is bring that work up to the trunk… my merge attempt was a disaster, so I might just hand-apply the changes for now.) P.S. I'm zigg on IRC and Trac, but I'm not necessarily online or responsive most of the time.
On Apr 5, 2013, at 8:15 AM, Matt Behrens
Hi all,
I'm looking into Twisted for some projects at work and believe I may be able to work on #5148 http://twistedmatrix.com/trac/ticket/5148 to add HTTP authentication to twisted.web.client.Agent, since I need at least Basic support (and will probably just add Digest too while I'm at it.)
Great!
I took a look at the branch changeset http://twistedmatrix.com/trac/changeset?new=32269%40branches%2Fhttp-client-auth-5148-2&old=32267%40trunk and it looks like what's been done so far is the addition of a basic agent that will eventually talk to an as-of-yet-uninvented responder that will provide the authentication. Is there any more than this at this point? Did anyone have ideas that they felt would work better?
None off the top of my head. I reserve the right to raise some during review, but assuming the strategy you are describing works, it sounds fine :).
I'm pretty new to actually using Twisted, but I think I get it. I may need some help making the end result fit well, since I'm discovering a lot of new things as I dig into the source. (Obviously, step 1 is bring that work up to the trunk… my merge attempt was a disaster, so I might just hand-apply the changes for now.)
Feel free to ask for help early and often. The more specific the questions, the better, of course.
P.S. I'm zigg on IRC and Trac, but I'm not necessarily online or responsive most of the time.
I haven't seen you around much - make sure to hang out on #twisted-dev if you're talking about developing Twisted itself; #twisted is more a support channel for people *using* Twisted now. -glyph
On Fri, Apr 5, 2013 at 2:15 PM, Matt Behrens
Hi all,
I'm looking into Twisted for some projects at work and believe I may be able to work on #5148 http://twistedmatrix.com/trac/ticket/5148 to add HTTP authentication to twisted.web.client.Agent, since I need at least Basic support (and will probably just add Digest too while I'm at it.)
Hi Matt, After reading your mail I was surprised this wasn't already in Twisted, JP Calderone, the branch author, brought something to my attention that perhaps makes this a little harder than it seems: The body producer may not be restartable, which means you need to buffer a copy of the body in case it needs to be replayed. With 100 Continue support you might be able to work around that but then you need to be communicating with a server that supports that feature. Hopefully the currently-in-development tubes API https://twistedmatrix.com/trac/ticket/1956 will make it easier to accommodate this requirement (and if not then perhaps the tubes API *should* make something like this easier.) -Jonathan
On Apr 7, 2013, at 3:23 PM, Jonathan Jacobs
After reading your mail I was surprised this wasn't already in Twisted, JP Calderone, the branch author, brought something to my attention that perhaps makes this a little harder than it seems:
The body producer may not be restartable, which means you need to buffer a copy of the body in case it needs to be replayed. With 100 Continue support you might be able to work around that but then you need to be communicating with a server that supports that feature.
Right, yes, that would complicate matters. Clearly, I hadn't thought that all the way through yet.
Hopefully the currently-in-development tubes API https://twistedmatrix.com/trac/ticket/1956 will make it easier to accommodate this requirement (and if not then perhaps the tubes API *should* make something like this easier.)
I can see where it would, but given as that's almost certainly a bit out yet I think will see about building out my own agent for now, and see where that goes. Sorry if I got anyone's hopes up, but my original thought is looking a bit more out of my reach at the moment. ;-)
On Apr 7, 2013, at 3:23 PM, Jonathan Jacobs
The body producer may not be restartable, which means you need to buffer a copy of the body in case it needs to be replayed. With 100 Continue support you might be able to work around that but then you need to be communicating with a server that supports that feature.
One more thought on this that I just found--the auth-int variant of digest authentication appears to require the MD5 hash of the request body, if I'm reading it correctly. Thus, you'd need to know the hash while generating the Authorization header.
participants (3)
-
Glyph
-
Jonathan Jacobs
-
Matt Behrens