Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http-parser -> llhttp #5364

Merged
merged 26 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,41 @@ jobs:
run: |
LC_ALL=C sort -c CONTRIBUTORS.txt

gen_llhttp:
name: Generate llhttp sources
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Cache llhttp generated files
uses: actions/cache@v2
id: cache
with:
key: llhttp-${{ hashFiles('vendor/llhttp/package.json', 'vendor/llhttp/src/**/*') }}
path: vendor/llhttp/build
- name: Setup NodeJS
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Generate llhttp sources
if: steps.cache.outputs.cache-hit != 'true'
run: |
make generate-llhttp
- name: Upload llhttp generated files
uses: actions/upload-artifact@v2
with:
name: llhttp
path: vendor/llhttp/build
if-no-files-found: error

test:
name: Test
needs: lint
needs: gen_llhttp
strategy:
matrix:
pyver: [3.7, 3.8, 3.9]
Expand Down Expand Up @@ -120,6 +152,12 @@ jobs:
if: ${{ matrix.no-extensions == '' }}
run: |
make cythonize
- name: Restore llhttp generated files
if: ${{ matrix.no-extensions == '' }}
uses: actions/download-artifact@v2
with:
name: llhttp
path: vendor/llhttp/build/
- name: Run unittests
env:
COLOR: 'yes'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
.idea
.install-cython
.install-deps
.llhttp-gen
.installed.cfg
.mypy_cache
.noseids
Expand Down
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "vendor/http-parser"]
path = vendor/http-parser
url = git://github.com/nodejs/http-parser.git
branch = 54f55a2
[submodule "vendor/llhttp"]
path = vendor/llhttp
url = https://github.com/nodejs/llhttp.git
branch = v3.0.0
1 change: 1 addition & 0 deletions CHANGES/3561.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Switch from http-parser to llhttp
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ aiohttp/_find_header.c: $(call to-hash,aiohttp/hdrs.py ./tools/gen.py)
aiohttp/%.c: aiohttp/%.pyx $(call to-hash,$(CYS)) aiohttp/_find_header.c
cython -3 -o $@ $< -I aiohttp

vendor/llhttp/node_modules: vendor/llhttp/package.json
cd vendor/llhttp; npm install

.llhttp-gen: vendor/llhttp/node_modules
$(MAKE) -C vendor/llhttp generate
@touch .llhttp-gen

.PHONY: generate-llhttp
generate-llhttp: .llhttp-gen

.PHONY: cythonize
cythonize: .install-cython $(PYXS:.pyx=.c)
Expand All @@ -76,7 +85,7 @@ fmt format:
mypy:
mypy aiohttp tests

.develop: .install-deps $(call to-hash,$(PYS) $(CYS) $(CS))
.develop: .install-deps generate-llhttp $(call to-hash,$(PYS) $(CYS) $(CS))
pip install -e .
@touch .develop

Expand Down Expand Up @@ -125,6 +134,9 @@ clean:
@rm -rf aiohttp.egg-info
@rm -f .install-deps
@rm -f .install-cython
@rm -rf vendor/llhttp/node_modules
@rm -f .llhttp-gen
@$(MAKE) -C vendor/llhttp clean

.PHONY: doc
doc:
Expand Down
Loading