[Net-ssleay-devel] file uploads

Florian Ragwitz rafl at debian.org
Thu Aug 24 20:42:17 CEST 2006


On Thu, Aug 24, 2006 at 12:17:15PM -0600, MH wrote:
> This may be a common question, but is there a way to send file uploads
> using Net::SSLeay?

Yes, that's easily possible. File uploads are usually done using HTTP
POST. The most straightforward way to do so can be found in the
documentation:

  my ($page, $response, %reply_headers) = post_https($host, $port,
		  $path, make_form($param => $value, $param2 => $value2)));


Nevertheless I tend to suggest another way which uses Net::SSLeay only
for the SSL stuff and other modules for the HTTP part.

For this simple case I'd even suggest to not use Net::SSLeay at all (at
least not directly). LWP and friends offer you all you need to do that. 

Create an LWP useragent, an HTTP::Request instance using an https url
and make the useragent do the request. It'll automatically use a Module
which implements SSL for the https part. It'll chose between Net::SSL
(prefered unless the other one is already loaded) or IO::Socket::SSL,
which is based on Net::SSLeay. You won't need to care about the
internals here. Everything will work pretty much out of the box if one
of those modules is installed.


Regards,
Flo

-- 
BOFH excuse #140:
LBNC (luser brain not connected)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/net-ssleay-devel/attachments/20060824/ad9554c2/attachment.pgp


More information about the Net-ssleay-devel mailing list