Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

libwww-SSL Post Issue

Status
Not open for further replies.

azstyx

Programmer
Oct 9, 2002
40
0
0
US
Hello Perl Mongers!

Environment:
lib 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 lib 5.79; it seems to work everytime ok.
However, it randomly fails when using lib 5.803 or 5.805.
Any suggestions on how to debug this?
I would appreciate any feedback at all!
:)


Code:
$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-[URL unfurl="true"]www-form-urlencoded')[/URL] ;
$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);

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 lib[URL unfurl="true"]www-perl-5.803[/URL]
Output file is [/export/ieapps/local/test/device-b.asc].
Base URL [[URL unfurl="true"]https://10.10.10.10:1900[/URL]]

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

DownloadFormat=ascii



Now get the WSD config ascii file.
Submitting browser request using url [[URL unfurl="true"]https://10.10.10.10:1900/dynamic/File/Configuration/ReceivefromDevice[/URL]].
HTTP Response: StatusLine[500 EOF] Code[500] Message[EOF]
Request failed.
 
I'd try by passing a var into the request, and have the recieving script use that for outputting in logs in terms of time started request, time finished request, also have a look at the crontab for the box to make sure there's no competition for resources at a similar time.

If it's a crontab scheduling issue, at least your'll know what it is, no real way of fixing it

maybe even include a tasklist in the recieving script to see if there's anything running when it fails, and not running when it passes.

You may need to look into Time::HiRes on for finer granularity ..

HTH

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top