Planned obsolescence
--#--
Let Paul play for awhile. Run him against www.darkspell.com.
Modify the parameters and action tag and hit a few real
sites. (Try the Burger King site that Pete cut his teeth on.)
Just satisfy yourself that Paul can tackle HTTP posts like a real
browser. Because we're about to perform an SSL transplant on Paul's
guts -- the sockets.c module.
libraries.
The OpenSSL API is idiosyncratic, opaque and poorly or non-documented.
This is to say, don't expect to figure it out easily. I won't claim
to understand what's going on under the covers. But using some of the
demo code in the latest distributions (particularly
demos/bio/sconnect.c and demos/ssl/cli.cpp) and grepping through the
program source, I can at least put together a reliable SSL3/TLS1
connection.
First we'll modify sockets.c to make an SSL handshake
and connection over a TCP socket. OpenSSL has more recently defined
a BIO input/output structure to handle SSL connections and data
transfer.
The BIO's advantage is that it performs non-blocking i/o.
In other words, if the server on the other end is busy or not
responding, the BIO's method won't just sit and wait. It will
return and your code can chose to wait and try again or abandon
the connection.
For now, I'll just cover a simple SSL protocol on top of a standard
TCP/IP socket. Perhaps at a later date we'll get into BIO's.