ApacheServerRequest.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // ApacheServerRequest.h
  3. //
  4. // $Id: //poco/1.4/ApacheConnector/include/ApacheServerRequest.h#2 $
  5. //
  6. // Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH.
  7. // and Contributors.
  8. //
  9. // SPDX-License-Identifier: BSL-1.0
  10. //
  11. #ifndef ApacheConnector_ApacheServerRequest_INCLUDED
  12. #define ApacheConnector_ApacheServerRequest_INCLUDED
  13. #include "ApacheConnector.h"
  14. #include "ApacheStream.h"
  15. #include "Poco/Net/HTTPServerRequest.h"
  16. #include <set>
  17. class ApacheServerResponse;
  18. class ApacheServerRequest: public Poco::Net::HTTPServerRequest
  19. {
  20. public:
  21. ApacheServerRequest(
  22. ApacheRequestRec* pApacheRequest,
  23. const char* serverName,
  24. int serverPort,
  25. const char* clientName,
  26. int clientPort);
  27. /// Creates a new ApacheServerRequest.
  28. ~ApacheServerRequest();
  29. /// Destroys the ApacheServerRequest.
  30. std::istream& stream();
  31. /// Returns the input stream for reading
  32. /// the request body.
  33. ///
  34. /// The stream is valid until the HTTPServerRequest
  35. /// object is destroyed.
  36. bool expectContinue() const;
  37. /// Returns true if the client expects a
  38. /// 100 Continue response.
  39. const Poco::Net::SocketAddress& clientAddress() const;
  40. /// Returns the client's address.
  41. const Poco::Net::SocketAddress& serverAddress() const;
  42. /// Returns the server's address.
  43. const Poco::Net::HTTPServerParams& serverParams() const;
  44. /// Returns a reference to the server parameters.
  45. Poco::Net::HTTPServerResponse& response() const;
  46. /// Returns a reference to the associated response
  47. protected:
  48. void setResponse(ApacheServerResponse* pResponse);
  49. private:
  50. ApacheRequestRec* _pApacheRequest;
  51. ApacheServerResponse* _pResponse;
  52. ApacheInputStream* _pStream;
  53. Poco::Net::SocketAddress _serverAddress;
  54. Poco::Net::SocketAddress _clientAddress;
  55. friend class ApacheServerResponse;
  56. };
  57. //
  58. // inlines
  59. //
  60. inline std::istream& ApacheServerRequest::stream()
  61. {
  62. poco_check_ptr (_pStream);
  63. return *_pStream;
  64. }
  65. inline const Poco::Net::SocketAddress& ApacheServerRequest::clientAddress() const
  66. {
  67. return _clientAddress;
  68. }
  69. inline const Poco::Net::SocketAddress& ApacheServerRequest::serverAddress() const
  70. {
  71. return _serverAddress;
  72. }
  73. #endif // ApacheConnector_ApacheServerRequest_INCLUDED