118f54607Sopenharmony_ci# third_party_brotli
218f54607Sopenharmony_ci
318f54607Sopenharmony_ci## Brotli简介
418f54607Sopenharmony_ciBrotli是基于LZ77算法,霍夫曼编码以及二阶上下文建模的开源数据压缩算法。
518f54607Sopenharmony_ciOpenHarmony引入该算法用于增强http的基础能力,使之可以处理使用brotli压缩算法的http请求。
618f54607Sopenharmony_ci
718f54607Sopenharmony_ci源代码最新参考资料可以访问:[brotli](https://github.com/google/brotli)
818f54607Sopenharmony_ci
918f54607Sopenharmony_ci引入版本[openEuler-brotli-1.0.9](https://gitee.com/src-openeuler/brotli)
1018f54607Sopenharmony_ci
1118f54607Sopenharmony_ci## 引入背景描述
1218f54607Sopenharmony_ci当前HTTP模块不支持该算法,无法满足社区需求。
1318f54607Sopenharmony_ci
1418f54607Sopenharmony_ci## 为OpenHarmony带来的价值
1518f54607Sopenharmony_ci生态应用在使用OpenHarmony提供的HTTP协议栈时,可以使用brotli的高压缩比特性,节省流量。
1618f54607Sopenharmony_ci
1718f54607Sopenharmony_ci## 如何使用
1818f54607Sopenharmony_ci在发送http请求时header信息带上"Accept-Encoding:br",则服务端会以brotli压缩的方式响应请求。
1918f54607Sopenharmony_ci
2018f54607Sopenharmony_cibrotli算法适用于静态网页数据、压缩阶段不敏感型、解压缩阶段敏感型等场景下的数据处理。
2118f54607Sopenharmony_ci
2218f54607Sopenharmony_ci## 软件架构
2318f54607Sopenharmony_ci```
2418f54607Sopenharmony_ciLICENSE           #版权声明
2518f54607Sopenharmony_civ.1.0.9.tar.gz    #源码压缩包
2618f54607Sopenharmony_ciinstall.sh        #解压缩以及打补丁脚本
2718f54607Sopenharmony_cipatch             #补丁
2818f54607Sopenharmony_ciBUILD.gn          #编译程序
2918f54607Sopenharmony_ci```
3018f54607Sopenharmony_ci
3118f54607Sopenharmony_ci
3218f54607Sopenharmony_ci## 安装教程
3318f54607Sopenharmony_ci
3418f54607Sopenharmony_ci1.  在使用该库的编译程序中加入依赖
3518f54607Sopenharmony_ci```
3618f54607Sopenharmony_cideps = ["//third_party/brotli:brotli"]
3718f54607Sopenharmony_ci```
3818f54607Sopenharmony_ci2.  预处理
3918f54607Sopenharmony_ci```
4018f54607Sopenharmony_ci./build/prebuilts_download.sh
4118f54607Sopenharmony_ci```
4218f54607Sopenharmony_ci3.  编译
4318f54607Sopenharmony_ci```
4418f54607Sopenharmony_ci./build.sh --product-name rk3568 --ccache
4518f54607Sopenharmony_ci```
4618f54607Sopenharmony_ci编译生成物对应路径: 'out/rk3568/thirdparty/brotli/libbrotli.z.so'
4718f54607Sopenharmony_ci
4818f54607Sopenharmony_ci## 参与贡献
4918f54607Sopenharmony_ci
5018f54607Sopenharmony_ci1.  Fork 本仓库
5118f54607Sopenharmony_ci2.  新建 Feat_xxx 分支
5218f54607Sopenharmony_ci3.  提交代码
5318f54607Sopenharmony_ci4.  新建 Pull Request
5418f54607Sopenharmony_ci
5518f54607Sopenharmony_ci
56