mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-18 00:15:27 +01:00
performance improvements from 1.3.4
This commit is contained in:
parent
64a7203a0d
commit
717dd9cf45
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPMessage.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/HTTPMessage.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/HTTPMessage.h#3 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTP
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerRequestImpl.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/HTTPServerRequestImpl.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/HTTPServerRequestImpl.h#4 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@ -43,6 +43,7 @@
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/HTTPServerRequest.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
#include <istream>
|
||||
|
||||
|
||||
@ -96,11 +97,11 @@ protected:
|
||||
static const std::string EXPECT;
|
||||
|
||||
private:
|
||||
HTTPServerResponse& _response;
|
||||
std::istream* _pStream;
|
||||
HTTPServerParams* _pParams;
|
||||
SocketAddress _clientAddress;
|
||||
SocketAddress _serverAddress;
|
||||
HTTPServerResponse& _response;
|
||||
std::istream* _pStream;
|
||||
Poco::AutoPtr<HTTPServerParams> _pParams;
|
||||
SocketAddress _clientAddress;
|
||||
SocketAddress _serverAddress;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPCookie.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/Net/src/HTTPCookie.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/HTTPCookie.cpp#8 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTP
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPMessage.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/HTTPMessage.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/HTTPMessage.cpp#8 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTP
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPRequest.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/HTTPRequest.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/HTTPRequest.cpp#13 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTP
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerConnection.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/HTTPServerConnection.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/HTTPServerConnection.cpp#11 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@ -43,6 +43,7 @@
|
||||
#include "Poco/Net/HTTPServerParams.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
#include <memory>
|
||||
|
||||
|
||||
@ -79,6 +80,8 @@ void HTTPServerConnection::run()
|
||||
HTTPServerResponseImpl response(session);
|
||||
HTTPServerRequestImpl request(response, session, _pParams);
|
||||
|
||||
Poco::Timestamp now;
|
||||
response.setDate(now);
|
||||
response.setVersion(request.getVersion());
|
||||
response.setKeepAlive(_pParams->getKeepAlive() && request.getKeepAlive() && session.canKeepAlive());
|
||||
if (!server.empty())
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerRequestImpl.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/HTTPServerRequestImpl.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/HTTPServerRequestImpl.cpp#4 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@ -57,12 +57,8 @@ const std::string HTTPServerRequestImpl::EXPECT("Expect");
|
||||
HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponse& response, HTTPServerSession& session, HTTPServerParams* pParams):
|
||||
_response(response),
|
||||
_pStream(0),
|
||||
_pParams(pParams)
|
||||
_pParams(pParams, true)
|
||||
{
|
||||
poco_check_ptr (_pParams);
|
||||
|
||||
_pParams->duplicate();
|
||||
|
||||
HTTPHeaderInputStream hs(session);
|
||||
read(hs);
|
||||
|
||||
@ -83,7 +79,6 @@ HTTPServerRequestImpl::HTTPServerRequestImpl(HTTPServerResponse& response, HTTPS
|
||||
|
||||
HTTPServerRequestImpl::~HTTPServerRequestImpl()
|
||||
{
|
||||
_pParams->release();
|
||||
delete _pStream;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerResponseImpl.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/HTTPServerResponseImpl.cpp#3 $
|
||||
// $Id: //poco/Main/Net/src/HTTPServerResponseImpl.cpp#6 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@ -68,8 +68,6 @@ HTTPServerResponseImpl::HTTPServerResponseImpl(HTTPServerSession& session):
|
||||
_session(session),
|
||||
_pStream(0)
|
||||
{
|
||||
Timestamp now;
|
||||
setDate(now);
|
||||
}
|
||||
|
||||
|
||||
@ -128,7 +126,7 @@ void HTTPServerResponseImpl::sendFile(const std::string& path, const std::string
|
||||
Poco::FileInputStream istr(path);
|
||||
if (istr.good())
|
||||
{
|
||||
_pStream = new HTTPOutputStream(_session);
|
||||
_pStream = new HTTPHeaderOutputStream(_session);
|
||||
write(*_pStream);
|
||||
StreamCopier::copyStream(istr, *_pStream);
|
||||
}
|
||||
@ -143,7 +141,7 @@ void HTTPServerResponseImpl::sendBuffer(const void* pBuffer, std::size_t length)
|
||||
setContentLength(static_cast<int>(length));
|
||||
setChunkedTransferEncoding(false);
|
||||
|
||||
_pStream = new HTTPOutputStream(_session);
|
||||
_pStream = new HTTPHeaderOutputStream(_session);
|
||||
write(*_pStream);
|
||||
_pStream->write(static_cast<const char*>(pBuffer), static_cast<std::streamsize>(length));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// MessageHeader.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/MessageHeader.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/MessageHeader.cpp#13 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Messages
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// NameValueCollection.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/NameValueCollection.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/NameValueCollection.cpp#8 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Messages
|
||||
|
Loading…
x
Reference in New Issue
Block a user