Click here to get back home

libwww-SSL Post Issue

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
libwww-SSL Post Issue AZSTYX 08-02-2006
Get Chitika Premium
Posted by AZSTYX on August 2, 2006, 4:04 pm
Please log in for more thread options


Hello Perl Mongers!

Environment:
libwww-perl: 5.805
Crypt::SSLeay -- 0.51
OS: Solaris 8
Perl: 5.8.4

Issue Summary:
Issue with SSL POST operation.

I have a script that randomly fails against devices using HTTPS
example: I run the script 3 times aganst the same device and all works
ok. Then the next 3 runs fail. Then the next run works.
I receive these types of messages:
StatusLine[500 Server closed connection without sending any data back]
StatusLine[500 EOF]
When the script is run on our old dev server using libwww-perl: 5.79;
it seems to work everytime ok.
However, it randomly fails when using libwww-perl: 5.803 or 5.805.
Any suggestions on how to debug this?
I would appreciate any feedback at all!
:)


[code]
use LWP;
$ua = LWP::UserAgent->new;                                # create new user agent object
$url = "$baseUrl$urlConfigFile";                # create URL for getting config ascii
file

# set up HTTP REQUEST object
$httpReq = HTTP::Request->new(POST=>$url) ;                        # init Request object
$httpReq-> content_type('application/x-www-form-urlencoded') ;
$httpReq->content('DownloadFormat=ascii');                        # pass form variables
$httpReq-> authorization_basic($UID, $upassw) ;                # credentials
$strReq = $httpReq->as_string( );                # debug dump of Request object

print "\nThe Request:\n$strReq\n";
print "\n\nNow get the WSD config ascii file.\n";
print "Submitting browser request using url [$url].\n";

$httpResp = $ua->request($httpReq) ;                                # launch request

$statusLine = $httpResp->status_line();
$statusCode = $httpResp->code();
$statusMsg = $httpResp->message();
print "HTTP Response: StatusLine[$statusLine] Code[$statusCode]
Message[$statusMsg]\n";
if ($httpResp->is_success) {
        print "Request OK.\n";
}
else {
        die "Request failed.\n";
}
# ok, save content to file
open(FILEO, ">$asciiFile") || die "Error $! Could not open file
$asciiFile.\n";
print FILEO $httpResp->content;
close(FILEO);


[/code]

Example run:

<code>
./getwsd4.pl device-b 10.10.10.10 1900 admin admin
Processing devName [device-b] ip addr [10.10.10.10].
Using libwww-perl-5.803
Output file is [/export/ieapps/local/test/device-b.asc].
Base URL [https://10.10.10.10:1900]

The Request:
POST
https://10.10.10.10:1900/dynamic/File/Configuration/ReceivefromDevice
Authorization: Basic ZG16c3VwcDpmaXNINHNAIWU=
Content-Type: application/x-www-form-urlencoded

DownloadFormat=ascii



Now get the WSD config ascii file.
Submitting browser request using url
[https://10.10.10.10:1900/dynamic/File/Configuration/ReceivefromDevice].
HTTP Response: StatusLine[500 EOF] Code[500] Message[EOF]
Request failed.

</code>


Posted by Sisyphus on August 2, 2006, 7:33 pm
Please log in for more thread options



> Hello Perl Mongers!
>
> Environment:
> libwww-perl: 5.805
> Crypt::SSLeay -- 0.51
> OS: Solaris 8
> Perl: 5.8.4
>
> Issue Summary:
> Issue with SSL POST operation.
>
> I have a script that randomly fails against devices using HTTPS

It's not clear to me at precisely which point the script is failing. Is it
the call to new() ? or perhaps the $ua->request() ? or perhaps something
else ?

I think the first thing to do is to determine just where (in the script) the
rot sets in - by examining (immediately) the return values of such things as
the new() call.

Cheers,
Rob



Posted by AZSTYX on August 3, 2006, 6:21 pm
Please log in for more thread options



Sisyphus wrote:
> > Hello Perl Mongers!
> >
> > Environment:
> > libwww-perl: 5.805
> > Crypt::SSLeay -- 0.51
> > OS: Solaris 8
> > Perl: 5.8.4
> >
> > Issue Summary:
> > Issue with SSL POST operation.
> >
> > I have a script that randomly fails against devices using HTTPS
>
> It's not clear to me at precisely which point the script is failing. Is it
> the call to new() ? or perhaps the $ua->request() ? or perhaps something
> else ?
>

new() is a constructor....it has no return value; the first item with a
return status is the ->request which returns code 500.
> I think the first thing to do is to determine just where (in the script) the
> rot sets in - by examining (immediately) the return values of such things as
> the new() call.
>
> Cheers,
> Rob


Posted by Stephan Titard on August 4, 2006, 10:59 am
Please log in for more thread options



> new() is a constructor....it has no return value; the first item with a
> return status is the ->request which returns code 500.
>> I think the first thing to do is to determine just where (in the script) the
>> rot sets in - by examining (immediately) the return values of such things as
>> the new() call.
>>
>> Cheers,
>> Rob
>
not true... new returns $ua, isn'it?
a reference to your user agent

use LWP's debug mode
hth
--stephan

Similar ThreadsPosted
debugging issue with Net::FTP January 1, 2005, 2:36 pm
net::telnet pm issue February 9, 2007, 3:33 pm
Possible Issue with HTML::TreeBuilder? July 5, 2005, 6:49 am
Illegal Immigration, the Non-Issue of the Week........................ March 30, 2006, 10:52 pm
Sybase Stored Procedure issue June 14, 2006, 12:27 pm
ImageMagick and Xitami jpeg/bmp issue June 28, 2006, 9:40 am
CPAN conflict issue - CGI.pm vs ModPerl::Registry September 25, 2006, 12:42 pm
Net::Daemon t/forkm.t issue on Solaris 10 zone? November 10, 2006, 7:12 pm
Perl Win32::Setupsup installation issue April 2, 2007, 5:01 pm
How to solve the issue that \. is interpreted as any character in system("sed ... "); ? August 13, 2008, 4:44 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap