RLib  5.7
RLib - an opensource, lightweight and multi-platform framework for cpp programming
System::Net::HttpRequest Class Reference

Makes a request to a Uniform Resource Identifier (URI) More...

Public Member Functions

 HttpRequest (const String &url)
 为指定的 URI 方案初始化新的 HttpRequest 实例 More...
 
 ~HttpRequest ()
 为此 HttpRequest 实例执行必要的清理 More...
 
HttpResponseGetResponse ()
 返回来自 Internet 资源的响应 More...
 
ResponseStreamGetResponseStream (OUT OPTIONAL IO::Stream *extern_out=nullptr)
 returns a response to an Internet request More...
 
RequestStreamGetRequestStream (intptr_t size=-1)
 Returns a Stream for writing data to the Internet resource More...
 
HttpException * GetLastException ()
 Gets the last exception during http request More...
 
bool DisConnect (bool reuse=false)
 Forces to disconnect from server More...
 
SocketsGetUsingSocket ()
 Gets the associated socket used by HttpRequest More...
 
void SetConnCallback (IN OPTIONAL HTTP_CONN_CALLBACK, IN OPTIONAL LPHTTP_CALLBACK_OBJECT)
 Registers or cancels Connect callback More...
 
void SetSendCallback (IN OPTIONAL HTTP_SEND_CALLBACK, IN OPTIONAL LPHTTP_CALLBACK_OBJECT)
 Registers or cancels Send callback More...
 
void SetRecvCallback (IN OPTIONAL HTTP_RECV_CALLBACK, IN OPTIONAL LPHTTP_CALLBACK_OBJECT)
 Registers or cancels Recv callback More...
 

Public Attributes

WebHeaderCollection Headers
 指定构成 HTTP 标头的名称/值对的集合 More...
 
String Referer
 获取或设置 Referer HTTP 标头的值 More...
 
String ContentType
 获取或设置 Content-Type HTTP 标头的值 More...
 
String UserAgent
 获取或设置 User-Agent HTTP 标头的值 More...
 
String Cookie
 获取或设置 Cookie HTTP 标头的值 格式 key0=val0; ...; keyN=valN More...
 
intptr_t ContentLength
 获取或设置 Content-Length HTTP 标头 More...
 
DecompressionMethod AutomaticDecompression
 获取或设置所使用的解压缩类型 More...
 
Ipv4Host WebProxy
 获取或设置请求的代理信息 More...
 
LPURI Address
 获取请求的统一资源标识符 (URI) More...
 
String Method
 获取或设置请求的方法 如果该值指定为 HEAD, 则将重写属性 IgnoreResponseBody 为 true More...
 
String ProtocolVer
 获取或设置用于请求的 HTTP 版本 More...
 
long ConnectTimeout
 获取或设置连接服务器的超时值(以毫秒为单位), 默认为8000(8秒) More...
 
long Timeout
 获取或设置发送和接收的超时值(以毫秒为单位), 默认为8000(8秒) More...
 
long RecvTimeout
 获取或设置接收临时超时值(以毫秒为单位), 默认为1000(1秒) 该属性仅在未知服务器响应长度时使用以防止长时间阻塞 More...
 
long MaxAutoRedirections
 获取或设置请求将跟随的重定向的最大数目, 默认值为 3 More...
 
bool AutoRedirect
 获取或设置一个值,该值指示请求是否应跟随重定向响应, 默认值为 true More...
 
bool IgnoreResponseBody
 获取或设置是否忽略 HTTP(s) 响应体, 默认值为 false enabling this option means asking for a download but without receiving body, instead of forcing HttpRequest to do a HEAD request More...
 
bool IgnoreResponseHeaders
 获取或设置是否忽略对 HTTP(s) 响应标头的解析, 默认值为 false 属性仅对 HttpResponse 对象行为产生影响 More...
 
bool IgnoreResponseStatus
 获取或设置是否忽略对 HTTP(s) 响应状态的解析, 默认值为 false 属性仅对 HttpResponse 对象行为产生影响 More...
 
bool KeepAlive
 获取或设置一个值, 该值指示是否与 Internet 资源建立持久性连接, 默认值为 false 该值直接影响 Connection HTTP 标头的值 More...
 
bool IsConnected
 Gets if connection has been established More...
 
 RLIB_DECLARE_DYNCREATE
 

Protected Member Functions

 RLIB_DELAY_DATA (Sockets, m_socket)
 

Detailed Description

Makes a request to a Uniform Resource Identifier (URI)

Constructor & Destructor Documentation

HttpRequest::HttpRequest ( const String url)

为指定的 URI 方案初始化新的 HttpRequest 实例

HttpRequest::~HttpRequest ( )

为此 HttpRequest 实例执行必要的清理

