I have a
quick question. Quick in that, I need the answer quickly. I've read quite a few documents concerning my problem, and have even used the Super Search. So far, I've struck out. My problem:
I am trying to upload files via https. I am using LWP (code below). I think I've installed everything I need (SSL wise). The code calls a CGI that accepts file uploads (I can supply code, if needed). The CGI writes the file down to disk. The server I am hitting has http turned off and https turned on. When I load the server CGI on a machine running http and change the url, the script works fine. I've called the method
$ua->is_protocol_supported. LWP tells me that https is supported. It returns LWP::Protocols::https. There is no proxy in between the two servers. I have a web page, form version that works fine via https (the page resides on my local machine). So, I've kind of narrowed it down to it maybe being an SSL certificate issue or that I'm just doing something incorrectly. Also, how are certificates handled in LWP; I've found little to no documentation concerning certificates. I have the code and output attached below. I receive the save Internal Server Error each time I try to hit the machine. Another oddity, the error is not being written to the apache error log. Please let me know if you have any questions! Thank you for your help!
#!/usr/bin/perl -w
use HTTP::Request::Common;
use LWP::UserAgent;
LWP::Debug::level('+');
# Create a user agent object
my $ua = LWP::UserAgent->new() or die "$!\n";
# Set the request parameters
my $clientfile = '/home/cmilfo/MINE/cmilfo.pubkey';
my $serverfile = 'cmilfo.pubkey';
my $user = 'cmilfo';
# Create a request
my $response =
$ua->request(POST 'https://mail007style/pubkeys/upload.pl',
Content_Type => 'form-data',
Content => [ clientfile => ["$clientfile"],
serverfile => $serverfile,
user => $user,
]
);
if($response->is_success) {
print STDOUT $response->content;
} else {
print STDOUT "request failed: ", $response->status_line, "\n";
}
__END__
The output looks like this:
LWP::UserAgent::new: ()
LWP::MediaTypes::read_media_types: Reading media types from /usr/lib/p
+erl5/site_perl/5.6.1/LWP/media.types
LWP::UserAgent::request: ()
LWP::UserAgent::simple_request: POST https://mail007style/pubkeys/uplo
+ad.pl
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::UserAgent::request: Simple response: Internal Server Error
request failed: 500 Can't connect to mail007style:443 ()
In reply to Https Help
by cmilfo
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.