xrtHttpRequestCreate
XRT_API xhttprequest* xrtHttpRequestCreate( xstrview Method, xstrview Url );
示例已编译验证
/* XRT_API xhttprequest* xrtHttpRequestCreate( xstrview Method, xstrview Url ); */ xhandle* h = xrtHttpRequestCreate();
xrtHttpRequestCreateWithHeaders
使用指定动态 Header 容量和限额创建客户端请求。
| 参数 | 说明 |
|---|---|
| xstrview Method | HTTP 方法 |
| xstrview Url | URL 文本 |
| const xhttpheadersconfig* pHeaders | 头部对象 |
示例已编译验证
/* 使用指定动态 Header 容量和限额创建客户端请求。 */ xhandle* h = xrtHttpRequestCreateWithHeaders(Method, Url, pHeaders);
xrtHttpRequestClone
创建内容和所有动态存储独立的请求副本;正文增加一个共享引用。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 创建内容和所有动态存储独立的请求副本;正文增加一个共享引用。 */ result = xrtHttpRequestClone(pRequest);
xrtHttpRequestDestroy
销毁请求及其 Header、URL、方法和正文引用;空指针是安全的空操作。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
示例已编译验证
xrtHttpRequestDestroy(pRequest);
xrtHttpRequestSetMethod
失败原子地替换请求方法;Method 必须是非空 HTTP token。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Method | HTTP 方法 |
示例已编译验证
/* 失败原子地替换请求方法;Method 必须是非空 HTTP token。 */ result = xrtHttpRequestSetMethod(pRequest, Method);
xrtHttpRequestMethod
返回借用的请求方法视图。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回借用的请求方法视图。 */ result = xrtHttpRequestMethod(pRequest);
xrtHttpRequestSetUrl
失败原子地替换绝对 HTTP 或 HTTPS URL。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Url | URL 文本 |
示例已编译验证
/* 失败原子地替换绝对 HTTP 或 HTTPS URL。 */ result = xrtHttpRequestSetUrl(pRequest, Url);
xrtHttpRequestUrlText
返回借用的原始 URL 文本;fragment 保留在文本中但不会进入请求 target。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回借用的原始 URL 文本;fragment 保留在文本中但不会进入请求 target。 */ result = xrtHttpRequestUrlText(pRequest);
xrtHttpRequestUrl
返回借用请求 URL 存储的解析结果。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回借用请求 URL 存储的解析结果。 */ result = xrtHttpRequestUrl(pRequest);
xrtHttpRequestAddHeader
追加一个拥有型 Header,允许同名字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Name | 名称(xstrview) |
| xstrview Value | 值 |
示例已编译验证
/* 追加一个拥有型 Header,允许同名字段。 */ result = xrtHttpRequestAddHeader(pRequest, Name, Value);
xrtHttpRequestSetHeader
设置首个同名 Header 并删除其余同名字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Name | 名称(xstrview) |
| xstrview Value | 值 |
示例已编译验证
/* 设置首个同名 Header 并删除其余同名字段。 */ result = xrtHttpRequestSetHeader(pRequest, Name, Value);
xrtHttpRequestRemoveHeader
删除全部同名 Header 并返回删除数量。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Name | 名称(xstrview) |
示例已编译验证
/* 删除全部同名 Header 并返回删除数量。 */ result = xrtHttpRequestRemoveHeader(pRequest, Name);
xrtHttpRequestHeader
返回首个同名借用 Header,未找到返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
| xstrview Name | 名称(xstrview) |
示例已编译验证
/* 返回首个同名借用 Header,未找到返回空指针。 */ result = xrtHttpRequestHeader(pRequest, Name);
xrtHttpRequestHeaderCount
返回 Header 数量。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回 Header 数量。 */ result = xrtHttpRequestHeaderCount(pRequest);
xrtHttpRequestHeaderData
返回连续只读 Header 数组;空请求或无字段返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回连续只读 Header 数组;空请求或无字段返回空指针。 */ result = xrtHttpRequestHeaderData(pRequest);
xrtHttpRequestHeaderAt
返回指定位置的借用 Header,越界返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
| size_t iIndex | 下标 |
示例已编译验证
/* 返回指定位置的借用 Header,越界返回空指针。 */ result = xrtHttpRequestHeaderAt(pRequest, iIndex);
xrtHttpRequestHeaders
XRT_API xhttpheaders* xrtHttpRequestHeaders( xhttprequest* pRequest );
示例已编译验证
/* XRT_API xhttpheaders* xrtHttpRequestHeaders( xhttprequest* pRequest ); */ result = xrtHttpRequestHeaders();
xrtHttpRequestSetAuth
校验并设置唯一 Authorization 字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Scheme | 协议方案 |
| xstrview Data | 数据内容 |
示例已编译验证
/* 校验并设置唯一 Authorization 字段。 */ result = xrtHttpRequestSetAuth(pRequest, Scheme, Data);
xrtHttpRequestSetProxyAuth
校验并设置唯一 Proxy-Authorization 字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Scheme | 协议方案 |
| xstrview Data | 数据内容 |
示例已编译验证
/* 校验并设置唯一 Proxy-Authorization 字段。 */ result = xrtHttpRequestSetProxyAuth(pRequest, Scheme, Data);
xrtHttpRequestClearAuth
删除全部 Authorization 字段并返回删除数量。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 删除全部 Authorization 字段并返回删除数量。 */ result = xrtHttpRequestClearAuth(pRequest);
xrtHttpRequestClearProxyAuth
删除全部 Proxy-Authorization 字段并返回删除数量。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 删除全部 Proxy-Authorization 字段并返回删除数量。 */ result = xrtHttpRequestClearProxyAuth(pRequest);
xrtHttpRequestSetBasicAuth
从用户名和密码设置唯一 Basic Authorization 字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview User | 用户名 |
| xstrview Password | 密码 |
示例已编译验证
/* 从用户名和密码设置唯一 Basic Authorization 字段。 */ result = xrtHttpRequestSetBasicAuth(pRequest, User, Password);
xrtHttpRequestSetProxyBasicAuth
从用户名和密码设置唯一 Basic Proxy-Authorization 字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview User | 用户名 |
| xstrview Password | 密码 |
示例已编译验证
/* 从用户名和密码设置唯一 Basic Proxy-Authorization 字段。 */ result = xrtHttpRequestSetProxyBasicAuth(pRequest, User, Password);
xrtHttpRequestSetBearerAuth
从 b64token 设置唯一 Bearer Authorization 字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Token | 令牌 |
示例已编译验证
/* 从 b64token 设置唯一 Bearer Authorization 字段。 */ result = xrtHttpRequestSetBearerAuth(pRequest, Token);
xrtHttpRequestSetProxyBearerAuth
从 b64token 设置唯一 Bearer Proxy-Authorization 字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Token | 令牌 |
示例已编译验证
/* 从 b64token 设置唯一 Bearer Proxy-Authorization 字段。 */ result = xrtHttpRequestSetProxyBearerAuth(pRequest, Token);
xrtHttpRequestSetDigestAuth
规范写出并设置唯一 Digest Authorization 字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| const xhttpdigestauth* pDigest | 摘要 |
示例已编译验证
/* 规范写出并设置唯一 Digest Authorization 字段。 */ result = xrtHttpRequestSetDigestAuth(pRequest, pDigest);
xrtHttpRequestSetProxyDigestAuth
规范写出并设置唯一 Digest Proxy-Authorization 字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| const xhttpdigestauth* pDigest | 摘要 |
示例已编译验证
/* 规范写出并设置唯一 Digest Proxy-Authorization 字段。 */ result = xrtHttpRequestSetProxyDigestAuth(pRequest, pDigest);
xrtHttpRequestSetBody
XRT_API bool xrtHttpRequestSetBody( xhttprequest* pRequest, xhttpbody* pBody );
示例已编译验证
/* XRT_API bool xrtHttpRequestSetBody( xhttprequest* pRequest, xhttpbody* pBody ); */ result = xrtHttpRequestSetBody();
xrtHttpRequestSetBytes
XRT_API bool xrtHttpRequestSetBytes( xhttprequest* pRequest, xbytesview Data, xstrview ContentType );
示例已编译验证
/* XRT_API bool xrtHttpRequestSetBytes( xhttprequest* pRequest, xbytesview Data, xstrview ContentType ); */ result = xrtHttpRequestSetBytes();
xrtHttpRequestBody
返回请求借用的正文对象,可能为空。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回请求借用的正文对象,可能为空。 */ result = xrtHttpRequestBody(pRequest);
xrtHttp1RequestAcceptTrailers
XRT_API bool xrtHttp1RequestAcceptTrailers( xhttprequest* pRequest );
示例已编译验证
/* XRT_API bool xrtHttp1RequestAcceptTrailers( xhttprequest* pRequest ); */ result = xrtHttp1RequestAcceptTrailers();
xrtHttpRequestAddTrailer
追加一个拥有型 Trailer,并保留同名字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Name | 名称(xstrview) |
| xstrview Value | 值 |
示例已编译验证
/* 追加一个拥有型 Trailer,并保留同名字段。 */ result = xrtHttpRequestAddTrailer(pRequest, Name, Value);
xrtHttpRequestSetTrailer
设置首个同名 Trailer,并删除其余同名字段。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Name | 名称(xstrview) |
| xstrview Value | 值 |
示例已编译验证
/* 设置首个同名 Trailer,并删除其余同名字段。 */ result = xrtHttpRequestSetTrailer(pRequest, Name, Value);
xrtHttpRequestRemoveTrailer
删除全部同名 Trailer 并返回删除数量。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| xstrview Name | 名称(xstrview) |
示例已编译验证
/* 删除全部同名 Trailer 并返回删除数量。 */ result = xrtHttpRequestRemoveTrailer(pRequest, Name);
xrtHttpRequestTrailer
返回首个同名借用 Trailer,未找到返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
| xstrview Name | 名称(xstrview) |
示例已编译验证
/* 返回首个同名借用 Trailer,未找到返回空指针。 */ result = xrtHttpRequestTrailer(pRequest, Name);
xrtHttpRequestTrailerCount
返回 Trailer 数量。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回 Trailer 数量。 */ result = xrtHttpRequestTrailerCount(pRequest);
xrtHttpRequestTrailerData
返回连续只读 Trailer 数组;空请求或无字段返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回连续只读 Trailer 数组;空请求或无字段返回空指针。 */ result = xrtHttpRequestTrailerData(pRequest);
xrtHttpRequestTrailerAt
返回指定位置的借用 Trailer,越界返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
| size_t iIndex | 下标 |
示例已编译验证
/* 返回指定位置的借用 Trailer,越界返回空指针。 */ result = xrtHttpRequestTrailerAt(pRequest, iIndex);
xrtHttpRequestTrailers
返回只读 Trailer 容器;从未添加字段时返回空指针且不分配。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回只读 Trailer 容器;从未添加字段时返回空指针且不分配。 */ result = xrtHttpRequestTrailers(pRequest);
xrtHttpRequestEditTrailers
返回可修改 Trailer 容器并在首次调用时创建它。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
示例已编译验证
/* 返回可修改 Trailer 容器并在首次调用时创建它。 */ result = xrtHttpRequestEditTrailers(pRequest);
xrtHttpRequestSetQueryParams
编码并失败原子地替换 URL 查询组件;空容器生成显式空查询。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| const xqueryparams* pParams | 参数对象 |
示例已编译验证
/* 编码并失败原子地替换 URL 查询组件;空容器生成显式空查询。 */ result = xrtHttpRequestSetQueryParams(pRequest, pParams);
xrtHttpRequestSetForm
编码 QueryParams 并失败原子地设置 urlencoded 正文和 Content-Type。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| const xqueryparams* pParams | 参数对象 |
示例已编译验证
/* 编码 QueryParams 并失败原子地设置 urlencoded 正文和 Content-Type。 */ result = xrtHttpRequestSetForm(pRequest, pParams);
xrtHttpRequestSetFormData
使用给定 boundary 设置可流式 multipart/form-data 正文与 Content-Type。
| 参数 | 说明 |
|---|---|
| xhttprequest* pRequest | 请求对象 |
| const xformdata* pForm | 表单对象 |
| const xmultipartboundary* pBoundary | 边界 |
示例已编译验证
/* 使用给定 boundary 设置可流式 multipart/form-data 正文与 Content-Type。 */ result = xrtHttpRequestSetFormData(pRequest, pForm, pBoundary);
xrtHttpRequestSetFormDataRandom
XRT_API bool xrtHttpRequestSetFormDataRandom( xhttprequest* pRequest, const xformdata* pForm, xmultipartboundary* pBoundary );
示例已编译验证
/* XRT_API bool xrtHttpRequestSetFormDataRandom( xhttprequest* pRequest, const xformdata* pForm, xmultipartboundary* pBoundary ); */ result = xrtHttpRequestSetFormDataRandom();
xrtHttp1RequestOptionsInit
初始化默认准备选项;接受未对齐的完整存储并拒绝回绕地址。
| 参数 | 说明 |
|---|---|
| xhttp1requestoptions* pOptions | 选项 |
示例已编译验证
http1requestoptionsinit obj; xrtHttp1RequestOptionsInit(&obj, pOptions);
xrtHttp1RequestPrepare
XRT_API xhttp1requestplan* xrtHttp1RequestPrepare( const xhttprequest* pRequest, const xhttp1requestoptions* pOptions );
示例已编译验证
/* XRT_API xhttp1requestplan* xrtHttp1RequestPrepare( const xhttprequest* pRequest, const xhttp1requestoptions* pOptions ); */ result = xrtHttp1RequestPrepare();
xrtHttp1RequestPrepareDigest
XRT_API xhttp1requestplan* xrtHttp1RequestPrepareDigest( const xhttprequest* pRequest, const xhttp1requestoptions* pOptions, xhttpdigestsession* pSession, xstrview EntityHash, xhttpdigestexchange** ppExchange );
示例已编译验证
/* XRT_API xhttp1requestplan* xrtHttp1RequestPrepareDigest( const xhttprequest* pRequest, const xhttp1requestoptions* pOptions, xhttpdigestsession* pSession, xstrview EntityHash, xhttpdigestexchange** ppExchange ); */ result = xrtHttp1RequestPrepareDigest();
xrtHttp1RequestPrepareProxyDigest
使用同一准备契约生成 Proxy-Authorization Digest 字段。
| 参数 | 说明 |
|---|---|
| const xhttprequest* pRequest | 请求对象 |
| const xhttp1requestoptions* pOptions | 选项 |
| xhttpdigestsession* pSession | 会话对象 |
| xstrview EntityHash | 实体哈希 |
| xhttpdigestexchange** ppExchange | 交换对象 |
示例已编译验证
/* 使用同一准备契约生成 Proxy-Authorization Digest 字段。 */ result = xrtHttp1RequestPrepareProxyDigest(pRequest, pOptions, pSession, EntityHash, ppExchange);
xrtHttp1RequestPlanDestroy
销毁请求计划、线路 Header 和正文引用;空指针是安全的空操作。
| 参数 | 说明 |
|---|---|
| xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
xrtHttp1RequestPlanDestroy(pPlan);
xrtHttp1RequestPlanHead
返回拥有型计划中的完整 HTTP/1.1 Header 字节。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回拥有型计划中的完整 HTTP/1.1 Header 字节。 */ result = xrtHttp1RequestPlanHead(pPlan);
xrtHttp1RequestPlanEnd
返回 chunked 计划冻结的完整 last-chunk;其他模式返回空视图。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回 chunked 计划冻结的完整 last-chunk;其他模式返回空视图。 */ result = xrtHttp1RequestPlanEnd(pPlan);
xrtHttp1RequestPlanMethod
返回计划拥有的请求方法。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回计划拥有的请求方法。 */ result = xrtHttp1RequestPlanMethod(pPlan);
xrtHttp1RequestPlanUrl
返回计划拥有的完整原始 URL;fragment 保留但不进入自动 target。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回计划拥有的完整原始 URL;fragment 保留但不进入自动 target。 */ result = xrtHttp1RequestPlanUrl(pPlan);
xrtHttp1RequestPlanTarget
返回计划拥有的实际 request-target。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回计划拥有的实际 request-target。 */ result = xrtHttp1RequestPlanTarget(pPlan);
xrtHttp1RequestPlanHost
返回连接端点使用的无方括号 URL host,不受 Host Header 覆盖影响。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回连接端点使用的无方括号 URL host,不受 Host Header 覆盖影响。 */ result = xrtHttp1RequestPlanHost(pPlan);
xrtHttp1RequestPlanPort
返回连接端点的显式端口或 scheme 默认端口。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回连接端点的显式端口或 scheme 默认端口。 */ result = xrtHttp1RequestPlanPort(pPlan);
xrtHttp1RequestPlanSecure
判断连接端点是否要求 TLS。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 判断连接端点是否要求 TLS。 */ result = xrtHttp1RequestPlanSecure(pPlan);
xrtHttp1RequestPlanBody
返回计划保留的借用正文对象,可能为空。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回计划保留的借用正文对象,可能为空。 */ result = xrtHttp1RequestPlanBody(pPlan);
xrtHttp1RequestPlanBodyMode
返回发送正文的唯一分帧模式。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回发送正文的唯一分帧模式。 */ result = xrtHttp1RequestPlanBodyMode(pPlan);
xrtHttp1RequestPlanBodyLength
返回正文源声明长度;未知 chunked 正文返回 XHTTP_BODY_UNKNOWN。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 返回正文源声明长度;未知 chunked 正文返回 XHTTP_BODY_UNKNOWN。 */ result = xrtHttp1RequestPlanBodyLength(pPlan);
xrtHttp1RequestPlanClose
判断请求是否显式要求发送后关闭连接。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 判断请求是否显式要求发送后关闭连接。 */ result = xrtHttp1RequestPlanClose(pPlan);
xrtHttp1RequestPlanExpectContinue
判断事务是否必须先等待 100 Continue 或最终响应。
| 参数 | 说明 |
|---|---|
| const xhttp1requestplan* pPlan | 计划对象 |
示例已编译验证
/* 判断事务是否必须先等待 100 Continue 或最终响应。 */ result = xrtHttp1RequestPlanExpectContinue(pPlan);
xrtHttpResponseDestroy
销毁响应拥有的 Header、trailer、正文和文本;空指针是安全的空操作。
| 参数 | 说明 |
|---|---|
| xhttpresponse* pResponse | 响应对象 |
示例已编译验证
xrtHttpResponseDestroy(pResponse);
xrtHttpResponseVersion
返回 HTTP 版本;空响应返回零。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回 HTTP 版本;空响应返回零。 */ result = xrtHttpResponseVersion(pResponse);
xrtHttpResponseStatus
返回三位响应状态码;空响应返回零。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回三位响应状态码;空响应返回零。 */ result = xrtHttpResponseStatus(pResponse);
xrtHttpResponseSuccess
判断响应状态是否属于 200 到 299。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 判断响应状态是否属于 200 到 299。 */ result = xrtHttpResponseSuccess(pResponse);
xrtHttpResponseReason
返回借用的 reason phrase,不包含前导空格。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回借用的 reason phrase,不包含前导空格。 */ result = xrtHttpResponseReason(pResponse);
xrtHttpResponseFlags
返回响应稳定标志。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回响应稳定标志。 */ result = xrtHttpResponseFlags(pResponse);
xrtHttpResponseHeader
返回首个同名借用 Header,未找到返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| xstrview Name | 名称(xstrview) |
示例已编译验证
/* 返回首个同名借用 Header,未找到返回空指针。 */ result = xrtHttpResponseHeader(pResponse, Name);
xrtHttpResponseHeaderCount
返回 Header 数量。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回 Header 数量。 */ result = xrtHttpResponseHeaderCount(pResponse);
xrtHttpResponseHeaderData
返回连续只读 Header 数组;空响应或无字段返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回连续只读 Header 数组;空响应或无字段返回空指针。 */ result = xrtHttpResponseHeaderData(pResponse);
xrtHttpResponseHeaderAt
返回指定位置的借用 Header,越界返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| size_t iIndex | 下标 |
示例已编译验证
/* 返回指定位置的借用 Header,越界返回空指针。 */ result = xrtHttpResponseHeaderAt(pResponse, iIndex);
xrtHttpResponseHeaders
XRT_API const xhttpheaders* xrtHttpResponseHeaders( const xhttpresponse* pResponse );
示例已编译验证
/* XRT_API const xhttpheaders* xrtHttpResponseHeaders( const xhttpresponse* pResponse ); */ result = xrtHttpResponseHeaders();
xrtHttpResponseChallengeNext
XRT_API xhttpnext xrtHttpResponseChallengeNext( const xhttpresponse* pResponse, xhttpauthcursor* pCursor, xhttpauth* pChallenge );
示例已编译验证
/* XRT_API xhttpnext xrtHttpResponseChallengeNext( const xhttpresponse* pResponse, xhttpauthcursor* pCursor, xhttpauth* pChallenge ); */ result = xrtHttpResponseChallengeNext();
xrtHttpResponseProxyChallengeNext
跨全部 Proxy-Authenticate 字段迭代代理 challenge;输出契约与源站一致。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| xhttpauthcursor* pCursor | 游标 |
| xhttpauth* pChallenge | 挑战 |
示例已编译验证
/* 跨全部 Proxy-Authenticate 字段迭代代理 challenge;输出契约与源站一致。 */ result = xrtHttpResponseProxyChallengeNext(pResponse, pCursor, pChallenge);
xrtHttpResponseBasicChallengeNext
XRT_API xhttpnext xrtHttpResponseBasicChallengeNext( const xhttpresponse* pResponse, xhttpauthcursor* pCursor, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbasicchallenge* pChallenge );
示例已编译验证
/* XRT_API xhttpnext xrtHttpResponseBasicChallengeNext( const xhttpresponse* pResponse, xhttpauthcursor* pCursor, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbasicchallenge* pChallenge ); */ result = xrtHttpResponseBasicChallengeNext();
xrtHttpResponseProxyBasicChallengeNext
迭代并解码代理 Basic challenge,缓冲与游标契约和源站入口一致。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| xhttpauthcursor* pCursor | 游标 |
| void* pOutput | 出:输出缓冲 |
| size_t iCapacity | 容量 |
| size_t* pSize | 出:大小 |
| xhttpbasicchallenge* pChallenge | 挑战 |
示例已编译验证
/* 迭代并解码代理 Basic challenge,缓冲与游标契约和源站入口一致。 */ result = xrtHttpResponseProxyBasicChallengeNext(pResponse, pCursor, pOutput, iCapacity, pSize, pChallenge);
xrtHttpResponseBearerChallengeNext
XRT_API xhttpnext xrtHttpResponseBearerChallengeNext( const xhttpresponse* pResponse, xhttpauthcursor* pCursor, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbearerchallenge* pChallenge );
示例已编译验证
/* XRT_API xhttpnext xrtHttpResponseBearerChallengeNext( const xhttpresponse* pResponse, xhttpauthcursor* pCursor, void* pOutput, size_t iCapacity, size_t* pSize, xhttpbearerchallenge* pChallenge ); */ result = xrtHttpResponseBearerChallengeNext();
xrtHttpResponseProxyBearerChallengeNext
迭代并解码代理 Bearer challenge,缓冲与游标契约和源站入口一致。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| xhttpauthcursor* pCursor | 游标 |
| void* pOutput | 出:输出缓冲 |
| size_t iCapacity | 容量 |
| size_t* pSize | 出:大小 |
| xhttpbearerchallenge* pChallenge | 挑战 |
示例已编译验证
/* 迭代并解码代理 Bearer challenge,缓冲与游标契约和源站入口一致。 */ result = xrtHttpResponseProxyBearerChallengeNext(pResponse, pCursor, pOutput, iCapacity, pSize, pChallenge);
xrtHttpResponseDigestChallengeNext
迭代并解码源站 Digest challenge;查询和失败不推进游标。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| xhttpauthcursor* pCursor | 游标 |
| void* pOutput | 出:输出缓冲 |
| size_t iCapacity | 容量 |
| size_t* pSize | 出:大小 |
| xhttpdigestchallenge* pChallenge | 挑战 |
示例已编译验证
/* 迭代并解码源站 Digest challenge;查询和失败不推进游标。 */ result = xrtHttpResponseDigestChallengeNext(pResponse, pCursor, pOutput, iCapacity, pSize, pChallenge);
xrtHttpResponseProxyDigestChallengeNext
迭代并解码代理 Digest challenge;契约与源站入口一致。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| xhttpauthcursor* pCursor | 游标 |
| void* pOutput | 出:输出缓冲 |
| size_t iCapacity | 容量 |
| size_t* pSize | 出:大小 |
| xhttpdigestchallenge* pChallenge | 挑战 |
示例已编译验证
/* 迭代并解码代理 Digest challenge;契约与源站入口一致。 */ result = xrtHttpResponseProxyDigestChallengeNext(pResponse, pCursor, pOutput, iCapacity, pSize, pChallenge);
xrtHttpResponseDigestChallengeChoose
XRT_API xhttpnext xrtHttpResponseDigestChallengeChoose( const xhttpresponse* pResponse, const xhttpdigestpolicy* pPolicy, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestchallenge* pChallenge, xhttpdigestchoice* pChoice );
示例已编译验证
/* XRT_API xhttpnext xrtHttpResponseDigestChallengeChoose( const xhttpresponse* pResponse, const xhttpdigestpolicy* pPolicy, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestchallenge* pChallenge, xhttpdigestchoice* pChoice ); */ result = xrtHttpResponseDigestChallengeChoose();
xrtHttpResponseProxyDigestChallengeChoose
选择首个满足本地策略的代理 Digest challenge;契约与源站入口一致。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| const xhttpdigestpolicy* pPolicy | 策略 |
| void* pOutput | 出:输出缓冲 |
| size_t iCapacity | 容量 |
| size_t* pSize | 出:大小 |
| xhttpdigestchallenge* pChallenge | 挑战 |
| xhttpdigestchoice* pChoice | Choce 参数 |
示例已编译验证
/* 选择首个满足本地策略的代理 Digest challenge;契约与源站入口一致。 */ result = xrtHttpResponseProxyDigestChallengeChoose(pResponse, pPolicy, pOutput, iCapacity, pSize, pChallenge, pChoice);
xrtHttpResponseDigestInfo
XRT_API xhttpnext xrtHttpResponseDigestInfo( const xhttpresponse* pResponse, xhttpdigestalgorithm Algorithm, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestinfo* pInfo );
示例已编译验证
/* XRT_API xhttpnext xrtHttpResponseDigestInfo( const xhttpresponse* pResponse, xhttpdigestalgorithm Algorithm, void* pOutput, size_t iCapacity, size_t* pSize, xhttpdigestinfo* pInfo ); */ result = xrtHttpResponseDigestInfo();
xrtHttpResponseProxyDigestInfo
解析唯一 Proxy-Authentication-Info;算法由原请求上下文提供。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| xhttpdigestalgorithm Algorithm | 算法标识 |
| void* pOutput | 出:输出缓冲 |
| size_t iCapacity | 容量 |
| size_t* pSize | 出:大小 |
| xhttpdigestinfo* pInfo | 上下文信息 |
示例已编译验证
/* 解析唯一 Proxy-Authentication-Info;算法由原请求上下文提供。 */ result = xrtHttpResponseProxyDigestInfo(pResponse, Algorithm, pOutput, iCapacity, pSize, pInfo);
xrtHttpResponseDigestSessionAccept
XRT_API xhttpnext xrtHttpResponseDigestSessionAccept( const xhttpresponse* pResponse, xhttpdigestsession* pSession, const xhttpdigestexchange* pExchange, xstrview ResponseEntityHash, xstrview NextCnonce, xhttpdigestsessioncheck* pCheck );
示例已编译验证
/* XRT_API xhttpnext xrtHttpResponseDigestSessionAccept( const xhttpresponse* pResponse, xhttpdigestsession* pSession, const xhttpdigestexchange* pExchange, xstrview ResponseEntityHash, xstrview NextCnonce, xhttpdigestsessioncheck* pCheck ); */ result = xrtHttpResponseDigestSessionAccept();
xrtHttpResponseProxyDigestSessionAccept
解析并验证代理 Digest 回执;返回与状态契约和源站入口一致。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| xhttpdigestsession* pSession | 会话对象 |
| const xhttpdigestexchange* pExchange | 交换对象 |
| xstrview ResponseEntityHash | ResonseEnttyHash 参数 |
| xstrview NextCnonce | NextCnonce 参数 |
| xhttpdigestsessioncheck* pCheck | Check 参数 |
示例已编译验证
/* 解析并验证代理 Digest 回执;返回与状态契约和源站入口一致。 */ result = xrtHttpResponseProxyDigestSessionAccept(pResponse, pSession, pExchange, ResponseEntityHash, NextCnonce, pCheck);
xrtHttpResponseContentType
XRT_API xhttpnext xrtHttpResponseContentType( const xhttpresponse* pResponse, xmediatype* pType );
示例已编译验证
/* XRT_API xhttpnext xrtHttpResponseContentType( const xhttpresponse* pResponse, xmediatype* pType ); */ result = xrtHttpResponseContentType();
xrtHttpResponseSetCookieNext
XRT_API xhttpnext xrtHttpResponseSetCookieNext( const xhttpresponse* pResponse, size_t* pHeaderIndex, xsetcookie* pCookie );
示例已编译验证
/* XRT_API xhttpnext xrtHttpResponseSetCookieNext( const xhttpresponse* pResponse, size_t* pHeaderIndex, xsetcookie* pCookie ); */ result = xrtHttpResponseSetCookieNext();
xrtHttpResponseTrailer
返回首个同名借用 trailer,未找到返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| xstrview Name | 名称(xstrview) |
示例已编译验证
/* 返回首个同名借用 trailer,未找到返回空指针。 */ result = xrtHttpResponseTrailer(pResponse, Name);
xrtHttpResponseTrailerCount
返回 trailer 数量。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回 trailer 数量。 */ result = xrtHttpResponseTrailerCount(pResponse);
xrtHttpResponseTrailerData
返回连续只读 trailer 数组;空响应或无字段返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回连续只读 trailer 数组;空响应或无字段返回空指针。 */ result = xrtHttpResponseTrailerData(pResponse);
xrtHttpResponseTrailerAt
返回指定位置的借用 trailer,越界返回空指针。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
| size_t iIndex | 下标 |
示例已编译验证
/* 返回指定位置的借用 trailer,越界返回空指针。 */ result = xrtHttpResponseTrailerAt(pResponse, iIndex);
xrtHttpResponseTrailers
XRT_API const xhttpheaders* xrtHttpResponseTrailers( const xhttpresponse* pResponse );
示例已编译验证
/* XRT_API const xhttpheaders* xrtHttpResponseTrailers( const xhttpresponse* pResponse ); */ result = xrtHttpResponseTrailers();
xrtHttpResponseBody
返回缓冲模式下的连续正文;流式模式返回空视图。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回缓冲模式下的连续正文;流式模式返回空视图。 */ result = xrtHttpResponseBody(pResponse);
xrtHttpResponseBodyBytes
返回已缓冲或已通过流式回调交付的正文总字节数。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回已缓冲或已通过流式回调交付的正文总字节数。 */ result = xrtHttpResponseBodyBytes(pResponse);
xrtHttpResponseWireBodyBytes
返回收到的编码正文载荷字节数,不包含 HTTP/1 chunk 元数据。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回收到的编码正文载荷字节数,不包含 HTTP/1 chunk 元数据。 */ result = xrtHttpResponseWireBodyBytes(pResponse);
xrtHttpResponseOriginalEncoding
XRT_API xstrview xrtHttpResponseOriginalEncoding( const xhttpresponse* pResponse );
示例已编译验证
/* XRT_API xstrview xrtHttpResponseOriginalEncoding( const xhttpresponse* pResponse ); */ result = xrtHttpResponseOriginalEncoding();
xrtHttpResponseBodyText
复制正文并附加零字符;返回值由 xrtFree 释放,二进制零字节原样保留。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 复制正文并附加零字符;返回值由 xrtFree 释放,二进制零字节原样保留。 */ result = xrtHttpResponseBodyText(pResponse);
xrtHttpResponseUrl
返回借用的最终有效 URL 文本。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回借用的最终有效 URL 文本。 */ result = xrtHttpResponseUrl(pResponse);
xrtHttpResponseRedirects
返回到达最终响应前实际跟随的重定向跳数。
| 参数 | 说明 |
|---|---|
| const xhttpresponse* pResponse | 响应对象 |
示例已编译验证
/* 返回到达最终响应前实际跟随的重定向跳数。 */ result = xrtHttpResponseRedirects(pResponse);