Member Function Documentation

bool HttpRequest::DisConnect ( bool  reuse = false)

Forces to disconnect from server

HttpException * HttpRequest::GetLastException ( )

Gets the last exception during http request

RequestStream * HttpRequest::GetRequestStream ( intptr_t  size = -1)

Returns a Stream for writing data to the Internet resource

HttpResponse * HttpRequest::GetResponse ( )

返回来自 Internet 资源的响应

ResponseStream * HttpRequest::GetResponseStream ( OUT OPTIONAL IO::Stream extern_out = nullptr)

returns a response to an Internet request

Warning
无需释放且不应与 GetResponse() 方法同时使用
如果 extern_out 被指定, 那么将直接返回传入的 extern_out(强制转换)
Returns
possible nullptr or empty stream
Sockets * HttpRequest::GetUsingSocket ( )

Gets the associated socket used by HttpRequest

void HttpRequest::SetConnCallback ( IN OPTIONAL HTTP_CONN_CALLBACK  callback,
IN OPTIONAL LPHTTP_CALLBACK_OBJECT  obj 
)

Registers or cancels Connect callback

void HttpRequest::SetRecvCallback ( IN OPTIONAL HTTP_RECV_CALLBACK  callback,
IN OPTIONAL LPHTTP_CALLBACK_OBJECT  obj 
)

Registers or cancels Recv callback

void HttpRequest::SetSendCallback ( IN OPTIONAL HTTP_SEND_CALLBACK  callback,
IN OPTIONAL LPHTTP_CALLBACK_OBJECT  obj 
)

Registers or cancels Send callback

Member Data Documentation

LPURI System::Net::HttpRequest::Address

获取请求的统一资源标识符 (URI)

DecompressionMethod System::Net::HttpRequest::AutomaticDecompression

获取或设置所使用的解压缩类型

bool System::Net::HttpRequest::AutoRedirect

获取或设置一个值,该值指示请求是否应跟随重定向响应, 默认值为 true

Warning
如果属性 Method 设置为 HEAD, 此值将被忽略即不会自动重定向
long System::Net::HttpRequest::ConnectTimeout

获取或设置连接服务器的超时值(以毫秒为单位), 默认为8000(8秒)

intptr_t System::Net::HttpRequest::ContentLength

获取或设置 Content-Length HTTP 标头

String System::Net::HttpRequest::ContentType

获取或设置 Content-Type HTTP 标头的值

String System::Net::HttpRequest::Cookie

获取或设置 Cookie HTTP 标头的值 格式 key0=val0; ...; keyN=valN

Warning
如果发生重定向, 该值可能被覆写
WebHeaderCollection System::Net::HttpRequest::Headers

指定构成 HTTP 标头的名称/值对的集合

bool System::Net::HttpRequest::IgnoreResponseBody

获取或设置是否忽略 HTTP(s) 响应体, 默认值为 false enabling this option means asking for a download but without receiving body, instead of forcing HttpRequest to do a HEAD request

bool System::Net::HttpRequest::IgnoreResponseHeaders

获取或设置是否忽略对 HTTP(s) 响应标头的解析, 默认值为 false 属性仅对 HttpResponse 对象行为产生影响

bool System::Net::HttpRequest::IgnoreResponseStatus

获取或设置是否忽略对 HTTP(s) 响应状态的解析, 默认值为 false 属性仅对 HttpResponse 对象行为产生影响

bool System::Net::HttpRequest::IsConnected

Gets if connection has been established

bool System::Net::HttpRequest::KeepAlive

获取或设置一个值, 该值指示是否与 Internet 资源建立持久性连接, 默认值为 false 该值直接影响 Connection HTTP 标头的值

long System::Net::HttpRequest::MaxAutoRedirections

获取或设置请求将跟随的重定向的最大数目, 默认值为 3

String System::Net::HttpRequest::Method

获取或设置请求的方法 如果该值指定为 HEAD, 则将重写属性 IgnoreResponseBody 为 true

String System::Net::HttpRequest::ProtocolVer

获取或设置用于请求的 HTTP 版本

long System::Net::HttpRequest::RecvTimeout

获取或设置接收临时超时值(以毫秒为单位), 默认为1000(1秒) 该属性仅在未知服务器响应长度时使用以防止长时间阻塞

String System::Net::HttpRequest::Referer

获取或设置 Referer HTTP 标头的值

long System::Net::HttpRequest::Timeout

获取或设置发送和接收的超时值(以毫秒为单位), 默认为8000(8秒)

String System::Net::HttpRequest::UserAgent

获取或设置 User-Agent HTTP 标头的值

Ipv4Host System::Net::HttpRequest::WebProxy

获取或设置请求的代理信息


The documentation for this class was generated from the following files: