2014-11-19 00:25:21 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
#include <list>
|
|
|
|
|
#include "acl_cpp/http/http_type.hpp"
|
|
|
|
|
|
|
|
|
|
struct HTTP_HDR_RES;
|
|
|
|
|
struct HTTP_HDR_ENTRY;
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class string;
|
|
|
|
|
class HttpCookie;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* HTTP ͷ<EFBFBD>࣬<EFBFBD><EFBFBD><EFBFBD>Թ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧͷ
|
|
|
|
|
*/
|
|
|
|
|
class ACL_CPP_API http_header
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
http_header(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param url {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> URL<EFBFBD><EFBFBD>url <EFBFBD><EFBFBD>ʽʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|
|
|
|
* http://www.test.com/
|
|
|
|
|
* /cgi-bin/test.cgi
|
|
|
|
|
* http://www.test.com/cgi-bin/test.cgi
|
|
|
|
|
* http://www.test.com/cgi-bin/test.cgi?name=value
|
|
|
|
|
* /cgi-bin/test.cgi?name=value
|
|
|
|
|
* <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>
|
|
|
|
|
* <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> add_param <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>øú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD>Ե<EFBFBD><EFBFBD><EFBFBD> add_param <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><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> add_param <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
http_header(const char* url);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param status {int} ״̬<EFBFBD><EFBFBD><EFBFBD>磺1xx, 2xx, 3xx, 4xx, 5xx
|
|
|
|
|
*/
|
|
|
|
|
http_header(int status);
|
|
|
|
|
virtual ~http_header(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP ͷ<EFBFBD><EFBFBD>Ϣͬʱ<EFBFBD><EFBFBD><EFBFBD>ϴε<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Դ<EFBFBD>ͷ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void reset(void);
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// HTTP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <20><>Ӧͨ<D3A6>õķ<C3B5><C4B7><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>Ӧͷ
|
|
|
|
|
* @param onoff {bool} true <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>Ӧͷ
|
|
|
|
|
* @return {http_header&} <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_header& set_request_mode(bool onoff);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @param name {const char*} <EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param value {const char*} <EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& add_entry(const char* name, const char* value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP ͷ<EFBFBD>е<EFBFBD> Content-Length <EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @param n {int64} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @return {http_header&} <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>
|
|
|
|
|
*/
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
http_header& set_content_length(__int64 n);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD> set_content_length <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> HTTP ͷ<EFBFBD>е<EFBFBD> Content-Length ֵ
|
|
|
|
|
* @return {int64}
|
|
|
|
|
*/
|
|
|
|
|
__int64 get_content_length() const
|
|
|
|
|
{
|
|
|
|
|
return content_length_;
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
http_header& set_content_length(long long int n);
|
|
|
|
|
long long int get_content_length() const
|
|
|
|
|
{
|
|
|
|
|
return content_length_;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP ͷ<EFBFBD>е<EFBFBD> Content-Type <EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @param value {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @return {http_header&} <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_header& set_content_type(const char* value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP ͷ<EFBFBD>е<EFBFBD> Connection <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><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param on {bool} <EFBFBD>Ƿֳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& set_keep_alive(bool on);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cookie
|
|
|
|
|
* @param name {const char*} cookie <EFBFBD><EFBFBD>
|
|
|
|
|
* @param value {const char*} cookie ֵ
|
|
|
|
|
* @param domain {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param path {const char*} <EFBFBD>洢·<EFBFBD><EFBFBD>
|
|
|
|
|
* @param expires {time_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ 0 ʱ<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
|
|
|
|
|
* > 0 ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> expires <EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><EFBFBD>λΪ<EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& add_cookie(const char* name, const char* value,
|
|
|
|
|
const char* domain = NULL, const char* path = NULL,
|
|
|
|
|
time_t expires = 0);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cookie
|
|
|
|
|
* @param cookie {http_cookie*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cookie <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& add_cookie(HttpCookie* cookie);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>Ϊ rfc1123 <EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
static void date_format(char* out, size_t size, time_t t);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ж<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> false <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ
|
|
|
|
|
*/
|
|
|
|
|
bool is_request(void) const;
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// HTTP <20><><EFBFBD><EFBFBD><F3B7BDB7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param buf {string&} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>з<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
bool build_request(string& buf) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> URL<EFBFBD><EFBFBD>url <EFBFBD><EFBFBD>ʽʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|
|
|
|
* 1<EFBFBD><EFBFBD>http://www.test.com/
|
|
|
|
|
* 2<EFBFBD><EFBFBD>/cgi-bin/test.cgi
|
|
|
|
|
* 3<EFBFBD><EFBFBD>http://www.test.com/cgi-bin/test.cgi
|
|
|
|
|
* 3<EFBFBD><EFBFBD>http://www.test.com/cgi-bin/test.cgi?name=value
|
|
|
|
|
* 4<EFBFBD><EFBFBD>/cgi-bin/test.cgi?name=value
|
|
|
|
|
* 5<EFBFBD><EFBFBD>http://www.test.com
|
|
|
|
|
* <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>
|
|
|
|
|
* <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> add_param <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>øú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD>Ե<EFBFBD><EFBFBD><EFBFBD> add_param <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><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> add_param <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param url {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> url<EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ָ<EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& set_url(const char* url);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD> HOST <EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @param value {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD> HOST <EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @return {http_header&} <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_header& set_host(const char* value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> HTTP <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> HOST <EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* get_host() const
|
|
|
|
|
{
|
|
|
|
|
return host_[0] == 0 ? NULL : host_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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> GET <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param method {http_method_t} HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& set_method(http_method_t method);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>չ 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> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param method {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& set_method(const char* method);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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 {http_method_t}
|
|
|
|
|
*/
|
|
|
|
|
http_method_t get_method(void) const
|
|
|
|
|
{
|
|
|
|
|
return method_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD> Range <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> WEB <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param from {http_off_t} <EFBFBD><EFBFBD>ʼƫ<EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD>±<EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ֵ<EFBFBD><EFBFBD> >= 0 ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
|
|
|
|
* @param to {http_off_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD>±<EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> < 0 ʱ<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>
|
|
|
|
|
* @return {http_header&} <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>
|
|
|
|
|
*/
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
http_header& set_range(__int64 from, __int64 to);
|
|
|
|
|
#else
|
|
|
|
|
http_header& set_range(long long int from, long long int to);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> set_range <EFBFBD><EFBFBD><EFBFBD>õķֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @param from {http_off_t*} <EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD>洢<EFBFBD><EFBFBD>ʼλ<EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param to {http_off_t*} <EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
void get_range(__int64* from, __int64* to);
|
|
|
|
|
#else
|
|
|
|
|
void get_range(long long int* from, long long int* to);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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> HTTP ͷ<EFBFBD>ֶ<EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* Accept-Encoding: gzip, deflate<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀǰ<EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD> gzip <EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @param on {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ true <EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP ѹ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& accept_gzip(bool on);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
* 1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿմ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ<EFBFBD><EFBFBD>ָ<EFBFBD>룬<EFBFBD><EFBFBD> URL <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>У<EFBFBD>{name}
|
|
|
|
|
* 2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿմ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ<EFBFBD>մ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> URL<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>{name}=
|
|
|
|
|
* @param name {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param value {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><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& add_param(const char* name, const char* value);
|
|
|
|
|
http_header& add_int(const char* name, short value);
|
|
|
|
|
http_header& add_int(const char* name, int value);
|
|
|
|
|
http_header& add_int(const char* name, long value);
|
|
|
|
|
http_header& add_int(const char* name, unsigned short value);
|
|
|
|
|
http_header& add_int(const char* name, unsigned int value);
|
|
|
|
|
http_header& add_int(const char* name, unsigned long value);
|
|
|
|
|
http_header& add_format(const char* name, const char* fmt, ...)
|
|
|
|
|
ACL_CPP_PRINTF(3, 4);
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
http_header& add_int(const char* name, __int64 vlaue);
|
|
|
|
|
http_header& add_int(const char* name, unsigned __int64 vlaue);
|
|
|
|
|
#else
|
|
|
|
|
http_header& add_int(const char* name, long long int value);
|
|
|
|
|
http_header& add_int(const char* name, unsigned long long int value);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* url <EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param url {const char*} <EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> URL<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>
|
|
|
|
|
* http://xxx.xxx.xxx/xxx <20><> /xxx
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD> HOST <EFBFBD>ֶΣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǻ<EFBFBD><EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD> HOST
|
|
|
|
|
*/
|
|
|
|
|
bool redirect(const char* url);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ == 0 <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>
|
|
|
|
|
* @param n {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_header&} <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_header& set_redirect(unsigned int n = 5);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>ȡͨ<EFBFBD><EFBFBD> set_redirect <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {unsigned int}
|
|
|
|
|
*/
|
|
|
|
|
unsigned int get_redirect(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
virtual void redicrect_reset(void) {}
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// HTTP <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param buf {string&} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧͷ<EFBFBD>з<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
bool build_response(string& buf) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>Ӧ״̬<EFBFBD><EFBFBD>
|
|
|
|
|
* @param status {int} ״̬<EFBFBD><EFBFBD><EFBFBD>磺1xx, 2xx, 3xx, 4xx, 5xx
|
|
|
|
|
* @return {http_header&} <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_header& set_status(int status);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD> chunked <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
|
|
|
|
* @param on {bool}
|
|
|
|
|
* @return {http_header&}
|
|
|
|
|
*/
|
|
|
|
|
http_header& set_chunked(bool on);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>жϵ<EFBFBD>ǰ HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> chunked <EFBFBD><EFBFBD><EFBFBD>䷽ʽ
|
|
|
|
|
* @return {bool}
|
|
|
|
|
*/
|
|
|
|
|
bool chunked_transfer() const
|
|
|
|
|
{
|
|
|
|
|
return chunked_transfer_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CGI <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧͷ
|
|
|
|
|
* @param on {bool} <EFBFBD>Ƿ<EFBFBD> CGI <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>Ӧͷ
|
|
|
|
|
* @return {http_header&} <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_header& set_cgi_mode(bool on);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
private:
|
|
|
|
|
//char* domain_; // HTTP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-01-04 22:51:01 +08:00
|
|
|
|
//unsigned short port_; // HTTP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
char* url_; // HTTP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> URL
|
|
|
|
|
std::list<HTTP_PARAM*> params_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
std::list<HttpCookie*> cookies_; // cookies <20><><EFBFBD><EFBFBD>
|
|
|
|
|
std::list<HTTP_HDR_ENTRY*> entries_; // HTTP <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>и<EFBFBD><D0B8>ֶμ<D6B6><CEBC><EFBFBD>
|
|
|
|
|
http_method_t method_; // HTTP <20><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
|
|
|
|
|
char method_s_[64]; // HTTP <20><><EFBFBD><EFBFBD><F3B7BDB7><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
char host_[256]; // HTTP <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>е<EFBFBD> HOST <20>ֶ<EFBFBD>
|
|
|
|
|
bool keep_alive_; // <20>Ƿֳ<F1B1A3B3><D6B3><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
unsigned int nredirect_; // <20><><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
bool accept_compress_; // <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int status_; // <20><>Ӧͷ<D3A6><CDB7>״̬<D7B4><CCAC>
|
|
|
|
|
bool is_request_; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧͷ
|
|
|
|
|
bool cgi_mode_; // <20>Ƿ<EFBFBD> CGI <20><>Ӧͷ
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
__int64 range_from_; // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>У<EFBFBD>range <20><>ʼλ<CABC><CEBB>
|
|
|
|
|
__int64 range_to_; // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>У<EFBFBD>range <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
__int64 content_length_; // HTTP <20><><EFBFBD><EFBFBD><EFBFBD>峤<EFBFBD><E5B3A4>
|
|
|
|
|
#else
|
|
|
|
|
long long int range_from_; // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>У<EFBFBD>range <20><>ʼλ<CABC><CEBB>
|
|
|
|
|
long long int range_to_; // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>У<EFBFBD>range <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
long long int content_length_; // HTTP <20><><EFBFBD><EFBFBD><EFBFBD>峤<EFBFBD><E5B3A4>
|
|
|
|
|
#endif
|
|
|
|
|
bool chunked_transfer_; // <20>Ƿ<EFBFBD>Ϊ chunked <20><><EFBFBD><EFBFBD>ģʽ
|
|
|
|
|
void init(void); // <20><>ʼ<EFBFBD><CABC>
|
|
|
|
|
void clear(void);
|
|
|
|
|
void build_common(string& buf) const; // <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>ͷ
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl end
|