Skip to content

Commit 717dd9c

Browse files
committed
performance improvements from 1.3.4
1 parent 64a7203 commit 717dd9c

10 files changed

Lines changed: 423 additions & 426 deletions

‎Net/include/Poco/Net/HTTPMessage.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// HTTPMessage.h
33
//
4-
// $Id: //poco/svn/Net/include/Poco/Net/HTTPMessage.h#2 $
4+
// $Id: //poco/Main/Net/include/Poco/Net/HTTPMessage.h#3 $
55
//
66
// Library: Net
77
// Package: HTTP
Lines changed: 146 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,146 @@
1-
//
2-
// HTTPServerRequestImpl.h
3-
//
4-
// $Id: //poco/svn/Net/include/Poco/Net/HTTPServerRequestImpl.h#2 $
5-
//
6-
// Library: Net
7-
// Package: HTTPServer
8-
// Module: HTTPServerRequestImpl
9-
//
10-
// Definition of the HTTPServerRequestImpl class.
11-
//
12-
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
13-
// and Contributors.
14-
//
15-
// Permission is hereby granted, free of charge, to any person or organization
16-
// obtaining a copy of the software and accompanying documentation covered by
17-
// this license (the "Software") to use, reproduce, display, distribute,
18-
// execute, and transmit the Software, and to prepare derivative works of the
19-
// Software, and to permit third-parties to whom the Software is furnished to
20-
// do so, all subject to the following:
21-
//
22-
// The copyright notices in the Software and this entire statement, including
23-
// the above license grant, this restriction and the following disclaimer,
24-
// must be included in all copies of the Software, in whole or in part, and
25-
// all derivative works of the Software, unless such copies or derivative
26-
// works are solely in the form of machine-executable object code generated by
27-
// a source language processor.
28-
//
29-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31-
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
32-
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
33-
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
34-
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35-
// DEALINGS IN THE SOFTWARE.
36-
//
37-
38-
39-
#ifndef Net_HTTPServerRequestImpl_INCLUDED
40-
#define Net_HTTPServerRequestImpl_INCLUDED
41-
42-
43-
#include "Poco/Net/Net.h"
44-
#include "Poco/Net/HTTPServerRequest.h"
45-
#include "Poco/Net/SocketAddress.h"
46-
#include <istream>
47-
48-
49-
namespace Poco {
50-
namespace Net {
51-
52-
53-
class HTTPServerSession;
54-
class HTTPServerParams;
55-
56-
57-
class Net_API HTTPServerRequestImpl: public HTTPServerRequest
58-
/// This subclass of HTTPServerRequest is used for
59-
/// representing server-side HTTP requests.
60-
///
61-
/// A HTTPServerRequest is passed to the
62-
/// handleRequest() method of HTTPRequestHandler.
63-
{
64-
public:
65-
HTTPServerRequestImpl(HTTPServerResponse& response, HTTPServerSession& session, HTTPServerParams* pParams);
66-
/// Creates the HTTPServerRequestImpl, using the
67-
/// given HTTPServerSession.
68-
69-
~HTTPServerRequestImpl();
70-
/// Destroys the HTTPServerRequestImpl.
71-
72-
std::istream& stream();
73-
/// Returns the input stream for reading
74-
/// the request body.
75-
///
76-
/// The stream is valid until the HTTPServerRequestImpl
77-
/// object is destroyed.
78-
79-
bool expectContinue() const;
80-
/// Returns true if the client expects a
81-
/// 100 Continue response.
82-
83-
const SocketAddress& clientAddress() const;
84-
/// Returns the client's address.
85-
86-
const SocketAddress& serverAddress() const;
87-
/// Returns the server's address.
88-
89-
const HTTPServerParams& serverParams() const;
90-
/// Returns a reference to the server parameters.
91-
92-
HTTPServerResponse& response() const;
93-
/// Returns a reference to the associated response.
94-
95-
protected:
96-
static const std::string EXPECT;
97-
98-
private:
99-
HTTPServerResponse& _response;
100-
std::istream* _pStream;
101-
HTTPServerParams* _pParams;
102-
SocketAddress _clientAddress;
103-
SocketAddress _serverAddress;
104-
};
105-
106-
107-
//
108-
// inlines
109-
//
110-
inline std::istream& HTTPServerRequestImpl::stream()
111-
{
112-
poco_check_ptr (_pStream);
113-
114-
return *_pStream;
115-
}
116-
117-
118-
inline const SocketAddress& HTTPServerRequestImpl::clientAddress() const
119-
{
120-
return _clientAddress;
121-
}
122-
123-
124-
inline const SocketAddress& HTTPServerRequestImpl::serverAddress() const
125-
{
126-
return _serverAddress;
127-
}
128-
129-
130-
inline const HTTPServerParams& HTTPServerRequestImpl::serverParams() const
131-
{
132-
return *_pParams;
133-
}
134-
135-
136-
inline HTTPServerResponse& HTTPServerRequestImpl::response() const
137-
{
138-
return _response;
139-
}
140-
141-
142-
} } // namespace Poco::Net
143-
144-
145-
#endif // Net_HTTPServerRequestImpl_INCLUDED
1+
//
2+
// HTTPServerRequestImpl.h
3+
//
4+
// $Id: //poco/Main/Net/include/Poco/Net/HTTPServerRequestImpl.h#4 $
5+
//
6+
// Library: Net
7+
// Package: HTTPServer
8+
// Module: HTTPServerRequestImpl
9+
//
10+
// Definition of the HTTPServerRequestImpl class.
11+
//
12+
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
13+
// and Contributors.
14+
//
15+
// Permission is hereby granted, free of charge, to any person or organization
16+
// obtaining a copy of the software and accompanying documentation covered by
17+
// this license (the "Software") to use, reproduce, display, distribute,
18+
// execute, and transmit the Software, and to prepare derivative works of the
19+
// Software, and to permit third-parties to whom the Software is furnished to
20+
// do so, all subject to the following:
21+
//
22+
// The copyright notices in the Software and this entire statement, including
23+
// the above license grant, this restriction and the following disclaimer,
24+
// must be included in all copies of the Software, in whole or in part, and
25+
// all derivative works of the Software, unless such copies or derivative
26+
// works are solely in the form of machine-executable object code generated by
27+
// a source language processor.
28+
//
29+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
32+
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
33+
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
34+
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35+
// DEALINGS IN THE SOFTWARE.
36+
//
37+
38+
39+
#ifndef Net_HTTPServerRequestImpl_INCLUDED
40+
#define Net_HTTPServerRequestImpl_INCLUDED
41+
42+
43+
#include "Poco/Net/Net.h"
44+
#include "Poco/Net/HTTPServerRequest.h"
45+
#include "Poco/Net/SocketAddress.h"
46+
#include "Poco/AutoPtr.h"
47+
#include <istream>
48+
49+
50+
namespace Poco {
51+
namespace Net {
52+
53+
54+
class HTTPServerSession;
55+
class HTTPServerParams;
56+
57+
58+
class Net_API HTTPServerRequestImpl: public HTTPServerRequest
59+
/// This subclass of HTTPServerRequest is used for
60+
/// representing server-side HTTP requests.
61+
///
62+
/// A HTTPServerRequest is passed to the
63+
/// handleRequest() method of HTTPRequestHandler.
64+
{
65+
public:
66+
HTTPServerRequestImpl(HTTPServerResponse& response, HTTPServerSession& session, HTTPServerParams* pParams);
67+
/// Creates the HTTPServerRequestImpl, using the
68+
/// given HTTPServerSession.
69+
70+
~HTTPServerRequestImpl();
71+
/// Destroys the HTTPServerRequestImpl.
72+
73+
std::istream& stream();
74+
/// Returns the input stream for reading
75+
/// the request body.
76+
///
77+
/// The stream is valid until the HTTPServerRequestImpl
78+
/// object is destroyed.
79+
80+
bool expectContinue() const;
81+
/// Returns true if the client expects a
82+
/// 100 Continue response.
83+
84+
const SocketAddress& clientAddress() const;
85+
/// Returns the client's address.
86+
87+
const SocketAddress& serverAddress() const;
88+
/// Returns the server's address.
89+
90+
const HTTPServerParams& serverParams() const;
91+
/// Returns a reference to the server parameters.
92+
93+
HTTPServerResponse& response() const;
94+
/// Returns a reference to the associated response.
95+
96+
protected:
97+
static const std::string EXPECT;
98+
99+
private:
100+
HTTPServerResponse& _response;
101+
std::istream* _pStream;
102+
Poco::AutoPtr<HTTPServerParams> _pParams;
103+
SocketAddress _clientAddress;
104+
SocketAddress _serverAddress;
105+
};
106+
107+
108+
//
109+
// inlines
110+
//
111+
inline std::istream& HTTPServerRequestImpl::stream()
112+
{
113+
poco_check_ptr (_pStream);
114+
115+
return *_pStream;
116+
}
117+
118+
119+
inline const SocketAddress& HTTPServerRequestImpl::clientAddress() const
120+
{
121+
return _clientAddress;
122+
}
123+
124+
125+
inline const SocketAddress& HTTPServerRequestImpl::serverAddress() const
126+
{
127+
return _serverAddress;
128+
}
129+
130+
131+
inline const HTTPServerParams& HTTPServerRequestImpl::serverParams() const
132+
{
133+
return *_pParams;
134+
}
135+
136+
137+
inline HTTPServerResponse& HTTPServerRequestImpl::response() const
138+
{
139+
return _response;
140+
}
141+
142+
143+
} } // namespace Poco::Net
144+
145+
146+
#endif // Net_HTTPServerRequestImpl_INCLUDED

