mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-19 00:46:03 +01:00
client WebSocket fixes
This commit is contained in:
parent
364536c5fd
commit
5444ac07f5
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPRequest.h
|
||||
//
|
||||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPRequest.h#2 $
|
||||
// $Id: //poco/1.4/Net/include/Poco/Net/HTTPRequest.h#3 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTP
|
||||
@ -161,6 +161,7 @@ public:
|
||||
static const std::string COOKIE;
|
||||
static const std::string AUTHORIZATION;
|
||||
static const std::string PROXY_AUTHORIZATION;
|
||||
static const std::string UPGRADE;
|
||||
|
||||
protected:
|
||||
void getCredentials(const std::string& header, std::string& scheme, std::string& authInfo) const;
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPClientSession.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/Net/src/HTTPClientSession.cpp#10 $
|
||||
// $Id: //poco/1.4/Net/src/HTTPClientSession.cpp#11 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPClient
|
||||
@ -223,7 +223,7 @@ std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request)
|
||||
#endif
|
||||
request.write(*_pRequestStream);
|
||||
}
|
||||
else if (request.getMethod() != HTTPRequest::HTTP_PUT && request.getMethod() != HTTPRequest::HTTP_POST)
|
||||
else if ((request.getMethod() != HTTPRequest::HTTP_PUT && request.getMethod() != HTTPRequest::HTTP_POST) || request.has(HTTPRequest::UPGRADE))
|
||||
{
|
||||
Poco::CountingOutputStream cs;
|
||||
request.write(cs);
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPRequest.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/Net/src/HTTPRequest.cpp#3 $
|
||||
// $Id: //poco/1.4/Net/src/HTTPRequest.cpp#4 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTP
|
||||
@ -61,6 +61,7 @@ const std::string HTTPRequest::HOST = "Host";
|
||||
const std::string HTTPRequest::COOKIE = "Cookie";
|
||||
const std::string HTTPRequest::AUTHORIZATION = "Authorization";
|
||||
const std::string HTTPRequest::PROXY_AUTHORIZATION = "Proxy-Authorization";
|
||||
const std::string HTTPRequest::UPGRADE = "Upgrade";
|
||||
|
||||
|
||||
HTTPRequest::HTTPRequest():
|
||||
@ -118,19 +119,7 @@ void HTTPRequest::setHost(const std::string& host)
|
||||
|
||||
void HTTPRequest::setHost(const std::string& host, Poco::UInt16 port)
|
||||
{
|
||||
std::string value;
|
||||
if (host.find(':') != std::string::npos)
|
||||
{
|
||||
// IPv6 address
|
||||
value.append("[");
|
||||
value.append(host);
|
||||
value.append("]");
|
||||
}
|
||||
else
|
||||
{
|
||||
value.append(host);
|
||||
}
|
||||
|
||||
std::string value(host);
|
||||
if (port != 80 && port != 443)
|
||||
{
|
||||
value.append(":");
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// WebSocket.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/Net/src/WebSocket.cpp#7 $
|
||||
// $Id: //poco/1.4/Net/src/WebSocket.cpp#8 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: WebSocket
|
||||
@ -224,7 +224,7 @@ WebSocketImpl* WebSocket::completeHandshake(HTTPClientSession& cs, HTTPResponse&
|
||||
std::string accept = response.get("Sec-WebSocket-Accept", "");
|
||||
if (accept != computeAccept(key))
|
||||
throw WebSocketException("Invalid or missing Sec-WebSocket-Accept header in handshake response", WS_ERR_NO_HANDSHAKE);
|
||||
return new WebSocketImpl(static_cast<StreamSocketImpl*>(cs.socket().impl()), true);
|
||||
return new WebSocketImpl(static_cast<StreamSocketImpl*>(cs.detachSocket().impl()), true);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user