I'm currently experimenting with LWP, and have run into something of a major stumbling block - specifically, we have webwasher and a proxy on our outbound connections.
If I try a simple 'get' request using LWP, I don't get a failure, I get a page that informs me that (the URL) "has been blocked by Webwasher because you have not been authorized and authorization is required."
Now, what I'm having trouble with now, is that I can't figure out how to go to the state of 'authorized' - I've tried configuring a proxy, proxy user, proxy pass. This doesn't work.
use LWP::UserAgent; use HTTP::Request::Common; my $url = 'http://www.bbc.co.uk/'; # Set up the ntlm client and then the base64 encoded ntlm handshake m +essage my $ua = new LWP::UserAgent(keep_alive=>1); #$ua -> proxy ('http', "http://my_domain\\myuser:mypass@myproxy:8080" + ); $ua -> proxy ('http', "http://myproxy:8080" ); $ua->credentials('www.bbc.co.uk:80', '', "mydomain\\myuser", 'mypass' +); $ua->credentials('myproxy:8080', '', "mydomain\\myuser", 'mypass'); $request = GET $url; print "--Performing request now...-----------\n"; $response = $ua->request($request); print "--Done with request-------------------\n"; if ($response->is_success) {print "It worked!->" . $response->code . +"\n"} else {print "It didn't work!->" . $response->code . "\n"}
This doesn't seem to help - I still get a '407 authorization required' although I can still request web pages through IE or Firefox. Firefox does request a username and password, and the best I can come up with is that I need to use NTLM authentication - but I can't seem to figure out how, and was wondering if anyone could shed some further light? (for bonus points, give me a hint as to how I get the CPAN module working again :))
I'm using Activestate Perl, on W2K3 which makes things a little more interesting.
That code snippet is right out of the LWP::Authen::NTLM module, although I couldn't quite figure out if I need to be setting credentials to the proxy server, or to the target site. Proxy is autoconfigured normally, but I've dug out the actual IP/Port to be using manually. I'm pretty sure this _used_ to work, but think they've upgraded the proxy software.

In reply to Proxy authentication using NTLM? by Preceptor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.