mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 08:31:43 +02:00
NetSSL library refactoring
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPClientSession.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Net/src/HTTPClientSession.cpp#20 $
|
||||
// $Id: //poco/Main/Net/src/HTTPClientSession.cpp#21 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPClient
|
||||
@@ -187,7 +187,7 @@ std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request)
|
||||
if (!request.has(HTTPRequest::HOST))
|
||||
request.setHost(_host, _port);
|
||||
if (!_proxyHost.empty())
|
||||
request.setURI(getHostInfo() + request.getURI());
|
||||
request.setURI(proxyRequestPrefix() + request.getURI());
|
||||
_reconnect = keepAlive;
|
||||
_expectResponseBody = request.getMethod() != HTTPRequest::HTTP_HEAD;
|
||||
if (request.getChunkedTransferEncoding())
|
||||
@@ -203,7 +203,7 @@ std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request)
|
||||
_pRequestStream = new HTTPFixedLengthOutputStream(*this, request.getContentLength() + cs.chars());
|
||||
request.write(*_pRequestStream);
|
||||
}
|
||||
else if (request.getMethod() == HTTPRequest::HTTP_GET || request.getMethod() == HTTPRequest::HTTP_HEAD)
|
||||
else if (request.getMethod() != HTTPRequest::HTTP_PUT && request.getMethod() != HTTPRequest::HTTP_POST)
|
||||
{
|
||||
Poco::CountingOutputStream cs;
|
||||
request.write(cs);
|
||||
@@ -296,7 +296,7 @@ void HTTPClientSession::reconnect()
|
||||
}
|
||||
|
||||
|
||||
std::string HTTPClientSession::getHostInfo() const
|
||||
std::string HTTPClientSession::proxyRequestPrefix() const
|
||||
{
|
||||
std::string result("http://");
|
||||
result.append(_host);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerResponseImpl.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Net/src/HTTPServerResponseImpl.cpp#6 $
|
||||
// $Id: //poco/Main/Net/src/HTTPServerResponseImpl.cpp#7 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@@ -154,7 +154,7 @@ void HTTPServerResponseImpl::redirect(const std::string& uri)
|
||||
setStatusAndReason(HTTPResponse::HTTP_FOUND);
|
||||
set("Location", uri);
|
||||
|
||||
_pStream = new HTTPOutputStream(_session);
|
||||
_pStream = new HTTPHeaderOutputStream(_session);
|
||||
write(*_pStream);
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPSession.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/HTTPSession.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/HTTPSession.cpp#14 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTP
|
||||
@@ -214,4 +214,19 @@ void HTTPSession::setException(const Poco::Exception& exc)
|
||||
}
|
||||
|
||||
|
||||
StreamSocket HTTPSession::detachSocket()
|
||||
{
|
||||
StreamSocket oldSocket(_socket);
|
||||
StreamSocket newSocket;
|
||||
_socket = newSocket;
|
||||
return oldSocket;
|
||||
}
|
||||
|
||||
|
||||
void HTTPSession::attachSocket(const StreamSocket& socket)
|
||||
{
|
||||
_socket = socket;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// IPAddress.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Net/src/IPAddress.cpp#20 $
|
||||
// $Id: //poco/Main/Net/src/IPAddress.cpp#21 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: NetCore
|
||||
@@ -324,7 +324,7 @@ public:
|
||||
}
|
||||
}
|
||||
if (i > 0) result.append(":");
|
||||
if (i < 8) NumberFormatter::appendHex(result, ntohs(words[i++])));
|
||||
if (i < 8) NumberFormatter::appendHex(result, ntohs(words[i++]));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SocketImpl.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/SocketImpl.cpp#3 $
|
||||
// $Id: //poco/Main/Net/src/SocketImpl.cpp#26 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Sockets
|
||||
@@ -338,6 +338,7 @@ int SocketImpl::available()
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
|
||||
{
|
||||
#if defined(POCO_HAVE_FD_POLL)
|
||||
@@ -804,9 +805,8 @@ void SocketImpl::ioctl(int request, void* arg)
|
||||
}
|
||||
|
||||
|
||||
void SocketImpl::setSockfd(poco_socket_t aSocket)
|
||||
void SocketImpl::reset(poco_socket_t aSocket)
|
||||
{
|
||||
poco_assert(sockfd() == POCO_INVALID_SOCKET);
|
||||
_sockfd = aSocket;
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// StreamSocket.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/StreamSocket.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/StreamSocket.cpp#9 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Sockets
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// StreamSocketImpl.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/StreamSocketImpl.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/StreamSocketImpl.cpp#8 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Sockets
|
||||
@@ -62,7 +62,8 @@ int StreamSocketImpl::sendBytes(const void* buffer, int length, int flags)
|
||||
int remaining = length;
|
||||
while (remaining > 0)
|
||||
{
|
||||
int n = SocketImpl::sendBytes(p, remaining, flags);
|
||||
int n = SocketImpl::sendBytes(p, remaining, flags);
|
||||
if (n <= 0) return n;
|
||||
p += n;
|
||||
remaining -= n;
|
||||
}
|
||||
|
Reference in New Issue
Block a user