‎Net/src/HTTPCookie.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// HTTPCookie.cpp
33
//
4-
// $Id: //poco/1.3/Net/src/HTTPCookie.cpp#2 $
4+
// $Id: //poco/Main/Net/src/HTTPCookie.cpp#8 $
55
//
66
// Library: Net
77
// Package: HTTP

‎Net/src/HTTPMessage.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// HTTPMessage.cpp
33
//
4-
// $Id: //poco/svn/Net/src/HTTPMessage.cpp#2 $
4+
// $Id: //poco/Main/Net/src/HTTPMessage.cpp#8 $
55
//
66
// Library: Net
77
// Package: HTTP

‎Net/src/HTTPRequest.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// HTTPRequest.cpp
33
//
4-
// $Id: //poco/svn/Net/src/HTTPRequest.cpp#2 $
4+
// $Id: //poco/Main/Net/src/HTTPRequest.cpp#13 $
55
//
66
// Library: Net
77
// Package: HTTP

‎Net/src/HTTPServerConnection.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// HTTPServerConnection.cpp
33
//
4-
// $Id: //poco/svn/Net/src/HTTPServerConnection.cpp#2 $
4+
// $Id: //poco/Main/Net/src/HTTPServerConnection.cpp#11 $
55
//
66
// Library: Net
77
// Package: HTTPServer
@@ -43,6 +43,7 @@
4343
#include "Poco/Net/HTTPServerParams.h"
4444
#include "Poco/Net/NetException.h"
4545
#include "Poco/NumberFormatter.h"
46+
#include "Poco/Timestamp.h"
4647
#include <memory>
4748

4849

@@ -79,6 +80,8 @@ void HTTPServerConnection::run()
7980
HTTPServerResponseImpl response(session);
8081
HTTPServerRequestImpl request(response, session, _pParams);
8182

83+
Poco::Timestamp now;
84+
response.setDate(now);
8285
response.setVersion(request.getVersion());
8386
response.setKeepAlive(_pParams->getKeepAlive() && request.getKeepAlive() && session.canKeepAlive());
8487
if (!server.empty())

0 commit comments

Comments
 (0)