LWP::UserAgent and proxies with NTLM handshake
- From: A Parker <dontjudgemyadd@xxxxxxxxx>
- Date: Thu, 12 Jan 2012 09:35:39 -0800 (PST)
I'm having trouble overcoming and figuring out how to get through a
proxy using LWP::UserAgent (with or without WWW::Mechanize). Bare
I've found a myriad of examples highlighting *->credentials(...) or *-
proxy(['http'],proxy) in combination with the packageLWP::Authen::Ntlm but can't find a robust working solution.
For illustrative purposes consider two local network addresses:
When I manually configure my proxy settings in firefox, for example, I
can explicitly require use through proxydom
I can browse from the minute I open firefox and don't have to enter a
username or password.
(see the Request/Response headers from Tamper Data)
AAAAAAAAAAo/x9qQ8AZfAGU/s400/m1-p1.jpg" height="94" width="400" /></a>
AAAAAAAAAAk/Y2_MiFmgCTA/s400/m1-p2.jpg" height="93" width="400" /></a>
AAAAAAAAAA0/_QV6QPaWD5A/s400/m1-p3.jpg" height="129" width="400" /></
Alternatively, when I have proxy settings set to "automatically
detect", the first http request I initiate routes me to a pop up box
asking to please enter the username and password for http://authorizedom.
I then enter my username and password and can browse without further
interruptions. This process redirects me to authorizedom for
validation than I'm redirected back to the requested website.
(see Request/Response headers from Tamper Data)
AAAAAAAAAB4/_pfRRlvzzJg/s400/m2-p0.jpg" height="77" width="400" /></a>
AAAAAAAAAA4/6tCi3lXNBLY/s400/m2-p2.jpg" height="87" width="400" /></a>
AAAAAAAAABE/n11HUoBKIP8/s400/m2-p3.jpg" height="97" width="400" /></a>
AAAAAAAAABU/QRm-ihTyspc/s400/m2-p4.jpg" height="105" width="400" /></
Ideally, I'd like to simulate the first method with LWP::UserAgent,
but I believe there is an NTLM handshake and am unsure whether I use/
what I use for/if I use my username and password.
Is anyone knowledgeable about what is occurring automatically in
firefox that I don't understand that lets it walk through the NTLM
handshake without a username/password? I have logged into a Win 7
machine with that username and password, but this is a copy of
portable firefox, so I don't think it could attain my pasword to send
to the server. How would I use LWP::UserAgent to simulate this?
I've actually managed to get this to work (in a fashion).
Given authorizedom as the redirecting server I do a combination of the
#follow redirects manually from header info.
Problem here is I actually get redirected to 1 of 2 authorizedom
servers, and though I change all the above parameters accordingly, I
can only succeed in reaching the desired page with authorizedom-02 but
authorizedom-01 tells me my credentials are wrong. So, sometimes my
agent passes through and sometimes it doesn't depending on which
authroizedom I'm routed to for a reason I can't figure out.
Any help would be greatly appreciated and I can provide any dumped
headers I receive along the way if they're useful for everyone, but if
anyone knows what’s going on in method 1 such that I can skip the
username/password all together, that'd be wonderful.