http协议是不安全的,是明文传输的,因此还需要结合openssl实现安全的https协议。启用了HTTPS协议后,服务器和浏览器两端自动对报文进行加密解密。做到安全传输。
在goahead-openssl.c中结合openssl库封装了安全的读写函数。
一、SSL读函数
/*
Read from a connection. Return the number of bytes read if successful. This may be less than the requested "len" and
may be zero. Return -1 for errors or EOF. Distinguish between error and EOF via socketEof().
*/
static ssize websRead(Webs *wp, char *buf, ssize len)
{
assert(wp);
assert(buf);
assert(len > 0)