More work on SSL support.
You can now accept SSL connections using SSLListeners, and then send/receive data through the associated SSLSocket. HttpSocket's now support both HTTP and HTTPS, using templates: fr::HttpSocket<fr::SSLSocket> https_socket; fr::HttpSocket<fr::TcpSocket> http_socket;
This commit is contained in:
@@ -8,27 +8,4 @@
|
||||
namespace fr
|
||||
{
|
||||
|
||||
Socket::Status HttpSocket::receive(Http &request)
|
||||
{
|
||||
//Create buffer to receive_request the request
|
||||
std::string buffer(2048, '\0');
|
||||
|
||||
//Receive the request
|
||||
size_t received;
|
||||
Socket::Status status = receive_raw(&buffer[0], buffer.size(), received);
|
||||
if(status != Socket::Success)
|
||||
return status;
|
||||
buffer.resize(received);
|
||||
|
||||
//Parse it
|
||||
request.parse(buffer);
|
||||
|
||||
return Socket::Success;
|
||||
}
|
||||
|
||||
Socket::Status HttpSocket::send(const Http &request)
|
||||
{
|
||||
std::string data = request.construct(remote_address);
|
||||
return send_raw(&data[0], data.size());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user