views:

163

answers:

3

I need to send an HTTP request to a server using HTTPS on Linux using plain sockets. Is there a way to do this?

Code is appreciated.

Thanks

+4  A: 

You can encrypt the traffic with the OpenSSL library. Here is an example HTTP client: http://www.w3.org/Library/src/HTTP.c

stribika
that sounds good. however I can't use external libs and certainly not a gpl one.
wonderer
@wonderer: OpenSSL isn't GPL.
ephemient
OpenSSL license is it's own animal: http://www.openssl.org/source/license.html
joeslice
ok, thanks. I'll see what I can do
wonderer
A: 

I think you'll need to use an SSL library, such as OpenSSL (which should be available on nearly every Linux system, or trivially available if not installed by default). AFAIK, there is no way to do SSL with only a absic Berkeley-style sockets implementation.

rmeador
There clearly IS a way to do SSL with only Berkeley sockets; it's just that it requires that you implement the protocol and crypto yourself, which is silly (as it would be very difficult to get right, harder to get it right and secure)
MarkR
+3  A: 

You need an implementation of TLS (Transport Layer Security, formerly known as Secure Sockets Layer, specified in RFC 5246), whether it be OpenSSL, GnuTLS, Ajisai, yaSSL, NSS, or your own implementation (not recommended).

ephemient
I nominate "(not recommended)" for SO Understatement Of The Year.
caf