xrtHttpStaticPathConfigInit
初始化根挂载、可移植文件名和默认拒绝隐藏段的安全配置;输出结构可以未对齐。
| 参数 | 说明 |
|---|---|
| xhttpstaticpathconfig* pConfig | 配置结构 |
示例已编译验证
httpstaticpathconfiginit obj; xrtHttpStaticPathConfigInit(&obj);
xrtHttpStaticPathWrite
XRT_API xhttpstaticpathstatus xrtHttpStaticPathWrite( xstrview RawPath, const xhttpstaticpathconfig* pConfig, char* sOutput, size_t iCapacity, size_t* pSize, bool* pTrailingSlash );
示例已编译验证
/* XRT_API xhttpstaticpathstatus xrtHttpStaticPathWrite( xstrview RawPath, const xhttpstaticpathconfig* pConfig, char* sOutput, size_t iCapacity, size_t* pSize, bool* pTrailingSlash ); */ result = xrtHttpStaticPathWrite();
xrtHttpStaticPathInit
初始化一个可交给映射与释放函数使用的空拥有型结果;结果结构可以未对齐。
| 参数 | 说明 |
|---|---|
| xhttpstaticpath* pPath | 路径 |
示例已编译验证
httpstaticpathinit obj; xrtHttpStaticPathInit(&obj, pPath);
xrtHttpStaticPathMap
XRT_API bool xrtHttpStaticPathMap( xstrview RawPath, const xhttpstaticpathconfig* pConfig, xhttpstaticpath* pPath );
示例已编译验证
/* XRT_API bool xrtHttpStaticPathMap( xstrview RawPath, const xhttpstaticpathconfig* pConfig, xhttpstaticpath* pPath ); */ result = xrtHttpStaticPathMap();
xrtHttpStaticPathFree
释放拥有型路径并恢复为空结果;空指针和空结果均可安全传入。
| 参数 | 说明 |
|---|---|
| xhttpstaticpath* pPath | 路径 |
示例已编译验证
xrtHttpStaticPathFree(pPath);
xrtHttpStaticFileOpen
XRT_API xhttpstaticfile* xrtHttpStaticFileOpen( xtaskpool* pPool, xroot Root, cstr sPath );
示例已编译验证
/* XRT_API xhttpstaticfile* xrtHttpStaticFileOpen( xtaskpool* pPool, xroot Root, cstr sPath ); */ result = xrtHttpStaticFileOpen();
xrtHttpStaticFileFuture
XRT_API xfuture* xrtHttpStaticFileFuture( xtaskpool* pPool, xroot Root, cstr sPath );
示例已编译验证
/* XRT_API xfuture* xrtHttpStaticFileFuture( xtaskpool* pPool, xroot Root, cstr sPath ); */ result = xrtHttpStaticFileFuture();
xrtHttpStaticFileRef
增加静态文件资源引用并返回原指针。
| 参数 | 说明 |
|---|---|
| xhttpstaticfile* pFile | 源文件名 |
示例已编译验证
/* 增加静态文件资源引用并返回原指针。 */ result = xrtHttpStaticFileRef(pFile);
xrtHttpStaticFileDestroy
释放资源引用;尚未取走的异步文件会进入异步关闭流程。
| 参数 | 说明 |
|---|---|
| xhttpstaticfile* pFile | 源文件名 |
示例已编译验证
xrtHttpStaticFileDestroy(pFile);
xrtHttpStaticFileInfo
返回从最终打开文件句柄取得的借用只读元数据。
| 参数 | 说明 |
|---|---|
| const xhttpstaticfile* pFile | 源文件名 |
示例已编译验证
/* 返回从最终打开文件句柄取得的借用只读元数据。 */ result = xrtHttpStaticFileInfo(pFile);
xrtHttpStaticFileRepresentation
XRT_API const xhttprepresentation* xrtHttpStaticFileRepresentation( const xhttpstaticfile* pFile );
示例已编译验证
/* XRT_API const xhttprepresentation* xrtHttpStaticFileRepresentation( const xhttpstaticfile* pFile ); */ result = xrtHttpStaticFileRepresentation();
xrtHttpStaticFileSize
返回静态文件的完整字节长度;参数无效时返回零并设置错误。
| 参数 | 说明 |
|---|---|
| const xhttpstaticfile* pFile | 源文件名 |
示例已编译验证
/* 返回静态文件的完整字节长度;参数无效时返回零并设置错误。 */ result = xrtHttpStaticFileSize(pFile);
xrtHttpStaticFileTakeFile
XRT_API xasyncfile* xrtHttpStaticFileTakeFile( xhttpstaticfile* pFile );
示例已编译验证
/* XRT_API xasyncfile* xrtHttpStaticFileTakeFile( xhttpstaticfile* pFile ); */ result = xrtHttpStaticFileTakeFile();
xrtHttpStaticFileTakeBody
XRT_API xhttpbody* xrtHttpStaticFileTakeBody( xhttpstaticfile* pFile, uint64 iOffset, uint64 iLength );
示例已编译验证
/* XRT_API xhttpbody* xrtHttpStaticFileTakeBody( xhttpstaticfile* pFile, uint64 iOffset, uint64 iLength ); */ result = xrtHttpStaticFileTakeBody();
xrtHttpStaticFileTakeBodyAll
一次性创建并取走完整文件正文。
| 参数 | 说明 |
|---|---|
| xhttpstaticfile* pFile | 源文件名 |
示例已编译验证
/* 一次性创建并取走完整文件正文。 */ result = xrtHttpStaticFileTakeBodyAll(pFile);
xrtHttpStaticPlanConfigInit
初始化静态响应计划默认值;输出可以未对齐,但必须覆盖完整结构范围。
| 参数 | 说明 |
|---|---|
| xhttpstaticplanconfig* pConfig | 配置结构 |
示例已编译验证
httpstaticplanconfiginit obj; xrtHttpStaticPlanConfigInit(&obj);
xrtHttpStaticPlanBuild
XRT_API bool xrtHttpStaticPlanBuild( xstrview Method, const xhttpfield* pFields, size_t iFieldCount, const xhttprepresentation* pCurrent, uint64 iLength, xhttpbyterange* pRanges, size_t iRangeCapacity, const xhttpstaticplanconfig* pConfig, xhttpstaticplan* pPlan );
示例已编译验证
/* XRT_API bool xrtHttpStaticPlanBuild( xstrview Method, const xhttpfield* pFields, size_t iFieldCount, const xhttprepresentation* pCurrent, uint64 iLength, xhttpbyterange* pRanges, size_t iRangeCapacity, const xhttpstaticplanconfig* pConfig, xhttpstaticplan* pPlan ); */ result = xrtHttpStaticPlanBuild();
xrtHttpStaticResponseConfigInit
初始化默认响应配置;输出可以未对齐,但必须覆盖完整且不回绕的结构范围。
| 参数 | 说明 |
|---|---|
| xhttpstaticresponseconfig* pConfig | 配置结构 |
示例已编译验证
httpstaticresponseconfiginit obj; xrtHttpStaticResponseConfigInit(&obj);
xrtHttpStaticResponseBuild
XRT_API bool xrtHttpStaticResponseBuild( const xhttpstaticplan* pPlan, const xhttpbyterange* pRanges, const xhttprepresentation* pCurrent, const xhttpstaticresponseconfig* pConfig, void* pWorkspace, size_t iCapacity, size_t* pSize, xhttpstaticresponse* pResponse );
示例已编译验证
/* XRT_API bool xrtHttpStaticResponseBuild( const xhttpstaticplan* pPlan, const xhttpbyterange* pRanges, const xhttprepresentation* pCurrent, const xhttpstaticresponseconfig* pConfig, void* pWorkspace, size_t iCapacity, size_t* pSize, xhttpstaticresponse* pResponse ); */ result = xrtHttpStaticResponseBuild();
xrtHttpStaticMultipartBodyAdopt
XRT_API xhttpbody* xrtHttpStaticMultipartBodyAdopt( xasyncfile* pFile, const xhttpbyterange* pRanges, size_t iRangeCount, uint64 iCompleteLength, xstrview ContentType, xstrview Boundary );
示例已编译验证
/* XRT_API xhttpbody* xrtHttpStaticMultipartBodyAdopt( xasyncfile* pFile, const xhttpbyterange* pRanges, size_t iRangeCount, uint64 iCompleteLength, xstrview ContentType, xstrview Boundary ); */ result = xrtHttpStaticMultipartBodyAdopt();
xrtHttpStaticFileTakeMultipartBody
XRT_API xhttpbody* xrtHttpStaticFileTakeMultipartBody( xhttpstaticfile* pFile, const xhttpbyterange* pRanges, size_t iRangeCount, xstrview ContentType, xstrview Boundary );
示例已编译验证
/* XRT_API xhttpbody* xrtHttpStaticFileTakeMultipartBody( xhttpstaticfile* pFile, const xhttpbyterange* pRanges, size_t iRangeCount, xstrview ContentType, xstrview Boundary ); */ result = xrtHttpStaticFileTakeMultipartBody();