in reply to Adding cookies into headers of LWP request

Thank you very much McA for the example.

However when I tried this in my code, it seems the ASP sessionID is still missing in the cookie.

What's more, the response was an html page instead of the real data that it should be.

The web page it access seems needs two parts in the cookie, one is the ASP sessionID, the other is the mail address like thing as you could see from the cookie content.

Is the cookie not correctly accept when I put it into the GET request?

345 $dl_res = $ua->request( 346 GET $req_url, 347 Cookie => 'ASP.NET_SessionId=xaduwqpg5ocnenpb0l0xsq4d +; GMProfileInfo=e=xxxx@banana.com' 348 );
The real request it sent by looking from the debugger (the ASP Session +ID is not showing up but it should): '_request' => bless( { '_content' => '', '_uri' => bless( do{\(my $o = 'http://www.xxxx.xxx/pages/profil +e.aspx/pages/profile.aspx?src=http://xxxx.xxxx.xxx/protectedfiledownl +oad.aspx?dlfile=data_bulk/file.txt')}, 'URI::http' ), '_headers' => bless( { 'cookie2' => '$Version="1"', 'user-agent' => 'libwww-perl/5.804', 'cookie' => 'GMProfileInfo=e=xxxx@banana.com&i=536' }, 'HTTP::Headers' ), '_method' => 'GET' }, 'HTTP::Request' )

Replies are listed 'Best First'.
Re^2: Adding cookies into headers of LWP request
by Loops (Curate) on Sep 25, 2014 at 16:12 UTC

    Things don't add up. Where for instance is that &i=536 in the cookie coming from?

    Since this all works here, i suspect that you might be hitting a bug in the version of libwww-perl you're using (5.804). For instance Bug 47667, has only been fixed since 5.815. Doesn't look like that actually applies in this case, but trying a newer version is worth a go.