From 0a47084940bc11a6330f9a665e58942bfd5080f4 Mon Sep 17 00:00:00 2001 From: hu-kai45 Date: Tue, 20 Jun 2023 11:04:53 +0800 Subject: [PATCH] =?UTF-8?q?ylong=5Fhttp=20README=20=E5=92=8C=20gn=20?= =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hu-kai45 --- README.en.md | 36 --------------- README.md | 88 ++++++++++++++++++++++++++++--------- README_zh.md | 84 +++++++++++++++++++++++++++++++++++ ylong_http/README.md | 14 +++--- ylong_http_client/README.md | 10 ++--- 5 files changed, 163 insertions(+), 69 deletions(-) delete mode 100644 README.en.md create mode 100644 README_zh.md diff --git a/README.en.md b/README.en.md deleted file mode 100644 index ec02095..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# commonlibrary_rust_ylong_http - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 92fce44..42fb99c 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,86 @@ -# ylong_http_client +# ylong_http -### 简介 +## Introduction -ylong_http_client 支持用户构建 HTTP 客户端,支持用户使用该客户端向服务器发送请求,接收并解析服务器返回的响应。 +`ylong_http` has built a complete HTTP capability, supporting users to use HTTP +capability to meet the needs of communication scenarios. -##### Client +`ylong_http` is written in Rust. -ylong_http_client 支持用户创建同步或者异步 HTTP 客户端,用户可以使用 mod 区分两种客户端。 +### ylong_http_client crate -- `sync_impl::Client`:同步 HTTP 客户端,整体流程使用同步接口。 +`ylong_http_client` crate supports HTTP client functionality and allows users +to create HTTP clients to send HTTP requests to specified servers. -- `async_impl::Client`:异步 HTTP 客户端,整体流程使用异步接口。 +Abilities supported by the current `ylong_http_client` crate: -不论是同步还是异步客户端,都具有相同的功能,例如:连接复用、自动重定向、自动重试、设置代理等功能。 +- Synchronous and asynchronous HTTP clients. +- HTTP/1.1 and HTTP/2 protocol versions. +- Proxy. +- Redirect. +- Automatic retry. +- Progress callback. +- Connection management and reuse. -ylong_http_client 创建的客户端支持以下 HTTP 版本: +### ylong_http crate -- `HTTP/1.1` +`ylong_http` crate provides various basic components of the HTTP protocol, such +as serialization components, compression components, etc. -- `HTTP/2` +Abilities supported by the current `ylong_http` crate: -- `HTTP/3` +- Serializer and deserializer of `HTTP/1.1` and `HTTP/2`. +- HPACK implementation. +- Basic types of HTTP Request and HTTP Response. +- Body trait and implementations of bodies. -##### Request 和 Response +## Build -ylong_http_client 使用 ylong_http 库提供的 `Request` 结构,支持用户自定义请求内容。 +`GN` is supported. User should add dependencies in `deps` of `BUILD.GN` to build this crate. -在使用客户端发送完请求后,接收到的响应会以 ylong_http 库提供的 `Response` + `HttpBody` 的结构返回。 +```gn +deps += ["//example_path/ylong_http_client:ylong_http_client"] +``` -用户可以使用 `Response` 提供的接口来获取请求信息,并且可以使用 ylong_http 提供的 `Body` trait 读取响应的内容。用户也可以使用 ylong_http_client 提供的 `BodyReader` 读取内容。 - -### 编译构建 - -在 ```Cargo.toml``` 下添加依赖。添加后使用 ```cargo``` 进行编译和构建: +`Cargo` is supported. User should add dependencies in ```Cargo.toml``` to build this crate. ```toml [dependencies] -ylong_http_client = "1.9.0" +ylong_http_client = { path = "/example_path/ylong_http_client" } +``` + +## Directory + +```text +ylong_http +├── ylong_http +│ ├── examples # Examples of ylong_http +│ ├── src # Source code ylong_http +│ │ ├── body # Body trait and body types +│ │ ├── h1 # HTTP/1.1 components +│ │ ├── h2 # HTTP/2 components +│ │ ├── h3 # HTTP/3 components +│ │ ├── huffman # Huffman +│ │ ├── request # Request type +│ │ └── response # Response type +│ └── tests # Tests of ylong_http +│ +└── ylong_http_client + ├── examples # Examples of ylong_http_client + ├── src # Source code of ylong_http_client + │ ├── async_impl # Asynchronous client implementation + │ │ ├── conn # Asynchronous connection layer + │ │ ├── downloader # Asynchronous downloader layer + │ │ ├── ssl_stream # Asynchronous TLS layer + │ │ └── uploader # Asynchronous uploader layer + │ ├── sync_impl # Synchronous client implementation + │ │ └── conn # Synchronous connection layer + │ └── util # Components of ylong_http_client + │ ├── c_openssl # OpenSSL adapter + │ │ ├── ffi # OpenSSL ffi adapter + │ │ └── ssl # OpenSSL ssl adapter + │ └── config # Configures + │ └── tls # TLS Configures + │ └── alpn # ALPN Configures + └── tests # Tests of ylong_http_client ``` \ No newline at end of file diff --git a/README_zh.md b/README_zh.md new file mode 100644 index 0000000..610165e --- /dev/null +++ b/README_zh.md @@ -0,0 +1,84 @@ +# ylong_http + +## 简介 + +ylong_http 协议栈构建了完整的 HTTP 能力,支持用户使用 HTTP 能力完成通信场景的需求。 + +ylong_http 协议栈主体使用 Rust 语言编写。 + +### ylong_http_client 库 + +ylong_http_client 库支持 HTTP 客户端功能,支持用户创建 HTTP 客户端向指定 Server 发送 HTTP +请求。 + +当前 ylong_http_client 库支持的功能: + +- 同步、异步客户端 +- HTTP/1.1、HTTP/2 协议版本 +- 代理 +- 自动重定向 +- 自动重试 +- 进度回调显示 +- 连接管理和复用 + +### ylong_http 库 + +ylong_http 库提供了 HTTP 协议的各种基础组件,例如序列化组件、压缩组件等。 + +当前 ylong_http 库支持的功能: + +- HTTP/1 序列化组件、HTTP/2 序列化组件 +- HPACK 头部压缩实现 +- Request、Response 以及相关基础类型 +- Body trait 以及 Body 的各种实现 + +## 编译构建 + +若使用 GN 编译工具链, 在 ```BUILD.GN``` 的 ```deps``` 段下添加依赖。添加后使用 GN 进行编译和构建: + +```gn +deps += ["//example_path/ylong_http_client:ylong_http_client"] +``` + +若使用 Cargo 编译工具链, 在 ```Cargo.toml``` 下添加依赖。添加后使用 ```cargo``` 进行编译和构建: + +```toml +[dependencies] +ylong_http_client = { path = "/example_path/ylong_http_client" } # 请使用路径依赖 +``` + +## 目录 + +``` +ylong_http +├── ylong_http +│ ├── examples # ylong_http 基础组件库代码示例 +│ ├── src # ylong_http 基础组件库源码 +│ │ ├── body # Body trait 定义和扩展 Body 类型 +│ │ ├── h1 # HTTP/1.1 相关组件实现 +│ │ ├── h2 # HTTP/2 相关组件实现 +│ │ ├── h3 # HTTP/3 相关组件实现 +│ │ ├── huffman # Huffman 编解码实现 +│ │ ├── request # Request 定义和实现 +│ │ └── response # Response 定义和实现 +│ └── tests # ylong_http 基础组件库测试目录 +│ +└── ylong_http_client + ├── examples # ylong_http_client 库代码示例 + ├── src # ylong_http_client 库源码 + │ ├── async_impl # ylong_http_client 异步客户端实现 + │ │ ├── conn # 异步连接层 + │ │ ├── downloader # 异步下载器实现 + │ │ ├── ssl_stream # 异步 tls 适配层 + │ │ └── uploader # 异步上传器实现 + │ ├── sync_impl # ylong_http_client 同步客户端实现 + │ │ └── conn # 同步连接层 + │ └── util # ylong_http_client 组件实现 + │ ├── c_openssl # OpenSSL 封装层 + │ │ ├── ffi # ffi 封装层 + │ │ └── ssl # ssl 适配层 + │ └── config # 配置选项实现 + │ └── tls # TLS 选项实现 + │ └── alpn # ALPN 实现 + └── tests # ylong_http_client 库测试目录 +``` \ No newline at end of file diff --git a/ylong_http/README.md b/ylong_http/README.md index c067b05..2c0d6a6 100644 --- a/ylong_http/README.md +++ b/ylong_http/README.md @@ -1,12 +1,12 @@ # ylong_http -### 简介 +## 简介 ylong_http 提供了 HTTP 各个版本下的协议所需的各种基础组件和扩展组件,方便用户组织所需的 HTTP 结构。 ylong_http 包含以下核心功能: -##### Request 和 Response +### Request 和 Response ylong_http 使用 `Request` 和 `Response` 结构来表示 HTTP 最基础的请求和响应: @@ -18,7 +18,7 @@ ylong_http 使用 `Request` 和 `Response` 结构来表示 HTTP 最基础的请 -##### Body +### Body 对于`Request`和`Response`的 Body 部分,ylong_http 提供了 `Body` trait,方便用户自定义想要的 Body 结构。 @@ -44,7 +44,7 @@ ylong_http 也提供默认的 Body 结构供用户使用: -##### 其他组件 +### 其他组件 ylong_http 提供了以下几个 HTTP 版本的相关组件: @@ -54,18 +54,18 @@ ylong_http 提供了以下几个 HTTP 版本的相关组件: -### 编译构建 +## 编译构建 在 ```Cargo.toml``` 下添加依赖。添加后使用 ```cargo``` 进行编译和构建: ```toml [dependencies] -ylong_http = "1.9.0" +ylong_http = { path = "/example_path/ylong_http" } # 请使用路径依赖 ``` -### 目录 +## 目录 ``` ylong_http diff --git a/ylong_http_client/README.md b/ylong_http_client/README.md index 92fce44..9c7e553 100644 --- a/ylong_http_client/README.md +++ b/ylong_http_client/README.md @@ -1,10 +1,10 @@ # ylong_http_client -### 简介 +## 简介 ylong_http_client 支持用户构建 HTTP 客户端,支持用户使用该客户端向服务器发送请求,接收并解析服务器返回的响应。 -##### Client +### Client ylong_http_client 支持用户创建同步或者异步 HTTP 客户端,用户可以使用 mod 区分两种客户端。 @@ -22,7 +22,7 @@ ylong_http_client 创建的客户端支持以下 HTTP 版本: - `HTTP/3` -##### Request 和 Response +### Request 和 Response ylong_http_client 使用 ylong_http 库提供的 `Request` 结构,支持用户自定义请求内容。 @@ -30,11 +30,11 @@ ylong_http_client 使用 ylong_http 库提供的 `Request` 结构,支持用户 用户可以使用 `Response` 提供的接口来获取请求信息,并且可以使用 ylong_http 提供的 `Body` trait 读取响应的内容。用户也可以使用 ylong_http_client 提供的 `BodyReader` 读取内容。 -### 编译构建 +## 编译构建 在 ```Cargo.toml``` 下添加依赖。添加后使用 ```cargo``` 进行编译和构建: ```toml [dependencies] -ylong_http_client = "1.9.0" +ylong_http_client = { path = "/example_path/ylong_http_client" } # 请使用路径依赖 ``` \ No newline at end of file -- Gitee