Note that there are some explanatory texts on larger screens.

plurals
  1. POWide character in subroutine entry when using LWP with NTLM authentication
    text
    copied!<p>I'm trying to get LWP to work against an IIS server configured with NTLM authentication. When NTLM authentication is turned off on the server, the code work fine, so I assume that the only problem here is the NTLM authentication.</p> <p>So far, I have the following:</p> <pre><code>my $ua = LWP::UserAgent-&gt;new(agent =&gt; "whatever", timeout =&gt; $timeout, keep_alive =&gt; 1); $ua-&gt;credentials('hostname:80', '', $username, $password); my $hdr = HTTP::Headers-&gt;new("Content-Type" =&gt; "text/xml; charset=UTF-8", "SOAPAction" =&gt; "\"whatever\""); my $req = HTTP::Request-&gt;new("POST" =&gt; $url, $hdr, encode_utf8($post)); $res = $ua-&gt;request($req); </code></pre> <p>If I turn on debugging, I get the following messages:</p> <pre><code>LWP::UserAgent::new: () LWP::UserAgent::request: () LWP::UserAgent::send_request: POST http://hostname LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::http::request: Keep the http connection to hostname:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Ntlm::authenticate: authenticate() has been called Use of uninitialized value in exists at /usr/lib/perl5/vendor_perl/5.8.5/LWP/UserAgent.pm line 560. Use of uninitialized value in hash element at /usr/lib/perl5/vendor_perl/5.8.5/LWP/UserAgent.pm line 561. LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication [Thu Apr 12 13:55:28 2012] [error] Wide character in subroutine entry at /usr/lib/perl5/site_perl/5.8.5/Authen/NTLM.pm line 346.\n LWP::Protocol::collect: read 625 bytes LWP::UserAgent::request: Simple response: Internal Server Error </code></pre> <p>Trying to access the same URL with <code>wget</code> works fine. The documentation for <a href="https://metacpan.org/module/MIME%3a%3aBase64" rel="nofollow"><code>MIME::Base64</code></a> says that the encode function will croak with <code>Wide character in subroutine entry</code> if $bytes contains characters with code above 255.</p> <p>Am I missing something essential here, or could this be a bug in <a href="https://metacpan.org/module/Authen%3a%3aNTLM" rel="nofollow"><code>Authen::NTLM</code></a>?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload