openharmony 鸿蒙 capi-net-http-interceptor-type-h

2026-08-25 浏览 (1)

http_interceptor_type.h

概述

为HTTP全局拦截器模块提供C接口的数据结构定义,包含拦截器的请求/响应头信息、HTTP请求/响应数据包结构、拦截器配置信息以及相关的枚举类型和函数指针。

引用文件: <network/netstack/http_interceptor_type.h>

库: libhttp_interceptor.so

系统能力: SystemCapability.Communication.NetStack

起始版本: 24

相关模块: netstack

汇总

结构体

名称typedef关键字描述
OH_Http_Interceptor_HeadersOH_Http_Interceptor_Headers定义拦截器的请求/响应头信息。
OH_Http_Interceptor_RequestOH_Http_Interceptor_Request定义拦截器的HTTP请求数据包结构。
OH_Http_Interceptor_ResponseOH_Http_Interceptor_Response定义拦截器的HTTP响应数据包结构。
OH_Http_InterceptorOH_Http_Interceptor定义HTTP全局拦截器的配置信息。

枚举

名称typedef关键字描述
OH_Interceptor_StageOH_Interceptor_Stage定义拦截器的执行阶段。
OH_Interceptor_TypeOH_Interceptor_Type定义拦截器的类型。
OH_Interceptor_ResultOH_Interceptor_Result定义拦截器的处理结果。

函数

名称typedef关键字描述
typedef OH_Interceptor_Result (*OH_Http_InterceptorHandler)(OH_Http_Interceptor_Request *request, OH_Http_Interceptor_Response *response, int32_t *isModified)OH_Http_InterceptorHandler指向HTTP拦截器处理函数的指针。

枚举类型说明

OH_Interceptor_Stage

typedef enum OH_Interceptor_Stage {
    OH_STAGE_REQUEST,
    OH_STAGE_RESPONSE
} OH_Interceptor_Stage;

描述

定义拦截器的执行阶段。

起始版本: 24

参数:

枚举项描述
OH_STAGE_REQUEST拦截器处理请求。
OH_STAGE_RESPONSE拦截器处理响应。

OH_Interceptor_Type

typedef enum OH_Interceptor_Type {
    OH_TYPE_READ_ONLY
} OH_Interceptor_Type;

描述

定义拦截器的类型。

起始版本: 24

参数:

枚举项描述
OH_TYPE_READ_ONLY只读拦截器。

OH_Interceptor_Result

typedef enum OH_Interceptor_Result {
    OH_CONTINUE,
    OH_ABORT
} OH_Interceptor_Result;

描述

定义拦截器的处理结果。

起始版本: 24

参数:

枚举项描述
OH_CONTINUE继续处理。
OH_ABORT拦截处理。

函数说明

OH_Http_InterceptorHandler()

typedef OH_Interceptor_Result (*OH_Http_InterceptorHandler)(
    OH_Http_Interceptor_Request *request,
    OH_Http_Interceptor_Response *response,
    int32_t *isModified);

描述

定义HTTP拦截器处理函数。

起始版本: 24

参数:

参数项描述
OH_Http_Interceptor_Request *requestHTTP请求数据包指针(仅在请求阶段有效)。
OH_Http_Interceptor_Response *responseHTTP响应数据包指针(仅在响应阶段有效)。
int32_t *isModified输出参数,标识拦截器是否修改了数据包,对OH_TYPE_READ_ONLY类型拦截器不生效。

返回:

类型说明
OH_Interceptor_Result拦截器处理结果:- OH_CONTINUE:继续处理 - OH_ABORT:拦截处理。

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-netconnection-netconn-connectionproperties

openharmony 鸿蒙 errorcode-net-mdns

openharmony 鸿蒙 js-apis-net-ethernet-sys

openharmony 鸿蒙 errorcode-net-http

openharmony 鸿蒙 capi-netstack-http-proxy

openharmony 鸿蒙 js-apis-system-fetch

openharmony 鸿蒙 errorcode-kernel

openharmony 鸿蒙 capi-netstack-netstack-certblob

openharmony 鸿蒙 js-apis-net-mdns

openharmony 鸿蒙 capi-netstack-websocket-closeoption

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/iTAhKpFg