diff --git a/README.md b/README.md index 50c5c57bdcfe8501c88ae54fb0bd5ae1bb15ee00..0336ebb4da27d2449913390cf8a18b22bde1880e 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,54 @@ upper layer applications build HTTP communication capabilities. ![structure](./figures/structure.png) +The following is the description information for the key fields in the figure above: + +- `APP`: A direct user facing upper level application that requires the ability to upload and download. +- `request`: The component in the OpenHarmony system service layer that provides upload and download capabilities. +- `netstack`: The system component in the OpenHarmony system service layer that provides network protocol stack functionality. +- `ylong_http`: The system component in the OpenHarmony system service layer that provides HTTP protocol stack functionality. + - `ylong_http_client`: One of the modules under `ylong_http` provides HTTP client capabilities. + - `ylong_http`: One of the modules under `ylong_http` provides the basic components of HTTP. +- `ylong_runtime`: Rust asynchronous runtime library provided by `ylong` in the system service layer. +- `tokio`: The third-party rust asynchronous runtime library commonly used in the industry. +- `OpenSSL`: A commonly used third-party TLS implementation library in the industry. + ### The internal structure of ylong_http ![inner_structure](./figures/inner_structure.png) +The following is the description information for the key fields in the figure above: + +- `ylong_http_client`: One of the modules under `ylong_http` provides HTTP client capabilities. + - `sync_impl`: Synchronize HTTP client implementation without relying on any runtime. + - `Client`: Synchronize HTTP clients to send HTTP requests. + - `ConnectionPool`: Manage all `Dispatchers`. + - `Dispatcher`: Manage the usage rights of `Connections`. + - `Connector`: Used to create a synchronous connection. + - `Connections`: Synchronous TCP or TLS connections, etc. + - `async_impl`: Asynchronous HTTP client implementation. + - `Client`: Asynchronous HTTP client used to send HTTP requests. + - `ConnectionPool`: Manage all `Dispatchers`. + - `Dispatcher`: Manage the usage rights of `Connections`. + - `Connector`: Used to create an asynchronous connection. + - `Connections`: Asynchronous TCP or TLS connections, etc. + - `Util`: Contains common components for both synchronous and asynchronous HTTP client implementations. + - `Redirect`: HTTP automatic redirection policy. + - `Proxy`: HTTP proxy policy. + - `Pool`: Universal Connection pool implementation. + - `OpenSSL_adapter`: OpenSSL Rust adaptation layer. +- `ylong_http`: One of the modules under `ylong_http` provides the basic components of HTTP. + - `Request`: HTTP Request implementation. + - `Response`: HTTP Response implementation. + - `Body`: HTTP message body implementation. + - `TextBody`: HTTP message body in plain text. + - `EmptyBody`: Empty message body implementation. + - `Mime`: Multipart message body implementation. + - `ylong_http`: ChunkBody message body implementation. + - `H1`: HTTP1 related component implementation. + - `H2`: HTTP2 related component implementation. + - `H3`: HTTP3 related component implementation. + ### ylong_http_client crate `ylong_http_client` crate supports HTTP client functionality and allows users diff --git a/README_zh.md b/README_zh.md index ece1ab861157e58ab2103436327b662fd640d978..fcac8e28fff5988401ff7813ca483cc2de724cc2 100644 --- a/README_zh.md +++ b/README_zh.md @@ -10,10 +10,54 @@ ylong_http 协议栈主体使用 Rust 语言编写,为 OpenHarmony 的 Rust ylong_http 向 OpenHarmony 系统服务层中的网络协议栈模块提供 HTTP 协议支持,经由网络协议栈模块帮助上层应用建立 HTTP 通信能力。 -![structure](./figures/structure_zh.png) +![structure](./figures/structure.png) + +以下是对于上图关键字段的描述信息: + +- `APP`:需要使用上传下载能力的直接面向用户的上层应用。 +- `request`:OpenHarmony 系统服务层提供上传下载能力的组件。 +- `netstack`:OpenHarmony 系统服务层提供网络协议栈功能的系统组件。 +- `ylong_http`:OpenHarmony 系统服务层提供 HTTP 协议栈功能的系统组件,使用 Rust 编写。 + - `ylong_http_client`:`ylong_http` 下的模块之一,提供 HTTP 客户端能力。 + - `ylong_http`:`ylong_http` 下的模块之一,提供 HTTP 的基础组件。 +- `ylong_runtime`:`ylong` 在系统服务层提供的 Rust 异步运行时库。 +- `tokio`:业界常用的第三方 Rust 异步运行时库。 +- `OpenSSL`:业界常用的第三方 TLS 实现库, C 语言实现。 ### ylong_http 的内部架构: -![inner_structure](./figures/inner_structure_zh.png) +![inner_structure](./figures/inner_structure.png) + +以下是对于上图关键字段的描述信息: + +- `ylong_http_client` 库:`ylong_http` 下的模块之一,提供 HTTP 客户端能力。 + - `sync_impl`:同步 HTTP 客户端实现,不依赖于任何运行时。 + - `Client`:同步 HTTP 客户端,用于发送 HTTP 请求。 + - `ConnectionPool`:管理所有的 `Dispatcher`。 + - `Dispatcher`:管理 `Connections` 的使用权。 + - `Connector`:用于创建同步连接。 + - `Connections`:同步的 TCP 或 TLS 连接等。 + - `async_impl`:异步 HTTP 客户端实现,不依赖于任何运行时。 + - `Client`:异步 HTTP 客户端,用于发送 HTTP 请求。 + - `ConnectionPool`:管理所有的 `Dispatcher`。 + - `Dispatcher`:管理 `Connections` 的使用权。 + - `Connector`:用于创建异步连接。 + - `Connections`:异步的 TCP 或 TLS 连接等。 + - `Util`:包含同步和异步 HTTP 客户端实现的共同组件。 + - `Redirect`:HTTP 自动重定向策略。 + - `Proxy`:HTTP 代理策略。 + - `Pool`:通用的连接池实现。 + - `OpenSSL_adapter`:OpenSSL Rust 适配层。 +- `ylong_http`:提供 HTTP 基础组件的模块。 + - `Request`:HTTP 请求实现 + - `Response`:HTTP 响应实现 + - `Body`:HTTP 消息体实现,提供基础的 trait。 + - `TextBody`:纯文本的消息体实现。 + - `EmptyBody`:空的消息体实现。 + - `Mime`:Multipart 消息体实现。 + - `ylong_http`:ChunkBody 消息体实现。 + - `H1`:HTTP1 相关组件实现。 + - `H2`:HTTP2 相关组件实现。 + - `H3`:HTTP3 相关组件实现。 ### ylong_http_client 库 diff --git a/figures/inner_structure.png b/figures/inner_structure.png index d70db04218492e0a96cf9b8206a2d461dc5de923..ee3031abba57639f18aa57800c21c6b6a80b162c 100644 Binary files a/figures/inner_structure.png and b/figures/inner_structure.png differ diff --git a/figures/inner_structure_zh.png b/figures/inner_structure_zh.png deleted file mode 100644 index 1a8af7d98fbce1e8ed00a7679452c79ec4e5a738..0000000000000000000000000000000000000000 Binary files a/figures/inner_structure_zh.png and /dev/null differ diff --git a/figures/structure.png b/figures/structure.png index 54499185631bbfd27e816128d5bffc6d8fdea4aa..830c08da13bcffa1d3b64f36e6ff490770ec39fa 100644 Binary files a/figures/structure.png and b/figures/structure.png differ diff --git a/figures/structure_zh.png b/figures/structure_zh.png deleted file mode 100644 index fa9a1fd3513d9ca807e350e0af8b28b1890fdbb6..0000000000000000000000000000000000000000 Binary files a/figures/structure_zh.png and /dev/null differ