4 ** \author grymse@alhem.net
7 Copyright (C) 2007 Anders Hedstrom
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #ifndef _SOCKETS_HttpRequest_H
24 #define _SOCKETS_HttpRequest_H
26 #include "HttpTransaction.h"
27 #include "HttpdCookies.h"
31 #ifdef SOCKETS_NAMESPACE
32 namespace SOCKETS_NAMESPACE
{
39 class HttpRequest
: public HttpTransaction
43 HttpRequest(const HttpRequest
& src
);
47 void SetHttpMethod(const std::string
& value
);
48 const std::string
& HttpMethod() const;
51 void SetHttpVersion(const std::string
& value
);
52 const std::string
& HttpVersion() const;
54 void SetUri(const std::string
& value
);
55 const std::string
& Uri() const;
57 void SetRemoteAddr(const std::string
& value
);
58 const std::string
& RemoteAddr() const;
60 void SetRemoteHost(const std::string
& value
);
61 const std::string
& RemoteHost() const;
63 void SetServerName(const std::string
& value
);
64 const std::string
& ServerName() const;
66 void SetServerPort(int value
);
67 int ServerPort() const;
69 void SetIsSsl(bool value
);
72 /** Set / Read attribute value */
73 void SetAttribute(const std::string
& key
, const std::string
& value
);
74 void SetAttribute(const std::string
& key
, long value
);
75 const std::string
& Attribute(const std::string
& key
) const;
77 const std::map
<std::string
, std::string
>& Attributes() const;
80 void AddCookie(const std::string
& );
81 const std::map
<std::string
, std::string
>& CookieMap() const { return m_cookie
; }
83 /** Open file for body data */
84 void InitBody( size_t sz
);
86 /** Write body data */
87 void Write( const char *buf
, size_t sz
);
89 /** No more writing */
94 const HttpdForm
& Form() const;
95 const HttpdCookies
& Cookies() const;
97 const IFile
*BodyFile() const { return m_body_file
.get(); }
102 std::string m_method
;
103 std::string m_protocol
;
104 std::string m_req_uri
;
105 std::string m_remote_addr
;
106 std::string m_remote_host
;
107 std::string m_server_name
;
110 std::map
<std::string
, std::string
> m_attribute
;
112 mutable std::auto_ptr
<IFile
> m_body_file
;
113 mutable std::auto_ptr
<HttpdForm
> m_form
;
114 HttpdCookies m_cookies
;
115 std::map
<std::string
, std::string
> m_cookie
;
120 #ifdef SOCKETS_NAMESPACE
121 } // namespace SOCKETS_NAMESPACE {
124 #endif // _SOCKETS_HttpRequest_H