cmilfo has asked for the wisdom of the Perl Monks concerning the following question:

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 ()

Replies are listed 'Best First'.
Re: Https Help
by blakem (Monsignor) on Oct 13, 2001 at 02:28 UTC
    Quick suggestion:

    Have you tried using the full hostname for mail007style something like mail007style.yourdomain.com?

    -Blake

Re: Https Help
by cmilfo (Hermit) on Nov 01, 2001 at 16:36 UTC
    I will answer my own question so that anyone super searching this might find it useful. The reason the code does not work is because the module Crypt::SSLeay is not installed. I do, however, have two other SSL type modules installed. The LWP is trying to use one of those and failing. That is the reason the "https is not a supported protocol" error does not show up. After installing Crypt::SSLeay on a fresh machine (as to make sure having the other SSL modules is not necessary), the program works fine. The cool thing is, the same code works on several different platforms. Perl Rocks!