2013-08-18 17:42:25 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "acl_cpp/http/http_header.hpp"
|
|
|
|
|
#include "acl_cpp/http/http_ctype.hpp"
|
|
|
|
|
#include "acl_cpp/http/http_type.hpp"
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class istream;
|
|
|
|
|
class ostream;
|
|
|
|
|
class socket_stream;
|
|
|
|
|
class http_client;
|
|
|
|
|
class http_mime;
|
|
|
|
|
class session;
|
|
|
|
|
class HttpSession;
|
|
|
|
|
class HttpCookie;
|
|
|
|
|
class HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD>࣬<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>̳У<EFBFBD><EFBFBD>û<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
class ACL_CPP_API HttpServletRequest
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param res {HttpServletResponse&}
|
|
|
|
|
* @param store {session&} <EFBFBD>洢<EFBFBD>Ự<EFBFBD><EFBFBD><EFBFBD>ݵĶ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param stream {socket_stream&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param local_charset {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>
|
|
|
|
|
* @param body_parse {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> POST <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ҫ
|
|
|
|
|
* <EFBFBD><EFBFBD>ȡ HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>岢<EFBFBD><EFBFBD> n/v <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ true <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> getParameter
|
|
|
|
|
* ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD> URL <EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD> POST <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD>Ϊ false ʱ<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>壬<EFBFBD>Ѷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ദ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param body_limit {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> POST <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MIME
|
|
|
|
|
* <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD> body_read Ϊ false<EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
|
|
|
|
*/
|
|
|
|
|
HttpServletRequest(HttpServletResponse& res, session& store,
|
|
|
|
|
socket_stream& stream, const char* local_charset = NULL,
|
|
|
|
|
bool body_parse = true, int body_limit = 102400);
|
|
|
|
|
~HttpServletRequest(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GET, POST, PUT, CONNECT, PURGE
|
|
|
|
|
* @return {http_method_t}
|
|
|
|
|
*/
|
|
|
|
|
http_method_t getMethod(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cookie <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const std::vector<HttpCookie*>&}
|
|
|
|
|
*/
|
|
|
|
|
const std::vector<HttpCookie*>& getCookies(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD> cookie ֵ
|
|
|
|
|
* @param name {const char*} cookie <EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>
|
|
|
|
|
* @return {const char*} cookie ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL ʱ<EFBFBD><EFBFBD>ʾ
|
|
|
|
|
* cookie ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getCookieValue(const char* name) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cookie <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param name {const char*} cookie <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param value {const char*} cookie ֵ<EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void setCookie(const char* name, const char* value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>е<EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param name {const char*} HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>е<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>
|
|
|
|
|
* @return {const char*} HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>е<EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL
|
|
|
|
|
* ʱ<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getHeader(const char* name) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP GET <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ URL <EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><EFBFBD><EFBFBD> ? <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*} û<EFBFBD>н<EFBFBD><EFBFBD><EFBFBD>URL <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ URL <EFBFBD><EFBFBD>û<EFBFBD>в<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getQueryString(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> http://test.com.cn/cgi-bin/test?name=value <20>е<EFBFBD>
|
|
|
|
|
* /cgi-bin/test ·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD>ؿձ<EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getPathInfo(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> http://test.com.cn/cgi-bin/test?name=value <20>е<EFBFBD>
|
|
|
|
|
* /cgi-bin/test?name=value ·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD>ؿձ<EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getRequestUri(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD>Ự<EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> HttpSession <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param create {bool} <EFBFBD><EFBFBD> session <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ƿ<EFBFBD><EFBFBD>ڻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>ij<EFBFBD>ͻ<EFBFBD><EFBFBD>˵<EFBFBD> session <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҹò<EFBFBD><EFBFBD><EFBFBD>Ϊ false ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ص<EFBFBD> session <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param sid {const char*} <EFBFBD><EFBFBD> session <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD> create <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> sid <EFBFBD>ǿգ<EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ô<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ψһ<EFBFBD>Ự<EFBFBD><EFBFBD>ͬʱ<EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
* cookie <EFBFBD><EFBFBD>
|
|
|
|
|
* @return {HttpSession&}
|
|
|
|
|
* ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> COOKIE > create = true > sid != NULL
|
|
|
|
|
*/
|
|
|
|
|
HttpSession& getSession(bool create = true, const char* sid = NULL);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {istream&}
|
|
|
|
|
*/
|
|
|
|
|
istream& getInputStream(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {acl_int64} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ GET <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD> Content-Length <EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
#ifdef WIN32
|
|
|
|
|
__int64 getContentLength(void) const;
|
|
|
|
|
#else
|
|
|
|
|
long long int getContentLength(void) const;
|
|
|
|
|
#endif
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD> Content-Type: text/html; charset=gb2312
|
|
|
|
|
* Content-Type <EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param part {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ true <EFBFBD><EFBFBD> text<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ֵ<EFBFBD><EFBFBD><EFBFBD>磺text/html; charset=gb2312
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD>ʾ Content-Type <EFBFBD>ֶβ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getContentType(bool part = true) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>е<EFBFBD> Content-Type: text/html; charset=gb2312
|
|
|
|
|
* <EFBFBD>е<EFBFBD> charset <EFBFBD>ֶ<EFBFBD>ֵ gb2312
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD>ʾ Content-Type <EFBFBD>ֶ<EFBFBD> <EFBFBD><EFBFBD>
|
|
|
|
|
* charset=xxx <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getCharacterEncoding(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @ return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD>ʾû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getLocalCharset(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD>ӵı<EFBFBD><EFBFBD><EFBFBD> IP <EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD>ؿգ<EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getLocalAddr(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD>ӵı<EFBFBD><EFBFBD><EFBFBD> PORT <EFBFBD><EFBFBD>
|
|
|
|
|
* @return {unsigned short} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
unsigned short getLocalPort(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>Զ<EFBFBD>̿ͻ<EFBFBD><EFBFBD><EFBFBD> IP <EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD>ؿգ<EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getRemoteAddr(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>Զ<EFBFBD>̿ͻ<EFBFBD><EFBFBD><EFBFBD> PORT <EFBFBD><EFBFBD>
|
|
|
|
|
* @return {unsigned short} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
unsigned short getRemotePort(void) const;
|
|
|
|
|
|
2013-12-07 20:31:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> Host <EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getRemoteHost(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> User-Agent <EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* getUserAgent(void) const;
|
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD> URL <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ת<EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GET <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* URL <EFBFBD><EFBFBD> ? <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> POST <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* URL <EFBFBD><EFBFBD> ? <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
*/
|
|
|
|
|
const char* getParameter(const char* name) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>е<EFBFBD> Content-Type Ϊ
|
|
|
|
|
* multipart/form-data; boundary=xxx <EFBFBD><EFBFBD>ʽʱ<EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><EFBFBD>ϴ<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> http_mime <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const http_mime*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD>û<EFBFBD><EFBFBD> MIME <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ֵ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD>ͷţ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD> HttpServletRequest <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>ͷ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
http_mime* getHttpMime(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_request_t}<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> POST <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>ϴ<EFBFBD>
|
|
|
|
|
* <EFBFBD>ļ<EFBFBD>Ӧ<EFBFBD>ö<EFBFBD><EFBFBD>ԣ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>øú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP_REQUEST_OTHER ʱ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* getContentType <EFBFBD><EFBFBD><EFBFBD>þ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
http_request_t getRequestType(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> referer URL
|
|
|
|
|
* @return {const char*} Ϊ NULL <EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><EFBFBD>ʱ<EFBFBD> URL
|
|
|
|
|
*/
|
|
|
|
|
const char* getRequestReferer(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> http_ctype <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const http_ctype&}
|
|
|
|
|
*/
|
|
|
|
|
const http_ctype& getHttpCtype(void) const;
|
|
|
|
|
|
2013-12-07 20:31:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ж<EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ҫ<EFBFBD>ֳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool}
|
|
|
|
|
*/
|
|
|
|
|
bool isKeepAlive(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ֳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>л<EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD>ֵ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ < 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Keep-Alive <EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
int getKeepAlive(void) const;
|
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
|
/*
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ POST <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* IO <EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>ֵ(<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param rw_timeout {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ij<EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
*/
|
|
|
|
|
void setRwTimeout(int rw_timeout);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴγ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_request_error_t}
|
|
|
|
|
*/
|
|
|
|
|
http_request_error_t getLastError(void) const;
|
|
|
|
|
|
2013-12-07 20:31:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> HttpServlet <EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><EFBFBD><EFBFBD>ģʽ(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> CGI <EFBFBD><EFBFBD>ʽ)<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><EFBFBD>ô<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_client*} <EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ӷǿն<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CGI <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ؿ<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
http_client* getClient(void) const;
|
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param out {ostream&}
|
|
|
|
|
* @param prompt {const char*} <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void fprint_header(ostream& out, const char* prompt);
|
|
|
|
|
private:
|
|
|
|
|
http_request_error_t req_error_;
|
|
|
|
|
char cookie_name_[64];
|
|
|
|
|
HttpServletResponse& res_;
|
|
|
|
|
session& store_;
|
|
|
|
|
HttpSession* http_session_;
|
|
|
|
|
socket_stream& stream_;
|
|
|
|
|
bool body_parse_;
|
|
|
|
|
int body_limit_;
|
|
|
|
|
|
|
|
|
|
std::vector<HttpCookie*> cookies_;
|
|
|
|
|
bool cookies_inited_;
|
|
|
|
|
http_client* client_;
|
|
|
|
|
http_method_t method_;
|
|
|
|
|
bool cgi_mode_;
|
|
|
|
|
http_ctype content_type_;
|
|
|
|
|
char localAddr_[32];
|
|
|
|
|
char remoteAddr_[32];
|
|
|
|
|
char localCharset_[32];
|
|
|
|
|
int rw_timeout_;
|
|
|
|
|
std::vector<HTTP_PARAM*> params_;
|
|
|
|
|
http_request_t request_type_;
|
|
|
|
|
http_mime* mime_;
|
|
|
|
|
|
|
|
|
|
bool readHeaderCalled_;
|
|
|
|
|
bool readHeader(void);
|
|
|
|
|
|
|
|
|
|
void parseParameters(const char* str);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|