Example of SSL socket code.
#ifndef DEBUG
#define DEBUG
#endif
#include <config.h>
#include <stdio.h>
using namespace UCOMMON_NAMESPACE;
int main(int argc, char **argv)
{
const char *proto = "80";
secure::client_t ctx = NULL;
proto = "443";
ctx = secure::client();
}
printf("protocol %s\n", proto);
if(ctx)
printf("ctx %p %d\n", (void *)ctx, ctx->err());
ssl.open("www.google.com", proto);
printf("open %d\n", ssl.is_open());
ssl.putline("GET /\r\n\r\n");
ssl.flush();
char buf[256];
while(!ssl.eof()) {
ssl.getline(buf, sizeof(buf));
printf("%s\n", buf);
}
ssl.close();
}