From efa97fa72b8b82271163433462996cdb2f5d400d Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Mon, 7 Apr 2025 14:09:32 -0600 Subject: [PATCH 01/29] lib: cfl: update to v0.6.0 Signed-off-by: Eduardo Silva --- lib/cfl/.github/workflows/build.yaml | 119 +- lib/cfl/.github/workflows/lint.yaml | 4 +- lib/cfl/.github/workflows/packages.yaml | 18 +- lib/cfl/CMakeLists.txt | 6 +- lib/cfl/CODEOWNERS | 7 + lib/cfl/appveyor.yml | 34 - lib/cfl/lib/xxhash/CHANGELOG | 33 + lib/cfl/lib/xxhash/Doxyfile | 14 +- lib/cfl/lib/xxhash/LICENSE | 2 +- lib/cfl/lib/xxhash/README.md | 116 +- .../xxhash/cmake_unofficial/CMakeLists.txt | 82 +- .../xxhash/cmake_unofficial/JoinPaths.cmake | 23 + lib/cfl/lib/xxhash/cmake_unofficial/README.md | 1 + lib/cfl/lib/xxhash/doc/xxhash_spec.md | 479 +- lib/cfl/lib/xxhash/libxxhash.pc.in | 6 +- lib/cfl/lib/xxhash/xxh3.h | 2 +- lib/cfl/lib/xxhash/xxh_x86dispatch.c | 245 +- lib/cfl/lib/xxhash/xxh_x86dispatch.h | 27 +- lib/cfl/lib/xxhash/xxhash.c | 7 +- lib/cfl/lib/xxhash/xxhash.h | 4268 ++++++++++++----- lib/cfl/src/cfl_kvlist.c | 2 +- lib/cfl/src/cfl_variant.c | 4 +- 22 files changed, 3982 insertions(+), 1517 deletions(-) create mode 100644 lib/cfl/CODEOWNERS delete mode 100644 lib/cfl/appveyor.yml create mode 100644 lib/cfl/lib/xxhash/cmake_unofficial/JoinPaths.cmake diff --git a/lib/cfl/.github/workflows/build.yaml b/lib/cfl/.github/workflows/build.yaml index ff9d15095d1..25400373773 100644 --- a/lib/cfl/.github/workflows/build.yaml +++ b/lib/cfl/.github/workflows/build.yaml @@ -17,7 +17,7 @@ jobs: matrix: os: [windows-latest, windows-2019] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build on ${{ matrix.os }} with vs-2019 run: | .\scripts\win_build.bat @@ -33,9 +33,9 @@ jobs: matrix: os: [windows-latest, windows-2019] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Get dependencies w/ chocolatey - uses: crazy-max/ghaction-chocolatey@v2 + uses: crazy-max/ghaction-chocolatey@v3 with: args: install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' - uses: msys2/setup-msys2@v2 @@ -67,17 +67,37 @@ jobs: sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo yum -y update - yum install -y ca-certificates cmake gcc gcc-c++ make wget + yum install -y ca-certificates gcc gcc-c++ git make wget yum install -y epel-release - yum install -y cmake3 shell: bash - - uses: actions/checkout@v3 + - name: Install CMake 3.20.0 + run: | + CMAKE_VERSION=3.20.0 + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh + ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local + ln -sf /usr/local/bin/cmake /usr/bin/cmake + cmake --version + + - name: Clone repo without submodules (1.8.3 version of Git) + run: | + git clone https://github.com/fluent/cfl.git + shell: bash + + - name: Check out the branch (1.8.3 version of Git) + env: + BRANCH_NAME: ${{ github.head_ref }} + run: | + git checkout "$BRANCH_NAME" + shell: bash + working-directory: cfl - name: Run compilation run: | - cmake3 -DCFL_DEV=on . + cmake -DCFL_DEV=on . make + working-directory: cfl build-debian: name: Debian Buster build to confirm no issues once used downstream @@ -87,14 +107,26 @@ jobs: - name: Set up base image dependencies run: | apt-get update - apt-get install -y build-essential cmake make - shell: bash + apt-get install -y build-essential wget make gcc g++ + + - name: Install CMake 3.20.0 + run: | + CMAKE_VERSION=3.20.0 + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh + ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local + + # Ensure the new CMake is found first + export PATH="/usr/local/bin:$PATH" - - uses: actions/checkout@v3 + # Confirm CMake installation + /usr/local/bin/cmake --version + + - uses: actions/checkout@v4 - name: Run compilation run: | - cmake -DCFL_DEV=on . + /usr/local/bin/cmake -DCFL_DEV=on . make build-unix-arm64: @@ -106,19 +138,19 @@ jobs: os: [ubuntu-latest] compiler: [ gcc, clang ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build on ${{ matrix.os }} with ${{ matrix.compiler }} - uses: uraimo/run-on-arch-action@v2.5.0 + uses: uraimo/run-on-arch-action@v3.0.0 with: arch: aarch64 - distro: ubuntu20.04 + distro: ubuntu_latest run: | apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ cmake \ file \ - make + make export CC=${{ env.compiler }} cmake -DCFL_TESTS=On . make all @@ -135,7 +167,7 @@ jobs: os: [ubuntu-latest, macos-latest] compiler: [ gcc, clang ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build on ${{ matrix.os }} with ${{ matrix.compiler }} run: | echo "CC = $CC, CXX = $CXX" @@ -161,13 +193,60 @@ jobs: contents: read runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true + dependencies_debian: 'wget' + + - name: Install CMake 3.20.0 + run: | + CMAKE_VERSION=3.20.0 + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh + + # Create a writable temporary directory + mkdir -p /tmp/cmake + + # Install CMake to /tmp/cmake + ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/tmp/cmake - - uses: docker://lpenz/ghaction-cmake:0.19 + # Add CMake to the PATH + echo 'export PATH=/tmp/cmake/bin:$PATH' >> ~/.bashrc + source ~/.bashrc + + # Verify installation + /tmp/cmake/bin/cmake --version + + - uses: actions/checkout@v4 with: preset: ${{ matrix.preset }} - # dependencies_debian: '' + cmakeflags: '-DCFL_TESTS=On -DCFL_DEV=on .' - build_command: make all + build_command: /tmp/cmake/bin/cmake && make all + + # this job provides the single required status for PRs to be merged into main. + # instead of updating the protected branch status in github, developers can update the needs section below + # to require additional status checks to protect main. + # the job uses the alls-green action to get around the github issue that treats a "skipped" required status check + # as passed. github will skip a job if an upstream needed job fails, which would defeat the purpose of this required + # status check. + test-required-checks-complete: + # note: this step always has to run in order to check if the dependent jobs passed. by default github skips running a job + # if the needed jobs upstream failed. + if: always() + needs: + - build-windows + - build-msys2 + - build-centos + - build-debian + - build-unix-arm64 + - build-unix-amd64 + - build-analysis-tests + name: Required checks complete + runs-on: ubuntu-latest + permissions: {} + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/lib/cfl/.github/workflows/lint.yaml b/lib/cfl/.github/workflows/lint.yaml index 7e3dc05b65e..e18e66b44f2 100644 --- a/lib/cfl/.github/workflows/lint.yaml +++ b/lib/cfl/.github/workflows/lint.yaml @@ -10,7 +10,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ludeeus/action-shellcheck@master with: ignore_paths: lib @@ -21,7 +21,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: | echo "::add-matcher::.github/actionlint-matcher.json" bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) diff --git a/lib/cfl/.github/workflows/packages.yaml b/lib/cfl/.github/workflows/packages.yaml index 34967c491d6..158ea414c90 100644 --- a/lib/cfl/.github/workflows/packages.yaml +++ b/lib/cfl/.github/workflows/packages.yaml @@ -18,12 +18,12 @@ jobs: matrix: format: [ rpm, deb ] steps: - - uses: actions/checkout@v3 - - uses: uraimo/run-on-arch-action@v2.5.0 + - uses: actions/checkout@v4 + - uses: uraimo/run-on-arch-action@v3.0.0 name: Build the ${{matrix.format}} packages with: arch: aarch64 - distro: ubuntu20.04 + distro: ubuntu_latest run: | apt-get update && \ apt-get install -y --no-install-recommends \ @@ -31,12 +31,12 @@ jobs: cmake \ file \ rpm \ - make + make cmake . echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {} - name: Store the master package artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.format }}-arm64 path: | @@ -51,14 +51,14 @@ jobs: runs-on: [ ubuntu-latest ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build the ${{matrix.format}} packages run: | cmake . echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {} - name: Store the master package artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.format }}-amd64 path: | @@ -74,7 +74,7 @@ jobs: contents: write steps: - name: Download all artefacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: artifacts/ @@ -94,7 +94,7 @@ jobs: artifacts/**/* - name: Release on tag - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: generate_release_notes: true diff --git a/lib/cfl/CMakeLists.txt b/lib/cfl/CMakeLists.txt index 2193cb29ce3..42875208586 100644 --- a/lib/cfl/CMakeLists.txt +++ b/lib/cfl/CMakeLists.txt @@ -1,12 +1,12 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.20) project(cfl C) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # C Floppy Version set(CFL_VERSION_MAJOR 0) -set(CFL_VERSION_MINOR 5) -set(CFL_VERSION_PATCH 1) +set(CFL_VERSION_MINOR 6) +set(CFL_VERSION_PATCH 0) set(CFL_VERSION_STR "${CFL_VERSION_MAJOR}.${CFL_VERSION_MINOR}.${CFL_VERSION_PATCH}") # Configuration options diff --git a/lib/cfl/CODEOWNERS b/lib/cfl/CODEOWNERS new file mode 100644 index 00000000000..2c2d84eaf89 --- /dev/null +++ b/lib/cfl/CODEOWNERS @@ -0,0 +1,7 @@ +# Global Owners +# ------------- +* @edsiper @leonardo-albertovich + +# CI +# ------------------------- +/.github/ @niedbalski @patrick-stephens @celalettin1286 diff --git a/lib/cfl/appveyor.yml b/lib/cfl/appveyor.yml deleted file mode 100644 index 1f60cfebc1c..00000000000 --- a/lib/cfl/appveyor.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: v1-winbuild-{build} - -image: Visual Studio 2019 - -platform: - - Win32 - - x64 - -environment: - vspath: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community' - winflexbison: https://github.com/lexxmark/winflexbison/releases/download/v2.5.22/win_flex_bison-2.5.22.zip - PATH: '%PATH%;C:\WinFlexBison' - -configuration: - - Release - -skip_commits: - message: /workflows/ - files: - - '.github/**' - -install: - - ps: Invoke-WebRequest -O winflexbison.zip $env:winflexbison - - ps: Expand-Archive winflexbison.zip -Destination /WinFlexBison - - ps: Copy-Item -Path /WinFlexBison/win_bison.exe /WinFlexBison/bison.exe - - ps: Copy-Item -Path /WinFlexBison/win_flex.exe /WinFlexBison/flex.exe - -before_build: - - if %PLATFORM%==Win32 call "%vspath%\VC\Auxiliary\Build\vcvars32.bat" - - if %PLATFORM%==x64 call "%vspatH%\VC\Auxiliary\Build\vcvars64.bat" - -build_script: - - .\scripts\win_build.bat - - ctest -C Debug --test-dir .\tests\ diff --git a/lib/cfl/lib/xxhash/CHANGELOG b/lib/cfl/lib/xxhash/CHANGELOG index ff59d8bb1f4..0eaba6116c7 100644 --- a/lib/cfl/lib/xxhash/CHANGELOG +++ b/lib/cfl/lib/xxhash/CHANGELOG @@ -1,3 +1,36 @@ +v0.8.3 +- fix : variant `XXH3_128bits_withSecretandSeed()` could produce an invalid result in some specific set of conditions, #894 by @hltj +- cli : vector extension detected at runtime on x86/x64, enabled by default +- cli : new commands `--filelist` and `--files-from`, by @Ian-Clowes +- cli : XXH3 64-bits GNU format can now be generated and checked (command `-H3`) +- portability: LoongArch SX SIMD extension, by @lrzlin +- portability: can build on AIX, suggested by @likema +- portability: validated for SPARC cpus + +v0.8.2 +- fix : XXH3 S390x vector implementation (@hzhuang1) +- fix : PowerPC vector compilation with IBM XL compiler (@MaxiBoether) +- perf : improved WASM speed by x2/x3 using SIMD128 (@easyaspi314) +- perf : improved speed (+20%) for XXH3 on ARM NEON (@easyaspi314) +- cli : Fix filename contain /LF character (@t-mat) +- cli : Support # comment lines in --check files (@t-mat) +- cli : Support commands --binary and --ignore-missing (@t-mat) +- build: fix -Og compilation (@easyaspi314, @t-mat) +- build: fix pkgconfig generation with cmake (@ilya-fedin) +- build: fix icc compilation +- build: fix cmake install directories +- build: new build options XXH_NO_XXH3, XXH_SIZE_OPT and XXH_NO_STREAM to reduce binary size (@easyaspi314) +- build: dedicated install targets (@ffontaine) +- build: support DISPATCH mode in cmake (@hzhuang1) +- portability: fix x86dispatch when building with Visual + clang-cl (@t-mat) +- portability: SVE vector implementation of XXH3 (@hzhuang1) +- portability: compatibility with freestanding environments, using XXH_NO_STDLIB +- portability: can build on Haiku (@Begasus) +- portability: validated on m68k and risc-v +- doc : XXH3 specification (@Adrien1018) +- doc : improved doxygen documentation (@easyaspi314, @t-mat) +- misc : dedicated sanity test binary (@t-mat) + v0.8.1 - perf : much improved performance for XXH3 streaming variants, notably on gcc and msvc - perf : improved XXH64 speed and latency on small inputs diff --git a/lib/cfl/lib/xxhash/Doxyfile b/lib/cfl/lib/xxhash/Doxyfile index 634e1e1a38d..d25dd1e3dff 100644 --- a/lib/cfl/lib/xxhash/Doxyfile +++ b/lib/cfl/lib/xxhash/Doxyfile @@ -2,13 +2,13 @@ DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "xxHash" -PROJECT_NUMBER = "0.8.0" +PROJECT_NUMBER = "0.8.3" PROJECT_BRIEF = "Extremely fast non-cryptographic hash function" OUTPUT_DIRECTORY = doxygen OUTPUT_LANGUAGE = English # We already separate the internal docs. -INTERNAL_DOCS = YES +INTERNAL_DOCS = NO # Consistency SORT_MEMBER_DOCS = NO BRIEF_MEMBER_DESC = YES @@ -28,20 +28,26 @@ MARKDOWN_SUPPORT = YES # xxHash is a C library OPTIMIZE_OUTPUT_FOR_C = YES -# So we can document the internals -EXTRACT_STATIC = YES +# We hide private part from public document +EXTRACT_STATIC = NO +# We hide private part from public document +EXTRACT_PRIVATE = NO # Document the macros MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES # Predefine some macros to clean up the output. PREDEFINED = "XXH_DOXYGEN=" \ "XXH_PUBLIC_API=" \ + "XXH_NOESCAPE=" \ "XXH_FORCE_INLINE=static inline" \ "XXH_NO_INLINE=static" \ "XXH_RESTRICT=restrict" \ "XSUM_API=" \ "XXH_STATIC_LINKING_ONLY" \ "XXH_IMPLEMENTATION" \ + "XXH_PUREF=[[gnu::pure]]" \ + "XXH_CONSTF=[[gnu::const]]" \ + "XXH_MALLOCF=[[gnu::malloc]]" \ "XXH_ALIGN(N)=alignas(N)" \ "XXH_ALIGN_MEMBER(align,type)=alignas(align) type" diff --git a/lib/cfl/lib/xxhash/LICENSE b/lib/cfl/lib/xxhash/LICENSE index 6bc30a1bc55..e4c5da7234e 100644 --- a/lib/cfl/lib/xxhash/LICENSE +++ b/lib/cfl/lib/xxhash/LICENSE @@ -1,5 +1,5 @@ xxHash Library -Copyright (c) 2012-2020 Yann Collet +Copyright (c) 2012-2021 Yann Collet All rights reserved. BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) diff --git a/lib/cfl/lib/xxhash/README.md b/lib/cfl/lib/xxhash/README.md index 2406c8d2443..1ff987b0acd 100644 --- a/lib/cfl/lib/xxhash/README.md +++ b/lib/cfl/lib/xxhash/README.md @@ -2,20 +2,28 @@ xxHash - Extremely fast hash algorithm ====================================== -xxHash is an Extremely fast Hash algorithm, running at RAM speed limits. -It successfully completes the [SMHasher](https://code.google.com/p/smhasher/wiki/SMHasher) test suite -which evaluates collision, dispersion and randomness qualities of hash functions. -Code is highly portable, and hashes are identical across all platforms (little / big endian). +xxHash is an Extremely fast Hash algorithm, processing at RAM speed limits. +Code is highly portable, and produces hashes identical across all platforms (little / big endian). +The library includes the following algorithms : +- XXH32 : generates 32-bit hashes, using 32-bit arithmetic +- XXH64 : generates 64-bit hashes, using 64-bit arithmetic +- XXH3 (since `v0.8.0`): generates 64 or 128-bit hashes, using vectorized arithmetic. + The 128-bit variant is called XXH128. + +All variants successfully complete the [SMHasher](https://code.google.com/p/smhasher/wiki/SMHasher) test suite +which evaluates the quality of hash functions (collision, dispersion and randomness). +Additional tests, which evaluate more thoroughly speed and collision properties of 64-bit hashes, [are also provided](https://github.com/Cyan4973/xxHash/tree/dev/tests). |Branch |Status | |------------|---------| +|release | [![Build Status](https://github.com/Cyan4973/xxHash/actions/workflows/ci.yml/badge.svg?branch=release)](https://github.com/Cyan4973/xxHash/actions?query=branch%3Arelease+) | |dev | [![Build Status](https://github.com/Cyan4973/xxHash/actions/workflows/ci.yml/badge.svg?branch=dev)](https://github.com/Cyan4973/xxHash/actions?query=branch%3Adev+) | Benchmarks ------------------------- -The reference system uses an Intel i7-9700K cpu, and runs Ubuntu x64 20.04. +The benchmarked reference system uses an Intel i7-9700K cpu, and runs Ubuntu x64 20.04. The [open source benchmark program] is compiled with `clang` v10.0 using `-O3` flag. | Hash Name | Width | Bandwidth (GB/s) | Small Data Velocity | Quality | Comment | @@ -43,7 +51,7 @@ The [open source benchmark program] is compiled with `clang` v10.0 using `-O3` f note 1: Small data velocity is a _rough_ evaluation of algorithm's efficiency on small data. For more detailed analysis, please refer to next paragraph. -note 2: some algorithms feature _faster than RAM_ speed. In which case, they can only reach their full speed when input data is already in CPU cache (L3 or better). Otherwise, they max out on RAM speed limit. +note 2: some algorithms feature _faster than RAM_ speed. In which case, they can only reach their full speed potential when input is already in CPU cache (L3 or better). Otherwise, they max out on RAM speed limit. ### Small data @@ -59,7 +67,7 @@ which can be observed in the following graph: ![XXH3, latency, random size](https://user-images.githubusercontent.com/750081/61976089-aedeab00-af9f-11e9-9239-e5375d6c080f.png) -For a more detailed analysis, visit the wiki : +For a more detailed analysis, please visit the wiki : https://github.com/Cyan4973/xxHash/wiki/Performance-comparison#benchmarks-concentrating-on-small-data- Quality @@ -85,58 +93,89 @@ A more detailed analysis is documented [in the wiki](https://github.com/Cyan4973 ### Build modifiers -The following macros can be set at compilation time to modify libxxhash's behavior. They are generally disabled by default. +The following macros can be set at compilation time to modify `libxxhash`'s behavior. They are generally disabled by default. -- `XXH_INLINE_ALL`: Make all functions `inline`, with implementations being directly included within `xxhash.h`. - Inlining functions is beneficial for speed on small keys. - It's _extremely effective_ when key length is expressed as _a compile time constant_, +- `XXH_INLINE_ALL`: Make all functions `inline`, implementation is directly included within `xxhash.h`. + Inlining functions is beneficial for speed, notably for small keys. + It's _extremely effective_ when key's length is expressed as _a compile time constant_, with performance improvements observed in the +200% range . See [this article](https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html) for details. - `XXH_PRIVATE_API`: same outcome as `XXH_INLINE_ALL`. Still available for legacy support. - The name underlines that `XXH_*` symbols will not be exported. + The name underlines that `XXH_*` symbol names will not be exported. +- `XXH_STATIC_LINKING_ONLY`: gives access to internal state declaration, required for static allocation. + Incompatible with dynamic linking, due to risks of ABI changes. - `XXH_NAMESPACE`: Prefixes all symbols with the value of `XXH_NAMESPACE`. This macro can only use compilable character set. Useful to evade symbol naming collisions, in case of multiple inclusions of xxHash's source code. Client applications still use the regular function names, as symbols are automatically translated through `xxhash.h`. -- `XXH_FORCE_MEMORY_ACCESS`: The default method `0` uses a portable `memcpy()` notation. - Method `1` uses a gcc-specific `packed` attribute, which can provide better performance for some targets. - Method `2` forces unaligned reads, which is not standards compliant, but might sometimes be the only way to extract better read performance. - Method `3` uses a byteshift operation, which is best for old compilers which don't inline `memcpy()` or big-endian systems without a byteswap instruction - `XXH_FORCE_ALIGN_CHECK`: Use a faster direct read path when input is aligned. - This option can result in dramatic performance improvement when input to hash is aligned on 32 or 64-bit boundaries, - when running on architectures unable to load memory from unaligned addresses, or suffering a performance penalty from it. + This option can result in dramatic performance improvement on architectures unable to load memory from unaligned addresses + when input to hash happens to be aligned on 32 or 64-bit boundaries. It is (slightly) detrimental on platform with good unaligned memory access performance (same instruction for both aligned and unaligned accesses). This option is automatically disabled on `x86`, `x64` and `aarch64`, and enabled on all other platforms. -- `XXH_VECTOR` : manually select a vector instruction set (default: auto-selected at compilation time). Available instruction sets are `XXH_SCALAR`, `XXH_SSE2`, `XXH_AVX2`, `XXH_AVX512`, `XXH_NEON` and `XXH_VSX`. Compiler may require additional flags to ensure proper support (for example, `gcc` on linux will require `-mavx2` for AVX2, and `-mavx512f` for AVX512). -- `XXH_NO_PREFETCH` : disable prefetching. Some platforms or situations may perform better without prefetching. XXH3 only. -- `XXH_PREFETCH_DIST` : select prefetching distance. For close-to-metal adaptation to specific hardware platforms. XXH3 only. -- `XXH_NO_INLINE_HINTS`: By default, xxHash uses `__attribute__((always_inline))` and `__forceinline` to improve performance at the cost of code size. - Defining this macro to 1 will mark all internal functions as `static`, allowing the compiler to decide whether to inline a function or not. - This is very useful when optimizing for smallest binary size, - and is automatically defined when compiling with `-O0`, `-Os`, `-Oz`, or `-fno-inline` on GCC and Clang. - This may also increase performance depending on compiler and architecture. -- `XXH32_ENDJMP`: Switch multi-branch finalization stage of XXH32 by a single jump. - This is generally undesirable for performance, especially when hashing inputs of random sizes. - But depending on exact architecture and compiler, a jump might provide slightly better performance on small inputs. Disabled by default. -- `XXH_STATIC_LINKING_ONLY`: gives access to internal state declaration, required for static allocation. - Incompatible with dynamic linking, due to risks of ABI changes. -- `XXH_NO_XXH3` : removes symbols related to `XXH3` (both 64 & 128 bits) from generated binary. - Useful to reduce binary size, notably for applications which do not use `XXH3`. -- `XXH_NO_LONG_LONG`: removes compilation of algorithms relying on 64-bit types (XXH3 and XXH64). Only XXH32 will be compiled. - Useful for targets (architectures and compilers) without 64-bit support. -- `XXH_IMPORT`: MSVC specific: should only be defined for dynamic linking, as it prevents linkage errors. +- `XXH_FORCE_MEMORY_ACCESS`: The default method `0` uses a portable `memcpy()` notation. + Method `1` uses a gcc-specific `packed` attribute, which can provide better performance for some targets. + Method `2` forces unaligned reads, which is not standard compliant, but might sometimes be the only way to extract better read performance. + Method `3` uses a byteshift operation, which is best for old compilers which don't inline `memcpy()` or big-endian systems without a byteswap instruction. - `XXH_CPU_LITTLE_ENDIAN`: By default, endianness is determined by a runtime test resolved at compile time. If, for some reason, the compiler cannot simplify the runtime test, it can cost performance. It's possible to skip auto-detection and simply state that the architecture is little-endian by setting this macro to 1. Setting it to 0 states big-endian. +- `XXH_ENABLE_AUTOVECTORIZE`: Auto-vectorization may be triggered for XXH32 and XXH64, depending on cpu vector capabilities and compiler version. + Note: auto-vectorization tends to be triggered more easily with recent versions of `clang`. + For XXH32, SSE4.1 or equivalent (NEON) is enough, while XXH64 requires AVX512. + Unfortunately, auto-vectorization is generally detrimental to XXH performance. + For this reason, the xxhash source code tries to prevent auto-vectorization by default. + That being said, systems evolve, and this conclusion is not forthcoming. + For example, it has been reported that recent Zen4 cpus are more likely to improve performance with vectorization. + Therefore, should you prefer or want to test vectorized code, you can enable this flag: + it will remove the no-vectorization protection code, thus making it more likely for XXH32 and XXH64 to be auto-vectorized. +- `XXH32_ENDJMP`: Switch multi-branch finalization stage of XXH32 by a single jump. + This is generally undesirable for performance, especially when hashing inputs of random sizes. + But depending on exact architecture and compiler, a jump might provide slightly better performance on small inputs. Disabled by default. +- `XXH_IMPORT`: MSVC specific: should only be defined for dynamic linking, as it prevents linkage errors. +- `XXH_NO_STDLIB`: Disable invocation of `` functions, notably `malloc()` and `free()`. + `libxxhash`'s `XXH*_createState()` will always fail and return `NULL`. + But one-shot hashing (like `XXH32()`) or streaming using statically allocated states + still work as expected. + This build flag is useful for embedded environments without dynamic allocation. +- `XXH_memcpy`, `XXH_memset`, `XXH_memcmp` : redirect `memcpy()`, `memset()` and `memcmp()` to some user-selected symbol at compile time. + Redirecting all 3 removes the need to include `` standard library. +- `XXH_NO_EXTERNC_GUARD`: When `xxhash.h` is compiled in C++ mode, removes the `extern "C" { .. }` block guard. - `XXH_DEBUGLEVEL` : When set to any value >= 1, enables `assert()` statements. This (slightly) slows down execution, but may help finding bugs during debugging sessions. -When compiling the Command Line Interface `xxhsum` with `make`, the following environment variables can also be set : -- `DISPATCH=1` : use `xxh_x86dispatch.c`, to automatically select between `scalar`, `sse2`, `avx2` or `avx512` instruction set at runtime, depending on local host. This option is only valid for `x86`/`x64` systems. +#### Binary size control +- `XXH_NO_XXH3` : removes symbols related to `XXH3` (both 64 & 128 bits) from generated binary. + `XXH3` is by far the largest contributor to `libxxhash` size, + so it's useful to reduce binary size for applications which do not employ `XXH3`. +- `XXH_NO_LONG_LONG`: removes compilation of algorithms relying on 64-bit `long long` types + which include `XXH3` and `XXH64`. + Only `XXH32` will be compiled. + Useful for targets (architectures and compilers) without 64-bit support. +- `XXH_NO_STREAM`: Disables the streaming API, limiting the library to single shot variants only. +- `XXH_NO_INLINE_HINTS`: By default, xxHash uses `__attribute__((always_inline))` and `__forceinline` to improve performance at the cost of code size. + Defining this macro to 1 will mark all internal functions as `static`, allowing the compiler to decide whether to inline a function or not. + This is very useful when optimizing for smallest binary size, + and is automatically defined when compiling with `-O0`, `-Os`, `-Oz`, or `-fno-inline` on GCC and Clang. + It may also be required to successfully compile using `-Og`, depending on compiler version. +- `XXH_SIZE_OPT`: `0`: default, optimize for speed + `1`: default for `-Os` and `-Oz`: disables some speed hacks for size optimization + `2`: makes code as small as possible, performance may cry +#### Build modifiers specific for XXH3 +- `XXH_VECTOR` : manually select a vector instruction set (default: auto-selected at compilation time). Available instruction sets are `XXH_SCALAR`, `XXH_SSE2`, `XXH_AVX2`, `XXH_AVX512`, `XXH_NEON` and `XXH_VSX`. Compiler may require additional flags to ensure proper support (for example, `gcc` on x86_64 requires `-mavx2` for `AVX2`, or `-mavx512f` for `AVX512`). +- `XXH_PREFETCH_DIST` : select prefetching distance. For close-to-metal adaptation to specific hardware platforms. XXH3 only. +- `XXH_NO_PREFETCH` : disable prefetching. Some platforms or situations may perform better without prefetching. XXH3 only. + +#### Makefile variables +When compiling the Command Line Interface `xxhsum` using `make`, the following environment variables can also be set : +- `DISPATCH=1` : use `xxh_x86dispatch.c`, select at runtime between `scalar`, `sse2`, `avx2` or `avx512` instruction set. This option is only valid for `x86`/`x64` systems. It is enabled by default when target `x86`/`x64` is detected. It can be forcefully turned off using `DISPATCH=0`. +- `LIBXXH_DISPATCH=1` : same idea, implemented a runtime vector extension detector, but within `libxxhash`. This parameter is disabled by default. When enabled (only valid for `x86`/`x64` systems), new symbols published in `xxh_x86dispatch.h` become accessible. At the time of this writing, it's required to include `xxh_x86dispatch.h` in order to access the symbols with runtime vector extension detection. +- `XXH_1ST_SPEED_TARGET` : select an initial speed target, expressed in MB/s, for the first speed test in benchmark mode. Benchmark will adjust the target at subsequent iterations, but the first test is made "blindly" by targeting this speed. Currently conservatively set to 10 MB/s, to support very slow (emulated) platforms. +- `NODE_JS=1` : When compiling `xxhsum` for Node.js with Emscripten, this links the `NODERAWFS` library for unrestricted filesystem access and patches `isatty` to make the command line utility correctly detect the terminal. This does make the binary specific to Node.js. ### Building xxHash - Using vcpkg @@ -150,7 +189,6 @@ You can download and install xxHash using the [vcpkg](https://github.com/Microso The xxHash port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. - ### Example The simplest example calls xxhash 64-bit variant as a one-shot function diff --git a/lib/cfl/lib/xxhash/cmake_unofficial/CMakeLists.txt b/lib/cfl/lib/xxhash/cmake_unofficial/CMakeLists.txt index d5456b018ab..89242ec6dd8 100644 --- a/lib/cfl/lib/xxhash/cmake_unofficial/CMakeLists.txt +++ b/lib/cfl/lib/xxhash/cmake_unofficial/CMakeLists.txt @@ -5,7 +5,7 @@ # # For details, see . -cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) +cmake_minimum_required (VERSION 3.10 FATAL_ERROR) set(XXHASH_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") @@ -25,14 +25,10 @@ if("${CMAKE_VERSION}" VERSION_LESS "3.13") else() cmake_policy (SET CMP0077 NEW) endif() -if("${CMAKE_VERSION}" VERSION_LESS "3.0") - project(xxHash C) -else() - cmake_policy (SET CMP0048 NEW) - project(xxHash - VERSION ${XXHASH_VERSION_STRING} - LANGUAGES C) -endif() +cmake_policy (SET CMP0048 NEW) +project(xxHash + VERSION ${XXHASH_VERSION_STRING} + LANGUAGES C) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Project build type" FORCE) @@ -42,9 +38,14 @@ endif() if(NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "xxHash build type: ${CMAKE_BUILD_TYPE}") endif() + # Enable assert() statements in debug builds if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - add_compile_definitions(XXH_DEBUGLEVEL=1) + if("${CMAKE_VERSION}" VERSION_LESS "3.12") + # add_compile_definitions is not available for older cmake => do nothing + else() + add_compile_definitions(XXH_DEBUGLEVEL=1) + endif() endif() option(BUILD_SHARED_LIBS "Build shared library" ON) @@ -70,8 +71,26 @@ mark_as_advanced(XXHASH_BUNDLED_MODE) include(CMakeDependentOption) CMAKE_DEPENDENT_OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON "NOT XXHASH_BUNDLED_MODE" OFF) +# detect architecture for DISPATCH mode +CMAKE_HOST_SYSTEM_INFORMATION(RESULT PLATFORM QUERY OS_PLATFORM) +message(STATUS "Architecture: ${PLATFORM}") + # libxxhash -add_library(xxhash "${XXHASH_DIR}/xxhash.c") +if((DEFINED DISPATCH) AND (DEFINED PLATFORM)) + # Only support DISPATCH option on x86_64. + if(("${PLATFORM}" STREQUAL "x86_64") OR ("${PLATFORM}" STREQUAL "AMD64")) + set(XXHSUM_DISPATCH ON) + message(STATUS "Enable xxHash dispatch mode") + add_library(xxhash "${XXHASH_DIR}/xxh_x86dispatch.c" + "${XXHASH_DIR}/xxhash.c" + ) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXXHSUM_DISPATCH=1") + else() + add_library(xxhash "${XXHASH_DIR}/xxhash.c") + endif() +else() + add_library(xxhash "${XXHASH_DIR}/xxhash.c") +endif() add_library(${PROJECT_NAME}::xxhash ALIAS xxhash) target_include_directories(xxhash @@ -88,12 +107,18 @@ set_target_properties(xxhash PROPERTIES if(XXHASH_BUILD_XXHSUM) set(XXHSUM_DIR "${XXHASH_DIR}/cli") # xxhsum - add_executable(xxhsum "${XXHSUM_DIR}/xxhsum.c" - "${XXHSUM_DIR}/xsum_os_specific.c" - "${XXHSUM_DIR}/xsum_output.c" - "${XXHSUM_DIR}/xsum_sanity_check.c" - "${XXHSUM_DIR}/xsum_bench.c" - ) + set(XXHSUM_SOURCES) + if (XXHSUM_DISPATCH) + list(APPEND XXHSUM_SOURCES "${XXHASH_DIR}/xxh_x86dispatch.c") + endif() + list(APPEND XXHSUM_SOURCES "${XXHSUM_DIR}/xxhsum.c" + "${XXHSUM_DIR}/xsum_arch.c" + "${XXHSUM_DIR}/xsum_os_specific.c" + "${XXHSUM_DIR}/xsum_output.c" + "${XXHSUM_DIR}/xsum_sanity_check.c" + "${XXHSUM_DIR}/xsum_bench.c" + ) + add_executable(xxhsum ${XXHSUM_SOURCES}) add_executable(${PROJECT_NAME}::xxhsum ALIAS xxhsum) target_link_libraries(xxhsum PRIVATE xxhash) @@ -118,11 +143,15 @@ if(NOT XXHASH_BUNDLED_MODE) DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") install(FILES "${XXHASH_DIR}/xxh3.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + if(DISPATCH) + install(FILES "${XXHASH_DIR}/xxh_x86dispatch.h" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + endif() if(XXHASH_BUILD_XXHSUM) install(TARGETS xxhsum EXPORT xxHashTargets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - install(FILES "${XXHASH_DIR}/xxhsum.1" + install(FILES "${XXHSUM_DIR}/xxhsum.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") endif(XXHASH_BUILD_XXHSUM) @@ -139,19 +168,9 @@ if(NOT XXHASH_BUNDLED_MODE) ${PROJECT_SOURCE_DIR}/xxHashConfig.cmake.in ${xxHash_PROJECT_CONFIG} INSTALL_DESTINATION ${xxHash_CONFIG_INSTALL_DIR}) - if("${CMAKE_VERSION}" VERSION_LESS "3.0") - set(XXHASH_EXPORT_SET xxhash) - if(XXHASH_BUILD_XXHSUM) - set(XXHASH_EXPORT_SET ${XXHASH_EXPORT_SET} xxhsum) - endif() - export(TARGETS ${XXHASH_EXPORT_SET} - FILE ${xxHash_TARGETS_CONFIG} - NAMESPACE ${PROJECT_NAME}::) - else() export(EXPORT xxHashTargets FILE ${xxHash_TARGETS_CONFIG} NAMESPACE ${PROJECT_NAME}::) - endif() install(FILES ${xxHash_PROJECT_CONFIG} ${xxHash_VERSION_CONFIG} DESTINATION ${xxHash_CONFIG_INSTALL_DIR}) @@ -160,10 +179,11 @@ if(NOT XXHASH_BUNDLED_MODE) NAMESPACE ${PROJECT_NAME}::) # configure and install pkg-config + include(JoinPaths.cmake) set(PREFIX ${CMAKE_INSTALL_PREFIX}) set(EXECPREFIX "\${prefix}") - set(INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}") - set(LIBDIR "${CMAKE_INSTALL_LIBDIR}") + join_paths(INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") + join_paths(LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}") set(VERSION "${XXHASH_VERSION_STRING}") configure_file(${XXHASH_DIR}/libxxhash.pc.in ${CMAKE_BINARY_DIR}/libxxhash.pc @ONLY) @@ -171,3 +191,5 @@ if(NOT XXHASH_BUNDLED_MODE) DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif(NOT XXHASH_BUNDLED_MODE) + +include(CPack) diff --git a/lib/cfl/lib/xxhash/cmake_unofficial/JoinPaths.cmake b/lib/cfl/lib/xxhash/cmake_unofficial/JoinPaths.cmake new file mode 100644 index 00000000000..c68d91b84db --- /dev/null +++ b/lib/cfl/lib/xxhash/cmake_unofficial/JoinPaths.cmake @@ -0,0 +1,23 @@ +# This module provides function for joining paths +# known from most languages +# +# SPDX-License-Identifier: (MIT OR CC0-1.0) +# Copyright 2020 Jan Tojnar +# https://github.com/jtojnar/cmake-snips +# +# Modelled after Python’s os.path.join +# https://docs.python.org/3.7/library/os.path.html#os.path.join +# Windows not supported +function(join_paths joined_path first_path_segment) + set(temp_path "${first_path_segment}") + foreach(current_segment IN LISTS ARGN) + if(NOT ("${current_segment}" STREQUAL "")) + if(IS_ABSOLUTE "${current_segment}") + set(temp_path "${current_segment}") + else() + set(temp_path "${temp_path}/${current_segment}") + endif() + endif() + endforeach() + set(${joined_path} "${temp_path}" PARENT_SCOPE) +endfunction() diff --git a/lib/cfl/lib/xxhash/cmake_unofficial/README.md b/lib/cfl/lib/xxhash/cmake_unofficial/README.md index 66df7909a73..37339124187 100644 --- a/lib/cfl/lib/xxhash/cmake_unofficial/README.md +++ b/lib/cfl/lib/xxhash/cmake_unofficial/README.md @@ -16,6 +16,7 @@ Where possible options are: - `-DXXHASH_BUILD_XXHSUM=`: build the command line binary. ON by default - `-DBUILD_SHARED_LIBS=`: build dynamic library. ON by default. - `-DCMAKE_INSTALL_PREFIX=`: use custom install prefix path. +- `-DDISPATCH=`: enable dispatch mode. OFF by default. Add lines into downstream CMakeLists.txt: diff --git a/lib/cfl/lib/xxhash/doc/xxhash_spec.md b/lib/cfl/lib/xxhash/doc/xxhash_spec.md index 80576d6bd17..1a544e9ba97 100644 --- a/lib/cfl/lib/xxhash/doc/xxhash_spec.md +++ b/lib/cfl/lib/xxhash/doc/xxhash_spec.md @@ -16,7 +16,7 @@ Distribution of this document is unlimited. ### Version -0.1.1 (10/10/18) +0.2.0 (29/06/23) Table of Contents @@ -24,6 +24,10 @@ Table of Contents - [Introduction](#introduction) - [XXH32 algorithm description](#xxh32-algorithm-description) - [XXH64 algorithm description](#xxh64-algorithm-description) +- [XXH3 algorithm description](#xxh3-algorithm-overview) + - [Small inputs](#xxh3-algorithm-description-for-small-inputs) + - [Medium inputs](#xxh3-algorithm-description-for-medium-inputs) + - [Large inputs](#xxh3-algorithm-description-for-large-inputs) - [Performance considerations](#performance-considerations) - [Reference Implementation](#reference-implementation) @@ -43,13 +47,20 @@ However, a given variant shall produce exactly the same output, irrespective of ### Operation notations All operations are performed modulo {32,64} bits. Arithmetic overflows are expected. -`XXH32` uses 32-bit modular operations. `XXH64` uses 64-bit modular operations. +`XXH32` uses 32-bit modular operations. +`XXH64` and `XXH3` use 64-bit modular operations. +When an operation ingests input or secret as multi-bytes values, it reads it using little-endian convention. - `+`: denotes modular addition +- `-`: denotes modular subtraction - `*`: denotes modular multiplication + - **Exception:** In `XXH3`, if it is in the form `(u128)x * (u128)y`, it denotes 64-bit by 64-bit normal multiplication into a full 128-bit result. - `X <<< s`: denotes the value obtained by circularly shifting (rotating) `X` left by `s` bit positions. - `X >> s`: denotes the value obtained by shifting `X` right by s bit positions. Upper `s` bits become `0`. +- `X << s`: denotes the value obtained by shifting `X` left by s bit positions. Lower `s` bits become `0`. - `X xor Y`: denotes the bit-wise XOR of `X` and `Y` (same width). +- `X | Y`: denotes the bit-wise OR of `X` and `Y` (same width). +- `~X`: denotes the bit-wise negation of `X`. XXH32 Algorithm Description @@ -232,7 +243,7 @@ Each lane read its associated 64-bit value using __little-endian__ convention. For each {lane, accumulator}, the update process is called a _round_, and applies the following formula: ```c - round(accN,laneN): +round(accN,laneN): accN = accN + (laneN * PRIME64_2); accN = accN <<< 31; return accN * PRIME64_1; @@ -250,7 +261,7 @@ All 4 lane accumulators from previous steps are merged to produce a single remai Note that accumulator convergence is more complex than 32-bit variant, and requires to define another function called _mergeAccumulator()_: ```c - mergeAccumulator(acc,accN): +mergeAccumulator(acc,accN): acc = acc xor round(0, accN); acc = acc * PRIME64_1; return acc + PRIME64_4; @@ -324,6 +335,462 @@ The `XXH64()` function produces an unsigned 64-bit value as output. For systems which require to store and/or display the result in binary or hexadecimal format, the canonical format is defined to reproduce the same value as the natural decimal format, hence follows __big-endian__ convention (most significant byte first). +XXH3 Algorithm Overview +------------------------------------- + +XXH3 comes in two different versions: XXH3-64 and XXH3-128 (or XXH128), producing 64 and 128 bits of output, respectively. + +XXH3 uses different algorithms for small (0-16 bytes), medium (17-240 bytes), and large (241+ bytes) inputs. The algorithms for small and medium inputs are optimized for performance. The three algorithms are described in the following sections. + +Many operations require some 64-bit prime number constants, which are mostly the same constants used in XXH32 and XXH64, all defined below: + +```c + static const u64 PRIME32_1 = 0x9E3779B1U; // 0b10011110001101110111100110110001 + static const u64 PRIME32_2 = 0x85EBCA77U; // 0b10000101111010111100101001110111 + static const u64 PRIME32_3 = 0xC2B2AE3DU; // 0b11000010101100101010111000111101 + static const u64 PRIME64_1 = 0x9E3779B185EBCA87ULL; // 0b1001111000110111011110011011000110000101111010111100101010000111 + static const u64 PRIME64_2 = 0xC2B2AE3D27D4EB4FULL; // 0b1100001010110010101011100011110100100111110101001110101101001111 + static const u64 PRIME64_3 = 0x165667B19E3779F9ULL; // 0b0001011001010110011001111011000110011110001101110111100111111001 + static const u64 PRIME64_4 = 0x85EBCA77C2B2AE63ULL; // 0b1000010111101011110010100111011111000010101100101010111001100011 + static const u64 PRIME64_5 = 0x27D4EB2F165667C5ULL; // 0b0010011111010100111010110010111100010110010101100110011111000101 + static const u64 PRIME_MX1 = 0x165667919E3779F9ULL; // 0b0001011001010110011001111001000110011110001101110111100111111001 + static const u64 PRIME_MX2 = 0x9FB21C651E98DF25ULL; // 0b1001111110110010000111000110010100011110100110001101111100100101 +``` + +The `XXH3_64bits()` function produces an unsigned 64-bit value. +The `XXH3_128bits()` function produces a `XXH128_hash_t` struct containing `low64` and `high64` - the lower and higher 64-bit half values of the result, respectively. + +For systems requiring storing and/or displaying the result in binary or hexadecimal format, the canonical format is defined to reproduce the same value as the natural decimal format, hence following **big-endian** convention (most significant byte first). + +### Seed and Secret + +XXH3 provides seeded hashing by introducing two configurable constants used in the hashing process: the seed and the secret. The seed is an unsigned 64-bit value, and the secret is an array of bytes that is at least 136 bytes in size. The default seed is 0, and the default secret is the following 192-byte value: + +```c +static const u8 defaultSecret[192] = { + 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c, + 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f, + 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21, + 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c, + 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3, + 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8, + 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d, + 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64, + 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb, + 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e, + 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce, + 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, +}; +``` + +The seed and the secret can be optionally specified using the `*_withSecret` and `*_withSeed` versions of the hash function. + +The seed and the secret cannot be specified simultaneously (`*_withSecretAndSeed` is actually `*_withSeed` for short and medium inputs <= 240 bytes, and `*_withSecret` for large inputs). When one is specified, the other one uses the default value. +There is one exception though: when input is large (> 240 bytes) and a seed is given, a secret is derived from the seed value and the default secret using the following procedure: + +```c +deriveSecret(u64 seed): + u64 derivedSecret[24] = defaultSecret[0:192]; + for (i = 0; i < 12; i++) { + derivedSecret[i*2] += seed; + derivedSecret[i*2+1] -= seed; + } + return derivedSecret; // convert to u8[192] (little-endian) +``` + +The derivation treats the secrets as 24 64-bit values. In XXH3 algorithms, the secret is always read similarly by treating a contiguous segment of the array as one or more 32-bit or 64-bit values. **The secret values are always read using little-endian convention**. + +### Final Mixing Step (avalanche) + +To make sure that all input bits have a chance to impact any bit in the output digest (avalanche effect), the final step of the XXH3 algorithm is usually one of the two fixed operations that mix the bits in a 64-bit value. These operations are denoted `avalanche()` and `avalanche_XXH64()` in the following XXH3 description. + +```c +avalanche(u64 x): + x = x xor (x >> 37); + x = x * PRIME_MX1; + x = x xor (x >> 32); + return x; + +avalanche_XXH64(u64 x): + x = x xor (x >> 33); + x = x * PRIME64_2; + x = x xor (x >> 29); + x = x * PRIME64_3; + x = x xor (x >> 32); + return x; +``` + +XXH3 Algorithm Description (for small inputs) +------------------------------------- + +The algorithm for small inputs (0-16 bytes of input) is further divided into 4 cases: empty, 1-3 bytes, 4-8 bytes, and 9-16 bytes of input. + +The algorithm uses byte-swap operations. The byte-swap operation reverses the byte order in a 32-bit or 64-bit value. It is denoted `bswap32` and `bswap64` for its 32-bit and 64-bit versions, respectively. + +### Empty input + +The hash of empty input is calculated from the seed and a segment of the secret: + +```c +XXH3_64_empty(): + u64 secretWords[2] = secret[56:72]; + return avalanche_XXH64(seed xor secretWords[0] xor secretWords[1]); + +XXH3_128_empty(): + u64 secretWords[4] = secret[64:96]; + return {avalanche_XXH64(seed xor secretWords[0] xor secretWords[1]), // lower half + avalanche_XXH64(seed xor secretWords[2] xor secretWords[3])}; // higher half +``` + +### 1-3 bytes of input + +The algorithm starts from a single 32-bit value combining the input bytes and its length: + +```c +u32 combined = (u32)input[inputLength-1] | ((u32)inputLength << 8) | + ((u32)input[0] << 16) | ((u32)input[inputLength>>1] << 24); +// LSB 8 16 24 MSB +// | last byte | length | first byte | middle-or-last byte | +``` + +Then the final output is calculated from the value and the first 8 bytes (XXH3-64) or 16 bytes (XXH3-128) of the secret to produce the final result. The secret here is read as 32-bit values instead of the usual 64-bit values. + +```c +XXH3_64_1to3(): + u32 secretWords[2] = secret[0:8]; + u64 value = ((u64)(secretWords[0] xor secretWords[1]) + seed) xor (u64)combined; + return avalanche_XXH64(value); + +XXH3_128_1to3(): + u32 secretWords[4] = secret[0:16]; + u64 low = ((u64)(secretWords[0] xor secretWords[1]) + seed) xor (u64)combined; + u64 high = ((u64)(secretWords[2] xor secretWords[3]) - seed) xor (u64)(bswap32(combined) <<< 13); + // note that the bswap32(combined) <<< 13 above is 32-bit rotate + return {avalanche_XXH64(low), // lower half + avalanche_XXH64(high)}; // higher half +``` + +Note that the XXH3-64 result is the lower half of XXH3-128 result. + +### 4-8 bytes of input + +The algorithm starts from reading the first and last 4 bytes of the input as little-endian 32-bit values, and a modified seed: + +```c +u32 inputFirst = input[0:4]; +u32 inputLast = input[inputLength-4:inputLength]; +u64 modifiedSeed = seed xor ((u64)bswap32((u32)lowerHalf(seed)) << 32); +``` + +Again, these values are combined with a segment of the secret to produce the final value. + +```c +XXH3_64_4to8(): + u64 secretWords[2] = secret[8:24]; + u64 combined = (u64)inputLast | ((u64)inputFirst << 32); + u64 value = ((secretWords[0] xor secretWords[1]) - modifiedSeed) xor combined; + value = value xor (value <<< 49) xor (value <<< 24); + value = value * PRIME_MX2; + value = value xor ((value >> 35) + inputLength); + value = value * PRIME_MX2; + value = value xor (value >> 28); + return value; + +XXH3_128_4to8(): + u64 secretWords[2] = secret[16:32]; + u64 combined = (u64)inputFirst | ((u64)inputLast << 32); + u64 value = ((secretWords[0] xor secretWords[1]) + modifiedSeed) xor combined; + u128 mulResult = (u128)value * (u128)(PRIME64_1 + (inputLength << 2)); + u64 high = higherHalf(mulResult); // mulResult >> 64 + u64 low = lowerHalf(mulResult); // mulResult & 0xFFFFFFFFFFFFFFFF + high = high + (low << 1); + low = low xor (high >> 3); + low = low xor (low >> 35); + low = low * PRIME_MX2; + low = low xor (low >> 28); + high = avalanche(high); + return {low, high}; +``` + +### 9-16 bytes of input + +The algorithm starts from reading the first and last 8 bytes of the input as little-endian 64-bit values: + +```c +u64 inputFirst = input[0:8]; +u64 inputLast = input[inputLength-8:inputLength]; +``` + +Once again, these values are combined with a segment of the secret to produce the final value. + +```c +XXH3_64_9to16(): + u64 secretWords[4] = secret[24:56]; + u64 low = ((secretWords[0] xor secretWords[1]) + seed) xor inputFirst; + u64 high = ((secretWords[2] xor secretWords[3]) - seed) xor inputLast; + u128 mulResult = (u128)low * (u128)high; + u64 value = inputLength + bswap64(low) + high + (u64)(lowerHalf(mulResult) xor higherHalf(mulResult)); + return avalanche(value); + +XXH3_128_9to16(): + u64 secretWords[4] = secret[32:64]; + u64 val1 = ((secretWords[0] xor secretWords[1]) - seed) xor inputFirst xor inputLast; + u64 val2 = ((secretWords[2] xor secretWords[3]) + seed) xor inputLast; + u128 mulResult = (u128)val1 * (u128)PRIME64_1; + u64 low = lowerHalf(mulResult) + ((u64)(inputLength - 1) << 54); + u64 high = higherHalf(mulResult) + ((u64)higherHalf(val2) << 32) + (u64)lowerHalf(val2) * PRIME32_2; + // the above line can also be simplified to higherHalf(mulResult) + val2 + (u64)lowerHalf(val2) * (PRIME32_2 - 1); + low = low xor bswap64(high); + // the following three lines are in fact a 128x64 -> 128 multiplication ({low,high} = (u128){low,high} * PRIME64_2) + u128 mulResult2 = (u128)low * (u128)PRIME64_2; + low = lowerHalf(mulResult2); + high = higherHalf(mulResult2) + high * PRIME64_2; + return {avalanche(low), // lower half + avalanche(high)}; // higher half +``` + + +XXH3 Algorithm Description (for medium inputs) +------------------------------------- + +This algorithm is used for medium inputs (17-240 bytes of input). Its internal hash state is stored inside 1 (XXH3-64) or 2 (XXH3-128) "accumulators", each storing an unsigned 64-bit value. + +### Step 1. Initialize internal accumulators + +The accumulator(s) are initialized based on the input length. + +```c +// For XXH3-64 +u64 acc = inputLength * PRIME64_1; + +// For XXH3-128 +u64 acc[2] = {inputLength * PRIME64_1, 0}; +``` + +### Step 2. Process the input + +This step is further divided into two cases: one for 17-128 bytes of input, and one for 129-240 bytes of input. + +#### Mixing operation + +This step uses a mixing operation that mixes a 16-byte segment of data, a 16-byte segment of secret and the seed into a 64-bit value as a building block. This operation treat the segment of data and secret as little-endian 64-bit values. + +```c +mixStep(u8 data[16], size secretOffset, u64 seed): + u64 dataWords[2] = data[0:16]; + u64 secretWords[2] = secret[secretOffset:secretOffset+16]; + u128 mulResult = (u128)(dataWords[0] xor (secretWords[0] + seed)) * + (u128)(dataWords[1] xor (secretWords[1] - seed)); + return lowerHalf(mulResult) xor higherHalf(mulResult); +``` + +The mixing operation is always invoked in groups of two in XXH3-128, where two 16-byte segments of data are mixed with a 32-byte segment of secret, and the accumulators are updated accordingly. + +```c +mixTwoChunks(u8 data1[16], u8 data2[16], size secretOffset, u64 seed): + u64 dataWords1[2] = data1[0:16]; // again, little-endian conversion + u64 dataWords2[2] = data2[0:16]; + acc[0] = acc[0] + mixStep(data1, secretOffset, seed); + acc[1] = acc[1] + mixStep(data2, secretOffset + 16, seed); + acc[0] = acc[0] xor (dataWords2[0] + dataWords2[1]); + acc[1] = acc[1] xor (dataWords1[0] + dataWords1[1]); +``` + +The input is split into several 16-byte chunks and mixed, and the result is added to the accumulator(s). + +#### 17-128 bytes of input + +The input is read as *N* 16-byte chunks starting from the beginning and *N* chunks starting from the end, where *N* is the smallest number that these 2*N* chunks cover the whole input. These chunks are paired up and mixed, and the results are accumulated to the accumulator(s). + +```c +// the loop variable `i` should be signed to avoid underflow in implementation +processInput_XXH3_64_17to128(): + u64 numRounds = ((inputLength - 1) >> 5) + 1; + for (i = numRounds - 1; i >= 0; i--) { + size offsetStart = i*16; + size offsetEnd = inputLength - i*16 - 16; + acc += mixStep(input[offsetStart:offsetStart+16], i*32, seed); + acc += mixStep(input[offsetEnd:offsetEnd+16], i*32+16, seed); + } + +processInput_XXH3_128_17to128(): + u64 numRounds = ((inputLength - 1) >> 5) + 1; + for (i = numRounds - 1; i >= 0; i--) { + size offsetStart = i*16; + size offsetEnd = inputLength - i*16 - 16; + mixTwoChunks(input[offsetStart:offsetStart+16], input[offsetEnd:offsetEnd+16], i*32, seed); + } +``` + +#### 129-240 bytes of input + +The input is split into 16-byte (XXH3-64) or 32-byte (XXH3-128) chunks. The first 128 bytes are first mixed chunk by chunk, followed by an intermediate avalanche operation. Then the remaining full chunks are processed, and finally the last 16/32 bytes are treated as a chunk to process. + +```c +processInput_XXH3_64_129to240(): + u64 numChunks = inputLength >> 4; + for (i = 0; i < 8; i++) { + acc += mixStep(input[i*16:i*16+16], i*16, seed); + } + acc = avalanche(acc); + for (i = 8; i < numChunks; i++) { + acc += mixStep(input[i*16:i*16+16], (i-8)*16 + 3, seed); + } + acc += mixStep(input[inputLength-16:inputLength], 119, seed); + +processInput_XXH3_128_129to240(): + u64 numChunks = inputLength >> 5; + for (i = 0; i < 4; i++) { + mixTwoChunks(input[i*32:i*32+16], input[i*32+16:i*32+32], i*32, seed); + } + acc[0] = avalanche(acc[0]); + acc[1] = avalanche(acc[1]); + for (i = 4; i < numChunks; i++) { + mixTwoChunks(input[i*32:i*32+16], input[i*32+16:i*32+32], (i-4)*32 + 3, seed); + } + // note that the half-chunk order and the seed is different here + mixTwoChunks(input[inputLength-16:inputLength], input[inputLength-32:inputLength-16], 103, (u64)0 - seed); +``` + +### Step 3. Finalization + +The final result is extracted from the accumulator(s). + +```c +XXH3_64_17to240(): + return avalanche(acc); + +XXH3_128_17to240(): + u64 low = acc[0] + acc[1]; + u64 high = (acc[0] * PRIME64_1) + (acc[1] * PRIME64_4) + (((u64)inputLength - seed) * PRIME64_2); + return {avalanche(low), // lower half + (u64)0 - avalanche(high)}; // higher half +``` + +XXH3 Algorithm Description (for large inputs) +------------------------------------- + +This algorithm is used for inputs larger than 240 bytes. The internal hash state is stored inside 8 "accumulators", each one storing an unsigned 64-bit value. + +### Step 1. Initialize internal accumulators + +The accumulators are initialized to fixed constants: + +```c +u64 acc[8] = { + PRIME32_3, PRIME64_1, PRIME64_2, PRIME64_3, + PRIME64_4, PRIME32_2, PRIME64_5, PRIME32_1}; +``` + +### Step 2. Process blocks + +The input is consumed and processed one full block at a time. The size of the block depends on the length of the secret. Specifically, a block consists of several 64-byte stripes. The number of stripes per block is `floor((secretLength-64)/8)` . For the default 192-byte secret, there are 16 stripes in a block, and thus the block size is 1024 bytes. + +```c +secretLength = lengthInBytes(secret); // default 192; at least 136 +stripesPerBlock = (secretLength-64) / 8; // default 16; at least 9 +blockSize = 64 * stripesPerBlock; // default 1024; at least 576 +``` + +The process of processing a full block is called a *round*. It consists of the following two sub-steps: + +#### Step 2-1. Process stripes in the block + +A stripe is evenly divided into 8 lanes, of 8 bytes each. In an accumulation step, one stripe and a 64-byte contiguous segment of the secret are used to update the accumulators. Each lane reads its associated 64-bit value using little-endian convention. + +The accumulation step applies the following procedure: + +```c +accumulate(u64 stripe[8], size secretOffset): + u64 secretWords[8] = secret[secretOffset:secretOffset+64]; + for (i = 0; i < 8; i++) { + u64 value = stripe[i] xor secretWords[i]; + acc[i xor 1] = acc[i xor 1] + stripe[i]; + acc[i] = acc[i] + (u64)lowerHalf(value) * (u64)higherHalf(value); + // (value and 0xFFFFFFFF) * (value >> 32) + } +``` + +The accumulation step is repeated for all stripes in a block, using different segments of the secret, starting from the first 64 bytes for the first stripe, and offset by 8 bytes for each following round: + +```c +round_accumulate(u8 block[blockSize]): + for (n = 0; n < stripesPerBlock; n++) { + u64 stripe[8] = block[n*64:n*64+64]; // 64 bytes = 8 u64s + accumulate(stripe, n*8); + } +``` + +#### Step 2-2. Scramble accumulators + +After the accumulation steps are finished for all stripes in the block, the accumulators are scrambled using the last 64 bytes of the secret. + +```c +round_scramble(): + u64 secretWords[8] = secret[secretLength-64:secretLength]; + for (i = 0; i < 8; i++) { + acc[i] = acc[i] xor (acc[i] >> 47); + acc[i] = acc[i] xor secretWords[i]; + acc[i] = acc[i] * PRIME32_1; + } +``` + +A round is thus a `round_accumulate` followed by a `round_scramble`: + +```c +round(u8 block[blockSize]): + round_accumulate(block); + round_scramble(); +``` + +Step 2 is looped to consume the input until there are less than or equal to `blockSize` bytes of input left. Note that we leave the last block to the next step even if it is a full block. + +### Step 3. Process the last block and the last 64 bytes + +Accumulation steps are run for the stripes in the last block, except for the last stripe (whether it is full or not). After that, run a final accumulation step by treating the last 64 bytes as a stripe. Note that the last 64 bytes might overlap with the second-to-last block. + +```c +// len is the size of the last block (1 <= len <= blockSize) +lastRound(u8 block[], size len, u64 lastStripe[8]): + size nFullStripes = (len-1)/64; + for (n = 0; n < nFullStripes; n++) { + u64 stripe[8] = block[n*64:n*64+64]; + accumulate(stripe, n * 8); + } + accumulate(lastStripe, secretLength - 71); +``` + +### Step 4. Finalization + +In the finalization step, a merging procedure is used to extract a single 64-bit value from the accumulators, using an initial seed value and a 64-byte segment of the secret. + +```c +finalMerge(u64 initValue, size secretOffset): + u64 secretWords[8] = secret[secretOffset:secretOffset+64]; + u64 result = initValue; + for (i = 0; i < 4; i++) { + // 64-bit by 64-bit multiplication to 128-bit full result + u128 mulResult = (u128)(acc[i*2] xor secretWords[i*2]) * + (u128)(acc[i*2+1] xor secretWords[i*2+1]); + result = result + (lowerHalf(mulResult) xor higherHalf(mulResult)); + // (mulResult and 0xFFFFFFFFFFFFFFFF) xor (mulResult >> 64) + } + return avalanche(result); +``` + +XXH3-128 runs the merging procedure twice for the two halves of the result, using different secret segments and different initial values derived from the total input length. +The XXH3-64 result is just the lower half of the XXH3-128 result. + +```c +XXH3_64_large(): + return finalMerge((u64)inputLength * PRIME64_1, 11); + +XXH3_128_large(): + return {finalMerge((u64)inputLength * PRIME64_1, 11), // lower half + finalMerge(~((u64)inputLength * PRIME64_2), secretLength - 75)}; // higher half +``` + + Performance considerations ---------------------------------- @@ -335,6 +802,8 @@ On 64-bit systems, the 64-bit variant `XXH64` is generally faster to compute, so On 32-bit systems though, positions are reversed: `XXH64` performance is reduced, due to its usage of 64-bit arithmetic. `XXH32` becomes a faster variant. +Finally, when vector operations are possible, `XXH3` is likely the faster variant. + Reference Implementation ---------------------------------------- @@ -346,6 +815,6 @@ It links to the [github project page](https://github.com/Cyan4973/xxHash) where Version changes -------------------- -v0.7.3: Minor fixes +v0.2.0: added XXH3 specification, by Adrien Wu v0.1.1: added a note on rationale for selection of constants v0.1.0: initial release diff --git a/lib/cfl/lib/xxhash/libxxhash.pc.in b/lib/cfl/lib/xxhash/libxxhash.pc.in index 28c16448567..fc59344ca22 100644 --- a/lib/cfl/lib/xxhash/libxxhash.pc.in +++ b/lib/cfl/lib/xxhash/libxxhash.pc.in @@ -1,11 +1,11 @@ # xxHash - Extremely fast hash algorithm -# Copyright (C) 2012-2020, Yann Collet, Facebook +# Copyright (C) 2012-2021, Yann Collet, Facebook # BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) prefix=@PREFIX@ exec_prefix=@EXECPREFIX@ -includedir=${prefix}/@INCLUDEDIR@ -libdir=${exec_prefix}/@LIBDIR@ +includedir=@INCLUDEDIR@ +libdir=@LIBDIR@ Name: xxhash Description: extremely fast hash algorithm diff --git a/lib/cfl/lib/xxhash/xxh3.h b/lib/cfl/lib/xxhash/xxh3.h index f7dc1959b57..7e3ce68e0cc 100644 --- a/lib/cfl/lib/xxhash/xxh3.h +++ b/lib/cfl/lib/xxhash/xxh3.h @@ -1,7 +1,7 @@ /* * xxHash - Extremely Fast Hash algorithm * Development source file for `xxh3` - * Copyright (C) 2019-2020 Yann Collet + * Copyright (C) 2019-2021 Yann Collet * * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) * diff --git a/lib/cfl/lib/xxhash/xxh_x86dispatch.c b/lib/cfl/lib/xxhash/xxh_x86dispatch.c index 399bad90458..0c1582008dc 100644 --- a/lib/cfl/lib/xxhash/xxh_x86dispatch.c +++ b/lib/cfl/lib/xxhash/xxh_x86dispatch.c @@ -1,6 +1,6 @@ /* * xxHash - Extremely Fast Hash algorithm - * Copyright (C) 2020 Yann Collet + * Copyright (C) 2020-2021 Yann Collet * * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) * @@ -36,13 +36,13 @@ /*! * @file xxh_x86dispatch.c * - * Automatic dispatcher code for the @ref xxh3_family on x86-based targets. + * Automatic dispatcher code for the @ref XXH3_family on x86-based targets. * * Optional add-on. * - * **Compile this file with the default flags for your target.** Do not compile - * with flags like `-mavx*`, `-march=native`, or `/arch:AVX*`, there will be - * an error. See @ref XXH_X86DISPATCH_ALLOW_AVX for details. + * **Compile this file with the default flags for your target.** + * Note that compiling with flags like `-mavx*`, `-march=native`, or `/arch:AVX*` + * will make the resulting binary incompatible with cpus not supporting the requested instruction set. * * @defgroup dispatch x86 Dispatcher * @{ @@ -56,40 +56,19 @@ extern "C" { # error "Dispatching is currently only supported on x86 and x86_64." #endif -/*! - * @def XXH_X86DISPATCH_ALLOW_AVX - * @brief Disables the AVX sanity check. - * - * Don't compile xxh_x86dispatch.c with options like `-mavx*`, `-march=native`, - * or `/arch:AVX*`. It is intended to be compiled for the minimum target, and - * it selectively enables SSE2, AVX2, and AVX512 when it is needed. - * - * Using this option _globally_ allows this feature, and therefore makes it - * undefined behavior to execute on any CPU without said feature. - * - * Even if the source code isn't directly using AVX intrinsics in a function, - * the compiler can still generate AVX code from autovectorization and by - * "upgrading" SSE2 intrinsics to use the VEX prefixes (a.k.a. AVX128). - * - * Use the same flags that you use to compile the rest of the program; this - * file will safely generate SSE2, AVX2, and AVX512 without these flags. - * - * Define XXH_X86DISPATCH_ALLOW_AVX to ignore this check, and feel free to open - * an issue if there is a target in the future where AVX is a default feature. +/*! @cond Doxygen ignores this part */ +#ifndef XXH_HAS_INCLUDE +# ifdef __has_include +/* + * Not defined as XXH_HAS_INCLUDE(x) (function-like) because + * this causes segfaults in Apple Clang 4.2 (on Mac OS X 10.7 Lion) */ -#ifdef XXH_DOXYGEN -# define XXH_X86DISPATCH_ALLOW_AVX -#endif - -#if defined(__AVX__) && !defined(XXH_X86DISPATCH_ALLOW_AVX) -# error "Do not compile xxh_x86dispatch.c with AVX enabled! See the comment above." -#endif - -#ifdef __has_include -# define XXH_HAS_INCLUDE(header) __has_include(header) -#else -# define XXH_HAS_INCLUDE(header) 0 +# define XXH_HAS_INCLUDE __has_include +# else +# define XXH_HAS_INCLUDE(x) 0 +# endif #endif +/*! @endcond */ /*! * @def XXH_DISPATCH_SCALAR @@ -107,7 +86,7 @@ extern "C" { #ifndef XXH_DISPATCH_SCALAR # if defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2) /* SSE2 on by default */ \ || defined(__x86_64__) || defined(_M_X64) /* x86_64 */ \ - || defined(__ANDROID__) || defined(__APPLEv__) /* Android or macOS */ + || defined(__ANDROID__) || defined(__APPLE__) /* Android or macOS */ # define XXH_DISPATCH_SCALAR 0 /* disable */ # else # define XXH_DISPATCH_SCALAR 1 @@ -174,6 +153,7 @@ extern "C" { * * @def XXH_TARGET_AVX512 * @brief Like @ref XXH_TARGET_SSE2, but for AVX512. + * */ #if defined(__GNUC__) # include /* SSE2 */ @@ -183,6 +163,18 @@ extern "C" { # define XXH_TARGET_SSE2 __attribute__((__target__("sse2"))) # define XXH_TARGET_AVX2 __attribute__((__target__("avx2"))) # define XXH_TARGET_AVX512 __attribute__((__target__("avx512f"))) +#elif defined(__clang__) && defined(_MSC_VER) /* clang-cl.exe */ +# include /* SSE2 */ +# if XXH_DISPATCH_AVX2 || XXH_DISPATCH_AVX512 +# include /* AVX2, AVX512F */ +# include +# include +# include +# include +# endif +# define XXH_TARGET_SSE2 __attribute__((__target__("sse2"))) +# define XXH_TARGET_AVX2 __attribute__((__target__("avx2"))) +# define XXH_TARGET_AVX512 __attribute__((__target__("avx512f"))) #elif defined(_MSC_VER) # include # define XXH_TARGET_SSE2 @@ -192,6 +184,7 @@ extern "C" { # error "Dispatching is currently not supported for your compiler." #endif +/*! @cond Doxygen ignores this part */ #ifdef XXH_DISPATCH_DEBUG /* debug logging */ # include @@ -201,12 +194,37 @@ extern "C" { # undef NDEBUG /* avoid redefinition */ # define NDEBUG #endif +/*! @endcond */ #include +#ifndef XXH_DOXYGEN #define XXH_INLINE_ALL #define XXH_X86DISPATCH #include "xxhash.h" +#endif + +/*! @cond Doxygen ignores this part */ +#ifndef XXH_HAS_ATTRIBUTE +# ifdef __has_attribute +# define XXH_HAS_ATTRIBUTE(...) __has_attribute(__VA_ARGS__) +# else +# define XXH_HAS_ATTRIBUTE(...) 0 +# endif +#endif +/*! @endcond */ +/*! @cond Doxygen ignores this part */ +#if XXH_HAS_ATTRIBUTE(constructor) +# define XXH_CONSTRUCTOR __attribute__((constructor)) +# define XXH_DISPATCH_MAYBE_NULL 0 +#else +# define XXH_CONSTRUCTOR +# define XXH_DISPATCH_MAYBE_NULL 1 +#endif +/*! @endcond */ + + +/*! @cond Doxygen ignores this part */ /* * Support both AT&T and Intel dialects * @@ -224,9 +242,10 @@ extern "C" { #else # define XXH_I_ATT(intel, att) "{" att "|" intel "}\n\t" #endif +/*! @endcond */ /*! - * @internal + * @private * @brief Runs CPUID. * * @param eax , ecx The parameters to pass to CPUID, %eax and %ecx respectively. @@ -235,7 +254,7 @@ extern "C" { static void XXH_cpuid(xxh_u32 eax, xxh_u32 ecx, xxh_u32* abcd) { #if defined(_MSC_VER) - __cpuidex(abcd, eax, ecx); + __cpuidex((int*)abcd, eax, ecx); #else xxh_u32 ebx, edx; # if defined(__i386__) && defined(__PIC__) @@ -269,7 +288,7 @@ static void XXH_cpuid(xxh_u32 eax, xxh_u32 ecx, xxh_u32* abcd) #if XXH_DISPATCH_AVX2 || XXH_DISPATCH_AVX512 /*! - * @internal + * @private * @brief Runs `XGETBV`. * * While the CPU may support AVX2, the operating system might not properly save @@ -303,23 +322,25 @@ static xxh_u64 XXH_xgetbv(void) } #endif +/*! @cond Doxygen ignores this part */ #define XXH_SSE2_CPUID_MASK (1 << 26) #define XXH_OSXSAVE_CPUID_MASK ((1 << 26) | (1 << 27)) #define XXH_AVX2_CPUID_MASK (1 << 5) #define XXH_AVX2_XGETBV_MASK ((1 << 2) | (1 << 1)) #define XXH_AVX512F_CPUID_MASK (1 << 16) #define XXH_AVX512F_XGETBV_MASK ((7 << 5) | (1 << 2) | (1 << 1)) +/*! @endcond */ /*! - * @internal + * @private * @brief Returns the best XXH3 implementation. * * Runs various CPUID/XGETBV tests to try and determine the best implementation. * - * @ret The best @ref XXH_VECTOR implementation. + * @return The best @ref XXH_VECTOR implementation. * @see XXH_VECTOR_TYPES */ -static int XXH_featureTest(void) +int XXH_featureTest(void) { xxh_u32 abcd[4]; xxh_u32 max_leaves; @@ -441,8 +462,9 @@ static int XXH_featureTest(void) /* === Vector implementations === */ +/*! @cond PRIVATE */ /*! - * @internal + * @private * @brief Defines the various dispatch functions. * * TODO: Consolidate? @@ -450,27 +472,29 @@ static int XXH_featureTest(void) * @param suffix The suffix for the functions, e.g. sse2 or scalar * @param target XXH_TARGET_* or empty. */ + #define XXH_DEFINE_DISPATCH_FUNCS(suffix, target) \ \ /* === XXH3, default variants === */ \ \ XXH_NO_INLINE target XXH64_hash_t \ -XXHL64_default_##suffix(const void* XXH_RESTRICT input, size_t len) \ +XXHL64_default_##suffix(XXH_NOESCAPE const void* XXH_RESTRICT input, \ + size_t len) \ { \ return XXH3_hashLong_64b_internal( \ input, len, XXH3_kSecret, sizeof(XXH3_kSecret), \ - XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix \ + XXH3_accumulate_##suffix, XXH3_scrambleAcc_##suffix \ ); \ } \ \ /* === XXH3, Seeded variants === */ \ \ XXH_NO_INLINE target XXH64_hash_t \ -XXHL64_seed_##suffix(const void* XXH_RESTRICT input, size_t len, \ +XXHL64_seed_##suffix(XXH_NOESCAPE const void* XXH_RESTRICT input, size_t len, \ XXH64_hash_t seed) \ { \ return XXH3_hashLong_64b_withSeed_internal( \ - input, len, seed, XXH3_accumulate_512_##suffix, \ + input, len, seed, XXH3_accumulate_##suffix, \ XXH3_scrambleAcc_##suffix, XXH3_initCustomSecret_##suffix \ ); \ } \ @@ -478,59 +502,66 @@ XXHL64_seed_##suffix(const void* XXH_RESTRICT input, size_t len, \ /* === XXH3, Secret variants === */ \ \ XXH_NO_INLINE target XXH64_hash_t \ -XXHL64_secret_##suffix(const void* XXH_RESTRICT input, size_t len, \ - const void* secret, size_t secretLen) \ +XXHL64_secret_##suffix(XXH_NOESCAPE const void* XXH_RESTRICT input, \ + size_t len, XXH_NOESCAPE const void* secret, \ + size_t secretLen) \ { \ return XXH3_hashLong_64b_internal( \ input, len, secret, secretLen, \ - XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix \ + XXH3_accumulate_##suffix, XXH3_scrambleAcc_##suffix \ ); \ } \ \ /* === XXH3 update variants === */ \ \ XXH_NO_INLINE target XXH_errorcode \ -XXH3_update_##suffix(XXH3_state_t* state, const void* input, size_t len) \ +XXH3_update_##suffix(XXH_NOESCAPE XXH3_state_t* state, \ + XXH_NOESCAPE const void* input, size_t len) \ { \ return XXH3_update(state, (const xxh_u8*)input, len, \ - XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix); \ + XXH3_accumulate_##suffix, XXH3_scrambleAcc_##suffix); \ } \ \ /* === XXH128 default variants === */ \ \ XXH_NO_INLINE target XXH128_hash_t \ -XXHL128_default_##suffix(const void* XXH_RESTRICT input, size_t len) \ +XXHL128_default_##suffix(XXH_NOESCAPE const void* XXH_RESTRICT input, \ + size_t len) \ { \ return XXH3_hashLong_128b_internal( \ input, len, XXH3_kSecret, sizeof(XXH3_kSecret), \ - XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix \ + XXH3_accumulate_##suffix, XXH3_scrambleAcc_##suffix \ ); \ } \ \ /* === XXH128 Secret variants === */ \ \ XXH_NO_INLINE target XXH128_hash_t \ -XXHL128_secret_##suffix(const void* XXH_RESTRICT input, size_t len, \ - const void* XXH_RESTRICT secret, size_t secretLen) \ +XXHL128_secret_##suffix(XXH_NOESCAPE const void* XXH_RESTRICT input, \ + size_t len, \ + XXH_NOESCAPE const void* XXH_RESTRICT secret, \ + size_t secretLen) \ { \ return XXH3_hashLong_128b_internal( \ input, len, (const xxh_u8*)secret, secretLen, \ - XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix); \ + XXH3_accumulate_##suffix, XXH3_scrambleAcc_##suffix); \ } \ \ /* === XXH128 Seeded variants === */ \ \ XXH_NO_INLINE target XXH128_hash_t \ -XXHL128_seed_##suffix(const void* XXH_RESTRICT input, size_t len, \ +XXHL128_seed_##suffix(XXH_NOESCAPE const void* XXH_RESTRICT input, size_t len,\ XXH64_hash_t seed) \ { \ return XXH3_hashLong_128b_withSeed_internal(input, len, seed, \ - XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix, \ + XXH3_accumulate_##suffix, XXH3_scrambleAcc_##suffix, \ XXH3_initCustomSecret_##suffix); \ } +/*! @endcond */ /* End XXH_DEFINE_DISPATCH_FUNCS */ +/*! @cond Doxygen ignores this part */ #if XXH_DISPATCH_SCALAR XXH_DEFINE_DISPATCH_FUNCS(scalar, /* nothing */) #endif @@ -542,16 +573,18 @@ XXH_DEFINE_DISPATCH_FUNCS(avx2, XXH_TARGET_AVX2) XXH_DEFINE_DISPATCH_FUNCS(avx512, XXH_TARGET_AVX512) #endif #undef XXH_DEFINE_DISPATCH_FUNCS +/*! @endcond */ /* ==== Dispatchers ==== */ -typedef XXH64_hash_t (*XXH3_dispatchx86_hashLong64_default)(const void* XXH_RESTRICT, size_t); +/*! @cond Doxygen ignores this part */ +typedef XXH64_hash_t (*XXH3_dispatchx86_hashLong64_default)(XXH_NOESCAPE const void* XXH_RESTRICT, size_t); -typedef XXH64_hash_t (*XXH3_dispatchx86_hashLong64_withSeed)(const void* XXH_RESTRICT, size_t, XXH64_hash_t); +typedef XXH64_hash_t (*XXH3_dispatchx86_hashLong64_withSeed)(XXH_NOESCAPE const void* XXH_RESTRICT, size_t, XXH64_hash_t); -typedef XXH64_hash_t (*XXH3_dispatchx86_hashLong64_withSecret)(const void* XXH_RESTRICT, size_t, const void* XXH_RESTRICT, size_t); +typedef XXH64_hash_t (*XXH3_dispatchx86_hashLong64_withSecret)(XXH_NOESCAPE const void* XXH_RESTRICT, size_t, XXH_NOESCAPE const void* XXH_RESTRICT, size_t); -typedef XXH_errorcode (*XXH3_dispatchx86_update)(XXH3_state_t*, const void*, size_t); +typedef XXH_errorcode (*XXH3_dispatchx86_update)(XXH_NOESCAPE XXH3_state_t*, XXH_NOESCAPE const void*, size_t); typedef struct { XXH3_dispatchx86_hashLong64_default hashLong64_default; @@ -561,9 +594,10 @@ typedef struct { } XXH_dispatchFunctions_s; #define XXH_NB_DISPATCHES 4 +/*! @endcond */ /*! - * @internal + * @private * @brief Table of dispatchers for @ref XXH3_64bits(). * * @pre The indices must match @ref XXH_VECTOR_TYPE. @@ -587,17 +621,18 @@ static const XXH_dispatchFunctions_s XXH_kDispatch[XXH_NB_DISPATCHES] = { #endif }; /*! - * @internal + * @private * @brief The selected dispatch table for @ref XXH3_64bits(). */ static XXH_dispatchFunctions_s XXH_g_dispatch = { NULL, NULL, NULL, NULL }; -typedef XXH128_hash_t (*XXH3_dispatchx86_hashLong128_default)(const void* XXH_RESTRICT, size_t); +/*! @cond Doxygen ignores this part */ +typedef XXH128_hash_t (*XXH3_dispatchx86_hashLong128_default)(XXH_NOESCAPE const void* XXH_RESTRICT, size_t); -typedef XXH128_hash_t (*XXH3_dispatchx86_hashLong128_withSeed)(const void* XXH_RESTRICT, size_t, XXH64_hash_t); +typedef XXH128_hash_t (*XXH3_dispatchx86_hashLong128_withSeed)(XXH_NOESCAPE const void* XXH_RESTRICT, size_t, XXH64_hash_t); -typedef XXH128_hash_t (*XXH3_dispatchx86_hashLong128_withSecret)(const void* XXH_RESTRICT, size_t, const void* XXH_RESTRICT, size_t); +typedef XXH128_hash_t (*XXH3_dispatchx86_hashLong128_withSecret)(XXH_NOESCAPE const void* XXH_RESTRICT, size_t, XXH_NOESCAPE const void* XXH_RESTRICT, size_t); typedef struct { XXH3_dispatchx86_hashLong128_default hashLong128_default; @@ -605,10 +640,11 @@ typedef struct { XXH3_dispatchx86_hashLong128_withSecret hashLong128_secret; XXH3_dispatchx86_update update; } XXH_dispatch128Functions_s; +/*! @endcond */ /*! - * @internal + * @private * @brief Table of dispatchers for @ref XXH3_128bits(). * * @pre The indices must match @ref XXH_VECTOR_TYPE. @@ -633,16 +669,16 @@ static const XXH_dispatch128Functions_s XXH_kDispatch128[XXH_NB_DISPATCHES] = { }; /*! - * @internal + * @private * @brief The selected dispatch table for @ref XXH3_64bits(). */ static XXH_dispatch128Functions_s XXH_g_dispatch128 = { NULL, NULL, NULL, NULL }; /*! - * @internal + * @private * @brief Runs a CPUID check and sets the correct dispatch tables. */ -static void XXH_setDispatch(void) +static XXH_CONSTRUCTOR void XXH_setDispatch(void) { int vecID = XXH_featureTest(); XXH_STATIC_ASSERT(XXH_AVX512 == XXH_NB_DISPATCHES-1); @@ -662,83 +698,94 @@ static void XXH_setDispatch(void) /* ==== XXH3 public functions ==== */ +/*! @cond Doxygen ignores this part */ static XXH64_hash_t -XXH3_hashLong_64b_defaultSecret_selection(const void* input, size_t len, - XXH64_hash_t seed64, const xxh_u8* secret, size_t secretLen) +XXH3_hashLong_64b_defaultSecret_selection(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; (void)secret; (void)secretLen; - if (XXH_g_dispatch.hashLong64_default == NULL) XXH_setDispatch(); + if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch.hashLong64_default == NULL) + XXH_setDispatch(); return XXH_g_dispatch.hashLong64_default(input, len); } -XXH64_hash_t XXH3_64bits_dispatch(const void* input, size_t len) +XXH64_hash_t XXH3_64bits_dispatch(XXH_NOESCAPE const void* input, size_t len) { return XXH3_64bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_defaultSecret_selection); } static XXH64_hash_t -XXH3_hashLong_64b_withSeed_selection(const void* input, size_t len, - XXH64_hash_t seed64, const xxh_u8* secret, size_t secretLen) +XXH3_hashLong_64b_withSeed_selection(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)secret; (void)secretLen; - if (XXH_g_dispatch.hashLong64_seed == NULL) XXH_setDispatch(); + if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch.hashLong64_seed == NULL) + XXH_setDispatch(); return XXH_g_dispatch.hashLong64_seed(input, len, seed64); } -XXH64_hash_t XXH3_64bits_withSeed_dispatch(const void* input, size_t len, XXH64_hash_t seed) +XXH64_hash_t XXH3_64bits_withSeed_dispatch(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed_selection); } static XXH64_hash_t -XXH3_hashLong_64b_withSecret_selection(const void* input, size_t len, - XXH64_hash_t seed64, const xxh_u8* secret, size_t secretLen) +XXH3_hashLong_64b_withSecret_selection(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; - if (XXH_g_dispatch.hashLong64_secret == NULL) XXH_setDispatch(); + if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch.hashLong64_secret == NULL) + XXH_setDispatch(); return XXH_g_dispatch.hashLong64_secret(input, len, secret, secretLen); } -XXH64_hash_t XXH3_64bits_withSecret_dispatch(const void* input, size_t len, const void* secret, size_t secretLen) +XXH64_hash_t XXH3_64bits_withSecret_dispatch(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretLen) { return XXH3_64bits_internal(input, len, 0, secret, secretLen, XXH3_hashLong_64b_withSecret_selection); } XXH_errorcode -XXH3_64bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len) +XXH3_64bits_update_dispatch(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len) { - if (XXH_g_dispatch.update == NULL) XXH_setDispatch(); + if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch.update == NULL) + XXH_setDispatch(); + return XXH_g_dispatch.update(state, (const xxh_u8*)input, len); } +/*! @endcond */ + /* ==== XXH128 public functions ==== */ +/*! @cond Doxygen ignores this part */ static XXH128_hash_t XXH3_hashLong_128b_defaultSecret_selection(const void* input, size_t len, XXH64_hash_t seed64, const void* secret, size_t secretLen) { (void)seed64; (void)secret; (void)secretLen; - if (XXH_g_dispatch128.hashLong128_default == NULL) XXH_setDispatch(); + if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch128.hashLong128_default == NULL) + XXH_setDispatch(); return XXH_g_dispatch128.hashLong128_default(input, len); } -XXH128_hash_t XXH3_128bits_dispatch(const void* input, size_t len) +XXH128_hash_t XXH3_128bits_dispatch(XXH_NOESCAPE const void* input, size_t len) { return XXH3_128bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_defaultSecret_selection); } static XXH128_hash_t XXH3_hashLong_128b_withSeed_selection(const void* input, size_t len, - XXH64_hash_t seed64, const void* secret, size_t secretLen) + XXH64_hash_t seed64, const void* secret, size_t secretLen) { (void)secret; (void)secretLen; - if (XXH_g_dispatch128.hashLong128_seed == NULL) XXH_setDispatch(); + if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch128.hashLong128_seed == NULL) + XXH_setDispatch(); return XXH_g_dispatch128.hashLong128_seed(input, len, seed64); } -XXH128_hash_t XXH3_128bits_withSeed_dispatch(const void* input, size_t len, XXH64_hash_t seed) +XXH128_hash_t XXH3_128bits_withSeed_dispatch(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_withSeed_selection); } @@ -748,22 +795,26 @@ XXH3_hashLong_128b_withSecret_selection(const void* input, size_t len, XXH64_hash_t seed64, const void* secret, size_t secretLen) { (void)seed64; - if (XXH_g_dispatch128.hashLong128_secret == NULL) XXH_setDispatch(); + if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch128.hashLong128_secret == NULL) + XXH_setDispatch(); return XXH_g_dispatch128.hashLong128_secret(input, len, secret, secretLen); } -XXH128_hash_t XXH3_128bits_withSecret_dispatch(const void* input, size_t len, const void* secret, size_t secretLen) +XXH128_hash_t XXH3_128bits_withSecret_dispatch(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretLen) { return XXH3_128bits_internal(input, len, 0, secret, secretLen, XXH3_hashLong_128b_withSecret_selection); } XXH_errorcode -XXH3_128bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len) +XXH3_128bits_update_dispatch(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len) { - if (XXH_g_dispatch128.update == NULL) XXH_setDispatch(); + if (XXH_DISPATCH_MAYBE_NULL && XXH_g_dispatch128.update == NULL) + XXH_setDispatch(); return XXH_g_dispatch128.update(state, (const xxh_u8*)input, len); } +/*! @endcond */ + #if defined (__cplusplus) } #endif diff --git a/lib/cfl/lib/xxhash/xxh_x86dispatch.h b/lib/cfl/lib/xxhash/xxh_x86dispatch.h index 6bc17bcbbe4..7085221570e 100644 --- a/lib/cfl/lib/xxhash/xxh_x86dispatch.h +++ b/lib/cfl/lib/xxhash/xxh_x86dispatch.h @@ -1,6 +1,6 @@ /* * xxHash - XXH3 Dispatcher for x86-based targets - * Copyright (C) 2020 Yann Collet + * Copyright (C) 2020-2024 Yann Collet * * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) * @@ -41,15 +41,23 @@ extern "C" { #endif -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_dispatch(const void* input, size_t len); -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed_dispatch(const void* input, size_t len, XXH64_hash_t seed); -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret_dispatch(const void* input, size_t len, const void* secret, size_t secretLen); -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len); +/*! + * @brief Returns the best XXH3 implementation for x86 + * + * @return The best @ref XXH_VECTOR implementation. + * @see XXH_VECTOR_TYPES + */ +XXH_PUBLIC_API int XXH_featureTest(void); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_dispatch(const void* input, size_t len); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed_dispatch(const void* input, size_t len, XXH64_hash_t seed); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret_dispatch(const void* input, size_t len, const void* secret, size_t secretLen); -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len); +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_dispatch(XXH_NOESCAPE const void* input, size_t len); +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed_dispatch(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed); +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret_dispatch(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretLen); +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update_dispatch(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len); + +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_dispatch(XXH_NOESCAPE const void* input, size_t len); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed_dispatch(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret_dispatch(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretLen); +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update_dispatch(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len); #if defined (__cplusplus) } @@ -71,7 +79,6 @@ XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update_dispatch(XXH3_state_t* state, c # undef XXH128 # define XXH128 XXH3_128bits_withSeed_dispatch -# define XXH3_128bits XXH3_128bits_dispatch # undef XXH3_128bits # define XXH3_128bits XXH3_128bits_dispatch # undef XXH3_128bits_withSeed diff --git a/lib/cfl/lib/xxhash/xxhash.c b/lib/cfl/lib/xxhash/xxhash.c index 0fae88c5d67..e60cc37f13c 100644 --- a/lib/cfl/lib/xxhash/xxhash.c +++ b/lib/cfl/lib/xxhash/xxhash.c @@ -1,6 +1,6 @@ /* * xxHash - Extremely Fast Hash algorithm - * Copyright (C) 2012-2020 Yann Collet + * Copyright (C) 2012-2023 Yann Collet * * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) * @@ -32,12 +32,11 @@ * - xxHash source repository: https://github.com/Cyan4973/xxHash */ - /* * xxhash.c instantiates functions defined in xxhash.h */ -#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ -#define XXH_IMPLEMENTATION /* access definitions */ +#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ +#define XXH_IMPLEMENTATION /* access definitions */ #include "xxhash.h" diff --git a/lib/cfl/lib/xxhash/xxhash.h b/lib/cfl/lib/xxhash/xxhash.h index 511c4d12bf6..1ad2ddb616e 100644 --- a/lib/cfl/lib/xxhash/xxhash.h +++ b/lib/cfl/lib/xxhash/xxhash.h @@ -1,7 +1,7 @@ /* * xxHash - Extremely Fast Hash algorithm * Header File - * Copyright (C) 2012-2020 Yann Collet + * Copyright (C) 2012-2023 Yann Collet * * BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) * @@ -32,51 +32,216 @@ * - xxHash homepage: https://www.xxhash.com * - xxHash source repository: https://github.com/Cyan4973/xxHash */ + /*! * @mainpage xxHash * + * xxHash is an extremely fast non-cryptographic hash algorithm, working at RAM speed + * limits. + * + * It is proposed in four flavors, in three families: + * 1. @ref XXH32_family + * - Classic 32-bit hash function. Simple, compact, and runs on almost all + * 32-bit and 64-bit systems. + * 2. @ref XXH64_family + * - Classic 64-bit adaptation of XXH32. Just as simple, and runs well on most + * 64-bit systems (but _not_ 32-bit systems). + * 3. @ref XXH3_family + * - Modern 64-bit and 128-bit hash function family which features improved + * strength and performance across the board, especially on smaller data. + * It benefits greatly from SIMD and 64-bit without requiring it. + * + * Benchmarks + * --- + * The reference system uses an Intel i7-9700K CPU, and runs Ubuntu x64 20.04. + * The open source benchmark program is compiled with clang v10.0 using -O3 flag. + * + * | Hash Name | ISA ext | Width | Large Data Speed | Small Data Velocity | + * | -------------------- | ------- | ----: | ---------------: | ------------------: | + * | XXH3_64bits() | @b AVX2 | 64 | 59.4 GB/s | 133.1 | + * | MeowHash | AES-NI | 128 | 58.2 GB/s | 52.5 | + * | XXH3_128bits() | @b AVX2 | 128 | 57.9 GB/s | 118.1 | + * | CLHash | PCLMUL | 64 | 37.1 GB/s | 58.1 | + * | XXH3_64bits() | @b SSE2 | 64 | 31.5 GB/s | 133.1 | + * | XXH3_128bits() | @b SSE2 | 128 | 29.6 GB/s | 118.1 | + * | RAM sequential read | | N/A | 28.0 GB/s | N/A | + * | ahash | AES-NI | 64 | 22.5 GB/s | 107.2 | + * | City64 | | 64 | 22.0 GB/s | 76.6 | + * | T1ha2 | | 64 | 22.0 GB/s | 99.0 | + * | City128 | | 128 | 21.7 GB/s | 57.7 | + * | FarmHash | AES-NI | 64 | 21.3 GB/s | 71.9 | + * | XXH64() | | 64 | 19.4 GB/s | 71.0 | + * | SpookyHash | | 64 | 19.3 GB/s | 53.2 | + * | Mum | | 64 | 18.0 GB/s | 67.0 | + * | CRC32C | SSE4.2 | 32 | 13.0 GB/s | 57.9 | + * | XXH32() | | 32 | 9.7 GB/s | 71.9 | + * | City32 | | 32 | 9.1 GB/s | 66.0 | + * | Blake3* | @b AVX2 | 256 | 4.4 GB/s | 8.1 | + * | Murmur3 | | 32 | 3.9 GB/s | 56.1 | + * | SipHash* | | 64 | 3.0 GB/s | 43.2 | + * | Blake3* | @b SSE2 | 256 | 2.4 GB/s | 8.1 | + * | HighwayHash | | 64 | 1.4 GB/s | 6.0 | + * | FNV64 | | 64 | 1.2 GB/s | 62.7 | + * | Blake2* | | 256 | 1.1 GB/s | 5.1 | + * | SHA1* | | 160 | 0.8 GB/s | 5.6 | + * | MD5* | | 128 | 0.6 GB/s | 7.8 | + * @note + * - Hashes which require a specific ISA extension are noted. SSE2 is also noted, + * even though it is mandatory on x64. + * - Hashes with an asterisk are cryptographic. Note that MD5 is non-cryptographic + * by modern standards. + * - Small data velocity is a rough average of algorithm's efficiency for small + * data. For more accurate information, see the wiki. + * - More benchmarks and strength tests are found on the wiki: + * https://github.com/Cyan4973/xxHash/wiki + * + * Usage + * ------ + * All xxHash variants use a similar API. Changing the algorithm is a trivial + * substitution. + * + * @pre + * For functions which take an input and length parameter, the following + * requirements are assumed: + * - The range from [`input`, `input + length`) is valid, readable memory. + * - The only exception is if the `length` is `0`, `input` may be `NULL`. + * - For C++, the objects must have the *TriviallyCopyable* property, as the + * functions access bytes directly as if it was an array of `unsigned char`. + * + * @anchor single_shot_example + * **Single Shot** + * + * These functions are stateless functions which hash a contiguous block of memory, + * immediately returning the result. They are the easiest and usually the fastest + * option. + * + * XXH32(), XXH64(), XXH3_64bits(), XXH3_128bits() + * + * @code{.c} + * #include + * #include "xxhash.h" + * + * // Example for a function which hashes a null terminated string with XXH32(). + * XXH32_hash_t hash_string(const char* string, XXH32_hash_t seed) + * { + * // NULL pointers are only valid if the length is zero + * size_t length = (string == NULL) ? 0 : strlen(string); + * return XXH32(string, length, seed); + * } + * @endcode + * + * + * @anchor streaming_example + * **Streaming** + * + * These groups of functions allow incremental hashing of unknown size, even + * more than what would fit in a size_t. + * + * XXH32_reset(), XXH64_reset(), XXH3_64bits_reset(), XXH3_128bits_reset() + * + * @code{.c} + * #include + * #include + * #include "xxhash.h" + * // Example for a function which hashes a FILE incrementally with XXH3_64bits(). + * XXH64_hash_t hashFile(FILE* f) + * { + * // Allocate a state struct. Do not just use malloc() or new. + * XXH3_state_t* state = XXH3_createState(); + * assert(state != NULL && "Out of memory!"); + * // Reset the state to start a new hashing session. + * XXH3_64bits_reset(state); + * char buffer[4096]; + * size_t count; + * // Read the file in chunks + * while ((count = fread(buffer, 1, sizeof(buffer), f)) != 0) { + * // Run update() as many times as necessary to process the data + * XXH3_64bits_update(state, buffer, count); + * } + * // Retrieve the finalized hash. This will not change the state. + * XXH64_hash_t result = XXH3_64bits_digest(state); + * // Free the state. Do not use free(). + * XXH3_freeState(state); + * return result; + * } + * @endcode + * + * Streaming functions generate the xxHash value from an incremental input. + * This method is slower than single-call functions, due to state management. + * For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized. + * + * An XXH state must first be allocated using `XXH*_createState()`. + * + * Start a new hash by initializing the state with a seed using `XXH*_reset()`. + * + * Then, feed the hash state by calling `XXH*_update()` as many times as necessary. + * + * The function returns an error code, with 0 meaning OK, and any other value + * meaning there is an error. + * + * Finally, a hash value can be produced anytime, by using `XXH*_digest()`. + * This function returns the nn-bits hash as an int or long long. + * + * It's still possible to continue inserting input into the hash state after a + * digest, and generate new hash values later on by invoking `XXH*_digest()`. + * + * When done, release the state using `XXH*_freeState()`. + * + * + * @anchor canonical_representation_example + * **Canonical Representation** + * + * The default return values from XXH functions are unsigned 32, 64 and 128 bit + * integers. + * This the simplest and fastest format for further post-processing. + * + * However, this leaves open the question of what is the order on the byte level, + * since little and big endian conventions will store the same number differently. + * + * The canonical representation settles this issue by mandating big-endian + * convention, the same convention as human-readable numbers (large digits first). + * + * When writing hash values to storage, sending them over a network, or printing + * them, it's highly recommended to use the canonical representation to ensure + * portability across a wider range of systems, present and future. + * + * The following functions allow transformation of hash values to and from + * canonical format. + * + * XXH32_canonicalFromHash(), XXH32_hashFromCanonical(), + * XXH64_canonicalFromHash(), XXH64_hashFromCanonical(), + * XXH128_canonicalFromHash(), XXH128_hashFromCanonical(), + * + * @code{.c} + * #include + * #include "xxhash.h" + * + * // Example for a function which prints XXH32_hash_t in human readable format + * void printXxh32(XXH32_hash_t hash) + * { + * XXH32_canonical_t cano; + * XXH32_canonicalFromHash(&cano, hash); + * size_t i; + * for(i = 0; i < sizeof(cano.digest); ++i) { + * printf("%02x", cano.digest[i]); + * } + * printf("\n"); + * } + * + * // Example for a function which converts XXH32_canonical_t to XXH32_hash_t + * XXH32_hash_t convertCanonicalToXxh32(XXH32_canonical_t cano) + * { + * XXH32_hash_t hash = XXH32_hashFromCanonical(&cano); + * return hash; + * } + * @endcode + * + * * @file xxhash.h * xxHash prototypes and implementation */ -/* TODO: update */ -/* Notice extracted from xxHash homepage: - -xxHash is an extremely fast hash algorithm, running at RAM speed limits. -It also successfully passes all tests from the SMHasher suite. - -Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) - -Name Speed Q.Score Author -xxHash 5.4 GB/s 10 -CrapWow 3.2 GB/s 2 Andrew -MurmurHash 3a 2.7 GB/s 10 Austin Appleby -SpookyHash 2.0 GB/s 10 Bob Jenkins -SBox 1.4 GB/s 9 Bret Mulvey -Lookup3 1.2 GB/s 9 Bob Jenkins -SuperFastHash 1.2 GB/s 1 Paul Hsieh -CityHash64 1.05 GB/s 10 Pike & Alakuijala -FNV 0.55 GB/s 5 Fowler, Noll, Vo -CRC32 0.43 GB/s 9 -MD5-32 0.33 GB/s 10 Ronald L. Rivest -SHA1-32 0.28 GB/s 10 - -Q.Score is a measure of quality of the hash function. -It depends on successfully passing SMHasher test set. -10 is a perfect score. - -Note: SMHasher's CRC32 implementation is not the fastest one. -Other speed-oriented implementations can be faster, -especially in combination with PCLMUL instruction: -https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html?showComment=1552696407071#c3490092340461170735 - -A 64-bit version, named XXH64, is available since r35. -It offers much better speed, but for 64-bit applications only. -Name Speed on 64 bits Speed on 32 bits -XXH64 13.8 GB/s 1.9 GB/s -XXH32 6.8 GB/s 6.0 GB/s -*/ - -#if defined (__cplusplus) + +#if defined(__cplusplus) && !defined(XXH_NO_EXTERNC_GUARD) extern "C" { #endif @@ -84,21 +249,80 @@ extern "C" { * INLINE mode ******************************/ /*! - * XXH_INLINE_ALL (and XXH_PRIVATE_API) + * @defgroup public Public API + * Contains details on the public xxHash functions. + * @{ + */ +#ifdef XXH_DOXYGEN +/*! + * @brief Gives access to internal state declaration, required for static allocation. + * + * Incompatible with dynamic linking, due to risks of ABI changes. + * + * Usage: + * @code{.c} + * #define XXH_STATIC_LINKING_ONLY + * #include "xxhash.h" + * @endcode + */ +# define XXH_STATIC_LINKING_ONLY +/* Do not undef XXH_STATIC_LINKING_ONLY for Doxygen */ + +/*! + * @brief Gives access to internal definitions. + * + * Usage: + * @code{.c} + * #define XXH_STATIC_LINKING_ONLY + * #define XXH_IMPLEMENTATION + * #include "xxhash.h" + * @endcode + */ +# define XXH_IMPLEMENTATION +/* Do not undef XXH_IMPLEMENTATION for Doxygen */ + +/*! + * @brief Exposes the implementation and marks all functions as `inline`. + * * Use these build macros to inline xxhash into the target unit. * Inlining improves performance on small inputs, especially when the length is * expressed as a compile-time constant: * - * https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html + * https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html * * It also keeps xxHash symbols private to the unit, so they are not exported. * * Usage: + * @code{.c} * #define XXH_INLINE_ALL * #include "xxhash.h" - * + * @endcode * Do not compile and link xxhash.o as a separate object, as it is not useful. */ +# define XXH_INLINE_ALL +# undef XXH_INLINE_ALL +/*! + * @brief Exposes the implementation without marking functions as inline. + */ +# define XXH_PRIVATE_API +# undef XXH_PRIVATE_API +/*! + * @brief Emulate a namespace by transparently prefixing all symbols. + * + * If you want to include _and expose_ xxHash functions from within your own + * library, but also want to avoid symbol collisions with other libraries which + * may also include xxHash, you can use @ref XXH_NAMESPACE to automatically prefix + * any public symbol from xxhash library with the value of @ref XXH_NAMESPACE + * (therefore, avoid empty or numeric values). + * + * Note that no change is required within the calling program as long as it + * includes `xxhash.h`: Regular symbol names will be automatically translated + * by this header. + */ +# define XXH_NAMESPACE /* YOUR NAME HERE */ +# undef XXH_NAMESPACE +#endif + #if (defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)) \ && !defined(XXH_INLINE_ALL_31684351384) /* this section should be traversed only once */ @@ -109,7 +333,7 @@ extern "C" { /* make all functions private */ # undef XXH_PUBLIC_API # if defined(__GNUC__) -# define XXH_PUBLIC_API static __inline __attribute__((unused)) +# define XXH_PUBLIC_API static __inline __attribute__((__unused__)) # elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) # define XXH_PUBLIC_API static inline # elif defined(_MSC_VER) @@ -213,23 +437,15 @@ extern "C" { # undef XXHASH_H_STATIC_13879238742 #endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */ - - /* **************************************************************** * Stable API *****************************************************************/ #ifndef XXHASH_H_5627135585666179 #define XXHASH_H_5627135585666179 1 - -/*! - * @defgroup public Public API - * Contains details on the public xxHash functions. - * @{ - */ -/* specific declaration modes for Windows */ +/*! @brief Marks a global symbol. */ #if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) -# if defined(WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) +# if defined(_WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) # ifdef XXH_EXPORT # define XXH_PUBLIC_API __declspec(dllexport) # elif XXH_IMPORT @@ -240,24 +456,6 @@ extern "C" { # endif #endif -#ifdef XXH_DOXYGEN -/*! - * @brief Emulate a namespace by transparently prefixing all symbols. - * - * If you want to include _and expose_ xxHash functions from within your own - * library, but also want to avoid symbol collisions with other libraries which - * may also include xxHash, you can use XXH_NAMESPACE to automatically prefix - * any public symbol from xxhash library with the value of XXH_NAMESPACE - * (therefore, avoid empty or numeric values). - * - * Note that no change is required within the calling program as long as it - * includes `xxhash.h`: Regular symbol names will be automatically translated - * by this header. - */ -# define XXH_NAMESPACE /* YOUR NAME HERE */ -# undef XXH_NAMESPACE -#endif - #ifdef XXH_NAMESPACE # define XXH_CAT(A,B) A##B # define XXH_NAME2(A,B) XXH_CAT(A,B) @@ -317,12 +515,40 @@ extern "C" { #endif +/* ************************************* +* Compiler specifics +***************************************/ + +/* specific declaration modes for Windows */ +#if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) +# if defined(_WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) +# ifdef XXH_EXPORT +# define XXH_PUBLIC_API __declspec(dllexport) +# elif XXH_IMPORT +# define XXH_PUBLIC_API __declspec(dllimport) +# endif +# else +# define XXH_PUBLIC_API /* do nothing */ +# endif +#endif + +#if defined (__GNUC__) +# define XXH_CONSTF __attribute__((__const__)) +# define XXH_PUREF __attribute__((__pure__)) +# define XXH_MALLOCF __attribute__((__malloc__)) +#else +# define XXH_CONSTF /* disable */ +# define XXH_PUREF +# define XXH_MALLOCF +#endif + /* ************************************* * Version ***************************************/ #define XXH_VERSION_MAJOR 0 #define XXH_VERSION_MINOR 8 -#define XXH_VERSION_RELEASE 1 +#define XXH_VERSION_RELEASE 3 +/*! @brief Version number, encoded as two digits each */ #define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) /*! @@ -331,16 +557,22 @@ extern "C" { * This is mostly useful when xxHash is compiled as a shared library, * since the returned value comes from the library, as opposed to header file. * - * @return `XXH_VERSION_NUMBER` of the invoked library. + * @return @ref XXH_VERSION_NUMBER of the invoked library. */ -XXH_PUBLIC_API unsigned XXH_versionNumber (void); +XXH_PUBLIC_API XXH_CONSTF unsigned XXH_versionNumber (void); /* **************************** * Common basic types ******************************/ #include /* size_t */ -typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; +/*! + * @brief Exit code for the streaming API. + */ +typedef enum { + XXH_OK = 0, /*!< OK */ + XXH_ERROR /*!< Error */ +} XXH_errorcode; /*-********************************************************************** @@ -357,44 +589,44 @@ typedef uint32_t XXH32_hash_t; #elif !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include +# ifdef _AIX +# include +# else +# include +# endif typedef uint32_t XXH32_hash_t; #else # include # if UINT_MAX == 0xFFFFFFFFUL typedef unsigned int XXH32_hash_t; +# elif ULONG_MAX == 0xFFFFFFFFUL + typedef unsigned long XXH32_hash_t; # else -# if ULONG_MAX == 0xFFFFFFFFUL - typedef unsigned long XXH32_hash_t; -# else -# error "unsupported platform: need a 32-bit type" -# endif +# error "unsupported platform: need a 32-bit type" # endif #endif /*! * @} * - * @defgroup xxh32_family XXH32 family + * @defgroup XXH32_family XXH32 family * @ingroup public * Contains functions used in the classic 32-bit xxHash algorithm. * * @note * XXH32 is useful for older platforms, with no or poor 64-bit performance. - * Note that @ref xxh3_family provides competitive speed - * for both 32-bit and 64-bit systems, and offers true 64/128 bit hash results. + * Note that the @ref XXH3_family provides competitive speed for both 32-bit + * and 64-bit systems, and offers true 64/128 bit hash results. * - * @see @ref xxh64_family, @ref xxh3_family : Other xxHash families - * @see @ref xxh32_impl for implementation details + * @see @ref XXH64_family, @ref XXH3_family : Other xxHash families + * @see @ref XXH32_impl for implementation details * @{ */ /*! * @brief Calculates the 32-bit hash of @p input using xxHash32. * - * Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark): 5.4 GB/s - * * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * @param seed The 32-bit seed to alter the hash's output predictably. @@ -404,87 +636,44 @@ typedef uint32_t XXH32_hash_t; * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * - * @return The calculated 32-bit hash value. - * - * @see - * XXH64(), XXH3_64bits_withSeed(), XXH3_128bits_withSeed(), XXH128(): - * Direct equivalents for the other variants of xxHash. - * @see - * XXH32_createState(), XXH32_update(), XXH32_digest(): Streaming version. - */ -XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed); - -/*! - * Streaming functions generate the xxHash value from an incremental input. - * This method is slower than single-call functions, due to state management. - * For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized. - * - * An XXH state must first be allocated using `XXH*_createState()`. - * - * Start a new hash by initializing the state with a seed using `XXH*_reset()`. - * - * Then, feed the hash state by calling `XXH*_update()` as many times as necessary. - * - * The function returns an error code, with 0 meaning OK, and any other value - * meaning there is an error. - * - * Finally, a hash value can be produced anytime, by using `XXH*_digest()`. - * This function returns the nn-bits hash as an int or long long. - * - * It's still possible to continue inserting input into the hash state after a - * digest, and generate new hash values later on by invoking `XXH*_digest()`. - * - * When done, release the state using `XXH*_freeState()`. - * - * Example code for incrementally hashing a file: - * @code{.c} - * #include - * #include - * #define BUFFER_SIZE 256 + * @return The calculated 32-bit xxHash32 value. * - * // Note: XXH64 and XXH3 use the same interface. - * XXH32_hash_t - * hashFile(FILE* stream) - * { - * XXH32_state_t* state; - * unsigned char buf[BUFFER_SIZE]; - * size_t amt; - * XXH32_hash_t hash; - * - * state = XXH32_createState(); // Create a state - * assert(state != NULL); // Error check here - * XXH32_reset(state, 0xbaad5eed); // Reset state with our seed - * while ((amt = fread(buf, 1, sizeof(buf), stream)) != 0) { - * XXH32_update(state, buf, amt); // Hash the file in chunks - * } - * hash = XXH32_digest(state); // Finalize the hash - * XXH32_freeState(state); // Clean up - * return hash; - * } - * @endcode + * @see @ref single_shot_example "Single Shot Example" for an example. */ +XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed); +#ifndef XXH_NO_STREAM /*! * @typedef struct XXH32_state_s XXH32_state_t * @brief The opaque state struct for the XXH32 streaming API. * * @see XXH32_state_s for details. + * @see @ref streaming_example "Streaming Example" */ typedef struct XXH32_state_s XXH32_state_t; /*! * @brief Allocates an @ref XXH32_state_t. * - * Must be freed with XXH32_freeState(). - * @return An allocated XXH32_state_t on success, `NULL` on failure. + * @return An allocated pointer of @ref XXH32_state_t on success. + * @return `NULL` on failure. + * + * @note Must be freed with XXH32_freeState(). + * + * @see @ref streaming_example "Streaming Example" */ -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); +XXH_PUBLIC_API XXH_MALLOCF XXH32_state_t* XXH32_createState(void); /*! * @brief Frees an @ref XXH32_state_t. * - * Must be allocated with XXH32_createState(). * @param statePtr A pointer to an @ref XXH32_state_t allocated with @ref XXH32_createState(). - * @return XXH_OK. + * + * @return @ref XXH_OK. + * + * @note @p statePtr must be allocated with XXH32_createState(). + * + * @see @ref streaming_example "Streaming Example" + * */ XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); /*! @@ -500,23 +689,24 @@ XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_ /*! * @brief Resets an @ref XXH32_state_t to begin a new hash. * - * This function resets and seeds a state. Call it before @ref XXH32_update(). - * * @param statePtr The state struct to reset. * @param seed The 32-bit seed to alter the hash result predictably. * * @pre * @p statePtr must not be `NULL`. * - * @return @ref XXH_OK on success, @ref XXH_ERROR on failure. + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note This function resets and seeds a state. Call it before @ref XXH32_update(). + * + * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t seed); /*! * @brief Consumes a block of @p input to an @ref XXH32_state_t. * - * Call this to incrementally consume blocks of data. - * * @param statePtr The state struct to update. * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. @@ -528,46 +718,35 @@ XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * - * @return @ref XXH_OK on success, @ref XXH_ERROR on failure. + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note Call this to incrementally consume blocks of data. + * + * @see @ref streaming_example "Streaming Example" */ XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); /*! * @brief Returns the calculated hash value from an @ref XXH32_state_t. * - * @note - * Calling XXH32_digest() will not affect @p statePtr, so you can update, - * digest, and update again. - * * @param statePtr The state struct to calculate the hash from. * * @pre * @p statePtr must not be `NULL`. * - * @return The calculated xxHash32 value from that state. - */ -XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); - -/******* Canonical representation *******/ - -/* - * The default return values from XXH functions are unsigned 32 and 64 bit - * integers. - * This the simplest and fastest format for further post-processing. - * - * However, this leaves open the question of what is the order on the byte level, - * since little and big endian conventions will store the same number differently. - * - * The canonical representation settles this issue by mandating big-endian - * convention, the same convention as human-readable numbers (large digits first). + * @return The calculated 32-bit xxHash32 value from that state. * - * When writing hash values to storage, sending them over a network, or printing - * them, it's highly recommended to use the canonical representation to ensure - * portability across a wider range of systems, present and future. + * @note + * Calling XXH32_digest() will not affect @p statePtr, so you can update, + * digest, and update again. * - * The following functions allow transformation of hash values to and from - * canonical format. + * @see @ref streaming_example "Streaming Example" */ +XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); +#endif /* !XXH_NO_STREAM */ + +/******* Canonical representation *******/ /*! * @brief Canonical (big endian) representation of @ref XXH32_hash_t. @@ -579,11 +758,13 @@ typedef struct { /*! * @brief Converts an @ref XXH32_hash_t to a big endian @ref XXH32_canonical_t. * - * @param dst The @ref XXH32_canonical_t pointer to be stored to. + * @param dst The @ref XXH32_canonical_t pointer to be stored to. * @param hash The @ref XXH32_hash_t to be converted. * * @pre * @p dst must not be `NULL`. + * + * @see @ref canonical_representation_example "Canonical Representation Example" */ XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); @@ -596,44 +777,75 @@ XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t * @p src must not be `NULL`. * * @return The converted hash. + * + * @see @ref canonical_representation_example "Canonical Representation Example" */ -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); +XXH_PUBLIC_API XXH_PUREF XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); +/*! @cond Doxygen ignores this part */ #ifdef __has_attribute # define XXH_HAS_ATTRIBUTE(x) __has_attribute(x) #else # define XXH_HAS_ATTRIBUTE(x) 0 #endif +/*! @endcond */ + +/*! @cond Doxygen ignores this part */ +/* + * C23 __STDC_VERSION__ number hasn't been specified yet. For now + * leave as `201711L` (C17 + 1). + * TODO: Update to correct value when its been specified. + */ +#define XXH_C23_VN 201711L +/*! @endcond */ +/*! @cond Doxygen ignores this part */ /* C-language Attributes are added in C23. */ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201710L) && defined(__has_c_attribute) +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= XXH_C23_VN) && defined(__has_c_attribute) # define XXH_HAS_C_ATTRIBUTE(x) __has_c_attribute(x) #else # define XXH_HAS_C_ATTRIBUTE(x) 0 #endif +/*! @endcond */ +/*! @cond Doxygen ignores this part */ #if defined(__cplusplus) && defined(__has_cpp_attribute) # define XXH_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) #else # define XXH_HAS_CPP_ATTRIBUTE(x) 0 #endif +/*! @endcond */ +/*! @cond Doxygen ignores this part */ /* -Define XXH_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute -introduced in CPP17 and C23. -CPP17 : https://en.cppreference.com/w/cpp/language/attributes/fallthrough -C23 : https://en.cppreference.com/w/c/language/attributes/fallthrough -*/ -#if XXH_HAS_C_ATTRIBUTE(x) -# define XXH_FALLTHROUGH [[fallthrough]] -#elif XXH_HAS_CPP_ATTRIBUTE(x) + * Define XXH_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute + * introduced in CPP17 and C23. + * CPP17 : https://en.cppreference.com/w/cpp/language/attributes/fallthrough + * C23 : https://en.cppreference.com/w/c/language/attributes/fallthrough + */ +#if XXH_HAS_C_ATTRIBUTE(fallthrough) || XXH_HAS_CPP_ATTRIBUTE(fallthrough) # define XXH_FALLTHROUGH [[fallthrough]] #elif XXH_HAS_ATTRIBUTE(__fallthrough__) -# define XXH_FALLTHROUGH __attribute__ ((fallthrough)) +# define XXH_FALLTHROUGH __attribute__ ((__fallthrough__)) +#else +# define XXH_FALLTHROUGH /* fallthrough */ +#endif +/*! @endcond */ + +/*! @cond Doxygen ignores this part */ +/* + * Define XXH_NOESCAPE for annotated pointers in public API. + * https://clang.llvm.org/docs/AttributeReference.html#noescape + * As of writing this, only supported by clang. + */ +#if XXH_HAS_ATTRIBUTE(noescape) +# define XXH_NOESCAPE __attribute__((__noescape__)) #else -# define XXH_FALLTHROUGH +# define XXH_NOESCAPE #endif +/*! @endcond */ + /*! * @} @@ -655,7 +867,11 @@ typedef uint64_t XXH64_hash_t; #elif !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include +# ifdef _AIX +# include +# else +# include +# endif typedef uint64_t XXH64_hash_t; #else # include @@ -671,7 +887,7 @@ typedef uint64_t XXH64_hash_t; /*! * @} * - * @defgroup xxh64_family XXH64 family + * @defgroup XXH64_family XXH64 family * @ingroup public * @{ * Contains functions used in the classic 64-bit xxHash algorithm. @@ -682,13 +898,9 @@ typedef uint64_t XXH64_hash_t; * It provides better speed for systems with vector processing capabilities. */ - /*! * @brief Calculates the 64-bit hash of @p input using xxHash64. * - * This function usually runs faster on 64-bit systems, but slower on 32-bit - * systems (see benchmark). - * * @param input The block of data to be hashed, at least @p length bytes in size. * @param length The length of @p input, in bytes. * @param seed The 64-bit seed to alter the hash's output predictably. @@ -698,40 +910,156 @@ typedef uint64_t XXH64_hash_t; * readable, contiguous memory. However, if @p length is `0`, @p input may be * `NULL`. In C++, this also must be *TriviallyCopyable*. * - * @return The calculated 64-bit hash. + * @return The calculated 64-bit xxHash64 value. * - * @see - * XXH32(), XXH3_64bits_withSeed(), XXH3_128bits_withSeed(), XXH128(): - * Direct equivalents for the other variants of xxHash. - * @see - * XXH64_createState(), XXH64_update(), XXH64_digest(): Streaming version. + * @see @ref single_shot_example "Single Shot Example" for an example. */ -XXH_PUBLIC_API XXH64_hash_t XXH64(const void* input, size_t length, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64(XXH_NOESCAPE const void* input, size_t length, XXH64_hash_t seed); /******* Streaming *******/ +#ifndef XXH_NO_STREAM /*! * @brief The opaque state struct for the XXH64 streaming API. * * @see XXH64_state_s for details. + * @see @ref streaming_example "Streaming Example" */ typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dst_state, const XXH64_state_t* src_state); - -XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, XXH64_hash_t seed); -XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); - -/******* Canonical representation *******/ -typedef struct { unsigned char digest[sizeof(XXH64_hash_t)]; } XXH64_canonical_t; -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); /*! - * @} + * @brief Allocates an @ref XXH64_state_t. + * + * @return An allocated pointer of @ref XXH64_state_t on success. + * @return `NULL` on failure. + * + * @note Must be freed with XXH64_freeState(). + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_MALLOCF XXH64_state_t* XXH64_createState(void); + +/*! + * @brief Frees an @ref XXH64_state_t. + * + * @param statePtr A pointer to an @ref XXH64_state_t allocated with @ref XXH64_createState(). + * + * @return @ref XXH_OK. + * + * @note @p statePtr must be allocated with XXH64_createState(). + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); + +/*! + * @brief Copies one @ref XXH64_state_t to another. + * + * @param dst_state The state to copy to. + * @param src_state The state to copy from. + * @pre + * @p dst_state and @p src_state must not be `NULL` and must not overlap. + */ +XXH_PUBLIC_API void XXH64_copyState(XXH_NOESCAPE XXH64_state_t* dst_state, const XXH64_state_t* src_state); + +/*! + * @brief Resets an @ref XXH64_state_t to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note This function resets and seeds a state. Call it before @ref XXH64_update(). + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH_NOESCAPE XXH64_state_t* statePtr, XXH64_hash_t seed); + +/*! + * @brief Consumes a block of @p input to an @ref XXH64_state_t. + * + * @param statePtr The state struct to update. + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note Call this to incrementally consume blocks of data. + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH_NOESCAPE XXH64_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length); + +/*! + * @brief Returns the calculated hash value from an @ref XXH64_state_t. + * + * @param statePtr The state struct to calculate the hash from. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return The calculated 64-bit xxHash64 value from that state. + * + * @note + * Calling XXH64_digest() will not affect @p statePtr, so you can update, + * digest, and update again. + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64_digest (XXH_NOESCAPE const XXH64_state_t* statePtr); +#endif /* !XXH_NO_STREAM */ +/******* Canonical representation *******/ + +/*! + * @brief Canonical (big endian) representation of @ref XXH64_hash_t. + */ +typedef struct { unsigned char digest[sizeof(XXH64_hash_t)]; } XXH64_canonical_t; + +/*! + * @brief Converts an @ref XXH64_hash_t to a big endian @ref XXH64_canonical_t. + * + * @param dst The @ref XXH64_canonical_t pointer to be stored to. + * @param hash The @ref XXH64_hash_t to be converted. + * + * @pre + * @p dst must not be `NULL`. + * + * @see @ref canonical_representation_example "Canonical Representation Example" + */ +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH_NOESCAPE XXH64_canonical_t* dst, XXH64_hash_t hash); + +/*! + * @brief Converts an @ref XXH64_canonical_t to a native @ref XXH64_hash_t. + * + * @param src The @ref XXH64_canonical_t to convert. + * + * @pre + * @p src must not be `NULL`. + * + * @return The converted hash. + * + * @see @ref canonical_representation_example "Canonical Representation Example" + */ +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH64_hashFromCanonical(XXH_NOESCAPE const XXH64_canonical_t* src); + +#ifndef XXH_NO_XXH3 + +/*! + * @} * ************************************************************************ - * @defgroup xxh3_family XXH3 family + * @defgroup XXH3_family XXH3 family * @ingroup public * @{ * @@ -751,16 +1079,26 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src * * XXH3's speed benefits greatly from SIMD and 64-bit arithmetic, * but does not require it. - * Any 32-bit and 64-bit targets that can run XXH32 smoothly - * can run XXH3 at competitive speeds, even without vector support. - * Further details are explained in the implementation. - * - * Optimized implementations are provided for AVX512, AVX2, SSE2, NEON, POWER8, - * ZVector and scalar targets. This can be controlled via the XXH_VECTOR macro. + * Most 32-bit and 64-bit targets that can run XXH32 smoothly can run XXH3 + * at competitive speeds, even without vector support. Further details are + * explained in the implementation. + * + * XXH3 has a fast scalar implementation, but it also includes accelerated SIMD + * implementations for many common platforms: + * - AVX512 + * - AVX2 + * - SSE2 + * - ARM NEON + * - WebAssembly SIMD128 + * - POWER8 VSX + * - s390x ZVector + * This can be controlled via the @ref XXH_VECTOR macro, but it automatically + * selects the best version according to predefined macros. For the x86 family, an + * automatic runtime dispatcher is included separately in @ref xxh_x86dispatch.c. * * XXH3 implementation is portable: * it has a generic C90 formulation that can be compiled on any platform, - * all implementations generage exactly the same hash value on all platforms. + * all implementations generate exactly the same hash value on all platforms. * Starting from v0.8.0, it's also labelled "stable", meaning that * any future version will also generate the same hash value. * @@ -773,23 +1111,76 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src * The API supports one-shot hashing, streaming mode, and custom secrets. */ +/*! + * @ingroup tuning + * @brief Possible values for @ref XXH_VECTOR. + * + * Unless set explicitly, determined automatically. + */ +# define XXH_SCALAR 0 /*!< Portable scalar version */ +# define XXH_SSE2 1 /*!< SSE2 for Pentium 4, Opteron, all x86_64. */ +# define XXH_AVX2 2 /*!< AVX2 for Haswell and Bulldozer */ +# define XXH_AVX512 3 /*!< AVX512 for Skylake and Icelake */ +# define XXH_NEON 4 /*!< NEON for most ARMv7-A, all AArch64, and WASM SIMD128 */ +# define XXH_VSX 5 /*!< VSX and ZVector for POWER8/z13 (64-bit) */ +# define XXH_SVE 6 /*!< SVE for some ARMv8-A and ARMv9-A */ +# define XXH_LSX 7 /*!< LSX (128-bit SIMD) for LoongArch64 */ +# define XXH_LASX 8 /*!< LASX (256-bit SIMD) for LoongArch64 */ + + /*-********************************************************************** * XXH3 64-bit variant ************************************************************************/ -/* XXH3_64bits(): - * default 64-bit variant, using default secret and default seed of 0. - * It's the fastest variant. */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* data, size_t len); +/*! + * @brief Calculates 64-bit unseeded variant of XXH3 hash of @p input. + * + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return The calculated 64-bit XXH3 hash value. + * + * @note + * This is equivalent to @ref XXH3_64bits_withSeed() with a seed of `0`, however + * it may have slightly better performance due to constant propagation of the + * defaults. + * + * @see + * XXH3_64bits_withSeed(), XXH3_64bits_withSecret(): other seeding variants + * @see @ref single_shot_example "Single Shot Example" for an example. + */ +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits(XXH_NOESCAPE const void* input, size_t length); -/* - * XXH3_64bits_withSeed(): - * This variant generates a custom secret on the fly - * based on default secret altered using the `seed` value. +/*! + * @brief Calculates 64-bit seeded variant of XXH3 hash of @p input. + * + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return The calculated 64-bit XXH3 hash value. + * + * @note + * seed == 0 produces the same results as @ref XXH3_64bits(). + * + * This variant generates a custom secret on the fly based on default secret + * altered using the @p seed value. + * * While this operation is decently fast, note that it's not completely free. - * Note: seed==0 produces the same results as XXH3_64bits(). + * + * @see @ref single_shot_example "Single Shot Example" for an example. */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_withSeed(XXH_NOESCAPE const void* input, size_t length, XXH64_hash_t seed); /*! * The bare minimum size for a custom secret. @@ -800,27 +1191,43 @@ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(const void* data, size_t len, X */ #define XXH3_SECRET_SIZE_MIN 136 -/* - * XXH3_64bits_withSecret(): +/*! + * @brief Calculates 64-bit variant of XXH3 with a custom "secret". + * + * @param data The block of data to be hashed, at least @p len bytes in size. + * @param len The length of @p data, in bytes. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * + * @return The calculated 64-bit XXH3 hash value. + * + * @pre + * The memory between @p data and @p data + @p len must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p data may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * * It's possible to provide any blob of bytes as a "secret" to generate the hash. * This makes it more difficult for an external actor to prepare an intentional collision. - * The main condition is that secretSize *must* be large enough (>= XXH3_SECRET_SIZE_MIN). + * The main condition is that @p secretSize *must* be large enough (>= @ref XXH3_SECRET_SIZE_MIN). * However, the quality of the secret impacts the dispersion of the hash algorithm. * Therefore, the secret _must_ look like a bunch of random bytes. * Avoid "trivial" or structured data such as repeated sequences or a text document. * Whenever in doubt about the "randomness" of the blob of bytes, - * consider employing "XXH3_generateSecret()" instead (see below). + * consider employing @ref XXH3_generateSecret() instead (see below). * It will generate a proper high entropy secret derived from the blob of bytes. * Another advantage of using XXH3_generateSecret() is that * it guarantees that all bits within the initial blob of bytes * will impact every bit of the output. * This is not necessarily the case when using the blob of bytes directly * because, when hashing _small_ inputs, only a portion of the secret is employed. + * + * @see @ref single_shot_example "Single Shot Example" for an example. */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_withSecret(XXH_NOESCAPE const void* data, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize); /******* Streaming *******/ +#ifndef XXH_NO_STREAM /* * Streaming requires state maintenance. * This operation costs memory and CPU. @@ -829,40 +1236,135 @@ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(const void* data, size_t len, */ /*! - * @brief The state struct for the XXH3 streaming API. + * @brief The opaque state struct for the XXH3 streaming API. * * @see XXH3_state_s for details. + * @see @ref streaming_example "Streaming Example" */ typedef struct XXH3_state_s XXH3_state_t; -XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void); +XXH_PUBLIC_API XXH_MALLOCF XXH3_state_t* XXH3_createState(void); XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr); -XXH_PUBLIC_API void XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state); -/* - * XXH3_64bits_reset(): - * Initialize with default parameters. - * digest will be equivalent to `XXH3_64bits()`. +/*! + * @brief Copies one @ref XXH3_state_t to another. + * + * @param dst_state The state to copy to. + * @param src_state The state to copy from. + * @pre + * @p dst_state and @p src_state must not be `NULL` and must not overlap. */ -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH3_state_t* statePtr); -/* - * XXH3_64bits_reset_withSeed(): - * Generate a custom secret from `seed`, and store it into `statePtr`. - * digest will be equivalent to `XXH3_64bits_withSeed()`. +XXH_PUBLIC_API void XXH3_copyState(XXH_NOESCAPE XXH3_state_t* dst_state, XXH_NOESCAPE const XXH3_state_t* src_state); + +/*! + * @brief Resets an @ref XXH3_state_t to begin a new hash. + * + * @param statePtr The state struct to reset. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * - This function resets `statePtr` and generate a secret with default parameters. + * - Call this function before @ref XXH3_64bits_update(). + * - Digest will be equivalent to `XXH3_64bits()`. + * + * @see @ref streaming_example "Streaming Example" + * */ -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); -/* - * XXH3_64bits_reset_withSecret(): - * `secret` is referenced, it _must outlive_ the hash streaming session. - * Similar to one-shot API, `secretSize` must be >= `XXH3_SECRET_SIZE_MIN`, +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr); + +/*! + * @brief Resets an @ref XXH3_state_t with 64-bit seed to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * - This function resets `statePtr` and generate a secret from `seed`. + * - Call this function before @ref XXH3_64bits_update(). + * - Digest will be equivalent to `XXH3_64bits_withSeed()`. + * + * @see @ref streaming_example "Streaming Example" + * + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed); + +/*! + * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * `secret` is referenced, it _must outlive_ the hash streaming session. + * + * Similar to one-shot API, `secretSize` must be >= @ref XXH3_SECRET_SIZE_MIN, * and the quality of produced hash values depends on secret's entropy * (secret's content should look like a bunch of random bytes). * When in doubt about the randomness of a candidate `secret`, * consider employing `XXH3_generateSecret()` instead (see below). + * + * @see @ref streaming_example "Streaming Example" */ -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize); -XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH3_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* statePtr); +/*! + * @brief Consumes a block of @p input to an @ref XXH3_state_t. + * + * @param statePtr The state struct to update. + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note Call this to incrementally consume blocks of data. + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length); + +/*! + * @brief Returns the calculated XXH3 64-bit hash value from an @ref XXH3_state_t. + * + * @param statePtr The state struct to calculate the hash from. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return The calculated XXH3 64-bit hash value from that state. + * + * @note + * Calling XXH3_64bits_digest() will not affect @p statePtr, so you can update, + * digest, and update again. + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t XXH3_64bits_digest (XXH_NOESCAPE const XXH3_state_t* statePtr); +#endif /* !XXH_NO_STREAM */ /* note : canonical representation of XXH3 is the same as XXH64 * since they both produce XXH64_hash_t values */ @@ -883,11 +1385,76 @@ typedef struct { XXH64_hash_t high64; /*!< `value >> 64` */ } XXH128_hash_t; -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* data, size_t len); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); +/*! + * @brief Calculates 128-bit unseeded variant of XXH3 of @p data. + * + * @param data The block of data to be hashed, at least @p length bytes in size. + * @param len The length of @p data, in bytes. + * + * @return The calculated 128-bit variant of XXH3 value. + * + * The 128-bit variant of XXH3 has more strength, but it has a bit of overhead + * for shorter inputs. + * + * This is equivalent to @ref XXH3_128bits_withSeed() with a seed of `0`, however + * it may have slightly better performance due to constant propagation of the + * defaults. + * + * @see XXH3_128bits_withSeed(), XXH3_128bits_withSecret(): other seeding variants + * @see @ref single_shot_example "Single Shot Example" for an example. + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits(XXH_NOESCAPE const void* data, size_t len); +/*! @brief Calculates 128-bit seeded variant of XXH3 hash of @p data. + * + * @param data The block of data to be hashed, at least @p length bytes in size. + * @param len The length of @p data, in bytes. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @return The calculated 128-bit variant of XXH3 value. + * + * @note + * seed == 0 produces the same results as @ref XXH3_64bits(). + * + * This variant generates a custom secret on the fly based on default secret + * altered using the @p seed value. + * + * While this operation is decently fast, note that it's not completely free. + * + * @see XXH3_128bits(), XXH3_128bits_withSecret(): other seeding variants + * @see @ref single_shot_example "Single Shot Example" for an example. + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_withSeed(XXH_NOESCAPE const void* data, size_t len, XXH64_hash_t seed); +/*! + * @brief Calculates 128-bit variant of XXH3 with a custom "secret". + * + * @param data The block of data to be hashed, at least @p len bytes in size. + * @param len The length of @p data, in bytes. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * + * @return The calculated 128-bit variant of XXH3 value. + * + * It's possible to provide any blob of bytes as a "secret" to generate the hash. + * This makes it more difficult for an external actor to prepare an intentional collision. + * The main condition is that @p secretSize *must* be large enough (>= @ref XXH3_SECRET_SIZE_MIN). + * However, the quality of the secret impacts the dispersion of the hash algorithm. + * Therefore, the secret _must_ look like a bunch of random bytes. + * Avoid "trivial" or structured data such as repeated sequences or a text document. + * Whenever in doubt about the "randomness" of the blob of bytes, + * consider employing @ref XXH3_generateSecret() instead (see below). + * It will generate a proper high entropy secret derived from the blob of bytes. + * Another advantage of using XXH3_generateSecret() is that + * it guarantees that all bits within the initial blob of bytes + * will impact every bit of the output. + * This is not necessarily the case when using the blob of bytes directly + * because, when hashing _small_ inputs, only a portion of the secret is employed. + * + * @see @ref single_shot_example "Single Shot Example" for an example. + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_withSecret(XXH_NOESCAPE const void* data, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize); /******* Streaming *******/ +#ifndef XXH_NO_STREAM /* * Streaming requires state maintenance. * This operation costs memory and CPU. @@ -900,41 +1467,172 @@ XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(const void* data, size_t le * All reset and streaming functions have same meaning as their 64-bit counterpart. */ -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH3_state_t* statePtr); -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); +/*! + * @brief Resets an @ref XXH3_state_t to begin a new hash. + * + * @param statePtr The state struct to reset. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * - This function resets `statePtr` and generate a secret with default parameters. + * - Call it before @ref XXH3_128bits_update(). + * - Digest will be equivalent to `XXH3_128bits()`. + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr); + +/*! + * @brief Resets an @ref XXH3_state_t with 64-bit seed to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * - This function resets `statePtr` and generate a secret from `seed`. + * - Call it before @ref XXH3_128bits_update(). + * - Digest will be equivalent to `XXH3_128bits_withSeed()`. + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed); +/*! + * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. + * + * @param statePtr The state struct to reset. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * `secret` is referenced, it _must outlive_ the hash streaming session. + * Similar to one-shot API, `secretSize` must be >= @ref XXH3_SECRET_SIZE_MIN, + * and the quality of produced hash values depends on secret's entropy + * (secret's content should look like a bunch of random bytes). + * When in doubt about the randomness of a candidate `secret`, + * consider employing `XXH3_generateSecret()` instead (see below). + * + * @see @ref streaming_example "Streaming Example" + */ +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize); + +/*! + * @brief Consumes a block of @p input to an @ref XXH3_state_t. + * + * Call this to incrementally consume blocks of data. + * + * @param statePtr The state struct to update. + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @note + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + */ +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update (XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* input, size_t length); -XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update (XXH3_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* statePtr); +/*! + * @brief Returns the calculated XXH3 128-bit hash value from an @ref XXH3_state_t. + * + * @param statePtr The state struct to calculate the hash from. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return The calculated XXH3 128-bit hash value from that state. + * + * @note + * Calling XXH3_128bits_digest() will not affect @p statePtr, so you can update, + * digest, and update again. + * + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH3_128bits_digest (XXH_NOESCAPE const XXH3_state_t* statePtr); +#endif /* !XXH_NO_STREAM */ /* Following helper functions make it possible to compare XXH128_hast_t values. * Since XXH128_hash_t is a structure, this capability is not offered by the language. * Note: For better performance, these functions can be inlined using XXH_INLINE_ALL */ /*! - * XXH128_isEqual(): - * Return: 1 if `h1` and `h2` are equal, 0 if they are not. + * @brief Check equality of two XXH128_hash_t values + * + * @param h1 The 128-bit hash value. + * @param h2 Another 128-bit hash value. + * + * @return `1` if `h1` and `h2` are equal. + * @return `0` if they are not. */ -XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2); +XXH_PUBLIC_API XXH_PUREF int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2); /*! - * XXH128_cmp(): + * @brief Compares two @ref XXH128_hash_t * * This comparator is compatible with stdlib's `qsort()`/`bsearch()`. * - * return: >0 if *h128_1 > *h128_2 - * =0 if *h128_1 == *h128_2 - * <0 if *h128_1 < *h128_2 + * @param h128_1 Left-hand side value + * @param h128_2 Right-hand side value + * + * @return >0 if @p h128_1 > @p h128_2 + * @return =0 if @p h128_1 == @p h128_2 + * @return <0 if @p h128_1 < @p h128_2 */ -XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2); +XXH_PUBLIC_API XXH_PUREF int XXH128_cmp(XXH_NOESCAPE const void* h128_1, XXH_NOESCAPE const void* h128_2); /******* Canonical representation *******/ typedef struct { unsigned char digest[sizeof(XXH128_hash_t)]; } XXH128_canonical_t; -XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash); -XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(const XXH128_canonical_t* src); +/*! + * @brief Converts an @ref XXH128_hash_t to a big endian @ref XXH128_canonical_t. + * + * @param dst The @ref XXH128_canonical_t pointer to be stored to. + * @param hash The @ref XXH128_hash_t to be converted. + * + * @pre + * @p dst must not be `NULL`. + * @see @ref canonical_representation_example "Canonical Representation Example" + */ +XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH_NOESCAPE XXH128_canonical_t* dst, XXH128_hash_t hash); + +/*! + * @brief Converts an @ref XXH128_canonical_t to a native @ref XXH128_hash_t. + * + * @param src The @ref XXH128_canonical_t to convert. + * + * @pre + * @p src must not be `NULL`. + * + * @return The converted hash. + * @see @ref canonical_representation_example "Canonical Representation Example" + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH128_hashFromCanonical(XXH_NOESCAPE const XXH128_canonical_t* src); + + +#endif /* !XXH_NO_XXH3 */ #endif /* XXH_NO_LONG_LONG */ /*! @@ -975,10 +1673,10 @@ XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(const XXH128_canonical_t* struct XXH32_state_s { XXH32_hash_t total_len_32; /*!< Total length hashed, modulo 2^32 */ XXH32_hash_t large_len; /*!< Whether the hash is >= 16 (handles @ref total_len_32 overflow) */ - XXH32_hash_t v[4]; /*!< Accumulator lanes */ - XXH32_hash_t mem32[4]; /*!< Internal buffer for partial reads. Treated as unsigned char[16]. */ - XXH32_hash_t memsize; /*!< Amount of data in @ref mem32 */ - XXH32_hash_t reserved; /*!< Reserved field. Do not read or write to it, it may be removed. */ + XXH32_hash_t acc[4]; /*!< Accumulator lanes */ + unsigned char buffer[16]; /*!< Internal buffer for partial reads. */ + XXH32_hash_t bufferedSize; /*!< Amount of data in @ref buffer */ + XXH32_hash_t reserved; /*!< Reserved field. Do not read nor write to it. */ }; /* typedef'd to XXH32_state_t */ @@ -998,16 +1696,17 @@ struct XXH32_state_s { */ struct XXH64_state_s { XXH64_hash_t total_len; /*!< Total length hashed. This is always 64-bit. */ - XXH64_hash_t v[4]; /*!< Accumulator lanes */ - XXH64_hash_t mem64[4]; /*!< Internal buffer for partial reads. Treated as unsigned char[32]. */ - XXH32_hash_t memsize; /*!< Amount of data in @ref mem64 */ + XXH64_hash_t acc[4]; /*!< Accumulator lanes */ + unsigned char buffer[32]; /*!< Internal buffer for partial reads.. */ + XXH32_hash_t bufferedSize; /*!< Amount of data in @ref buffer */ XXH32_hash_t reserved32; /*!< Reserved field, needed for padding anyways*/ - XXH64_hash_t reserved64; /*!< Reserved field. Do not read or write to it, it may be removed. */ + XXH64_hash_t reserved64; /*!< Reserved field. Do not read or write to it. */ }; /* typedef'd to XXH64_state_t */ +#ifndef XXH_NO_XXH3 + #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* >= C11 */ -# include -# define XXH_ALIGN(n) alignas(n) +# define XXH_ALIGN(n) _Alignas(n) #elif defined(__cplusplus) && (__cplusplus >= 201103L) /* >= C++11 */ /* In C++ alignas() is a keyword */ # define XXH_ALIGN(n) alignas(n) @@ -1029,6 +1728,7 @@ struct XXH64_state_s { #endif /*! + * @internal * @brief The size of the internal XXH3 buffer. * * This is the optimal update size for incremental hashing. @@ -1038,9 +1738,11 @@ struct XXH64_state_s { #define XXH3_INTERNALBUFFER_SIZE 256 /*! - * @brief Default size of the secret buffer (and @ref XXH3_kSecret). + * @def XXH3_SECRET_DEFAULT_SIZE + * @brief Default Secret's size * - * This is the size used in @ref XXH3_kSecret and the seeded functions. + * This is the size of internal XXH3_kSecret + * and is needed by XXH3_generateSecret_fromSeed(). * * Not to be confused with @ref XXH3_SECRET_SIZE_MIN. */ @@ -1070,7 +1772,7 @@ struct XXH64_state_s { */ struct XXH3_state_s { XXH_ALIGN_MEMBER(64, XXH64_hash_t acc[8]); - /*!< The 8 accumulators. Similar to `vN` in @ref XXH32_state_s::v1 and @ref XXH64_state_s */ + /*!< The 8 accumulators. See @ref XXH32_state_s::acc and @ref XXH64_state_s::acc */ XXH_ALIGN_MEMBER(64, unsigned char customSecret[XXH3_SECRET_DEFAULT_SIZE]); /*!< Used to store a custom secret generated from a seed. */ XXH_ALIGN_MEMBER(64, unsigned char buffer[XXH3_INTERNALBUFFER_SIZE]); @@ -1110,69 +1812,153 @@ struct XXH3_state_s { * Note that this doesn't prepare the state for a streaming operation, * it's still necessary to use XXH3_NNbits_reset*() afterwards. */ -#define XXH3_INITSTATE(XXH3_state_ptr) { (XXH3_state_ptr)->seed = 0; } +#define XXH3_INITSTATE(XXH3_state_ptr) \ + do { \ + XXH3_state_t* tmp_xxh3_state_ptr = (XXH3_state_ptr); \ + tmp_xxh3_state_ptr->seed = 0; \ + tmp_xxh3_state_ptr->extSecret = NULL; \ + } while(0) -/* XXH128() : - * simple alias to pre-selected XXH3_128bits variant +/*! + * @brief Calculates the 128-bit hash of @p data using XXH3. + * + * @param data The block of data to be hashed, at least @p len bytes in size. + * @param len The length of @p data, in bytes. + * @param seed The 64-bit seed to alter the hash's output predictably. + * + * @pre + * The memory between @p data and @p data + @p len must be valid, + * readable, contiguous memory. However, if @p len is `0`, @p data may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return The calculated 128-bit XXH3 value. + * + * @see @ref single_shot_example "Single Shot Example" for an example. */ -XXH_PUBLIC_API XXH128_hash_t XXH128(const void* data, size_t len, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t XXH128(XXH_NOESCAPE const void* data, size_t len, XXH64_hash_t seed); /* === Experimental API === */ /* Symbols defined below must be considered tied to a specific library version. */ -/* - * XXH3_generateSecret(): +/*! + * @brief Derive a high-entropy secret from any user-defined content, named customSeed. + * + * @param secretBuffer A writable buffer for derived high-entropy secret data. + * @param secretSize Size of secretBuffer, in bytes. Must be >= XXH3_SECRET_SIZE_MIN. + * @param customSeed A user-defined content. + * @param customSeedSize Size of customSeed, in bytes. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. * - * Derive a high-entropy secret from any user-defined content, named customSeed. * The generated secret can be used in combination with `*_withSecret()` functions. - * The `_withSecret()` variants are useful to provide a higher level of protection than 64-bit seed, - * as it becomes much more difficult for an external actor to guess how to impact the calculation logic. + * The `_withSecret()` variants are useful to provide a higher level of protection + * than 64-bit seed, as it becomes much more difficult for an external actor to + * guess how to impact the calculation logic. * * The function accepts as input a custom seed of any length and any content, - * and derives from it a high-entropy secret of length @secretSize - * into an already allocated buffer @secretBuffer. - * @secretSize must be >= XXH3_SECRET_SIZE_MIN + * and derives from it a high-entropy secret of length @p secretSize into an + * already allocated buffer @p secretBuffer. * * The generated secret can then be used with any `*_withSecret()` variant. - * Functions `XXH3_128bits_withSecret()`, `XXH3_64bits_withSecret()`, - * `XXH3_128bits_reset_withSecret()` and `XXH3_64bits_reset_withSecret()` + * The functions @ref XXH3_128bits_withSecret(), @ref XXH3_64bits_withSecret(), + * @ref XXH3_128bits_reset_withSecret() and @ref XXH3_64bits_reset_withSecret() * are part of this list. They all accept a `secret` parameter - * which must be large enough for implementation reasons (>= XXH3_SECRET_SIZE_MIN) + * which must be large enough for implementation reasons (>= @ref XXH3_SECRET_SIZE_MIN) * _and_ feature very high entropy (consist of random-looking bytes). - * These conditions can be a high bar to meet, so - * XXH3_generateSecret() can be employed to ensure proper quality. + * These conditions can be a high bar to meet, so @ref XXH3_generateSecret() can + * be employed to ensure proper quality. * - * customSeed can be anything. It can have any size, even small ones, - * and its content can be anything, even "poor entropy" sources such as a bunch of zeroes. - * The resulting `secret` will nonetheless provide all required qualities. + * @p customSeed can be anything. It can have any size, even small ones, + * and its content can be anything, even "poor entropy" sources such as a bunch + * of zeroes. The resulting `secret` will nonetheless provide all required qualities. * - * When customSeedSize > 0, supplying NULL as customSeed is undefined behavior. + * @pre + * - @p secretSize must be >= @ref XXH3_SECRET_SIZE_MIN + * - When @p customSeedSize > 0, supplying NULL as customSeed is undefined behavior. + * + * Example code: + * @code{.c} + * #include + * #include + * #include + * #define XXH_STATIC_LINKING_ONLY // expose unstable API + * #include "xxhash.h" + * // Hashes argv[2] using the entropy from argv[1]. + * int main(int argc, char* argv[]) + * { + * char secret[XXH3_SECRET_SIZE_MIN]; + * if (argv != 3) { return 1; } + * XXH3_generateSecret(secret, sizeof(secret), argv[1], strlen(argv[1])); + * XXH64_hash_t h = XXH3_64bits_withSecret( + * argv[2], strlen(argv[2]), + * secret, sizeof(secret) + * ); + * printf("%016llx\n", (unsigned long long) h); + * } + * @endcode */ -XXH_PUBLIC_API XXH_errorcode XXH3_generateSecret(void* secretBuffer, size_t secretSize, const void* customSeed, size_t customSeedSize); - +XXH_PUBLIC_API XXH_errorcode XXH3_generateSecret(XXH_NOESCAPE void* secretBuffer, size_t secretSize, XXH_NOESCAPE const void* customSeed, size_t customSeedSize); -/* - * XXH3_generateSecret_fromSeed(): - * - * Generate the same secret as the _withSeed() variants. +/*! + * @brief Generate the same secret as the _withSeed() variants. * - * The resulting secret has a length of XXH3_SECRET_DEFAULT_SIZE (necessarily). - * @secretBuffer must be already allocated, of size at least XXH3_SECRET_DEFAULT_SIZE bytes. + * @param secretBuffer A writable buffer of @ref XXH3_SECRET_DEFAULT_SIZE bytes + * @param seed The 64-bit seed to alter the hash result predictably. * * The generated secret can be used in combination with *`*_withSecret()` and `_withSecretandSeed()` variants. - * This generator is notably useful in combination with `_withSecretandSeed()`, - * as a way to emulate a faster `_withSeed()` variant. + * + * Example C++ `std::string` hash class: + * @code{.cpp} + * #include + * #define XXH_STATIC_LINKING_ONLY // expose unstable API + * #include "xxhash.h" + * // Slow, seeds each time + * class HashSlow { + * XXH64_hash_t seed; + * public: + * HashSlow(XXH64_hash_t s) : seed{s} {} + * size_t operator()(const std::string& x) const { + * return size_t{XXH3_64bits_withSeed(x.c_str(), x.length(), seed)}; + * } + * }; + * // Fast, caches the seeded secret for future uses. + * class HashFast { + * unsigned char secret[XXH3_SECRET_DEFAULT_SIZE]; + * public: + * HashFast(XXH64_hash_t s) { + * XXH3_generateSecret_fromSeed(secret, seed); + * } + * size_t operator()(const std::string& x) const { + * return size_t{ + * XXH3_64bits_withSecret(x.c_str(), x.length(), secret, sizeof(secret)) + * }; + * } + * }; + * @endcode */ -XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_t seed); +XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(XXH_NOESCAPE void* secretBuffer, XXH64_hash_t seed); -/* - * *_withSecretandSeed() : - * These variants generate hash values using either - * @seed for "short" keys (< XXH3_MIDSIZE_MAX = 240 bytes) - * or @secret for "large" keys (>= XXH3_MIDSIZE_MAX). +/*! + * @brief Maximum size of "short" key in bytes. + */ +#define XXH3_MIDSIZE_MAX 240 + +/*! + * @brief Calculates 64/128-bit seeded variant of XXH3 hash of @p data. + * + * @param data The block of data to be hashed, at least @p len bytes in size. + * @param len The length of @p data, in bytes. + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * @param seed The 64-bit seed to alter the hash result predictably. + * + * These variants generate hash values using either: + * - @p seed for "short" keys (< @ref XXH3_MIDSIZE_MAX = 240 bytes) + * - @p secret for "large" keys (>= @ref XXH3_MIDSIZE_MAX). * * This generally benefits speed, compared to `_withSeed()` or `_withSecret()`. * `_withSeed()` has to generate the secret on the fly for "large" keys. @@ -1181,7 +1967,7 @@ XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_ * which requires more instructions than _withSeed() variants. * Therefore, _withSecretandSeed variant combines the best of both worlds. * - * When @secret has been generated by XXH3_generateSecret_fromSeed(), + * When @p secret has been generated by XXH3_generateSecret_fromSeed(), * this variant produces *exactly* the same results as `_withSeed()` variant, * hence offering only a pure speed benefit on "large" input, * by skipping the need to regenerate the secret for every large input. @@ -1190,32 +1976,83 @@ XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_ * for example with XXH3_64bits(), which then becomes the seed, * and then employ both the seed and the secret in _withSecretandSeed(). * On top of speed, an added benefit is that each bit in the secret - * has a 50% chance to swap each bit in the output, - * via its impact to the seed. + * has a 50% chance to swap each bit in the output, via its impact to the seed. + * * This is not guaranteed when using the secret directly in "small data" scenarios, * because only portions of the secret are employed for small data. */ -XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSecretandSeed(const void* data, size_t len, - const void* secret, size_t secretSize, - XXH64_hash_t seed); - -XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSecretandSeed(const void* data, size_t len, - const void* secret, size_t secretSize, +XXH_PUBLIC_API XXH_PUREF XXH64_hash_t +XXH3_64bits_withSecretandSeed(XXH_NOESCAPE const void* data, size_t len, + XXH_NOESCAPE const void* secret, size_t secretSize, + XXH64_hash_t seed); + +/*! + * @brief Calculates 128-bit seeded variant of XXH3 hash of @p data. + * + * @param input The memory segment to be hashed, at least @p len bytes in size. + * @param length The length of @p data, in bytes. + * @param secret The secret used to alter hash result predictably. + * @param secretSize The length of @p secret, in bytes (must be >= XXH3_SECRET_SIZE_MIN) + * @param seed64 The 64-bit seed to alter the hash result predictably. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @see XXH3_64bits_withSecretandSeed(): contract is the same. + */ +XXH_PUBLIC_API XXH_PUREF XXH128_hash_t +XXH3_128bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t length, + XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64); +#ifndef XXH_NO_STREAM +/*! + * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. + * + * @param statePtr A pointer to an @ref XXH3_state_t allocated with @ref XXH3_createState(). + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * @param seed64 The 64-bit seed to alter the hash result predictably. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @see XXH3_64bits_withSecretandSeed(). Contract is identical. + */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSecretandSeed(XXH3_state_t* statePtr, - const void* secret, size_t secretSize, +XXH3_64bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, + XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64); +/*! + * @brief Resets an @ref XXH3_state_t with secret data to begin a new hash. + * + * @param statePtr A pointer to an @ref XXH3_state_t allocated with @ref XXH3_createState(). + * @param secret The secret data. + * @param secretSize The length of @p secret, in bytes. + * @param seed64 The 64-bit seed to alter the hash result predictably. + * + * @return @ref XXH_OK on success. + * @return @ref XXH_ERROR on failure. + * + * @see XXH3_64bits_withSecretandSeed(). Contract is identical. + * + * Note: there was a bug in an earlier version of this function (<= v0.8.2) + * that would make it generate an incorrect hash value + * when @p seed == 0 and @p length < XXH3_MIDSIZE_MAX + * and @p secret is different from XXH3_generateSecret_fromSeed(). + * As stated in the contract, the correct hash result must be + * the same as XXH3_128bits_withSeed() when @p length <= XXH3_MIDSIZE_MAX. + * Results generated by this older version are wrong, hence not comparable. + */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, - const void* secret, size_t secretSize, +XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, + XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64); +#endif /* !XXH_NO_STREAM */ +#endif /* !XXH_NO_XXH3 */ #endif /* XXH_NO_LONG_LONG */ #if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) # define XXH_IMPLEMENTATION @@ -1269,7 +2106,7 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, /*! * @brief Define this to disable 64-bit code. * - * Useful if only using the @ref xxh32_family and you have a strict C90 compiler. + * Useful if only using the @ref XXH32_family and you have a strict C90 compiler. */ # define XXH_NO_LONG_LONG # undef XXH_NO_LONG_LONG /* don't actually */ @@ -1292,7 +2129,7 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, * Use `memcpy()`. Safe and portable. Note that most modern compilers will * eliminate the function call and treat it as an unaligned access. * - * - `XXH_FORCE_MEMORY_ACCESS=1`: `__attribute__((packed))` + * - `XXH_FORCE_MEMORY_ACCESS=1`: `__attribute__((aligned(1)))` * @par * Depends on compiler extensions and is therefore not portable. * This method is safe _if_ your compiler supports it, @@ -1312,19 +2149,47 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, * inline small `memcpy()` calls, and it might also be faster on big-endian * systems which lack a native byteswap instruction. However, some compilers * will emit literal byteshifts even if the target supports unaligned access. - * . + * * * @warning * Methods 1 and 2 rely on implementation-defined behavior. Use these with * care, as what works on one compiler/platform/optimization level may cause * another to read garbage data or even crash. * - * See http://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html for details. + * See https://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html for details. * * Prefer these methods in priority order (0 > 3 > 1 > 2) */ # define XXH_FORCE_MEMORY_ACCESS 0 +/*! + * @def XXH_SIZE_OPT + * @brief Controls how much xxHash optimizes for size. + * + * xxHash, when compiled, tends to result in a rather large binary size. This + * is mostly due to heavy usage to forced inlining and constant folding of the + * @ref XXH3_family to increase performance. + * + * However, some developers prefer size over speed. This option can + * significantly reduce the size of the generated code. When using the `-Os` + * or `-Oz` options on GCC or Clang, this is defined to 1 by default, + * otherwise it is defined to 0. + * + * Most of these size optimizations can be controlled manually. + * + * This is a number from 0-2. + * - `XXH_SIZE_OPT` == 0: Default. xxHash makes no size optimizations. Speed + * comes first. + * - `XXH_SIZE_OPT` == 1: Default for `-Os` and `-Oz`. xxHash is more + * conservative and disables hacks that increase code size. It implies the + * options @ref XXH_NO_INLINE_HINTS == 1, @ref XXH_FORCE_ALIGN_CHECK == 0, + * and @ref XXH3_NEON_LANES == 8 if they are not already defined. + * - `XXH_SIZE_OPT` == 2: xxHash tries to make itself as small as possible. + * Performance may cry. For example, the single shot functions just use the + * streaming API. + */ +# define XXH_SIZE_OPT 0 + /*! * @def XXH_FORCE_ALIGN_CHECK * @brief If defined to non-zero, adds a special path for aligned inputs (XXH32() @@ -1346,9 +2211,11 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, * * In these cases, the alignment check can be removed by setting this macro to 0. * Then the code will always use unaligned memory access. - * Align check is automatically disabled on x86, x64 & arm64, + * Align check is automatically disabled on x86, x64, ARM64, and some ARM chips * which are platforms known to offer good unaligned memory accesses performance. * + * It is also disabled by default when @ref XXH_SIZE_OPT >= 1. + * * This option does not affect XXH3 (only XXH32 and XXH64). */ # define XXH_FORCE_ALIGN_CHECK 0 @@ -1370,11 +2237,28 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, * XXH_NO_INLINE_HINTS marks all internal functions as static, giving the * compiler full control on whether to inline or not. * - * When not optimizing (-O0), optimizing for size (-Os, -Oz), or using - * -fno-inline with GCC or Clang, this will automatically be defined. + * When not optimizing (-O0), using `-fno-inline` with GCC or Clang, or if + * @ref XXH_SIZE_OPT >= 1, this will automatically be defined. */ # define XXH_NO_INLINE_HINTS 0 +/*! + * @def XXH3_INLINE_SECRET + * @brief Determines whether to inline the XXH3 withSecret code. + * + * When the secret size is known, the compiler can improve the performance + * of XXH3_64bits_withSecret() and XXH3_128bits_withSecret(). + * + * However, if the secret size is not known, it doesn't have any benefit. This + * happens when xxHash is compiled into a global symbol. Therefore, if + * @ref XXH_INLINE_ALL is *not* defined, this will be defined to 0. + * + * Additionally, this defaults to 0 on GCC 12+, which has an issue with function pointers + * that are *sometimes* force inline on -Og, and it is impossible to automatically + * detect this optimization level. + */ +# define XXH3_INLINE_SECRET 0 + /*! * @def XXH32_ENDJMP * @brief Whether to use a jump for `XXH32_finalize`. @@ -1396,34 +2280,45 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, */ # define XXH_OLD_NAMES # undef XXH_OLD_NAMES /* don't actually use, it is ugly. */ + +/*! + * @def XXH_NO_STREAM + * @brief Disables the streaming API. + * + * When xxHash is not inlined and the streaming functions are not used, disabling + * the streaming functions can improve code size significantly, especially with + * the @ref XXH3_family which tends to make constant folded copies of itself. + */ +# define XXH_NO_STREAM +# undef XXH_NO_STREAM /* don't actually */ #endif /* XXH_DOXYGEN */ /*! * @} */ #ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ - /* prefer __packed__ structures (method 1) for gcc on armv7+ and mips */ -# if !defined(__clang__) && \ -( \ - (defined(__INTEL_COMPILER) && !defined(_WIN32)) || \ - ( \ - defined(__GNUC__) && ( \ - (defined(__ARM_ARCH) && __ARM_ARCH >= 7) || \ - ( \ - defined(__mips__) && \ - (__mips <= 5 || __mips_isa_rev < 6) && \ - (!defined(__mips16) || defined(__mips_mips16e2)) \ - ) \ - ) \ - ) \ -) + /* prefer __packed__ structures (method 1) for GCC + * < ARMv7 with unaligned access (e.g. Raspbian armhf) still uses byte shifting, so we use memcpy + * which for some reason does unaligned loads. */ +# if defined(__GNUC__) && !(defined(__ARM_ARCH) && __ARM_ARCH < 7 && defined(__ARM_FEATURE_UNALIGNED)) # define XXH_FORCE_MEMORY_ACCESS 1 # endif #endif +#ifndef XXH_SIZE_OPT + /* default to 1 for -Os or -Oz */ +# if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE_SIZE__) +# define XXH_SIZE_OPT 1 +# else +# define XXH_SIZE_OPT 0 +# endif +#endif + #ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ -# if defined(__i386) || defined(__x86_64__) || defined(__aarch64__) \ - || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) /* visual */ + /* don't check on sizeopt, x86, aarch64, or arm when unaligned access is available */ +# if XXH_SIZE_OPT >= 1 || \ + defined(__i386) || defined(__x86_64__) || defined(__aarch64__) || defined(__ARM_FEATURE_UNALIGNED) \ + || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) || defined(_M_ARM) /* visual */ # define XXH_FORCE_ALIGN_CHECK 0 # else # define XXH_FORCE_ALIGN_CHECK 1 @@ -1431,14 +2326,22 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, #endif #ifndef XXH_NO_INLINE_HINTS -# if defined(__OPTIMIZE_SIZE__) /* -Os, -Oz */ \ - || defined(__NO_INLINE__) /* -O0, -fno-inline */ +# if XXH_SIZE_OPT >= 1 || defined(__NO_INLINE__) /* -O0, -fno-inline */ # define XXH_NO_INLINE_HINTS 1 # else # define XXH_NO_INLINE_HINTS 0 # endif #endif +#ifndef XXH3_INLINE_SECRET +# if (defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 12) \ + || !defined(XXH_INLINE_ALL) +# define XXH3_INLINE_SECRET 0 +# else +# define XXH3_INLINE_SECRET 1 +# endif +#endif + #ifndef XXH32_ENDJMP /* generally preferable for performance */ # define XXH32_ENDJMP 0 @@ -1453,6 +2356,24 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, /* ************************************* * Includes & Memory related functions ***************************************/ +#if defined(XXH_NO_STREAM) +/* nothing */ +#elif defined(XXH_NO_STDLIB) + +/* When requesting to disable any mention of stdlib, + * the library loses the ability to invoked malloc / free. + * In practice, it means that functions like `XXH*_createState()` + * will always fail, and return NULL. + * This flag is useful in situations where + * xxhash.h is integrated into some kernel, embedded or limited environment + * without access to dynamic allocation. + */ + +static XXH_CONSTF void* XXH_malloc(size_t s) { (void)s; return NULL; } +static void XXH_free(void* p) { (void)p; } + +#else + /* * Modify the local functions below should you wish to use * different memory routines for malloc() and free() @@ -1463,7 +2384,7 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, * @internal * @brief Modify this function to use a different routine than malloc(). */ -static void* XXH_malloc(size_t s) { return malloc(s); } +static XXH_MALLOCF void* XXH_malloc(size_t s) { return malloc(s); } /*! * @internal @@ -1471,16 +2392,37 @@ static void* XXH_malloc(size_t s) { return malloc(s); } */ static void XXH_free(void* p) { free(p); } -#include +#endif /* XXH_NO_STDLIB */ +#ifndef XXH_memcpy /*! * @internal - * @brief Modify this function to use a different routine than memcpy(). + * @brief XXH_memcpy() macro can be redirected at compile time */ -static void* XXH_memcpy(void* dest, const void* src, size_t size) -{ - return memcpy(dest,src,size); -} +# include +# define XXH_memcpy memcpy +#endif + +#ifndef XXH_memset +/*! + * @internal + * @brief XXH_memset() macro can be redirected at compile time + */ +# include +# define XXH_memset memset +#endif + +#ifndef XXH_memcmp +/*! + * @internal + * @brief XXH_memcmp() macro can be redirected at compile time + * Note: only needed by XXH128. + */ +# include +# define XXH_memcmp memcmp +#endif + + #include /* ULLONG_MAX */ @@ -1494,15 +2436,15 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) #if XXH_NO_INLINE_HINTS /* disable inlining hints */ # if defined(__GNUC__) || defined(__clang__) -# define XXH_FORCE_INLINE static __attribute__((unused)) +# define XXH_FORCE_INLINE static __attribute__((__unused__)) # else # define XXH_FORCE_INLINE static # endif # define XXH_NO_INLINE static /* enable inlining hints */ #elif defined(__GNUC__) || defined(__clang__) -# define XXH_FORCE_INLINE static __inline__ __attribute__((always_inline, unused)) -# define XXH_NO_INLINE static __attribute__((noinline)) +# define XXH_FORCE_INLINE static __inline__ __attribute__((__always_inline__, __unused__)) +# define XXH_NO_INLINE static __attribute__((__noinline__)) #elif defined(_MSC_VER) /* Visual Studio */ # define XXH_FORCE_INLINE static __forceinline # define XXH_NO_INLINE static __declspec(noinline) @@ -1515,7 +2457,34 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) # define XXH_NO_INLINE static #endif +#if defined(XXH_INLINE_ALL) +# define XXH_STATIC XXH_FORCE_INLINE +#else +# define XXH_STATIC static +#endif + +#if XXH3_INLINE_SECRET +# define XXH3_WITH_SECRET_INLINE XXH_FORCE_INLINE +#else +# define XXH3_WITH_SECRET_INLINE XXH_NO_INLINE +#endif +#if ((defined(sun) || defined(__sun)) && __cplusplus) /* Solaris includes __STDC_VERSION__ with C++. Tested with GCC 5.5 */ +# define XXH_RESTRICT /* disable */ +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* >= C99 */ +# define XXH_RESTRICT restrict +#elif (defined (__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))) \ + || (defined (__clang__)) \ + || (defined (_MSC_VER) && (_MSC_VER >= 1400)) \ + || (defined (__INTEL_COMPILER) && (__INTEL_COMPILER >= 1300)) +/* + * There are a LOT more compilers that recognize __restrict but this + * covers the major ones. + */ +# define XXH_RESTRICT __restrict +#else +# define XXH_RESTRICT /* disable */ +#endif /* ************************************* * Debug @@ -1540,7 +2509,11 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) # include /* note: can still be disabled with NDEBUG */ # define XXH_ASSERT(c) assert(c) #else -# define XXH_ASSERT(c) ((void)0) +# if defined(__INTEL_COMPILER) +# define XXH_ASSERT(c) XXH_ASSUME((unsigned char) (c)) +# else +# define XXH_ASSERT(c) XXH_ASSUME(c) +# endif #endif /* note: use after variable declarations */ @@ -1572,25 +2545,38 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) * XXH3_initCustomSecret_scalar(). */ #if defined(__GNUC__) || defined(__clang__) -# define XXH_COMPILER_GUARD(var) __asm__ __volatile__("" : "+r" (var)) +# define XXH_COMPILER_GUARD(var) __asm__("" : "+r" (var)) #else # define XXH_COMPILER_GUARD(var) ((void)0) #endif +/* Specifically for NEON vectors which use the "w" constraint, on + * Clang. */ +#if defined(__clang__) && defined(__ARM_ARCH) && !defined(__wasm__) +# define XXH_COMPILER_GUARD_CLANG_NEON(var) __asm__("" : "+w" (var)) +#else +# define XXH_COMPILER_GUARD_CLANG_NEON(var) ((void)0) +#endif + /* ************************************* * Basic Types ***************************************/ #if !defined (__VMS) \ && (defined (__cplusplus) \ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include - typedef uint8_t xxh_u8; +# ifdef _AIX +# include +# else +# include +# endif + typedef uint8_t xxh_u8; #else - typedef unsigned char xxh_u8; + typedef unsigned char xxh_u8; #endif typedef XXH32_hash_t xxh_u32; #ifdef XXH_OLD_NAMES +# warning "XXH_OLD_NAMES is planned to be removed starting v0.9. If the program depends on it, consider moving away from it by employing newer type names directly" # define BYTE xxh_u8 # define U8 xxh_u8 # define U32 xxh_u32 @@ -1664,25 +2650,26 @@ static xxh_u32 XXH_read32(const void* memPtr) { return *(const xxh_u32*) memPtr; #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) /* - * __pack instructions are safer but compiler specific, hence potentially - * problematic for some compilers. - * - * Currently only defined for GCC and ICC. + * __attribute__((aligned(1))) is supported by gcc and clang. Originally the + * documentation claimed that it only increased the alignment, but actually it + * can decrease it on gcc, clang, and icc: + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69502, + * https://gcc.godbolt.org/z/xYez1j67Y. */ #ifdef XXH_OLD_NAMES -typedef union { xxh_u32 u32; } __attribute__((packed)) unalign; +typedef union { xxh_u32 u32; } __attribute__((__packed__)) unalign; #endif static xxh_u32 XXH_read32(const void* ptr) { - typedef union { xxh_u32 u32; } __attribute__((packed)) xxh_unalign; - return ((const xxh_unalign*)ptr)->u32; + typedef __attribute__((__aligned__(1))) xxh_u32 xxh_unalign32; + return *((const xxh_unalign32*)ptr); } #else /* * Portable and safe solution. Generally efficient. - * see: http://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html + * see: https://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html */ static xxh_u32 XXH_read32(const void* memPtr) { @@ -1758,6 +2745,51 @@ static int XXH_isLittleEndian(void) # define XXH_HAS_BUILTIN(x) 0 #endif + + +/* + * C23 and future versions have standard "unreachable()". + * Once it has been implemented reliably we can add it as an + * additional case: + * + * ``` + * #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= XXH_C23_VN) + * # include + * # ifdef unreachable + * # define XXH_UNREACHABLE() unreachable() + * # endif + * #endif + * ``` + * + * Note C++23 also has std::unreachable() which can be detected + * as follows: + * ``` + * #if defined(__cpp_lib_unreachable) && (__cpp_lib_unreachable >= 202202L) + * # include + * # define XXH_UNREACHABLE() std::unreachable() + * #endif + * ``` + * NB: `__cpp_lib_unreachable` is defined in the `` header. + * We don't use that as including `` in `extern "C"` blocks + * doesn't work on GCC12 + */ + +#if XXH_HAS_BUILTIN(__builtin_unreachable) +# define XXH_UNREACHABLE() __builtin_unreachable() + +#elif defined(_MSC_VER) +# define XXH_UNREACHABLE() __assume(0) + +#else +# define XXH_UNREACHABLE() +#endif + +#if XXH_HAS_BUILTIN(__builtin_assume) +# define XXH_ASSUME(c) __builtin_assume(c) +#else +# define XXH_ASSUME(c) if (!(c)) { XXH_UNREACHABLE(); } +#endif + /*! * @internal * @def XXH_rotl32(x,r) @@ -1775,6 +2807,9 @@ static int XXH_isLittleEndian(void) && XXH_HAS_BUILTIN(__builtin_rotateleft64) # define XXH_rotl32 __builtin_rotateleft32 # define XXH_rotl64 __builtin_rotateleft64 +#elif XXH_HAS_BUILTIN(__builtin_stdc_rotate_left) +# define XXH_rotl32 __builtin_stdc_rotate_left +# define XXH_rotl64 __builtin_stdc_rotate_left /* Note: although _rotl exists for minGW (GCC under windows), performance seems poor */ #elif defined(_MSC_VER) # define XXH_rotl32(x,r) _rotl(x,r) @@ -1880,8 +2915,10 @@ XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } *********************************************************************/ /*! * @} - * @defgroup xxh32_impl XXH32 implementation + * @defgroup XXH32_impl XXH32 implementation * @ingroup impl + * + * Details on the XXH32 implementation. * @{ */ /* #define instead of static const, to be used as initializers */ @@ -1915,10 +2952,10 @@ static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) acc += input * XXH_PRIME32_2; acc = XXH_rotl32(acc, 13); acc *= XXH_PRIME32_1; -#if (defined(__SSE4_1__) || defined(__aarch64__)) && !defined(XXH_ENABLE_AUTOVECTORIZE) +#if (defined(__SSE4_1__) || defined(__aarch64__) || defined(__wasm_simd128__)) && !defined(XXH_ENABLE_AUTOVECTORIZE) /* * UGLY HACK: - * A compiler fence is the only thing that prevents GCC and Clang from + * A compiler fence is used to prevent GCC and Clang from * autovectorizing the XXH32 loop (pragmas and attributes don't work for some * reason) without globally disabling SSE4.1. * @@ -1945,9 +2982,12 @@ static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) * can load data, while v3 can multiply. SSE forces them to operate * together. * - * This is also enabled on AArch64, as Clang autovectorizes it incorrectly - * and it is pointless writing a NEON implementation that is basically the - * same speed as scalar for XXH32. + * This is also enabled on AArch64, as Clang is *very aggressive* in vectorizing + * the loop. NEON is only faster on the A53, and with the newer cores, it is less + * than half the speed. + * + * Additionally, this is used on WASM SIMD128 because it JITs to the same + * SIMD instructions and has the same issue. */ XXH_COMPILER_GUARD(acc); #endif @@ -1961,21 +3001,76 @@ static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) * The final mix ensures that all input bits have a chance to impact any bit in * the output digest, resulting in an unbiased distribution. * - * @param h32 The hash to avalanche. + * @param hash The hash to avalanche. * @return The avalanched hash. */ -static xxh_u32 XXH32_avalanche(xxh_u32 h32) +static xxh_u32 XXH32_avalanche(xxh_u32 hash) { - h32 ^= h32 >> 15; - h32 *= XXH_PRIME32_2; - h32 ^= h32 >> 13; - h32 *= XXH_PRIME32_3; - h32 ^= h32 >> 16; - return(h32); + hash ^= hash >> 15; + hash *= XXH_PRIME32_2; + hash ^= hash >> 13; + hash *= XXH_PRIME32_3; + hash ^= hash >> 16; + return hash; } #define XXH_get32bits(p) XXH_readLE32_align(p, align) +/*! + * @internal + * @brief Sets up the initial accumulator state for XXH32(). + */ +XXH_FORCE_INLINE void +XXH32_initAccs(xxh_u32 *acc, xxh_u32 seed) +{ + XXH_ASSERT(acc != NULL); + acc[0] = seed + XXH_PRIME32_1 + XXH_PRIME32_2; + acc[1] = seed + XXH_PRIME32_2; + acc[2] = seed + 0; + acc[3] = seed - XXH_PRIME32_1; +} + +/*! + * @internal + * @brief Consumes a block of data for XXH32(). + * + * @return the end input pointer. + */ +XXH_FORCE_INLINE const xxh_u8 * +XXH32_consumeLong( + xxh_u32 *XXH_RESTRICT acc, + xxh_u8 const *XXH_RESTRICT input, + size_t len, + XXH_alignment align +) +{ + const xxh_u8* const bEnd = input + len; + const xxh_u8* const limit = bEnd - 15; + XXH_ASSERT(acc != NULL); + XXH_ASSERT(input != NULL); + XXH_ASSERT(len >= 16); + do { + acc[0] = XXH32_round(acc[0], XXH_get32bits(input)); input += 4; + acc[1] = XXH32_round(acc[1], XXH_get32bits(input)); input += 4; + acc[2] = XXH32_round(acc[2], XXH_get32bits(input)); input += 4; + acc[3] = XXH32_round(acc[3], XXH_get32bits(input)); input += 4; + } while (input < limit); + + return input; +} + +/*! + * @internal + * @brief Merges the accumulator lanes together for XXH32() + */ +XXH_FORCE_INLINE XXH_PUREF xxh_u32 +XXH32_mergeAccs(const xxh_u32 *acc) +{ + XXH_ASSERT(acc != NULL); + return XXH_rotl32(acc[0], 1) + XXH_rotl32(acc[1], 7) + + XXH_rotl32(acc[2], 12) + XXH_rotl32(acc[3], 18); +} + /*! * @internal * @brief Processes the last 0-15 bytes of @p ptr. @@ -1984,24 +3079,25 @@ static xxh_u32 XXH32_avalanche(xxh_u32 h32) * This final stage will digest them to ensure that all input bytes are present * in the final mix. * - * @param h32 The hash to finalize. + * @param hash The hash to finalize. * @param ptr The pointer to the remaining input. * @param len The remaining length, modulo 16. * @param align Whether @p ptr is aligned. * @return The finalized hash. + * @see XXH64_finalize(). */ -static xxh_u32 -XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) +static XXH_PUREF xxh_u32 +XXH32_finalize(xxh_u32 hash, const xxh_u8* ptr, size_t len, XXH_alignment align) { -#define XXH_PROCESS1 do { \ - h32 += (*ptr++) * XXH_PRIME32_5; \ - h32 = XXH_rotl32(h32, 11) * XXH_PRIME32_1; \ +#define XXH_PROCESS1 do { \ + hash += (*ptr++) * XXH_PRIME32_5; \ + hash = XXH_rotl32(hash, 11) * XXH_PRIME32_1; \ } while (0) -#define XXH_PROCESS4 do { \ - h32 += XXH_get32bits(ptr) * XXH_PRIME32_3; \ - ptr += 4; \ - h32 = XXH_rotl32(h32, 17) * XXH_PRIME32_4; \ +#define XXH_PROCESS4 do { \ + hash += XXH_get32bits(ptr) * XXH_PRIME32_3; \ + ptr += 4; \ + hash = XXH_rotl32(hash, 17) * XXH_PRIME32_4; \ } while (0) if (ptr==NULL) XXH_ASSERT(len == 0); @@ -2017,49 +3113,49 @@ XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) XXH_PROCESS1; --len; } - return XXH32_avalanche(h32); + return XXH32_avalanche(hash); } else { switch(len&15) /* or switch(bEnd - p) */ { case 12: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 8: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 4: XXH_PROCESS4; - return XXH32_avalanche(h32); + return XXH32_avalanche(hash); case 13: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 9: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 5: XXH_PROCESS4; XXH_PROCESS1; - return XXH32_avalanche(h32); + return XXH32_avalanche(hash); case 14: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 10: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 6: XXH_PROCESS4; XXH_PROCESS1; XXH_PROCESS1; - return XXH32_avalanche(h32); + return XXH32_avalanche(hash); case 15: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 11: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 7: XXH_PROCESS4; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 3: XXH_PROCESS1; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 2: XXH_PROCESS1; - XXH_FALLTHROUGH; + XXH_FALLTHROUGH; /* fallthrough */ case 1: XXH_PROCESS1; - XXH_FALLTHROUGH; - case 0: return XXH32_avalanche(h32); + XXH_FALLTHROUGH; /* fallthrough */ + case 0: return XXH32_avalanche(hash); } XXH_ASSERT(0); - return h32; /* reaching this point is deemed impossible */ + return hash; /* reaching this point is deemed impossible */ } } @@ -2079,7 +3175,7 @@ XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) * @param align Whether @p input is aligned. * @return The calculated hash. */ -XXH_FORCE_INLINE xxh_u32 +XXH_FORCE_INLINE XXH_PUREF xxh_u32 XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment align) { xxh_u32 h32; @@ -2087,22 +3183,12 @@ XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment if (input==NULL) XXH_ASSERT(len == 0); if (len>=16) { - const xxh_u8* const bEnd = input + len; - const xxh_u8* const limit = bEnd - 15; - xxh_u32 v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2; - xxh_u32 v2 = seed + XXH_PRIME32_2; - xxh_u32 v3 = seed + 0; - xxh_u32 v4 = seed - XXH_PRIME32_1; + xxh_u32 acc[4]; + XXH32_initAccs(acc, seed); - do { - v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4; - v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4; - v3 = XXH32_round(v3, XXH_get32bits(input)); input += 4; - v4 = XXH32_round(v4, XXH_get32bits(input)); input += 4; - } while (input < limit); - - h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) - + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); + input = XXH32_consumeLong(acc, input, len, align); + + h32 = XXH32_mergeAccs(acc); } else { h32 = seed + XXH_PRIME32_5; } @@ -2112,10 +3198,10 @@ XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment return XXH32_finalize(h32, input, len&15, align); } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t seed) { -#if 0 +#if !defined(XXH_NO_STREAM) && XXH_SIZE_OPT >= 2 /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ XXH32_state_t state; XXH32_reset(&state, seed); @@ -2134,42 +3220,36 @@ XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t s /******* Hash streaming *******/ -/*! - * @ingroup xxh32_family - */ +#ifndef XXH_NO_STREAM +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) { return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) { XXH_free(statePtr); return XXH_OK; } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dstState, const XXH32_state_t* srcState) { XXH_memcpy(dstState, srcState, sizeof(*dstState)); } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, XXH32_hash_t seed) { - XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ - memset(&state, 0, sizeof(state)); - state.v[0] = seed + XXH_PRIME32_1 + XXH_PRIME32_2; - state.v[1] = seed + XXH_PRIME32_2; - state.v[2] = seed + 0; - state.v[3] = seed - XXH_PRIME32_1; - /* do not write into reserved, planned to be removed in a future version */ - XXH_memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved)); + XXH_ASSERT(statePtr != NULL); + XXH_memset(statePtr, 0, sizeof(*statePtr)); + XXH32_initAccs(statePtr->acc, seed); return XXH_OK; } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH_errorcode XXH32_update(XXH32_state_t* state, const void* input, size_t len) { @@ -2178,45 +3258,37 @@ XXH32_update(XXH32_state_t* state, const void* input, size_t len) return XXH_OK; } - { const xxh_u8* p = (const xxh_u8*)input; - const xxh_u8* const bEnd = p + len; + state->total_len_32 += (XXH32_hash_t)len; + state->large_len |= (XXH32_hash_t)((len>=16) | (state->total_len_32>=16)); - state->total_len_32 += (XXH32_hash_t)len; - state->large_len |= (XXH32_hash_t)((len>=16) | (state->total_len_32>=16)); + XXH_ASSERT(state->bufferedSize < sizeof(state->buffer)); + if (len < sizeof(state->buffer) - state->bufferedSize) { /* fill in tmp buffer */ + XXH_memcpy(state->buffer + state->bufferedSize, input, len); + state->bufferedSize += (XXH32_hash_t)len; + return XXH_OK; + } - if (state->memsize + len < 16) { /* fill in tmp buffer */ - XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, len); - state->memsize += (XXH32_hash_t)len; - return XXH_OK; - } + { const xxh_u8* xinput = (const xxh_u8*)input; + const xxh_u8* const bEnd = xinput + len; - if (state->memsize) { /* some data left from previous update */ - XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, 16-state->memsize); - { const xxh_u32* p32 = state->mem32; - state->v[0] = XXH32_round(state->v[0], XXH_readLE32(p32)); p32++; - state->v[1] = XXH32_round(state->v[1], XXH_readLE32(p32)); p32++; - state->v[2] = XXH32_round(state->v[2], XXH_readLE32(p32)); p32++; - state->v[3] = XXH32_round(state->v[3], XXH_readLE32(p32)); - } - p += 16-state->memsize; - state->memsize = 0; + if (state->bufferedSize) { /* non-empty buffer: complete first */ + XXH_memcpy(state->buffer + state->bufferedSize, xinput, sizeof(state->buffer) - state->bufferedSize); + xinput += sizeof(state->buffer) - state->bufferedSize; + /* then process one round */ + (void)XXH32_consumeLong(state->acc, state->buffer, sizeof(state->buffer), XXH_aligned); + state->bufferedSize = 0; } - if (p <= bEnd-16) { - const xxh_u8* const limit = bEnd - 16; - - do { - state->v[0] = XXH32_round(state->v[0], XXH_readLE32(p)); p+=4; - state->v[1] = XXH32_round(state->v[1], XXH_readLE32(p)); p+=4; - state->v[2] = XXH32_round(state->v[2], XXH_readLE32(p)); p+=4; - state->v[3] = XXH32_round(state->v[3], XXH_readLE32(p)); p+=4; - } while (p<=limit); - + XXH_ASSERT(xinput <= bEnd); + if ((size_t)(bEnd - xinput) >= sizeof(state->buffer)) { + /* Process the remaining data */ + xinput = XXH32_consumeLong(state->acc, xinput, (size_t)(bEnd - xinput), XXH_unaligned); } - if (p < bEnd) { - XXH_memcpy(state->mem32, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); + if (xinput < bEnd) { + /* Copy the leftover to the tmp buffer */ + XXH_memcpy(state->buffer, xinput, (size_t)(bEnd-xinput)); + state->bufferedSize = (unsigned)(bEnd-xinput); } } @@ -2224,49 +3296,33 @@ XXH32_update(XXH32_state_t* state, const void* input, size_t len) } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_hash_t XXH32_digest(const XXH32_state_t* state) { xxh_u32 h32; if (state->large_len) { - h32 = XXH_rotl32(state->v[0], 1) - + XXH_rotl32(state->v[1], 7) - + XXH_rotl32(state->v[2], 12) - + XXH_rotl32(state->v[3], 18); + h32 = XXH32_mergeAccs(state->acc); } else { - h32 = state->v[2] /* == seed */ + XXH_PRIME32_5; + h32 = state->acc[2] /* == seed */ + XXH_PRIME32_5; } h32 += state->total_len_32; - return XXH32_finalize(h32, (const xxh_u8*)state->mem32, state->memsize, XXH_aligned); + return XXH32_finalize(h32, state->buffer, state->bufferedSize, XXH_aligned); } - +#endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ -/*! - * @ingroup xxh32_family - * The default return values from XXH functions are unsigned 32 and 64 bit - * integers. - * - * The canonical representation uses big endian convention, the same convention - * as human-readable numbers (large digits first). - * - * This way, hash values can be written into a file or buffer, remaining - * comparable across different systems. - * - * The following functions allow transformation of hash values to and from their - * canonical format. - */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) { XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); XXH_memcpy(dst, &hash, sizeof(*dst)); } -/*! @ingroup xxh32_family */ +/*! @ingroup XXH32_family */ XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) { return XXH_readBE32(src); @@ -2307,25 +3363,26 @@ static xxh_u64 XXH_read64(const void* memPtr) #elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) /* - * __pack instructions are safer, but compiler specific, hence potentially - * problematic for some compilers. - * - * Currently only defined for GCC and ICC. + * __attribute__((aligned(1))) is supported by gcc and clang. Originally the + * documentation claimed that it only increased the alignment, but actually it + * can decrease it on gcc, clang, and icc: + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69502, + * https://gcc.godbolt.org/z/xYez1j67Y. */ #ifdef XXH_OLD_NAMES -typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) unalign64; +typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((__packed__)) unalign64; #endif static xxh_u64 XXH_read64(const void* ptr) { - typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) xxh_unalign64; - return ((const xxh_unalign64*)ptr)->u64; + typedef __attribute__((__aligned__(1))) xxh_u64 xxh_unalign64; + return *((const xxh_unalign64*)ptr); } #else /* * Portable and safe solution. Generally efficient. - * see: http://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html + * see: https://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html */ static xxh_u64 XXH_read64(const void* memPtr) { @@ -2409,8 +3466,10 @@ XXH_readLE64_align(const void* ptr, XXH_alignment align) /******* xxh64 *******/ /*! * @} - * @defgroup xxh64_impl XXH64 implementation + * @defgroup XXH64_impl XXH64 implementation * @ingroup impl + * + * Details on the XXH64 implementation. * @{ */ /* #define rather that static const, to be used as initializers */ @@ -2428,11 +3487,29 @@ XXH_readLE64_align(const void* ptr, XXH_alignment align) # define PRIME64_5 XXH_PRIME64_5 #endif +/*! @copydoc XXH32_round */ static xxh_u64 XXH64_round(xxh_u64 acc, xxh_u64 input) { acc += input * XXH_PRIME64_2; acc = XXH_rotl64(acc, 31); acc *= XXH_PRIME64_1; +#if (defined(__AVX512F__)) && !defined(XXH_ENABLE_AUTOVECTORIZE) + /* + * DISABLE AUTOVECTORIZATION: + * A compiler fence is used to prevent GCC and Clang from + * autovectorizing the XXH64 loop (pragmas and attributes don't work for some + * reason) without globally disabling AVX512. + * + * Autovectorization of XXH64 tends to be detrimental, + * though the exact outcome may change depending on exact cpu and compiler version. + * For information, it has been reported as detrimental for Skylake-X, + * but possibly beneficial for Zen4. + * + * The default is to disable auto-vectorization, + * but you can select to enable it instead using `XXH_ENABLE_AUTOVECTORIZE` build variable. + */ + XXH_COMPILER_GUARD(acc); +#endif return acc; } @@ -2444,43 +3521,138 @@ static xxh_u64 XXH64_mergeRound(xxh_u64 acc, xxh_u64 val) return acc; } -static xxh_u64 XXH64_avalanche(xxh_u64 h64) +/*! @copydoc XXH32_avalanche */ +static xxh_u64 XXH64_avalanche(xxh_u64 hash) { - h64 ^= h64 >> 33; - h64 *= XXH_PRIME64_2; - h64 ^= h64 >> 29; - h64 *= XXH_PRIME64_3; - h64 ^= h64 >> 32; - return h64; + hash ^= hash >> 33; + hash *= XXH_PRIME64_2; + hash ^= hash >> 29; + hash *= XXH_PRIME64_3; + hash ^= hash >> 32; + return hash; } #define XXH_get64bits(p) XXH_readLE64_align(p, align) -static xxh_u64 -XXH64_finalize(xxh_u64 h64, const xxh_u8* ptr, size_t len, XXH_alignment align) +/*! + * @internal + * @brief Sets up the initial accumulator state for XXH64(). + */ +XXH_FORCE_INLINE void +XXH64_initAccs(xxh_u64 *acc, xxh_u64 seed) +{ + XXH_ASSERT(acc != NULL); + acc[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2; + acc[1] = seed + XXH_PRIME64_2; + acc[2] = seed + 0; + acc[3] = seed - XXH_PRIME64_1; +} + +/*! + * @internal + * @brief Consumes a block of data for XXH64(). + * + * @return the end input pointer. + */ +XXH_FORCE_INLINE const xxh_u8 * +XXH64_consumeLong( + xxh_u64 *XXH_RESTRICT acc, + xxh_u8 const *XXH_RESTRICT input, + size_t len, + XXH_alignment align +) +{ + const xxh_u8* const bEnd = input + len; + const xxh_u8* const limit = bEnd - 31; + XXH_ASSERT(acc != NULL); + XXH_ASSERT(input != NULL); + XXH_ASSERT(len >= 32); + do { + /* reroll on 32-bit */ + if (sizeof(void *) < sizeof(xxh_u64)) { + size_t i; + for (i = 0; i < 4; i++) { + acc[i] = XXH64_round(acc[i], XXH_get64bits(input)); + input += 8; + } + } else { + acc[0] = XXH64_round(acc[0], XXH_get64bits(input)); input += 8; + acc[1] = XXH64_round(acc[1], XXH_get64bits(input)); input += 8; + acc[2] = XXH64_round(acc[2], XXH_get64bits(input)); input += 8; + acc[3] = XXH64_round(acc[3], XXH_get64bits(input)); input += 8; + } + } while (input < limit); + + return input; +} + +/*! + * @internal + * @brief Merges the accumulator lanes together for XXH64() + */ +XXH_FORCE_INLINE XXH_PUREF xxh_u64 +XXH64_mergeAccs(const xxh_u64 *acc) +{ + XXH_ASSERT(acc != NULL); + { + xxh_u64 h64 = XXH_rotl64(acc[0], 1) + XXH_rotl64(acc[1], 7) + + XXH_rotl64(acc[2], 12) + XXH_rotl64(acc[3], 18); + /* reroll on 32-bit */ + if (sizeof(void *) < sizeof(xxh_u64)) { + size_t i; + for (i = 0; i < 4; i++) { + h64 = XXH64_mergeRound(h64, acc[i]); + } + } else { + h64 = XXH64_mergeRound(h64, acc[0]); + h64 = XXH64_mergeRound(h64, acc[1]); + h64 = XXH64_mergeRound(h64, acc[2]); + h64 = XXH64_mergeRound(h64, acc[3]); + } + return h64; + } +} + +/*! + * @internal + * @brief Processes the last 0-31 bytes of @p ptr. + * + * There may be up to 31 bytes remaining to consume from the input. + * This final stage will digest them to ensure that all input bytes are present + * in the final mix. + * + * @param hash The hash to finalize. + * @param ptr The pointer to the remaining input. + * @param len The remaining length, modulo 32. + * @param align Whether @p ptr is aligned. + * @return The finalized hash + * @see XXH32_finalize(). + */ +XXH_STATIC XXH_PUREF xxh_u64 +XXH64_finalize(xxh_u64 hash, const xxh_u8* ptr, size_t len, XXH_alignment align) { if (ptr==NULL) XXH_ASSERT(len == 0); len &= 31; while (len >= 8) { xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr)); ptr += 8; - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * XXH_PRIME64_1 + XXH_PRIME64_4; + hash ^= k1; + hash = XXH_rotl64(hash,27) * XXH_PRIME64_1 + XXH_PRIME64_4; len -= 8; } if (len >= 4) { - h64 ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1; + hash ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1; ptr += 4; - h64 = XXH_rotl64(h64, 23) * XXH_PRIME64_2 + XXH_PRIME64_3; + hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3; len -= 4; } while (len > 0) { - h64 ^= (*ptr++) * XXH_PRIME64_5; - h64 = XXH_rotl64(h64, 11) * XXH_PRIME64_1; + hash ^= (*ptr++) * XXH_PRIME64_5; + hash = XXH_rotl64(hash, 11) * XXH_PRIME64_1; --len; } - return XXH64_avalanche(h64); + return XXH64_avalanche(hash); } #ifdef XXH_OLD_NAMES @@ -2493,33 +3665,27 @@ XXH64_finalize(xxh_u64 h64, const xxh_u8* ptr, size_t len, XXH_alignment align) # undef XXH_PROCESS8_64 #endif -XXH_FORCE_INLINE xxh_u64 +/*! + * @internal + * @brief The implementation for @ref XXH64(). + * + * @param input , len , seed Directly passed from @ref XXH64(). + * @param align Whether @p input is aligned. + * @return The calculated hash. + */ +XXH_FORCE_INLINE XXH_PUREF xxh_u64 XXH64_endian_align(const xxh_u8* input, size_t len, xxh_u64 seed, XXH_alignment align) { xxh_u64 h64; if (input==NULL) XXH_ASSERT(len == 0); - if (len>=32) { - const xxh_u8* const bEnd = input + len; - const xxh_u8* const limit = bEnd - 31; - xxh_u64 v1 = seed + XXH_PRIME64_1 + XXH_PRIME64_2; - xxh_u64 v2 = seed + XXH_PRIME64_2; - xxh_u64 v3 = seed + 0; - xxh_u64 v4 = seed - XXH_PRIME64_1; + if (len>=32) { /* Process a large block of data */ + xxh_u64 acc[4]; + XXH64_initAccs(acc, seed); - do { - v1 = XXH64_round(v1, XXH_get64bits(input)); input+=8; - v2 = XXH64_round(v2, XXH_get64bits(input)); input+=8; - v3 = XXH64_round(v3, XXH_get64bits(input)); input+=8; - v4 = XXH64_round(v4, XXH_get64bits(input)); input+=8; - } while (input= 2 /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ XXH64_state_t state; XXH64_reset(&state, seed); @@ -2551,84 +3717,73 @@ XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t len, XXH64_hash_t s } /******* Hash Streaming *******/ - -/*! @ingroup xxh64_family*/ +#ifndef XXH_NO_STREAM +/*! @ingroup XXH64_family*/ XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) { return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); } -/*! @ingroup xxh64_family */ +/*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) { XXH_free(statePtr); return XXH_OK; } -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dstState, const XXH64_state_t* srcState) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API void XXH64_copyState(XXH_NOESCAPE XXH64_state_t* dstState, const XXH64_state_t* srcState) { XXH_memcpy(dstState, srcState, sizeof(*dstState)); } -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, XXH64_hash_t seed) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH_NOESCAPE XXH64_state_t* statePtr, XXH64_hash_t seed) { - XXH64_state_t state; /* use a local state to memcpy() in order to avoid strict-aliasing warnings */ - memset(&state, 0, sizeof(state)); - state.v[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2; - state.v[1] = seed + XXH_PRIME64_2; - state.v[2] = seed + 0; - state.v[3] = seed - XXH_PRIME64_1; - /* do not write into reserved64, might be removed in a future version */ - XXH_memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved64)); + XXH_ASSERT(statePtr != NULL); + XXH_memset(statePtr, 0, sizeof(*statePtr)); + XXH64_initAccs(statePtr->acc, seed); return XXH_OK; } -/*! @ingroup xxh64_family */ +/*! @ingroup XXH64_family */ XXH_PUBLIC_API XXH_errorcode -XXH64_update (XXH64_state_t* state, const void* input, size_t len) +XXH64_update (XXH_NOESCAPE XXH64_state_t* state, XXH_NOESCAPE const void* input, size_t len) { if (input==NULL) { XXH_ASSERT(len == 0); return XXH_OK; } - { const xxh_u8* p = (const xxh_u8*)input; - const xxh_u8* const bEnd = p + len; + state->total_len += len; - state->total_len += len; + XXH_ASSERT(state->bufferedSize <= sizeof(state->buffer)); + if (len < sizeof(state->buffer) - state->bufferedSize) { /* fill in tmp buffer */ + XXH_memcpy(state->buffer + state->bufferedSize, input, len); + state->bufferedSize += (XXH32_hash_t)len; + return XXH_OK; + } - if (state->memsize + len < 32) { /* fill in tmp buffer */ - XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, len); - state->memsize += (xxh_u32)len; - return XXH_OK; - } + { const xxh_u8* xinput = (const xxh_u8*)input; + const xxh_u8* const bEnd = xinput + len; - if (state->memsize) { /* tmp buffer is full */ - XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize); - state->v[0] = XXH64_round(state->v[0], XXH_readLE64(state->mem64+0)); - state->v[1] = XXH64_round(state->v[1], XXH_readLE64(state->mem64+1)); - state->v[2] = XXH64_round(state->v[2], XXH_readLE64(state->mem64+2)); - state->v[3] = XXH64_round(state->v[3], XXH_readLE64(state->mem64+3)); - p += 32 - state->memsize; - state->memsize = 0; + if (state->bufferedSize) { /* non-empty buffer => complete first */ + XXH_memcpy(state->buffer + state->bufferedSize, xinput, sizeof(state->buffer) - state->bufferedSize); + xinput += sizeof(state->buffer) - state->bufferedSize; + /* and process one round */ + (void)XXH64_consumeLong(state->acc, state->buffer, sizeof(state->buffer), XXH_aligned); + state->bufferedSize = 0; } - if (p+32 <= bEnd) { - const xxh_u8* const limit = bEnd - 32; - - do { - state->v[0] = XXH64_round(state->v[0], XXH_readLE64(p)); p+=8; - state->v[1] = XXH64_round(state->v[1], XXH_readLE64(p)); p+=8; - state->v[2] = XXH64_round(state->v[2], XXH_readLE64(p)); p+=8; - state->v[3] = XXH64_round(state->v[3], XXH_readLE64(p)); p+=8; - } while (p<=limit); - + XXH_ASSERT(xinput <= bEnd); + if ((size_t)(bEnd - xinput) >= sizeof(state->buffer)) { + /* Process the remaining data */ + xinput = XXH64_consumeLong(state->acc, xinput, (size_t)(bEnd - xinput), XXH_unaligned); } - if (p < bEnd) { - XXH_memcpy(state->mem64, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); + if (xinput < bEnd) { + /* Copy the leftover to the tmp buffer */ + XXH_memcpy(state->buffer, xinput, (size_t)(bEnd-xinput)); + state->bufferedSize = (unsigned)(bEnd-xinput); } } @@ -2636,39 +3791,35 @@ XXH64_update (XXH64_state_t* state, const void* input, size_t len) } -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API XXH64_hash_t XXH64_digest(const XXH64_state_t* state) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API XXH64_hash_t XXH64_digest(XXH_NOESCAPE const XXH64_state_t* state) { xxh_u64 h64; if (state->total_len >= 32) { - h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18); - h64 = XXH64_mergeRound(h64, state->v[0]); - h64 = XXH64_mergeRound(h64, state->v[1]); - h64 = XXH64_mergeRound(h64, state->v[2]); - h64 = XXH64_mergeRound(h64, state->v[3]); + h64 = XXH64_mergeAccs(state->acc); } else { - h64 = state->v[2] /*seed*/ + XXH_PRIME64_5; + h64 = state->acc[2] /*seed*/ + XXH_PRIME64_5; } h64 += (xxh_u64) state->total_len; - return XXH64_finalize(h64, (const xxh_u8*)state->mem64, (size_t)state->total_len, XXH_aligned); + return XXH64_finalize(h64, state->buffer, (size_t)state->total_len, XXH_aligned); } - +#endif /* !XXH_NO_STREAM */ /******* Canonical representation *******/ -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH_NOESCAPE XXH64_canonical_t* dst, XXH64_hash_t hash) { XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); XXH_memcpy(dst, &hash, sizeof(*dst)); } -/*! @ingroup xxh64_family */ -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) +/*! @ingroup XXH64_family */ +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(XXH_NOESCAPE const XXH64_canonical_t* src) { return XXH_readBE64(src); } @@ -2681,21 +3832,13 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src ************************************************************************ */ /*! * @} - * @defgroup xxh3_impl XXH3 implementation + * @defgroup XXH3_impl XXH3 implementation * @ingroup impl * @{ */ /* === Compiler specifics === */ -#if ((defined(sun) || defined(__sun)) && __cplusplus) /* Solaris includes __STDC_VERSION__ with C++. Tested with GCC 5.5 */ -# define XXH_RESTRICT /* disable */ -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* >= C99 */ -# define XXH_RESTRICT restrict -#else -/* Note: it might be useful to define __restrict or __restrict__ for some C++ compilers */ -# define XXH_RESTRICT /* disable */ -#endif #if (defined(__GNUC__) && (__GNUC__ >= 3)) \ || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) \ @@ -2707,17 +3850,42 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src # define XXH_unlikely(x) (x) #endif -#if defined(__GNUC__) -# if defined(__AVX2__) -# include -# elif defined(__SSE2__) -# include -# elif defined(__ARM_NEON__) || defined(__ARM_NEON) +#ifndef XXH_HAS_INCLUDE +# ifdef __has_include +/* + * Not defined as XXH_HAS_INCLUDE(x) (function-like) because + * this causes segfaults in Apple Clang 4.2 (on Mac OS X 10.7 Lion) + */ +# define XXH_HAS_INCLUDE __has_include +# else +# define XXH_HAS_INCLUDE(x) 0 +# endif +#endif + +#if defined(__GNUC__) || defined(__clang__) +# if defined(__ARM_FEATURE_SVE) +# include +# endif +# if defined(__ARM_NEON__) || defined(__ARM_NEON) \ + || (defined(_M_ARM) && _M_ARM >= 7) \ + || defined(_M_ARM64) || defined(_M_ARM64EC) \ + || (defined(__wasm_simd128__) && XXH_HAS_INCLUDE()) /* WASM SIMD128 via SIMDe */ # define inline __inline__ /* circumvent a clang bug */ # include # undef inline +# elif defined(__AVX2__) +# include +# elif defined(__SSE2__) +# include +# elif defined(__loongarch_asx) +# include +# include +# elif defined(__loongarch_sx) +# include # endif -#elif defined(_MSC_VER) +#endif + +#if defined(_MSC_VER) # include #endif @@ -2803,40 +3971,18 @@ XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src * @ingroup tuning * @brief Overrides the vectorization implementation chosen for XXH3. * - * Can be defined to 0 to disable SIMD or any of the values mentioned in - * @ref XXH_VECTOR_TYPE. + * Can be defined to 0 to disable SIMD, + * or any other authorized value of @ref XXH_VECTOR. * * If this is not defined, it uses predefined macros to determine the best * implementation. */ # define XXH_VECTOR XXH_SCALAR -/*! - * @ingroup tuning - * @brief Possible values for @ref XXH_VECTOR. - * - * Note that these are actually implemented as macros. - * - * If this is not defined, it is detected automatically. - * @ref XXH_X86DISPATCH overrides this. - */ -enum XXH_VECTOR_TYPE /* fake enum */ { - XXH_SCALAR = 0, /*!< Portable scalar version */ - XXH_SSE2 = 1, /*!< - * SSE2 for Pentium 4, Opteron, all x86_64. - * - * @note SSE2 is also guaranteed on Windows 10, macOS, and - * Android x86. - */ - XXH_AVX2 = 2, /*!< AVX2 for Haswell and Bulldozer */ - XXH_AVX512 = 3, /*!< AVX512 for Skylake and Icelake */ - XXH_NEON = 4, /*!< NEON for most ARMv7-A and all AArch64 */ - XXH_VSX = 5, /*!< VSX and ZVector for POWER8/z13 (64-bit) */ -}; /*! * @ingroup tuning * @brief Selects the minimum alignment for XXH3's accumulators. * - * When using SIMD, this should match the alignment reqired for said vector + * When using SIMD, this should match the alignment required for said vector * type, so, for example, 32 for AVX2. * * Default: Auto detected. @@ -2846,36 +3992,48 @@ enum XXH_VECTOR_TYPE /* fake enum */ { /* Actual definition */ #ifndef XXH_DOXYGEN -# define XXH_SCALAR 0 -# define XXH_SSE2 1 -# define XXH_AVX2 2 -# define XXH_AVX512 3 -# define XXH_NEON 4 -# define XXH_VSX 5 #endif #ifndef XXH_VECTOR /* can be defined on command line */ -# if defined(__AVX512F__) -# define XXH_VECTOR XXH_AVX512 -# elif defined(__AVX2__) -# define XXH_VECTOR XXH_AVX2 -# elif defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP == 2)) -# define XXH_VECTOR XXH_SSE2 +# if defined(__ARM_FEATURE_SVE) +# define XXH_VECTOR XXH_SVE # elif ( \ defined(__ARM_NEON__) || defined(__ARM_NEON) /* gcc */ \ - || defined(_M_ARM64) || defined(_M_ARM_ARMV7VE) /* msvc */ \ + || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) /* msvc */ \ + || (defined(__wasm_simd128__) && XXH_HAS_INCLUDE()) /* wasm simd128 via SIMDe */ \ ) && ( \ defined(_WIN32) || defined(__LITTLE_ENDIAN__) /* little endian only */ \ || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \ ) # define XXH_VECTOR XXH_NEON +# elif defined(__AVX512F__) +# define XXH_VECTOR XXH_AVX512 +# elif defined(__AVX2__) +# define XXH_VECTOR XXH_AVX2 +# elif defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP == 2)) +# define XXH_VECTOR XXH_SSE2 # elif (defined(__PPC64__) && defined(__POWER8_VECTOR__)) \ || (defined(__s390x__) && defined(__VEC__)) \ && defined(__GNUC__) /* TODO: IBM XL */ # define XXH_VECTOR XXH_VSX +# elif defined(__loongarch_asx) +# define XXH_VECTOR XXH_LASX +# elif defined(__loongarch_sx) +# define XXH_VECTOR XXH_LSX +# else +# define XXH_VECTOR XXH_SCALAR +# endif +#endif + +/* __ARM_FEATURE_SVE is only supported by GCC & Clang. */ +#if (XXH_VECTOR == XXH_SVE) && !defined(__ARM_FEATURE_SVE) +# ifdef _MSC_VER +# pragma warning(once : 4606) # else -# define XXH_VECTOR XXH_SCALAR +# warning "__ARM_FEATURE_SVE isn't supported. Use SCALAR instead." # endif +# undef XXH_VECTOR +# define XXH_VECTOR XXH_SCALAR #endif /* @@ -2897,16 +4055,30 @@ enum XXH_VECTOR_TYPE /* fake enum */ { # define XXH_ACC_ALIGN 16 # elif XXH_VECTOR == XXH_AVX512 /* avx512 */ # define XXH_ACC_ALIGN 64 +# elif XXH_VECTOR == XXH_SVE /* sve */ +# define XXH_ACC_ALIGN 64 +# elif XXH_VECTOR == XXH_LASX /* lasx */ +# define XXH_ACC_ALIGN 64 +# elif XXH_VECTOR == XXH_LSX /* lsx */ +# define XXH_ACC_ALIGN 64 # endif #endif #if defined(XXH_X86DISPATCH) || XXH_VECTOR == XXH_SSE2 \ || XXH_VECTOR == XXH_AVX2 || XXH_VECTOR == XXH_AVX512 # define XXH_SEC_ALIGN XXH_ACC_ALIGN +#elif XXH_VECTOR == XXH_SVE +# define XXH_SEC_ALIGN XXH_ACC_ALIGN #else # define XXH_SEC_ALIGN 8 #endif +#if defined(__GNUC__) || defined(__clang__) +# define XXH_ALIASING __attribute__((__may_alias__)) +#else +# define XXH_ALIASING /* nothing */ +#endif + /* * UGLY HACK: * GCC usually generates the best code with -O3 for xxHash. @@ -2930,111 +4102,130 @@ enum XXH_VECTOR_TYPE /* fake enum */ { */ #if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ - && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ + && defined(__OPTIMIZE__) && XXH_SIZE_OPT <= 0 /* respect -O0 and -Os */ # pragma GCC push_options # pragma GCC optimize("-O2") #endif - #if XXH_VECTOR == XXH_NEON + /* - * NEON's setup for vmlal_u32 is a little more complicated than it is on - * SSE2, AVX2, and VSX. - * - * While PMULUDQ and VMULEUW both perform a mask, VMLAL.U32 performs an upcast. - * - * To do the same operation, the 128-bit 'Q' register needs to be split into - * two 64-bit 'D' registers, performing this operation:: - * - * [ a | b ] - * | '---------. .--------' | - * | x | - * | .---------' '--------. | - * [ a & 0xFFFFFFFF | b & 0xFFFFFFFF ],[ a >> 32 | b >> 32 ] + * UGLY HACK: While AArch64 GCC on Linux does not seem to care, on macOS, GCC -O3 + * optimizes out the entire hashLong loop because of the aliasing violation. * - * Due to significant changes in aarch64, the fastest method for aarch64 is - * completely different than the fastest method for ARMv7-A. - * - * ARMv7-A treats D registers as unions overlaying Q registers, so modifying - * D11 will modify the high half of Q5. This is similar to how modifying AH - * will only affect bits 8-15 of AX on x86. - * - * VZIP takes two registers, and puts even lanes in one register and odd lanes - * in the other. + * However, GCC is also inefficient at load-store optimization with vld1q/vst1q, + * so the only option is to mark it as aliasing. + */ +typedef uint64x2_t xxh_aliasing_uint64x2_t XXH_ALIASING; + +/*! + * @internal + * @brief `vld1q_u64` but faster and alignment-safe. * - * On ARMv7-A, this strangely modifies both parameters in place instead of - * taking the usual 3-operand form. + * On AArch64, unaligned access is always safe, but on ARMv7-a, it is only + * *conditionally* safe (`vld1` has an alignment bit like `movdq[ua]` in x86). * - * Therefore, if we want to do this, we can simply use a D-form VZIP.32 on the - * lower and upper halves of the Q register to end up with the high and low - * halves where we want - all in one instruction. + * GCC for AArch64 sees `vld1q_u8` as an intrinsic instead of a load, so it + * prohibits load-store optimizations. Therefore, a direct dereference is used. * - * vzip.32 d10, d11 @ d10 = { d10[0], d11[0] }; d11 = { d10[1], d11[1] } + * Otherwise, `vld1q_u8` is used with `vreinterpretq_u8_u64` to do a safe + * unaligned load. + */ +#if defined(__aarch64__) && defined(__GNUC__) && !defined(__clang__) +XXH_FORCE_INLINE uint64x2_t XXH_vld1q_u64(void const* ptr) /* silence -Wcast-align */ +{ + return *(xxh_aliasing_uint64x2_t const *)ptr; +} +#else +XXH_FORCE_INLINE uint64x2_t XXH_vld1q_u64(void const* ptr) +{ + return vreinterpretq_u64_u8(vld1q_u8((uint8_t const*)ptr)); +} +#endif + +/*! + * @internal + * @brief `vmlal_u32` on low and high halves of a vector. * - * Unfortunately we need inline assembly for this: Instructions modifying two - * registers at once is not possible in GCC or Clang's IR, and they have to - * create a copy. + * This is a workaround for AArch64 GCC < 11 which implemented arm_neon.h with + * inline assembly and were therefore incapable of merging the `vget_{low, high}_u32` + * with `vmlal_u32`. + */ +#if defined(__aarch64__) && defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 11 +XXH_FORCE_INLINE uint64x2_t +XXH_vmlal_low_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) +{ + /* Inline assembly is the only way */ + __asm__("umlal %0.2d, %1.2s, %2.2s" : "+w" (acc) : "w" (lhs), "w" (rhs)); + return acc; +} +XXH_FORCE_INLINE uint64x2_t +XXH_vmlal_high_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) +{ + /* This intrinsic works as expected */ + return vmlal_high_u32(acc, lhs, rhs); +} +#else +/* Portable intrinsic versions */ +XXH_FORCE_INLINE uint64x2_t +XXH_vmlal_low_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) +{ + return vmlal_u32(acc, vget_low_u32(lhs), vget_low_u32(rhs)); +} +/*! @copydoc XXH_vmlal_low_u32 + * Assume the compiler converts this to vmlal_high_u32 on aarch64 */ +XXH_FORCE_INLINE uint64x2_t +XXH_vmlal_high_u32(uint64x2_t acc, uint32x4_t lhs, uint32x4_t rhs) +{ + return vmlal_u32(acc, vget_high_u32(lhs), vget_high_u32(rhs)); +} +#endif + +/*! + * @ingroup tuning + * @brief Controls the NEON to scalar ratio for XXH3 * - * aarch64 requires a different approach. + * This can be set to 2, 4, 6, or 8. * - * In order to make it easier to write a decent compiler for aarch64, many - * quirks were removed, such as conditional execution. + * ARM Cortex CPUs are _very_ sensitive to how their pipelines are used. * - * NEON was also affected by this. + * For example, the Cortex-A73 can dispatch 3 micro-ops per cycle, but only 2 of those + * can be NEON. If you are only using NEON instructions, you are only using 2/3 of the CPU + * bandwidth. * - * aarch64 cannot access the high bits of a Q-form register, and writes to a - * D-form register zero the high bits, similar to how writes to W-form scalar - * registers (or DWORD registers on x86_64) work. + * This is even more noticeable on the more advanced cores like the Cortex-A76 which + * can dispatch 8 micro-ops per cycle, but still only 2 NEON micro-ops at once. * - * The formerly free vget_high intrinsics now require a vext (with a few - * exceptions) + * Therefore, to make the most out of the pipeline, it is beneficial to run 6 NEON lanes + * and 2 scalar lanes, which is chosen by default. * - * Additionally, VZIP was replaced by ZIP1 and ZIP2, which are the equivalent - * of PUNPCKL* and PUNPCKH* in SSE, respectively, in order to only modify one - * operand. + * This does not apply to Apple processors or 32-bit processors, which run better with + * full NEON. These will default to 8. Additionally, size-optimized builds run 8 lanes. * - * The equivalent of the VZIP.32 on the lower and upper halves would be this - * mess: + * This change benefits CPUs with large micro-op buffers without negatively affecting + * most other CPUs: * - * ext v2.4s, v0.4s, v0.4s, #2 // v2 = { v0[2], v0[3], v0[0], v0[1] } - * zip1 v1.2s, v0.2s, v2.2s // v1 = { v0[0], v2[0] } - * zip2 v0.2s, v0.2s, v1.2s // v0 = { v0[1], v2[1] } + * | Chipset | Dispatch type | NEON only | 6:2 hybrid | Diff. | + * |:----------------------|:--------------------|----------:|-----------:|------:| + * | Snapdragon 730 (A76) | 2 NEON/8 micro-ops | 8.8 GB/s | 10.1 GB/s | ~16% | + * | Snapdragon 835 (A73) | 2 NEON/3 micro-ops | 5.1 GB/s | 5.3 GB/s | ~5% | + * | Marvell PXA1928 (A53) | In-order dual-issue | 1.9 GB/s | 1.9 GB/s | 0% | + * | Apple M1 | 4 NEON/8 micro-ops | 37.3 GB/s | 36.1 GB/s | ~-3% | * - * Instead, we use a literal downcast, vmovn_u64 (XTN), and vshrn_n_u64 (SHRN): + * It also seems to fix some bad codegen on GCC, making it almost as fast as clang. * - * shrn v1.2s, v0.2d, #32 // v1 = (uint32x2_t)(v0 >> 32); - * xtn v0.2s, v0.2d // v0 = (uint32x2_t)(v0 & 0xFFFFFFFF); + * When using WASM SIMD128, if this is 2 or 6, SIMDe will scalarize 2 of the lanes meaning + * it effectively becomes worse 4. * - * This is available on ARMv7-A, but is less efficient than a single VZIP.32. - */ - -/*! - * Function-like macro: - * void XXH_SPLIT_IN_PLACE(uint64x2_t &in, uint32x2_t &outLo, uint32x2_t &outHi) - * { - * outLo = (uint32x2_t)(in & 0xFFFFFFFF); - * outHi = (uint32x2_t)(in >> 32); - * in = UNDEFINED; - * } + * @see XXH3_accumulate_512_neon() */ -# if !defined(XXH_NO_VZIP_HACK) /* define to disable */ \ - && defined(__GNUC__) \ - && !defined(__aarch64__) && !defined(__arm64__) && !defined(_M_ARM64) -# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ - do { \ - /* Undocumented GCC/Clang operand modifier: %e0 = lower D half, %f0 = upper D half */ \ - /* https://github.com/gcc-mirror/gcc/blob/38cf91e5/gcc/config/arm/arm.c#L22486 */ \ - /* https://github.com/llvm-mirror/llvm/blob/2c4ca683/lib/Target/ARM/ARMAsmPrinter.cpp#L399 */ \ - __asm__("vzip.32 %e0, %f0" : "+w" (in)); \ - (outLo) = vget_low_u32 (vreinterpretq_u32_u64(in)); \ - (outHi) = vget_high_u32(vreinterpretq_u32_u64(in)); \ - } while (0) -# else -# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ - do { \ - (outLo) = vmovn_u64 (in); \ - (outHi) = vshrn_n_u64 ((in), 32); \ - } while (0) +# ifndef XXH3_NEON_LANES +# if (defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) || defined(_M_ARM64EC)) \ + && !defined(__APPLE__) && XXH_SIZE_OPT <= 0 +# define XXH3_NEON_LANES 6 +# else +# define XXH3_NEON_LANES XXH_ACC_NB +# endif # endif #endif /* XXH_VECTOR == XXH_NEON */ @@ -3047,27 +4238,42 @@ enum XXH_VECTOR_TYPE /* fake enum */ { * inconsistent intrinsics, spotty coverage, and multiple endiannesses. */ #if XXH_VECTOR == XXH_VSX +/* Annoyingly, these headers _may_ define three macros: `bool`, `vector`, + * and `pixel`. This is a problem for obvious reasons. + * + * These keywords are unnecessary; the spec literally says they are + * equivalent to `__bool`, `__vector`, and `__pixel` and may be undef'd + * after including the header. + * + * We use pragma push_macro/pop_macro to keep the namespace clean. */ +# pragma push_macro("bool") +# pragma push_macro("vector") +# pragma push_macro("pixel") +/* silence potential macro redefined warnings */ +# undef bool +# undef vector +# undef pixel + # if defined(__s390x__) # include # else -/* gcc's altivec.h can have the unwanted consequence to unconditionally - * #define bool, vector, and pixel keywords, - * with bad consequences for programs already using these keywords for other purposes. - * The paragraph defining these macros is skipped when __APPLE_ALTIVEC__ is defined. - * __APPLE_ALTIVEC__ is _generally_ defined automatically by the compiler, - * but it seems that, in some cases, it isn't. - * Force the build macro to be defined, so that keywords are not altered. - */ -# if defined(__GNUC__) && !defined(__APPLE_ALTIVEC__) -# define __APPLE_ALTIVEC__ -# endif # include # endif +/* Restore the original macro values, if applicable. */ +# pragma pop_macro("pixel") +# pragma pop_macro("vector") +# pragma pop_macro("bool") + typedef __vector unsigned long long xxh_u64x2; typedef __vector unsigned char xxh_u8x16; typedef __vector unsigned xxh_u32x4; +/* + * UGLY HACK: Similar to aarch64 macOS GCC, s390x GCC has the same aliasing issue. + */ +typedef xxh_u64x2 xxh_aliasing_u64x2 XXH_ALIASING; + # ifndef XXH_VSX_BE # if defined(__BIG_ENDIAN__) \ || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) @@ -3119,8 +4325,9 @@ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_loadu(const void *ptr) /* s390x is always big endian, no issue on this platform */ # define XXH_vec_mulo vec_mulo # define XXH_vec_mule vec_mule -# elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) +# elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) && !defined(__ibmxl__) /* Clang has a better way to control this, we can just use the builtin which doesn't swap. */ + /* The IBM XL Compiler (which defined __clang__) only implements the vec_* operations */ # define XXH_vec_mulo __builtin_altivec_vmulouw # define XXH_vec_mule __builtin_altivec_vmuleuw # else @@ -3141,13 +4348,28 @@ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b) # endif /* XXH_vec_mulo, XXH_vec_mule */ #endif /* XXH_VECTOR == XXH_VSX */ +#if XXH_VECTOR == XXH_SVE +#define ACCRND(acc, offset) \ +do { \ + svuint64_t input_vec = svld1_u64(mask, xinput + offset); \ + svuint64_t secret_vec = svld1_u64(mask, xsecret + offset); \ + svuint64_t mixed = sveor_u64_x(mask, secret_vec, input_vec); \ + svuint64_t swapped = svtbl_u64(input_vec, kSwap); \ + svuint64_t mixed_lo = svextw_u64_x(mask, mixed); \ + svuint64_t mixed_hi = svlsr_n_u64_x(mask, mixed, 32); \ + svuint64_t mul = svmad_u64_x(mask, mixed_lo, mixed_hi, swapped); \ + acc = svadd_u64_x(mask, acc, mul); \ +} while (0) +#endif /* XXH_VECTOR == XXH_SVE */ /* prefetch * can be disabled, by declaring XXH_NO_PREFETCH build macro */ #if defined(XXH_NO_PREFETCH) # define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ #else -# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) /* _mm_prefetch() not defined outside of x86/x64 */ +# if XXH_SIZE_OPT >= 1 +# define XXH_PREFETCH(ptr) (void)(ptr) +# elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) /* _mm_prefetch() not defined outside of x86/x64 */ # include /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ # define XXH_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) # elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) ) @@ -3168,7 +4390,10 @@ XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b) # error "default keyset is not large enough" #endif -/*! Pseudorandom secret taken directly from FARSH. */ +/*! + * @internal + * @def XXH3_kSecret + * @brief Pseudorandom secret taken directly from FARSH. */ XXH_ALIGN(64) static const xxh_u8 XXH3_kSecret[XXH_SECRET_DEFAULT_SIZE] = { 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c, 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f, @@ -3184,6 +4409,8 @@ XXH_ALIGN(64) static const xxh_u8 XXH3_kSecret[XXH_SECRET_DEFAULT_SIZE] = { 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, }; +static const xxh_u64 PRIME_MX1 = 0x165667919E3779F9ULL; /*!< 0b0001011001010110011001111001000110011110001101110111100111111001 */ +static const xxh_u64 PRIME_MX2 = 0x9FB21C651E98DF25ULL; /*!< 0b1001111110110010000111000110010100011110100110001101111100100101 */ #ifdef XXH_OLD_NAMES # define kSecret XXH3_kSecret @@ -3212,7 +4439,6 @@ XXH_mult32to64(xxh_u64 x, xxh_u64 y) return (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF); } #elif defined(_MSC_VER) && defined(_M_IX86) -# include # define XXH_mult32to64(x, y) __emulu((unsigned)(x), (unsigned)(y)) #else /* @@ -3252,7 +4478,7 @@ XXH_mult64to128(xxh_u64 lhs, xxh_u64 rhs) * In that case it is best to use the portable one. * https://github.com/Cyan4973/xxHash/issues/211#issuecomment-515575677 */ -#if defined(__GNUC__) && !defined(__wasm__) \ +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__wasm__) \ && defined(__SIZEOF_INT128__) \ || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) @@ -3269,7 +4495,7 @@ XXH_mult64to128(xxh_u64 lhs, xxh_u64 rhs) * * This compiles to single operand MUL on x64. */ -#elif defined(_M_X64) || defined(_M_IA64) +#elif (defined(_M_X64) || defined(_M_IA64)) && !defined(_M_ARM64EC) #ifndef _MSC_VER # pragma intrinsic(_umul128) @@ -3286,7 +4512,7 @@ XXH_mult64to128(xxh_u64 lhs, xxh_u64 rhs) * * This compiles to the same MUL + UMULH as GCC/Clang's __uint128_t method. */ -#elif defined(_M_ARM64) +#elif defined(_M_ARM64) || defined(_M_ARM64EC) #ifndef _MSC_VER # pragma intrinsic(__umulh) @@ -3376,7 +4602,7 @@ XXH3_mul128_fold64(xxh_u64 lhs, xxh_u64 rhs) } /*! Seems to produce slightly better code on GCC for some reason. */ -XXH_FORCE_INLINE xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) +XXH_FORCE_INLINE XXH_CONSTF xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) { XXH_ASSERT(0 <= shift && shift < 64); return v64 ^ (v64 >> shift); @@ -3389,7 +4615,7 @@ XXH_FORCE_INLINE xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) static XXH64_hash_t XXH3_avalanche(xxh_u64 h64) { h64 = XXH_xorshift64(h64, 37); - h64 *= 0x165667919E3779F9ULL; + h64 *= PRIME_MX1; h64 = XXH_xorshift64(h64, 32); return h64; } @@ -3403,9 +4629,9 @@ static XXH64_hash_t XXH3_rrmxmx(xxh_u64 h64, xxh_u64 len) { /* this mix is inspired by Pelle Evensen's rrmxmx */ h64 ^= XXH_rotl64(h64, 49) ^ XXH_rotl64(h64, 24); - h64 *= 0x9FB21C651E98DF25ULL; + h64 *= PRIME_MX2; h64 ^= (h64 >> 35) + len ; - h64 *= 0x9FB21C651E98DF25ULL; + h64 *= PRIME_MX2; return XXH_xorshift64(h64, 28); } @@ -3443,7 +4669,7 @@ static XXH64_hash_t XXH3_rrmxmx(xxh_u64 h64, xxh_u64 len) * * This adds an extra layer of strength for custom secrets. */ -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_1to3_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -3465,7 +4691,7 @@ XXH3_len_1to3_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_h } } -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -3481,7 +4707,7 @@ XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_h } } -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -3498,7 +4724,7 @@ XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_ } } -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_0to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(len <= 16); @@ -3568,7 +4794,7 @@ XXH_FORCE_INLINE xxh_u64 XXH3_mix16B(const xxh_u8* XXH_RESTRICT input, } /* For mid range keys, XXH3 uses a Mum-hash variant. */ -XXH_FORCE_INLINE XXH64_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH64_hash_t XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) @@ -3577,6 +4803,14 @@ XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, XXH_ASSERT(16 < len && len <= 128); { xxh_u64 acc = len * XXH_PRIME64_1; +#if XXH_SIZE_OPT >= 1 + /* Smaller and cleaner, but slightly slower. */ + unsigned int i = (unsigned int)(len - 1) / 32; + do { + acc += XXH3_mix16B(input+16 * i, secret+32*i, seed); + acc += XXH3_mix16B(input+len-16*(i+1), secret+32*i+16, seed); + } while (i-- != 0); +#else if (len > 32) { if (len > 64) { if (len > 96) { @@ -3591,14 +4825,12 @@ XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, } acc += XXH3_mix16B(input+0, secret+0, seed); acc += XXH3_mix16B(input+len-16, secret+16, seed); - +#endif return XXH3_avalanche(acc); } } -#define XXH3_MIDSIZE_MAX 240 - -XXH_NO_INLINE XXH64_hash_t +XXH_NO_INLINE XXH_PUREF XXH64_hash_t XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) @@ -3610,13 +4842,17 @@ XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, #define XXH3_MIDSIZE_LASTOFFSET 17 { xxh_u64 acc = len * XXH_PRIME64_1; - int const nbRounds = (int)len / 16; - int i; + xxh_u64 acc_end; + unsigned int const nbRounds = (unsigned int)len / 16; + unsigned int i; + XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); for (i=0; i<8; i++) { acc += XXH3_mix16B(input+(16*i), secret+(16*i), seed); } - acc = XXH3_avalanche(acc); + /* last bytes */ + acc_end = XXH3_mix16B(input + len - 16, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET, seed); XXH_ASSERT(nbRounds >= 8); + acc = XXH3_avalanche(acc); #if defined(__clang__) /* Clang */ \ && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ @@ -3643,11 +4879,13 @@ XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, #pragma clang loop vectorize(disable) #endif for (i=8 ; i < nbRounds; i++) { - acc += XXH3_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3_MIDSIZE_STARTOFFSET, seed); + /* + * Prevents clang for unrolling the acc loop and interleaving with this one. + */ + XXH_COMPILER_GUARD(acc); + acc_end += XXH3_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3_MIDSIZE_STARTOFFSET, seed); } - /* last bytes */ - acc += XXH3_mix16B(input + len - 16, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET, seed); - return XXH3_avalanche(acc); + return XXH3_avalanche(acc + acc_end); } } @@ -3663,6 +4901,47 @@ XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, # define ACC_NB XXH_ACC_NB #endif +#ifndef XXH_PREFETCH_DIST +# ifdef __clang__ +# define XXH_PREFETCH_DIST 320 +# else +# if (XXH_VECTOR == XXH_AVX512) +# define XXH_PREFETCH_DIST 512 +# else +# define XXH_PREFETCH_DIST 384 +# endif +# endif /* __clang__ */ +#endif /* XXH_PREFETCH_DIST */ + +/* + * These macros are to generate an XXH3_accumulate() function. + * The two arguments select the name suffix and target attribute. + * + * The name of this symbol is XXH3_accumulate_() and it calls + * XXH3_accumulate_512_(). + * + * It may be useful to hand implement this function if the compiler fails to + * optimize the inline function. + */ +#define XXH3_ACCUMULATE_TEMPLATE(name) \ +void \ +XXH3_accumulate_##name(xxh_u64* XXH_RESTRICT acc, \ + const xxh_u8* XXH_RESTRICT input, \ + const xxh_u8* XXH_RESTRICT secret, \ + size_t nbStripes) \ +{ \ + size_t n; \ + for (n = 0; n < nbStripes; n++ ) { \ + const xxh_u8* const in = input + n*XXH_STRIPE_LEN; \ + XXH_PREFETCH(in + XXH_PREFETCH_DIST); \ + XXH3_accumulate_512_##name( \ + acc, \ + in, \ + secret + n*XXH_SECRET_CONSUME_RATE); \ + } \ +} + + XXH_FORCE_INLINE void XXH_writeLE64(void* dst, xxh_u64 v64) { if (!XXH_CPU_LITTLE_ENDIAN) v64 = XXH_swap64(v64); @@ -3683,6 +4962,7 @@ XXH_FORCE_INLINE void XXH_writeLE64(void* dst, xxh_u64 v64) typedef long long xxh_i64; #endif + /* * XXH3_accumulate_512 is the tightest loop for long inputs, and it is the most optimized. * @@ -3730,7 +5010,7 @@ XXH3_accumulate_512_avx512(void* XXH_RESTRICT acc, /* data_key = data_vec ^ key_vec; */ __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); /* data_key_lo = data_key >> 32; */ - __m512i const data_key_lo = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + __m512i const data_key_lo = _mm512_srli_epi64 (data_key, 32); /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ __m512i const product = _mm512_mul_epu32 (data_key, data_key_lo); /* xacc[0] += swap(data_vec); */ @@ -3740,6 +5020,7 @@ XXH3_accumulate_512_avx512(void* XXH_RESTRICT acc, *xacc = _mm512_add_epi64(product, sum); } } +XXH_FORCE_INLINE XXH_TARGET_AVX512 XXH3_ACCUMULATE_TEMPLATE(avx512) /* * XXH3_scrambleAcc: Scrambles the accumulators to improve mixing. @@ -3773,13 +5054,12 @@ XXH3_scrambleAcc_avx512(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) /* xacc[0] ^= (xacc[0] >> 47) */ __m512i const acc_vec = *xacc; __m512i const shifted = _mm512_srli_epi64 (acc_vec, 47); - __m512i const data_vec = _mm512_xor_si512 (acc_vec, shifted); /* xacc[0] ^= secret; */ __m512i const key_vec = _mm512_loadu_si512 (secret); - __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); + __m512i const data_key = _mm512_ternarylogic_epi32(key_vec, acc_vec, shifted, 0x96 /* key_vec ^ acc_vec ^ shifted */); /* xacc[0] *= XXH_PRIME32_1; */ - __m512i const data_key_hi = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + __m512i const data_key_hi = _mm512_srli_epi64 (data_key, 32); __m512i const prod_lo = _mm512_mul_epu32 (data_key, prime32); __m512i const prod_hi = _mm512_mul_epu32 (data_key_hi, prime32); *xacc = _mm512_add_epi64(prod_lo, _mm512_slli_epi64(prod_hi, 32)); @@ -3794,7 +5074,8 @@ XXH3_initCustomSecret_avx512(void* XXH_RESTRICT customSecret, xxh_u64 seed64) XXH_ASSERT(((size_t)customSecret & 63) == 0); (void)(&XXH_writeLE64); { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m512i); - __m512i const seed = _mm512_mask_set1_epi64(_mm512_set1_epi64((xxh_i64)seed64), 0xAA, (xxh_i64)(0U - seed64)); + __m512i const seed_pos = _mm512_set1_epi64((xxh_i64)seed64); + __m512i const seed = _mm512_mask_sub_epi64(seed_pos, 0xAA, _mm512_set1_epi8(0), seed_pos); const __m512i* const src = (const __m512i*) ((const void*) XXH3_kSecret); __m512i* const dest = ( __m512i*) customSecret; @@ -3802,14 +5083,7 @@ XXH3_initCustomSecret_avx512(void* XXH_RESTRICT customSecret, xxh_u64 seed64) XXH_ASSERT(((size_t)src & 63) == 0); /* control alignment */ XXH_ASSERT(((size_t)dest & 63) == 0); for (i=0; i < nbRounds; ++i) { - /* GCC has a bug, _mm512_stream_load_si512 accepts 'void*', not 'void const*', - * this will warn "discards 'const' qualifier". */ - union { - const __m512i* cp; - void* p; - } remote_const_void; - remote_const_void.cp = src + i; - dest[i] = _mm512_add_epi64(_mm512_stream_load_si512(remote_const_void.p), seed); + dest[i] = _mm512_add_epi64(_mm512_load_si512(src + i), seed); } } } @@ -3845,7 +5119,7 @@ XXH3_accumulate_512_avx2( void* XXH_RESTRICT acc, /* data_key = data_vec ^ key_vec; */ __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); /* data_key_lo = data_key >> 32; */ - __m256i const data_key_lo = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m256i const data_key_lo = _mm256_srli_epi64 (data_key, 32); /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ __m256i const product = _mm256_mul_epu32 (data_key, data_key_lo); /* xacc[i] += swap(data_vec); */ @@ -3855,6 +5129,7 @@ XXH3_accumulate_512_avx2( void* XXH_RESTRICT acc, xacc[i] = _mm256_add_epi64(product, sum); } } } +XXH_FORCE_INLINE XXH_TARGET_AVX2 XXH3_ACCUMULATE_TEMPLATE(avx2) XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_scrambleAcc_avx2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) @@ -3877,7 +5152,7 @@ XXH3_scrambleAcc_avx2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); /* xacc[i] *= XXH_PRIME32_1; */ - __m256i const data_key_hi = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m256i const data_key_hi = _mm256_srli_epi64 (data_key, 32); __m256i const prod_lo = _mm256_mul_epu32 (data_key, prime32); __m256i const prod_hi = _mm256_mul_epu32 (data_key_hi, prime32); xacc[i] = _mm256_add_epi64(prod_lo, _mm256_slli_epi64(prod_hi, 32)); @@ -3909,12 +5184,12 @@ XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_initCustomSecret_avx2(void* XXH_RESTR XXH_ASSERT(((size_t)dest & 31) == 0); /* GCC -O2 need unroll loop manually */ - dest[0] = _mm256_add_epi64(_mm256_stream_load_si256(src+0), seed); - dest[1] = _mm256_add_epi64(_mm256_stream_load_si256(src+1), seed); - dest[2] = _mm256_add_epi64(_mm256_stream_load_si256(src+2), seed); - dest[3] = _mm256_add_epi64(_mm256_stream_load_si256(src+3), seed); - dest[4] = _mm256_add_epi64(_mm256_stream_load_si256(src+4), seed); - dest[5] = _mm256_add_epi64(_mm256_stream_load_si256(src+5), seed); + dest[0] = _mm256_add_epi64(_mm256_load_si256(src+0), seed); + dest[1] = _mm256_add_epi64(_mm256_load_si256(src+1), seed); + dest[2] = _mm256_add_epi64(_mm256_load_si256(src+2), seed); + dest[3] = _mm256_add_epi64(_mm256_load_si256(src+3), seed); + dest[4] = _mm256_add_epi64(_mm256_load_si256(src+4), seed); + dest[5] = _mm256_add_epi64(_mm256_load_si256(src+5), seed); } } @@ -3961,6 +5236,7 @@ XXH3_accumulate_512_sse2( void* XXH_RESTRICT acc, xacc[i] = _mm_add_epi64(product, sum); } } } +XXH_FORCE_INLINE XXH_TARGET_SSE2 XXH3_ACCUMULATE_TEMPLATE(sse2) XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_scrambleAcc_sse2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) @@ -4028,202 +5304,645 @@ XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_initCustomSecret_sse2(void* XXH_RESTR #if (XXH_VECTOR == XXH_NEON) +/* forward declarations for the scalar routines */ +XXH_FORCE_INLINE void +XXH3_scalarRound(void* XXH_RESTRICT acc, void const* XXH_RESTRICT input, + void const* XXH_RESTRICT secret, size_t lane); + +XXH_FORCE_INLINE void +XXH3_scalarScrambleRound(void* XXH_RESTRICT acc, + void const* XXH_RESTRICT secret, size_t lane); + +/*! + * @internal + * @brief The bulk processing loop for NEON and WASM SIMD128. + * + * The NEON code path is actually partially scalar when running on AArch64. This + * is to optimize the pipelining and can have up to 15% speedup depending on the + * CPU, and it also mitigates some GCC codegen issues. + * + * @see XXH3_NEON_LANES for configuring this and details about this optimization. + * + * NEON's 32-bit to 64-bit long multiply takes a half vector of 32-bit + * integers instead of the other platforms which mask full 64-bit vectors, + * so the setup is more complicated than just shifting right. + * + * Additionally, there is an optimization for 4 lanes at once noted below. + * + * Since, as stated, the most optimal amount of lanes for Cortexes is 6, + * there needs to be *three* versions of the accumulate operation used + * for the remaining 2 lanes. + * + * WASM's SIMD128 uses SIMDe's arm_neon.h polyfill because the intrinsics overlap + * nearly perfectly. + */ + +XXH_FORCE_INLINE void +XXH3_accumulate_512_neon( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + XXH_STATIC_ASSERT(XXH3_NEON_LANES > 0 && XXH3_NEON_LANES <= XXH_ACC_NB && XXH3_NEON_LANES % 2 == 0); + { /* GCC for darwin arm64 does not like aliasing here */ + xxh_aliasing_uint64x2_t* const xacc = (xxh_aliasing_uint64x2_t*) acc; + /* We don't use a uint32x4_t pointer because it causes bus errors on ARMv7. */ + uint8_t const* xinput = (const uint8_t *) input; + uint8_t const* xsecret = (const uint8_t *) secret; + + size_t i; +#ifdef __wasm_simd128__ + /* + * On WASM SIMD128, Clang emits direct address loads when XXH3_kSecret + * is constant propagated, which results in it converting it to this + * inside the loop: + * + * a = v128.load(XXH3_kSecret + 0 + $secret_offset, offset = 0) + * b = v128.load(XXH3_kSecret + 16 + $secret_offset, offset = 0) + * ... + * + * This requires a full 32-bit address immediate (and therefore a 6 byte + * instruction) as well as an add for each offset. + * + * Putting an asm guard prevents it from folding (at the cost of losing + * the alignment hint), and uses the free offset in `v128.load` instead + * of adding secret_offset each time which overall reduces code size by + * about a kilobyte and improves performance. + */ + XXH_COMPILER_GUARD(xsecret); +#endif + /* Scalar lanes use the normal scalarRound routine */ + for (i = XXH3_NEON_LANES; i < XXH_ACC_NB; i++) { + XXH3_scalarRound(acc, input, secret, i); + } + i = 0; + /* 4 NEON lanes at a time. */ + for (; i+1 < XXH3_NEON_LANES / 2; i+=2) { + /* data_vec = xinput[i]; */ + uint64x2_t data_vec_1 = XXH_vld1q_u64(xinput + (i * 16)); + uint64x2_t data_vec_2 = XXH_vld1q_u64(xinput + ((i+1) * 16)); + /* key_vec = xsecret[i]; */ + uint64x2_t key_vec_1 = XXH_vld1q_u64(xsecret + (i * 16)); + uint64x2_t key_vec_2 = XXH_vld1q_u64(xsecret + ((i+1) * 16)); + /* data_swap = swap(data_vec) */ + uint64x2_t data_swap_1 = vextq_u64(data_vec_1, data_vec_1, 1); + uint64x2_t data_swap_2 = vextq_u64(data_vec_2, data_vec_2, 1); + /* data_key = data_vec ^ key_vec; */ + uint64x2_t data_key_1 = veorq_u64(data_vec_1, key_vec_1); + uint64x2_t data_key_2 = veorq_u64(data_vec_2, key_vec_2); + + /* + * If we reinterpret the 64x2 vectors as 32x4 vectors, we can use a + * de-interleave operation for 4 lanes in 1 step with `vuzpq_u32` to + * get one vector with the low 32 bits of each lane, and one vector + * with the high 32 bits of each lane. + * + * The intrinsic returns a double vector because the original ARMv7-a + * instruction modified both arguments in place. AArch64 and SIMD128 emit + * two instructions from this intrinsic. + * + * [ dk11L | dk11H | dk12L | dk12H ] -> [ dk11L | dk12L | dk21L | dk22L ] + * [ dk21L | dk21H | dk22L | dk22H ] -> [ dk11H | dk12H | dk21H | dk22H ] + */ + uint32x4x2_t unzipped = vuzpq_u32( + vreinterpretq_u32_u64(data_key_1), + vreinterpretq_u32_u64(data_key_2) + ); + /* data_key_lo = data_key & 0xFFFFFFFF */ + uint32x4_t data_key_lo = unzipped.val[0]; + /* data_key_hi = data_key >> 32 */ + uint32x4_t data_key_hi = unzipped.val[1]; + /* + * Then, we can split the vectors horizontally and multiply which, as for most + * widening intrinsics, have a variant that works on both high half vectors + * for free on AArch64. A similar instruction is available on SIMD128. + * + * sum = data_swap + (u64x2) data_key_lo * (u64x2) data_key_hi + */ + uint64x2_t sum_1 = XXH_vmlal_low_u32(data_swap_1, data_key_lo, data_key_hi); + uint64x2_t sum_2 = XXH_vmlal_high_u32(data_swap_2, data_key_lo, data_key_hi); + /* + * Clang reorders + * a += b * c; // umlal swap.2d, dkl.2s, dkh.2s + * c += a; // add acc.2d, acc.2d, swap.2d + * to + * c += a; // add acc.2d, acc.2d, swap.2d + * c += b * c; // umlal acc.2d, dkl.2s, dkh.2s + * + * While it would make sense in theory since the addition is faster, + * for reasons likely related to umlal being limited to certain NEON + * pipelines, this is worse. A compiler guard fixes this. + */ + XXH_COMPILER_GUARD_CLANG_NEON(sum_1); + XXH_COMPILER_GUARD_CLANG_NEON(sum_2); + /* xacc[i] = acc_vec + sum; */ + xacc[i] = vaddq_u64(xacc[i], sum_1); + xacc[i+1] = vaddq_u64(xacc[i+1], sum_2); + } + /* Operate on the remaining NEON lanes 2 at a time. */ + for (; i < XXH3_NEON_LANES / 2; i++) { + /* data_vec = xinput[i]; */ + uint64x2_t data_vec = XXH_vld1q_u64(xinput + (i * 16)); + /* key_vec = xsecret[i]; */ + uint64x2_t key_vec = XXH_vld1q_u64(xsecret + (i * 16)); + /* acc_vec_2 = swap(data_vec) */ + uint64x2_t data_swap = vextq_u64(data_vec, data_vec, 1); + /* data_key = data_vec ^ key_vec; */ + uint64x2_t data_key = veorq_u64(data_vec, key_vec); + /* For two lanes, just use VMOVN and VSHRN. */ + /* data_key_lo = data_key & 0xFFFFFFFF; */ + uint32x2_t data_key_lo = vmovn_u64(data_key); + /* data_key_hi = data_key >> 32; */ + uint32x2_t data_key_hi = vshrn_n_u64(data_key, 32); + /* sum = data_swap + (u64x2) data_key_lo * (u64x2) data_key_hi; */ + uint64x2_t sum = vmlal_u32(data_swap, data_key_lo, data_key_hi); + /* Same Clang workaround as before */ + XXH_COMPILER_GUARD_CLANG_NEON(sum); + /* xacc[i] = acc_vec + sum; */ + xacc[i] = vaddq_u64 (xacc[i], sum); + } + } +} +XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(neon) + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_neon(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + + { xxh_aliasing_uint64x2_t* xacc = (xxh_aliasing_uint64x2_t*) acc; + uint8_t const* xsecret = (uint8_t const*) secret; + + size_t i; + /* WASM uses operator overloads and doesn't need these. */ +#ifndef __wasm_simd128__ + /* { prime32_1, prime32_1 } */ + uint32x2_t const kPrimeLo = vdup_n_u32(XXH_PRIME32_1); + /* { 0, prime32_1, 0, prime32_1 } */ + uint32x4_t const kPrimeHi = vreinterpretq_u32_u64(vdupq_n_u64((xxh_u64)XXH_PRIME32_1 << 32)); +#endif + + /* AArch64 uses both scalar and neon at the same time */ + for (i = XXH3_NEON_LANES; i < XXH_ACC_NB; i++) { + XXH3_scalarScrambleRound(acc, secret, i); + } + for (i=0; i < XXH3_NEON_LANES / 2; i++) { + /* xacc[i] ^= (xacc[i] >> 47); */ + uint64x2_t acc_vec = xacc[i]; + uint64x2_t shifted = vshrq_n_u64(acc_vec, 47); + uint64x2_t data_vec = veorq_u64(acc_vec, shifted); + + /* xacc[i] ^= xsecret[i]; */ + uint64x2_t key_vec = XXH_vld1q_u64(xsecret + (i * 16)); + uint64x2_t data_key = veorq_u64(data_vec, key_vec); + /* xacc[i] *= XXH_PRIME32_1 */ +#ifdef __wasm_simd128__ + /* SIMD128 has multiply by u64x2, use it instead of expanding and scalarizing */ + xacc[i] = data_key * XXH_PRIME32_1; +#else + /* + * Expanded version with portable NEON intrinsics + * + * lo(x) * lo(y) + (hi(x) * lo(y) << 32) + * + * prod_hi = hi(data_key) * lo(prime) << 32 + * + * Since we only need 32 bits of this multiply a trick can be used, reinterpreting the vector + * as a uint32x4_t and multiplying by { 0, prime, 0, prime } to cancel out the unwanted bits + * and avoid the shift. + */ + uint32x4_t prod_hi = vmulq_u32 (vreinterpretq_u32_u64(data_key), kPrimeHi); + /* Extract low bits for vmlal_u32 */ + uint32x2_t data_key_lo = vmovn_u64(data_key); + /* xacc[i] = prod_hi + lo(data_key) * XXH_PRIME32_1; */ + xacc[i] = vmlal_u32(vreinterpretq_u64_u32(prod_hi), data_key_lo, kPrimeLo); +#endif + } + } +} +#endif + +#if (XXH_VECTOR == XXH_VSX) + +XXH_FORCE_INLINE void +XXH3_accumulate_512_vsx( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + /* presumed aligned */ + xxh_aliasing_u64x2* const xacc = (xxh_aliasing_u64x2*) acc; + xxh_u8 const* const xinput = (xxh_u8 const*) input; /* no alignment restriction */ + xxh_u8 const* const xsecret = (xxh_u8 const*) secret; /* no alignment restriction */ + xxh_u64x2 const v32 = { 32, 32 }; + size_t i; + for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { + /* data_vec = xinput[i]; */ + xxh_u64x2 const data_vec = XXH_vec_loadu(xinput + 16*i); + /* key_vec = xsecret[i]; */ + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + 16*i); + xxh_u64x2 const data_key = data_vec ^ key_vec; + /* shuffled = (data_key << 32) | (data_key >> 32); */ + xxh_u32x4 const shuffled = (xxh_u32x4)vec_rl(data_key, v32); + /* product = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)shuffled & 0xFFFFFFFF); */ + xxh_u64x2 const product = XXH_vec_mulo((xxh_u32x4)data_key, shuffled); + /* acc_vec = xacc[i]; */ + xxh_u64x2 acc_vec = xacc[i]; + acc_vec += product; + + /* swap high and low halves */ +#ifdef __s390x__ + acc_vec += vec_permi(data_vec, data_vec, 2); +#else + acc_vec += vec_xxpermdi(data_vec, data_vec, 2); +#endif + xacc[i] = acc_vec; + } +} +XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(vsx) + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + + { xxh_aliasing_u64x2* const xacc = (xxh_aliasing_u64x2*) acc; + const xxh_u8* const xsecret = (const xxh_u8*) secret; + /* constants */ + xxh_u64x2 const v32 = { 32, 32 }; + xxh_u64x2 const v47 = { 47, 47 }; + xxh_u32x4 const prime = { XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1 }; + size_t i; + for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { + /* xacc[i] ^= (xacc[i] >> 47); */ + xxh_u64x2 const acc_vec = xacc[i]; + xxh_u64x2 const data_vec = acc_vec ^ (acc_vec >> v47); + + /* xacc[i] ^= xsecret[i]; */ + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + 16*i); + xxh_u64x2 const data_key = data_vec ^ key_vec; + + /* xacc[i] *= XXH_PRIME32_1 */ + /* prod_lo = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)prime & 0xFFFFFFFF); */ + xxh_u64x2 const prod_even = XXH_vec_mule((xxh_u32x4)data_key, prime); + /* prod_hi = ((xxh_u64x2)data_key >> 32) * ((xxh_u64x2)prime >> 32); */ + xxh_u64x2 const prod_odd = XXH_vec_mulo((xxh_u32x4)data_key, prime); + xacc[i] = prod_odd + (prod_even << v32); + } } +} + +#endif + +#if (XXH_VECTOR == XXH_SVE) + +XXH_FORCE_INLINE void +XXH3_accumulate_512_sve( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + uint64_t *xacc = (uint64_t *)acc; + const uint64_t *xinput = (const uint64_t *)(const void *)input; + const uint64_t *xsecret = (const uint64_t *)(const void *)secret; + svuint64_t kSwap = sveor_n_u64_z(svptrue_b64(), svindex_u64(0, 1), 1); + uint64_t element_count = svcntd(); + if (element_count >= 8) { + svbool_t mask = svptrue_pat_b64(SV_VL8); + svuint64_t vacc = svld1_u64(mask, xacc); + ACCRND(vacc, 0); + svst1_u64(mask, xacc, vacc); + } else if (element_count == 2) { /* sve128 */ + svbool_t mask = svptrue_pat_b64(SV_VL2); + svuint64_t acc0 = svld1_u64(mask, xacc + 0); + svuint64_t acc1 = svld1_u64(mask, xacc + 2); + svuint64_t acc2 = svld1_u64(mask, xacc + 4); + svuint64_t acc3 = svld1_u64(mask, xacc + 6); + ACCRND(acc0, 0); + ACCRND(acc1, 2); + ACCRND(acc2, 4); + ACCRND(acc3, 6); + svst1_u64(mask, xacc + 0, acc0); + svst1_u64(mask, xacc + 2, acc1); + svst1_u64(mask, xacc + 4, acc2); + svst1_u64(mask, xacc + 6, acc3); + } else { + svbool_t mask = svptrue_pat_b64(SV_VL4); + svuint64_t acc0 = svld1_u64(mask, xacc + 0); + svuint64_t acc1 = svld1_u64(mask, xacc + 4); + ACCRND(acc0, 0); + ACCRND(acc1, 4); + svst1_u64(mask, xacc + 0, acc0); + svst1_u64(mask, xacc + 4, acc1); + } +} + +XXH_FORCE_INLINE void +XXH3_accumulate_sve(xxh_u64* XXH_RESTRICT acc, + const xxh_u8* XXH_RESTRICT input, + const xxh_u8* XXH_RESTRICT secret, + size_t nbStripes) +{ + if (nbStripes != 0) { + uint64_t *xacc = (uint64_t *)acc; + const uint64_t *xinput = (const uint64_t *)(const void *)input; + const uint64_t *xsecret = (const uint64_t *)(const void *)secret; + svuint64_t kSwap = sveor_n_u64_z(svptrue_b64(), svindex_u64(0, 1), 1); + uint64_t element_count = svcntd(); + if (element_count >= 8) { + svbool_t mask = svptrue_pat_b64(SV_VL8); + svuint64_t vacc = svld1_u64(mask, xacc + 0); + do { + /* svprfd(svbool_t, void *, enum svfprop); */ + svprfd(mask, xinput + 128, SV_PLDL1STRM); + ACCRND(vacc, 0); + xinput += 8; + xsecret += 1; + nbStripes--; + } while (nbStripes != 0); + + svst1_u64(mask, xacc + 0, vacc); + } else if (element_count == 2) { /* sve128 */ + svbool_t mask = svptrue_pat_b64(SV_VL2); + svuint64_t acc0 = svld1_u64(mask, xacc + 0); + svuint64_t acc1 = svld1_u64(mask, xacc + 2); + svuint64_t acc2 = svld1_u64(mask, xacc + 4); + svuint64_t acc3 = svld1_u64(mask, xacc + 6); + do { + svprfd(mask, xinput + 128, SV_PLDL1STRM); + ACCRND(acc0, 0); + ACCRND(acc1, 2); + ACCRND(acc2, 4); + ACCRND(acc3, 6); + xinput += 8; + xsecret += 1; + nbStripes--; + } while (nbStripes != 0); + + svst1_u64(mask, xacc + 0, acc0); + svst1_u64(mask, xacc + 2, acc1); + svst1_u64(mask, xacc + 4, acc2); + svst1_u64(mask, xacc + 6, acc3); + } else { + svbool_t mask = svptrue_pat_b64(SV_VL4); + svuint64_t acc0 = svld1_u64(mask, xacc + 0); + svuint64_t acc1 = svld1_u64(mask, xacc + 4); + do { + svprfd(mask, xinput + 128, SV_PLDL1STRM); + ACCRND(acc0, 0); + ACCRND(acc1, 4); + xinput += 8; + xsecret += 1; + nbStripes--; + } while (nbStripes != 0); + + svst1_u64(mask, xacc + 0, acc0); + svst1_u64(mask, xacc + 4, acc1); + } + } +} + +#endif + +#if (XXH_VECTOR == XXH_LSX) +#define _LSX_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) + XXH_FORCE_INLINE void -XXH3_accumulate_512_neon( void* XXH_RESTRICT acc, +XXH3_accumulate_512_lsx( void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 15) == 0); { - uint64x2_t* const xacc = (uint64x2_t *) acc; - /* We don't use a uint32x4_t pointer because it causes bus errors on ARMv7. */ - uint8_t const* const xinput = (const uint8_t *) input; - uint8_t const* const xsecret = (const uint8_t *) secret; + __m128i* const xacc = (__m128i *) acc; + const __m128i* const xinput = (const __m128i *) input; + const __m128i* const xsecret = (const __m128i *) secret; - size_t i; - for (i=0; i < XXH_STRIPE_LEN / sizeof(uint64x2_t); i++) { + for (size_t i = 0; i < XXH_STRIPE_LEN / sizeof(__m128i); i++) { /* data_vec = xinput[i]; */ - uint8x16_t data_vec = vld1q_u8(xinput + (i * 16)); - /* key_vec = xsecret[i]; */ - uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16)); - uint64x2_t data_key; - uint32x2_t data_key_lo, data_key_hi; - /* xacc[i] += swap(data_vec); */ - uint64x2_t const data64 = vreinterpretq_u64_u8(data_vec); - uint64x2_t const swapped = vextq_u64(data64, data64, 1); - xacc[i] = vaddq_u64 (xacc[i], swapped); + __m128i const data_vec = __lsx_vld(xinput + i, 0); + /* key_vec = xsecret[i]; */ + __m128i const key_vec = __lsx_vld(xsecret + i, 0); /* data_key = data_vec ^ key_vec; */ - data_key = vreinterpretq_u64_u8(veorq_u8(data_vec, key_vec)); - /* data_key_lo = (uint32x2_t) (data_key & 0xFFFFFFFF); - * data_key_hi = (uint32x2_t) (data_key >> 32); - * data_key = UNDEFINED; */ - XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); - /* xacc[i] += (uint64x2_t) data_key_lo * (uint64x2_t) data_key_hi; */ - xacc[i] = vmlal_u32 (xacc[i], data_key_lo, data_key_hi); - + __m128i const data_key = __lsx_vxor_v(data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m128i const data_key_lo = __lsx_vsrli_d(data_key, 32); + // __m128i const data_key_lo = __lsx_vsrli_d(data_key, 32); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m128i const product = __lsx_vmulwev_d_wu(data_key, data_key_lo); + /* xacc[i] += swap(data_vec); */ + __m128i const data_swap = __lsx_vshuf4i_w(data_vec, _LSX_SHUFFLE(1, 0, 3, 2)); + __m128i const sum = __lsx_vadd_d(xacc[i], data_swap); + /* xacc[i] += product; */ + xacc[i] = __lsx_vadd_d(product, sum); } } } +XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(lsx) XXH_FORCE_INLINE void -XXH3_scrambleAcc_neon(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +XXH3_scrambleAcc_lsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { XXH_ASSERT((((size_t)acc) & 15) == 0); + { + __m128i* const xacc = (__m128i*) acc; + const __m128i* const xsecret = (const __m128i *) secret; + const __m128i prime32 = __lsx_vreplgr2vr_d(XXH_PRIME32_1); - { uint64x2_t* xacc = (uint64x2_t*) acc; - uint8_t const* xsecret = (uint8_t const*) secret; - uint32x2_t prime = vdup_n_u32 (XXH_PRIME32_1); - - size_t i; - for (i=0; i < XXH_STRIPE_LEN/sizeof(uint64x2_t); i++) { - /* xacc[i] ^= (xacc[i] >> 47); */ - uint64x2_t acc_vec = xacc[i]; - uint64x2_t shifted = vshrq_n_u64 (acc_vec, 47); - uint64x2_t data_vec = veorq_u64 (acc_vec, shifted); - + for (size_t i = 0; i < XXH_STRIPE_LEN / sizeof(__m128i); i++) { + /* xacc[i] ^= (xacc[i] >> 47) */ + __m128i const acc_vec = xacc[i]; + __m128i const shifted = __lsx_vsrli_d(acc_vec, 47); + __m128i const data_vec = __lsx_vxor_v(acc_vec, shifted); /* xacc[i] ^= xsecret[i]; */ - uint8x16_t key_vec = vld1q_u8 (xsecret + (i * 16)); - uint64x2_t data_key = veorq_u64 (data_vec, vreinterpretq_u64_u8(key_vec)); + __m128i const key_vec = __lsx_vld(xsecret + i, 0); + __m128i const data_key = __lsx_vxor_v(data_vec, key_vec); - /* xacc[i] *= XXH_PRIME32_1 */ - uint32x2_t data_key_lo, data_key_hi; - /* data_key_lo = (uint32x2_t) (xacc[i] & 0xFFFFFFFF); - * data_key_hi = (uint32x2_t) (xacc[i] >> 32); - * xacc[i] = UNDEFINED; */ - XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); - { /* - * prod_hi = (data_key >> 32) * XXH_PRIME32_1; - * - * Avoid vmul_u32 + vshll_n_u32 since Clang 6 and 7 will - * incorrectly "optimize" this: - * tmp = vmul_u32(vmovn_u64(a), vmovn_u64(b)); - * shifted = vshll_n_u32(tmp, 32); - * to this: - * tmp = "vmulq_u64"(a, b); // no such thing! - * shifted = vshlq_n_u64(tmp, 32); - * - * However, unlike SSE, Clang lacks a 64-bit multiply routine - * for NEON, and it scalarizes two 64-bit multiplies instead. - * - * vmull_u32 has the same timing as vmul_u32, and it avoids - * this bug completely. - * See https://bugs.llvm.org/show_bug.cgi?id=39967 - */ - uint64x2_t prod_hi = vmull_u32 (data_key_hi, prime); - /* xacc[i] = prod_hi << 32; */ - xacc[i] = vshlq_n_u64(prod_hi, 32); - /* xacc[i] += (prod_hi & 0xFFFFFFFF) * XXH_PRIME32_1; */ - xacc[i] = vmlal_u32(xacc[i], data_key_lo, prime); - } - } } + /* xacc[i] *= XXH_PRIME32_1; */ + xacc[i] = __lsx_vmul_d(data_key, prime32); + } + } } #endif -#if (XXH_VECTOR == XXH_VSX) +#if (XXH_VECTOR == XXH_LASX) +#define _LASX_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) XXH_FORCE_INLINE void -XXH3_accumulate_512_vsx( void* XXH_RESTRICT acc, +XXH3_accumulate_512_lasx( void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { - /* presumed aligned */ - unsigned long long* const xacc = (unsigned long long*) acc; - xxh_u64x2 const* const xinput = (xxh_u64x2 const*) input; /* no alignment restriction */ - xxh_u64x2 const* const xsecret = (xxh_u64x2 const*) secret; /* no alignment restriction */ - xxh_u64x2 const v32 = { 32, 32 }; - size_t i; - for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { - /* data_vec = xinput[i]; */ - xxh_u64x2 const data_vec = XXH_vec_loadu(xinput + i); - /* key_vec = xsecret[i]; */ - xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); - xxh_u64x2 const data_key = data_vec ^ key_vec; - /* shuffled = (data_key << 32) | (data_key >> 32); */ - xxh_u32x4 const shuffled = (xxh_u32x4)vec_rl(data_key, v32); - /* product = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)shuffled & 0xFFFFFFFF); */ - xxh_u64x2 const product = XXH_vec_mulo((xxh_u32x4)data_key, shuffled); - /* acc_vec = xacc[i]; */ - xxh_u64x2 acc_vec = vec_xl(0, xacc + 2 * i); - acc_vec += product; + XXH_ASSERT((((size_t)acc) & 31) == 0); + { + __m256i* const xacc = (__m256i *) acc; + const __m256i* const xinput = (const __m256i *) input; + const __m256i* const xsecret = (const __m256i *) secret; - /* swap high and low halves */ -#ifdef __s390x__ - acc_vec += vec_permi(data_vec, data_vec, 2); -#else - acc_vec += vec_xxpermdi(data_vec, data_vec, 2); -#endif - /* xacc[i] = acc_vec; */ - vec_xst(acc_vec, 0, xacc + 2 * i); + for (size_t i = 0; i < XXH_STRIPE_LEN / sizeof(__m256i); i++) { + /* data_vec = xinput[i]; */ + __m256i const data_vec = __lasx_xvld(xinput + i, 0); + /* key_vec = xsecret[i]; */ + __m256i const key_vec = __lasx_xvld(xsecret + i, 0); + /* data_key = data_vec ^ key_vec; */ + __m256i const data_key = __lasx_xvxor_v(data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m256i const data_key_lo = __lasx_xvsrli_d(data_key, 32); + // __m256i const data_key_lo = __lasx_xvsrli_d(data_key, 32); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m256i const product = __lasx_xvmulwev_d_wu(data_key, data_key_lo); + /* xacc[i] += swap(data_vec); */ + __m256i const data_swap = __lasx_xvshuf4i_w(data_vec, _LASX_SHUFFLE(1, 0, 3, 2)); + __m256i const sum = __lasx_xvadd_d(xacc[i], data_swap); + /* xacc[i] += product; */ + xacc[i] = __lasx_xvadd_d(product, sum); + } } } +XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(lasx) XXH_FORCE_INLINE void -XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +XXH3_scrambleAcc_lasx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) { - XXH_ASSERT((((size_t)acc) & 15) == 0); - - { xxh_u64x2* const xacc = (xxh_u64x2*) acc; - const xxh_u64x2* const xsecret = (const xxh_u64x2*) secret; - /* constants */ - xxh_u64x2 const v32 = { 32, 32 }; - xxh_u64x2 const v47 = { 47, 47 }; - xxh_u32x4 const prime = { XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1 }; - size_t i; - for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { - /* xacc[i] ^= (xacc[i] >> 47); */ - xxh_u64x2 const acc_vec = xacc[i]; - xxh_u64x2 const data_vec = acc_vec ^ (acc_vec >> v47); + XXH_ASSERT((((size_t)acc) & 31) == 0); + { + __m256i* const xacc = (__m256i*) acc; + const __m256i* const xsecret = (const __m256i *) secret; + const __m256i prime32 = __lasx_xvreplgr2vr_d(XXH_PRIME32_1); + for (size_t i = 0; i < XXH_STRIPE_LEN / sizeof(__m256i); i++) { + /* xacc[i] ^= (xacc[i] >> 47) */ + __m256i const acc_vec = xacc[i]; + __m256i const shifted = __lasx_xvsrli_d(acc_vec, 47); + __m256i const data_vec = __lasx_xvxor_v(acc_vec, shifted); /* xacc[i] ^= xsecret[i]; */ - xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); - xxh_u64x2 const data_key = data_vec ^ key_vec; + __m256i const key_vec = __lasx_xvld(xsecret + i, 0); + __m256i const data_key = __lasx_xvxor_v(data_vec, key_vec); - /* xacc[i] *= XXH_PRIME32_1 */ - /* prod_lo = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)prime & 0xFFFFFFFF); */ - xxh_u64x2 const prod_even = XXH_vec_mule((xxh_u32x4)data_key, prime); - /* prod_hi = ((xxh_u64x2)data_key >> 32) * ((xxh_u64x2)prime >> 32); */ - xxh_u64x2 const prod_odd = XXH_vec_mulo((xxh_u32x4)data_key, prime); - xacc[i] = prod_odd + (prod_even << v32); - } } + /* xacc[i] *= XXH_PRIME32_1; */ + xacc[i] = __lasx_xvmul_d(data_key, prime32); + } + } } #endif /* scalar variants - universal */ +#if defined(__aarch64__) && (defined(__GNUC__) || defined(__clang__)) +/* + * In XXH3_scalarRound(), GCC and Clang have a similar codegen issue, where they + * emit an excess mask and a full 64-bit multiply-add (MADD X-form). + * + * While this might not seem like much, as AArch64 is a 64-bit architecture, only + * big Cortex designs have a full 64-bit multiplier. + * + * On the little cores, the smaller 32-bit multiplier is used, and full 64-bit + * multiplies expand to 2-3 multiplies in microcode. This has a major penalty + * of up to 4 latency cycles and 2 stall cycles in the multiply pipeline. + * + * Thankfully, AArch64 still provides the 32-bit long multiply-add (UMADDL) which does + * not have this penalty and does the mask automatically. + */ +XXH_FORCE_INLINE xxh_u64 +XXH_mult32to64_add64(xxh_u64 lhs, xxh_u64 rhs, xxh_u64 acc) +{ + xxh_u64 ret; + /* note: %x = 64-bit register, %w = 32-bit register */ + __asm__("umaddl %x0, %w1, %w2, %x3" : "=r" (ret) : "r" (lhs), "r" (rhs), "r" (acc)); + return ret; +} +#else +XXH_FORCE_INLINE xxh_u64 +XXH_mult32to64_add64(xxh_u64 lhs, xxh_u64 rhs, xxh_u64 acc) +{ + return XXH_mult32to64((xxh_u32)lhs, (xxh_u32)rhs) + acc; +} +#endif + +/*! + * @internal + * @brief Scalar round for @ref XXH3_accumulate_512_scalar(). + * + * This is extracted to its own function because the NEON path uses a combination + * of NEON and scalar. + */ +XXH_FORCE_INLINE void +XXH3_scalarRound(void* XXH_RESTRICT acc, + void const* XXH_RESTRICT input, + void const* XXH_RESTRICT secret, + size_t lane) +{ + xxh_u64* xacc = (xxh_u64*) acc; + xxh_u8 const* xinput = (xxh_u8 const*) input; + xxh_u8 const* xsecret = (xxh_u8 const*) secret; + XXH_ASSERT(lane < XXH_ACC_NB); + XXH_ASSERT(((size_t)acc & (XXH_ACC_ALIGN-1)) == 0); + { + xxh_u64 const data_val = XXH_readLE64(xinput + lane * 8); + xxh_u64 const data_key = data_val ^ XXH_readLE64(xsecret + lane * 8); + xacc[lane ^ 1] += data_val; /* swap adjacent lanes */ + xacc[lane] = XXH_mult32to64_add64(data_key /* & 0xFFFFFFFF */, data_key >> 32, xacc[lane]); + } +} + +/*! + * @internal + * @brief Processes a 64 byte block of data using the scalar path. + */ XXH_FORCE_INLINE void XXH3_accumulate_512_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT input, const void* XXH_RESTRICT secret) { - xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ - const xxh_u8* const xinput = (const xxh_u8*) input; /* no alignment restriction */ - const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ size_t i; - XXH_ASSERT(((size_t)acc & (XXH_ACC_ALIGN-1)) == 0); + /* ARM GCC refuses to unroll this loop, resulting in a 24% slowdown on ARMv6. */ +#if defined(__GNUC__) && !defined(__clang__) \ + && (defined(__arm__) || defined(__thumb2__)) \ + && defined(__ARM_FEATURE_UNALIGNED) /* no unaligned access just wastes bytes */ \ + && XXH_SIZE_OPT <= 0 +# pragma GCC unroll 8 +#endif for (i=0; i < XXH_ACC_NB; i++) { - xxh_u64 const data_val = XXH_readLE64(xinput + 8*i); - xxh_u64 const data_key = data_val ^ XXH_readLE64(xsecret + i*8); - xacc[i ^ 1] += data_val; /* swap adjacent lanes */ - xacc[i] += XXH_mult32to64(data_key & 0xFFFFFFFF, data_key >> 32); + XXH3_scalarRound(acc, input, secret, i); } } +XXH_FORCE_INLINE XXH3_ACCUMULATE_TEMPLATE(scalar) +/*! + * @internal + * @brief Scalar scramble step for @ref XXH3_scrambleAcc_scalar(). + * + * This is extracted to its own function because the NEON path uses a combination + * of NEON and scalar. + */ XXH_FORCE_INLINE void -XXH3_scrambleAcc_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +XXH3_scalarScrambleRound(void* XXH_RESTRICT acc, + void const* XXH_RESTRICT secret, + size_t lane) { xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ - size_t i; XXH_ASSERT((((size_t)acc) & (XXH_ACC_ALIGN-1)) == 0); - for (i=0; i < XXH_ACC_NB; i++) { - xxh_u64 const key64 = XXH_readLE64(xsecret + 8*i); - xxh_u64 acc64 = xacc[i]; + XXH_ASSERT(lane < XXH_ACC_NB); + { + xxh_u64 const key64 = XXH_readLE64(xsecret + lane * 8); + xxh_u64 acc64 = xacc[lane]; acc64 = XXH_xorshift64(acc64, 47); acc64 ^= key64; acc64 *= XXH_PRIME32_1; - xacc[i] = acc64; + xacc[lane] = acc64; + } +} + +/*! + * @internal + * @brief Scrambles the accumulators after a large chunk has been read + */ +XXH_FORCE_INLINE void +XXH3_scrambleAcc_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + size_t i; + for (i=0; i < XXH_ACC_NB; i++) { + XXH3_scalarScrambleRound(acc, secret, i); } } @@ -4238,15 +5957,16 @@ XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) const xxh_u8* kSecretPtr = XXH3_kSecret; XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); -#if defined(__clang__) && defined(__aarch64__) +#if defined(__GNUC__) && defined(__aarch64__) /* * UGLY HACK: - * Clang generates a bunch of MOV/MOVK pairs for aarch64, and they are + * GCC and Clang generate a bunch of MOV/MOVK pairs for aarch64, and they are * placed sequentially, in order, at the top of the unrolled loop. * * While MOVK is great for generating constants (2 cycles for a 64-bit - * constant compared to 4 cycles for LDR), long MOVK chains stall the - * integer pipelines: + * constant compared to 4 cycles for LDR), it fights for bandwidth with + * the arithmetic instructions. + * * I L S * MOVK * MOVK @@ -4255,7 +5975,7 @@ XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) * ADD * SUB STR * STR - * By forcing loads from memory (as the asm line causes Clang to assume + * By forcing loads from memory (as the asm line causes the compiler to assume * that XXH3_kSecretPtr has been changed), the pipelines are used more * efficiently: * I L S @@ -4263,23 +5983,20 @@ XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) * ADD LDR * SUB STR * STR + * + * See XXH3_NEON_LANES for details on the pipsline. + * * XXH3_64bits_withSeed, len == 256, Snapdragon 835 * without hack: 2654.4 MB/s * with hack: 3202.9 MB/s */ XXH_COMPILER_GUARD(kSecretPtr); #endif - /* - * Note: in debug mode, this overrides the asm optimization - * and Clang will emit MOVK chains again. - */ - XXH_ASSERT(kSecretPtr == XXH3_kSecret); - { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / 16; int i; for (i=0; i < nbRounds; i++) { /* - * The asm hack causes Clang to assume that kSecretPtr aliases with + * The asm hack causes the compiler to assume that kSecretPtr aliases with * customSecret, and on aarch64, this prevented LDP from merging two * loads together for free. Putting the loads together before the stores * properly generates LDP. @@ -4292,7 +6009,7 @@ XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) } -typedef void (*XXH3_f_accumulate_512)(void* XXH_RESTRICT, const void*, const void*); +typedef void (*XXH3_f_accumulate)(xxh_u64* XXH_RESTRICT, const xxh_u8* XXH_RESTRICT, const xxh_u8* XXH_RESTRICT, size_t); typedef void (*XXH3_f_scrambleAcc)(void* XXH_RESTRICT, const void*); typedef void (*XXH3_f_initCustomSecret)(void* XXH_RESTRICT, xxh_u64); @@ -4300,82 +6017,75 @@ typedef void (*XXH3_f_initCustomSecret)(void* XXH_RESTRICT, xxh_u64); #if (XXH_VECTOR == XXH_AVX512) #define XXH3_accumulate_512 XXH3_accumulate_512_avx512 +#define XXH3_accumulate XXH3_accumulate_avx512 #define XXH3_scrambleAcc XXH3_scrambleAcc_avx512 #define XXH3_initCustomSecret XXH3_initCustomSecret_avx512 #elif (XXH_VECTOR == XXH_AVX2) #define XXH3_accumulate_512 XXH3_accumulate_512_avx2 +#define XXH3_accumulate XXH3_accumulate_avx2 #define XXH3_scrambleAcc XXH3_scrambleAcc_avx2 #define XXH3_initCustomSecret XXH3_initCustomSecret_avx2 #elif (XXH_VECTOR == XXH_SSE2) #define XXH3_accumulate_512 XXH3_accumulate_512_sse2 +#define XXH3_accumulate XXH3_accumulate_sse2 #define XXH3_scrambleAcc XXH3_scrambleAcc_sse2 #define XXH3_initCustomSecret XXH3_initCustomSecret_sse2 #elif (XXH_VECTOR == XXH_NEON) #define XXH3_accumulate_512 XXH3_accumulate_512_neon +#define XXH3_accumulate XXH3_accumulate_neon #define XXH3_scrambleAcc XXH3_scrambleAcc_neon #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar #elif (XXH_VECTOR == XXH_VSX) #define XXH3_accumulate_512 XXH3_accumulate_512_vsx +#define XXH3_accumulate XXH3_accumulate_vsx #define XXH3_scrambleAcc XXH3_scrambleAcc_vsx #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar +#elif (XXH_VECTOR == XXH_SVE) +#define XXH3_accumulate_512 XXH3_accumulate_512_sve +#define XXH3_accumulate XXH3_accumulate_sve +#define XXH3_scrambleAcc XXH3_scrambleAcc_scalar +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#elif (XXH_VECTOR == XXH_LASX) +#define XXH3_accumulate_512 XXH3_accumulate_512_lasx +#define XXH3_accumulate XXH3_accumulate_lasx +#define XXH3_scrambleAcc XXH3_scrambleAcc_lasx +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#elif (XXH_VECTOR == XXH_LSX) +#define XXH3_accumulate_512 XXH3_accumulate_512_lsx +#define XXH3_accumulate XXH3_accumulate_lsx +#define XXH3_scrambleAcc XXH3_scrambleAcc_lsx +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + #else /* scalar */ #define XXH3_accumulate_512 XXH3_accumulate_512_scalar +#define XXH3_accumulate XXH3_accumulate_scalar #define XXH3_scrambleAcc XXH3_scrambleAcc_scalar #define XXH3_initCustomSecret XXH3_initCustomSecret_scalar #endif - - -#ifndef XXH_PREFETCH_DIST -# ifdef __clang__ -# define XXH_PREFETCH_DIST 320 -# else -# if (XXH_VECTOR == XXH_AVX512) -# define XXH_PREFETCH_DIST 512 -# else -# define XXH_PREFETCH_DIST 384 -# endif -# endif /* __clang__ */ -#endif /* XXH_PREFETCH_DIST */ - -/* - * XXH3_accumulate() - * Loops over XXH3_accumulate_512(). - * Assumption: nbStripes will not overflow the secret size - */ -XXH_FORCE_INLINE void -XXH3_accumulate( xxh_u64* XXH_RESTRICT acc, - const xxh_u8* XXH_RESTRICT input, - const xxh_u8* XXH_RESTRICT secret, - size_t nbStripes, - XXH3_f_accumulate_512 f_acc512) -{ - size_t n; - for (n = 0; n < nbStripes; n++ ) { - const xxh_u8* const in = input + n*XXH_STRIPE_LEN; - XXH_PREFETCH(in + XXH_PREFETCH_DIST); - f_acc512(acc, - in, - secret + n*XXH_SECRET_CONSUME_RATE); - } -} +#if XXH_SIZE_OPT >= 1 /* don't do SIMD for initialization */ +# undef XXH3_initCustomSecret +# define XXH3_initCustomSecret XXH3_initCustomSecret_scalar +#endif XXH_FORCE_INLINE void XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { size_t const nbStripesPerBlock = (secretSize - XXH_STRIPE_LEN) / XXH_SECRET_CONSUME_RATE; @@ -4387,7 +6097,7 @@ XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); for (n = 0; n < nb_blocks; n++) { - XXH3_accumulate(acc, input + n*block_len, secret, nbStripesPerBlock, f_acc512); + f_acc(acc, input + n*block_len, secret, nbStripesPerBlock); f_scramble(acc, secret + secretSize - XXH_STRIPE_LEN); } @@ -4395,12 +6105,12 @@ XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, XXH_ASSERT(len > XXH_STRIPE_LEN); { size_t const nbStripes = ((len - 1) - (block_len * nb_blocks)) / XXH_STRIPE_LEN; XXH_ASSERT(nbStripes <= (secretSize / XXH_SECRET_CONSUME_RATE)); - XXH3_accumulate(acc, input + nb_blocks*block_len, secret, nbStripes, f_acc512); + f_acc(acc, input + nb_blocks*block_len, secret, nbStripes); /* last stripe */ { const xxh_u8* const p = input + len - XXH_STRIPE_LEN; #define XXH_SECRET_LASTACC_START 7 /* not aligned on 8, last secret is different from acc & scrambler */ - f_acc512(acc, p, secret + secretSize - XXH_STRIPE_LEN - XXH_SECRET_LASTACC_START); + XXH3_accumulate_512(acc, p, secret + secretSize - XXH_STRIPE_LEN - XXH_SECRET_LASTACC_START); } } } @@ -4412,7 +6122,7 @@ XXH3_mix2Accs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret acc[1] ^ XXH_readLE64(secret+8) ); } -static XXH64_hash_t +static XXH_PUREF XXH64_hash_t XXH3_mergeAccs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret, xxh_u64 start) { xxh_u64 result64 = start; @@ -4439,38 +6149,47 @@ XXH3_mergeAccs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secre return XXH3_avalanche(result64); } +/* do not align on 8, so that the secret is different from the accumulator */ +#define XXH_SECRET_MERGEACCS_START 11 + +static XXH_PUREF XXH64_hash_t +XXH3_finalizeLong_64b(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret, xxh_u64 len) +{ + return XXH3_mergeAccs(acc, secret + XXH_SECRET_MERGEACCS_START, len * XXH_PRIME64_1); +} + #define XXH3_INIT_ACC { XXH_PRIME32_3, XXH_PRIME64_1, XXH_PRIME64_2, XXH_PRIME64_3, \ XXH_PRIME64_4, XXH_PRIME32_2, XXH_PRIME64_5, XXH_PRIME32_1 } XXH_FORCE_INLINE XXH64_hash_t XXH3_hashLong_64b_internal(const void* XXH_RESTRICT input, size_t len, const void* XXH_RESTRICT secret, size_t secretSize, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; - XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, (const xxh_u8*)secret, secretSize, f_acc512, f_scramble); + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, (const xxh_u8*)secret, secretSize, f_acc, f_scramble); /* converge into final hash */ XXH_STATIC_ASSERT(sizeof(acc) == 64); - /* do not align on 8, so that the secret is different from the accumulator */ -#define XXH_SECRET_MERGEACCS_START 11 XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); - return XXH3_mergeAccs(acc, (const xxh_u8*)secret + XXH_SECRET_MERGEACCS_START, (xxh_u64)len * XXH_PRIME64_1); + return XXH3_finalizeLong_64b(acc, (const xxh_u8*)secret, (xxh_u64)len); } /* * It's important for performance to transmit secret's size (when it's static) * so that the compiler can properly optimize the vectorized loop. * This makes a big performance difference for "medium" keys (<1 KB) when using AVX instruction set. + * When the secret size is unknown, or on GCC 12 where the mix of NO_INLINE and FORCE_INLINE + * breaks -Og, this is XXH_NO_INLINE. */ -XXH_FORCE_INLINE XXH64_hash_t +XXH3_WITH_SECRET_INLINE XXH64_hash_t XXH3_hashLong_64b_withSecret(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; - return XXH3_hashLong_64b_internal(input, len, secret, secretLen, XXH3_accumulate_512, XXH3_scrambleAcc); + return XXH3_hashLong_64b_internal(input, len, secret, secretLen, XXH3_accumulate, XXH3_scrambleAcc); } /* @@ -4479,12 +6198,12 @@ XXH3_hashLong_64b_withSecret(const void* XXH_RESTRICT input, size_t len, * Note that inside this no_inline function, we do inline the internal loop, * and provide a statically defined secret size to allow optimization of vector loop. */ -XXH_NO_INLINE XXH64_hash_t +XXH_NO_INLINE XXH_PUREF XXH64_hash_t XXH3_hashLong_64b_default(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; (void)secret; (void)secretLen; - return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate_512, XXH3_scrambleAcc); + return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate, XXH3_scrambleAcc); } /* @@ -4501,18 +6220,20 @@ XXH3_hashLong_64b_default(const void* XXH_RESTRICT input, size_t len, XXH_FORCE_INLINE XXH64_hash_t XXH3_hashLong_64b_withSeed_internal(const void* input, size_t len, XXH64_hash_t seed, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble, XXH3_f_initCustomSecret f_initSec) { +#if XXH_SIZE_OPT <= 0 if (seed == 0) return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), - f_acc512, f_scramble); + f_acc, f_scramble); +#endif { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; f_initSec(secret, seed); return XXH3_hashLong_64b_internal(input, len, secret, sizeof(secret), - f_acc512, f_scramble); + f_acc, f_scramble); } } @@ -4520,12 +6241,12 @@ XXH3_hashLong_64b_withSeed_internal(const void* input, size_t len, * It's important for performance that XXH3_hashLong is not inlined. */ XXH_NO_INLINE XXH64_hash_t -XXH3_hashLong_64b_withSeed(const void* input, size_t len, - XXH64_hash_t seed, const xxh_u8* secret, size_t secretLen) +XXH3_hashLong_64b_withSeed(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) { (void)secret; (void)secretLen; return XXH3_hashLong_64b_withSeed_internal(input, len, seed, - XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); + XXH3_accumulate, XXH3_scrambleAcc, XXH3_initCustomSecret); } @@ -4557,39 +6278,39 @@ XXH3_64bits_internal(const void* XXH_RESTRICT input, size_t len, /* === Public entry point === */ -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* input, size_t len) +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(XXH_NOESCAPE const void* input, size_t length) { - return XXH3_64bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_default); + return XXH3_64bits_internal(input, length, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_default); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +XXH3_64bits_withSecret(XXH_NOESCAPE const void* input, size_t length, XXH_NOESCAPE const void* secret, size_t secretSize) { - return XXH3_64bits_internal(input, len, 0, secret, secretSize, XXH3_hashLong_64b_withSecret); + return XXH3_64bits_internal(input, length, 0, secret, secretSize, XXH3_hashLong_64b_withSecret); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +XXH3_64bits_withSeed(XXH_NOESCAPE const void* input, size_t length, XXH64_hash_t seed) { - return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed); + return XXH3_64bits_internal(input, length, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed); } XXH_PUBLIC_API XXH64_hash_t -XXH3_64bits_withSecretandSeed(const void* input, size_t len, const void* secret, size_t secretSize, XXH64_hash_t seed) +XXH3_64bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t length, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed) { - if (len <= XXH3_MIDSIZE_MAX) - return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); - return XXH3_hashLong_64b_withSecret(input, len, seed, (const xxh_u8*)secret, secretSize); + if (length <= XXH3_MIDSIZE_MAX) + return XXH3_64bits_internal(input, length, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); + return XXH3_hashLong_64b_withSecret(input, length, seed, (const xxh_u8*)secret, secretSize); } /* === XXH3 streaming === */ - +#ifndef XXH_NO_STREAM /* - * Malloc's a pointer that is always aligned to align. + * Malloc's a pointer that is always aligned to @align. * * This must be freed with `XXH_alignedFree()`. * @@ -4611,7 +6332,7 @@ XXH3_64bits_withSecretandSeed(const void* input, size_t len, const void* secret, * * Align must be a power of 2 and 8 <= align <= 128. */ -static void* XXH_alignedMalloc(size_t s, size_t align) +static XXH_MALLOCF void* XXH_alignedMalloc(size_t s, size_t align) { XXH_ASSERT(align <= 128 && align >= 8); /* range check */ XXH_ASSERT((align & (align-1)) == 0); /* power of 2 */ @@ -4653,7 +6374,17 @@ static void XXH_alignedFree(void* p) XXH_free(base); } } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ +/*! + * @brief Allocate an @ref XXH3_state_t. + * + * @return An allocated pointer of @ref XXH3_state_t on success. + * @return `NULL` on failure. + * + * @note Must be freed with XXH3_freeState(). + * + * @see @ref streaming_example "Streaming Example" + */ XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void) { XXH3_state_t* const state = (XXH3_state_t*)XXH_alignedMalloc(sizeof(XXH3_state_t), 64); @@ -4662,16 +6393,27 @@ XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void) return state; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ +/*! + * @brief Frees an @ref XXH3_state_t. + * + * @param statePtr A pointer to an @ref XXH3_state_t allocated with @ref XXH3_createState(). + * + * @return @ref XXH_OK. + * + * @note Must be allocated with XXH3_createState(). + * + * @see @ref streaming_example "Streaming Example" + */ XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr) { XXH_alignedFree(statePtr); return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API void -XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state) +XXH3_copyState(XXH_NOESCAPE XXH3_state_t* dst_state, XXH_NOESCAPE const XXH3_state_t* src_state) { XXH_memcpy(dst_state, src_state, sizeof(*dst_state)); } @@ -4686,7 +6428,7 @@ XXH3_reset_internal(XXH3_state_t* statePtr, XXH_ASSERT(offsetof(XXH3_state_t, nbStripesPerBlock) > initStart); XXH_ASSERT(statePtr != NULL); /* set members from bufferedSize to nbStripesPerBlock (excluded) to 0 */ - memset((char*)statePtr + initStart, 0, initLength); + XXH_memset((char*)statePtr + initStart, 0, initLength); statePtr->acc[0] = XXH_PRIME32_3; statePtr->acc[1] = XXH_PRIME64_1; statePtr->acc[2] = XXH_PRIME64_2; @@ -4703,18 +6445,18 @@ XXH3_reset_internal(XXH3_state_t* statePtr, statePtr->nbStripesPerBlock = statePtr->secretLimit / XXH_SECRET_CONSUME_RATE; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset(XXH3_state_t* statePtr) +XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr) { if (statePtr == NULL) return XXH_ERROR; XXH3_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize) { if (statePtr == NULL) return XXH_ERROR; XXH3_reset_internal(statePtr, 0, secret, secretSize); @@ -4723,9 +6465,9 @@ XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed) { if (statePtr == NULL) return XXH_ERROR; if (seed==0) return XXH3_64bits_reset(statePtr); @@ -4735,9 +6477,9 @@ XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_reset_withSecretandSeed(XXH3_state_t* statePtr, const void* secret, size_t secretSize, XXH64_hash_t seed64) +XXH3_64bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64) { if (statePtr == NULL) return XXH_ERROR; if (secret == NULL) return XXH_ERROR; @@ -4747,45 +6489,72 @@ XXH3_64bits_reset_withSecretandSeed(XXH3_state_t* statePtr, const void* secret, return XXH_OK; } -/* Note : when XXH3_consumeStripes() is invoked, - * there must be a guarantee that at least one more byte must be consumed from input - * so that the function can blindly consume all stripes using the "normal" secret segment */ -XXH_FORCE_INLINE void +/*! + * @internal + * @brief Processes a large input for XXH3_update() and XXH3_digest_long(). + * + * Unlike XXH3_hashLong_internal_loop(), this can process data that overlaps a block. + * + * @param acc Pointer to the 8 accumulator lanes + * @param nbStripesSoFarPtr In/out pointer to the number of leftover stripes in the block* + * @param nbStripesPerBlock Number of stripes in a block + * @param input Input pointer + * @param nbStripes Number of stripes to process + * @param secret Secret pointer + * @param secretLimit Offset of the last block in @p secret + * @param f_acc Pointer to an XXH3_accumulate implementation + * @param f_scramble Pointer to an XXH3_scrambleAcc implementation + * @return Pointer past the end of @p input after processing + */ +XXH_FORCE_INLINE const xxh_u8 * XXH3_consumeStripes(xxh_u64* XXH_RESTRICT acc, size_t* XXH_RESTRICT nbStripesSoFarPtr, size_t nbStripesPerBlock, const xxh_u8* XXH_RESTRICT input, size_t nbStripes, const xxh_u8* XXH_RESTRICT secret, size_t secretLimit, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { - XXH_ASSERT(nbStripes <= nbStripesPerBlock); /* can handle max 1 scramble per invocation */ - XXH_ASSERT(*nbStripesSoFarPtr < nbStripesPerBlock); - if (nbStripesPerBlock - *nbStripesSoFarPtr <= nbStripes) { - /* need a scrambling operation */ - size_t const nbStripesToEndofBlock = nbStripesPerBlock - *nbStripesSoFarPtr; - size_t const nbStripesAfterBlock = nbStripes - nbStripesToEndofBlock; - XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripesToEndofBlock, f_acc512); - f_scramble(acc, secret + secretLimit); - XXH3_accumulate(acc, input + nbStripesToEndofBlock * XXH_STRIPE_LEN, secret, nbStripesAfterBlock, f_acc512); - *nbStripesSoFarPtr = nbStripesAfterBlock; - } else { - XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripes, f_acc512); + const xxh_u8* initialSecret = secret + *nbStripesSoFarPtr * XXH_SECRET_CONSUME_RATE; + /* Process full blocks */ + if (nbStripes >= (nbStripesPerBlock - *nbStripesSoFarPtr)) { + /* Process the initial partial block... */ + size_t nbStripesThisIter = nbStripesPerBlock - *nbStripesSoFarPtr; + + do { + /* Accumulate and scramble */ + f_acc(acc, input, initialSecret, nbStripesThisIter); + f_scramble(acc, secret + secretLimit); + input += nbStripesThisIter * XXH_STRIPE_LEN; + nbStripes -= nbStripesThisIter; + /* Then continue the loop with the full block size */ + nbStripesThisIter = nbStripesPerBlock; + initialSecret = secret; + } while (nbStripes >= nbStripesPerBlock); + *nbStripesSoFarPtr = 0; + } + /* Process a partial block */ + if (nbStripes > 0) { + f_acc(acc, input, initialSecret, nbStripes); + input += nbStripes * XXH_STRIPE_LEN; *nbStripesSoFarPtr += nbStripes; } + /* Return end pointer */ + return input; } #ifndef XXH3_STREAM_USE_STACK -# ifndef __clang__ /* clang doesn't need additional stack space */ +# if XXH_SIZE_OPT <= 0 && !defined(__clang__) /* clang doesn't need additional stack space */ # define XXH3_STREAM_USE_STACK 1 # endif #endif -/* - * Both XXH3_64bits_update and XXH3_128bits_update use this routine. +/* This function accepts f_acc and f_scramble as function pointers, + * making it possible to implement multiple variants with different acc & scramble stages. + * This is notably useful to implement multiple vector variants with different intrinsics. */ XXH_FORCE_INLINE XXH_errorcode XXH3_update(XXH3_state_t* XXH_RESTRICT const state, const xxh_u8* XXH_RESTRICT input, size_t len, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { if (input==NULL) { @@ -4801,7 +6570,8 @@ XXH3_update(XXH3_state_t* XXH_RESTRICT const state, * when operating accumulators directly into state. * Operating into stack space seems to enable proper optimization. * clang, on the other hand, doesn't seem to need this trick */ - XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[8]; memcpy(acc, state->acc, sizeof(acc)); + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[8]; + XXH_memcpy(acc, state->acc, sizeof(acc)); #else xxh_u64* XXH_RESTRICT const acc = state->acc; #endif @@ -4809,7 +6579,7 @@ XXH3_update(XXH3_state_t* XXH_RESTRICT const state, XXH_ASSERT(state->bufferedSize <= XXH3_INTERNALBUFFER_SIZE); /* small input : just fill in tmp buffer */ - if (state->bufferedSize + len <= XXH3_INTERNALBUFFER_SIZE) { + if (len <= XXH3_INTERNALBUFFER_SIZE - state->bufferedSize) { XXH_memcpy(state->buffer + state->bufferedSize, input, len); state->bufferedSize += (XXH32_hash_t)len; return XXH_OK; @@ -4831,57 +6601,20 @@ XXH3_update(XXH3_state_t* XXH_RESTRICT const state, &state->nbStripesSoFar, state->nbStripesPerBlock, state->buffer, XXH3_INTERNALBUFFER_STRIPES, secret, state->secretLimit, - f_acc512, f_scramble); + f_acc, f_scramble); state->bufferedSize = 0; } XXH_ASSERT(input < bEnd); - - /* large input to consume : ingest per full block */ - if ((size_t)(bEnd - input) > state->nbStripesPerBlock * XXH_STRIPE_LEN) { + if (bEnd - input > XXH3_INTERNALBUFFER_SIZE) { size_t nbStripes = (size_t)(bEnd - 1 - input) / XXH_STRIPE_LEN; - XXH_ASSERT(state->nbStripesPerBlock >= state->nbStripesSoFar); - /* join to current block's end */ - { size_t const nbStripesToEnd = state->nbStripesPerBlock - state->nbStripesSoFar; - XXH_ASSERT(nbStripes <= nbStripes); - XXH3_accumulate(acc, input, secret + state->nbStripesSoFar * XXH_SECRET_CONSUME_RATE, nbStripesToEnd, f_acc512); - f_scramble(acc, secret + state->secretLimit); - state->nbStripesSoFar = 0; - input += nbStripesToEnd * XXH_STRIPE_LEN; - nbStripes -= nbStripesToEnd; - } - /* consume per entire blocks */ - while(nbStripes >= state->nbStripesPerBlock) { - XXH3_accumulate(acc, input, secret, state->nbStripesPerBlock, f_acc512); - f_scramble(acc, secret + state->secretLimit); - input += state->nbStripesPerBlock * XXH_STRIPE_LEN; - nbStripes -= state->nbStripesPerBlock; - } - /* consume last partial block */ - XXH3_accumulate(acc, input, secret, nbStripes, f_acc512); - input += nbStripes * XXH_STRIPE_LEN; - XXH_ASSERT(input < bEnd); /* at least some bytes left */ - state->nbStripesSoFar = nbStripes; - /* buffer predecessor of last partial stripe */ - XXH_memcpy(state->buffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); - XXH_ASSERT(bEnd - input <= XXH_STRIPE_LEN); - } else { - /* content to consume <= block size */ - /* Consume input by a multiple of internal buffer size */ - if (bEnd - input > XXH3_INTERNALBUFFER_SIZE) { - const xxh_u8* const limit = bEnd - XXH3_INTERNALBUFFER_SIZE; - do { - XXH3_consumeStripes(acc, + input = XXH3_consumeStripes(acc, &state->nbStripesSoFar, state->nbStripesPerBlock, - input, XXH3_INTERNALBUFFER_STRIPES, - secret, state->secretLimit, - f_acc512, f_scramble); - input += XXH3_INTERNALBUFFER_SIZE; - } while (inputbuffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); - } - } + input, nbStripes, + secret, state->secretLimit, + f_acc, f_scramble); + XXH_memcpy(state->buffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); + } /* Some remaining input (always) : buffer it */ XXH_ASSERT(input < bEnd); XXH_ASSERT(bEnd - input <= XXH3_INTERNALBUFFER_SIZE); @@ -4890,19 +6623,28 @@ XXH3_update(XXH3_state_t* XXH_RESTRICT const state, state->bufferedSize = (XXH32_hash_t)(bEnd-input); #if defined(XXH3_STREAM_USE_STACK) && XXH3_STREAM_USE_STACK >= 1 /* save stack accumulators into state */ - memcpy(state->acc, acc, sizeof(acc)); + XXH_memcpy(state->acc, acc, sizeof(acc)); #endif } return XXH_OK; } -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API XXH_errorcode -XXH3_64bits_update(XXH3_state_t* state, const void* input, size_t len) +/* + * Both XXH3_64bits_update and XXH3_128bits_update use this routine. + */ +XXH_NO_INLINE XXH_errorcode +XXH3_update_regular(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len) { return XXH3_update(state, (const xxh_u8*)input, len, - XXH3_accumulate_512, XXH3_scrambleAcc); + XXH3_accumulate, XXH3_scrambleAcc); +} + +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_update(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len) +{ + return XXH3_update_regular(state, input, len); } @@ -4911,45 +6653,46 @@ XXH3_digest_long (XXH64_hash_t* acc, const XXH3_state_t* state, const unsigned char* secret) { + xxh_u8 lastStripe[XXH_STRIPE_LEN]; + const xxh_u8* lastStripePtr; + /* * Digest on a local copy. This way, the state remains unaltered, and it can * continue ingesting more input afterwards. */ XXH_memcpy(acc, state->acc, sizeof(state->acc)); if (state->bufferedSize >= XXH_STRIPE_LEN) { + /* Consume remaining stripes then point to remaining data in buffer */ size_t const nbStripes = (state->bufferedSize - 1) / XXH_STRIPE_LEN; size_t nbStripesSoFar = state->nbStripesSoFar; XXH3_consumeStripes(acc, &nbStripesSoFar, state->nbStripesPerBlock, state->buffer, nbStripes, secret, state->secretLimit, - XXH3_accumulate_512, XXH3_scrambleAcc); - /* last stripe */ - XXH3_accumulate_512(acc, - state->buffer + state->bufferedSize - XXH_STRIPE_LEN, - secret + state->secretLimit - XXH_SECRET_LASTACC_START); + XXH3_accumulate, XXH3_scrambleAcc); + lastStripePtr = state->buffer + state->bufferedSize - XXH_STRIPE_LEN; } else { /* bufferedSize < XXH_STRIPE_LEN */ - xxh_u8 lastStripe[XXH_STRIPE_LEN]; + /* Copy to temp buffer */ size_t const catchupSize = XXH_STRIPE_LEN - state->bufferedSize; XXH_ASSERT(state->bufferedSize > 0); /* there is always some input buffered */ XXH_memcpy(lastStripe, state->buffer + sizeof(state->buffer) - catchupSize, catchupSize); XXH_memcpy(lastStripe + catchupSize, state->buffer, state->bufferedSize); - XXH3_accumulate_512(acc, - lastStripe, - secret + state->secretLimit - XXH_SECRET_LASTACC_START); + lastStripePtr = lastStripe; } + /* Last stripe */ + XXH3_accumulate_512(acc, + lastStripePtr, + secret + state->secretLimit - XXH_SECRET_LASTACC_START); } -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (XXH_NOESCAPE const XXH3_state_t* state) { const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; if (state->totalLen > XXH3_MIDSIZE_MAX) { XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; XXH3_digest_long(acc, state, secret); - return XXH3_mergeAccs(acc, - secret + XXH_SECRET_MERGEACCS_START, - (xxh_u64)state->totalLen * XXH_PRIME64_1); + return XXH3_finalizeLong_64b(acc, secret, (xxh_u64)state->totalLen); } /* totalLen <= XXH3_MIDSIZE_MAX: digesting a short input */ if (state->useSeed) @@ -4957,7 +6700,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) return XXH3_64bits_withSecret(state->buffer, (size_t)(state->totalLen), secret, state->secretLimit + XXH_STRIPE_LEN); } - +#endif /* !XXH_NO_STREAM */ /* ========================================== @@ -4977,7 +6720,7 @@ XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) * fast for a _128-bit_ hash on 32-bit (it usually clears XXH64). */ -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_1to3_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { /* A doubled version of 1to3_64b with different constants. */ @@ -5006,7 +6749,7 @@ XXH3_len_1to3_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_ } } -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_4to8_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -5026,14 +6769,14 @@ XXH3_len_4to8_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_ m128.low64 ^= (m128.high64 >> 3); m128.low64 = XXH_xorshift64(m128.low64, 35); - m128.low64 *= 0x9FB21C651E98DF25ULL; + m128.low64 *= PRIME_MX2; m128.low64 = XXH_xorshift64(m128.low64, 28); m128.high64 = XXH3_avalanche(m128.high64); return m128; } } -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_9to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(input != NULL); @@ -5108,7 +6851,7 @@ XXH3_len_9to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64 /* * Assumption: `secret` size is >= XXH3_SECRET_SIZE_MIN */ -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_0to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) { XXH_ASSERT(len <= 16); @@ -5139,7 +6882,7 @@ XXH128_mix32B(XXH128_hash_t acc, const xxh_u8* input_1, const xxh_u8* input_2, } -XXH_FORCE_INLINE XXH128_hash_t +XXH_FORCE_INLINE XXH_PUREF XXH128_hash_t XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) @@ -5150,6 +6893,16 @@ XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, { XXH128_hash_t acc; acc.low64 = len * XXH_PRIME64_1; acc.high64 = 0; + +#if XXH_SIZE_OPT >= 1 + { + /* Smaller, but slightly slower. */ + unsigned int i = (unsigned int)(len - 1) / 32; + do { + acc = XXH128_mix32B(acc, input+16*i, input+len-16*(i+1), secret+32*i, seed); + } while (i-- != 0); + } +#else if (len > 32) { if (len > 64) { if (len > 96) { @@ -5160,6 +6913,7 @@ XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, acc = XXH128_mix32B(acc, input+16, input+len-32, secret+32, seed); } acc = XXH128_mix32B(acc, input, input+len-16, secret, seed); +#endif { XXH128_hash_t h128; h128.low64 = acc.low64 + acc.high64; h128.high64 = (acc.low64 * XXH_PRIME64_1) @@ -5172,7 +6926,7 @@ XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, } } -XXH_NO_INLINE XXH128_hash_t +XXH_NO_INLINE XXH_PUREF XXH128_hash_t XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, XXH64_hash_t seed) @@ -5181,25 +6935,34 @@ XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); { XXH128_hash_t acc; - int const nbRounds = (int)len / 32; - int i; + unsigned i; acc.low64 = len * XXH_PRIME64_1; acc.high64 = 0; - for (i=0; i<4; i++) { + /* + * We set as `i` as offset + 32. We do this so that unchanged + * `len` can be used as upper bound. This reaches a sweet spot + * where both x86 and aarch64 get simple agen and good codegen + * for the loop. + */ + for (i = 32; i < 160; i += 32) { acc = XXH128_mix32B(acc, - input + (32 * i), - input + (32 * i) + 16, - secret + (32 * i), + input + i - 32, + input + i - 16, + secret + i - 32, seed); } acc.low64 = XXH3_avalanche(acc.low64); acc.high64 = XXH3_avalanche(acc.high64); - XXH_ASSERT(nbRounds >= 4); - for (i=4 ; i < nbRounds; i++) { + /* + * NB: `i <= len` will duplicate the last 32-bytes if + * len % 32 was zero. This is an unfortunate necessity to keep + * the hash result stable. + */ + for (i=160; i <= len; i += 32) { acc = XXH128_mix32B(acc, - input + (32 * i), - input + (32 * i) + 16, - secret + XXH3_MIDSIZE_STARTOFFSET + (32 * (i - 4)), + input + i - 32, + input + i - 16, + secret + XXH3_MIDSIZE_STARTOFFSET + i - 160, seed); } /* last bytes */ @@ -5207,7 +6970,7 @@ XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, input + len - 16, input + len - 32, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET - 16, - 0ULL - seed); + (XXH64_hash_t)0 - seed); { XXH128_hash_t h128; h128.low64 = acc.low64 + acc.high64; @@ -5221,73 +6984,78 @@ XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, } } +static XXH_PUREF XXH128_hash_t +XXH3_finalizeLong_128b(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, xxh_u64 len) +{ + XXH128_hash_t h128; + h128.low64 = XXH3_finalizeLong_64b(acc, secret, len); + h128.high64 = XXH3_mergeAccs(acc, secret + secretSize + - XXH_STRIPE_LEN - XXH_SECRET_MERGEACCS_START, + ~(len * XXH_PRIME64_2)); + return h128; +} + XXH_FORCE_INLINE XXH128_hash_t XXH3_hashLong_128b_internal(const void* XXH_RESTRICT input, size_t len, const xxh_u8* XXH_RESTRICT secret, size_t secretSize, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble) { XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; - XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, secret, secretSize, f_acc512, f_scramble); + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, secret, secretSize, f_acc, f_scramble); /* converge into final hash */ XXH_STATIC_ASSERT(sizeof(acc) == 64); XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); - { XXH128_hash_t h128; - h128.low64 = XXH3_mergeAccs(acc, - secret + XXH_SECRET_MERGEACCS_START, - (xxh_u64)len * XXH_PRIME64_1); - h128.high64 = XXH3_mergeAccs(acc, - secret + secretSize - - sizeof(acc) - XXH_SECRET_MERGEACCS_START, - ~((xxh_u64)len * XXH_PRIME64_2)); - return h128; - } + return XXH3_finalizeLong_128b(acc, secret, secretSize, (xxh_u64)len); } /* - * It's important for performance that XXH3_hashLong is not inlined. + * It's important for performance that XXH3_hashLong() is not inlined. */ -XXH_NO_INLINE XXH128_hash_t +XXH_NO_INLINE XXH_PUREF XXH128_hash_t XXH3_hashLong_128b_default(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; (void)secret; (void)secretLen; return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), - XXH3_accumulate_512, XXH3_scrambleAcc); + XXH3_accumulate, XXH3_scrambleAcc); } /* - * It's important for performance to pass @secretLen (when it's static) + * It's important for performance to pass @p secretLen (when it's static) * to the compiler, so that it can properly optimize the vectorized loop. + * + * When the secret size is unknown, or on GCC 12 where the mix of NO_INLINE and FORCE_INLINE + * breaks -Og, this is XXH_NO_INLINE. */ -XXH_FORCE_INLINE XXH128_hash_t +XXH3_WITH_SECRET_INLINE XXH128_hash_t XXH3_hashLong_128b_withSecret(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) { (void)seed64; return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, secretLen, - XXH3_accumulate_512, XXH3_scrambleAcc); + XXH3_accumulate, XXH3_scrambleAcc); } XXH_FORCE_INLINE XXH128_hash_t XXH3_hashLong_128b_withSeed_internal(const void* XXH_RESTRICT input, size_t len, XXH64_hash_t seed64, - XXH3_f_accumulate_512 f_acc512, + XXH3_f_accumulate f_acc, XXH3_f_scrambleAcc f_scramble, XXH3_f_initCustomSecret f_initSec) { if (seed64 == 0) return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), - f_acc512, f_scramble); + f_acc, f_scramble); { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; f_initSec(secret, seed64); return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, sizeof(secret), - f_acc512, f_scramble); + f_acc, f_scramble); } } @@ -5300,7 +7068,7 @@ XXH3_hashLong_128b_withSeed(const void* input, size_t len, { (void)secret; (void)secretLen; return XXH3_hashLong_128b_withSeed_internal(input, len, seed64, - XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); + XXH3_accumulate, XXH3_scrambleAcc, XXH3_initCustomSecret); } typedef XXH128_hash_t (*XXH3_hashLong128_f)(const void* XXH_RESTRICT, size_t, @@ -5330,136 +7098,124 @@ XXH3_128bits_internal(const void* input, size_t len, /* === Public XXH128 API === */ -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* input, size_t len) +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(XXH_NOESCAPE const void* input, size_t len) { return XXH3_128bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_default); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +XXH3_128bits_withSecret(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize) { return XXH3_128bits_internal(input, len, 0, (const xxh_u8*)secret, secretSize, XXH3_hashLong_128b_withSecret); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +XXH3_128bits_withSeed(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_withSeed); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH3_128bits_withSecretandSeed(const void* input, size_t len, const void* secret, size_t secretSize, XXH64_hash_t seed) +XXH3_128bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed) { if (len <= XXH3_MIDSIZE_MAX) return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); return XXH3_hashLong_128b_withSecret(input, len, seed, secret, secretSize); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH128(const void* input, size_t len, XXH64_hash_t seed) +XXH128(XXH_NOESCAPE const void* input, size_t len, XXH64_hash_t seed) { return XXH3_128bits_withSeed(input, len, seed); } /* === XXH3 128-bit streaming === */ - +#ifndef XXH_NO_STREAM /* * All initialization and update functions are identical to 64-bit streaming variant. * The only difference is the finalization routine. */ -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset(XXH3_state_t* statePtr) +XXH3_128bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr) { return XXH3_64bits_reset(statePtr); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +XXH3_128bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize) { return XXH3_64bits_reset_withSecret(statePtr, secret, secretSize); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +XXH3_128bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed) { return XXH3_64bits_reset_withSeed(statePtr, seed); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, const void* secret, size_t secretSize, XXH64_hash_t seed) +XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed) { return XXH3_64bits_reset_withSecretandSeed(statePtr, secret, secretSize, seed); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_128bits_update(XXH3_state_t* state, const void* input, size_t len) +XXH3_128bits_update(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* input, size_t len) { - return XXH3_update(state, (const xxh_u8*)input, len, - XXH3_accumulate_512, XXH3_scrambleAcc); + return XXH3_update_regular(state, input, len); } -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* state) +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (XXH_NOESCAPE const XXH3_state_t* state) { const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; if (state->totalLen > XXH3_MIDSIZE_MAX) { XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; XXH3_digest_long(acc, state, secret); XXH_ASSERT(state->secretLimit + XXH_STRIPE_LEN >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); - { XXH128_hash_t h128; - h128.low64 = XXH3_mergeAccs(acc, - secret + XXH_SECRET_MERGEACCS_START, - (xxh_u64)state->totalLen * XXH_PRIME64_1); - h128.high64 = XXH3_mergeAccs(acc, - secret + state->secretLimit + XXH_STRIPE_LEN - - sizeof(acc) - XXH_SECRET_MERGEACCS_START, - ~((xxh_u64)state->totalLen * XXH_PRIME64_2)); - return h128; - } + return XXH3_finalizeLong_128b(acc, secret, state->secretLimit + XXH_STRIPE_LEN, (xxh_u64)state->totalLen); } /* len <= XXH3_MIDSIZE_MAX : short code */ - if (state->seed) + if (state->useSeed) return XXH3_128bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); return XXH3_128bits_withSecret(state->buffer, (size_t)(state->totalLen), secret, state->secretLimit + XXH_STRIPE_LEN); } - +#endif /* !XXH_NO_STREAM */ /* 128-bit utility functions */ -#include /* memcmp, memcpy */ - /* return : 1 is equal, 0 if different */ -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2) { /* note : XXH128_hash_t is compact, it has no padding byte */ - return !(memcmp(&h1, &h2, sizeof(h1))); + return !(XXH_memcmp(&h1, &h2, sizeof(h1))); } /* This prototype is compatible with stdlib's qsort(). - * return : >0 if *h128_1 > *h128_2 - * <0 if *h128_1 < *h128_2 - * =0 if *h128_1 == *h128_2 */ -/*! @ingroup xxh3_family */ -XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2) + * @return : >0 if *h128_1 > *h128_2 + * <0 if *h128_1 < *h128_2 + * =0 if *h128_1 == *h128_2 */ +/*! @ingroup XXH3_family */ +XXH_PUBLIC_API int XXH128_cmp(XXH_NOESCAPE const void* h128_1, XXH_NOESCAPE const void* h128_2) { XXH128_hash_t const h1 = *(const XXH128_hash_t*)h128_1; XXH128_hash_t const h2 = *(const XXH128_hash_t*)h128_2; @@ -5471,9 +7227,9 @@ XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2) /*====== Canonical representation ======*/ -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API void -XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash) +XXH128_canonicalFromHash(XXH_NOESCAPE XXH128_canonical_t* dst, XXH128_hash_t hash) { XXH_STATIC_ASSERT(sizeof(XXH128_canonical_t) == sizeof(XXH128_hash_t)); if (XXH_CPU_LITTLE_ENDIAN) { @@ -5484,9 +7240,9 @@ XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash) XXH_memcpy((char*)dst + sizeof(hash.high64), &hash.low64, sizeof(hash.low64)); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH128_hash_t -XXH128_hashFromCanonical(const XXH128_canonical_t* src) +XXH128_hashFromCanonical(XXH_NOESCAPE const XXH128_canonical_t* src) { XXH128_hash_t h; h.high64 = XXH_readBE64(src); @@ -5502,32 +7258,40 @@ XXH128_hashFromCanonical(const XXH128_canonical_t* src) */ #define XXH_MIN(x, y) (((x) > (y)) ? (y) : (x)) -static void XXH3_combine16(void* dst, XXH128_hash_t h128) +XXH_FORCE_INLINE void XXH3_combine16(void* dst, XXH128_hash_t h128) { XXH_writeLE64( dst, XXH_readLE64(dst) ^ h128.low64 ); XXH_writeLE64( (char*)dst+8, XXH_readLE64((char*)dst+8) ^ h128.high64 ); } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API XXH_errorcode -XXH3_generateSecret(void* secretBuffer, size_t secretSize, const void* customSeed, size_t customSeedSize) +XXH3_generateSecret(XXH_NOESCAPE void* secretBuffer, size_t secretSize, XXH_NOESCAPE const void* customSeed, size_t customSeedSize) { +#if (XXH_DEBUGLEVEL >= 1) XXH_ASSERT(secretBuffer != NULL); - if (secretBuffer == NULL) return XXH_ERROR; XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); +#else + /* production mode, assert() are disabled */ + if (secretBuffer == NULL) return XXH_ERROR; if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; +#endif + if (customSeedSize == 0) { customSeed = XXH3_kSecret; customSeedSize = XXH_SECRET_DEFAULT_SIZE; } +#if (XXH_DEBUGLEVEL >= 1) XXH_ASSERT(customSeed != NULL); +#else if (customSeed == NULL) return XXH_ERROR; +#endif /* Fill secretBuffer with a copy of customSeed - repeat as needed */ { size_t pos = 0; while (pos < secretSize) { size_t const toCopy = XXH_MIN((secretSize - pos), customSeedSize); - memcpy((char*)secretBuffer + pos, customSeed, toCopy); + XXH_memcpy((char*)secretBuffer + pos, customSeed, toCopy); pos += toCopy; } } @@ -5545,14 +7309,14 @@ XXH3_generateSecret(void* secretBuffer, size_t secretSize, const void* customSee return XXH_OK; } -/*! @ingroup xxh3_family */ +/*! @ingroup XXH3_family */ XXH_PUBLIC_API void -XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_t seed) +XXH3_generateSecret_fromSeed(XXH_NOESCAPE void* secretBuffer, XXH64_hash_t seed) { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; XXH3_initCustomSecret(secret, seed); XXH_ASSERT(secretBuffer != NULL); - memcpy(secretBuffer, secret, XXH_SECRET_DEFAULT_SIZE); + XXH_memcpy(secretBuffer, secret, XXH_SECRET_DEFAULT_SIZE); } @@ -5560,7 +7324,7 @@ XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_t seed) /* Pop our optimization override from above */ #if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ - && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ + && defined(__OPTIMIZE__) && XXH_SIZE_OPT <= 0 /* respect -O0 and -Os */ # pragma GCC pop_options #endif @@ -5574,6 +7338,6 @@ XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_t seed) #endif /* XXH_IMPLEMENTATION */ -#if defined (__cplusplus) -} +#if defined (__cplusplus) && !defined(XXH_NO_EXTERNC_GUARD) +} /* extern "C" */ #endif diff --git a/lib/cfl/src/cfl_kvlist.c b/lib/cfl/src/cfl_kvlist.c index 12c7711290c..4ffc5ea83a2 100644 --- a/lib/cfl/src/cfl_kvlist.c +++ b/lib/cfl/src/cfl_kvlist.c @@ -329,7 +329,7 @@ struct cfl_variant *cfl_kvlist_fetch_s(struct cfl_kvlist *list, char *key, size_ continue; } - if (strncmp(pair->key, key, key_size) == 0) { + if (strncasecmp(pair->key, key, key_size) == 0) { return pair->val; } } diff --git a/lib/cfl/src/cfl_variant.c b/lib/cfl/src/cfl_variant.c index 1b688b847fe..3e7065e3737 100644 --- a/lib/cfl/src/cfl_variant.c +++ b/lib/cfl/src/cfl_variant.c @@ -104,7 +104,7 @@ struct cfl_variant *cfl_variant_create_from_string_s(char *value, size_t value_s instance->data.as_string = cfl_sds_create_len(value, value_size); if (instance->data.as_string == NULL) { free(instance); - instance = NULL; + return NULL; } } @@ -136,7 +136,7 @@ struct cfl_variant *cfl_variant_create_from_bytes(char *value, size_t length, in instance->data.as_bytes = cfl_sds_create_len(value, length); if (instance->data.as_bytes == NULL) { free(instance); - instance = NULL; + return NULL; } } cfl_variant_size_set(instance, length); From bafa67f5749fb0208b77b98f921ef05d876a560d Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Mon, 7 Apr 2025 15:47:46 -0600 Subject: [PATCH 02/29] lib: chunkio: upgrade to v1.5.3 Signed-off-by: Eduardo Silva --- lib/chunkio/.github/dependabot.yml | 6 + lib/chunkio/CMakeLists.txt | 4 +- lib/chunkio/tests/fs_fragmentation.c | 221 +++++++++++++++++++++++++++ lib/chunkio/tests/fs_perf.c | 206 +++++++++++++++++++++++++ 4 files changed, 435 insertions(+), 2 deletions(-) create mode 100644 lib/chunkio/.github/dependabot.yml create mode 100644 lib/chunkio/tests/fs_fragmentation.c create mode 100644 lib/chunkio/tests/fs_perf.c diff --git a/lib/chunkio/.github/dependabot.yml b/lib/chunkio/.github/dependabot.yml new file mode 100644 index 00000000000..8ac6b8c4984 --- /dev/null +++ b/lib/chunkio/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/lib/chunkio/CMakeLists.txt b/lib/chunkio/CMakeLists.txt index dbc7d4805b0..21f1c3e47fe 100644 --- a/lib/chunkio/CMakeLists.txt +++ b/lib/chunkio/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.20) project(chunk-io C) set(CIO_VERSION_MAJOR 1) set(CIO_VERSION_MINOR 5) -set(CIO_VERSION_PATCH 2) +set(CIO_VERSION_PATCH 3) set(CIO_VERSION_STR "${CIO_VERSION_MAJOR}.${CIO_VERSION_MINOR}.${CIO_VERSION_PATCH}") # CFLAGS diff --git a/lib/chunkio/tests/fs_fragmentation.c b/lib/chunkio/tests/fs_fragmentation.c new file mode 100644 index 00000000000..fc2c5777fed --- /dev/null +++ b/lib/chunkio/tests/fs_fragmentation.c @@ -0,0 +1,221 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* Chunk I/O + * ========= + * Copyright 2023 Eduardo Silva + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _WIN32 +#include +#include +#endif +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cio_tests_internal.h" + +/* These tests are disabled by default because they are meant to + * test a filesystem fragmentation issue that only affects XFS + * under certain specific conditions. + * + * Environment setup instructions : + * + * mkdir chunks + * dd if=/dev/zero of=xfs_filesystem bs=1024 count=9765625 + * export LOOP_DEVICE=$(losetup -f) + * losetup /dev/$LOOP_DEVICE xfs_filesystem + * mkfs.xfs -f -b size=4096 -d agcount=20 /dev/$LOOP_DEVICE + * mkdir chunks + * mount /dev/$LOOP_DEVICE chunks + */ + +#define CIO_ENV "/tmp/cio-fs-test/" +#define CIO_FILE_400KB CIO_TESTS_DATA_PATH "/data/400kb.txt" +#define CHUNK_FILE_COUNT 3500 +#define CHUNK_SIZE_LIMIT (2 * 1024 * 1000) +#define TEST_DURATION (60 * 5) + +/* Logging callback, once called it just turn on the log_check flag */ +static int log_cb(struct cio_ctx *ctx, int level, const char *file, int line, + char *str) +{ + (void) ctx; + + printf("[cio-test-fs] %-60s => %s:%i\n", str, file, line); + + return 0; +} + +static void test_core(int trim_chunk_files) +{ + struct cio_chunk *chunks[CHUNK_FILE_COUNT]; + int failure_detected; + int chunk_file_full; + char chunk_name[64]; + time_t current_time; + time_t elapsed_time; + time_t start_time; + size_t write_size; + size_t chunk_id; + struct cio_options cio_opts; + char *in_data; + size_t in_size; + struct cio_stream *stream; + struct cio_chunk *chunk; + struct cio_ctx *ctx; + int ret; + +#ifndef EXECUTE_FS_FRAGMENTATION_TESTS + return; +#endif + + srand(time(NULL)); + + /* delete any previous temporary content directory */ + cio_utils_recursive_delete(CIO_ENV); + + /* initialize options */ + cio_options_init(&cio_opts); + + cio_opts.root_path = CIO_ENV; + cio_opts.log_cb = log_cb; + cio_opts.log_level = CIO_LOG_INFO; + + if (trim_chunk_files) { + cio_opts.flags |= CIO_TRIM_FILES; + } + + /* + * Load sample data file and with the same content through multiple write + * operations generating other files. + */ + ret = cio_utils_read_file(CIO_FILE_400KB, &in_data, &in_size); + TEST_CHECK(ret == 0); + if (ret == -1) { + exit(EXIT_FAILURE); + } + printf("in_size = %zu\n", in_size); + + ctx = cio_create(&cio_opts); + stream = cio_stream_create(ctx, "test-fragmentation", CIO_STORE_FS); + + memset(chunks, 0, sizeof(chunks)); + + /* do not force a maximum of chunks up, we want to test writing overhead */ + cio_set_max_chunks_up(ctx, 1000000); + + start_time = time(NULL); + current_time = time(NULL); + elapsed_time = current_time - start_time; + failure_detected = CIO_FALSE; + + chunk_id = 0; + + while (elapsed_time < TEST_DURATION) { + if (chunks[chunk_id] != NULL) { + chunk = chunks[chunk_id]; + + cio_chunk_close(chunk, CIO_TRUE); + + chunks[chunk_id] = NULL; + } + + if (chunks[chunk_id] == NULL) { + snprintf(chunk_name, + sizeof(chunk_name) - 1, + "chunk-%03zu", + chunk_id); + + chunks[chunk_id] = cio_chunk_open(ctx, + stream, + chunk_name, + CIO_OPEN, + 1000, + &ret); + + if (chunks[chunk_id] == NULL) { + failure_detected = CIO_TRUE; + + break; + } + } + + chunk = chunks[chunk_id]; + + chunk_file_full = CIO_FALSE; + + while (chunk_file_full != CIO_TRUE) { + write_size = rand() * 976; + write_size %= (32 * 1024); + + if (!cio_chunk_is_up(chunk)) { + ret = cio_chunk_up(chunk); + } + + ret = cio_chunk_write(chunk, in_data, write_size); + + if (cio_chunk_get_content_size(chunk) > CHUNK_SIZE_LIMIT) { + chunk_file_full = CIO_TRUE; + } + + ret = cio_chunk_down(chunk); + } + + chunk_id = (chunk_id + 1) % CHUNK_FILE_COUNT; + + current_time = time(NULL); + elapsed_time = current_time - start_time; + } + + cio_destroy(ctx); + + free(in_data); + + if (trim_chunk_files) { + TEST_CHECK(failure_detected == CIO_TRUE); + } + else { + TEST_CHECK(failure_detected == CIO_FALSE); + } +} + +static void test_no_trim() +{ + test_core(CIO_FALSE); +} + +static void test_trim() +{ + test_core(CIO_TRUE); +} + +TEST_LIST = { + {"trim", test_trim}, + {"no_trim", test_no_trim}, + + { 0 } +}; diff --git a/lib/chunkio/tests/fs_perf.c b/lib/chunkio/tests/fs_perf.c new file mode 100644 index 00000000000..cb7253956b8 --- /dev/null +++ b/lib/chunkio/tests/fs_perf.c @@ -0,0 +1,206 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* Chunk I/O + * ========= + * Copyright 2023 Eduardo Silva + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _WIN32 +#include +#include +#endif +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cio_tests_internal.h" + +#define CIO_ENV "/tmp/cio-fs-test/" +#define CIO_FILE_400KB CIO_TESTS_DATA_PATH "/data/400kb.txt" + + +/* Logging callback, once called it just turn on the log_check flag */ +static int log_cb(struct cio_ctx *ctx, int level, const char *file, int line, + char *str) +{ + (void) ctx; + + printf("[cio-test-fs] %-60s => %s:%i\n", str, file, line); + return 0; +} + +static void tests_init(struct cio_options *opts) +{ + /* delete any previous temporary content directory */ + cio_utils_recursive_delete("tmp"); + + /* initialize options */ + cio_options_init(opts); + opts->root_path = "tmp"; + opts->log_cb = log_cb; + opts->log_level = CIO_LOG_INFO; +} + +/* test write overhead. This might need to increase the file descriptors limit (ulimit -n ABC) */ +static void perf_write_realloc_hint(int realloc_hint, int up_down_mod) +{ + int i; + int ret; + int err; + int chunk_id = 0; + char name[64]; + char *in_data; + size_t in_size; + struct cio_ctx *ctx; + struct cio_chunk *chunk; + struct cio_stream *stream; + struct cio_options cio_opts; + + tests_init(&cio_opts); + cio_opts.realloc_size_hint = realloc_hint; + + /* + * Load sample data file and with the same content through multiple write + * operations generating other files. + */ + ret = cio_utils_read_file(CIO_FILE_400KB, &in_data, &in_size); + TEST_CHECK(ret == 0); + if (ret == -1) { + exit(EXIT_FAILURE); + } + + ctx = cio_create(&cio_opts); + stream = cio_stream_create(ctx, "test-perf", CIO_STORE_FS); + + snprintf(name, sizeof(name) - 1, "chunk-%03i", chunk_id); + + chunk = cio_chunk_open(ctx, stream, name, CIO_OPEN, 1000, &err); + TEST_CHECK(chunk != NULL); + if (!chunk) { + printf("cannot open chunk\n"); + exit(1); + } + + /* do not force a maximum of chunks up, we want to test writing overhead */ + cio_set_max_chunks_up(ctx, 1000000); + + for (i = 0; i < 5000000; i++) { + ret = cio_chunk_write(chunk, in_data, 550); + TEST_CHECK(ret == CIO_OK); + + ret = cio_chunk_write(chunk, in_data, 250); + TEST_CHECK(ret == CIO_OK); + + if (up_down_mod && !(i % up_down_mod)) { + ret = cio_chunk_down(chunk); + TEST_CHECK(ret == CIO_OK); + + ret = cio_chunk_up(chunk); + TEST_CHECK(ret == CIO_OK); + } + + if (cio_chunk_get_content_size(chunk) > (2 * 1024 * 1000 /* 2MB */)) { + ret = cio_chunk_down(chunk); + + /* create another chunk */ + chunk_id++; + snprintf(name, sizeof(name) - 1, "chunk-%03i", chunk_id); + + chunk = cio_chunk_open(ctx, stream, name, CIO_OPEN_RW, 1000, &err); + TEST_CHECK(chunk != NULL); + if (!chunk) { + printf("cannot open chunk\n"); + exit(1); + } + } + } + + cio_destroy(ctx); + free(in_data); +} + +static void test_perf_write_realloc_32() +{ + int realloc_hint = 32 * 1024; + int up_down_mod = 0; + + perf_write_realloc_hint(realloc_hint, up_down_mod); +} + +static void test_perf_write_realloc_128() +{ + int realloc_hint = 128 * 1024; + int up_down_mod = 0; + + perf_write_realloc_hint(realloc_hint, up_down_mod); +} + +static void test_perf_write_realloc_512() +{ + int realloc_hint = 512 * 1024; + int up_down_mod = 0; + + perf_write_realloc_hint(realloc_hint, up_down_mod); +} + +static void test_write_up_down_500() +{ + int realloc_hint = 512 * 1024; + int up_down_mod = 500; + + perf_write_realloc_hint(realloc_hint, up_down_mod); +} + +static void test_write_up_down_1000() +{ + int realloc_hint = 512 * 1024; + int up_down_mod = 1000; + + perf_write_realloc_hint(realloc_hint, up_down_mod); +} + +static void test_write_up_down_10000() +{ + int realloc_hint = 512 * 1024; + int up_down_mod = 10000; + + perf_write_realloc_hint(realloc_hint, up_down_mod); +} + +TEST_LIST = { + /* write with different realloc size hints */ + {"write_realloc_32" , test_perf_write_realloc_32}, + {"write_realloc_128", test_perf_write_realloc_128}, + {"write_realloc_512", test_perf_write_realloc_512}, + + /* + * the tests performs (5000000 * 2) cio writes, the following tests uses realloc hint of 512k + * and force the chunks to go down/up every specific loop intervals. + */ + {"write_up_down_500" , test_write_up_down_500}, + {"write_up_down_1000" , test_write_up_down_1000}, + {"write_up_down_10000", test_write_up_down_10000}, + + { 0 } +}; From d0e766ed49b7fa4d6de29c597b95dab10f9a9fb5 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Tue, 8 Apr 2025 08:06:12 -0600 Subject: [PATCH 03/29] lib: ctraces: upgrade to v0.6.3 Signed-off-by: Eduardo Silva --- lib/ctraces/.github/workflows/build.yaml | 98 +++++++++++++++---- .../ctraces/ctr_decode_opentelemetry.h | 8 ++ lib/ctraces/src/ctr_decode_opentelemetry.c | 39 +++++++- lib/ctraces/src/ctr_span.c | 8 +- 4 files changed, 126 insertions(+), 27 deletions(-) diff --git a/lib/ctraces/.github/workflows/build.yaml b/lib/ctraces/.github/workflows/build.yaml index 3fddff58c51..6d2faee05c8 100644 --- a/lib/ctraces/.github/workflows/build.yaml +++ b/lib/ctraces/.github/workflows/build.yaml @@ -34,22 +34,33 @@ jobs: name: CentOS 7 build to confirm no issues once used downstream runs-on: ubuntu-latest container: centos:7 - permissions: - contents: none + env: + # workaround required for checkout@v3, https://github.com/actions/checkout/issues/1590 + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true steps: - name: Set up base image dependencies run: | sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo - yum -y update && \ - yum install -y ca-certificates cmake curl-devel gcc gcc-c++ git make wget && \ + yum -y update + yum install -y ca-certificates gcc gcc-c++ git make wget yum install -y epel-release - yum install -y cmake3 + yum install -y libcurl-devel + shell: bash - - name: Clone repo with submodules (1.8.3 version of Git) + - name: Install CMake 3.20.0 + run: | + CMAKE_VERSION=3.20.0 + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh + ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local + ln -sf /usr/local/bin/cmake /usr/bin/cmake + cmake --version + + - name: Clone repo without submodules (1.8.3 version of Git) run: | - git clone --recursive https://github.com/calyptia/ctraces.git + git clone https://github.com/fluent/ctraces.git shell: bash - name: Check out the branch (1.8.3 version of Git) @@ -57,14 +68,14 @@ jobs: BRANCH_NAME: ${{ github.head_ref }} run: | git checkout "$BRANCH_NAME" + git submodule update --init --recursive shell: bash working-directory: ctraces - name: Run compilation run: | - cmake3 -DCTR_TESTS=on -DCTR_DEV=on . + cmake -DCTR_TESTS=on -DCTR_DEV=on . make - shell: bash working-directory: ctraces build-debian: @@ -75,19 +86,40 @@ jobs: - name: Set up base image dependencies run: | apt-get update - apt-get install -y build-essential cmake make git + apt-get install -y build-essential wget make gcc g++ git libcurl4-openssl-dev + + - name: Install CMake 3.20.0 + run: | + CMAKE_VERSION=3.20.0 + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh + ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local + + # Ensure the new CMake is found first + echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc + export PATH="/usr/local/bin:$PATH" + + # Confirm CMake installation + /usr/local/bin/cmake --version + + - name: Clone repository and submodules + run: | + git clone --recursive https://github.com/fluent/ctraces.git shell: bash - - uses: actions/checkout@v4 - with: - submodules: true + - name: Initialize submodules + run: | + git submodule update --init --recursive + shell: bash + working-directory: ctraces - name: Run compilation run: | - cmake -DCTR_TESTS=On . + cmake -DCTR_TESTS=On -DCTR_DEV=On . make all CTEST_OUTPUT_ON_FAILURE=1 make test shell: bash + working-directory: ctraces build-unix-arm64: name: Build sources on arm64 for ${{ matrix.os }} - ${{ matrix.compiler }} @@ -164,16 +196,40 @@ jobs: contents: read runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Check out the repository + uses: actions/checkout@v4 with: submodules: true - - uses: docker://lpenz/ghaction-cmake:0.19 - with: - preset: ${{ matrix.preset }} - # dependencies_debian: '' - cmakeflags: '-DCTR_TESTS=On -DCMT_DEV=on .' - build_command: make all + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + clang \ + valgrind \ + wget \ + make \ + gcc \ + g++ \ + git \ + libcurl4-openssl-dev + + - name: Install CMake 3.20.0 or higher + run: | + CMAKE_VERSION=3.20.0 + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh + sudo ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local + sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake + /usr/local/bin/cmake --version + + - name: Initialize Submodules + run: git submodule update --init --recursive + + - name: Configure and Build + run: | + /usr/local/bin/cmake -DCTR_TESTS=On -DCTR_DEV=On -DCMT_DEV=on . + make all # this job provides the single required status for PRs to be merged into main. # instead of updating the protected branch status in github, developers can update the needs section below diff --git a/lib/ctraces/include/ctraces/ctr_decode_opentelemetry.h b/lib/ctraces/include/ctraces/ctr_decode_opentelemetry.h index c1ba2c3014a..756df2ba6cd 100644 --- a/lib/ctraces/include/ctraces/ctr_decode_opentelemetry.h +++ b/lib/ctraces/include/ctraces/ctr_decode_opentelemetry.h @@ -20,6 +20,14 @@ #ifndef CTR_DECODE_OPENTELEMETRY_H #define CTR_DECODE_OPENTELEMETRY_H +#define CTR_DECODE_OPENTELEMETRY_SUCCESS 0 +#define CTR_DECODE_OPENTELEMETRY_INSUFFICIENT_DATA -1 +#define CTR_DECODE_OPENTELEMETRY_INVALID_ARGUMENT -2 +#define CTR_DECODE_OPENTELEMETRY_CORRUPTED_DATA -3 +#define CTR_DECODE_OPENTELEMETRY_INVALID_PAYLOAD -4 +#define CTR_DECODE_OPENTELEMETRY_ALLOCATION_ERROR -5 + + typedef enum { CTR_OPENTELEMETRY_TYPE_ATTRIBUTE = 0, CTR_OPENTELEMETRY_TYPE_ARRAY = 1, diff --git a/lib/ctraces/src/ctr_decode_opentelemetry.c b/lib/ctraces/src/ctr_decode_opentelemetry.c index 23c3232ded1..f9be84fea85 100644 --- a/lib/ctraces/src/ctr_decode_opentelemetry.c +++ b/lib/ctraces/src/ctr_decode_opentelemetry.c @@ -525,11 +525,15 @@ int ctr_decode_opentelemetry_create(struct ctrace **out_ctr, Opentelemetry__Proto__Trace__V1__ScopeSpans *otel_scope_span; Opentelemetry__Proto__Trace__V1__Span *otel_span; + if (*offset >= in_size) { + return CTR_DECODE_OPENTELEMETRY_INSUFFICIENT_DATA; + } + service_request = opentelemetry__proto__collector__trace__v1__export_trace_service_request__unpack(NULL, in_size - *offset, (unsigned char *) &in_buf[*offset]); if (service_request == NULL) { - return -1; + return CTR_DECODE_OPENTELEMETRY_CORRUPTED_DATA; } ctr = ctr_create(NULL); @@ -539,7 +543,7 @@ int ctr_decode_opentelemetry_create(struct ctrace **out_ctr, if (otel_resource_span == NULL) { opentelemetry__proto__collector__trace__v1__export_trace_service_request__free_unpacked(service_request, NULL); ctr_destroy(ctr); - return -1; + return CTR_DECODE_OPENTELEMETRY_INVALID_PAYLOAD; } /* resource span */ @@ -554,12 +558,23 @@ int ctr_decode_opentelemetry_create(struct ctrace **out_ctr, for (scope_span_index = 0; scope_span_index < otel_resource_span->n_scope_spans; scope_span_index++) { otel_scope_span = otel_resource_span->scope_spans[scope_span_index]; + if (otel_scope_span == NULL) { opentelemetry__proto__collector__trace__v1__export_trace_service_request__free_unpacked(service_request, NULL); - return -1; + ctr_destroy(ctr); + + return CTR_DECODE_OPENTELEMETRY_INVALID_PAYLOAD; } scope_span = ctr_scope_span_create(resource_span); + + if (scope_span == NULL) { + opentelemetry__proto__collector__trace__v1__export_trace_service_request__free_unpacked(service_request, NULL); + ctr_destroy(ctr); + + return CTR_DECODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + ctr_scope_span_set_schema_url(scope_span, otel_scope_span->schema_url); if (otel_scope_span->scope != NULL) { @@ -568,13 +583,23 @@ int ctr_decode_opentelemetry_create(struct ctrace **out_ctr, for (span_index = 0; span_index < otel_scope_span->n_spans; span_index++) { otel_span = otel_scope_span->spans[span_index]; + if (otel_span == NULL) { opentelemetry__proto__collector__trace__v1__export_trace_service_request__free_unpacked(service_request, NULL); - return -1; + ctr_destroy(ctr); + + return CTR_DECODE_OPENTELEMETRY_INVALID_PAYLOAD; } span = ctr_span_create(ctr, scope_span, otel_span->name, NULL); + if (span == NULL) { + opentelemetry__proto__collector__trace__v1__export_trace_service_request__free_unpacked(service_request, NULL); + ctr_destroy(ctr); + + return CTR_DECODE_OPENTELEMETRY_ALLOCATION_ERROR; + } + /* copy data from otel span to ctraces span representation */ ctr_span_set_trace_id(span, otel_span->trace_id.data, otel_span->trace_id.len); ctr_span_set_span_id(span, otel_span->span_id.data, otel_span->span_id.len); @@ -587,6 +612,7 @@ int ctr_decode_opentelemetry_create(struct ctrace **out_ctr, ctr_span_kind_set(span, otel_span->kind); ctr_span_start_ts(ctr, span, otel_span->start_time_unix_nano); ctr_span_end_ts(ctr, span, otel_span->end_time_unix_nano); + if (otel_span->status) { ctr_span_set_status(span, otel_span->status->code, otel_span->status->message); } @@ -603,10 +629,13 @@ int ctr_decode_opentelemetry_create(struct ctrace **out_ctr, } } + *offset += opentelemetry__proto__collector__trace__v1__export_trace_service_request__get_packed_size(service_request); + opentelemetry__proto__collector__trace__v1__export_trace_service_request__free_unpacked(service_request, NULL); + *out_ctr = ctr; - return 0; + return CTR_DECODE_OPENTELEMETRY_SUCCESS; } void ctr_decode_opentelemetry_destroy(struct ctrace *ctr) diff --git a/lib/ctraces/src/ctr_span.c b/lib/ctraces/src/ctr_span.c index 56794d33c1b..0df7fd936d1 100644 --- a/lib/ctraces/src/ctr_span.c +++ b/lib/ctraces/src/ctr_span.c @@ -34,6 +34,7 @@ struct ctrace_span *ctr_span_create(struct ctrace *ctx, struct ctrace_scope_span /* allocate a spanc context */ span = calloc(1, sizeof(struct ctrace_span)); + if (span == NULL) { ctr_errno(); return NULL; @@ -47,15 +48,19 @@ struct ctrace_span *ctr_span_create(struct ctrace *ctx, struct ctrace_scope_span span->name = cfl_sds_create(name); if (span->name == NULL) { free(span); + return NULL; } /* attributes */ span->attr = ctr_attributes_create(); if (span->attr == NULL) { + cfl_sds_destroy(span->name); free(span); + return NULL; } + cfl_list_init(&span->events); cfl_list_init(&span->links); @@ -63,7 +68,7 @@ struct ctrace_span *ctr_span_create(struct ctrace *ctx, struct ctrace_scope_span span->dropped_attr_count = 0; /* if a parent context was given, populate the span parent id */ - if (parent && parent->span_id) { + if (parent != NULL && parent->span_id != NULL) { ctr_span_set_parent_span_id_with_cid(span, parent->span_id); } @@ -78,6 +83,7 @@ struct ctrace_span *ctr_span_create(struct ctrace *ctx, struct ctrace_scope_span /* always start a span by default, the start can be overriden later if needed */ ctr_span_start(ctx, span); + return span; } From 72cdaff0f9b0471eae7c7f59ae6044760f9680da Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Wed, 9 Apr 2025 11:13:58 -0600 Subject: [PATCH 04/29] lib: cmetrics: upgrade to v1.0.0 Signed-off-by: Eduardo Silva --- lib/cmetrics/.github/workflows/build.yaml | 153 ++++++++++++++++--- lib/cmetrics/.github/workflows/lint.yaml | 4 +- lib/cmetrics/.github/workflows/packages.yaml | 52 ++----- lib/cmetrics/CMakeLists.txt | 8 +- lib/cmetrics/CODEOWNERS | 7 + lib/cmetrics/src/CMakeLists.txt | 2 + lib/cmetrics/src/cmt_encode_opentelemetry.c | 95 ++++++++---- 7 files changed, 222 insertions(+), 99 deletions(-) create mode 100644 lib/cmetrics/CODEOWNERS diff --git a/lib/cmetrics/.github/workflows/build.yaml b/lib/cmetrics/.github/workflows/build.yaml index 42015b80d59..7da5381104a 100644 --- a/lib/cmetrics/.github/workflows/build.yaml +++ b/lib/cmetrics/.github/workflows/build.yaml @@ -1,6 +1,5 @@ name: Build PR(s) and master branch. on: - workflow_dispatch: push: branches: - master @@ -8,6 +7,7 @@ on: branches: - master types: [opened, reopened, synchronize] + jobs: build-windows: name: Build sources on amd64 for ${{ matrix.os }} @@ -19,7 +19,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -39,28 +39,89 @@ jobs: name: CentOS 7 build to confirm no issues once used downstream runs-on: ubuntu-latest container: centos:7 - permissions: - contents: read + env: + # workaround required for checkout@v3, https://github.com/actions/checkout/issues/1590 + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true steps: - name: Set up base image dependencies run: | sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo - yum -y update && \ - yum install -y ca-certificates cmake gcc gcc-c++ git make wget && \ + yum -y update + yum install -y ca-certificates gcc gcc-c++ git make wget yum install -y epel-release - yum install -y cmake3 + yum install -y libcurl-devel + shell: bash - - name: Clone repo with submodules (1.8.3 version of Git) + - name: Install CMake 3.20.0 + run: | + CMAKE_VERSION=3.20.0 + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh + ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local + ln -sf /usr/local/bin/cmake /usr/bin/cmake + cmake --version + + - name: Clone repo without submodules (1.8.3 version of Git) run: | - git clone --recursive https://github.com/calyptia/cmetrics.git + git clone https://github.com/fluent/cmetrics.git shell: bash + - name: Check out the branch (1.8.3 version of Git) + env: + BRANCH_NAME: ${{ github.head_ref }} + run: | + git checkout "$BRANCH_NAME" + git submodule update --init --recursive + shell: bash + working-directory: cmetrics + - name: Run compilation run: | - cmake3 -DCMT_TESTS=on -DCMT_DEV=on . + cmake -DCMT_TESTS=on -DCMT_DEV=on . make + working-directory: cmetrics + + build-debian: + name: Debian Buster build to confirm no issues once used downstream + runs-on: ubuntu-latest + container: debian:buster + steps: + - name: Set up base image dependencies + run: | + apt-get update + apt-get install -y build-essential wget make gcc g++ git libcurl4-openssl-dev + + - name: Install CMake 3.20.0 + run: | + CMAKE_VERSION=3.20.0 + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh + ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local + + # Ensure the new CMake is found first + echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc + export PATH="/usr/local/bin:$PATH" + + # Confirm CMake installation + /usr/local/bin/cmake --version + + - name: Clone repository and submodules + run: | + git clone --recursive https://github.com/fluent/cmetrics.git + shell: bash + + - name: Initialize submodules + run: | + git submodule update --init --recursive + shell: bash + working-directory: cmetrics + + - name: Run compilation + run: | + cmake -DCMT_TESTS=on -DCMT_DEV=on . + make all shell: bash working-directory: cmetrics @@ -75,15 +136,15 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Build on ${{ matrix.os }} with ${{ matrix.compiler }} - uses: uraimo/run-on-arch-action@v2.5.0 + uses: uraimo/run-on-arch-action@v3.0.0 with: arch: aarch64 - distro: ubuntu20.04 + distro: ubuntu_latest run: | apt-get update && \ apt-get install -y --no-install-recommends \ @@ -109,7 +170,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -138,13 +199,63 @@ jobs: contents: read runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Check out the repository + uses: actions/checkout@v4 with: submodules: true - - uses: docker://lpenz/ghaction-cmake:0.19 - with: - preset: ${{ matrix.preset }} - # dependencies_debian: '' - cmakeflags: '-DCMT_TESTS=On -DCMT_DEV=on .' - build_command: make all + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + clang \ + valgrind \ + wget \ + make \ + gcc \ + g++ \ + git \ + libcurl4-openssl-dev + + - name: Install CMake 3.20.0 or higher + run: | + CMAKE_VERSION=3.20.0 + wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh + sudo ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local + sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake + /usr/local/bin/cmake --version + + - name: Initialize Submodules + run: git submodule update --init --recursive + + - name: Configure and Build + run: | + /usr/local/bin/cmake -DCMT_TESTS=On -DCMT_DEV=on . + make all + + # this job provides the single required status for PRs to be merged into main. + # instead of updating the protected branch status in github, developers can update the needs section below + # to require additional status checks to protect main. + # the job uses the alls-green action to get around the github issue that treats a "skipped" required status check + # as passed. github will skip a job if an upstream needed job fails, which would defeat the purpose of this required + # status check. + test-required-checks-complete: + # note: this step always has to run in order to check if the dependent jobs passed. by default github skips running a job + # if the needed jobs upstream failed. + if: always() + needs: + - build-windows + - build-centos + - build-debian + - build-unix-arm64 + - build-unix-amd64 + - build-analysis-tests + name: Required checks complete + runs-on: ubuntu-latest + permissions: {} + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/lib/cmetrics/.github/workflows/lint.yaml b/lib/cmetrics/.github/workflows/lint.yaml index 75cdd122e4d..01b521496d7 100644 --- a/lib/cmetrics/.github/workflows/lint.yaml +++ b/lib/cmetrics/.github/workflows/lint.yaml @@ -10,7 +10,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ludeeus/action-shellcheck@master actionlint: @@ -19,7 +19,7 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: | echo "::add-matcher::.github/actionlint-matcher.json" bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) diff --git a/lib/cmetrics/.github/workflows/packages.yaml b/lib/cmetrics/.github/workflows/packages.yaml index f0ed2335d6b..0e4c0e0f10a 100644 --- a/lib/cmetrics/.github/workflows/packages.yaml +++ b/lib/cmetrics/.github/workflows/packages.yaml @@ -18,15 +18,15 @@ jobs: matrix: format: [ rpm, deb ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: uraimo/run-on-arch-action@v2.5.0 + - uses: uraimo/run-on-arch-action@v3.0.0 name: Build the ${{matrix.format}} packages with: arch: aarch64 - distro: ubuntu20.04 + distro: ubuntu_latest run: | apt-get update && \ apt-get install -y --no-install-recommends \ @@ -39,7 +39,7 @@ jobs: echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {} - name: Store the master package artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.format }}-arm64 path: | @@ -51,9 +51,10 @@ jobs: fail-fast: true matrix: format: [ rpm, deb ] - runs-on: ubuntu-latest + + runs-on: [ ubuntu-latest ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -63,39 +64,12 @@ jobs: echo ${{ matrix.format }} | awk '{print toupper($0)}' | xargs -I{} cpack -G {} - name: Store the master package artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.format }}-amd64 path: | ./*.${{matrix.format}} - build-macos-packages-amd64: - name: build macOS intel packages - strategy: - fail-fast: true - matrix: - config: - - format: productbuild - arch: intel - ext: pkg - runs-on: macos-12 - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - - name: Build the ${{matrix.config.format}} packages - run: | - cmake . -DCPACK_GENERATOR=${{ matrix.config.format }} - echo ${{ matrix.config.format }} | xargs -I{} cpack -G {} - - - name: Store the master package artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.config.format }}-${{matrix.config.arch}} - path: | - ./*-${{matrix.config.arch}}.${{matrix.config.ext}} - build-macos-packages-arm64: name: build macOS Apple Silicon packages strategy: @@ -107,7 +81,7 @@ jobs: ext: pkg runs-on: macos-14 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true @@ -117,7 +91,7 @@ jobs: echo ${{ matrix.config.format }} | xargs -I{} cpack -G {} - name: Store the master package artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.config.format }}-${{matrix.config.arch}} path: | @@ -128,7 +102,6 @@ jobs: needs: - build-distro-packages-amd64 - build-distro-packages-arm64 - - build-macos-packages-amd64 - build-macos-packages-arm64 runs-on: ubuntu-latest @@ -136,7 +109,7 @@ jobs: contents: write steps: - name: Download all artefacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: artifacts/ @@ -156,10 +129,9 @@ jobs: artifacts/**/* - name: Release on tag - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: generate_release_notes: true - draft: false files: | artifacts/**/* diff --git a/lib/cmetrics/CMakeLists.txt b/lib/cmetrics/CMakeLists.txt index 18582997d61..9ea50a23439 100644 --- a/lib/cmetrics/CMakeLists.txt +++ b/lib/cmetrics/CMakeLists.txt @@ -1,12 +1,12 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.20) project(cmetrics C) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # CMetrics Version -set(CMT_VERSION_MAJOR 0) -set(CMT_VERSION_MINOR 9) -set(CMT_VERSION_PATCH 9) +set(CMT_VERSION_MAJOR 1) +set(CMT_VERSION_MINOR 0) +set(CMT_VERSION_PATCH 0) set(CMT_VERSION_STR "${CMT_VERSION_MAJOR}.${CMT_VERSION_MINOR}.${CMT_VERSION_PATCH}") # Include helpers diff --git a/lib/cmetrics/CODEOWNERS b/lib/cmetrics/CODEOWNERS new file mode 100644 index 00000000000..2c2d84eaf89 --- /dev/null +++ b/lib/cmetrics/CODEOWNERS @@ -0,0 +1,7 @@ +# Global Owners +# ------------- +* @edsiper @leonardo-albertovich + +# CI +# ------------------------- +/.github/ @niedbalski @patrick-stephens @celalettin1286 diff --git a/lib/cmetrics/src/CMakeLists.txt b/lib/cmetrics/src/CMakeLists.txt index f08667d07a1..0940e616341 100644 --- a/lib/cmetrics/src/CMakeLists.txt +++ b/lib/cmetrics/src/CMakeLists.txt @@ -37,6 +37,8 @@ set(src cmt_decode_msgpack.c cmt_decode_statsd.c cmt_mpack_utils.c + + # Prometheus related protobuf files external/remote.pb-c.c external/types.pb-c.c ) diff --git a/lib/cmetrics/src/cmt_encode_opentelemetry.c b/lib/cmetrics/src/cmt_encode_opentelemetry.c index 8f961aa7625..3e23176f5c7 100644 --- a/lib/cmetrics/src/cmt_encode_opentelemetry.c +++ b/lib/cmetrics/src/cmt_encode_opentelemetry.c @@ -273,7 +273,7 @@ static inline void otlp_kvpair_destroy(Opentelemetry__Proto__Common__V1__KeyValu { if (kvpair != NULL) { if (kvpair->key != NULL) { - cfl_sds_destroy(kvpair->key); + free(kvpair->key); } if (kvpair->value != NULL) { @@ -323,7 +323,7 @@ static inline void otlp_any_value_destroy(Opentelemetry__Proto__Common__V1__AnyV if (value != NULL) { if (value->value_case == OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_STRING_VALUE) { if (value->string_value != NULL) { - cfl_sds_destroy(value->string_value); + free(value->string_value); } } else if (value->value_case == OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_ARRAY_VALUE) { @@ -494,19 +494,21 @@ static inline Opentelemetry__Proto__Common__V1__KeyValue *cfl_variant_kvpair_to_ pair = otlp_kvpair_value_initialize(); if (pair != NULL) { - pair->key = cfl_sds_create(input_pair->key); + pair->key = strdup(input_pair->key); if (pair->key != NULL) { pair->value = cfl_variant_to_otlp_any_value(input_pair->val); if (pair->value == NULL) { - cfl_sds_destroy(pair->key); + free(pair->key); + pair->key = NULL; } } if (pair->key == NULL) { free(pair); + pair = NULL; } } @@ -647,9 +649,11 @@ static inline Opentelemetry__Proto__Common__V1__AnyValue *cfl_variant_string_to_ result = otlp_any_value_initialize(CFL_VARIANT_STRING, 0); if (result != NULL) { - result->string_value = cfl_sds_create(value->data.as_string); + result->string_value = strdup(value->data.as_string); + if (result->string_value == NULL) { otlp_any_value_destroy(result); + result = NULL; } } @@ -1057,49 +1061,50 @@ static Opentelemetry__Proto__Common__V1__InstrumentationScope * return NULL; } - /* cmetrics: retrieve attributes and metadata fields */ attributes = fetch_metadata_kvlist_key(scope_root, "attributes"); metadata = fetch_metadata_kvlist_key(scope_root, "metadata"); - /* create scope */ + if (cfl_kvlist_count(attributes) == 0 && + cfl_kvlist_count(metadata) == 0) { + return NULL; + } + scope = calloc(1, sizeof(Opentelemetry__Proto__Common__V1__InstrumentationScope)); if (scope == NULL) { *error_detection_flag = CMT_TRUE; + return NULL; } - opentelemetry__proto__common__v1__instrumentation_scope__init(scope); - /* attributes */ - if (attributes && cfl_kvlist_count(attributes) > 0) { - scope->attributes = cfl_kvlist_to_otlp_kvpair_list(attributes); + opentelemetry__proto__common__v1__instrumentation_scope__init(scope); - if (scope->attributes == NULL) { - *error_detection_flag = CMT_TRUE; - } + scope->attributes = cfl_kvlist_to_otlp_kvpair_list(attributes); - scope->n_attributes = cfl_kvlist_count(attributes); + if (scope->attributes == NULL) { + *error_detection_flag = CMT_TRUE; } - /* scope metadata */ - if (metadata) { - if (!(*error_detection_flag)) { - scope->dropped_attributes_count = (uint32_t) fetch_metadata_int64_key( - metadata, - "dropped_attributes_count", - error_detection_flag); - } + scope->n_attributes = cfl_kvlist_count(attributes); - if (!(*error_detection_flag)) { - scope->name = fetch_metadata_string_key(metadata, "name", error_detection_flag); - } + if (!(*error_detection_flag)) { + scope->dropped_attributes_count = (uint32_t) fetch_metadata_int64_key( + metadata, + "dropped_attributes_count", + error_detection_flag); + } - if (!(*error_detection_flag)) { - scope->version = fetch_metadata_string_key(metadata, "version", error_detection_flag); - } + if (!(*error_detection_flag)) { + scope->name = fetch_metadata_string_key(metadata, "name", error_detection_flag); + } + + if (!(*error_detection_flag)) { + scope->version = fetch_metadata_string_key(metadata, "version", error_detection_flag); } - if (*error_detection_flag && scope != NULL) { + if (*error_detection_flag && + scope != NULL) { destroy_instrumentation_scope(scope); + scope = NULL; } @@ -1200,11 +1205,13 @@ static void destroy_attribute(Opentelemetry__Proto__Common__V1__KeyValue *attrib { if (attribute != NULL) { if (attribute->value != NULL) { - if (attribute->value->value_case == OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_STRING_VALUE) { + if (attribute->value->value_case == \ + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_STRING_VALUE) { if (is_string_releaseable(attribute->value->string_value)) { cfl_sds_destroy(attribute->value->string_value); } } + free(attribute->value); } @@ -1588,7 +1595,31 @@ static Opentelemetry__Proto__Metrics__V1__HistogramDataPoint * data_point->count = count; data_point->n_bucket_counts = bucket_count; + + /* + * In the OpenTelemetry Metrics protobuf definition, the `sum` field in HistogramDataPoint is + * marked as `optional`: + * + * https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/metrics/v1/metrics.proto#L456 + * + * While `optional` is supported in proto3, the `protobuf-c` project does not handle proto3 + * optional scalar fields using `has_*` booleans like the main protobuf implementations. + * + * Instead, `protobuf-c` represents optional fields internally using a synthetic `oneof`. + * This means that in the generated C code, the optional `sum` field is placed inside a union, + * and its presence is tracked using a corresponding `_sum_case` enum field. + * + * To correctly serialize the `sum` field, both the `sum` value and its `_sum_case` must be set: + * + * data_point->sum = some_value; + * data_point->_sum_case = OPENTELEMETRY__PROTO__METRICS__V1__HISTOGRAM_DATA_POINT___SUM_SUM; + * + * Failing to set `_sum_case` will result in the `sum` field being silently omitted from the + * serialized output. + */ data_point->sum = sum; + data_point->_sum_case = OPENTELEMETRY__PROTO__METRICS__V1__HISTOGRAM_DATA_POINT___SUM_SUM; + if (bucket_count > 0) { data_point->bucket_counts = calloc(bucket_count, sizeof(uint64_t)); @@ -1611,7 +1642,7 @@ static Opentelemetry__Proto__Metrics__V1__HistogramDataPoint * data_point->n_explicit_bounds = boundary_count; if (boundary_count > 0) { - data_point->explicit_bounds = calloc(boundary_count, sizeof(uint64_t)); + data_point->explicit_bounds = calloc(boundary_count, sizeof(double)); if (data_point->explicit_bounds == NULL) { cmt_errno(); From 06cb16dfda917acc29558bc74d5fb4be0c3434f4 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Wed, 9 Apr 2025 11:15:05 -0600 Subject: [PATCH 05/29] in_ebpf: remove cmake requirement Signed-off-by: Eduardo Silva --- plugins/in_ebpf/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/in_ebpf/CMakeLists.txt b/plugins/in_ebpf/CMakeLists.txt index fbd0505f0dd..476c077746d 100644 --- a/plugins/in_ebpf/CMakeLists.txt +++ b/plugins/in_ebpf/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.0) - # Define source files for the main plugin file(GLOB_RECURSE src "in_ebpf.c" From ded893ced2fe301b898202708fd7804932940148 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Wed, 9 Apr 2025 11:28:36 -0600 Subject: [PATCH 06/29] lib: nghttp2: upgrade to v1.65.0 Signed-off-by: Eduardo Silva --- cmake/libraries.cmake | 2 +- lib/{nghttp2 => nghttp2-1.65.0}/AUTHORS | 13 + .../CMakeLists.txt | 169 +- .../CMakeOptions.txt | 6 +- lib/{nghttp2 => nghttp2-1.65.0}/COPYING | 0 lib/nghttp2-1.65.0/ChangeLog | 927 + .../Dockerfile.android | 13 +- lib/nghttp2-1.65.0/INSTALL | 368 + lib/{nghttp2 => nghttp2-1.65.0}/Makefile.am | 5 +- lib/nghttp2-1.65.0/Makefile.in | 1018 + lib/{nghttp2 => nghttp2-1.65.0}/NEWS | 0 lib/{nghttp2 => nghttp2-1.65.0}/README | 0 lib/{nghttp2 => nghttp2-1.65.0}/README.rst | 111 +- lib/nghttp2-1.65.0/aclocal.m4 | 1860 + .../android-config | 0 lib/{nghttp2 => nghttp2-1.65.0}/android-env | 0 .../bpf/CMakeLists.txt | 0 .../bpf/Makefile.am | 0 lib/nghttp2-1.65.0/bpf/Makefile.in | 608 + .../bpf/reuseport_kern.c | 222 +- .../cmake/ExtractValidFlags.cmake | 0 .../cmake/FindJansson.cmake | 0 .../cmake/FindJemalloc.cmake | 0 .../cmake/FindLibbpf.cmake | 0 .../cmake/FindLibbrotlidec.cmake | 36 + .../cmake/FindLibbrotlienc.cmake | 36 + .../cmake/FindLibcares.cmake | 18 +- .../cmake/FindLibev.cmake | 0 .../cmake/FindLibevent.cmake | 0 .../cmake/FindLibnghttp3.cmake | 0 .../cmake/FindLibngtcp2.cmake | 0 .../cmake/FindLibngtcp2_crypto_quictls.cmake | 0 .../cmake/FindLibngtcp2_crypto_wolfssl.cmake | 43 + .../cmake/FindSystemd.cmake | 0 lib/nghttp2-1.65.0/cmake/FindWolfSSL.cmake | 41 + .../cmake/PickyWarningsC.cmake | 1 - .../cmake/PickyWarningsCXX.cmake | 4 + .../cmake/Version.cmake | 0 .../cmakeconfig.h.in | 21 +- lib/nghttp2-1.65.0/compile | 348 + lib/nghttp2-1.65.0/config.guess | 1754 + lib/nghttp2-1.65.0/config.h.in | 475 + lib/nghttp2-1.65.0/config.sub | 1890 + lib/nghttp2-1.65.0/configure | 30770 ++++++++++++++++ lib/{nghttp2 => nghttp2-1.65.0}/configure.ac | 234 +- .../contrib/CMakeLists.txt | 0 .../contrib/Makefile.am | 0 lib/nghttp2-1.65.0/contrib/Makefile.in | 568 + .../contrib/nghttpx-init.in | 0 .../contrib/nghttpx-logrotate | 0 .../contrib/nghttpx-upstart.conf.in | 0 .../contrib/nghttpx.service.in | 0 .../contrib/tlsticketupdate.go | 0 lib/nghttp2-1.65.0/depcomp | 791 + .../doc/CMakeLists.txt | 0 .../doc/Makefile.am | 17 +- lib/nghttp2-1.65.0/doc/Makefile.in | 1012 + .../doc/README.rst | 2 +- .../doc/_exts/rubydomain/LICENSE.rubydomain | 0 .../doc/_exts/rubydomain/__init__.py | 0 .../doc/_exts/rubydomain/rubydomain.py | 0 .../doc/bash_completion/h2load | 2 +- .../doc/bash_completion/nghttp | 2 +- .../doc/bash_completion/nghttpd | 2 +- .../doc/bash_completion/nghttpx | 19 + .../doc/building-android-binary.rst.in | 0 .../doc/conf.py.in | 0 .../doc/contribute.rst.in | 0 lib/nghttp2-1.65.0/doc/enums.rst | 539 + .../doc/h2load-howto.rst.in | 0 lib/{nghttp2 => nghttp2-1.65.0}/doc/h2load.1 | 19 +- .../doc/h2load.1.rst | 16 +- .../doc/index.rst.in | 0 lib/nghttp2-1.65.0/doc/macros.rst | 141 + .../doc/mkapiref.py | 0 lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttp.1 | 81 +- .../doc/nghttp.1.rst | 78 +- .../doc/nghttp2.h.rst.in | 0 .../doc/nghttp2_check_authority.rst | 25 + .../doc/nghttp2_check_header_name.rst | 17 + .../doc/nghttp2_check_header_value.rst | 18 + .../nghttp2_check_header_value_rfc9113.rst | 16 + .../doc/nghttp2_check_method.rst | 16 + lib/nghttp2-1.65.0/doc/nghttp2_check_path.rst | 20 + .../doc/nghttp2_extpri_parse_priority.rst | 25 + .../doc/nghttp2_hd_deflate_bound.rst | 14 + .../nghttp2_hd_deflate_change_table_size.rst | 31 + .../doc/nghttp2_hd_deflate_del.rst | 13 + ...ttp2_hd_deflate_get_dynamic_table_size.rst | 14 + ..._hd_deflate_get_max_dynamic_table_size.rst | 13 + ...http2_hd_deflate_get_num_table_entries.rst | 15 + .../nghttp2_hd_deflate_get_table_entry.rst | 18 + .../doc/nghttp2_hd_deflate_hd.rst | 39 + .../doc/nghttp2_hd_deflate_hd2.rst | 35 + .../doc/nghttp2_hd_deflate_hd_vec.rst | 40 + .../doc/nghttp2_hd_deflate_hd_vec2.rst | 36 + .../doc/nghttp2_hd_deflate_new.rst | 24 + .../doc/nghttp2_hd_deflate_new2.rst | 23 + .../nghttp2_hd_inflate_change_table_size.rst | 34 + .../doc/nghttp2_hd_inflate_del.rst | 13 + .../doc/nghttp2_hd_inflate_end_headers.rst | 16 + ...ttp2_hd_inflate_get_dynamic_table_size.rst | 14 + ..._hd_inflate_get_max_dynamic_table_size.rst | 13 + ...http2_hd_inflate_get_num_table_entries.rst | 15 + .../nghttp2_hd_inflate_get_table_entry.rst | 18 + .../doc/nghttp2_hd_inflate_hd.rst | 90 + .../doc/nghttp2_hd_inflate_hd2.rst | 95 + .../doc/nghttp2_hd_inflate_hd3.rst | 91 + .../doc/nghttp2_hd_inflate_new.rst | 21 + .../doc/nghttp2_hd_inflate_new2.rst | 23 + .../doc/nghttp2_http2_strerror.rst | 16 + lib/nghttp2-1.65.0/doc/nghttp2_is_fatal.rst | 14 + .../doc/nghttp2_nv_compare_name.rst | 17 + lib/nghttp2-1.65.0/doc/nghttp2_option_del.rst | 14 + lib/nghttp2-1.65.0/doc/nghttp2_option_new.rst | 22 + ...option_set_builtin_recv_extension_type.rst | 24 + .../nghttp2_option_set_max_continuations.rst | 16 + ...ion_set_max_deflate_dynamic_table_size.rst | 17 + .../nghttp2_option_set_max_outbound_ack.rst | 16 + ...option_set_max_reserved_remote_streams.rst | 23 + ...ption_set_max_send_header_block_length.rst | 19 + .../doc/nghttp2_option_set_max_settings.rst | 16 + .../nghttp2_option_set_no_auto_ping_ack.rst | 19 + ...http2_option_set_no_auto_window_update.rst | 18 + .../nghttp2_option_set_no_closed_streams.rst | 18 + .../nghttp2_option_set_no_http_messaging.rst | 21 + ...ghttp2_option_set_no_recv_client_magic.rst | 27 + ...113_leading_and_trailing_ws_validation.rst | 16 + ...option_set_peer_max_concurrent_streams.rst | 23 + ...set_server_fallback_rfc7540_priorities.rst | 17 + ...tp2_option_set_stream_reset_rate_limit.rst | 21 + ...p2_option_set_user_recv_extension_type.rst | 21 + .../doc/nghttp2_pack_settings_payload.rst | 33 + .../doc/nghttp2_pack_settings_payload2.rst | 29 + .../nghttp2_priority_spec_check_default.rst | 19 + .../nghttp2_priority_spec_default_init.rst | 21 + .../doc/nghttp2_priority_spec_init.rst | 24 + .../doc/nghttp2_rcbuf_decref.rst | 15 + .../doc/nghttp2_rcbuf_get_buf.rst | 13 + .../doc/nghttp2_rcbuf_incref.rst | 13 + .../doc/nghttp2_rcbuf_is_static.rst | 15 + .../doc/nghttp2_select_alpn.rst | 62 + .../doc/nghttp2_select_next_protocol.rst | 67 + .../doc/nghttp2_session_callbacks_del.rst | 14 + .../doc/nghttp2_session_callbacks_new.rst | 25 + ...llbacks_set_before_frame_send_callback.rst | 13 + ...s_set_data_source_read_length_callback.rst | 20 + ..._set_data_source_read_length_callback2.rst | 14 + ...2_session_callbacks_set_error_callback.rst | 24 + ..._session_callbacks_set_error_callback2.rst | 18 + ..._callbacks_set_on_begin_frame_callback.rst | 13 + ...allbacks_set_on_begin_headers_callback.rst | 14 + ...lbacks_set_on_data_chunk_recv_callback.rst | 14 + ...s_set_on_extension_chunk_recv_callback.rst | 14 + ...llbacks_set_on_frame_not_send_callback.rst | 14 + ...n_callbacks_set_on_frame_recv_callback.rst | 14 + ...n_callbacks_set_on_frame_send_callback.rst | 13 + ...ssion_callbacks_set_on_header_callback.rst | 17 + ...sion_callbacks_set_on_header_callback2.rst | 14 + ...cks_set_on_invalid_frame_recv_callback.rst | 15 + ...llbacks_set_on_invalid_header_callback.rst | 17 + ...lbacks_set_on_invalid_header_callback2.rst | 14 + ...callbacks_set_on_stream_close_callback.rst | 13 + ..._callbacks_set_pack_extension_callback.rst | 20 + ...callbacks_set_pack_extension_callback2.rst | 14 + ...p2_session_callbacks_set_recv_callback.rst | 21 + ...2_session_callbacks_set_recv_callback2.rst | 16 + ..._callbacks_set_select_padding_callback.rst | 21 + ...callbacks_set_select_padding_callback2.rst | 15 + ...p2_session_callbacks_set_send_callback.rst | 21 + ...2_session_callbacks_set_send_callback2.rst | 16 + ...ssion_callbacks_set_send_data_callback.rst | 15 + ...allbacks_set_unpack_extension_callback.rst | 14 + ..._session_change_extpri_stream_priority.rst | 38 + ...nghttp2_session_change_stream_priority.rst | 19 + .../nghttp2_session_check_request_allowed.rst | 24 + .../nghttp2_session_check_server_session.rst | 13 + .../doc/nghttp2_session_client_new.rst | 29 + .../doc/nghttp2_session_client_new2.rst | 29 + .../doc/nghttp2_session_client_new3.rst | 29 + .../doc/nghttp2_session_consume.rst | 31 + .../nghttp2_session_consume_connection.rst | 24 + .../doc/nghttp2_session_consume_stream.rst | 26 + .../nghttp2_session_create_idle_stream.rst | 19 + .../doc/nghttp2_session_del.rst | 14 + .../doc/nghttp2_session_find_stream.rst | 21 + ...ession_get_effective_local_window_size.rst | 25 + ...session_get_effective_recv_data_length.rst | 22 + ...tp2_session_get_extpri_stream_priority.rst | 33 + ...sion_get_hd_deflate_dynamic_table_size.rst | 14 + ...sion_get_hd_inflate_dynamic_table_size.rst | 14 + ...ghttp2_session_get_last_proc_stream_id.rst | 19 + .../nghttp2_session_get_local_settings.rst | 15 + .../nghttp2_session_get_local_window_size.rst | 19 + .../nghttp2_session_get_next_stream_id.rst | 15 + ...ghttp2_session_get_outbound_queue_size.rst | 14 + .../nghttp2_session_get_remote_settings.rst | 15 + ...nghttp2_session_get_remote_window_size.rst | 15 + .../doc/nghttp2_session_get_root_stream.rst | 21 + ...get_stream_effective_local_window_size.rst | 25 + ..._get_stream_effective_recv_data_length.rst | 22 + ...nghttp2_session_get_stream_local_close.rst | 14 + ...2_session_get_stream_local_window_size.rst | 20 + ...ghttp2_session_get_stream_remote_close.rst | 14 + ..._session_get_stream_remote_window_size.rst | 22 + .../nghttp2_session_get_stream_user_data.rst | 20 + .../doc/nghttp2_session_mem_recv.rst | 49 + .../doc/nghttp2_session_mem_recv2.rst | 45 + .../doc/nghttp2_session_mem_send.rst | 51 + .../doc/nghttp2_session_mem_send2.rst | 47 + .../doc/nghttp2_session_recv.rst | 76 + .../doc/nghttp2_session_resume_data.rst | 22 + .../doc/nghttp2_session_send.rst | 63 + .../doc/nghttp2_session_server_new.rst | 29 + .../doc/nghttp2_session_server_new2.rst | 29 + .../doc/nghttp2_session_server_new3.rst | 29 + .../nghttp2_session_set_local_window_size.rst | 42 + .../nghttp2_session_set_next_stream_id.rst | 24 + .../nghttp2_session_set_stream_user_data.rst | 26 + .../doc/nghttp2_session_set_user_data.rst | 15 + .../doc/nghttp2_session_terminate_session.rst | 34 + .../nghttp2_session_terminate_session2.rst | 34 + .../doc/nghttp2_session_upgrade.rst | 55 + .../doc/nghttp2_session_upgrade2.rst | 47 + .../doc/nghttp2_session_want_read.rst | 18 + .../doc/nghttp2_session_want_write.rst | 18 + .../nghttp2_set_debug_vprintf_callback.rst | 29 + .../doc/nghttp2_stream_get_first_child.rst | 19 + .../doc/nghttp2_stream_get_next_sibling.rst | 19 + .../doc/nghttp2_stream_get_parent.rst | 19 + .../nghttp2_stream_get_previous_sibling.rst | 19 + .../doc/nghttp2_stream_get_state.rst | 15 + ...http2_stream_get_sum_dependency_weight.rst | 19 + .../doc/nghttp2_stream_get_weight.rst | 19 + lib/nghttp2-1.65.0/doc/nghttp2_strerror.rst | 14 + .../doc/nghttp2_submit_altsvc.rst | 41 + .../doc/nghttp2_submit_data.rst | 53 + .../doc/nghttp2_submit_data2.rst | 49 + .../doc/nghttp2_submit_extension.rst | 47 + .../doc/nghttp2_submit_goaway.rst | 53 + .../doc/nghttp2_submit_headers.rst | 85 + .../doc/nghttp2_submit_origin.rst | 35 + .../doc/nghttp2_submit_ping.rst | 33 + .../doc/nghttp2_submit_priority.rst | 19 + .../doc/nghttp2_submit_priority_update.rst | 42 + .../doc/nghttp2_submit_push_promise.rst | 79 + .../doc/nghttp2_submit_request.rst | 75 + .../doc/nghttp2_submit_request2.rst | 71 + .../doc/nghttp2_submit_response.rst | 76 + .../doc/nghttp2_submit_response2.rst | 72 + .../doc/nghttp2_submit_rst_stream.rst | 27 + .../doc/nghttp2_submit_settings.rst | 38 + .../doc/nghttp2_submit_shutdown_notice.rst | 43 + .../doc/nghttp2_submit_trailer.rst | 60 + .../doc/nghttp2_submit_window_update.rst | 46 + lib/nghttp2-1.65.0/doc/nghttp2_version.rst | 17 + .../doc/nghttp2ver.h.rst.in | 0 lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttpd.1 | 7 +- .../doc/nghttpd.1.rst | 4 - .../doc/nghttpx-howto.rst.in | 0 lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttpx.1 | 107 +- .../doc/nghttpx.1.rst | 43 +- .../doc/package_README.rst.in | 0 .../doc/programmers-guide.rst | 91 +- .../doc/sources/building-android-binary.rst | 127 + lib/nghttp2-1.65.0/doc/sources/contribute.rst | 56 + .../doc/sources/h2load-howto.rst | 142 + lib/nghttp2-1.65.0/doc/sources/index.rst | 49 + .../doc/sources/nghttpx-howto.rst | 642 + .../doc/sources/tutorial-client.rst | 465 + .../doc/sources/tutorial-hpack.rst | 126 + .../doc/sources/tutorial-server.rst | 578 + .../doc/tutorial-client.rst.in | 0 .../doc/tutorial-hpack.rst.in | 0 .../doc/tutorial-server.rst.in | 0 lib/nghttp2-1.65.0/doc/types.rst | 1583 + .../examples/CMakeLists.txt | 10 +- .../examples/Makefile.am | 4 +- lib/nghttp2-1.65.0/examples/Makefile.in | 771 + .../examples/client.c | 87 +- .../examples/deflate.c | 24 +- .../examples/libevent-client.c | 160 +- .../examples/libevent-server.c | 123 +- lib/nghttp2-1.65.0/install-sh | 541 + .../integration-tests/CMakeLists.txt | 0 .../integration-tests/Makefile.am | 0 .../integration-tests/Makefile.in | 571 + .../integration-tests/alt-server.crt | 0 .../integration-tests/config.go.in | 0 .../integration-tests/nghttpx_http1_test.go | 178 +- .../integration-tests/nghttpx_http2_test.go | 427 +- .../integration-tests/nghttpx_http3_test.go | 33 +- .../integration-tests/req-return.rb | 0 .../integration-tests/req-set-header.rb | 0 .../integration-tests/resp-return.rb | 0 .../integration-tests/resp-set-header.rb | 0 .../integration-tests/server.crt | 0 .../integration-tests/server_tester.go | 153 +- .../integration-tests/server_tester_http3.go | 1 + lib/nghttp2-1.65.0/integration-tests/setenv | 14 + .../integration-tests/setenv.in | 1 + lib/nghttp2-1.65.0/lib/CMakeLists.txt | 107 + .../lib/Makefile.am | 4 +- lib/nghttp2-1.65.0/lib/Makefile.in | 1053 + .../lib/Makefile.msvc | 2 +- .../lib/includes/CMakeLists.txt | 0 .../lib/includes/Makefile.am | 0 lib/nghttp2-1.65.0/lib/includes/Makefile.in | 664 + .../lib/includes/nghttp2/nghttp2.h | 1638 +- .../lib/includes/nghttp2/nghttp2ver.h | 42 + .../lib/includes/nghttp2/nghttp2ver.h.in | 0 .../lib/libnghttp2.pc.in | 0 .../lib/nghttp2_alpn.c} | 29 +- .../lib/nghttp2_alpn.h} | 6 +- .../lib/nghttp2_buf.c | 8 +- .../lib/nghttp2_buf.h | 2 +- .../lib/nghttp2_callbacks.c | 112 +- .../lib/nghttp2_callbacks.h | 45 +- .../lib/nghttp2_debug.c | 6 +- .../lib/nghttp2_debug.h | 0 .../lib/nghttp2_extpri.c | 0 .../lib/nghttp2_extpri.h | 2 +- .../lib/nghttp2_frame.c | 12 +- .../lib/nghttp2_frame.h | 0 .../lib/nghttp2_hd.c | 315 +- .../lib/nghttp2_hd.h | 20 +- .../lib/nghttp2_hd_huffman.c | 14 +- .../lib/nghttp2_hd_huffman.h | 0 .../lib/nghttp2_hd_huffman_data.c | 4980 +++ lib/nghttp2-1.65.0/lib/nghttp2_helper.c | 805 + .../lib/nghttp2_helper.h | 29 +- .../lib/nghttp2_http.c | 107 +- .../lib/nghttp2_http.h | 0 .../lib/nghttp2_int.h | 0 lib/nghttp2-1.65.0/lib/nghttp2_map.c | 302 + .../lib/nghttp2_map.h | 60 +- .../lib/nghttp2_mem.c | 0 .../lib/nghttp2_mem.h | 0 .../lib/nghttp2_net.h | 0 .../lib/nghttp2_option.c | 11 +- .../lib/nghttp2_option.h | 5 + .../lib/nghttp2_outbound_item.c | 26 + .../lib/nghttp2_outbound_item.h | 27 +- .../lib/nghttp2_pq.c | 2 +- .../lib/nghttp2_pq.h | 0 .../lib/nghttp2_priority_spec.c | 0 .../lib/nghttp2_priority_spec.h | 0 .../lib/nghttp2_queue.c | 2 +- .../lib/nghttp2_queue.h | 0 .../lib/nghttp2_ratelim.c | 2 +- .../lib/nghttp2_ratelim.h | 0 .../lib/nghttp2_rcbuf.c | 0 .../lib/nghttp2_rcbuf.h | 0 .../lib/nghttp2_session.c | 1540 +- .../lib/nghttp2_session.h | 120 +- lib/nghttp2-1.65.0/lib/nghttp2_stream.c | 225 + .../lib/nghttp2_stream.h | 172 +- .../lib/nghttp2_submit.c | 295 +- .../lib/nghttp2_submit.h | 6 + .../lib/nghttp2_time.c | 8 +- .../lib/nghttp2_time.h | 0 .../lib/nghttp2_version.c | 0 lib/nghttp2-1.65.0/lib/sfparse.c | 1787 + lib/nghttp2-1.65.0/lib/sfparse.h | 442 + .../lib/version.rc.in | 0 lib/nghttp2-1.65.0/ltmain.sh | 11436 ++++++ .../m4/ax_check_compile_flag.m4 | 0 .../m4/ax_cxx_compile_stdcxx.m4 | 0 lib/nghttp2-1.65.0/m4/libtool.m4 | 8427 +++++ lib/nghttp2-1.65.0/m4/ltoptions.m4 | 437 + lib/nghttp2-1.65.0/m4/ltsugar.m4 | 124 + lib/nghttp2-1.65.0/m4/ltversion.m4 | 24 + lib/nghttp2-1.65.0/m4/lt~obsolete.m4 | 99 + lib/nghttp2-1.65.0/missing | 215 + .../nghttpx.conf.sample | 0 .../proxy.pac.sample | 0 .../script/CMakeLists.txt | 0 .../script/Makefile.am | 0 lib/nghttp2-1.65.0/script/Makefile.in | 612 + .../script/README.rst | 0 .../script/fetch-ocsp-response | 4 +- .../src/CMakeLists.txt | 40 +- .../src/HtmlParser.cc | 124 +- .../src/HtmlParser.h | 0 .../src/HttpServer.cc | 509 +- .../src/HttpServer.h | 46 +- .../src/Makefile.am | 27 +- lib/nghttp2-1.65.0/src/Makefile.in | 3129 ++ .../src/allocator.h | 87 +- .../src/app_helper.cc | 70 +- .../src/app_helper.h | 3 - lib/{nghttp2 => nghttp2-1.65.0}/src/base64.h | 48 +- .../src/base64_test.cc | 85 +- .../src/base64_test.h | 10 +- lib/{nghttp2 => nghttp2-1.65.0}/src/buffer.h | 0 .../src/buffer_test.cc | 51 +- .../src/buffer_test.h | 8 +- .../src/comp_helper.c | 24 +- .../src/comp_helper.h | 0 .../src/deflatehd.cc | 24 +- lib/{nghttp2 => nghttp2-1.65.0}/src/h2load.cc | 808 +- lib/{nghttp2 => nghttp2-1.65.0}/src/h2load.h | 19 +- .../src/h2load_http1_session.cc | 66 +- .../src/h2load_http1_session.h | 0 .../src/h2load_http2_session.cc | 54 +- .../src/h2load_http2_session.h | 0 .../src/h2load_http3_session.cc | 75 +- .../src/h2load_http3_session.h | 1 + .../src/h2load_quic.cc | 178 +- .../src/h2load_quic.h | 0 .../src/h2load_session.h | 0 lib/{nghttp2 => nghttp2-1.65.0}/src/http2.cc | 617 +- lib/{nghttp2 => nghttp2-1.65.0}/src/http2.h | 121 +- lib/nghttp2-1.65.0/src/http2_test.cc | 1190 + .../src/http2_test.h | 40 +- lib/{nghttp2 => nghttp2-1.65.0}/src/http3.cc | 74 +- lib/nghttp2-1.65.0/src/http3.h | 79 + .../src/inflatehd.cc | 17 +- .../src/memchunk.h | 58 +- lib/nghttp2-1.65.0/src/memchunk_test.cc | 360 + lib/nghttp2-1.65.0/src/memchunk_test.h | 53 + lib/{nghttp2 => nghttp2-1.65.0}/src/network.h | 0 lib/{nghttp2 => nghttp2-1.65.0}/src/nghttp.cc | 1008 +- lib/{nghttp2 => nghttp2-1.65.0}/src/nghttp.h | 32 +- .../src/nghttp2_config.h | 0 .../src/nghttp2_gzip.c | 0 .../src/nghttp2_gzip.h | 0 .../src/nghttp2_gzip_test.c | 63 +- .../src/nghttp2_gzip_test.h | 8 +- .../src/nghttpd.cc | 99 +- lib/{nghttp2 => nghttp2-1.65.0}/src/quic.cc | 2 +- lib/{nghttp2 => nghttp2-1.65.0}/src/quic.h | 0 .../src/shrpx-unittest.cc} | 78 +- lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx.cc | 1258 +- lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx.h | 2 + .../src/shrpx_accept_handler.cc | 4 +- .../src/shrpx_accept_handler.h | 0 .../src/shrpx_api_downstream_connection.cc | 96 +- .../src/shrpx_api_downstream_connection.h | 0 .../src/shrpx_client_handler.cc | 214 +- .../src/shrpx_client_handler.h | 15 +- .../src/shrpx_config.cc | 1279 +- .../src/shrpx_config.h | 584 +- lib/nghttp2-1.65.0/src/shrpx_config_test.cc | 268 + .../src/shrpx_config_test.h | 15 +- .../src/shrpx_connect_blocker.cc | 16 +- .../src/shrpx_connect_blocker.h | 0 .../src/shrpx_connection.cc | 270 +- .../src/shrpx_connection.h | 29 +- .../src/shrpx_connection_handler.cc | 313 +- .../src/shrpx_connection_handler.h | 51 +- .../src/shrpx_dns_resolver.cc | 81 +- .../src/shrpx_dns_resolver.h | 4 +- .../src/shrpx_dns_tracker.cc | 52 +- .../src/shrpx_dns_tracker.h | 12 +- .../src/shrpx_downstream.cc | 162 +- .../src/shrpx_downstream.h | 61 +- .../src/shrpx_downstream_connection.cc | 2 +- .../src/shrpx_downstream_connection.h | 0 .../src/shrpx_downstream_connection_pool.cc | 4 +- .../src/shrpx_downstream_connection_pool.h | 0 .../src/shrpx_downstream_queue.cc | 16 +- .../src/shrpx_downstream_queue.h | 0 .../src/shrpx_downstream_test.cc | 222 + .../src/shrpx_downstream_test.h | 20 +- .../src/shrpx_dual_dns_resolver.cc | 2 +- .../src/shrpx_dual_dns_resolver.h | 0 .../src/shrpx_error.h | 0 .../src/shrpx_exec.cc | 6 +- .../src/shrpx_exec.h | 0 ...px_health_monitor_downstream_connection.cc | 9 +- ...rpx_health_monitor_downstream_connection.h | 0 .../src/shrpx_http.cc | 50 +- .../src/shrpx_http.h | 6 +- .../src/shrpx_http2_downstream_connection.cc | 127 +- .../src/shrpx_http2_downstream_connection.h | 9 +- .../src/shrpx_http2_session.cc | 315 +- .../src/shrpx_http2_session.h | 11 +- .../src/shrpx_http2_upstream.cc | 333 +- .../src/shrpx_http2_upstream.h | 0 .../src/shrpx_http3_upstream.cc | 660 +- .../src/shrpx_http3_upstream.h | 28 +- .../src/shrpx_http_downstream_connection.cc | 197 +- .../src/shrpx_http_downstream_connection.h | 2 +- lib/nghttp2-1.65.0/src/shrpx_http_test.cc | 176 + .../src/shrpx_http_test.h | 16 +- .../src/shrpx_https_upstream.cc | 213 +- .../src/shrpx_https_upstream.h | 0 .../src/shrpx_io_control.cc | 0 .../src/shrpx_io_control.h | 0 .../src/shrpx_live_check.cc | 97 +- .../src/shrpx_live_check.h | 9 +- .../src/shrpx_log.cc | 222 +- .../src/shrpx_log.h | 6 +- .../src/shrpx_log_config.cc | 30 +- .../src/shrpx_log_config.h | 0 .../src/shrpx_memcached_connection.cc | 48 +- .../src/shrpx_memcached_connection.h | 0 .../src/shrpx_memcached_dispatcher.cc | 6 +- .../src/shrpx_memcached_dispatcher.h | 9 +- .../src/shrpx_memcached_request.h | 2 +- .../src/shrpx_memcached_result.h | 2 +- .../src/shrpx_mruby.cc | 8 +- .../src/shrpx_mruby.h | 0 .../src/shrpx_mruby_module.cc | 4 +- .../src/shrpx_mruby_module.h | 0 .../src/shrpx_mruby_module_env.cc | 28 +- .../src/shrpx_mruby_module_env.h | 0 .../src/shrpx_mruby_module_request.cc | 45 +- .../src/shrpx_mruby_module_request.h | 0 .../src/shrpx_mruby_module_response.cc | 63 +- .../src/shrpx_mruby_module_response.h | 0 .../src/shrpx_null_downstream_connection.cc | 4 +- .../src/shrpx_null_downstream_connection.h | 0 .../src/shrpx_process.h | 0 .../src/shrpx_quic.cc | 193 +- lib/nghttp2-1.65.0/src/shrpx_quic.h | 178 + .../src/shrpx_quic_connection_handler.cc | 307 +- .../src/shrpx_quic_connection_handler.h | 36 +- .../src/shrpx_quic_listener.cc | 34 +- .../src/shrpx_quic_listener.h | 0 .../src/shrpx_rate_limit.cc | 14 +- .../src/shrpx_rate_limit.h | 9 +- .../src/shrpx_router.cc | 14 +- .../src/shrpx_router.h | 0 lib/nghttp2-1.65.0/src/shrpx_router_test.cc | 179 + .../src/shrpx_router_test.h | 12 +- .../src/shrpx_signal.cc | 6 +- .../src/shrpx_signal.h | 0 .../src/shrpx_tls.cc | 857 +- .../src/shrpx_tls.h | 56 +- .../src/shrpx_tls_test.cc | 218 +- .../src/shrpx_tls_test.h | 16 +- .../src/shrpx_upstream.h | 2 +- .../src/shrpx_worker.cc | 352 +- .../src/shrpx_worker.h | 65 +- .../src/shrpx_worker_process.cc | 79 +- .../src/shrpx_worker_process.h | 4 +- lib/nghttp2-1.65.0/src/shrpx_worker_test.cc | 262 + .../src/shrpx_worker_test.h | 8 +- lib/nghttp2-1.65.0/src/siphash.cc | 114 + lib/nghttp2-1.65.0/src/siphash.h | 61 + lib/nghttp2-1.65.0/src/siphash_test.cc | 68 + .../src/siphash_test.h} | 25 +- .../src/ssl_compat.h | 34 +- .../src/template.h | 301 +- lib/nghttp2-1.65.0/src/template_test.cc | 239 + .../src/template_test.h | 11 +- .../src/test.example.com.pem | 0 .../src/test.nghttp2.org.pem | 0 .../src/testdata/Makefile.am | 0 lib/nghttp2-1.65.0/src/testdata/Makefile.in | 546 + .../src/testdata/ipaddr.crt | 0 .../src/testdata/nosan.crt | 0 .../src/testdata/nosan_ip.crt | 0 .../src/testdata/verify_hostname.crt | 0 lib/{nghttp2 => nghttp2-1.65.0}/src/timegm.c | 16 +- lib/{nghttp2 => nghttp2-1.65.0}/src/timegm.h | 6 +- lib/{nghttp2 => nghttp2-1.65.0}/src/tls.cc | 169 +- lib/{nghttp2 => nghttp2-1.65.0}/src/tls.h | 62 +- lib/{nghttp2 => nghttp2-1.65.0}/src/util.cc | 556 +- lib/{nghttp2 => nghttp2-1.65.0}/src/util.h | 323 +- lib/nghttp2-1.65.0/src/util_test.cc | 701 + lib/nghttp2-1.65.0/src/util_test.h | 80 + .../src/xsi_strerror.c | 0 .../src/xsi_strerror.h | 0 lib/nghttp2-1.65.0/test-driver | 153 + lib/nghttp2-1.65.0/tests/CMakeLists.txt | 52 + .../tests/Makefile.am | 32 +- lib/nghttp2-1.65.0/tests/Makefile.in | 1362 + .../tests/failmalloc.c} | 31 +- .../tests/failmalloc_test.c | 81 +- .../tests/failmalloc_test.h | 16 +- lib/nghttp2-1.65.0/tests/main.c | 71 + .../tests/malloc_wrapper.c | 0 .../tests/malloc_wrapper.h | 0 lib/nghttp2-1.65.0/tests/munit/COPYING | 21 + lib/nghttp2-1.65.0/tests/munit/munit.c | 2447 ++ lib/nghttp2-1.65.0/tests/munit/munit.h | 574 + lib/nghttp2-1.65.0/tests/munit/munitxx.h | 94 + lib/nghttp2-1.65.0/tests/nghttp2_alpn_test.c | 108 + .../tests/nghttp2_alpn_test.h} | 14 +- lib/nghttp2-1.65.0/tests/nghttp2_assertion.h | 56 + .../tests/nghttp2_buf_test.c | 201 +- lib/nghttp2-1.65.0/tests/nghttp2_buf_test.h | 48 + .../tests/nghttp2_extpri_test.c | 19 +- .../tests/nghttp2_extpri_test.h | 8 +- .../tests/nghttp2_frame_test.c | 324 +- .../tests/nghttp2_frame_test.h | 34 +- .../tests/nghttp2_hd_test.c | 981 +- lib/nghttp2-1.65.0/tests/nghttp2_hd_test.h | 61 + .../tests/nghttp2_helper_test.c | 205 + .../tests/nghttp2_helper_test.h | 14 +- .../tests/nghttp2_http_test.c | 75 +- .../tests/nghttp2_http_test.h | 8 +- .../tests/nghttp2_map_test.c | 82 +- .../tests/nghttp2_map_test.h | 14 +- .../tests/nghttp2_pq_test.c | 67 +- .../tests/nghttp2_pq_test.h | 12 +- .../tests/nghttp2_queue_test.c | 21 +- .../tests/nghttp2_queue_test.h | 8 +- .../tests/nghttp2_ratelim_test.c | 52 +- .../tests/nghttp2_ratelim_test.h | 10 +- .../tests/nghttp2_session_test.c | 8199 ++-- .../tests/nghttp2_session_test.h | 169 + .../tests/nghttp2_stream_test.c | 2 - .../tests/nghttp2_stream_test.h | 0 .../tests/nghttp2_test_helper.c | 150 +- .../tests/nghttp2_test_helper.h | 58 +- .../tests/testdata/Makefile.am | 0 lib/nghttp2-1.65.0/tests/testdata/Makefile.in | 541 + .../tests/testdata/cacert.pem | 0 .../tests/testdata/index.html | 0 .../tests/testdata/privkey.pem | 0 .../third-party/CMakeLists.txt | 9 +- .../third-party/Makefile.am | 31 +- lib/nghttp2-1.65.0/third-party/Makefile.in | 1265 + .../third-party/build_config.rb | 26 +- .../third-party/llhttp/include/llhttp.h | 42 +- .../third-party/llhttp/src/api.c | 18 +- .../third-party/llhttp/src/http.c | 26 +- .../third-party/llhttp/src/llhttp.c | 2451 +- lib/nghttp2-1.65.0/third-party/mruby/AUTHORS | 325 + .../third-party/mruby/CODEOWNERS | 1 + .../third-party/mruby/CONTRIBUTING.md | 185 + .../third-party/mruby/Dockerfile | 13 + lib/nghttp2-1.65.0/third-party/mruby/Doxyfile | 2748 ++ lib/nghttp2-1.65.0/third-party/mruby/Gemfile | 8 + .../third-party/mruby/Gemfile.lock | 27 + lib/nghttp2-1.65.0/third-party/mruby/LEGAL | 40 + .../third-party/mruby/LICENSE} | 18 +- lib/nghttp2-1.65.0/third-party/mruby/Makefile | 35 + lib/nghttp2-1.65.0/third-party/mruby/NEWS | 189 + .../third-party/mruby/README.md | 115 + lib/nghttp2-1.65.0/third-party/mruby/Rakefile | 96 + .../third-party/mruby/SECURITY.md | 20 + lib/nghttp2-1.65.0/third-party/mruby/TODO.md | 13 + .../third-party/mruby/appveyor.yml | 48 + .../mruby/benchmark/bm_ao_render.rb | 309 + .../mruby/benchmark/bm_app_lc_fizzbuzz.rb | 51 + .../third-party/mruby/benchmark/bm_fib.rb | 6 + .../mruby/benchmark/bm_so_lists.rb | 49 + .../third-party/mruby/benchmark/plot.gpl | 5 + .../third-party/mruby/build_config.rb | 9 + .../mruby/build_config/ArduinoDue.rb | 73 + .../mruby/build_config/IntelEdison.rb | 69 + .../mruby/build_config/IntelGalileo.rb | 89 + .../third-party/mruby/build_config/RX630.rb | 64 + .../mruby/build_config/android_arm64_v8a.rb | 11 + .../android_armeabi_v7a_neon_hard.rb | 13 + .../third-party/mruby/build_config/bench.rb | 11 + .../third-party/mruby/build_config/boxing.rb | 19 + .../mruby/build_config/chipKITMax32.rb | 69 + .../mruby/build_config/ci/gcc-clang.rb | 40 + .../third-party/mruby/build_config/ci/msvc.rb | 20 + .../mruby/build_config/clang-asan.rb | 11 + .../mruby/build_config/cross-32bit.rb | 14 + .../build_config/cross-mingw-winetest.rb | 90 + .../mruby/build_config/cross-mingw.rb | 14 + .../third-party/mruby/build_config/default.rb | 80 + .../mruby/build_config/dreamcast_shelf.rb | 83 + .../mruby/build_config/gameboyadvance.rb | 73 + .../mruby/build_config/helpers/wine_runner.rb | 71 + .../mruby/build_config/host-cxx.rb | 12 + .../mruby/build_config/host-debug.rb | 20 + .../mruby/build_config/host-f32.rb | 14 + .../mruby/build_config/host-gprof.rb | 14 + .../mruby/build_config/host-m32.rb | 15 + .../mruby/build_config/host-nofloat.rb | 22 + .../mruby/build_config/host-shared.rb | 36 + .../mruby/build_config/i586-pc-msdosdjgpp.rb | 77 + .../third-party/mruby/build_config/minimal.rb | 4 + .../third-party/mruby/build_config/mrbc.rb | 11 + .../mruby/build_config/nintendo_switch.rb | 73 + .../mruby/build_config/nintendo_wii.rb | 96 + .../mruby/build_config/serenity.rb | 26 + .../third-party/mruby/codespell.txt | 16 + .../third-party/mruby/doc/guides/compile.md | 612 + .../third-party/mruby/doc/guides/debugger.md | 371 + .../mruby/doc/guides/gc-arena-howto.md | 178 + .../third-party/mruby/doc/guides/link.md | 83 + .../third-party/mruby/doc/guides/memory.md | 21 + .../third-party/mruby/doc/guides/mrbconf.md | 252 + .../third-party/mruby/doc/guides/mrbgems.md | 464 + .../third-party/mruby/doc/guides/symbol.md | 83 + .../third-party/mruby/doc/internal/boxing.md | 52 + .../third-party/mruby/doc/internal/opcode.md | 136 + .../third-party/mruby/doc/limitations.md | 255 + .../third-party/mruby/doc/mruby3.0.md | 163 + .../third-party/mruby/doc/mruby3.1.md | 255 + .../third-party/mruby/doc/mruby3.2.md | 79 + .../third-party/mruby/doc/mruby3.3.md | 186 + .../mruby/doc/mruby_logo_red_icon.png | Bin 0 -> 8561 bytes .../third-party/mruby/docker-compose.yml | 13 + .../c_and_ruby_extension_example/README.md | 3 + .../c_and_ruby_extension_example/mrbgem.rake | 23 + .../mrblib/example.rb | 5 + .../src/example.c | 23 + .../test/example.rb | 7 + .../mrbgems/c_extension_example/README.md | 3 + .../mrbgems/c_extension_example/mrbgem.rake | 23 + .../mrbgems/c_extension_example/src/example.c | 23 + .../c_extension_example/test/example.c | 7 + .../c_extension_example/test/example.rb | 3 + .../mrbgems/cdata_extension_example/README.md | 3 + .../cdata_extension_example/mrbgem.rake | 23 + .../cdata_extension_example/src/example.c | 77 + .../cdata_extension_example/test/example.c | 7 + .../mrbgems/mruby-YOUR-bigint/TODO-HINT.md | 39 + .../mrbgems/mruby-YOUR-bigint/core/bigint.c | 70 + .../mrbgems/mruby-YOUR-bigint/mrbgem.rake | 12 + .../mrbgems/ruby_extension_example/README.md | 3 + .../ruby_extension_example/mrbgem.rake | 25 + .../ruby_extension_example/mrblib/example.rb | 5 + .../ruby_extension_example/test/example.rb | 3 + .../third-party/mruby/include/mrbconf.h | 243 + .../third-party/mruby/include/mruby.h | 1545 + .../third-party/mruby/include/mruby/array.h | 301 + .../mruby/include/mruby/boxing_nan.h | 159 + .../mruby/include/mruby/boxing_no.h | 58 + .../mruby/include/mruby/boxing_word.h | 231 + .../third-party/mruby/include/mruby/class.h | 104 + .../third-party/mruby/include/mruby/common.h | 98 + .../third-party/mruby/include/mruby/compile.h | 215 + .../third-party/mruby/include/mruby/data.h | 76 + .../third-party/mruby/include/mruby/debug.h | 75 + .../third-party/mruby/include/mruby/dump.h | 159 + .../third-party/mruby/include/mruby/endian.h | 44 + .../third-party/mruby/include/mruby/error.h | 132 + .../third-party/mruby/include/mruby/gc.h | 83 + .../third-party/mruby/include/mruby/hash.h | 234 + .../mruby/include/mruby/internal.h | 238 + .../third-party/mruby/include/mruby/irep.h | 132 + .../third-party/mruby/include/mruby/istruct.h | 50 + .../third-party/mruby/include/mruby/khash.h | 284 + .../third-party/mruby/include/mruby/numeric.h | 174 + .../third-party/mruby/include/mruby/object.h | 47 + .../third-party/mruby/include/mruby/opcode.h | 69 + .../third-party/mruby/include/mruby/ops.h | 120 + .../third-party/mruby/include/mruby/presym.h | 40 + .../mruby/include/mruby/presym/disable.h | 70 + .../mruby/include/mruby/presym/enable.h | 37 + .../mruby/include/mruby/presym/scanning.h | 79 + .../third-party/mruby/include/mruby/proc.h | 185 + .../third-party/mruby/include/mruby/range.h | 77 + .../third-party/mruby/include/mruby/re.h | 16 + .../third-party/mruby/include/mruby/string.h | 431 + .../third-party/mruby/include/mruby/throw.h | 65 + .../third-party/mruby/include/mruby/value.h | 461 + .../mruby/include/mruby/variable.h | 102 + .../third-party/mruby/include/mruby/version.h | 143 + .../third-party/mruby/lib/mruby/build.rb | 622 + .../mruby/lib/mruby/build/command.rb | 383 + .../mruby/lib/mruby/build/load_gems.rb | 376 + .../third-party/mruby/lib/mruby/core_ext.rb | 61 + .../third-party/mruby/lib/mruby/doc.rb | 50 + .../third-party/mruby/lib/mruby/gem.rb | 532 + .../third-party/mruby/lib/mruby/lockfile.rb | 81 + .../third-party/mruby/lib/mruby/presym.rb | 166 + .../third-party/mruby/lib/mruby/source.rb | 32 + lib/nghttp2-1.65.0/third-party/mruby/minirake | 2 + .../mruby/mrbgems/default-no-fpu.gembox | 3 + .../mruby/mrbgems/default-no-stdio.gembox | 4 + .../third-party/mruby/mrbgems/default.gembox | 25 + .../mruby/mrbgems/full-core.gembox | 6 + .../third-party/mruby/mrbgems/math.gembox | 14 + .../third-party/mruby/mrbgems/metaprog.gembox | 15 + .../mruby/mrbgems/mruby-array-ext/mrbgem.rake | 5 + .../mrbgems/mruby-array-ext/mrblib/array.rb | 1019 + .../mruby/mrbgems/mruby-array-ext/src/array.c | 363 + .../mrbgems/mruby-array-ext/test/array.rb | 501 + .../mruby/mrbgems/mruby-bigint/README-fgmp.md | 154 + .../mruby/mrbgems/mruby-bigint/README.md | 7 + .../mruby/mrbgems/mruby-bigint/core/bigint.c | 1635 + .../mruby/mrbgems/mruby-bigint/core/bigint.h | 63 + .../mruby/mrbgems/mruby-bigint/mrbgem.rake | 10 + .../mruby/mrbgems/mruby-bigint/test/bigint.rb | 23 + .../mrbgems/mruby-bin-config/mrbgem.rake | 49 + .../mrbgems/mruby-bin-config/mruby-config | 46 + .../mrbgems/mruby-bin-config/mruby-config.bat | 102 + .../mruby-bin-debugger/bintest/mrdb.rb | 283 + .../mruby-bin-debugger/bintest/print.rb | 703 + .../mrbgems/mruby-bin-debugger/mrbgem.rake | 9 + .../mruby-bin-debugger/tools/mrdb/apibreak.c | 523 + .../mruby-bin-debugger/tools/mrdb/apibreak.h | 26 + .../mruby-bin-debugger/tools/mrdb/apilist.c | 238 + .../mruby-bin-debugger/tools/mrdb/apilist.h | 14 + .../mruby-bin-debugger/tools/mrdb/apiprint.c | 84 + .../mruby-bin-debugger/tools/mrdb/apiprint.h | 13 + .../mruby-bin-debugger/tools/mrdb/apistring.c | 34 + .../mruby-bin-debugger/tools/mrdb/apistring.h | 14 + .../mruby-bin-debugger/tools/mrdb/cmdbreak.c | 436 + .../mruby-bin-debugger/tools/mrdb/cmdmisc.c | 509 + .../mruby-bin-debugger/tools/mrdb/cmdprint.c | 81 + .../mruby-bin-debugger/tools/mrdb/cmdrun.c | 64 + .../mruby-bin-debugger/tools/mrdb/mrdb.c | 765 + .../mruby-bin-debugger/tools/mrdb/mrdb.h | 159 + .../mruby-bin-debugger/tools/mrdb/mrdbconf.h | 24 + .../mruby-bin-debugger/tools/mrdb/mrdberror.h | 19 + .../mrbgems/mruby-bin-mirb/bintest/mirb.rb | 58 + .../mruby/mrbgems/mruby-bin-mirb/mrbgem.rake | 49 + .../mrbgems/mruby-bin-mirb/tools/mirb/mirb.c | 714 + .../mrbgems/mruby-bin-mrbc/bintest/mrbc.rb | 30 + .../mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake | 15 + .../mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c | 371 + .../mrbgems/mruby-bin-mrbc/tools/mrbc/stub.c | 74 + .../mrbgems/mruby-bin-mruby/bintest/mruby.rb | 178 + .../mruby/mrbgems/mruby-bin-mruby/mrbgem.rake | 12 + .../mruby-bin-mruby/tools/mruby/mruby.c | 380 + .../mruby-bin-strip/bintest/mruby-strip.rb | 73 + .../mruby/mrbgems/mruby-bin-strip/mrbgem.rake | 7 + .../tools/mruby-strip/mruby-strip.c | 144 + .../mruby/mrbgems/mruby-binding/mrbgem.rake | 7 + .../mruby/mrbgems/mruby-binding/src/binding.c | 420 + .../mrbgems/mruby-binding/test/binding.c | 14 + .../mrbgems/mruby-binding/test/binding.rb | 64 + .../mruby/mrbgems/mruby-catch/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-catch/mrblib/catch.rb | 8 + .../mruby/mrbgems/mruby-catch/src/catch.c | 99 + .../mruby/mrbgems/mruby-catch/test/catch.rb | 86 + .../mruby/mrbgems/mruby-class-ext/mrbgem.rake | 5 + .../mrbgems/mruby-class-ext/mrblib/module.rb | 89 + .../mruby/mrbgems/mruby-class-ext/src/class.c | 158 + .../mrbgems/mruby-class-ext/test/class.rb | 29 + .../mrbgems/mruby-class-ext/test/module.rb | 109 + .../mruby/mrbgems/mruby-cmath/mrbgem.rake | 8 + .../mruby/mrbgems/mruby-cmath/src/cmath.c | 269 + .../mruby/mrbgems/mruby-cmath/test/cmath.rb | 41 + .../mrbgems/mruby-compar-ext/mrbgem.rake | 5 + .../mrbgems/mruby-compar-ext/mrblib/compar.rb | 92 + .../mrbgems/mruby-compiler/core/codegen.c | 4099 ++ .../mrbgems/mruby-compiler/core/keywords | 52 + .../mruby/mrbgems/mruby-compiler/core/lex.def | 207 + .../mruby/mrbgems/mruby-compiler/core/node.h | 103 + .../mruby/mrbgems/mruby-compiler/core/parse.y | 7860 ++++ .../mruby/mrbgems/mruby-compiler/core/y.tab.c | 14435 ++++++++ .../mruby/mrbgems/mruby-compiler/mrbgem.rake | 40 + .../mruby/mrbgems/mruby-complex/mrbgem.rake | 7 + .../mrbgems/mruby-complex/mrblib/complex.rb | 82 + .../mruby/mrbgems/mruby-complex/src/complex.c | 423 + .../mrbgems/mruby-complex/test/complex.rb | 163 + .../mruby/mrbgems/mruby-data/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-data/src/data.c | 516 + .../mruby/mrbgems/mruby-data/test/data.rb | 76 + .../mruby/mrbgems/mruby-dir/README.md | 53 + .../mruby/mrbgems/mruby-dir/mrbgem.rake | 4 + .../mruby/mrbgems/mruby-dir/mrblib/dir.rb | 68 + .../mruby/mrbgems/mruby-dir/src/Win/dirent.c | 140 + .../mruby/mrbgems/mruby-dir/src/dir.c | 328 + .../mruby/mrbgems/mruby-dir/test/dir.rb | 137 + .../mruby/mrbgems/mruby-dir/test/dirtest.c | 142 + .../mrbgems/mruby-enum-chain/mrbgem.rake | 6 + .../mrbgems/mruby-enum-chain/mrblib/chain.rb | 62 + .../mruby-enum-chain/test/enum_chain.rb | 108 + .../mruby/mrbgems/mruby-enum-ext/mrbgem.rake | 5 + .../mrbgems/mruby-enum-ext/mrblib/enum.rb | 883 + .../mruby/mrbgems/mruby-enum-ext/test/enum.rb | 197 + .../mruby/mrbgems/mruby-enum-lazy/mrbgem.rake | 7 + .../mrbgems/mruby-enum-lazy/mrblib/lazy.rb | 181 + .../mrbgems/mruby-enum-lazy/test/lazy.rb | 53 + .../mrbgems/mruby-enumerator/mrbgem.rake | 6 + .../mruby-enumerator/mrblib/enumerator.rb | 704 + .../mruby-enumerator/test/enumerator.rb | 600 + .../mruby/mrbgems/mruby-errno/README.md | 25 + .../mruby/mrbgems/mruby-errno/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-errno/mrblib/errno.rb | 15 + .../mruby/mrbgems/mruby-errno/src/errno.c | 323 + .../mruby/mrbgems/mruby-errno/src/gen.rb | 18 + .../mrbgems/mruby-errno/src/known_errors.def | 156 + .../mruby-errno/src/known_errors_def.cstub | 780 + .../mruby/mrbgems/mruby-errno/test/errno.rb | 58 + .../mruby/mrbgems/mruby-error/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-error/src/exception.c | 81 + .../mrbgems/mruby-error/test/exception.c | 59 + .../mrbgems/mruby-error/test/exception.rb | 55 + .../mruby/mrbgems/mruby-eval/mrbgem.rake | 10 + .../mruby/mrbgems/mruby-eval/src/eval.c | 357 + .../mruby/mrbgems/mruby-eval/test/binding.rb | 81 + .../mruby/mrbgems/mruby-eval/test/eval.rb | 164 + .../mruby/mrbgems/mruby-exit/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-exit/src/mruby-exit.c | 83 + .../mruby/mrbgems/mruby-fiber/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-fiber/src/fiber.c | 572 + .../mruby/mrbgems/mruby-fiber/test/fiber.rb | 210 + .../mruby/mrbgems/mruby-fiber/test/fiber2.rb | 155 + .../mrbgems/mruby-fiber/test/fibertest.c | 87 + .../mruby/mrbgems/mruby-hash-ext/mrbgem.rake | 6 + .../mrbgems/mruby-hash-ext/mrblib/hash.rb | 487 + .../mrbgems/mruby-hash-ext/src/hash-ext.c | 112 + .../mruby/mrbgems/mruby-hash-ext/test/hash.rb | 300 + .../mruby/mrbgems/mruby-io/README.md | 193 + .../mrbgems/mruby-io/include/mruby/ext/io.h | 74 + .../mruby/mrbgems/mruby-io/mrbgem.rake | 10 + .../mruby/mrbgems/mruby-io/mrblib/file.rb | 220 + .../mrbgems/mruby-io/mrblib/file_constants.rb | 13 + .../mruby/mrbgems/mruby-io/mrblib/io.rb | 186 + .../mruby/mrbgems/mruby-io/mrblib/kernel.rb | 31 + .../mruby/mrbgems/mruby-io/src/file.c | 705 + .../mruby/mrbgems/mruby-io/src/file_test.c | 352 + .../mruby/mrbgems/mruby-io/src/io.c | 1990 + .../mruby/mrbgems/mruby-io/src/mruby_io_gem.c | 20 + .../mruby/mrbgems/mruby-io/test/file.rb | 289 + .../mruby/mrbgems/mruby-io/test/file_test.rb | 112 + .../mruby/mrbgems/mruby-io/test/io.rb | 667 + .../mrbgems/mruby-io/test/mruby_io_test.c | 246 + .../mrbgems/mruby-kernel-ext/mrbgem.rake | 5 + .../mrbgems/mruby-kernel-ext/src/kernel.c | 289 + .../mrbgems/mruby-kernel-ext/test/kernel.rb | 135 + .../mruby/mrbgems/mruby-math/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-math/src/math.c | 723 + .../mruby/mrbgems/mruby-math/test/math.rb | 201 + .../mruby/mrbgems/mruby-metaprog/mrbgem.rake | 5 + .../mrbgems/mruby-metaprog/src/metaprog.c | 705 + .../mrbgems/mruby-metaprog/test/metaprog.rb | 422 + .../mruby/mrbgems/mruby-method/README.md | 59 + .../mruby/mrbgems/mruby-method/mrbgem.rake | 7 + .../mrbgems/mruby-method/mrblib/method.rb | 16 + .../mruby/mrbgems/mruby-method/src/method.c | 592 + .../mruby/mrbgems/mruby-method/test/method.rb | 484 + .../mrbgems/mruby-numeric-ext/mrbgem.rake | 5 + .../mruby-numeric-ext/mrblib/numeric_ext.rb | 99 + .../mruby-numeric-ext/src/numeric_ext.c | 251 + .../mrbgems/mruby-numeric-ext/test/numeric.rb | 51 + .../mrbgems/mruby-object-ext/mrbgem.rake | 5 + .../mrbgems/mruby-object-ext/mrblib/object.rb | 33 + .../mrbgems/mruby-object-ext/src/object.c | 133 + .../mrbgems/mruby-object-ext/test/nil.rb | 16 + .../mrbgems/mruby-object-ext/test/object.rb | 53 + .../mrbgems/mruby-objectspace/mrbgem.rake | 5 + .../mruby-objectspace/src/mruby_objectspace.c | 188 + .../mruby-objectspace/test/objectspace.rb | 60 + .../mrbgems/mruby-os-memsize/mrbgem.rake | 10 + .../mrbgems/mruby-os-memsize/src/memsize.c | 266 + .../mrbgems/mruby-os-memsize/test/memsize.rb | 63 + .../mruby/mrbgems/mruby-pack/README.md | 71 + .../mruby/mrbgems/mruby-pack/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-pack/src/pack.c | 1763 + .../mruby/mrbgems/mruby-pack/test/pack.rb | 158 + .../mruby/mrbgems/mruby-print/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-print/mrblib/print.rb | 43 + .../mruby/mrbgems/mruby-print/src/print.c | 70 + .../mrbgems/mruby-proc-binding/mrbgem.rake | 10 + .../mruby-proc-binding/src/proc-binding.c | 45 + .../mruby-proc-binding/test/proc-binding.c | 14 + .../mruby-proc-binding/test/proc-binding.rb | 22 + .../mruby/mrbgems/mruby-proc-ext/mrbgem.rake | 5 + .../mrbgems/mruby-proc-ext/mrblib/proc.rb | 50 + .../mruby/mrbgems/mruby-proc-ext/src/proc.c | 191 + .../mruby/mrbgems/mruby-proc-ext/test/proc.c | 62 + .../mruby/mrbgems/mruby-proc-ext/test/proc.rb | 134 + .../mruby/mrbgems/mruby-random/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-random/src/random.c | 435 + .../mruby/mrbgems/mruby-random/test/random.rb | 137 + .../mruby/mrbgems/mruby-range-ext/mrbgem.rake | 5 + .../mrbgems/mruby-range-ext/mrblib/range.rb | 124 + .../mruby/mrbgems/mruby-range-ext/src/range.c | 219 + .../mrbgems/mruby-range-ext/test/range.rb | 214 + .../mruby/mrbgems/mruby-rational/mrbgem.rake | 7 + .../mrbgems/mruby-rational/mrblib/rational.rb | 15 + .../mrbgems/mruby-rational/src/rational.c | 803 + .../mrbgems/mruby-rational/test/rational.rb | 348 + .../mruby/mrbgems/mruby-set/LICENSE | 24 + .../mruby/mrbgems/mruby-set/README.md | 34 + .../mruby/mrbgems/mruby-set/mrbgem.rake | 7 + .../mruby/mrbgems/mruby-set/mrblib/set.rb | 325 + .../mruby/mrbgems/mruby-set/mruby-set.gem | 6 + .../mruby/mrbgems/mruby-set/test/set.rb | 632 + .../mruby/mrbgems/mruby-sleep/README.md | 29 + .../mrbgems/mruby-sleep/example/sleep.rb | 2 + .../mruby/mrbgems/mruby-sleep/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-sleep/src/sleep.c | 138 + .../mrbgems/mruby-sleep/test/sleep_test.rb | 29 + .../mruby/mrbgems/mruby-socket/README.md | 56 + .../mruby/mrbgems/mruby-socket/mrbgem.rake | 17 + .../mrbgems/mruby-socket/mrblib/socket.rb | 572 + .../mrbgems/mruby-socket/src/const.cstub | 480 + .../mruby/mrbgems/mruby-socket/src/const.def | 172 + .../mruby/mrbgems/mruby-socket/src/gen.rb | 17 + .../mruby/mrbgems/mruby-socket/src/socket.c | 1134 + .../mrbgems/mruby-socket/test/addrinfo.rb | 91 + .../mrbgems/mruby-socket/test/basicsocket.rb | 17 + .../mrbgems/mruby-socket/test/ipsocket.rb | 44 + .../mruby/mrbgems/mruby-socket/test/socket.rb | 38 + .../mrbgems/mruby-socket/test/sockettest.c | 84 + .../mrbgems/mruby-socket/test/tcpsocket.rb | 4 + .../mrbgems/mruby-socket/test/udpsocket.rb | 16 + .../mruby/mrbgems/mruby-socket/test/unix.rb | 130 + .../mruby/mrbgems/mruby-sprintf/mrbgem.rake | 5 + .../mrbgems/mruby-sprintf/mrblib/string.rb | 9 + .../mruby/mrbgems/mruby-sprintf/src/sprintf.c | 1123 + .../mrbgems/mruby-sprintf/test/sprintf.rb | 97 + .../mrbgems/mruby-string-ext/mrbgem.rake | 5 + .../mrbgems/mruby-string-ext/mrblib/string.rb | 462 + .../mrbgems/mruby-string-ext/src/string.c | 1411 + .../mrbgems/mruby-string-ext/test/numeric.rb | 27 + .../mrbgems/mruby-string-ext/test/range.rb | 26 + .../mrbgems/mruby-string-ext/test/string.rb | 739 + .../mruby/mrbgems/mruby-struct/mrbgem.rake | 5 + .../mrbgems/mruby-struct/mrblib/struct.rb | 69 + .../mruby/mrbgems/mruby-struct/src/struct.c | 727 + .../mruby/mrbgems/mruby-struct/test/struct.rb | 210 + .../mrbgems/mruby-symbol-ext/mrbgem.rake | 5 + .../mrbgems/mruby-symbol-ext/mrblib/symbol.rb | 72 + .../mrbgems/mruby-symbol-ext/src/symbol.c | 76 + .../mrbgems/mruby-symbol-ext/test/symbol.rb | 55 + .../mruby-test-inline-struct/mrbgem.rake | 5 + .../mruby-test-inline-struct/test/inline.c | 92 + .../mruby-test-inline-struct/test/inline.rb | 118 + .../mruby/mrbgems/mruby-test/README.md | 7 + .../mruby/mrbgems/mruby-test/driver.c | 310 + .../mruby/mrbgems/mruby-test/mrbgem.rake | 165 + .../mruby/mrbgems/mruby-test/vformat.c | 179 + .../mrbgems/mruby-time/include/mruby/time.h | 26 + .../mruby/mrbgems/mruby-time/mrbgem.rake | 5 + .../mruby/mrbgems/mruby-time/src/time.c | 1172 + .../mruby/mrbgems/mruby-time/test/time.rb | 269 + .../mrbgems/mruby-toplevel-ext/mrbgem.rake | 5 + .../mruby-toplevel-ext/mrblib/toplevel.rb | 10 + .../mruby-toplevel-ext/test/toplevel.rb | 23 + .../mruby/mrbgems/stdlib-ext.gembox | 21 + .../mruby/mrbgems/stdlib-io.gembox | 18 + .../third-party/mruby/mrbgems/stdlib.gembox | 57 + .../third-party/mruby/mrblib/00class.rb | 41 + .../third-party/mruby/mrblib/00kernel.rb | 35 + .../third-party/mruby/mrblib/10error.rb | 76 + .../third-party/mruby/mrblib/array.rb | 298 + .../third-party/mruby/mrblib/compar.rb | 102 + .../third-party/mruby/mrblib/enum.rb | 353 + .../third-party/mruby/mrblib/hash.rb | 303 + .../third-party/mruby/mrblib/kernel.rb | 45 + .../third-party/mruby/mrblib/numeric.rb | 160 + .../third-party/mruby/mrblib/range.rb | 97 + .../third-party/mruby/mrblib/string.rb | 173 + .../third-party/mruby/mrblib/symbol.rb | 7 + .../third-party/mruby/mruby-source.gemspec | 17 + .../mruby/oss-fuzz/config/mruby.dict | 105 + .../oss-fuzz/config/mruby_fuzzer.options | 5 + .../config/mruby_proto_fuzzer.options | 4 + .../third-party/mruby/oss-fuzz/mruby_fuzzer.c | 18 + .../mruby/oss-fuzz/mruby_proto_fuzzer.cpp | 45 + .../mruby/oss-fuzz/proto_to_ruby.cpp | 455 + .../mruby/oss-fuzz/proto_to_ruby.h | 55 + .../third-party/mruby/oss-fuzz/ruby.proto | 201 + .../third-party/mruby/src/allocf.c | 30 + .../third-party/mruby/src/array.c | 1442 + .../third-party/mruby/src/backtrace.c | 273 + .../third-party/mruby/src/cdump.c | 467 + .../third-party/mruby/src/class.c | 3075 ++ .../third-party/mruby/src/codedump.c | 644 + .../third-party/mruby/src/debug.c | 241 + .../third-party/mruby/src/dump.c | 931 + .../third-party/mruby/src/enum.c | 31 + .../third-party/mruby/src/error.c | 690 + .../third-party/mruby/src/error.h | 3 + .../third-party/mruby/src/etc.c | 252 + .../third-party/mruby/src/fmt_fp.c | 372 + lib/nghttp2-1.65.0/third-party/mruby/src/gc.c | 1588 + .../third-party/mruby/src/hash.c | 1900 + .../third-party/mruby/src/init.c | 49 + .../third-party/mruby/src/kernel.c | 589 + .../third-party/mruby/src/load.c | 768 + .../third-party/mruby/src/numeric.c | 2322 ++ .../third-party/mruby/src/numops.c | 112 + .../third-party/mruby/src/object.c | 651 + .../third-party/mruby/src/opcode.h | 2 + .../third-party/mruby/src/pool.c | 181 + .../third-party/mruby/src/print.c | 84 + .../third-party/mruby/src/proc.c | 507 + .../third-party/mruby/src/range.c | 526 + .../third-party/mruby/src/readfloat.c | 120 + .../third-party/mruby/src/readint.c | 28 + .../third-party/mruby/src/readnum.c | 43 + .../third-party/mruby/src/state.c | 231 + .../third-party/mruby/src/string.c | 3119 ++ .../third-party/mruby/src/symbol.c | 702 + .../third-party/mruby/src/value_array.h | 28 + .../third-party/mruby/src/variable.c | 1141 + .../third-party/mruby/src/version.c | 17 + lib/nghttp2-1.65.0/third-party/mruby/src/vm.c | 3126 ++ .../third-party/mruby/tasks/benchmark.rake | 93 + .../third-party/mruby/tasks/bin.rake | 23 + .../third-party/mruby/tasks/core.rake | 12 + .../third-party/mruby/tasks/doc.rake | 92 + .../third-party/mruby/tasks/install.rake | 33 + .../third-party/mruby/tasks/libmruby.rake | 90 + .../third-party/mruby/tasks/mrbgems.rake | 153 + .../third-party/mruby/tasks/mrblib.rake | 40 + .../third-party/mruby/tasks/presym.rake | 48 + .../third-party/mruby/tasks/test.rake | 69 + .../mruby/tasks/toolchains/android.rake | 228 + .../mruby/tasks/toolchains/clang.rake | 8 + .../mruby/tasks/toolchains/gcc.rake | 74 + .../mruby/tasks/toolchains/openwrt.rake | 32 + .../mruby/tasks/toolchains/visualcpp.rake | 53 + .../third-party/mruby/test/assert.rb | 404 + .../third-party/mruby/test/bintest.rb | 56 + .../third-party/mruby/test/t/argumenterror.rb | 37 + .../third-party/mruby/test/t/array.rb | 447 + .../third-party/mruby/test/t/basicobject.rb | 10 + .../third-party/mruby/test/t/bs_block.rb | 534 + .../third-party/mruby/test/t/bs_literal.rb | 38 + .../third-party/mruby/test/t/class.rb | 479 + .../third-party/mruby/test/t/codegen.rb | 196 + .../third-party/mruby/test/t/comparable.rb | 79 + .../third-party/mruby/test/t/ensure.rb | 36 + .../third-party/mruby/test/t/enumerable.rb | 134 + .../third-party/mruby/test/t/exception.rb | 425 + .../third-party/mruby/test/t/false.rb | 31 + .../third-party/mruby/test/t/float.rb | 318 + .../third-party/mruby/test/t/gc.rb | 45 + .../third-party/mruby/test/t/hash.rb | 1008 + .../third-party/mruby/test/t/indexerror.rb | 6 + .../third-party/mruby/test/t/integer.rb | 252 + .../third-party/mruby/test/t/iterations.rb | 61 + .../third-party/mruby/test/t/kernel.rb | 498 + .../third-party/mruby/test/t/lang.rb | 74 + .../third-party/mruby/test/t/literals.rb | 386 + .../mruby/test/t/localjumperror.rb | 13 + .../third-party/mruby/test/t/methods.rb | 138 + .../third-party/mruby/test/t/module.rb | 798 + .../third-party/mruby/test/t/nameerror.rb | 28 + .../third-party/mruby/test/t/nil.rb | 39 + .../third-party/mruby/test/t/nomethoderror.rb | 22 + .../third-party/mruby/test/t/numeric.rb | 114 + .../third-party/mruby/test/t/object.rb | 10 + .../third-party/mruby/test/t/proc.rb | 180 + .../third-party/mruby/test/t/range.rb | 194 + .../third-party/mruby/test/t/rangeerror.rb | 6 + .../third-party/mruby/test/t/regexperror.rb | 4 + .../third-party/mruby/test/t/runtimeerror.rb | 6 + .../third-party/mruby/test/t/standarderror.rb | 6 + .../third-party/mruby/test/t/string.rb | 969 + .../third-party/mruby/test/t/superclass.rb | 46 + .../third-party/mruby/test/t/symbol.rb | 30 + .../third-party/mruby/test/t/syntax.rb | 773 + .../third-party/mruby/test/t/true.rb | 31 + .../third-party/mruby/test/t/typeerror.rb | 6 + .../third-party/mruby/test/t/unicode.rb | 39 + .../third-party/mruby/test/t/vformat.rb | 58 + .../third-party/neverbleed/neverbleed.c | 2261 ++ .../third-party/neverbleed/neverbleed.h | 143 + .../third-party/urlparse/urlparse.c | 675 + .../third-party/urlparse/urlparse.h | 170 + lib/nghttp2/CONTRIBUTION | 18 - lib/nghttp2/ChangeLog | 0 lib/nghttp2/LICENSE | 1 - lib/nghttp2/author.py | 52 - lib/nghttp2/cmake/FindCUnit.cmake | 40 - lib/nghttp2/contrib/.gitignore | 3 - lib/nghttp2/contrib/usr.sbin.nghttpx | 16 - lib/nghttp2/doc/.gitignore | 19 - .../bash_completion/make_bash_completion.py | 75 - lib/nghttp2/doc/bash_completion/nghttpx | 19 - lib/nghttp2/doc/docutils.conf | 2 - lib/nghttp2/doc/h2load.h2r | 120 - lib/nghttp2/doc/make.bat | 170 - lib/nghttp2/doc/nghttp.h2r | 57 - lib/nghttp2/doc/nghttpd.h2r | 4 - lib/nghttp2/doc/nghttpx.h2r | 719 - lib/nghttp2/doc/security.rst | 1 - lib/nghttp2/doc/sources/security.rst | 33 - lib/nghttp2/docker/Dockerfile | 78 - lib/nghttp2/docker/README.rst | 25 - lib/nghttp2/examples/.gitignore | 5 - lib/nghttp2/fedora/spdylay.spec | 75 - lib/nghttp2/fuzz/README.rst | 33 - ...4c3ba49d20eac5b4332f7b75b8f74bfba5e43f59f8 | Bin 61 -> 0 bytes ...3c23a338b4c827bf6164640ff20a2d64d45a6b3f5a | Bin 85 -> 0 bytes ...8fcfff43b378a92c7da44268b9dda2bf32a1178c66 | Bin 16466 -> 0 bytes ...2bd3a6c6b1b6005c5f7d5783e99baf2f8f7432d71a | Bin 86 -> 0 bytes ...2f5d07b1dd87de1f651f80ef82c2815b0248b7dccd | Bin 82 -> 0 bytes ...0a41547272ad42377149edcf130b2bf0b76804c61f | 2 - ...06ca725770a731e73c2144c7b81953dcc4b4f73c32 | Bin 86 -> 0 bytes ...6ca4615a351ab74bfc75eb0d227acbef6a35bcae39 | Bin 76 -> 0 bytes ...c5a2b9a9637d325c8f38b4cc6d3f808b5b2a4169a9 | Bin 96 -> 0 bytes ...e83f97e6585c8a51ec2413e7a2e8dfcc444082a5c5 | Bin 61 -> 0 bytes ...84e8c2f917946ec7ef3f4720535478b41e097a798a | Bin 73 -> 0 bytes ...158af429421570e7363a3b75441edc5d740513b0dc | Bin 3603 -> 0 bytes ...9edfac603133e0144dba08836f90b1ae164b328800 | Bin 88 -> 0 bytes ...847b76c09921e984796f6dc482859b119cf4879300 | Bin 77 -> 0 bytes ...fad189d3d70aebe70ecb14ffb1ffe2cd5fc5d1e5f0 | Bin 86 -> 0 bytes ...5432789b45aff588c606536e93824b89739a6d07ab | Bin 85 -> 0 bytes ...54d935ebc543f4d1305e318ccd2ff407517636bed8 | Bin 78 -> 0 bytes ...7f853954e6f11c1f4754ccd83b1603b808878cfa76 | Bin 84 -> 0 bytes ...ea37c900f13f429b750c87e6175b234b881bda6248 | Bin 98 -> 0 bytes ...983d11256d2432fcdeb55bfba9634aa88e3794adc6 | Bin 98 -> 0 bytes ...8ddd0722f69830ac04975ddb5a9d83cdc406cbb678 | Bin 2487 -> 0 bytes ...7c55330e80d8121a0cff19633a56eba8f2182a59df | Bin 71 -> 0 bytes ...01339096b80a382afa1083a19c4deab11be847502f | Bin 77 -> 0 bytes ...042038692eaede4d2c1f9e05a27f2410a6e0230132 | Bin 61 -> 0 bytes ...48ae962bb543dd5ca188dabc30897726f87403fbce | Bin 93 -> 0 bytes ...f68a89c9750332ae5063e36401eae150ce63188fe0 | Bin 86 -> 0 bytes ...4f5d37e4111fe6203bac35b220d50362d5e986aa91 | Bin 65 -> 0 bytes ...6401fee50c647552c99c0550ebfd7a3b736e8db9e5 | Bin 3603 -> 0 bytes ...8a4336f1386633bac75dea2c4b64c02541e7320933 | Bin 114 -> 0 bytes ...aab9a74dd392cbdae104307e8512e5e4113739e93a | Bin 86 -> 0 bytes ...b480efaf9e2526f4ae87c5f5a585d68d6f7f7da13c | Bin 85 -> 0 bytes ...a8dfc0cd0e7aef8a1f5f420eae3d39067ad78df17d | Bin 75 -> 0 bytes ...0881328f80b5d3c942de3b1304a0382923ce896f8f | Bin 89 -> 0 bytes ...4a34c3574da63554ff06f52377b73a9cfc24eb02ca | Bin 61 -> 0 bytes ...5e7e4a102ba74721a04dfa1811e0968e9a4966d92c | Bin 90 -> 0 bytes ...4e1d029cbbbb6113071b2bb13fc9646b5a0447d2cf | Bin 17632 -> 0 bytes ...99f21e9793f6ffc82ae0ef6917a8611e8879e05941 | Bin 86 -> 0 bytes ...ea13b0740f76898ccbb1da25f2281da76e50c1d04a | Bin 93 -> 0 bytes ...a505d84e76374b064aa5c71aab33bd9650c9a9d801 | Bin 83 -> 0 bytes ...f4baf3996053b8572da5f2deee3a636c3bc8dfcc60 | Bin 82 -> 0 bytes ...391023a0981789c2351817996e0c253bfed708ad82 | Bin 58 -> 0 bytes ...fcf964f1897063e81da79c971e8af8c1fefa3e3cab | Bin 63 -> 0 bytes ...153c480754054a57777f22a00d377d745d78e9d193 | Bin 73 -> 0 bytes ...0da94f77bf4a44e4e741420291491343f7ae4ecc16 | Bin 84 -> 0 bytes ...bb7ac85f76a91229d9ba675fc9e09fe12f4a497937 | Bin 86 -> 0 bytes ...61a9f9da021f0fe52ebdbb148ee776ced87bac9b13 | Bin 91 -> 0 bytes ...c9f51f211183795660ec81a6bdb5614031d39ebe3a | Bin 3593 -> 0 bytes ...cb33958a806a1debf3d9ccf7b09c2d31256498cda6 | Bin 85 -> 0 bytes ...f8b4a0e8f7756b9846f2e2add8dd0df825296d993e | Bin 72 -> 0 bytes ...bde202c732b06a9b5f6bc5471c879fa56ec2daa4aa | Bin 85 -> 0 bytes ...0fe60a3e6f90709c6a0e7063a8b4057dafa57c878a | Bin 63 -> 0 bytes ...1e14519f10d8c669a5a2602fc948bc9a80e6114b63 | Bin 82 -> 0 bytes ...625307fe48ef29bc66641c4f80ed4593bf8b773f88 | Bin 85 -> 0 bytes ...90554c93278034ebacc24792509a32aeba466df4e8 | Bin 96 -> 0 bytes ...89d60c1995b7fab68ded6ab052814008d990862c23 | Bin 85 -> 0 bytes ...8cbcfe1a511670ae1a4a434f3d483f942738933a3e | Bin 95 -> 0 bytes ...61d387692063ce2ae73b3e5401b716326967b4ce0c | Bin 73 -> 0 bytes ...9cb48c502c3bfc4cb0a950aeba998a72ea6a3d5b2d | Bin 84 -> 0 bytes ...fa7ebdc8d9ff3443ad5892d75dd6d4f7d541713d33 | Bin 71 -> 0 bytes ...74d4fab435b7738e1a14d0754fb79229c4bda9f604 | Bin 63 -> 0 bytes ...ee59618a2ebd483812410e9f8ae5a92fb72ef70885 | Bin 87 -> 0 bytes ...f62659d3b26bcbb8f2055f1add504f599f9051f61e | Bin 65 -> 0 bytes ...d33933fae10c67e501d6cea8e73ce76f4363d0bbea | Bin 89 -> 0 bytes ...8849f277f914a889a54d44c1f2566b6ddd5bc83b4f | Bin 86 -> 0 bytes ...23da1173666aaeae9788b144fa2c723204d55cc0a2 | Bin 61 -> 0 bytes ...9e19835f34e56c7927fda22859e960f5f13bc847a0 | Bin 87 -> 0 bytes ...4677a6c1a118994d7534d1fb08d631898d67372f5a | Bin 92 -> 0 bytes ...03e3e553623d4fc382324d8b8ba53ebf83f0457707 | Bin 74 -> 0 bytes ...d0668e5c26a87a1c4cf70a6566aa0f199fe3c1dc18 | Bin 77 -> 0 bytes ...5328f893972df210ab75cdb67f620b370ee5cddf45 | Bin 60 -> 0 bytes ...2d0a01173ea80ccc584b659947b64ffefddab7fada | Bin 73 -> 0 bytes ...fbd63cb6b161131d5722f201f2f4ba0984b46a3ca5 | Bin 80 -> 0 bytes ...0f7d85086319d4177524fad58dc01743434765902a | Bin 101 -> 0 bytes ...3a7a52dc7494b53a0f8a93fbc1816c6c4f347780b0 | Bin 61 -> 0 bytes ...5e9cc4e407fc62ce5688e1c6636f482ea02314c357 | Bin 103 -> 0 bytes ...556bfbdb3e1c74e04f7d2cf88eab49b0fd89845453 | Bin 73 -> 0 bytes ...48550f07fa8818d1ee8edae39ca50f516a57a12edb | Bin 73 -> 0 bytes ...9caf527d5f10667e0a38790f28f32af61efa930eef | Bin 58 -> 0 bytes ...d187c8acb61d3a638bc30568bdcc6be30fd9defd43 | Bin 65 -> 0 bytes ...88a40d0b144f11ee98624e3686c0f43684e34e6838 | Bin 100 -> 0 bytes ...b07b2fd54985ef27c99670bed582ce904569b95702 | Bin 81 -> 0 bytes ...c37e73af29a0fbb29e47bf36839a762bb26fea3ec7 | Bin 65 -> 0 bytes ...d38ef10be0d08b5e096630308f0d6f57a6f8ee5d88 | Bin 73 -> 0 bytes ...73ecca531ef0dc92a67a233ebc8d1e2fff79f50a07 | Bin 83 -> 0 bytes ...c3527d5ecf2f4e538dfedddf34ff484e29d6fd26d1 | Bin 85 -> 0 bytes ...4a0969b588dc9281ea98fd744acd9b8bd1daf72225 | Bin 3606 -> 0 bytes ...c304c9c9ba6b43e13849235339710d6b5f941e80a1 | Bin 84 -> 0 bytes ...1b48d08b52752a41633279ff2e9e474eebf508250f | Bin 91 -> 0 bytes ...e44db5b90a4bb23e0558873f159bf09140782989d8 | Bin 102 -> 0 bytes ...ff40a58a1f24e9b1a8c530823d7d12053ec4aabd76 | Bin 75 -> 0 bytes ...eb105290328add76123b4a99ad4e78189e1337ae1b | Bin 65 -> 0 bytes ...ec483a4b493668ca1448948c62f641d176838306d5 | Bin 73 -> 0 bytes ...211893e7681fef6da4b623392d402fb40736dc1beb | Bin 71 -> 0 bytes ...3016c49cc2a868a1bfc007528138a28ea1c0abfda7 | Bin 63 -> 0 bytes ...d9897e41ceb2add1ebdec0937a64321c536eef71f7 | Bin 104 -> 0 bytes ...4bb9e6c9011855bbf954c273f45eb3ea97bb491c9a | Bin 39 -> 0 bytes ...8c177382ab3278a019935fa50b3e0d7971c28c40d9 | Bin 63 -> 0 bytes ...c5a009696cd5f659f85fc10ef76dc140851ffcc423 | Bin 87 -> 0 bytes ...e5de18d06d885b50be9136778b4937437f0d70738d | Bin 101 -> 0 bytes ...77470859ccb4ec9fa5e8c30de7b40521d620b87a1e | Bin 117 -> 0 bytes ...fcf3f3e41e75bae978dcfc8886981479d723fc44e9 | Bin 98 -> 0 bytes ...2a88c9537bee642b8a7a8a388cb4952f3bf60e64cc | Bin 70 -> 0 bytes ...b9a30f8faa658ee49f6ce90f3e34df70560a0477ad | Bin 85 -> 0 bytes ...4b1a0d0e22054f76bf704db8e19d73cb9bf792a89b | Bin 86 -> 0 bytes ...63f7c212d2465936090c06ba4db92071a3c247ca11 | Bin 72 -> 0 bytes ...bc0fa5ea05ea4dd7b163e8d85287b19ff257a88ea7 | Bin 58 -> 0 bytes ...db68bd212ef16a7f1f41047e290d14f9cd6dae91a0 | Bin 102 -> 0 bytes ...ec0bec10473e79c9097bfd8fd81d1a239f146f31d3 | Bin 63 -> 0 bytes ...5aaad19a6ff59c8316908b20d3c94cdc29a92964e6 | Bin 62 -> 0 bytes ...b53931aa6bfd4ce95771c748372626414d5c37e105 | Bin 3593 -> 0 bytes ...1cef9c3f753d440c75efa489a952fdcd314d27ee1d | Bin 81 -> 0 bytes ...ff4970fb339f440867ebedf02eaab75fb555e293cf | Bin 76 -> 0 bytes ...ac3f98734af2cdcfe3ebb6e02dcce9b7f4c4bcc99a | Bin 98 -> 0 bytes ...a945b7fd0035f6dba48d886160fdf1974aae8dee65 | Bin 84 -> 0 bytes ...c711940e4917d5dae3dc2723a034f44d2b53a34a11 | Bin 16465 -> 0 bytes ...e717a9e6aa8bb2842953e4528230a5bcfc3a59c120 | Bin 62 -> 0 bytes ...290f938c5bc247c440a2e572ab18021c8223c55bc7 | Bin 65 -> 0 bytes ...3d6e269f8b4bc785089040be666f480464cb13b4df | Bin 102 -> 0 bytes ...a68efea1d8d304ae595a094ebc955bceb6d06ed629 | Bin 81 -> 0 bytes ...5556875ab6df561f1ca718f1fc716a929d3c706f14 | Bin 60 -> 0 bytes ...1c1ef87680a96a1aca613180110df26259eb36c433 | Bin 79 -> 0 bytes ...51637a357cc1c84d30e3d48bccc9b97564c8a60b73 | Bin 73 -> 0 bytes ...1089ad6af12beea18f895be6f18d42962721d6e3ee | Bin 102 -> 0 bytes ...cac77778fe630b278f167321a46d861ac8ad56fd76 | Bin 85 -> 0 bytes ...98bdd719b37b4a98fe3b1414b583ddb5dc17f62e3a | Bin 63 -> 0 bytes ...157dbfa122f6de9b6f4e5a3a036c17f32da3030877 | Bin 72 -> 0 bytes ...12a9b8b0419fbae7c0934dda22e61f11556918f1cc | Bin 115 -> 0 bytes ...bd936130b0d06332ab062a48f41b206ce696428e03 | Bin 65 -> 0 bytes ...4af58d8bba7df12c1cd15c404d95680df6fc1cb89e | Bin 72 -> 0 bytes ...e7ff3c0422328c131f4642d30a4c88bdf43bcd8d98 | Bin 90 -> 0 bytes ...57fde916a7d8db293427159f3b31bbc23b6b285116 | Bin 85 -> 0 bytes ...057b557ab044d24130bd360fe087e9f55bef2cadc6 | Bin 91 -> 0 bytes ...ef7f1af5952ecb2df2423022dd5483d8fede26d6e5 | Bin 3606 -> 0 bytes ...4ac6fc7a87ffaf9f9c6ce4323e6e0fefaabb2393cb | Bin 191 -> 0 bytes ...a704db43cdfec99fc1b9de83c195227161f4bdb911 | Bin 5070 -> 0 bytes ...084e3946d556086c9991cce7962e9e69a3eed406aa | Bin 18740 -> 0 bytes lib/nghttp2/fuzz/fuzz_frames.cc | 160 - lib/nghttp2/fuzz/fuzz_target.cc | 79 - lib/nghttp2/fuzz/fuzz_target_fdp.cc | 99 - lib/nghttp2/genauthoritychartbl.py | 32 - lib/nghttp2/gendowncasetbl.py | 30 - lib/nghttp2/genheaderfunc.py | 48 - lib/nghttp2/genlibtokenlookup.py | 143 - lib/nghttp2/genmethodchartbl.py | 29 - lib/nghttp2/genmethodfunc.py | 52 - lib/nghttp2/gennghttpxfun.py | 241 - lib/nghttp2/gennmchartbl.py | 28 - lib/nghttp2/genpathchartbl.py | 23 - lib/nghttp2/gentokenlookup.py | 69 - lib/nghttp2/genvchartbl.py | 26 - lib/nghttp2/git-clang-format | 484 - lib/nghttp2/go.mod | 26 - lib/nghttp2/go.sum | 78 - lib/nghttp2/help2rst.py | 192 - lib/nghttp2/integration-tests/.gitignore | 3 - lib/nghttp2/lib/.gitignore | 3 - lib/nghttp2/lib/CMakeLists.txt | 80 - lib/nghttp2/lib/nghttp2_hd_huffman_data.c | 4980 --- lib/nghttp2/lib/nghttp2_helper.c | 805 - lib/nghttp2/lib/nghttp2_map.c | 338 - lib/nghttp2/lib/nghttp2_stream.c | 1016 - lib/nghttp2/lib/sfparse.c | 1146 - lib/nghttp2/lib/sfparse.h | 409 - lib/nghttp2/m4/libxml2.m4 | 188 - lib/nghttp2/makebashcompletion | 7 - lib/nghttp2/makemanpages | 12 - lib/nghttp2/makerelease.sh | 23 - lib/nghttp2/mkcipherlist.py | 325 - lib/nghttp2/mkhufftbl.py | 468 - lib/nghttp2/mkstatichdtbl.py | 36 - lib/nghttp2/nghttp2-master.zip | Bin 1445803 -> 0 bytes .../nghttp2-master/.github/dependabot.yml | 6 - .../.github/workflows/build.yml | 482 - .../nghttp2-master/.github/workflows/fuzz.yml | 24 - lib/nghttp2/nghttp2-master/.gitignore | 56 - lib/nghttp2/nghttp2-master/.gitmodules | 7 - lib/nghttp2/pre-commit | 27 - lib/nghttp2/releasechk | 6 - lib/nghttp2/src/.gitignore | 13 - lib/nghttp2/src/ca-config.json | 17 - lib/nghttp2/src/ca.nghttp2.org-key.pem | 27 - lib/nghttp2/src/ca.nghttp2.org.csr | 17 - lib/nghttp2/src/ca.nghttp2.org.csr.json | 17 - lib/nghttp2/src/ca.nghttp2.org.pem | 22 - lib/nghttp2/src/http-parser.patch | 28 - lib/nghttp2/src/http2_test.cc | 1249 - lib/nghttp2/src/http3.h | 123 - lib/nghttp2/src/libevent_util.cc | 162 - lib/nghttp2/src/libevent_util.h | 75 - lib/nghttp2/src/memchunk_test.cc | 340 - lib/nghttp2/src/shrpx-unittest.cc | 248 - lib/nghttp2/src/shrpx_config_test.cc | 249 - lib/nghttp2/src/shrpx_downstream_test.cc | 231 - lib/nghttp2/src/shrpx_http_test.cc | 168 - lib/nghttp2/src/shrpx_quic.h | 138 - lib/nghttp2/src/shrpx_router_test.cc | 184 - lib/nghttp2/src/shrpx_worker_test.cc | 247 - lib/nghttp2/src/template_test.cc | 204 - lib/nghttp2/src/test.example.com-key.pem | 27 - lib/nghttp2/src/test.example.com.csr | 17 - lib/nghttp2/src/test.example.com.csr.json | 14 - lib/nghttp2/src/test.nghttp2.org-key.pem | 27 - lib/nghttp2/src/test.nghttp2.org.csr | 19 - lib/nghttp2/src/test.nghttp2.org.csr.json | 19 - lib/nghttp2/src/util_test.cc | 707 - lib/nghttp2/src/util_test.h | 75 - lib/nghttp2/tests/.gitignore | 3 - lib/nghttp2/tests/CMakeLists.txt | 60 - lib/nghttp2/tests/end_to_end.py | 104 - lib/nghttp2/tests/failmalloc.c | 79 - lib/nghttp2/tests/main.c | 473 - lib/nghttp2/tests/nghttp2_helper_test.c | 195 - lib/nghttp2/tests/nghttp2_npn_test.c | 73 - lib/nghttp2/tests/nghttp2_session_test.h | 184 - lib/nghttp2/third-party/llhttp/LICENSE-MIT | 22 - lib/nghttp2/third-party/llhttp/README.md | 482 - lib/nghttp2/third-party/llhttp/common.gypi | 46 - lib/nghttp2/third-party/llhttp/llhttp.gyp | 22 - lib/nghttp2/third-party/url-parser/.gitignore | 1 - lib/nghttp2/third-party/url-parser/AUTHORS | 68 - .../third-party/url-parser/url_parser.c | 652 - .../third-party/url-parser/url_parser.h | 94 - 1388 files changed, 252865 insertions(+), 39200 deletions(-) rename lib/{nghttp2 => nghttp2-1.65.0}/AUTHORS (93%) rename lib/{nghttp2 => nghttp2-1.65.0}/CMakeLists.txt (79%) rename lib/{nghttp2 => nghttp2-1.65.0}/CMakeOptions.txt (81%) rename lib/{nghttp2 => nghttp2-1.65.0}/COPYING (100%) create mode 100644 lib/nghttp2-1.65.0/ChangeLog rename lib/{nghttp2 => nghttp2-1.65.0}/Dockerfile.android (89%) create mode 100755 lib/nghttp2-1.65.0/INSTALL rename lib/{nghttp2 => nghttp2-1.65.0}/Makefile.am (94%) create mode 100644 lib/nghttp2-1.65.0/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/NEWS (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/README (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/README.rst (94%) create mode 100644 lib/nghttp2-1.65.0/aclocal.m4 rename lib/{nghttp2 => nghttp2-1.65.0}/android-config (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/android-env (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/bpf/CMakeLists.txt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/bpf/Makefile.am (100%) create mode 100644 lib/nghttp2-1.65.0/bpf/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/bpf/reuseport_kern.c (68%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/ExtractValidFlags.cmake (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindJansson.cmake (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindJemalloc.cmake (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindLibbpf.cmake (100%) create mode 100644 lib/nghttp2-1.65.0/cmake/FindLibbrotlidec.cmake create mode 100644 lib/nghttp2-1.65.0/cmake/FindLibbrotlienc.cmake rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindLibcares.cmake (62%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindLibev.cmake (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindLibevent.cmake (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindLibnghttp3.cmake (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindLibngtcp2.cmake (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindLibngtcp2_crypto_quictls.cmake (100%) create mode 100644 lib/nghttp2-1.65.0/cmake/FindLibngtcp2_crypto_wolfssl.cmake rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/FindSystemd.cmake (100%) create mode 100644 lib/nghttp2-1.65.0/cmake/FindWolfSSL.cmake rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/PickyWarningsC.cmake (99%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/PickyWarningsCXX.cmake (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmake/Version.cmake (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/cmakeconfig.h.in (88%) create mode 100755 lib/nghttp2-1.65.0/compile create mode 100755 lib/nghttp2-1.65.0/config.guess create mode 100644 lib/nghttp2-1.65.0/config.h.in create mode 100755 lib/nghttp2-1.65.0/config.sub create mode 100755 lib/nghttp2-1.65.0/configure rename lib/{nghttp2 => nghttp2-1.65.0}/configure.ac (86%) rename lib/{nghttp2 => nghttp2-1.65.0}/contrib/CMakeLists.txt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/contrib/Makefile.am (100%) create mode 100644 lib/nghttp2-1.65.0/contrib/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/contrib/nghttpx-init.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/contrib/nghttpx-logrotate (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/contrib/nghttpx-upstart.conf.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/contrib/nghttpx.service.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/contrib/tlsticketupdate.go (100%) create mode 100755 lib/nghttp2-1.65.0/depcomp rename lib/{nghttp2 => nghttp2-1.65.0}/doc/CMakeLists.txt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/Makefile.am (95%) create mode 100644 lib/nghttp2-1.65.0/doc/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/doc/README.rst (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/_exts/rubydomain/LICENSE.rubydomain (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/_exts/rubydomain/__init__.py (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/_exts/rubydomain/rubydomain.py (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/bash_completion/h2load (71%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/bash_completion/nghttp (70%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/bash_completion/nghttpd (85%) create mode 100644 lib/nghttp2-1.65.0/doc/bash_completion/nghttpx rename lib/{nghttp2 => nghttp2-1.65.0}/doc/building-android-binary.rst.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/conf.py.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/contribute.rst.in (100%) create mode 100644 lib/nghttp2-1.65.0/doc/enums.rst rename lib/{nghttp2 => nghttp2-1.65.0}/doc/h2load-howto.rst.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/h2load.1 (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/h2load.1.rst (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/index.rst.in (100%) create mode 100644 lib/nghttp2-1.65.0/doc/macros.rst rename lib/{nghttp2 => nghttp2-1.65.0}/doc/mkapiref.py (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttp.1 (71%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttp.1.rst (66%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttp2.h.rst.in (100%) create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_check_authority.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_check_header_name.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_check_header_value.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_check_header_value_rfc9113.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_check_method.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_check_path.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_extpri_parse_priority.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_bound.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_change_table_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_del.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_dynamic_table_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_max_dynamic_table_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_num_table_entries.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_table_entry.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd_vec.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd_vec2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_new.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_new2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_change_table_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_del.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_end_headers.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_dynamic_table_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_max_dynamic_table_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_num_table_entries.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_table_entry.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd3.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_new.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_new2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_http2_strerror.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_is_fatal.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_nv_compare_name.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_del.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_new.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_builtin_recv_extension_type.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_continuations.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_deflate_dynamic_table_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_outbound_ack.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_reserved_remote_streams.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_send_header_block_length.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_settings.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_auto_ping_ack.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_auto_window_update.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_closed_streams.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_http_messaging.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_recv_client_magic.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_peer_max_concurrent_streams.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_server_fallback_rfc7540_priorities.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_stream_reset_rate_limit.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_option_set_user_recv_extension_type.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_pack_settings_payload.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_pack_settings_payload2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_check_default.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_default_init.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_init.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_decref.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_get_buf.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_incref.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_is_static.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_select_alpn.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_select_next_protocol.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_del.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_new.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_before_frame_send_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_data_source_read_length_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_data_source_read_length_callback2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_error_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_error_callback2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_begin_frame_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_begin_headers_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_data_chunk_recv_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_extension_chunk_recv_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_not_send_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_recv_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_send_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_header_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_header_callback2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_frame_recv_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_header_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_header_callback2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_stream_close_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_pack_extension_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_pack_extension_callback2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_recv_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_recv_callback2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_select_padding_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_select_padding_callback2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_callback2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_data_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_unpack_extension_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_change_extpri_stream_priority.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_change_stream_priority.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_check_request_allowed.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_check_server_session.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_client_new.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_client_new2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_client_new3.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_consume.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_consume_connection.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_consume_stream.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_create_idle_stream.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_del.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_find_stream.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_effective_local_window_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_effective_recv_data_length.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_extpri_stream_priority.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_hd_deflate_dynamic_table_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_hd_inflate_dynamic_table_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_last_proc_stream_id.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_local_settings.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_local_window_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_next_stream_id.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_outbound_queue_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_remote_settings.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_remote_window_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_root_stream.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_effective_local_window_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_effective_recv_data_length.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_local_close.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_local_window_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_remote_close.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_remote_window_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_user_data.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_mem_recv.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_mem_recv2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_mem_send.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_mem_send2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_recv.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_resume_data.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_send.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_server_new.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_server_new2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_server_new3.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_set_local_window_size.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_set_next_stream_id.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_set_stream_user_data.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_set_user_data.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_terminate_session.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_terminate_session2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_upgrade.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_upgrade2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_want_read.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_session_want_write.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_set_debug_vprintf_callback.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_stream_get_first_child.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_stream_get_next_sibling.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_stream_get_parent.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_stream_get_previous_sibling.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_stream_get_state.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_stream_get_sum_dependency_weight.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_stream_get_weight.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_strerror.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_altsvc.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_data.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_data2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_extension.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_goaway.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_headers.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_origin.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_ping.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_priority.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_priority_update.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_push_promise.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_request.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_request2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_response.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_response2.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_rst_stream.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_settings.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_shutdown_notice.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_trailer.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_submit_window_update.rst create mode 100644 lib/nghttp2-1.65.0/doc/nghttp2_version.rst rename lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttp2ver.h.rst.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttpd.1 (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttpd.1.rst (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttpx-howto.rst.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttpx.1 (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/nghttpx.1.rst (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/package_README.rst.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/programmers-guide.rst (85%) create mode 100644 lib/nghttp2-1.65.0/doc/sources/building-android-binary.rst create mode 100644 lib/nghttp2-1.65.0/doc/sources/contribute.rst create mode 100644 lib/nghttp2-1.65.0/doc/sources/h2load-howto.rst create mode 100644 lib/nghttp2-1.65.0/doc/sources/index.rst create mode 100644 lib/nghttp2-1.65.0/doc/sources/nghttpx-howto.rst create mode 100644 lib/nghttp2-1.65.0/doc/sources/tutorial-client.rst create mode 100644 lib/nghttp2-1.65.0/doc/sources/tutorial-hpack.rst create mode 100644 lib/nghttp2-1.65.0/doc/sources/tutorial-server.rst rename lib/{nghttp2 => nghttp2-1.65.0}/doc/tutorial-client.rst.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/tutorial-hpack.rst.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/doc/tutorial-server.rst.in (100%) create mode 100644 lib/nghttp2-1.65.0/doc/types.rst rename lib/{nghttp2 => nghttp2-1.65.0}/examples/CMakeLists.txt (83%) rename lib/{nghttp2 => nghttp2-1.65.0}/examples/Makefile.am (95%) create mode 100644 lib/nghttp2-1.65.0/examples/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/examples/client.c (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/examples/deflate.c (88%) rename lib/{nghttp2 => nghttp2-1.65.0}/examples/libevent-client.c (78%) rename lib/{nghttp2 => nghttp2-1.65.0}/examples/libevent-server.c (85%) create mode 100755 lib/nghttp2-1.65.0/install-sh rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/CMakeLists.txt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/Makefile.am (100%) create mode 100644 lib/nghttp2-1.65.0/integration-tests/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/alt-server.crt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/config.go.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/nghttpx_http1_test.go (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/nghttpx_http2_test.go (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/nghttpx_http3_test.go (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/req-return.rb (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/req-set-header.rb (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/resp-return.rb (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/resp-set-header.rb (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/server.crt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/server_tester.go (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/server_tester_http3.go (99%) create mode 100644 lib/nghttp2-1.65.0/integration-tests/setenv rename lib/{nghttp2 => nghttp2-1.65.0}/integration-tests/setenv.in (90%) create mode 100644 lib/nghttp2-1.65.0/lib/CMakeLists.txt rename lib/{nghttp2 => nghttp2-1.65.0}/lib/Makefile.am (98%) create mode 100644 lib/nghttp2-1.65.0/lib/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/lib/Makefile.msvc (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/includes/CMakeLists.txt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/includes/Makefile.am (100%) create mode 100644 lib/nghttp2-1.65.0/lib/includes/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/lib/includes/nghttp2/nghttp2.h (78%) create mode 100644 lib/nghttp2-1.65.0/lib/includes/nghttp2/nghttp2ver.h rename lib/{nghttp2 => nghttp2-1.65.0}/lib/includes/nghttp2/nghttp2ver.h.in (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/libnghttp2.pc.in (100%) rename lib/{nghttp2/lib/nghttp2_npn.c => nghttp2-1.65.0/lib/nghttp2_alpn.c} (65%) rename lib/{nghttp2/lib/nghttp2_npn.h => nghttp2-1.65.0/lib/nghttp2_alpn.h} (94%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_buf.c (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_buf.h (99%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_callbacks.c (57%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_callbacks.h (75%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_debug.c (91%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_debug.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_extpri.c (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_extpri.h (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_frame.c (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_frame.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_hd.c (86%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_hd.h (94%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_hd_huffman.c (87%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_hd_huffman.h (100%) create mode 100644 lib/nghttp2-1.65.0/lib/nghttp2_hd_huffman_data.c create mode 100644 lib/nghttp2-1.65.0/lib/nghttp2_helper.c rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_helper.h (81%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_http.c (79%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_http.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_int.h (100%) create mode 100644 lib/nghttp2-1.65.0/lib/nghttp2_map.c rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_map.h (63%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_mem.c (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_mem.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_net.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_option.c (94%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_option.h (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_outbound_item.c (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_outbound_item.h (88%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_pq.c (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_pq.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_priority_spec.c (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_priority_spec.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_queue.c (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_queue.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_ratelim.c (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_ratelim.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_rcbuf.c (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_rcbuf.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_session.c (84%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_session.h (88%) create mode 100644 lib/nghttp2-1.65.0/lib/nghttp2_stream.c rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_stream.h (65%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_submit.c (78%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_submit.h (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_time.c (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_time.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/lib/nghttp2_version.c (100%) create mode 100644 lib/nghttp2-1.65.0/lib/sfparse.c create mode 100644 lib/nghttp2-1.65.0/lib/sfparse.h rename lib/{nghttp2 => nghttp2-1.65.0}/lib/version.rc.in (100%) create mode 100755 lib/nghttp2-1.65.0/ltmain.sh rename lib/{nghttp2 => nghttp2-1.65.0}/m4/ax_check_compile_flag.m4 (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/m4/ax_cxx_compile_stdcxx.m4 (100%) create mode 100755 lib/nghttp2-1.65.0/m4/libtool.m4 create mode 100755 lib/nghttp2-1.65.0/m4/ltoptions.m4 create mode 100755 lib/nghttp2-1.65.0/m4/ltsugar.m4 create mode 100755 lib/nghttp2-1.65.0/m4/ltversion.m4 create mode 100755 lib/nghttp2-1.65.0/m4/lt~obsolete.m4 create mode 100755 lib/nghttp2-1.65.0/missing rename lib/{nghttp2 => nghttp2-1.65.0}/nghttpx.conf.sample (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/proxy.pac.sample (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/script/CMakeLists.txt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/script/Makefile.am (100%) create mode 100644 lib/nghttp2-1.65.0/script/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/script/README.rst (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/script/fetch-ocsp-response (99%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/CMakeLists.txt (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/HtmlParser.cc (55%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/HtmlParser.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/HttpServer.cc (81%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/HttpServer.h (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/Makefile.am (92%) create mode 100644 lib/nghttp2-1.65.0/src/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/src/allocator.h (80%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/app_helper.cc (90%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/app_helper.h (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/base64.h (76%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/base64_test.cc (57%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/base64_test.h (88%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/buffer.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/buffer_test.cc (61%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/buffer_test.h (90%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/comp_helper.c (90%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/comp_helper.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/deflatehd.cc (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load.cc (83%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load.h (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load_http1_session.cc (78%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load_http1_session.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load_http2_session.cc (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load_http2_session.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load_http3_session.cc (88%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load_http3_session.h (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load_quic.cc (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load_quic.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/h2load_session.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/http2.cc (72%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/http2.h (80%) create mode 100644 lib/nghttp2-1.65.0/src/http2_test.cc rename lib/{nghttp2 => nghttp2-1.65.0}/src/http2_test.h (58%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/http3.cc (61%) create mode 100644 lib/nghttp2-1.65.0/src/http3.h rename lib/{nghttp2 => nghttp2-1.65.0}/src/inflatehd.cc (93%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/memchunk.h (92%) create mode 100644 lib/nghttp2-1.65.0/src/memchunk_test.cc create mode 100644 lib/nghttp2-1.65.0/src/memchunk_test.h rename lib/{nghttp2 => nghttp2-1.65.0}/src/network.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/nghttp.cc (75%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/nghttp.h (91%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/nghttp2_config.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/nghttp2_gzip.c (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/nghttp2_gzip.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/nghttp2_gzip_test.c (62%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/nghttp2_gzip_test.h (90%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/nghttpd.cc (86%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/quic.cc (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/quic.h (100%) rename lib/{nghttp2/tests/nghttp2_hd_test.h => nghttp2-1.65.0/src/shrpx-unittest.cc} (50%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx.cc (83%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx.h (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_accept_handler.cc (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_accept_handler.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_api_downstream_connection.cc (81%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_api_downstream_connection.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_client_handler.cc (88%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_client_handler.h (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_config.cc (76%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_config.h (69%) create mode 100644 lib/nghttp2-1.65.0/src/shrpx_config_test.cc rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_config_test.h (79%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_connect_blocker.cc (91%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_connect_blocker.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_connection.cc (83%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_connection.h (89%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_connection_handler.cc (81%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_connection_handler.h (87%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_dns_resolver.cc (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_dns_resolver.h (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_dns_tracker.cc (89%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_dns_tracker.h (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_downstream.cc (89%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_downstream.h (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_downstream_connection.cc (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_downstream_connection.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_downstream_connection_pool.cc (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_downstream_connection_pool.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_downstream_queue.cc (92%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_downstream_queue.h (100%) create mode 100644 lib/nghttp2-1.65.0/src/shrpx_downstream_test.cc rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_downstream_test.h (71%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_dual_dns_resolver.cc (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_dual_dns_resolver.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_error.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_exec.cc (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_exec.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_health_monitor_downstream_connection.cc (93%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_health_monitor_downstream_connection.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http.cc (83%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http.h (94%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http2_downstream_connection.cc (81%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http2_downstream_connection.h (92%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http2_session.cc (88%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http2_session.h (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http2_upstream.cc (87%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http2_upstream.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http3_upstream.cc (83%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http3_upstream.h (89%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http_downstream_connection.cc (88%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http_downstream_connection.h (99%) create mode 100644 lib/nghttp2-1.65.0/src/shrpx_http_test.cc rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_http_test.h (77%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_https_upstream.cc (87%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_https_upstream.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_io_control.cc (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_io_control.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_live_check.cc (87%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_live_check.h (93%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_log.cc (77%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_log.h (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_log_config.cc (80%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_log_config.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_memcached_connection.cc (94%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_memcached_connection.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_memcached_dispatcher.cc (91%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_memcached_dispatcher.h (89%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_memcached_request.h (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_memcached_result.h (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby.cc (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby_module.cc (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby_module.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby_module_env.cc (94%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby_module_env.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby_module_request.cc (89%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby_module_request.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby_module_response.cc (91%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_mruby_module_response.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_null_downstream_connection.cc (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_null_downstream_connection.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_process.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_quic.cc (60%) create mode 100644 lib/nghttp2-1.65.0/src/shrpx_quic.h rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_quic_connection_handler.cc (66%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_quic_connection_handler.h (79%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_quic_listener.cc (82%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_quic_listener.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_rate_limit.cc (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_rate_limit.h (90%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_router.cc (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_router.h (100%) create mode 100644 lib/nghttp2-1.65.0/src/shrpx_router_test.cc rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_router_test.h (84%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_signal.cc (93%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_signal.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_tls.cc (76%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_tls.h (90%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_tls_test.cc (54%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_tls_test.h (77%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_upstream.h (98%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_worker.cc (77%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_worker.h (92%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_worker_process.cc (89%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_worker_process.h (94%) create mode 100644 lib/nghttp2-1.65.0/src/shrpx_worker_test.cc rename lib/{nghttp2 => nghttp2-1.65.0}/src/shrpx_worker_test.h (89%) create mode 100644 lib/nghttp2-1.65.0/src/siphash.cc create mode 100644 lib/nghttp2-1.65.0/src/siphash.h create mode 100644 lib/nghttp2-1.65.0/src/siphash_test.cc rename lib/{nghttp2/src/memchunk_test.h => nghttp2-1.65.0/src/siphash_test.h} (71%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/ssl_compat.h (72%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/template.h (59%) create mode 100644 lib/nghttp2-1.65.0/src/template_test.cc rename lib/{nghttp2 => nghttp2-1.65.0}/src/template_test.h (84%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/test.example.com.pem (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/test.nghttp2.org.pem (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/testdata/Makefile.am (100%) create mode 100644 lib/nghttp2-1.65.0/src/testdata/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/src/testdata/ipaddr.crt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/testdata/nosan.crt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/testdata/nosan_ip.crt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/testdata/verify_hostname.crt (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/timegm.c (92%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/timegm.h (96%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/tls.cc (56%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/tls.h (66%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/util.cc (80%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/util.h (74%) create mode 100644 lib/nghttp2-1.65.0/src/util_test.cc create mode 100644 lib/nghttp2-1.65.0/src/util_test.h rename lib/{nghttp2 => nghttp2-1.65.0}/src/xsi_strerror.c (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/src/xsi_strerror.h (100%) create mode 100755 lib/nghttp2-1.65.0/test-driver create mode 100644 lib/nghttp2-1.65.0/tests/CMakeLists.txt rename lib/{nghttp2 => nghttp2-1.65.0}/tests/Makefile.am (87%) create mode 100644 lib/nghttp2-1.65.0/tests/Makefile.in rename lib/{nghttp2/tests/nghttp2_buf_test.h => nghttp2-1.65.0/tests/failmalloc.c} (71%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/failmalloc_test.c (86%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/failmalloc_test.h (79%) create mode 100644 lib/nghttp2-1.65.0/tests/main.c rename lib/{nghttp2 => nghttp2-1.65.0}/tests/malloc_wrapper.c (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/malloc_wrapper.h (100%) create mode 100644 lib/nghttp2-1.65.0/tests/munit/COPYING create mode 100644 lib/nghttp2-1.65.0/tests/munit/munit.c create mode 100644 lib/nghttp2-1.65.0/tests/munit/munit.h create mode 100644 lib/nghttp2-1.65.0/tests/munit/munitxx.h create mode 100644 lib/nghttp2-1.65.0/tests/nghttp2_alpn_test.c rename lib/{nghttp2/tests/nghttp2_npn_test.h => nghttp2-1.65.0/tests/nghttp2_alpn_test.h} (84%) create mode 100644 lib/nghttp2-1.65.0/tests/nghttp2_assertion.h rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_buf_test.c (54%) create mode 100644 lib/nghttp2-1.65.0/tests/nghttp2_buf_test.h rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_extpri_test.c (76%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_extpri_test.h (90%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_frame_test.c (67%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_frame_test.h (60%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_hd_test.c (51%) create mode 100644 lib/nghttp2-1.65.0/tests/nghttp2_hd_test.h create mode 100644 lib/nghttp2-1.65.0/tests/nghttp2_helper_test.c rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_helper_test.h (80%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_http_test.c (71%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_http_test.h (90%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_map_test.c (65%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_map_test.h (83%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_pq_test.c (76%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_pq_test.h (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_queue_test.c (76%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_queue_test.h (90%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_ratelim_test.c (66%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_ratelim_test.h (87%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_session_test.c (53%) create mode 100644 lib/nghttp2-1.65.0/tests/nghttp2_session_test.h rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_stream_test.c (97%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_stream_test.h (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_test_helper.c (64%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/nghttp2_test_helper.h (55%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/testdata/Makefile.am (100%) create mode 100644 lib/nghttp2-1.65.0/tests/testdata/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/tests/testdata/cacert.pem (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/testdata/index.html (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/tests/testdata/privkey.pem (100%) rename lib/{nghttp2 => nghttp2-1.65.0}/third-party/CMakeLists.txt (92%) rename lib/{nghttp2 => nghttp2-1.65.0}/third-party/Makefile.am (97%) create mode 100644 lib/nghttp2-1.65.0/third-party/Makefile.in rename lib/{nghttp2 => nghttp2-1.65.0}/third-party/build_config.rb (54%) rename lib/{nghttp2 => nghttp2-1.65.0}/third-party/llhttp/include/llhttp.h (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/third-party/llhttp/src/api.c (95%) rename lib/{nghttp2 => nghttp2-1.65.0}/third-party/llhttp/src/http.c (85%) rename lib/{nghttp2 => nghttp2-1.65.0}/third-party/llhttp/src/llhttp.c (88%) create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/AUTHORS create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/CODEOWNERS create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/CONTRIBUTING.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/Dockerfile create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/Doxyfile create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/Gemfile create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/Gemfile.lock create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/LEGAL rename lib/{nghttp2/third-party/url-parser/LICENSE-MIT => nghttp2-1.65.0/third-party/mruby/LICENSE} (58%) create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/Makefile create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/NEWS create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/Rakefile create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/SECURITY.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/TODO.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/appveyor.yml create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/benchmark/bm_ao_render.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/benchmark/bm_app_lc_fizzbuzz.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/benchmark/bm_fib.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/benchmark/bm_so_lists.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/benchmark/plot.gpl create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/ArduinoDue.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/IntelEdison.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/IntelGalileo.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/RX630.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/android_arm64_v8a.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/android_armeabi_v7a_neon_hard.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/bench.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/boxing.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/chipKITMax32.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/ci/gcc-clang.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/ci/msvc.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/clang-asan.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/cross-32bit.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/cross-mingw-winetest.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/cross-mingw.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/default.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/dreamcast_shelf.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/gameboyadvance.rb create mode 100755 lib/nghttp2-1.65.0/third-party/mruby/build_config/helpers/wine_runner.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/host-cxx.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/host-debug.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/host-f32.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/host-gprof.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/host-m32.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/host-nofloat.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/host-shared.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/i586-pc-msdosdjgpp.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/minimal.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/mrbc.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/nintendo_switch.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/nintendo_wii.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/build_config/serenity.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/codespell.txt create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/guides/compile.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/guides/debugger.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/guides/gc-arena-howto.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/guides/link.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/guides/memory.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/guides/mrbconf.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/guides/mrbgems.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/guides/symbol.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/internal/boxing.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/internal/opcode.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/limitations.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/mruby3.0.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/mruby3.1.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/mruby3.2.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/mruby3.3.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/doc/mruby_logo_red_icon.png create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/docker-compose.yml create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_and_ruby_extension_example/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_and_ruby_extension_example/test/example.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_extension_example/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_extension_example/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_extension_example/src/example.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_extension_example/test/example.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/c_extension_example/test/example.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/cdata_extension_example/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/cdata_extension_example/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/cdata_extension_example/src/example.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/cdata_extension_example/test/example.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/mruby-YOUR-bigint/TODO-HINT.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/mruby-YOUR-bigint/core/bigint.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/mruby-YOUR-bigint/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/ruby_extension_example/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/ruby_extension_example/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/examples/mrbgems/ruby_extension_example/test/example.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mrbconf.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/array.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/boxing_nan.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/boxing_no.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/boxing_word.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/class.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/common.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/compile.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/data.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/debug.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/dump.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/endian.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/error.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/gc.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/hash.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/internal.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/irep.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/istruct.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/khash.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/numeric.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/object.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/opcode.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/ops.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/presym.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/presym/disable.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/presym/enable.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/presym/scanning.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/proc.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/range.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/re.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/string.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/throw.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/value.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/variable.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/include/mruby/version.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/lib/mruby/build.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/lib/mruby/build/command.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/lib/mruby/build/load_gems.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/lib/mruby/core_ext.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/lib/mruby/doc.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/lib/mruby/gem.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/lib/mruby/lockfile.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/lib/mruby/presym.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/lib/mruby/source.rb create mode 100755 lib/nghttp2-1.65.0/third-party/mruby/minirake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/default-no-fpu.gembox create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/default-no-stdio.gembox create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/default.gembox create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/full-core.gembox create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/math.gembox create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/metaprog.gembox create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-array-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-array-ext/mrblib/array.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-array-ext/src/array.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-array-ext/test/array.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bigint/README-fgmp.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bigint/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bigint/core/bigint.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bigint/core/bigint.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bigint/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bigint/test/bigint.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-config/mrbgem.rake create mode 100755 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-config/mruby-config create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-config/mruby-config.bat create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/bintest/mrdb.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/bintest/print.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apistring.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apistring.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mirb/bintest/mirb.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mrbc/bintest/mrbc.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/stub.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-strip/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-binding/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-binding/src/binding.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-binding/test/binding.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-binding/test/binding.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-catch/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-catch/mrblib/catch.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-catch/src/catch.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-catch/test/catch.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-class-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-class-ext/mrblib/module.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-class-ext/src/class.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-class-ext/test/class.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-class-ext/test/module.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-cmath/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-cmath/src/cmath.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-cmath/test/cmath.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-compar-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-compar-ext/mrblib/compar.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-compiler/core/codegen.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-compiler/core/keywords create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-compiler/core/lex.def create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-compiler/core/node.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-compiler/core/parse.y create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-compiler/core/y.tab.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-compiler/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-complex/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-complex/mrblib/complex.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-complex/src/complex.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-complex/test/complex.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-data/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-data/src/data.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-data/test/data.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-dir/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-dir/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-dir/mrblib/dir.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-dir/src/Win/dirent.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-dir/src/dir.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-dir/test/dir.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-dir/test/dirtest.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enum-chain/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enum-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enum-ext/test/enum.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enum-lazy/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enum-lazy/mrblib/lazy.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enum-lazy/test/lazy.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enumerator/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-enumerator/test/enumerator.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-errno/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-errno/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-errno/mrblib/errno.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-errno/src/errno.c create mode 100755 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-errno/src/gen.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-errno/src/known_errors.def create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-errno/src/known_errors_def.cstub create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-errno/test/errno.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-error/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-error/src/exception.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-error/test/exception.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-error/test/exception.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-eval/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-eval/src/eval.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-eval/test/binding.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-eval/test/eval.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-exit/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-exit/src/mruby-exit.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-fiber/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-fiber/src/fiber.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-fiber/test/fiber.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-fiber/test/fiber2.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-fiber/test/fibertest.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-hash-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-hash-ext/test/hash.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/include/mruby/ext/io.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/mrblib/file.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/mrblib/file_constants.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/mrblib/io.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/mrblib/kernel.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/src/file.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/src/file_test.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/src/io.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/src/mruby_io_gem.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/test/file.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/test/file_test.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/test/io.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-io/test/mruby_io_test.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-kernel-ext/src/kernel.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-math/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-math/src/math.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-math/test/math.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-metaprog/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-metaprog/src/metaprog.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-metaprog/test/metaprog.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-method/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-method/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-method/mrblib/method.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-method/src/method.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-method/test/method.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-numeric-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-object-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-object-ext/mrblib/object.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-object-ext/src/object.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-object-ext/test/nil.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-object-ext/test/object.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-objectspace/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-objectspace/test/objectspace.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-os-memsize/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-os-memsize/src/memsize.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-os-memsize/test/memsize.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-pack/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-pack/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-pack/src/pack.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-pack/test/pack.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-print/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-print/mrblib/print.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-print/src/print.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-proc-binding/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-proc-binding/src/proc-binding.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-proc-binding/test/proc-binding.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-proc-binding/test/proc-binding.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-proc-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-proc-ext/mrblib/proc.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-proc-ext/src/proc.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-proc-ext/test/proc.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-proc-ext/test/proc.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-random/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-random/src/random.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-random/test/random.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-range-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-range-ext/mrblib/range.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-range-ext/src/range.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-range-ext/test/range.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-rational/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-rational/mrblib/rational.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-rational/src/rational.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-rational/test/rational.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-set/LICENSE create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-set/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-set/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-set/mrblib/set.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-set/mruby-set.gem create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-set/test/set.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-sleep/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-sleep/example/sleep.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-sleep/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-sleep/src/sleep.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-sleep/test/sleep_test.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/mrblib/socket.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/src/const.cstub create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/src/const.def create mode 100755 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/src/gen.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/src/socket.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/test/addrinfo.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/test/basicsocket.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/test/ipsocket.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/test/socket.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/test/sockettest.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/test/tcpsocket.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/test/udpsocket.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-socket/test/unix.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-sprintf/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-sprintf/mrblib/string.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-sprintf/src/sprintf.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-sprintf/test/sprintf.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-string-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-string-ext/mrblib/string.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-string-ext/src/string.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-string-ext/test/numeric.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-string-ext/test/range.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-string-ext/test/string.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-struct/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-struct/mrblib/struct.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-struct/src/struct.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-struct/test/struct.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-symbol-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-symbol-ext/mrblib/symbol.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-symbol-ext/src/symbol.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-test-inline-struct/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-test-inline-struct/test/inline.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-test-inline-struct/test/inline.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-test/README.md create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-test/driver.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-test/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-test/vformat.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-time/include/mruby/time.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-time/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-time/src/time.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-time/test/time.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-toplevel-ext/mrbgem.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/mruby-toplevel-ext/test/toplevel.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/stdlib-ext.gembox create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/stdlib-io.gembox create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrbgems/stdlib.gembox create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/00class.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/00kernel.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/10error.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/array.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/compar.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/enum.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/hash.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/kernel.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/numeric.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/range.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/string.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mrblib/symbol.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/mruby-source.gemspec create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/oss-fuzz/config/mruby.dict create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/oss-fuzz/config/mruby_fuzzer.options create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/oss-fuzz/config/mruby_proto_fuzzer.options create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/oss-fuzz/mruby_fuzzer.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/oss-fuzz/mruby_proto_fuzzer.cpp create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/oss-fuzz/proto_to_ruby.cpp create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/oss-fuzz/proto_to_ruby.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/oss-fuzz/ruby.proto create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/allocf.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/array.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/backtrace.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/cdump.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/class.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/codedump.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/debug.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/dump.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/enum.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/error.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/error.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/etc.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/fmt_fp.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/gc.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/hash.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/init.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/kernel.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/load.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/numeric.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/numops.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/object.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/opcode.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/pool.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/print.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/proc.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/range.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/readfloat.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/readint.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/readnum.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/state.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/string.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/symbol.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/value_array.h create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/variable.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/version.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/src/vm.c create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/benchmark.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/bin.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/core.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/doc.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/install.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/libmruby.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/mrbgems.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/mrblib.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/presym.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/test.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/toolchains/android.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/toolchains/clang.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/toolchains/gcc.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/toolchains/openwrt.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/tasks/toolchains/visualcpp.rake create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/assert.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/bintest.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/argumenterror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/array.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/basicobject.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/bs_block.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/bs_literal.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/class.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/codegen.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/comparable.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/ensure.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/enumerable.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/exception.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/false.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/float.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/gc.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/hash.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/indexerror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/integer.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/iterations.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/kernel.rb create mode 100755 lib/nghttp2-1.65.0/third-party/mruby/test/t/lang.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/literals.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/localjumperror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/methods.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/module.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/nameerror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/nil.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/nomethoderror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/numeric.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/object.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/proc.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/range.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/rangeerror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/regexperror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/runtimeerror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/standarderror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/string.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/superclass.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/symbol.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/syntax.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/true.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/typeerror.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/unicode.rb create mode 100644 lib/nghttp2-1.65.0/third-party/mruby/test/t/vformat.rb create mode 100644 lib/nghttp2-1.65.0/third-party/neverbleed/neverbleed.c create mode 100644 lib/nghttp2-1.65.0/third-party/neverbleed/neverbleed.h create mode 100644 lib/nghttp2-1.65.0/third-party/urlparse/urlparse.c create mode 100644 lib/nghttp2-1.65.0/third-party/urlparse/urlparse.h delete mode 100644 lib/nghttp2/CONTRIBUTION delete mode 100644 lib/nghttp2/ChangeLog delete mode 100644 lib/nghttp2/LICENSE delete mode 100755 lib/nghttp2/author.py delete mode 100644 lib/nghttp2/cmake/FindCUnit.cmake delete mode 100644 lib/nghttp2/contrib/.gitignore delete mode 100644 lib/nghttp2/contrib/usr.sbin.nghttpx delete mode 100644 lib/nghttp2/doc/.gitignore delete mode 100755 lib/nghttp2/doc/bash_completion/make_bash_completion.py delete mode 100644 lib/nghttp2/doc/bash_completion/nghttpx delete mode 100644 lib/nghttp2/doc/docutils.conf delete mode 100644 lib/nghttp2/doc/h2load.h2r delete mode 100644 lib/nghttp2/doc/make.bat delete mode 100644 lib/nghttp2/doc/nghttp.h2r delete mode 100644 lib/nghttp2/doc/nghttpd.h2r delete mode 100644 lib/nghttp2/doc/nghttpx.h2r delete mode 100644 lib/nghttp2/doc/security.rst delete mode 100644 lib/nghttp2/doc/sources/security.rst delete mode 100644 lib/nghttp2/docker/Dockerfile delete mode 100644 lib/nghttp2/docker/README.rst delete mode 100644 lib/nghttp2/examples/.gitignore delete mode 100644 lib/nghttp2/fedora/spdylay.spec delete mode 100644 lib/nghttp2/fuzz/README.rst delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/025ca25c8427361ea5498e4c3ba49d20eac5b4332f7b75b8f74bfba5e43f59f8 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/0276779c73bddcebc63b863c23a338b4c827bf6164640ff20a2d64d45a6b3f5a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/0428d1e3b2364efcc93ffd8fcfff43b378a92c7da44268b9dda2bf32a1178c66 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/06bc5f79b7e68e005bd4382bd3a6c6b1b6005c5f7d5783e99baf2f8f7432d71a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/09f76550ec065944a5d1d52f5d07b1dd87de1f651f80ef82c2815b0248b7dccd delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/0b39d9df6e1721030667980a41547272ad42377149edcf130b2bf0b76804c61f delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/0bb4365b02c05540936f9606ca725770a731e73c2144c7b81953dcc4b4f73c32 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/0d577f6eb853e987b8fdab6ca4615a351ab74bfc75eb0d227acbef6a35bcae39 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/0df702020c019dd33d0643c5a2b9a9637d325c8f38b4cc6d3f808b5b2a4169a9 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/0f8054152149c73e64c9f3e83f97e6585c8a51ec2413e7a2e8dfcc444082a5c5 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/105f72bc9184bf47a857ed84e8c2f917946ec7ef3f4720535478b41e097a798a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/1368ed7160cc4115e31a8a158af429421570e7363a3b75441edc5d740513b0dc delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/1402c49b963994284b0d429edfac603133e0144dba08836f90b1ae164b328800 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/1468c2cddae629788f6957847b76c09921e984796f6dc482859b119cf4879300 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/14f66ce296f03e52f039f4fad189d3d70aebe70ecb14ffb1ffe2cd5fc5d1e5f0 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/17caaf734401d2d25d09a65432789b45aff588c606536e93824b89739a6d07ab delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/195b4a74a62fabc877052454d935ebc543f4d1305e318ccd2ff407517636bed8 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/1960fc215485486f3e8ab97f853954e6f11c1f4754ccd83b1603b808878cfa76 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/1a56272611761f0687dfb0ea37c900f13f429b750c87e6175b234b881bda6248 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/1d31cd88fae35f2329e201983d11256d2432fcdeb55bfba9634aa88e3794adc6 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/1e27187b10c02fe7e151818ddd0722f69830ac04975ddb5a9d83cdc406cbb678 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/1ecace234d8542fbaab35c7c55330e80d8121a0cff19633a56eba8f2182a59df delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/1f4f3a16f5ad0425e0b38601339096b80a382afa1083a19c4deab11be847502f delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/203a798d4b658be744fe34042038692eaede4d2c1f9e05a27f2410a6e0230132 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/21904e842e90becb56ff9748ae962bb543dd5ca188dabc30897726f87403fbce delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/23df7e0419240a9709b55af68a89c9750332ae5063e36401eae150ce63188fe0 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/245ba702520fa32cf41d994f5d37e4111fe6203bac35b220d50362d5e986aa91 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/274faf343feb9cb44079316401fee50c647552c99c0550ebfd7a3b736e8db9e5 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/2b042a1dfa3aeed6af58c58a4336f1386633bac75dea2c4b64c02541e7320933 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/2d8ec606661a9f12960893aab9a74dd392cbdae104307e8512e5e4113739e93a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/2e0c8a3ce53e8e3711f781b480efaf9e2526f4ae87c5f5a585d68d6f7f7da13c delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/315e6acba7d715333d0865a8dfc0cd0e7aef8a1f5f420eae3d39067ad78df17d delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/3376a2cdde0b98759f14490881328f80b5d3c942de3b1304a0382923ce896f8f delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/35c2719913a19f197fb6484a34c3574da63554ff06f52377b73a9cfc24eb02ca delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/35ddf0611cd98d025f6a625e7e4a102ba74721a04dfa1811e0968e9a4966d92c delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/37e9eab291d6bca69510354e1d029cbbbb6113071b2bb13fc9646b5a0447d2cf delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/381c81f5e4d1b02de39c4f99f21e9793f6ffc82ae0ef6917a8611e8879e05941 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/38ac32c81952cc832ade7aea13b0740f76898ccbb1da25f2281da76e50c1d04a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/3e297dd8fcdb50a751c397a505d84e76374b064aa5c71aab33bd9650c9a9d801 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/3e5a57c30a97d3f06a3181f4baf3996053b8572da5f2deee3a636c3bc8dfcc60 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/420b9790375f59a6e8c326391023a0981789c2351817996e0c253bfed708ad82 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/43df3c3af62ddd1393269ffcf964f1897063e81da79c971e8af8c1fefa3e3cab delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/443f39c99e1c9ca1908b54153c480754054a57777f22a00d377d745d78e9d193 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/44f3fc1504a14e693fde420da94f77bf4a44e4e741420291491343f7ae4ecc16 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/4528e6beb34f695f4df8ddbb7ac85f76a91229d9ba675fc9e09fe12f4a497937 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/4534032d57020d2910641561a9f9da021f0fe52ebdbb148ee776ced87bac9b13 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/47c5e9b339f9e7f1dccad5c9f51f211183795660ec81a6bdb5614031d39ebe3a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/48ca2b3f63206aa8f774c3cb33958a806a1debf3d9ccf7b09c2d31256498cda6 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/4ddbb54259df7ee7ecbdf9f8b4a0e8f7756b9846f2e2add8dd0df825296d993e delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/4e612f3c1dfa468d94bbc3bde202c732b06a9b5f6bc5471c879fa56ec2daa4aa delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/55860c89ef796d41b06b3c0fe60a3e6f90709c6a0e7063a8b4057dafa57c878a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/5748e7a24e8d9ecb43de7d1e14519f10d8c669a5a2602fc948bc9a80e6114b63 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/5a13c8e09802e07fd3ceee625307fe48ef29bc66641c4f80ed4593bf8b773f88 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/5aa30337198b482522a55c90554c93278034ebacc24792509a32aeba466df4e8 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/5f3ff3c345ade163ba1ba889d60c1995b7fab68ded6ab052814008d990862c23 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/5f88a17509a8843ab761bc8cbcfe1a511670ae1a4a434f3d483f942738933a3e delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/60a288333ea7f01d380f2661d387692063ce2ae73b3e5401b716326967b4ce0c delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/63ae750f5fe9469664b6f79cb48c502c3bfc4cb0a950aeba998a72ea6a3d5b2d delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/67abeaacb21769a9fb521efa7ebdc8d9ff3443ad5892d75dd6d4f7d541713d33 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/6e3b8913d874a18ec3ab9f74d4fab435b7738e1a14d0754fb79229c4bda9f604 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/6fe31187ce1a64bffb0b31ee59618a2ebd483812410e9f8ae5a92fb72ef70885 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/71d3c74882a100eaa5aaf9f62659d3b26bcbb8f2055f1add504f599f9051f61e delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/7232f506e00bee175a3df8d33933fae10c67e501d6cea8e73ce76f4363d0bbea delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/7425039321dcbecb1a1ef28849f277f914a889a54d44c1f2566b6ddd5bc83b4f delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/7487341c630472c46a534223da1173666aaeae9788b144fa2c723204d55cc0a2 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/79207f7d09b6145f3dbfcb9e19835f34e56c7927fda22859e960f5f13bc847a0 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/7a1e1268d329e5f71ebdf74677a6c1a118994d7534d1fb08d631898d67372f5a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/7c954b010232be9461483803e3e553623d4fc382324d8b8ba53ebf83f0457707 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/7ce8914993956b04baafaad0668e5c26a87a1c4cf70a6566aa0f199fe3c1dc18 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/7d230ff71bac867a9820e75328f893972df210ab75cdb67f620b370ee5cddf45 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/85a985b9011e356e11a24c2d0a01173ea80ccc584b659947b64ffefddab7fada delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/8b165b8b94a9d120edf139fbd63cb6b161131d5722f201f2f4ba0984b46a3ca5 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/8f5fd3dd5c0eb40ceb409c0f7d85086319d4177524fad58dc01743434765902a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/9223480b7c4b0d1cb95eb33a7a52dc7494b53a0f8a93fbc1816c6c4f347780b0 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/9248ee16c602d45651b0045e9cc4e407fc62ce5688e1c6636f482ea02314c357 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/979b96b7806f61081a48ff556bfbdb3e1c74e04f7d2cf88eab49b0fd89845453 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/97f2f674b859ff1adb2e9548550f07fa8818d1ee8edae39ca50f516a57a12edb delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/9984490c02b1604423a8679caf527d5f10667e0a38790f28f32af61efa930eef delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/9a648e49f93b60cf578c87d187c8acb61d3a638bc30568bdcc6be30fd9defd43 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/9af5c7a8538fb02b0a836b88a40d0b144f11ee98624e3686c0f43684e34e6838 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/9b24f66bc7c47e677e40f8b07b2fd54985ef27c99670bed582ce904569b95702 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/9fc2eee916b1cfb002a487c37e73af29a0fbb29e47bf36839a762bb26fea3ec7 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/9ff0fc476b3d27f5dc9803d38ef10be0d08b5e096630308f0d6f57a6f8ee5d88 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/a46866d1875d0c06ec3ead73ecca531ef0dc92a67a233ebc8d1e2fff79f50a07 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/a71bcbf6a6668aa019d38cc3527d5ecf2f4e538dfedddf34ff484e29d6fd26d1 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/ad0d3509e08424d21d87c64a0969b588dc9281ea98fd744acd9b8bd1daf72225 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/adaa168d63fe063455c1e0c304c9c9ba6b43e13849235339710d6b5f941e80a1 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/aee251ccb027a2676ad1261b48d08b52752a41633279ff2e9e474eebf508250f delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/b5b546cf87a6d23c6f6ee0e44db5b90a4bb23e0558873f159bf09140782989d8 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/b8fffa51391680139ea773ff40a58a1f24e9b1a8c530823d7d12053ec4aabd76 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/b904fd3aa656603b26572deb105290328add76123b4a99ad4e78189e1337ae1b delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/bbda8e26f356aa635f7774ec483a4b493668ca1448948c62f641d176838306d5 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/bc35711cdc43b868c59515211893e7681fef6da4b623392d402fb40736dc1beb delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/bd25bb84dd44c7e09d9e723016c49cc2a868a1bfc007528138a28ea1c0abfda7 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/c23df1d03e3c1039692ea3d9897e41ceb2add1ebdec0937a64321c536eef71f7 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/c2e6cf1692ef3a4bc88af94bb9e6c9011855bbf954c273f45eb3ea97bb491c9a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/c3b0ea2a8874777b9805018c177382ab3278a019935fa50b3e0d7971c28c40d9 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/c9dfe97833473610816085c5a009696cd5f659f85fc10ef76dc140851ffcc423 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/ca19cba772c047e5e1f229e5de18d06d885b50be9136778b4937437f0d70738d delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/ca6e1239c11d08940c991f77470859ccb4ec9fa5e8c30de7b40521d620b87a1e delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/cb09d2148ae1c8b054cdbafcf3f3e41e75bae978dcfc8886981479d723fc44e9 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/cd35ff680e23f67fe52b722a88c9537bee642b8a7a8a388cb4952f3bf60e64cc delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/cd6d3880ee87c6b716749cb9a30f8faa658ee49f6ce90f3e34df70560a0477ad delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/cd7b24cfe10fc4346a91f04b1a0d0e22054f76bf704db8e19d73cb9bf792a89b delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/cea2c4c70f94e90c4c4a6b63f7c212d2465936090c06ba4db92071a3c247ca11 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/d26a0d653a01c6bf9403e0bc0fa5ea05ea4dd7b163e8d85287b19ff257a88ea7 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/d3dec3f7485c6c3f8b8949db68bd212ef16a7f1f41047e290d14f9cd6dae91a0 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/d43f2a0606841580986981ec0bec10473e79c9097bfd8fd81d1a239f146f31d3 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/d4d5fe38e4bafa733182eb5aaad19a6ff59c8316908b20d3c94cdc29a92964e6 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/d69256403d5d27244080b8b53931aa6bfd4ce95771c748372626414d5c37e105 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/d9b617f62de41c1cb02ff91cef9c3f753d440c75efa489a952fdcd314d27ee1d delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/dc57f64202486572ef99d4ff4970fb339f440867ebedf02eaab75fb555e293cf delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/e11a6036e2c0bde71f3eabac3f98734af2cdcfe3ebb6e02dcce9b7f4c4bcc99a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/e26ce028366bb4ff566972a945b7fd0035f6dba48d886160fdf1974aae8dee65 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/e35a4d079adfe4d399f026c711940e4917d5dae3dc2723a034f44d2b53a34a11 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/e3666122dbe804ac609c0ae717a9e6aa8bb2842953e4528230a5bcfc3a59c120 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/e59961f75a4cfe33bc4ce9290f938c5bc247c440a2e572ab18021c8223c55bc7 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/e7b11cf0762255ad6741aa3d6e269f8b4bc785089040be666f480464cb13b4df delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/e89af554621f1ce6262d47a68efea1d8d304ae595a094ebc955bceb6d06ed629 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/e9d399b6dc6b7d18bac97e5556875ab6df561f1ca718f1fc716a929d3c706f14 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/eb733425f0fc1f0cf7f74e1c1ef87680a96a1aca613180110df26259eb36c433 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/ec399d3511fa4a30df9b3c51637a357cc1c84d30e3d48bccc9b97564c8a60b73 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/ef73cbf3d98059b13b30db1089ad6af12beea18f895be6f18d42962721d6e3ee delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/efc0f664cf2ebac4e05e6acac77778fe630b278f167321a46d861ac8ad56fd76 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/f139f9c20bcdc6bbe0301c98bdd719b37b4a98fe3b1414b583ddb5dc17f62e3a delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/f5318eb5ea6dcdf630a2ab157dbfa122f6de9b6f4e5a3a036c17f32da3030877 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/f5f4973e9e8fb6fb8834a612a9b8b0419fbae7c0934dda22e61f11556918f1cc delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/f932da1aefb3b8d9918f46bd936130b0d06332ab062a48f41b206ce696428e03 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/fbfa931f27b0173613b0e04af58d8bba7df12c1cd15c404d95680df6fc1cb89e delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/fc30ab2ea532f953350f0de7ff3c0422328c131f4642d30a4c88bdf43bcd8d98 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/fc7e85c3af87f3c0b482cb57fde916a7d8db293427159f3b31bbc23b6b285116 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/fcfcfe84724a9b7c7c8277057b557ab044d24130bd360fe087e9f55bef2cadc6 delete mode 100644 lib/nghttp2/fuzz/corpus/h2spec/ff00f50eada19c5354a579ef7f1af5952ecb2df2423022dd5483d8fede26d6e5 delete mode 100644 lib/nghttp2/fuzz/corpus/nghttp/9c8ed8981065d28ce8a5a04ac6fc7a87ffaf9f9c6ce4323e6e0fefaabb2393cb delete mode 100644 lib/nghttp2/fuzz/corpus/nghttp/d53b58a8685030918fda36a704db43cdfec99fc1b9de83c195227161f4bdb911 delete mode 100644 lib/nghttp2/fuzz/corpus/nghttp/f0a8cacb9f31b53d237628084e3946d556086c9991cce7962e9e69a3eed406aa delete mode 100644 lib/nghttp2/fuzz/fuzz_frames.cc delete mode 100644 lib/nghttp2/fuzz/fuzz_target.cc delete mode 100644 lib/nghttp2/fuzz/fuzz_target_fdp.cc delete mode 100755 lib/nghttp2/genauthoritychartbl.py delete mode 100755 lib/nghttp2/gendowncasetbl.py delete mode 100755 lib/nghttp2/genheaderfunc.py delete mode 100755 lib/nghttp2/genlibtokenlookup.py delete mode 100755 lib/nghttp2/genmethodchartbl.py delete mode 100755 lib/nghttp2/genmethodfunc.py delete mode 100755 lib/nghttp2/gennghttpxfun.py delete mode 100755 lib/nghttp2/gennmchartbl.py delete mode 100755 lib/nghttp2/genpathchartbl.py delete mode 100644 lib/nghttp2/gentokenlookup.py delete mode 100755 lib/nghttp2/genvchartbl.py delete mode 100755 lib/nghttp2/git-clang-format delete mode 100644 lib/nghttp2/go.mod delete mode 100644 lib/nghttp2/go.sum delete mode 100755 lib/nghttp2/help2rst.py delete mode 100644 lib/nghttp2/integration-tests/.gitignore delete mode 100644 lib/nghttp2/lib/.gitignore delete mode 100644 lib/nghttp2/lib/CMakeLists.txt delete mode 100644 lib/nghttp2/lib/nghttp2_hd_huffman_data.c delete mode 100644 lib/nghttp2/lib/nghttp2_helper.c delete mode 100644 lib/nghttp2/lib/nghttp2_map.c delete mode 100644 lib/nghttp2/lib/nghttp2_stream.c delete mode 100644 lib/nghttp2/lib/sfparse.c delete mode 100644 lib/nghttp2/lib/sfparse.h delete mode 100644 lib/nghttp2/m4/libxml2.m4 delete mode 100755 lib/nghttp2/makebashcompletion delete mode 100755 lib/nghttp2/makemanpages delete mode 100755 lib/nghttp2/makerelease.sh delete mode 100755 lib/nghttp2/mkcipherlist.py delete mode 100755 lib/nghttp2/mkhufftbl.py delete mode 100755 lib/nghttp2/mkstatichdtbl.py delete mode 100644 lib/nghttp2/nghttp2-master.zip delete mode 100644 lib/nghttp2/nghttp2-master/.github/dependabot.yml delete mode 100644 lib/nghttp2/nghttp2-master/.github/workflows/build.yml delete mode 100644 lib/nghttp2/nghttp2-master/.github/workflows/fuzz.yml delete mode 100644 lib/nghttp2/nghttp2-master/.gitignore delete mode 100644 lib/nghttp2/nghttp2-master/.gitmodules delete mode 100755 lib/nghttp2/pre-commit delete mode 100755 lib/nghttp2/releasechk delete mode 100644 lib/nghttp2/src/.gitignore delete mode 100644 lib/nghttp2/src/ca-config.json delete mode 100644 lib/nghttp2/src/ca.nghttp2.org-key.pem delete mode 100644 lib/nghttp2/src/ca.nghttp2.org.csr delete mode 100644 lib/nghttp2/src/ca.nghttp2.org.csr.json delete mode 100644 lib/nghttp2/src/ca.nghttp2.org.pem delete mode 100644 lib/nghttp2/src/http-parser.patch delete mode 100644 lib/nghttp2/src/http2_test.cc delete mode 100644 lib/nghttp2/src/http3.h delete mode 100644 lib/nghttp2/src/libevent_util.cc delete mode 100644 lib/nghttp2/src/libevent_util.h delete mode 100644 lib/nghttp2/src/memchunk_test.cc delete mode 100644 lib/nghttp2/src/shrpx-unittest.cc delete mode 100644 lib/nghttp2/src/shrpx_config_test.cc delete mode 100644 lib/nghttp2/src/shrpx_downstream_test.cc delete mode 100644 lib/nghttp2/src/shrpx_http_test.cc delete mode 100644 lib/nghttp2/src/shrpx_quic.h delete mode 100644 lib/nghttp2/src/shrpx_router_test.cc delete mode 100644 lib/nghttp2/src/shrpx_worker_test.cc delete mode 100644 lib/nghttp2/src/template_test.cc delete mode 100644 lib/nghttp2/src/test.example.com-key.pem delete mode 100644 lib/nghttp2/src/test.example.com.csr delete mode 100644 lib/nghttp2/src/test.example.com.csr.json delete mode 100644 lib/nghttp2/src/test.nghttp2.org-key.pem delete mode 100644 lib/nghttp2/src/test.nghttp2.org.csr delete mode 100644 lib/nghttp2/src/test.nghttp2.org.csr.json delete mode 100644 lib/nghttp2/src/util_test.cc delete mode 100644 lib/nghttp2/src/util_test.h delete mode 100644 lib/nghttp2/tests/.gitignore delete mode 100644 lib/nghttp2/tests/CMakeLists.txt delete mode 100755 lib/nghttp2/tests/end_to_end.py delete mode 100644 lib/nghttp2/tests/failmalloc.c delete mode 100644 lib/nghttp2/tests/main.c delete mode 100644 lib/nghttp2/tests/nghttp2_helper_test.c delete mode 100644 lib/nghttp2/tests/nghttp2_npn_test.c delete mode 100644 lib/nghttp2/tests/nghttp2_session_test.h delete mode 100644 lib/nghttp2/third-party/llhttp/LICENSE-MIT delete mode 100644 lib/nghttp2/third-party/llhttp/README.md delete mode 100644 lib/nghttp2/third-party/llhttp/common.gypi delete mode 100644 lib/nghttp2/third-party/llhttp/llhttp.gyp delete mode 100644 lib/nghttp2/third-party/url-parser/.gitignore delete mode 100644 lib/nghttp2/third-party/url-parser/AUTHORS delete mode 100644 lib/nghttp2/third-party/url-parser/url_parser.c delete mode 100644 lib/nghttp2/third-party/url-parser/url_parser.h diff --git a/cmake/libraries.cmake b/cmake/libraries.cmake index 9a50a8ed3ae..630ef45644b 100644 --- a/cmake/libraries.cmake +++ b/cmake/libraries.cmake @@ -8,7 +8,7 @@ set(FLB_PATH_LIB_CPROFILES "lib/cprofiles") set(FLB_PATH_LIB_CO "lib/flb_libco") set(FLB_PATH_LIB_RBTREE "lib/rbtree") set(FLB_PATH_LIB_MSGPACK "lib/msgpack-c") -set(FLB_PATH_LIB_NGHTTP2 "lib/nghttp2") +set(FLB_PATH_LIB_NGHTTP2 "lib/nghttp2-1.65.0") set(FLB_PATH_LIB_AVRO "lib/avro") set(FLB_PATH_LIB_CHUNKIO "lib/chunkio") set(FLB_PATH_LIB_LUAJIT "lib/luajit-04dca791") diff --git a/lib/nghttp2/AUTHORS b/lib/nghttp2-1.65.0/AUTHORS similarity index 93% rename from lib/nghttp2/AUTHORS rename to lib/nghttp2-1.65.0/AUTHORS index bb1ae74f12c..7ec26510701 100644 --- a/lib/nghttp2/AUTHORS +++ b/lib/nghttp2-1.65.0/AUTHORS @@ -20,6 +20,7 @@ Alex Nalivko Alexandr Vlasov Alexandros Konstantinakis-Karmis Alexis La Goutte +Alyssa Ross Amir Livneh Amir Pakdel Anders Bakken @@ -29,10 +30,12 @@ Andy Davies Angus Gratton Anna Henningsen Ant Bryan +Anthony Alayo Asra Ali Benedikt Christoph Wolters Benjamin Peterson Bernard Spil +Bernhard Walle Brendan Heinonen Brian Card Brian Suh @@ -43,6 +46,8 @@ Dave Reisner David Beitey David Korczynski David Weekly +Deel +Deep Chordia Dimitris Apostolou Dmitri Tikhonov Dmitriy Vetutnev @@ -70,6 +75,8 @@ Jay Satiro Jeff 'Raid' Baitis Jianqing Wang Jim Morrison +Jiwoo Park +Jonas Kvinge Josh Braegger José F. Calcerrada Kamil Dudka @@ -85,6 +92,7 @@ Lucas Pardue MATSUMOTO Ryosuke Marc Bachmann Marcelo Trylesinski +Mark Boddington Matt Rudary Matt Way Michael Kaufmann @@ -107,9 +115,11 @@ Richard Wolfert Rick Lei Ross Smith II Rudi Heitbaum +Ryan Carsten Schmidt Ryo Ota Scott Mitchell Sebastiaan Deckers +Sergey Fedorov Shelley Vohr Simon Frankenberger Simone Basso @@ -122,6 +132,7 @@ Syohei YOSHIDA Tapanito Tatsuhiko Kubo Tatsuhiro Tsujikawa +Thomas Devoogdt Tobias Geerinckx-Rice Tom Harwood Tomas Krizek @@ -131,6 +142,7 @@ Vernon Tang Viacheslav Biriukov Viktor Szakats Viktor Szépe +Ville Vesilehto Wenfeng Liu William A Rowe Jr Xiaoguang Sun @@ -143,6 +155,7 @@ dalf dawg es fangdingjun +hrxi jwchoi kumagi lhuang04 diff --git a/lib/nghttp2/CMakeLists.txt b/lib/nghttp2-1.65.0/CMakeLists.txt similarity index 79% rename from lib/nghttp2/CMakeLists.txt rename to lib/nghttp2-1.65.0/CMakeLists.txt index ee4cb0a4a11..edd2fc29761 100644 --- a/lib/nghttp2/CMakeLists.txt +++ b/lib/nghttp2-1.65.0/CMakeLists.txt @@ -22,15 +22,15 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.14) # XXX using 1.8.90 instead of 1.9.0-DEV -project(nghttp2 VERSION 1.58.90) +project(nghttp2 VERSION 1.65.0 LANGUAGES C) # See versioning rule: # https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -set(LT_CURRENT 39) -set(LT_REVISION 1) -set(LT_AGE 25) +set(LT_CURRENT 42) +set(LT_REVISION 4) +set(LT_AGE 28) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) include(Version) @@ -51,24 +51,38 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() include(GNUInstallDirs) - -# This is necessary to ensure that we link openssl statically -set(OPENSSL_USE_STATIC_LIBS ON) -set(OPENSSL_MSVC_STATIC_RT ON) +include(CMakeDependentOption) # For documentation find_package(Python3 COMPONENTS Interpreter) # Auto-detection of features that can be toggled -## This auto detection causes weird linker errors. So, it's disabled for now. -# find_package(OpenSSL 1.0.1) -find_package(Libev 4.11) -find_package(Libcares 1.7.5) -find_package(ZLIB 1.2.3) +if(NOT ENABLE_LIB_ONLY) + enable_language(CXX) + find_package(Libev 4.11) + find_package(Libcares 1.7.5) + find_package(ZLIB 1.2.3) + find_package(Libbrotlienc 1.0.9) + find_package(Libbrotlidec 1.0.9) +endif() + +if(WITH_WOLFSSL) + find_package(WolfSSL 5.7.0) +else() + find_package(OpenSSL 1.1.1) +endif() find_package(Libngtcp2 1.0.0) -find_package(Libngtcp2_crypto_quictls 1.0.0) -if(LIBNGTCP2_CRYPTO_QUICTLS_FOUND) - set(HAVE_LIBNGTCP2_CRYPTO_QUICTLS 1) +if(OPENSSL_FOUND) + find_package(Libngtcp2_crypto_quictls 1.0.0) + if(LIBNGTCP2_CRYPTO_QUICTLS_FOUND) + set(HAVE_LIBNGTCP2_CRYPTO_QUICTLS 1) + endif() +endif() +if(WOLFSSL_FOUND) + find_package(Libngtcp2_crypto_wolfssl 1.0.0) + if(LIBNGTCP2_CRYPTO_WOLFSSL_FOUND) + set(HAVE_LIBNGTCP2_CRYPTO_WOLFSSL 1) + endif() endif() find_package(Libnghttp3 1.1.0) if(WITH_LIBBPF) @@ -77,7 +91,7 @@ if(WITH_LIBBPF) message(FATAL_ERROR "libbpf was requested (WITH_LIBBPF=1) but not found.") endif() endif() -if(OPENSSL_FOUND AND LIBEV_FOUND AND ZLIB_FOUND) +if((OPENSSL_FOUND OR WOLFSSL_FOUND) AND LIBEV_FOUND AND ZLIB_FOUND) set(ENABLE_APP_DEFAULT ON) else() set(ENABLE_APP_DEFAULT OFF) @@ -122,30 +136,31 @@ else() set(HINT_NORETURN) endif() -include(ExtractValidFlags) -foreach(_cxx1x_flag -std=c++14) - extract_valid_cxx_flags(_cxx1x_flag_supported ${_cxx1x_flag}) - if(_cxx1x_flag_supported) - set(CXX1XCXXFLAGS ${_cxx1x_flag}) - break() - endif() -endforeach() - -include(CMakePushCheckState) -include(CheckCXXSourceCompiles) -cmake_push_check_state() -set(CMAKE_REQUIRED_DEFINITIONS "${CXX1XCXXFLAGS}") -# Check that std::future is available. -check_cxx_source_compiles(" -#include -#include -int main() { std::vector> v; }" HAVE_STD_FUTURE) -# Check that std::map::emplace is available for g++-4.7. -check_cxx_source_compiles(" -#include -int main() { std::map().emplace(1, 2); }" HAVE_STD_MAP_EMPLACE) -cmake_pop_check_state() +if(NOT ENABLE_LIB_ONLY) + include(ExtractValidFlags) + foreach(_cxx1x_flag -std=c++20) + extract_valid_cxx_flags(_cxx1x_flag_supported ${_cxx1x_flag}) + if(_cxx1x_flag_supported) + set(CXX1XCXXFLAGS ${_cxx1x_flag}) + break() + endif() + endforeach() + include(CMakePushCheckState) + include(CheckCXXSourceCompiles) + cmake_push_check_state() + set(CMAKE_REQUIRED_DEFINITIONS "${CXX1XCXXFLAGS}") + # Check that std::future is available. + check_cxx_source_compiles(" + #include + #include + int main() { std::vector> v; }" HAVE_STD_FUTURE) + # Check that std::map::emplace is available for g++-4.7. + check_cxx_source_compiles(" + #include + int main() { std::map().emplace(1, 2); }" HAVE_STD_MAP_EMPLACE) + cmake_pop_check_state() +endif() # Checks for libraries. # Additional libraries required for programs under src directory. @@ -167,17 +182,13 @@ endif() # XXX shouldn't ${CMAKE_DL_LIBS} be appended to OPENSSL_LIBRARIES instead of # APP_LIBRARIES if it is really specific to OpenSSL? -find_package(CUnit 2.1) enable_testing() -set(HAVE_CUNIT ${CUNIT_FOUND}) -if(HAVE_CUNIT) - add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) -endif() +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) # openssl (for src) include(CheckSymbolExists) set(HAVE_OPENSSL ${OPENSSL_FOUND}) -if(OPENSSL_FOUND) +if(NOT ENABLE_LIB_ONLY AND OPENSSL_FOUND) set(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) cmake_push_check_state() set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") @@ -185,15 +196,33 @@ if(OPENSSL_FOUND) if(WIN32) set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" "ws2_32" "bcrypt") endif() - check_symbol_exists(SSL_provide_quic_data "openssl/ssl.h" HAVE_SSL_PROVIDE_QUIC_DATA) - if(NOT HAVE_SSL_PROVIDE_QUIC_DATA) - message(WARNING "OpenSSL in ${OPENSSL_LIBRARIES} does not have SSL_provide_quic_data. HTTP/3 support cannot be enabled") + if(ENABLE_HTTP3) + check_symbol_exists(SSL_provide_quic_data "openssl/ssl.h" HAVE_SSL_PROVIDE_QUIC_DATA) + if(NOT HAVE_SSL_PROVIDE_QUIC_DATA) + message(WARNING "OpenSSL in ${OPENSSL_LIBRARIES} does not have SSL_provide_quic_data. HTTP/3 support cannot be enabled") + endif() endif() cmake_pop_check_state() else() set(OPENSSL_INCLUDE_DIRS "") set(OPENSSL_LIBRARIES "") endif() +# wolfSSL (for src) +set(HAVE_WOLFSSL ${WOLFSSL_FOUND}) +if(WOLFSSL_FOUND) + set(WOLFSSL_INCLUDE_DIRS ${WOLFSSL_INCLUDE_DIR}) + cmake_push_check_state() + set(CMAKE_REQUIRED_INCLUDES "${WOLFSSL_INCLUDE_DIR}") + set(CMAKE_REQUIRED_LIBRARIES "${WOLFSSL_LIBRARIES}") + check_symbol_exists(SSL_provide_quic_data "wolfssl/options.h;wolfssl/ssl.h" HAVE_WOLFSSL_SSL_PROVIDE_QUIC_DATA) + if(NOT HAVE_WOLFSSL_SSL_PROVIDE_QUIC_DATA) + message(WARNING "wolfSSL in ${WOLFSSL_LIBRARIES} does not have SSL_provide_quic_data. HTTP/3 support cannot be enabled") + endif() + cmake_pop_check_state() +else() + set(WOLFSSL_INCLUDE_DIRS "") + set(WOLFSSL_LIBRARIES "") +endif() # libev (for src) set(HAVE_LIBEV ${LIBEV_FOUND}) set(HAVE_ZLIB ${ZLIB_FOUND}) @@ -224,6 +253,13 @@ endif() # jemalloc set(HAVE_JEMALLOC ${JEMALLOC_FOUND}) +# libbrotli (for src) +set(HAVE_LIBBROTLIENC ${LIBBROTLIENC_FOUND}) +set(HAVE_LIBBROTLIDEC ${LIBBROTLIDEC_FOUND}) +if(LIBBROTLIENC_FOUND AND LIBBROTLIDEC_FOUND) + set(HAVE_LIBBROTLI 1) +endif() + # libbpf (for bpf) set(HAVE_LIBBPF ${LIBBPF_FOUND}) if(LIBBPF_FOUND) @@ -239,13 +275,16 @@ int main() { enum bpf_stats_type foo; (void)foo; }" HAVE_BPF_STATS_TYPE) endif() # The nghttp, nghttpd and nghttpx under src depend on zlib, OpenSSL and libev -if(ENABLE_APP AND NOT (ZLIB_FOUND AND OPENSSL_FOUND AND LIBEV_FOUND)) +if(ENABLE_APP AND NOT (ZLIB_FOUND AND (OPENSSL_FOUND OR WOLFSSL_FOUND) AND LIBEV_FOUND)) message(FATAL_ERROR "Applications were requested (ENABLE_APP=1) but dependencies are not met.") endif() -# HTTP/3 requires quictls/openssl, libngtcp2, libngtcp2_crypto_quictls -# and libnghttp3. -if(ENABLE_HTTP3 AND NOT (HAVE_SSL_PROVIDE_QUIC_DATA AND LIBNGTCP2_FOUND AND LIBNGTCP2_CRYPTO_QUICTLS_FOUND AND LIBNGHTTP3_FOUND)) +# HTTP/3 requires libngtcp2 + (quictls/openssl + +# libngtcp2_crypto_quictls or wolfSSL + libngtcp2_crypto_wolfssl) and +# libnghttp3. +if(ENABLE_HTTP3 AND NOT (LIBNGTCP2_FOUND AND LIBNGHTTP3_FOUND AND + ((HAVE_SSL_PROVIDE_QUIC_DATA AND LIBNGTCP2_CRYPTO_QUICTLS_FOUND) OR + (HAVE_WOLFSSL_SSL_PROVIDE_QUIC_DATA AND LIBNGTCP2_CRYPTO_WOLFSSL_FOUND)))) message(FATAL_ERROR "HTTP/3 was requested (ENABLE_HTTP3=1) but dependencies are not met.") endif() @@ -283,7 +322,6 @@ check_include_file("pwd.h" HAVE_PWD_H) check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H) check_include_file("sys/time.h" HAVE_SYS_TIME_H) check_include_file("syslog.h" HAVE_SYSLOG_H) -check_include_file("time.h" HAVE_TIME_H) check_include_file("unistd.h" HAVE_UNISTD_H) check_include_file("windows.h" HAVE_WINDOWS_H) @@ -315,16 +353,13 @@ endif() include(CheckStructHasMember) check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_STRUCT_TM_TM_GMTOFF) -# Check size of pointer to decide we need 8 bytes alignment adjustment. -check_type_size("int *" SIZEOF_INT_P) -check_type_size("time_t" SIZEOF_TIME_T) - # Checks for library functions. include(CheckFunctionExists) check_function_exists(_Exit HAVE__EXIT) check_function_exists(accept4 HAVE_ACCEPT4) check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) check_function_exists(mkostemp HAVE_MKOSTEMP) +check_function_exists(pipe2 HAVE_PIPE2) check_symbol_exists(GetTickCount64 sysinfoapi.h HAVE_GETTICKCOUNT64) @@ -421,7 +456,7 @@ if(APPLE) endif() include_directories( - BEFORE "${CMAKE_CURRENT_BINARY_DIR}" # for config.h + "${CMAKE_CURRENT_BINARY_DIR}" # for config.h ) # For use in src/CMakeLists.txt set(PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}") @@ -434,9 +469,11 @@ add_subdirectory(lib) add_subdirectory(third-party) add_subdirectory(src) add_subdirectory(examples) -add_subdirectory(tests) -#add_subdirectory(tests/testdata) -add_subdirectory(integration-tests) +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) + add_subdirectory(tests) + #add_subdirectory(tests/testdata) + add_subdirectory(integration-tests) +endif() if(ENABLE_DOC) add_subdirectory(doc) endif() @@ -465,15 +502,17 @@ message(STATUS "summary of build options: Python: ${Python3_EXECUTABLE} Python3_VERSION: ${Python3_VERSION} Test: - CUnit: ${HAVE_CUNIT} (LIBS='${CUNIT_LIBRARIES}') Failmalloc: ${ENABLE_FAILMALLOC} + Build Test: ${BUILD_TESTING} Libs: OpenSSL: ${HAVE_OPENSSL} (LIBS='${OPENSSL_LIBRARIES}') + wolfSSL: ${HAVE_WOLFSSL} (LIBS='${WOLFSSL_LIBRARIES}') Libxml2: ${HAVE_LIBXML2} (LIBS='${LIBXML2_LIBRARIES}') Libev: ${HAVE_LIBEV} (LIBS='${LIBEV_LIBRARIES}') Libc-ares: ${HAVE_LIBCARES} (LIBS='${LIBCARES_LIBRARIES}') Libngtcp2: ${HAVE_LIBNGTCP2} (LIBS='${LIBNGTCP2_LIBRARIES}') Libngtcp2_crypto_quictls: ${HAVE_LIBNGTCP2_CRYPTO_QUICTLS} (LIBS='${LIBNGTCP2_CRYPTO_QUICTLS_LIBRARIES}') + Libngtcp2_crypto_wolfssl: ${HAVE_LIBNGTCP2_CRYPTO_WOLFSSL} (LIBS='${LIBNGTCP2_CRYPTO_WOLFSSL_LIBRARIES}') Libnghttp3: ${HAVE_LIBNGHTTP3} (LIBS='${LIBNGHTTP3_LIBRARIES}') Libbpf: ${HAVE_LIBBPF} (LIBS='${LIBBPF_LIBRARIES}') Libevent(SSL): ${HAVE_LIBEVENT_OPENSSL} (LIBS='${LIBEVENT_OPENSSL_LIBRARIES}') @@ -481,6 +520,8 @@ message(STATUS "summary of build options: Jemalloc: ${HAVE_JEMALLOC} (LIBS='${JEMALLOC_LIBRARIES}') Zlib: ${HAVE_ZLIB} (LIBS='${ZLIB_LIBRARIES}') Systemd: ${HAVE_SYSTEMD} (LIBS='${SYSTEMD_LIBRARIES}') + Libbrotlienc: ${HAVE_LIBBROTLIENC} (LIBS='${LIBBROTLIENC_LIBRARIES}') + Libbrotlidec: ${HAVE_LIBBROTLIDEC} (LIBS='${LIBBROTLIDEC_LIBRARIES}') Third-party: http-parser: ${ENABLE_THIRD_PARTY} MRuby: ${HAVE_MRUBY} diff --git a/lib/nghttp2/CMakeOptions.txt b/lib/nghttp2-1.65.0/CMakeOptions.txt similarity index 81% rename from lib/nghttp2/CMakeOptions.txt rename to lib/nghttp2-1.65.0/CMakeOptions.txt index 238d5b1b2b3..b6687e2e1fd 100644 --- a/lib/nghttp2/CMakeOptions.txt +++ b/lib/nghttp2-1.65.0/CMakeOptions.txt @@ -11,11 +11,12 @@ option(ENABLE_EXAMPLES "Build examples" ${ENABLE_EXAMPLES_DEFAULT}) option(ENABLE_FAILMALLOC "Build failmalloc test program" ON) option(ENABLE_LIB_ONLY "Build libnghttp2 only. This is a short hand for -DENABLE_APP=0 -DENABLE_EXAMPLES=0 -DENABLE_HPACK_TOOLS=0") -option(ENABLE_STATIC_LIB "Build libnghttp2 in static mode also") -option(ENABLE_SHARED_LIB "Build libnghttp2 as a shared library" ON) +option(BUILD_SHARED_LIBS "Build libnghttp2 as a shared library" ON) +option(BUILD_STATIC_LIBS "Build libnghttp2 in static mode also" OFF) option(ENABLE_STATIC_CRT "Build libnghttp2 against the MS LIBCMT[d]") option(ENABLE_HTTP3 "Enable HTTP/3 support" OFF) option(ENABLE_DOC "Build documentation" ON) +cmake_dependent_option(BUILD_TESTING "Enable tests" ON "BUILD_STATIC_LIBS" OFF) option(WITH_LIBXML2 "Use libxml2" ${WITH_LIBXML2_DEFAULT}) @@ -24,5 +25,6 @@ option(WITH_JEMALLOC "Use jemalloc" option(WITH_MRUBY "Use mruby") option(WITH_NEVERBLEED "Use neverbleed") option(WITH_LIBBPF "Use libbpf") +option(WITH_WOLFSSL "Use wolfSSL") # vim: ft=cmake: diff --git a/lib/nghttp2/COPYING b/lib/nghttp2-1.65.0/COPYING similarity index 100% rename from lib/nghttp2/COPYING rename to lib/nghttp2-1.65.0/COPYING diff --git a/lib/nghttp2-1.65.0/ChangeLog b/lib/nghttp2-1.65.0/ChangeLog new file mode 100644 index 00000000000..2a36715719a --- /dev/null +++ b/lib/nghttp2-1.65.0/ChangeLog @@ -0,0 +1,927 @@ +commit 319bf015de8fa38e21ac271ce2f7d61aa77d90cb +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-03-02 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-03-02 + + Update bash_completion + +commit 99c572448ac94f122a27cc088fe9cd8998222278 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-03-02 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-03-02 + + Update manual pages + +commit a5007158dfdc76cd308e731c629d963406e25965 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-03-02 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-03-02 + + Bump package and library versions + +commit 0b210f072d60db111d6abb44c98cfa754e4d9c99 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-03-02 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-03-02 + + Update AUTHORS + +commit 5ca289471f681ed6c62a9f29e0cc4ea980506fdf +Merge: 2141edda 1459db27 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-03-02 +Commit: GitHub +CommitDate: 2025-03-02 + + Merge pull request #2311 from nghttp2/bump-libbpf + + Bump libbpf to v1.5.0 + +commit 2141edda0cbf8a85bd46c041cc4b421d505d0cd5 +Merge: 133cc56e d9793fce +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-03-01 +Commit: GitHub +CommitDate: 2025-03-01 + + Merge pull request #2312 from nghttp2/fix-coverity-check + + Fix errors reported by coverity + +commit d9793fceafdf44dbdea727dfb3e6d35023f46105 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-03-01 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-03-01 + + Fix errors reported by coverity + +commit 1459db27fb5daf83d418729ab781d4cdd14c07ad +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-02-28 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-02-28 + + Bump libbpf to v1.5.0 + +commit 133cc56e70a31897088a75d38d24dfedf413060e +Merge: ce5329a3 cd9a021a +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-02-27 +Commit: GitHub +CommitDate: 2025-02-27 + + Merge pull request #2310 from nghttp2/bump-ngtcp2 + + Bump ngtcp2 + +commit cd9a021a19c7f6b83250be5dbb3ac01a12793a7f +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-02-27 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-02-27 + + Suppress warning when building C++ code with wolfSSL + +commit 2e8124eadb41808b1de787131de1b6f58c83ed05 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-02-27 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-02-27 + + Bump ngtcp2 and its dependencies + +commit ce5329a3109cda508f4d84e5c46a206d4d5ef3a6 +Merge: 6b74e009 1049ce0a +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-02-18 +Commit: GitHub +CommitDate: 2025-02-18 + + Merge pull request #2309 from nghttp2/nghttpx-rework-quic-conn + + nghttpx: Rework QUIC connection handling + +commit 1049ce0a99b121f85768a3d1c3a3dd461fe6bd10 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-11 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-02-18 + + nghttpx: Rework QUIC connection handling + +commit 6b74e0097ba30b1273843776a20395319f441987 +Merge: 321b71ae 785b0b54 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-02-18 +Commit: GitHub +CommitDate: 2025-02-18 + + Merge pull request #2308 from nghttp2/dependabot/go_modules/golang.org/x/net-0.35.0 + + build(deps): bump golang.org/x/net from 0.34.0 to 0.35.0 + +commit 785b0b541d4152e5e07e33a611fa85e2ddd3593a +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +AuthorDate: 2025-02-17 +Commit: GitHub +CommitDate: 2025-02-17 + + build(deps): bump golang.org/x/net from 0.34.0 to 0.35.0 + + Bumps [golang.org/x/net](https://github.com/golang/net) from 0.34.0 to 0.35.0. + - [Commits](https://github.com/golang/net/compare/v0.34.0...v0.35.0) + + --- + updated-dependencies: + - dependency-name: golang.org/x/net + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] + +commit 321b71aedb54eaab20456828f316212ec203c8fa +Merge: e2e73723 1dbbcc35 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-02-08 +Commit: GitHub +CommitDate: 2025-02-08 + + Merge pull request #2306 from nghttp2/clang-format + + clang-format + +commit 1dbbcc35e1c5365d3ca94b6509ed7fe06d5b2444 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-02-08 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-02-08 + + clang-format + +commit e2e737234e9d292d3cdbabd947c05e16b57ee19e +Merge: e01c9f10 2b7ad6e6 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-02-05 +Commit: GitHub +CommitDate: 2025-02-05 + + Merge pull request #2305 from qnx-ports/master + + Add QNX Support + +commit 2b7ad6e6f376d47943347b2dc4b0b9ac2223870b +Author: Deep Chordia +AuthorDate: 2025-02-05 +Commit: Deep Chordia +CommitDate: 2025-02-05 + + Add QNX Support + +commit e01c9f10a3b7d1df1b50f7ff190dee474cc15d0b +Merge: fd4505cf a2db898d +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-02-03 +Commit: GitHub +CommitDate: 2025-02-03 + + Merge pull request #2304 from nghttp2/cmake-src-tests + + cmake: Disable src tests if BUILD_TESTING is OFF + +commit a2db898d7094899c3dc8cb0b32ac1cf35ee362c8 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-02-03 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-02-03 + + cmake: Disable src tests if BUILD_TESTING is OFF + +commit fd4505cfb21710ee9ca54a128001184472a9ab46 +Merge: d037dc32 9c23c72d +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-29 +Commit: GitHub +CommitDate: 2025-01-29 + + Merge pull request #2302 from nghttp2/min-quic-pktlen + + The minimum length of a valid QUIC packet is 21 + +commit 9c23c72d9997465205b62e061f317e8845e7dbb0 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-29 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-29 + + The minimum length of a valid QUIC packet is 21 + +commit d037dc32b4ddac267b0ede89f5f6f334319c636b +Merge: a4dad6d3 e045b463 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-28 +Commit: GitHub +CommitDate: 2025-01-28 + + Merge pull request #2301 from nghttp2/dependabot/go_modules/github.com/quic-go/quic-go-0.49.0 + + build(deps): bump github.com/quic-go/quic-go from 0.48.2 to 0.49.0 + +commit e045b46352a9a36834c7157c77e873d570717c26 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +AuthorDate: 2025-01-27 +Commit: GitHub +CommitDate: 2025-01-27 + + build(deps): bump github.com/quic-go/quic-go from 0.48.2 to 0.49.0 + + Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.48.2 to 0.49.0. + - [Release notes](https://github.com/quic-go/quic-go/releases) + - [Changelog](https://github.com/quic-go/quic-go/blob/master/Changelog.md) + - [Commits](https://github.com/quic-go/quic-go/compare/v0.48.2...v0.49.0) + + --- + updated-dependencies: + - dependency-name: github.com/quic-go/quic-go + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] + +commit a4dad6d36acde0f2a511632ba8fa395e70159b41 +Merge: 0c9fdf26 bdf7f14b +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-27 +Commit: GitHub +CommitDate: 2025-01-27 + + Merge pull request #2300 from nghttp2/stale-exempt-pr + + GHA: Exempt pull request from actions/stale + +commit bdf7f14b3d914d43ca7f9d1c6641331e7970b155 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-27 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-27 + + GHA: Exempt pull request from actions/stale + +commit 0c9fdf26397d6f46595dd0f0df4091dd50606f70 +Merge: 280110ca dd59dd8b +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-26 +Commit: GitHub +CommitDate: 2025-01-26 + + Merge pull request #2299 from nghttp2/nullptr + + src: nullptr + +commit dd59dd8ba99b3e40ed6a1bfb4ba5f676be8e386d +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-26 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-26 + + src: nullptr + +commit 280110ca8dd1563b9fe1597bd33fbf0607fb5f5c +Merge: e25e68f2 f9958255 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-26 +Commit: GitHub +CommitDate: 2025-01-26 + + Merge pull request #2298 from nghttp2/fix-stale-action + + Workaround actions/stale cache issue + +commit f9958255ee08011a7d72060bcb1675a8f0842635 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-26 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-26 + + Workaround actions/stale cache issue + +commit e25e68f23408720c11812ece06ffadb1b635f931 +Merge: ab19019b 01accaef +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-25 +Commit: GitHub +CommitDate: 2025-01-25 + + Merge pull request #2297 from thevilledev/fix/hd-int-overflow-check + + fix: Add defensive bounds checking in hd_ringbuf_init() + +commit 01accaef55254ffeeebf99b1b0ceeb9cc0592d8e +Author: Ville Vesilehto +AuthorDate: 2025-01-24 +Commit: GitHub +CommitDate: 2025-01-24 + + fix: remove redundant sizeof check + + Co-authored-by: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> + +commit d06472b2c170cc898f9722b55005ef8cdbb07a63 +Author: Ville Vesilehto +AuthorDate: 2025-01-24 +Commit: GitHub +CommitDate: 2025-01-24 + + fix: optimise for conditions + + Co-authored-by: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> + +commit 8ada192e6942eb4f5b85d73b648de73185a3e112 +Author: Ville Vesilehto +AuthorDate: 2025-01-24 +Commit: GitHub +CommitDate: 2025-01-24 + + fix: set max_size as const + + Co-authored-by: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> + +commit 639b14710b83c831b5c2bc75d33e385da4cde22e +Author: Ville Vesilehto +AuthorDate: 2025-01-20 +Commit: Ville Vesilehto +CommitDate: 2025-01-20 + + fix: Add defensive integer overflow checks in hd ringbuf init + + Add bounds checking in hd_ringbuf_init() to prevent potential integer + overflow during size calculations. While HPACK decoder controls its own + buffer size (4-8K typical) and is not vulnerable to remote exploitation, + this adds defensive programming guards for robustness. + + Signed-off-by: Ville Vesilehto + +commit ab19019b77bc04925cbede25307720af056b83d3 +Merge: f88c0985 15d75404 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-18 +Commit: GitHub +CommitDate: 2025-01-18 + + Merge pull request #2296 from nghttp2/xmlfree + + HtmlParser: Use xmlFree + +commit 15d754040a03101bed219fd4ae910f56446b1b84 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-18 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-18 + + HtmlParser: Use xmlFree + +commit f88c09857dc8819c3a849a67a5e1d8e10503b49f +Merge: e5309612 3cb06f11 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-14 +Commit: GitHub +CommitDate: 2025-01-14 + + Merge pull request #2295 from nghttp2/dependabot/go_modules/golang.org/x/net-0.34.0 + + build(deps): bump golang.org/x/net from 0.33.0 to 0.34.0 + +commit 3cb06f116d662843cc4fbd82ffd251cd90842532 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +AuthorDate: 2025-01-13 +Commit: GitHub +CommitDate: 2025-01-13 + + build(deps): bump golang.org/x/net from 0.33.0 to 0.34.0 + + Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.34.0. + - [Commits](https://github.com/golang/net/compare/v0.33.0...v0.34.0) + + --- + updated-dependencies: + - dependency-name: golang.org/x/net + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] + +commit e53096123c961357302442fb1e0ac14cf7bc7e03 +Merge: 6494f056 48cdba35 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-12 +Commit: GitHub +CommitDate: 2025-01-12 + + Merge pull request #2294 from nghttp2/remove-nghttp2-dependency-based-priority-section + + Remove nghttp2 dependency based priority section + +commit 48cdba3553b294a470651f040d4c9dfff9fdea74 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-12 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-12 + + Update manual pages + +commit 71498767046147f87bb3a5b01d5e4ff35dfba4c3 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-12 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-12 + + nghttp: Remove DEPENDENCY BASED PRIORITY section from its manual page + +commit 6494f0563818cbc27a351769c1bc649f89177140 +Merge: 1f581807 db12ee7a +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-12 +Commit: GitHub +CommitDate: 2025-01-12 + + Merge pull request #2293 from nghttp2/update-priority-doc + + Update Stream priorities section + +commit 1f5818070d0500822f03bc1194a655494a724dc9 +Merge: d928ceb7 82602821 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-12 +Commit: GitHub +CommitDate: 2025-01-12 + + Merge pull request #2292 from nghttp2/nghttp-show-deprecation-warn-no-rfc7540-pri + + nghttp: Show deprecation warning for --no-rfc7540-pri option + +commit db12ee7a37bbd2ba7d2a59b3c31b0dd1f31aac1d +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-12 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-12 + + Update Stream priorities section + +commit 82602821d00ff42eae0c7cf8cfe4a7eba2d0c563 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-12 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-12 + + nghttp: Show deprecation warning for --no-rfc7540-pri option + +commit d928ceb75a364f1e199b841eae1548cc9897c9c2 +Merge: 7e096cbc 7f871f63 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-12 +Commit: GitHub +CommitDate: 2025-01-12 + + Merge pull request #2291 from nghttp2/nghttpd-remove-rfc7540-pri + + nghttpd: Remove RFC 7540 priorities + +commit 7f871f63ea0935c9a09c3eab6b310f051806a672 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-12 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-12 + + nghttpd: Remove RFC 7540 priorities + + This change deprecates --no-rfc7540-pri option. + SETTINGS_NO_RFC7540_PRIORITIES is now always sent. + +commit 7e096cbc4131b1473e91e0e672a2bc2ca2ad91cf +Merge: c8bcf5a6 f25a8dca +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-11 +Commit: GitHub +CommitDate: 2025-01-11 + + Merge pull request #2290 from nghttp2/nghttp-remove-rfc7540-pri + + nghttp: Remove RFC 7540 priorities + +commit f25a8dca17446f525ce2930918e503536dcd4374 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-10 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-11 + + nghttp: Remove RFC 7540 priorities + + This change removes RFC 7540 priorities from nghttp. nghttp now does + not create the initial dependency tree. --no-dep and --no-rfc7540-pri + options have been removed. + + nghttp now always sends NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES. + --extpri option has been added to set priority for a given URI. + +commit c8bcf5a6a2157b316444dddd8d262778b41f2821 +Merge: 26a33cf9 b2a3299e +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-11 +Commit: GitHub +CommitDate: 2025-01-11 + + Merge pull request #2289 from nghttp2/deprecate-nghttp2_option_set_no_closed_streams + + Deprecate nghttp2_option_set_no_closed_streams + +commit b2a3299e8ecec9a879c41415373a46f8eb4cb286 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-10 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-11 + + Deprecate nghttp2_option_set_no_closed_streams + +commit 26a33cf99bd30d4be24c6f6e534286cbddd86d05 +Merge: cb8421e3 96e06509 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-10 +Commit: GitHub +CommitDate: 2025-01-10 + + Merge pull request #2288 from nghttp2/deprecate-nghttp2_option_set_server_fallback_rfc7540_priorities + + Deprecate nghttp2_option_set_server_fallback_rfc7540_priorities + +commit cb8421e3537154536dfaf8d1d8fdea77de672b21 +Merge: 8c83772f 3dd61f8e +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-10 +Commit: GitHub +CommitDate: 2025-01-10 + + Merge pull request #2287 from nghttp2/remove-rfc7540-priority + + Remove RFC 7540 priorities + +commit 96e06509ac558d1b740cc62e2e6bf442b4d4667b +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-10 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-10 + + Deprecate nghttp2_option_set_server_fallback_rfc7540_priorities + +commit 3dd61f8ec3990928ee5f2606353d2b291f771aab +Author: Tatsuhiro Tsujikawa +AuthorDate: 2024-03-25 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-10 + + Remove RFC 7540 priorities + + Summary of the behavioral changes in public API functions: + + - nghttp2_session_change_stream_priority: This function is noop. It + always returns 0. + - nghttp2_session_create_idle_stream: This function is noop. It + always returns 0. + - nghttp2_submit_request: pri_spec is ignored. + - nghttp2_submit_request2: pri_spec is ignored. + - nghttp2_submit_headers: pri_spec is ignored. + - nghttp2_submit_priority: This function is noop. It always returns + 0. + - nghttp2_stream_get_parent: This function always returns NULL. + - nghttp2_stream_get_next_sibling: This function always returns NULL. + - nghttp2_stream_get_previous_sibling: This function always returns + NULL. + - nghttp2_stream_get_first_child: This function always returns NULL. + - nghttp2_stream_get_weight: This function always returns + NGHTTP2_DEFAULT_WEIGHT. + - nghttp2_stream_get_sum_dependency_weight: This function always + returns 0. + +commit 8c83772f6c45a571fb209e9ec91729a360b8490f +Merge: 5ca0bca1 a8d731d8 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2025-01-03 +Commit: GitHub +CommitDate: 2025-01-03 + + Merge pull request #2286 from nghttp2/bump-munit + + Bump munit + +commit a8d731d81fb34fa253cc9cb7c8874f096914ee00 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2025-01-03 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2025-01-03 + + Bump munit + +commit 5ca0bca19992fbb08792a25a6657a61c16f78710 +Merge: 89f27a59 23a17d00 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-12-19 +Commit: GitHub +CommitDate: 2024-12-19 + + Merge pull request #2283 from nghttp2/bump-ngtcp2 + + Bump ngtcp2 and QUIC dependencies + +commit 89f27a597f4237d1c70a7d2b1b6c559ff4182ed6 +Merge: 59f85c5d 947928bc +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-12-19 +Commit: GitHub +CommitDate: 2024-12-19 + + Merge pull request #2282 from nghttp2/bump-golang.org/x/net + + Bump golang.org/x/net to v0.33.0 + +commit 947928bcc2a8a5951a7ff15ea032501bae98927b +Author: Tatsuhiro Tsujikawa +AuthorDate: 2024-12-19 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2024-12-19 + + Bump golang.org/x/net to v0.33.0 + +commit 23a17d0048f581856a363f6e3498815b0a4e4844 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2024-12-19 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2024-12-19 + + Bump ngtcp2 and QUIC dependencies + +commit 59f85c5d622ba46826f11e6d02b5aa39439cf7f8 +Merge: 92fa43ac c7bf69c8 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-12-10 +Commit: GitHub +CommitDate: 2024-12-10 + + Merge pull request #2281 from nghttp2/dependabot/go_modules/golang.org/x/net-0.32.0 + + build(deps): bump golang.org/x/net from 0.31.0 to 0.32.0 + +commit c7bf69c8e1d8646b249ef08ad58f3bca06ff0f3b +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +AuthorDate: 2024-12-09 +Commit: GitHub +CommitDate: 2024-12-09 + + build(deps): bump golang.org/x/net from 0.31.0 to 0.32.0 + + Bumps [golang.org/x/net](https://github.com/golang/net) from 0.31.0 to 0.32.0. + - [Commits](https://github.com/golang/net/compare/v0.31.0...v0.32.0) + + --- + updated-dependencies: + - dependency-name: golang.org/x/net + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] + +commit 92fa43ac912b6c3b3d8bbfde55416eaa4f4ad508 +Merge: 68c3600d b05ee704 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-12-10 +Commit: GitHub +CommitDate: 2024-12-10 + + Merge pull request #2279 from nghttp2/dependabot/go_modules/github.com/quic-go/quic-go-0.48.2 + + build(deps): bump github.com/quic-go/quic-go from 0.48.1 to 0.48.2 + +commit b05ee704dd020e9dd0a8ff329686241fdbaeb897 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +AuthorDate: 2024-12-02 +Commit: GitHub +CommitDate: 2024-12-02 + + build(deps): bump github.com/quic-go/quic-go from 0.48.1 to 0.48.2 + + Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.48.1 to 0.48.2. + - [Release notes](https://github.com/quic-go/quic-go/releases) + - [Changelog](https://github.com/quic-go/quic-go/blob/master/Changelog.md) + - [Commits](https://github.com/quic-go/quic-go/compare/v0.48.1...v0.48.2) + + --- + updated-dependencies: + - dependency-name: github.com/quic-go/quic-go + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] + +commit 68c3600d9fe729b8c66424384472a23ae8b45cec +Merge: eb22cc12 f51e9b30 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-11-25 +Commit: GitHub +CommitDate: 2024-11-25 + + Merge pull request #2275 from nghttp2/bump-ngtcp2 + + Bump ngtcp2 + +commit f51e9b300f35ab50b16d3cdece1acf6ff9425357 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2024-11-25 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2024-11-25 + + GHA: Fix build error on Mac OS 14 + +commit f61d304ef38f92fb4c898664c48df9eadde36f9f +Author: Tatsuhiro Tsujikawa +AuthorDate: 2024-11-25 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2024-11-25 + + Bump ngtcp2 and its dependencies + +commit eb22cc1231a6b57b384abcd9948eb3ddfb844755 +Merge: 55c5adf9 41c8940a +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-11-18 +Commit: GitHub +CommitDate: 2024-11-18 + + Merge pull request #2274 from nghttp2/bump-sfparse + + Bump sfparse to 7eaf5b651f67123edf2605391023ed2fd7e2ef16 + +commit 41c8940a4ca9875b6ada4d432d8d2f2beeda0e60 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2024-11-18 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2024-11-18 + + Bump sfparse to 7eaf5b651f67123edf2605391023ed2fd7e2ef16 + +commit 55c5adf9676ecb49e8083fe3458381e751796123 +Merge: da14a31c db315a45 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-11-16 +Commit: GitHub +CommitDate: 2024-11-16 + + Merge pull request #2273 from nghttp2/urlparse + + Replace url-parser with urlparse + +commit db315a458810adb7d30be01315d48addd2a9fc40 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2024-11-16 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2024-11-16 + + Replace url-parser with urlparse + +commit da14a31cfb7dd05ee0b5cbbc6ec9d04cc87da365 +Merge: 7a96731c f5b0c5bf +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-11-15 +Commit: GitHub +CommitDate: 2024-11-15 + + Merge pull request #2272 from nghttp2/dependabot/go_modules/golang.org/x/net-0.31.0 + + build(deps): bump golang.org/x/net from 0.30.0 to 0.31.0 + +commit f5b0c5bf06354d8cdb5fc46ee1c736e818bb2933 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +AuthorDate: 2024-11-11 +Commit: GitHub +CommitDate: 2024-11-11 + + build(deps): bump golang.org/x/net from 0.30.0 to 0.31.0 + + Bumps [golang.org/x/net](https://github.com/golang/net) from 0.30.0 to 0.31.0. + - [Commits](https://github.com/golang/net/compare/v0.30.0...v0.31.0) + + --- + updated-dependencies: + - dependency-name: golang.org/x/net + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] + +commit 7a96731c6b03810bb5f45b3bd34806b895d7446e +Merge: 82ec1af2 ce70fb2a +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-10-30 +Commit: GitHub +CommitDate: 2024-10-30 + + Merge pull request #2268 from TuxInvader/conn-close-bytes + + account for bytes on closing connections + +commit ce70fb2a3e46a60a73ffe5526be9d1bdc87bd8ba +Author: Mark Boddington +AuthorDate: 2024-10-29 +Commit: GitHub +CommitDate: 2024-10-29 + + remove len check + +commit 82ec1af20e05b6f3d7c3b9106f777dcd28e732a1 +Merge: 55d4de79 5024c1b2 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-10-29 +Commit: GitHub +CommitDate: 2024-10-29 + + Merge pull request #2270 from nghttp2/dependabot/go_modules/github.com/quic-go/quic-go-0.48.1 + + build(deps): bump github.com/quic-go/quic-go from 0.48.0 to 0.48.1 + +commit 5024c1b2409a35c670fe945eb27c944f0e03d0c9 +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +AuthorDate: 2024-10-28 +Commit: GitHub +CommitDate: 2024-10-28 + + build(deps): bump github.com/quic-go/quic-go from 0.48.0 to 0.48.1 + + Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.48.0 to 0.48.1. + - [Release notes](https://github.com/quic-go/quic-go/releases) + - [Changelog](https://github.com/quic-go/quic-go/blob/master/Changelog.md) + - [Commits](https://github.com/quic-go/quic-go/compare/v0.48.0...v0.48.1) + + --- + updated-dependencies: + - dependency-name: github.com/quic-go/quic-go + dependency-type: direct:production + update-type: version-update:semver-patch + ... + + Signed-off-by: dependabot[bot] + +commit a30bc25ac7327764863b430da3a713095afbe9df +Author: Mark Boddington +AuthorDate: 2024-10-25 +Commit: GitHub +CommitDate: 2024-10-25 + + account for bytes on closing connections + +commit 55d4de7963bc8c2c849cf4ca0c195a6d9f8e12eb +Merge: fcd4f266 69df6871 +Author: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> +AuthorDate: 2024-10-22 +Commit: GitHub +CommitDate: 2024-10-22 + + Merge pull request #2266 from nghttp2/dependabot/go_modules/github.com/quic-go/quic-go-0.48.0 + + build(deps): bump github.com/quic-go/quic-go from 0.47.0 to 0.48.0 + +commit 69df6871f63994fa41b09f2d1972ee43982e894b +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +AuthorDate: 2024-10-21 +Commit: GitHub +CommitDate: 2024-10-21 + + build(deps): bump github.com/quic-go/quic-go from 0.47.0 to 0.48.0 + + Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.47.0 to 0.48.0. + - [Release notes](https://github.com/quic-go/quic-go/releases) + - [Changelog](https://github.com/quic-go/quic-go/blob/master/Changelog.md) + - [Commits](https://github.com/quic-go/quic-go/compare/v0.47.0...v0.48.0) + + --- + updated-dependencies: + - dependency-name: github.com/quic-go/quic-go + dependency-type: direct:production + update-type: version-update:semver-minor + ... + + Signed-off-by: dependabot[bot] + +commit fcd4f2663a61d1098cb2fca7d4da7e009f285569 +Author: Tatsuhiro Tsujikawa +AuthorDate: 2024-10-21 +Commit: Tatsuhiro Tsujikawa +CommitDate: 2024-10-21 + + Bump package version diff --git a/lib/nghttp2/Dockerfile.android b/lib/nghttp2-1.65.0/Dockerfile.android similarity index 89% rename from lib/nghttp2/Dockerfile.android rename to lib/nghttp2-1.65.0/Dockerfile.android index 96ce7c4670d..c58354c9a94 100644 --- a/lib/nghttp2/Dockerfile.android +++ b/lib/nghttp2-1.65.0/Dockerfile.android @@ -15,7 +15,7 @@ FROM ubuntu:22.04 MAINTAINER Tatsuhiro Tsujikawa -ENV NDK_VERSION r25b +ENV NDK_VERSION r26d ENV NDK /root/android-ndk-$NDK_VERSION ENV TOOLCHAIN $NDK/toolchains/llvm/prebuilt/linux-x86_64 ENV TARGET aarch64-linux-android @@ -42,9 +42,9 @@ RUN curl -L -O https://dl.google.com/android/repository/android-ndk-$NDK_VERSION rm android-ndk-$NDK_VERSION-linux.zip # Setup version of libraries -ENV OPENSSL_VERSION 1.1.1q +ENV OPENSSL_VERSION 1.1.1w ENV LIBEV_VERSION 4.33 -ENV ZLIB_VERSION 1.2.13 +ENV ZLIB_VERSION 1.3.1 ENV CARES_VERSION 1.18.1 ENV NGHTTP2_VERSION master @@ -65,6 +65,7 @@ RUN curl -L -O http://dist.schmorp.de/libev/Attic/libev-$LIBEV_VERSION.tar.gz && WORKDIR /root/build/libev-$LIBEV_VERSION RUN ./configure \ + --disable-dependency-tracking \ --host=$TARGET \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ --prefix=$PREFIX \ @@ -75,7 +76,7 @@ RUN ./configure \ make install WORKDIR /root/build -RUN curl -L -O https://zlib.net/zlib-$ZLIB_VERSION.tar.gz && \ +RUN curl -L -O https://github.com/madler/zlib/releases/download/v$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz && \ tar xf zlib-$ZLIB_VERSION.tar.gz && \ rm zlib-$ZLIB_VERSION.tar.gz @@ -90,12 +91,13 @@ RUN HOST=$TARGET \ WORKDIR /root/build -RUN curl -L -O https://c-ares.haxx.se/download/c-ares-$CARES_VERSION.tar.gz && \ +RUN curl -L -O https://github.com/c-ares/c-ares/releases/download/cares-1_18_1/c-ares-$CARES_VERSION.tar.gz && \ tar xf c-ares-$CARES_VERSION.tar.gz && \ rm c-ares-$CARES_VERSION.tar.gz WORKDIR /root/build/c-ares-$CARES_VERSION RUN ./configure \ + --disable-dependency-tracking \ --host=$TARGET \ --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ --prefix=$PREFIX \ @@ -107,6 +109,7 @@ RUN git clone https://github.com/nghttp2/nghttp2 -b $NGHTTP2_VERSION --depth 1 WORKDIR /root/build/nghttp2 RUN autoreconf -i && \ ./configure \ + --disable-dependency-tracking \ --enable-app \ --disable-shared \ --host=$TARGET \ diff --git a/lib/nghttp2-1.65.0/INSTALL b/lib/nghttp2-1.65.0/INSTALL new file mode 100755 index 00000000000..e82fd21de2e --- /dev/null +++ b/lib/nghttp2-1.65.0/INSTALL @@ -0,0 +1,368 @@ +Installation Instructions +************************* + + Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free +Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell command './configure && make && make install' +should configure, build, and install this package. The following +more-detailed instructions are generic; see the 'README' file for +instructions specific to this package. Some packages provide this +'INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The 'configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a 'Makefile' in each directory of the package. +It may also create one or more '.h' files containing system-dependent +definitions. Finally, it creates a shell script 'config.status' that +you can run in the future to recreate the current configuration, and a +file 'config.log' containing compiler output (useful mainly for +debugging 'configure'). + + It can also use an optional file (typically called 'config.cache' and +enabled with '--cache-file=config.cache' or simply '-C') that saves the +results of its tests to speed up reconfiguring. Caching is disabled by +default to prevent problems with accidental use of stale cache files. + + If you need to do unusual things to compile the package, please try +to figure out how 'configure' could check whether to do them, and mail +diffs or instructions to the address given in the 'README' so they can +be considered for the next release. If you are using the cache, and at +some point 'config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file 'configure.ac' (or 'configure.in') is used to create +'configure' by a program called 'autoconf'. You need 'configure.ac' if +you want to change it or regenerate 'configure' using a newer version of +'autoconf'. + + The simplest way to compile this package is: + + 1. 'cd' to the directory containing the package's source code and type + './configure' to configure the package for your system. + + Running 'configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type 'make' to compile the package. + + 3. Optionally, type 'make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type 'make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the 'make install' phase executed with root + privileges. + + 5. Optionally, type 'make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior 'make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing 'make clean'. To also remove the + files that 'configure' created (so you can compile the package for + a different kind of computer), type 'make distclean'. There is + also a 'make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type 'make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide 'make + distcheck', which can by used by developers to test that all other + targets like 'make install' and 'make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the 'configure' script does not know about. Run './configure --help' +for details on some of the pertinent environment variables. + + You can give 'configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here is +an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU 'make'. 'cd' to the +directory where you want the object files and executables to go and run +the 'configure' script. 'configure' automatically checks for the source +code in the directory that 'configure' is in and in '..'. This is known +as a "VPATH" build. + + With a non-GNU 'make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use 'make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple '-arch' options to the +compiler but only a single '-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the 'lipo' tool if you have problems. + +Installation Names +================== + + By default, 'make install' installs the package's commands under +'/usr/local/bin', include files under '/usr/local/include', etc. You +can specify an installation prefix other than '/usr/local' by giving +'configure' the option '--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option '--exec-prefix=PREFIX' to 'configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like '--bindir=DIR' to specify different values for particular +kinds of files. Run 'configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the default +for these options is expressed in terms of '${prefix}', so that +specifying just '--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to 'configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +'make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, 'make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +'${prefix}'. Any directories that were specified during 'configure', +but not in terms of '${prefix}', must each be overridden at install time +for the entire installation to be relocated. The approach of makefile +variable overrides for each directory variable is required by the GNU +Coding Standards, and ideally causes no recompilation. However, some +platforms have known limitations with the semantics of shared libraries +that end up requiring recompilation when using this method, particularly +noticeable in packages that use GNU Libtool. + + The second method involves providing the 'DESTDIR' variable. For +example, 'make install DESTDIR=/alternate/directory' will prepend +'/alternate/directory' before all installation names. The approach of +'DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of '${prefix}' +at 'configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving 'configure' the +option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. + + Some packages pay attention to '--enable-FEATURE' options to +'configure', where FEATURE indicates an optional part of the package. +They may also pay attention to '--with-PACKAGE' options, where PACKAGE +is something like 'gnu-as' or 'x' (for the X Window System). The +'README' should mention any '--enable-' and '--with-' options that the +package recognizes. + + For packages that use the X Window System, 'configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the 'configure' options '--x-includes=DIR' and +'--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of 'make' will be. For these packages, running './configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with 'make V=1'; while running './configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with 'make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC +is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX 'make' updates targets which have the same timestamps as their +prerequisites, which makes it generally unusable when shipped generated +files such as 'configure' are involved. Use GNU 'make' instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its '' header file. The option '-nodtk' can be used as a +workaround. If GNU CC is not installed, it is therefore recommended to +try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put '/usr/ucb' early in your 'PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in '/usr/bin'. So, if you need '/usr/ucb' +in your 'PATH', put it _after_ '/usr/bin'. + + On Haiku, software installed for all users goes in '/boot/common', +not '/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features 'configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, 'configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +'--build=TYPE' option. TYPE can either be a short name for the system +type, such as 'sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file 'config.sub' for the possible values of each field. If +'config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option '--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with '--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for 'configure' scripts to share, +you can create a site shell script called 'config.site' that gives +default values for variables like 'CC', 'cache_file', and 'prefix'. +'configure' looks for 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Or, you can set the +'CONFIG_SITE' environment variable to the location of the site script. +A warning: not all 'configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to 'configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the 'configure' command line, using 'VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified 'gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an +Autoconf limitation. Until the limitation is lifted, you can use this +workaround: + + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash + +'configure' Invocation +====================== + + 'configure' recognizes the following options to control how it +operates. + +'--help' +'-h' + Print a summary of all of the options to 'configure', and exit. + +'--help=short' +'--help=recursive' + Print a summary of the options unique to this package's + 'configure', and exit. The 'short' variant lists options used only + in the top level, while the 'recursive' variant lists options also + present in any nested packages. + +'--version' +'-V' + Print the version of Autoconf used to generate the 'configure' + script, and exit. + +'--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally 'config.cache'. FILE defaults to '/dev/null' to + disable caching. + +'--config-cache' +'-C' + Alias for '--cache-file=config.cache'. + +'--quiet' +'--silent' +'-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to '/dev/null' (any error + messages will still be shown). + +'--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + 'configure' can determine that directory automatically. + +'--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: for + more details, including other options available for fine-tuning the + installation locations. + +'--no-create' +'-n' + Run the configure checks, but stop before creating any output + files. + +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. diff --git a/lib/nghttp2/Makefile.am b/lib/nghttp2-1.65.0/Makefile.am similarity index 94% rename from lib/nghttp2/Makefile.am rename to lib/nghttp2-1.65.0/Makefile.am index 683b9896b09..ad916e01f9d 100644 --- a/lib/nghttp2/Makefile.am +++ b/lib/nghttp2-1.65.0/Makefile.am @@ -35,7 +35,6 @@ EXTRA_DIST = nghttpx.conf.sample proxy.pac.sample android-config android-env \ cmake/ExtractValidFlags.cmake \ cmake/FindJemalloc.cmake \ cmake/FindLibev.cmake \ - cmake/FindCUnit.cmake \ cmake/Version.cmake \ cmake/FindLibevent.cmake \ cmake/FindJansson.cmake \ @@ -45,6 +44,10 @@ EXTRA_DIST = nghttpx.conf.sample proxy.pac.sample android-config android-env \ cmake/FindLibnghttp3.cmake \ cmake/FindLibngtcp2.cmake \ cmake/FindLibngtcp2_crypto_quictls.cmake \ + cmake/FindLibbrotlienc.cmake \ + cmake/FindLibbrotlidec.cmake \ + cmake/FindLibngtcp2_crypto_wolfssl.cmake \ + cmake/FindWolfSSL.cmake \ cmake/PickyWarningsC.cmake \ cmake/PickyWarningsCXX.cmake diff --git a/lib/nghttp2-1.65.0/Makefile.in b/lib/nghttp2-1.65.0/Makefile.in new file mode 100644 index 00000000000..c7cb6d973d2 --- /dev/null +++ b/lib/nghttp2-1.65.0/Makefile.in @@ -0,0 +1,1018 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2012 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(dist_doc_DATA) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = lib/includes/nghttp2/nghttp2ver.h +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(docdir)" +DATA = $(dist_doc_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir distdir-am dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/lib/includes/nghttp2/nghttp2ver.h.in AUTHORS \ + COPYING ChangeLog INSTALL NEWS README compile config.guess \ + config.sub install-sh ltmain.sh missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +SUBDIRS = lib third-party src bpf examples tests integration-tests \ + doc contrib script + +ACLOCAL_AMFLAGS = -I m4 +dist_doc_DATA = README.rst +EXTRA_DIST = nghttpx.conf.sample proxy.pac.sample android-config android-env \ + Dockerfile.android \ + cmakeconfig.h.in \ + CMakeLists.txt \ + CMakeOptions.txt \ + cmake/ExtractValidFlags.cmake \ + cmake/FindJemalloc.cmake \ + cmake/FindLibev.cmake \ + cmake/Version.cmake \ + cmake/FindLibevent.cmake \ + cmake/FindJansson.cmake \ + cmake/FindLibcares.cmake \ + cmake/FindSystemd.cmake \ + cmake/FindLibbpf.cmake \ + cmake/FindLibnghttp3.cmake \ + cmake/FindLibngtcp2.cmake \ + cmake/FindLibngtcp2_crypto_quictls.cmake \ + cmake/FindLibbrotlienc.cmake \ + cmake/FindLibbrotlidec.cmake \ + cmake/FindLibngtcp2_crypto_wolfssl.cmake \ + cmake/FindWolfSSL.cmake \ + cmake/PickyWarningsC.cmake \ + cmake/PickyWarningsCXX.cmake + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +lib/includes/nghttp2/nghttp2ver.h: $(top_builddir)/config.status $(top_srcdir)/lib/includes/nghttp2/nghttp2ver.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt +install-dist_docDATA: $(dist_doc_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ + done + +uninstall-dist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(DATA) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(docdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-dist_docDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-dist_docDATA + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool cscope cscopelist-am ctags ctags-am dist \ + dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ + dist-xz dist-zip dist-zstd distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dist_docDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-dist_docDATA + +.PRECIOUS: Makefile + + +.PHONY: clang-format + +# Format source files using clang-format. Don't format source files +# under third-party directory since we are not responsible for their +# coding style. +clang-format: + CLANGFORMAT=`git config --get clangformat.binary`; \ + test -z $${CLANGFORMAT} && CLANGFORMAT="clang-format"; \ + $${CLANGFORMAT} -i lib/*.{c,h} lib/includes/nghttp2/*.h \ + src/*.{c,cc,h} examples/*.c \ + tests/*.{c,h} bpf/*.c fuzz/*.cc + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/NEWS b/lib/nghttp2-1.65.0/NEWS similarity index 100% rename from lib/nghttp2/NEWS rename to lib/nghttp2-1.65.0/NEWS diff --git a/lib/nghttp2/README b/lib/nghttp2-1.65.0/README similarity index 100% rename from lib/nghttp2/README rename to lib/nghttp2-1.65.0/README diff --git a/lib/nghttp2/README.rst b/lib/nghttp2-1.65.0/README.rst similarity index 94% rename from lib/nghttp2/README.rst rename to lib/nghttp2-1.65.0/README.rst index 596d5615753..d2020ef634f 100644 --- a/lib/nghttp2/README.rst +++ b/lib/nghttp2-1.65.0/README.rst @@ -29,10 +29,10 @@ Public Test Server The following endpoints are available to try out our nghttp2 implementation. -* https://nghttp2.org/ (TLS + ALPN/NPN and HTTP/3) +* https://nghttp2.org/ (TLS + ALPN and HTTP/3) This endpoint supports ``h2``, ``h2-16``, ``h2-14``, and - ``http/1.1`` via ALPN/NPN and requires TLSv1.2 for HTTP/2 + ``http/1.1`` via ALPN and requires TLSv1.2 for HTTP/2 connection. It also supports HTTP/3. @@ -48,11 +48,6 @@ The following package is required to build the libnghttp2 library: * pkg-config >= 0.20 -To build and run the unit test programs, the following package is -required: - -* cunit >= 2.1 - To build the documentation, you need to install: * sphinx (http://sphinx-doc.org/) @@ -66,15 +61,12 @@ To build and run the application programs (``nghttp``, ``nghttpd``, ``nghttpx`` and ``h2load``) in the ``src`` directory, the following packages are required: -* OpenSSL >= 1.0.1 +* OpenSSL >= 1.1.1; or wolfSSL >= 5.7.0; or LibreSSL >= 3.8.1; or + aws-lc >= 1.19.0; or BoringSSL * libev >= 4.11 * zlib >= 1.2.3 * libc-ares >= 1.7.5 -ALPN support requires OpenSSL >= 1.0.2 (released 22 January 2015). -LibreSSL >= 2.2.0 can be used instead of OpenSSL, but OpenSSL has more -features than LibreSSL at the time of this writing. - To enable ``-a`` option (getting linked assets from the downloaded resource) in ``nghttp``, the following package is required: @@ -103,10 +95,15 @@ To mitigate heap fragmentation in long running server programs Alpine Linux currently does not support malloc replacement due to musl limitations. See details in issue `#762 `_. +For BoringSSL or aws-lc build, to enable :rfc:`8879` TLS Certificate +Compression in applications, the following library is required: + +* libbrotli-dev >= 1.0.9 + To enable mruby support for nghttpx, `mruby `_ is required. We need to build mruby with C++ ABI explicitly turned on, and probably need other -mrgems, mruby is manged by git submodule under third-party/mruby +mrgems, mruby is managed by git submodule under third-party/mruby directory. Currently, mruby support for nghttpx is disabled by default. To enable mruby support, use ``--with-mruby`` configure option. Note that at the time of this writing, libmruby-dev and mruby @@ -118,19 +115,20 @@ required: * bison nghttpx supports `neverbleed `_, -privilege separation engine for OpenSSL / LibreSSL. In short, it -minimizes the risk of private key leakage when serious bug like -Heartbleed is exploited. The neverbleed is disabled by default. To -enable it, use ``--with-neverbleed`` configure option. +privilege separation engine for OpenSSL. In short, it minimizes the +risk of private key leakage when serious bug like Heartbleed is +exploited. The neverbleed is disabled by default. To enable it, use +``--with-neverbleed`` configure option. To enable the experimental HTTP/3 support for h2load and nghttpx, the following libraries are required: * `OpenSSL with QUIC support `_; or + wolfSSL; or LibreSSL (does not support 0RTT); or aws-lc; or `BoringSSL `_ (commit - 6ca49385b168f47a50e7172d82a590b218f55e4d) -* `ngtcp2 `_ >= 1.0.0 + 294ab9730c570213b496cfc2fc14b3c0bfcd4bcc) +* `ngtcp2 `_ >= 1.4.0 * `nghttp3 `_ >= 1.1.0 Use ``--enable-http3`` configure option to enable HTTP/3 feature for @@ -146,14 +144,14 @@ Use ``--with-libbpf`` configure option to build eBPF program. libelf-dev is needed to build libbpf. For Ubuntu 20.04, you can build libbpf from `the source code -`_. nghttpx -requires eBPF program for reloading its configuration and hot swapping -its executable. +`_. nghttpx requires eBPF +program for reloading its configuration and hot swapping its +executable. Compiling libnghttp2 C source code requires a C99 compiler. gcc 4.8 -is known to be adequate. In order to compile the C++ source code, gcc ->= 6.0 or clang >= 6.0 is required. C++ source code requires C++14 -language features. +is known to be adequate. In order to compile the C++ source code, +C++20 compliant compiler is required. At least g++ >= 12 and +clang++ >= 15 are known to work. .. note:: @@ -207,7 +205,7 @@ required packages: sudo apt-get install g++ clang make binutils autoconf automake \ autotools-dev libtool pkg-config \ - zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev \ + zlib1g-dev libssl-dev libxml2-dev libev-dev \ libevent-dev libjansson-dev \ libc-ares-dev libjemalloc-dev libsystemd-dev \ ruby-dev bison libelf-dev @@ -339,23 +337,24 @@ connections alive during reload. The detailed steps to build HTTP/3 enabled h2load and nghttpx follow. -Build custom OpenSSL: +Build aws-lc: .. code-block:: text - $ git clone --depth 1 -b OpenSSL_1_1_1w+quic https://github.com/quictls/openssl - $ cd openssl - $ ./config --prefix=$PWD/build --openssldir=/etc/ssl - $ make -j$(nproc) - $ make install_sw + $ git clone --depth 1 -b v1.46.1 https://github.com/aws/aws-lc + $ cd aws-lc + $ cmake -B build -DDISABLE_GO=ON --install-prefix=$PWD/opt + $ make -j$(nproc) -C build + $ cmake --install build $ cd .. Build nghttp3: .. code-block:: text - $ git clone --depth 1 -b v1.1.0 https://github.com/ngtcp2/nghttp3 + $ git clone --depth 1 -b v1.8.0 https://github.com/ngtcp2/nghttp3 $ cd nghttp3 + $ git submodule update --init --depth 1 $ autoreconf -i $ ./configure --prefix=$PWD/build --enable-lib-only $ make -j$(nproc) @@ -366,11 +365,13 @@ Build ngtcp2: .. code-block:: text - $ git clone --depth 1 -b v1.1.0 https://github.com/ngtcp2/ngtcp2 + $ git clone --depth 1 -b v1.11.0 https://github.com/ngtcp2/ngtcp2 $ cd ngtcp2 + $ git submodule update --init --depth 1 $ autoreconf -i - $ ./configure --prefix=$PWD/build --enable-lib-only \ - PKG_CONFIG_PATH="$PWD/../openssl/build/lib/pkgconfig" + $ ./configure --prefix=$PWD/build --enable-lib-only --with-boringssl \ + BORINGSSL_CFLAGS="-I$PWD/../aws-lc/opt/include" \ + BORINGSSL_LIBS="-L$PWD/../aws-lc/opt/lib -lssl -lcrypto" $ make -j$(nproc) $ make install $ cd .. @@ -380,7 +381,7 @@ from source: .. code-block:: text - $ git clone --depth 1 -b v1.3.0 https://github.com/libbpf/libbpf + $ git clone --depth 1 -b v1.5.0 https://github.com/libbpf/libbpf $ cd libbpf $ PREFIX=$PWD/build make -C src install $ cd .. @@ -393,10 +394,10 @@ Build nghttp2: $ cd nghttp2 $ git submodule update --init $ autoreconf -i - $ ./configure --with-mruby --with-neverbleed --enable-http3 --with-libbpf \ - CC=clang-14 CXX=clang++-14 \ - PKG_CONFIG_PATH="$PWD/../openssl/build/lib/pkgconfig:$PWD/../nghttp3/build/lib/pkgconfig:$PWD/../ngtcp2/build/lib/pkgconfig:$PWD/../libbpf/build/lib64/pkgconfig" \ - LDFLAGS="$LDFLAGS -Wl,-rpath,$PWD/../openssl/build/lib -Wl,-rpath,$PWD/../libbpf/build/lib64" + $ ./configure --with-mruby --enable-http3 --with-libbpf \ + CC=clang-15 CXX=clang++-15 \ + PKG_CONFIG_PATH="$PWD/../aws-lc/opt/lib/pkgconfig:$PWD/../nghttp3/build/lib/pkgconfig:$PWD/../ngtcp2/build/lib/pkgconfig:$PWD/../libbpf/build/lib64/pkgconfig" \ + LDFLAGS="$LDFLAGS -Wl,-rpath,$PWD/../aws-lc/opt/lib -Wl,-rpath,$PWD/../libbpf/build/lib64" $ make -j$(nproc) The eBPF program ``reuseport_kern.o`` should be found under bpf @@ -481,7 +482,7 @@ Previously nghttp2 library did not send client magic, which is first 24 bytes byte string of client connection preface, and client applications have to send it by themselves. Since v1.0.0, client magic is sent by library via first call of ``nghttp2_session_send()`` -or ``nghttp2_session_mem_send()``. +or ``nghttp2_session_mem_send2()``. The client applications which send client magic must remove the relevant code. @@ -539,7 +540,7 @@ nghttp - client +++++++++++++++ ``nghttp`` is a HTTP/2 client. It can connect to the HTTP/2 server -with prior knowledge, HTTP Upgrade and NPN/ALPN TLS extension. +with prior knowledge, HTTP Upgrade and ALPN TLS extension. It has verbose output mode for framing information. Here is sample output from ``nghttp`` client: @@ -765,8 +766,8 @@ nghttpd - server By default, it uses SSL/TLS connection. Use ``--no-tls`` option to disable it. -``nghttpd`` only accepts HTTP/2 connections via NPN/ALPN or direct -HTTP/2 connections. No HTTP Upgrade is supported. +``nghttpd`` only accepts HTTP/2 connections via ALPN or direct HTTP/2 +connections. No HTTP Upgrade is supported. The ``-p`` option allows users to configure server push. @@ -847,7 +848,7 @@ to know how to migrate from earlier releases. ``nghttpx`` implements `important performance-oriented features `_ in TLS, such as session IDs, session tickets (with automatic key rotation), OCSP -stapling, dynamic record sizing, ALPN/NPN, forward secrecy and HTTP/2. +stapling, dynamic record sizing, ALPN, forward secrecy and HTTP/2. ``nghttpx`` also offers the functionality to share session cache and ticket keys among multiple ``nghttpx`` instances via memcached. @@ -974,12 +975,15 @@ threads to avoid saturating a single core on client side. servers. If the experimental HTTP/3 is enabled, h2load can send requests to -HTTP/3 server. To do this, specify ``h3`` to ``--npn-list`` option +HTTP/3 server. To do this, specify ``h3`` to ``--alpn-list`` option like so: .. code-block:: text - $ h2load --npn-list h3 https://127.0.0.1:4433 + $ h2load --alpn-list h3 https://127.0.0.1:4433 + +For nghttp2 v1.58 or earlier, use ``--npn-list`` instead of +``--alpn-list``. HPACK tools ----------- @@ -1445,17 +1449,6 @@ See `Contribution Guidelines `_ for more details. -Reporting vulnerability ------------------------ - -If you find a vulnerability in our software, please send the email to -"tatsuhiro.t at gmail dot com" about its details instead of submitting -issues on github issue page. It is a standard practice not to -disclose vulnerability information publicly until a fixed version is -released, or mitigation is worked out. - -In the future, we may setup a dedicated mail address for this purpose. - Versioning ---------- diff --git a/lib/nghttp2-1.65.0/aclocal.m4 b/lib/nghttp2-1.65.0/aclocal.m4 new file mode 100644 index 00000000000..8b2badae567 --- /dev/null +++ b/lib/nghttp2-1.65.0/aclocal.m4 @@ -0,0 +1,1860 @@ +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.2]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurrence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $2]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR + +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES + +# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.16' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.16.5], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.16.5])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? + done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. +AC_DEFUN([AM_MAKE_INCLUDE], +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------------- +# Adds support for distributing Python modules and packages. To +# install modules, copy them to $(pythondir), using the python_PYTHON +# automake variable. To install a package with the same name as the +# automake package, install to $(pkgpythondir), or use the +# pkgpython_PYTHON automake variable. +# +# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as +# locations to install python extension modules (shared libraries). +# Another macro is required to find the appropriate flags to compile +# extension modules. +# +# If your package is configured with a different prefix to python, +# users will have to add the install directory to the PYTHONPATH +# environment variable, or create a .pth file (see the python +# documentation for details). +# +# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will +# cause an error if the version of python installed on the system +# doesn't meet the requirement. MINIMUM-VERSION should consist of +# numbers and dots only. +AC_DEFUN([AM_PATH_PYTHON], + [ + dnl Find a Python interpreter. Python versions prior to 2.0 are not + dnl supported. (2.0 was released on October 16, 2000). + m4_define_default([_AM_PYTHON_INTERPRETER_LIST], +[python python2 python3 dnl + python3.11 python3.10 dnl + python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl + python3.2 python3.1 python3.0 dnl + python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl + python2.0]) + + AC_ARG_VAR([PYTHON], [the Python interpreter]) + + m4_if([$1],[],[ + dnl No version check is needed. + # Find any Python interpreter. + if test -z "$PYTHON"; then + AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) + fi + am_display_PYTHON=python + ], [ + dnl A version check is needed. + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + AC_MSG_CHECKING([whether $PYTHON version is >= $1]) + AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Python interpreter is too old])]) + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + AC_CACHE_CHECK([for a Python interpreter with version >= $1], + [am_cv_pathless_PYTHON],[ + for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do + test "$am_cv_pathless_PYTHON" = none && break + AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) + done]) + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + if test "$am_cv_pathless_PYTHON" = none; then + PYTHON=: + else + AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + ]) + + if test "$PYTHON" = :; then + dnl Run any user-specified action, or abort. + m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) + else + + dnl Query Python for its version number. Although site.py simply uses + dnl sys.version[:3], printing that failed with Python 3.10, since the + dnl trailing zero was eliminated. So now we output just the major + dnl and minor version numbers, as numbers. Apparently the tertiary + dnl version is not of interest. + dnl + AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], + [am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[[:2]])"`]) + AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) + + dnl At times, e.g., when building shared libraries, you may want + dnl to know which OS platform Python thinks this is. + dnl + AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], + [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) + AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) + + dnl emacs-page + dnl If --with-python-sys-prefix is given, use the values of sys.prefix + dnl and sys.exec_prefix for the corresponding values of PYTHON_PREFIX + dnl and PYTHON_EXEC_PREFIX. Otherwise, use the GNU ${prefix} and + dnl ${exec_prefix} variables. + dnl + dnl The two are made distinct variables so they can be overridden if + dnl need be, although general consensus is that you shouldn't need + dnl this separation. + dnl + dnl Also allow directly setting the prefixes via configure options, + dnl overriding any default. + dnl + if test "x$prefix" = xNONE; then + am__usable_prefix=$ac_default_prefix + else + am__usable_prefix=$prefix + fi + + # Allow user to request using sys.* values from Python, + # instead of the GNU $prefix values. + AC_ARG_WITH([python-sys-prefix], + [AS_HELP_STRING([--with-python-sys-prefix], + [use Python's sys.prefix and sys.exec_prefix values])], + [am_use_python_sys=:], + [am_use_python_sys=false]) + + # Allow user to override whatever the default Python prefix is. + AC_ARG_WITH([python_prefix], + [AS_HELP_STRING([--with-python_prefix], + [override the default PYTHON_PREFIX])], + [am_python_prefix_subst=$withval + am_cv_python_prefix=$withval + AC_MSG_CHECKING([for explicit $am_display_PYTHON prefix]) + AC_MSG_RESULT([$am_cv_python_prefix])], + [ + if $am_use_python_sys; then + # using python sys.prefix value, not GNU + AC_CACHE_CHECK([for python default $am_display_PYTHON prefix], + [am_cv_python_prefix], + [am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`]) + + dnl If sys.prefix is a subdir of $prefix, replace the literal value of + dnl $prefix with a variable reference so it can be overridden. + case $am_cv_python_prefix in + $am__usable_prefix*) + am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'` + am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"` + ;; + *) + am_python_prefix_subst=$am_cv_python_prefix + ;; + esac + else # using GNU prefix value, not python sys.prefix + am_python_prefix_subst='${prefix}' + am_python_prefix=$am_python_prefix_subst + AC_MSG_CHECKING([for GNU default $am_display_PYTHON prefix]) + AC_MSG_RESULT([$am_python_prefix]) + fi]) + # Substituting python_prefix_subst value. + AC_SUBST([PYTHON_PREFIX], [$am_python_prefix_subst]) + + # emacs-page Now do it all over again for Python exec_prefix, but with yet + # another conditional: fall back to regular prefix if that was specified. + AC_ARG_WITH([python_exec_prefix], + [AS_HELP_STRING([--with-python_exec_prefix], + [override the default PYTHON_EXEC_PREFIX])], + [am_python_exec_prefix_subst=$withval + am_cv_python_exec_prefix=$withval + AC_MSG_CHECKING([for explicit $am_display_PYTHON exec_prefix]) + AC_MSG_RESULT([$am_cv_python_exec_prefix])], + [ + # no explicit --with-python_exec_prefix, but if + # --with-python_prefix was given, use its value for python_exec_prefix too. + AS_IF([test -n "$with_python_prefix"], + [am_python_exec_prefix_subst=$with_python_prefix + am_cv_python_exec_prefix=$with_python_prefix + AC_MSG_CHECKING([for python_prefix-given $am_display_PYTHON exec_prefix]) + AC_MSG_RESULT([$am_cv_python_exec_prefix])], + [ + # Set am__usable_exec_prefix whether using GNU or Python values, + # since we use that variable for pyexecdir. + if test "x$exec_prefix" = xNONE; then + am__usable_exec_prefix=$am__usable_prefix + else + am__usable_exec_prefix=$exec_prefix + fi + # + if $am_use_python_sys; then # using python sys.exec_prefix, not GNU + AC_CACHE_CHECK([for python default $am_display_PYTHON exec_prefix], + [am_cv_python_exec_prefix], + [am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`]) + dnl If sys.exec_prefix is a subdir of $exec_prefix, replace the + dnl literal value of $exec_prefix with a variable reference so it can + dnl be overridden. + case $am_cv_python_exec_prefix in + $am__usable_exec_prefix*) + am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'` + am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"` + ;; + *) + am_python_exec_prefix_subst=$am_cv_python_exec_prefix + ;; + esac + else # using GNU $exec_prefix, not python sys.exec_prefix + am_python_exec_prefix_subst='${exec_prefix}' + am_python_exec_prefix=$am_python_exec_prefix_subst + AC_MSG_CHECKING([for GNU default $am_display_PYTHON exec_prefix]) + AC_MSG_RESULT([$am_python_exec_prefix]) + fi])]) + # Substituting python_exec_prefix_subst. + AC_SUBST([PYTHON_EXEC_PREFIX], [$am_python_exec_prefix_subst]) + + # Factor out some code duplication into this shell variable. + am_python_setup_sysconfig="\ +import sys +# Prefer sysconfig over distutils.sysconfig, for better compatibility +# with python 3.x. See automake bug#10227. +try: + import sysconfig +except ImportError: + can_use_sysconfig = 0 +else: + can_use_sysconfig = 1 +# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: +# +try: + from platform import python_implementation + if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': + can_use_sysconfig = 0 +except ImportError: + pass" + + dnl emacs-page Set up 4 directories: + + dnl 1. pythondir: where to install python scripts. This is the + dnl site-packages directory, not the python standard library + dnl directory like in previous automake betas. This behavior + dnl is more consistent with lispdir.m4 for example. + dnl Query distutils for this directory. + dnl + AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)], + [am_cv_python_pythondir], + [if test "x$am_cv_python_prefix" = x; then + am_py_prefix=$am__usable_prefix + else + am_py_prefix=$am_cv_python_prefix + fi + am_cv_python_pythondir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() + else: + scheme = sysconfig._get_default_scheme() + if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' + sitedir = sysconfig.get_path('purelib', scheme, vars={'base':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + # + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages" + ;; + esac + ;; + esac + ]) + AC_SUBST([pythondir], [$am_cv_python_pythondir]) + + dnl 2. pkgpythondir: $PACKAGE directory under pythondir. Was + dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is + dnl more consistent with the rest of automake. + dnl + AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) + + dnl 3. pyexecdir: directory for installing python extension modules + dnl (shared libraries). + dnl Query distutils for this directory. + dnl + AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)], + [am_cv_python_pyexecdir], + [if test "x$am_cv_python_exec_prefix" = x; then + am_py_exec_prefix=$am__usable_exec_prefix + else + am_py_exec_prefix=$am_cv_python_exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() + else: + scheme = sysconfig._get_default_scheme() + if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' + sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase':'$am_py_exec_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix') +sys.stdout.write(sitedir)"` + # + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages" + ;; + esac + ;; + esac + ]) + AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) + + dnl 4. pkgpyexecdir: $(pyexecdir)/$(PACKAGE) + dnl + AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) + + dnl Run any user-specified action. + $2 + fi +]) + + +# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------------------- +# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. +# Run ACTION-IF-FALSE otherwise. +# This test uses sys.hexversion instead of the string equivalent (first +# word of sys.version), in order to cope with versions such as 2.2c1. +# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). +AC_DEFUN([AM_PYTHON_CHECK_VERSION], + [prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] +sys.exit(sys.hexversion < minverhex)" + AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/ax_check_compile_flag.m4]) +m4_include([m4/ax_cxx_compile_stdcxx.m4]) +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) diff --git a/lib/nghttp2/android-config b/lib/nghttp2-1.65.0/android-config similarity index 100% rename from lib/nghttp2/android-config rename to lib/nghttp2-1.65.0/android-config diff --git a/lib/nghttp2/android-env b/lib/nghttp2-1.65.0/android-env similarity index 100% rename from lib/nghttp2/android-env rename to lib/nghttp2-1.65.0/android-env diff --git a/lib/nghttp2/bpf/CMakeLists.txt b/lib/nghttp2-1.65.0/bpf/CMakeLists.txt similarity index 100% rename from lib/nghttp2/bpf/CMakeLists.txt rename to lib/nghttp2-1.65.0/bpf/CMakeLists.txt diff --git a/lib/nghttp2/bpf/Makefile.am b/lib/nghttp2-1.65.0/bpf/Makefile.am similarity index 100% rename from lib/nghttp2/bpf/Makefile.am rename to lib/nghttp2-1.65.0/bpf/Makefile.am diff --git a/lib/nghttp2-1.65.0/bpf/Makefile.in b/lib/nghttp2-1.65.0/bpf/Makefile.in new file mode 100644 index 00000000000..3a59e9a6253 --- /dev/null +++ b/lib/nghttp2-1.65.0/bpf/Makefile.in @@ -0,0 +1,608 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2021 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = bpf +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(bpf_pkglibdir)" +DATA = $(bpf_pkglib_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = CMakeLists.txt reuseport_kern.c +@HAVE_LIBBPF_TRUE@bpf_pkglibdir = $(pkglibdir) +@HAVE_LIBBPF_TRUE@bpf_pkglib_DATA = reuseport_kern.o +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bpf/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu bpf/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-bpf_pkglibDATA: $(bpf_pkglib_DATA) + @$(NORMAL_INSTALL) + @list='$(bpf_pkglib_DATA)'; test -n "$(bpf_pkglibdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bpf_pkglibdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bpf_pkglibdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(bpf_pkglibdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(bpf_pkglibdir)" || exit $$?; \ + done + +uninstall-bpf_pkglibDATA: + @$(NORMAL_UNINSTALL) + @list='$(bpf_pkglib_DATA)'; test -n "$(bpf_pkglibdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(bpf_pkglibdir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(bpf_pkglibdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +@HAVE_LIBBPF_FALSE@clean-local: +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-bpf_pkglibDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-bpf_pkglibDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-bpf_pkglibDATA install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-bpf_pkglibDATA + +.PRECIOUS: Makefile + + +@HAVE_LIBBPF_TRUE@all: $(builddir)/reuseport_kern.o + +@HAVE_LIBBPF_TRUE@$(builddir)/reuseport_kern.o: reuseport_kern.c +@HAVE_LIBBPF_TRUE@ $(CC) @LIBBPF_CFLAGS@ @BPFCFLAGS@ @EXTRABPFCFLAGS@ \ +@HAVE_LIBBPF_TRUE@ -target bpf -c $< -o $@ + +@HAVE_LIBBPF_TRUE@clean-local: +@HAVE_LIBBPF_TRUE@ -rm -f reuseport_kern.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/bpf/reuseport_kern.c b/lib/nghttp2-1.65.0/bpf/reuseport_kern.c similarity index 68% rename from lib/nghttp2/bpf/reuseport_kern.c rename to lib/nghttp2-1.65.0/bpf/reuseport_kern.c index 74c08c5aae1..6cbc82ff011 100644 --- a/lib/nghttp2/bpf/reuseport_kern.c +++ b/lib/nghttp2-1.65.0/bpf/reuseport_kern.c @@ -42,11 +42,6 @@ License is Public Domain. Commit hash: 12e7744b4919e9d55de75b7ab566326a1c8e7a67 */ -#define AES_BLOCKLEN \ - 16 /* Block length in bytes - AES is 128b block \ - only */ - -#define AES_KEYLEN 16 /* Key length in bytes */ #define AES_keyExpSize 176 struct AES_ctx { @@ -57,7 +52,6 @@ struct AES_ctx { in AES. Value=4 */ #define Nb 4 -#define Nk 4 /* The number of 32 bit words in a key. */ #define Nr 10 /* The number of rounds in AES Cipher. */ /* state - array holding the intermediate results during @@ -68,126 +62,27 @@ typedef __u8 state_t[4][4]; read-only storage instead of RAM The numbers below can be computed dynamically trading ROM for RAM - This can be useful in (embedded) bootloader applications, where ROM is often limited. */ -static const __u8 sbox[256] = { - /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ - 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, - 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, - 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, - 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, - 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, - 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, - 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, - 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, - 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, - 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, - 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, - 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, - 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, - 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, - 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, - 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, - 0xb0, 0x54, 0xbb, 0x16}; - static const __u8 rsbox[256] = { - 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, - 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, - 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, - 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, - 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, - 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, - 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, - 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, - 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, - 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, - 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, - 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, - 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, - 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, - 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, - 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, - 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, - 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, - 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, - 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, - 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, - 0x55, 0x21, 0x0c, 0x7d}; - -/* The round constant word array, Rcon[i], contains the values given - by x to the power (i-1) being powers of x (x is denoted as {02}) in - the field GF(2^8) */ -static const __u8 Rcon[11] = {0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, - 0x20, 0x40, 0x80, 0x1b, 0x36}; - -#define getSBoxValue(num) (sbox[(num)]) - -/* This function produces Nb(Nr+1) round keys. The round keys are used - in each round to decrypt the states. */ -static void KeyExpansion(__u8 *RoundKey, const __u8 *Key) { - unsigned i, j, k; - __u8 tempa[4]; /* Used for the column/row operations */ - - /* The first round key is the key itself. */ - for (i = 0; i < Nk; ++i) { - RoundKey[(i * 4) + 0] = Key[(i * 4) + 0]; - RoundKey[(i * 4) + 1] = Key[(i * 4) + 1]; - RoundKey[(i * 4) + 2] = Key[(i * 4) + 2]; - RoundKey[(i * 4) + 3] = Key[(i * 4) + 3]; - } - - /* All other round keys are found from the previous round keys. */ - for (i = Nk; i < Nb * (Nr + 1); ++i) { - { - k = (i - 1) * 4; - tempa[0] = RoundKey[k + 0]; - tempa[1] = RoundKey[k + 1]; - tempa[2] = RoundKey[k + 2]; - tempa[3] = RoundKey[k + 3]; - } - - if (i % Nk == 0) { - /* This function shifts the 4 bytes in a word to the left once. - [a0,a1,a2,a3] becomes [a1,a2,a3,a0] */ - - /* Function RotWord() */ - { - const __u8 u8tmp = tempa[0]; - tempa[0] = tempa[1]; - tempa[1] = tempa[2]; - tempa[2] = tempa[3]; - tempa[3] = u8tmp; - } - - /* SubWord() is a function that takes a four-byte input word and - applies the S-box to each of the four bytes to produce an - output word. */ - - /* Function Subword() */ - { - tempa[0] = getSBoxValue(tempa[0]); - tempa[1] = getSBoxValue(tempa[1]); - tempa[2] = getSBoxValue(tempa[2]); - tempa[3] = getSBoxValue(tempa[3]); - } - - tempa[0] = tempa[0] ^ Rcon[i / Nk]; - } - j = i * 4; - k = (i - Nk) * 4; - RoundKey[j + 0] = RoundKey[k + 0] ^ tempa[0]; - RoundKey[j + 1] = RoundKey[k + 1] ^ tempa[1]; - RoundKey[j + 2] = RoundKey[k + 2] ^ tempa[2]; - RoundKey[j + 3] = RoundKey[k + 3] ^ tempa[3]; - } -} - -static void AES_init_ctx(struct AES_ctx *ctx, const __u8 *key) { - KeyExpansion(ctx->RoundKey, key); -} + 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, + 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, + 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, + 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, + 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, + 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, + 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, + 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, + 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, + 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, + 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, + 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, + 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, + 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, + 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, + 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, + 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, + 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, + 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, + 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d}; /* This function adds the round key to state. The round key is added to the state by an XOR function. */ @@ -428,7 +323,7 @@ struct { __uint(max_entries, 255); __type(key, __u64); __type(value, __u32); -} cid_prefix_map SEC(".maps"); +} worker_id_map SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY); @@ -439,11 +334,18 @@ struct { struct { __uint(type, BPF_MAP_TYPE_ARRAY); - __uint(max_entries, 3); + __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); } sk_info SEC(".maps"); +struct { + __uint(type, BPF_MAP_TYPE_ARRAY); + __uint(max_entries, 1); + __type(key, __u32); + __type(value, struct AES_ctx); +} aes_key SEC(".maps"); + typedef struct quic_hd { __u8 *dcid; __u32 dcidlen; @@ -451,11 +353,11 @@ typedef struct quic_hd { __u8 type; } quic_hd; -#define SV_DCIDLEN 20 +#define SV_DCIDLEN 17 #define MAX_DCIDLEN 20 #define MIN_DCIDLEN 8 -#define CID_PREFIXLEN 8 -#define CID_PREFIX_OFFSET 1 +#define WORKER_IDLEN 8 +#define WORKER_ID_OFFSET 1 enum { NGTCP2_PKT_INITIAL = 0x0, @@ -573,54 +475,68 @@ static __u32 sk_index_from_dcid(const quic_hd *qhd, SEC("sk_reuseport") int select_reuseport(struct sk_reuseport_md *reuse_md) { __u32 sk_index, *psk_index; - __u64 *pnum_socks, *pkey; - __u32 zero = 0, key_high_idx = 1, key_low_idx = 2; + __u64 *pnum_socks; + __u32 zero = 0; int rv; quic_hd qhd; __u8 qpktbuf[6 + MAX_DCIDLEN]; - struct AES_ctx aes_ctx; - __u8 key[AES_KEYLEN]; - __u8 *cid_prefix; + struct AES_ctx *aes_ctx; + __u8 *worker_id; + __u16 remote_port; + __u8 *data = reuse_md->data; - if (bpf_skb_load_bytes(reuse_md, sizeof(struct udphdr), qpktbuf, - sizeof(qpktbuf)) != 0) { + /* Packets less than 22 bytes never be a valid QUIC packet. */ + if (reuse_md->len < sizeof(struct udphdr) + 22) { return SK_DROP; } - pnum_socks = bpf_map_lookup_elem(&sk_info, &zero); - if (pnum_socks == NULL) { + if (reuse_md->data + sizeof(struct udphdr) > reuse_md->data_end) { return SK_DROP; } - pkey = bpf_map_lookup_elem(&sk_info, &key_high_idx); - if (pkey == NULL) { + remote_port = (data[0] << 8) + data[1]; + + switch (remote_port) { + case 1900: + case 5353: + case 11211: + case 20800: + case 27015: return SK_DROP; + default: + if (remote_port < 1024) { + return SK_DROP; + } } - __builtin_memcpy(key, pkey, sizeof(*pkey)); + if (bpf_skb_load_bytes(reuse_md, sizeof(struct udphdr), qpktbuf, + sizeof(qpktbuf)) != 0) { + return SK_DROP; + } - pkey = bpf_map_lookup_elem(&sk_info, &key_low_idx); - if (pkey == NULL) { + pnum_socks = bpf_map_lookup_elem(&sk_info, &zero); + if (pnum_socks == NULL) { return SK_DROP; } - __builtin_memcpy(key + sizeof(*pkey), pkey, sizeof(*pkey)); + aes_ctx = bpf_map_lookup_elem(&aes_key, &zero); + if (aes_ctx == NULL) { + return SK_DROP; + } rv = parse_quic(&qhd, qpktbuf, qpktbuf + sizeof(qpktbuf)); if (rv != 0) { return SK_DROP; } - AES_init_ctx(&aes_ctx, key); - switch (qhd.type) { case NGTCP2_PKT_INITIAL: case NGTCP2_PKT_0RTT: if (qhd.dcidlen == SV_DCIDLEN) { - cid_prefix = qhd.dcid + CID_PREFIX_OFFSET; - AES_ECB_decrypt(&aes_ctx, cid_prefix); + worker_id = qhd.dcid + WORKER_ID_OFFSET; + AES_ECB_decrypt(aes_ctx, worker_id); - psk_index = bpf_map_lookup_elem(&cid_prefix_map, cid_prefix); + psk_index = bpf_map_lookup_elem(&worker_id_map, worker_id); if (psk_index != NULL) { sk_index = *psk_index; @@ -637,10 +553,10 @@ int select_reuseport(struct sk_reuseport_md *reuse_md) { return SK_DROP; } - cid_prefix = qhd.dcid + CID_PREFIX_OFFSET; - AES_ECB_decrypt(&aes_ctx, cid_prefix); + worker_id = qhd.dcid + WORKER_ID_OFFSET; + AES_ECB_decrypt(aes_ctx, worker_id); - psk_index = bpf_map_lookup_elem(&cid_prefix_map, cid_prefix); + psk_index = bpf_map_lookup_elem(&worker_id_map, worker_id); if (psk_index == NULL) { sk_index = sk_index_from_dcid(&qhd, reuse_md, *pnum_socks); diff --git a/lib/nghttp2/cmake/ExtractValidFlags.cmake b/lib/nghttp2-1.65.0/cmake/ExtractValidFlags.cmake similarity index 100% rename from lib/nghttp2/cmake/ExtractValidFlags.cmake rename to lib/nghttp2-1.65.0/cmake/ExtractValidFlags.cmake diff --git a/lib/nghttp2/cmake/FindJansson.cmake b/lib/nghttp2-1.65.0/cmake/FindJansson.cmake similarity index 100% rename from lib/nghttp2/cmake/FindJansson.cmake rename to lib/nghttp2-1.65.0/cmake/FindJansson.cmake diff --git a/lib/nghttp2/cmake/FindJemalloc.cmake b/lib/nghttp2-1.65.0/cmake/FindJemalloc.cmake similarity index 100% rename from lib/nghttp2/cmake/FindJemalloc.cmake rename to lib/nghttp2-1.65.0/cmake/FindJemalloc.cmake diff --git a/lib/nghttp2/cmake/FindLibbpf.cmake b/lib/nghttp2-1.65.0/cmake/FindLibbpf.cmake similarity index 100% rename from lib/nghttp2/cmake/FindLibbpf.cmake rename to lib/nghttp2-1.65.0/cmake/FindLibbpf.cmake diff --git a/lib/nghttp2-1.65.0/cmake/FindLibbrotlidec.cmake b/lib/nghttp2-1.65.0/cmake/FindLibbrotlidec.cmake new file mode 100644 index 00000000000..59066c6401d --- /dev/null +++ b/lib/nghttp2-1.65.0/cmake/FindLibbrotlidec.cmake @@ -0,0 +1,36 @@ +# - Try to find libbrotlidec +# Once done this will define +# LIBBROTLIDEC_FOUND - System has libbrotlidec +# LIBBROTLIDEC_INCLUDE_DIRS - The libbrotlidec include directories +# LIBBROTLIDEC_LIBRARIES - The libraries needed to use libbrotlidec + +find_package(PkgConfig QUIET) +pkg_check_modules(PC_LIBBROTLIDEC QUIET libbrotlidec) + +find_path(LIBBROTLIDEC_INCLUDE_DIR + NAMES brotli/decode.h + HINTS ${PC_LIBBROTLIDEC_INCLUDE_DIRS} +) +find_library(LIBBROTLIDEC_LIBRARY + NAMES brotlidec + HINTS ${PC_LIBBROTLIDEC_LIBRARY_DIRS} +) + +if(PC_LIBBROTLIDEC_FOUND) + set(LIBBROTLIDEC_VERSION ${PC_LIBBROTLIDEC_VERSION}) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LIBBROTLIDEC_FOUND +# to TRUE if all listed variables are TRUE and the requested version +# matches. +find_package_handle_standard_args(Libbrotlidec REQUIRED_VARS + LIBBROTLIDEC_LIBRARY LIBBROTLIDEC_INCLUDE_DIR + VERSION_VAR LIBBROTLIDEC_VERSION) + +if(LIBBROTLIDEC_FOUND) + set(LIBBROTLIDEC_LIBRARIES ${LIBBROTLIDEC_LIBRARY}) + set(LIBBROTLIDEC_INCLUDE_DIRS ${LIBBROTLIDEC_INCLUDE_DIR}) +endif() + +mark_as_advanced(LIBBROTLIDEC_INCLUDE_DIR LIBBROTLIDEC_LIBRARY) diff --git a/lib/nghttp2-1.65.0/cmake/FindLibbrotlienc.cmake b/lib/nghttp2-1.65.0/cmake/FindLibbrotlienc.cmake new file mode 100644 index 00000000000..acf63343cbf --- /dev/null +++ b/lib/nghttp2-1.65.0/cmake/FindLibbrotlienc.cmake @@ -0,0 +1,36 @@ +# - Try to find libbrotlienc +# Once done this will define +# LIBBROTLIENC_FOUND - System has libbrotlienc +# LIBBROTLIENC_INCLUDE_DIRS - The libbrotlienc include directories +# LIBBROTLIENC_LIBRARIES - The libraries needed to use libbrotlienc + +find_package(PkgConfig QUIET) +pkg_check_modules(PC_LIBBROTLIENC QUIET libbrotlienc) + +find_path(LIBBROTLIENC_INCLUDE_DIR + NAMES brotli/encode.h + HINTS ${PC_LIBBROTLIENC_INCLUDE_DIRS} +) +find_library(LIBBROTLIENC_LIBRARY + NAMES brotlienc + HINTS ${PC_LIBBROTLIENC_LIBRARY_DIRS} +) + +if(PC_LIBBROTLIENC_FOUND) + set(LIBBROTLIENC_VERSION ${PC_LIBBROTLIENC_VERSION}) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LIBBROTLIENC_FOUND +# to TRUE if all listed variables are TRUE and the requested version +# matches. +find_package_handle_standard_args(Libbrotlienc REQUIRED_VARS + LIBBROTLIENC_LIBRARY LIBBROTLIENC_INCLUDE_DIR + VERSION_VAR LIBBROTLIENC_VERSION) + +if(LIBBROTLIENC_FOUND) + set(LIBBROTLIENC_LIBRARIES ${LIBBROTLIENC_LIBRARY}) + set(LIBBROTLIENC_INCLUDE_DIRS ${LIBBROTLIENC_INCLUDE_DIR}) +endif() + +mark_as_advanced(LIBBROTLIENC_INCLUDE_DIR LIBBROTLIENC_LIBRARY) diff --git a/lib/nghttp2/cmake/FindLibcares.cmake b/lib/nghttp2-1.65.0/cmake/FindLibcares.cmake similarity index 62% rename from lib/nghttp2/cmake/FindLibcares.cmake rename to lib/nghttp2-1.65.0/cmake/FindLibcares.cmake index 1fe56ce7021..e4f66db800a 100644 --- a/lib/nghttp2/cmake/FindLibcares.cmake +++ b/lib/nghttp2-1.65.0/cmake/FindLibcares.cmake @@ -17,12 +17,18 @@ find_library(LIBCARES_LIBRARY ) if(LIBCARES_INCLUDE_DIR) - set(_version_regex "^#define[ \t]+ARES_VERSION_STR[ \t]+\"([^\"]+)\".*") - file(STRINGS "${LIBCARES_INCLUDE_DIR}/ares_version.h" - LIBCARES_VERSION REGEX "${_version_regex}") - string(REGEX REPLACE "${_version_regex}" "\\1" - LIBCARES_VERSION "${LIBCARES_VERSION}") - unset(_version_regex) + file(READ "${LIBCARES_INCLUDE_DIR}/ares_version.h" _ares_version_h) + string(REGEX REPLACE ".*#define[ \t]+ARES_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" + _ares_version_major ${_ares_version_h}) + string(REGEX REPLACE ".*#define[ \t]+ARES_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" + _ares_version_minor ${_ares_version_h}) + string(REGEX REPLACE ".*#define[ \t]+ARES_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" + _ares_version_patch ${_ares_version_h}) + set(LIBCARES_VERSION "${_ares_version_major}.${_ares_version_minor}.${_ares_version_patch}") + unset(_ares_version_patch) + unset(_ares_version_minor) + unset(_ares_version_major) + unset(_ares_version_h) endif() include(FindPackageHandleStandardArgs) diff --git a/lib/nghttp2/cmake/FindLibev.cmake b/lib/nghttp2-1.65.0/cmake/FindLibev.cmake similarity index 100% rename from lib/nghttp2/cmake/FindLibev.cmake rename to lib/nghttp2-1.65.0/cmake/FindLibev.cmake diff --git a/lib/nghttp2/cmake/FindLibevent.cmake b/lib/nghttp2-1.65.0/cmake/FindLibevent.cmake similarity index 100% rename from lib/nghttp2/cmake/FindLibevent.cmake rename to lib/nghttp2-1.65.0/cmake/FindLibevent.cmake diff --git a/lib/nghttp2/cmake/FindLibnghttp3.cmake b/lib/nghttp2-1.65.0/cmake/FindLibnghttp3.cmake similarity index 100% rename from lib/nghttp2/cmake/FindLibnghttp3.cmake rename to lib/nghttp2-1.65.0/cmake/FindLibnghttp3.cmake diff --git a/lib/nghttp2/cmake/FindLibngtcp2.cmake b/lib/nghttp2-1.65.0/cmake/FindLibngtcp2.cmake similarity index 100% rename from lib/nghttp2/cmake/FindLibngtcp2.cmake rename to lib/nghttp2-1.65.0/cmake/FindLibngtcp2.cmake diff --git a/lib/nghttp2/cmake/FindLibngtcp2_crypto_quictls.cmake b/lib/nghttp2-1.65.0/cmake/FindLibngtcp2_crypto_quictls.cmake similarity index 100% rename from lib/nghttp2/cmake/FindLibngtcp2_crypto_quictls.cmake rename to lib/nghttp2-1.65.0/cmake/FindLibngtcp2_crypto_quictls.cmake diff --git a/lib/nghttp2-1.65.0/cmake/FindLibngtcp2_crypto_wolfssl.cmake b/lib/nghttp2-1.65.0/cmake/FindLibngtcp2_crypto_wolfssl.cmake new file mode 100644 index 00000000000..8a82f73152a --- /dev/null +++ b/lib/nghttp2-1.65.0/cmake/FindLibngtcp2_crypto_wolfssl.cmake @@ -0,0 +1,43 @@ +# - Try to find libngtcp2_crypto_wolfssl +# Once done this will define +# LIBNGTCP2_CRYPTO_WOLFSSL_FOUND - System has libngtcp2_crypto_wolfssl +# LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIRS - The libngtcp2_crypto_wolfssl include directories +# LIBNGTCP2_CRYPTO_WOLFSSL_LIBRARIES - The libraries needed to use libngtcp2_crypto_wolfssl + +find_package(PkgConfig QUIET) +pkg_check_modules(PC_LIBNGTCP2_CRYPTO_WOLFSSL QUIET libngtcp2_crypto_wolfssl) + +find_path(LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIR + NAMES ngtcp2/ngtcp2_crypto_wolfssl.h + HINTS ${PC_LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIRS} +) +find_library(LIBNGTCP2_CRYPTO_WOLFSSL_LIBRARY + NAMES ngtcp2_crypto_wolfssl + HINTS ${PC_LIBNGTCP2_CRYPTO_WOLFSSL_LIBRARY_DIRS} +) + +if(LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIR) + set(_version_regex "^#define[ \t]+NGTCP2_VERSION[ \t]+\"([^\"]+)\".*") + file(STRINGS "${LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIR}/ngtcp2/version.h" + LIBNGTCP2_CRYPTO_WOLFSSL_VERSION REGEX "${_version_regex}") + string(REGEX REPLACE "${_version_regex}" "\\1" + LIBNGTCP2_CRYPTO_WOLFSSL_VERSION "${LIBNGTCP2_CRYPTO_WOLFSSL_VERSION}") + unset(_version_regex) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set +# LIBNGTCP2_CRYPTO_WOLFSSL_FOUND to TRUE if all listed variables are +# TRUE and the requested version matches. +find_package_handle_standard_args(Libngtcp2_crypto_wolfssl REQUIRED_VARS + LIBNGTCP2_CRYPTO_WOLFSSL_LIBRARY + LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIR + VERSION_VAR LIBNGTCP2_CRYPTO_WOLFSSL_VERSION) + +if(LIBNGTCP2_CRYPTO_WOLFSSL_FOUND) + set(LIBNGTCP2_CRYPTO_WOLFSSL_LIBRARIES ${LIBNGTCP2_CRYPTO_WOLFSSL_LIBRARY}) + set(LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIRS ${LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIR}) +endif() + +mark_as_advanced(LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIR + LIBNGTCP2_CRYPTO_WOLFSSL_LIBRARY) diff --git a/lib/nghttp2/cmake/FindSystemd.cmake b/lib/nghttp2-1.65.0/cmake/FindSystemd.cmake similarity index 100% rename from lib/nghttp2/cmake/FindSystemd.cmake rename to lib/nghttp2-1.65.0/cmake/FindSystemd.cmake diff --git a/lib/nghttp2-1.65.0/cmake/FindWolfSSL.cmake b/lib/nghttp2-1.65.0/cmake/FindWolfSSL.cmake new file mode 100644 index 00000000000..084e184b4a0 --- /dev/null +++ b/lib/nghttp2-1.65.0/cmake/FindWolfSSL.cmake @@ -0,0 +1,41 @@ +# - Try to find wolfssl +# Once done this will define +# WOLFSSL_FOUND - System has wolfssl +# WOLFSSL_INCLUDE_DIRS - The wolfssl include directories +# WOLFSSL_LIBRARIES - The libraries needed to use wolfssl + +find_package(PkgConfig QUIET) +pkg_check_modules(PC_WOLFSSL QUIET wolfssl) + +find_path(WOLFSSL_INCLUDE_DIR + NAMES wolfssl/ssl.h + HINTS ${PC_WOLFSSL_INCLUDE_DIRS} +) +find_library(WOLFSSL_LIBRARY + NAMES wolfssl + HINTS ${PC_WOLFSSL_LIBRARY_DIRS} +) + +if(WOLFSSL_INCLUDE_DIR) + set(_version_regex "^#define[ \t]+LIBWOLFSSL_VERSION_STRING[ \t]+\"([^\"]+)\".*") + file(STRINGS "${WOLFSSL_INCLUDE_DIR}/wolfssl/version.h" + WOLFSSL_VERSION REGEX "${_version_regex}") + string(REGEX REPLACE "${_version_regex}" "\\1" + WOLFSSL_VERSION "${WOLFSSL_VERSION}") + unset(_version_regex) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set WOLFSSL_FOUND +# to TRUE if all listed variables are TRUE and the requested version +# matches. +find_package_handle_standard_args(WolfSSL REQUIRED_VARS + WOLFSSL_LIBRARY WOLFSSL_INCLUDE_DIR + VERSION_VAR WOLFSSL_VERSION) + +if(WOLFSSL_FOUND) + set(WOLFSSL_LIBRARIES ${WOLFSSL_LIBRARY}) + set(WOLFSSL_INCLUDE_DIRS ${WOLFSSL_INCLUDE_DIR}) +endif() + +mark_as_advanced(WOLFSSL_INCLUDE_DIR WOLFSSL_LIBRARY) diff --git a/lib/nghttp2/cmake/PickyWarningsC.cmake b/lib/nghttp2-1.65.0/cmake/PickyWarningsC.cmake similarity index 99% rename from lib/nghttp2/cmake/PickyWarningsC.cmake rename to lib/nghttp2-1.65.0/cmake/PickyWarningsC.cmake index 50eb7891802..6a5ee27d046 100644 --- a/lib/nghttp2/cmake/PickyWarningsC.cmake +++ b/lib/nghttp2-1.65.0/cmake/PickyWarningsC.cmake @@ -85,7 +85,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MA -Wstrict-prototypes # clang 1.0 gcc 3.3 # -Wswitch-enum # clang 3.0 gcc 4.1 # Not used because this basically disallows default case -Wunreachable-code # clang 3.0 gcc 4.1 - -Wunused-macros # clang 3.0 gcc 4.1 -Wunused-parameter # clang 3.0 gcc 4.1 -Wvla # clang 2.8 gcc 4.3 ) diff --git a/lib/nghttp2/cmake/PickyWarningsCXX.cmake b/lib/nghttp2-1.65.0/cmake/PickyWarningsCXX.cmake similarity index 96% rename from lib/nghttp2/cmake/PickyWarningsCXX.cmake rename to lib/nghttp2-1.65.0/cmake/PickyWarningsCXX.cmake index 4699733d25a..c253ac6b264 100644 --- a/lib/nghttp2/cmake/PickyWarningsCXX.cmake +++ b/lib/nghttp2-1.65.0/cmake/PickyWarningsCXX.cmake @@ -58,6 +58,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID list(APPEND WPICKY_ENABLE ${WPICKY_COMMON_OLD} ) + list(APPEND WPICKY_ENABLE + # clang++-18 warns this when building with wolfSSL >= v5.7.6-stable. + -Wno-extern-c-compat + ) # Enable based on compiler version if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6) OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.3)) diff --git a/lib/nghttp2/cmake/Version.cmake b/lib/nghttp2-1.65.0/cmake/Version.cmake similarity index 100% rename from lib/nghttp2/cmake/Version.cmake rename to lib/nghttp2-1.65.0/cmake/Version.cmake diff --git a/lib/nghttp2/cmakeconfig.h.in b/lib/nghttp2-1.65.0/cmakeconfig.h.in similarity index 88% rename from lib/nghttp2/cmakeconfig.h.in rename to lib/nghttp2-1.65.0/cmakeconfig.h.in index 765a72a5c84..385125dc1b1 100644 --- a/lib/nghttp2/cmakeconfig.h.in +++ b/lib/nghttp2-1.65.0/cmakeconfig.h.in @@ -19,12 +19,6 @@ /* Define to 1 if you have `neverbleed` library. */ #cmakedefine HAVE_NEVERBLEED 1 -/* sizeof(int *) */ -#cmakedefine SIZEOF_INT_P @SIZEOF_INT_P@ - -/* sizeof(time_t) */ -#cmakedefine SIZEOF_TIME_T @SIZEOF_TIME_T@ - /* Define to 1 if you have the `_Exit` function. */ #cmakedefine HAVE__EXIT 1 @@ -37,6 +31,9 @@ /* Define to 1 if you have the `mkostemp` function. */ #cmakedefine HAVE_MKOSTEMP 1 +/* Define to 1 if you have the `pipe2` function. */ +#cmakedefine HAVE_PIPE2 1 + /* Define to 1 if you have the `GetTickCount64` function. */ #cmakedefine HAVE_GETTICKCOUNT64 1 @@ -85,9 +82,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYSLOG_H 1 -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_TIME_H 1 - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UNISTD_H 1 @@ -106,5 +100,14 @@ /* Define to 1 if you have `libngtcp2_crypto_quictls` library. */ #cmakedefine HAVE_LIBNGTCP2_CRYPTO_QUICTLS +/* Define to 1 if you have `libngtcp2_crypto_wolfssl` library. */ +#cmakedefine HAVE_LIBNGTCP2_CRYPTO_WOLFSSL 1 + /* Define to 1 if you have `libev` library. */ #cmakedefine HAVE_LIBEV 1 + +/* Define to 1 if you have `libbrotlienc` and `libbrotlidec` libraries. */ +#cmakedefine HAVE_LIBBROTLI 1 + +/* Define to 1 if you have `wolfssl` library. */ +#cmakedefine HAVE_WOLFSSL 1 diff --git a/lib/nghttp2-1.65.0/compile b/lib/nghttp2-1.65.0/compile new file mode 100755 index 00000000000..df363c8fbfb --- /dev/null +++ b/lib/nghttp2-1.65.0/compile @@ -0,0 +1,348 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN* | MSYS*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/* | msys/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/lib/nghttp2-1.65.0/config.guess b/lib/nghttp2-1.65.0/config.guess new file mode 100755 index 00000000000..7f76b6228f7 --- /dev/null +++ b/lib/nghttp2-1.65.0/config.guess @@ -0,0 +1,1754 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2022 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-01-09' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to . + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2022 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# Just in case it came from the environment. +GUESS= + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if test -f /.attbin/uname ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case $UNAME_SYSTEM in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case $UNAME_VERSION in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + GUESS=$machine-${os}${release}${abi-} + ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; + *:ekkoBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; + *:SolidBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; + macppc:MirBSD:*:*) + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; + *:MirBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case $ALPHA_CPU_TYPE in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; + Amiga*:UNIX_System_V:4.0:*) + GUESS=m68k-unknown-sysv4 + ;; + *:[Aa]miga[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; + *:[Mm]orph[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-morphos + ;; + *:OS/390:*:*) + GUESS=i370-ibm-openedition + ;; + *:z/VM:*:*) + GUESS=s390-ibm-zvmoe + ;; + *:OS400:*:*) + GUESS=powerpc-ibm-os400 + ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + GUESS=arm-unknown-riscos + ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + GUESS=hppa1.1-hitachi-hiuxmpp + ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; + NILE*:*:*:dcosx) + GUESS=pyramid-pyramid-svr4 + ;; + DRS?6000:unix:4.0:6*) + GUESS=sparc-icl-nx6 + ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; + s390x:SunOS:*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; + sun4H:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; + sun4*:SunOS:*:*) + case `/usr/bin/arch -k` in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; + sun3*:SunOS:*:*) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in + sun3) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun4) + GUESS=sparc-sun-sunos$UNAME_RELEASE + ;; + esac + ;; + aushp:SunOS:*:*) + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; + m68k:machten:*:*) + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; + powerpc:machten:*:*) + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; + RISC*:Mach:*:*) + GUESS=mips-dec-mach_bsd4.3 + ;; + RISC*:ULTRIX:*:*) + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; + VAX*:ULTRIX*:*:*) + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; + Motorola:PowerMAX_OS:*:*) + GUESS=powerpc-motorola-powermax + ;; + Motorola:*:4.3:PL8-*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:Power_UNIX:*:*) + GUESS=powerpc-harris-powerunix + ;; + m88k:CX/UX:7*:*) + GUESS=m88k-harris-cxux7 + ;; + m88k:*:4*:R4*) + GUESS=m88k-motorola-sysv4 + ;; + m88k:*:3*:R3*) + GUESS=m88k-motorola-sysv3 + ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + GUESS=m88k-dg-dgux$UNAME_RELEASE + else + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE + fi + else + GUESS=i586-dg-dgux$UNAME_RELEASE + fi + ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + GUESS=m88k-dolphin-sysv3 + ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + GUESS=m88k-motorola-sysv3 + ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + GUESS=m88k-tektronix-sysv3 + ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + GUESS=m68k-tektronix-bsd + ;; + *:IRIX*:*:*) + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + GUESS=i386-ibm-aix + ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + GUESS=$SYSTEM_NAME + else + GUESS=rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + GUESS=rs6000-ibm-aix3.2.4 + else + GUESS=rs6000-ibm-aix3.2 + fi + ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; + *:AIX:*:*) + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + GUESS=rs6000-bull-bosx + ;; + DPX/2?00:B.O.S.:*:*) + GUESS=m68k-bull-sysv3 + ;; + 9000/[34]??:4.3bsd:1.*:*) + GUESS=m68k-hp-bsd + ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + GUESS=m68k-hp-bsd4.4 + ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if test -x /usr/bin/getconf; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; + 9000/8??:4.3bsd:*:*) + GUESS=hppa1.0-hp-bsd + ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; + hp8??:OSF1:*:*) + GUESS=hppa1.0-hp-osf + ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk + else + GUESS=$UNAME_MACHINE-unknown-osf1 + fi + ;; + parisc*:Lites*:*:*) + GUESS=hppa1.1-hp-lites + ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + GUESS=c1-convex-bsd + ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + GUESS=c34-convex-bsd + ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + GUESS=c38-convex-bsd + ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + GUESS=c4-convex-bsd + ;; + CRAY*Y-MP:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; + CRAY*T3E:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; + CRAY*SV1:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; + *:UNICOS/mp:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; + sparc*:BSD/OS:*:*) + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; + *:BSD/OS:*:*) + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; + i*:CYGWIN*:*) + GUESS=$UNAME_MACHINE-pc-cygwin + ;; + *:MINGW64*:*) + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; + *:MINGW*:*) + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; + i*:PW*:*) + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + GUESS=i586-pc-interix$UNAME_RELEASE + ;; + authenticamd | genuineintel | EM64T) + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; + IA64) + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; + esac ;; + i*:UWIN*:*) + GUESS=$UNAME_MACHINE-pc-uwin + ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + GUESS=x86_64-pc-cygwin + ;; + prep*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; + *:GNU:*:*) + # the GNU system + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; + aarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi + else + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf + fi + fi + ;; + avr32*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + cris:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + crisv32:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + frv:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + hexagon:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:Linux:*:*) + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; + ia64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m32r*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m68*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + padre:Linux:*:*) + GUESS=sparc-unknown-linux-$LIBC + ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + GUESS=hppa64-unknown-linux-$LIBC + ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; + esac + ;; + ppc64:Linux:*:*) + GUESS=powerpc64-unknown-linux-$LIBC + ;; + ppc:Linux:*:*) + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + s390:Linux:*:* | s390x:Linux:*:*) + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; + sh64*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sh*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + vax:Linux:*:*) + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; + x86_64:Linux:*:*) + set_cc_for_build + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI=${LIBC}x32 + fi + fi + GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI + ;; + xtensa*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + GUESS=i386-sequent-sysv4 + ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; + i*86:XTS-300:*:STOP) + GUESS=$UNAME_MACHINE-unknown-stop + ;; + i*86:atheos:*:*) + GUESS=$UNAME_MACHINE-unknown-atheos + ;; + i*86:syllable:*:*) + GUESS=$UNAME_MACHINE-pc-syllable + ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; + i*86:*DOS:*:*) + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL + fi + ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv32 + fi + ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + GUESS=i586-pc-msdosdjgpp + ;; + Intel:Mach:3*:*) + GUESS=i386-pc-mach3 + ;; + paragon:*:*:*) + GUESS=i860-intel-osf1 + ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 + fi + ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + GUESS=m68010-convergent-sysv + ;; + mc68k:UNIX:SYSTEM5:3.51m) + GUESS=m68k-convergent-sysv + ;; + M680?0:D-NIX:5.3:*) + GUESS=m68k-diab-dnix + ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; + mc68030:UNIX_System_V:4.*:*) + GUESS=m68k-atari-sysv4 + ;; + TSUNAMI:LynxOS:2.*:*) + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; + rs6000:LynxOS:2.*:*) + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; + SM[BE]S:UNIX_SV:*:*) + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; + RM*:ReliantUNIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + RM*:SINIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 + else + GUESS=ns32k-sni-sysv + fi + ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + GUESS=i586-unisys-sysv4 + ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + GUESS=hppa1.1-stratus-sysv4 + ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + GUESS=i860-stratus-sysv4 + ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=$UNAME_MACHINE-stratus-vos + ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=hppa1.1-stratus-vos + ;; + mc68*:A/UX:*:*) + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; + news*:NEWS-OS:6*:*) + GUESS=mips-sony-newsos6 + ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE + else + GUESS=mips-unknown-sysv$UNAME_RELEASE + fi + ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + GUESS=powerpc-be-beos + ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + GUESS=powerpc-apple-beos + ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + GUESS=i586-pc-beos + ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; + x86_64:Haiku:*:*) + GUESS=x86_64-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; + SX-5:SUPER-UX:*:*) + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; + SX-6:SUPER-UX:*:*) + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; + SX-7:SUPER-UX:*:*) + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; + SX-8:SUPER-UX:*:*) + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; + SX-8R:SUPER-UX:*:*) + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; + Power*:Rhapsody:*:*) + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; + *:Rhapsody:*:*) + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; + *:QNX:*:4*) + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; + NSE-*:NONSTOP_KERNEL:*:*) + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; + *:NonStop-UX:*:*) + GUESS=mips-compaq-nonstopux + ;; + BS2000:POSIX*:*:*) + GUESS=bs2000-siemens-sysv + ;; + DS/*:UNIX_System_V:*:*) + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "${cputype-}" = 386; then + UNAME_MACHINE=i386 + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype + fi + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; + *:TOPS-10:*:*) + GUESS=pdp10-unknown-tops10 + ;; + *:TENEX:*:*) + GUESS=pdp10-unknown-tenex + ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + GUESS=pdp10-dec-tops20 + ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + GUESS=pdp10-xkl-tops20 + ;; + *:TOPS-20:*:*) + GUESS=pdp10-unknown-tops20 + ;; + *:ITS:*:*) + GUESS=pdp10-unknown-its + ;; + SEI:*:*:SEIUX) + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; + *:DragonFly:*:*) + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; + esac ;; + *:XENIX:*:SysV) + GUESS=i386-pc-xenix + ;; + i*86:skyos:*:*) + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; + i*86:rdos:*:*) + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; + x86_64:VMkernel:*:*) + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; +esac + +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 <&2 </dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/lib/nghttp2-1.65.0/config.h.in b/lib/nghttp2-1.65.0/config.h.in new file mode 100644 index 00000000000..b5ede1deb03 --- /dev/null +++ b/lib/nghttp2-1.65.0/config.h.in @@ -0,0 +1,475 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Define to 1 to enable debug output. */ +#undef DEBUGBUILD + +/* Define to 1 if HTTP/3 is enabled. */ +#undef ENABLE_HTTP3 + +/* Define to 1 if you have the `accept4' function. */ +#undef HAVE_ACCEPT4 + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the std::atomic> is supported. + */ +#undef HAVE_ATOMIC_STD_SHARED_PTR + +/* Define to 1 if you have enum bpf_stats_type in linux/bpf.h. */ +#undef HAVE_BPF_STATS_TYPE + +/* Define to 1 if your system has a working `chown' function. */ +#undef HAVE_CHOWN + +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + +/* define if the compiler supports basic C++20 syntax */ +#undef HAVE_CXX20 + +/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if + you don't. */ +#undef HAVE_DECL_CLOCK_MONOTONIC + +/* Define to 1 if you have the declaration of `initgroups', and to 0 if you + don't. */ +#undef HAVE_DECL_INITGROUPS + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `dup2' function. */ +#undef HAVE_DUP2 + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getpwnam' function. */ +#undef HAVE_GETPWNAM + +/* Define to 1 if you have `GetTickCount64` function. */ +#undef HAVE_GETTICKCOUNT64 + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have `libjansson` library. */ +#undef HAVE_JANSSON + +/* Define to 1 if you have `libbpf` library. */ +#undef HAVE_LIBBPF + +/* Define to 1 if you have `libbrotlienc` and `libbrotlidec` libraries. */ +#undef HAVE_LIBBROTLI + +/* Define to 1 if you have `libev` library. */ +#undef HAVE_LIBEV + +/* Define to 1 if you have `libngtcp2_crypto_boringssl` library. */ +#undef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL + +/* Define to 1 if you have `libngtcp2_crypto_quictls` library. */ +#undef HAVE_LIBNGTCP2_CRYPTO_QUICTLS + +/* Define to 1 if you have `libngtcp2_crypto_wolfssl` library. */ +#undef HAVE_LIBNGTCP2_CRYPTO_WOLFSSL + +/* Define to 1 if you have `libsystemd` library. */ +#undef HAVE_LIBSYSTEMD + +/* Define to 1 if you have `libxml2` library. */ +#undef HAVE_LIBXML2 + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the `localtime_r' function. */ +#undef HAVE_LOCALTIME_R + +/* Define to 1 if you have the `memchr' function. */ +#undef HAVE_MEMCHR + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the header file. */ +#undef HAVE_MINIX_CONFIG_H + +/* Define to 1 if you have the `mkostemp' function. */ +#undef HAVE_MKOSTEMP + +/* Define to 1 if you have `mruby` library. */ +#undef HAVE_MRUBY + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* Define to 1 if you have `neverbleed` library. */ +#undef HAVE_NEVERBLEED + +/* Define to 1 if you have the `pipe2' function. */ +#undef HAVE_PIPE2 + +/* Define to 1 if the system has the type `ptrdiff_t'. */ +#undef HAVE_PTRDIFF_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if struct sockaddr_in6 has sin6_len member. */ +#undef HAVE_SOCKADDR_IN6_SIN6_LEN + +/* Define to 1 if struct sockaddr_in has sin_len member. */ +#undef HAVE_SOCKADDR_IN_SIN_LEN + +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* Define to 1 if you have the `sqrt' function. */ +#undef HAVE_SQRT + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `std::future`. */ +#undef HAVE_STD_FUTURE + +/* Define to 1 if you have the `std::map::emplace`. */ +#undef HAVE_STD_MAP_EMPLACE + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define if you have `strerror_r'. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strndup' function. */ +#undef HAVE_STRNDUP + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define to 1 if you have `struct tm.tm_gmtoff` member. */ +#undef HAVE_STRUCT_TM_TM_GMTOFF + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSLOG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have thread_local storage specifier. */ +#undef HAVE_THREAD_LOCAL + +/* Define to 1 if you have the `timegm' function. */ +#undef HAVE_TIMEGM + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINDOWS_H + +/* Define to 1 if you have 'wolfssl' library. */ +#undef HAVE_WOLFSSL + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if you have the `_Exit' function. */ +#undef HAVE__EXIT + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#undef LT_OBJDIR + +/* Define to 1 if assertions should be disabled. */ +#undef NDEBUG + +/* Hint to the compiler that a function never return */ +#undef NGHTTP2_NORETURN + +/* Define to 1 if you want to disable threads. */ +#undef NOTHREADS + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Define to 1 if strerror_r returns char *. */ +#undef STRERROR_R_CHAR_P + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif + + +/* Version number of package */ +#undef VERSION + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + +/* Define to `int' if doesn't define. */ +#undef gid_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef int16_t + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef int32_t + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef int64_t + +/* Define to the type of a signed integer type of width exactly 8 bits if such + a type exists and the standard includes do not define it. */ +#undef int8_t + +/* Define to `long int' if does not define. */ +#undef off_t + +/* Define as a signed integer type capable of holding a process identifier. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to `int' if doesn't define. */ +#undef uid_t + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef uint16_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef uint64_t + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#undef uint8_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork diff --git a/lib/nghttp2-1.65.0/config.sub b/lib/nghttp2-1.65.0/config.sub new file mode 100755 index 00000000000..dba16e84c77 --- /dev/null +++ b/lib/nghttp2-1.65.0/config.sub @@ -0,0 +1,1890 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2022 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-01-03' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2022 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x$basic_os != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/lib/nghttp2-1.65.0/configure b/lib/nghttp2-1.65.0/configure new file mode 100755 index 00000000000..ae51a4e54eb --- /dev/null +++ b/lib/nghttp2-1.65.0/configure @@ -0,0 +1,30770 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.71 for nghttp2 1.65.0. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else \$as_nop + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else \$as_nop + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else $as_nop + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and +$0: t-tujikawa@users.sourceforge.net about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='nghttp2' +PACKAGE_TARNAME='nghttp2' +PACKAGE_VERSION='1.65.0' +PACKAGE_STRING='nghttp2 1.65.0' +PACKAGE_BUGREPORT='t-tujikawa@users.sourceforge.net' +PACKAGE_URL='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_c_list= +ac_func_c_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +APPLDFLAGS +TESTLDADD +ENABLE_STATIC_FALSE +ENABLE_STATIC_TRUE +EXTRACFLAG +WARNCXXFLAGS +WARNCFLAGS +LIBOBJS +ENABLE_FAILMALLOC_FALSE +ENABLE_FAILMALLOC_TRUE +HAVE_NEVERBLEED_FALSE +HAVE_NEVERBLEED_TRUE +HAVE_MRUBY_FALSE +HAVE_MRUBY_TRUE +ENABLE_THIRD_PARTY_FALSE +ENABLE_THIRD_PARTY_TRUE +LIBMRUBY_CFLAGS +LIBMRUBY_LIBS +ENABLE_EXAMPLES_FALSE +ENABLE_EXAMPLES_TRUE +ENABLE_HPACK_TOOLS_FALSE +ENABLE_HPACK_TOOLS_TRUE +ENABLE_HTTP3_FALSE +ENABLE_HTTP3_TRUE +ENABLE_APP_FALSE +ENABLE_APP_TRUE +HAVE_LIBXML2_FALSE +HAVE_LIBXML2_TRUE +LIBXML2_LIBS +LIBXML2_CFLAGS +SYSTEMD_LIBS +SYSTEMD_CFLAGS +JANSSON_LIBS +JANSSON_CFLAGS +LIBEVENT_OPENSSL_LIBS +LIBEVENT_OPENSSL_CFLAGS +LIBBROTLIDEC_LIBS +LIBBROTLIDEC_CFLAGS +LIBBROTLIENC_LIBS +LIBBROTLIENC_CFLAGS +HAVE_LIBBPF_FALSE +HAVE_LIBBPF_TRUE +EXTRABPFCFLAGS +LIBBPF_LIBS +LIBBPF_CFLAGS +LIBNGHTTP3_LIBS +LIBNGHTTP3_CFLAGS +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS +LIBNGTCP2_CRYPTO_QUICTLS_LIBS +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS +LIBNGTCP2_LIBS +LIBNGTCP2_CFLAGS +LIBCARES_LIBS +LIBCARES_CFLAGS +WOLFSSL_LIBS +WOLFSSL_CFLAGS +OPENSSL_LIBS +OPENSSL_CFLAGS +ZLIB_LIBS +ZLIB_CFLAGS +EXTRA_DEFS +CXX1XCXXFLAGS +HAVE_CXX20 +pkgpyexecdir +pyexecdir +pkgpythondir +pythondir +PYTHON_EXEC_PREFIX +PYTHON_PREFIX +PYTHON_PLATFORM +PYTHON_VERSION +PYTHON +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +CPP +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +CXXCPP +ac_ct_CXX +CXXFLAGS +CXX +BPFCFLAGS +LIBTOOL_LDFLAGS +JEMALLOC_LIBS +JEMALLOC_CFLAGS +LIBEV_LIBS +LIBEV_CFLAGS +PACKAGE_VERSION_NUM +LT_AGE +LT_REVISION +LT_CURRENT +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +CSCOPE +ETAGS +CTAGS +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_os +target_vendor +target_cpu +target +LT_SYS_LIBRARY_PATH +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +AWK +RANLIB +STRIP +ac_ct_AR +AR +DLLTOOL +OBJDUMP +FILECMD +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_shared +enable_static +with_pic +enable_fast_install +with_aix_soname +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_dependency_tracking +enable_silent_rules +enable_werror +enable_debug +enable_threads +enable_app +enable_hpack_tools +enable_examples +enable_failmalloc +enable_lib_only +enable_http3 +with_libxml2 +with_jansson +with_zlib +with_libevent_openssl +with_libcares +with_wolfssl +with_openssl +with_libev +with_jemalloc +with_systemd +with_mruby +with_neverbleed +with_libngtcp2 +with_libnghttp3 +with_libbpf +with_libbrotlienc +with_libbrotlidec +with_python_sys_prefix +with_python_prefix +with_python_exec_prefix +enable_assert +enable_largefile +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +LT_SYS_LIBRARY_PATH +LIBEV_CFLAGS +LIBEV_LIBS +JEMALLOC_CFLAGS +JEMALLOC_LIBS +LIBTOOL_LDFLAGS +BPFCFLAGS +CXX +CXXFLAGS +CCC +CXXCPP +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +PYTHON +ZLIB_CFLAGS +ZLIB_LIBS +OPENSSL_CFLAGS +OPENSSL_LIBS +WOLFSSL_CFLAGS +WOLFSSL_LIBS +LIBCARES_CFLAGS +LIBCARES_LIBS +LIBNGTCP2_CFLAGS +LIBNGTCP2_LIBS +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS +LIBNGTCP2_CRYPTO_QUICTLS_LIBS +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS +LIBNGHTTP3_CFLAGS +LIBNGHTTP3_LIBS +LIBBPF_CFLAGS +LIBBPF_LIBS +LIBBROTLIENC_CFLAGS +LIBBROTLIENC_LIBS +LIBBROTLIDEC_CFLAGS +LIBBROTLIDEC_LIBS +LIBEVENT_OPENSSL_CFLAGS +LIBEVENT_OPENSSL_LIBS +JANSSON_CFLAGS +JANSSON_LIBS +SYSTEMD_CFLAGS +SYSTEMD_LIBS +LIBXML2_CFLAGS +LIBXML2_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures nghttp2 1.65.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/nghttp2] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of nghttp2 1.65.0:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-werror Turn on compile time warnings + --enable-debug Turn on debug output + --disable-threads Turn off threading in apps + --enable-app Build applications (nghttp, nghttpd, nghttpx and + h2load) [default=check] + --enable-hpack-tools Build HPACK tools [default=check] + --enable-examples Build examples [default=check] + --disable-failmalloc Do not build failmalloc test program + --enable-lib-only Build libnghttp2 only. This is a short hand for + --disable-app --disable-examples + --disable-hpack-tools + --enable-http3 (EXPERIMENTAL) Enable HTTP/3. This requires ngtcp2, + nghttp3, and a custom OpenSSL. + --disable-assert turn off assertions + --disable-largefile omit support for large files + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot[=DIR] Search for dependent libraries within DIR (or the + compiler's sysroot if not specified). + --with-libxml2 Use libxml2 [default=check] + --with-jansson Use jansson [default=check] + --with-zlib Use zlib [default=check] + --with-libevent-openssl Use libevent_openssl [default=check] + --with-libcares Use libc-ares [default=check] + --with-wolfssl Use wolfSSL [default=check] + --with-openssl Use openssl [default=check] + --with-libev Use libev [default=check] + --with-jemalloc Use jemalloc [default=check] + --with-systemd Enable systemd support in nghttpx [default=check] + --with-mruby Use mruby [default=no] + --with-neverbleed Use neverbleed [default=no] + --with-libngtcp2 Use libngtcp2 [default=check] + --with-libnghttp3 Use libnghttp3 [default=check] + --with-libbpf Use libbpf [default=no] + --with-libbrotlienc Use libbrotlienc [default=no] + --with-libbrotlidec Use libbrotlidec [default=no] + --with-python-sys-prefix + use Python's sys.prefix and sys.exec_prefix values + --with-python_prefix override the default PYTHON_PREFIX + --with-python_exec_prefix + override the default PYTHON_EXEC_PREFIX + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. + LIBEV_CFLAGS + C compiler flags for libev, skipping any checks + LIBEV_LIBS linker flags for libev, skipping any checks + JEMALLOC_CFLAGS + C compiler flags for jemalloc, skipping any checks + JEMALLOC_LIBS + linker flags for jemalloc, skipping any checks + LIBTOOL_LDFLAGS + libtool specific flags (e.g., -static-libtool-libs) + BPFCFLAGS C compiler flags for bpf program + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + CPP C preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + PYTHON the Python interpreter + ZLIB_CFLAGS C compiler flags for ZLIB, overriding pkg-config + ZLIB_LIBS linker flags for ZLIB, overriding pkg-config + OPENSSL_CFLAGS + C compiler flags for OPENSSL, overriding pkg-config + OPENSSL_LIBS + linker flags for OPENSSL, overriding pkg-config + WOLFSSL_CFLAGS + C compiler flags for WOLFSSL, overriding pkg-config + WOLFSSL_LIBS + linker flags for WOLFSSL, overriding pkg-config + LIBCARES_CFLAGS + C compiler flags for LIBCARES, overriding pkg-config + LIBCARES_LIBS + linker flags for LIBCARES, overriding pkg-config + LIBNGTCP2_CFLAGS + C compiler flags for LIBNGTCP2, overriding pkg-config + LIBNGTCP2_LIBS + linker flags for LIBNGTCP2, overriding pkg-config + LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS + C compiler flags for LIBNGTCP2_CRYPTO_WOLFSSL, overriding + pkg-config + LIBNGTCP2_CRYPTO_WOLFSSL_LIBS + linker flags for LIBNGTCP2_CRYPTO_WOLFSSL, overriding pkg-config + LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS + C compiler flags for LIBNGTCP2_CRYPTO_QUICTLS, overriding + pkg-config + LIBNGTCP2_CRYPTO_QUICTLS_LIBS + linker flags for LIBNGTCP2_CRYPTO_QUICTLS, overriding pkg-config + LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS + C compiler flags for LIBNGTCP2_CRYPTO_BORINGSSL, overriding + pkg-config + LIBNGTCP2_CRYPTO_BORINGSSL_LIBS + linker flags for LIBNGTCP2_CRYPTO_BORINGSSL, overriding + pkg-config + LIBNGHTTP3_CFLAGS + C compiler flags for LIBNGHTTP3, overriding pkg-config + LIBNGHTTP3_LIBS + linker flags for LIBNGHTTP3, overriding pkg-config + LIBBPF_CFLAGS + C compiler flags for LIBBPF, overriding pkg-config + LIBBPF_LIBS linker flags for LIBBPF, overriding pkg-config + LIBBROTLIENC_CFLAGS + C compiler flags for LIBBROTLIENC, overriding pkg-config + LIBBROTLIENC_LIBS + linker flags for LIBBROTLIENC, overriding pkg-config + LIBBROTLIDEC_CFLAGS + C compiler flags for LIBBROTLIDEC, overriding pkg-config + LIBBROTLIDEC_LIBS + linker flags for LIBBROTLIDEC, overriding pkg-config + LIBEVENT_OPENSSL_CFLAGS + C compiler flags for LIBEVENT_OPENSSL, overriding pkg-config + LIBEVENT_OPENSSL_LIBS + linker flags for LIBEVENT_OPENSSL, overriding pkg-config + JANSSON_CFLAGS + C compiler flags for JANSSON, overriding pkg-config + JANSSON_LIBS + linker flags for JANSSON, overriding pkg-config + SYSTEMD_CFLAGS + C compiler flags for SYSTEMD, overriding pkg-config + SYSTEMD_LIBS + linker flags for SYSTEMD, overriding pkg-config + LIBXML2_CFLAGS + C compiler flags for LIBXML2, overriding pkg-config + LIBXML2_LIBS + linker flags for LIBXML2, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +nghttp2 configure 1.65.0 +generated by GNU Autoconf 2.71 + +Copyright (C) 2021 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_cxx_try_cpp LINENO +# ------------------------ +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_cpp + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_find_uintX_t LINENO BITS VAR +# ------------------------------------ +# Finds an unsigned integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_uintX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +printf %s "checking for uint$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ +static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + case $ac_type in #( + uint$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : + +else $as_nop + break +fi + done +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_uintX_t + +# ac_fn_c_find_intX_t LINENO BITS VAR +# ----------------------------------- +# Finds a signed integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_intX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 +printf %s "checking for int$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in int$2_t 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main (void) +{ +static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main (void) +{ +static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) + < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + case $ac_type in #( + int$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : + +else $as_nop + break +fi + done +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_intX_t + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +printf %s "checking for $2.$3... " >&6; } +if eval test \${$4+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$4=yes" +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$4=yes" +else $as_nop + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$4 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member + +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_check_decl +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by nghttp2 $as_me 1.65.0, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" +as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +as_fn_append ac_header_c_list " vfork.h vfork_h HAVE_VFORK_H" +as_fn_append ac_func_c_list " fork HAVE_FORK" +as_fn_append ac_func_c_list " vfork HAVE_VFORK" + +# Auxiliary files required by this configure script. +ac_aux_files="missing install-sh config.guess config.sub ltmain.sh compile" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +ac_config_headers="$ac_config_headers config.h" + + + + + + + + + + + + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test ${ac_cv_safe_to_define___extensions__+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_safe_to_define___extensions__=yes +else $as_nop + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 +printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } +if test ${ac_cv_should_define__xopen_source+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_should_define__xopen_source=no + if test $ac_cv_header_wchar_h = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define _XOPEN_SOURCE 500 + #include + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_should_define__xopen_source=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 +printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } + + printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + + printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + + printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h + + if test $ac_cv_header_minix_config_h = yes +then : + MINIX=yes + printf "%s\n" "#define _MINIX 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h + +else $as_nop + MINIX= +fi + if test $ac_cv_safe_to_define___extensions__ = yes +then : + printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h + +fi + if test $ac_cv_should_define__xopen_source = yes +then : + printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h + +fi + + + +case `pwd` in + *\ * | *\ *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.7' +macro_revision='2.4.7' + + + + + + + + + + + + + + +ltmain=$ac_aux_dir/ltmain.sh + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +printf %s "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case $ECHO in + printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +printf "%s\n" "printf" >&6; } ;; + print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +printf "%s\n" "print -r" >&6; } ;; + *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +printf "%s\n" "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +printf %s "checking for a sed that does not truncate output... " >&6; } +if test ${ac_cv_path_SED+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in sed gsed + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +printf "%s\n" "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +printf %s "checking for fgrep... " >&6; } +if test ${ac_cv_path_FGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in fgrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +printf "%s\n" "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test ${with_gnu_ld+y} +then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else $as_nop + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test ${lt_cv_path_NM+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +printf "%s\n" "$lt_cv_path_NM" >&6; } +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +printf "%s\n" "$DUMPBIN" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +printf "%s\n" "$ac_ct_DUMPBIN" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +printf %s "checking the name lister ($NM) interface... " >&6; } +if test ${lt_cv_nm_interface+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +printf "%s\n" "$lt_cv_nm_interface" >&6; } + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +printf %s "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +printf "%s\n" "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +printf %s "checking the maximum length of command line arguments... " >&6; } +if test ${lt_cv_sys_max_cmd_len+y} +then : + printf %s "(cached) " >&6 +else $as_nop + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n "$lt_cv_sys_max_cmd_len"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +printf %s "checking how to convert $build file names to $host format... " >&6; } +if test ${lt_cv_to_host_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +printf %s "checking how to convert $build file names to toolchain format... " >&6; } +if test ${lt_cv_to_tool_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +printf %s "checking for $LD option to reload object files... " >&6; } +if test ${lt_cv_ld_reload_flag+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_reload_flag='-r' +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. +set dummy ${ac_tool_prefix}file; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_FILECMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$FILECMD"; then + ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_FILECMD="${ac_tool_prefix}file" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +FILECMD=$ac_cv_prog_FILECMD +if test -n "$FILECMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 +printf "%s\n" "$FILECMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_FILECMD"; then + ac_ct_FILECMD=$FILECMD + # Extract the first word of "file", so it can be a program name with args. +set dummy file; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_FILECMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_FILECMD"; then + ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_FILECMD="file" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_FILECMD=$ac_cv_prog_ac_ct_FILECMD +if test -n "$ac_ct_FILECMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 +printf "%s\n" "$ac_ct_FILECMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_FILECMD" = x; then + FILECMD=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + FILECMD=$ac_ct_FILECMD + fi +else + FILECMD="$ac_cv_prog_FILECMD" +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +printf %s "checking how to recognize dependent libraries... " >&6; } +if test ${lt_cv_deplibs_check_method+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='$FILECMD -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly* | midnightbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=$FILECMD + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +printf %s "checking how to associate runtime and link libraries... " >&6; } +if test ${lt_cv_sharedlib_from_linklib_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} + + + + + + +# Use ARFLAGS variable as AR's operation code to sync the variable naming with +# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have +# higher priority because thats what people were doing historically (setting +# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS +# variable obsoleted/removed. + +test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} +lt_ar_flags=$AR_FLAGS + + + + + + +# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override +# by AR_FLAGS because that was never working and AR_FLAGS is about to die. + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +printf %s "checking for archiver @FILE support... " >&6; } +if test ${lt_cv_ar_at_file+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +printf "%s\n" "$lt_cv_ar_at_file" >&6; } + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AWK" && break +done + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +printf %s "checking command to parse $NM output from $compiler object... " >&6; } +if test ${lt_cv_sys_global_symbol_pipe+y} +then : + printf %s "(cached) " >&6 +else $as_nop + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++ or ICC, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +printf "%s\n" "failed" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf "%s\n" "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +printf %s "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test ${with_sysroot+y} +then : + withval=$with_sysroot; +else $as_nop + with_sysroot=no +fi + + +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +printf "%s\n" "$with_sysroot" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +printf "%s\n" "${lt_sysroot:-no}" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +printf %s "checking for a working dd... " >&6; } +if test ${ac_cv_path_lt_DD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +if test -z "$lt_DD"; then + ac_path_lt_DD_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in dd + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_lt_DD" || continue +if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi + $ac_path_lt_DD_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_lt_DD"; then + : + fi +else + ac_cv_path_lt_DD=$lt_DD +fi + +rm -f conftest.i conftest2.i conftest.out +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +printf "%s\n" "$ac_cv_path_lt_DD" >&6; } + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +printf %s "checking how to truncate binary pipes... " >&6; } +if test ${lt_cv_truncate_bin+y} +then : + printf %s "(cached) " >&6 +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +printf "%s\n" "$lt_cv_truncate_bin" >&6; } + + + + + + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + +# Check whether --enable-libtool-lock was given. +if test ${enable_libtool_lock+y} +then : + enableval=$enable_libtool_lock; +fi + +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `$FILECMD conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + emul=elf + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `$FILECMD conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `$FILECMD conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +printf %s "checking whether the C compiler needs -belf... " >&6; } +if test ${lt_cv_cc_needs_belf+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_cc_needs_belf=yes +else $as_nop + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `$FILECMD conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +printf "%s\n" "$MANIFEST_TOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if test ${lt_cv_path_mainfest_tool+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +printf "%s\n" "$DSYMUTIL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +printf "%s\n" "$NMEDIT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +printf "%s\n" "$ac_ct_NMEDIT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +printf "%s\n" "$LIPO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +printf "%s\n" "$ac_ct_LIPO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +printf "%s\n" "$OTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +printf "%s\n" "$ac_ct_OTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +printf "%s\n" "$OTOOL64" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +printf "%s\n" "$ac_ct_OTOOL64" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +printf %s "checking for -single_module linker flag... " >&6; } +if test ${lt_cv_apple_cc_single_mod+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +printf %s "checking for -exported_symbols_list linker flag... " >&6; } +if test ${lt_cv_ld_exported_symbols_list+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_ld_exported_symbols_list=yes +else $as_nop + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +printf %s "checking for -force_load linker flag... " >&6; } +if test ${lt_cv_ld_force_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 + $AR $AR_FLAGS libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +printf "%s\n" "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) + case $MACOSX_DEPLOYMENT_TARGET,$host in + 10.[012],*|,*powerpc*-darwin[5-8]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + *) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + +ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes +then : + printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h + +fi + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test ${enable_shared+y} +then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test ${enable_static+y} +then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test ${with_pic+y} +then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + pic_mode=default +fi + + + + + + + + + # Check whether --enable-fast-install was given. +if test ${enable_fast_install+y} +then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + enable_fast_install=yes +fi + + + + + + + + + shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[5-9]*,yes) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +printf %s "checking which variant of shared library versioning to provide... " >&6; } + +# Check whether --with-aix-soname was given. +if test ${with_aix_soname+y} +then : + withval=$with_aix_soname; case $withval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname +else $as_nop + if test ${lt_cv_with_aix_soname+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_with_aix_soname=aix +fi + + with_aix_soname=$lt_cv_with_aix_soname +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +printf "%s\n" "$with_aix_soname" >&6; } + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +printf %s "checking for objdir... " >&6; } +if test ${lt_cv_objdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +printf "%s\n" "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +printf %s "checking for ${ac_tool_prefix}file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/${ac_tool_prefix}file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +printf %s "checking for file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC=$CC +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test ${lt_cv_prog_compiler_rtti_exceptions+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test yes = "$GCC"; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + lt_prog_compiler_pic='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works"; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_static_works=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works"; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } + if test no = "$hard_links"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++ or Intel C++ Compiler. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + export_dynamic_flag_spec='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='$wl--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + file_list_spec='@' + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + export_dynamic_flag_spec='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test no = "$ld_shlibs"; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct=no + hardcode_direct_absolute=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' $wl-bernotok' + allow_undefined_flag=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++ or Intel C++ Compiler. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl* | icl*) + # Native MSVC or ICC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC and ICC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly* | midnightbsd*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test yes = "$GCC"; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +printf %s "checking if $CC understands -b... " >&6; } +if test ${lt_cv_prog_compiler__b+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler__b=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } + +if test yes = "$lt_cv_prog_compiler__b"; then + archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if test ${lt_cv_irix_exported_symbol+y} +then : + printf %s "(cached) " >&6 +else $as_nop + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_irix_exported_symbol=yes +else $as_nop + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } + if test yes = "$lt_cv_irix_exported_symbol"; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + link_all_deplibs=no + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs=yes + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + ;; + esac + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + else + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + file_list_spec='@' + ;; + + osf3*) + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='$wl-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='$wl-z,text' + allow_undefined_flag='$wl-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='$wl-Blargedynsym' + ;; + esac + fi + fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +printf "%s\n" "$ld_shlibs" >&6; } +test no = "$ld_shlibs" && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc+y} +then : + printf %s "(cached) " >&6 +else $as_nop + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } + +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([A-Za-z]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + + + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl* | *,icl*) + # Native MSVC or ICC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC and ICC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly* | midnightbsd*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test yes = "$hardcode_automatic"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && + test no != "$hardcode_minus_L"; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +printf "%s\n" "$hardcode_action" >&6; } + +if test relink = "$hardcode_action" || + test yes = "$inherit_rpath"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dl_dlopen=yes +else $as_nop + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else $as_nop + + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes +then : + lt_cv_dlopen=shl_load +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +printf %s "checking for shl_load in -ldld... " >&6; } +if test ${ac_cv_lib_dld_shl_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main (void) +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dld_shl_load=yes +else $as_nop + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes +then : + lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld +else $as_nop + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes +then : + lt_cv_dlopen=dlopen +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dl_dlopen=yes +else $as_nop + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +printf %s "checking for dlopen in -lsvld... " >&6; } +if test ${ac_cv_lib_svld_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_svld_dlopen=yes +else $as_nop + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +printf %s "checking for dld_link in -ldld... " >&6; } +if test ${ac_cv_lib_dld_dld_link+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main (void) +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dld_dld_link=yes +else $as_nop + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes +then : + lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +printf %s "checking whether a program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +printf "%s\n" "$lt_cv_dlopen_self" >&6; } + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +printf %s "checking whether a statically linked program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self_static+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +printf %s "checking whether stripping libraries is possible... " >&6; } +if test -z "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +else + if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + case $host_os in + darwin*) + # FIXME - insert some real tests, host_os isn't really good enough + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + ;; + freebsd*) + if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; + esac + fi +fi + + + + + + + + + + + + + # Report what library types will actually be built + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +printf %s "checking if libtool supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +printf "%s\n" "$can_build_shared" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +printf %s "checking whether to build shared libraries... " >&6; } + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +printf "%s\n" "$enable_shared" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +printf %s "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +printf "%s\n" "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC=$lt_save_CC + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +printf %s "checking target system type... " >&6; } +if test ${ac_cv_target+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +printf "%s\n" "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +am__api_version='1.16' + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test ${ac_cv_path_mkdir+y}; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='nghttp2' + VERSION='1.65.0' + + +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h + + +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to create a pax tar archive" >&5 +printf %s "checking how to create a pax tar archive... " >&6; } + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_pax-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + { echo "$as_me:$LINENO: $_am_tar --version" >&5 + ($_am_tar --version) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && break + done + am__tar="$_am_tar --format=posix -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=posix -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x pax -w "$$tardir"' + am__tar_='pax -L -x pax -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H pax -L' + am__tar_='find "$tardir" -print | cpio -o -H pax -L' + am__untar='cpio -i -H pax -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_pax}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5 + (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + rm -rf conftest.dir + if test -s conftest.tar; then + { echo "$as_me:$LINENO: $am__untar &5 + ($am__untar &5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + { echo "$as_me:$LINENO: cat conftest.dir/file" >&5 + (cat conftest.dir/file) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + if test ${am_cv_prog_tar_pax+y} +then : + printf %s "(cached) " >&6 +else $as_nop + am_cv_prog_tar_pax=$_am_tool +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_pax" >&5 +printf "%s\n" "$am_cv_prog_tar_pax" >&6; } + + + + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + + +LT_CURRENT=42 + +LT_REVISION=4 + +LT_AGE=28 + + +major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/^0-9//g"` +minor=`echo $PACKAGE_VERSION |cut -d. -f2 | sed -e "s/^0-9//g"` +patch=`echo $PACKAGE_VERSION |cut -d. -f3 | cut -d- -f1 | sed -e "s/^0-9//g"` + +PACKAGE_VERSION_NUM=`printf "0x%02x%02x%02x" "$major" "$minor" "$patch"` + + + +# Check whether --enable-werror was given. +if test ${enable_werror+y} +then : + enableval=$enable_werror; werror=$enableval +else $as_nop + werror=no +fi + + +# Check whether --enable-debug was given. +if test ${enable_debug+y} +then : + enableval=$enable_debug; debug=$enableval +else $as_nop + debug=no +fi + + +# Check whether --enable-threads was given. +if test ${enable_threads+y} +then : + enableval=$enable_threads; threads=$enableval +else $as_nop + threads=yes +fi + + +# Check whether --enable-app was given. +if test ${enable_app+y} +then : + enableval=$enable_app; request_app=$enableval +else $as_nop + request_app=check +fi + + +# Check whether --enable-hpack-tools was given. +if test ${enable_hpack_tools+y} +then : + enableval=$enable_hpack_tools; request_hpack_tools=$enableval +else $as_nop + request_hpack_tools=check +fi + + +# Check whether --enable-examples was given. +if test ${enable_examples+y} +then : + enableval=$enable_examples; request_examples=$enableval +else $as_nop + request_examples=check +fi + + +# Check whether --enable-failmalloc was given. +if test ${enable_failmalloc+y} +then : + enableval=$enable_failmalloc; request_failmalloc=$enableval +else $as_nop + request_failmalloc=yes +fi + + +# Check whether --enable-lib-only was given. +if test ${enable_lib_only+y} +then : + enableval=$enable_lib_only; request_lib_only=$enableval +else $as_nop + request_lib_only=no +fi + + +# Check whether --enable-http3 was given. +if test ${enable_http3+y} +then : + enableval=$enable_http3; request_http3=$enableval +else $as_nop + request_http3=no +fi + + + +# Check whether --with-libxml2 was given. +if test ${with_libxml2+y} +then : + withval=$with_libxml2; request_libxml2=$withval +else $as_nop + request_libxml2=check +fi + + + +# Check whether --with-jansson was given. +if test ${with_jansson+y} +then : + withval=$with_jansson; request_jansson=$withval +else $as_nop + request_jansson=check +fi + + + +# Check whether --with-zlib was given. +if test ${with_zlib+y} +then : + withval=$with_zlib; request_zlib=$withval +else $as_nop + request_zlib=check +fi + + + +# Check whether --with-libevent-openssl was given. +if test ${with_libevent_openssl+y} +then : + withval=$with_libevent_openssl; request_libevent_openssl=$withval +else $as_nop + request_libevent_openssl=check +fi + + + +# Check whether --with-libcares was given. +if test ${with_libcares+y} +then : + withval=$with_libcares; request_libcares=$withval +else $as_nop + request_libcares=check +fi + + + +# Check whether --with-wolfssl was given. +if test ${with_wolfssl+y} +then : + withval=$with_wolfssl; request_wolfssl=$withval +else $as_nop + request_wolfssl=check +fi + + + +# Check whether --with-openssl was given. +if test ${with_openssl+y} +then : + withval=$with_openssl; request_openssl=$withval +else $as_nop + request_openssl=check +fi + + + +# Check whether --with-libev was given. +if test ${with_libev+y} +then : + withval=$with_libev; request_libev=$withval +else $as_nop + request_libev=check +fi + + + +# Check whether --with-jemalloc was given. +if test ${with_jemalloc+y} +then : + withval=$with_jemalloc; request_jemalloc=$withval +else $as_nop + request_jemalloc=check +fi + + + +# Check whether --with-systemd was given. +if test ${with_systemd+y} +then : + withval=$with_systemd; request_systemd=$withval +else $as_nop + request_systemd=check +fi + + + +# Check whether --with-mruby was given. +if test ${with_mruby+y} +then : + withval=$with_mruby; request_mruby=$withval +else $as_nop + request_mruby=no +fi + + + +# Check whether --with-neverbleed was given. +if test ${with_neverbleed+y} +then : + withval=$with_neverbleed; request_neverbleed=$withval +else $as_nop + request_neverbleed=no +fi + + + +# Check whether --with-libngtcp2 was given. +if test ${with_libngtcp2+y} +then : + withval=$with_libngtcp2; request_libngtcp2=$withval +else $as_nop + request_libngtcp2=check +fi + + + +# Check whether --with-libnghttp3 was given. +if test ${with_libnghttp3+y} +then : + withval=$with_libnghttp3; request_libnghttp3=$withval +else $as_nop + request_libnghttp3=check +fi + + + +# Check whether --with-libbpf was given. +if test ${with_libbpf+y} +then : + withval=$with_libbpf; request_libbpf=$withval +else $as_nop + request_libbpf=no +fi + + + +# Check whether --with-libbrotlienc was given. +if test ${with_libbrotlienc+y} +then : + withval=$with_libbrotlienc; request_libbrotlienc=$withval +else $as_nop + request_libbrotlienc=no +fi + + + +# Check whether --with-libbrotlidec was given. +if test ${with_libbrotlidec+y} +then : + withval=$with_libbrotlidec; request_libbrotlidec=$withval +else $as_nop + request_libbrotlidec=no +fi + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else $as_nop + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_cxx11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_cxx98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +func_stripname_cnf () +{ + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; + esac +} # func_stripname_cnf + + if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +printf %s "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if test ${ac_cv_prog_CXXCPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CXX needs to be expanded + for CXXCPP in "$CXX -E" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +printf "%s\n" "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else + _lt_caught_CXX_error=yes +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +compiler_needs_object_CXX=no +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_direct_absolute_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +inherit_rpath_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +reload_flag_CXX=$reload_flag +reload_cmds_CXX=$reload_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + + # save warnings/boilerplate of simple test code + ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + + ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + compiler_CXX=$CC + func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' + else + lt_prog_compiler_no_builtin_flag_CXX= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + + +# Check whether --with-gnu-ld was given. +if test ${with_gnu_ld+y} +then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else $as_nop + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + ld_shlibs_CXX=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + file_list_spec_CXX='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct_CXX=no + hardcode_direct_absolute_CXX=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec_CXX='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + always_export_symbols_CXX=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + no_undefined_flag_CXX='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' $wl-bernotok' + allow_undefined_flag_CXX=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + fi + archive_cmds_need_lc_CXX=yes + archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl* | ,icl* | no,icl*) + # Native MSVC or ICC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_CXX=' ' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=yes + file_list_spec_CXX='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' + enable_shared_with_static_runtimes_CXX=yes + # Don't use ranlib + old_postinstall_cmds_CXX='chmod 644 $oldlib' + postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='$wl--export-all-symbols' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + + + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec_CXX='' + fi + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds_CXX="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + if test yes != "$lt_cv_apple_cc_single_mod"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + archive_expsym_cmds_CXX="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi + + else + ld_shlibs_CXX=no + fi + + ;; + + os2*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_minus_L_CXX=yes + allow_undefined_flag_CXX=unsupported + shrext_cmds=.dll + archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes_CXX=yes + file_list_spec_CXX='@' + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + ld_shlibs_CXX=no + ;; + + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + + haiku*) + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs_CXX=yes + ;; + + hpux9*) + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='$wl-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + export_dynamic_flag_spec_CXX='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + inherit_rpath_CXX=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [1-5].* | *pgcpp\ [1-5].*) + prelink_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + old_archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object_CXX=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + ld_shlibs_CXX=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + hardcode_direct_absolute_CXX=yes + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='$wl-E' + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + ld_shlibs_CXX=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + case $host in + osf3*) + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + ;; + *) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + ;; + esac + + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + no_undefined_flag_CXX=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + fi + + hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='$wl-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_CXX='$wl-z,text' + allow_undefined_flag_CXX='$wl-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ + '"$old_archive_cmds_CXX" + reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ + '"$reload_cmds_CXX" + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } + test no = "$ld_shlibs_CXX" && can_build_shared=no + + GCC_CXX=$GXX + LD_CXX=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + # Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF + + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX=$prev$p + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX=$prev$p + else + postdeps_CXX="${postdeps_CXX} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX=$p + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX=$p + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + compiler_lib_search_dirs_CXX= +if test -n "${compiler_lib_search_path_CXX}"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + + + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + lt_prog_compiler_pic_CXX='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic_CXX='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static_CXX='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-qpic' + lt_prog_compiler_static_CXX='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } +lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_CXX=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_static_works_CXX=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then + : +else + lt_prog_compiler_static_CXX= +fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } + if test no = "$hard_links"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + case $host_os in + aix[4-9]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl* | icl*) + exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + ;; + esac + ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs_CXX=no + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } +test no = "$ld_shlibs_CXX" && can_build_shared=no + +with_gnu_ld_CXX=$with_gnu_ld + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc_CXX=no + else + lt_cv_archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } + archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } + +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + + + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl* | *,icl*) + # Native MSVC or ICC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC and ICC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly* | midnightbsd*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || + test -n "$runpath_var_CXX" || + test yes = "$hardcode_automatic_CXX"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct_CXX" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && + test no != "$hardcode_minus_L_CXX"; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +printf "%s\n" "$hardcode_action_CXX" >&6; } + +if test relink = "$hardcode_action_CXX" || + test yes = "$inherit_rpath_CXX"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CXX" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +printf %s "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +printf "%s\n" "no, using $LN_S" >&6; } +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.20 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + PKG_CONFIG="" + fi +fi + + + + + + + + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version is >= 3.8" >&5 +printf %s "checking whether $PYTHON version is >= 3.8... " >&6; } + prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '3.8'.split('.'))) + [0, 0, 0] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] +sys.exit(sys.hexversion < minverhex)" + if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 + ($PYTHON -c "$prog") >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + as_fn_error $? "Python interpreter is too old" "$LINENO" 5 +fi + am_display_PYTHON=$PYTHON + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 3.8" >&5 +printf %s "checking for a Python interpreter with version >= 3.8... " >&6; } +if test ${am_cv_pathless_PYTHON+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + for am_cv_pathless_PYTHON in python python2 python3 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do + test "$am_cv_pathless_PYTHON" = none && break + prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '3.8'.split('.'))) + [0, 0, 0] +minverhex = 0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] +sys.exit(sys.hexversion < minverhex)" + if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 + ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +then : + break +fi + done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 +printf "%s\n" "$am_cv_pathless_PYTHON" >&6; } + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + if test "$am_cv_pathless_PYTHON" = none; then + PYTHON=: + else + # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. +set dummy $am_cv_pathless_PYTHON; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PYTHON+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $PYTHON in + [\\/]* | ?:[\\/]*) + ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PYTHON="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PYTHON=$ac_cv_path_PYTHON +if test -n "$PYTHON"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +printf "%s\n" "$PYTHON" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + + + if test "$PYTHON" = :; then + : + else + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 +printf %s "checking for $am_display_PYTHON version... " >&6; } +if test ${am_cv_python_version+y} +then : + printf %s "(cached) " >&6 +else $as_nop + am_cv_python_version=`$PYTHON -c "import sys; print ('%u.%u' % sys.version_info[:2])"` +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 +printf "%s\n" "$am_cv_python_version" >&6; } + PYTHON_VERSION=$am_cv_python_version + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 +printf %s "checking for $am_display_PYTHON platform... " >&6; } +if test ${am_cv_python_platform+y} +then : + printf %s "(cached) " >&6 +else $as_nop + am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 +printf "%s\n" "$am_cv_python_platform" >&6; } + PYTHON_PLATFORM=$am_cv_python_platform + + + if test "x$prefix" = xNONE; then + am__usable_prefix=$ac_default_prefix + else + am__usable_prefix=$prefix + fi + + # Allow user to request using sys.* values from Python, + # instead of the GNU $prefix values. + +# Check whether --with-python-sys-prefix was given. +if test ${with_python_sys_prefix+y} +then : + withval=$with_python_sys_prefix; am_use_python_sys=: +else $as_nop + am_use_python_sys=false +fi + + + # Allow user to override whatever the default Python prefix is. + +# Check whether --with-python_prefix was given. +if test ${with_python_prefix+y} +then : + withval=$with_python_prefix; am_python_prefix_subst=$withval + am_cv_python_prefix=$withval + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for explicit $am_display_PYTHON prefix" >&5 +printf %s "checking for explicit $am_display_PYTHON prefix... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_prefix" >&5 +printf "%s\n" "$am_cv_python_prefix" >&6; } +else $as_nop + + if $am_use_python_sys; then + # using python sys.prefix value, not GNU + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python default $am_display_PYTHON prefix" >&5 +printf %s "checking for python default $am_display_PYTHON prefix... " >&6; } +if test ${am_cv_python_prefix+y} +then : + printf %s "(cached) " >&6 +else $as_nop + am_cv_python_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"` +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_prefix" >&5 +printf "%s\n" "$am_cv_python_prefix" >&6; } + + case $am_cv_python_prefix in + $am__usable_prefix*) + am__strip_prefix=`echo "$am__usable_prefix" | sed 's|.|.|g'` + am_python_prefix_subst=`echo "$am_cv_python_prefix" | sed "s,^$am__strip_prefix,\\${prefix},"` + ;; + *) + am_python_prefix_subst=$am_cv_python_prefix + ;; + esac + else # using GNU prefix value, not python sys.prefix + am_python_prefix_subst='${prefix}' + am_python_prefix=$am_python_prefix_subst + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU default $am_display_PYTHON prefix" >&5 +printf %s "checking for GNU default $am_display_PYTHON prefix... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_python_prefix" >&5 +printf "%s\n" "$am_python_prefix" >&6; } + fi +fi + + # Substituting python_prefix_subst value. + PYTHON_PREFIX=$am_python_prefix_subst + + + # emacs-page Now do it all over again for Python exec_prefix, but with yet + # another conditional: fall back to regular prefix if that was specified. + +# Check whether --with-python_exec_prefix was given. +if test ${with_python_exec_prefix+y} +then : + withval=$with_python_exec_prefix; am_python_exec_prefix_subst=$withval + am_cv_python_exec_prefix=$withval + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for explicit $am_display_PYTHON exec_prefix" >&5 +printf %s "checking for explicit $am_display_PYTHON exec_prefix... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_exec_prefix" >&5 +printf "%s\n" "$am_cv_python_exec_prefix" >&6; } +else $as_nop + + # no explicit --with-python_exec_prefix, but if + # --with-python_prefix was given, use its value for python_exec_prefix too. + if test -n "$with_python_prefix" +then : + am_python_exec_prefix_subst=$with_python_prefix + am_cv_python_exec_prefix=$with_python_prefix + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python_prefix-given $am_display_PYTHON exec_prefix" >&5 +printf %s "checking for python_prefix-given $am_display_PYTHON exec_prefix... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_exec_prefix" >&5 +printf "%s\n" "$am_cv_python_exec_prefix" >&6; } +else $as_nop + + # Set am__usable_exec_prefix whether using GNU or Python values, + # since we use that variable for pyexecdir. + if test "x$exec_prefix" = xNONE; then + am__usable_exec_prefix=$am__usable_prefix + else + am__usable_exec_prefix=$exec_prefix + fi + # + if $am_use_python_sys; then # using python sys.exec_prefix, not GNU + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python default $am_display_PYTHON exec_prefix" >&5 +printf %s "checking for python default $am_display_PYTHON exec_prefix... " >&6; } +if test ${am_cv_python_exec_prefix+y} +then : + printf %s "(cached) " >&6 +else $as_nop + am_cv_python_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"` +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_exec_prefix" >&5 +printf "%s\n" "$am_cv_python_exec_prefix" >&6; } + case $am_cv_python_exec_prefix in + $am__usable_exec_prefix*) + am__strip_prefix=`echo "$am__usable_exec_prefix" | sed 's|.|.|g'` + am_python_exec_prefix_subst=`echo "$am_cv_python_exec_prefix" | sed "s,^$am__strip_prefix,\\${exec_prefix},"` + ;; + *) + am_python_exec_prefix_subst=$am_cv_python_exec_prefix + ;; + esac + else # using GNU $exec_prefix, not python sys.exec_prefix + am_python_exec_prefix_subst='${exec_prefix}' + am_python_exec_prefix=$am_python_exec_prefix_subst + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU default $am_display_PYTHON exec_prefix" >&5 +printf %s "checking for GNU default $am_display_PYTHON exec_prefix... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_python_exec_prefix" >&5 +printf "%s\n" "$am_python_exec_prefix" >&6; } + fi +fi +fi + + # Substituting python_exec_prefix_subst. + PYTHON_EXEC_PREFIX=$am_python_exec_prefix_subst + + + # Factor out some code duplication into this shell variable. + am_python_setup_sysconfig="\ +import sys +# Prefer sysconfig over distutils.sysconfig, for better compatibility +# with python 3.x. See automake bug#10227. +try: + import sysconfig +except ImportError: + can_use_sysconfig = 0 +else: + can_use_sysconfig = 1 +# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: +# +try: + from platform import python_implementation + if python_implementation() == 'CPython' and sys.version[:3] == '2.7': + can_use_sysconfig = 0 +except ImportError: + pass" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory (pythondir)" >&5 +printf %s "checking for $am_display_PYTHON script directory (pythondir)... " >&6; } +if test ${am_cv_python_pythondir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$am_cv_python_prefix" = x; then + am_py_prefix=$am__usable_prefix + else + am_py_prefix=$am_cv_python_prefix + fi + am_cv_python_pythondir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() + else: + scheme = sysconfig._get_default_scheme() + if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' + sitedir = sysconfig.get_path('purelib', scheme, vars={'base':'$am_py_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') +sys.stdout.write(sitedir)"` + # + case $am_cv_python_pythondir in + $am_py_prefix*) + am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` + am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,\\${PYTHON_PREFIX},"` + ;; + *) + case $am_py_prefix in + /usr|/System*) ;; + *) am_cv_python_pythondir="\${PYTHON_PREFIX}/lib/python$PYTHON_VERSION/site-packages" + ;; + esac + ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 +printf "%s\n" "$am_cv_python_pythondir" >&6; } + pythondir=$am_cv_python_pythondir + + + pkgpythondir=\${pythondir}/$PACKAGE + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory (pyexecdir)" >&5 +printf %s "checking for $am_display_PYTHON extension module directory (pyexecdir)... " >&6; } +if test ${am_cv_python_pyexecdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$am_cv_python_exec_prefix" = x; then + am_py_exec_prefix=$am__usable_exec_prefix + else + am_py_exec_prefix=$am_cv_python_exec_prefix + fi + am_cv_python_pyexecdir=`$PYTHON -c " +$am_python_setup_sysconfig +if can_use_sysconfig: + if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() + else: + scheme = sysconfig._get_default_scheme() + if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' + sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase':'$am_py_exec_prefix'}) +else: + from distutils import sysconfig + sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix') +sys.stdout.write(sitedir)"` + # + case $am_cv_python_pyexecdir in + $am_py_exec_prefix*) + am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` + am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,\\${PYTHON_EXEC_PREFIX},"` + ;; + *) + case $am_py_exec_prefix in + /usr|/System*) ;; + *) am_cv_python_pyexecdir="\${PYTHON_EXEC_PREFIX}/lib/python$PYTHON_VERSION/site-packages" + ;; + esac + ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 +printf "%s\n" "$am_cv_python_pyexecdir" >&6; } + pyexecdir=$am_cv_python_pyexecdir + + + pkgpyexecdir=\${pyexecdir}/$PACKAGE + + + + fi + + +if test "x$request_lib_only" = "xyes"; then + request_app=no + request_hpack_tools=no + request_examples=no + request_http3=no + request_libxml2=no + request_jansson=no + request_zlib=no + request_libevent_openssl=no + request_libcares=no + request_openssl=no + request_libev=no + request_jemalloc=no + request_systemd=no + request_mruby=no + request_neverbleed=no + request_libngtcp2=no + request_libnghttp3=no + request_libbpf=no +fi + +if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then + +printf "%s\n" "#define NGHTTP2_NORETURN __attribute__((noreturn))" >>confdefs.h + +else + +printf "%s\n" "#define NGHTTP2_NORETURN /**/" >>confdefs.h + +fi + +save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= + + ax_cxx_compile_alternatives="20" ax_cxx_compile_cxx20_required=false + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + ac_success=no + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++20 features by default" >&5 +printf %s "checking whether $CXX supports C++20 features by default... " >&6; } +if test ${ax_cv_cxx_compile_cxx20+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +// MSVC always sets __cplusplus to 199711L in older versions; newer versions +// only set it correctly if /Zc:__cplusplus is specified as well as a +// /std:c++NN switch: +// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ +#elif __cplusplus < 201103L && !defined _MSC_VER + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual ~Base() {} + virtual void f() {} + }; + + struct Derived : public Base + { + virtual ~Derived() override {} + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L && !defined _MSC_VER + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + + + + +// If the compiler admits that it is not ready for C++17, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201703L && !defined _MSC_VER + +#error "This is not a C++17 compiler" + +#else + +#include +#include +#include + +namespace cxx17 +{ + + namespace test_constexpr_lambdas + { + + constexpr int foo = [](){return 42;}(); + + } + + namespace test::nested_namespace::definitions + { + + } + + namespace test_fold_expression + { + + template + int multiply(Args... args) + { + return (args * ... * 1); + } + + template + bool all(Args... args) + { + return (args && ...); + } + + } + + namespace test_extended_static_assert + { + + static_assert (true); + + } + + namespace test_auto_brace_init_list + { + + auto foo = {5}; + auto bar {5}; + + static_assert(std::is_same, decltype(foo)>::value); + static_assert(std::is_same::value); + } + + namespace test_typename_in_template_template_parameter + { + + template typename X> struct D; + + } + + namespace test_fallthrough_nodiscard_maybe_unused_attributes + { + + int f1() + { + return 42; + } + + [[nodiscard]] int f2() + { + [[maybe_unused]] auto unused = f1(); + + switch (f1()) + { + case 17: + f1(); + [[fallthrough]]; + case 42: + f1(); + } + return f1(); + } + + } + + namespace test_extended_aggregate_initialization + { + + struct base1 + { + int b1, b2 = 42; + }; + + struct base2 + { + base2() { + b3 = 42; + } + int b3; + }; + + struct derived : base1, base2 + { + int d; + }; + + derived d1 {{1, 2}, {}, 4}; // full initialization + derived d2 {{}, {}, 4}; // value-initialized bases + + } + + namespace test_general_range_based_for_loop + { + + struct iter + { + int i; + + int& operator* () + { + return i; + } + + const int& operator* () const + { + return i; + } + + iter& operator++() + { + ++i; + return *this; + } + }; + + struct sentinel + { + int i; + }; + + bool operator== (const iter& i, const sentinel& s) + { + return i.i == s.i; + } + + bool operator!= (const iter& i, const sentinel& s) + { + return !(i == s); + } + + struct range + { + iter begin() const + { + return {0}; + } + + sentinel end() const + { + return {5}; + } + }; + + void f() + { + range r {}; + + for (auto i : r) + { + [[maybe_unused]] auto v = i; + } + } + + } + + namespace test_lambda_capture_asterisk_this_by_value + { + + struct t + { + int i; + int foo() + { + return [*this]() + { + return i; + }(); + } + }; + + } + + namespace test_enum_class_construction + { + + enum class byte : unsigned char + {}; + + byte foo {42}; + + } + + namespace test_constexpr_if + { + + template + int f () + { + if constexpr(cond) + { + return 13; + } + else + { + return 42; + } + } + + } + + namespace test_selection_statement_with_initializer + { + + int f() + { + return 13; + } + + int f2() + { + if (auto i = f(); i > 0) + { + return 3; + } + + switch (auto i = f(); i + 4) + { + case 17: + return 2; + + default: + return 1; + } + } + + } + + namespace test_template_argument_deduction_for_class_templates + { + + template + struct pair + { + pair (T1 p1, T2 p2) + : m1 {p1}, + m2 {p2} + {} + + T1 m1; + T2 m2; + }; + + void f() + { + [[maybe_unused]] auto p = pair{13, 42u}; + } + + } + + namespace test_non_type_auto_template_parameters + { + + template + struct B + {}; + + B<5> b1; + B<'a'> b2; + + } + + namespace test_structured_bindings + { + + int arr[2] = { 1, 2 }; + std::pair pr = { 1, 2 }; + + auto f1() -> int(&)[2] + { + return arr; + } + + auto f2() -> std::pair& + { + return pr; + } + + struct S + { + int x1 : 2; + volatile double y1; + }; + + S f3() + { + return {}; + } + + auto [ x1, y1 ] = f1(); + auto& [ xr1, yr1 ] = f1(); + auto [ x2, y2 ] = f2(); + auto& [ xr2, yr2 ] = f2(); + const auto [ x3, y3 ] = f3(); + + } + + namespace test_exception_spec_type_system + { + + struct Good {}; + struct Bad {}; + + void g1() noexcept; + void g2(); + + template + Bad + f(T*, T*); + + template + Good + f(T1*, T2*); + + static_assert (std::is_same_v); + + } + + namespace test_inline_variables + { + + template void f(T) + {} + + template inline T g(T) + { + return T{}; + } + + template<> inline void f<>(int) + {} + + template<> int g<>(int) + { + return 5; + } + + } + +} // namespace cxx17 + +#endif // __cplusplus < 201703L && !defined _MSC_VER + + + + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 202002L && !defined _MSC_VER + +#error "This is not a C++20 compiler" + +#else + +#include + +namespace cxx20 +{ + +// As C++20 supports feature test macros in the standard, there is no +// immediate need to actually test for feature availability on the +// Autoconf side. + +} // namespace cxx20 + +#endif // __cplusplus < 202002L && !defined _MSC_VER + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ax_cv_cxx_compile_cxx20=yes +else $as_nop + ax_cv_cxx_compile_cxx20=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx20" >&5 +printf "%s\n" "$ax_cv_cxx_compile_cxx20" >&6; } + if test x$ax_cv_cxx_compile_cxx20 = xyes; then + ac_success=yes + fi + + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + switch="-std=gnu++${alternative}" + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx20_$switch" | $as_tr_sh` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++20 features with $switch" >&5 +printf %s "checking whether $CXX supports C++20 features with $switch... " >&6; } +if eval test \${$cachevar+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CXX="$CXX" + CXX="$CXX $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +// MSVC always sets __cplusplus to 199711L in older versions; newer versions +// only set it correctly if /Zc:__cplusplus is specified as well as a +// /std:c++NN switch: +// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ +#elif __cplusplus < 201103L && !defined _MSC_VER + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual ~Base() {} + virtual void f() {} + }; + + struct Derived : public Base + { + virtual ~Derived() override {} + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L && !defined _MSC_VER + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + + + + +// If the compiler admits that it is not ready for C++17, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201703L && !defined _MSC_VER + +#error "This is not a C++17 compiler" + +#else + +#include +#include +#include + +namespace cxx17 +{ + + namespace test_constexpr_lambdas + { + + constexpr int foo = [](){return 42;}(); + + } + + namespace test::nested_namespace::definitions + { + + } + + namespace test_fold_expression + { + + template + int multiply(Args... args) + { + return (args * ... * 1); + } + + template + bool all(Args... args) + { + return (args && ...); + } + + } + + namespace test_extended_static_assert + { + + static_assert (true); + + } + + namespace test_auto_brace_init_list + { + + auto foo = {5}; + auto bar {5}; + + static_assert(std::is_same, decltype(foo)>::value); + static_assert(std::is_same::value); + } + + namespace test_typename_in_template_template_parameter + { + + template typename X> struct D; + + } + + namespace test_fallthrough_nodiscard_maybe_unused_attributes + { + + int f1() + { + return 42; + } + + [[nodiscard]] int f2() + { + [[maybe_unused]] auto unused = f1(); + + switch (f1()) + { + case 17: + f1(); + [[fallthrough]]; + case 42: + f1(); + } + return f1(); + } + + } + + namespace test_extended_aggregate_initialization + { + + struct base1 + { + int b1, b2 = 42; + }; + + struct base2 + { + base2() { + b3 = 42; + } + int b3; + }; + + struct derived : base1, base2 + { + int d; + }; + + derived d1 {{1, 2}, {}, 4}; // full initialization + derived d2 {{}, {}, 4}; // value-initialized bases + + } + + namespace test_general_range_based_for_loop + { + + struct iter + { + int i; + + int& operator* () + { + return i; + } + + const int& operator* () const + { + return i; + } + + iter& operator++() + { + ++i; + return *this; + } + }; + + struct sentinel + { + int i; + }; + + bool operator== (const iter& i, const sentinel& s) + { + return i.i == s.i; + } + + bool operator!= (const iter& i, const sentinel& s) + { + return !(i == s); + } + + struct range + { + iter begin() const + { + return {0}; + } + + sentinel end() const + { + return {5}; + } + }; + + void f() + { + range r {}; + + for (auto i : r) + { + [[maybe_unused]] auto v = i; + } + } + + } + + namespace test_lambda_capture_asterisk_this_by_value + { + + struct t + { + int i; + int foo() + { + return [*this]() + { + return i; + }(); + } + }; + + } + + namespace test_enum_class_construction + { + + enum class byte : unsigned char + {}; + + byte foo {42}; + + } + + namespace test_constexpr_if + { + + template + int f () + { + if constexpr(cond) + { + return 13; + } + else + { + return 42; + } + } + + } + + namespace test_selection_statement_with_initializer + { + + int f() + { + return 13; + } + + int f2() + { + if (auto i = f(); i > 0) + { + return 3; + } + + switch (auto i = f(); i + 4) + { + case 17: + return 2; + + default: + return 1; + } + } + + } + + namespace test_template_argument_deduction_for_class_templates + { + + template + struct pair + { + pair (T1 p1, T2 p2) + : m1 {p1}, + m2 {p2} + {} + + T1 m1; + T2 m2; + }; + + void f() + { + [[maybe_unused]] auto p = pair{13, 42u}; + } + + } + + namespace test_non_type_auto_template_parameters + { + + template + struct B + {}; + + B<5> b1; + B<'a'> b2; + + } + + namespace test_structured_bindings + { + + int arr[2] = { 1, 2 }; + std::pair pr = { 1, 2 }; + + auto f1() -> int(&)[2] + { + return arr; + } + + auto f2() -> std::pair& + { + return pr; + } + + struct S + { + int x1 : 2; + volatile double y1; + }; + + S f3() + { + return {}; + } + + auto [ x1, y1 ] = f1(); + auto& [ xr1, yr1 ] = f1(); + auto [ x2, y2 ] = f2(); + auto& [ xr2, yr2 ] = f2(); + const auto [ x3, y3 ] = f3(); + + } + + namespace test_exception_spec_type_system + { + + struct Good {}; + struct Bad {}; + + void g1() noexcept; + void g2(); + + template + Bad + f(T*, T*); + + template + Good + f(T1*, T2*); + + static_assert (std::is_same_v); + + } + + namespace test_inline_variables + { + + template void f(T) + {} + + template inline T g(T) + { + return T{}; + } + + template<> inline void f<>(int) + {} + + template<> int g<>(int) + { + return 5; + } + + } + +} // namespace cxx17 + +#endif // __cplusplus < 201703L && !defined _MSC_VER + + + + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 202002L && !defined _MSC_VER + +#error "This is not a C++20 compiler" + +#else + +#include + +namespace cxx20 +{ + +// As C++20 supports feature test macros in the standard, there is no +// immediate need to actually test for feature availability on the +// Autoconf side. + +} // namespace cxx20 + +#endif // __cplusplus < 202002L && !defined _MSC_VER + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + eval $cachevar=yes +else $as_nop + eval $cachevar=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXX="$ac_save_CXX" +fi +eval ac_res=\$$cachevar + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi + + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do + if test x"$switch" = xMSVC; then + switch=-std:c++${alternative} + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx20_${switch}_MSVC" | $as_tr_sh` + else + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx20_$switch" | $as_tr_sh` + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++20 features with $switch" >&5 +printf %s "checking whether $CXX supports C++20 features with $switch... " >&6; } +if eval test \${$cachevar+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CXX="$CXX" + CXX="$CXX $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +// MSVC always sets __cplusplus to 199711L in older versions; newer versions +// only set it correctly if /Zc:__cplusplus is specified as well as a +// /std:c++NN switch: +// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ +#elif __cplusplus < 201103L && !defined _MSC_VER + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual ~Base() {} + virtual void f() {} + }; + + struct Derived : public Base + { + virtual ~Derived() override {} + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L && !defined _MSC_VER + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + + + + +// If the compiler admits that it is not ready for C++17, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201703L && !defined _MSC_VER + +#error "This is not a C++17 compiler" + +#else + +#include +#include +#include + +namespace cxx17 +{ + + namespace test_constexpr_lambdas + { + + constexpr int foo = [](){return 42;}(); + + } + + namespace test::nested_namespace::definitions + { + + } + + namespace test_fold_expression + { + + template + int multiply(Args... args) + { + return (args * ... * 1); + } + + template + bool all(Args... args) + { + return (args && ...); + } + + } + + namespace test_extended_static_assert + { + + static_assert (true); + + } + + namespace test_auto_brace_init_list + { + + auto foo = {5}; + auto bar {5}; + + static_assert(std::is_same, decltype(foo)>::value); + static_assert(std::is_same::value); + } + + namespace test_typename_in_template_template_parameter + { + + template typename X> struct D; + + } + + namespace test_fallthrough_nodiscard_maybe_unused_attributes + { + + int f1() + { + return 42; + } + + [[nodiscard]] int f2() + { + [[maybe_unused]] auto unused = f1(); + + switch (f1()) + { + case 17: + f1(); + [[fallthrough]]; + case 42: + f1(); + } + return f1(); + } + + } + + namespace test_extended_aggregate_initialization + { + + struct base1 + { + int b1, b2 = 42; + }; + + struct base2 + { + base2() { + b3 = 42; + } + int b3; + }; + + struct derived : base1, base2 + { + int d; + }; + + derived d1 {{1, 2}, {}, 4}; // full initialization + derived d2 {{}, {}, 4}; // value-initialized bases + + } + + namespace test_general_range_based_for_loop + { + + struct iter + { + int i; + + int& operator* () + { + return i; + } + + const int& operator* () const + { + return i; + } + + iter& operator++() + { + ++i; + return *this; + } + }; + + struct sentinel + { + int i; + }; + + bool operator== (const iter& i, const sentinel& s) + { + return i.i == s.i; + } + + bool operator!= (const iter& i, const sentinel& s) + { + return !(i == s); + } + + struct range + { + iter begin() const + { + return {0}; + } + + sentinel end() const + { + return {5}; + } + }; + + void f() + { + range r {}; + + for (auto i : r) + { + [[maybe_unused]] auto v = i; + } + } + + } + + namespace test_lambda_capture_asterisk_this_by_value + { + + struct t + { + int i; + int foo() + { + return [*this]() + { + return i; + }(); + } + }; + + } + + namespace test_enum_class_construction + { + + enum class byte : unsigned char + {}; + + byte foo {42}; + + } + + namespace test_constexpr_if + { + + template + int f () + { + if constexpr(cond) + { + return 13; + } + else + { + return 42; + } + } + + } + + namespace test_selection_statement_with_initializer + { + + int f() + { + return 13; + } + + int f2() + { + if (auto i = f(); i > 0) + { + return 3; + } + + switch (auto i = f(); i + 4) + { + case 17: + return 2; + + default: + return 1; + } + } + + } + + namespace test_template_argument_deduction_for_class_templates + { + + template + struct pair + { + pair (T1 p1, T2 p2) + : m1 {p1}, + m2 {p2} + {} + + T1 m1; + T2 m2; + }; + + void f() + { + [[maybe_unused]] auto p = pair{13, 42u}; + } + + } + + namespace test_non_type_auto_template_parameters + { + + template + struct B + {}; + + B<5> b1; + B<'a'> b2; + + } + + namespace test_structured_bindings + { + + int arr[2] = { 1, 2 }; + std::pair pr = { 1, 2 }; + + auto f1() -> int(&)[2] + { + return arr; + } + + auto f2() -> std::pair& + { + return pr; + } + + struct S + { + int x1 : 2; + volatile double y1; + }; + + S f3() + { + return {}; + } + + auto [ x1, y1 ] = f1(); + auto& [ xr1, yr1 ] = f1(); + auto [ x2, y2 ] = f2(); + auto& [ xr2, yr2 ] = f2(); + const auto [ x3, y3 ] = f3(); + + } + + namespace test_exception_spec_type_system + { + + struct Good {}; + struct Bad {}; + + void g1() noexcept; + void g2(); + + template + Bad + f(T*, T*); + + template + Good + f(T1*, T2*); + + static_assert (std::is_same_v); + + } + + namespace test_inline_variables + { + + template void f(T) + {} + + template inline T g(T) + { + return T{}; + } + + template<> inline void f<>(int) + {} + + template<> int g<>(int) + { + return 5; + } + + } + +} // namespace cxx17 + +#endif // __cplusplus < 201703L && !defined _MSC_VER + + + + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 202002L && !defined _MSC_VER + +#error "This is not a C++20 compiler" + +#else + +#include + +namespace cxx20 +{ + +// As C++20 supports feature test macros in the standard, there is no +// immediate need to actually test for feature availability on the +// Autoconf side. + +} // namespace cxx20 + +#endif // __cplusplus < 202002L && !defined _MSC_VER + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + eval $cachevar=yes +else $as_nop + eval $cachevar=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXX="$ac_save_CXX" +fi +eval ac_res=\$$cachevar + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + if test x$ac_success = xyes; then + break + fi + done + fi + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test x$ax_cxx_compile_cxx20_required = xtrue; then + if test x$ac_success = xno; then + as_fn_error $? "*** A compiler with support for C++20 language features is required." "$LINENO" 5 + fi + fi + if test x$ac_success = xno; then + HAVE_CXX20=0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++20 support was found" >&5 +printf "%s\n" "$as_me: No compiler with C++20 support was found" >&6;} + else + HAVE_CXX20=1 + +printf "%s\n" "#define HAVE_CXX20 1" >>confdefs.h + + fi + + + +CXX1XCXXFLAGS="$CXXFLAGS" +CXXFLAGS="$save_CXXFLAGS" + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $CXX1XCXXFLAGS" + +# Check that std::future is available. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether std::future is available" >&5 +printf %s "checking whether std::future is available... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main (void) +{ + +std::vector> v; +(void)v; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +printf "%s\n" "#define HAVE_STD_FUTURE 1" >>confdefs.h + + have_std_future=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + have_std_future=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +# Check that std::map::emplace is available for g++-4.7. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether std::map::emplace is available" >&5 +printf %s "checking whether std::map::emplace is available... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main (void) +{ + +std::map().emplace(1, 2); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +printf "%s\n" "#define HAVE_STD_MAP_EMPLACE 1" >>confdefs.h + + have_std_map_emplace=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + have_std_map_emplace=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +# Check that std::atomic> is supported. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether std::atomic> is supported" >&5 +printf %s "checking whether std::atomic> is supported... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main (void) +{ + +auto a = std::atomic>(std::make_shared(1000000007)); +auto p = a.load(); +++*p; +a.store(p); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +printf "%s\n" "#define HAVE_ATOMIC_STD_SHARED_PTR 1" >>confdefs.h + + have_atomic_std_shared_ptr=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + have_atomic_std_shared_ptr=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +# Check that thread_local storage specifier is available +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether thread_local storage class specifier is available." >&5 +printf %s "checking whether thread_local storage class specifier is available.... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + +thread_local int a = 0; +(void)a; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +printf "%s\n" "#define HAVE_THREAD_LOCAL 1" >>confdefs.h + + have_thread_local=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + have_Thread_local=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +CXXFLAGS=$save_CXXFLAGS + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Checks for libraries. + +# Additional libraries required for tests. +TESTLDADD= + +# Additional libraries required for programs under src directory. +APPLDFLAGS= + +case "$host_os" in + *android*) + android_build=yes + # android does not need -pthread, but needs following 2 libs for C++ + APPLDFLAGS="$APPLDFLAGS -latomic" + ;; + *) + PTHREAD_LDFLAGS="-pthread" + APPLDFLAGS="$APPLDFLAGS $PTHREAD_LDFLAGS" + ;; +esac + +case "$host_os" in + *solaris*) + APPLDFLAGS="$APPLDFLAGS -lsocket -lnsl" + ;; +esac + +case "${build}" in + *-apple-darwin*) + EXTRA_DEFS="-D__APPLE_USE_RFC_3542" + + ;; +esac + +# zlib +have_zlib=no +if test "x${request_zlib}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib >= 1.2.3" >&5 +printf %s "checking for zlib >= 1.2.3... " >&6; } + +if test -n "$ZLIB_CFLAGS"; then + pkg_cv_ZLIB_CFLAGS="$ZLIB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib >= 1.2.3") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ZLIB_CFLAGS=`$PKG_CONFIG --cflags "zlib >= 1.2.3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$ZLIB_LIBS"; then + pkg_cv_ZLIB_LIBS="$ZLIB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.3\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib >= 1.2.3") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_ZLIB_LIBS=`$PKG_CONFIG --libs "zlib >= 1.2.3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + ZLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib >= 1.2.3" 2>&1` + else + ZLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib >= 1.2.3" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$ZLIB_PKG_ERRORS" >&5 + + have_zlib=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_zlib=no +else + ZLIB_CFLAGS=$pkg_cv_ZLIB_CFLAGS + ZLIB_LIBS=$pkg_cv_ZLIB_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_zlib=yes +fi + + if test "x${have_zlib}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ZLIB_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $ZLIB_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_zlib}" = "xyes" && + test "x${have_zlib}" != "xyes"; then + as_fn_error $? "zlib was requested (--with-zlib) but not found" "$LINENO" 5 +fi + +# dl: openssl requires libdl when it is statically linked. +case "${host_os}" in + *bsd*) + # dlopen is in libc on *BSD + ;; + *) + save_LIBS=$LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +printf %s "checking for library containing dlopen... " >&6; } +if test ${ac_cv_search_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_dlopen+y} +then : + break +fi +done +if test ${ac_cv_search_dlopen+y} +then : + +else $as_nop + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +printf "%s\n" "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + APPLDFLAGS="-ldl $APPLDFLAGS" +fi + + LIBS=$save_LIBS + ;; +esac + +# libev (for src) +have_libev=no +if test "x${request_libev}" != "xno"; then + if test "x${LIBEV_LIBS}" = "x" && test "x${LIBEV_CFLAGS}" = "x"; then + # libev does not have pkg-config file. Check it in an old way. + save_LIBS=$LIBS + # android requires -lm for floor + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ev_time in -lev" >&5 +printf %s "checking for ev_time in -lev... " >&6; } +if test ${ac_cv_lib_ev_ev_time+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lev -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char ev_time (); +int +main (void) +{ +return ev_time (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_ev_ev_time=yes +else $as_nop + ac_cv_lib_ev_ev_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ev_ev_time" >&5 +printf "%s\n" "$ac_cv_lib_ev_ev_time" >&6; } +if test "x$ac_cv_lib_ev_ev_time" = xyes +then : + have_libev=yes +else $as_nop + have_libev=no +fi + + if test "x${have_libev}" = "xyes"; then + ac_fn_c_check_header_compile "$LINENO" "ev.h" "ac_cv_header_ev_h" "$ac_includes_default" +if test "x$ac_cv_header_ev_h" = xyes +then : + have_libev=yes +else $as_nop + have_libev=no +fi + + if test "x${have_libev}" = "xyes"; then + LIBEV_LIBS=-lev + LIBEV_CFLAGS= + fi + fi + LIBS=$save_LIBS + else + have_libev=yes + fi + + if test "x${have_libev}" = "xyes"; then + +printf "%s\n" "#define HAVE_LIBEV 1" >>confdefs.h + + fi +fi + +if test "x${request_libev}" = "xyes" && + test "x${have_libev}" != "xyes"; then + as_fn_error $? "libev was requested (--with-libev) but not found" "$LINENO" 5 +fi + +if test "x${request_openssl}" = "xyes" && + test "x${request_wolfssl}" = "xyes"; then + as_fn_error $? "Requesting both OpenSSL and wolfSSL is not allowed" "$LINENO" 5 +fi + +# openssl (for src) +have_openssl=no +if test "x${request_openssl}" != "xno" && + test "x${request_wolfssl}" != "xyes"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for openssl >= 1.1.1" >&5 +printf %s "checking for openssl >= 1.1.1... " >&6; } + +if test -n "$OPENSSL_CFLAGS"; then + pkg_cv_OPENSSL_CFLAGS="$OPENSSL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 1.1.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "openssl >= 1.1.1") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "openssl >= 1.1.1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$OPENSSL_LIBS"; then + pkg_cv_OPENSSL_LIBS="$OPENSSL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl >= 1.1.1\""; } >&5 + ($PKG_CONFIG --exists --print-errors "openssl >= 1.1.1") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_OPENSSL_LIBS=`$PKG_CONFIG --libs "openssl >= 1.1.1" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl >= 1.1.1" 2>&1` + else + OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl >= 1.1.1" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$OPENSSL_PKG_ERRORS" >&5 + + have_openssl=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_openssl=no +else + OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS + OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_openssl=yes +fi + if test "x${have_openssl}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $OPENSSL_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $OPENSSL_PKG_ERRORS" >&6;} + else + # Use C++ compiler because boringssl needs C++ runtime. + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + save_CXXFLAGS="$CXXFLAGS" + save_LIBS="$LIBS" + CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS" + LIBS="$OPENSSL_LIBS $LIBS" + + # quictls/openssl has SSL_provide_quic_data. boringssl also has + # it. We will deal with it later. + have_ssl_provide_quic_data=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_provide_quic_data" >&5 +printf %s "checking for SSL_provide_quic_data... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + +int +main (void) +{ + + SSL_provide_quic_data(NULL, (ssl_encryption_level_t)0, NULL, 0); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; }; have_ssl_provide_quic_data=yes +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; }; have_ssl_provide_quic_data=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + # boringssl has SSL_set_quic_early_data_context. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_set_quic_early_data_context" >&5 +printf %s "checking for SSL_set_quic_early_data_context... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + +int +main (void) +{ + + SSL *ssl = NULL; + SSL_set_quic_early_data_context(ssl, NULL, 0); + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; }; have_boringssl_quic=yes +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; }; have_boringssl_quic=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + CXXFLAGS="$save_CXXFLAGS" + LIBS="$save_LIBS" + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + fi +fi + +if test "x${request_openssl}" = "xyes" && + test "x${have_openssl}" != "xyes"; then + as_fn_error $? "openssl was requested (--with-openssl) but not found" "$LINENO" 5 +fi + +# wolfSSL (for src) +have_wolfssl=no +if test "x${request_wolfssl}" != "xno" && + test "x${request_openssl}" != "xyes" && + test "x${have_openssl}" != "xyes"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wolfssl >= 5.7.0" >&5 +printf %s "checking for wolfssl >= 5.7.0... " >&6; } + +if test -n "$WOLFSSL_CFLAGS"; then + pkg_cv_WOLFSSL_CFLAGS="$WOLFSSL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"wolfssl >= 5.7.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "wolfssl >= 5.7.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_WOLFSSL_CFLAGS=`$PKG_CONFIG --cflags "wolfssl >= 5.7.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$WOLFSSL_LIBS"; then + pkg_cv_WOLFSSL_LIBS="$WOLFSSL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"wolfssl >= 5.7.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "wolfssl >= 5.7.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_WOLFSSL_LIBS=`$PKG_CONFIG --libs "wolfssl >= 5.7.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + WOLFSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "wolfssl >= 5.7.0" 2>&1` + else + WOLFSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "wolfssl >= 5.7.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$WOLFSSL_PKG_ERRORS" >&5 + + have_wolfssl=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_wolfssl=no +else + WOLFSSL_CFLAGS=$pkg_cv_WOLFSSL_CFLAGS + WOLFSSL_LIBS=$pkg_cv_WOLFSSL_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_wolfssl=yes +fi + if test "x${have_wolfssl}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $WOLFSSL_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $WOLFSSL_PKG_ERRORS" >&6;} + else + +printf "%s\n" "#define HAVE_WOLFSSL 1" >>confdefs.h + + + save_CFLAGS="$CFLAGS" + save_LIBS="$LIBS" + CFLAGS="$WOLFSSL_CFLAGS $CFLAGS" + LIBS="$WOLFSSL_LIBS $LIBS" + + have_wolfssl_quic=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wolfSSL QUIC" >&5 +printf %s "checking for wolfSSL QUIC... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + +int +main (void) +{ + + SSL_provide_quic_data(NULL, 0, NULL, 0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; }; have_wolfssl_quic=yes +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; }; have_wolfssl_quic=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + CFLAGS="$save_CFLAGS" + LIBS="$save_LIBS" + fi +fi + +if test "x${request_wolfssl}" = "xyes" && + test "x${have_wolfssl}" != "xyes"; then + as_fn_error $? "wolfSSL was requested (--with-wolfssl) but not found" "$LINENO" 5 +fi + +# c-ares (for src) +have_libcares=no +if test "x${request_libcares}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libcares >= 1.16.0" >&5 +printf %s "checking for libcares >= 1.16.0... " >&6; } + +if test -n "$LIBCARES_CFLAGS"; then + pkg_cv_LIBCARES_CFLAGS="$LIBCARES_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcares >= 1.16.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcares >= 1.16.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBCARES_CFLAGS=`$PKG_CONFIG --cflags "libcares >= 1.16.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBCARES_LIBS"; then + pkg_cv_LIBCARES_LIBS="$LIBCARES_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcares >= 1.16.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libcares >= 1.16.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBCARES_LIBS=`$PKG_CONFIG --libs "libcares >= 1.16.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBCARES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcares >= 1.16.0" 2>&1` + else + LIBCARES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcares >= 1.16.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBCARES_PKG_ERRORS" >&5 + + have_libcares=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libcares=no +else + LIBCARES_CFLAGS=$pkg_cv_LIBCARES_CFLAGS + LIBCARES_LIBS=$pkg_cv_LIBCARES_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libcares=yes +fi + if test "x${have_libcares}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBCARES_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBCARES_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_libcares}" = "xyes" && + test "x${have_libcares}" != "xyes"; then + as_fn_error $? "libcares was requested (--with-libcares) but not found" "$LINENO" 5 +fi + +# ngtcp2 (for src) +have_libngtcp2=no +if test "x${request_libngtcp2}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libngtcp2 >= 1.4.0" >&5 +printf %s "checking for libngtcp2 >= 1.4.0... " >&6; } + +if test -n "$LIBNGTCP2_CFLAGS"; then + pkg_cv_LIBNGTCP2_CFLAGS="$LIBNGTCP2_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libngtcp2 >= 1.4.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libngtcp2 >= 1.4.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGTCP2_CFLAGS=`$PKG_CONFIG --cflags "libngtcp2 >= 1.4.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBNGTCP2_LIBS"; then + pkg_cv_LIBNGTCP2_LIBS="$LIBNGTCP2_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libngtcp2 >= 1.4.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libngtcp2 >= 1.4.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGTCP2_LIBS=`$PKG_CONFIG --libs "libngtcp2 >= 1.4.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBNGTCP2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libngtcp2 >= 1.4.0" 2>&1` + else + LIBNGTCP2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libngtcp2 >= 1.4.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBNGTCP2_PKG_ERRORS" >&5 + + have_libngtcp2=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libngtcp2=no +else + LIBNGTCP2_CFLAGS=$pkg_cv_LIBNGTCP2_CFLAGS + LIBNGTCP2_LIBS=$pkg_cv_LIBNGTCP2_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libngtcp2=yes +fi + if test "x${have_libngtcp2}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBNGTCP2_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBNGTCP2_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_libngtcp2}" = "xyes" && + test "x${have_libngtcp2}" != "xyes"; then + as_fn_error $? "libngtcp2 was requested (--with-libngtcp2) but not found" "$LINENO" 5 +fi + +# ngtcp2_crypto_wolfssl (for src) +have_libngtcp2_crypto_wolfssl=no +if test "x${have_wolfssl_quic}" = "xyes" && + test "x${request_libngtcp2}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libngtcp2_crypto_wolfssl >= 1.0.0" >&5 +printf %s "checking for libngtcp2_crypto_wolfssl >= 1.0.0... " >&6; } + +if test -n "$LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS"; then + pkg_cv_LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS="$LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libngtcp2_crypto_wolfssl >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libngtcp2_crypto_wolfssl >= 1.0.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS=`$PKG_CONFIG --cflags "libngtcp2_crypto_wolfssl >= 1.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBNGTCP2_CRYPTO_WOLFSSL_LIBS"; then + pkg_cv_LIBNGTCP2_CRYPTO_WOLFSSL_LIBS="$LIBNGTCP2_CRYPTO_WOLFSSL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libngtcp2_crypto_wolfssl >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libngtcp2_crypto_wolfssl >= 1.0.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGTCP2_CRYPTO_WOLFSSL_LIBS=`$PKG_CONFIG --libs "libngtcp2_crypto_wolfssl >= 1.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBNGTCP2_CRYPTO_WOLFSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libngtcp2_crypto_wolfssl >= 1.0.0" 2>&1` + else + LIBNGTCP2_CRYPTO_WOLFSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libngtcp2_crypto_wolfssl >= 1.0.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBNGTCP2_CRYPTO_WOLFSSL_PKG_ERRORS" >&5 + + have_libngtcp2_crypto_wolfssl=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libngtcp2_crypto_wolfssl=no +else + LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS=$pkg_cv_LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS + LIBNGTCP2_CRYPTO_WOLFSSL_LIBS=$pkg_cv_LIBNGTCP2_CRYPTO_WOLFSSL_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libngtcp2_crypto_wolfssl=yes +fi + if test "x${have_libngtcp2_crypto_wolfssl}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBNGTCP2_CRYPTO_WOLFSSL_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBNGTCP2_CRYPTO_WOLFSSL_PKG_ERRORS" >&6;} + else + +printf "%s\n" "#define HAVE_LIBNGTCP2_CRYPTO_WOLFSSL 1" >>confdefs.h + + fi +fi + +if test "x${have_wolfssl_quic}" = "xyes" && + test "x${request_libngtcp2}" = "xyes" && + test "x${have_libngtcp2_crypto_wolfssl}" != "xyes"; then + as_fn_error $? "libngtcp2_crypto_wolfssl was requested (--with-libngtcp2) but not found" "$LINENO" 5 +fi + +# ngtcp2_crypto_quictls (for src) +have_libngtcp2_crypto_quictls=no +if test "x${have_ssl_provide_quic_data}" = "xyes" && + test "x${have_boringssl_quic}" != "xyes" && + test "x${request_libngtcp2}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libngtcp2_crypto_quictls >= 1.0.0" >&5 +printf %s "checking for libngtcp2_crypto_quictls >= 1.0.0... " >&6; } + +if test -n "$LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS"; then + pkg_cv_LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS="$LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libngtcp2_crypto_quictls >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libngtcp2_crypto_quictls >= 1.0.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS=`$PKG_CONFIG --cflags "libngtcp2_crypto_quictls >= 1.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBNGTCP2_CRYPTO_QUICTLS_LIBS"; then + pkg_cv_LIBNGTCP2_CRYPTO_QUICTLS_LIBS="$LIBNGTCP2_CRYPTO_QUICTLS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libngtcp2_crypto_quictls >= 1.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libngtcp2_crypto_quictls >= 1.0.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGTCP2_CRYPTO_QUICTLS_LIBS=`$PKG_CONFIG --libs "libngtcp2_crypto_quictls >= 1.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBNGTCP2_CRYPTO_QUICTLS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libngtcp2_crypto_quictls >= 1.0.0" 2>&1` + else + LIBNGTCP2_CRYPTO_QUICTLS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libngtcp2_crypto_quictls >= 1.0.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBNGTCP2_CRYPTO_QUICTLS_PKG_ERRORS" >&5 + + have_libngtcp2_crypto_quictls=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libngtcp2_crypto_quictls=no +else + LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS=$pkg_cv_LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS + LIBNGTCP2_CRYPTO_QUICTLS_LIBS=$pkg_cv_LIBNGTCP2_CRYPTO_QUICTLS_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libngtcp2_crypto_quictls=yes +fi + if test "x${have_libngtcp2_crypto_quictls}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBNGTCP2_CRYPTO_QUICTLS_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBNGTCP2_CRYPTO_QUICTLS_PKG_ERRORS" >&6;} + else + +printf "%s\n" "#define HAVE_LIBNGTCP2_CRYPTO_QUICTLS 1" >>confdefs.h + + fi +fi + +if test "x${have_ssl_provide_quic_data}" = "xyes" && + test "x${have_boringssl_quic}" != "xyes" && + test "x${request_libngtcp2}" = "xyes" && + test "x${have_libngtcp2_crypto_quictls}" != "xyes"; then + as_fn_error $? "libngtcp2_crypto_quictls was requested (--with-libngtcp2) but not found" "$LINENO" 5 +fi + +# ngtcp2_crypto_boringssl (for src) +have_libngtcp2_crypto_boringssl=no +if test "x${have_boringssl_quic}" = "xyes" && + test "x${request_libngtcp2}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libngtcp2_crypto_boringssl >= 0.0.0" >&5 +printf %s "checking for libngtcp2_crypto_boringssl >= 0.0.0... " >&6; } + +if test -n "$LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS"; then + pkg_cv_LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS="$LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libngtcp2_crypto_boringssl >= 0.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libngtcp2_crypto_boringssl >= 0.0.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS=`$PKG_CONFIG --cflags "libngtcp2_crypto_boringssl >= 0.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBNGTCP2_CRYPTO_BORINGSSL_LIBS"; then + pkg_cv_LIBNGTCP2_CRYPTO_BORINGSSL_LIBS="$LIBNGTCP2_CRYPTO_BORINGSSL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libngtcp2_crypto_boringssl >= 0.0.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libngtcp2_crypto_boringssl >= 0.0.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGTCP2_CRYPTO_BORINGSSL_LIBS=`$PKG_CONFIG --libs "libngtcp2_crypto_boringssl >= 0.0.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBNGTCP2_CRYPTO_BORINGSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libngtcp2_crypto_boringssl >= 0.0.0" 2>&1` + else + LIBNGTCP2_CRYPTO_BORINGSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libngtcp2_crypto_boringssl >= 0.0.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBNGTCP2_CRYPTO_BORINGSSL_PKG_ERRORS" >&5 + + have_libngtcp2_crypto_boringssl=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libngtcp2_crypto_boringssl=no +else + LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS=$pkg_cv_LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS + LIBNGTCP2_CRYPTO_BORINGSSL_LIBS=$pkg_cv_LIBNGTCP2_CRYPTO_BORINGSSL_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libngtcp2_crypto_boringssl=yes +fi + if test "x${have_libngtcp2_crypto_boringssl}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBNGTCP2_CRYPTO_BORINGSSL_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBNGTCP2_CRYPTO_BORINGSSL_PKG_ERRORS" >&6;} + else + +printf "%s\n" "#define HAVE_LIBNGTCP2_CRYPTO_BORINGSSL 1" >>confdefs.h + + fi +fi + +if test "x${have_boringssl_quic}" = "xyes" && + test "x${request_libngtcp2}" = "xyes" && + test "x${have_libngtcp2_crypto_boringssl}" != "xyes"; then + as_fn_error $? "libngtcp2_crypto_boringssl was requested (--with-libngtcp2) but not found" "$LINENO" 5 +fi + +# nghttp3 (for src) +have_libnghttp3=no +if test "x${request_libnghttp3}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libnghttp3 >= 1.1.0" >&5 +printf %s "checking for libnghttp3 >= 1.1.0... " >&6; } + +if test -n "$LIBNGHTTP3_CFLAGS"; then + pkg_cv_LIBNGHTTP3_CFLAGS="$LIBNGHTTP3_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnghttp3 >= 1.1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libnghttp3 >= 1.1.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGHTTP3_CFLAGS=`$PKG_CONFIG --cflags "libnghttp3 >= 1.1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBNGHTTP3_LIBS"; then + pkg_cv_LIBNGHTTP3_LIBS="$LIBNGHTTP3_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnghttp3 >= 1.1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libnghttp3 >= 1.1.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBNGHTTP3_LIBS=`$PKG_CONFIG --libs "libnghttp3 >= 1.1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBNGHTTP3_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnghttp3 >= 1.1.0" 2>&1` + else + LIBNGHTTP3_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnghttp3 >= 1.1.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBNGHTTP3_PKG_ERRORS" >&5 + + have_libnghttp3=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libnghttp3=no +else + LIBNGHTTP3_CFLAGS=$pkg_cv_LIBNGHTTP3_CFLAGS + LIBNGHTTP3_LIBS=$pkg_cv_LIBNGHTTP3_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libnghttp3=yes +fi + if test "x${have_libnghttp3}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBNGHTTP3_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBNGHTTP3_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_libnghttp3}" = "xyes" && + test "x${have_libnghttp3}" != "xyes"; then + as_fn_error $? "libnghttp3 was requested (--with-libnghttp3) but not found" "$LINENO" 5 +fi + +# libbpf (for src) +have_libbpf=no +if test "x${request_libbpf}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libbpf >= 0.7.0" >&5 +printf %s "checking for libbpf >= 0.7.0... " >&6; } + +if test -n "$LIBBPF_CFLAGS"; then + pkg_cv_LIBBPF_CFLAGS="$LIBBPF_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libbpf >= 0.7.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libbpf >= 0.7.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBBPF_CFLAGS=`$PKG_CONFIG --cflags "libbpf >= 0.7.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBBPF_LIBS"; then + pkg_cv_LIBBPF_LIBS="$LIBBPF_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libbpf >= 0.7.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libbpf >= 0.7.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBBPF_LIBS=`$PKG_CONFIG --libs "libbpf >= 0.7.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBBPF_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libbpf >= 0.7.0" 2>&1` + else + LIBBPF_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libbpf >= 0.7.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBBPF_PKG_ERRORS" >&5 + + have_libbpf=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libbpf=no +else + LIBBPF_CFLAGS=$pkg_cv_LIBBPF_CFLAGS + LIBBPF_LIBS=$pkg_cv_LIBBPF_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libbpf=yes +fi + if test "x${have_libbpf}" = "xyes"; then + +printf "%s\n" "#define HAVE_LIBBPF 1" >>confdefs.h + + if test "x${BPFCFLAGS}" = "x"; then + BPFCFLAGS="-Wall -O2 -g" + fi + # Add the include path for Debian + EXTRABPFCFLAGS="-I/usr/include/$host_cpu-$host_os" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether enum bpf_stats_type is defined in linux/bpf.h" >&5 +printf %s "checking whether enum bpf_stats_type is defined in linux/bpf.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + +int +main (void) +{ + + enum bpf_stats_type foo; + (void)foo; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + have_bpf_stats_type=yes +else $as_nop + have_bpf_stats_type=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + if test "x${have_bpf_stats_type}" = "xyes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_BPF_STATS_TYPE 1" >>confdefs.h + + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBBPF_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBBPF_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_libbpf}" = "xyes" && + test "x${have_libbpf}" != "xyes"; then + as_fn_error $? "libbpf was requested (--with-libbpf) but not found" "$LINENO" 5 +fi + + if test "x${have_libbpf}" = "xyes" ; then + HAVE_LIBBPF_TRUE= + HAVE_LIBBPF_FALSE='#' +else + HAVE_LIBBPF_TRUE='#' + HAVE_LIBBPF_FALSE= +fi + + +# libbrotlienc (for src) +have_libbrotlienc=no +if test "x${request_libbrotlienc}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libbrotlienc >= 1.0.9" >&5 +printf %s "checking for libbrotlienc >= 1.0.9... " >&6; } + +if test -n "$LIBBROTLIENC_CFLAGS"; then + pkg_cv_LIBBROTLIENC_CFLAGS="$LIBBROTLIENC_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libbrotlienc >= 1.0.9\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libbrotlienc >= 1.0.9") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBBROTLIENC_CFLAGS=`$PKG_CONFIG --cflags "libbrotlienc >= 1.0.9" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBBROTLIENC_LIBS"; then + pkg_cv_LIBBROTLIENC_LIBS="$LIBBROTLIENC_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libbrotlienc >= 1.0.9\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libbrotlienc >= 1.0.9") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBBROTLIENC_LIBS=`$PKG_CONFIG --libs "libbrotlienc >= 1.0.9" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBBROTLIENC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libbrotlienc >= 1.0.9" 2>&1` + else + LIBBROTLIENC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libbrotlienc >= 1.0.9" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBBROTLIENC_PKG_ERRORS" >&5 + + have_libbrotlienc=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libbrotlienc=no +else + LIBBROTLIENC_CFLAGS=$pkg_cv_LIBBROTLIENC_CFLAGS + LIBBROTLIENC_LIBS=$pkg_cv_LIBBROTLIENC_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libbrotlienc=yes +fi + if test "x${have_libbrotlienc}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBBROTLIENC_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBBROTLIENC_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_libbrotlienc}" = "xyes" && + test "x${have_libbrotlienc}" != "xyes"; then + as_fn_error $? "libbrotlienc was requested (--with-libbrotlienc) but not found" "$LINENO" 5 +fi + +# libbrotlidec (for src) +have_libbrotlidec=no +if test "x${request_libbrotlidec}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libbrotlidec >= 1.0.9" >&5 +printf %s "checking for libbrotlidec >= 1.0.9... " >&6; } + +if test -n "$LIBBROTLIDEC_CFLAGS"; then + pkg_cv_LIBBROTLIDEC_CFLAGS="$LIBBROTLIDEC_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libbrotlidec >= 1.0.9\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libbrotlidec >= 1.0.9") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBBROTLIDEC_CFLAGS=`$PKG_CONFIG --cflags "libbrotlidec >= 1.0.9" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBBROTLIDEC_LIBS"; then + pkg_cv_LIBBROTLIDEC_LIBS="$LIBBROTLIDEC_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libbrotlidec >= 1.0.9\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libbrotlidec >= 1.0.9") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBBROTLIDEC_LIBS=`$PKG_CONFIG --libs "libbrotlidec >= 1.0.9" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBBROTLIDEC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libbrotlidec >= 1.0.9" 2>&1` + else + LIBBROTLIDEC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libbrotlidec >= 1.0.9" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBBROTLIDEC_PKG_ERRORS" >&5 + + have_libbrotlidec=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libbrotlidec=no +else + LIBBROTLIDEC_CFLAGS=$pkg_cv_LIBBROTLIDEC_CFLAGS + LIBBROTLIDEC_LIBS=$pkg_cv_LIBBROTLIDEC_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libbrotlidec=yes +fi + if test "x${have_libbrotlidec}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBBROTLIDEC_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBBROTLIDEC_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_libbrotlidec}" = "xyes" && + test "x${have_libbrotlidec}" != "xyes"; then + as_fn_error $? "libbrotlidec was requested (--with-libbrotlidec) but not found" "$LINENO" 5 +fi + +have_libbrotli=no +if test "x${have_libbrotlienc}" = "xyes" && + test "x${have_libbrotlidec}" = "xyes"; then + have_libbrotli=yes + + +printf "%s\n" "#define HAVE_LIBBROTLI 1" >>confdefs.h + +fi + +# libevent_openssl (for examples) +# 2.0.8 is required because we use evconnlistener_set_error_cb() +have_libevent_openssl=no +if test "x${request_libevent_openssl}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libevent_openssl >= 2.0.8" >&5 +printf %s "checking for libevent_openssl >= 2.0.8... " >&6; } + +if test -n "$LIBEVENT_OPENSSL_CFLAGS"; then + pkg_cv_LIBEVENT_OPENSSL_CFLAGS="$LIBEVENT_OPENSSL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevent_openssl >= 2.0.8\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libevent_openssl >= 2.0.8") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBEVENT_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "libevent_openssl >= 2.0.8" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBEVENT_OPENSSL_LIBS"; then + pkg_cv_LIBEVENT_OPENSSL_LIBS="$LIBEVENT_OPENSSL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevent_openssl >= 2.0.8\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libevent_openssl >= 2.0.8") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBEVENT_OPENSSL_LIBS=`$PKG_CONFIG --libs "libevent_openssl >= 2.0.8" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBEVENT_OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libevent_openssl >= 2.0.8" 2>&1` + else + LIBEVENT_OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libevent_openssl >= 2.0.8" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBEVENT_OPENSSL_PKG_ERRORS" >&5 + + have_libevent_openssl=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libevent_openssl=no +else + LIBEVENT_OPENSSL_CFLAGS=$pkg_cv_LIBEVENT_OPENSSL_CFLAGS + LIBEVENT_OPENSSL_LIBS=$pkg_cv_LIBEVENT_OPENSSL_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libevent_openssl=yes +fi + if test "x${have_libevent_openssl}" = "xno"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBEVENT_OPENSSL_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBEVENT_OPENSSL_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_libevent_openssl}" = "xyes" && + test "x${have_libevent_openssl}" != "xyes"; then + as_fn_error $? "libevent_openssl was requested (--with-libevent) but not found" "$LINENO" 5 +fi + +# jansson (for src/nghttp, src/deflatehd and src/inflatehd) +have_jansson=no +if test "x${request_jansson}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for jansson >= 2.5" >&5 +printf %s "checking for jansson >= 2.5... " >&6; } + +if test -n "$JANSSON_CFLAGS"; then + pkg_cv_JANSSON_CFLAGS="$JANSSON_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson >= 2.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "jansson >= 2.5") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_JANSSON_CFLAGS=`$PKG_CONFIG --cflags "jansson >= 2.5" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$JANSSON_LIBS"; then + pkg_cv_JANSSON_LIBS="$JANSSON_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson >= 2.5\""; } >&5 + ($PKG_CONFIG --exists --print-errors "jansson >= 2.5") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_JANSSON_LIBS=`$PKG_CONFIG --libs "jansson >= 2.5" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + JANSSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "jansson >= 2.5" 2>&1` + else + JANSSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "jansson >= 2.5" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$JANSSON_PKG_ERRORS" >&5 + + have_jansson=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_jansson=no +else + JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS + JANSSON_LIBS=$pkg_cv_JANSSON_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_jansson=yes +fi + if test "x${have_jansson}" = "xyes"; then + +printf "%s\n" "#define HAVE_JANSSON 1" >>confdefs.h + + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $JANSSON_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $JANSSON_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_jansson}" = "xyes" && + test "x${have_jansson}" != "xyes"; then + as_fn_error $? "jansson was requested (--with-jansson) but not found" "$LINENO" 5 +fi + +# libsystemd (for src/nghttpx) +have_libsystemd=no +if test "x${request_systemd}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsystemd >= 209" >&5 +printf %s "checking for libsystemd >= 209... " >&6; } + +if test -n "$SYSTEMD_CFLAGS"; then + pkg_cv_SYSTEMD_CFLAGS="$SYSTEMD_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd >= 209\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libsystemd >= 209") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "libsystemd >= 209" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SYSTEMD_LIBS"; then + pkg_cv_SYSTEMD_LIBS="$SYSTEMD_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd >= 209\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libsystemd >= 209") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "libsystemd >= 209" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd >= 209" 2>&1` + else + SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd >= 209" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SYSTEMD_PKG_ERRORS" >&5 + + have_libsystemd=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libsystemd=no +else + SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS + SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libsystemd=yes +fi + if test "x${have_libsystemd}" = "xyes"; then + +printf "%s\n" "#define HAVE_LIBSYSTEMD 1" >>confdefs.h + + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $SYSTEMD_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $SYSTEMD_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_systemd}" = "xyes" && + test "x${have_libsystemd}" != "xyes"; then + as_fn_error $? "systemd was requested (--with-systemd) but not found" "$LINENO" 5 +fi + +# libxml2 (for src/nghttp) +have_libxml2=no +if test "x${request_libxml2}" != "xno"; then + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0 >= 2.6.26" >&5 +printf %s "checking for libxml-2.0 >= 2.6.26... " >&6; } + +if test -n "$LIBXML2_CFLAGS"; then + pkg_cv_LIBXML2_CFLAGS="$LIBXML2_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.26\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.26") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBXML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= 2.6.26" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBXML2_LIBS"; then + pkg_cv_LIBXML2_LIBS="$LIBXML2_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.26\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.26") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBXML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= 2.6.26" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0 >= 2.6.26" 2>&1` + else + LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0 >= 2.6.26" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBXML2_PKG_ERRORS" >&5 + + have_libxml2=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_libxml2=no +else + LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS + LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_libxml2=yes +fi + if test "x${have_libxml2}" = "xyes"; then + +printf "%s\n" "#define HAVE_LIBXML2 1" >>confdefs.h + + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $LIBXML2_PKG_ERRORS" >&5 +printf "%s\n" "$as_me: $LIBXML2_PKG_ERRORS" >&6;} + fi +fi + +if test "x${request_libxml2}" = "xyes" && + test "x${have_libxml2}" != "xyes"; then + as_fn_error $? "libxml2 was requested (--with-libxml2) but not found" "$LINENO" 5 +fi + + if test "x${have_libxml2}" = "xyes" ; then + HAVE_LIBXML2_TRUE= + HAVE_LIBXML2_FALSE='#' +else + HAVE_LIBXML2_TRUE='#' + HAVE_LIBXML2_FALSE= +fi + + +# jemalloc +have_jemalloc=no +if test "x${request_jemalloc}" != "xno"; then + if test "x${JEMALLOC_LIBS}" = "x" && test "x${JEMALLOC_CFLAGS}" = "x"; then + save_LIBS=$LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing malloc_stats_print" >&5 +printf %s "checking for library containing malloc_stats_print... " >&6; } +if test ${ac_cv_search_malloc_stats_print+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char malloc_stats_print (); +int +main (void) +{ +return malloc_stats_print (); + ; + return 0; +} +_ACEOF +for ac_lib in '' jemalloc +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $PTHREAD_LDFLAGS $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_malloc_stats_print=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_malloc_stats_print+y} +then : + break +fi +done +if test ${ac_cv_search_malloc_stats_print+y} +then : + +else $as_nop + ac_cv_search_malloc_stats_print=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_malloc_stats_print" >&5 +printf "%s\n" "$ac_cv_search_malloc_stats_print" >&6; } +ac_res=$ac_cv_search_malloc_stats_print +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + have_jemalloc=yes +fi + + + if test "x${have_jemalloc}" = "xyes"; then + jemalloc_libs=${ac_cv_search_malloc_stats_print} + else + # On Darwin, malloc_stats_print is je_malloc_stats_print + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing je_malloc_stats_print" >&5 +printf %s "checking for library containing je_malloc_stats_print... " >&6; } +if test ${ac_cv_search_je_malloc_stats_print+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char je_malloc_stats_print (); +int +main (void) +{ +return je_malloc_stats_print (); + ; + return 0; +} +_ACEOF +for ac_lib in '' jemalloc +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $PTHREAD_LDFLAGS $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_je_malloc_stats_print=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_je_malloc_stats_print+y} +then : + break +fi +done +if test ${ac_cv_search_je_malloc_stats_print+y} +then : + +else $as_nop + ac_cv_search_je_malloc_stats_print=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_je_malloc_stats_print" >&5 +printf "%s\n" "$ac_cv_search_je_malloc_stats_print" >&6; } +ac_res=$ac_cv_search_je_malloc_stats_print +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + have_jemalloc=yes +fi + + + if test "x${have_jemalloc}" = "xyes"; then + jemalloc_libs=${ac_cv_search_je_malloc_stats_print} + fi + fi + + LIBS=$save_LIBS + + if test "x${have_jemalloc}" = "xyes" && + test "x${jemalloc_libs}" != "xnone required"; then + JEMALLOC_LIBS=${jemalloc_libs} + fi + else + have_jemalloc=yes + fi +fi + +if test "x${request_jemalloc}" = "xyes" && + test "x${have_jemalloc}" != "xyes"; then + as_fn_error $? "jemalloc was requested (--with-jemalloc) but not found" "$LINENO" 5 +fi + +# The nghttp, nghttpd and nghttpx under src depend on zlib, OpenSSL, +# libev, and libc-ares. +enable_app=no +if test "x${request_app}" != "xno" && + test "x${have_zlib}" = "xyes" && + (test "x${have_openssl}" = "xyes" || test "x${have_wolfssl}" = "xyes") && + test "x${have_libev}" = "xyes" && + test "x${have_libcares}" = "xyes"; then + enable_app=yes +fi + +if test "x${request_app}" = "xyes" && + test "x${enable_app}" != "xyes"; then + as_fn_error $? "applications were requested (--enable-app) but dependencies are not met." "$LINENO" 5 +fi + + if test "x${enable_app}" = "xyes" ; then + ENABLE_APP_TRUE= + ENABLE_APP_FALSE='#' +else + ENABLE_APP_TRUE='#' + ENABLE_APP_FALSE= +fi + + +# Check HTTP/3 support +enable_http3=no +if test "x${request_http3}" != "xno" && + test "x${have_libngtcp2}" = "xyes" && + (test "x${have_libngtcp2_crypto_wolfssl}" = "xyes" || + test "x${have_libngtcp2_crypto_quictls}" = "xyes" || + test "x${have_libngtcp2_crypto_boringssl}" = "xyes") && + test "x${have_libnghttp3}" = "xyes"; then + enable_http3=yes + +printf "%s\n" "#define ENABLE_HTTP3 1" >>confdefs.h + +fi + +if test "x${request_http3}" = "xyes" && + test "x${enable_http3}" != "xyes"; then + as_fn_error $? "HTTP/3 was requested (--enable-http3) but dependencies are not met." "$LINENO" 5 +fi + + if test "x${enable_http3}" = "xyes" ; then + ENABLE_HTTP3_TRUE= + ENABLE_HTTP3_FALSE='#' +else + ENABLE_HTTP3_TRUE='#' + ENABLE_HTTP3_FALSE= +fi + + +enable_hpack_tools=no +# HPACK tools requires jansson +if test "x${request_hpack_tools}" != "xno" && + test "x${have_jansson}" = "xyes"; then + enable_hpack_tools=yes +fi + +if test "x${request_hpack_tools}" = "xyes" && + test "x${enable_hpack_tools}" != "xyes"; then + as_fn_error $? "HPACK tools were requested (--enable-hpack-tools) but dependencies are not met." "$LINENO" 5 +fi + + if test "x${enable_hpack_tools}" = "xyes" ; then + ENABLE_HPACK_TOOLS_TRUE= + ENABLE_HPACK_TOOLS_FALSE='#' +else + ENABLE_HPACK_TOOLS_TRUE='#' + ENABLE_HPACK_TOOLS_FALSE= +fi + + +# The example programs depend on OpenSSL and libevent_openssl +enable_examples=no +if test "x${request_examples}" != "xno" && + test "x${have_openssl}" = "xyes" && + test "x${have_libevent_openssl}" = "xyes"; then + enable_examples=yes +fi + +if test "x${request_examples}" = "xyes" && + test "x${enable_examples}" != "xyes"; then + as_fn_error $? "examples were requested (--enable-examples) but dependencies are not met." "$LINENO" 5 +fi + + if test "x${enable_examples}" = "xyes" ; then + ENABLE_EXAMPLES_TRUE= + ENABLE_EXAMPLES_FALSE='#' +else + ENABLE_EXAMPLES_TRUE='#' + ENABLE_EXAMPLES_FALSE= +fi + + +# third-party only be built when needed + +enable_third_party=no +have_mruby=no +have_neverbleed=no +if test "x${enable_examples}" = "xyes" || + test "x${enable_app}" = "xyes" || + test "x${enable_hpack_tools}" = "xyes"; then + enable_third_party=yes + + # mruby (for src/nghttpx) + if test "x${request_mruby}" = "xyes"; then + # We are going to build mruby + have_mruby=yes + +printf "%s\n" "#define HAVE_MRUBY 1" >>confdefs.h + + LIBMRUBY_LIBS="-lmruby -lm" + LIBMRUBY_CFLAGS= + + + fi + + # neverbleed (for src/nghttpx) + if test "x${request_neverbleed}" = "xyes"; then + have_neverbleed=yes + +printf "%s\n" "#define HAVE_NEVERBLEED 1" >>confdefs.h + + fi +fi + + if test "x${enable_third_party}" = "xyes" ; then + ENABLE_THIRD_PARTY_TRUE= + ENABLE_THIRD_PARTY_FALSE='#' +else + ENABLE_THIRD_PARTY_TRUE='#' + ENABLE_THIRD_PARTY_FALSE= +fi + + if test "x${have_mruby}" = "xyes"; then + HAVE_MRUBY_TRUE= + HAVE_MRUBY_FALSE='#' +else + HAVE_MRUBY_TRUE='#' + HAVE_MRUBY_FALSE= +fi + + if test "x${have_neverbleed}" = "xyes"; then + HAVE_NEVERBLEED_TRUE= + HAVE_NEVERBLEED_FALSE='#' +else + HAVE_NEVERBLEED_TRUE='#' + HAVE_NEVERBLEED_FALSE= +fi + + +# failmalloc tests +enable_failmalloc=no +if test "x${request_failmalloc}" = "xyes"; then + enable_failmalloc=yes +fi + + if test "x${enable_failmalloc}" = "xyes" ; then + ENABLE_FAILMALLOC_TRUE= + ENABLE_FAILMALLOC_FALSE='#' +else + ENABLE_FAILMALLOC_TRUE='#' + ENABLE_FAILMALLOC_FALSE= +fi + + +# Checks for header files. + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable assertions" >&5 +printf %s "checking whether to enable assertions... " >&6; } + # Check whether --enable-assert was given. +if test ${enable_assert+y} +then : + enableval=$enable_assert; ac_enable_assert=$enableval + if test "x$enableval" = xno +then : + +printf "%s\n" "#define NDEBUG 1" >>confdefs.h + +elif test "x$enableval" != xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-assert" >&5 +printf "%s\n" "$as_me: WARNING: invalid argument supplied to --enable-assert" >&2;} + ac_enable_assert=yes +fi +else $as_nop + ac_enable_assert=yes +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_enable_assert" >&5 +printf "%s\n" "$ac_enable_assert" >&6; } + +ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" +if test "x$ac_cv_header_arpa_inet_h" = xyes +then : + printf "%s\n" "#define HAVE_ARPA_INET_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes +then : + printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" +if test "x$ac_cv_header_inttypes_h" = xyes +then : + printf "%s\n" "#define HAVE_INTTYPES_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes +then : + printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" +if test "x$ac_cv_header_netdb_h" = xyes +then : + printf "%s\n" "#define HAVE_NETDB_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" +if test "x$ac_cv_header_netinet_in_h" = xyes +then : + printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "netinet/ip.h" "ac_cv_header_netinet_ip_h" "$ac_includes_default" +if test "x$ac_cv_header_netinet_ip_h" = xyes +then : + printf "%s\n" "#define HAVE_NETINET_IP_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default" +if test "x$ac_cv_header_pwd_h" = xyes +then : + printf "%s\n" "#define HAVE_PWD_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" +if test "x$ac_cv_header_stddef_h" = xyes +then : + printf "%s\n" "#define HAVE_STDDEF_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes +then : + printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : + printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_socket_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" +if test "x$ac_cv_header_syslog_h" = xyes +then : + printf "%s\n" "#define HAVE_SYSLOG_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : + printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" +if test "x$ac_cv_header_windows_h" = xyes +then : + printf "%s\n" "#define HAVE_WINDOWS_H 1" >>confdefs.h + +fi + + +# Checks for typedefs, structures, and compiler characteristics. +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define size_t unsigned int" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define ssize_t int" >>confdefs.h + +fi + +ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" +case $ac_cv_c_uint8_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define _UINT8_T 1" >>confdefs.h + + +printf "%s\n" "#define uint8_t $ac_cv_c_uint8_t" >>confdefs.h +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" +case $ac_cv_c_uint16_t in #( + no|yes) ;; #( + *) + + +printf "%s\n" "#define uint16_t $ac_cv_c_uint16_t" >>confdefs.h +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" +case $ac_cv_c_uint32_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define _UINT32_T 1" >>confdefs.h + + +printf "%s\n" "#define uint32_t $ac_cv_c_uint32_t" >>confdefs.h +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" +case $ac_cv_c_uint64_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define _UINT64_T 1" >>confdefs.h + + +printf "%s\n" "#define uint64_t $ac_cv_c_uint64_t" >>confdefs.h +;; + esac + +ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" +case $ac_cv_c_int8_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define int8_t $ac_cv_c_int8_t" >>confdefs.h +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" +case $ac_cv_c_int16_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define int16_t $ac_cv_c_int16_t" >>confdefs.h +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" +case $ac_cv_c_int32_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define int32_t $ac_cv_c_int32_t" >>confdefs.h +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" +case $ac_cv_c_int64_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define int64_t $ac_cv_c_int64_t" >>confdefs.h +;; +esac + +ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" +if test "x$ac_cv_type_off_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define off_t long int" >>confdefs.h + +fi + + + ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default +" +if test "x$ac_cv_type_pid_t" = xyes +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined _WIN64 && !defined __CYGWIN__ + LLP64 + #endif + +int +main (void) +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_pid_type='int' +else $as_nop + ac_pid_type='__int64' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h + + +fi + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +printf %s "checking for uid_t in sys/types.h... " >&6; } +if test ${ac_cv_type_uid_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1 +then : + ac_cv_type_uid_t=yes +else $as_nop + ac_cv_type_uid_t=no +fi +rm -rf conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 +printf "%s\n" "$ac_cv_type_uid_t" >&6; } +if test $ac_cv_type_uid_t = no; then + +printf "%s\n" "#define uid_t int" >>confdefs.h + + +printf "%s\n" "#define gid_t int" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" +if test "x$ac_cv_type_ptrdiff_t" = xyes +then : + +printf "%s\n" "#define HAVE_PTRDIFF_T 1" >>confdefs.h + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +printf %s "checking whether byte ordering is bigendian... " >&6; } +if test ${ac_cv_c_bigendian+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_bigendian=yes +else $as_nop + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_bigendian=yes +else $as_nop + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes +then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +unsigned short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + unsigned short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + unsigned short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + unsigned short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main (void) +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_bigendian=no +else $as_nop + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +printf "%s\n" "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +# Check whether --enable-largefile was given. +if test ${enable_largefile+y} +then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +printf %s "checking for special C compiler options needed for large files... " >&6; } +if test ${ac_cv_sys_largefile_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO" +then : + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test ${ac_cv_sys_file_offset_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } +if test ${ac_cv_sys_large_files+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +printf "%s\n" "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h +;; +esac +rm -rf conftest* + fi +fi + + +ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include +" +if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes +then : + have_struct_tm_tm_gmtoff=yes +else $as_nop + have_struct_tm_tm_gmtoff=no +fi + + +ac_fn_c_check_member "$LINENO" "struct sockaddr_in" "sin_len" "ac_cv_member_struct_sockaddr_in_sin_len" " +#include +#include +#include + +" +if test "x$ac_cv_member_struct_sockaddr_in_sin_len" = xyes +then : + +printf "%s\n" "#define HAVE_SOCKADDR_IN_SIN_LEN 1" >>confdefs.h + +fi + + +ac_fn_c_check_member "$LINENO" "struct sockaddr_in6" "sin6_len" "ac_cv_member_struct_sockaddr_in6_sin6_len" " +#include +#include +#include + +" +if test "x$ac_cv_member_struct_sockaddr_in6_sin6_len" = xyes +then : + +printf "%s\n" "#define HAVE_SOCKADDR_IN6_SIN6_LEN 1" >>confdefs.h + +fi + + +if test "x$have_struct_tm_tm_gmtoff" = "xyes"; then + +printf "%s\n" "#define HAVE_STRUCT_TM_TM_GMTOFF 1" >>confdefs.h + +fi + +# Checks for library functions. + +# Don't check malloc, since it does not play nicely with C++ stdlib +# AC_FUNC_MALLOC + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5 +printf %s "checking for working chown... " >&6; } +if test ${ac_cv_func_chown_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on glibc systems. + *-gnu*) ac_cv_func_chown_works=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_chown_works=no ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +#include + +int +main (void) +{ + char *f = "conftest.chown"; + struct stat before, after; + + if (creat (f, 0600) < 0) + return 1; + if (stat (f, &before) < 0) + return 1; + if (chown (f, (uid_t) -1, (gid_t) -1) == -1) + return 1; + if (stat (f, &after) < 0) + return 1; + return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_chown_works=yes +else $as_nop + ac_cv_func_chown_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +rm -f conftest.chown + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5 +printf "%s\n" "$ac_cv_func_chown_works" >&6; } +if test $ac_cv_func_chown_works = yes; then + +printf "%s\n" "#define HAVE_CHOWN 1" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 +printf %s "checking for error_at_line... " >&6; } +if test ${ac_cv_lib_error_at_line+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +error_at_line (0, 0, "", 0, "an error occurred"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_error_at_line=yes +else $as_nop + ac_cv_lib_error_at_line=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 +printf "%s\n" "$ac_cv_lib_error_at_line" >&6; } +if test $ac_cv_lib_error_at_line = no; then + case " $LIBOBJS " in + *" error.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS error.$ac_objext" + ;; +esac + +fi + + +ac_func= +for ac_item in $ac_func_c_list +do + if test $ac_func; then + ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func + if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then + echo "#define $ac_item 1" >> confdefs.h + fi + ac_func= + else + ac_func=$ac_item + fi +done + + + +if test "x$ac_cv_func_fork" = xyes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 +printf %s "checking for working fork... " >&6; } +if test ${ac_cv_func_fork_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + ac_cv_func_fork_works=cross +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ + + /* By Ruediger Kuhlmann. */ + return fork () < 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_fork_works=yes +else $as_nop + ac_cv_func_fork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 +printf "%s\n" "$ac_cv_func_fork_works" >&6; } + +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +printf "%s\n" "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 +printf %s "checking for working vfork... " >&6; } +if test ${ac_cv_func_vfork_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + ac_cv_func_vfork_works=cross +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Thanks to Paul Eggert for this test. */ +$ac_includes_default +#include +#include +#ifdef HAVE_VFORK_H +# include +#endif + +static void +do_nothing (int sig) +{ + (void) sig; +} + +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +sparc_address_test (int arg) +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} + +int +main (void) +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (0); + + /* On Solaris 2.4, changes by the child to the signal handler + also munge signal handlers in the parent. To detect this, + start by putting the parent's handler in a known state. */ + signal (SIGTERM, SIG_DFL); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* Alter the child's signal handler. */ + if (signal (SIGTERM, do_nothing) != SIG_DFL) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + return ( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child munge the parent's signal handler? */ + || signal (SIGTERM, SIG_DFL) != SIG_DFL + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_vfork_works=yes +else $as_nop + ac_cv_func_vfork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 +printf "%s\n" "$ac_cv_func_vfork_works" >&6; } + +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +printf "%s\n" "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + +printf "%s\n" "#define HAVE_WORKING_VFORK 1" >>confdefs.h + +else + +printf "%s\n" "#define vfork fork" >>confdefs.h + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +printf "%s\n" "#define HAVE_WORKING_FORK 1" >>confdefs.h + +fi + +# Don't check realloc, since LeakSanitizer detects memory leak during check +# AC_FUNC_REALLOC +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +ac_fn_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_strerror_r" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_STRERROR_R $ac_have_decl" >>confdefs.h + + +if test $ac_cv_have_decl_strerror_r = yes; then + # For backward compatibility's sake, define HAVE_STRERROR_R. + # (We used to run AC_CHECK_FUNCS_ONCE for strerror_r, as well + # as AC_CHECK_DECLS_ONCE.) + +printf "%s\n" "#define HAVE_STRERROR_R 1" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 +printf %s "checking whether strerror_r returns char *... " >&6; } +if test ${ac_cv_func_strerror_r_char_p+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ + + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_strerror_r_char_p=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 +printf "%s\n" "$ac_cv_func_strerror_r_char_p" >&6; } +if test $ac_cv_func_strerror_r_char_p = yes; then + +printf "%s\n" "#define STRERROR_R_CHAR_P 1" >>confdefs.h + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5 +printf %s "checking for working strnlen... " >&6; } +if test ${ac_cv_func_strnlen_working+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + # Guess no on AIX systems, yes otherwise. + case "$host_os" in + aix*) ac_cv_func_strnlen_working=no;; + *) ac_cv_func_strnlen_working=yes;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ + +#define S "foobar" +#define S_LEN (sizeof S - 1) + + /* At least one implementation is buggy: that of AIX 4.3 would + give strnlen (S, 1) == 3. */ + + int i; + for (i = 0; i < S_LEN + 1; ++i) + { + int expected = i <= S_LEN ? i : S_LEN; + if (strnlen (S, i) != expected) + return 1; + } + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_strnlen_working=yes +else $as_nop + ac_cv_func_strnlen_working=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strnlen_working" >&5 +printf "%s\n" "$ac_cv_func_strnlen_working" >&6; } +test $ac_cv_func_strnlen_working = no && case " $LIBOBJS " in + *" strnlen.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strnlen.$ac_objext" + ;; +esac + + + +ac_fn_c_check_func "$LINENO" "_Exit" "ac_cv_func__Exit" +if test "x$ac_cv_func__Exit" = xyes +then : + printf "%s\n" "#define HAVE__EXIT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "accept4" "ac_cv_func_accept4" +if test "x$ac_cv_func_accept4" = xyes +then : + printf "%s\n" "#define HAVE_ACCEPT4 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" +if test "x$ac_cv_func_clock_gettime" = xyes +then : + printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" +if test "x$ac_cv_func_dup2" = xyes +then : + printf "%s\n" "#define HAVE_DUP2 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" +if test "x$ac_cv_func_getcwd" = xyes +then : + printf "%s\n" "#define HAVE_GETCWD 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getpwnam" "ac_cv_func_getpwnam" +if test "x$ac_cv_func_getpwnam" = xyes +then : + printf "%s\n" "#define HAVE_GETPWNAM 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "localtime_r" "ac_cv_func_localtime_r" +if test "x$ac_cv_func_localtime_r" = xyes +then : + printf "%s\n" "#define HAVE_LOCALTIME_R 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memchr" "ac_cv_func_memchr" +if test "x$ac_cv_func_memchr" = xyes +then : + printf "%s\n" "#define HAVE_MEMCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" +if test "x$ac_cv_func_memmove" = xyes +then : + printf "%s\n" "#define HAVE_MEMMOVE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" +if test "x$ac_cv_func_memset" = xyes +then : + printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mkostemp" "ac_cv_func_mkostemp" +if test "x$ac_cv_func_mkostemp" = xyes +then : + printf "%s\n" "#define HAVE_MKOSTEMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2" +if test "x$ac_cv_func_pipe2" = xyes +then : + printf "%s\n" "#define HAVE_PIPE2 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" +if test "x$ac_cv_func_socket" = xyes +then : + printf "%s\n" "#define HAVE_SOCKET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sqrt" "ac_cv_func_sqrt" +if test "x$ac_cv_func_sqrt" = xyes +then : + printf "%s\n" "#define HAVE_SQRT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" +if test "x$ac_cv_func_strchr" = xyes +then : + printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" +if test "x$ac_cv_func_strdup" = xyes +then : + printf "%s\n" "#define HAVE_STRDUP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" +if test "x$ac_cv_func_strerror" = xyes +then : + printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strndup" "ac_cv_func_strndup" +if test "x$ac_cv_func_strndup" = xyes +then : + printf "%s\n" "#define HAVE_STRNDUP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" +if test "x$ac_cv_func_strstr" = xyes +then : + printf "%s\n" "#define HAVE_STRSTR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" +if test "x$ac_cv_func_strtol" = xyes +then : + printf "%s\n" "#define HAVE_STRTOL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" +if test "x$ac_cv_func_strtoul" = xyes +then : + printf "%s\n" "#define HAVE_STRTOUL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" +if test "x$ac_cv_func_timegm" = xyes +then : + printf "%s\n" "#define HAVE_TIMEGM 1" >>confdefs.h + +fi + + +# timerfd_create was added in linux kernel 2.6.25 + +ac_fn_c_check_func "$LINENO" "timerfd_create" "ac_cv_func_timerfd_create" +if test "x$ac_cv_func_timerfd_create" = xyes +then : + have_timerfd_create=yes +else $as_nop + have_timerfd_create=no +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking checking for GetTickCount64" >&5 +printf %s "checking checking for GetTickCount64... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main (void) +{ + +GetTickCount64(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + have_gettickcount64=yes +else $as_nop + have_gettickcount64=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + +if test "x${have_gettickcount64}" = "xyes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_GETTICKCOUNT64 1" >>confdefs.h + +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + +# For cygwin: we can link initgroups, so AC_CHECK_FUNCS succeeds, but +# cygwin disables initgroups due to feature test macro magic with our +# configuration. FreeBSD declares initgroups() in unistd.h. +ac_fn_check_decl "$LINENO" "initgroups" "ac_cv_have_decl_initgroups" " + #ifdef HAVE_UNISTD_H + # include + #endif + #include + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_initgroups" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_INITGROUPS $ac_have_decl" >>confdefs.h + + +ac_fn_check_decl "$LINENO" "CLOCK_MONOTONIC" "ac_cv_have_decl_CLOCK_MONOTONIC" " +#include + +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_CLOCK_MONOTONIC" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_CLOCK_MONOTONIC $ac_have_decl" >>confdefs.h + + +save_CFLAGS=$CFLAGS +save_CXXFLAGS=$CXXFLAGS + +CFLAGS= +CXXFLAGS= + +if test "x$werror" != "xno"; then + # For C compiler + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wall" >&5 +printf %s "checking whether C compiler accepts -Wall... " >&6; } +if test ${ax_cv_check_cflags___Wall+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wall" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wall=yes +else $as_nop + ax_cv_check_cflags___Wall=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wall" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wall" >&6; } +if test "x$ax_cv_check_cflags___Wall" = xyes +then : + CFLAGS="$CFLAGS -Wall" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wextra" >&5 +printf %s "checking whether C compiler accepts -Wextra... " >&6; } +if test ${ax_cv_check_cflags___Wextra+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wextra" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wextra=yes +else $as_nop + ax_cv_check_cflags___Wextra=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wextra" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wextra" >&6; } +if test "x$ax_cv_check_cflags___Wextra" = xyes +then : + CFLAGS="$CFLAGS -Wextra" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror" >&5 +printf %s "checking whether C compiler accepts -Werror... " >&6; } +if test ${ax_cv_check_cflags___Werror+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Werror=yes +else $as_nop + ax_cv_check_cflags___Werror=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Werror" >&5 +printf "%s\n" "$ax_cv_check_cflags___Werror" >&6; } +if test "x$ax_cv_check_cflags___Werror" = xyes +then : + CFLAGS="$CFLAGS -Werror" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wmissing-prototypes" >&5 +printf %s "checking whether C compiler accepts -Wmissing-prototypes... " >&6; } +if test ${ax_cv_check_cflags___Wmissing_prototypes+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wmissing-prototypes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wmissing_prototypes=yes +else $as_nop + ax_cv_check_cflags___Wmissing_prototypes=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wmissing_prototypes" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wmissing_prototypes" >&6; } +if test "x$ax_cv_check_cflags___Wmissing_prototypes" = xyes +then : + CFLAGS="$CFLAGS -Wmissing-prototypes" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wstrict-prototypes" >&5 +printf %s "checking whether C compiler accepts -Wstrict-prototypes... " >&6; } +if test ${ax_cv_check_cflags___Wstrict_prototypes+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wstrict-prototypes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wstrict_prototypes=yes +else $as_nop + ax_cv_check_cflags___Wstrict_prototypes=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wstrict_prototypes" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wstrict_prototypes" >&6; } +if test "x$ax_cv_check_cflags___Wstrict_prototypes" = xyes +then : + CFLAGS="$CFLAGS -Wstrict-prototypes" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wmissing-declarations" >&5 +printf %s "checking whether C compiler accepts -Wmissing-declarations... " >&6; } +if test ${ax_cv_check_cflags___Wmissing_declarations+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wmissing-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wmissing_declarations=yes +else $as_nop + ax_cv_check_cflags___Wmissing_declarations=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wmissing_declarations" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wmissing_declarations" >&6; } +if test "x$ax_cv_check_cflags___Wmissing_declarations" = xyes +then : + CFLAGS="$CFLAGS -Wmissing-declarations" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wpointer-arith" >&5 +printf %s "checking whether C compiler accepts -Wpointer-arith... " >&6; } +if test ${ax_cv_check_cflags___Wpointer_arith+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wpointer-arith" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wpointer_arith=yes +else $as_nop + ax_cv_check_cflags___Wpointer_arith=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wpointer_arith" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wpointer_arith" >&6; } +if test "x$ax_cv_check_cflags___Wpointer_arith" = xyes +then : + CFLAGS="$CFLAGS -Wpointer-arith" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wdeclaration-after-statement" >&5 +printf %s "checking whether C compiler accepts -Wdeclaration-after-statement... " >&6; } +if test ${ax_cv_check_cflags___Wdeclaration_after_statement+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wdeclaration-after-statement" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wdeclaration_after_statement=yes +else $as_nop + ax_cv_check_cflags___Wdeclaration_after_statement=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wdeclaration_after_statement" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wdeclaration_after_statement" >&6; } +if test "x$ax_cv_check_cflags___Wdeclaration_after_statement" = xyes +then : + CFLAGS="$CFLAGS -Wdeclaration-after-statement" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-security" >&5 +printf %s "checking whether C compiler accepts -Wformat-security... " >&6; } +if test ${ax_cv_check_cflags___Wformat_security+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wformat-security" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wformat_security=yes +else $as_nop + ax_cv_check_cflags___Wformat_security=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wformat_security" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wformat_security" >&6; } +if test "x$ax_cv_check_cflags___Wformat_security" = xyes +then : + CFLAGS="$CFLAGS -Wformat-security" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wwrite-strings" >&5 +printf %s "checking whether C compiler accepts -Wwrite-strings... " >&6; } +if test ${ax_cv_check_cflags___Wwrite_strings+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wwrite-strings" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wwrite_strings=yes +else $as_nop + ax_cv_check_cflags___Wwrite_strings=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wwrite_strings" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wwrite_strings" >&6; } +if test "x$ax_cv_check_cflags___Wwrite_strings" = xyes +then : + CFLAGS="$CFLAGS -Wwrite-strings" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wshadow" >&5 +printf %s "checking whether C compiler accepts -Wshadow... " >&6; } +if test ${ax_cv_check_cflags___Wshadow+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wshadow" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wshadow=yes +else $as_nop + ax_cv_check_cflags___Wshadow=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wshadow" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wshadow" >&6; } +if test "x$ax_cv_check_cflags___Wshadow" = xyes +then : + CFLAGS="$CFLAGS -Wshadow" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Winline" >&5 +printf %s "checking whether C compiler accepts -Winline... " >&6; } +if test ${ax_cv_check_cflags___Winline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Winline" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Winline=yes +else $as_nop + ax_cv_check_cflags___Winline=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Winline" >&5 +printf "%s\n" "$ax_cv_check_cflags___Winline" >&6; } +if test "x$ax_cv_check_cflags___Winline" = xyes +then : + CFLAGS="$CFLAGS -Winline" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wnested-externs" >&5 +printf %s "checking whether C compiler accepts -Wnested-externs... " >&6; } +if test ${ax_cv_check_cflags___Wnested_externs+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wnested-externs" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wnested_externs=yes +else $as_nop + ax_cv_check_cflags___Wnested_externs=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wnested_externs" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wnested_externs" >&6; } +if test "x$ax_cv_check_cflags___Wnested_externs" = xyes +then : + CFLAGS="$CFLAGS -Wnested-externs" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wfloat-equal" >&5 +printf %s "checking whether C compiler accepts -Wfloat-equal... " >&6; } +if test ${ax_cv_check_cflags___Wfloat_equal+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wfloat-equal" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wfloat_equal=yes +else $as_nop + ax_cv_check_cflags___Wfloat_equal=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wfloat_equal" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wfloat_equal" >&6; } +if test "x$ax_cv_check_cflags___Wfloat_equal" = xyes +then : + CFLAGS="$CFLAGS -Wfloat-equal" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wundef" >&5 +printf %s "checking whether C compiler accepts -Wundef... " >&6; } +if test ${ax_cv_check_cflags___Wundef+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wundef" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wundef=yes +else $as_nop + ax_cv_check_cflags___Wundef=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wundef" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wundef" >&6; } +if test "x$ax_cv_check_cflags___Wundef" = xyes +then : + CFLAGS="$CFLAGS -Wundef" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wendif-labels" >&5 +printf %s "checking whether C compiler accepts -Wendif-labels... " >&6; } +if test ${ax_cv_check_cflags___Wendif_labels+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wendif-labels" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wendif_labels=yes +else $as_nop + ax_cv_check_cflags___Wendif_labels=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wendif_labels" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wendif_labels" >&6; } +if test "x$ax_cv_check_cflags___Wendif_labels" = xyes +then : + CFLAGS="$CFLAGS -Wendif-labels" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wempty-body" >&5 +printf %s "checking whether C compiler accepts -Wempty-body... " >&6; } +if test ${ax_cv_check_cflags___Wempty_body+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wempty-body" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wempty_body=yes +else $as_nop + ax_cv_check_cflags___Wempty_body=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wempty_body" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wempty_body" >&6; } +if test "x$ax_cv_check_cflags___Wempty_body" = xyes +then : + CFLAGS="$CFLAGS -Wempty-body" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wcast-align" >&5 +printf %s "checking whether C compiler accepts -Wcast-align... " >&6; } +if test ${ax_cv_check_cflags___Wcast_align+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wcast-align" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wcast_align=yes +else $as_nop + ax_cv_check_cflags___Wcast_align=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wcast_align" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wcast_align" >&6; } +if test "x$ax_cv_check_cflags___Wcast_align" = xyes +then : + CFLAGS="$CFLAGS -Wcast-align" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wclobbered" >&5 +printf %s "checking whether C compiler accepts -Wclobbered... " >&6; } +if test ${ax_cv_check_cflags___Wclobbered+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wclobbered" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wclobbered=yes +else $as_nop + ax_cv_check_cflags___Wclobbered=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wclobbered" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wclobbered" >&6; } +if test "x$ax_cv_check_cflags___Wclobbered" = xyes +then : + CFLAGS="$CFLAGS -Wclobbered" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wvla" >&5 +printf %s "checking whether C compiler accepts -Wvla... " >&6; } +if test ${ax_cv_check_cflags___Wvla+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wvla" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wvla=yes +else $as_nop + ax_cv_check_cflags___Wvla=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wvla" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wvla" >&6; } +if test "x$ax_cv_check_cflags___Wvla" = xyes +then : + CFLAGS="$CFLAGS -Wvla" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wpragmas" >&5 +printf %s "checking whether C compiler accepts -Wpragmas... " >&6; } +if test ${ax_cv_check_cflags___Wpragmas+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wpragmas" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wpragmas=yes +else $as_nop + ax_cv_check_cflags___Wpragmas=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wpragmas" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wpragmas" >&6; } +if test "x$ax_cv_check_cflags___Wpragmas" = xyes +then : + CFLAGS="$CFLAGS -Wpragmas" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunreachable-code" >&5 +printf %s "checking whether C compiler accepts -Wunreachable-code... " >&6; } +if test ${ax_cv_check_cflags___Wunreachable_code+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wunreachable-code" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wunreachable_code=yes +else $as_nop + ax_cv_check_cflags___Wunreachable_code=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wunreachable_code" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wunreachable_code" >&6; } +if test "x$ax_cv_check_cflags___Wunreachable_code" = xyes +then : + CFLAGS="$CFLAGS -Wunreachable-code" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Waddress" >&5 +printf %s "checking whether C compiler accepts -Waddress... " >&6; } +if test ${ax_cv_check_cflags___Waddress+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Waddress" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Waddress=yes +else $as_nop + ax_cv_check_cflags___Waddress=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Waddress" >&5 +printf "%s\n" "$ax_cv_check_cflags___Waddress" >&6; } +if test "x$ax_cv_check_cflags___Waddress" = xyes +then : + CFLAGS="$CFLAGS -Waddress" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wattributes" >&5 +printf %s "checking whether C compiler accepts -Wattributes... " >&6; } +if test ${ax_cv_check_cflags___Wattributes+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wattributes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wattributes=yes +else $as_nop + ax_cv_check_cflags___Wattributes=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wattributes" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wattributes" >&6; } +if test "x$ax_cv_check_cflags___Wattributes" = xyes +then : + CFLAGS="$CFLAGS -Wattributes" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wdiv-by-zero" >&5 +printf %s "checking whether C compiler accepts -Wdiv-by-zero... " >&6; } +if test ${ax_cv_check_cflags___Wdiv_by_zero+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wdiv-by-zero" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wdiv_by_zero=yes +else $as_nop + ax_cv_check_cflags___Wdiv_by_zero=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wdiv_by_zero" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wdiv_by_zero" >&6; } +if test "x$ax_cv_check_cflags___Wdiv_by_zero" = xyes +then : + CFLAGS="$CFLAGS -Wdiv-by-zero" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wshorten-64-to-32" >&5 +printf %s "checking whether C compiler accepts -Wshorten-64-to-32... " >&6; } +if test ${ax_cv_check_cflags___Wshorten_64_to_32+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wshorten-64-to-32" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wshorten_64_to_32=yes +else $as_nop + ax_cv_check_cflags___Wshorten_64_to_32=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wshorten_64_to_32" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wshorten_64_to_32" >&6; } +if test "x$ax_cv_check_cflags___Wshorten_64_to_32" = xyes +then : + CFLAGS="$CFLAGS -Wshorten-64-to-32" +else $as_nop + : +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wconversion" >&5 +printf %s "checking whether C compiler accepts -Wconversion... " >&6; } +if test ${ax_cv_check_cflags___Wconversion+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wconversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wconversion=yes +else $as_nop + ax_cv_check_cflags___Wconversion=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wconversion" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wconversion" >&6; } +if test "x$ax_cv_check_cflags___Wconversion" = xyes +then : + CFLAGS="$CFLAGS -Wconversion" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wextended-offsetof" >&5 +printf %s "checking whether C compiler accepts -Wextended-offsetof... " >&6; } +if test ${ax_cv_check_cflags___Wextended_offsetof+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wextended-offsetof" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wextended_offsetof=yes +else $as_nop + ax_cv_check_cflags___Wextended_offsetof=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wextended_offsetof" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wextended_offsetof" >&6; } +if test "x$ax_cv_check_cflags___Wextended_offsetof" = xyes +then : + CFLAGS="$CFLAGS -Wextended-offsetof" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-nonliteral" >&5 +printf %s "checking whether C compiler accepts -Wformat-nonliteral... " >&6; } +if test ${ax_cv_check_cflags___Wformat_nonliteral+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wformat-nonliteral" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wformat_nonliteral=yes +else $as_nop + ax_cv_check_cflags___Wformat_nonliteral=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wformat_nonliteral" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wformat_nonliteral" >&6; } +if test "x$ax_cv_check_cflags___Wformat_nonliteral" = xyes +then : + CFLAGS="$CFLAGS -Wformat-nonliteral" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wlanguage-extension-token" >&5 +printf %s "checking whether C compiler accepts -Wlanguage-extension-token... " >&6; } +if test ${ax_cv_check_cflags___Wlanguage_extension_token+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wlanguage-extension-token" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wlanguage_extension_token=yes +else $as_nop + ax_cv_check_cflags___Wlanguage_extension_token=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wlanguage_extension_token" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wlanguage_extension_token" >&6; } +if test "x$ax_cv_check_cflags___Wlanguage_extension_token" = xyes +then : + CFLAGS="$CFLAGS -Wlanguage-extension-token" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wmissing-field-initializers" >&5 +printf %s "checking whether C compiler accepts -Wmissing-field-initializers... " >&6; } +if test ${ax_cv_check_cflags___Wmissing_field_initializers+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wmissing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wmissing_field_initializers=yes +else $as_nop + ax_cv_check_cflags___Wmissing_field_initializers=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wmissing_field_initializers" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wmissing_field_initializers" >&6; } +if test "x$ax_cv_check_cflags___Wmissing_field_initializers" = xyes +then : + CFLAGS="$CFLAGS -Wmissing-field-initializers" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wmissing-noreturn" >&5 +printf %s "checking whether C compiler accepts -Wmissing-noreturn... " >&6; } +if test ${ax_cv_check_cflags___Wmissing_noreturn+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wmissing-noreturn" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wmissing_noreturn=yes +else $as_nop + ax_cv_check_cflags___Wmissing_noreturn=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wmissing_noreturn" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wmissing_noreturn" >&6; } +if test "x$ax_cv_check_cflags___Wmissing_noreturn" = xyes +then : + CFLAGS="$CFLAGS -Wmissing-noreturn" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wmissing-variable-declarations" >&5 +printf %s "checking whether C compiler accepts -Wmissing-variable-declarations... " >&6; } +if test ${ax_cv_check_cflags___Wmissing_variable_declarations+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wmissing-variable-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wmissing_variable_declarations=yes +else $as_nop + ax_cv_check_cflags___Wmissing_variable_declarations=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wmissing_variable_declarations" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wmissing_variable_declarations" >&6; } +if test "x$ax_cv_check_cflags___Wmissing_variable_declarations" = xyes +then : + CFLAGS="$CFLAGS -Wmissing-variable-declarations" +else $as_nop + : +fi + + # Not used because we cannot change public structs + # AX_CHECK_COMPILE_FLAG([-Wpadded], [CFLAGS="$CFLAGS -Wpadded"]) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wsign-conversion" >&5 +printf %s "checking whether C compiler accepts -Wsign-conversion... " >&6; } +if test ${ax_cv_check_cflags___Wsign_conversion+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wsign-conversion" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wsign_conversion=yes +else $as_nop + ax_cv_check_cflags___Wsign_conversion=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wsign_conversion" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wsign_conversion" >&6; } +if test "x$ax_cv_check_cflags___Wsign_conversion" = xyes +then : + CFLAGS="$CFLAGS -Wsign-conversion" +else $as_nop + : +fi + + # Not used because this basically disallows default case + # AX_CHECK_COMPILE_FLAG([-Wswitch-enum], [CFLAGS="$CFLAGS -Wswitch-enum"]) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunreachable-code-break" >&5 +printf %s "checking whether C compiler accepts -Wunreachable-code-break... " >&6; } +if test ${ax_cv_check_cflags___Wunreachable_code_break+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wunreachable-code-break" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wunreachable_code_break=yes +else $as_nop + ax_cv_check_cflags___Wunreachable_code_break=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wunreachable_code_break" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wunreachable_code_break" >&6; } +if test "x$ax_cv_check_cflags___Wunreachable_code_break" = xyes +then : + CFLAGS="$CFLAGS -Wunreachable-code-break" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused-macros" >&5 +printf %s "checking whether C compiler accepts -Wunused-macros... " >&6; } +if test ${ax_cv_check_cflags___Wunused_macros+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wunused-macros" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wunused_macros=yes +else $as_nop + ax_cv_check_cflags___Wunused_macros=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wunused_macros" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wunused_macros" >&6; } +if test "x$ax_cv_check_cflags___Wunused_macros" = xyes +then : + CFLAGS="$CFLAGS -Wunused-macros" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused-parameter" >&5 +printf %s "checking whether C compiler accepts -Wunused-parameter... " >&6; } +if test ${ax_cv_check_cflags___Wunused_parameter+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wunused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wunused_parameter=yes +else $as_nop + ax_cv_check_cflags___Wunused_parameter=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wunused_parameter" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wunused_parameter" >&6; } +if test "x$ax_cv_check_cflags___Wunused_parameter" = xyes +then : + CFLAGS="$CFLAGS -Wunused-parameter" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wredundant-decls" >&5 +printf %s "checking whether C compiler accepts -Wredundant-decls... " >&6; } +if test ${ax_cv_check_cflags___Wredundant_decls+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wredundant-decls" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wredundant_decls=yes +else $as_nop + ax_cv_check_cflags___Wredundant_decls=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wredundant_decls" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wredundant_decls" >&6; } +if test "x$ax_cv_check_cflags___Wredundant_decls" = xyes +then : + CFLAGS="$CFLAGS -Wredundant-decls" +else $as_nop + : +fi + + # Only work with Clang for the moment + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wheader-guard" >&5 +printf %s "checking whether C compiler accepts -Wheader-guard... " >&6; } +if test ${ax_cv_check_cflags___Wheader_guard+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wheader-guard" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wheader_guard=yes +else $as_nop + ax_cv_check_cflags___Wheader_guard=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wheader_guard" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wheader_guard" >&6; } +if test "x$ax_cv_check_cflags___Wheader_guard" = xyes +then : + CFLAGS="$CFLAGS -Wheader-guard" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wsometimes-uninitialized" >&5 +printf %s "checking whether C compiler accepts -Wsometimes-uninitialized... " >&6; } +if test ${ax_cv_check_cflags___Wsometimes_uninitialized+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wsometimes-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wsometimes_uninitialized=yes +else $as_nop + ax_cv_check_cflags___Wsometimes_uninitialized=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wsometimes_uninitialized" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wsometimes_uninitialized" >&6; } +if test "x$ax_cv_check_cflags___Wsometimes_uninitialized" = xyes +then : + CFLAGS="$CFLAGS -Wsometimes-uninitialized" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wextra-semi" >&5 +printf %s "checking whether C compiler accepts -Wextra-semi... " >&6; } +if test ${ax_cv_check_cflags___Wextra_semi+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wextra-semi" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wextra_semi=yes +else $as_nop + ax_cv_check_cflags___Wextra_semi=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wextra_semi" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wextra_semi" >&6; } +if test "x$ax_cv_check_cflags___Wextra_semi" = xyes +then : + CFLAGS="$CFLAGS -Wextra-semi" +else $as_nop + : +fi + + + # This is required because we pass format string as "const char*. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wno-format-nonliteral" >&5 +printf %s "checking whether C compiler accepts -Wno-format-nonliteral... " >&6; } +if test ${ax_cv_check_cflags___Wno_format_nonliteral+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Wno-format-nonliteral" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___Wno_format_nonliteral=yes +else $as_nop + ax_cv_check_cflags___Wno_format_nonliteral=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wno_format_nonliteral" >&5 +printf "%s\n" "$ax_cv_check_cflags___Wno_format_nonliteral" >&6; } +if test "x$ax_cv_check_cflags___Wno_format_nonliteral" = xyes +then : + CFLAGS="$CFLAGS -Wno-format-nonliteral" +else $as_nop + : +fi + + + # For C++ compiler + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wall" >&5 +printf %s "checking whether C++ compiler accepts -Wall... " >&6; } +if test ${ax_cv_check_cxxflags___Wall+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Wall" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ax_cv_check_cxxflags___Wall=yes +else $as_nop + ax_cv_check_cxxflags___Wall=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Wall" >&5 +printf "%s\n" "$ax_cv_check_cxxflags___Wall" >&6; } +if test "x$ax_cv_check_cxxflags___Wall" = xyes +then : + CXXFLAGS="$CXXFLAGS -Wall" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Werror" >&5 +printf %s "checking whether C++ compiler accepts -Werror... " >&6; } +if test ${ax_cv_check_cxxflags___Werror+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ax_cv_check_cxxflags___Werror=yes +else $as_nop + ax_cv_check_cxxflags___Werror=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Werror" >&5 +printf "%s\n" "$ax_cv_check_cxxflags___Werror" >&6; } +if test "x$ax_cv_check_cxxflags___Werror" = xyes +then : + CXXFLAGS="$CXXFLAGS -Werror" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wformat-security" >&5 +printf %s "checking whether C++ compiler accepts -Wformat-security... " >&6; } +if test ${ax_cv_check_cxxflags___Wformat_security+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Wformat-security" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ax_cv_check_cxxflags___Wformat_security=yes +else $as_nop + ax_cv_check_cxxflags___Wformat_security=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Wformat_security" >&5 +printf "%s\n" "$ax_cv_check_cxxflags___Wformat_security" >&6; } +if test "x$ax_cv_check_cxxflags___Wformat_security" = xyes +then : + CXXFLAGS="$CXXFLAGS -Wformat-security" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wsometimes-uninitialized" >&5 +printf %s "checking whether C++ compiler accepts -Wsometimes-uninitialized... " >&6; } +if test ${ax_cv_check_cxxflags___Wsometimes_uninitialized+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Wsometimes-uninitialized" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ax_cv_check_cxxflags___Wsometimes_uninitialized=yes +else $as_nop + ax_cv_check_cxxflags___Wsometimes_uninitialized=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Wsometimes_uninitialized" >&5 +printf "%s\n" "$ax_cv_check_cxxflags___Wsometimes_uninitialized" >&6; } +if test "x$ax_cv_check_cxxflags___Wsometimes_uninitialized" = xyes +then : + CXXFLAGS="$CXXFLAGS -Wsometimes-uninitialized" +else $as_nop + : +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wextra-semi" >&5 +printf %s "checking whether C++ compiler accepts -Wextra-semi... " >&6; } +if test ${ax_cv_check_cxxflags___Wextra_semi+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Wextra-semi" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ax_cv_check_cxxflags___Wextra_semi=yes +else $as_nop + ax_cv_check_cxxflags___Wextra_semi=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Wextra_semi" >&5 +printf "%s\n" "$ax_cv_check_cxxflags___Wextra_semi" >&6; } +if test "x$ax_cv_check_cxxflags___Wextra_semi" = xyes +then : + CXXFLAGS="$CXXFLAGS -Wextra-semi" +else $as_nop + : +fi + + # Disable noexcept-type warning of g++-7. This is not harmful as + # long as all source files are compiled with the same compiler. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wno-noexcept-type" >&5 +printf %s "checking whether C++ compiler accepts -Wno-noexcept-type... " >&6; } +if test ${ax_cv_check_cxxflags___Wno_noexcept_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Wno-noexcept-type" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ax_cv_check_cxxflags___Wno_noexcept_type=yes +else $as_nop + ax_cv_check_cxxflags___Wno_noexcept_type=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Wno_noexcept_type" >&5 +printf "%s\n" "$ax_cv_check_cxxflags___Wno_noexcept_type" >&6; } +if test "x$ax_cv_check_cxxflags___Wno_noexcept_type" = xyes +then : + CXXFLAGS="$CXXFLAGS -Wno-noexcept-type" +else $as_nop + : +fi + + # clang++-18 warns this when building with wolfSSL >= v5.7.6-stable. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wno-extern-c-compat" >&5 +printf %s "checking whether C++ compiler accepts -Wno-extern-c-compat... " >&6; } +if test ${ax_cv_check_cxxflags___Wno_extern_c_compat+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -Wno-extern-c-compat" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ax_cv_check_cxxflags___Wno_extern_c_compat=yes +else $as_nop + ax_cv_check_cxxflags___Wno_extern_c_compat=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___Wno_extern_c_compat" >&5 +printf "%s\n" "$ax_cv_check_cxxflags___Wno_extern_c_compat" >&6; } +if test "x$ax_cv_check_cxxflags___Wno_extern_c_compat" = xyes +then : + CXXFLAGS="$CXXFLAGS -Wno-extern-c-compat" +else $as_nop + : +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi + +WARNCFLAGS=$CFLAGS +WARNCXXFLAGS=$CXXFLAGS + +CFLAGS=$save_CFLAGS +CXXFLAGS=$save_CXXFLAGS + + + + +EXTRACFLAG= +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fvisibility=hidden" >&5 +printf %s "checking whether C compiler accepts -fvisibility=hidden... " >&6; } +if test ${ax_cv_check_cflags___fvisibility_hidden+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -fvisibility=hidden" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags___fvisibility_hidden=yes +else $as_nop + ax_cv_check_cflags___fvisibility_hidden=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fvisibility_hidden" >&5 +printf "%s\n" "$ax_cv_check_cflags___fvisibility_hidden" >&6; } +if test "x$ax_cv_check_cflags___fvisibility_hidden" = xyes +then : + EXTRACFLAG="-fvisibility=hidden" +else $as_nop + : +fi + + + + +if test "x$debug" != "xno"; then + +printf "%s\n" "#define DEBUGBUILD 1" >>confdefs.h + +fi + +enable_threads=yes +# Some platform does not have working std::future. We disable +# threading for those platforms. +if test "x$threads" != "xyes" || + test "x$have_std_future" != "xyes"; then + enable_threads=no + +printf "%s\n" "#define NOTHREADS 1" >>confdefs.h + +fi + +# propagate $enable_static to tests/Makefile.am + if test "x$enable_static" = "xyes"; then + ENABLE_STATIC_TRUE= + ENABLE_STATIC_FALSE='#' +else + ENABLE_STATIC_TRUE='#' + ENABLE_STATIC_FALSE= +fi + + + + + +ac_config_files="$ac_config_files Makefile lib/Makefile lib/libnghttp2.pc lib/includes/Makefile lib/includes/nghttp2/nghttp2ver.h tests/Makefile tests/testdata/Makefile third-party/Makefile src/Makefile src/testdata/Makefile bpf/Makefile examples/Makefile integration-tests/Makefile integration-tests/config.go integration-tests/setenv doc/Makefile doc/conf.py doc/index.rst doc/package_README.rst doc/tutorial-client.rst doc/tutorial-server.rst doc/tutorial-hpack.rst doc/nghttpx-howto.rst doc/h2load-howto.rst doc/building-android-binary.rst doc/nghttp2.h.rst doc/nghttp2ver.h.rst doc/contribute.rst contrib/Makefile script/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBBPF_TRUE}" && test -z "${HAVE_LIBBPF_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBBPF\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBXML2_TRUE}" && test -z "${HAVE_LIBXML2_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBXML2\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_APP_TRUE}" && test -z "${ENABLE_APP_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_APP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_HTTP3_TRUE}" && test -z "${ENABLE_HTTP3_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_HTTP3\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_HPACK_TOOLS_TRUE}" && test -z "${ENABLE_HPACK_TOOLS_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_HPACK_TOOLS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_EXAMPLES_TRUE}" && test -z "${ENABLE_EXAMPLES_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_EXAMPLES\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_THIRD_PARTY_TRUE}" && test -z "${ENABLE_THIRD_PARTY_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_THIRD_PARTY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_MRUBY_TRUE}" && test -z "${HAVE_MRUBY_FALSE}"; then + as_fn_error $? "conditional \"HAVE_MRUBY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_NEVERBLEED_TRUE}" && test -z "${HAVE_NEVERBLEED_FALSE}"; then + as_fn_error $? "conditional \"HAVE_NEVERBLEED\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_FAILMALLOC_TRUE}" && test -z "${ENABLE_FAILMALLOC_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_FAILMALLOC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +if test -z "${ENABLE_STATIC_TRUE}" && test -z "${ENABLE_STATIC_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_STATIC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by nghttp2 $as_me 1.65.0, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +nghttp2 config.status 1.65.0 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +FILECMD \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_import \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +lt_cv_nm_interface \ +nm_file_list_spec \ +lt_cv_truncate_bin \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +reload_flag_CXX \ +compiler_CXX \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_static_CXX \ +lt_cv_prog_compiler_c_o_CXX \ +export_dynamic_flag_spec_CXX \ +whole_archive_flag_spec_CXX \ +compiler_needs_object_CXX \ +with_gnu_ld_CXX \ +allow_undefined_flag_CXX \ +no_undefined_flag_CXX \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_separator_CXX \ +exclude_expsyms_CXX \ +include_expsyms_CXX \ +file_list_spec_CXX \ +compiler_lib_search_dirs_CXX \ +predep_objects_CXX \ +postdep_objects_CXX \ +predeps_CXX \ +postdeps_CXX \ +compiler_lib_search_path_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path \ +reload_cmds_CXX \ +old_archive_cmds_CXX \ +old_archive_from_new_cmds_CXX \ +old_archive_from_expsyms_cmds_CXX \ +archive_cmds_CXX \ +archive_expsym_cmds_CXX \ +module_cmds_CXX \ +module_expsym_cmds_CXX \ +export_symbols_cmds_CXX \ +prelink_cmds_CXX \ +postlink_cmds_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' + +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile' + + + + + +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "lib/libnghttp2.pc") CONFIG_FILES="$CONFIG_FILES lib/libnghttp2.pc" ;; + "lib/includes/Makefile") CONFIG_FILES="$CONFIG_FILES lib/includes/Makefile" ;; + "lib/includes/nghttp2/nghttp2ver.h") CONFIG_FILES="$CONFIG_FILES lib/includes/nghttp2/nghttp2ver.h" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "tests/testdata/Makefile") CONFIG_FILES="$CONFIG_FILES tests/testdata/Makefile" ;; + "third-party/Makefile") CONFIG_FILES="$CONFIG_FILES third-party/Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/testdata/Makefile") CONFIG_FILES="$CONFIG_FILES src/testdata/Makefile" ;; + "bpf/Makefile") CONFIG_FILES="$CONFIG_FILES bpf/Makefile" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "integration-tests/Makefile") CONFIG_FILES="$CONFIG_FILES integration-tests/Makefile" ;; + "integration-tests/config.go") CONFIG_FILES="$CONFIG_FILES integration-tests/config.go" ;; + "integration-tests/setenv") CONFIG_FILES="$CONFIG_FILES integration-tests/setenv" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/conf.py") CONFIG_FILES="$CONFIG_FILES doc/conf.py" ;; + "doc/index.rst") CONFIG_FILES="$CONFIG_FILES doc/index.rst" ;; + "doc/package_README.rst") CONFIG_FILES="$CONFIG_FILES doc/package_README.rst" ;; + "doc/tutorial-client.rst") CONFIG_FILES="$CONFIG_FILES doc/tutorial-client.rst" ;; + "doc/tutorial-server.rst") CONFIG_FILES="$CONFIG_FILES doc/tutorial-server.rst" ;; + "doc/tutorial-hpack.rst") CONFIG_FILES="$CONFIG_FILES doc/tutorial-hpack.rst" ;; + "doc/nghttpx-howto.rst") CONFIG_FILES="$CONFIG_FILES doc/nghttpx-howto.rst" ;; + "doc/h2load-howto.rst") CONFIG_FILES="$CONFIG_FILES doc/h2load-howto.rst" ;; + "doc/building-android-binary.rst") CONFIG_FILES="$CONFIG_FILES doc/building-android-binary.rst" ;; + "doc/nghttp2.h.rst") CONFIG_FILES="$CONFIG_FILES doc/nghttp2.h.rst" ;; + "doc/nghttp2ver.h.rst") CONFIG_FILES="$CONFIG_FILES doc/nghttp2ver.h.rst" ;; + "doc/contribute.rst") CONFIG_FILES="$CONFIG_FILES doc/contribute.rst" ;; + "contrib/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;; + "script/Makefile") CONFIG_FILES="$CONFIG_FILES script/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "libtool":C) + + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# The names of the tagged configurations supported by this script. +available_tags='CXX ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# A file(cmd) program that detects file types. +FILECMD=$lt_FILECMD + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive (by configure). +lt_ar_flags=$lt_ar_flags + +# Flags to create an archive. +AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name lister interface. +nm_interface=$lt_lt_cv_nm_interface + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and where our libraries should be installed. +lt_sysroot=$lt_sysroot + +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + + +ltmain=$ac_aux_dir/ltmain.sh + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + $SED '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + ;; + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: summary of build options: + + Package version: ${VERSION} + Library version: $LT_CURRENT:$LT_REVISION:$LT_AGE + Install prefix: ${prefix} + System types: + Build: ${build} + Host: ${host} + Target: ${target} + Compiler: + C compiler: ${CC} + CFLAGS: ${CFLAGS} + LDFLAGS: ${LDFLAGS} + C++ compiler: ${CXX} + CXXFLAGS: ${CXXFLAGS} + CXXCPP: ${CXXCPP} + C preprocessor: ${CPP} + CPPFLAGS: ${CPPFLAGS} + WARNCFLAGS: ${WARNCFLAGS} + WARNCXXFLAGS: ${WARNCXXFLAGS} + CXX1XCXXFLAGS: ${CXX1XCXXFLAGS} + EXTRACFLAG: ${EXTRACFLAG} + BPFCFLAGS: ${BPFCFLAGS} + EXTRABPFCFLAGS: ${EXTRABPFCFLAGS} + LIBS: ${LIBS} + DEFS: ${DEFS} + EXTRA_DEFS: ${EXTRA_DEFS} + Library: + Shared: ${enable_shared} + Static: ${enable_static} + Libtool: + LIBTOOL_LDFLAGS: ${LIBTOOL_LDFLAGS} + Python: + Python: ${PYTHON} + PYTHON_VERSION: ${PYTHON_VERSION} + Test: + Failmalloc: ${enable_failmalloc} + Libs: + wolfSSL: ${have_wolfssl} (CFLAGS='${WOLFSSL_CFLAGS}' LIBS='${WOLFSSL_LIBS}') + OpenSSL: ${have_openssl} (CFLAGS='${OPENSSL_CFLAGS}' LIBS='${OPENSSL_LIBS}') + Libxml2: ${have_libxml2} (CFLAGS='${LIBXML2_CFLAGS}' LIBS='${LIBXML2_LIBS}') + Libev: ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}') + Libc-ares: ${have_libcares} (CFLAGS='${LIBCARES_CFLAGS}' LIBS='${LIBCARES_LIBS}') + libngtcp2: ${have_libngtcp2} (CFLAGS='${LIBNGTCP2_CFLAGS}' LIBS='${LIBNGTCP2_LIBS}') + libngtcp2_crypto_quictls: ${have_libngtcp2_crypto_quictls} (CFLAGS='${LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_QUICTLS_LIBS}') + libngtcp2_crypto_boringssl: ${have_libngtcp2_crypto_boringssl} (CFLAGS='${LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_BORINGSSL_LIBS}') + libnghttp3: ${have_libnghttp3} (CFLAGS='${LIBNGHTTP3_CFLAGS}' LIBS='${LIBNGHTTP3_LIBS}') + libbpf: ${have_libbpf} (CFLAGS='${LIBBPF_CFLAGS}' LIBS='${LIBBPF_LIBS}') + Libevent(SSL): ${have_libevent_openssl} (CFLAGS='${LIBEVENT_OPENSSL_CFLAGS}' LIBS='${LIBEVENT_OPENSSL_LIBS}') + Jansson: ${have_jansson} (CFLAGS='${JANSSON_CFLAGS}' LIBS='${JANSSON_LIBS}') + Jemalloc: ${have_jemalloc} (CFLAGS='${JEMALLOC_CFLAGS}' LIBS='${JEMALLOC_LIBS}') + Zlib: ${have_zlib} (CFLAGS='${ZLIB_CFLAGS}' LIBS='${ZLIB_LIBS}') + Systemd: ${have_libsystemd} (CFLAGS='${SYSTEMD_CFLAGS}' LIBS='${SYSTEMD_LIBS}') + Libbrotlienc: ${have_libbrotlienc} (CFLAGS=\"${LIBBROTLIENC_CFLAGS}' LIBS='${LIBBROTLIENC_LIBS}') + Libbrotlidec: ${have_libbrotlidec} (CFLAGS=\"${LIBBROTLIDEC_CFLAGS}' LIBS='${LIBBROTLIDEC_LIBS}') + Third-party: + http-parser: ${enable_third_party} + MRuby: ${have_mruby} (CFLAGS='${LIBMRUBY_CFLAGS}' LIBS='${LIBMRUBY_LIBS}') + Neverbleed: ${have_neverbleed} + Features: + Applications: ${enable_app} + HPACK tools: ${enable_hpack_tools} + Examples: ${enable_examples} + Threading: ${enable_threads} + HTTP/3 (EXPERIMENTAL): ${enable_http3} +" >&5 +printf "%s\n" "$as_me: summary of build options: + + Package version: ${VERSION} + Library version: $LT_CURRENT:$LT_REVISION:$LT_AGE + Install prefix: ${prefix} + System types: + Build: ${build} + Host: ${host} + Target: ${target} + Compiler: + C compiler: ${CC} + CFLAGS: ${CFLAGS} + LDFLAGS: ${LDFLAGS} + C++ compiler: ${CXX} + CXXFLAGS: ${CXXFLAGS} + CXXCPP: ${CXXCPP} + C preprocessor: ${CPP} + CPPFLAGS: ${CPPFLAGS} + WARNCFLAGS: ${WARNCFLAGS} + WARNCXXFLAGS: ${WARNCXXFLAGS} + CXX1XCXXFLAGS: ${CXX1XCXXFLAGS} + EXTRACFLAG: ${EXTRACFLAG} + BPFCFLAGS: ${BPFCFLAGS} + EXTRABPFCFLAGS: ${EXTRABPFCFLAGS} + LIBS: ${LIBS} + DEFS: ${DEFS} + EXTRA_DEFS: ${EXTRA_DEFS} + Library: + Shared: ${enable_shared} + Static: ${enable_static} + Libtool: + LIBTOOL_LDFLAGS: ${LIBTOOL_LDFLAGS} + Python: + Python: ${PYTHON} + PYTHON_VERSION: ${PYTHON_VERSION} + Test: + Failmalloc: ${enable_failmalloc} + Libs: + wolfSSL: ${have_wolfssl} (CFLAGS='${WOLFSSL_CFLAGS}' LIBS='${WOLFSSL_LIBS}') + OpenSSL: ${have_openssl} (CFLAGS='${OPENSSL_CFLAGS}' LIBS='${OPENSSL_LIBS}') + Libxml2: ${have_libxml2} (CFLAGS='${LIBXML2_CFLAGS}' LIBS='${LIBXML2_LIBS}') + Libev: ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}') + Libc-ares: ${have_libcares} (CFLAGS='${LIBCARES_CFLAGS}' LIBS='${LIBCARES_LIBS}') + libngtcp2: ${have_libngtcp2} (CFLAGS='${LIBNGTCP2_CFLAGS}' LIBS='${LIBNGTCP2_LIBS}') + libngtcp2_crypto_quictls: ${have_libngtcp2_crypto_quictls} (CFLAGS='${LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_QUICTLS_LIBS}') + libngtcp2_crypto_boringssl: ${have_libngtcp2_crypto_boringssl} (CFLAGS='${LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_BORINGSSL_LIBS}') + libnghttp3: ${have_libnghttp3} (CFLAGS='${LIBNGHTTP3_CFLAGS}' LIBS='${LIBNGHTTP3_LIBS}') + libbpf: ${have_libbpf} (CFLAGS='${LIBBPF_CFLAGS}' LIBS='${LIBBPF_LIBS}') + Libevent(SSL): ${have_libevent_openssl} (CFLAGS='${LIBEVENT_OPENSSL_CFLAGS}' LIBS='${LIBEVENT_OPENSSL_LIBS}') + Jansson: ${have_jansson} (CFLAGS='${JANSSON_CFLAGS}' LIBS='${JANSSON_LIBS}') + Jemalloc: ${have_jemalloc} (CFLAGS='${JEMALLOC_CFLAGS}' LIBS='${JEMALLOC_LIBS}') + Zlib: ${have_zlib} (CFLAGS='${ZLIB_CFLAGS}' LIBS='${ZLIB_LIBS}') + Systemd: ${have_libsystemd} (CFLAGS='${SYSTEMD_CFLAGS}' LIBS='${SYSTEMD_LIBS}') + Libbrotlienc: ${have_libbrotlienc} (CFLAGS=\"${LIBBROTLIENC_CFLAGS}' LIBS='${LIBBROTLIENC_LIBS}') + Libbrotlidec: ${have_libbrotlidec} (CFLAGS=\"${LIBBROTLIDEC_CFLAGS}' LIBS='${LIBBROTLIDEC_LIBS}') + Third-party: + http-parser: ${enable_third_party} + MRuby: ${have_mruby} (CFLAGS='${LIBMRUBY_CFLAGS}' LIBS='${LIBMRUBY_LIBS}') + Neverbleed: ${have_neverbleed} + Features: + Applications: ${enable_app} + HPACK tools: ${enable_hpack_tools} + Examples: ${enable_examples} + Threading: ${enable_threads} + HTTP/3 (EXPERIMENTAL): ${enable_http3} +" >&6;} + diff --git a/lib/nghttp2/configure.ac b/lib/nghttp2-1.65.0/configure.ac similarity index 86% rename from lib/nghttp2/configure.ac rename to lib/nghttp2-1.65.0/configure.ac index 0376e21fa92..3ac15a33e97 100644 --- a/lib/nghttp2/configure.ac +++ b/lib/nghttp2-1.65.0/configure.ac @@ -25,7 +25,7 @@ dnl Do not change user variables! dnl https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html AC_PREREQ(2.61) -AC_INIT([nghttp2], [1.59.0-DEV], [t-tujikawa@users.sourceforge.net]) +AC_INIT([nghttp2], [1.65.0], [t-tujikawa@users.sourceforge.net]) AC_CONFIG_AUX_DIR([.]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -38,15 +38,15 @@ AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET -AM_INIT_AUTOMAKE([subdir-objects]) +AM_INIT_AUTOMAKE([subdir-objects tar-pax]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) dnl See versioning rule: dnl https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -AC_SUBST(LT_CURRENT, 39) -AC_SUBST(LT_REVISION, 1) -AC_SUBST(LT_AGE, 25) +AC_SUBST(LT_CURRENT, 42) +AC_SUBST(LT_REVISION, 4) +AC_SUBST(LT_AGE, 28) major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/[^0-9]//g"` minor=`echo $PACKAGE_VERSION |cut -d. -f2 | sed -e "s/[^0-9]//g"` @@ -127,6 +127,11 @@ AC_ARG_WITH([libcares], [Use libc-ares [default=check]])], [request_libcares=$withval], [request_libcares=check]) +AC_ARG_WITH([wolfssl], + [AS_HELP_STRING([--with-wolfssl], + [Use wolfSSL [default=check]])], + [request_wolfssl=$withval], [request_wolfssl=check]) + AC_ARG_WITH([openssl], [AS_HELP_STRING([--with-openssl], [Use openssl [default=check]])], @@ -137,11 +142,6 @@ AC_ARG_WITH([libev], [Use libev [default=check]])], [request_libev=$withval], [request_libev=check]) -AC_ARG_WITH([cunit], - [AS_HELP_STRING([--with-cunit], - [Use cunit [default=check]])], - [request_cunit=$withval], [request_cunit=check]) - AC_ARG_WITH([jemalloc], [AS_HELP_STRING([--with-jemalloc], [Use jemalloc [default=check]])], @@ -177,6 +177,16 @@ AC_ARG_WITH([libbpf], [Use libbpf [default=no]])], [request_libbpf=$withval], [request_libbpf=no]) +AC_ARG_WITH([libbrotlienc], + [AS_HELP_STRING([--with-libbrotlienc], + [Use libbrotlienc [default=no]])], + [request_libbrotlienc=$withval], [request_libbrotlienc=no]) + +AC_ARG_WITH([libbrotlidec], + [AS_HELP_STRING([--with-libbrotlidec], + [Use libbrotlidec [default=no]])], + [request_libbrotlidec=$withval], [request_libbrotlidec=no]) + dnl Define variables AC_ARG_VAR([LIBEV_CFLAGS], [C compiler flags for libev, skipping any checks]) AC_ARG_VAR([LIBEV_LIBS], [linker flags for libev, skipping any checks]) @@ -233,7 +243,7 @@ fi save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= -AX_CXX_COMPILE_STDCXX([14], [], [optional]) +AX_CXX_COMPILE_STDCXX([20], [], [optional]) CXX1XCXXFLAGS="$CXXFLAGS" CXXFLAGS="$save_CXXFLAGS" @@ -278,21 +288,20 @@ std::map().emplace(1, 2); [have_std_map_emplace=no AC_MSG_RESULT([no])]) -# Check that std::atomic_* overloads for std::shared_ptr are -# available. -AC_MSG_CHECKING([whether std::atomic_* overloads for std::shared_ptr are available]) +# Check that std::atomic> is supported. +AC_MSG_CHECKING([whether std::atomic> is supported]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ #include ]], [[ -auto a = std::make_shared(1000000007); -auto p = std::atomic_load(&a); +auto a = std::atomic>(std::make_shared(1000000007)); +auto p = a.load(); ++*p; -std::atomic_store(&a, p); +a.store(p); ]])], [AC_DEFINE([HAVE_ATOMIC_STD_SHARED_PTR], [1], - [Define to 1 if you have the std::atomic_* overloads for std::shared_ptr.]) + [Define to 1 if you have the std::atomic> is supported.]) have_atomic_std_shared_ptr=yes AC_MSG_RESULT([yes])], [have_atomic_std_shared_ptr=no @@ -329,7 +338,7 @@ case "$host_os" in *android*) android_build=yes # android does not need -pthread, but needs following 2 libs for C++ - APPLDFLAGS="$APPLDFLAGS -lstdc++ -latomic" + APPLDFLAGS="$APPLDFLAGS -latomic" ;; *) PTHREAD_LDFLAGS="-pthread" @@ -377,43 +386,6 @@ case "${host_os}" in ;; esac -# cunit -have_cunit=no -if test "x${request_cunit}" != "xno"; then - PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes], [have_cunit=no]) - # If pkg-config does not find cunit, check it using AC_CHECK_LIB. We - # do this because Debian (Ubuntu) lacks pkg-config file for cunit. - if test "x${have_cunit}" = "xno"; then - AC_MSG_WARN([${CUNIT_PKG_ERRORS}]) - AC_CHECK_LIB([cunit], [CU_initialize_registry], - [have_cunit=yes], [have_cunit=no]) - if test "x${have_cunit}" = "xyes"; then - CUNIT_LIBS="-lcunit" - CUNIT_CFLAGS="" - AC_SUBST([CUNIT_LIBS]) - AC_SUBST([CUNIT_CFLAGS]) - fi - fi - if test "x${have_cunit}" = "xyes"; then - # cunit in Mac OS X requires ncurses. Note that in Mac OS X, test - # program can be built without -lncurses, but it emits runtime - # error. - case "${build}" in - *-apple-darwin*) - CUNIT_LIBS="$CUNIT_LIBS -lncurses" - AC_SUBST([CUNIT_LIBS]) - ;; - esac - fi -fi - -if test "x${request_cunit}" = "xyes" && - test "x${have_cunit}" != "xyes"; then - AC_MSG_ERROR([cunit was requested (--with-cunit) but not found]) -fi - -AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ]) - # libev (for src) have_libev=no if test "x${request_libev}" != "xno"; then @@ -444,17 +416,26 @@ if test "x${request_libev}" = "xyes" && AC_MSG_ERROR([libev was requested (--with-libev) but not found]) fi +if test "x${request_openssl}" = "xyes" && + test "x${request_wolfssl}" = "xyes"; then + AC_MSG_ERROR([Requesting both OpenSSL and wolfSSL is not allowed]) +fi + # openssl (for src) have_openssl=no -if test "x${request_openssl}" != "xno"; then - PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1], +if test "x${request_openssl}" != "xno" && + test "x${request_wolfssl}" != "xyes"; then + PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.1.1], [have_openssl=yes], [have_openssl=no]) if test "x${have_openssl}" = "xno"; then AC_MSG_NOTICE($OPENSSL_PKG_ERRORS) else - save_CFLAGS="$CFLAGS" + # Use C++ compiler because boringssl needs C++ runtime. + AC_LANG_PUSH(C++) + + save_CXXFLAGS="$CXXFLAGS" save_LIBS="$LIBS" - CFLAGS="$OPENSSL_CFLAGS $CFLAGS" + CXXFLAGS="$OPENSSL_CFLAGS $CXXFLAGS" LIBS="$OPENSSL_LIBS $LIBS" # quictls/openssl has SSL_provide_quic_data. boringssl also has @@ -464,7 +445,7 @@ if test "x${request_openssl}" != "xno"; then AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ - SSL_provide_quic_data(NULL, 0, NULL, 0); + SSL_provide_quic_data(NULL, (ssl_encryption_level_t)0, NULL, 0); ]])], [AC_MSG_RESULT([yes]); have_ssl_provide_quic_data=yes], [AC_MSG_RESULT([no]); have_ssl_provide_quic_data=no]) @@ -480,8 +461,10 @@ if test "x${request_openssl}" != "xno"; then [AC_MSG_RESULT([yes]); have_boringssl_quic=yes], [AC_MSG_RESULT([no]); have_boringssl_quic=no]) - CFLAGS="$save_CFLAGS" + CXXFLAGS="$save_CXXFLAGS" LIBS="$save_LIBS" + + AC_LANG_POP() fi fi @@ -490,10 +473,49 @@ if test "x${request_openssl}" = "xyes" && AC_MSG_ERROR([openssl was requested (--with-openssl) but not found]) fi +# wolfSSL (for src) +have_wolfssl=no +if test "x${request_wolfssl}" != "xno" && + test "x${request_openssl}" != "xyes" && + test "x${have_openssl}" != "xyes"; then + PKG_CHECK_MODULES([WOLFSSL], [wolfssl >= 5.7.0], + [have_wolfssl=yes], [have_wolfssl=no]) + if test "x${have_wolfssl}" = "xno"; then + AC_MSG_NOTICE($WOLFSSL_PKG_ERRORS) + else + AC_DEFINE([HAVE_WOLFSSL], [1], + [Define to 1 if you have 'wolfssl' library.]) + + save_CFLAGS="$CFLAGS" + save_LIBS="$LIBS" + CFLAGS="$WOLFSSL_CFLAGS $CFLAGS" + LIBS="$WOLFSSL_LIBS $LIBS" + + have_wolfssl_quic=no + AC_MSG_CHECKING([for wolfSSL QUIC]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include + #include + ]], [[ + SSL_provide_quic_data(NULL, 0, NULL, 0); + ]])], + [AC_MSG_RESULT([yes]); have_wolfssl_quic=yes], + [AC_MSG_RESULT([no]); have_wolfssl_quic=no]) + + CFLAGS="$save_CFLAGS" + LIBS="$save_LIBS" + fi +fi + +if test "x${request_wolfssl}" = "xyes" && + test "x${have_wolfssl}" != "xyes"; then + AC_MSG_ERROR([wolfSSL was requested (--with-wolfssl) but not found]) +fi + # c-ares (for src) have_libcares=no if test "x${request_libcares}" != "xno"; then - PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.5], [have_libcares=yes], + PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.16.0], [have_libcares=yes], [have_libcares=no]) if test "x${have_libcares}" = "xno"; then AC_MSG_NOTICE($LIBCARES_PKG_ERRORS) @@ -508,7 +530,7 @@ fi # ngtcp2 (for src) have_libngtcp2=no if test "x${request_libngtcp2}" != "xno"; then - PKG_CHECK_MODULES([LIBNGTCP2], [libngtcp2 >= 1.0.0], [have_libngtcp2=yes], + PKG_CHECK_MODULES([LIBNGTCP2], [libngtcp2 >= 1.4.0], [have_libngtcp2=yes], [have_libngtcp2=no]) if test "x${have_libngtcp2}" = "xno"; then AC_MSG_NOTICE($LIBNGTCP2_PKG_ERRORS) @@ -520,6 +542,28 @@ if test "x${request_libngtcp2}" = "xyes" && AC_MSG_ERROR([libngtcp2 was requested (--with-libngtcp2) but not found]) fi +# ngtcp2_crypto_wolfssl (for src) +have_libngtcp2_crypto_wolfssl=no +if test "x${have_wolfssl_quic}" = "xyes" && + test "x${request_libngtcp2}" != "xno"; then + PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_WOLFSSL], + [libngtcp2_crypto_wolfssl >= 1.0.0], + [have_libngtcp2_crypto_wolfssl=yes], + [have_libngtcp2_crypto_wolfssl=no]) + if test "x${have_libngtcp2_crypto_wolfssl}" = "xno"; then + AC_MSG_NOTICE($LIBNGTCP2_CRYPTO_WOLFSSL_PKG_ERRORS) + else + AC_DEFINE([HAVE_LIBNGTCP2_CRYPTO_WOLFSSL], [1], + [Define to 1 if you have `libngtcp2_crypto_wolfssl` library.]) + fi +fi + +if test "x${have_wolfssl_quic}" = "xyes" && + test "x${request_libngtcp2}" = "xyes" && + test "x${have_libngtcp2_crypto_wolfssl}" != "xyes"; then + AC_MSG_ERROR([libngtcp2_crypto_wolfssl was requested (--with-libngtcp2) but not found]) +fi + # ngtcp2_crypto_quictls (for src) have_libngtcp2_crypto_quictls=no if test "x${have_ssl_provide_quic_data}" = "xyes" && @@ -626,6 +670,47 @@ fi AM_CONDITIONAL([HAVE_LIBBPF], [ test "x${have_libbpf}" = "xyes" ]) +# libbrotlienc (for src) +have_libbrotlienc=no +if test "x${request_libbrotlienc}" != "xno"; then + PKG_CHECK_MODULES([LIBBROTLIENC], [libbrotlienc >= 1.0.9], + [have_libbrotlienc=yes], + [have_libbrotlienc=no]) + if test "x${have_libbrotlienc}" = "xno"; then + AC_MSG_NOTICE($LIBBROTLIENC_PKG_ERRORS) + fi +fi + +if test "x${request_libbrotlienc}" = "xyes" && + test "x${have_libbrotlienc}" != "xyes"; then + AC_MSG_ERROR([libbrotlienc was requested (--with-libbrotlienc) but not found]) +fi + +# libbrotlidec (for src) +have_libbrotlidec=no +if test "x${request_libbrotlidec}" != "xno"; then + PKG_CHECK_MODULES([LIBBROTLIDEC], [libbrotlidec >= 1.0.9], + [have_libbrotlidec=yes], + [have_libbrotlidec=no]) + if test "x${have_libbrotlidec}" = "xno"; then + AC_MSG_NOTICE($LIBBROTLIDEC_PKG_ERRORS) + fi +fi + +if test "x${request_libbrotlidec}" = "xyes" && + test "x${have_libbrotlidec}" != "xyes"; then + AC_MSG_ERROR([libbrotlidec was requested (--with-libbrotlidec) but not found]) +fi + +have_libbrotli=no +if test "x${have_libbrotlienc}" = "xyes" && + test "x${have_libbrotlidec}" = "xyes"; then + have_libbrotli=yes + + AC_DEFINE([HAVE_LIBBROTLI], [1], + [Define to 1 if you have `libbrotlienc` and `libbrotlidec` libraries.]) +fi + # libevent_openssl (for examples) # 2.0.8 is required because we use evconnlistener_set_error_cb() have_libevent_openssl=no @@ -738,7 +823,7 @@ fi enable_app=no if test "x${request_app}" != "xno" && test "x${have_zlib}" = "xyes" && - test "x${have_openssl}" = "xyes" && + (test "x${have_openssl}" = "xyes" || test "x${have_wolfssl}" = "xyes") && test "x${have_libev}" = "xyes" && test "x${have_libcares}" = "xyes"; then enable_app=yes @@ -755,7 +840,8 @@ AM_CONDITIONAL([ENABLE_APP], [ test "x${enable_app}" = "xyes" ]) enable_http3=no if test "x${request_http3}" != "xno" && test "x${have_libngtcp2}" = "xyes" && - (test "x${have_libngtcp2_crypto_quictls}" = "xyes" || + (test "x${have_libngtcp2_crypto_wolfssl}" = "xyes" || + test "x${have_libngtcp2_crypto_quictls}" = "xyes" || test "x${have_libngtcp2_crypto_boringssl}" = "xyes") && test "x${have_libnghttp3}" = "xyes"; then enable_http3=yes @@ -856,7 +942,6 @@ AC_CHECK_HEADERS([ \ sys/socket.h \ sys/time.h \ syslog.h \ - time.h \ unistd.h \ windows.h \ ]) @@ -908,12 +993,6 @@ if test "x$have_struct_tm_tm_gmtoff" = "xyes"; then [Define to 1 if you have `struct tm.tm_gmtoff` member.]) fi -# Check size of pointer to decide we need 8 bytes alignment -# adjustment. -AC_CHECK_SIZEOF([int *]) - -AC_CHECK_SIZEOF([time_t]) - # Checks for library functions. # Don't check malloc, since it does not play nicely with C++ stdlib @@ -939,6 +1018,7 @@ AC_CHECK_FUNCS([ \ memmove \ memset \ mkostemp \ + pipe2 \ socket \ sqrt \ strchr \ @@ -1043,6 +1123,7 @@ if test "x$werror" != "xno"; then # Only work with Clang for the moment AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"]) AX_CHECK_COMPILE_FLAG([-Wsometimes-uninitialized], [CFLAGS="$CFLAGS -Wsometimes-uninitialized"]) + AX_CHECK_COMPILE_FLAG([-Wextra-semi], [CFLAGS="$CFLAGS -Wextra-semi"]) # This is required because we pass format string as "const char*. AX_CHECK_COMPILE_FLAG([-Wno-format-nonliteral], [CFLAGS="$CFLAGS -Wno-format-nonliteral"]) @@ -1053,9 +1134,12 @@ if test "x$werror" != "xno"; then AX_CHECK_COMPILE_FLAG([-Werror], [CXXFLAGS="$CXXFLAGS -Werror"]) AX_CHECK_COMPILE_FLAG([-Wformat-security], [CXXFLAGS="$CXXFLAGS -Wformat-security"]) AX_CHECK_COMPILE_FLAG([-Wsometimes-uninitialized], [CXXFLAGS="$CXXFLAGS -Wsometimes-uninitialized"]) + AX_CHECK_COMPILE_FLAG([-Wextra-semi], [CXXFLAGS="$CXXFLAGS -Wextra-semi"]) # Disable noexcept-type warning of g++-7. This is not harmful as # long as all source files are compiled with the same compiler. AX_CHECK_COMPILE_FLAG([-Wno-noexcept-type], [CXXFLAGS="$CXXFLAGS -Wno-noexcept-type"]) + # clang++-18 warns this when building with wolfSSL >= v5.7.6-stable. + AX_CHECK_COMPILE_FLAG([-Wno-extern-c-compat], [CXXFLAGS="$CXXFLAGS -Wno-extern-c-compat"]) AC_LANG_POP() fi @@ -1162,9 +1246,9 @@ AC_MSG_NOTICE([summary of build options: Python: ${PYTHON} PYTHON_VERSION: ${PYTHON_VERSION} Test: - CUnit: ${have_cunit} (CFLAGS='${CUNIT_CFLAGS}' LIBS='${CUNIT_LIBS}') Failmalloc: ${enable_failmalloc} Libs: + wolfSSL: ${have_wolfssl} (CFLAGS='${WOLFSSL_CFLAGS}' LIBS='${WOLFSSL_LIBS}') OpenSSL: ${have_openssl} (CFLAGS='${OPENSSL_CFLAGS}' LIBS='${OPENSSL_LIBS}') Libxml2: ${have_libxml2} (CFLAGS='${LIBXML2_CFLAGS}' LIBS='${LIBXML2_LIBS}') Libev: ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}') @@ -1179,6 +1263,8 @@ AC_MSG_NOTICE([summary of build options: Jemalloc: ${have_jemalloc} (CFLAGS='${JEMALLOC_CFLAGS}' LIBS='${JEMALLOC_LIBS}') Zlib: ${have_zlib} (CFLAGS='${ZLIB_CFLAGS}' LIBS='${ZLIB_LIBS}') Systemd: ${have_libsystemd} (CFLAGS='${SYSTEMD_CFLAGS}' LIBS='${SYSTEMD_LIBS}') + Libbrotlienc: ${have_libbrotlienc} (CFLAGS="${LIBBROTLIENC_CFLAGS}' LIBS='${LIBBROTLIENC_LIBS}') + Libbrotlidec: ${have_libbrotlidec} (CFLAGS="${LIBBROTLIDEC_CFLAGS}' LIBS='${LIBBROTLIDEC_LIBS}') Third-party: http-parser: ${enable_third_party} MRuby: ${have_mruby} (CFLAGS='${LIBMRUBY_CFLAGS}' LIBS='${LIBMRUBY_LIBS}') diff --git a/lib/nghttp2/contrib/CMakeLists.txt b/lib/nghttp2-1.65.0/contrib/CMakeLists.txt similarity index 100% rename from lib/nghttp2/contrib/CMakeLists.txt rename to lib/nghttp2-1.65.0/contrib/CMakeLists.txt diff --git a/lib/nghttp2/contrib/Makefile.am b/lib/nghttp2-1.65.0/contrib/Makefile.am similarity index 100% rename from lib/nghttp2/contrib/Makefile.am rename to lib/nghttp2-1.65.0/contrib/Makefile.am diff --git a/lib/nghttp2-1.65.0/contrib/Makefile.in b/lib/nghttp2-1.65.0/contrib/Makefile.in new file mode 100644 index 00000000000..ee9868cc1bb --- /dev/null +++ b/lib/nghttp2-1.65.0/contrib/Makefile.in @@ -0,0 +1,568 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2014 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = contrib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +configfiles = nghttpx-init nghttpx.service nghttpx-upstart.conf +EXTRA_DIST = \ + CMakeLists.txt \ + $(configfiles:%=%.in) \ + nghttpx-logrotate \ + tlsticketupdate.go + +edit = sed -e 's|@bindir[@]|$(bindir)|g' +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu contrib/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am all-local check check-am clean clean-generic \ + clean-libtool clean-local cscopelist-am ctags-am distclean \ + distclean-generic distclean-libtool distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +nghttpx-init: $(srcdir)/nghttpx-init.in + rm -f $@ $@.tmp + $(edit) $< > $@.tmp + chmod +x $@.tmp + mv $@.tmp $@ + +nghttpx.service: $(srcdir)/nghttpx.service.in + $(edit) $< > $@ + +nghttpx-upstart.conf: $(srcdir)/nghttpx-upstart.conf.in + $(edit) $< > $@ + +$(configfiles): Makefile + +all-local: $(configfiles) + +clean-local: + -rm -f nghttpx-init.tmp $(configfiles) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/contrib/nghttpx-init.in b/lib/nghttp2-1.65.0/contrib/nghttpx-init.in similarity index 100% rename from lib/nghttp2/contrib/nghttpx-init.in rename to lib/nghttp2-1.65.0/contrib/nghttpx-init.in diff --git a/lib/nghttp2/contrib/nghttpx-logrotate b/lib/nghttp2-1.65.0/contrib/nghttpx-logrotate similarity index 100% rename from lib/nghttp2/contrib/nghttpx-logrotate rename to lib/nghttp2-1.65.0/contrib/nghttpx-logrotate diff --git a/lib/nghttp2/contrib/nghttpx-upstart.conf.in b/lib/nghttp2-1.65.0/contrib/nghttpx-upstart.conf.in similarity index 100% rename from lib/nghttp2/contrib/nghttpx-upstart.conf.in rename to lib/nghttp2-1.65.0/contrib/nghttpx-upstart.conf.in diff --git a/lib/nghttp2/contrib/nghttpx.service.in b/lib/nghttp2-1.65.0/contrib/nghttpx.service.in similarity index 100% rename from lib/nghttp2/contrib/nghttpx.service.in rename to lib/nghttp2-1.65.0/contrib/nghttpx.service.in diff --git a/lib/nghttp2/contrib/tlsticketupdate.go b/lib/nghttp2-1.65.0/contrib/tlsticketupdate.go similarity index 100% rename from lib/nghttp2/contrib/tlsticketupdate.go rename to lib/nghttp2-1.65.0/contrib/tlsticketupdate.go diff --git a/lib/nghttp2-1.65.0/depcomp b/lib/nghttp2-1.65.0/depcomp new file mode 100755 index 00000000000..715e34311ed --- /dev/null +++ b/lib/nghttp2-1.65.0/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/lib/nghttp2/doc/CMakeLists.txt b/lib/nghttp2-1.65.0/doc/CMakeLists.txt similarity index 100% rename from lib/nghttp2/doc/CMakeLists.txt rename to lib/nghttp2-1.65.0/doc/CMakeLists.txt diff --git a/lib/nghttp2/doc/Makefile.am b/lib/nghttp2-1.65.0/doc/Makefile.am similarity index 95% rename from lib/nghttp2/doc/Makefile.am rename to lib/nghttp2-1.65.0/doc/Makefile.am index 4e6f2779e25..50d57b22177 100644 --- a/lib/nghttp2/doc/Makefile.am +++ b/lib/nghttp2-1.65.0/doc/Makefile.am @@ -42,7 +42,9 @@ APIDOCS= \ nghttp2_hd_deflate_get_num_table_entries.rst \ nghttp2_hd_deflate_get_table_entry.rst \ nghttp2_hd_deflate_hd.rst \ + nghttp2_hd_deflate_hd2.rst \ nghttp2_hd_deflate_hd_vec.rst \ + nghttp2_hd_deflate_hd_vec2.rst \ nghttp2_hd_deflate_new.rst \ nghttp2_hd_deflate_new2.rst \ nghttp2_hd_inflate_change_table_size.rst \ @@ -54,6 +56,7 @@ APIDOCS= \ nghttp2_hd_inflate_get_table_entry.rst \ nghttp2_hd_inflate_hd.rst \ nghttp2_hd_inflate_hd2.rst \ + nghttp2_hd_inflate_hd3.rst \ nghttp2_hd_inflate_new.rst \ nghttp2_hd_inflate_new2.rst \ nghttp2_http2_strerror.rst \ @@ -74,10 +77,12 @@ APIDOCS= \ nghttp2_option_set_peer_max_concurrent_streams.rst \ nghttp2_option_set_server_fallback_rfc7540_priorities.rst \ nghttp2_option_set_user_recv_extension_type.rst \ + nghttp2_option_set_max_continuations.rst \ nghttp2_option_set_max_outbound_ack.rst \ nghttp2_option_set_max_settings.rst \ nghttp2_option_set_stream_reset_rate_limit.rst \ nghttp2_pack_settings_payload.rst \ + nghttp2_pack_settings_payload2.rst \ nghttp2_priority_spec_check_default.rst \ nghttp2_priority_spec_default_init.rst \ nghttp2_priority_spec_init.rst \ @@ -86,10 +91,12 @@ APIDOCS= \ nghttp2_rcbuf_incref.rst \ nghttp2_rcbuf_is_static.rst \ nghttp2_select_next_protocol.rst \ + nghttp2_select_alpn.rst \ nghttp2_session_callbacks_del.rst \ nghttp2_session_callbacks_new.rst \ nghttp2_session_callbacks_set_before_frame_send_callback.rst \ nghttp2_session_callbacks_set_data_source_read_length_callback.rst \ + nghttp2_session_callbacks_set_data_source_read_length_callback2.rst \ nghttp2_session_callbacks_set_error_callback.rst \ nghttp2_session_callbacks_set_error_callback2.rst \ nghttp2_session_callbacks_set_on_begin_frame_callback.rst \ @@ -106,9 +113,13 @@ APIDOCS= \ nghttp2_session_callbacks_set_on_invalid_header_callback2.rst \ nghttp2_session_callbacks_set_on_stream_close_callback.rst \ nghttp2_session_callbacks_set_pack_extension_callback.rst \ + nghttp2_session_callbacks_set_pack_extension_callback2.rst \ nghttp2_session_callbacks_set_recv_callback.rst \ + nghttp2_session_callbacks_set_recv_callback2.rst \ nghttp2_session_callbacks_set_select_padding_callback.rst \ + nghttp2_session_callbacks_set_select_padding_callback2.rst \ nghttp2_session_callbacks_set_send_callback.rst \ + nghttp2_session_callbacks_set_send_callback2.rst \ nghttp2_session_callbacks_set_send_data_callback.rst \ nghttp2_session_callbacks_set_unpack_extension_callback.rst \ nghttp2_session_change_extpri_stream_priority.rst \ @@ -145,7 +156,9 @@ APIDOCS= \ nghttp2_session_get_stream_remote_window_size.rst \ nghttp2_session_get_stream_user_data.rst \ nghttp2_session_mem_recv.rst \ + nghttp2_session_mem_recv2.rst \ nghttp2_session_mem_send.rst \ + nghttp2_session_mem_send2.rst \ nghttp2_session_recv.rst \ nghttp2_session_resume_data.rst \ nghttp2_session_send.rst \ @@ -173,6 +186,7 @@ APIDOCS= \ nghttp2_strerror.rst \ nghttp2_submit_altsvc.rst \ nghttp2_submit_data.rst \ + nghttp2_submit_data2.rst \ nghttp2_submit_extension.rst \ nghttp2_submit_goaway.rst \ nghttp2_submit_headers.rst \ @@ -182,7 +196,9 @@ APIDOCS= \ nghttp2_submit_priority_update.rst \ nghttp2_submit_push_promise.rst \ nghttp2_submit_request.rst \ + nghttp2_submit_request2.rst \ nghttp2_submit_response.rst \ + nghttp2_submit_response2.rst \ nghttp2_submit_rst_stream.rst \ nghttp2_submit_settings.rst \ nghttp2_submit_shutdown_notice.rst \ @@ -211,7 +227,6 @@ EXTRA_DIST = \ sources/h2load-howto.rst \ sources/building-android-binary.rst \ sources/contribute.rst \ - sources/security.rst \ _exts/rubydomain/LICENSE.rubydomain \ _exts/rubydomain/__init__.py \ _exts/rubydomain/rubydomain.py \ diff --git a/lib/nghttp2-1.65.0/doc/Makefile.in b/lib/nghttp2-1.65.0/doc/Makefile.in new file mode 100644 index 00000000000..4a18446fa76 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/Makefile.in @@ -0,0 +1,1012 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2012 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = doc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = conf.py index.rst package_README.rst \ + tutorial-client.rst tutorial-server.rst tutorial-hpack.rst \ + nghttpx-howto.rst h2load-howto.rst building-android-binary.rst \ + nghttp2.h.rst nghttp2ver.h.rst contribute.rst +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" +NROFF = nroff +MANS = $(man_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/building-android-binary.rst.in $(srcdir)/conf.py.in \ + $(srcdir)/contribute.rst.in $(srcdir)/h2load-howto.rst.in \ + $(srcdir)/index.rst.in $(srcdir)/nghttp2.h.rst.in \ + $(srcdir)/nghttp2ver.h.rst.in $(srcdir)/nghttpx-howto.rst.in \ + $(srcdir)/package_README.rst.in \ + $(srcdir)/tutorial-client.rst.in \ + $(srcdir)/tutorial-hpack.rst.in \ + $(srcdir)/tutorial-server.rst.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +man_MANS = nghttp.1 nghttpd.1 nghttpx.1 h2load.1 +APIDOCS = \ + macros.rst \ + enums.rst \ + types.rst \ + nghttp2_check_authority.rst \ + nghttp2_check_header_name.rst \ + nghttp2_check_header_value.rst \ + nghttp2_check_header_value_rfc9113.rst \ + nghttp2_check_method.rst \ + nghttp2_check_path.rst \ + nghttp2_extpri_parse_priority.rst \ + nghttp2_hd_deflate_bound.rst \ + nghttp2_hd_deflate_change_table_size.rst \ + nghttp2_hd_deflate_del.rst \ + nghttp2_hd_deflate_get_dynamic_table_size.rst \ + nghttp2_hd_deflate_get_max_dynamic_table_size.rst \ + nghttp2_hd_deflate_get_num_table_entries.rst \ + nghttp2_hd_deflate_get_table_entry.rst \ + nghttp2_hd_deflate_hd.rst \ + nghttp2_hd_deflate_hd2.rst \ + nghttp2_hd_deflate_hd_vec.rst \ + nghttp2_hd_deflate_hd_vec2.rst \ + nghttp2_hd_deflate_new.rst \ + nghttp2_hd_deflate_new2.rst \ + nghttp2_hd_inflate_change_table_size.rst \ + nghttp2_hd_inflate_del.rst \ + nghttp2_hd_inflate_end_headers.rst \ + nghttp2_hd_inflate_get_dynamic_table_size.rst \ + nghttp2_hd_inflate_get_max_dynamic_table_size.rst \ + nghttp2_hd_inflate_get_num_table_entries.rst \ + nghttp2_hd_inflate_get_table_entry.rst \ + nghttp2_hd_inflate_hd.rst \ + nghttp2_hd_inflate_hd2.rst \ + nghttp2_hd_inflate_hd3.rst \ + nghttp2_hd_inflate_new.rst \ + nghttp2_hd_inflate_new2.rst \ + nghttp2_http2_strerror.rst \ + nghttp2_is_fatal.rst \ + nghttp2_nv_compare_name.rst \ + nghttp2_option_del.rst \ + nghttp2_option_new.rst \ + nghttp2_option_set_builtin_recv_extension_type.rst \ + nghttp2_option_set_max_deflate_dynamic_table_size.rst \ + nghttp2_option_set_max_reserved_remote_streams.rst \ + nghttp2_option_set_max_send_header_block_length.rst \ + nghttp2_option_set_no_auto_ping_ack.rst \ + nghttp2_option_set_no_auto_window_update.rst \ + nghttp2_option_set_no_closed_streams.rst \ + nghttp2_option_set_no_http_messaging.rst \ + nghttp2_option_set_no_recv_client_magic.rst \ + nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation.rst \ + nghttp2_option_set_peer_max_concurrent_streams.rst \ + nghttp2_option_set_server_fallback_rfc7540_priorities.rst \ + nghttp2_option_set_user_recv_extension_type.rst \ + nghttp2_option_set_max_continuations.rst \ + nghttp2_option_set_max_outbound_ack.rst \ + nghttp2_option_set_max_settings.rst \ + nghttp2_option_set_stream_reset_rate_limit.rst \ + nghttp2_pack_settings_payload.rst \ + nghttp2_pack_settings_payload2.rst \ + nghttp2_priority_spec_check_default.rst \ + nghttp2_priority_spec_default_init.rst \ + nghttp2_priority_spec_init.rst \ + nghttp2_rcbuf_decref.rst \ + nghttp2_rcbuf_get_buf.rst \ + nghttp2_rcbuf_incref.rst \ + nghttp2_rcbuf_is_static.rst \ + nghttp2_select_next_protocol.rst \ + nghttp2_select_alpn.rst \ + nghttp2_session_callbacks_del.rst \ + nghttp2_session_callbacks_new.rst \ + nghttp2_session_callbacks_set_before_frame_send_callback.rst \ + nghttp2_session_callbacks_set_data_source_read_length_callback.rst \ + nghttp2_session_callbacks_set_data_source_read_length_callback2.rst \ + nghttp2_session_callbacks_set_error_callback.rst \ + nghttp2_session_callbacks_set_error_callback2.rst \ + nghttp2_session_callbacks_set_on_begin_frame_callback.rst \ + nghttp2_session_callbacks_set_on_begin_headers_callback.rst \ + nghttp2_session_callbacks_set_on_data_chunk_recv_callback.rst \ + nghttp2_session_callbacks_set_on_extension_chunk_recv_callback.rst \ + nghttp2_session_callbacks_set_on_frame_not_send_callback.rst \ + nghttp2_session_callbacks_set_on_frame_recv_callback.rst \ + nghttp2_session_callbacks_set_on_frame_send_callback.rst \ + nghttp2_session_callbacks_set_on_header_callback.rst \ + nghttp2_session_callbacks_set_on_header_callback2.rst \ + nghttp2_session_callbacks_set_on_invalid_frame_recv_callback.rst \ + nghttp2_session_callbacks_set_on_invalid_header_callback.rst \ + nghttp2_session_callbacks_set_on_invalid_header_callback2.rst \ + nghttp2_session_callbacks_set_on_stream_close_callback.rst \ + nghttp2_session_callbacks_set_pack_extension_callback.rst \ + nghttp2_session_callbacks_set_pack_extension_callback2.rst \ + nghttp2_session_callbacks_set_recv_callback.rst \ + nghttp2_session_callbacks_set_recv_callback2.rst \ + nghttp2_session_callbacks_set_select_padding_callback.rst \ + nghttp2_session_callbacks_set_select_padding_callback2.rst \ + nghttp2_session_callbacks_set_send_callback.rst \ + nghttp2_session_callbacks_set_send_callback2.rst \ + nghttp2_session_callbacks_set_send_data_callback.rst \ + nghttp2_session_callbacks_set_unpack_extension_callback.rst \ + nghttp2_session_change_extpri_stream_priority.rst \ + nghttp2_session_change_stream_priority.rst \ + nghttp2_session_check_request_allowed.rst \ + nghttp2_session_check_server_session.rst \ + nghttp2_session_client_new.rst \ + nghttp2_session_client_new2.rst \ + nghttp2_session_client_new3.rst \ + nghttp2_session_consume.rst \ + nghttp2_session_consume_connection.rst \ + nghttp2_session_consume_stream.rst \ + nghttp2_session_create_idle_stream.rst \ + nghttp2_session_del.rst \ + nghttp2_session_find_stream.rst \ + nghttp2_session_get_effective_local_window_size.rst \ + nghttp2_session_get_effective_recv_data_length.rst \ + nghttp2_session_get_extpri_stream_priority.rst \ + nghttp2_session_get_hd_deflate_dynamic_table_size.rst \ + nghttp2_session_get_hd_inflate_dynamic_table_size.rst \ + nghttp2_session_get_last_proc_stream_id.rst \ + nghttp2_session_get_local_settings.rst \ + nghttp2_session_get_local_window_size.rst \ + nghttp2_session_get_next_stream_id.rst \ + nghttp2_session_get_outbound_queue_size.rst \ + nghttp2_session_get_remote_settings.rst \ + nghttp2_session_get_remote_window_size.rst \ + nghttp2_session_get_root_stream.rst \ + nghttp2_session_get_stream_effective_local_window_size.rst \ + nghttp2_session_get_stream_effective_recv_data_length.rst \ + nghttp2_session_get_stream_local_close.rst \ + nghttp2_session_get_stream_local_window_size.rst \ + nghttp2_session_get_stream_remote_close.rst \ + nghttp2_session_get_stream_remote_window_size.rst \ + nghttp2_session_get_stream_user_data.rst \ + nghttp2_session_mem_recv.rst \ + nghttp2_session_mem_recv2.rst \ + nghttp2_session_mem_send.rst \ + nghttp2_session_mem_send2.rst \ + nghttp2_session_recv.rst \ + nghttp2_session_resume_data.rst \ + nghttp2_session_send.rst \ + nghttp2_session_server_new.rst \ + nghttp2_session_server_new2.rst \ + nghttp2_session_server_new3.rst \ + nghttp2_session_set_local_window_size.rst \ + nghttp2_session_set_next_stream_id.rst \ + nghttp2_session_set_stream_user_data.rst \ + nghttp2_session_set_user_data.rst \ + nghttp2_session_terminate_session.rst \ + nghttp2_session_terminate_session2.rst \ + nghttp2_session_upgrade.rst \ + nghttp2_session_upgrade2.rst \ + nghttp2_session_want_read.rst \ + nghttp2_session_want_write.rst \ + nghttp2_set_debug_vprintf_callback.rst \ + nghttp2_stream_get_first_child.rst \ + nghttp2_stream_get_next_sibling.rst \ + nghttp2_stream_get_parent.rst \ + nghttp2_stream_get_previous_sibling.rst \ + nghttp2_stream_get_state.rst \ + nghttp2_stream_get_sum_dependency_weight.rst \ + nghttp2_stream_get_weight.rst \ + nghttp2_strerror.rst \ + nghttp2_submit_altsvc.rst \ + nghttp2_submit_data.rst \ + nghttp2_submit_data2.rst \ + nghttp2_submit_extension.rst \ + nghttp2_submit_goaway.rst \ + nghttp2_submit_headers.rst \ + nghttp2_submit_origin.rst \ + nghttp2_submit_ping.rst \ + nghttp2_submit_priority.rst \ + nghttp2_submit_priority_update.rst \ + nghttp2_submit_push_promise.rst \ + nghttp2_submit_request.rst \ + nghttp2_submit_request2.rst \ + nghttp2_submit_response.rst \ + nghttp2_submit_response2.rst \ + nghttp2_submit_rst_stream.rst \ + nghttp2_submit_settings.rst \ + nghttp2_submit_shutdown_notice.rst \ + nghttp2_submit_trailer.rst \ + nghttp2_submit_window_update.rst \ + nghttp2_version.rst + +RST_FILES = \ + README.rst \ + programmers-guide.rst \ + nghttp.1.rst \ + nghttpd.1.rst \ + nghttpx.1.rst \ + h2load.1.rst + +EXTRA_DIST = \ + CMakeLists.txt \ + mkapiref.py \ + $(RST_FILES) \ + $(APIDOCS) \ + sources/index.rst \ + sources/tutorial-client.rst \ + sources/tutorial-server.rst \ + sources/tutorial-hpack.rst \ + sources/nghttpx-howto.rst \ + sources/h2load-howto.rst \ + sources/building-android-binary.rst \ + sources/contribute.rst \ + _exts/rubydomain/LICENSE.rubydomain \ + _exts/rubydomain/__init__.py \ + _exts/rubydomain/rubydomain.py \ + $(man_MANS) \ + bash_completion/nghttp \ + bash_completion/nghttpd \ + bash_completion/nghttpx \ + bash_completion/h2load + + +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +PAPER = +BUILDDIR = manual + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +conf.py: $(top_builddir)/config.status $(srcdir)/conf.py.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +index.rst: $(top_builddir)/config.status $(srcdir)/index.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +package_README.rst: $(top_builddir)/config.status $(srcdir)/package_README.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +tutorial-client.rst: $(top_builddir)/config.status $(srcdir)/tutorial-client.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +tutorial-server.rst: $(top_builddir)/config.status $(srcdir)/tutorial-server.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +tutorial-hpack.rst: $(top_builddir)/config.status $(srcdir)/tutorial-hpack.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +nghttpx-howto.rst: $(top_builddir)/config.status $(srcdir)/nghttpx-howto.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +h2load-howto.rst: $(top_builddir)/config.status $(srcdir)/h2load-howto.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +building-android-binary.rst: $(top_builddir)/config.status $(srcdir)/building-android-binary.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +nghttp2.h.rst: $(top_builddir)/config.status $(srcdir)/nghttp2.h.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +nghttp2ver.h.rst: $(top_builddir)/config.status $(srcdir)/nghttp2ver.h.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +contribute.rst: $(top_builddir)/config.status $(srcdir)/contribute.rst.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) +installdirs: + for dir in "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: html-local + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am html-local \ + info info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags-am uninstall uninstall-am uninstall-man \ + uninstall-man1 + +.PRECIOUS: Makefile + +SPHINXBUILD ?= sphinx-build + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +apiref.rst: \ + $(top_builddir)/lib/includes/nghttp2/nghttp2ver.h \ + $(top_srcdir)/lib/includes/nghttp2/nghttp2.h + for i in $(RST_FILES); do [ -e $(builddir)/$$i ] || cp $(srcdir)/$$i $(builddir); done + $(PYTHON) $(top_srcdir)/doc/mkapiref.py \ + apiref.rst macros.rst enums.rst types.rst . $^ + +$(APIDOCS): apiref.rst + +clean-local: + if [ $(srcdir) != $(builddir) ]; then for i in $(RST_FILES); do rm -f $(builddir)/$$i; done fi + -rm -f apiref.rst + -rm -f $(APIDOCS) + -rm -rf $(BUILDDIR)/* + +html-local: apiref.rst + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/nghttp2.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/nghttp2.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/nghttp2" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/nghttp2" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: apiref.rst + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/doc/README.rst b/lib/nghttp2-1.65.0/doc/README.rst similarity index 98% rename from lib/nghttp2/doc/README.rst rename to lib/nghttp2-1.65.0/doc/README.rst index 549e5506ac4..7d4809cdf58 100644 --- a/lib/nghttp2/doc/README.rst +++ b/lib/nghttp2-1.65.0/doc/README.rst @@ -68,7 +68,7 @@ The example follows:: * Callback function invoked when |session| wants to send data to * remote peer. */ - typedef ssize_t (*nghttp2_send_callback) + typedef nghttp2_ssize (*nghttp2_send_callback2) (nghttp2_session *session, const uint8_t *data, size_t length, int flags, void *user_data); diff --git a/lib/nghttp2/doc/_exts/rubydomain/LICENSE.rubydomain b/lib/nghttp2-1.65.0/doc/_exts/rubydomain/LICENSE.rubydomain similarity index 100% rename from lib/nghttp2/doc/_exts/rubydomain/LICENSE.rubydomain rename to lib/nghttp2-1.65.0/doc/_exts/rubydomain/LICENSE.rubydomain diff --git a/lib/nghttp2/doc/_exts/rubydomain/__init__.py b/lib/nghttp2-1.65.0/doc/_exts/rubydomain/__init__.py similarity index 100% rename from lib/nghttp2/doc/_exts/rubydomain/__init__.py rename to lib/nghttp2-1.65.0/doc/_exts/rubydomain/__init__.py diff --git a/lib/nghttp2/doc/_exts/rubydomain/rubydomain.py b/lib/nghttp2-1.65.0/doc/_exts/rubydomain/rubydomain.py similarity index 100% rename from lib/nghttp2/doc/_exts/rubydomain/rubydomain.py rename to lib/nghttp2-1.65.0/doc/_exts/rubydomain/rubydomain.py diff --git a/lib/nghttp2/doc/bash_completion/h2load b/lib/nghttp2-1.65.0/doc/bash_completion/h2load similarity index 71% rename from lib/nghttp2/doc/bash_completion/h2load rename to lib/nghttp2-1.65.0/doc/bash_completion/h2load index 80afe391882..e07d75327eb 100644 --- a/lib/nghttp2/doc/bash_completion/h2load +++ b/lib/nghttp2-1.65.0/doc/bash_completion/h2load @@ -8,7 +8,7 @@ _h2load() _get_comp_words_by_ref cur prev case $cur in -*) - COMPREPLY=( $( compgen -W '--requests --clients --threads --input-file --max-concurrent-streams --max-frame-size --window-bits --connection-window-bits --header --ciphers --tls13-ciphers --no-tls-proto --data --rate --rate-period --duration --warm-up-time --connection-active-timeout --connection-inactivity-timeout --timing-script-file --base-uri --npn-list --h1 --header-table-size --encoder-header-table-size --log-file --qlog-file-base --connect-to --rps --groups --no-udp-gso --max-udp-payload-size --ktls --verbose --version --help ' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '--requests --clients --threads --input-file --max-concurrent-streams --max-frame-size --window-bits --connection-window-bits --header --ciphers --tls13-ciphers --no-tls-proto --data --rate --rate-period --duration --warm-up-time --connection-active-timeout --connection-inactivity-timeout --timing-script-file --base-uri --alpn-list --h1 --header-table-size --encoder-header-table-size --log-file --qlog-file-base --connect-to --rps --groups --no-udp-gso --max-udp-payload-size --ktls --sni --verbose --version --help ' -- "$cur" ) ) ;; *) _filedir diff --git a/lib/nghttp2/doc/bash_completion/nghttp b/lib/nghttp2-1.65.0/doc/bash_completion/nghttp similarity index 70% rename from lib/nghttp2/doc/bash_completion/nghttp rename to lib/nghttp2-1.65.0/doc/bash_completion/nghttp index dd48403972f..fc6e01334fd 100644 --- a/lib/nghttp2/doc/bash_completion/nghttp +++ b/lib/nghttp2-1.65.0/doc/bash_completion/nghttp @@ -8,7 +8,7 @@ _nghttp() _get_comp_words_by_ref cur prev case $cur in -*) - COMPREPLY=( $( compgen -W '--verbose --null-out --remote-name --timeout --window-bits --connection-window-bits --get-assets --stat --header --trailer --cert --key --data --multiply --upgrade --weight --peer-max-concurrent-streams --header-table-size --encoder-header-table-size --padding --har --color --continuation --no-content-length --no-dep --hexdump --no-push --max-concurrent-streams --expect-continue --no-verify-peer --ktls --no-rfc7540-pri --version --help ' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '--verbose --null-out --remote-name --timeout --window-bits --connection-window-bits --get-assets --stat --header --trailer --cert --key --data --multiply --upgrade --extpri --peer-max-concurrent-streams --header-table-size --encoder-header-table-size --padding --har --color --continuation --no-content-length --hexdump --no-push --max-concurrent-streams --expect-continue --no-verify-peer --ktls --version --help ' -- "$cur" ) ) ;; *) _filedir diff --git a/lib/nghttp2/doc/bash_completion/nghttpd b/lib/nghttp2-1.65.0/doc/bash_completion/nghttpd similarity index 85% rename from lib/nghttp2/doc/bash_completion/nghttpd rename to lib/nghttp2-1.65.0/doc/bash_completion/nghttpd index 7dd4d9b7973..4f508efc3d6 100644 --- a/lib/nghttp2/doc/bash_completion/nghttpd +++ b/lib/nghttp2-1.65.0/doc/bash_completion/nghttpd @@ -8,7 +8,7 @@ _nghttpd() _get_comp_words_by_ref cur prev case $cur in -*) - COMPREPLY=( $( compgen -W '--address --daemon --verify-client --htdocs --verbose --no-tls --header-table-size --encoder-header-table-size --color --push --padding --max-concurrent-streams --workers --error-gzip --window-bits --connection-window-bits --dh-param-file --early-response --trailer --hexdump --echo-upload --mime-types-file --no-content-length --ktls --no-rfc7540-pri --version --help ' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '--address --daemon --verify-client --htdocs --verbose --no-tls --header-table-size --encoder-header-table-size --color --push --padding --max-concurrent-streams --workers --error-gzip --window-bits --connection-window-bits --dh-param-file --early-response --trailer --hexdump --echo-upload --mime-types-file --no-content-length --ktls --version --help ' -- "$cur" ) ) ;; *) _filedir diff --git a/lib/nghttp2-1.65.0/doc/bash_completion/nghttpx b/lib/nghttp2-1.65.0/doc/bash_completion/nghttpx new file mode 100644 index 00000000000..782309cec8a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/bash_completion/nghttpx @@ -0,0 +1,19 @@ +_nghttpx() +{ + local cur prev split=false + COMPREPLY=() + COMP_WORDBREAKS=${COMP_WORDBREAKS//=} + + cmd=${COMP_WORDS[0]} + _get_comp_words_by_ref cur prev + case $cur in + -*) + COMPREPLY=( $( compgen -W '--backend --frontend --backlog --backend-address-family --backend-http-proxy-uri --workers --single-thread --read-rate --read-burst --write-rate --write-burst --worker-read-rate --worker-read-burst --worker-write-rate --worker-write-burst --worker-frontend-connections --backend-connections-per-host --backend-connections-per-frontend --rlimit-nofile --rlimit-memlock --backend-request-buffer --backend-response-buffer --fastopen --no-kqueue --frontend-http2-idle-timeout --frontend-http3-idle-timeout --frontend-write-timeout --frontend-keep-alive-timeout --frontend-header-timeout --stream-read-timeout --stream-write-timeout --backend-read-timeout --backend-write-timeout --backend-connect-timeout --backend-keep-alive-timeout --listener-disable-timeout --frontend-http2-setting-timeout --backend-http2-settings-timeout --backend-max-backoff --ciphers --tls13-ciphers --client-ciphers --tls13-client-ciphers --ecdh-curves --insecure --cacert --private-key-passwd-file --subcert --dh-param-file --alpn-list --verify-client --verify-client-cacert --verify-client-tolerate-expired --client-private-key-file --client-cert-file --tls-min-proto-version --tls-max-proto-version --tls-ticket-key-file --tls-ticket-key-memcached --tls-ticket-key-memcached-address-family --tls-ticket-key-memcached-interval --tls-ticket-key-memcached-max-retry --tls-ticket-key-memcached-max-fail --tls-ticket-key-cipher --tls-ticket-key-memcached-cert-file --tls-ticket-key-memcached-private-key-file --fetch-ocsp-response-file --ocsp-update-interval --ocsp-startup --no-verify-ocsp --no-ocsp --tls-session-cache-memcached --tls-session-cache-memcached-address-family --tls-session-cache-memcached-cert-file --tls-session-cache-memcached-private-key-file --tls-dyn-rec-warmup-threshold --tls-dyn-rec-idle-timeout --no-http2-cipher-block-list --client-no-http2-cipher-block-list --tls-sct-dir --psk-secrets --client-psk-secrets --tls-no-postpone-early-data --tls-max-early-data --tls-ktls --frontend-http2-max-concurrent-streams --backend-http2-max-concurrent-streams --frontend-http2-window-size --frontend-http2-connection-window-size --backend-http2-window-size --backend-http2-connection-window-size --http2-no-cookie-crumbling --padding --no-server-push --frontend-http2-optimize-write-buffer-size --frontend-http2-optimize-window-size --frontend-http2-encoder-dynamic-table-size --frontend-http2-decoder-dynamic-table-size --backend-http2-encoder-dynamic-table-size --backend-http2-decoder-dynamic-table-size --http2-proxy --log-level --accesslog-file --accesslog-syslog --accesslog-format --accesslog-write-early --errorlog-file --errorlog-syslog --syslog-facility --add-x-forwarded-for --strip-incoming-x-forwarded-for --no-add-x-forwarded-proto --no-strip-incoming-x-forwarded-proto --add-forwarded --strip-incoming-forwarded --forwarded-by --forwarded-for --no-via --no-strip-incoming-early-data --no-location-rewrite --host-rewrite --altsvc --http2-altsvc --add-request-header --add-response-header --request-header-field-buffer --max-request-header-fields --response-header-field-buffer --max-response-header-fields --error-page --server-name --no-server-rewrite --redirect-https-port --require-http-scheme --api-max-request-body --dns-cache-timeout --dns-lookup-timeout --dns-max-try --frontend-max-requests --frontend-http2-dump-request-header --frontend-http2-dump-response-header --frontend-frame-debug --daemon --pid-file --user --single-process --max-worker-processes --worker-process-grace-shutdown-period --mruby-file --ignore-per-pattern-mruby-error --frontend-quic-idle-timeout --frontend-quic-debug-log --quic-bpf-program-file --frontend-quic-early-data --frontend-quic-qlog-dir --frontend-quic-require-token --frontend-quic-congestion-controller --frontend-quic-secret-file --quic-server-id --frontend-quic-initial-rtt --no-quic-bpf --frontend-http3-window-size --frontend-http3-connection-window-size --frontend-http3-max-window-size --frontend-http3-max-connection-window-size --frontend-http3-max-concurrent-streams --conf --include --version --help ' -- "$cur" ) ) + ;; + *) + _filedir + return 0 + esac + return 0 +} +complete -F _nghttpx nghttpx diff --git a/lib/nghttp2/doc/building-android-binary.rst.in b/lib/nghttp2-1.65.0/doc/building-android-binary.rst.in similarity index 100% rename from lib/nghttp2/doc/building-android-binary.rst.in rename to lib/nghttp2-1.65.0/doc/building-android-binary.rst.in diff --git a/lib/nghttp2/doc/conf.py.in b/lib/nghttp2-1.65.0/doc/conf.py.in similarity index 100% rename from lib/nghttp2/doc/conf.py.in rename to lib/nghttp2-1.65.0/doc/conf.py.in diff --git a/lib/nghttp2/doc/contribute.rst.in b/lib/nghttp2-1.65.0/doc/contribute.rst.in similarity index 100% rename from lib/nghttp2/doc/contribute.rst.in rename to lib/nghttp2-1.65.0/doc/contribute.rst.in diff --git a/lib/nghttp2-1.65.0/doc/enums.rst b/lib/nghttp2-1.65.0/doc/enums.rst new file mode 100644 index 00000000000..2689885133b --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/enums.rst @@ -0,0 +1,539 @@ + +Enums +===== +.. type:: nghttp2_error + + + Error codes used in this library. The code range is [-999, -500], + inclusive. The following values are defined: + + .. enum:: NGHTTP2_ERR_INVALID_ARGUMENT + + (``-501``) + Invalid argument passed. + .. enum:: NGHTTP2_ERR_BUFFER_ERROR + + (``-502``) + Out of buffer space. + .. enum:: NGHTTP2_ERR_UNSUPPORTED_VERSION + + (``-503``) + The specified protocol version is not supported. + .. enum:: NGHTTP2_ERR_WOULDBLOCK + + (``-504``) + Used as a return value from :type:`nghttp2_send_callback2`, + :type:`nghttp2_recv_callback` and + :type:`nghttp2_send_data_callback` to indicate that the operation + would block. + .. enum:: NGHTTP2_ERR_PROTO + + (``-505``) + General protocol error + .. enum:: NGHTTP2_ERR_INVALID_FRAME + + (``-506``) + The frame is invalid. + .. enum:: NGHTTP2_ERR_EOF + + (``-507``) + The peer performed a shutdown on the connection. + .. enum:: NGHTTP2_ERR_DEFERRED + + (``-508``) + Used as a return value from + :func:`nghttp2_data_source_read_callback2` to indicate that data + transfer is postponed. See + :func:`nghttp2_data_source_read_callback2` for details. + .. enum:: NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE + + (``-509``) + Stream ID has reached the maximum value. Therefore no stream ID + is available. + .. enum:: NGHTTP2_ERR_STREAM_CLOSED + + (``-510``) + The stream is already closed; or the stream ID is invalid. + .. enum:: NGHTTP2_ERR_STREAM_CLOSING + + (``-511``) + RST_STREAM has been added to the outbound queue. The stream is + in closing state. + .. enum:: NGHTTP2_ERR_STREAM_SHUT_WR + + (``-512``) + The transmission is not allowed for this stream (e.g., a frame + with END_STREAM flag set has already sent). + .. enum:: NGHTTP2_ERR_INVALID_STREAM_ID + + (``-513``) + The stream ID is invalid. + .. enum:: NGHTTP2_ERR_INVALID_STREAM_STATE + + (``-514``) + The state of the stream is not valid (e.g., DATA cannot be sent + to the stream if response HEADERS has not been sent). + .. enum:: NGHTTP2_ERR_DEFERRED_DATA_EXIST + + (``-515``) + Another DATA frame has already been deferred. + .. enum:: NGHTTP2_ERR_START_STREAM_NOT_ALLOWED + + (``-516``) + Starting new stream is not allowed (e.g., GOAWAY has been sent + and/or received). + .. enum:: NGHTTP2_ERR_GOAWAY_ALREADY_SENT + + (``-517``) + GOAWAY has already been sent. + .. enum:: NGHTTP2_ERR_INVALID_HEADER_BLOCK + + (``-518``) + The received frame contains the invalid header block (e.g., There + are duplicate header names; or the header names are not encoded + in US-ASCII character set and not lower cased; or the header name + is zero-length string; or the header value contains multiple + in-sequence NUL bytes). + .. enum:: NGHTTP2_ERR_INVALID_STATE + + (``-519``) + Indicates that the context is not suitable to perform the + requested operation. + .. enum:: NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE + + (``-521``) + The user callback function failed due to the temporal error. + .. enum:: NGHTTP2_ERR_FRAME_SIZE_ERROR + + (``-522``) + The length of the frame is invalid, either too large or too small. + .. enum:: NGHTTP2_ERR_HEADER_COMP + + (``-523``) + Header block inflate/deflate error. + .. enum:: NGHTTP2_ERR_FLOW_CONTROL + + (``-524``) + Flow control error + .. enum:: NGHTTP2_ERR_INSUFF_BUFSIZE + + (``-525``) + Insufficient buffer size given to function. + .. enum:: NGHTTP2_ERR_PAUSE + + (``-526``) + Callback was paused by the application + .. enum:: NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS + + (``-527``) + There are too many in-flight SETTING frame and no more + transmission of SETTINGS is allowed. + .. enum:: NGHTTP2_ERR_PUSH_DISABLED + + (``-528``) + The server push is disabled. + .. enum:: NGHTTP2_ERR_DATA_EXIST + + (``-529``) + DATA or HEADERS frame for a given stream has been already + submitted and has not been fully processed yet. Application + should wait for the transmission of the previously submitted + frame before submitting another. + .. enum:: NGHTTP2_ERR_SESSION_CLOSING + + (``-530``) + The current session is closing due to a connection error or + `nghttp2_session_terminate_session()` is called. + .. enum:: NGHTTP2_ERR_HTTP_HEADER + + (``-531``) + Invalid HTTP header field was received and stream is going to be + closed. + .. enum:: NGHTTP2_ERR_HTTP_MESSAGING + + (``-532``) + Violation in HTTP messaging rule. + .. enum:: NGHTTP2_ERR_REFUSED_STREAM + + (``-533``) + Stream was refused. + .. enum:: NGHTTP2_ERR_INTERNAL + + (``-534``) + Unexpected internal error, but recovered. + .. enum:: NGHTTP2_ERR_CANCEL + + (``-535``) + Indicates that a processing was canceled. + .. enum:: NGHTTP2_ERR_SETTINGS_EXPECTED + + (``-536``) + When a local endpoint expects to receive SETTINGS frame, it + receives an other type of frame. + .. enum:: NGHTTP2_ERR_TOO_MANY_SETTINGS + + (``-537``) + When a local endpoint receives too many settings entries + in a single SETTINGS frame. + .. enum:: NGHTTP2_ERR_FATAL + + (``-900``) + The errors < :enum:`nghttp2_error.NGHTTP2_ERR_FATAL` mean that + the library is under unexpected condition and processing was + terminated (e.g., out of memory). If application receives this + error code, it must stop using that :type:`nghttp2_session` + object and only allowed operation for that object is deallocate + it using `nghttp2_session_del()`. + .. enum:: NGHTTP2_ERR_NOMEM + + (``-901``) + Out of memory. This is a fatal error. + .. enum:: NGHTTP2_ERR_CALLBACK_FAILURE + + (``-902``) + The user callback function failed. This is a fatal error. + .. enum:: NGHTTP2_ERR_BAD_CLIENT_MAGIC + + (``-903``) + Invalid client magic (see :macro:`NGHTTP2_CLIENT_MAGIC`) was + received and further processing is not possible. + .. enum:: NGHTTP2_ERR_FLOODED + + (``-904``) + Possible flooding by peer was detected in this HTTP/2 session. + Flooding is measured by how many PING and SETTINGS frames with + ACK flag set are queued for transmission. These frames are + response for the peer initiated frames, and peer can cause memory + exhaustion on server side to send these frames forever and does + not read network. + .. enum:: NGHTTP2_ERR_TOO_MANY_CONTINUATIONS + + (``-905``) + When a local endpoint receives too many CONTINUATION frames + following a HEADER frame. + +.. type:: nghttp2_nv_flag + + + The flags for header field name/value pair. + + .. enum:: NGHTTP2_NV_FLAG_NONE + + (``0``) + No flag set. + .. enum:: NGHTTP2_NV_FLAG_NO_INDEX + + (``0x01``) + Indicates that this name/value pair must not be indexed ("Literal + Header Field never Indexed" representation must be used in HPACK + encoding). Other implementation calls this bit as "sensitive". + .. enum:: NGHTTP2_NV_FLAG_NO_COPY_NAME + + (``0x02``) + This flag is set solely by application. If this flag is set, the + library does not make a copy of header field name. This could + improve performance. + .. enum:: NGHTTP2_NV_FLAG_NO_COPY_VALUE + + (``0x04``) + This flag is set solely by application. If this flag is set, the + library does not make a copy of header field value. This could + improve performance. + +.. type:: nghttp2_frame_type + + + The frame types in HTTP/2 specification. + + .. enum:: NGHTTP2_DATA + + (``0``) + The DATA frame. + .. enum:: NGHTTP2_HEADERS + + (``0x01``) + The HEADERS frame. + .. enum:: NGHTTP2_PRIORITY + + (``0x02``) + The PRIORITY frame. + .. enum:: NGHTTP2_RST_STREAM + + (``0x03``) + The RST_STREAM frame. + .. enum:: NGHTTP2_SETTINGS + + (``0x04``) + The SETTINGS frame. + .. enum:: NGHTTP2_PUSH_PROMISE + + (``0x05``) + The PUSH_PROMISE frame. + .. enum:: NGHTTP2_PING + + (``0x06``) + The PING frame. + .. enum:: NGHTTP2_GOAWAY + + (``0x07``) + The GOAWAY frame. + .. enum:: NGHTTP2_WINDOW_UPDATE + + (``0x08``) + The WINDOW_UPDATE frame. + .. enum:: NGHTTP2_CONTINUATION + + (``0x09``) + The CONTINUATION frame. This frame type won't be passed to any + callbacks because the library processes this frame type and its + preceding HEADERS/PUSH_PROMISE as a single frame. + .. enum:: NGHTTP2_ALTSVC + + (``0x0a``) + The ALTSVC frame, which is defined in `RFC 7383 + `_. + .. enum:: NGHTTP2_ORIGIN + + (``0x0c``) + The ORIGIN frame, which is defined by `RFC 8336 + `_. + .. enum:: NGHTTP2_PRIORITY_UPDATE + + (``0x10``) + The PRIORITY_UPDATE frame, which is defined by :rfc:`9218`. + +.. type:: nghttp2_flag + + + The flags for HTTP/2 frames. This enum defines all flags for all + frames. + + .. enum:: NGHTTP2_FLAG_NONE + + (``0``) + No flag set. + .. enum:: NGHTTP2_FLAG_END_STREAM + + (``0x01``) + The END_STREAM flag. + .. enum:: NGHTTP2_FLAG_END_HEADERS + + (``0x04``) + The END_HEADERS flag. + .. enum:: NGHTTP2_FLAG_ACK + + (``0x01``) + The ACK flag. + .. enum:: NGHTTP2_FLAG_PADDED + + (``0x08``) + The PADDED flag. + .. enum:: NGHTTP2_FLAG_PRIORITY + + (``0x20``) + The PRIORITY flag. + +.. type:: nghttp2_settings_id + + The SETTINGS ID. + + .. enum:: NGHTTP2_SETTINGS_HEADER_TABLE_SIZE + + (``0x01``) + SETTINGS_HEADER_TABLE_SIZE + .. enum:: NGHTTP2_SETTINGS_ENABLE_PUSH + + (``0x02``) + SETTINGS_ENABLE_PUSH + .. enum:: NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS + + (``0x03``) + SETTINGS_MAX_CONCURRENT_STREAMS + .. enum:: NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE + + (``0x04``) + SETTINGS_INITIAL_WINDOW_SIZE + .. enum:: NGHTTP2_SETTINGS_MAX_FRAME_SIZE + + (``0x05``) + SETTINGS_MAX_FRAME_SIZE + .. enum:: NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE + + (``0x06``) + SETTINGS_MAX_HEADER_LIST_SIZE + .. enum:: NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL + + (``0x08``) + SETTINGS_ENABLE_CONNECT_PROTOCOL + (`RFC 8441 `_) + .. enum:: NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES + + (``0x09``) + SETTINGS_NO_RFC7540_PRIORITIES (:rfc:`9218`) + +.. type:: nghttp2_error_code + + The status codes for the RST_STREAM and GOAWAY frames. + + .. enum:: NGHTTP2_NO_ERROR + + (``0x00``) + No errors. + .. enum:: NGHTTP2_PROTOCOL_ERROR + + (``0x01``) + PROTOCOL_ERROR + .. enum:: NGHTTP2_INTERNAL_ERROR + + (``0x02``) + INTERNAL_ERROR + .. enum:: NGHTTP2_FLOW_CONTROL_ERROR + + (``0x03``) + FLOW_CONTROL_ERROR + .. enum:: NGHTTP2_SETTINGS_TIMEOUT + + (``0x04``) + SETTINGS_TIMEOUT + .. enum:: NGHTTP2_STREAM_CLOSED + + (``0x05``) + STREAM_CLOSED + .. enum:: NGHTTP2_FRAME_SIZE_ERROR + + (``0x06``) + FRAME_SIZE_ERROR + .. enum:: NGHTTP2_REFUSED_STREAM + + (``0x07``) + REFUSED_STREAM + .. enum:: NGHTTP2_CANCEL + + (``0x08``) + CANCEL + .. enum:: NGHTTP2_COMPRESSION_ERROR + + (``0x09``) + COMPRESSION_ERROR + .. enum:: NGHTTP2_CONNECT_ERROR + + (``0x0a``) + CONNECT_ERROR + .. enum:: NGHTTP2_ENHANCE_YOUR_CALM + + (``0x0b``) + ENHANCE_YOUR_CALM + .. enum:: NGHTTP2_INADEQUATE_SECURITY + + (``0x0c``) + INADEQUATE_SECURITY + .. enum:: NGHTTP2_HTTP_1_1_REQUIRED + + (``0x0d``) + HTTP_1_1_REQUIRED + +.. type:: nghttp2_data_flag + + + The flags used to set in *data_flags* output parameter in + :type:`nghttp2_data_source_read_callback2`. + + .. enum:: NGHTTP2_DATA_FLAG_NONE + + (``0``) + No flag set. + .. enum:: NGHTTP2_DATA_FLAG_EOF + + (``0x01``) + Indicates EOF was sensed. + .. enum:: NGHTTP2_DATA_FLAG_NO_END_STREAM + + (``0x02``) + Indicates that END_STREAM flag must not be set even if + NGHTTP2_DATA_FLAG_EOF is set. Usually this flag is used to send + trailer fields with `nghttp2_submit_request2()` or + `nghttp2_submit_response2()`. + .. enum:: NGHTTP2_DATA_FLAG_NO_COPY + + (``0x04``) + Indicates that application will send complete DATA frame in + :type:`nghttp2_send_data_callback`. + +.. type:: nghttp2_headers_category + + + The category of HEADERS, which indicates the role of the frame. In + HTTP/2 spec, request, response, push response and other arbitrary + headers (e.g., trailer fields) are all called just HEADERS. To + give the application the role of incoming HEADERS frame, we define + several categories. + + .. enum:: NGHTTP2_HCAT_REQUEST + + (``0``) + The HEADERS frame is opening new stream, which is analogous to + SYN_STREAM in SPDY. + .. enum:: NGHTTP2_HCAT_RESPONSE + + (``1``) + The HEADERS frame is the first response headers, which is + analogous to SYN_REPLY in SPDY. + .. enum:: NGHTTP2_HCAT_PUSH_RESPONSE + + (``2``) + The HEADERS frame is the first headers sent against reserved + stream. + .. enum:: NGHTTP2_HCAT_HEADERS + + (``3``) + The HEADERS frame which does not apply for the above categories, + which is analogous to HEADERS in SPDY. If non-final response + (e.g., status 1xx) is used, final response HEADERS frame will be + categorized here. + +.. type:: nghttp2_hd_inflate_flag + + + The flags for header inflation. + + .. enum:: NGHTTP2_HD_INFLATE_NONE + + (``0``) + No flag set. + .. enum:: NGHTTP2_HD_INFLATE_FINAL + + (``0x01``) + Indicates all headers were inflated. + .. enum:: NGHTTP2_HD_INFLATE_EMIT + + (``0x02``) + Indicates a header was emitted. + +.. type:: nghttp2_stream_proto_state + + + State of stream as described in RFC 7540. + + .. enum:: NGHTTP2_STREAM_STATE_IDLE + + (``1``) + idle state. + .. enum:: NGHTTP2_STREAM_STATE_OPEN + + open state. + .. enum:: NGHTTP2_STREAM_STATE_RESERVED_LOCAL + + reserved (local) state. + .. enum:: NGHTTP2_STREAM_STATE_RESERVED_REMOTE + + reserved (remote) state. + .. enum:: NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL + + half closed (local) state. + .. enum:: NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE + + half closed (remote) state. + .. enum:: NGHTTP2_STREAM_STATE_CLOSED + + closed state. + diff --git a/lib/nghttp2/doc/h2load-howto.rst.in b/lib/nghttp2-1.65.0/doc/h2load-howto.rst.in similarity index 100% rename from lib/nghttp2/doc/h2load-howto.rst.in rename to lib/nghttp2-1.65.0/doc/h2load-howto.rst.in diff --git a/lib/nghttp2/doc/h2load.1 b/lib/nghttp2-1.65.0/doc/h2load.1 similarity index 97% rename from lib/nghttp2/doc/h2load.1 rename to lib/nghttp2-1.65.0/doc/h2load.1 index 9f4cec51e22..58f6e68a2f7 100644 --- a/lib/nghttp2/doc/h2load.1 +++ b/lib/nghttp2-1.65.0/doc/h2load.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "H2LOAD" "1" "Oct 27, 2023" "1.58.0" "nghttp2" +.TH "H2LOAD" "1" "Jan 12, 2025" "1.65.0-DEV" "nghttp2" .SH NAME h2load \- HTTP/2 benchmarking tool .SH SYNOPSIS @@ -255,20 +255,19 @@ input files as usual. .UNINDENT .INDENT 0.0 .TP -.B \-\-npn\-list= +.B \-\-alpn\-list= Comma delimited list of ALPN protocol identifier sorted in the order of preference. That means most desirable -protocol comes first. This is used in both ALPN and -NPN. The parameter must be delimited by a single comma -only and any white spaces are treated as a part of -protocol string. +protocol comes first. The parameter must be delimited +by a single comma only and any white spaces are treated +as a part of protocol string. .sp Default: \fBh2,h2\-16,h2\-14,http/1.1\fP .UNINDENT .INDENT 0.0 .TP .B \-\-h1 -Short hand for \fI\%\-\-npn\-list\fP=http/1.1 +Short hand for \fI\%\-\-alpn\-list\fP=http/1.1 \fI\%\-\-no\-tls\-proto\fP=http/1.1, which effectively force http/1.1 for both http and https URI. .UNINDENT @@ -345,6 +344,12 @@ Enable ktls. .UNINDENT .INDENT 0.0 .TP +.B \-\-sni= +Send in TLS SNI, overriding the host name +specified in URI. +.UNINDENT +.INDENT 0.0 +.TP .B \-v, \-\-verbose Output debug information. .UNINDENT diff --git a/lib/nghttp2/doc/h2load.1.rst b/lib/nghttp2-1.65.0/doc/h2load.1.rst similarity index 97% rename from lib/nghttp2/doc/h2load.1.rst rename to lib/nghttp2-1.65.0/doc/h2load.1.rst index 0f65849d683..d63a839244f 100644 --- a/lib/nghttp2/doc/h2load.1.rst +++ b/lib/nghttp2-1.65.0/doc/h2load.1.rst @@ -213,20 +213,19 @@ OPTIONS the first URI appeared in the command line or inside input files as usual. -.. option:: --npn-list= +.. option:: --alpn-list= Comma delimited list of ALPN protocol identifier sorted in the order of preference. That means most desirable - protocol comes first. This is used in both ALPN and - NPN. The parameter must be delimited by a single comma - only and any white spaces are treated as a part of - protocol string. + protocol comes first. The parameter must be delimited + by a single comma only and any white spaces are treated + as a part of protocol string. Default: ``h2,h2-16,h2-14,http/1.1`` .. option:: --h1 - Short hand for :option:`--npn-list`\=http/1.1 + Short hand for :option:`--alpn-list`\=http/1.1 :option:`--no-tls-proto`\=http/1.1, which effectively force http/1.1 for both http and https URI. @@ -291,6 +290,11 @@ OPTIONS Enable ktls. +.. option:: --sni= + + Send in TLS SNI, overriding the host name + specified in URI. + .. option:: -v, --verbose Output debug information. diff --git a/lib/nghttp2/doc/index.rst.in b/lib/nghttp2-1.65.0/doc/index.rst.in similarity index 100% rename from lib/nghttp2/doc/index.rst.in rename to lib/nghttp2-1.65.0/doc/index.rst.in diff --git a/lib/nghttp2-1.65.0/doc/macros.rst b/lib/nghttp2-1.65.0/doc/macros.rst new file mode 100644 index 00000000000..f9b46431cca --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/macros.rst @@ -0,0 +1,141 @@ + +Macros +====== +.. macro:: NGHTTP2_VERSION + + Version number of the nghttp2 library release +.. macro:: NGHTTP2_VERSION_NUM + + Numerical representation of the version number of the nghttp2 library + release. This is a 24 bit number with 8 bits for major number, 8 bits + for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. +.. macro:: NGHTTP2_PROTO_VERSION_ID + + + The protocol version identification string of this library + supports. This identifier is used if HTTP/2 is used over TLS. +.. macro:: NGHTTP2_PROTO_VERSION_ID_LEN + + + The length of :macro:`NGHTTP2_PROTO_VERSION_ID`. +.. macro:: NGHTTP2_PROTO_ALPN + + + The serialized form of ALPN protocol identifier this library + supports. Notice that first byte is the length of following + protocol identifier. This is the same wire format of `TLS ALPN + extension `_. This is useful + to process incoming ALPN tokens in wire format. +.. macro:: NGHTTP2_PROTO_ALPN_LEN + + + The length of :macro:`NGHTTP2_PROTO_ALPN`. +.. macro:: NGHTTP2_CLEARTEXT_PROTO_VERSION_ID + + + The protocol version identification string of this library + supports. This identifier is used if HTTP/2 is used over cleartext + TCP. +.. macro:: NGHTTP2_CLEARTEXT_PROTO_VERSION_ID_LEN + + + The length of :macro:`NGHTTP2_CLEARTEXT_PROTO_VERSION_ID`. +.. macro:: NGHTTP2_VERSION_AGE + + + The age of :type:`nghttp2_info` +.. macro:: NGHTTP2_DEFAULT_WEIGHT + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + The default weight of stream dependency. +.. macro:: NGHTTP2_MAX_WEIGHT + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + The maximum weight of stream dependency. +.. macro:: NGHTTP2_MIN_WEIGHT + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + The minimum weight of stream dependency. +.. macro:: NGHTTP2_MAX_WINDOW_SIZE + + + The maximum window size +.. macro:: NGHTTP2_INITIAL_WINDOW_SIZE + + + The initial window size for stream level flow control. +.. macro:: NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + + + The initial window size for connection level flow control. +.. macro:: NGHTTP2_DEFAULT_HEADER_TABLE_SIZE + + + The default header table size. +.. macro:: NGHTTP2_CLIENT_MAGIC + + + The client magic string, which is the first 24 bytes byte string of + client connection preface. +.. macro:: NGHTTP2_CLIENT_MAGIC_LEN + + + The length of :macro:`NGHTTP2_CLIENT_MAGIC`. +.. macro:: NGHTTP2_DEFAULT_MAX_SETTINGS + + + The default max number of settings per SETTINGS frame +.. macro:: NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS + + + .. warning:: + + Deprecated. The initial max concurrent streams is 0xffffffffu. + + Default maximum number of incoming concurrent streams. Use + `nghttp2_submit_settings()` with + :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS` + to change the maximum number of incoming concurrent streams. + + .. note:: + + The maximum number of outgoing concurrent streams is 100 by + default. +.. macro:: NGHTTP2_EXTPRI_DEFAULT_URGENCY + + + :macro:`NGHTTP2_EXTPRI_DEFAULT_URGENCY` is the default urgency + level for :rfc:`9218` extensible priorities. +.. macro:: NGHTTP2_EXTPRI_URGENCY_HIGH + + + :macro:`NGHTTP2_EXTPRI_URGENCY_HIGH` is the highest urgency level + for :rfc:`9218` extensible priorities. +.. macro:: NGHTTP2_EXTPRI_URGENCY_LOW + + + :macro:`NGHTTP2_EXTPRI_URGENCY_LOW` is the lowest urgency level for + :rfc:`9218` extensible priorities. +.. macro:: NGHTTP2_EXTPRI_URGENCY_LEVELS + + + :macro:`NGHTTP2_EXTPRI_URGENCY_LEVELS` is the number of urgency + levels for :rfc:`9218` extensible priorities. diff --git a/lib/nghttp2/doc/mkapiref.py b/lib/nghttp2-1.65.0/doc/mkapiref.py similarity index 100% rename from lib/nghttp2/doc/mkapiref.py rename to lib/nghttp2-1.65.0/doc/mkapiref.py diff --git a/lib/nghttp2/doc/nghttp.1 b/lib/nghttp2-1.65.0/doc/nghttp.1 similarity index 71% rename from lib/nghttp2/doc/nghttp.1 rename to lib/nghttp2-1.65.0/doc/nghttp.1 index 4bf274fb870..f32408dda45 100644 --- a/lib/nghttp2/doc/nghttp.1 +++ b/lib/nghttp2-1.65.0/doc/nghttp.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "NGHTTP" "1" "Oct 27, 2023" "1.58.0" "nghttp2" +.TH "NGHTTP" "1" "Jan 12, 2025" "1.65.0-DEV" "nghttp2" .SH NAME nghttp \- HTTP/2 client .SH SYNOPSIS @@ -141,14 +141,15 @@ HTTP upgrade request is performed with OPTIONS method. .UNINDENT .INDENT 0.0 .TP -.B \-p, \-\-weight= -Sets weight of given URI. This option can be used -multiple times, and N\-th \fI\%\-p\fP option sets weight of N\-th -URI in the command line. If the number of \fI\%\-p\fP option is -less than the number of URI, the last \fI\%\-p\fP option value is -repeated. If there is no \fI\%\-p\fP option, default weight, 16, -is assumed. The valid value range is -[1, 256], inclusive. +.B \-\-extpri= +Sets RFC 9218 priority of given URI. must be the +wire format of priority header field (e.g., \(dqu=3,i\(dq). +This option can be used multiple times, and N\-th +\fI\%\-\-extpri\fP option sets priority of N\-th URI in the command +line. If the number of this option is less than the +number of URI, the last option value is repeated. If +there is no \fI\%\-\-extpri\fP option, urgency is 3, and +incremental is false. .UNINDENT .INDENT 0.0 .TP @@ -205,11 +206,6 @@ Don\(aqt send content\-length header field. .UNINDENT .INDENT 0.0 .TP -.B \-\-no\-dep -Don\(aqt send dependency based priority hint to server. -.UNINDENT -.INDENT 0.0 -.TP .B \-\-hexdump Display the incoming traffic in hexadecimal (Canonical hex+ASCII display). If SSL/TLS is used, decrypted data @@ -268,63 +264,6 @@ The argument is an integer and an optional unit (e.g., 1s is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms (hours, minutes, seconds and milliseconds, respectively). If a unit is omitted, a second is used as unit. -.SH DEPENDENCY BASED PRIORITY -.sp -nghttp sends priority hints to server by default unless -\fI\%\-\-no\-dep\fP is used. nghttp mimics the way Firefox employs to -manages dependency using idle streams. We follows the behaviour of -Firefox Nightly as of April, 2015, and nghttp\(aqs behaviour is very -static and could be different from Firefox in detail. But reproducing -the same behaviour of Firefox is not our goal. The goal is provide -the easy way to test out the dependency priority in server -implementation. -.sp -When connection is established, nghttp sends 5 PRIORITY frames to idle -streams 3, 5, 7, 9 and 11 to create \(dqanchor\(dq nodes in dependency -tree: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C - +\-\-\-\-\-+ - |id=0 | - +\-\-\-\-\-+ - ^ ^ ^ - w=201 / | \e w=1 - / | \e - / w=101| \e - +\-\-\-\-\-+ +\-\-\-\-\-+ +\-\-\-\-\-+ - |id=3 | |id=5 | |id=7 | - +\-\-\-\-\-+ +\-\-\-\-\-+ +\-\-\-\-\-+ - ^ ^ -w=1 | w=1 | - | | - +\-\-\-\-\-+ +\-\-\-\-\-+ - |id=11| |id=9 | - +\-\-\-\-\-+ +\-\-\-\-\-+ -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -In the above figure, \fBid\fP means stream ID, and \fBw\fP means weight. -The stream 0 is non\-existence stream, and forms the root of the tree. -The stream 7 and 9 are not used for now. -.sp -The URIs given in the command\-line depend on stream 11 with the weight -given in \fI\%\-p\fP option, which defaults to 16. -.sp -If \fI\%\-a\fP option is used, nghttp parses the resource pointed by -URI given in command\-line as html, and extracts resource links from -it. When requesting those resources, nghttp uses dependency according -to its resource type. -.sp -For CSS, and Javascript files inside \(dqhead\(dq element, they depend on -stream 3 with the weight 2. The Javascript files outside \(dqhead\(dq -element depend on stream 5 with the weight 2. The mages depend on -stream 11 with the weight 12. The other resources (e.g., icon) depend -on stream 11 with the weight 2. .SH SEE ALSO .sp \fBnghttpd(1)\fP, \fBnghttpx(1)\fP, \fBh2load(1)\fP diff --git a/lib/nghttp2/doc/nghttp.1.rst b/lib/nghttp2-1.65.0/doc/nghttp.1.rst similarity index 66% rename from lib/nghttp2/doc/nghttp.1.rst rename to lib/nghttp2-1.65.0/doc/nghttp.1.rst index e10f3ee8a71..11ee8b477a9 100644 --- a/lib/nghttp2/doc/nghttp.1.rst +++ b/lib/nghttp2-1.65.0/doc/nghttp.1.rst @@ -105,15 +105,16 @@ OPTIONS if the request URI has https scheme. If :option:`-d` is used, the HTTP upgrade request is performed with OPTIONS method. -.. option:: -p, --weight= +.. option:: --extpri= - Sets weight of given URI. This option can be used - multiple times, and N-th :option:`-p` option sets weight of N-th - URI in the command line. If the number of :option:`-p` option is - less than the number of URI, the last :option:`-p` option value is - repeated. If there is no :option:`-p` option, default weight, 16, - is assumed. The valid value range is - [1, 256], inclusive. + Sets RFC 9218 priority of given URI. must be the + wire format of priority header field (e.g., "u=3,i"). + This option can be used multiple times, and N-th + :option:`--extpri` option sets priority of N-th URI in the command + line. If the number of this option is less than the + number of URI, the last option value is repeated. If + there is no :option:`--extpri` option, urgency is 3, and + incremental is false. .. option:: -M, --peer-max-concurrent-streams= @@ -160,10 +161,6 @@ OPTIONS Don't send content-length header field. -.. option:: --no-dep - - Don't send dependency based priority hint to server. - .. option:: --hexdump Display the incoming traffic in hexadecimal (Canonical @@ -195,10 +192,6 @@ OPTIONS Enable ktls. -.. option:: --no-rfc7540-pri - - Disable RFC7540 priorities. - .. option:: --version Display version information and exit. @@ -217,59 +210,6 @@ is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms (hours, minutes, seconds and milliseconds, respectively). If a unit is omitted, a second is used as unit. -DEPENDENCY BASED PRIORITY -------------------------- - -nghttp sends priority hints to server by default unless -:option:`--no-dep` is used. nghttp mimics the way Firefox employs to -manages dependency using idle streams. We follows the behaviour of -Firefox Nightly as of April, 2015, and nghttp's behaviour is very -static and could be different from Firefox in detail. But reproducing -the same behaviour of Firefox is not our goal. The goal is provide -the easy way to test out the dependency priority in server -implementation. - -When connection is established, nghttp sends 5 PRIORITY frames to idle -streams 3, 5, 7, 9 and 11 to create "anchor" nodes in dependency -tree: - -.. code-block:: text - - +-----+ - |id=0 | - +-----+ - ^ ^ ^ - w=201 / | \ w=1 - / | \ - / w=101| \ - +-----+ +-----+ +-----+ - |id=3 | |id=5 | |id=7 | - +-----+ +-----+ +-----+ - ^ ^ - w=1 | w=1 | - | | - +-----+ +-----+ - |id=11| |id=9 | - +-----+ +-----+ - -In the above figure, ``id`` means stream ID, and ``w`` means weight. -The stream 0 is non-existence stream, and forms the root of the tree. -The stream 7 and 9 are not used for now. - -The URIs given in the command-line depend on stream 11 with the weight -given in :option:`-p` option, which defaults to 16. - -If :option:`-a` option is used, nghttp parses the resource pointed by -URI given in command-line as html, and extracts resource links from -it. When requesting those resources, nghttp uses dependency according -to its resource type. - -For CSS, and Javascript files inside "head" element, they depend on -stream 3 with the weight 2. The Javascript files outside "head" -element depend on stream 5 with the weight 2. The mages depend on -stream 11 with the weight 12. The other resources (e.g., icon) depend -on stream 11 with the weight 2. - SEE ALSO -------- diff --git a/lib/nghttp2/doc/nghttp2.h.rst.in b/lib/nghttp2-1.65.0/doc/nghttp2.h.rst.in similarity index 100% rename from lib/nghttp2/doc/nghttp2.h.rst.in rename to lib/nghttp2-1.65.0/doc/nghttp2.h.rst.in diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_check_authority.rst b/lib/nghttp2-1.65.0/doc/nghttp2_check_authority.rst new file mode 100644 index 00000000000..4c549038f35 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_check_authority.rst @@ -0,0 +1,25 @@ + +nghttp2_check_authority +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_check_authority(const uint8_t *value, size_t len) + + + Returns nonzero if the *value* which is supposed to be the value of the + :authority or host header field is valid according to + https://tools.ietf.org/html/rfc3986#section-3.2 + + Note that :authority and host field values are not authority. They + do not include userinfo in RFC 3986, see + https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2, that + is, it does not include '@'. This function treats '@' as a valid + character. + + *value* is valid if it merely consists of the allowed characters. + In particular, it does not check whether *value* follows the syntax + of authority. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_check_header_name.rst b/lib/nghttp2-1.65.0/doc/nghttp2_check_header_name.rst new file mode 100644 index 00000000000..2fba2c5596c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_check_header_name.rst @@ -0,0 +1,17 @@ + +nghttp2_check_header_name +========================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_check_header_name(const uint8_t *name, size_t len) + + + Returns nonzero if HTTP header field name *name* of length *len* is + valid according to http://tools.ietf.org/html/rfc7230#section-3.2 + + Because this is a header field name in HTTP2, the upper cased alphabet + is treated as error. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_check_header_value.rst b/lib/nghttp2-1.65.0/doc/nghttp2_check_header_value.rst new file mode 100644 index 00000000000..9680317de67 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_check_header_value.rst @@ -0,0 +1,18 @@ + +nghttp2_check_header_value +========================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_check_header_value(const uint8_t *value, size_t len) + + + Returns nonzero if HTTP header field value *value* of length *len* + is valid according to + http://tools.ietf.org/html/rfc7230#section-3.2 + + This function is considered obsolete, and application should + consider to use `nghttp2_check_header_value_rfc9113()` instead. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_check_header_value_rfc9113.rst b/lib/nghttp2-1.65.0/doc/nghttp2_check_header_value_rfc9113.rst new file mode 100644 index 00000000000..22cc91efbe0 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_check_header_value_rfc9113.rst @@ -0,0 +1,16 @@ + +nghttp2_check_header_value_rfc9113 +================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_check_header_value_rfc9113(const uint8_t *value, size_t len) + + + Returns nonzero if HTTP header field value *value* of length *len* + is valid according to + http://tools.ietf.org/html/rfc7230#section-3.2, plus + https://datatracker.ietf.org/doc/html/rfc9113#section-8.2.1 diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_check_method.rst b/lib/nghttp2-1.65.0/doc/nghttp2_check_method.rst new file mode 100644 index 00000000000..87570cde1d4 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_check_method.rst @@ -0,0 +1,16 @@ + +nghttp2_check_method +==================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_check_method(const uint8_t *value, size_t len) + + + Returns nonzero if the *value* which is supposed to be the value of + the :method header field is valid according to + https://datatracker.ietf.org/doc/html/rfc7231#section-4 and + https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6 diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_check_path.rst b/lib/nghttp2-1.65.0/doc/nghttp2_check_path.rst new file mode 100644 index 00000000000..24e3c240545 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_check_path.rst @@ -0,0 +1,20 @@ + +nghttp2_check_path +================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_check_path(const uint8_t *value, size_t len) + + + Returns nonzero if the *value* which is supposed to be the value of + the :path header field is valid according to + https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.3 + + *value* is valid if it merely consists of the allowed characters. + In particular, it does not check whether *value* follows the syntax + of path. The allowed characters are all characters valid by + `nghttp2_check_header_value` minus SPC and HT. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_extpri_parse_priority.rst b/lib/nghttp2-1.65.0/doc/nghttp2_extpri_parse_priority.rst new file mode 100644 index 00000000000..80d11ca93ef --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_extpri_parse_priority.rst @@ -0,0 +1,25 @@ + +nghttp2_extpri_parse_priority +============================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_extpri_parse_priority(nghttp2_extpri *extpri, const uint8_t *value, size_t len) + + + Parses Priority header field value pointed by *value* of length + *len*, and stores the result in the object pointed by *extpri*. + Priority header field is defined in :rfc:`9218`. + + This function does not initialize the object pointed by *extpri* + before storing the result. It only assigns the values that the + parser correctly extracted to fields. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + Failed to parse the header field value. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_bound.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_bound.rst new file mode 100644 index 00000000000..27eaed39809 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_bound.rst @@ -0,0 +1,14 @@ + +nghttp2_hd_deflate_bound +======================== + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater, const nghttp2_nv *nva, size_t nvlen) + + + Returns an upper bound on the compressed size after deflation of + *nva* of length *nvlen*. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_change_table_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_change_table_size.rst new file mode 100644 index 00000000000..5f351b0dccd --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_change_table_size.rst @@ -0,0 +1,31 @@ + +nghttp2_hd_deflate_change_table_size +==================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, size_t settings_max_dynamic_table_size) + + + Changes header table size of the *deflater* to + *settings_max_dynamic_table_size* bytes. This may trigger eviction + in the dynamic table. + + The *settings_max_dynamic_table_size* should be the value received + in SETTINGS_HEADER_TABLE_SIZE. + + The deflater never uses more memory than + ``max_deflate_dynamic_table_size`` bytes specified in + `nghttp2_hd_deflate_new()`. Therefore, if + *settings_max_dynamic_table_size* > + ``max_deflate_dynamic_table_size``, resulting maximum table size + becomes ``max_deflate_dynamic_table_size``. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_del.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_del.rst new file mode 100644 index 00000000000..ea81a35c190 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_del.rst @@ -0,0 +1,13 @@ + +nghttp2_hd_deflate_del +====================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_hd_deflate_del(nghttp2_hd_deflater *deflater) + + + Deallocates any resources allocated for *deflater*. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_dynamic_table_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_dynamic_table_size.rst new file mode 100644 index 00000000000..f2b4fffecf6 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_dynamic_table_size.rst @@ -0,0 +1,14 @@ + +nghttp2_hd_deflate_get_dynamic_table_size +========================================= + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_hd_deflate_get_dynamic_table_size(nghttp2_hd_deflater *deflater) + + + Returns the used dynamic table size, including the overhead 32 + bytes per entry described in RFC 7541. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_max_dynamic_table_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_max_dynamic_table_size.rst new file mode 100644 index 00000000000..95ddb101c66 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_max_dynamic_table_size.rst @@ -0,0 +1,13 @@ + +nghttp2_hd_deflate_get_max_dynamic_table_size +============================================= + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_hd_deflate_get_max_dynamic_table_size(nghttp2_hd_deflater *deflater) + + + Returns the maximum dynamic table size. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_num_table_entries.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_num_table_entries.rst new file mode 100644 index 00000000000..b2a2f7f18a2 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_num_table_entries.rst @@ -0,0 +1,15 @@ + +nghttp2_hd_deflate_get_num_table_entries +======================================== + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_hd_deflate_get_num_table_entries(nghttp2_hd_deflater *deflater) + + + Returns the number of entries that header table of *deflater* + contains. This is the sum of the number of static table and + dynamic table, so the return value is at least 61. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_table_entry.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_table_entry.rst new file mode 100644 index 00000000000..dcf8478edbc --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_get_table_entry.rst @@ -0,0 +1,18 @@ + +nghttp2_hd_deflate_get_table_entry +================================== + +Synopsis +-------- + +*#include * + +.. function:: const nghttp2_nv * nghttp2_hd_deflate_get_table_entry(nghttp2_hd_deflater *deflater, size_t idx) + + + Returns the table entry denoted by *idx* from header table of + *deflater*. The *idx* is 1-based, and idx=1 returns first entry of + static table. idx=62 returns first entry of dynamic table if it + exists. Specifying idx=0 is error, and this function returns NULL. + If *idx* is strictly greater than the number of entries the tables + contain, this function returns NULL. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd.rst new file mode 100644 index 00000000000..9b663df5500 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd.rst @@ -0,0 +1,39 @@ + +nghttp2_hd_deflate_hd +===================== + +Synopsis +-------- + +*#include * + +.. function:: ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, uint8_t *buf, size_t buflen, const nghttp2_nv *nva, size_t nvlen) + + + .. warning:: + + Deprecated. Use `nghttp2_hd_deflate_hd2()` instead. + + Deflates the *nva*, which has the *nvlen* name/value pairs, into + the *buf* of length *buflen*. + + If *buf* is not large enough to store the deflated header block, + this function fails with + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE`. The caller + should use `nghttp2_hd_deflate_bound()` to know the upper bound of + buffer size required to deflate given header name/value pairs. + + Once this function fails, subsequent call of this function always + returns :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP`. + + After this function returns, it is safe to delete the *nva*. + + This function returns the number of bytes written to *buf* if it + succeeds, or one of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + Deflation process has failed. + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE` + The provided *buflen* size is too small to hold the output. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd2.rst new file mode 100644 index 00000000000..d60d2d948da --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd2.rst @@ -0,0 +1,35 @@ + +nghttp2_hd_deflate_hd2 +====================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_ssize nghttp2_hd_deflate_hd2(nghttp2_hd_deflater *deflater, uint8_t *buf, size_t buflen, const nghttp2_nv *nva, size_t nvlen) + + + Deflates the *nva*, which has the *nvlen* name/value pairs, into + the *buf* of length *buflen*. + + If *buf* is not large enough to store the deflated header block, + this function fails with + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE`. The caller + should use `nghttp2_hd_deflate_bound()` to know the upper bound of + buffer size required to deflate given header name/value pairs. + + Once this function fails, subsequent call of this function always + returns :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP`. + + After this function returns, it is safe to delete the *nva*. + + This function returns the number of bytes written to *buf* if it + succeeds, or one of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + Deflation process has failed. + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE` + The provided *buflen* size is too small to hold the output. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd_vec.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd_vec.rst new file mode 100644 index 00000000000..c065c2979a9 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd_vec.rst @@ -0,0 +1,40 @@ + +nghttp2_hd_deflate_hd_vec +========================= + +Synopsis +-------- + +*#include * + +.. function:: ssize_t nghttp2_hd_deflate_hd_vec(nghttp2_hd_deflater *deflater, const nghttp2_vec *vec, size_t veclen, const nghttp2_nv *nva, size_t nvlen) + + + .. warning:: + + Deprecated. Use `nghttp2_hd_deflate_hd_vec2()` instead. + + Deflates the *nva*, which has the *nvlen* name/value pairs, into + the *veclen* size of buf vector *vec*. The each size of buffer + must be set in len field of :type:`nghttp2_vec`. If and only if + one chunk is filled up completely, next chunk will be used. If + *vec* is not large enough to store the deflated header block, this + function fails with + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE`. The caller + should use `nghttp2_hd_deflate_bound()` to know the upper bound of + buffer size required to deflate given header name/value pairs. + + Once this function fails, subsequent call of this function always + returns :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP`. + + After this function returns, it is safe to delete the *nva*. + + This function returns the number of bytes written to *vec* if it + succeeds, or one of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + Deflation process has failed. + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE` + The provided *buflen* size is too small to hold the output. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd_vec2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd_vec2.rst new file mode 100644 index 00000000000..8d34d1551c7 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_hd_vec2.rst @@ -0,0 +1,36 @@ + +nghttp2_hd_deflate_hd_vec2 +========================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_ssize nghttp2_hd_deflate_hd_vec2( nghttp2_hd_deflater *deflater, const nghttp2_vec *vec, size_t veclen, const nghttp2_nv *nva, size_t nvlen) + + + Deflates the *nva*, which has the *nvlen* name/value pairs, into + the *veclen* size of buf vector *vec*. The each size of buffer + must be set in len field of :type:`nghttp2_vec`. If and only if + one chunk is filled up completely, next chunk will be used. If + *vec* is not large enough to store the deflated header block, this + function fails with + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE`. The caller + should use `nghttp2_hd_deflate_bound()` to know the upper bound of + buffer size required to deflate given header name/value pairs. + + Once this function fails, subsequent call of this function always + returns :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP`. + + After this function returns, it is safe to delete the *nva*. + + This function returns the number of bytes written to *vec* if it + succeeds, or one of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + Deflation process has failed. + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE` + The provided *buflen* size is too small to hold the output. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_new.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_new.rst new file mode 100644 index 00000000000..35e72731ccc --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_new.rst @@ -0,0 +1,24 @@ + +nghttp2_hd_deflate_new +====================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr, size_t max_deflate_dynamic_table_size) + + + Initializes *\*deflater_ptr* for deflating name/values pairs. + + The *max_deflate_dynamic_table_size* is the upper bound of header + table size the deflater will use. + + If this function fails, *\*deflater_ptr* is left untouched. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_new2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_new2.rst new file mode 100644 index 00000000000..9a4353eb9d4 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_deflate_new2.rst @@ -0,0 +1,23 @@ + +nghttp2_hd_deflate_new2 +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_hd_deflate_new2(nghttp2_hd_deflater **deflater_ptr, size_t max_deflate_dynamic_table_size, nghttp2_mem *mem) + + + Like `nghttp2_hd_deflate_new()`, but with additional custom memory + allocator specified in the *mem*. + + The *mem* can be ``NULL`` and the call is equivalent to + `nghttp2_hd_deflate_new()`. + + This function does not take ownership *mem*. The application is + responsible for freeing *mem*. + + The library code does not refer to *mem* pointer after this + function returns, so the application can safely free it. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_change_table_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_change_table_size.rst new file mode 100644 index 00000000000..ed1657441d0 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_change_table_size.rst @@ -0,0 +1,34 @@ + +nghttp2_hd_inflate_change_table_size +==================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater, size_t settings_max_dynamic_table_size) + + + Changes header table size in the *inflater*. This may trigger + eviction in the dynamic table. + + The *settings_max_dynamic_table_size* should be the value + transmitted in SETTINGS_HEADER_TABLE_SIZE. + + This function must not be called while header block is being + inflated. In other words, this function must be called after + initialization of *inflater*, but before calling + `nghttp2_hd_inflate_hd3()`, or after + `nghttp2_hd_inflate_end_headers()`. Otherwise, + `NGHTTP2_ERR_INVALID_STATE` was returned. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + The function is called while header block is being inflated. + Probably, application missed to call + `nghttp2_hd_inflate_end_headers()`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_del.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_del.rst new file mode 100644 index 00000000000..bdf51bbc1d4 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_del.rst @@ -0,0 +1,13 @@ + +nghttp2_hd_inflate_del +====================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_hd_inflate_del(nghttp2_hd_inflater *inflater) + + + Deallocates any resources allocated for *inflater*. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_end_headers.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_end_headers.rst new file mode 100644 index 00000000000..63ea728e4b1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_end_headers.rst @@ -0,0 +1,16 @@ + +nghttp2_hd_inflate_end_headers +============================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_hd_inflate_end_headers(nghttp2_hd_inflater *inflater) + + + Signals the end of decompression for one header block. + + This function returns 0 if it succeeds. Currently this function + always succeeds. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_dynamic_table_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_dynamic_table_size.rst new file mode 100644 index 00000000000..3c57fcecf10 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_dynamic_table_size.rst @@ -0,0 +1,14 @@ + +nghttp2_hd_inflate_get_dynamic_table_size +========================================= + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_hd_inflate_get_dynamic_table_size(nghttp2_hd_inflater *inflater) + + + Returns the used dynamic table size, including the overhead 32 + bytes per entry described in RFC 7541. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_max_dynamic_table_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_max_dynamic_table_size.rst new file mode 100644 index 00000000000..20a63883a14 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_max_dynamic_table_size.rst @@ -0,0 +1,13 @@ + +nghttp2_hd_inflate_get_max_dynamic_table_size +============================================= + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_hd_inflate_get_max_dynamic_table_size(nghttp2_hd_inflater *inflater) + + + Returns the maximum dynamic table size. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_num_table_entries.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_num_table_entries.rst new file mode 100644 index 00000000000..6ec0767406a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_num_table_entries.rst @@ -0,0 +1,15 @@ + +nghttp2_hd_inflate_get_num_table_entries +======================================== + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_hd_inflate_get_num_table_entries(nghttp2_hd_inflater *inflater) + + + Returns the number of entries that header table of *inflater* + contains. This is the sum of the number of static table and + dynamic table, so the return value is at least 61. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_table_entry.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_table_entry.rst new file mode 100644 index 00000000000..94eeebf2806 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_get_table_entry.rst @@ -0,0 +1,18 @@ + +nghttp2_hd_inflate_get_table_entry +================================== + +Synopsis +-------- + +*#include * + +.. function:: const nghttp2_nv * nghttp2_hd_inflate_get_table_entry(nghttp2_hd_inflater *inflater, size_t idx) + + + Returns the table entry denoted by *idx* from header table of + *inflater*. The *idx* is 1-based, and idx=1 returns first entry of + static table. idx=62 returns first entry of dynamic table if it + exists. Specifying idx=0 is error, and this function returns NULL. + If *idx* is strictly greater than the number of entries the tables + contain, this function returns NULL. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd.rst new file mode 100644 index 00000000000..b7f5b28fb81 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd.rst @@ -0,0 +1,90 @@ + +nghttp2_hd_inflate_hd +===================== + +Synopsis +-------- + +*#include * + +.. function:: ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out, int *inflate_flags, uint8_t *in, size_t inlen, int in_final) + + + .. warning:: + + Deprecated. Use `nghttp2_hd_inflate_hd2()` instead. + + Inflates name/value block stored in *in* with length *inlen*. This + function performs decompression. For each successful emission of + header name/value pair, + :enum:`nghttp2_hd_inflate_flag.NGHTTP2_HD_INFLATE_EMIT` is set in + *\*inflate_flags* and name/value pair is assigned to the *nv_out* + and the function returns. The caller must not free the members of + *nv_out*. + + The *nv_out* may include pointers to the memory region in the *in*. + The caller must retain the *in* while the *nv_out* is used. + + The application should call this function repeatedly until the + ``(*inflate_flags) & NGHTTP2_HD_INFLATE_FINAL`` is nonzero and + return value is non-negative. This means the all input values are + processed successfully. Then the application must call + `nghttp2_hd_inflate_end_headers()` to prepare for the next header + block input. + + The caller can feed complete compressed header block. It also can + feed it in several chunks. The caller must set *in_final* to + nonzero if the given input is the last block of the compressed + header. + + This function returns the number of bytes processed if it succeeds, + or one of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + Inflation process has failed. + :enum:`nghttp2_error.NGHTTP2_ERR_BUFFER_ERROR` + The header field name or value is too large. + + Example follows:: + + int inflate_header_block(nghttp2_hd_inflater *hd_inflater, + uint8_t *in, size_t inlen, int final) + { + ssize_t rv; + + for(;;) { + nghttp2_nv nv; + int inflate_flags = 0; + + rv = nghttp2_hd_inflate_hd(hd_inflater, &nv, &inflate_flags, + in, inlen, final); + + if(rv < 0) { + fprintf(stderr, "inflate failed with error code %zd", rv); + return -1; + } + + in += rv; + inlen -= rv; + + if(inflate_flags & NGHTTP2_HD_INFLATE_EMIT) { + fwrite(nv.name, nv.namelen, 1, stderr); + fprintf(stderr, ": "); + fwrite(nv.value, nv.valuelen, 1, stderr); + fprintf(stderr, "\n"); + } + if(inflate_flags & NGHTTP2_HD_INFLATE_FINAL) { + nghttp2_hd_inflate_end_headers(hd_inflater); + break; + } + if((inflate_flags & NGHTTP2_HD_INFLATE_EMIT) == 0 && + inlen == 0) { + break; + } + } + + return 0; + } + diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd2.rst new file mode 100644 index 00000000000..2f5bdd5921c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd2.rst @@ -0,0 +1,95 @@ + +nghttp2_hd_inflate_hd2 +====================== + +Synopsis +-------- + +*#include * + +.. function:: ssize_t nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out, int *inflate_flags, const uint8_t *in, size_t inlen, int in_final) + + + .. warning:: + + Deprecated. Use `nghttp2_hd_inflate_hd3()` instead. + + Inflates name/value block stored in *in* with length *inlen*. This + function performs decompression. For each successful emission of + header name/value pair, + :enum:`nghttp2_hd_inflate_flag.NGHTTP2_HD_INFLATE_EMIT` is set in + *\*inflate_flags* and name/value pair is assigned to the *nv_out* + and the function returns. The caller must not free the members of + *nv_out*. + + The *nv_out* may include pointers to the memory region in the *in*. + The caller must retain the *in* while the *nv_out* is used. + + The application should call this function repeatedly until the + ``(*inflate_flags) & NGHTTP2_HD_INFLATE_FINAL`` is nonzero and + return value is non-negative. If that happens, all given input + data (*inlen* bytes) are processed successfully. Then the + application must call `nghttp2_hd_inflate_end_headers()` to prepare + for the next header block input. + + In other words, if *in_final* is nonzero, and this function returns + *inlen*, you can assert that + :enum:`nghttp2_hd_inflate_final.NGHTTP2_HD_INFLATE_FINAL` is set in + *\*inflate_flags*. + + The caller can feed complete compressed header block. It also can + feed it in several chunks. The caller must set *in_final* to + nonzero if the given input is the last block of the compressed + header. + + This function returns the number of bytes processed if it succeeds, + or one of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + Inflation process has failed. + :enum:`nghttp2_error.NGHTTP2_ERR_BUFFER_ERROR` + The header field name or value is too large. + + Example follows:: + + int inflate_header_block(nghttp2_hd_inflater *hd_inflater, + uint8_t *in, size_t inlen, int final) + { + ssize_t rv; + + for(;;) { + nghttp2_nv nv; + int inflate_flags = 0; + + rv = nghttp2_hd_inflate_hd2(hd_inflater, &nv, &inflate_flags, + in, inlen, final); + + if(rv < 0) { + fprintf(stderr, "inflate failed with error code %zd", rv); + return -1; + } + + in += rv; + inlen -= rv; + + if(inflate_flags & NGHTTP2_HD_INFLATE_EMIT) { + fwrite(nv.name, nv.namelen, 1, stderr); + fprintf(stderr, ": "); + fwrite(nv.value, nv.valuelen, 1, stderr); + fprintf(stderr, "\n"); + } + if(inflate_flags & NGHTTP2_HD_INFLATE_FINAL) { + nghttp2_hd_inflate_end_headers(hd_inflater); + break; + } + if((inflate_flags & NGHTTP2_HD_INFLATE_EMIT) == 0 && + inlen == 0) { + break; + } + } + + return 0; + } + diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd3.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd3.rst new file mode 100644 index 00000000000..018cede17af --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_hd3.rst @@ -0,0 +1,91 @@ + +nghttp2_hd_inflate_hd3 +====================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_ssize nghttp2_hd_inflate_hd3( nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out, int *inflate_flags, const uint8_t *in, size_t inlen, int in_final) + + + Inflates name/value block stored in *in* with length *inlen*. This + function performs decompression. For each successful emission of + header name/value pair, + :enum:`nghttp2_hd_inflate_flag.NGHTTP2_HD_INFLATE_EMIT` is set in + *\*inflate_flags* and name/value pair is assigned to the *nv_out* + and the function returns. The caller must not free the members of + *nv_out*. + + The *nv_out* may include pointers to the memory region in the *in*. + The caller must retain the *in* while the *nv_out* is used. + + The application should call this function repeatedly until the + ``(*inflate_flags) & NGHTTP2_HD_INFLATE_FINAL`` is nonzero and + return value is non-negative. If that happens, all given input + data (*inlen* bytes) are processed successfully. Then the + application must call `nghttp2_hd_inflate_end_headers()` to prepare + for the next header block input. + + In other words, if *in_final* is nonzero, and this function returns + *inlen*, you can assert that + :enum:`nghttp2_hd_inflate_final.NGHTTP2_HD_INFLATE_FINAL` is set in + *\*inflate_flags*. + + The caller can feed complete compressed header block. It also can + feed it in several chunks. The caller must set *in_final* to + nonzero if the given input is the last block of the compressed + header. + + This function returns the number of bytes processed if it succeeds, + or one of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + Inflation process has failed. + :enum:`nghttp2_error.NGHTTP2_ERR_BUFFER_ERROR` + The header field name or value is too large. + + Example follows:: + + int inflate_header_block(nghttp2_hd_inflater *hd_inflater, + uint8_t *in, size_t inlen, int final) + { + nghttp2_ssize rv; + + for(;;) { + nghttp2_nv nv; + int inflate_flags = 0; + + rv = nghttp2_hd_inflate_hd3(hd_inflater, &nv, &inflate_flags, + in, inlen, final); + + if(rv < 0) { + fprintf(stderr, "inflate failed with error code %td", rv); + return -1; + } + + in += rv; + inlen -= rv; + + if(inflate_flags & NGHTTP2_HD_INFLATE_EMIT) { + fwrite(nv.name, nv.namelen, 1, stderr); + fprintf(stderr, ": "); + fwrite(nv.value, nv.valuelen, 1, stderr); + fprintf(stderr, "\n"); + } + if(inflate_flags & NGHTTP2_HD_INFLATE_FINAL) { + nghttp2_hd_inflate_end_headers(hd_inflater); + break; + } + if((inflate_flags & NGHTTP2_HD_INFLATE_EMIT) == 0 && + inlen == 0) { + break; + } + } + + return 0; + } + diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_new.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_new.rst new file mode 100644 index 00000000000..0394e3a457b --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_new.rst @@ -0,0 +1,21 @@ + +nghttp2_hd_inflate_new +====================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_hd_inflate_new(nghttp2_hd_inflater **inflater_ptr) + + + Initializes *\*inflater_ptr* for inflating name/values pairs. + + If this function fails, *\*inflater_ptr* is left untouched. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_new2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_new2.rst new file mode 100644 index 00000000000..f052019df85 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_hd_inflate_new2.rst @@ -0,0 +1,23 @@ + +nghttp2_hd_inflate_new2 +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_hd_inflate_new2(nghttp2_hd_inflater **inflater_ptr, nghttp2_mem *mem) + + + Like `nghttp2_hd_inflate_new()`, but with additional custom memory + allocator specified in the *mem*. + + The *mem* can be ``NULL`` and the call is equivalent to + `nghttp2_hd_inflate_new()`. + + This function does not take ownership *mem*. The application is + responsible for freeing *mem*. + + The library code does not refer to *mem* pointer after this + function returns, so the application can safely free it. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_http2_strerror.rst b/lib/nghttp2-1.65.0/doc/nghttp2_http2_strerror.rst new file mode 100644 index 00000000000..3c80741ff5f --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_http2_strerror.rst @@ -0,0 +1,16 @@ + +nghttp2_http2_strerror +====================== + +Synopsis +-------- + +*#include * + +.. function:: const char *nghttp2_http2_strerror(uint32_t error_code) + + + Returns string representation of HTTP/2 error code *error_code* + (e.g., ``PROTOCOL_ERROR`` is returned if ``error_code == + NGHTTP2_PROTOCOL_ERROR``). If string representation is unknown for + given *error_code*, this function returns string ``unknown``. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_is_fatal.rst b/lib/nghttp2-1.65.0/doc/nghttp2_is_fatal.rst new file mode 100644 index 00000000000..b5482196708 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_is_fatal.rst @@ -0,0 +1,14 @@ + +nghttp2_is_fatal +================ + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_is_fatal(int lib_error_code) + + + Returns nonzero if the :type:`nghttp2_error` library error code + *lib_error* is fatal. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_nv_compare_name.rst b/lib/nghttp2-1.65.0/doc/nghttp2_nv_compare_name.rst new file mode 100644 index 00000000000..9fa4c1b8940 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_nv_compare_name.rst @@ -0,0 +1,17 @@ + +nghttp2_nv_compare_name +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_nv_compare_name(const nghttp2_nv *lhs, const nghttp2_nv *rhs) + + + Compares ``lhs->name`` of length ``lhs->namelen`` bytes and + ``rhs->name`` of length ``rhs->namelen`` bytes. Returns negative + integer if ``lhs->name`` is found to be less than ``rhs->name``; or + returns positive integer if ``lhs->name`` is found to be greater + than ``rhs->name``; or returns 0 otherwise. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_del.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_del.rst new file mode 100644 index 00000000000..b816b714f7e --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_del.rst @@ -0,0 +1,14 @@ + +nghttp2_option_del +================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_del(nghttp2_option *option) + + + Frees any resources allocated for *option*. If *option* is + ``NULL``, this function does nothing. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_new.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_new.rst new file mode 100644 index 00000000000..c95ac140b5d --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_new.rst @@ -0,0 +1,22 @@ + +nghttp2_option_new +================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_option_new(nghttp2_option **option_ptr) + + + Initializes *\*option_ptr* with default values. + + When the application finished using this object, it can use + `nghttp2_option_del()` to free its memory. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_builtin_recv_extension_type.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_builtin_recv_extension_type.rst new file mode 100644 index 00000000000..5d052ef7985 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_builtin_recv_extension_type.rst @@ -0,0 +1,24 @@ + +nghttp2_option_set_builtin_recv_extension_type +============================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_builtin_recv_extension_type(nghttp2_option *option, uint8_t type) + + + Sets extension frame type the application is willing to receive + using builtin handler. The *type* is the extension frame type to + receive, and must be strictly greater than 0x9. Otherwise, this + function does nothing. The application can call this function + multiple times to set more than one frame type to receive. The + application does not have to call this function if it just sends + extension frames. + + If same frame type is passed to both + `nghttp2_option_set_builtin_recv_extension_type()` and + `nghttp2_option_set_user_recv_extension_type()`, the latter takes + precedence. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_continuations.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_continuations.rst new file mode 100644 index 00000000000..36f66887e3c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_continuations.rst @@ -0,0 +1,16 @@ + +nghttp2_option_set_max_continuations +==================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_max_continuations(nghttp2_option *option, size_t val) + + + This function sets the maximum number of CONTINUATION frames + following an incoming HEADER frame. If more than those frames are + received, the remote endpoint is considered to be misbehaving and + session will be closed. The default value is 8. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_deflate_dynamic_table_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_deflate_dynamic_table_size.rst new file mode 100644 index 00000000000..2fa43869c06 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_deflate_dynamic_table_size.rst @@ -0,0 +1,17 @@ + +nghttp2_option_set_max_deflate_dynamic_table_size +================================================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_max_deflate_dynamic_table_size(nghttp2_option *option, size_t val) + + + This option sets the maximum dynamic table size for deflating + header fields. The default value is 4KiB. In HTTP/2, receiver of + deflated header block can specify maximum dynamic table size. The + actual maximum size is the minimum of the size receiver specified + and this option value. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_outbound_ack.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_outbound_ack.rst new file mode 100644 index 00000000000..5b24dcfa1e3 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_outbound_ack.rst @@ -0,0 +1,16 @@ + +nghttp2_option_set_max_outbound_ack +=================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_max_outbound_ack(nghttp2_option *option, size_t val) + + + This function sets the maximum number of outgoing SETTINGS ACK and + PING ACK frames retained in :type:`nghttp2_session` object. If + more than those frames are retained, the peer is considered to be + misbehaving and session will be closed. The default value is 1000. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_reserved_remote_streams.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_reserved_remote_streams.rst new file mode 100644 index 00000000000..0d63b3a1a9e --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_reserved_remote_streams.rst @@ -0,0 +1,23 @@ + +nghttp2_option_set_max_reserved_remote_streams +============================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_max_reserved_remote_streams(nghttp2_option *option, uint32_t val) + + + RFC 7540 does not enforce any limit on the number of incoming + reserved streams (in RFC 7540 terms, streams in reserved (remote) + state). This only affects client side, since only server can push + streams. Malicious server can push arbitrary number of streams, + and make client's memory exhausted. This option can set the + maximum number of such incoming streams to avoid possible memory + exhaustion. If this option is set, and pushed streams are + automatically closed on reception, without calling user provided + callback, if they exceed the given limit. The default value is + 200. If session is configured as server side, this option has no + effect. Server can control the number of streams to push. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_send_header_block_length.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_send_header_block_length.rst new file mode 100644 index 00000000000..5344d308987 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_send_header_block_length.rst @@ -0,0 +1,19 @@ + +nghttp2_option_set_max_send_header_block_length +=============================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_max_send_header_block_length(nghttp2_option *option, size_t val) + + + This option sets the maximum length of header block (a set of + header fields per one HEADERS frame) to send. The length of a + given set of header fields is calculated using + `nghttp2_hd_deflate_bound()`. The default value is 64KiB. If + application attempts to send header fields larger than this limit, + the transmission of the frame fails with error code + :enum:`nghttp2_error.NGHTTP2_ERR_FRAME_SIZE_ERROR`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_settings.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_settings.rst new file mode 100644 index 00000000000..ba325e765e4 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_max_settings.rst @@ -0,0 +1,16 @@ + +nghttp2_option_set_max_settings +=============================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_max_settings(nghttp2_option *option, size_t val) + + + This function sets the maximum number of SETTINGS entries per + SETTINGS frame that will be accepted. If more than those entries + are received, the peer is considered to be misbehaving and session + will be closed. The default value is 32. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_auto_ping_ack.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_auto_ping_ack.rst new file mode 100644 index 00000000000..3eade60ef49 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_auto_ping_ack.rst @@ -0,0 +1,19 @@ + +nghttp2_option_set_no_auto_ping_ack +=================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_no_auto_ping_ack(nghttp2_option *option, int val) + + + This option prevents the library from sending PING frame with ACK + flag set automatically when PING frame without ACK flag set is + received. If this option is set to nonzero, the library won't send + PING frame with ACK flag set in the response for incoming PING + frame. The application can send PING frame with ACK flag set using + `nghttp2_submit_ping()` with :enum:`nghttp2_flag.NGHTTP2_FLAG_ACK` + as flags parameter. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_auto_window_update.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_auto_window_update.rst new file mode 100644 index 00000000000..737b6ceb741 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_auto_window_update.rst @@ -0,0 +1,18 @@ + +nghttp2_option_set_no_auto_window_update +======================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_no_auto_window_update(nghttp2_option *option, int val) + + + This option prevents the library from sending WINDOW_UPDATE for a + connection automatically. If this option is set to nonzero, the + library won't send WINDOW_UPDATE for DATA until application calls + `nghttp2_session_consume()` to indicate the consumed amount of + data. Don't use `nghttp2_submit_window_update()` for this purpose. + By default, this option is set to zero. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_closed_streams.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_closed_streams.rst new file mode 100644 index 00000000000..67c3f721bb1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_closed_streams.rst @@ -0,0 +1,18 @@ + +nghttp2_option_set_no_closed_streams +==================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_no_closed_streams(nghttp2_option *option, int val) + + + .. warning:: + + Deprecated. Closed streams are not retained anymore. + + This function works as before, but it does not take any effect + against :type:`nghttp2_session`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_http_messaging.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_http_messaging.rst new file mode 100644 index 00000000000..ef10aa99550 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_http_messaging.rst @@ -0,0 +1,21 @@ + +nghttp2_option_set_no_http_messaging +==================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_no_http_messaging(nghttp2_option *option, int val) + + + By default, nghttp2 library enforces subset of HTTP Messaging rules + described in `HTTP/2 specification, section 8 + `_. See + :ref:`http-messaging` section for details. For those applications + who use nghttp2 library as non-HTTP use, give nonzero to *val* to + disable this enforcement. Please note that disabling this feature + does not change the fundamental client and server model of HTTP. + That is, even if the validation is disabled, only client can send + requests. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_recv_client_magic.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_recv_client_magic.rst new file mode 100644 index 00000000000..841a1e1dc54 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_recv_client_magic.rst @@ -0,0 +1,27 @@ + +nghttp2_option_set_no_recv_client_magic +======================================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_no_recv_client_magic(nghttp2_option *option, int val) + + + By default, nghttp2 library, if configured as server, requires + first 24 bytes of client magic byte string (MAGIC). In most cases, + this will simplify the implementation of server. But sometimes + server may want to detect the application protocol based on first + few bytes on clear text communication. + + If this option is used with nonzero *val*, nghttp2 library does not + handle MAGIC. It still checks following SETTINGS frame. This + means that applications should deal with MAGIC by themselves. + + If this option is not used or used with zero value, if MAGIC does + not match :macro:`NGHTTP2_CLIENT_MAGIC`, `nghttp2_session_recv()` + and `nghttp2_session_mem_recv2()` will return error + :enum:`nghttp2_error.NGHTTP2_ERR_BAD_CLIENT_MAGIC`, which is fatal + error. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation.rst new file mode 100644 index 00000000000..a505645a970 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation.rst @@ -0,0 +1,16 @@ + +nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation +================================================================ + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation( nghttp2_option *option, int val) + + + This option, if set to nonzero, turns off RFC 9113 leading and + trailing white spaces validation against HTTP field value. Some + important fields, such as HTTP/2 pseudo header fields, are + validated more strictly and this option does not apply to them. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_peer_max_concurrent_streams.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_peer_max_concurrent_streams.rst new file mode 100644 index 00000000000..19e0f1f3655 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_peer_max_concurrent_streams.rst @@ -0,0 +1,23 @@ + +nghttp2_option_set_peer_max_concurrent_streams +============================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_peer_max_concurrent_streams(nghttp2_option *option, uint32_t val) + + + This option sets the SETTINGS_MAX_CONCURRENT_STREAMS value of + remote endpoint as if it is received in SETTINGS frame. Without + specifying this option, the maximum number of outgoing concurrent + streams is initially limited to 100 to avoid issues when the local + endpoint submits lots of requests before receiving initial SETTINGS + frame from the remote endpoint, since sending them at once to the + remote endpoint could lead to rejection of some of the requests. + This value will be overwritten when the local endpoint receives + initial SETTINGS frame from the remote endpoint, either to the + value advertised in SETTINGS_MAX_CONCURRENT_STREAMS or to the + default value (unlimited) if none was advertised. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_server_fallback_rfc7540_priorities.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_server_fallback_rfc7540_priorities.rst new file mode 100644 index 00000000000..1e1ae432c2b --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_server_fallback_rfc7540_priorities.rst @@ -0,0 +1,17 @@ + +nghttp2_option_set_server_fallback_rfc7540_priorities +===================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_server_fallback_rfc7540_priorities(nghttp2_option *option, int val) + + + .. warning:: + Deprecated. :rfc:`7540` priorities have been removed. + + This function works as before, but it does not take any effect + against :type:`nghttp2_session`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_stream_reset_rate_limit.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_stream_reset_rate_limit.rst new file mode 100644 index 00000000000..adde8c67604 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_stream_reset_rate_limit.rst @@ -0,0 +1,21 @@ + +nghttp2_option_set_stream_reset_rate_limit +========================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_stream_reset_rate_limit(nghttp2_option *option, uint64_t burst, uint64_t rate) + + + This function sets the rate limit for the incoming stream reset + (RST_STREAM frame). It is server use only. It is a token-bucket + based rate limiter. *burst* specifies the number of tokens that is + initially available. The maximum number of tokens is capped to + this value. *rate* specifies the number of tokens that are + regenerated per second. An incoming RST_STREAM consumes one token. + If there is no token available, GOAWAY is sent to tear down the + connection. *burst* and *rate* default to 1000 and 33 + respectively. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_option_set_user_recv_extension_type.rst b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_user_recv_extension_type.rst new file mode 100644 index 00000000000..23ec72044fc --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_option_set_user_recv_extension_type.rst @@ -0,0 +1,21 @@ + +nghttp2_option_set_user_recv_extension_type +=========================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_option_set_user_recv_extension_type(nghttp2_option *option, uint8_t type) + + + Sets extension frame type the application is willing to handle with + user defined callbacks (see + :type:`nghttp2_on_extension_chunk_recv_callback` and + :type:`nghttp2_unpack_extension_callback`). The *type* is + extension frame type, and must be strictly greater than 0x9. + Otherwise, this function does nothing. The application can call + this function multiple times to set more than one frame type to + receive. The application does not have to call this function if it + just sends extension frames. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_pack_settings_payload.rst b/lib/nghttp2-1.65.0/doc/nghttp2_pack_settings_payload.rst new file mode 100644 index 00000000000..f32381136c1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_pack_settings_payload.rst @@ -0,0 +1,33 @@ + +nghttp2_pack_settings_payload +============================= + +Synopsis +-------- + +*#include * + +.. function:: ssize_t nghttp2_pack_settings_payload( uint8_t *buf, size_t buflen, const nghttp2_settings_entry *iv, size_t niv) + + + .. warning:: + + Deprecated. Use `nghttp2_pack_settings_payload2()` instead. + + Serializes the SETTINGS values *iv* in the *buf*. The size of the + *buf* is specified by *buflen*. The number of entries in the *iv* + array is given by *niv*. The required space in *buf* for the *niv* + entries is ``6*niv`` bytes and if the given buffer is too small, an + error is returned. This function is used mainly for creating a + SETTINGS payload to be sent with the ``HTTP2-Settings`` header + field in an HTTP Upgrade request. The data written in *buf* is NOT + base64url encoded and the application is responsible for encoding. + + This function returns the number of bytes written in *buf*, or one + of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *iv* contains duplicate settings ID or invalid value. + + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE` + The provided *buflen* size is too small to hold the output. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_pack_settings_payload2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_pack_settings_payload2.rst new file mode 100644 index 00000000000..9ad310e4d9c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_pack_settings_payload2.rst @@ -0,0 +1,29 @@ + +nghttp2_pack_settings_payload2 +============================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_ssize nghttp2_pack_settings_payload2( uint8_t *buf, size_t buflen, const nghttp2_settings_entry *iv, size_t niv) + + + Serializes the SETTINGS values *iv* in the *buf*. The size of the + *buf* is specified by *buflen*. The number of entries in the *iv* + array is given by *niv*. The required space in *buf* for the *niv* + entries is ``6*niv`` bytes and if the given buffer is too small, an + error is returned. This function is used mainly for creating a + SETTINGS payload to be sent with the ``HTTP2-Settings`` header + field in an HTTP Upgrade request. The data written in *buf* is NOT + base64url encoded and the application is responsible for encoding. + + This function returns the number of bytes written in *buf*, or one + of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *iv* contains duplicate settings ID or invalid value. + + :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE` + The provided *buflen* size is too small to hold the output. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_check_default.rst b/lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_check_default.rst new file mode 100644 index 00000000000..108b0736a47 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_check_default.rst @@ -0,0 +1,19 @@ + +nghttp2_priority_spec_check_default +=================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + Returns nonzero if the *pri_spec* is filled with default values. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_default_init.rst b/lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_default_init.rst new file mode 100644 index 00000000000..aadfa0152f3 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_default_init.rst @@ -0,0 +1,21 @@ + +nghttp2_priority_spec_default_init +================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_priority_spec_default_init(nghttp2_priority_spec *pri_spec) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + Initializes *pri_spec* with the default values. The default values + are: stream_id = 0, weight = :macro:`NGHTTP2_DEFAULT_WEIGHT` and + exclusive = 0. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_init.rst b/lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_init.rst new file mode 100644 index 00000000000..ec29d90527b --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_priority_spec_init.rst @@ -0,0 +1,24 @@ + +nghttp2_priority_spec_init +========================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_priority_spec_init(nghttp2_priority_spec *pri_spec, int32_t stream_id, int32_t weight, int exclusive) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + Initializes *pri_spec* with the *stream_id* of the stream to depend + on with *weight* and its exclusive flag. If *exclusive* is + nonzero, exclusive flag is set. + + The *weight* must be in [:macro:`NGHTTP2_MIN_WEIGHT`, + :macro:`NGHTTP2_MAX_WEIGHT`], inclusive. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_decref.rst b/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_decref.rst new file mode 100644 index 00000000000..5d7cdda7e5f --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_decref.rst @@ -0,0 +1,15 @@ + +nghttp2_rcbuf_decref +==================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_rcbuf_decref(nghttp2_rcbuf *rcbuf) + + + Decrements the reference count of *rcbuf* by 1. If the reference + count becomes zero, the object pointed by *rcbuf* will be freed. + In this case, application must not use *rcbuf* again. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_get_buf.rst b/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_get_buf.rst new file mode 100644 index 00000000000..94cd5d04aa1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_get_buf.rst @@ -0,0 +1,13 @@ + +nghttp2_rcbuf_get_buf +===================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_vec nghttp2_rcbuf_get_buf(nghttp2_rcbuf *rcbuf) + + + Returns the underlying buffer managed by *rcbuf*. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_incref.rst b/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_incref.rst new file mode 100644 index 00000000000..01c132705d3 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_incref.rst @@ -0,0 +1,13 @@ + +nghttp2_rcbuf_incref +==================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_rcbuf_incref(nghttp2_rcbuf *rcbuf) + + + Increments the reference count of *rcbuf* by 1. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_is_static.rst b/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_is_static.rst new file mode 100644 index 00000000000..50ba5a3b8f2 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_rcbuf_is_static.rst @@ -0,0 +1,15 @@ + +nghttp2_rcbuf_is_static +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_rcbuf_is_static(const nghttp2_rcbuf *rcbuf) + + + Returns nonzero if the underlying buffer is statically allocated, + and 0 otherwise. This can be useful for language bindings that wish + to avoid creating duplicate strings for these buffers. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_select_alpn.rst b/lib/nghttp2-1.65.0/doc/nghttp2_select_alpn.rst new file mode 100644 index 00000000000..8583bdc98a8 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_select_alpn.rst @@ -0,0 +1,62 @@ + +nghttp2_select_alpn +=================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_select_alpn(const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen) + + + A helper function for dealing with ALPN in server side. The *in* + contains peer's protocol list in preferable order. The format of + *in* is length-prefixed and not null-terminated. For example, + ``h2`` and ``http/1.1`` stored in *in* like this:: + + in[0] = 2 + in[1..2] = "h2" + in[3] = 8 + in[4..11] = "http/1.1" + inlen = 12 + + The selection algorithm is as follows: + + 1. If peer's list contains HTTP/2 protocol the library supports, + it is selected and returns 1. The following step is not taken. + + 2. If peer's list contains ``http/1.1``, this function selects + ``http/1.1`` and returns 0. The following step is not taken. + + 3. This function selects nothing and returns -1 (So called + non-overlap case). In this case, *out* and *outlen* are left + untouched. + + Selecting ``h2`` means that ``h2`` is written into *\*out* and its + length (which is 2) is assigned to *\*outlen*. + + For ALPN, refer to https://tools.ietf.org/html/rfc7301 + + To use this method you should do something like:: + + static int alpn_select_proto_cb(SSL* ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg) + { + int rv; + rv = nghttp2_select_alpn(out, outlen, in, inlen); + if (rv == -1) { + return SSL_TLSEXT_ERR_NOACK; + } + if (rv == 1) { + ((MyType*)arg)->http2_selected = 1; + } + return SSL_TLSEXT_ERR_OK; + } + ... + SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, my_obj); + diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_select_next_protocol.rst b/lib/nghttp2-1.65.0/doc/nghttp2_select_next_protocol.rst new file mode 100644 index 00000000000..2ed15616b21 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_select_next_protocol.rst @@ -0,0 +1,67 @@ + +nghttp2_select_next_protocol +============================ + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_select_next_protocol(unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen) + + + .. warning:: + + Deprecated. Use `nghttp2_select_alpn` instead. + + A helper function for dealing with ALPN in server side. The *in* + contains peer's protocol list in preferable order. The format of + *in* is length-prefixed and not null-terminated. For example, + ``h2`` and ``http/1.1`` stored in *in* like this:: + + in[0] = 2 + in[1..2] = "h2" + in[3] = 8 + in[4..11] = "http/1.1" + inlen = 12 + + The selection algorithm is as follows: + + 1. If peer's list contains HTTP/2 protocol the library supports, + it is selected and returns 1. The following step is not taken. + + 2. If peer's list contains ``http/1.1``, this function selects + ``http/1.1`` and returns 0. The following step is not taken. + + 3. This function selects nothing and returns -1 (So called + non-overlap case). In this case, *out* and *outlen* are left + untouched. + + Selecting ``h2`` means that ``h2`` is written into *\*out* and its + length (which is 2) is assigned to *\*outlen*. + + For ALPN, refer to https://tools.ietf.org/html/rfc7301 + + To use this method you should do something like:: + + static int alpn_select_proto_cb(SSL* ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg) + { + int rv; + rv = nghttp2_select_next_protocol((unsigned char**)out, outlen, + in, inlen); + if (rv == -1) { + return SSL_TLSEXT_ERR_NOACK; + } + if (rv == 1) { + ((MyType*)arg)->http2_selected = 1; + } + return SSL_TLSEXT_ERR_OK; + } + ... + SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, my_obj); + diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_del.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_del.rst new file mode 100644 index 00000000000..23723552a11 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_del.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_del +============================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_del(nghttp2_session_callbacks *callbacks) + + + Frees any resources allocated for *callbacks*. If *callbacks* is + ``NULL``, this function does nothing. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_new.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_new.rst new file mode 100644 index 00000000000..44ef7ac256a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_new.rst @@ -0,0 +1,25 @@ + +nghttp2_session_callbacks_new +============================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_callbacks_new(nghttp2_session_callbacks **callbacks_ptr) + + + Initializes *\*callbacks_ptr* with NULL values. + + The initialized object can be used when initializing multiple + :type:`nghttp2_session` objects. + + When the application finished using this object, it can use + `nghttp2_session_callbacks_del()` to free its memory. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_before_frame_send_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_before_frame_send_callback.rst new file mode 100644 index 00000000000..0f52c10c42c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_before_frame_send_callback.rst @@ -0,0 +1,13 @@ + +nghttp2_session_callbacks_set_before_frame_send_callback +======================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_before_frame_send_callback( nghttp2_session_callbacks *cbs, nghttp2_before_frame_send_callback before_frame_send_callback) + + + Sets callback function invoked before a non-DATA frame is sent. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_data_source_read_length_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_data_source_read_length_callback.rst new file mode 100644 index 00000000000..51efa4636ec --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_data_source_read_length_callback.rst @@ -0,0 +1,20 @@ + +nghttp2_session_callbacks_set_data_source_read_length_callback +============================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_data_source_read_length_callback( nghttp2_session_callbacks *cbs, nghttp2_data_source_read_length_callback data_source_read_length_callback) + + + .. warning:: + + Deprecated. Use + `nghttp2_session_callbacks_set_data_source_read_length_callback2()` + with :type:`nghttp2_data_source_read_length_callback2` instead. + + Sets callback function determine the length allowed in + :type:`nghttp2_data_source_read_callback`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_data_source_read_length_callback2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_data_source_read_length_callback2.rst new file mode 100644 index 00000000000..241266350a0 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_data_source_read_length_callback2.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_data_source_read_length_callback2 +=============================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_data_source_read_length_callback2( nghttp2_session_callbacks *cbs, nghttp2_data_source_read_length_callback2 data_source_read_length_callback) + + + Sets callback function determine the length allowed in + :type:`nghttp2_data_source_read_callback2`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_error_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_error_callback.rst new file mode 100644 index 00000000000..bedb22daa63 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_error_callback.rst @@ -0,0 +1,24 @@ + +nghttp2_session_callbacks_set_error_callback +============================================ + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_error_callback( nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback) + + + .. warning:: + + Deprecated. Use + `nghttp2_session_callbacks_set_error_callback2()` with + :type:`nghttp2_error_callback2` instead. + + Sets callback function invoked when library tells error message to + the application. + + If both :type:`nghttp2_error_callback` and + :type:`nghttp2_error_callback2` are set, the latter takes + precedence. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_error_callback2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_error_callback2.rst new file mode 100644 index 00000000000..f3d48d02e6c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_error_callback2.rst @@ -0,0 +1,18 @@ + +nghttp2_session_callbacks_set_error_callback2 +============================================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_error_callback2( nghttp2_session_callbacks *cbs, nghttp2_error_callback2 error_callback2) + + + Sets callback function invoked when library tells error code, and + message to the application. + + If both :type:`nghttp2_error_callback` and + :type:`nghttp2_error_callback2` are set, the latter takes + precedence. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_begin_frame_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_begin_frame_callback.rst new file mode 100644 index 00000000000..95f0b728066 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_begin_frame_callback.rst @@ -0,0 +1,13 @@ + +nghttp2_session_callbacks_set_on_begin_frame_callback +===================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_begin_frame_callback( nghttp2_session_callbacks *cbs, nghttp2_on_begin_frame_callback on_begin_frame_callback) + + + Sets callback function invoked when a frame header is received. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_begin_headers_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_begin_headers_callback.rst new file mode 100644 index 00000000000..970b1fd089c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_begin_headers_callback.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_on_begin_headers_callback +======================================================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_begin_headers_callback( nghttp2_session_callbacks *cbs, nghttp2_on_begin_headers_callback on_begin_headers_callback) + + + Sets callback function invoked when the reception of header block + in HEADERS or PUSH_PROMISE is started. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_data_chunk_recv_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_data_chunk_recv_callback.rst new file mode 100644 index 00000000000..04fa3f61886 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_data_chunk_recv_callback.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_on_data_chunk_recv_callback +========================================================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_data_chunk_recv_callback( nghttp2_session_callbacks *cbs, nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback) + + + Sets callback function invoked when a chunk of data in DATA frame + is received. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_extension_chunk_recv_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_extension_chunk_recv_callback.rst new file mode 100644 index 00000000000..2079781d0c6 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_extension_chunk_recv_callback.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_on_extension_chunk_recv_callback +============================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_extension_chunk_recv_callback( nghttp2_session_callbacks *cbs, nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback) + + + Sets callback function invoked when chunk of extension frame + payload is received. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_not_send_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_not_send_callback.rst new file mode 100644 index 00000000000..73e9fb12748 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_not_send_callback.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_on_frame_not_send_callback +======================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_frame_not_send_callback( nghttp2_session_callbacks *cbs, nghttp2_on_frame_not_send_callback on_frame_not_send_callback) + + + Sets callback function invoked when a non-DATA frame is not sent + because of an error. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_recv_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_recv_callback.rst new file mode 100644 index 00000000000..255b53896b6 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_recv_callback.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_on_frame_recv_callback +==================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_frame_recv_callback( nghttp2_session_callbacks *cbs, nghttp2_on_frame_recv_callback on_frame_recv_callback) + + + Sets callback function invoked by `nghttp2_session_recv()` and + `nghttp2_session_mem_recv2()` when a frame is received. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_send_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_send_callback.rst new file mode 100644 index 00000000000..7a02ee5e174 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_frame_send_callback.rst @@ -0,0 +1,13 @@ + +nghttp2_session_callbacks_set_on_frame_send_callback +==================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_frame_send_callback( nghttp2_session_callbacks *cbs, nghttp2_on_frame_send_callback on_frame_send_callback) + + + Sets callback function invoked after a frame is sent. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_header_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_header_callback.rst new file mode 100644 index 00000000000..4e92ab8e80b --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_header_callback.rst @@ -0,0 +1,17 @@ + +nghttp2_session_callbacks_set_on_header_callback +================================================ + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_header_callback( nghttp2_session_callbacks *cbs, nghttp2_on_header_callback on_header_callback) + + + Sets callback function invoked when a header name/value pair is + received. If both + `nghttp2_session_callbacks_set_on_header_callback()` and + `nghttp2_session_callbacks_set_on_header_callback2()` are used to + set callbacks, the latter has the precedence. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_header_callback2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_header_callback2.rst new file mode 100644 index 00000000000..f621bdfecb1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_header_callback2.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_on_header_callback2 +================================================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_header_callback2( nghttp2_session_callbacks *cbs, nghttp2_on_header_callback2 on_header_callback2) + + + Sets callback function invoked when a header name/value pair is + received. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_frame_recv_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_frame_recv_callback.rst new file mode 100644 index 00000000000..403b3243b7a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_frame_recv_callback.rst @@ -0,0 +1,15 @@ + +nghttp2_session_callbacks_set_on_invalid_frame_recv_callback +============================================================ + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_invalid_frame_recv_callback( nghttp2_session_callbacks *cbs, nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback) + + + Sets callback function invoked by `nghttp2_session_recv()` and + `nghttp2_session_mem_recv2()` when an invalid non-DATA frame is + received. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_header_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_header_callback.rst new file mode 100644 index 00000000000..667e228b46e --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_header_callback.rst @@ -0,0 +1,17 @@ + +nghttp2_session_callbacks_set_on_invalid_header_callback +======================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_invalid_header_callback( nghttp2_session_callbacks *cbs, nghttp2_on_invalid_header_callback on_invalid_header_callback) + + + Sets callback function invoked when a invalid header name/value + pair is received. If both + `nghttp2_session_callbacks_set_on_invalid_header_callback()` and + `nghttp2_session_callbacks_set_on_invalid_header_callback2()` are + used to set callbacks, the latter takes the precedence. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_header_callback2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_header_callback2.rst new file mode 100644 index 00000000000..8cf4cf956d7 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_invalid_header_callback2.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_on_invalid_header_callback2 +========================================================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_invalid_header_callback2( nghttp2_session_callbacks *cbs, nghttp2_on_invalid_header_callback2 on_invalid_header_callback2) + + + Sets callback function invoked when a invalid header name/value + pair is received. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_stream_close_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_stream_close_callback.rst new file mode 100644 index 00000000000..9349a1c5e6e --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_on_stream_close_callback.rst @@ -0,0 +1,13 @@ + +nghttp2_session_callbacks_set_on_stream_close_callback +====================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_on_stream_close_callback( nghttp2_session_callbacks *cbs, nghttp2_on_stream_close_callback on_stream_close_callback) + + + Sets callback function invoked when the stream is closed. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_pack_extension_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_pack_extension_callback.rst new file mode 100644 index 00000000000..a4633dcfd1a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_pack_extension_callback.rst @@ -0,0 +1,20 @@ + +nghttp2_session_callbacks_set_pack_extension_callback +===================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_pack_extension_callback( nghttp2_session_callbacks *cbs, nghttp2_pack_extension_callback pack_extension_callback) + + + .. warning:: + + Deprecated. Use + `nghttp2_session_callbacks_set_pack_extension_callback2()` with + :type:`nghttp2_pack_extension_callback2` instead. + + Sets callback function invoked when the library asks the + application to pack extension frame payload in wire format. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_pack_extension_callback2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_pack_extension_callback2.rst new file mode 100644 index 00000000000..b7ff1737df7 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_pack_extension_callback2.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_pack_extension_callback2 +====================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_pack_extension_callback2( nghttp2_session_callbacks *cbs, nghttp2_pack_extension_callback2 pack_extension_callback) + + + Sets callback function invoked when the library asks the + application to pack extension frame payload in wire format. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_recv_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_recv_callback.rst new file mode 100644 index 00000000000..c2ca8c5d2c6 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_recv_callback.rst @@ -0,0 +1,21 @@ + +nghttp2_session_callbacks_set_recv_callback +=========================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_recv_callback( nghttp2_session_callbacks *cbs, nghttp2_recv_callback recv_callback) + + + .. warning:: + + Deprecated. Use `nghttp2_session_callbacks_set_recv_callback2()` + with :type:`nghttp2_recv_callback2` instead. + + Sets callback function invoked when the a session wants to receive + data from the remote peer. This callback is not necessary if the + application uses solely `nghttp2_session_mem_recv()` to process + received data. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_recv_callback2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_recv_callback2.rst new file mode 100644 index 00000000000..b9a652f29ce --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_recv_callback2.rst @@ -0,0 +1,16 @@ + +nghttp2_session_callbacks_set_recv_callback2 +============================================ + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_recv_callback2( nghttp2_session_callbacks *cbs, nghttp2_recv_callback2 recv_callback) + + + Sets callback function invoked when the a session wants to receive + data from the remote peer. This callback is not necessary if the + application uses solely `nghttp2_session_mem_recv2()` to process + received data. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_select_padding_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_select_padding_callback.rst new file mode 100644 index 00000000000..10f67caff98 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_select_padding_callback.rst @@ -0,0 +1,21 @@ + +nghttp2_session_callbacks_set_select_padding_callback +===================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_select_padding_callback( nghttp2_session_callbacks *cbs, nghttp2_select_padding_callback select_padding_callback) + + + .. warning:: + + Deprecated. Use + `nghttp2_session_callbacks_set_select_padding_callback2()` with + :type:`nghttp2_select_padding_callback2` instead. + + Sets callback function invoked when the library asks application + how many padding bytes are required for the transmission of the + given frame. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_select_padding_callback2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_select_padding_callback2.rst new file mode 100644 index 00000000000..5edb9ee19d5 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_select_padding_callback2.rst @@ -0,0 +1,15 @@ + +nghttp2_session_callbacks_set_select_padding_callback2 +====================================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_select_padding_callback2( nghttp2_session_callbacks *cbs, nghttp2_select_padding_callback2 select_padding_callback) + + + Sets callback function invoked when the library asks application + how many padding bytes are required for the transmission of the + given frame. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_callback.rst new file mode 100644 index 00000000000..979781ff5b1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_callback.rst @@ -0,0 +1,21 @@ + +nghttp2_session_callbacks_set_send_callback +=========================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_send_callback( nghttp2_session_callbacks *cbs, nghttp2_send_callback send_callback) + + + .. warning:: + + Deprecated. Use `nghttp2_session_callbacks_set_send_callback2()` + with :type:`nghttp2_send_callback2` instead. + + Sets callback function invoked when a session wants to send data to + the remote peer. This callback is not necessary if the application + uses solely `nghttp2_session_mem_send()` to serialize data to + transmit. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_callback2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_callback2.rst new file mode 100644 index 00000000000..09731c4c69c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_callback2.rst @@ -0,0 +1,16 @@ + +nghttp2_session_callbacks_set_send_callback2 +============================================ + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_send_callback2( nghttp2_session_callbacks *cbs, nghttp2_send_callback2 send_callback) + + + Sets callback function invoked when a session wants to send data to + the remote peer. This callback is not necessary if the application + uses solely `nghttp2_session_mem_send2()` to serialize data to + transmit. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_data_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_data_callback.rst new file mode 100644 index 00000000000..fba59965863 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_send_data_callback.rst @@ -0,0 +1,15 @@ + +nghttp2_session_callbacks_set_send_data_callback +================================================ + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_send_data_callback( nghttp2_session_callbacks *cbs, nghttp2_send_data_callback send_data_callback) + + + Sets callback function invoked when + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_COPY` is used in + :type:`nghttp2_data_source_read_callback2` to avoid data copy. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_unpack_extension_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_unpack_extension_callback.rst new file mode 100644 index 00000000000..545a630c6de --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_callbacks_set_unpack_extension_callback.rst @@ -0,0 +1,14 @@ + +nghttp2_session_callbacks_set_unpack_extension_callback +======================================================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_callbacks_set_unpack_extension_callback( nghttp2_session_callbacks *cbs, nghttp2_unpack_extension_callback unpack_extension_callback) + + + Sets callback function invoked when the library asks the + application to unpack extension frame payload from wire format. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_change_extpri_stream_priority.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_change_extpri_stream_priority.rst new file mode 100644 index 00000000000..fb7ef8f158c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_change_extpri_stream_priority.rst @@ -0,0 +1,38 @@ + +nghttp2_session_change_extpri_stream_priority +============================================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_change_extpri_stream_priority( nghttp2_session *session, int32_t stream_id, const nghttp2_extpri *extpri, int ignore_client_signal) + + + Changes the priority of the existing stream denoted by *stream_id*. + The new priority is *extpri*. This function is meant to be used by + server for :rfc:`9218` extensible prioritization scheme. + + If *session* is initialized as client, this function returns + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`. For client, use + `nghttp2_submit_priority_update()` instead. + + If :member:`extpri->urgency ` is out of + bound, it is set to :macro:`NGHTTP2_EXTPRI_URGENCY_LOW`. + + If *ignore_client_signal* is nonzero, server starts to ignore + client priority signals for this stream. + + If + :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` + of value of 1 is not submitted via `nghttp2_submit_settings()`, + this function does nothing and returns 0. + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + The *session* is initialized as client. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + *stream_id* is zero; or a stream denoted by *stream_id* is not + found. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_change_stream_priority.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_change_stream_priority.rst new file mode 100644 index 00000000000..afe6778a54e --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_change_stream_priority.rst @@ -0,0 +1,19 @@ + +nghttp2_session_change_stream_priority +====================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_change_stream_priority(nghttp2_session *session, int32_t stream_id, const nghttp2_priority_spec *pri_spec) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + This function is noop. It always returns 0. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_check_request_allowed.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_check_request_allowed.rst new file mode 100644 index 00000000000..1b14cf79489 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_check_request_allowed.rst @@ -0,0 +1,24 @@ + +nghttp2_session_check_request_allowed +===================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_check_request_allowed(nghttp2_session *session) + + + Returns nonzero if new request can be sent from local endpoint. + + This function return 0 if request is not allowed for this session. + There are several reasons why request is not allowed. Some of the + reasons are: session is server; stream ID has been spent; GOAWAY + has been sent or received. + + The application can call `nghttp2_submit_request2()` without + consulting this function. In that case, + `nghttp2_submit_request2()` may return error. Or, request is + failed to sent, and :type:`nghttp2_on_stream_close_callback` is + called. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_check_server_session.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_check_server_session.rst new file mode 100644 index 00000000000..be3f0bd7c23 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_check_server_session.rst @@ -0,0 +1,13 @@ + +nghttp2_session_check_server_session +==================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_check_server_session(nghttp2_session *session) + + + Returns nonzero if *session* is initialized as server side session. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_client_new.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_client_new.rst new file mode 100644 index 00000000000..a38005fd8c4 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_client_new.rst @@ -0,0 +1,29 @@ + +nghttp2_session_client_new +========================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_client_new(nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, void *user_data) + + + Initializes *\*session_ptr* for client use. The all members of + *callbacks* are copied to *\*session_ptr*. Therefore *\*session_ptr* + does not store *callbacks*. The *user_data* is an arbitrary user + supplied data, which will be passed to the callback functions. + + The :type:`nghttp2_send_callback2` must be specified. If the + application code uses `nghttp2_session_recv()`, the + :type:`nghttp2_recv_callback` must be specified. The other members + of *callbacks* can be ``NULL``. + + If this function fails, *\*session_ptr* is left untouched. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_client_new2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_client_new2.rst new file mode 100644 index 00000000000..ac12c9bcbcc --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_client_new2.rst @@ -0,0 +1,29 @@ + +nghttp2_session_client_new2 +=========================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_client_new2(nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, void *user_data, const nghttp2_option *option) + + + Like `nghttp2_session_client_new()`, but with additional options + specified in the *option*. + + The *option* can be ``NULL`` and the call is equivalent to + `nghttp2_session_client_new()`. + + This function does not take ownership *option*. The application is + responsible for freeing *option* if it finishes using the object. + + The library code does not refer to *option* after this function + returns. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_client_new3.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_client_new3.rst new file mode 100644 index 00000000000..6d023a04f4d --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_client_new3.rst @@ -0,0 +1,29 @@ + +nghttp2_session_client_new3 +=========================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_client_new3( nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, void *user_data, const nghttp2_option *option, nghttp2_mem *mem) + + + Like `nghttp2_session_client_new2()`, but with additional custom + memory allocator specified in the *mem*. + + The *mem* can be ``NULL`` and the call is equivalent to + `nghttp2_session_client_new2()`. + + This function does not take ownership *mem*. The application is + responsible for freeing *mem*. + + The library code does not refer to *mem* pointer after this + function returns, so the application can safely free it. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_consume.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_consume.rst new file mode 100644 index 00000000000..eb544a569c5 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_consume.rst @@ -0,0 +1,31 @@ + +nghttp2_session_consume +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_consume(nghttp2_session *session, int32_t stream_id, size_t size) + + + Tells the *session* that *size* bytes for a stream denoted by + *stream_id* were consumed by application and are ready to + WINDOW_UPDATE. The consumed bytes are counted towards both + connection and stream level WINDOW_UPDATE (see + `nghttp2_session_consume_connection()` and + `nghttp2_session_consume_stream()` to update consumption + independently). This function is intended to be used without + automatic window update (see + `nghttp2_option_set_no_auto_window_update()`). + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + Automatic WINDOW_UPDATE is not disabled. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_consume_connection.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_consume_connection.rst new file mode 100644 index 00000000000..e3ef0d1a5f4 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_consume_connection.rst @@ -0,0 +1,24 @@ + +nghttp2_session_consume_connection +================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_consume_connection(nghttp2_session *session, size_t size) + + + Like `nghttp2_session_consume()`, but this only tells library that + *size* bytes were consumed only for connection level. Note that + HTTP/2 maintains connection and stream level flow control windows + independently. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + Automatic WINDOW_UPDATE is not disabled. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_consume_stream.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_consume_stream.rst new file mode 100644 index 00000000000..c979c7204c6 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_consume_stream.rst @@ -0,0 +1,26 @@ + +nghttp2_session_consume_stream +============================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_consume_stream(nghttp2_session *session, int32_t stream_id, size_t size) + + + Like `nghttp2_session_consume()`, but this only tells library that + *size* bytes were consumed only for stream denoted by *stream_id*. + Note that HTTP/2 maintains connection and stream level flow control + windows independently. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + Automatic WINDOW_UPDATE is not disabled. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_create_idle_stream.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_create_idle_stream.rst new file mode 100644 index 00000000000..69fecd76f78 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_create_idle_stream.rst @@ -0,0 +1,19 @@ + +nghttp2_session_create_idle_stream +================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_create_idle_stream(nghttp2_session *session, int32_t stream_id, const nghttp2_priority_spec *pri_spec) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + This function is noop. It always returns 0. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_del.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_del.rst new file mode 100644 index 00000000000..1c00d7cf2aa --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_del.rst @@ -0,0 +1,14 @@ + +nghttp2_session_del +=================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_del(nghttp2_session *session) + + + Frees any resources allocated for *session*. If *session* is + ``NULL``, this function does nothing. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_find_stream.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_find_stream.rst new file mode 100644 index 00000000000..0f675904f25 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_find_stream.rst @@ -0,0 +1,21 @@ + +nghttp2_session_find_stream +=========================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_stream * nghttp2_session_find_stream(nghttp2_session *session, int32_t stream_id) + + + Returns pointer to :type:`nghttp2_stream` object denoted by + *stream_id*. If stream was not found, returns NULL. + + Returns imaginary root stream (see + `nghttp2_session_get_root_stream()`) if 0 is given in *stream_id*. + + Unless *stream_id* == 0, the returned pointer is valid until next + call of `nghttp2_session_send()`, `nghttp2_session_mem_send2()`, + `nghttp2_session_recv()`, and `nghttp2_session_mem_recv2()`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_effective_local_window_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_effective_local_window_size.rst new file mode 100644 index 00000000000..398bfa7aba9 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_effective_local_window_size.rst @@ -0,0 +1,25 @@ + +nghttp2_session_get_effective_local_window_size +=============================================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_session_get_effective_local_window_size(nghttp2_session *session) + + + Returns the local (receive) window size for a connection. The + local window size can be adjusted by + `nghttp2_submit_window_update()`. This function takes into account + that and returns effective window size. + + This function does not take into account the amount of received + data from the remote endpoint. Use + `nghttp2_session_get_local_window_size()` to know the amount of + data the remote endpoint can send without receiving + connection-level WINDOW_UPDATE frame. Note that each stream is + still subject to the stream level flow control. + + This function returns -1 if it fails. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_effective_recv_data_length.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_effective_recv_data_length.rst new file mode 100644 index 00000000000..be4e97abe09 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_effective_recv_data_length.rst @@ -0,0 +1,22 @@ + +nghttp2_session_get_effective_recv_data_length +============================================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_session_get_effective_recv_data_length(nghttp2_session *session) + + + Returns the number of DATA payload in bytes received without + WINDOW_UPDATE transmission for a connection. The local (receive) + window size can be adjusted by `nghttp2_submit_window_update()`. + This function takes into account that and returns effective data + length. In particular, if the local window size is reduced by + submitting negative window_size_increment with + `nghttp2_submit_window_update()`, this function returns the number + of bytes less than actually received. + + This function returns -1 if it fails. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_extpri_stream_priority.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_extpri_stream_priority.rst new file mode 100644 index 00000000000..dbe8a45538a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_extpri_stream_priority.rst @@ -0,0 +1,33 @@ + +nghttp2_session_get_extpri_stream_priority +========================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_get_extpri_stream_priority( nghttp2_session *session, nghttp2_extpri *extpri, int32_t stream_id) + + + Stores the stream priority of the existing stream denoted by + *stream_id* in the object pointed by *extpri*. This function is + meant to be used by server for :rfc:`9218` extensible + prioritization scheme. + + If *session* is initialized as client, this function returns + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`. + + If + :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` + of value of 1 is not submitted via `nghttp2_submit_settings()`, + this function does nothing and returns 0. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + The *session* is initialized as client. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + *stream_id* is zero; or a stream denoted by *stream_id* is not + found. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_hd_deflate_dynamic_table_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_hd_deflate_dynamic_table_size.rst new file mode 100644 index 00000000000..685f197826a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_hd_deflate_dynamic_table_size.rst @@ -0,0 +1,14 @@ + +nghttp2_session_get_hd_deflate_dynamic_table_size +================================================= + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_session_get_hd_deflate_dynamic_table_size(nghttp2_session *session) + + + Returns the current dynamic table size of HPACK deflater including + the overhead 32 bytes per entry described in RFC 7541. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_hd_inflate_dynamic_table_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_hd_inflate_dynamic_table_size.rst new file mode 100644 index 00000000000..b2dd95ec405 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_hd_inflate_dynamic_table_size.rst @@ -0,0 +1,14 @@ + +nghttp2_session_get_hd_inflate_dynamic_table_size +================================================= + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_session_get_hd_inflate_dynamic_table_size(nghttp2_session *session) + + + Returns the current dynamic table size of HPACK inflater, including + the overhead 32 bytes per entry described in RFC 7541. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_last_proc_stream_id.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_last_proc_stream_id.rst new file mode 100644 index 00000000000..726fffd5653 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_last_proc_stream_id.rst @@ -0,0 +1,19 @@ + +nghttp2_session_get_last_proc_stream_id +======================================= + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_session_get_last_proc_stream_id(nghttp2_session *session) + + + Returns the last stream ID of a stream for which + :type:`nghttp2_on_frame_recv_callback` was invoked most recently. + The returned value can be used as last_stream_id parameter for + `nghttp2_submit_goaway()` and + `nghttp2_session_terminate_session2()`. + + This function always succeeds. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_local_settings.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_local_settings.rst new file mode 100644 index 00000000000..630176ff3f1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_local_settings.rst @@ -0,0 +1,15 @@ + +nghttp2_session_get_local_settings +================================== + +Synopsis +-------- + +*#include * + +.. function:: uint32_t nghttp2_session_get_local_settings( nghttp2_session *session, nghttp2_settings_id id) + + + Returns the value of SETTINGS *id* of local endpoint acknowledged + by the remote endpoint. The *id* must be one of the values defined + in :enum:`nghttp2_settings_id`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_local_window_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_local_window_size.rst new file mode 100644 index 00000000000..7abc88772bb --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_local_window_size.rst @@ -0,0 +1,19 @@ + +nghttp2_session_get_local_window_size +===================================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_session_get_local_window_size(nghttp2_session *session) + + + Returns the amount of flow-controlled payload (e.g., DATA) that the + remote endpoint can send without receiving connection level + WINDOW_UPDATE frame. Note that each stream is still subject to the + stream level flow control (see + `nghttp2_session_get_stream_local_window_size()`). + + This function returns -1 if it fails. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_next_stream_id.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_next_stream_id.rst new file mode 100644 index 00000000000..a68401cdb95 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_next_stream_id.rst @@ -0,0 +1,15 @@ + +nghttp2_session_get_next_stream_id +================================== + +Synopsis +-------- + +*#include * + +.. function:: uint32_t nghttp2_session_get_next_stream_id(nghttp2_session *session) + + + Returns the next outgoing stream ID. Notice that return type is + uint32_t. If we run out of stream ID for this session, this + function returns 1 << 31. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_outbound_queue_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_outbound_queue_size.rst new file mode 100644 index 00000000000..8816ee742ba --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_outbound_queue_size.rst @@ -0,0 +1,14 @@ + +nghttp2_session_get_outbound_queue_size +======================================= + +Synopsis +-------- + +*#include * + +.. function:: size_t nghttp2_session_get_outbound_queue_size(nghttp2_session *session) + + + Returns the number of frames in the outbound queue. This does not + include the deferred DATA frames. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_remote_settings.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_remote_settings.rst new file mode 100644 index 00000000000..056991a4de7 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_remote_settings.rst @@ -0,0 +1,15 @@ + +nghttp2_session_get_remote_settings +=================================== + +Synopsis +-------- + +*#include * + +.. function:: uint32_t nghttp2_session_get_remote_settings( nghttp2_session *session, nghttp2_settings_id id) + + + Returns the value of SETTINGS *id* notified by a remote endpoint. + The *id* must be one of values defined in + :enum:`nghttp2_settings_id`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_remote_window_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_remote_window_size.rst new file mode 100644 index 00000000000..cd810c2b96d --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_remote_window_size.rst @@ -0,0 +1,15 @@ + +nghttp2_session_get_remote_window_size +====================================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_session_get_remote_window_size(nghttp2_session *session) + + + Returns the remote window size for a connection. + + This function always succeeds. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_root_stream.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_root_stream.rst new file mode 100644 index 00000000000..3b3915f755f --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_root_stream.rst @@ -0,0 +1,21 @@ + +nghttp2_session_get_root_stream +=============================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_stream * nghttp2_session_get_root_stream(nghttp2_session *session) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + Returns root of dependency tree, which is imaginary stream with + stream ID 0. The returned pointer is valid until *session* is + freed by `nghttp2_session_del()`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_effective_local_window_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_effective_local_window_size.rst new file mode 100644 index 00000000000..55793fd7a78 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_effective_local_window_size.rst @@ -0,0 +1,25 @@ + +nghttp2_session_get_stream_effective_local_window_size +====================================================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_session_get_stream_effective_local_window_size( nghttp2_session *session, int32_t stream_id) + + + Returns the local (receive) window size for the stream *stream_id*. + The local window size can be adjusted by + `nghttp2_submit_window_update()`. This function takes into account + that and returns effective window size. + + This function does not take into account the amount of received + data from the remote endpoint. Use + `nghttp2_session_get_stream_local_window_size()` to know the amount + of data the remote endpoint can send without receiving stream level + WINDOW_UPDATE frame. Note that each stream is still subject to the + connection level flow control. + + This function returns -1 if it fails. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_effective_recv_data_length.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_effective_recv_data_length.rst new file mode 100644 index 00000000000..8e01b2f0fd7 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_effective_recv_data_length.rst @@ -0,0 +1,22 @@ + +nghttp2_session_get_stream_effective_recv_data_length +===================================================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_session_get_stream_effective_recv_data_length( nghttp2_session *session, int32_t stream_id) + + + Returns the number of DATA payload in bytes received without + WINDOW_UPDATE transmission for the stream *stream_id*. The local + (receive) window size can be adjusted by + `nghttp2_submit_window_update()`. This function takes into account + that and returns effective data length. In particular, if the + local window size is reduced by submitting negative + window_size_increment with `nghttp2_submit_window_update()`, this + function returns the number of bytes less than actually received. + + This function returns -1 if it fails. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_local_close.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_local_close.rst new file mode 100644 index 00000000000..cc01d8db319 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_local_close.rst @@ -0,0 +1,14 @@ + +nghttp2_session_get_stream_local_close +====================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_get_stream_local_close(nghttp2_session *session, int32_t stream_id) + + + Returns 1 if local peer half closed the given stream *stream_id*. + Returns 0 if it did not. Returns -1 if no such stream exists. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_local_window_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_local_window_size.rst new file mode 100644 index 00000000000..48bf7b68d4f --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_local_window_size.rst @@ -0,0 +1,20 @@ + +nghttp2_session_get_stream_local_window_size +============================================ + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_session_get_stream_local_window_size( nghttp2_session *session, int32_t stream_id) + + + Returns the amount of flow-controlled payload (e.g., DATA) that the + remote endpoint can send without receiving stream level + WINDOW_UPDATE frame. It is also subject to the connection level + flow control. So the actual amount of data to send is + min(`nghttp2_session_get_stream_local_window_size()`, + `nghttp2_session_get_local_window_size()`). + + This function returns -1 if it fails. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_remote_close.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_remote_close.rst new file mode 100644 index 00000000000..a0a540ce9e0 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_remote_close.rst @@ -0,0 +1,14 @@ + +nghttp2_session_get_stream_remote_close +======================================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_get_stream_remote_close(nghttp2_session *session, int32_t stream_id) + + + Returns 1 if remote peer half closed the given stream *stream_id*. + Returns 0 if it did not. Returns -1 if no such stream exists. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_remote_window_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_remote_window_size.rst new file mode 100644 index 00000000000..73c5821fc67 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_remote_window_size.rst @@ -0,0 +1,22 @@ + +nghttp2_session_get_stream_remote_window_size +============================================= + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_session_get_stream_remote_window_size( nghttp2_session *session, int32_t stream_id) + + + Returns the remote window size for a given stream *stream_id*. + + This is the amount of flow-controlled payload (e.g., DATA) that the + local endpoint can send without stream level WINDOW_UPDATE. There + is also connection level flow control, so the effective size of + payload that the local endpoint can actually send is + min(`nghttp2_session_get_stream_remote_window_size()`, + `nghttp2_session_get_remote_window_size()`). + + This function returns -1 if it fails. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_user_data.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_user_data.rst new file mode 100644 index 00000000000..ee2bc26c0e1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_get_stream_user_data.rst @@ -0,0 +1,20 @@ + +nghttp2_session_get_stream_user_data +==================================== + +Synopsis +-------- + +*#include * + +.. function:: void * nghttp2_session_get_stream_user_data(nghttp2_session *session, int32_t stream_id) + + + Returns stream_user_data for the stream *stream_id*. The + stream_user_data is provided by `nghttp2_submit_request2()`, + `nghttp2_submit_headers()` or + `nghttp2_session_set_stream_user_data()`. Unless it is set using + `nghttp2_session_set_stream_user_data()`, if the stream is + initiated by the remote endpoint, stream_user_data is always + ``NULL``. If the stream does not exist, this function returns + ``NULL``. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_recv.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_recv.rst new file mode 100644 index 00000000000..9d830f643ed --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_recv.rst @@ -0,0 +1,49 @@ + +nghttp2_session_mem_recv +======================== + +Synopsis +-------- + +*#include * + +.. function:: ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, size_t inlen) + + + .. warning:: + + Deprecated. Use `nghttp2_session_mem_recv2()` instead. + + Processes data *in* as an input from the remote endpoint. The + *inlen* indicates the number of bytes to receive in the *in*. + + This function behaves like `nghttp2_session_recv()` except that it + does not use :type:`nghttp2_recv_callback` to receive data; the + *in* is the only data for the invocation of this function. If all + bytes are processed, this function returns. The other callbacks + are called in the same way as they are in `nghttp2_session_recv()`. + + In the current implementation, this function always tries to + processes *inlen* bytes of input data unless either an error occurs or + :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` is returned from + :type:`nghttp2_on_header_callback` or + :type:`nghttp2_on_data_chunk_recv_callback`. If + :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` is used, the return value + includes the number of bytes which was used to produce the data or + frame for the callback. + + This function returns the number of processed bytes, or one of the + following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` + The callback function failed. + :enum:`nghttp2_error.NGHTTP2_ERR_BAD_CLIENT_MAGIC` + Invalid client magic was detected. This error only returns + when *session* was configured as server and + `nghttp2_option_set_no_recv_client_magic()` is not used with + nonzero value. + :enum:`nghttp2_error.NGHTTP2_ERR_FLOODED` + Flooding was detected in this HTTP/2 session, and it must be + closed. This is most likely caused by misbehaviour of peer. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_recv2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_recv2.rst new file mode 100644 index 00000000000..e68799a581f --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_recv2.rst @@ -0,0 +1,45 @@ + +nghttp2_session_mem_recv2 +========================= + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_ssize nghttp2_session_mem_recv2(nghttp2_session *session, const uint8_t *in, size_t inlen) + + + Processes data *in* as an input from the remote endpoint. The + *inlen* indicates the number of bytes to receive in the *in*. + + This function behaves like `nghttp2_session_recv()` except that it + does not use :type:`nghttp2_recv_callback` to receive data; the + *in* is the only data for the invocation of this function. If all + bytes are processed, this function returns. The other callbacks + are called in the same way as they are in `nghttp2_session_recv()`. + + In the current implementation, this function always tries to + processes *inlen* bytes of input data unless either an error occurs or + :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` is returned from + :type:`nghttp2_on_header_callback` or + :type:`nghttp2_on_data_chunk_recv_callback`. If + :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` is used, the return value + includes the number of bytes which was used to produce the data or + frame for the callback. + + This function returns the number of processed bytes, or one of the + following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` + The callback function failed. + :enum:`nghttp2_error.NGHTTP2_ERR_BAD_CLIENT_MAGIC` + Invalid client magic was detected. This error only returns + when *session* was configured as server and + `nghttp2_option_set_no_recv_client_magic()` is not used with + nonzero value. + :enum:`nghttp2_error.NGHTTP2_ERR_FLOODED` + Flooding was detected in this HTTP/2 session, and it must be + closed. This is most likely caused by misbehaviour of peer. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_send.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_send.rst new file mode 100644 index 00000000000..ef36a3a7d4e --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_send.rst @@ -0,0 +1,51 @@ + +nghttp2_session_mem_send +======================== + +Synopsis +-------- + +*#include * + +.. function:: ssize_t nghttp2_session_mem_send(nghttp2_session *session, const uint8_t **data_ptr) + + + .. warning:: + + Deprecated. Use `nghttp2_session_mem_send2()` instead. + + Returns the serialized data to send. + + This function behaves like `nghttp2_session_send()` except that it + does not use :type:`nghttp2_send_callback` to transmit data. + Instead, it assigns the pointer to the serialized data to the + *\*data_ptr* and returns its length. The other callbacks are called + in the same way as they are in `nghttp2_session_send()`. + + If no data is available to send, this function returns 0. + + This function may not return all serialized data in one invocation. + To get all data, call this function repeatedly until it returns 0 + or one of negative error codes. + + The assigned *\*data_ptr* is valid until the next call of + `nghttp2_session_mem_send()` or `nghttp2_session_send()`. + + The caller must send all data before sending the next chunk of + data. + + This function returns the length of the data pointed by the + *\*data_ptr* if it succeeds, or one of the following negative error + codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + + .. note:: + + This function may produce very small byte string. If that is the + case, and application disables Nagle algorithm (``TCP_NODELAY``), + then writing this small chunk leads to very small packet, and it + is very inefficient. An application should be responsible to + buffer up small chunks of data as necessary to avoid this + situation. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_send2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_send2.rst new file mode 100644 index 00000000000..04453c1f861 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_mem_send2.rst @@ -0,0 +1,47 @@ + +nghttp2_session_mem_send2 +========================= + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_ssize nghttp2_session_mem_send2(nghttp2_session *session, const uint8_t **data_ptr) + + + Returns the serialized data to send. + + This function behaves like `nghttp2_session_send()` except that it + does not use :type:`nghttp2_send_callback2` to transmit data. + Instead, it assigns the pointer to the serialized data to the + *\*data_ptr* and returns its length. The other callbacks are called + in the same way as they are in `nghttp2_session_send()`. + + If no data is available to send, this function returns 0. + + This function may not return all serialized data in one invocation. + To get all data, call this function repeatedly until it returns 0 + or one of negative error codes. + + The assigned *\*data_ptr* is valid until the next call of + `nghttp2_session_mem_send2()` or `nghttp2_session_send()`. + + The caller must send all data before sending the next chunk of + data. + + This function returns the length of the data pointed by the + *\*data_ptr* if it succeeds, or one of the following negative error + codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + + .. note:: + + This function may produce very small byte string. If that is the + case, and application disables Nagle algorithm (``TCP_NODELAY``), + then writing this small chunk leads to very small packet, and it + is very inefficient. An application should be responsible to + buffer up small chunks of data as necessary to avoid this + situation. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_recv.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_recv.rst new file mode 100644 index 00000000000..22182aaf680 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_recv.rst @@ -0,0 +1,76 @@ + +nghttp2_session_recv +==================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_recv(nghttp2_session *session) + + + Receives frames from the remote peer. + + This function receives as many frames as possible until the user + callback :type:`nghttp2_recv_callback` returns + :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. This function calls + several callback functions which are passed when initializing the + *session*. Here is the simple time chart which tells when each + callback is invoked: + + 1. :type:`nghttp2_recv_callback` is invoked one or more times to + receive frame header. + + 2. When frame header is received, + :type:`nghttp2_on_begin_frame_callback` is invoked. + + 3. If the frame is DATA frame: + + 1. :type:`nghttp2_recv_callback` is invoked to receive DATA + payload. For each chunk of data, + :type:`nghttp2_on_data_chunk_recv_callback` is invoked. + + 2. If one DATA frame is completely received, + :type:`nghttp2_on_frame_recv_callback` is invoked. If the + reception of the frame triggers the closure of the stream, + :type:`nghttp2_on_stream_close_callback` is invoked. + + 4. If the frame is the control frame: + + 1. :type:`nghttp2_recv_callback` is invoked one or more times to + receive whole frame. + + 2. If the received frame is valid, then following actions are + taken. If the frame is either HEADERS or PUSH_PROMISE, + :type:`nghttp2_on_begin_headers_callback` is invoked. Then + :type:`nghttp2_on_header_callback` is invoked for each header + name/value pair. For invalid header field, + :type:`nghttp2_on_invalid_header_callback` is called. After + all name/value pairs are emitted successfully, + :type:`nghttp2_on_frame_recv_callback` is invoked. For other + frames, :type:`nghttp2_on_frame_recv_callback` is invoked. + If the reception of the frame triggers the closure of the + stream, :type:`nghttp2_on_stream_close_callback` is invoked. + + 3. If the received frame is unpacked but is interpreted as + invalid, :type:`nghttp2_on_invalid_frame_recv_callback` is + invoked. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_EOF` + The remote peer did shutdown on the connection. + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` + The callback function failed. + :enum:`nghttp2_error.NGHTTP2_ERR_BAD_CLIENT_MAGIC` + Invalid client magic was detected. This error only returns + when *session* was configured as server and + `nghttp2_option_set_no_recv_client_magic()` is not used with + nonzero value. + :enum:`nghttp2_error.NGHTTP2_ERR_FLOODED` + Flooding was detected in this HTTP/2 session, and it must be + closed. This is most likely caused by misbehaviour of peer. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_resume_data.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_resume_data.rst new file mode 100644 index 00000000000..8b7a65aac5f --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_resume_data.rst @@ -0,0 +1,22 @@ + +nghttp2_session_resume_data +=========================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_resume_data(nghttp2_session *session, int32_t stream_id) + + + Puts back previously deferred DATA frame in the stream *stream_id* + to the outbound queue. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The stream does not exist; or no deferred data exist. + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_send.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_send.rst new file mode 100644 index 00000000000..f8ab854a26a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_send.rst @@ -0,0 +1,63 @@ + +nghttp2_session_send +==================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_send(nghttp2_session *session) + + + Sends pending frames to the remote peer. + + This function retrieves the highest prioritized frame from the + outbound queue and sends it to the remote peer. It does this as + many times as possible until the user callback + :type:`nghttp2_send_callback2` returns + :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`, the outbound queue + becomes empty or flow control is triggered (remote window size + becomes depleted or maximum number of concurrent streams is + reached). This function calls several callback functions which are + passed when initializing the *session*. Here is the simple time + chart which tells when each callback is invoked: + + 1. Get the next frame to send from outbound queue. + + 2. Prepare transmission of the frame. + + 3. If the control frame cannot be sent because some preconditions + are not met (e.g., request HEADERS cannot be sent after GOAWAY), + :type:`nghttp2_on_frame_not_send_callback` is invoked. Abort + the following steps. + + 4. If the frame is HEADERS, PUSH_PROMISE or DATA, + :type:`nghttp2_select_padding_callback` is invoked. + + 5. If the frame is request HEADERS, the stream is opened here. + + 6. :type:`nghttp2_before_frame_send_callback` is invoked. + + 7. If :enum:`nghttp2_error.NGHTTP2_ERR_CANCEL` is returned from + :type:`nghttp2_before_frame_send_callback`, the current frame + transmission is canceled, and + :type:`nghttp2_on_frame_not_send_callback` is invoked. Abort + the following steps. + + 8. :type:`nghttp2_send_callback2` is invoked one or more times to + send the frame. + + 9. :type:`nghttp2_on_frame_send_callback` is invoked. + + 10. If the transmission of the frame triggers closure of the + stream, the stream is closed and + :type:`nghttp2_on_stream_close_callback` is invoked. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` + The callback function failed. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_server_new.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_server_new.rst new file mode 100644 index 00000000000..2b0e89aee2d --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_server_new.rst @@ -0,0 +1,29 @@ + +nghttp2_session_server_new +========================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_server_new(nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, void *user_data) + + + Initializes *\*session_ptr* for server use. The all members of + *callbacks* are copied to *\*session_ptr*. Therefore *\*session_ptr* + does not store *callbacks*. The *user_data* is an arbitrary user + supplied data, which will be passed to the callback functions. + + The :type:`nghttp2_send_callback2` must be specified. If the + application code uses `nghttp2_session_recv()`, the + :type:`nghttp2_recv_callback` must be specified. The other members + of *callbacks* can be ``NULL``. + + If this function fails, *\*session_ptr* is left untouched. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_server_new2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_server_new2.rst new file mode 100644 index 00000000000..c6d19f260da --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_server_new2.rst @@ -0,0 +1,29 @@ + +nghttp2_session_server_new2 +=========================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_server_new2(nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, void *user_data, const nghttp2_option *option) + + + Like `nghttp2_session_server_new()`, but with additional options + specified in the *option*. + + The *option* can be ``NULL`` and the call is equivalent to + `nghttp2_session_server_new()`. + + This function does not take ownership *option*. The application is + responsible for freeing *option* if it finishes using the object. + + The library code does not refer to *option* after this function + returns. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_server_new3.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_server_new3.rst new file mode 100644 index 00000000000..42b28541c9b --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_server_new3.rst @@ -0,0 +1,29 @@ + +nghttp2_session_server_new3 +=========================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_server_new3( nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, void *user_data, const nghttp2_option *option, nghttp2_mem *mem) + + + Like `nghttp2_session_server_new2()`, but with additional custom + memory allocator specified in the *mem*. + + The *mem* can be ``NULL`` and the call is equivalent to + `nghttp2_session_server_new2()`. + + This function does not take ownership *mem*. The application is + responsible for freeing *mem*. + + The library code does not refer to *mem* pointer after this + function returns, so the application can safely free it. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_set_local_window_size.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_set_local_window_size.rst new file mode 100644 index 00000000000..0ac688b669f --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_set_local_window_size.rst @@ -0,0 +1,42 @@ + +nghttp2_session_set_local_window_size +===================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_set_local_window_size(nghttp2_session *session, uint8_t flags, int32_t stream_id, int32_t window_size) + + + Set local window size (local endpoints's window size) to the given + *window_size* for the given stream denoted by *stream_id*. To + change connection level window size, specify 0 to *stream_id*. To + increase window size, this function may submit WINDOW_UPDATE frame + to transmission queue. + + The *flags* is currently ignored and should be + :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. + + This sounds similar to `nghttp2_submit_window_update()`, but there + are 2 differences. The first difference is that this function + takes the absolute value of window size to set, rather than the + delta. To change the window size, this may be easier to use since + the application just declares the intended window size, rather than + calculating delta. The second difference is that + `nghttp2_submit_window_update()` affects the received bytes count + which has not acked yet. By the specification of + `nghttp2_submit_window_update()`, to strictly increase the local + window size, we have to submit delta including all received bytes + count, which might not be desirable in some cases. On the other + hand, this function does not affect the received bytes count. It + just sets the local window size to the given value. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is negative. + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_set_next_stream_id.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_set_next_stream_id.rst new file mode 100644 index 00000000000..2efffa190a1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_set_next_stream_id.rst @@ -0,0 +1,24 @@ + +nghttp2_session_set_next_stream_id +================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_set_next_stream_id(nghttp2_session *session, int32_t next_stream_id) + + + Tells the *session* that next stream ID is *next_stream_id*. The + *next_stream_id* must be equal or greater than the value returned + by `nghttp2_session_get_next_stream_id()`. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *next_stream_id* is strictly less than the value + `nghttp2_session_get_next_stream_id()` returns; or + *next_stream_id* is invalid (e.g., even integer for client, or + odd integer for server). diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_set_stream_user_data.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_set_stream_user_data.rst new file mode 100644 index 00000000000..7d0059f6eb2 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_set_stream_user_data.rst @@ -0,0 +1,26 @@ + +nghttp2_session_set_stream_user_data +==================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_set_stream_user_data(nghttp2_session *session, int32_t stream_id, void *stream_user_data) + + + Sets the *stream_user_data* to the stream denoted by the + *stream_id*. If a stream user data is already set to the stream, + it is replaced with the *stream_user_data*. It is valid to specify + ``NULL`` in the *stream_user_data*, which nullifies the associated + data pointer. + + It is valid to set the *stream_user_data* to the stream reserved by + PUSH_PROMISE frame. + + This function returns 0 if it succeeds, or one of following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The stream does not exist diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_set_user_data.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_set_user_data.rst new file mode 100644 index 00000000000..4d2b1670118 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_set_user_data.rst @@ -0,0 +1,15 @@ + +nghttp2_session_set_user_data +============================= + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_session_set_user_data(nghttp2_session *session, void *user_data) + + + Sets *user_data* to *session*, overwriting the existing user data + specified in `nghttp2_session_client_new()`, or + `nghttp2_session_server_new()`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_terminate_session.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_terminate_session.rst new file mode 100644 index 00000000000..335554111a2 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_terminate_session.rst @@ -0,0 +1,34 @@ + +nghttp2_session_terminate_session +================================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_terminate_session(nghttp2_session *session, uint32_t error_code) + + + Signals the session so that the connection should be terminated. + + The last stream ID is the minimum value between the stream ID of a + stream for which :type:`nghttp2_on_frame_recv_callback` was called + most recently and the last stream ID we have sent to the peer + previously. + + The *error_code* is the error code of this GOAWAY frame. The + pre-defined error code is one of :enum:`nghttp2_error_code`. + + After the transmission, both `nghttp2_session_want_read()` and + `nghttp2_session_want_write()` return 0. + + This function should be called when the connection should be + terminated after sending GOAWAY. If the remaining streams should + be processed after GOAWAY, use `nghttp2_submit_goaway()` instead. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_terminate_session2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_terminate_session2.rst new file mode 100644 index 00000000000..e7aa4ce1a94 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_terminate_session2.rst @@ -0,0 +1,34 @@ + +nghttp2_session_terminate_session2 +================================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_terminate_session2(nghttp2_session *session, int32_t last_stream_id, uint32_t error_code) + + + Signals the session so that the connection should be terminated. + + This function behaves like `nghttp2_session_terminate_session()`, + but the last stream ID can be specified by the application for fine + grained control of stream. The HTTP/2 specification does not allow + last_stream_id to be increased. So the actual value sent as + last_stream_id is the minimum value between the given + *last_stream_id* and the last_stream_id we have previously sent to + the peer. + + The *last_stream_id* is peer's stream ID or 0. So if *session* is + initialized as client, *last_stream_id* must be even or 0. If + *session* is initialized as server, *last_stream_id* must be odd or + 0. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *last_stream_id* is invalid. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_upgrade.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_upgrade.rst new file mode 100644 index 00000000000..545a4087f40 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_upgrade.rst @@ -0,0 +1,55 @@ + +nghttp2_session_upgrade +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_upgrade(nghttp2_session *session, const uint8_t *settings_payload, size_t settings_payloadlen, void *stream_user_data) + + + .. warning:: + + This function is deprecated in favor of + `nghttp2_session_upgrade2()`, because this function lacks the + parameter to tell the library the request method used in the + original HTTP request. This information is required for client + to validate actual response body length against content-length + header field (see `nghttp2_option_set_no_http_messaging()`). If + HEAD is used in request, the length of response body must be 0 + regardless of value included in content-length header field. + + Performs post-process of HTTP Upgrade request. This function can + be called from both client and server, but the behavior is very + different in each other. + + If called from client side, the *settings_payload* must be the + value sent in ``HTTP2-Settings`` header field and must be decoded + by base64url decoder. The *settings_payloadlen* is the length of + *settings_payload*. The *settings_payload* is unpacked and its + setting values will be submitted using `nghttp2_submit_settings()`. + This means that the client application code does not need to submit + SETTINGS by itself. The stream with stream ID=1 is opened and the + *stream_user_data* is used for its stream_user_data. The opened + stream becomes half-closed (local) state. + + If called from server side, the *settings_payload* must be the + value received in ``HTTP2-Settings`` header field and must be + decoded by base64url decoder. The *settings_payloadlen* is the + length of *settings_payload*. It is treated as if the SETTINGS + frame with that payload is received. Thus, callback functions for + the reception of SETTINGS frame will be invoked. The stream with + stream ID=1 is opened. The *stream_user_data* is ignored. The + opened stream becomes half-closed (remote). + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *settings_payload* is badly formed. + :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + The stream ID 1 is already used or closed; or is not available. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_upgrade2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_upgrade2.rst new file mode 100644 index 00000000000..faf267670e8 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_upgrade2.rst @@ -0,0 +1,47 @@ + +nghttp2_session_upgrade2 +======================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_upgrade2(nghttp2_session *session, const uint8_t *settings_payload, size_t settings_payloadlen, int head_request, void *stream_user_data) + + + Performs post-process of HTTP Upgrade request. This function can + be called from both client and server, but the behavior is very + different in each other. + + If called from client side, the *settings_payload* must be the + value sent in ``HTTP2-Settings`` header field and must be decoded + by base64url decoder. The *settings_payloadlen* is the length of + *settings_payload*. The *settings_payload* is unpacked and its + setting values will be submitted using `nghttp2_submit_settings()`. + This means that the client application code does not need to submit + SETTINGS by itself. The stream with stream ID=1 is opened and the + *stream_user_data* is used for its stream_user_data. The opened + stream becomes half-closed (local) state. + + If called from server side, the *settings_payload* must be the + value received in ``HTTP2-Settings`` header field and must be + decoded by base64url decoder. The *settings_payloadlen* is the + length of *settings_payload*. It is treated as if the SETTINGS + frame with that payload is received. Thus, callback functions for + the reception of SETTINGS frame will be invoked. The stream with + stream ID=1 is opened. The *stream_user_data* is ignored. The + opened stream becomes half-closed (remote). + + If the request method is HEAD, pass nonzero value to + *head_request*. Otherwise, pass 0. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *settings_payload* is badly formed. + :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + The stream ID 1 is already used or closed; or is not available. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_want_read.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_want_read.rst new file mode 100644 index 00000000000..4a2af49aa84 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_want_read.rst @@ -0,0 +1,18 @@ + +nghttp2_session_want_read +========================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_want_read(nghttp2_session *session) + + + Returns nonzero value if *session* wants to receive data from the + remote peer. + + If both `nghttp2_session_want_read()` and + `nghttp2_session_want_write()` return 0, the application should + drop the connection. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_session_want_write.rst b/lib/nghttp2-1.65.0/doc/nghttp2_session_want_write.rst new file mode 100644 index 00000000000..96f27fc33a9 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_session_want_write.rst @@ -0,0 +1,18 @@ + +nghttp2_session_want_write +========================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_session_want_write(nghttp2_session *session) + + + Returns nonzero value if *session* wants to send data to the remote + peer. + + If both `nghttp2_session_want_read()` and + `nghttp2_session_want_write()` return 0, the application should + drop the connection. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_set_debug_vprintf_callback.rst b/lib/nghttp2-1.65.0/doc/nghttp2_set_debug_vprintf_callback.rst new file mode 100644 index 00000000000..63fe0dd70e2 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_set_debug_vprintf_callback.rst @@ -0,0 +1,29 @@ + +nghttp2_set_debug_vprintf_callback +================================== + +Synopsis +-------- + +*#include * + +.. function:: void nghttp2_set_debug_vprintf_callback( nghttp2_debug_vprintf_callback debug_vprintf_callback) + + + Sets a debug output callback called by the library when built with + ``DEBUGBUILD`` macro defined. If this option is not used, debug + log is written into standard error output. + + For builds without ``DEBUGBUILD`` macro defined, this function is + noop. + + Note that building with ``DEBUGBUILD`` may cause significant + performance penalty to libnghttp2 because of extra processing. It + should be used for debugging purpose only. + + .. Warning:: + + Building with ``DEBUGBUILD`` may cause significant performance + penalty to libnghttp2 because of extra processing. It should be + used for debugging purpose only. We write this two times because + this is important. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_first_child.rst b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_first_child.rst new file mode 100644 index 00000000000..3d80919ec9c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_first_child.rst @@ -0,0 +1,19 @@ + +nghttp2_stream_get_first_child +============================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_stream * nghttp2_stream_get_first_child(nghttp2_stream *stream) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + This function always returns NULL. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_next_sibling.rst b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_next_sibling.rst new file mode 100644 index 00000000000..57426ab486a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_next_sibling.rst @@ -0,0 +1,19 @@ + +nghttp2_stream_get_next_sibling +=============================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_stream * nghttp2_stream_get_next_sibling(nghttp2_stream *stream) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + This function always returns NULL. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_parent.rst b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_parent.rst new file mode 100644 index 00000000000..7270e81c3b0 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_parent.rst @@ -0,0 +1,19 @@ + +nghttp2_stream_get_parent +========================= + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_stream * nghttp2_stream_get_parent(nghttp2_stream *stream) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + This function always returns NULL. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_previous_sibling.rst b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_previous_sibling.rst new file mode 100644 index 00000000000..a6523133d05 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_previous_sibling.rst @@ -0,0 +1,19 @@ + +nghttp2_stream_get_previous_sibling +=================================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_stream * nghttp2_stream_get_previous_sibling(nghttp2_stream *stream) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + This function always returns NULL. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_state.rst b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_state.rst new file mode 100644 index 00000000000..46cb1a3cae7 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_state.rst @@ -0,0 +1,15 @@ + +nghttp2_stream_get_state +======================== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_stream_proto_state nghttp2_stream_get_state(nghttp2_stream *stream) + + + Returns state of *stream*. The root stream retrieved by + `nghttp2_session_get_root_stream()` will have stream state + :enum:`nghttp2_stream_proto_state.NGHTTP2_STREAM_STATE_IDLE`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_sum_dependency_weight.rst b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_sum_dependency_weight.rst new file mode 100644 index 00000000000..4d28beff5c7 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_sum_dependency_weight.rst @@ -0,0 +1,19 @@ + +nghttp2_stream_get_sum_dependency_weight +======================================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_stream_get_sum_dependency_weight(nghttp2_stream *stream) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + This function always returns 0. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_weight.rst b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_weight.rst new file mode 100644 index 00000000000..681aa8fac81 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_stream_get_weight.rst @@ -0,0 +1,19 @@ + +nghttp2_stream_get_weight +========================= + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_stream_get_weight(nghttp2_stream *stream) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + This function always returns :macro:`NGHTTP2_DEFAULT_WEIGHT`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_strerror.rst b/lib/nghttp2-1.65.0/doc/nghttp2_strerror.rst new file mode 100644 index 00000000000..0a5ef86f0fb --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_strerror.rst @@ -0,0 +1,14 @@ + +nghttp2_strerror +================ + +Synopsis +-------- + +*#include * + +.. function:: const char *nghttp2_strerror(int lib_error_code) + + + Returns string describing the *lib_error_code*. The + *lib_error_code* must be one of the :enum:`nghttp2_error`. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_altsvc.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_altsvc.rst new file mode 100644 index 00000000000..1ad9355825a --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_altsvc.rst @@ -0,0 +1,41 @@ + +nghttp2_submit_altsvc +===================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags, int32_t stream_id, const uint8_t *origin, size_t origin_len, const uint8_t *field_value, size_t field_value_len) + + + Submits ALTSVC frame. + + ALTSVC frame is a non-critical extension to HTTP/2, and defined in + `RFC 7383 `_. + + The *flags* is currently ignored and should be + :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. + + The *origin* points to the origin this alternative service is + associated with. The *origin_len* is the length of the origin. If + *stream_id* is 0, the origin must be specified. If *stream_id* is + not zero, the origin must be empty (in other words, *origin_len* + must be 0). + + The ALTSVC frame is only usable from server side. If this function + is invoked with client side session, this function returns + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + The function is called from client side session + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The sum of *origin_len* and *field_value_len* is larger than + 16382; or *origin_len* is 0 while *stream_id* is 0; or + *origin_len* is not 0 while *stream_id* is not 0. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_data.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_data.rst new file mode 100644 index 00000000000..d43de315da6 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_data.rst @@ -0,0 +1,53 @@ + +nghttp2_submit_data +=================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_data(nghttp2_session *session, uint8_t flags, int32_t stream_id, const nghttp2_data_provider *data_prd) + + + .. warning:: + + Deprecated. Use `nghttp2_submit_data2()` instead. + + Submits one or more DATA frames to the stream *stream_id*. The + data to be sent are provided by *data_prd*. If *flags* contains + :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM`, the last DATA frame + has END_STREAM flag set. + + This function does not take ownership of the *data_prd*. The + function copies the members of the *data_prd*. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` + DATA or HEADERS has been already submitted and not fully + processed yet. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0. + :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_CLOSED` + The stream was already closed; or the *stream_id* is invalid. + + .. note:: + + Currently, only one DATA or HEADERS is allowed for a stream at a + time. Submitting these frames more than once before first DATA + or HEADERS is finished results in + :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` error code. The + earliest callback which tells that previous frame is done is + :type:`nghttp2_on_frame_send_callback`. In side that callback, + new data can be submitted using `nghttp2_submit_data()`. Of + course, all data except for last one must not have + :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM` flag set in *flags*. + This sounds a bit complicated, and we recommend to use + `nghttp2_submit_request()` and `nghttp2_submit_response()` to + avoid this cascading issue. The experience shows that for HTTP + use, these two functions are enough to implement both client and + server. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_data2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_data2.rst new file mode 100644 index 00000000000..d1342486ea5 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_data2.rst @@ -0,0 +1,49 @@ + +nghttp2_submit_data2 +==================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_data2(nghttp2_session *session, uint8_t flags, int32_t stream_id, const nghttp2_data_provider2 *data_prd) + + + Submits one or more DATA frames to the stream *stream_id*. The + data to be sent are provided by *data_prd*. If *flags* contains + :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM`, the last DATA frame + has END_STREAM flag set. + + This function does not take ownership of the *data_prd*. The + function copies the members of the *data_prd*. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` + DATA or HEADERS has been already submitted and not fully + processed yet. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0. + :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_CLOSED` + The stream was already closed; or the *stream_id* is invalid. + + .. note:: + + Currently, only one DATA or HEADERS is allowed for a stream at a + time. Submitting these frames more than once before first DATA + or HEADERS is finished results in + :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` error code. The + earliest callback which tells that previous frame is done is + :type:`nghttp2_on_frame_send_callback`. In side that callback, + new data can be submitted using `nghttp2_submit_data2()`. Of + course, all data except for last one must not have + :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM` flag set in *flags*. + This sounds a bit complicated, and we recommend to use + `nghttp2_submit_request2()` and `nghttp2_submit_response2()` to + avoid this cascading issue. The experience shows that for HTTP + use, these two functions are enough to implement both client and + server. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_extension.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_extension.rst new file mode 100644 index 00000000000..c7750ed0ac3 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_extension.rst @@ -0,0 +1,47 @@ + +nghttp2_submit_extension +======================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_extension(nghttp2_session *session, uint8_t type, uint8_t flags, int32_t stream_id, void *payload) + + + Submits extension frame. + + Application can pass arbitrary frame flags and stream ID in *flags* + and *stream_id* respectively. The *payload* is opaque pointer, and + it can be accessible though ``frame->ext.payload`` in + :type:`nghttp2_pack_extension_callback2`. The library will not own + passed *payload* pointer. + + The application must set :type:`nghttp2_pack_extension_callback2` + using `nghttp2_session_callbacks_set_pack_extension_callback2()`. + + The application should retain the memory pointed by *payload* until + the transmission of extension frame is done (which is indicated by + :type:`nghttp2_on_frame_send_callback`), or transmission fails + (which is indicated by :type:`nghttp2_on_frame_not_send_callback`). + If application does not touch this memory region after packing it + into a wire format, application can free it inside + :type:`nghttp2_pack_extension_callback2`. + + The standard HTTP/2 frame cannot be sent with this function, so + *type* must be strictly grater than 0x9. Otherwise, this function + will fail with error code + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT`. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + If :type:`nghttp2_pack_extension_callback2` is not set. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + If *type* specifies standard HTTP/2 frame type. The frame + types in the rage [0x0, 0x9], both inclusive, are standard + HTTP/2 frame type, and cannot be sent using this function. + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_goaway.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_goaway.rst new file mode 100644 index 00000000000..e7e331709eb --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_goaway.rst @@ -0,0 +1,53 @@ + +nghttp2_submit_goaway +===================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_goaway(nghttp2_session *session, uint8_t flags, int32_t last_stream_id, uint32_t error_code, const uint8_t *opaque_data, size_t opaque_data_len) + + + Submits GOAWAY frame with the last stream ID *last_stream_id* and + the error code *error_code*. + + The pre-defined error code is one of :enum:`nghttp2_error_code`. + + The *flags* is currently ignored and should be + :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. + + The *last_stream_id* is peer's stream ID or 0. So if *session* is + initialized as client, *last_stream_id* must be even or 0. If + *session* is initialized as server, *last_stream_id* must be odd or + 0. + + The HTTP/2 specification says last_stream_id must not be increased + from the value previously sent. So the actual value sent as + last_stream_id is the minimum value between the given + *last_stream_id* and the last_stream_id previously sent to the + peer. + + If the *opaque_data* is not ``NULL`` and *opaque_data_len* is not + zero, those data will be sent as additional debug data. The + library makes a copy of the memory region pointed by *opaque_data* + with the length *opaque_data_len*, so the caller does not need to + keep this memory after the return of this function. If the + *opaque_data_len* is 0, the *opaque_data* could be ``NULL``. + + After successful transmission of GOAWAY, following things happen. + All incoming streams having strictly more than *last_stream_id* are + closed. All incoming HEADERS which starts new stream are simply + ignored. After all active streams are handled, both + `nghttp2_session_want_read()` and `nghttp2_session_want_write()` + return 0 and the application can close session. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *opaque_data_len* is too large; the *last_stream_id* is + invalid. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_headers.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_headers.rst new file mode 100644 index 00000000000..da56ec61e20 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_headers.rst @@ -0,0 +1,85 @@ + +nghttp2_submit_headers +====================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_submit_headers( nghttp2_session *session, uint8_t flags, int32_t stream_id, const nghttp2_priority_spec *pri_spec, const nghttp2_nv *nva, size_t nvlen, void *stream_user_data) + + + Submits HEADERS frame. The *flags* is bitwise OR of the + following values: + + * :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM` + + If *flags* includes :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM`, + this frame has END_STREAM flag set. + + The library handles the CONTINUATION frame internally and it + correctly sets END_HEADERS to the last sequence of the PUSH_PROMISE + or CONTINUATION frame. + + If the *stream_id* is -1, this frame is assumed as request (i.e., + request HEADERS frame which opens new stream). In this case, the + assigned stream ID will be returned. Otherwise, specify stream ID + in *stream_id*. + + The *pri_spec* is ignored. + + The *nva* is an array of name/value pair :type:`nghttp2_nv` with + *nvlen* elements. The application is responsible to include + required pseudo-header fields (header field whose name starts with + ":") in *nva* and must place pseudo-headers before regular header + fields. + + This function creates copies of all name/value pairs in *nva*. It + also lower-cases all names in *nva*. The order of elements in + *nva* is preserved. For header fields with + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME` and + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, + header field name and value are not copied respectively. With + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`, application + is responsible to pass header field name in lowercase. The + application should maintain the references to them until + :type:`nghttp2_on_frame_send_callback` or + :type:`nghttp2_on_frame_not_send_callback` is called. + + The *stream_user_data* is a pointer to an arbitrary data which is + associated to the stream this frame will open. Therefore it is + only used if this frame opens streams, in other words, it changes + stream state from idle or reserved to open. + + This function is low-level in a sense that the application code can + specify flags directly. For usual HTTP request, + `nghttp2_submit_request2()` is useful. Likewise, for HTTP + response, prefer `nghttp2_submit_response2()`. + + This function returns newly assigned stream ID if it succeeds and + *stream_id* is -1. Otherwise, this function returns 0 if it + succeeds, or one of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE` + No stream ID is available because maximum stream ID was + reached. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0. + :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` + DATA or HEADERS has been already submitted and not fully + processed yet. This happens if stream denoted by *stream_id* + is in reserved state. + :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + The *stream_id* is -1, and *session* is server session. + + .. warning:: + + This function returns assigned stream ID if it succeeds and + *stream_id* is -1. But that stream is not opened yet. The + application must not submit frame to that stream ID before + :type:`nghttp2_before_frame_send_callback` is called for this + frame. + diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_origin.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_origin.rst new file mode 100644 index 00000000000..0a8db6b9084 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_origin.rst @@ -0,0 +1,35 @@ + +nghttp2_submit_origin +===================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_origin(nghttp2_session *session, uint8_t flags, const nghttp2_origin_entry *ov, size_t nov) + + + Submits ORIGIN frame. + + ORIGIN frame is a non-critical extension to HTTP/2 and defined by + `RFC 8336 `_. + + The *flags* is currently ignored and should be + :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. + + The *ov* points to the array of origins. The *nov* specifies the + number of origins included in *ov*. This function creates copies + of all elements in *ov*. + + The ORIGIN frame is only usable by a server. If this function is + invoked with client side session, this function returns + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`. + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + The function is called from client side session. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + There are too many origins, or an origin is too large to fit + into a default frame payload. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_ping.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_ping.rst new file mode 100644 index 00000000000..0317a032d82 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_ping.rst @@ -0,0 +1,33 @@ + +nghttp2_submit_ping +=================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_ping(nghttp2_session *session, uint8_t flags, const uint8_t *opaque_data) + + + Submits PING frame. You don't have to send PING back when you + received PING frame. The library automatically submits PING frame + in this case. + + The *flags* is bitwise OR of 0 or more of the following value. + + * :enum:`nghttp2_flag.NGHTTP2_FLAG_ACK` + + Unless `nghttp2_option_set_no_auto_ping_ack()` is used, the *flags* + should be :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. + + If the *opaque_data* is non ``NULL``, then it should point to the 8 + bytes array of memory to specify opaque data to send with PING + frame. If the *opaque_data* is ``NULL``, zero-cleared 8 bytes will + be sent as opaque data. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_priority.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_priority.rst new file mode 100644 index 00000000000..eafcfe70a8e --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_priority.rst @@ -0,0 +1,19 @@ + +nghttp2_submit_priority +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags, int32_t stream_id, const nghttp2_priority_spec *pri_spec) + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + This function is noop. It always returns 0. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_priority_update.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_priority_update.rst new file mode 100644 index 00000000000..76b7bf7e45c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_priority_update.rst @@ -0,0 +1,42 @@ + +nghttp2_submit_priority_update +============================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_priority_update(nghttp2_session *session, uint8_t flags, int32_t stream_id, const uint8_t *field_value, size_t field_value_len) + + + Submits PRIORITY_UPDATE frame. + + PRIORITY_UPDATE frame is a non-critical extension to HTTP/2, and + defined in :rfc:`9218#section-7.1`. + + The *flags* is currently ignored and should be + :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. + + The *stream_id* is the ID of stream which is prioritized. The + *field_value* points to the Priority field value. The + *field_value_len* is the length of the Priority field value. + + If this function is called by server, + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` is returned. + + If + :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` + of value of 0 is received by a remote endpoint (or it is omitted), + this function does nothing and returns 0. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + The function is called from server side session + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *field_value_len* is larger than 16380; or *stream_id* is + 0. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_push_promise.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_push_promise.rst new file mode 100644 index 00000000000..77cac459ca1 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_push_promise.rst @@ -0,0 +1,79 @@ + +nghttp2_submit_push_promise +=========================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_submit_push_promise( nghttp2_session *session, uint8_t flags, int32_t stream_id, const nghttp2_nv *nva, size_t nvlen, void *promised_stream_user_data) + + + Submits PUSH_PROMISE frame. + + The *flags* is currently ignored. The library handles the + CONTINUATION frame internally and it correctly sets END_HEADERS to + the last sequence of the PUSH_PROMISE or CONTINUATION frame. + + The *stream_id* must be client initiated stream ID. + + The *nva* is an array of name/value pair :type:`nghttp2_nv` with + *nvlen* elements. The application is responsible to include + required pseudo-header fields (header field whose name starts with + ":") in *nva* and must place pseudo-headers before regular header + fields. + + This function creates copies of all name/value pairs in *nva*. It + also lower-cases all names in *nva*. The order of elements in + *nva* is preserved. For header fields with + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME` and + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, + header field name and value are not copied respectively. With + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`, application + is responsible to pass header field name in lowercase. The + application should maintain the references to them until + :type:`nghttp2_on_frame_send_callback` or + :type:`nghttp2_on_frame_not_send_callback` is called. + + The *promised_stream_user_data* is a pointer to an arbitrary data + which is associated to the promised stream this frame will open and + make it in reserved state. It is available using + `nghttp2_session_get_stream_user_data()`. The application can + access it in :type:`nghttp2_before_frame_send_callback` and + :type:`nghttp2_on_frame_send_callback` of this frame. + + The client side is not allowed to use this function. + + To submit response headers and data, use + `nghttp2_submit_response2()`. + + This function returns assigned promised stream ID if it succeeds, + or one of the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + This function was invoked when *session* is initialized as + client. + :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE` + No stream ID is available because maximum stream ID was + reached. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0; The *stream_id* does not designate stream + that peer initiated. + :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_CLOSED` + The stream was already closed; or the *stream_id* is invalid. + + .. warning:: + + This function returns assigned promised stream ID if it succeeds. + As of 1.16.0, stream object for pushed resource is created when + this function succeeds. In that case, the application can submit + push response for the promised frame. + + In 1.15.0 or prior versions, pushed stream is not opened yet when + this function succeeds. The application must not submit frame to + that stream ID before :type:`nghttp2_before_frame_send_callback` + is called for this frame. + diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_request.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_request.rst new file mode 100644 index 00000000000..4d05acd8793 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_request.rst @@ -0,0 +1,75 @@ + +nghttp2_submit_request +====================== + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_submit_request( nghttp2_session *session, const nghttp2_priority_spec *pri_spec, const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider *data_prd, void *stream_user_data) + + + .. warning:: + + Deprecated. Use `nghttp2_submit_request2()` instead. + + Submits HEADERS frame and optionally one or more DATA frames. + + The *pri_spec* is ignored. + + The *nva* is an array of name/value pair :type:`nghttp2_nv` with + *nvlen* elements. The application is responsible to include + required pseudo-header fields (header field whose name starts with + ":") in *nva* and must place pseudo-headers before regular header + fields. + + This function creates copies of all name/value pairs in *nva*. It + also lower-cases all names in *nva*. The order of elements in + *nva* is preserved. For header fields with + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME` and + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, + header field name and value are not copied respectively. With + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`, application + is responsible to pass header field name in lowercase. The + application should maintain the references to them until + :type:`nghttp2_on_frame_send_callback` or + :type:`nghttp2_on_frame_not_send_callback` is called. + + HTTP/2 specification has requirement about header fields in the + request HEADERS. See the specification for more details. + + If *data_prd* is not ``NULL``, it provides data which will be sent + in subsequent DATA frames. In this case, a method that allows + request message bodies + (https://tools.ietf.org/html/rfc7231#section-4) must be specified + with ``:method`` key in *nva* (e.g. ``POST``). This function does + not take ownership of the *data_prd*. The function copies the + members of the *data_prd*. If *data_prd* is ``NULL``, HEADERS have + END_STREAM set. The *stream_user_data* is data associated to the + stream opened by this request and can be an arbitrary pointer, + which can be retrieved later by + `nghttp2_session_get_stream_user_data()`. + + This function returns assigned stream ID if it succeeds, or one of + the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE` + No stream ID is available because maximum stream ID was + reached. + :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + The *session* is server session. + + .. warning:: + + This function returns assigned stream ID if it succeeds. But + that stream is not created yet. The application must not submit + frame to that stream ID before + :type:`nghttp2_before_frame_send_callback` is called for this + frame. This means `nghttp2_session_get_stream_user_data()` does + not work before the callback. But + `nghttp2_session_set_stream_user_data()` handles this situation + specially, and it can set data to a stream during this period. + diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_request2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_request2.rst new file mode 100644 index 00000000000..07d0c159c46 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_request2.rst @@ -0,0 +1,71 @@ + +nghttp2_submit_request2 +======================= + +Synopsis +-------- + +*#include * + +.. function:: int32_t nghttp2_submit_request2( nghttp2_session *session, const nghttp2_priority_spec *pri_spec, const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider2 *data_prd, void *stream_user_data) + + + Submits HEADERS frame and optionally one or more DATA frames. + + The *pri_spec* is ignored. + + The *nva* is an array of name/value pair :type:`nghttp2_nv` with + *nvlen* elements. The application is responsible to include + required pseudo-header fields (header field whose name starts with + ":") in *nva* and must place pseudo-headers before regular header + fields. + + This function creates copies of all name/value pairs in *nva*. It + also lower-cases all names in *nva*. The order of elements in + *nva* is preserved. For header fields with + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME` and + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, + header field name and value are not copied respectively. With + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`, application + is responsible to pass header field name in lowercase. The + application should maintain the references to them until + :type:`nghttp2_on_frame_send_callback` or + :type:`nghttp2_on_frame_not_send_callback` is called. + + HTTP/2 specification has requirement about header fields in the + request HEADERS. See the specification for more details. + + If *data_prd* is not ``NULL``, it provides data which will be sent + in subsequent DATA frames. In this case, a method that allows + request message bodies + (https://tools.ietf.org/html/rfc7231#section-4) must be specified + with ``:method`` key in *nva* (e.g. ``POST``). This function does + not take ownership of the *data_prd*. The function copies the + members of the *data_prd*. If *data_prd* is ``NULL``, HEADERS have + END_STREAM set. The *stream_user_data* is data associated to the + stream opened by this request and can be an arbitrary pointer, + which can be retrieved later by + `nghttp2_session_get_stream_user_data()`. + + This function returns assigned stream ID if it succeeds, or one of + the following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE` + No stream ID is available because maximum stream ID was + reached. + :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + The *session* is server session. + + .. warning:: + + This function returns assigned stream ID if it succeeds. But + that stream is not created yet. The application must not submit + frame to that stream ID before + :type:`nghttp2_before_frame_send_callback` is called for this + frame. This means `nghttp2_session_get_stream_user_data()` does + not work before the callback. But + `nghttp2_session_set_stream_user_data()` handles this situation + specially, and it can set data to a stream during this period. + diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_response.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_response.rst new file mode 100644 index 00000000000..09197a6a11c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_response.rst @@ -0,0 +1,76 @@ + +nghttp2_submit_response +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_response(nghttp2_session *session, int32_t stream_id, const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider *data_prd) + + + .. warning:: + + Deprecated. Use `nghttp2_submit_response2()` instead. + + Submits response HEADERS frame and optionally one or more DATA + frames against the stream *stream_id*. + + The *nva* is an array of name/value pair :type:`nghttp2_nv` with + *nvlen* elements. The application is responsible to include + required pseudo-header fields (header field whose name starts with + ":") in *nva* and must place pseudo-headers before regular header + fields. + + This function creates copies of all name/value pairs in *nva*. It + also lower-cases all names in *nva*. The order of elements in + *nva* is preserved. For header fields with + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME` and + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, + header field name and value are not copied respectively. With + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`, application + is responsible to pass header field name in lowercase. The + application should maintain the references to them until + :type:`nghttp2_on_frame_send_callback` or + :type:`nghttp2_on_frame_not_send_callback` is called. + + HTTP/2 specification has requirement about header fields in the + response HEADERS. See the specification for more details. + + If *data_prd* is not ``NULL``, it provides data which will be sent + in subsequent DATA frames. This function does not take ownership + of the *data_prd*. The function copies the members of the + *data_prd*. If *data_prd* is ``NULL``, HEADERS will have + END_STREAM flag set. + + This method can be used as normal HTTP response and push response. + When pushing a resource using this function, the *session* must be + configured using `nghttp2_session_server_new()` or its variants and + the target stream denoted by the *stream_id* must be reserved using + `nghttp2_submit_push_promise()`. + + To send non-final response headers (e.g., HTTP status 101), don't + use this function because this function half-closes the outbound + stream. Instead, use `nghttp2_submit_headers()` for this purpose. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0. + :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` + DATA or HEADERS has been already submitted and not fully + processed yet. Normally, this does not happen, but when + application wrongly calls `nghttp2_submit_response()` twice, + this may happen. + :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + The *session* is client session. + + .. warning:: + + Calling this function twice for the same stream ID may lead to + program crash. It is generally considered to a programming error + to commit response twice. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_response2.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_response2.rst new file mode 100644 index 00000000000..73cd11490c3 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_response2.rst @@ -0,0 +1,72 @@ + +nghttp2_submit_response2 +======================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_response2(nghttp2_session *session, int32_t stream_id, const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider2 *data_prd) + + + Submits response HEADERS frame and optionally one or more DATA + frames against the stream *stream_id*. + + The *nva* is an array of name/value pair :type:`nghttp2_nv` with + *nvlen* elements. The application is responsible to include + required pseudo-header fields (header field whose name starts with + ":") in *nva* and must place pseudo-headers before regular header + fields. + + This function creates copies of all name/value pairs in *nva*. It + also lower-cases all names in *nva*. The order of elements in + *nva* is preserved. For header fields with + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME` and + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, + header field name and value are not copied respectively. With + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`, application + is responsible to pass header field name in lowercase. The + application should maintain the references to them until + :type:`nghttp2_on_frame_send_callback` or + :type:`nghttp2_on_frame_not_send_callback` is called. + + HTTP/2 specification has requirement about header fields in the + response HEADERS. See the specification for more details. + + If *data_prd* is not ``NULL``, it provides data which will be sent + in subsequent DATA frames. This function does not take ownership + of the *data_prd*. The function copies the members of the + *data_prd*. If *data_prd* is ``NULL``, HEADERS will have + END_STREAM flag set. + + This method can be used as normal HTTP response and push response. + When pushing a resource using this function, the *session* must be + configured using `nghttp2_session_server_new()` or its variants and + the target stream denoted by the *stream_id* must be reserved using + `nghttp2_submit_push_promise()`. + + To send non-final response headers (e.g., HTTP status 101), don't + use this function because this function half-closes the outbound + stream. Instead, use `nghttp2_submit_headers()` for this purpose. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0. + :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` + DATA or HEADERS has been already submitted and not fully + processed yet. Normally, this does not happen, but when + application wrongly calls `nghttp2_submit_response2()` twice, + this may happen. + :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + The *session* is client session. + + .. warning:: + + Calling this function twice for the same stream ID may lead to + program crash. It is generally considered to a programming error + to commit response twice. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_rst_stream.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_rst_stream.rst new file mode 100644 index 00000000000..05fc390a4f2 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_rst_stream.rst @@ -0,0 +1,27 @@ + +nghttp2_submit_rst_stream +========================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_rst_stream(nghttp2_session *session, uint8_t flags, int32_t stream_id, uint32_t error_code) + + + Submits RST_STREAM frame to cancel/reject the stream *stream_id* + with the error code *error_code*. + + The pre-defined error code is one of :enum:`nghttp2_error_code`. + + The *flags* is currently ignored and should be + :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_settings.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_settings.rst new file mode 100644 index 00000000000..88127515931 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_settings.rst @@ -0,0 +1,38 @@ + +nghttp2_submit_settings +======================= + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_settings(nghttp2_session *session, uint8_t flags, const nghttp2_settings_entry *iv, size_t niv) + + + Stores local settings and submits SETTINGS frame. The *iv* is the + pointer to the array of :type:`nghttp2_settings_entry`. The *niv* + indicates the number of :type:`nghttp2_settings_entry`. + + The *flags* is currently ignored and should be + :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. + + This function does not take ownership of the *iv*. This function + copies all the elements in the *iv*. + + While updating individual stream's local window size, if the window + size becomes strictly larger than NGHTTP2_MAX_WINDOW_SIZE, + RST_STREAM is issued against such a stream. + + SETTINGS with :enum:`nghttp2_flag.NGHTTP2_FLAG_ACK` is + automatically submitted by the library and application could not + send it at its will. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *iv* contains invalid value (e.g., initial window size + strictly greater than (1 << 31) - 1. + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_shutdown_notice.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_shutdown_notice.rst new file mode 100644 index 00000000000..b824574767e --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_shutdown_notice.rst @@ -0,0 +1,43 @@ + +nghttp2_submit_shutdown_notice +============================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_shutdown_notice(nghttp2_session *session) + + + Signals to the client that the server started graceful shutdown + procedure. + + This function is only usable for server. If this function is + called with client side session, this function returns + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`. + + To gracefully shutdown HTTP/2 session, server should call this + function to send GOAWAY with last_stream_id (1u << 31) - 1. And + after some delay (e.g., 1 RTT), send another GOAWAY with the stream + ID that the server has some processing using + `nghttp2_submit_goaway()`. See also + `nghttp2_session_get_last_proc_stream_id()`. + + Unlike `nghttp2_submit_goaway()`, this function just sends GOAWAY + and does nothing more. This is a mere indication to the client + that session shutdown is imminent. The application should call + `nghttp2_submit_goaway()` with appropriate last_stream_id after + this call. + + If one or more GOAWAY frame have been already sent by either + `nghttp2_submit_goaway()` or `nghttp2_session_terminate_session()`, + this function has no effect. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + The *session* is initialized as client. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_trailer.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_trailer.rst new file mode 100644 index 00000000000..ce60b38e600 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_trailer.rst @@ -0,0 +1,60 @@ + +nghttp2_submit_trailer +====================== + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_trailer(nghttp2_session *session, int32_t stream_id, const nghttp2_nv *nva, size_t nvlen) + + + Submits trailer fields HEADERS against the stream *stream_id*. + + The *nva* is an array of name/value pair :type:`nghttp2_nv` with + *nvlen* elements. The application must not include pseudo-header + fields (headers whose names starts with ":") in *nva*. + + This function creates copies of all name/value pairs in *nva*. It + also lower-cases all names in *nva*. The order of elements in + *nva* is preserved. For header fields with + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME` and + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, + header field name and value are not copied respectively. With + :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`, application + is responsible to pass header field name in lowercase. The + application should maintain the references to them until + :type:`nghttp2_on_frame_send_callback` or + :type:`nghttp2_on_frame_not_send_callback` is called. + + For server, trailer fields must follow response HEADERS or response + DATA without END_STREAM flat set. The library does not enforce + this requirement, and applications should do this for themselves. + If `nghttp2_submit_trailer()` is called before any response HEADERS + submission (usually by `nghttp2_submit_response2()`), the content + of *nva* will be sent as response headers, which will result in + error. + + This function has the same effect with `nghttp2_submit_headers()`, + with flags = :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM` and both + pri_spec and stream_user_data to NULL. + + To submit trailer fields after `nghttp2_submit_response2()` is + called, the application has to specify + :type:`nghttp2_data_provider2` to `nghttp2_submit_response2()`. + Inside of :type:`nghttp2_data_source_read_callback2`, when setting + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF`, also set + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_END_STREAM`. After + that, the application can send trailer fields using + `nghttp2_submit_trailer()`. `nghttp2_submit_trailer()` can be used + inside :type:`nghttp2_data_source_read_callback2`. + + This function returns 0 if it succeeds and *stream_id* is -1. + Otherwise, this function returns 0 if it succeeds, or one of the + following negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. + :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + The *stream_id* is 0. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_submit_window_update.rst b/lib/nghttp2-1.65.0/doc/nghttp2_submit_window_update.rst new file mode 100644 index 00000000000..7ded94ac30c --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_submit_window_update.rst @@ -0,0 +1,46 @@ + +nghttp2_submit_window_update +============================ + +Synopsis +-------- + +*#include * + +.. function:: int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags, int32_t stream_id, int32_t window_size_increment) + + + Submits WINDOW_UPDATE frame. + + The *flags* is currently ignored and should be + :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. + + The *stream_id* is the stream ID to send this WINDOW_UPDATE. To + send connection level WINDOW_UPDATE, specify 0 to *stream_id*. + + If the *window_size_increment* is positive, the WINDOW_UPDATE with + that value as window_size_increment is queued. If the + *window_size_increment* is larger than the received bytes from the + remote endpoint, the local window size is increased by that + difference. If the sole purpose is to increase the local window + size, consider to use `nghttp2_session_set_local_window_size()`. + + If the *window_size_increment* is negative, the local window size + is decreased by -*window_size_increment*. If automatic + WINDOW_UPDATE is enabled + (`nghttp2_option_set_no_auto_window_update()`), and the library + decided that the WINDOW_UPDATE should be submitted, then + WINDOW_UPDATE is queued with the current received bytes count. If + the sole purpose is to decrease the local window size, consider to + use `nghttp2_session_set_local_window_size()`. + + If the *window_size_increment* is 0, the function does nothing and + returns 0. + + This function returns 0 if it succeeds, or one of the following + negative error codes: + + :enum:`nghttp2_error.NGHTTP2_ERR_FLOW_CONTROL` + The local window size overflow or gets negative. + :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + Out of memory. diff --git a/lib/nghttp2-1.65.0/doc/nghttp2_version.rst b/lib/nghttp2-1.65.0/doc/nghttp2_version.rst new file mode 100644 index 00000000000..3f16c5467f6 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/nghttp2_version.rst @@ -0,0 +1,17 @@ + +nghttp2_version +=============== + +Synopsis +-------- + +*#include * + +.. function:: nghttp2_info *nghttp2_version(int least_version) + + + Returns a pointer to a nghttp2_info struct with version information + about the run-time library in use. The *least_version* argument + can be set to a 24 bit numerical value for the least accepted + version number and if the condition is not met, this function will + return a ``NULL``. Pass in 0 to skip the version checking. diff --git a/lib/nghttp2/doc/nghttp2ver.h.rst.in b/lib/nghttp2-1.65.0/doc/nghttp2ver.h.rst.in similarity index 100% rename from lib/nghttp2/doc/nghttp2ver.h.rst.in rename to lib/nghttp2-1.65.0/doc/nghttp2ver.h.rst.in diff --git a/lib/nghttp2/doc/nghttpd.1 b/lib/nghttp2-1.65.0/doc/nghttpd.1 similarity index 97% rename from lib/nghttp2/doc/nghttpd.1 rename to lib/nghttp2-1.65.0/doc/nghttpd.1 index 232757da1bb..5aeef3e637e 100644 --- a/lib/nghttp2/doc/nghttpd.1 +++ b/lib/nghttp2-1.65.0/doc/nghttpd.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "NGHTTPD" "1" "Oct 27, 2023" "1.58.0" "nghttp2" +.TH "NGHTTPD" "1" "Jan 12, 2025" "1.65.0-DEV" "nghttp2" .SH NAME nghttpd \- HTTP/2 server .SH SYNOPSIS @@ -209,11 +209,6 @@ Enable ktls. .UNINDENT .INDENT 0.0 .TP -.B \-\-no\-rfc7540\-pri -Disable RFC7540 priorities. -.UNINDENT -.INDENT 0.0 -.TP .B \-\-version Display version information and exit. .UNINDENT diff --git a/lib/nghttp2/doc/nghttpd.1.rst b/lib/nghttp2-1.65.0/doc/nghttpd.1.rst similarity index 98% rename from lib/nghttp2/doc/nghttpd.1.rst rename to lib/nghttp2-1.65.0/doc/nghttpd.1.rst index 654a0253499..9e8eacb629d 100644 --- a/lib/nghttp2/doc/nghttpd.1.rst +++ b/lib/nghttp2-1.65.0/doc/nghttpd.1.rst @@ -163,10 +163,6 @@ OPTIONS Enable ktls. -.. option:: --no-rfc7540-pri - - Disable RFC7540 priorities. - .. option:: --version Display version information and exit. diff --git a/lib/nghttp2/doc/nghttpx-howto.rst.in b/lib/nghttp2-1.65.0/doc/nghttpx-howto.rst.in similarity index 100% rename from lib/nghttp2/doc/nghttpx-howto.rst.in rename to lib/nghttp2-1.65.0/doc/nghttpx-howto.rst.in diff --git a/lib/nghttp2/doc/nghttpx.1 b/lib/nghttp2-1.65.0/doc/nghttpx.1 similarity index 97% rename from lib/nghttp2/doc/nghttpx.1 rename to lib/nghttp2-1.65.0/doc/nghttpx.1 index 1aaa47e60dc..3fe16febfab 100644 --- a/lib/nghttp2/doc/nghttpx.1 +++ b/lib/nghttp2-1.65.0/doc/nghttpx.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "NGHTTPX" "1" "Oct 27, 2023" "1.58.0" "nghttp2" +.TH "NGHTTPX" "1" "Jan 12, 2025" "1.65.0-DEV" "nghttp2" .SH NAME nghttpx \- HTTP/2 proxy .SH SYNOPSIS @@ -371,7 +371,7 @@ Default: \fBauto\fP .TP .B \-\-backend\-http\-proxy\-uri= Specify proxy URI in the form -\fI\%http:/\fP/[:@]:. If a proxy +\X'tty: link http:/'\fI\%http:/\fP\X'tty: link'/[:@]:. If a proxy requires authentication, specify and . Note that they must be properly percent\-encoded. This proxy is used when the backend connection is HTTP/2. @@ -555,27 +555,24 @@ this option will be simply ignored. .SS Timeout .INDENT 0.0 .TP -.B \-\-frontend\-http2\-read\-timeout= -Specify read timeout for HTTP/2 frontend connection. +.B \-\-frontend\-http2\-idle\-timeout= +Specify idle timeout for HTTP/2 frontend connection. If +no active streams exist for this duration, connection is +closed. .sp Default: \fB3m\fP .UNINDENT .INDENT 0.0 .TP -.B \-\-frontend\-http3\-read\-timeout= -Specify read timeout for HTTP/3 frontend connection. +.B \-\-frontend\-http3\-idle\-timeout= +Specify idle timeout for HTTP/3 frontend connection. If +no active streams exist for this duration, connection is +closed. .sp Default: \fB3m\fP .UNINDENT .INDENT 0.0 .TP -.B \-\-frontend\-read\-timeout= -Specify read timeout for HTTP/1.1 frontend connection. -.sp -Default: \fB1m\fP -.UNINDENT -.INDENT 0.0 -.TP .B \-\-frontend\-write\-timeout= Specify write timeout for all frontend connections. .sp @@ -591,6 +588,17 @@ Default: \fB1m\fP .UNINDENT .INDENT 0.0 .TP +.B \-\-frontend\-header\-timeout= +Specify duration that the server waits for an HTTP +request header fields to be received completely. On +timeout, HTTP/1 and HTTP/2 connections are closed. For +HTTP/3, the stream is shutdown, and the connection +itself is left intact. +.sp +Default: \fB1m\fP +.UNINDENT +.INDENT 0.0 +.TP .B \-\-stream\-read\-timeout= Specify read timeout for HTTP/2 streams. 0 means no timeout. @@ -783,13 +791,12 @@ available. .UNINDENT .INDENT 0.0 .TP -.B \-\-npn\-list= +.B \-\-alpn\-list= Comma delimited list of ALPN protocol identifier sorted in the order of preference. That means most desirable -protocol comes first. This is used in both ALPN and -NPN. The parameter must be delimited by a single comma -only and any white spaces are treated as a part of -protocol string. +protocol comes first. The parameter must be delimited +by a single comma only and any white spaces are treated +as a part of protocol string. .sp Default: \fBh2,h2\-16,h2\-14,http/1.1\fP .UNINDENT @@ -1050,7 +1057,7 @@ Default: \fB1s\fP .B \-\-no\-http2\-cipher\-block\-list Allow block listed cipher suite on frontend HTTP/2 connection. See -\fI\%https://tools.ietf.org/html/rfc7540#appendix\-A\fP for the +\X'tty: link https://tools.ietf.org/html/rfc7540#appendix-A'\fI\%https://tools.ietf.org/html/rfc7540#appendix\-A\fP\X'tty: link' for the complete HTTP/2 cipher suites block list. .UNINDENT .INDENT 0.0 @@ -1058,7 +1065,7 @@ complete HTTP/2 cipher suites block list. .B \-\-client\-no\-http2\-cipher\-block\-list Allow block listed cipher suite on backend HTTP/2 connection. See -\fI\%https://tools.ietf.org/html/rfc7540#appendix\-A\fP for the +\X'tty: link https://tools.ietf.org/html/rfc7540#appendix-A'\fI\%https://tools.ietf.org/html/rfc7540#appendix\-A\fP\X'tty: link' for the complete HTTP/2 cipher suites block list. .UNINDENT .INDENT 0.0 @@ -1847,12 +1854,12 @@ as QUIC keying materials. It is used to derive keys for encrypting tokens and Connection IDs. It is not used to encrypt QUIC packets. Each line of this file must contain exactly 136 bytes hex\-encoded string (when -decoded the byte string is 68 bytes long). The first 2 +decoded the byte string is 68 bytes long). The first 3 bits of decoded byte string are used to identify the keying material. An empty line or a line which starts \(aq#\(aq is ignored. The file can contain more than one -keying materials. Because the identifier is 2 bits, at -most 4 keying materials are read and the remaining data +keying materials. Because the identifier is 3 bits, at +most 8 keying materials are read and the remaining data is discarded. The first keying material in the file is primarily used for encryption and decryption for new connection. The other ones are used to decrypt data for @@ -1996,11 +2003,9 @@ request header field, do this: .INDENT 7.0 .INDENT 3.5 .sp -.nf -.ft C +.EX add\-request\-header=foo: bar -.ft P -.fi +.EE .UNINDENT .UNINDENT .sp @@ -2008,11 +2013,9 @@ instead of: .INDENT 7.0 .INDENT 3.5 .sp -.nf -.ft C +.EX add\-request\-header=\(dqfoo: bar\(dq -.ft P -.fi +.EE .UNINDENT .UNINDENT .sp @@ -2109,20 +2112,18 @@ than main process. .SH SERVER PUSH .sp nghttpx supports HTTP/2 server push in default mode with Link header -field. nghttpx looks for Link header field (\fI\%RFC 5988\fP) in response headers from +field. nghttpx looks for Link header field (\X'tty: link http://tools.ietf.org/html/rfc5988'\fI\%RFC 5988\fP\X'tty: link') in response headers from backend server and extracts URI\-reference with parameter -\fBrel=preload\fP (see \fI\%preload\fP) +\fBrel=preload\fP (see \X'tty: link http://w3c.github.io/preload/#interoperability-with-http-link-header'\fI\%preload\fP\X'tty: link') and pushes those URIs to the frontend client. Here is a sample Link header field to initiate server push: .INDENT 0.0 .INDENT 3.5 .sp -.nf -.ft C +.EX Link: ; rel=preload Link: ; rel=preload -.ft P -.fi +.EE .UNINDENT .UNINDENT .sp @@ -2157,7 +2158,7 @@ delete the socket and continues to use it. .sp OCSP query is done using external Python script \fBfetch\-ocsp\-response\fP, which has been originally developed in Perl -as part of h2o project (\fI\%https://github.com/h2o/h2o\fP), and was +as part of h2o project (\X'tty: link https://github.com/h2o/h2o'\fI\%https://github.com/h2o/h2o\fP\X'tty: link'), and was translated into Python. .sp The script file is usually installed under @@ -2217,8 +2218,7 @@ memcached is the binary format described below: .INDENT 0.0 .INDENT 3.5 .sp -.nf -.ft C +.EX +\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | VERSION (4) |LEN (2)|KEY(48 or 80) ... +\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ @@ -2226,8 +2226,7 @@ memcached is the binary format described below: | | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ (LEN, KEY) pair can be repeated -.ft P -.fi +.EE .UNINDENT .UNINDENT .sp @@ -2253,15 +2252,15 @@ automatically. To rotate key, one has to restart nghttpx (see SIGNALS). .SH CERTIFICATE TRANSPARENCY .sp -nghttpx supports TLS \fBsigned_certificate_timestamp\fP extension (\fI\%RFC -6962\fP). The relevant options +nghttpx supports TLS \fBsigned_certificate_timestamp\fP extension (\X'tty: link https://tools.ietf.org/html/rfc6962'\fI\%RFC +6962\fP\X'tty: link'). The relevant options are \fI\%\-\-tls\-sct\-dir\fP and \fBsct\-dir\fP parameter in \fI\%\-\-subcert\fP\&. They takes a directory, and nghttpx reads all files whose extension is \fB\&.sct\fP under the directory. The \fB*.sct\fP files are encoded as \fBSignedCertificateTimestamp\fP struct described -in \fI\%section 3.2 of RFC 69662\fP\&. This format is -the same one used by \fI\%nginx\-ct\fP and \fI\%mod_ssl_ct\fP\&. -\fI\%ct\-submit\fP can be +in \X'tty: link https://tools.ietf.org/html/rfc6962#section-3.2'\fI\%section 3.2 of RFC 69662\fP\X'tty: link'\&. This format is +the same one used by \X'tty: link https://github.com/grahamedgecombe/nginx-ct'\fI\%nginx\-ct\fP\X'tty: link' and \X'tty: link https://httpd.apache.org/docs/trunk/mod/mod_ssl_ct.html'\fI\%mod_ssl_ct\fP\X'tty: link'\&. +\X'tty: link https://github.com/grahamedgecombe/ct-submit'\fI\%ct\-submit\fP\X'tty: link' can be used to submit certificates to log servers, and obtain the \fBSignedCertificateTimestamp\fP struct which can be used with nghttpx. .SH MRUBY SCRIPTING @@ -2505,7 +2504,7 @@ On assignment, copy of given value is assigned. The path does not include authority component of URI. This may include query component. nghttpx makes certain normalization for path. It decodes percent\-encoding for unreserved characters -(see \fI\%https://tools.ietf.org/html/rfc3986#section\-2.3\fP), and +(see \X'tty: link https://tools.ietf.org/html/rfc3986#section-2.3'\fI\%https://tools.ietf.org/html/rfc3986#section\-2.3\fP\X'tty: link'), and resolves \(dq..\(dq and \(dq.\(dq. But it may leave characters which should be percent\-encoded as is. So be careful when comparing path against desired string. @@ -2644,8 +2643,7 @@ Modify request path: .INDENT 0.0 .INDENT 3.5 .sp -.nf -.ft C +.EX class App def on_req(env) env.req.path = \(dq/apps#{env.req.path}\(dq @@ -2653,8 +2651,7 @@ class App end App.new -.ft P -.fi +.EE .UNINDENT .UNINDENT .sp @@ -2665,8 +2662,7 @@ addresses: .INDENT 0.0 .INDENT 3.5 .sp -.nf -.ft C +.EX class App def on_req(env) allowed_clients = [\(dq127.0.0.1\(dq, \(dq::1\(dq] @@ -2680,8 +2676,7 @@ class App end App.new -.ft P -.fi +.EE .UNINDENT .UNINDENT .SH API ENDPOINTS diff --git a/lib/nghttp2/doc/nghttpx.1.rst b/lib/nghttp2-1.65.0/doc/nghttpx.1.rst similarity index 98% rename from lib/nghttp2/doc/nghttpx.1.rst rename to lib/nghttp2-1.65.0/doc/nghttpx.1.rst index b70b163233e..cee23f2a110 100644 --- a/lib/nghttp2/doc/nghttpx.1.rst +++ b/lib/nghttp2-1.65.0/doc/nghttpx.1.rst @@ -522,24 +522,22 @@ Performance Timeout ~~~~~~~ -.. option:: --frontend-http2-read-timeout= +.. option:: --frontend-http2-idle-timeout= - Specify read timeout for HTTP/2 frontend connection. + Specify idle timeout for HTTP/2 frontend connection. If + no active streams exist for this duration, connection is + closed. Default: ``3m`` -.. option:: --frontend-http3-read-timeout= +.. option:: --frontend-http3-idle-timeout= - Specify read timeout for HTTP/3 frontend connection. + Specify idle timeout for HTTP/3 frontend connection. If + no active streams exist for this duration, connection is + closed. Default: ``3m`` -.. option:: --frontend-read-timeout= - - Specify read timeout for HTTP/1.1 frontend connection. - - Default: ``1m`` - .. option:: --frontend-write-timeout= Specify write timeout for all frontend connections. @@ -553,6 +551,16 @@ Timeout Default: ``1m`` +.. option:: --frontend-header-timeout= + + Specify duration that the server waits for an HTTP + request header fields to be received completely. On + timeout, HTTP/1 and HTTP/2 connections are closed. For + HTTP/3, the stream is shutdown, and the connection + itself is left intact. + + Default: ``1m`` + .. option:: --stream-read-timeout= Specify read timeout for HTTP/2 streams. 0 means no @@ -728,14 +736,13 @@ SSL/TLS Without this option, DHE cipher suites are not available. -.. option:: --npn-list= +.. option:: --alpn-list= Comma delimited list of ALPN protocol identifier sorted in the order of preference. That means most desirable - protocol comes first. This is used in both ALPN and - NPN. The parameter must be delimited by a single comma - only and any white spaces are treated as a part of - protocol string. + protocol comes first. The parameter must be delimited + by a single comma only and any white spaces are treated + as a part of protocol string. Default: ``h2,h2-16,h2-14,http/1.1`` @@ -1687,12 +1694,12 @@ HTTP/3 and QUIC encrypting tokens and Connection IDs. It is not used to encrypt QUIC packets. Each line of this file must contain exactly 136 bytes hex-encoded string (when - decoded the byte string is 68 bytes long). The first 2 + decoded the byte string is 68 bytes long). The first 3 bits of decoded byte string are used to identify the keying material. An empty line or a line which starts '#' is ignored. The file can contain more than one - keying materials. Because the identifier is 2 bits, at - most 4 keying materials are read and the remaining data + keying materials. Because the identifier is 3 bits, at + most 8 keying materials are read and the remaining data is discarded. The first keying material in the file is primarily used for encryption and decryption for new connection. The other ones are used to decrypt data for diff --git a/lib/nghttp2/doc/package_README.rst.in b/lib/nghttp2-1.65.0/doc/package_README.rst.in similarity index 100% rename from lib/nghttp2/doc/package_README.rst.in rename to lib/nghttp2-1.65.0/doc/package_README.rst.in diff --git a/lib/nghttp2/doc/programmers-guide.rst b/lib/nghttp2-1.65.0/doc/programmers-guide.rst similarity index 85% rename from lib/nghttp2/doc/programmers-guide.rst rename to lib/nghttp2-1.65.0/doc/programmers-guide.rst index 820cd204951..5b93b08652e 100644 --- a/lib/nghttp2/doc/programmers-guide.rst +++ b/lib/nghttp2-1.65.0/doc/programmers-guide.rst @@ -40,28 +40,28 @@ most event-based architecture applications use is single thread per core, and handling one connection I/O is done by single thread. To feed input to :type:`nghttp2_session` object, one can use -`nghttp2_session_recv()` or `nghttp2_session_mem_recv()` functions. +`nghttp2_session_recv()` or `nghttp2_session_mem_recv2()` functions. They behave similarly, and the difference is that `nghttp2_session_recv()` will use :type:`nghttp2_read_callback` to get -input. On the other hand, `nghttp2_session_mem_recv()` will take -input as its parameter. If in doubt, use `nghttp2_session_mem_recv()` -since it is simpler, and could be faster since it avoids calling -callback function. +input. On the other hand, `nghttp2_session_mem_recv2()` will take +input as its parameter. If in doubt, use +`nghttp2_session_mem_recv2()` since it is simpler, and could be faster +since it avoids calling callback function. To get output from :type:`nghttp2_session` object, one can use -`nghttp2_session_send()` or `nghttp2_session_mem_send()`. The +`nghttp2_session_send()` or `nghttp2_session_mem_send2()`. The difference between them is that the former uses :type:`nghttp2_send_callback` to pass output to an application. On the other hand, the latter returns the output to the caller. If in -doubt, use `nghttp2_session_mem_send()` since it is simpler. But +doubt, use `nghttp2_session_mem_send2()` since it is simpler. But `nghttp2_session_send()` might be easier to use if the output buffer an application has is fixed sized. -In general, an application should call `nghttp2_session_mem_send()` +In general, an application should call `nghttp2_session_mem_send2()` when it gets input from underlying connection. Since there is great chance to get something pushed into transmission queue while the call -of `nghttp2_session_mem_send()`, it is recommended to call -`nghttp2_session_mem_recv()` after `nghttp2_session_mem_send()`. +of `nghttp2_session_mem_send2()`, it is recommended to call +`nghttp2_session_mem_recv2()` after `nghttp2_session_mem_send2()`. There is a question when we are safe to close HTTP/2 session without waiting for the closure of underlying connection. We offer 2 API @@ -70,7 +70,7 @@ calls for this: `nghttp2_session_want_read()` and can destroy :type:`nghttp2_session`, and then close the underlying connection. But make sure that the buffered output has been transmitted to the peer before closing the connection when -`nghttp2_session_mem_send()` is used, since +`nghttp2_session_mem_send2()` is used, since `nghttp2_session_want_write()` does not take into account the transmission of the buffered data outside of :type:`nghttp2_session`. @@ -87,18 +87,18 @@ The header files are also available online: :doc:`nghttp2.h` and Remarks ------- -Do not call `nghttp2_session_send()`, `nghttp2_session_mem_send()`, -`nghttp2_session_recv()` or `nghttp2_session_mem_recv()` from the +Do not call `nghttp2_session_send()`, `nghttp2_session_mem_send2()`, +`nghttp2_session_recv()` or `nghttp2_session_mem_recv2()` from the nghttp2 callback functions directly or indirectly. It will lead to the crash. You can submit requests or frames in the callbacks then call these functions outside the callbacks. -`nghttp2_session_send()` and `nghttp2_session_mem_send()` send first +`nghttp2_session_send()` and `nghttp2_session_mem_send2()` send first 24 bytes of client magic string (MAGIC) (:macro:`NGHTTP2_CLIENT_MAGIC`) on client configuration. The applications are responsible to send SETTINGS frame as part of connection preface using `nghttp2_submit_settings()`. Similarly, -`nghttp2_session_recv()` and `nghttp2_session_mem_recv()` consume +`nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` consume MAGIC on server configuration unless `nghttp2_option_set_no_recv_client_magic()` is used with nonzero option value. @@ -222,7 +222,7 @@ above, the following code does not work: .. code-block:: c - nghttp2_submit_response(...) + nghttp2_submit_response2(...) nghttp2_submit_rst_stream(...) RST_STREAM cancels HEADERS (and DATA), and just RST_STREAM is sent. @@ -258,9 +258,9 @@ For example, we will illustrate how to send `ALTSVC const char *field; } alt_svc; - ssize_t pack_extension_callback(nghttp2_session *session, uint8_t *buf, - size_t len, const nghttp2_frame *frame, - void *user_data) { + nghttp2_ssize pack_extension_callback(nghttp2_session *session, uint8_t *buf, + size_t len, const nghttp2_frame *frame, + void *user_data) { const alt_svc *altsvc = (const alt_svc *)frame->ext.payload; size_t originlen = strlen(altsvc->origin); size_t fieldlen = strlen(altsvc->field); @@ -482,45 +482,26 @@ be called as usual. Stream priorities ----------------- -By default, the stream prioritization scheme described in :rfc:`7540` -is used. This scheme has been formally deprecated by :rfc:`9113`. In -order to disable it, send +The stream prioritization scheme described in :rfc:`7540`, which has +been formally deprecated by :rfc:`9113`, has been removed. An +application is advised to send :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` of -value of 1 via `nghttp2_submit_settings()`. This settings ID is -defined by :rfc:`9218`. The sender of this settings value disables -RFC 7540 priorities, and instead it enables RFC 9218 Extensible -Prioritization Scheme. This new prioritization scheme has 2 methods -to convey the stream priorities to a remote endpoint: Priority header -field and PRIORITY_UPDATE frame. nghttp2 supports both methods. In -order to receive and process PRIORITY_UPDATE frame, server has to call -``nghttp2_option_set_builtin_recv_extension_type(option, -NGHTTP2_PRIORITY_UPDATE)`` (see the above section), and pass the -option to `nghttp2_session_server_new2()` or +value of 1 via `nghttp2_submit_settings()`, and migrate to +:rfc:`9218`. + +The sender of this settings value disables :rfc:`7540` priorities, and +instead it enables :rfc:`9218` Extensible Prioritization Scheme. This +new prioritization scheme has 2 methods to convey the stream +priorities to a remote endpoint: Priority header field and +PRIORITY_UPDATE frame. nghttp2 supports both methods. In order to +receive and process PRIORITY_UPDATE frame, server has to call +`nghttp2_option_set_builtin_recv_extension_type()` with +NGHTTP2_PRIORITY_UPDATE as type argument (see the above section), and +pass the option to `nghttp2_session_server_new2()` or `nghttp2_session_server_new3()` to create a server session. Client -can send Priority header field via `nghttp2_submit_request()`. It can -also send PRIORITY_UPDATE frame via +can send Priority header field via `nghttp2_submit_request2()`. It +can also send PRIORITY_UPDATE frame via `nghttp2_submit_priority_update()`. Server processes Priority header field in a request header field and updates the stream priority unless HTTP messaging rule enforcement is disabled (see `nghttp2_option_set_no_http_messaging()`). - -For the purpose of smooth migration from RFC 7540 priorities, client -is advised to send -:enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` of -value of 1. Until it receives the first server SETTINGS frame, it can -send both RFC 7540 and RFC 9128 priority signals. If client receives -SETTINGS_NO_RFC7540_PRIORITIES of value of 0, or it is omitted , -client stops sending PRIORITY_UPDATE frame. Priority header field -will be sent in anyway since it is an end-to-end signal. If -SETTINGS_NO_RFC7540_PRIORITIES of value of 1 is received, client stops -sending RFC 7540 priority signals. This is the advice described in -:rfc:`9218#section-2.1.1`. - -Server has an optional mechanism to fallback to RFC 7540 priorities. -By default, if server sends SETTINGS_NO_RFC7540_PRIORITIES of value of -1, it completely disables RFC 7540 priorities and no fallback. By -setting nonzero value to -`nghttp2_option_set_server_fallback_rfc7540_priorities()`, server -falls back to RFC 7540 priorities if it sends -SETTINGS_NO_RFC7540_PRIORITIES value of value of 1, and client omits -SETTINGS_NO_RFC7540_PRIORITIES in its SETTINGS frame. diff --git a/lib/nghttp2-1.65.0/doc/sources/building-android-binary.rst b/lib/nghttp2-1.65.0/doc/sources/building-android-binary.rst new file mode 100644 index 00000000000..339ac44f6ee --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/sources/building-android-binary.rst @@ -0,0 +1,127 @@ +Building Android binary +======================= + +In this article, we briefly describe how to build Android binary using +`Android NDK `_ cross-compiler on +Debian Linux. + +The easiest way to build android binary is use Dockerfile.android. +See Dockerfile.android for more details. If you cannot use +Dockerfile.android for whatever reason, continue to read the rest of +this article. + +We offer ``android-config`` script to make the build easier. To make +the script work, NDK directory must be set to ``NDK`` environment +variable. NDK directory is the directory where NDK is unpacked: + +.. code-block:: text + + $ unzip android-ndk-$NDK_VERSION-linux.zip + $ cd android-ndk-$NDK_VERSION + $ export NDK=$PWD + +The dependent libraries, such as OpenSSL, libev, and c-ares should be +built with the same NDK toolchain and installed under +``$NDK/usr/local``. We recommend to build these libraries as static +library to make the deployment easier. libxml2 support is currently +disabled. + +Although zlib comes with Android NDK, it seems not to be a part of +public API, so we have to built it for our own. That also provides us +proper .pc file as a bonus. + +Before running ``android-config``, ``NDK`` environment variable must +be set to point to the correct path. + +You need to set ``NGHTTP2`` environment variable to the absolute path +to the source directory of nghttp2. + +To configure OpenSSL, use the following script: + +.. code-block:: sh + + #!/bin/sh + + . $NGHTTP2/android-env + + export ANDROID_NDK_HOME=$NDK + export PATH=$TOOLCHAIN/bin:$PATH + + ./Configure no-shared --prefix=$PREFIX android-arm64 + +And run the following script to build and install without +documentation: + +.. code-block:: sh + + #!/bin/sh + + . $NGHTTP2/android-env + + export PATH=$TOOLCHAIN/bin:$PATH + + make install_sw + +To configure libev, use the following script: + +.. code-block:: sh + + #!/bin/sh + + . $NGHTTP2/android-env + + ./configure \ + --host=$TARGET \ + --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ + --prefix=$PREFIX \ + --disable-shared \ + --enable-static \ + CPPFLAGS=-I$PREFIX/include \ + LDFLAGS=-L$PREFIX/lib + +And run ``make install`` to build and install. + +To configure c-ares, use the following script: + +.. code-block:: sh + + #!/bin/sh -e + + . $NGHTTP2/android-env + + ./configure \ + --host=$TARGET \ + --build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \ + --prefix=$PREFIX \ + --disable-shared + +And run ``make install`` to build and install. + +To configure zlib, use the following script: + +.. code-block:: sh + + #!/bin/sh -e + + . $NGHTTP2/android-env + + export HOST=$TARGET + + ./configure \ + --prefix=$PREFIX \ + --libdir=$PREFIX/lib \ + --includedir=$PREFIX/include \ + --static + +And run ``make install`` to build and install. + +After prerequisite libraries are prepared, run ``android-config`` and +then ``make`` to compile nghttp2 source files. + +If all went well, application binaries, such as nghttpx, are created +under src directory. Strip debugging information from the binary +using the following command: + +.. code-block:: text + + $ $NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip src/nghttpx diff --git a/lib/nghttp2-1.65.0/doc/sources/contribute.rst b/lib/nghttp2-1.65.0/doc/sources/contribute.rst new file mode 100644 index 00000000000..ce8fcc01a3e --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/sources/contribute.rst @@ -0,0 +1,56 @@ +Contribution Guidelines +======================= + +[This text was composed based on 1.2. License section of curl/libcurl +project.] + +When contributing with code, you agree to put your changes and new +code under the same license nghttp2 is already using unless stated and +agreed otherwise. + +When changing existing source code, you do not alter the copyright of +the original file(s). The copyright will still be owned by the +original creator(s) or those who have been assigned copyright by the +original author(s). + +By submitting a patch to the nghttp2 project, you are assumed to have +the right to the code and to be allowed by your employer or whatever +to hand over that patch/code to us. We will credit you for your +changes as far as possible, to give credit but also to keep a trace +back to who made what changes. Please always provide us with your +full real name when contributing! + +Coding style +------------ + +We use clang-format to format source code consistently. The +clang-format configuration file .clang-format is located at the root +directory. Since clang-format produces slightly different results +between versions, we currently use clang-format-18. + +To detect any violation to the coding style, we recommend to setup git +pre-commit hook to check coding style of the changes you introduced. +The pre-commit file is located at the root directory. Copy it under +.git/hooks and make sure that it is executable. The pre-commit script +uses clang-format-diff.py to detect any style errors. If it is not in +your PATH or it exists under different name (e.g., +clang-format-diff-18 in debian), either add it to PATH variable or add +git option ``clangformatdiff.binary`` to point to the script. + +For emacs users, integrating clang-format to emacs is very easy. +clang-format.el should come with clang distribution. If it is not +found, download it from `here +`_. +And add these lines to your .emacs file: + +.. code-block:: lisp + + ;; From + ;; https://code.google.com/p/chromium/wiki/Emacs#Use_Google's_C++_style! + (load "//clang-format.el") + (add-hook 'c-mode-common-hook + (function (lambda () (local-set-key (kbd "TAB") + 'clang-format-region)))) + +You can find other editor integration in +http://clang.llvm.org/docs/ClangFormat.html. diff --git a/lib/nghttp2-1.65.0/doc/sources/h2load-howto.rst b/lib/nghttp2-1.65.0/doc/sources/h2load-howto.rst new file mode 100644 index 00000000000..879a0eb1503 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/sources/h2load-howto.rst @@ -0,0 +1,142 @@ +.. program:: h2load + +h2load - HTTP/2 benchmarking tool - HOW-TO +========================================== + +:doc:`h2load.1` is benchmarking tool for HTTP/2 and HTTP/1.1. It +supports SSL/TLS and clear text for all supported protocols. + +Compiling from source +--------------------- + +h2load is compiled alongside nghttp2 and requires that the +``--enable-app`` flag is passed to ``./configure`` and `required +dependencies `_ are +available during compilation. For details on compiling, see `nghttp2: +Building from Git +`_. + +Basic Usage +----------- + +In order to set benchmark settings, specify following 3 options. + +:option:`-n` + The number of total requests. Default: 1 + +:option:`-c` + The number of concurrent clients. Default: 1 + +:option:`-m` + The max concurrent streams to issue per client. Default: 1 + +For SSL/TLS connection, the protocol will be negotiated via ALPN. You +can set specific protocols in :option:`--alpn-list` option. For +cleartext connection, the default protocol is HTTP/2. To change the +protocol in cleartext connection, use :option:`--no-tls-proto` option. +For convenience, :option:`--h1` option forces HTTP/1.1 for both +cleartext and SSL/TLS connections. + +Here is a command-line to perform benchmark to URI \https://localhost +using total 100000 requests, 100 concurrent clients and 10 max +concurrent streams: + +.. code-block:: text + + $ h2load -n100000 -c100 -m10 https://localhost + +The benchmarking result looks like this: + +.. code-block:: text + + finished in 7.08s, 141164.80 req/s, 555.33MB/s + requests: 1000000 total, 1000000 started, 1000000 done, 1000000 succeeded, 0 failed, 0 errored, 0 timeout + status codes: 1000000 2xx, 0 3xx, 0 4xx, 0 5xx + traffic: 4125025824 bytes total, 11023424 bytes headers (space savings 93.07%), 4096000000 bytes data + min max mean sd +/- sd + time for request: 15.31ms 146.85ms 69.78ms 9.26ms 92.43% + time for connect: 1.08ms 25.04ms 10.71ms 9.80ms 64.00% + time to 1st byte: 25.36ms 184.96ms 79.11ms 53.97ms 78.00% + req/s (client) : 1412.04 1447.84 1426.52 10.57 63.00% + +See the h2load manual page :ref:`h2load-1-output` section for the +explanation of the above numbers. + +Timing-based load-testing +------------------------- + +As of v1.26.0, h2load supports timing-based load-testing. This method +performs load-testing in terms of a given duration instead of a +pre-defined number of requests. The new option :option:`--duration` +specifies how long the load-testing takes. For example, +``--duration=10`` makes h2load perform load-testing against a server +for 10 seconds. You can also specify a “warming-up” period with +:option:`--warm-up-time`. If :option:`--duration` is used, +:option:`-n` option is ignored. + +The following command performs load-testing for 10 seconds after 5 +seconds warming up period: + +.. code-block:: text + + $ h2load -c100 -m100 --duration=10 --warm-up-time=5 https://localhost + +Flow Control +------------ + +HTTP/2 has flow control and it may affect benchmarking results. By +default, h2load uses large enough flow control window, which +effectively disables flow control. To adjust receiver flow control +window size, there are following options: + +:option:`-w` + Sets the stream level initial window size to + (2**)-1. + +:option:`-W` + Sets the connection level initial window size to + (2**)-1. + +Multi-Threading +--------------- + +Sometimes benchmarking client itself becomes a bottleneck. To remedy +this situation, use :option:`-t` option to specify the number of native +thread to use. + +:option:`-t` + The number of native threads. Default: 1 + +Selecting protocol for clear text +--------------------------------- + +By default, if \http:// URI is given, HTTP/2 protocol is used. To +change the protocol to use for clear text, use :option:`-p` option. + +Multiple URIs +------------- + +If multiple URIs are specified, they are used in round robin manner. + +.. note:: + + Please note that h2load uses scheme, host and port in the first URI + and ignores those parts in the rest of the URIs. + +UNIX domain socket +------------------ + +To request against UNIX domain socket, use :option:`--base-uri`, and +specify ``unix:`` followed by the path to UNIX domain socket. For +example, if UNIX domain socket is ``/tmp/nghttpx.sock``, use +``--base-uri=unix:/tmp/nghttpx.sock``. h2load uses scheme, host and +port in the first URI in command-line or input file. + +HTTP/3 +------ + +h2load supports HTTP/3 if it is built with HTTP/3 enabled. HTTP/3 +support is experimental. + +In order to send HTTP/3 request, specify ``h3`` to +:option:`--alpn-list`. diff --git a/lib/nghttp2-1.65.0/doc/sources/index.rst b/lib/nghttp2-1.65.0/doc/sources/index.rst new file mode 100644 index 00000000000..e181645d3de --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/sources/index.rst @@ -0,0 +1,49 @@ +.. nghttp2 documentation main file, created by + sphinx-quickstart on Sun Mar 11 22:57:49 2012. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +nghttp2 - HTTP/2 C Library +============================ + +This is an implementation of Hypertext Transfer Protocol version 2. + +The project is hosted at `github.com/nghttp2/nghttp2 +`_. + +Contents: + +.. toctree:: + :maxdepth: 2 + + package_README + contribute + building-android-binary + tutorial-client + tutorial-server + tutorial-hpack + nghttp.1 + nghttpd.1 + nghttpx.1 + h2load.1 + nghttpx-howto + h2load-howto + programmers-guide + apiref + nghttp2.h + nghttp2ver.h + Source + Issues + nghttp2.org + +Released Versions +================= + +https://github.com/nghttp2/nghttp2/releases + +Resources +--------- + +* HTTP/2 https://tools.ietf.org/html/rfc7540 +* HPACK https://tools.ietf.org/html/rfc7541 +* HTTP Alternative Services https://tools.ietf.org/html/rfc7838 diff --git a/lib/nghttp2-1.65.0/doc/sources/nghttpx-howto.rst b/lib/nghttp2-1.65.0/doc/sources/nghttpx-howto.rst new file mode 100644 index 00000000000..6f8a71f6cb9 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/sources/nghttpx-howto.rst @@ -0,0 +1,642 @@ +.. program:: nghttpx + +nghttpx - HTTP/2 proxy - HOW-TO +=============================== + +:doc:`nghttpx.1` is a proxy translating protocols between HTTP/2 and +other protocols (e.g., HTTP/1). It operates in several modes and each +mode may require additional programs to work with. This article +describes each operation mode and explains the intended use-cases. It +also covers some useful options later. + +Default mode +------------ + +If nghttpx is invoked without :option:`--http2-proxy`, it operates in +default mode. In this mode, it works as reverse proxy (gateway) for +HTTP/3, HTTP/2 and HTTP/1 clients to backend servers. This is also +known as "HTTP/2 router". + +By default, frontend connection is encrypted using SSL/TLS. So +server's private key and certificate must be supplied to the command +line (or through configuration file). In this case, the frontend +protocol selection will be done via ALPN. + +To turn off encryption on frontend connection, use ``no-tls`` keyword +in :option:`--frontend` option. HTTP/2 and HTTP/1 are available on +the frontend, and an HTTP/1 connection can be upgraded to HTTP/2 using +HTTP Upgrade. Starting HTTP/2 connection by sending HTTP/2 connection +preface is also supported. + +In order to receive HTTP/3 traffic, use ``quic`` parameter in +:option:`--frontend` option (.e.g, ``--frontend='*,443;quic'``) + +nghttpx can listen on multiple frontend addresses. This is achieved +by using multiple :option:`--frontend` options. For each frontend +address, TLS can be enabled or disabled. + +By default, backend connections are not encrypted. To enable TLS +encryption on backend connections, use ``tls`` keyword in +:option:`--backend` option. Using patterns and ``proto`` keyword in +:option:`--backend` option, backend application protocol can be +specified per host/request path pattern. It means that you can use +both HTTP/2 and HTTP/1 in backend connections at the same time. Note +that default backend protocol is HTTP/1.1. To use HTTP/2 in backend, +you have to specify ``h2`` in ``proto`` keyword in :option:`--backend` +explicitly. + +The backend is supposed to be a Web server. For example, to make +nghttpx listen to encrypted HTTP/2 requests at port 8443, and a +backend Web server is configured to listen to HTTP requests at port +8080 on the same host, run nghttpx command-line like this: + +.. code-block:: text + + $ nghttpx -f0.0.0.0,8443 -b127.0.0.1,8080 /path/to/server.key /path/to/server.crt + +Then an HTTP/2 enabled client can access the nghttpx server using HTTP/2. For +example, you can send a GET request using nghttp: + +.. code-block:: text + + $ nghttp -nv https://localhost:8443/ + +HTTP/2 proxy mode +----------------- + +If nghttpx is invoked with :option:`--http2-proxy` (or its shorthand +:option:`-s`) option, it operates in HTTP/2 proxy mode. The supported +protocols in frontend and backend connections are the same as in `default +mode`_. The difference is that this mode acts like a forward proxy and +assumes the backend is an HTTP proxy server (e.g., Squid, Apache Traffic +Server). HTTP/1 requests must include an absolute URI in request line. + +By default, the frontend connection is encrypted. So this mode is +also called secure proxy. + +To turn off encryption on the frontend connection, use ``no-tls`` keyword +in :option:`--frontend` option. + +The backend must be an HTTP proxy server. nghttpx supports multiple +backend server addresses. It translates incoming requests to HTTP +request to backend server. The backend server performs real proxy +work for each request, for example, dispatching requests to the origin +server and caching contents. + +The backend connection is not encrypted by default. To enable +encryption, use ``tls`` keyword in :option:`--backend` option. The +default backend protocol is HTTP/1.1. To use HTTP/2 in backend +connection, use :option:`--backend` option, and specify ``h2`` in +``proto`` keyword explicitly. + +For example, to make nghttpx listen to encrypted HTTP/2 requests at +port 8443, and a backend HTTP proxy server is configured to listen to +HTTP/1 requests at port 8080 on the same host, run nghttpx command-line +like this: + +.. code-block:: text + + $ nghttpx -s -f'*,8443' -b127.0.0.1,8080 /path/to/server.key /path/to/server.crt + +At the time of this writing, Firefox 41 and Chromium v46 can use +nghttpx as HTTP/2 proxy. + +To make Firefox or Chromium use nghttpx as HTTP/2 proxy, user has to +create proxy.pac script file like this: + +.. code-block:: javascript + + function FindProxyForURL(url, host) { + return "HTTPS SERVERADDR:PORT"; + } + +``SERVERADDR`` and ``PORT`` is the hostname/address and port of the +machine nghttpx is running. Please note that both Firefox and +Chromium require valid certificate for secure proxy. + +For Firefox, open Preference window and select Advanced then click +Network tab. Clicking Connection Settings button will show the +dialog. Select "Automatic proxy configuration URL" and enter the path +to proxy.pac file, something like this: + +.. code-block:: text + + file:///path/to/proxy.pac + +For Chromium, use following command-line: + +.. code-block:: text + + $ google-chrome --proxy-pac-url=file:///path/to/proxy.pac --use-npn + +As HTTP/1 proxy server, Squid may work as out-of-box. Traffic server +requires to be configured as forward proxy. Here is the minimum +configuration items to edit: + +.. code-block:: text + + CONFIG proxy.config.reverse_proxy.enabled INT 0 + CONFIG proxy.config.url_remap.remap_required INT 0 + +Consult Traffic server `documentation +`_ +to know how to configure traffic server as forward proxy and its +security implications. + +ALPN support +------------ + +ALPN support requires OpenSSL >= 1.0.2. + +Disable frontend SSL/TLS +------------------------ + +The frontend connections are encrypted with SSL/TLS by default. To +turn off SSL/TLS, use ``no-tls`` keyword in :option:`--frontend` +option. If this option is used, the private key and certificate are +not required to run nghttpx. + +Enable backend SSL/TLS +---------------------- + +The backend connections are not encrypted by default. To enable +SSL/TLS encryption, use ``tls`` keyword in :option:`--backend` option. + +Enable SSL/TLS on memcached connection +-------------------------------------- + +By default, memcached connection is not encrypted. To enable +encryption, use ``tls`` keyword in +:option:`--tls-ticket-key-memcached` for TLS ticket key, and +:option:`--tls-session-cache-memcached` for TLS session cache. + +Specifying additional server certificates +----------------------------------------- + +nghttpx accepts additional server private key and certificate pairs +using :option:`--subcert` option. It can be used multiple times. + +Specifying additional CA certificate +------------------------------------ + +By default, nghttpx tries to read CA certificate from system. But +depending on the system you use, this may fail or is not supported. +To specify CA certificate manually, use :option:`--cacert` option. +The specified file must be PEM format and can contain multiple +certificates. + +By default, nghttpx validates server's certificate. If you want to +turn off this validation, knowing this is really insecure and what you +are doing, you can use :option:`--insecure` option to disable +certificate validation. + +Read/write rate limit +--------------------- + +nghttpx supports transfer rate limiting on frontend connections. You +can do rate limit per frontend connection for reading and writing +individually. + +To perform rate limit for reading, use :option:`--read-rate` and +:option:`--read-burst` options. For writing, use +:option:`--write-rate` and :option:`--write-burst`. + +Please note that rate limit is performed on top of TCP and nothing to +do with HTTP/2 flow control. + +Rewriting location header field +------------------------------- + +nghttpx automatically rewrites location response header field if the +following all conditions satisfy: + +* In the default mode (:option:`--http2-proxy` is not used) +* :option:`--no-location-rewrite` is not used +* URI in location header field is an absolute URI +* URI in location header field includes non empty host component. +* host (without port) in URI in location header field must match the + host appearing in ``:authority`` or ``host`` header field. + +When rewrite happens, URI scheme is replaced with the ones used in +frontend, and authority is replaced with which appears in +``:authority``, or ``host`` request header field. ``:authority`` +header field has precedence over ``host``. + +Hot swapping +------------ + +nghttpx supports hot swapping using signals. The hot swapping in +nghttpx is multi step process. First send USR2 signal to nghttpx +process. It will do fork and execute new executable, using same +command-line arguments and environment variables. + +As of nghttpx version 1.20.0, that is all you have to do. The new +main process sends QUIT signal to the original process, when it is +ready to serve requests, to shut it down gracefully. + +For earlier versions of nghttpx, you have to do one more thing. At +this point, both current and new processes can accept requests. To +gracefully shutdown current process, send QUIT signal to current +nghttpx process. When all existing frontend connections are done, the +current process will exit. At this point, only new nghttpx process +exists and serves incoming requests. + +If you want to just reload configuration file without executing new +binary, send SIGHUP to nghttpx main process. + +Re-opening log files +-------------------- + +When rotating log files, it is desirable to re-open log files after +log rotation daemon renamed existing log files. To tell nghttpx to +re-open log files, send USR1 signal to nghttpx process. It will +re-open files specified by :option:`--accesslog-file` and +:option:`--errorlog-file` options. + +Multiple frontend addresses +--------------------------- + +nghttpx can listen on multiple frontend addresses. To specify them, +just use :option:`--frontend` (or its shorthand :option:`-f`) option +repeatedly. TLS can be enabled or disabled per frontend address +basis. For example, to listen on port 443 with TLS enabled, and on +port 80 without TLS: + +.. code-block:: text + + frontend=*,443 + frontend=*,80;no-tls + + +Multiple backend addresses +-------------------------- + +nghttpx supports multiple backend addresses. To specify them, just +use :option:`--backend` (or its shorthand :option:`-b`) option +repeatedly. For example, to use ``192.168.0.10:8080`` and +``192.168.0.11:8080``, use command-line like this: +``-b192.168.0.10,8080 -b192.168.0.11,8080``. In configuration file, +this looks like: + +.. code-block:: text + + backend=192.168.0.10,8080 + backend=192.168.0.11,8008 + +nghttpx can route request to different backend according to request +host and path. For example, to route request destined to host +``doc.example.com`` to backend server ``docserv:3000``, you can write +like so: + +.. code-block:: text + + backend=docserv,3000;doc.example.com/ + +When you write this option in command-line, you should enclose +argument with single or double quotes, since the character ``;`` has a +special meaning in shell. + +To route, request to request path ``/foo`` to backend server +``[::1]:8080``, you can write like so: + +.. code-block:: text + + backend=::1,8080;/foo + +If the last character of path pattern is ``/``, all request paths +which start with that pattern match: + +.. code-block:: text + + backend=::1,8080;/bar/ + +The request path ``/bar/buzz`` matches the ``/bar/``. + +You can use ``*`` at the end of the path pattern to make it wildcard +pattern. ``*`` must match at least one character: + +.. code-block:: text + + backend=::1,8080;/sample* + +The request path ``/sample1/foo`` matches the ``/sample*`` pattern. + +Of course, you can specify both host and request path at the same +time: + +.. code-block:: text + + backend=192.168.0.10,8080;example.com/foo + +We can use ``*`` in the left most position of host to achieve wildcard +suffix match. If ``*`` is the left most character, then the remaining +string should match the request host suffix. ``*`` must match at +least one character. For example, ``*.example.com`` matches +``www.example.com`` and ``dev.example.com``, and does not match +``example.com`` and ``nghttp2.org``. The exact match (without ``*``) +always takes precedence over wildcard match. + +One important thing you have to remember is that we have to specify +default routing pattern for so called "catch all" pattern. To write +"catch all" pattern, just specify backend server address, without +pattern. + +Usually, host is the value of ``Host`` header field. In HTTP/2, the +value of ``:authority`` pseudo header field is used. + +When you write multiple backend addresses sharing the same routing +pattern, they are used as load balancing. For example, to use 2 +servers ``serv1:3000`` and ``serv2:3000`` for request host +``example.com`` and path ``/myservice``, you can write like so: + +.. code-block:: text + + backend=serv1,3000;example.com/myservice + backend=serv2,3000;example.com/myservice + +You can also specify backend application protocol in +:option:`--backend` option using ``proto`` keyword after pattern. +Utilizing this allows ngttpx to route certain request to HTTP/2, other +requests to HTTP/1. For example, to route requests to ``/ws/`` in +backend HTTP/1.1 connection, and use backend HTTP/2 for other +requests, do this: + +.. code-block:: text + + backend=serv1,3000;/;proto=h2 + backend=serv1,3000;/ws/;proto=http/1.1 + +The default backend protocol is HTTP/1.1. + +TLS can be enabled per pattern basis: + +.. code-block:: text + + backend=serv1,8443;/;proto=h2;tls + backend=serv2,8080;/ws/;proto=http/1.1 + +In the above case, connection to serv1 will be encrypted by TLS. On +the other hand, connection to serv2 will not be encrypted by TLS. + +Dynamic hostname lookup +----------------------- + +By default, nghttpx performs backend hostname lookup at start up, or +configuration reload, and keeps using them in its entire session. To +make nghttpx perform hostname lookup dynamically, use ``dns`` +parameter in :option:`--backend` option, like so: + +.. code-block:: text + + backend=foo.example.com,80;;dns + +nghttpx will cache resolved addresses for certain period of time. To +change this cache period, use :option:`--dns-cache-timeout`. + +Enable PROXY protocol +--------------------- + +PROXY protocol can be enabled per frontend. In order to enable PROXY +protocol, use ``proxyproto`` parameter in :option:`--frontend` option, +like so: + +.. code-block:: text + + frontend=*,443;proxyproto + +nghttpx supports both PROXY protocol v1 and v2. AF_UNIX in PROXY +protocol version 2 is ignored. + +Session affinity +---------------- + +Two kinds of session affinity are available: client IP, and HTTP +Cookie. + +To enable client IP based affinity, specify ``affinity=ip`` parameter +in :option:`--backend` option. If PROXY protocol is enabled, then an +address obtained from PROXY protocol is taken into consideration. + +To enable HTTP Cookie based affinity, specify ``affinity=cookie`` +parameter, and specify a name of cookie in ``affinity-cookie-name`` +parameter. Optionally, a Path attribute can be specified in +``affinity-cookie-path`` parameter: + +.. code-block:: text + + backend=127.0.0.1,3000;;affinity=cookie;affinity-cookie-name=nghttpxlb;affinity-cookie-path=/ + +Secure attribute of cookie is set if client connection is protected by +TLS. ``affinity-cookie-stickiness`` specifies the stickiness of this +affinity. If ``loose`` is given, which is the default, removing or +adding a backend server might break affinity. While ``strict`` is +given, removing the designated backend server breaks affinity, but +adding new backend server does not cause breakage. + +PSK cipher suites +----------------- + +nghttpx supports pre-shared key (PSK) cipher suites for both frontend +and backend TLS connections. For frontend connection, use +:option:`--psk-secrets` option to specify a file which contains PSK +identity and secrets. The format of the file is +``:``, where ```` is PSK identity, and +```` is PSK secret in hex, like so: + +.. code-block:: text + + client1:9567800e065e078085c241d54a01c6c3f24b3bab71a606600f4c6ad2c134f3b9 + client2:b1376c3f8f6dcf7c886c5bdcceecd1e6f1d708622b6ddd21bda26ebd0c0bca99 + +nghttpx server accepts any of the identity and secret pairs in the +file. The default cipher suite list does not contain PSK cipher +suites. In order to use PSK, PSK cipher suite must be enabled by +using :option:`--ciphers` option. The desired PSK cipher suite may be +listed in `HTTP/2 cipher block list +`_. In order to use +such PSK cipher suite with HTTP/2, disable HTTP/2 cipher block list by +using :option:`--no-http2-cipher-block-list` option. But you should +understand its implications. + +At the time of writing, even if only PSK cipher suites are specified +in :option:`--ciphers` option, certificate and private key are still +required. + +For backend connection, use :option:`--client-psk-secrets` option to +specify a file which contains single PSK identity and secret. The +format is the same as the file used by :option:`--psk-secrets` +described above, but only first identity and secret pair is solely +used, like so: + +.. code-block:: text + + client2:b1376c3f8f6dcf7c886c5bdcceecd1e6f1d708622b6ddd21bda26ebd0c0bca99 + +The default cipher suite list does not contain PSK cipher suites. In +order to use PSK, PSK cipher suite must be enabled by using +:option:`--client-ciphers` option. The desired PSK cipher suite may +be listed in `HTTP/2 cipher block list +`_. In order to use +such PSK cipher suite with HTTP/2, disable HTTP/2 cipher block list by +using :option:`--client-no-http2-cipher-block-list` option. But you +should understand its implications. + +TLSv1.3 +------- + +As of nghttpx v1.34.0, if it is built with OpenSSL 1.1.1 or later, it +supports TLSv1.3. 0-RTT data is supported, but by default its +processing is postponed until TLS handshake completes to mitigate +replay attack. This costs extra round trip and reduces effectiveness +of 0-RTT data. :option:`--tls-no-postpone-early-data` makes nghttpx +not wait for handshake to complete before forwarding request included +in 0-RTT to get full potential of 0-RTT data. In this case, nghttpx +adds ``Early-Data: 1`` header field when forwarding a request to a +backend server. All backend servers should recognize this header +field and understand that there is a risk for replay attack. See `RFC +8470 `_ for ``Early-Data`` header +field. + +nghttpx disables anti replay protection provided by OpenSSL. The anti +replay protection of OpenSSL requires that a resumed request must hit +the same server which generates the session ticket. Therefore it +might not work nicely in a deployment where there are multiple nghttpx +instances sharing ticket encryption keys via memcached. + +Because TLSv1.3 completely changes the semantics of cipher suite +naming scheme and structure, nghttpx provides the new option +:option:`--tls13-ciphers` and :option:`--tls13-client-ciphers` to +change preferred cipher list for TLSv1.3. + +WebSockets over HTTP/2 +---------------------- + +nghttpx supports `RFC 8441 `_ +Bootstrapping WebSockets with HTTP/2 for both frontend and backend +connections. This feature is enabled by default and no configuration +is required. + +WebSockets over HTTP/3 is also supported. + +HTTP/3 +------ + +nghttpx supports HTTP/3 if it is built with HTTP/3 support enabled. +HTTP/3 support is experimental. + +In order to listen UDP port to receive HTTP/3 traffic, +:option:`--frontend` option must have ``quic`` parameter: + +.. code-block:: text + + frontend=*,443;quic + +The above example makes nghttpx receive HTTP/3 traffic on UDP +port 443. + +nghttpx does not support HTTP/3 on backend connection. + +Hot swapping (SIGUSR2) or configuration reload (SIGHUP) require eBPF +program. Without eBPF, old worker processes keep getting HTTP/3 +traffic and do not work as intended. The QUIC keying material to +encrypt Connection ID must be set with +:option:`--frontend-quic-secret-file` and must provide the existing +keys in order to keep the existing connections alive during reload. + +The construction of Connection ID closely follows Block Cipher CID +Algorithm described in `QUIC-LB draft +`_. +A Connection ID that nghttpx generates is always 17 bytes long. It +uses first 3 bits as a configuration ID. The remaining bits in the +first byte are reserved and random. The next 4 bytes are server ID. +The next 4 bytes are used to route UDP datagram to a correct +``SO_REUSEPORT`` socket. The remaining bytes are randomly generated. +The server ID and the next 12 bytes are encrypted with AES-ECB. The +key is derived from the keying materials stored in a file specified by +:option:`--frontend-quic-secret-file`. The first 2 bits of keying +material in the file is used as a configuration ID. The remaining +bits and following 3 bytes are reserved and unused. The next 32 bytes +are used as an initial secret. The remaining 32 bytes are used as a +salt. The encryption key is generated by `HKDF +`_ with SHA256 and +these keying materials and ``connection id encryption key`` as info. + +In order announce that HTTP/3 endpoint is available, you should +specify alt-svc header field. For example, the following options send +alt-svc header field in HTTP/1.1 and HTTP/2 response: + +.. code-block:: text + + altsvc=h3,443,,,ma=3600 + http2-altsvc=h3,443,,,ma=3600 + +Migration from nghttpx v1.18.x or earlier +----------------------------------------- + +As of nghttpx v1.19.0, :option:`--ciphers` option only changes cipher +list for frontend TLS connection. In order to change cipher list for +backend connection, use :option:`--client-ciphers` option. + +Similarly, :option:`--no-http2-cipher-block-list` option only disables +HTTP/2 cipher block list for frontend connection. In order to disable +HTTP/2 cipher block list for backend connection, use +:option:`--client-no-http2-cipher-block-list` option. + +``--accept-proxy-protocol`` option was deprecated. Instead, use +``proxyproto`` parameter in :option:`--frontend` option to enable +PROXY protocol support per frontend. + +Migration from nghttpx v1.8.0 or earlier +---------------------------------------- + +As of nghttpx 1.9.0, ``--frontend-no-tls`` and ``--backend-no-tls`` +have been removed. + +To disable encryption on frontend connection, use ``no-tls`` keyword +in :option:`--frontend` potion: + +.. code-block:: text + + frontend=*,3000;no-tls + +The TLS encryption is now disabled on backend connection in all modes +by default. To enable encryption on backend connection, use ``tls`` +keyword in :option:`--backend` option: + +.. code-block:: text + + backend=127.0.0.1,8080;tls + +As of nghttpx 1.9.0, ``--http2-bridge``, ``--client`` and +``--client-proxy`` options have been removed. These functionality can +be used using combinations of options. + +Use following option instead of ``--http2-bridge``: + +.. code-block:: text + + backend=,;;proto=h2;tls + +Use following options instead of ``--client``: + +.. code-block:: text + + frontend=,;no-tls + backend=,;;proto=h2;tls + +Use following options instead of ``--client-proxy``: + +.. code-block:: text + + http2-proxy=yes + frontend=,;no-tls + backend=,;;proto=h2;tls + +We also removed ``--backend-http2-connections-per-worker`` option. It +was present because previously the number of backend h2 connection was +statically configured, and defaulted to 1. Now the number of backend +h2 connection is increased on demand. We know the maximum number of +concurrent streams per connection. When we push as many request as +the maximum concurrency to the one connection, we create another new +connection so that we can distribute load and avoid delay the request +processing. This is done automatically without any configuration. diff --git a/lib/nghttp2-1.65.0/doc/sources/tutorial-client.rst b/lib/nghttp2-1.65.0/doc/sources/tutorial-client.rst new file mode 100644 index 00000000000..dc190834f89 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/sources/tutorial-client.rst @@ -0,0 +1,465 @@ +Tutorial: HTTP/2 client +========================= + +In this tutorial, we are going to write a very primitive HTTP/2 +client. The complete source code, `libevent-client.c`_, is attached at +the end of this page. It also resides in the examples directory in +the archive or repository. + +This simple client takes a single HTTPS URI and retrieves the resource +at the URI. The synopsis is: + +.. code-block:: text + + $ libevent-client HTTPS_URI + +We use libevent in this tutorial to handle networking I/O. Please +note that nghttp2 itself does not depend on libevent. + +The client starts with some libevent and OpenSSL setup in the +``main()`` and ``run()`` functions. This setup isn't specific to +nghttp2, but one thing you should look at is setup of ALPN. Client +tells application protocols that it supports to server via ALPN:: + + static SSL_CTX *create_ssl_ctx(void) { + SSL_CTX *ssl_ctx; + ssl_ctx = SSL_CTX_new(SSLv23_client_method()); + if (!ssl_ctx) { + errx(1, "Could not create SSL/TLS context: %s", + ERR_error_string(ERR_get_error(), NULL)); + } + SSL_CTX_set_options(ssl_ctx, + SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | + SSL_OP_NO_COMPRESSION | + SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); + + SSL_CTX_set_alpn_protos(ssl_ctx, (const unsigned char *)"\x02h2", 3); + + return ssl_ctx; + } + +Here we see ``SSL_CTX_get_alpn_protos()`` function call. We instructs +OpenSSL to notify the server that we support h2, ALPN identifier for +HTTP/2. + +The example client defines a couple of structs: + +We define and use a ``http2_session_data`` structure to store data +related to the HTTP/2 session:: + + typedef struct { + nghttp2_session *session; + struct evdns_base *dnsbase; + struct bufferevent *bev; + http2_stream_data *stream_data; + } http2_session_data; + +Since this program only handles one URI, it uses only one stream. We +store the single stream's data in a ``http2_stream_data`` structure +and the ``stream_data`` points to it. The ``http2_stream_data`` +structure is defined as follows:: + + typedef struct { + /* The NULL-terminated URI string to retrieve. */ + const char *uri; + /* Parsed result of the |uri| */ + urlparse_url *u; + /* The authority portion of the |uri|, not NULL-terminated */ + char *authority; + /* The path portion of the |uri|, including query, not + NULL-terminated */ + char *path; + /* The length of the |authority| */ + size_t authoritylen; + /* The length of the |path| */ + size_t pathlen; + /* The stream ID of this stream */ + int32_t stream_id; + } http2_stream_data; + +We create and initialize these structures in +``create_http2_session_data()`` and ``create_http2_stream_data()`` +respectively. + +``initiate_connection()`` is called to start the connection to the +remote server. It's defined as:: + + static void initiate_connection(struct event_base *evbase, SSL_CTX *ssl_ctx, + const char *host, uint16_t port, + http2_session_data *session_data) { + int rv; + struct bufferevent *bev; + SSL *ssl; + + ssl = create_ssl(ssl_ctx); + bev = bufferevent_openssl_socket_new( + evbase, -1, ssl, BUFFEREVENT_SSL_CONNECTING, + BEV_OPT_DEFER_CALLBACKS | BEV_OPT_CLOSE_ON_FREE); + bufferevent_enable(bev, EV_READ | EV_WRITE); + bufferevent_setcb(bev, readcb, writecb, eventcb, session_data); + rv = bufferevent_socket_connect_hostname(bev, session_data->dnsbase, + AF_UNSPEC, host, port); + + if (rv != 0) { + errx(1, "Could not connect to the remote host %s", host); + } + session_data->bev = bev; + } + +``initiate_connection()`` creates a bufferevent for the connection and +sets up three callbacks: ``readcb``, ``writecb``, and ``eventcb``. + +The ``eventcb()`` is invoked by the libevent event loop when an event +(e.g. connection has been established, timeout, etc.) occurs on the +underlying network socket:: + + static void eventcb(struct bufferevent *bev, short events, void *ptr) { + http2_session_data *session_data = (http2_session_data *)ptr; + if (events & BEV_EVENT_CONNECTED) { + int fd = bufferevent_getfd(bev); + int val = 1; + const unsigned char *alpn = NULL; + unsigned int alpnlen = 0; + SSL *ssl; + + fprintf(stderr, "Connected\n"); + + ssl = bufferevent_openssl_get_ssl(session_data->bev); + + SSL_get0_alpn_selected(ssl, &alpn, &alpnlen); + + if (alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) { + fprintf(stderr, "h2 is not negotiated\n"); + delete_http2_session_data(session_data); + return; + } + + setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); + initialize_nghttp2_session(session_data); + send_client_connection_header(session_data); + submit_request(session_data); + if (session_send(session_data) != 0) { + delete_http2_session_data(session_data); + } + return; + } + if (events & BEV_EVENT_EOF) { + warnx("Disconnected from the remote host"); + } else if (events & BEV_EVENT_ERROR) { + warnx("Network error"); + } else if (events & BEV_EVENT_TIMEOUT) { + warnx("Timeout"); + } + delete_http2_session_data(session_data); + } + +Here we validate that HTTP/2 is negotiated, and if not, drop +connection. + +For ``BEV_EVENT_EOF``, ``BEV_EVENT_ERROR``, and ``BEV_EVENT_TIMEOUT`` +events, we just simply tear down the connection. + +The ``BEV_EVENT_CONNECTED`` event is invoked when the SSL/TLS +handshake has completed successfully. After this we're ready to begin +communicating via HTTP/2. + +The ``initialize_nghttp2_session()`` function initializes the nghttp2 +session object and several callbacks:: + + static void initialize_nghttp2_session(http2_session_data *session_data) { + nghttp2_session_callbacks *callbacks; + + nghttp2_session_callbacks_new(&callbacks); + + nghttp2_session_callbacks_set_send_callback2(callbacks, send_callback); + + nghttp2_session_callbacks_set_on_frame_recv_callback(callbacks, + on_frame_recv_callback); + + nghttp2_session_callbacks_set_on_data_chunk_recv_callback( + callbacks, on_data_chunk_recv_callback); + + nghttp2_session_callbacks_set_on_stream_close_callback( + callbacks, on_stream_close_callback); + + nghttp2_session_callbacks_set_on_header_callback(callbacks, + on_header_callback); + + nghttp2_session_callbacks_set_on_begin_headers_callback( + callbacks, on_begin_headers_callback); + + nghttp2_session_client_new(&session_data->session, callbacks, session_data); + + nghttp2_session_callbacks_del(callbacks); + } + +Since we are creating a client, we use `nghttp2_session_client_new()` +to initialize the nghttp2 session object. The callbacks setup are +explained later. + +The `delete_http2_session_data()` function destroys ``session_data`` +and frees its bufferevent, so the underlying connection is closed. It +also calls `nghttp2_session_del()` to delete the nghttp2 session +object. + +A HTTP/2 connection begins by sending the client connection preface, +which is a 24 byte magic byte string (:macro:`NGHTTP2_CLIENT_MAGIC`), +followed by a SETTINGS frame. The 24 byte magic string is sent +automatically by nghttp2. We send the SETTINGS frame in +``send_client_connection_header()``:: + + static void send_client_connection_header(http2_session_data *session_data) { + nghttp2_settings_entry iv[1] = { + {NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100}}; + int rv; + + /* client 24 bytes magic string will be sent by nghttp2 library */ + rv = nghttp2_submit_settings(session_data->session, NGHTTP2_FLAG_NONE, iv, + ARRLEN(iv)); + if (rv != 0) { + errx(1, "Could not submit SETTINGS: %s", nghttp2_strerror(rv)); + } + } + +Here we specify SETTINGS_MAX_CONCURRENT_STREAMS as 100. This is not +needed for this tiny example program, it just demonstrates use of the +SETTINGS frame. To queue the SETTINGS frame for transmission, we call +`nghttp2_submit_settings()`. Note that `nghttp2_submit_settings()` +only queues the frame for transmission, and doesn't actually send it. +All ``nghttp2_submit_*()`` family functions have this property. To +actually send the frame, `nghttp2_session_send()` has to be called, +which is described (and called) later. + +After the transmission of the client connection header, we enqueue the +HTTP request in the ``submit_request()`` function:: + + static void submit_request(http2_session_data *session_data) { + int32_t stream_id; + http2_stream_data *stream_data = session_data->stream_data; + const char *uri = stream_data->uri; + const urlparse_url *u = stream_data->u; + nghttp2_nv hdrs[] = { + MAKE_NV2(":method", "GET"), + MAKE_NV(":scheme", &uri[u->field_data[URLPARSE_SCHEMA].off], + u->field_data[URLPARSE_SCHEMA].len), + MAKE_NV(":authority", stream_data->authority, stream_data->authoritylen), + MAKE_NV(":path", stream_data->path, stream_data->pathlen)}; + fprintf(stderr, "Request headers:\n"); + print_headers(stderr, hdrs, ARRLEN(hdrs)); + stream_id = nghttp2_submit_request2(session_data->session, NULL, hdrs, + ARRLEN(hdrs), NULL, stream_data); + if (stream_id < 0) { + errx(1, "Could not submit HTTP request: %s", nghttp2_strerror(stream_id)); + } + + stream_data->stream_id = stream_id; + } + +We build the HTTP request header fields in ``hdrs``, which is an array +of :type:`nghttp2_nv`. There are four header fields to be sent: +``:method``, ``:scheme``, ``:authority``, and ``:path``. To queue the +HTTP request, we call `nghttp2_submit_request2()`. The ``stream_data`` +is passed via the *stream_user_data* parameter, which is helpfully +later passed back to callback functions. + +`nghttp2_submit_request2()` returns the newly assigned stream ID for +the request. + +The next bufferevent callback is ``readcb()``, which is invoked when +data is available to read from the bufferevent input buffer:: + + static void readcb(struct bufferevent *bev, void *ptr) { + http2_session_data *session_data = (http2_session_data *)ptr; + nghttp2_ssize readlen; + struct evbuffer *input = bufferevent_get_input(bev); + size_t datalen = evbuffer_get_length(input); + unsigned char *data = evbuffer_pullup(input, -1); + + readlen = nghttp2_session_mem_recv2(session_data->session, data, datalen); + if (readlen < 0) { + warnx("Fatal error: %s", nghttp2_strerror((int)readlen)); + delete_http2_session_data(session_data); + return; + } + if (evbuffer_drain(input, (size_t)readlen) != 0) { + warnx("Fatal error: evbuffer_drain failed"); + delete_http2_session_data(session_data); + return; + } + if (session_send(session_data) != 0) { + delete_http2_session_data(session_data); + return; + } + } + +In this function we feed all unprocessed, received data to the nghttp2 +session object using the `nghttp2_session_mem_recv2()` function. +`nghttp2_session_mem_recv2()` processes the received data and may +invoke nghttp2 callbacks and queue frames for transmission. Since +there may be pending frames for transmission, we call immediately +``session_send()`` to send them. ``session_send()`` is defined as +follows:: + + static int session_send(http2_session_data *session_data) { + int rv; + + rv = nghttp2_session_send(session_data->session); + if (rv != 0) { + warnx("Fatal error: %s", nghttp2_strerror(rv)); + return -1; + } + return 0; + } + +The `nghttp2_session_send()` function serializes pending frames into +wire format and calls the ``send_callback()`` function to send them. +``send_callback()`` has type :type:`nghttp2_send_callback2` and is +defined as:: + + static nghttp2_ssize send_callback(nghttp2_session *session _U_, + const uint8_t *data, size_t length, + int flags _U_, void *user_data) { + http2_session_data *session_data = (http2_session_data *)user_data; + struct bufferevent *bev = session_data->bev; + bufferevent_write(bev, data, length); + return (nghttp2_ssize)length; + } + +Since we use bufferevent to abstract network I/O, we just write the +data to the bufferevent object. Note that `nghttp2_session_send()` +continues to write all frames queued so far. If we were writing the +data to the non-blocking socket directly using the ``write()`` system +call, we'd soon receive an ``EAGAIN`` or ``EWOULDBLOCK`` error, since +sockets have a limited send buffer. If that happens, it's possible to +return :macro:`NGHTTP2_ERR_WOULDBLOCK` to signal the nghttp2 library +to stop sending further data. When writing to a bufferevent, you +should regulate the amount of data written, to avoid possible huge +memory consumption. In this example client however we don't implement +a limit. To see how to regulate the amount of buffered data, see the +``send_callback()`` in the server tutorial. + +The third bufferevent callback is ``writecb()``, which is invoked when +all data written in the bufferevent output buffer has been sent:: + + static void writecb(struct bufferevent *bev _U_, void *ptr) { + http2_session_data *session_data = (http2_session_data *)ptr; + if (nghttp2_session_want_read(session_data->session) == 0 && + nghttp2_session_want_write(session_data->session) == 0 && + evbuffer_get_length(bufferevent_get_output(session_data->bev)) == 0) { + delete_http2_session_data(session_data); + } + } + +As described earlier, we just write off all data in `send_callback()`, +so there is no data to write in this function. All we have to do is +check if the connection should be dropped or not. The nghttp2 session +object keeps track of reception and transmission of GOAWAY frames and +other error conditions. Using this information, the nghttp2 session +object can state whether the connection should be dropped or not. +More specifically, when both `nghttp2_session_want_read()` and +`nghttp2_session_want_write()` return 0, the connection is no-longer +required and can be closed. Since we're using bufferevent and its +deferred callback option, the bufferevent output buffer may still +contain pending data when the ``writecb()`` is called. To handle this +situation, we also check whether the output buffer is empty or not. If +all of these conditions are met, then we drop the connection. + +Now let's look at the remaining nghttp2 callbacks setup in the +``initialize_nghttp2_setup()`` function. + +A server responds to the request by first sending a HEADERS frame. +The HEADERS frame consists of response header name/value pairs, and +the ``on_header_callback()`` is called for each name/value pair:: + + static int on_header_callback(nghttp2_session *session _U_, + const nghttp2_frame *frame, const uint8_t *name, + size_t namelen, const uint8_t *value, + size_t valuelen, uint8_t flags _U_, + void *user_data) { + http2_session_data *session_data = (http2_session_data *)user_data; + switch (frame->hd.type) { + case NGHTTP2_HEADERS: + if (frame->headers.cat == NGHTTP2_HCAT_RESPONSE && + session_data->stream_data->stream_id == frame->hd.stream_id) { + /* Print response headers for the initiated request. */ + print_header(stderr, name, namelen, value, valuelen); + break; + } + } + return 0; + } + +In this tutorial, we just print the name/value pairs on stderr. + +After the HEADERS frame has been fully received (and thus all response +header name/value pairs have been received), the +``on_frame_recv_callback()`` function is called:: + + static int on_frame_recv_callback(nghttp2_session *session _U_, + const nghttp2_frame *frame, void *user_data) { + http2_session_data *session_data = (http2_session_data *)user_data; + switch (frame->hd.type) { + case NGHTTP2_HEADERS: + if (frame->headers.cat == NGHTTP2_HCAT_RESPONSE && + session_data->stream_data->stream_id == frame->hd.stream_id) { + fprintf(stderr, "All headers received\n"); + } + break; + } + return 0; + } + +``on_frame_recv_callback()`` is called for other frame types too. + +In this tutorial, we are just interested in the HTTP response HEADERS +frame. We check the frame type and its category (it should be +:macro:`NGHTTP2_HCAT_RESPONSE` for HTTP response HEADERS). We also +check its stream ID. + +Next, zero or more DATA frames can be received. The +``on_data_chunk_recv_callback()`` function is invoked when a chunk of +data is received from the remote peer:: + + static int on_data_chunk_recv_callback(nghttp2_session *session _U_, + uint8_t flags _U_, int32_t stream_id, + const uint8_t *data, size_t len, + void *user_data) { + http2_session_data *session_data = (http2_session_data *)user_data; + if (session_data->stream_data->stream_id == stream_id) { + fwrite(data, len, 1, stdout); + } + return 0; + } + +In our case, a chunk of data is HTTP response body. After checking the +stream ID, we just write the received data to stdout. Note the output +in the terminal may be corrupted if the response body contains some +binary data. + +The ``on_stream_close_callback()`` function is invoked when the stream +is about to close:: + + static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, + nghttp2_error_code error_code, + void *user_data) { + http2_session_data *session_data = (http2_session_data *)user_data; + int rv; + + if (session_data->stream_data->stream_id == stream_id) { + fprintf(stderr, "Stream %d closed with error_code=%d\n", stream_id, + error_code); + rv = nghttp2_session_terminate_session(session, NGHTTP2_NO_ERROR); + if (rv != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + return 0; + } + +If the stream ID matches the one we initiated, it means that its +stream is going to be closed. Since we have finished receiving +resource we wanted (or the stream was reset by RST_STREAM from the +remote peer), we call `nghttp2_session_terminate_session()` to +commence closure of the HTTP/2 session gracefully. If you have +some data associated for the stream to be closed, you may delete it +here. diff --git a/lib/nghttp2-1.65.0/doc/sources/tutorial-hpack.rst b/lib/nghttp2-1.65.0/doc/sources/tutorial-hpack.rst new file mode 100644 index 00000000000..82acd9470be --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/sources/tutorial-hpack.rst @@ -0,0 +1,126 @@ +Tutorial: HPACK API +=================== + +In this tutorial, we describe basic use of nghttp2's HPACK API. We +briefly describe the APIs for deflating and inflating header fields. +The full example of using these APIs, `deflate.c`_, is attached at the +end of this page. It also resides in the examples directory in the +archive or repository. + +Deflating (encoding) headers +---------------------------- + +First we need to initialize a :type:`nghttp2_hd_deflater` object using +the `nghttp2_hd_deflate_new()` function:: + + int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr, + size_t deflate_hd_table_bufsize_max); + +This function allocates a :type:`nghttp2_hd_deflater` object, +initializes it, and assigns its pointer to ``*deflater_ptr``. The +*deflate_hd_table_bufsize_max* is the upper bound of header table size +the deflater will use. This will limit the memory usage by the +deflater object for the dynamic header table. If in doubt, just +specify 4096 here, which is the default upper bound of dynamic header +table buffer size. + +To encode header fields, use the `nghttp2_hd_deflate_hd2()` function:: + + nghttp2_ssize nghttp2_hd_deflate_hd2(nghttp2_hd_deflater *deflater, + uint8_t *buf, size_t buflen, + const nghttp2_nv *nva, size_t nvlen); + +The *deflater* is the deflater object initialized by +`nghttp2_hd_deflate_new()` described above. The encoded byte string is +written to the buffer *buf*, which has length *buflen*. The *nva* is +a pointer to an array of headers fields, each of type +:type:`nghttp2_nv`. *nvlen* is the number of header fields which +*nva* contains. + +It is important to initialize and assign all members of +:type:`nghttp2_nv`. For security sensitive header fields (such as +cookies), set the :macro:`NGHTTP2_NV_FLAG_NO_INDEX` flag in +:member:`nghttp2_nv.flags`. Setting this flag prevents recovery of +sensitive header fields by compression based attacks: This is achieved +by not inserting the header field into the dynamic header table. + +`nghttp2_hd_deflate_hd2()` processes all headers given in *nva*. The +*nva* must include all request or response header fields to be sent in +one HEADERS (or optionally following (multiple) CONTINUATION +frame(s)). The *buf* must have enough space to store the encoded +result, otherwise the function will fail. To estimate the upper bound +of the encoded result length, use `nghttp2_hd_deflate_bound()`:: + + size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater, + const nghttp2_nv *nva, size_t nvlen); + +Pass this function the same parameters (*deflater*, *nva*, and +*nvlen*) which will be passed to `nghttp2_hd_deflate_hd2()`. + +Subsequent calls to `nghttp2_hd_deflate_hd2()` will use the current +encoder state and perform differential encoding, which yields HPAC's +fundamental compression gain. + +If `nghttp2_hd_deflate_hd2()` fails, the failure is fatal and any +further calls with the same deflater object will fail. Thus it's very +important to use `nghttp2_hd_deflate_bound()` to determine the +required size of the output buffer. + +To delete a :type:`nghttp2_hd_deflater` object, use the +`nghttp2_hd_deflate_del()` function. + +Inflating (decoding) headers +---------------------------- + +A :type:`nghttp2_hd_inflater` object is used to inflate compressed +header data. To initialize the object, use +`nghttp2_hd_inflate_new()`:: + + int nghttp2_hd_inflate_new(nghttp2_hd_inflater **inflater_ptr); + +To inflate header data, use `nghttp2_hd_inflate_hd3()`:: + + nghttp2_ssize nghttp2_hd_inflate_hd3(nghttp2_hd_inflater *inflater, + nghttp2_nv *nv_out, int *inflate_flags, + const uint8_t *in, size_t inlen, + int in_final); + +`nghttp2_hd_inflate_hd3()` reads a stream of bytes and outputs a +single header field at a time. Multiple calls are normally required to +read a full stream of bytes and output all of the header fields. + +The *inflater* is the inflater object initialized above. The *nv_out* +is a pointer to a :type:`nghttp2_nv` into which one header field may +be stored. The *in* is a pointer to input data, and *inlen* is its +length. The caller is not required to specify the whole deflated +header data via *in* at once: Instead it can call this function +multiple times as additional data bytes become available. If +*in_final* is nonzero, it tells the function that the passed data is +the final sequence of deflated header data. + +The *inflate_flags* is an output parameter; on success the function +sets it to a bitset of flags. It will be described later. + +This function returns when each header field is inflated. When this +happens, the function sets the :macro:`NGHTTP2_HD_INFLATE_EMIT` flag +in *inflate_flags*, and a header field is stored in *nv_out*. The +return value indicates the number of bytes read from *in* processed so +far, which may be less than *inlen*. The caller should call the +function repeatedly until all bytes are processed. Processed bytes +should be removed from *in*, and *inlen* should be adjusted +appropriately. + +If *in_final* is nonzero and all given data was processed, the +function sets the :macro:`NGHTTP2_HD_INFLATE_FINAL` flag in +*inflate_flags*. When you see this flag set, call the +`nghttp2_hd_inflate_end_headers()` function. + +If *in_final* is zero and the :macro:`NGHTTP2_HD_INFLATE_EMIT` flag is +not set, it indicates that all given data was processed. The caller +is required to pass additional data. + +Example usage of `nghttp2_hd_inflate_hd3()` is shown in the +`inflate_header_block()` function in `deflate.c`_. + +Finally, to delete a :type:`nghttp2_hd_inflater` object, use +`nghttp2_hd_inflate_del()`. diff --git a/lib/nghttp2-1.65.0/doc/sources/tutorial-server.rst b/lib/nghttp2-1.65.0/doc/sources/tutorial-server.rst new file mode 100644 index 00000000000..bf71296f2df --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/sources/tutorial-server.rst @@ -0,0 +1,578 @@ +Tutorial: HTTP/2 server +========================= + +In this tutorial, we are going to write a single-threaded, event-based +HTTP/2 web server, which supports HTTPS only. It can handle concurrent +multiple requests, but only the GET method is supported. The complete +source code, `libevent-server.c`_, is attached at the end of this +page. The source also resides in the examples directory in the +archive or repository. + +This simple server takes 3 arguments: The port number to listen on, +the path to your SSL/TLS private key file, and the path to your +certificate file. The synopsis is: + +.. code-block:: text + + $ libevent-server PORT /path/to/server.key /path/to/server.crt + +We use libevent in this tutorial to handle networking I/O. Please +note that nghttp2 itself does not depend on libevent. + +The server starts with some libevent and OpenSSL setup in the +``main()`` and ``run()`` functions. This setup isn't specific to +nghttp2, but one thing you should look at is setup of ALPN callback. +The ALPN callback is used by the server to select application +protocols offered by client. In ALPN, client sends the list of +supported application protocols, and server selects one of them. We +provide the callback for it:: + + static int alpn_select_proto_cb(SSL *ssl _U_, const unsigned char **out, + unsigned char *outlen, const unsigned char *in, + unsigned int inlen, void *arg _U_) { + int rv; + + rv = nghttp2_select_alpn(out, outlen, in, inlen); + + if (rv != 1) { + return SSL_TLSEXT_ERR_NOACK; + } + + return SSL_TLSEXT_ERR_OK; + } + + static SSL_CTX *create_ssl_ctx(const char *key_file, const char *cert_file) { + SSL_CTX *ssl_ctx; + EC_KEY *ecdh; + + ssl_ctx = SSL_CTX_new(SSLv23_server_method()); + + ... + + SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, NULL); + + return ssl_ctx; + } + +In ``alpn_select_proto_cb()``, we use `nghttp2_select_alpn()` to +select application protocol. The `nghttp2_select_alpn()` returns 1 +only if it selected h2 (ALPN identifier for HTTP/2), and out +parameters were assigned accordingly. + +Next, let's take a look at the main structures used by the example +application: + +We use the ``app_context`` structure to store application-wide data:: + + struct app_context { + SSL_CTX *ssl_ctx; + struct event_base *evbase; + }; + +We use the ``http2_session_data`` structure to store session-level +(which corresponds to one HTTP/2 connection) data:: + + typedef struct http2_session_data { + struct http2_stream_data root; + struct bufferevent *bev; + app_context *app_ctx; + nghttp2_session *session; + char *client_addr; + } http2_session_data; + +We use the ``http2_stream_data`` structure to store stream-level data:: + + typedef struct http2_stream_data { + struct http2_stream_data *prev, *next; + char *request_path; + int32_t stream_id; + int fd; + } http2_stream_data; + +A single HTTP/2 session can have multiple streams. To manage them, we +use a doubly linked list: The first element of this list is pointed +to by the ``root->next`` in ``http2_session_data``. Initially, +``root->next`` is ``NULL``. + +libevent's bufferevent structure is used to perform network I/O, with +the pointer to the bufferevent stored in the ``http2_session_data`` +structure. Note that the bufferevent object is kept in +``http2_session_data`` and not in ``http2_stream_data``. This is +because ``http2_stream_data`` is just a logical stream multiplexed +over the single connection managed by the bufferevent in +``http2_session_data``. + +We first create a listener object to accept incoming connections. +libevent's ``struct evconnlistener`` is used for this purpose:: + + static void start_listen(struct event_base *evbase, const char *service, + app_context *app_ctx) { + int rv; + struct addrinfo hints; + struct addrinfo *res, *rp; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + #ifdef AI_ADDRCONFIG + hints.ai_flags |= AI_ADDRCONFIG; + #endif /* AI_ADDRCONFIG */ + + rv = getaddrinfo(NULL, service, &hints, &res); + if (rv != 0) { + errx(1, NULL); + } + for (rp = res; rp; rp = rp->ai_next) { + struct evconnlistener *listener; + listener = evconnlistener_new_bind( + evbase, acceptcb, app_ctx, LEV_OPT_CLOSE_ON_FREE | LEV_OPT_REUSEABLE, + 16, rp->ai_addr, (int)rp->ai_addrlen); + if (listener) { + freeaddrinfo(res); + + return; + } + } + errx(1, "Could not start listener"); + } + +We specify the ``acceptcb`` callback, which is called when a new connection is +accepted:: + + static void acceptcb(struct evconnlistener *listener _U_, int fd, + struct sockaddr *addr, int addrlen, void *arg) { + app_context *app_ctx = (app_context *)arg; + http2_session_data *session_data; + + session_data = create_http2_session_data(app_ctx, fd, addr, addrlen); + + bufferevent_setcb(session_data->bev, readcb, writecb, eventcb, session_data); + } + +Here we create the ``http2_session_data`` object. The connection's +bufferevent is initialized at the same time. We specify three +callbacks for the bufferevent: ``readcb``, ``writecb``, and +``eventcb``. + +The ``eventcb()`` callback is invoked by the libevent event loop when an event +(e.g. connection has been established, timeout, etc.) occurs on the +underlying network socket:: + + static void eventcb(struct bufferevent *bev _U_, short events, void *ptr) { + http2_session_data *session_data = (http2_session_data *)ptr; + if (events & BEV_EVENT_CONNECTED) { + const unsigned char *alpn = NULL; + unsigned int alpnlen = 0; + SSL *ssl; + + fprintf(stderr, "%s connected\n", session_data->client_addr); + + ssl = bufferevent_openssl_get_ssl(session_data->bev); + + SSL_get0_alpn_selected(ssl, &alpn, &alpnlen); + + if (alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) { + fprintf(stderr, "%s h2 is not negotiated\n", session_data->client_addr); + delete_http2_session_data(session_data); + return; + } + + initialize_nghttp2_session(session_data); + + if (send_server_connection_header(session_data) != 0 || + session_send(session_data) != 0) { + delete_http2_session_data(session_data); + return; + } + + return; + } + if (events & BEV_EVENT_EOF) { + fprintf(stderr, "%s EOF\n", session_data->client_addr); + } else if (events & BEV_EVENT_ERROR) { + fprintf(stderr, "%s network error\n", session_data->client_addr); + } else if (events & BEV_EVENT_TIMEOUT) { + fprintf(stderr, "%s timeout\n", session_data->client_addr); + } + delete_http2_session_data(session_data); + } + +Here we validate that HTTP/2 is negotiated, and if not, drop +connection. + +For the ``BEV_EVENT_EOF``, ``BEV_EVENT_ERROR``, and +``BEV_EVENT_TIMEOUT`` events, we just simply tear down the connection. +The ``delete_http2_session_data()`` function destroys the +``http2_session_data`` object and its associated bufferevent member. +As a result, the underlying connection is closed. + +The +``BEV_EVENT_CONNECTED`` event is invoked when SSL/TLS handshake has +completed successfully. After this we are ready to begin communicating +via HTTP/2. + +The ``initialize_nghttp2_session()`` function initializes the nghttp2 +session object and several callbacks:: + + static void initialize_nghttp2_session(http2_session_data *session_data) { + nghttp2_session_callbacks *callbacks; + + nghttp2_session_callbacks_new(&callbacks); + + nghttp2_session_callbacks_set_send_callback2(callbacks, send_callback); + + nghttp2_session_callbacks_set_on_frame_recv_callback(callbacks, + on_frame_recv_callback); + + nghttp2_session_callbacks_set_on_stream_close_callback( + callbacks, on_stream_close_callback); + + nghttp2_session_callbacks_set_on_header_callback(callbacks, + on_header_callback); + + nghttp2_session_callbacks_set_on_begin_headers_callback( + callbacks, on_begin_headers_callback); + + nghttp2_session_server_new(&session_data->session, callbacks, session_data); + + nghttp2_session_callbacks_del(callbacks); + } + +Since we are creating a server, we use `nghttp2_session_server_new()` +to initialize the nghttp2 session object. We also setup 5 callbacks +for the nghttp2 session, these are explained later. + +The server now begins by sending the server connection preface, which +always consists of a SETTINGS frame. +``send_server_connection_header()`` configures and submits it:: + + static int send_server_connection_header(http2_session_data *session_data) { + nghttp2_settings_entry iv[1] = { + {NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100}}; + int rv; + + rv = nghttp2_submit_settings(session_data->session, NGHTTP2_FLAG_NONE, iv, + ARRLEN(iv)); + if (rv != 0) { + warnx("Fatal error: %s", nghttp2_strerror(rv)); + return -1; + } + return 0; + } + +In the example SETTINGS frame we've set +SETTINGS_MAX_CONCURRENT_STREAMS to 100. `nghttp2_submit_settings()` +is used to queue the frame for transmission, but note it only queues +the frame for transmission, and doesn't actually send it. All +functions in the ``nghttp2_submit_*()`` family have this property. To +actually send the frame, `nghttp2_session_send()` should be used, as +described later. + +Since bufferevent may buffer more than the first 24 bytes from the client, we +have to process them here since libevent won't invoke callback functions for +this pending data. To process the received data, we call the +``session_recv()`` function:: + + static int session_recv(http2_session_data *session_data) { + nghttp2_ssize readlen; + struct evbuffer *input = bufferevent_get_input(session_data->bev); + size_t datalen = evbuffer_get_length(input); + unsigned char *data = evbuffer_pullup(input, -1); + + readlen = nghttp2_session_mem_recv2(session_data->session, data, datalen); + if (readlen < 0) { + warnx("Fatal error: %s", nghttp2_strerror((int)readlen)); + return -1; + } + if (evbuffer_drain(input, (size_t)readlen) != 0) { + warnx("Fatal error: evbuffer_drain failed"); + return -1; + } + if (session_send(session_data) != 0) { + return -1; + } + return 0; + } + +In this function, we feed all unprocessed but already received data to +the nghttp2 session object using the `nghttp2_session_mem_recv2()` +function. The `nghttp2_session_mem_recv2()` function processes the +data and may both invoke the previously setup callbacks and also queue +outgoing frames. To send any pending outgoing frames, we immediately +call ``session_send()``. + +The ``session_send()`` function is defined as follows:: + + static int session_send(http2_session_data *session_data) { + int rv; + rv = nghttp2_session_send(session_data->session); + if (rv != 0) { + warnx("Fatal error: %s", nghttp2_strerror(rv)); + return -1; + } + return 0; + } + +The `nghttp2_session_send()` function serializes the frame into wire +format and calls the ``send_callback()``, which is of type +:type:`nghttp2_send_callback2`. The ``send_callback()`` is defined as +follows:: + + static nghttp2_ssize send_callback(nghttp2_session *session _U_, + const uint8_t *data, size_t length, + int flags _U_, void *user_data) { + http2_session_data *session_data = (http2_session_data *)user_data; + struct bufferevent *bev = session_data->bev; + /* Avoid excessive buffering in server side. */ + if (evbuffer_get_length(bufferevent_get_output(session_data->bev)) >= + OUTPUT_WOULDBLOCK_THRESHOLD) { + return NGHTTP2_ERR_WOULDBLOCK; + } + bufferevent_write(bev, data, length); + return (nghttp2_ssize)length; + } + +Since we use bufferevent to abstract network I/O, we just write the +data to the bufferevent object. Note that `nghttp2_session_send()` +continues to write all frames queued so far. If we were writing the +data to a non-blocking socket directly using the ``write()`` system +call in the ``send_callback()``, we'd soon receive an ``EAGAIN`` or +``EWOULDBLOCK`` error since sockets have a limited send buffer. If +that happens, it's possible to return :macro:`NGHTTP2_ERR_WOULDBLOCK` +to signal the nghttp2 library to stop sending further data. But here, +when writing to the bufferevent, we have to regulate the amount data +to buffered ourselves to avoid using huge amounts of memory. To +achieve this, we check the size of the output buffer and if it reaches +more than or equal to ``OUTPUT_WOULDBLOCK_THRESHOLD`` bytes, we stop +writing data and return :macro:`NGHTTP2_ERR_WOULDBLOCK`. + +The next bufferevent callback is ``readcb()``, which is invoked when +data is available to read in the bufferevent input buffer:: + + static void readcb(struct bufferevent *bev _U_, void *ptr) { + http2_session_data *session_data = (http2_session_data *)ptr; + if (session_recv(session_data) != 0) { + delete_http2_session_data(session_data); + return; + } + } + +In this function, we just call ``session_recv()`` to process incoming +data. + +The third bufferevent callback is ``writecb()``, which is invoked when all +data in the bufferevent output buffer has been sent:: + + static void writecb(struct bufferevent *bev, void *ptr) { + http2_session_data *session_data = (http2_session_data *)ptr; + if (evbuffer_get_length(bufferevent_get_output(bev)) > 0) { + return; + } + if (nghttp2_session_want_read(session_data->session) == 0 && + nghttp2_session_want_write(session_data->session) == 0) { + delete_http2_session_data(session_data); + return; + } + if (session_send(session_data) != 0) { + delete_http2_session_data(session_data); + return; + } + } + +First we check whether we should drop the connection or not. The +nghttp2 session object keeps track of reception and transmission of +GOAWAY frames and other error conditions as well. Using this +information, the nghttp2 session object can state whether the +connection should be dropped or not. More specifically, if both +`nghttp2_session_want_read()` and `nghttp2_session_want_write()` +return 0, the connection is no-longer required and can be closed. +Since we are using bufferevent and its deferred callback option, the +bufferevent output buffer may still contain pending data when the +``writecb()`` is called. To handle this, we check whether the output +buffer is empty or not. If all of these conditions are met, we drop +connection. + +Otherwise, we call ``session_send()`` to process the pending output +data. Remember that in ``send_callback()``, we must not write all data to +bufferevent to avoid excessive buffering. We continue processing pending data +when the output buffer becomes empty. + +We have already described the nghttp2 callback ``send_callback()``. Let's +learn about the remaining nghttp2 callbacks setup in +``initialize_nghttp2_setup()`` function. + +The ``on_begin_headers_callback()`` function is invoked when the reception of +a header block in HEADERS or PUSH_PROMISE frame is started:: + + static int on_begin_headers_callback(nghttp2_session *session, + const nghttp2_frame *frame, + void *user_data) { + http2_session_data *session_data = (http2_session_data *)user_data; + http2_stream_data *stream_data; + + if (frame->hd.type != NGHTTP2_HEADERS || + frame->headers.cat != NGHTTP2_HCAT_REQUEST) { + return 0; + } + stream_data = create_http2_stream_data(session_data, frame->hd.stream_id); + nghttp2_session_set_stream_user_data(session, frame->hd.stream_id, + stream_data); + return 0; + } + +We are only interested in the HEADERS frame in this function. Since +the HEADERS frame has several roles in the HTTP/2 protocol, we check +that it is a request HEADERS, which opens new stream. If the frame is +a request HEADERS, we create a ``http2_stream_data`` object to store +the stream related data. We associate the created +``http2_stream_data`` object with the stream in the nghttp2 session +object using `nghttp2_set_stream_user_data()`. The +``http2_stream_data`` object can later be easily retrieved from the +stream, without searching through the doubly linked list. + +In this example server, we want to serve files relative to the current working +directory in which the program was invoked. Each header name/value pair is +emitted via ``on_header_callback`` function, which is called after +``on_begin_headers_callback()``:: + + static int on_header_callback(nghttp2_session *session, + const nghttp2_frame *frame, const uint8_t *name, + size_t namelen, const uint8_t *value, + size_t valuelen, uint8_t flags _U_, + void *user_data _U_) { + http2_stream_data *stream_data; + const char PATH[] = ":path"; + switch (frame->hd.type) { + case NGHTTP2_HEADERS: + if (frame->headers.cat != NGHTTP2_HCAT_REQUEST) { + break; + } + stream_data = + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id); + if (!stream_data || stream_data->request_path) { + break; + } + if (namelen == sizeof(PATH) - 1 && memcmp(PATH, name, namelen) == 0) { + size_t j; + for (j = 0; j < valuelen && value[j] != '?'; ++j) + ; + stream_data->request_path = percent_decode(value, j); + } + break; + } + return 0; + } + +We search for the ``:path`` header field among the request headers and +store the requested path in the ``http2_stream_data`` object. In this +example program, we ignore the ``:method`` header field and always +treat the request as a GET request. + +The ``on_frame_recv_callback()`` function is invoked when a frame is +fully received:: + + static int on_frame_recv_callback(nghttp2_session *session, + const nghttp2_frame *frame, void *user_data) { + http2_session_data *session_data = (http2_session_data *)user_data; + http2_stream_data *stream_data; + switch (frame->hd.type) { + case NGHTTP2_DATA: + case NGHTTP2_HEADERS: + /* Check that the client request has finished */ + if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { + stream_data = + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id); + /* For DATA and HEADERS frame, this callback may be called after + on_stream_close_callback. Check that stream still alive. */ + if (!stream_data) { + return 0; + } + return on_request_recv(session, session_data, stream_data); + } + break; + default: + break; + } + return 0; + } + +First we retrieve the ``http2_stream_data`` object associated with the +stream in ``on_begin_headers_callback()`` using +`nghttp2_session_get_stream_user_data()`. If the requested path +cannot be served for some reason (e.g. file is not found), we send a +404 response using ``error_reply()``. Otherwise, we open +the requested file and send its content. We send the header field +``:status`` as a single response header. + +Sending the file content is performed by the ``send_response()`` function:: + + static int send_response(nghttp2_session *session, int32_t stream_id, + nghttp2_nv *nva, size_t nvlen, int fd) { + int rv; + nghttp2_data_provider2 data_prd; + data_prd.source.fd = fd; + data_prd.read_callback = file_read_callback; + + rv = nghttp2_submit_response2(session, stream_id, nva, nvlen, &data_prd); + if (rv != 0) { + warnx("Fatal error: %s", nghttp2_strerror(rv)); + return -1; + } + return 0; + } + +nghttp2 uses the :type:`nghttp2_data_provider2` structure to send the +entity body to the remote peer. The ``source`` member of this +structure is a union, which can be either a void pointer or an int +(which is intended to be used as file descriptor). In this example +server, we use it as a file descriptor. We also set the +``file_read_callback()`` callback function to read the contents of the +file:: + + static nghttp2_ssize file_read_callback(nghttp2_session *session _U_, + int32_t stream_id _U_, uint8_t *buf, + size_t length, uint32_t *data_flags, + nghttp2_data_source *source, + void *user_data _U_) { + int fd = source->fd; + ssize_t r; + while ((r = read(fd, buf, length)) == -1 && errno == EINTR) + ; + if (r == -1) { + return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; + } + if (r == 0) { + *data_flags |= NGHTTP2_DATA_FLAG_EOF; + } + return (nghttp2_ssize)r; + } + +If an error occurs while reading the file, we return +:macro:`NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. This tells the +library to send RST_STREAM to the stream. When all data has been +read, the :macro:`NGHTTP2_DATA_FLAG_EOF` flag is set to signal nghttp2 +that we have finished reading the file. + +The `nghttp2_submit_response2()` function is used to send the response +to the remote peer. + +The ``on_stream_close_callback()`` function is invoked when the stream +is about to close:: + + static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, + uint32_t error_code _U_, void *user_data) { + http2_session_data *session_data = (http2_session_data *)user_data; + http2_stream_data *stream_data; + + stream_data = nghttp2_session_get_stream_user_data(session, stream_id); + if (!stream_data) { + return 0; + } + remove_stream(session_data, stream_data); + delete_http2_stream_data(stream_data); + return 0; + } + +Lastly, we destroy the ``http2_stream_data`` object in this function, +since the stream is about to close and we no longer need the object. diff --git a/lib/nghttp2/doc/tutorial-client.rst.in b/lib/nghttp2-1.65.0/doc/tutorial-client.rst.in similarity index 100% rename from lib/nghttp2/doc/tutorial-client.rst.in rename to lib/nghttp2-1.65.0/doc/tutorial-client.rst.in diff --git a/lib/nghttp2/doc/tutorial-hpack.rst.in b/lib/nghttp2-1.65.0/doc/tutorial-hpack.rst.in similarity index 100% rename from lib/nghttp2/doc/tutorial-hpack.rst.in rename to lib/nghttp2-1.65.0/doc/tutorial-hpack.rst.in diff --git a/lib/nghttp2/doc/tutorial-server.rst.in b/lib/nghttp2-1.65.0/doc/tutorial-server.rst.in similarity index 100% rename from lib/nghttp2/doc/tutorial-server.rst.in rename to lib/nghttp2-1.65.0/doc/tutorial-server.rst.in diff --git a/lib/nghttp2-1.65.0/doc/types.rst b/lib/nghttp2-1.65.0/doc/types.rst new file mode 100644 index 00000000000..ccd7102cb41 --- /dev/null +++ b/lib/nghttp2-1.65.0/doc/types.rst @@ -0,0 +1,1583 @@ + +Types (structs, unions and typedefs) +==================================== +.. type:: ptrdiff_t nghttp2_ssize + + + :type:`nghttp2_ssize` is a signed counterpart of size_t. +.. type:: nghttp2_session + + + The primary structure to hold the resources needed for a HTTP/2 + session. The details of this structure are intentionally hidden + from the public API. + + +.. type:: nghttp2_info + + + This struct is what `nghttp2_version()` returns. It holds + information about the particular nghttp2 version. + + .. member:: int age + + Age of this struct. This instance of nghttp2 sets it to + :macro:`NGHTTP2_VERSION_AGE` but a future version may bump it and + add more struct fields at the bottom + .. member:: int version_num + + the :macro:`NGHTTP2_VERSION_NUM` number (since age ==1) + .. member:: const char *version_str + + points to the :macro:`NGHTTP2_VERSION` string (since age ==1) + .. member:: const char *proto_str + + points to the :macro:`NGHTTP2_PROTO_VERSION_ID` string this + instance implements (since age ==1) + +.. type:: nghttp2_vec + + + The object representing single contiguous buffer. + + .. member:: uint8_t *base + + The pointer to the buffer. + .. member:: size_t len + + The length of the buffer. + +.. type:: nghttp2_rcbuf + + + The object representing reference counted buffer. The details of + this structure are intentionally hidden from the public API. + + +.. type:: nghttp2_nv + + + The name/value pair, which mainly used to represent header fields. + + .. member:: uint8_t *name + + The *name* byte string. If this struct is presented from library + (e.g., :type:`nghttp2_on_frame_recv_callback`), *name* is + guaranteed to be NULL-terminated. For some callbacks + (:type:`nghttp2_before_frame_send_callback`, + :type:`nghttp2_on_frame_send_callback`, and + :type:`nghttp2_on_frame_not_send_callback`), it may not be + NULL-terminated if header field is passed from application with + the flag :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`). + When application is constructing this struct, *name* is not + required to be NULL-terminated. + .. member:: uint8_t *value + + The *value* byte string. If this struct is presented from + library (e.g., :type:`nghttp2_on_frame_recv_callback`), *value* + is guaranteed to be NULL-terminated. For some callbacks + (:type:`nghttp2_before_frame_send_callback`, + :type:`nghttp2_on_frame_send_callback`, and + :type:`nghttp2_on_frame_not_send_callback`), it may not be + NULL-terminated if header field is passed from application with + the flag :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE`). + When application is constructing this struct, *value* is not + required to be NULL-terminated. + .. member:: size_t namelen + + The length of the *name*, excluding terminating NULL. + .. member:: size_t valuelen + + The length of the *value*, excluding terminating NULL. + .. member:: uint8_t flags + + Bitwise OR of one or more of :type:`nghttp2_nv_flag`. + +.. type:: nghttp2_frame_hd + + The frame header. + + .. member:: size_t length + + The length field of this frame, excluding frame header. + .. member:: int32_t stream_id + + The stream identifier (aka, stream ID) + .. member:: uint8_t type + + The type of this frame. See `nghttp2_frame_type`. + .. member:: uint8_t flags + + The flags. + .. member:: uint8_t reserved + + Reserved bit in frame header. Currently, this is always set to 0 + and application should not expect something useful in here. + +.. type:: nghttp2_data_source + + + This union represents the some kind of data source passed to + :type:`nghttp2_data_source_read_callback2`. + + .. member:: int fd + + The integer field, suitable for a file descriptor. + .. member:: void *ptr + + The pointer to an arbitrary object. + +.. type:: ssize_t (*nghttp2_data_source_read_callback)( nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t length, uint32_t *data_flags, nghttp2_data_source *source, void *user_data) + + + .. warning:: + + Deprecated. Use :type:`nghttp2_data_source_read_callback2` + instead. + + Callback function invoked when the library wants to read data from + the *source*. The read data is sent in the stream *stream_id*. + The implementation of this function must read at most *length* + bytes of data from *source* (or possibly other places) and store + them in *buf* and return number of data stored in *buf*. If EOF is + reached, set :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF` flag + in *\*data_flags*. + + Sometime it is desirable to avoid copying data into *buf* and let + application to send data directly. To achieve this, set + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_COPY` to + *\*data_flags* (and possibly other flags, just like when we do + copy), and return the number of bytes to send without copying data + into *buf*. The library, seeing + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_COPY`, will invoke + :type:`nghttp2_send_data_callback`. The application must send + complete DATA frame in that callback. + + If this callback is set by `nghttp2_submit_request()`, + `nghttp2_submit_response()` or `nghttp2_submit_headers()` and + `nghttp2_submit_data()` with flag parameter + :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM` set, and + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF` flag is set to + *\*data_flags*, DATA frame will have END_STREAM flag set. Usually, + this is expected behaviour and all are fine. One exception is send + trailer fields. You cannot send trailer fields after sending frame + with END_STREAM set. To avoid this problem, one can set + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_END_STREAM` along + with :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF` to signal the + library not to set END_STREAM in DATA frame. Then application can + use `nghttp2_submit_trailer()` to send trailer fields. + `nghttp2_submit_trailer()` can be called inside this callback. + + If the application wants to postpone DATA frames (e.g., + asynchronous I/O, or reading data blocks for long time), it is + achieved by returning :enum:`nghttp2_error.NGHTTP2_ERR_DEFERRED` + without reading any data in this invocation. The library removes + DATA frame from the outgoing queue temporarily. To move back + deferred DATA frame to outgoing queue, call + `nghttp2_session_resume_data()`. + + By default, *length* is limited to 16KiB at maximum. If peer + allows larger frames, application can enlarge transmission buffer + size. See :type:`nghttp2_data_source_read_length_callback` for + more details. + + If the application just wants to return from + `nghttp2_session_send()` or `nghttp2_session_mem_send()` without + sending anything, return :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE`. + + In case of error, there are 2 choices. Returning + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` will + close the stream by issuing RST_STREAM with + :enum:`nghttp2_error_code.NGHTTP2_INTERNAL_ERROR`. If a different + error code is desirable, use `nghttp2_submit_rst_stream()` with a + desired error code and then return + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. + Returning :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` will + signal the entire session failure. +.. type:: nghttp2_ssize (*nghttp2_data_source_read_callback2)( nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t length, uint32_t *data_flags, nghttp2_data_source *source, void *user_data) + + + Callback function invoked when the library wants to read data from + the *source*. The read data is sent in the stream *stream_id*. + The implementation of this function must read at most *length* + bytes of data from *source* (or possibly other places) and store + them in *buf* and return number of data stored in *buf*. If EOF is + reached, set :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF` flag + in *\*data_flags*. + + Sometime it is desirable to avoid copying data into *buf* and let + application to send data directly. To achieve this, set + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_COPY` to + *\*data_flags* (and possibly other flags, just like when we do + copy), and return the number of bytes to send without copying data + into *buf*. The library, seeing + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_COPY`, will invoke + :type:`nghttp2_send_data_callback`. The application must send + complete DATA frame in that callback. + + If this callback is set by `nghttp2_submit_request2()`, + `nghttp2_submit_response2()` or `nghttp2_submit_headers()` and + `nghttp2_submit_data2()` with flag parameter + :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM` set, and + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF` flag is set to + *\*data_flags*, DATA frame will have END_STREAM flag set. Usually, + this is expected behaviour and all are fine. One exception is send + trailer fields. You cannot send trailer fields after sending frame + with END_STREAM set. To avoid this problem, one can set + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_END_STREAM` along + with :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF` to signal the + library not to set END_STREAM in DATA frame. Then application can + use `nghttp2_submit_trailer()` to send trailer fields. + `nghttp2_submit_trailer()` can be called inside this callback. + + If the application wants to postpone DATA frames (e.g., + asynchronous I/O, or reading data blocks for long time), it is + achieved by returning :enum:`nghttp2_error.NGHTTP2_ERR_DEFERRED` + without reading any data in this invocation. The library removes + DATA frame from the outgoing queue temporarily. To move back + deferred DATA frame to outgoing queue, call + `nghttp2_session_resume_data()`. + + By default, *length* is limited to 16KiB at maximum. If peer + allows larger frames, application can enlarge transmission buffer + size. See :type:`nghttp2_data_source_read_length_callback` for + more details. + + If the application just wants to return from + `nghttp2_session_send()` or `nghttp2_session_mem_send2()` without + sending anything, return :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE`. + + In case of error, there are 2 choices. Returning + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` will + close the stream by issuing RST_STREAM with + :enum:`nghttp2_error_code.NGHTTP2_INTERNAL_ERROR`. If a different + error code is desirable, use `nghttp2_submit_rst_stream()` with a + desired error code and then return + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. + Returning :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` will + signal the entire session failure. +.. type:: nghttp2_data_provider + + + .. warning:: + + Deprecated. Use :type:`nghttp2_data_provider2` instead. + + This struct represents the data source and the way to read a chunk + of data from it. + + .. member:: nghttp2_data_source source + + The data source. + .. member:: nghttp2_data_source_read_callback read_callback + + The callback function to read a chunk of data from the *source*. + +.. type:: nghttp2_data_provider2 + + + This struct represents the data source and the way to read a chunk + of data from it. + + .. member:: nghttp2_data_source source + + The data source. + .. member:: nghttp2_data_source_read_callback2 read_callback + + The callback function to read a chunk of data from the *source*. + +.. type:: nghttp2_data + + + The DATA frame. The received data is delivered via + :type:`nghttp2_on_data_chunk_recv_callback`. + + .. member:: size_t padlen + + The length of the padding in this frame. This includes PAD_HIGH + and PAD_LOW. + +.. type:: nghttp2_priority_spec + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + The structure to specify stream dependency. + + .. member:: int32_t stream_id + + The stream ID of the stream to depend on. Specifying 0 makes + stream not depend any other stream. + .. member:: int32_t weight + + The weight of this dependency. + .. member:: uint8_t exclusive + + nonzero means exclusive dependency + +.. type:: nghttp2_headers + + + The HEADERS frame. It has the following members: + + .. member:: nghttp2_frame_hd hd + + The frame header. + .. member:: size_t padlen + + The length of the padding in this frame. This includes PAD_HIGH + and PAD_LOW. + .. member:: nghttp2_priority_spec pri_spec + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + The priority specification + .. member:: nghttp2_nv *nva + + The name/value pairs. + .. member:: size_t nvlen + + The number of name/value pairs in *nva*. + .. member:: nghttp2_headers_category cat + + The category of this HEADERS frame. + +.. type:: nghttp2_priority + + + .. warning:: + + Deprecated. :rfc:`7540` priorities are deprecated by + :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + prioritization scheme. + + The PRIORITY frame. It has the following members: + + .. member:: nghttp2_frame_hd hd + + The frame header. + .. member:: nghttp2_priority_spec pri_spec + + The priority specification. + +.. type:: nghttp2_rst_stream + + + The RST_STREAM frame. It has the following members: + + .. member:: nghttp2_frame_hd hd + + The frame header. + .. member:: uint32_t error_code + + The error code. See :type:`nghttp2_error_code`. + +.. type:: nghttp2_settings_entry + + + The SETTINGS ID/Value pair. It has the following members: + + .. member:: int32_t settings_id + + The SETTINGS ID. See :type:`nghttp2_settings_id`. + .. member:: uint32_t value + + The value of this entry. + +.. type:: nghttp2_settings + + + The SETTINGS frame. It has the following members: + + .. member:: nghttp2_frame_hd hd + + The frame header. + .. member:: size_t niv + + The number of SETTINGS ID/Value pairs in *iv*. + .. member:: nghttp2_settings_entry *iv + + The pointer to the array of SETTINGS ID/Value pair. + +.. type:: nghttp2_push_promise + + + The PUSH_PROMISE frame. It has the following members: + + .. member:: nghttp2_frame_hd hd + + The frame header. + .. member:: size_t padlen + + The length of the padding in this frame. This includes PAD_HIGH + and PAD_LOW. + .. member:: nghttp2_nv *nva + + The name/value pairs. + .. member:: size_t nvlen + + The number of name/value pairs in *nva*. + .. member:: int32_t promised_stream_id + + The promised stream ID + .. member:: uint8_t reserved + + Reserved bit. Currently this is always set to 0 and application + should not expect something useful in here. + +.. type:: nghttp2_ping + + + The PING frame. It has the following members: + + .. member:: nghttp2_frame_hd hd + + The frame header. + .. member:: uint8_t opaque_data[8] + + The opaque data + +.. type:: nghttp2_goaway + + + The GOAWAY frame. It has the following members: + + .. member:: nghttp2_frame_hd hd + + The frame header. + .. member:: int32_t last_stream_id + + The last stream stream ID. + .. member:: uint32_t error_code + + The error code. See :type:`nghttp2_error_code`. + .. member:: uint8_t *opaque_data + + The additional debug data + .. member:: size_t opaque_data_len + + The length of *opaque_data* member. + .. member:: uint8_t reserved + + Reserved bit. Currently this is always set to 0 and application + should not expect something useful in here. + +.. type:: nghttp2_window_update + + + The WINDOW_UPDATE frame. It has the following members: + + .. member:: nghttp2_frame_hd hd + + The frame header. + .. member:: int32_t window_size_increment + + The window size increment. + .. member:: uint8_t reserved + + Reserved bit. Currently this is always set to 0 and application + should not expect something useful in here. + +.. type:: nghttp2_extension + + + The extension frame. It has following members: + + .. member:: nghttp2_frame_hd hd + + The frame header. + .. member:: void *payload + + The pointer to extension payload. The exact pointer type is + determined by hd.type. + + Currently, no extension is supported. This is a place holder for + the future extensions. + +.. type:: nghttp2_frame + + + This union includes all frames to pass them to various function + calls as nghttp2_frame type. The CONTINUATION frame is omitted + from here because the library deals with it internally. + + .. member:: nghttp2_frame_hd hd + + The frame header, which is convenient to inspect frame header. + .. member:: nghttp2_data data + + The DATA frame. + .. member:: nghttp2_headers headers + + The HEADERS frame. + .. member:: nghttp2_priority priority + + The PRIORITY frame. + .. member:: nghttp2_rst_stream rst_stream + + The RST_STREAM frame. + .. member:: nghttp2_settings settings + + The SETTINGS frame. + .. member:: nghttp2_push_promise push_promise + + The PUSH_PROMISE frame. + .. member:: nghttp2_ping ping + + The PING frame. + .. member:: nghttp2_goaway goaway + + The GOAWAY frame. + .. member:: nghttp2_window_update window_update + + The WINDOW_UPDATE frame. + .. member:: nghttp2_extension ext + + The extension frame. + +.. type:: ssize_t (*nghttp2_send_callback)(nghttp2_session *session, const uint8_t *data, size_t length, int flags, void *user_data) + + + .. warning:: + + Deprecated. Use :type:`nghttp2_send_callback2` instead. + + Callback function invoked when *session* wants to send data to the + remote peer. The implementation of this function must send at most + *length* bytes of data stored in *data*. The *flags* is currently + not used and always 0. It must return the number of bytes sent if + it succeeds. If it cannot send any single byte without blocking, + it must return :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. For + other errors, it must return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. The + *user_data* pointer is the third argument passed in to the call to + `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + + This callback is required if the application uses + `nghttp2_session_send()` to send data to the remote endpoint. If + the application uses solely `nghttp2_session_mem_send()` instead, + this callback function is unnecessary. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_send_callback()`. + + .. note:: + + The *length* may be very small. If that is the case, and + application disables Nagle algorithm (``TCP_NODELAY``), then just + writing *data* to the network stack leads to very small packet, + and it is very inefficient. An application should be responsible + to buffer up small chunks of data as necessary to avoid this + situation. +.. type:: nghttp2_ssize (*nghttp2_send_callback2)(nghttp2_session *session, const uint8_t *data, size_t length, int flags, void *user_data) + + + Callback function invoked when *session* wants to send data to the + remote peer. The implementation of this function must send at most + *length* bytes of data stored in *data*. The *flags* is currently + not used and always 0. It must return the number of bytes sent if + it succeeds. If it cannot send any single byte without blocking, + it must return :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. For + other errors, it must return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. The + *user_data* pointer is the third argument passed in to the call to + `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + + This callback is required if the application uses + `nghttp2_session_send()` to send data to the remote endpoint. If + the application uses solely `nghttp2_session_mem_send2()` instead, + this callback function is unnecessary. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_send_callback2()`. + + .. note:: + + The *length* may be very small. If that is the case, and + application disables Nagle algorithm (``TCP_NODELAY``), then just + writing *data* to the network stack leads to very small packet, + and it is very inefficient. An application should be responsible + to buffer up small chunks of data as necessary to avoid this + situation. +.. type:: int (*nghttp2_send_data_callback)(nghttp2_session *session, nghttp2_frame *frame, const uint8_t *framehd, size_t length, nghttp2_data_source *source, void *user_data) + + + Callback function invoked when + :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_COPY` is used in + :type:`nghttp2_data_source_read_callback` to send complete DATA + frame. + + The *frame* is a DATA frame to send. The *framehd* is the + serialized frame header (9 bytes). The *length* is the length of + application data to send (this does not include padding). The + *source* is the same pointer passed to + :type:`nghttp2_data_source_read_callback`. + + The application first must send frame header *framehd* of length 9 + bytes. If ``frame->data.padlen > 0``, send 1 byte of value + ``frame->data.padlen - 1``. Then send exactly *length* bytes of + application data. Finally, if ``frame->data.padlen > 1``, send + ``frame->data.padlen - 1`` bytes of zero as padding. + + The application has to send complete DATA frame in this callback. + If all data were written successfully, return 0. + + If it cannot send any data at all, just return + :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`; the library will call + this callback with the same parameters later (It is recommended to + send complete DATA frame at once in this function to deal with + error; if partial frame data has already sent, it is impossible to + send another data in that state, and all we can do is tear down + connection). When data is fully processed, but application wants + to make `nghttp2_session_mem_send2()` or `nghttp2_session_send()` + return immediately without processing next frames, return + :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE`. If application decided to + reset this stream, return + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`, then + the library will send RST_STREAM with INTERNAL_ERROR as error code. + The application can also return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`, which will + result in connection closure. Returning any other value is treated + as :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` is returned. +.. type:: ssize_t (*nghttp2_recv_callback)(nghttp2_session *session, uint8_t *buf, size_t length, int flags, void *user_data) + + + .. warning:: + + Deprecated. Use :type:`nghttp2_recv_callback2` instead. + + Callback function invoked when *session* wants to receive data from + the remote peer. The implementation of this function must read at + most *length* bytes of data and store it in *buf*. The *flags* is + currently not used and always 0. It must return the number of + bytes written in *buf* if it succeeds. If it cannot read any + single byte without blocking, it must return + :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. If it gets EOF + before it reads any single byte, it must return + :enum:`nghttp2_error.NGHTTP2_ERR_EOF`. For other errors, it must + return :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + Returning 0 is treated as + :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. The *user_data* + pointer is the third argument passed in to the call to + `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + + This callback is required if the application uses + `nghttp2_session_recv()` to receive data from the remote endpoint. + If the application uses solely `nghttp2_session_mem_recv()` + instead, this callback function is unnecessary. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_recv_callback()`. +.. type:: nghttp2_ssize (*nghttp2_recv_callback2)(nghttp2_session *session, uint8_t *buf, size_t length, int flags, void *user_data) + + + Callback function invoked when *session* wants to receive data from + the remote peer. The implementation of this function must read at + most *length* bytes of data and store it in *buf*. The *flags* is + currently not used and always 0. It must return the number of + bytes written in *buf* if it succeeds. If it cannot read any + single byte without blocking, it must return + :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. If it gets EOF + before it reads any single byte, it must return + :enum:`nghttp2_error.NGHTTP2_ERR_EOF`. For other errors, it must + return :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + Returning 0 is treated as + :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. The *user_data* + pointer is the third argument passed in to the call to + `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + + This callback is required if the application uses + `nghttp2_session_recv()` to receive data from the remote endpoint. + If the application uses solely `nghttp2_session_mem_recv2()` + instead, this callback function is unnecessary. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_recv_callback2()`. +.. type:: int (*nghttp2_on_frame_recv_callback)(nghttp2_session *session, const nghttp2_frame *frame, void *user_data) + + + Callback function invoked by `nghttp2_session_recv()` and + `nghttp2_session_mem_recv2()` when a frame is received. The + *user_data* pointer is the third argument passed in to the call to + `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + + If frame is HEADERS or PUSH_PROMISE, the ``nva`` and ``nvlen`` + member of their data structure are always ``NULL`` and 0 + respectively. The header name/value pairs are emitted via + :type:`nghttp2_on_header_callback`. + + Only HEADERS and DATA frame can signal the end of incoming data. + If ``frame->hd.flags & NGHTTP2_FLAG_END_STREAM`` is nonzero, the + *frame* is the last frame from the remote peer in this stream. + + This callback won't be called for CONTINUATION frames. + HEADERS/PUSH_PROMISE + CONTINUATIONs are treated as single frame. + + The implementation of this function must return 0 if it succeeds. + If nonzero value is returned, it is treated as fatal error and + `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_on_frame_recv_callback()`. +.. type:: int (*nghttp2_on_invalid_frame_recv_callback)( nghttp2_session *session, const nghttp2_frame *frame, int lib_error_code, void *user_data) + + + Callback function invoked by `nghttp2_session_recv()` and + `nghttp2_session_mem_recv2()` when an invalid non-DATA frame is + received. The error is indicated by the *lib_error_code*, which is + one of the values defined in :type:`nghttp2_error`. When this + callback function is invoked, the library automatically submits + either RST_STREAM or GOAWAY frame. The *user_data* pointer is the + third argument passed in to the call to + `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + + If frame is HEADERS or PUSH_PROMISE, the ``nva`` and ``nvlen`` + member of their data structure are always ``NULL`` and 0 + respectively. + + The implementation of this function must return 0 if it succeeds. + If nonzero is returned, it is treated as fatal error and + `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_on_invalid_frame_recv_callback()`. +.. type:: int (*nghttp2_on_data_chunk_recv_callback)(nghttp2_session *session, uint8_t flags, int32_t stream_id, const uint8_t *data, size_t len, void *user_data) + + + Callback function invoked when a chunk of data in DATA frame is + received. The *stream_id* is the stream ID this DATA frame belongs + to. The *flags* is the flags of DATA frame which this data chunk + is contained. ``(flags & NGHTTP2_FLAG_END_STREAM) != 0`` does not + necessarily mean this chunk of data is the last one in the stream. + You should use :type:`nghttp2_on_frame_recv_callback` to know all + data frames are received. The *user_data* pointer is the third + argument passed in to the call to `nghttp2_session_client_new()` or + `nghttp2_session_server_new()`. + + If the application uses `nghttp2_session_mem_recv2()`, it can + return :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` to make + `nghttp2_session_mem_recv2()` return without processing further + input bytes. The memory by pointed by the *data* is retained until + `nghttp2_session_mem_recv2()` or `nghttp2_session_recv()` is + called. The application must retain the input bytes which was used + to produce the *data* parameter, because it may refer to the memory + region included in the input bytes. + + The implementation of this function must return 0 if it succeeds. + If nonzero is returned, it is treated as fatal error, and + `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_on_data_chunk_recv_callback()`. +.. type:: int (*nghttp2_before_frame_send_callback)(nghttp2_session *session, const nghttp2_frame *frame, void *user_data) + + + Callback function invoked just before the non-DATA frame *frame* is + sent. The *user_data* pointer is the third argument passed in to + the call to `nghttp2_session_client_new()` or + `nghttp2_session_server_new()`. + + The implementation of this function must return 0 if it succeeds. + It can also return :enum:`nghttp2_error.NGHTTP2_ERR_CANCEL` to + cancel the transmission of the given frame. + + If there is a fatal error while executing this callback, the + implementation should return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`, which makes + `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + If the other value is returned, it is treated as if + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` is returned. + But the implementation should not rely on this since the library + may define new return value to extend its capability. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_before_frame_send_callback()`. +.. type:: int (*nghttp2_on_frame_send_callback)(nghttp2_session *session, const nghttp2_frame *frame, void *user_data) + + + Callback function invoked after the frame *frame* is sent. The + *user_data* pointer is the third argument passed in to the call to + `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + + The implementation of this function must return 0 if it succeeds. + If nonzero is returned, it is treated as fatal error and + `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_on_frame_send_callback()`. +.. type:: int (*nghttp2_on_frame_not_send_callback)(nghttp2_session *session, const nghttp2_frame *frame, int lib_error_code, void *user_data) + + + Callback function invoked after the non-DATA frame *frame* is not + sent because of the error. The error is indicated by the + *lib_error_code*, which is one of the values defined in + :type:`nghttp2_error`. The *user_data* pointer is the third + argument passed in to the call to `nghttp2_session_client_new()` or + `nghttp2_session_server_new()`. + + The implementation of this function must return 0 if it succeeds. + If nonzero is returned, it is treated as fatal error and + `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + `nghttp2_session_get_stream_user_data()` can be used to get + associated data. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_on_frame_not_send_callback()`. +.. type:: int (*nghttp2_on_stream_close_callback)(nghttp2_session *session, int32_t stream_id, uint32_t error_code, void *user_data) + + + Callback function invoked when the stream *stream_id* is closed. + The reason of closure is indicated by the *error_code*. The + *error_code* is usually one of :enum:`nghttp2_error_code`, but that + is not guaranteed. The stream_user_data, which was specified in + `nghttp2_submit_request2()` or `nghttp2_submit_headers()`, is still + available in this function. The *user_data* pointer is the third + argument passed in to the call to `nghttp2_session_client_new()` or + `nghttp2_session_server_new()`. + + This function is also called for a stream in reserved state. + + The implementation of this function must return 0 if it succeeds. + If nonzero is returned, it is treated as fatal error and + `nghttp2_session_recv()`, `nghttp2_session_mem_recv2()`, + `nghttp2_session_send()`, and `nghttp2_session_mem_send2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_on_stream_close_callback()`. +.. type:: int (*nghttp2_on_begin_headers_callback)(nghttp2_session *session, const nghttp2_frame *frame, void *user_data) + + + Callback function invoked when the reception of header block in + HEADERS or PUSH_PROMISE is started. Each header name/value pair + will be emitted by :type:`nghttp2_on_header_callback`. + + The ``frame->hd.flags`` may not have + :enum:`nghttp2_flag.NGHTTP2_FLAG_END_HEADERS` flag set, which + indicates that one or more CONTINUATION frames are involved. But + the application does not need to care about that because the header + name/value pairs are emitted transparently regardless of + CONTINUATION frames. + + The server applications probably create an object to store + information about new stream if ``frame->hd.type == + NGHTTP2_HEADERS`` and ``frame->headers.cat == + NGHTTP2_HCAT_REQUEST``. If *session* is configured as server side, + ``frame->headers.cat`` is either ``NGHTTP2_HCAT_REQUEST`` + containing request headers or ``NGHTTP2_HCAT_HEADERS`` containing + trailer fields and never get PUSH_PROMISE in this callback. + + For the client applications, ``frame->hd.type`` is either + ``NGHTTP2_HEADERS`` or ``NGHTTP2_PUSH_PROMISE``. In case of + ``NGHTTP2_HEADERS``, ``frame->headers.cat == + NGHTTP2_HCAT_RESPONSE`` means that it is the first response + headers, but it may be non-final response which is indicated by 1xx + status code. In this case, there may be zero or more HEADERS frame + with ``frame->headers.cat == NGHTTP2_HCAT_HEADERS`` which has + non-final response code and finally client gets exactly one HEADERS + frame with ``frame->headers.cat == NGHTTP2_HCAT_HEADERS`` + containing final response headers (non-1xx status code). The + trailer fields also has ``frame->headers.cat == + NGHTTP2_HCAT_HEADERS`` which does not contain any status code. + + Returning + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` will + close the stream (promised stream if frame is PUSH_PROMISE) by + issuing RST_STREAM with + :enum:`nghttp2_error_code.NGHTTP2_INTERNAL_ERROR`. In this case, + :type:`nghttp2_on_header_callback` and + :type:`nghttp2_on_frame_recv_callback` will not be invoked. If a + different error code is desirable, use + `nghttp2_submit_rst_stream()` with a desired error code and then + return :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. + Again, use ``frame->push_promise.promised_stream_id`` as stream_id + parameter in `nghttp2_submit_rst_stream()` if frame is + PUSH_PROMISE. + + The implementation of this function must return 0 if it succeeds. + It can return + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` to + reset the stream (promised stream if frame is PUSH_PROMISE). For + critical errors, it must return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the other + value is returned, it is treated as if + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` is returned. If + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` is returned, + `nghttp2_session_mem_recv2()` function will immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_on_begin_headers_callback()`. +.. type:: int (*nghttp2_on_header_callback)(nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen, uint8_t flags, void *user_data) + + + Callback function invoked when a header name/value pair is received + for the *frame*. The *name* of length *namelen* is header name. + The *value* of length *valuelen* is header value. The *flags* is + bitwise OR of one or more of :type:`nghttp2_nv_flag`. + + If :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_INDEX` is set in + *flags*, the receiver must not index this name/value pair when + forwarding it to the next hop. More specifically, "Literal Header + Field never Indexed" representation must be used in HPACK encoding. + + When this callback is invoked, ``frame->hd.type`` is either + :enum:`nghttp2_frame_type.NGHTTP2_HEADERS` or + :enum:`nghttp2_frame_type.NGHTTP2_PUSH_PROMISE`. After all header + name/value pairs are processed with this callback, and no error has + been detected, :type:`nghttp2_on_frame_recv_callback` will be + invoked. If there is an error in decompression, + :type:`nghttp2_on_frame_recv_callback` for the *frame* will not be + invoked. + + Both *name* and *value* are guaranteed to be NULL-terminated. The + *namelen* and *valuelen* do not include terminal NULL. If + `nghttp2_option_set_no_http_messaging()` is used with nonzero + value, NULL character may be included in *name* or *value* before + terminating NULL. + + Please note that unless `nghttp2_option_set_no_http_messaging()` is + used, nghttp2 library does perform validation against the *name* + and the *value* using `nghttp2_check_header_name()` and + `nghttp2_check_header_value()`. In addition to this, nghttp2 + performs validation based on HTTP Messaging rule, which is briefly + explained in :ref:`http-messaging` section. + + If the application uses `nghttp2_session_mem_recv2()`, it can + return :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` to make + `nghttp2_session_mem_recv2()` return without processing further + input bytes. The memory pointed by *frame*, *name* and *value* + parameters are retained until `nghttp2_session_mem_recv2()` or + `nghttp2_session_recv()` is called. The application must retain + the input bytes which was used to produce these parameters, because + it may refer to the memory region included in the input bytes. + + Returning + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` will + close the stream (promised stream if frame is PUSH_PROMISE) by + issuing RST_STREAM with + :enum:`nghttp2_error_code.NGHTTP2_INTERNAL_ERROR`. In this case, + :type:`nghttp2_on_header_callback` and + :type:`nghttp2_on_frame_recv_callback` will not be invoked. If a + different error code is desirable, use + `nghttp2_submit_rst_stream()` with a desired error code and then + return :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. + Again, use ``frame->push_promise.promised_stream_id`` as stream_id + parameter in `nghttp2_submit_rst_stream()` if frame is + PUSH_PROMISE. + + The implementation of this function must return 0 if it succeeds. + It may return :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` or + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. For + other critical failures, it must return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the other + nonzero value is returned, it is treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` is returned, + `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_on_header_callback()`. + + .. warning:: + + Application should properly limit the total buffer size to store + incoming header fields. Without it, peer may send large number + of header fields or large header fields to cause out of memory in + local endpoint. Due to how HPACK works, peer can do this + effectively without using much memory on their own. +.. type:: int (*nghttp2_on_header_callback2)(nghttp2_session *session, const nghttp2_frame *frame, nghttp2_rcbuf *name, nghttp2_rcbuf *value, uint8_t flags, void *user_data) + + + Callback function invoked when a header name/value pair is received + for the *frame*. The *name* is header name. The *value* is header + value. The *flags* is bitwise OR of one or more of + :type:`nghttp2_nv_flag`. + + This callback behaves like :type:`nghttp2_on_header_callback`, + except that *name* and *value* are stored in reference counted + buffer. If application wishes to keep these references without + copying them, use `nghttp2_rcbuf_incref()` to increment their + reference count. It is the application's responsibility to call + `nghttp2_rcbuf_decref()` if they called `nghttp2_rcbuf_incref()` so + as not to leak memory. If the *session* is created by + `nghttp2_session_server_new3()` or `nghttp2_session_client_new3()`, + the function to free memory is the one belongs to the mem + parameter. As long as this free function alives, *name* and + *value* can live after *session* was destroyed. +.. type:: int (*nghttp2_on_invalid_header_callback)( nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen, uint8_t flags, void *user_data) + + + Callback function invoked when a invalid header name/value pair is + received for the *frame*. + + The parameter and behaviour are similar to + :type:`nghttp2_on_header_callback`. The difference is that this + callback is only invoked when a invalid header name/value pair is + received which is treated as stream error if this callback is not + set. Only invalid regular header field are passed to this + callback. In other words, invalid pseudo header field is not + passed to this callback. Also header fields which includes upper + cased latter are also treated as error without passing them to this + callback. + + This callback is only considered if HTTP messaging validation is + turned on (which is on by default, see + `nghttp2_option_set_no_http_messaging()`). + + With this callback, application inspects the incoming invalid + field, and it also can reset stream from this callback by returning + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. By + default, the error code is + :enum:`nghttp2_error_code.NGHTTP2_PROTOCOL_ERROR`. To change the + error code, call `nghttp2_submit_rst_stream()` with the error code + of choice in addition to returning + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. + + If 0 is returned, the header field is ignored, and the stream is + not reset. +.. type:: int (*nghttp2_on_invalid_header_callback2)( nghttp2_session *session, const nghttp2_frame *frame, nghttp2_rcbuf *name, nghttp2_rcbuf *value, uint8_t flags, void *user_data) + + + Callback function invoked when a invalid header name/value pair is + received for the *frame*. + + The parameter and behaviour are similar to + :type:`nghttp2_on_header_callback2`. The difference is that this + callback is only invoked when a invalid header name/value pair is + received which is silently ignored if this callback is not set. + Only invalid regular header field are passed to this callback. In + other words, invalid pseudo header field is not passed to this + callback. Also header fields which includes upper cased latter are + also treated as error without passing them to this callback. + + This callback is only considered if HTTP messaging validation is + turned on (which is on by default, see + `nghttp2_option_set_no_http_messaging()`). + + With this callback, application inspects the incoming invalid + field, and it also can reset stream from this callback by returning + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. By + default, the error code is + :enum:`nghttp2_error_code.NGHTTP2_INTERNAL_ERROR`. To change the + error code, call `nghttp2_submit_rst_stream()` with the error code + of choice in addition to returning + :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. +.. type:: ssize_t (*nghttp2_select_padding_callback)(nghttp2_session *session, const nghttp2_frame *frame, size_t max_payloadlen, void *user_data) + + + .. warning:: + + Deprecated. Use :type:`nghttp2_select_padding_callback2` + instead. + + Callback function invoked when the library asks application how + many padding bytes are required for the transmission of the + *frame*. The application must choose the total length of payload + including padded bytes in range [frame->hd.length, max_payloadlen], + inclusive. Choosing number not in this range will be treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. Returning + ``frame->hd.length`` means no padding is added. Returning + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` will make + `nghttp2_session_send()` and `nghttp2_session_mem_send()` functions + immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_select_padding_callback()`. +.. type:: nghttp2_ssize (*nghttp2_select_padding_callback2)( nghttp2_session *session, const nghttp2_frame *frame, size_t max_payloadlen, void *user_data) + + + Callback function invoked when the library asks application how + many padding bytes are required for the transmission of the + *frame*. The application must choose the total length of payload + including padded bytes in range [frame->hd.length, max_payloadlen], + inclusive. Choosing number not in this range will be treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. Returning + ``frame->hd.length`` means no padding is added. Returning + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` will make + `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_select_padding_callback2()`. +.. type:: ssize_t (*nghttp2_data_source_read_length_callback)( nghttp2_session *session, uint8_t frame_type, int32_t stream_id, int32_t session_remote_window_size, int32_t stream_remote_window_size, uint32_t remote_max_frame_size, void *user_data) + + + .. warning:: + + Deprecated. Use + :type:`nghttp2_data_source_read_length_callback2` instead. + + Callback function invoked when library wants to get max length of + data to send data to the remote peer. The implementation of this + function should return a value in the following range. [1, + min(*session_remote_window_size*, *stream_remote_window_size*, + *remote_max_frame_size*)]. If a value greater than this range is + returned than the max allow value will be used. Returning a value + smaller than this range is treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. The + *frame_type* is provided for future extensibility and identifies + the type of frame (see :type:`nghttp2_frame_type`) for which to get + the length for. Currently supported frame types are: + :enum:`nghttp2_frame_type.NGHTTP2_DATA`. + + This callback can be used to control the length in bytes for which + :type:`nghttp2_data_source_read_callback` is allowed to send to the + remote endpoint. This callback is optional. Returning + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` will signal the + entire session failure. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_data_source_read_length_callback()`. +.. type:: nghttp2_ssize (*nghttp2_data_source_read_length_callback2)( nghttp2_session *session, uint8_t frame_type, int32_t stream_id, int32_t session_remote_window_size, int32_t stream_remote_window_size, uint32_t remote_max_frame_size, void *user_data) + + + Callback function invoked when library wants to get max length of + data to send data to the remote peer. The implementation of this + function should return a value in the following range. [1, + min(*session_remote_window_size*, *stream_remote_window_size*, + *remote_max_frame_size*)]. If a value greater than this range is + returned than the max allow value will be used. Returning a value + smaller than this range is treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. The + *frame_type* is provided for future extensibility and identifies + the type of frame (see :type:`nghttp2_frame_type`) for which to get + the length for. Currently supported frame types are: + :enum:`nghttp2_frame_type.NGHTTP2_DATA`. + + This callback can be used to control the length in bytes for which + :type:`nghttp2_data_source_read_callback` is allowed to send to the + remote endpoint. This callback is optional. Returning + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` will signal the + entire session failure. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_data_source_read_length_callback2()`. +.. type:: int (*nghttp2_on_begin_frame_callback)(nghttp2_session *session, const nghttp2_frame_hd *hd, void *user_data) + + + Callback function invoked when a frame header is received. The + *hd* points to received frame header. + + Unlike :type:`nghttp2_on_frame_recv_callback`, this callback will + also be called when frame header of CONTINUATION frame is received. + + If both :type:`nghttp2_on_begin_frame_callback` and + :type:`nghttp2_on_begin_headers_callback` are set and HEADERS or + PUSH_PROMISE is received, :type:`nghttp2_on_begin_frame_callback` + will be called first. + + The implementation of this function must return 0 if it succeeds. + If nonzero value is returned, it is treated as fatal error and + `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + + To set this callback to :type:`nghttp2_session_callbacks`, use + `nghttp2_session_callbacks_set_on_begin_frame_callback()`. +.. type:: int (*nghttp2_on_extension_chunk_recv_callback)( nghttp2_session *session, const nghttp2_frame_hd *hd, const uint8_t *data, size_t len, void *user_data) + + + Callback function invoked when chunk of extension frame payload is + received. The *hd* points to frame header. The received + chunk is *data* of length *len*. + + The implementation of this function must return 0 if it succeeds. + + To abort processing this extension frame, return + :enum:`nghttp2_error.NGHTTP2_ERR_CANCEL`. + + If fatal error occurred, application should return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, + `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the other + values are returned, currently they are treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. +.. type:: int (*nghttp2_unpack_extension_callback)(nghttp2_session *session, void **payload, const nghttp2_frame_hd *hd, void *user_data) + + + Callback function invoked when library asks the application to + unpack extension payload from its wire format. The extension + payload has been passed to the application using + :type:`nghttp2_on_extension_chunk_recv_callback`. The frame header + is already unpacked by the library and provided as *hd*. + + To receive extension frames, the application must tell desired + extension frame type to the library using + `nghttp2_option_set_user_recv_extension_type()`. + + The implementation of this function may store the pointer to the + created object as a result of unpacking in *\*payload*, and returns + 0. The pointer stored in *\*payload* is opaque to the library, and + the library does not own its pointer. *\*payload* is initialized as + ``NULL``. The *\*payload* is available as ``frame->ext.payload`` in + :type:`nghttp2_on_frame_recv_callback`. Therefore if application + can free that memory inside :type:`nghttp2_on_frame_recv_callback` + callback. Of course, application has a liberty not to use + *\*payload*, and do its own mechanism to process extension frames. + + To abort processing this extension frame, return + :enum:`nghttp2_error.NGHTTP2_ERR_CANCEL`. + + If fatal error occurred, application should return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, + `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the other + values are returned, currently they are treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. +.. type:: ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session, uint8_t *buf, size_t len, const nghttp2_frame *frame, void *user_data) + + + .. warning:: + + Deprecated. Use :type:`nghttp2_pack_extension_callback2` + instead. + + Callback function invoked when library asks the application to pack + extension payload in its wire format. The frame header will be + packed by library. Application must pack payload only. + ``frame->ext.payload`` is the object passed to + `nghttp2_submit_extension()` as payload parameter. Application + must pack extension payload to the *buf* of its capacity *len* + bytes. The *len* is at least 16KiB. + + The implementation of this function should return the number of + bytes written into *buf* when it succeeds. + + To abort processing this extension frame, return + :enum:`nghttp2_error.NGHTTP2_ERR_CANCEL`, and + :type:`nghttp2_on_frame_not_send_callback` will be invoked. + + If fatal error occurred, application should return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, + `nghttp2_session_send()` and `nghttp2_session_mem_send()` functions + immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the other + values are returned, currently they are treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the return + value is strictly larger than *len*, it is treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. +.. type:: nghttp2_ssize (*nghttp2_pack_extension_callback2)( nghttp2_session *session, uint8_t *buf, size_t len, const nghttp2_frame *frame, void *user_data) + + + Callback function invoked when library asks the application to pack + extension payload in its wire format. The frame header will be + packed by library. Application must pack payload only. + ``frame->ext.payload`` is the object passed to + `nghttp2_submit_extension()` as payload parameter. Application + must pack extension payload to the *buf* of its capacity *len* + bytes. The *len* is at least 16KiB. + + The implementation of this function should return the number of + bytes written into *buf* when it succeeds. + + To abort processing this extension frame, return + :enum:`nghttp2_error.NGHTTP2_ERR_CANCEL`, and + :type:`nghttp2_on_frame_not_send_callback` will be invoked. + + If fatal error occurred, application should return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, + `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + functions immediately return + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the other + values are returned, currently they are treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the return + value is strictly larger than *len*, it is treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. +.. type:: int (*nghttp2_error_callback)(nghttp2_session *session, const char *msg, size_t len, void *user_data) + + + .. warning:: + + Deprecated. Use :type:`nghttp2_error_callback2` instead. + + Callback function invoked when library provides the error message + intended for human consumption. This callback is solely for + debugging purpose. The *msg* is typically NULL-terminated string + of length *len*. *len* does not include the sentinel NULL + character. + + The format of error message may change between nghttp2 library + versions. The application should not depend on the particular + format. + + Normally, application should return 0 from this callback. If fatal + error occurred while doing something in this callback, application + should return :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + In this case, library will return immediately with return value + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. Currently, if + nonzero value is returned from this callback, they are treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`, but application + should not rely on this details. +.. type:: int (*nghttp2_error_callback2)(nghttp2_session *session, int lib_error_code, const char *msg, size_t len, void *user_data) + + + Callback function invoked when library provides the error code, and + message. This callback is solely for debugging purpose. + *lib_error_code* is one of error code defined in + :enum:`nghttp2_error`. The *msg* is typically NULL-terminated + string of length *len*, and intended for human consumption. *len* + does not include the sentinel NULL character. + + The format of error message may change between nghttp2 library + versions. The application should not depend on the particular + format. + + Normally, application should return 0 from this callback. If fatal + error occurred while doing something in this callback, application + should return :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + In this case, library will return immediately with return value + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. Currently, if + nonzero value is returned from this callback, they are treated as + :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`, but application + should not rely on this details. +.. type:: nghttp2_session_callbacks + + + Callback functions for :type:`nghttp2_session`. The details of + this structure are intentionally hidden from the public API. + + +.. type:: void *(*nghttp2_malloc)(size_t size, void *mem_user_data) + + + Custom memory allocator to replace malloc(). The *mem_user_data* + is the mem_user_data member of :type:`nghttp2_mem` structure. +.. type:: void (*nghttp2_free)(void *ptr, void *mem_user_data) + + + Custom memory allocator to replace free(). The *mem_user_data* is + the mem_user_data member of :type:`nghttp2_mem` structure. +.. type:: void *(*nghttp2_calloc)(size_t nmemb, size_t size, void *mem_user_data) + + + Custom memory allocator to replace calloc(). The *mem_user_data* + is the mem_user_data member of :type:`nghttp2_mem` structure. +.. type:: void *(*nghttp2_realloc)(void *ptr, size_t size, void *mem_user_data) + + + Custom memory allocator to replace realloc(). The *mem_user_data* + is the mem_user_data member of :type:`nghttp2_mem` structure. +.. type:: nghttp2_mem + + + Custom memory allocator functions and user defined pointer. The + *mem_user_data* member is passed to each allocator function. This + can be used, for example, to achieve per-session memory pool. + + In the following example code, ``my_malloc``, ``my_free``, + ``my_calloc`` and ``my_realloc`` are the replacement of the + standard allocators ``malloc``, ``free``, ``calloc`` and + ``realloc`` respectively:: + + void *my_malloc_cb(size_t size, void *mem_user_data) { + return my_malloc(size); + } + + void my_free_cb(void *ptr, void *mem_user_data) { my_free(ptr); } + + void *my_calloc_cb(size_t nmemb, size_t size, void *mem_user_data) { + return my_calloc(nmemb, size); + } + + void *my_realloc_cb(void *ptr, size_t size, void *mem_user_data) { + return my_realloc(ptr, size); + } + + void session_new() { + nghttp2_session *session; + nghttp2_session_callbacks *callbacks; + nghttp2_mem mem = {NULL, my_malloc_cb, my_free_cb, my_calloc_cb, + my_realloc_cb}; + + ... + + nghttp2_session_client_new3(&session, callbacks, NULL, NULL, &mem); + + ... + } + + .. member:: void *mem_user_data + + An arbitrary user supplied data. This is passed to each + allocator function. + .. member:: nghttp2_malloc malloc + + Custom allocator function to replace malloc(). + .. member:: nghttp2_free free + + Custom allocator function to replace free(). + .. member:: nghttp2_calloc calloc + + Custom allocator function to replace calloc(). + .. member:: nghttp2_realloc realloc + + Custom allocator function to replace realloc(). + +.. type:: nghttp2_option + + + Configuration options for :type:`nghttp2_session`. The details of + this structure are intentionally hidden from the public API. + + +.. type:: nghttp2_extpri + + + :type:`nghttp2_extpri` is :rfc:`9218` extensible priorities + specification for a stream. + + .. member:: uint32_t urgency + + :member:`urgency` is the urgency of a stream, it must be in + [:macro:`NGHTTP2_EXTPRI_URGENCY_HIGH`, + :macro:`NGHTTP2_EXTPRI_URGENCY_LOW`], inclusive, and 0 is the + highest urgency. + .. member:: int inc + + :member:`inc` indicates that a content can be processed + incrementally or not. If inc is 0, it cannot be processed + incrementally. If inc is 1, it can be processed incrementally. + Other value is not permitted. + +.. type:: nghttp2_ext_altsvc + + + The payload of ALTSVC frame. ALTSVC frame is a non-critical + extension to HTTP/2. If this frame is received, and + `nghttp2_option_set_user_recv_extension_type()` is not set, and + `nghttp2_option_set_builtin_recv_extension_type()` is set for + :enum:`nghttp2_frame_type.NGHTTP2_ALTSVC`, + ``nghttp2_extension.payload`` will point to this struct. + + It has the following members: + + .. member:: uint8_t *origin + + The pointer to origin which this alternative service is + associated with. This is not necessarily NULL-terminated. + .. member:: size_t origin_len + + The length of the *origin*. + .. member:: uint8_t *field_value + + The pointer to Alt-Svc field value contained in ALTSVC frame. + This is not necessarily NULL-terminated. + .. member:: size_t field_value_len + + The length of the *field_value*. + +.. type:: nghttp2_origin_entry + + + The single entry of an origin. + + .. member:: uint8_t *origin + + The pointer to origin. No validation is made against this field + by the library. This is not necessarily NULL-terminated. + .. member:: size_t origin_len + + The length of the *origin*. + +.. type:: nghttp2_ext_origin + + + The payload of ORIGIN frame. ORIGIN frame is a non-critical + extension to HTTP/2 and defined by `RFC 8336 + `_. + + If this frame is received, and + `nghttp2_option_set_user_recv_extension_type()` is not set, and + `nghttp2_option_set_builtin_recv_extension_type()` is set for + :enum:`nghttp2_frame_type.NGHTTP2_ORIGIN`, + ``nghttp2_extension.payload`` will point to this struct. + + It has the following members: + + .. member:: size_t nov + + The number of origins contained in *ov*. + .. member:: nghttp2_origin_entry *ov + + The pointer to the array of origins contained in ORIGIN frame. + +.. type:: nghttp2_ext_priority_update + + + The payload of PRIORITY_UPDATE frame. PRIORITY_UPDATE frame is a + non-critical extension to HTTP/2. If this frame is received, and + `nghttp2_option_set_user_recv_extension_type()` is not set, and + `nghttp2_option_set_builtin_recv_extension_type()` is set for + :enum:`nghttp2_frame_type.NGHTTP2_PRIORITY_UPDATE`, + ``nghttp2_extension.payload`` will point to this struct. + + It has the following members: + + .. member:: int32_t stream_id + + The stream ID of the stream whose priority is updated. + .. member:: uint8_t *field_value + + The pointer to Priority field value. It is not necessarily + NULL-terminated. + .. member:: size_t field_value_len + + The length of the :member:`field_value`. + +.. type:: nghttp2_hd_deflater + + + HPACK deflater object. + + +.. type:: nghttp2_hd_inflater + + + HPACK inflater object. + + +.. type:: nghttp2_stream + + + The structure to represent HTTP/2 stream. The details of this + structure are intentionally hidden from the public API. + + +.. type:: void (*nghttp2_debug_vprintf_callback)(const char *format, va_list args) + + + Callback function invoked when the library outputs debug logging. + The function is called with arguments suitable for ``vfprintf(3)`` + + The debug output is only enabled if the library is built with + ``DEBUGBUILD`` macro defined. diff --git a/lib/nghttp2/examples/CMakeLists.txt b/lib/nghttp2-1.65.0/examples/CMakeLists.txt similarity index 83% rename from lib/nghttp2/examples/CMakeLists.txt rename to lib/nghttp2-1.65.0/examples/CMakeLists.txt index 7a57bbf4108..70f1f0c397d 100644 --- a/lib/nghttp2/examples/CMakeLists.txt +++ b/lib/nghttp2-1.65.0/examples/CMakeLists.txt @@ -8,7 +8,7 @@ if(ENABLE_EXAMPLES) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} - "${CMAKE_CURRENT_SOURCE_DIR}/../third-party" + "${CMAKE_CURRENT_SOURCE_DIR}/../third-party/urlparse" "${CMAKE_CURRENT_SOURCE_DIR}/../third-party/llhttp/include" ${LIBEVENT_INCLUDE_DIRS} @@ -23,15 +23,15 @@ if(ENABLE_EXAMPLES) ) add_executable(client client.c $ - $ + $ ) add_executable(libevent-client libevent-client.c $ - $ + $ ) add_executable(libevent-server libevent-server.c $ - $ + $ ) add_executable(deflate deflate.c $ - $ + $ ) endif() diff --git a/lib/nghttp2/examples/Makefile.am b/lib/nghttp2-1.65.0/examples/Makefile.am similarity index 95% rename from lib/nghttp2/examples/Makefile.am rename to lib/nghttp2-1.65.0/examples/Makefile.am index 7b682ed4981..eafb1cbc632 100644 --- a/lib/nghttp2/examples/Makefile.am +++ b/lib/nghttp2-1.65.0/examples/Makefile.am @@ -30,13 +30,13 @@ AM_CXXFLAGS = $(WARNCXXFLAGS) $(CXX1XCXXFLAGS) AM_CPPFLAGS = \ -I$(top_srcdir)/lib/includes \ -I$(top_builddir)/lib/includes \ - -I$(top_srcdir)/third-party \ + -I$(top_srcdir)/third-party/urlparse \ @LIBEVENT_OPENSSL_CFLAGS@ \ @OPENSSL_CFLAGS@ \ @DEFS@ AM_LDFLAGS = @LIBTOOL_LDFLAGS@ LDADD = $(top_builddir)/lib/libnghttp2.la \ - $(top_builddir)/third-party/liburl-parser.la \ + $(top_builddir)/third-party/liburlparse.la \ @LIBEVENT_OPENSSL_LIBS@ \ @OPENSSL_LIBS@ \ @APPLDFLAGS@ diff --git a/lib/nghttp2-1.65.0/examples/Makefile.in b/lib/nghttp2-1.65.0/examples/Makefile.in new file mode 100644 index 00000000000..8bfe64f3266 --- /dev/null +++ b/lib/nghttp2-1.65.0/examples/Makefile.in @@ -0,0 +1,771 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2012 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@ENABLE_EXAMPLES_TRUE@noinst_PROGRAMS = client$(EXEEXT) \ +@ENABLE_EXAMPLES_TRUE@ libevent-client$(EXEEXT) \ +@ENABLE_EXAMPLES_TRUE@ libevent-server$(EXEEXT) \ +@ENABLE_EXAMPLES_TRUE@ deflate$(EXEEXT) +subdir = examples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am__client_SOURCES_DIST = client.c +@ENABLE_EXAMPLES_TRUE@am_client_OBJECTS = client.$(OBJEXT) +client_OBJECTS = $(am_client_OBJECTS) +client_LDADD = $(LDADD) +@ENABLE_EXAMPLES_TRUE@client_DEPENDENCIES = \ +@ENABLE_EXAMPLES_TRUE@ $(top_builddir)/lib/libnghttp2.la \ +@ENABLE_EXAMPLES_TRUE@ $(top_builddir)/third-party/liburlparse.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am__deflate_SOURCES_DIST = deflate.c +@ENABLE_EXAMPLES_TRUE@am_deflate_OBJECTS = deflate.$(OBJEXT) +deflate_OBJECTS = $(am_deflate_OBJECTS) +deflate_LDADD = $(LDADD) +@ENABLE_EXAMPLES_TRUE@deflate_DEPENDENCIES = \ +@ENABLE_EXAMPLES_TRUE@ $(top_builddir)/lib/libnghttp2.la \ +@ENABLE_EXAMPLES_TRUE@ $(top_builddir)/third-party/liburlparse.la +am__libevent_client_SOURCES_DIST = libevent-client.c +@ENABLE_EXAMPLES_TRUE@am_libevent_client_OBJECTS = \ +@ENABLE_EXAMPLES_TRUE@ libevent-client.$(OBJEXT) +libevent_client_OBJECTS = $(am_libevent_client_OBJECTS) +libevent_client_LDADD = $(LDADD) +@ENABLE_EXAMPLES_TRUE@libevent_client_DEPENDENCIES = \ +@ENABLE_EXAMPLES_TRUE@ $(top_builddir)/lib/libnghttp2.la \ +@ENABLE_EXAMPLES_TRUE@ $(top_builddir)/third-party/liburlparse.la +am__libevent_server_SOURCES_DIST = libevent-server.c +@ENABLE_EXAMPLES_TRUE@am_libevent_server_OBJECTS = \ +@ENABLE_EXAMPLES_TRUE@ libevent-server.$(OBJEXT) +libevent_server_OBJECTS = $(am_libevent_server_OBJECTS) +libevent_server_LDADD = $(LDADD) +@ENABLE_EXAMPLES_TRUE@libevent_server_DEPENDENCIES = \ +@ENABLE_EXAMPLES_TRUE@ $(top_builddir)/lib/libnghttp2.la \ +@ENABLE_EXAMPLES_TRUE@ $(top_builddir)/third-party/liburlparse.la +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/client.Po ./$(DEPDIR)/deflate.Po \ + ./$(DEPDIR)/libevent-client.Po ./$(DEPDIR)/libevent-server.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(client_SOURCES) $(deflate_SOURCES) \ + $(libevent_client_SOURCES) $(libevent_server_SOURCES) +DIST_SOURCES = $(am__client_SOURCES_DIST) $(am__deflate_SOURCES_DIST) \ + $(am__libevent_client_SOURCES_DIST) \ + $(am__libevent_server_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = CMakeLists.txt +@ENABLE_EXAMPLES_TRUE@AM_CFLAGS = $(WARNCFLAGS) +@ENABLE_EXAMPLES_TRUE@AM_CXXFLAGS = $(WARNCXXFLAGS) $(CXX1XCXXFLAGS) +@ENABLE_EXAMPLES_TRUE@AM_CPPFLAGS = \ +@ENABLE_EXAMPLES_TRUE@ -I$(top_srcdir)/lib/includes \ +@ENABLE_EXAMPLES_TRUE@ -I$(top_builddir)/lib/includes \ +@ENABLE_EXAMPLES_TRUE@ -I$(top_srcdir)/third-party/urlparse \ +@ENABLE_EXAMPLES_TRUE@ @LIBEVENT_OPENSSL_CFLAGS@ \ +@ENABLE_EXAMPLES_TRUE@ @OPENSSL_CFLAGS@ \ +@ENABLE_EXAMPLES_TRUE@ @DEFS@ + +@ENABLE_EXAMPLES_TRUE@AM_LDFLAGS = @LIBTOOL_LDFLAGS@ +@ENABLE_EXAMPLES_TRUE@LDADD = $(top_builddir)/lib/libnghttp2.la \ +@ENABLE_EXAMPLES_TRUE@ $(top_builddir)/third-party/liburlparse.la \ +@ENABLE_EXAMPLES_TRUE@ @LIBEVENT_OPENSSL_LIBS@ \ +@ENABLE_EXAMPLES_TRUE@ @OPENSSL_LIBS@ \ +@ENABLE_EXAMPLES_TRUE@ @APPLDFLAGS@ + +@ENABLE_EXAMPLES_TRUE@client_SOURCES = client.c +@ENABLE_EXAMPLES_TRUE@libevent_client_SOURCES = libevent-client.c +@ENABLE_EXAMPLES_TRUE@libevent_server_SOURCES = libevent-server.c +@ENABLE_EXAMPLES_TRUE@deflate_SOURCES = deflate.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +client$(EXEEXT): $(client_OBJECTS) $(client_DEPENDENCIES) $(EXTRA_client_DEPENDENCIES) + @rm -f client$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(client_OBJECTS) $(client_LDADD) $(LIBS) + +deflate$(EXEEXT): $(deflate_OBJECTS) $(deflate_DEPENDENCIES) $(EXTRA_deflate_DEPENDENCIES) + @rm -f deflate$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(deflate_OBJECTS) $(deflate_LDADD) $(LIBS) + +libevent-client$(EXEEXT): $(libevent_client_OBJECTS) $(libevent_client_DEPENDENCIES) $(EXTRA_libevent_client_DEPENDENCIES) + @rm -f libevent-client$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libevent_client_OBJECTS) $(libevent_client_LDADD) $(LIBS) + +libevent-server$(EXEEXT): $(libevent_server_OBJECTS) $(libevent_server_DEPENDENCIES) $(EXTRA_libevent_server_DEPENDENCIES) + @rm -f libevent-server$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(libevent_server_OBJECTS) $(libevent_server_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deflate.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libevent-client.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libevent-server.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -f ./$(DEPDIR)/client.Po + -rm -f ./$(DEPDIR)/deflate.Po + -rm -f ./$(DEPDIR)/libevent-client.Po + -rm -f ./$(DEPDIR)/libevent-server.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f ./$(DEPDIR)/client.Po + -rm -f ./$(DEPDIR)/deflate.Po + -rm -f ./$(DEPDIR)/libevent-client.Po + -rm -f ./$(DEPDIR)/libevent-server.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/examples/client.c b/lib/nghttp2-1.65.0/examples/client.c similarity index 85% rename from lib/nghttp2/examples/client.c rename to lib/nghttp2-1.65.0/examples/client.c index 6012d27cfbe..40042399dfb 100644 --- a/lib/nghttp2/examples/client.c +++ b/lib/nghttp2-1.65.0/examples/client.c @@ -56,6 +56,7 @@ #include #include +#define NGHTTP2_NO_SSIZE_T #include #include @@ -66,14 +67,14 @@ enum { IO_NONE, WANT_READ, WANT_WRITE }; #define MAKE_NV(NAME, VALUE) \ { \ - (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \ - NGHTTP2_NV_FLAG_NONE \ + (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, \ + sizeof(VALUE) - 1, NGHTTP2_NV_FLAG_NONE, \ } #define MAKE_NV_CS(NAME, VALUE) \ { \ - (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, strlen(VALUE), \ - NGHTTP2_NV_FLAG_NONE \ + (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, \ + strlen(VALUE), NGHTTP2_NV_FLAG_NONE, \ } struct Connection { @@ -154,13 +155,14 @@ static void diec(const char *func, int error_code) { } /* - * The implementation of nghttp2_send_callback type. Here we write + * The implementation of nghttp2_send_callback2 type. Here we write * |data| with size |length| to the network and return the number of * bytes actually written. See the documentation of * nghttp2_send_callback for the details. */ -static ssize_t send_callback(nghttp2_session *session, const uint8_t *data, - size_t length, int flags, void *user_data) { +static nghttp2_ssize send_callback(nghttp2_session *session, + const uint8_t *data, size_t length, + int flags, void *user_data) { struct Connection *connection; int rv; (void)session; @@ -174,7 +176,7 @@ static ssize_t send_callback(nghttp2_session *session, const uint8_t *data, int err = SSL_get_error(connection->ssl, rv); if (err == SSL_ERROR_WANT_WRITE || err == SSL_ERROR_WANT_READ) { connection->want_io = - (err == SSL_ERROR_WANT_READ ? WANT_READ : WANT_WRITE); + (err == SSL_ERROR_WANT_READ ? WANT_READ : WANT_WRITE); rv = NGHTTP2_ERR_WOULDBLOCK; } else { rv = NGHTTP2_ERR_CALLBACK_FAILURE; @@ -184,13 +186,14 @@ static ssize_t send_callback(nghttp2_session *session, const uint8_t *data, } /* - * The implementation of nghttp2_recv_callback type. Here we read data - * from the network and write them in |buf|. The capacity of |buf| is - * |length| bytes. Returns the number of bytes stored in |buf|. See - * the documentation of nghttp2_recv_callback for the details. + * The implementation of nghttp2_recv_callback2 type. Here we read + * data from the network and write them in |buf|. The capacity of + * |buf| is |length| bytes. Returns the number of bytes stored in + * |buf|. See the documentation of nghttp2_recv_callback for the + * details. */ -static ssize_t recv_callback(nghttp2_session *session, uint8_t *buf, - size_t length, int flags, void *user_data) { +static nghttp2_ssize recv_callback(nghttp2_session *session, uint8_t *buf, + size_t length, int flags, void *user_data) { struct Connection *connection; int rv; (void)session; @@ -204,7 +207,7 @@ static ssize_t recv_callback(nghttp2_session *session, uint8_t *buf, int err = SSL_get_error(connection->ssl, rv); if (err == SSL_ERROR_WANT_WRITE || err == SSL_ERROR_WANT_READ) { connection->want_io = - (err == SSL_ERROR_WANT_READ ? WANT_READ : WANT_WRITE); + (err == SSL_ERROR_WANT_READ ? WANT_READ : WANT_WRITE); rv = NGHTTP2_ERR_WOULDBLOCK; } else { rv = NGHTTP2_ERR_CALLBACK_FAILURE; @@ -328,9 +331,9 @@ static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags, * recv_callback is also required. */ static void setup_nghttp2_callbacks(nghttp2_session_callbacks *callbacks) { - nghttp2_session_callbacks_set_send_callback(callbacks, send_callback); + nghttp2_session_callbacks_set_send_callback2(callbacks, send_callback); - nghttp2_session_callbacks_set_recv_callback(callbacks, recv_callback); + nghttp2_session_callbacks_set_recv_callback2(callbacks, recv_callback); nghttp2_session_callbacks_set_on_frame_send_callback(callbacks, on_frame_send_callback); @@ -339,35 +342,12 @@ static void setup_nghttp2_callbacks(nghttp2_session_callbacks *callbacks) { on_frame_recv_callback); nghttp2_session_callbacks_set_on_stream_close_callback( - callbacks, on_stream_close_callback); + callbacks, on_stream_close_callback); nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - callbacks, on_data_chunk_recv_callback); + callbacks, on_data_chunk_recv_callback); } -#ifndef OPENSSL_NO_NEXTPROTONEG -/* - * Callback function for TLS NPN. Since this program only supports - * HTTP/2 protocol, if server does not offer HTTP/2 the nghttp2 - * library supports, we terminate program. - */ -static int select_next_proto_cb(SSL *ssl, unsigned char **out, - unsigned char *outlen, const unsigned char *in, - unsigned int inlen, void *arg) { - int rv; - (void)ssl; - (void)arg; - - /* nghttp2_select_next_protocol() selects HTTP/2 protocol the - nghttp2 library supports. */ - rv = nghttp2_select_next_protocol(out, outlen, in, inlen); - if (rv <= 0) { - die("Server did not advertise HTTP/2 protocol"); - } - return SSL_TLSEXT_ERR_OK; -} -#endif /* !OPENSSL_NO_NEXTPROTONEG */ - /* * Setup SSL/TLS context. */ @@ -376,14 +356,8 @@ static void init_ssl_ctx(SSL_CTX *ssl_ctx) { SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2); SSL_CTX_set_mode(ssl_ctx, SSL_MODE_AUTO_RETRY); SSL_CTX_set_mode(ssl_ctx, SSL_MODE_RELEASE_BUFFERS); - /* Set NPN callback */ -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, NULL); -#endif /* !OPENSSL_NO_NEXTPROTONEG */ -#if OPENSSL_VERSION_NUMBER >= 0x10002000L SSL_CTX_set_alpn_protos(ssl_ctx, (const unsigned char *)"\x02h2", 3); -#endif /* OPENSSL_VERSION_NUMBER >= 0x10002000L */ } static void ssl_handshake(SSL *ssl, int fd) { @@ -487,8 +461,8 @@ static void submit_request(struct Connection *connection, struct Request *req) { MAKE_NV("accept", "*/*"), MAKE_NV("user-agent", "nghttp2/" NGHTTP2_VERSION)}; - stream_id = nghttp2_submit_request(connection->session, NULL, nva, - sizeof(nva) / sizeof(nva[0]), NULL, req); + stream_id = nghttp2_submit_request2(connection->session, NULL, nva, + sizeof(nva) / sizeof(nva[0]), NULL, req); if (stream_id < 0) { diec("nghttp2_submit_request", stream_id); @@ -719,19 +693,6 @@ int main(int argc, char **argv) { act.sa_handler = SIG_IGN; sigaction(SIGPIPE, &act, 0); -#if OPENSSL_VERSION_NUMBER >= 0x1010000fL - /* No explicit initialization is required. */ -#elif defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC) - CRYPTO_library_init(); -#else /* !(OPENSSL_VERSION_NUMBER >= 0x1010000fL) && \ - !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC) */ - OPENSSL_config(NULL); - SSL_load_error_strings(); - SSL_library_init(); - OpenSSL_add_all_algorithms(); -#endif /* !(OPENSSL_VERSION_NUMBER >= 0x1010000fL) && \ - !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC) */ - rv = parse_uri(&uri, argv[1]); if (rv != 0) { die("parse_uri failed"); diff --git a/lib/nghttp2/examples/deflate.c b/lib/nghttp2-1.65.0/examples/deflate.c similarity index 88% rename from lib/nghttp2/examples/deflate.c rename to lib/nghttp2-1.65.0/examples/deflate.c index df1cb92025d..36826e03a4a 100644 --- a/lib/nghttp2/examples/deflate.c +++ b/lib/nghttp2-1.65.0/examples/deflate.c @@ -29,12 +29,13 @@ #include #include +#define NGHTTP2_NO_SSIZE_T #include #define MAKE_NV(K, V) \ { \ - (uint8_t *)K, (uint8_t *)V, sizeof(K) - 1, sizeof(V) - 1, \ - NGHTTP2_NV_FLAG_NONE \ + (uint8_t *)K, (uint8_t *)V, sizeof(K) - 1, \ + sizeof(V) - 1, NGHTTP2_NV_FLAG_NONE, \ } static void deflate(nghttp2_hd_deflater *deflater, @@ -50,9 +51,9 @@ int main(void) { nghttp2_hd_inflater *inflater; /* Define 1st header set. This is looks like a HTTP request. */ nghttp2_nv nva1[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"), - MAKE_NV(":path", "/"), MAKE_NV("user-agent", "libnghttp2"), - MAKE_NV("accept-encoding", "gzip, deflate")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"), + MAKE_NV(":path", "/"), MAKE_NV("user-agent", "libnghttp2"), + MAKE_NV("accept-encoding", "gzip, deflate")}; /* Define 2nd header set */ nghttp2_nv nva2[] = {MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"), @@ -93,7 +94,7 @@ int main(void) { static void deflate(nghttp2_hd_deflater *deflater, nghttp2_hd_inflater *inflater, const nghttp2_nv *const nva, size_t nvlen) { - ssize_t rv; + nghttp2_ssize rv; uint8_t *buf; size_t buflen; size_t outlen; @@ -118,10 +119,10 @@ static void deflate(nghttp2_hd_deflater *deflater, buflen = nghttp2_hd_deflate_bound(deflater, nva, nvlen); buf = malloc(buflen); - rv = nghttp2_hd_deflate_hd(deflater, buf, buflen, nva, nvlen); + rv = nghttp2_hd_deflate_hd2(deflater, buf, buflen, nva, nvlen); if (rv < 0) { - fprintf(stderr, "nghttp2_hd_deflate_hd() failed with error: %s\n", + fprintf(stderr, "nghttp2_hd_deflate_hd2() failed with error: %s\n", nghttp2_strerror((int)rv)); free(buf); @@ -166,17 +167,18 @@ static void deflate(nghttp2_hd_deflater *deflater, int inflate_header_block(nghttp2_hd_inflater *inflater, uint8_t *in, size_t inlen, int final) { - ssize_t rv; + nghttp2_ssize rv; for (;;) { nghttp2_nv nv; int inflate_flags = 0; size_t proclen; - rv = nghttp2_hd_inflate_hd(inflater, &nv, &inflate_flags, in, inlen, final); + rv = + nghttp2_hd_inflate_hd3(inflater, &nv, &inflate_flags, in, inlen, final); if (rv < 0) { - fprintf(stderr, "inflate failed with error code %zd", rv); + fprintf(stderr, "inflate failed with error code %td", rv); return -1; } diff --git a/lib/nghttp2/examples/libevent-client.c b/lib/nghttp2-1.65.0/examples/libevent-client.c similarity index 78% rename from lib/nghttp2/examples/libevent-client.c rename to lib/nghttp2-1.65.0/examples/libevent-client.c index be117a2eaf7..112eb27d8b0 100644 --- a/lib/nghttp2/examples/libevent-client.c +++ b/lib/nghttp2-1.65.0/examples/libevent-client.c @@ -63,9 +63,10 @@ char *strndup(const char *s, size_t size); #include #include +#define NGHTTP2_NO_SSIZE_T #include -#include "url-parser/url_parser.h" +#include "urlparse.h" #define ARRLEN(x) (sizeof(x) / sizeof(x[0])) @@ -73,7 +74,7 @@ typedef struct { /* The NULL-terminated URI string to retrieve. */ const char *uri; /* Parsed result of the |uri| */ - struct http_parser_url *u; + urlparse_url *u; /* The authority portion of the |uri|, not NULL-terminated */ char *authority; /* The path portion of the |uri|, including query, not @@ -95,7 +96,7 @@ typedef struct { } http2_session_data; static http2_stream_data *create_http2_stream_data(const char *uri, - struct http_parser_url *u) { + urlparse_url *u) { /* MAX 5 digits (max 65535) + 1 ':' + 1 NULL (because of snprintf) */ size_t extra = 7; http2_stream_data *stream_data = malloc(sizeof(http2_stream_data)); @@ -104,39 +105,41 @@ static http2_stream_data *create_http2_stream_data(const char *uri, stream_data->u = u; stream_data->stream_id = -1; - stream_data->authoritylen = u->field_data[UF_HOST].len; + stream_data->authoritylen = u->field_data[URLPARSE_HOST].len; stream_data->authority = malloc(stream_data->authoritylen + extra); - memcpy(stream_data->authority, &uri[u->field_data[UF_HOST].off], - u->field_data[UF_HOST].len); - if (u->field_set & (1 << UF_PORT)) { - stream_data->authoritylen += - (size_t)snprintf(stream_data->authority + u->field_data[UF_HOST].len, - extra, ":%u", u->port); + memcpy(stream_data->authority, &uri[u->field_data[URLPARSE_HOST].off], + u->field_data[URLPARSE_HOST].len); + if (u->field_set & (1 << URLPARSE_PORT)) { + stream_data->authoritylen += (size_t)snprintf( + stream_data->authority + u->field_data[URLPARSE_HOST].len, extra, ":%u", + u->port); } /* If we don't have path in URI, we use "/" as path. */ stream_data->pathlen = 1; - if (u->field_set & (1 << UF_PATH)) { - stream_data->pathlen = u->field_data[UF_PATH].len; + if (u->field_set & (1 << URLPARSE_PATH)) { + stream_data->pathlen = u->field_data[URLPARSE_PATH].len; } - if (u->field_set & (1 << UF_QUERY)) { + if (u->field_set & (1 << URLPARSE_QUERY)) { /* +1 for '?' character */ - stream_data->pathlen += (size_t)(u->field_data[UF_QUERY].len + 1); + stream_data->pathlen += (size_t)(u->field_data[URLPARSE_QUERY].len + 1); } stream_data->path = malloc(stream_data->pathlen); - if (u->field_set & (1 << UF_PATH)) { - memcpy(stream_data->path, &uri[u->field_data[UF_PATH].off], - u->field_data[UF_PATH].len); + if (u->field_set & (1 << URLPARSE_PATH)) { + memcpy(stream_data->path, &uri[u->field_data[URLPARSE_PATH].off], + u->field_data[URLPARSE_PATH].len); } else { stream_data->path[0] = '/'; } - if (u->field_set & (1 << UF_QUERY)) { - stream_data->path[stream_data->pathlen - u->field_data[UF_QUERY].len - 1] = - '?'; + if (u->field_set & (1 << URLPARSE_QUERY)) { + stream_data + ->path[stream_data->pathlen - u->field_data[URLPARSE_QUERY].len - 1] = + '?'; memcpy(stream_data->path + stream_data->pathlen - - u->field_data[UF_QUERY].len, - &uri[u->field_data[UF_QUERY].off], u->field_data[UF_QUERY].len); + u->field_data[URLPARSE_QUERY].len, + &uri[u->field_data[URLPARSE_QUERY].off], + u->field_data[URLPARSE_QUERY].len); } return stream_data; @@ -196,18 +199,19 @@ static void print_headers(FILE *f, nghttp2_nv *nva, size_t nvlen) { fprintf(f, "\n"); } -/* nghttp2_send_callback. Here we transmit the |data|, |length| bytes, - to the network. Because we are using libevent bufferevent, we just - write those bytes into bufferevent buffer. */ -static ssize_t send_callback(nghttp2_session *session, const uint8_t *data, - size_t length, int flags, void *user_data) { +/* nghttp2_send_callback2. Here we transmit the |data|, |length| + bytes, to the network. Because we are using libevent bufferevent, + we just write those bytes into bufferevent buffer. */ +static nghttp2_ssize send_callback(nghttp2_session *session, + const uint8_t *data, size_t length, + int flags, void *user_data) { http2_session_data *session_data = (http2_session_data *)user_data; struct bufferevent *bev = session_data->bev; (void)session; (void)flags; bufferevent_write(bev, data, length); - return (ssize_t)length; + return (nghttp2_ssize)length; } /* nghttp2_on_header_callback: Called when nghttp2 library emits @@ -308,23 +312,6 @@ static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, return 0; } -#ifndef OPENSSL_NO_NEXTPROTONEG -/* NPN TLS extension client callback. We check that server advertised - the HTTP/2 protocol the nghttp2 library supports. If not, exit - the program. */ -static int select_next_proto_cb(SSL *ssl, unsigned char **out, - unsigned char *outlen, const unsigned char *in, - unsigned int inlen, void *arg) { - (void)ssl; - (void)arg; - - if (nghttp2_select_next_protocol(out, outlen, in, inlen) <= 0) { - errx(1, "Server did not advertise " NGHTTP2_PROTO_VERSION_ID); - } - return SSL_TLSEXT_ERR_OK; -} -#endif /* !OPENSSL_NO_NEXTPROTONEG */ - /* Create SSL_CTX. */ static SSL_CTX *create_ssl_ctx(void) { SSL_CTX *ssl_ctx; @@ -333,17 +320,11 @@ static SSL_CTX *create_ssl_ctx(void) { errx(1, "Could not create SSL/TLS context: %s", ERR_error_string(ERR_get_error(), NULL)); } - SSL_CTX_set_options(ssl_ctx, - SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | - SSL_OP_NO_COMPRESSION | - SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, NULL); -#endif /* !OPENSSL_NO_NEXTPROTONEG */ - -#if OPENSSL_VERSION_NUMBER >= 0x10002000L + SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | + SSL_OP_NO_COMPRESSION | + SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); + SSL_CTX_set_alpn_protos(ssl_ctx, (const unsigned char *)"\x02h2", 3); -#endif /* OPENSSL_VERSION_NUMBER >= 0x10002000L */ return ssl_ctx; } @@ -364,22 +345,22 @@ static void initialize_nghttp2_session(http2_session_data *session_data) { nghttp2_session_callbacks_new(&callbacks); - nghttp2_session_callbacks_set_send_callback(callbacks, send_callback); + nghttp2_session_callbacks_set_send_callback2(callbacks, send_callback); nghttp2_session_callbacks_set_on_frame_recv_callback(callbacks, on_frame_recv_callback); nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - callbacks, on_data_chunk_recv_callback); + callbacks, on_data_chunk_recv_callback); nghttp2_session_callbacks_set_on_stream_close_callback( - callbacks, on_stream_close_callback); + callbacks, on_stream_close_callback); nghttp2_session_callbacks_set_on_header_callback(callbacks, on_header_callback); nghttp2_session_callbacks_set_on_begin_headers_callback( - callbacks, on_begin_headers_callback); + callbacks, on_begin_headers_callback); nghttp2_session_client_new(&session_data->session, callbacks, session_data); @@ -388,7 +369,7 @@ static void initialize_nghttp2_session(http2_session_data *session_data) { static void send_client_connection_header(http2_session_data *session_data) { nghttp2_settings_entry iv[1] = { - {NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100}}; + {NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100}}; int rv; /* client 24 bytes magic string will be sent by nghttp2 library */ @@ -401,14 +382,14 @@ static void send_client_connection_header(http2_session_data *session_data) { #define MAKE_NV(NAME, VALUE, VALUELEN) \ { \ - (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, VALUELEN, \ - NGHTTP2_NV_FLAG_NONE \ + (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, \ + VALUELEN, NGHTTP2_NV_FLAG_NONE, \ } #define MAKE_NV2(NAME, VALUE) \ { \ - (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \ - NGHTTP2_NV_FLAG_NONE \ + (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, \ + sizeof(VALUE) - 1, NGHTTP2_NV_FLAG_NONE, \ } /* Send HTTP request to the remote peer */ @@ -416,17 +397,17 @@ static void submit_request(http2_session_data *session_data) { int32_t stream_id; http2_stream_data *stream_data = session_data->stream_data; const char *uri = stream_data->uri; - const struct http_parser_url *u = stream_data->u; + const urlparse_url *u = stream_data->u; nghttp2_nv hdrs[] = { - MAKE_NV2(":method", "GET"), - MAKE_NV(":scheme", &uri[u->field_data[UF_SCHEMA].off], - u->field_data[UF_SCHEMA].len), - MAKE_NV(":authority", stream_data->authority, stream_data->authoritylen), - MAKE_NV(":path", stream_data->path, stream_data->pathlen)}; + MAKE_NV2(":method", "GET"), + MAKE_NV(":scheme", &uri[u->field_data[URLPARSE_SCHEMA].off], + u->field_data[URLPARSE_SCHEMA].len), + MAKE_NV(":authority", stream_data->authority, stream_data->authoritylen), + MAKE_NV(":path", stream_data->path, stream_data->pathlen)}; fprintf(stderr, "Request headers:\n"); print_headers(stderr, hdrs, ARRLEN(hdrs)); - stream_id = nghttp2_submit_request(session_data->session, NULL, hdrs, - ARRLEN(hdrs), NULL, stream_data); + stream_id = nghttp2_submit_request2(session_data->session, NULL, hdrs, + ARRLEN(hdrs), NULL, stream_data); if (stream_id < 0) { errx(1, "Could not submit HTTP request: %s", nghttp2_strerror(stream_id)); } @@ -453,12 +434,12 @@ static int session_send(http2_session_data *session_data) { context. To send them, we call session_send() in the end. */ static void readcb(struct bufferevent *bev, void *ptr) { http2_session_data *session_data = (http2_session_data *)ptr; - ssize_t readlen; + nghttp2_ssize readlen; struct evbuffer *input = bufferevent_get_input(bev); size_t datalen = evbuffer_get_length(input); unsigned char *data = evbuffer_pullup(input, -1); - readlen = nghttp2_session_mem_recv(session_data->session, data, datalen); + readlen = nghttp2_session_mem_recv2(session_data->session, data, datalen); if (readlen < 0) { warnx("Fatal error: %s", nghttp2_strerror((int)readlen)); delete_http2_session_data(session_data); @@ -508,14 +489,9 @@ static void eventcb(struct bufferevent *bev, short events, void *ptr) { ssl = bufferevent_openssl_get_ssl(session_data->bev); -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen); -#endif /* !OPENSSL_NO_NEXTPROTONEG */ -#if OPENSSL_VERSION_NUMBER >= 0x10002000L if (alpn == NULL) { SSL_get0_alpn_selected(ssl, &alpn, &alpnlen); } -#endif /* OPENSSL_VERSION_NUMBER >= 0x10002000L */ if (alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) { fprintf(stderr, "h2 is not negotiated\n"); @@ -552,8 +528,8 @@ static void initiate_connection(struct event_base *evbase, SSL_CTX *ssl_ctx, ssl = create_ssl(ssl_ctx); bev = bufferevent_openssl_socket_new( - evbase, -1, ssl, BUFFEREVENT_SSL_CONNECTING, - BEV_OPT_DEFER_CALLBACKS | BEV_OPT_CLOSE_ON_FREE); + evbase, -1, ssl, BUFFEREVENT_SSL_CONNECTING, + BEV_OPT_DEFER_CALLBACKS | BEV_OPT_CLOSE_ON_FREE); bufferevent_enable(bev, EV_READ | EV_WRITE); bufferevent_setcb(bev, readcb, writecb, eventcb, session_data); rv = bufferevent_socket_connect_hostname(bev, session_data->dnsbase, @@ -568,7 +544,7 @@ static void initiate_connection(struct event_base *evbase, SSL_CTX *ssl_ctx, /* Get resource denoted by the |uri|. The debug and error messages are printed in stderr, while the response body is printed in stdout. */ static void run(const char *uri) { - struct http_parser_url u; + urlparse_url u; char *host; uint16_t port; int rv; @@ -577,12 +553,13 @@ static void run(const char *uri) { http2_session_data *session_data; /* Parse the |uri| and stores its components in |u| */ - rv = http_parser_parse_url(uri, strlen(uri), 0, &u); + rv = urlparse_parse_url(uri, strlen(uri), 0, &u); if (rv != 0) { errx(1, "Could not parse URI %s", uri); } - host = strndup(&uri[u.field_data[UF_HOST].off], u.field_data[UF_HOST].len); - if (!(u.field_set & (1 << UF_PORT))) { + host = strndup(&uri[u.field_data[URLPARSE_HOST].off], + u.field_data[URLPARSE_HOST].len); + if (!(u.field_set & (1 << URLPARSE_PORT))) { port = 443; } else { port = u.port; @@ -617,19 +594,6 @@ int main(int argc, char **argv) { act.sa_handler = SIG_IGN; sigaction(SIGPIPE, &act, NULL); -#if OPENSSL_VERSION_NUMBER >= 0x1010000fL - /* No explicit initialization is required. */ -#elif defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC) - CRYPTO_library_init(); -#else /* !(OPENSSL_VERSION_NUMBER >= 0x1010000fL) && \ - !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC) */ - OPENSSL_config(NULL); - SSL_load_error_strings(); - SSL_library_init(); - OpenSSL_add_all_algorithms(); -#endif /* !(OPENSSL_VERSION_NUMBER >= 0x1010000fL) && \ - !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC) */ - run(argv[1]); return 0; } diff --git a/lib/nghttp2/examples/libevent-server.c b/lib/nghttp2-1.65.0/examples/libevent-server.c similarity index 85% rename from lib/nghttp2/examples/libevent-server.c rename to lib/nghttp2-1.65.0/examples/libevent-server.c index bca8b645153..d04f444330f 100644 --- a/lib/nghttp2/examples/libevent-server.c +++ b/lib/nghttp2-1.65.0/examples/libevent-server.c @@ -71,6 +71,7 @@ #include #include +#define NGHTTP2_NO_SSIZE_T #include #define OUTPUT_WOULDBLOCK_THRESHOLD (1 << 16) @@ -79,8 +80,8 @@ #define MAKE_NV(NAME, VALUE) \ { \ - (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \ - NGHTTP2_NV_FLAG_NONE \ + (uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, \ + sizeof(VALUE) - 1, NGHTTP2_NV_FLAG_NONE, \ } struct app_context; @@ -106,22 +107,6 @@ struct app_context { struct event_base *evbase; }; -static unsigned char next_proto_list[256]; -static size_t next_proto_list_len; - -#ifndef OPENSSL_NO_NEXTPROTONEG -static int next_proto_cb(SSL *ssl, const unsigned char **data, - unsigned int *len, void *arg) { - (void)ssl; - (void)arg; - - *data = next_proto_list; - *len = (unsigned int)next_proto_list_len; - return SSL_TLSEXT_ERR_OK; -} -#endif /* !OPENSSL_NO_NEXTPROTONEG */ - -#if OPENSSL_VERSION_NUMBER >= 0x10002000L static int alpn_select_proto_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { @@ -129,7 +114,7 @@ static int alpn_select_proto_cb(SSL *ssl, const unsigned char **out, (void)ssl; (void)arg; - rv = nghttp2_select_next_protocol((unsigned char **)out, outlen, in, inlen); + rv = nghttp2_select_alpn(out, outlen, in, inlen); if (rv != 1) { return SSL_TLSEXT_ERR_NOACK; @@ -137,7 +122,6 @@ static int alpn_select_proto_cb(SSL *ssl, const unsigned char **out, return SSL_TLSEXT_ERR_OK; } -#endif /* OPENSSL_VERSION_NUMBER >= 0x10002000L */ /* Create SSL_CTX. */ static SSL_CTX *create_ssl_ctx(const char *key_file, const char *cert_file) { @@ -148,10 +132,9 @@ static SSL_CTX *create_ssl_ctx(const char *key_file, const char *cert_file) { errx(1, "Could not create SSL/TLS context: %s", ERR_error_string(ERR_get_error(), NULL)); } - SSL_CTX_set_options(ssl_ctx, - SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | - SSL_OP_NO_COMPRESSION | - SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); + SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | + SSL_OP_NO_COMPRESSION | + SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); #if OPENSSL_VERSION_NUMBER >= 0x30000000L if (SSL_CTX_set1_curves_list(ssl_ctx, "P-256") != 1) { errx(1, "SSL_CTX_set1_curves_list failed: %s", @@ -177,18 +160,7 @@ static SSL_CTX *create_ssl_ctx(const char *key_file, const char *cert_file) { errx(1, "Could not read certificate file %s", cert_file); } - next_proto_list[0] = NGHTTP2_PROTO_VERSION_ID_LEN; - memcpy(&next_proto_list[1], NGHTTP2_PROTO_VERSION_ID, - NGHTTP2_PROTO_VERSION_ID_LEN); - next_proto_list_len = 1 + NGHTTP2_PROTO_VERSION_ID_LEN; - -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, NULL); -#endif /* !OPENSSL_NO_NEXTPROTONEG */ - -#if OPENSSL_VERSION_NUMBER >= 0x10002000L SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, NULL); -#endif /* OPENSSL_VERSION_NUMBER >= 0x10002000L */ return ssl_ctx; } @@ -260,8 +232,8 @@ static http2_session_data *create_http2_session_data(app_context *app_ctx, session_data->app_ctx = app_ctx; setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); session_data->bev = bufferevent_openssl_socket_new( - app_ctx->evbase, fd, ssl, BUFFEREVENT_SSL_ACCEPTING, - BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS); + app_ctx->evbase, fd, ssl, BUFFEREVENT_SSL_ACCEPTING, + BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS); bufferevent_enable(session_data->bev, EV_READ | EV_WRITE); rv = getnameinfo(addr, (socklen_t)addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST); @@ -305,16 +277,16 @@ static int session_send(http2_session_data *session_data) { } /* Read the data in the bufferevent and feed them into nghttp2 library - function. Invocation of nghttp2_session_mem_recv() may make + function. Invocation of nghttp2_session_mem_recv2() may make additional pending frames, so call session_send() at the end of the function. */ static int session_recv(http2_session_data *session_data) { - ssize_t readlen; + nghttp2_ssize readlen; struct evbuffer *input = bufferevent_get_input(session_data->bev); size_t datalen = evbuffer_get_length(input); unsigned char *data = evbuffer_pullup(input, -1); - readlen = nghttp2_session_mem_recv(session_data->session, data, datalen); + readlen = nghttp2_session_mem_recv2(session_data->session, data, datalen); if (readlen < 0) { warnx("Fatal error: %s", nghttp2_strerror((int)readlen)); return -1; @@ -329,8 +301,9 @@ static int session_recv(http2_session_data *session_data) { return 0; } -static ssize_t send_callback(nghttp2_session *session, const uint8_t *data, - size_t length, int flags, void *user_data) { +static nghttp2_ssize send_callback(nghttp2_session *session, + const uint8_t *data, size_t length, + int flags, void *user_data) { http2_session_data *session_data = (http2_session_data *)user_data; struct bufferevent *bev = session_data->bev; (void)session; @@ -342,7 +315,7 @@ static ssize_t send_callback(nghttp2_session *session, const uint8_t *data, return NGHTTP2_ERR_WOULDBLOCK; } bufferevent_write(bev, data, length); - return (ssize_t)length; + return (nghttp2_ssize)length; } /* Returns nonzero if the string |s| ends with the substring |sub| */ @@ -386,7 +359,7 @@ static char *percent_decode(const uint8_t *value, size_t valuelen) { continue; } res[j++] = - (char)((hex_to_uint(value[i + 1]) << 4) + hex_to_uint(value[i + 2])); + (char)((hex_to_uint(value[i + 1]) << 4) + hex_to_uint(value[i + 2])); i += 3; } memcpy(&res[j], &value[i], 2); @@ -398,11 +371,11 @@ static char *percent_decode(const uint8_t *value, size_t valuelen) { return res; } -static ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t length, - uint32_t *data_flags, - nghttp2_data_source *source, - void *user_data) { +static nghttp2_ssize file_read_callback(nghttp2_session *session, + int32_t stream_id, uint8_t *buf, + size_t length, uint32_t *data_flags, + nghttp2_data_source *source, + void *user_data) { int fd = source->fd; ssize_t r; (void)session; @@ -417,17 +390,17 @@ static ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, if (r == 0) { *data_flags |= NGHTTP2_DATA_FLAG_EOF; } - return r; + return (nghttp2_ssize)r; } static int send_response(nghttp2_session *session, int32_t stream_id, nghttp2_nv *nva, size_t nvlen, int fd) { int rv; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; data_prd.source.fd = fd; - data_prd.read_callback = data_source_read_callback; + data_prd.read_callback = file_read_callback; - rv = nghttp2_submit_response(session, stream_id, nva, nvlen, &data_prd); + rv = nghttp2_submit_response2(session, stream_id, nva, nvlen, &data_prd); if (rv != 0) { warnx("Fatal error: %s", nghttp2_strerror(rv)); return -1; @@ -448,9 +421,9 @@ static int error_reply(nghttp2_session *session, rv = pipe(pipefd); if (rv != 0) { warn("Could not create pipe"); - rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, - stream_data->stream_id, - NGHTTP2_INTERNAL_ERROR); + rv = + nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, + stream_data->stream_id, NGHTTP2_INTERNAL_ERROR); if (rv != 0) { warnx("Fatal error: %s", nghttp2_strerror(rv)); return -1; @@ -493,7 +466,7 @@ static int on_header_callback(nghttp2_session *session, break; } stream_data = - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id); if (!stream_data || stream_data->request_path) { break; } @@ -583,7 +556,7 @@ static int on_frame_recv_callback(nghttp2_session *session, /* Check that the client request has finished */ if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { stream_data = - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id); /* For DATA and HEADERS frame, this callback may be called after on_stream_close_callback. Check that stream still alive. */ if (!stream_data) { @@ -618,19 +591,19 @@ static void initialize_nghttp2_session(http2_session_data *session_data) { nghttp2_session_callbacks_new(&callbacks); - nghttp2_session_callbacks_set_send_callback(callbacks, send_callback); + nghttp2_session_callbacks_set_send_callback2(callbacks, send_callback); nghttp2_session_callbacks_set_on_frame_recv_callback(callbacks, on_frame_recv_callback); nghttp2_session_callbacks_set_on_stream_close_callback( - callbacks, on_stream_close_callback); + callbacks, on_stream_close_callback); nghttp2_session_callbacks_set_on_header_callback(callbacks, on_header_callback); nghttp2_session_callbacks_set_on_begin_headers_callback( - callbacks, on_begin_headers_callback); + callbacks, on_begin_headers_callback); nghttp2_session_server_new(&session_data->session, callbacks, session_data); @@ -641,7 +614,7 @@ static void initialize_nghttp2_session(http2_session_data *session_data) { magic octets and SETTINGS frame */ static int send_server_connection_header(http2_session_data *session_data) { nghttp2_settings_entry iv[1] = { - {NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100}}; + {NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100}}; int rv; rv = nghttp2_submit_settings(session_data->session, NGHTTP2_FLAG_NONE, iv, @@ -702,14 +675,7 @@ static void eventcb(struct bufferevent *bev, short events, void *ptr) { ssl = bufferevent_openssl_get_ssl(session_data->bev); -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen); -#endif /* !OPENSSL_NO_NEXTPROTONEG */ -#if OPENSSL_VERSION_NUMBER >= 0x10002000L - if (alpn == NULL) { - SSL_get0_alpn_selected(ssl, &alpn, &alpnlen); - } -#endif /* OPENSSL_VERSION_NUMBER >= 0x10002000L */ + SSL_get0_alpn_selected(ssl, &alpn, &alpnlen); if (alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) { fprintf(stderr, "%s h2 is not negotiated\n", session_data->client_addr); @@ -770,8 +736,8 @@ static void start_listen(struct event_base *evbase, const char *service, for (rp = res; rp; rp = rp->ai_next) { struct evconnlistener *listener; listener = evconnlistener_new_bind( - evbase, acceptcb, app_ctx, LEV_OPT_CLOSE_ON_FREE | LEV_OPT_REUSEABLE, - 16, rp->ai_addr, (int)rp->ai_addrlen); + evbase, acceptcb, app_ctx, LEV_OPT_CLOSE_ON_FREE | LEV_OPT_REUSEABLE, 16, + rp->ai_addr, (int)rp->ai_addrlen); if (listener) { freeaddrinfo(res); @@ -817,19 +783,6 @@ int main(int argc, char **argv) { act.sa_handler = SIG_IGN; sigaction(SIGPIPE, &act, NULL); -#if OPENSSL_VERSION_NUMBER >= 0x1010000fL - /* No explicit initialization is required. */ -#elif defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC) - CRYPTO_library_init(); -#else /* !(OPENSSL_VERSION_NUMBER >= 0x1010000fL) && \ - !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC) */ - OPENSSL_config(NULL); - SSL_load_error_strings(); - SSL_library_init(); - OpenSSL_add_all_algorithms(); -#endif /* !(OPENSSL_VERSION_NUMBER >= 0x1010000fL) && \ - !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC) */ - run(argv[1], argv[2], argv[3]); return 0; } diff --git a/lib/nghttp2-1.65.0/install-sh b/lib/nghttp2-1.65.0/install-sh new file mode 100755 index 00000000000..ec298b53740 --- /dev/null +++ b/lib/nghttp2-1.65.0/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/lib/nghttp2/integration-tests/CMakeLists.txt b/lib/nghttp2-1.65.0/integration-tests/CMakeLists.txt similarity index 100% rename from lib/nghttp2/integration-tests/CMakeLists.txt rename to lib/nghttp2-1.65.0/integration-tests/CMakeLists.txt diff --git a/lib/nghttp2/integration-tests/Makefile.am b/lib/nghttp2-1.65.0/integration-tests/Makefile.am similarity index 100% rename from lib/nghttp2/integration-tests/Makefile.am rename to lib/nghttp2-1.65.0/integration-tests/Makefile.am diff --git a/lib/nghttp2-1.65.0/integration-tests/Makefile.in b/lib/nghttp2-1.65.0/integration-tests/Makefile.in new file mode 100644 index 00000000000..1d55f8c32f3 --- /dev/null +++ b/lib/nghttp2-1.65.0/integration-tests/Makefile.in @@ -0,0 +1,571 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2015 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@ENABLE_HTTP3_TRUE@am__append_1 = quic +subdir = integration-tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = config.go setenv +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.go.in \ + $(srcdir)/setenv.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +GO_FILES = \ + nghttpx_http1_test.go \ + nghttpx_http2_test.go \ + nghttpx_http3_test.go \ + server_tester.go \ + server_tester_http3.go + +EXTRA_DIST = \ + CMakeLists.txt \ + $(GO_FILES) \ + server.key \ + server.crt \ + alt-server.key \ + alt-server.crt \ + setenv \ + req-set-header.rb \ + resp-set-header.rb \ + req-return.rb \ + resp-return.rb + +GO_TEST_TAGS = $(am__append_1) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu integration-tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu integration-tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +config.go: $(top_builddir)/config.status $(srcdir)/config.go.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +setenv: $(top_builddir)/config.status $(srcdir)/setenv.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +it: + for i in $(GO_FILES); do [ -e $(builddir)/$$i ] || cp $(srcdir)/$$i $(builddir); done + sh setenv go test -v --tags=${GO_TEST_TAGS} + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/integration-tests/alt-server.crt b/lib/nghttp2-1.65.0/integration-tests/alt-server.crt similarity index 100% rename from lib/nghttp2/integration-tests/alt-server.crt rename to lib/nghttp2-1.65.0/integration-tests/alt-server.crt diff --git a/lib/nghttp2/integration-tests/config.go.in b/lib/nghttp2-1.65.0/integration-tests/config.go.in similarity index 100% rename from lib/nghttp2/integration-tests/config.go.in rename to lib/nghttp2-1.65.0/integration-tests/config.go.in diff --git a/lib/nghttp2/integration-tests/nghttpx_http1_test.go b/lib/nghttp2-1.65.0/integration-tests/nghttpx_http1_test.go similarity index 95% rename from lib/nghttp2/integration-tests/nghttpx_http1_test.go rename to lib/nghttp2-1.65.0/integration-tests/nghttpx_http1_test.go index 740396d8f8e..84559ce62a8 100644 --- a/lib/nghttp2/integration-tests/nghttpx_http1_test.go +++ b/lib/nghttp2-1.65.0/integration-tests/nghttpx_http1_test.go @@ -4,6 +4,7 @@ import ( "bufio" "bytes" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -58,10 +59,11 @@ func TestH1H1PlainGETClose(t *testing.T) { // 501 status code func TestH1H1InvalidMethod(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -82,10 +84,11 @@ func TestH1H1InvalidMethod(t *testing.T) { // contains multiple Content-Length header fields. func TestH1H1MultipleRequestCL(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward bad request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -133,6 +136,7 @@ func TestH1H1AffinityCookie(t *testing.T) { opts := options{ args: []string{"--affinity-cookie"}, } + st := newServerTester(t, opts) defer st.Close() @@ -149,6 +153,7 @@ func TestH1H1AffinityCookie(t *testing.T) { const pattern = `affinity=[0-9a-f]{8}; Path=/foo/bar` validCookie := regexp.MustCompile(pattern) + if got := res.header.Get("Set-Cookie"); !validCookie.MatchString(got) { t.Errorf("Set-Cookie: %v; want pattern %v", got, pattern) } @@ -161,6 +166,7 @@ func TestH1H1AffinityCookieTLS(t *testing.T) { args: []string{"--alpn-h1", "--affinity-cookie"}, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -177,6 +183,7 @@ func TestH1H1AffinityCookieTLS(t *testing.T) { const pattern = `affinity=[0-9a-f]{8}; Path=/foo/bar; Secure` validCookie := regexp.MustCompile(pattern) + if got := res.header.Get("Set-Cookie"); !validCookie.MatchString(got) { t.Errorf("Set-Cookie: %v; want pattern %v", got, pattern) } @@ -221,7 +228,8 @@ func TestH1H1GracefulShutdown(t *testing.T) { want := io.EOF b := make([]byte, 256) - if _, err := st.conn.Read(b); err == nil || err != want { + + if _, err := st.conn.Read(b); !errors.Is(err, want) { t.Errorf("st.conn.Read(): %v; want %v", err, want) } } @@ -234,6 +242,7 @@ func TestH1H1HostRewrite(t *testing.T) { w.Header().Add("request-host", r.Host) }, } + st := newServerTester(t, opts) defer st.Close() @@ -243,9 +252,11 @@ func TestH1H1HostRewrite(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } + if got, want := res.header.Get("request-host"), st.backendHost; got != want { t.Errorf("request-host: %v; want %v", got, want) } @@ -255,16 +266,18 @@ func TestH1H1HostRewrite(t *testing.T) { // characters in host header field. func TestH1H1BadHost(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, } + st := newServerTester(t, opts) defer st.Close() if _, err := io.WriteString(st.conn, "GET / HTTP/1.1\r\nTest-Case: TestH1H1HBadHost\r\nHost: foo\"bar\r\n\r\n"); err != nil { t.Fatalf("Error io.WriteString() = %v", err) } + resp, err := http.ReadResponse(bufio.NewReader(st.conn), nil) if err != nil { t.Fatalf("Error http.ReadResponse() = %v", err) @@ -281,16 +294,18 @@ func TestH1H1BadHost(t *testing.T) { // bad characters in authority component of requset URI. func TestH1H1BadAuthority(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, } + st := newServerTester(t, opts) defer st.Close() if _, err := io.WriteString(st.conn, "GET http://foo\"bar/ HTTP/1.1\r\nTest-Case: TestH1H1HBadAuthority\r\nHost: foobar\r\n\r\n"); err != nil { t.Fatalf("Error io.WriteString() = %v", err) } + resp, err := http.ReadResponse(bufio.NewReader(st.conn), nil) if err != nil { t.Fatalf("Error http.ReadResponse() = %v", err) @@ -307,16 +322,18 @@ func TestH1H1BadAuthority(t *testing.T) { // bad characters in scheme component of requset URI. func TestH1H1BadScheme(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, } + st := newServerTester(t, opts) defer st.Close() if _, err := io.WriteString(st.conn, "GET http*://example.com/ HTTP/1.1\r\nTest-Case: TestH1H1HBadScheme\r\nHost: example.com\r\n\r\n"); err != nil { t.Fatalf("Error io.WriteString() = %v", err) } + resp, err := http.ReadResponse(bufio.NewReader(st.conn), nil) if err != nil { t.Fatalf("Error http.ReadResponse() = %v", err) @@ -337,6 +354,7 @@ func TestH1H1HTTP10(t *testing.T) { w.Header().Add("request-host", r.Host) }, } + st := newServerTester(t, opts) defer st.Close() @@ -354,6 +372,7 @@ func TestH1H1HTTP10(t *testing.T) { if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } + if got, want := resp.Header.Get("request-host"), st.backendHost; got != want { t.Errorf("request-host: %v; want %v", got, want) } @@ -368,6 +387,7 @@ func TestH1H1HTTP10NoHostRewrite(t *testing.T) { w.Header().Add("request-host", r.Host) }, } + st := newServerTester(t, opts) defer st.Close() @@ -385,6 +405,7 @@ func TestH1H1HTTP10NoHostRewrite(t *testing.T) { if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } + if got, want := resp.Header.Get("request-host"), st.backendHost; got != want { t.Errorf("request-host: %v; want %v", got, want) } @@ -394,14 +415,15 @@ func TestH1H1HTTP10NoHostRewrite(t *testing.T) { // backend. func TestH1H1RequestTrailer(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { buf := make([]byte, 4096) for { _, err := r.Body.Read(buf) - if err == io.EOF { - break - } if err != nil { + if errors.Is(err, io.EOF) { + break + } + t.Fatalf("r.Body.Read() = %v", err) } } @@ -410,6 +432,7 @@ func TestH1H1RequestTrailer(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -423,6 +446,7 @@ func TestH1H1RequestTrailer(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -436,10 +460,11 @@ func TestH1H1HeaderFieldBufferPath(t *testing.T) { // limit. opts := options{ args: []string{"--request-header-field-buffer=100"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatal("execution path should not be here") }, } + st := newServerTester(t, opts) defer st.Close() @@ -450,6 +475,7 @@ func TestH1H1HeaderFieldBufferPath(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusRequestHeaderFieldsTooLarge; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -460,10 +486,11 @@ func TestH1H1HeaderFieldBufferPath(t *testing.T) { func TestH1H1HeaderFieldBuffer(t *testing.T) { opts := options{ args: []string{"--request-header-field-buffer=10"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatal("execution path should not be here") }, } + st := newServerTester(t, opts) defer st.Close() @@ -473,6 +500,7 @@ func TestH1H1HeaderFieldBuffer(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusRequestHeaderFieldsTooLarge; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -483,10 +511,11 @@ func TestH1H1HeaderFieldBuffer(t *testing.T) { func TestH1H1HeaderFields(t *testing.T) { opts := options{ args: []string{"--max-request-header-fields=1"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatal("execution path should not be here") }, } + st := newServerTester(t, opts) defer st.Close() @@ -501,6 +530,7 @@ func TestH1H1HeaderFields(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusRequestHeaderFieldsTooLarge; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -515,6 +545,7 @@ func TestH1H1Websocket(t *testing.T) { } }).ServeHTTP, } + st := newServerTester(t, opts) defer st.Close() @@ -523,6 +554,7 @@ func TestH1H1Websocket(t *testing.T) { name: "TestH1H1Websocket", body: content, }) + if got, want := res.body, content; !bytes.Equal(got, want) { t.Errorf("echo: %q; want %q", got, want) } @@ -533,12 +565,13 @@ func TestH1H1Websocket(t *testing.T) { func TestH1H1ReqPhaseSetHeader(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/req-set-header.rb"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("User-Agent"), "mruby"; got != want { t.Errorf("User-Agent = %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -559,10 +592,11 @@ func TestH1H1ReqPhaseSetHeader(t *testing.T) { func TestH1H1ReqPhaseReturn(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/req-return.rb"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, } + st := newServerTester(t, opts) defer st.Close() @@ -599,10 +633,11 @@ func TestH1H1ReqPhaseReturn(t *testing.T) { func TestH1H1ReqPhaseReturnCONNECTMethod(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/req-return.rb"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, } + st := newServerTester(t, opts) defer st.Close() @@ -670,6 +705,7 @@ func TestH1H1RespPhaseSetHeader(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/resp-set-header.rb"}, } + st := newServerTester(t, opts) defer st.Close() @@ -695,6 +731,7 @@ func TestH1H1RespPhaseReturn(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/resp-return.rb"}, } + st := newServerTester(t, opts) defer st.Close() @@ -732,6 +769,7 @@ func TestH1H1HTTPSRedirect(t *testing.T) { opts := options{ args: []string{"--redirect-if-not-tls"}, } + st := newServerTester(t, opts) defer st.Close() @@ -745,6 +783,7 @@ func TestH1H1HTTPSRedirect(t *testing.T) { if got, want := res.status, http.StatusPermanentRedirect; got != want { t.Errorf("status = %v; want %v", got, want) } + if got, want := res.header.Get("location"), "https://127.0.0.1/"; got != want { t.Errorf("location: %v; want %v", got, want) } @@ -759,6 +798,7 @@ func TestH1H1HTTPSRedirectPort(t *testing.T) { "--redirect-https-port=8443", }, } + st := newServerTester(t, opts) defer st.Close() @@ -773,6 +813,7 @@ func TestH1H1HTTPSRedirectPort(t *testing.T) { if got, want := res.status, http.StatusPermanentRedirect; got != want { t.Errorf("status = %v; want %v", got, want) } + if got, want := res.header.Get("location"), "https://127.0.0.1:8443/foo?bar"; got != want { t.Errorf("location: %v; want %v", got, want) } @@ -791,6 +832,7 @@ func TestH1H1POSTRequests(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -802,6 +844,7 @@ func TestH1H1POSTRequests(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -817,6 +860,7 @@ func TestH1H1CONNECTMethodFailure(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -884,10 +928,11 @@ func TestH1H1CONNECTMethodFailure(t *testing.T) { func TestH1H2NoHost(t *testing.T) { opts := options{ args: []string{"--http2-bridge"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward bad request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -917,6 +962,7 @@ func TestH1H2HTTP10(t *testing.T) { w.Header().Add("request-host", r.Host) }, } + st := newServerTester(t, opts) defer st.Close() @@ -934,6 +980,7 @@ func TestH1H2HTTP10(t *testing.T) { if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } + if got, want := resp.Header.Get("request-host"), st.backendHost; got != want { t.Errorf("request-host: %v; want %v", got, want) } @@ -949,6 +996,7 @@ func TestH1H2HTTP10NoHostRewrite(t *testing.T) { w.Header().Add("request-host", r.Host) }, } + st := newServerTester(t, opts) defer st.Close() @@ -966,6 +1014,7 @@ func TestH1H2HTTP10NoHostRewrite(t *testing.T) { if got, want := resp.StatusCode, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } + if got, want := resp.Header.Get("request-host"), st.backendHost; got != want { t.Errorf("request-host: %v; want %v", got, want) } @@ -978,12 +1027,13 @@ func TestH1H2HTTP10NoHostRewrite(t *testing.T) { func TestH1H2CrumbleCookie(t *testing.T) { opts := options{ args: []string{"--http2-bridge"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("Cookie"), "alpha; bravo; charlie"; got != want { t.Errorf("Cookie: %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -996,6 +1046,7 @@ func TestH1H2CrumbleCookie(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -1006,12 +1057,13 @@ func TestH1H2CrumbleCookie(t *testing.T) { func TestH1H2GenerateVia(t *testing.T) { opts := options{ args: []string{"--http2-bridge"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("Via"), "1.1 nghttpx"; got != want { t.Errorf("Via: %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1021,6 +1073,7 @@ func TestH1H2GenerateVia(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.header.Get("Via"), "2 nghttpx"; got != want { t.Errorf("Via: %v; want %v", got, want) } @@ -1038,6 +1091,7 @@ func TestH1H2AppendVia(t *testing.T) { w.Header().Add("Via", "bar") }, } + st := newServerTester(t, opts) defer st.Close() @@ -1050,6 +1104,7 @@ func TestH1H2AppendVia(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.header.Get("Via"), "bar, 2 nghttpx"; got != want { t.Errorf("Via: %v; want %v", got, want) } @@ -1067,6 +1122,7 @@ func TestH1H2NoVia(t *testing.T) { w.Header().Add("Via", "bar") }, } + st := newServerTester(t, opts) defer st.Close() @@ -1079,6 +1135,7 @@ func TestH1H2NoVia(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.header.Get("Via"), "bar"; got != want { t.Errorf("Via: %v; want %v", got, want) } @@ -1092,10 +1149,11 @@ func TestH1H2ReqPhaseReturn(t *testing.T) { "--http2-bridge", "--mruby-file=" + testDir + "/req-return.rb", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, } + st := newServerTester(t, opts) defer st.Close() @@ -1136,6 +1194,7 @@ func TestH1H2RespPhaseReturn(t *testing.T) { "--mruby-file=" + testDir + "/resp-return.rb", }, } + st := newServerTester(t, opts) defer st.Close() @@ -1172,12 +1231,13 @@ func TestH1H2RespPhaseReturn(t *testing.T) { func TestH1H2TE(t *testing.T) { opts := options{ args: []string{"--http2-bridge"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("te"), "trailers"; got != want { t.Errorf("te: %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1190,6 +1250,7 @@ func TestH1H2TE(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -1200,11 +1261,12 @@ func TestH1H2TE(t *testing.T) { func TestH1APIBackendconfig(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -1220,18 +1282,21 @@ backend=127.0.0.1,3011 if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } var apiResp APIResponse - err = json.Unmarshal(res.body, &apiResp) - if err != nil { + + if err := json.Unmarshal(res.body, &apiResp); err != nil { t.Fatalf("Error unmarshaling API response: %v", err) } + if got, want := apiResp.Status, "Success"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 200; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } @@ -1242,11 +1307,12 @@ backend=127.0.0.1,3011 func TestH1APIBackendconfigQuery(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -1262,18 +1328,21 @@ backend=127.0.0.1,3011 if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } var apiResp APIResponse - err = json.Unmarshal(res.body, &apiResp) - if err != nil { + + if err := json.Unmarshal(res.body, &apiResp); err != nil { t.Fatalf("Error unmarshaling API response: %v", err) } + if got, want := apiResp.Status, "Success"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 200; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } @@ -1284,11 +1353,12 @@ backend=127.0.0.1,3011 func TestH1APIBackendconfigBadMethod(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -1304,18 +1374,21 @@ backend=127.0.0.1,3011 if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusMethodNotAllowed; got != want { t.Errorf("res.status: %v; want %v", got, want) } var apiResp APIResponse - err = json.Unmarshal(res.body, &apiResp) - if err != nil { + + if err := json.Unmarshal(res.body, &apiResp); err != nil { t.Fatalf("Error unmarshaling API response: %v", err) } + if got, want := apiResp.Status, "Failure"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 405; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } @@ -1325,11 +1398,12 @@ backend=127.0.0.1,3011 func TestH1APIConfigrevision(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -1341,23 +1415,28 @@ func TestH1APIConfigrevision(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want = %v", got, want) } var apiResp APIResponse + d := json.NewDecoder(bytes.NewBuffer(res.body)) d.UseNumber() - err = d.Decode(&apiResp) - if err != nil { + + if err := d.Decode(&apiResp); err != nil { t.Fatalf("Error unmarshalling API response: %v", err) } + if got, want := apiResp.Status, "Success"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 200; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Data["configRevision"], json.Number("0"); got != want { t.Errorf(`apiResp.Data["configRevision"]: %v %t; want %v`, got, got, want) } @@ -1368,11 +1447,12 @@ func TestH1APIConfigrevision(t *testing.T) { func TestH1APINotFound(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -1388,18 +1468,21 @@ backend=127.0.0.1,3011 if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusNotFound; got != want { t.Errorf("res.status: %v; want %v", got, want) } var apiResp APIResponse - err = json.Unmarshal(res.body, &apiResp) - if err != nil { + + if err := json.Unmarshal(res.body, &apiResp); err != nil { t.Fatalf("Error unmarshaling API response: %v", err) } + if got, want := apiResp.Status, "Failure"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 404; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } @@ -1409,11 +1492,12 @@ backend=127.0.0.1,3011 func TestH1Healthmon(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3011;healthmon;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3011, } + st := newServerTester(t, opts) defer st.Close() @@ -1424,6 +1508,7 @@ func TestH1Healthmon(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -1434,10 +1519,11 @@ func TestH1Healthmon(t *testing.T) { func TestH1ResponseBeforeRequestEnd(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/req-return.rb"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatal("request should not be forwarded") }, } + st := newServerTester(t, opts) defer st.Close() @@ -1462,7 +1548,7 @@ func TestH1ResponseBeforeRequestEnd(t *testing.T) { // if the backend chunked encoded response ends prematurely. func TestH1H1ChunkedEndsPrematurely(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { hj, ok := w.(http.Hijacker) if !ok { http.Error(w, "Could not hijack the connection", http.StatusInternalServerError) @@ -1480,6 +1566,7 @@ func TestH1H1ChunkedEndsPrematurely(t *testing.T) { bufrw.Flush() }, } + st := newServerTester(t, opts) defer st.Close() @@ -1495,10 +1582,11 @@ func TestH1H1ChunkedEndsPrematurely(t *testing.T) { // request which contains malformed transfer-encoding. func TestH1H1RequestMalformedTransferEncoding(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward bad request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -1523,7 +1611,7 @@ func TestH1H1RequestMalformedTransferEncoding(t *testing.T) { // its response contains malformed transfer-encoding. func TestH1H1ResponseMalformedTransferEncoding(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { hj, ok := w.(http.Hijacker) if !ok { http.Error(w, "Could not hijack the connection", http.StatusInternalServerError) @@ -1541,6 +1629,7 @@ func TestH1H1ResponseMalformedTransferEncoding(t *testing.T) { bufrw.Flush() }, } + st := newServerTester(t, opts) defer st.Close() @@ -1550,6 +1639,7 @@ func TestH1H1ResponseMalformedTransferEncoding(t *testing.T) { if err != nil { t.Fatalf("Error st.http1() = %v", err) } + if got, want := res.status, http.StatusBadGateway; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -1559,7 +1649,7 @@ func TestH1H1ResponseMalformedTransferEncoding(t *testing.T) { // its response contains unknown transfer-encoding. func TestH1H1ResponseUnknownTransferEncoding(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { hj, ok := w.(http.Hijacker) if !ok { http.Error(w, "Could not hijack the connection", http.StatusInternalServerError) @@ -1577,6 +1667,7 @@ func TestH1H1ResponseUnknownTransferEncoding(t *testing.T) { bufrw.Flush() }, } + st := newServerTester(t, opts) defer st.Close() @@ -1607,10 +1698,11 @@ func TestH1H1ResponseUnknownTransferEncoding(t *testing.T) { // HTTP/1.0 request which contains transfer-encoding. func TestH1H1RequestHTTP10TransferEncoding(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward bad request") }, } + st := newServerTester(t, opts) defer st.Close() diff --git a/lib/nghttp2/integration-tests/nghttpx_http2_test.go b/lib/nghttp2-1.65.0/integration-tests/nghttpx_http2_test.go similarity index 95% rename from lib/nghttp2/integration-tests/nghttpx_http2_test.go rename to lib/nghttp2-1.65.0/integration-tests/nghttpx_http2_test.go index 5324a18c525..d94eaf5849c 100644 --- a/lib/nghttp2/integration-tests/nghttpx_http2_test.go +++ b/lib/nghttp2-1.65.0/integration-tests/nghttpx_http2_test.go @@ -4,6 +4,7 @@ import ( "bytes" "crypto/tls" "encoding/json" + "errors" "fmt" "io" "net" @@ -40,13 +41,14 @@ func TestH2H1PlainGET(t *testing.T) { func TestH2H1AddXfp(t *testing.T) { opts := options{ args: []string{"--no-strip-incoming-x-forwarded-proto"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xfp := r.Header.Get("X-Forwarded-Proto") if got, want := xfp, "foo, http"; got != want { t.Errorf("X-Forwarded-Proto = %q; want %q", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -59,6 +61,7 @@ func TestH2H1AddXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -72,13 +75,14 @@ func TestH2H1NoAddXfp(t *testing.T) { "--no-add-x-forwarded-proto", "--no-strip-incoming-x-forwarded-proto", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xfp := r.Header.Get("X-Forwarded-Proto") if got, want := xfp, "foo"; got != want { t.Errorf("X-Forwarded-Proto = %q; want %q", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -91,6 +95,7 @@ func TestH2H1NoAddXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -100,13 +105,14 @@ func TestH2H1NoAddXfp(t *testing.T) { // x-forwarded-proto header field. func TestH2H1StripXfp(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xfp := r.Header.Get("X-Forwarded-Proto") if got, want := xfp, "http"; got != want { t.Errorf("X-Forwarded-Proto = %q; want %q", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -119,6 +125,7 @@ func TestH2H1StripXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -129,12 +136,13 @@ func TestH2H1StripXfp(t *testing.T) { func TestH2H1StripNoAddXfp(t *testing.T) { opts := options{ args: []string{"--no-add-x-forwarded-proto"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, found := r.Header["X-Forwarded-Proto"]; found { t.Errorf("X-Forwarded-Proto = %q; want nothing", got) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -147,6 +155,7 @@ func TestH2H1StripNoAddXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -157,7 +166,7 @@ func TestH2H1StripNoAddXfp(t *testing.T) { func TestH2H1AddXff(t *testing.T) { opts := options{ args: []string{"--add-x-forwarded-for"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xff := r.Header.Get("X-Forwarded-For") want := "127.0.0.1" if xff != want { @@ -165,6 +174,7 @@ func TestH2H1AddXff(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -174,6 +184,7 @@ func TestH2H1AddXff(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -184,7 +195,7 @@ func TestH2H1AddXff(t *testing.T) { func TestH2H1AddXff2(t *testing.T) { opts := options{ args: []string{"--add-x-forwarded-for"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xff := r.Header.Get("X-Forwarded-For") want := "host, 127.0.0.1" if xff != want { @@ -192,6 +203,7 @@ func TestH2H1AddXff2(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -204,6 +216,7 @@ func TestH2H1AddXff2(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -214,12 +227,13 @@ func TestH2H1AddXff2(t *testing.T) { func TestH2H1StripXff(t *testing.T) { opts := options{ args: []string{"--strip-incoming-x-forwarded-for"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if xff, found := r.Header["X-Forwarded-For"]; found { t.Errorf("X-Forwarded-For = %v; want nothing", xff) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -232,6 +246,7 @@ func TestH2H1StripXff(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -245,7 +260,7 @@ func TestH2H1StripAddXff(t *testing.T) { "--strip-incoming-x-forwarded-for", "--add-x-forwarded-for", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xff := r.Header.Get("X-Forwarded-For") want := "127.0.0.1" if xff != want { @@ -253,6 +268,7 @@ func TestH2H1StripAddXff(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -265,6 +281,7 @@ func TestH2H1StripAddXff(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -275,7 +292,7 @@ func TestH2H1StripAddXff(t *testing.T) { func TestH2H1AddForwardedObfuscated(t *testing.T) { opts := options{ args: []string{"--add-forwarded=by,for,host,proto"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { pattern := fmt.Sprintf(`by=_[^;]+;for=_[^;]+;host="127\.0\.0\.1:%v";proto=http`, serverPort) validFwd := regexp.MustCompile(pattern) got := r.Header.Get("Forwarded") @@ -285,6 +302,7 @@ func TestH2H1AddForwardedObfuscated(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -294,6 +312,7 @@ func TestH2H1AddForwardedObfuscated(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -304,7 +323,7 @@ func TestH2H1AddForwardedObfuscated(t *testing.T) { func TestH2H1AddForwardedByIP(t *testing.T) { opts := options{ args: []string{"--add-forwarded=by,for", "--forwarded-by=ip"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { pattern := fmt.Sprintf(`by="127\.0\.0\.1:%v";for=_[^;]+`, serverPort) validFwd := regexp.MustCompile(pattern) if got := r.Header.Get("Forwarded"); !validFwd.MatchString(got) { @@ -312,6 +331,7 @@ func TestH2H1AddForwardedByIP(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -321,6 +341,7 @@ func TestH2H1AddForwardedByIP(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -335,13 +356,14 @@ func TestH2H1AddForwardedForIP(t *testing.T) { "--forwarded-by=_alpha", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { want := fmt.Sprintf(`by=_alpha;for=127.0.0.1;host="127.0.0.1:%v";proto=http`, serverPort) if got := r.Header.Get("Forwarded"); got != want { t.Errorf("Forwarded = %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -351,6 +373,7 @@ func TestH2H1AddForwardedForIP(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -362,12 +385,13 @@ func TestH2H1AddForwardedForIP(t *testing.T) { func TestH2H1AddForwardedMerge(t *testing.T) { opts := options{ args: []string{"--add-forwarded=proto"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("Forwarded"), `host=foo, proto=http`; got != want { t.Errorf("Forwarded = %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -380,6 +404,7 @@ func TestH2H1AddForwardedMerge(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -394,12 +419,13 @@ func TestH2H1AddForwardedStrip(t *testing.T) { "--strip-incoming-forwarded", "--add-forwarded=proto", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("Forwarded"), `proto=http`; got != want { t.Errorf("Forwarded = %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -412,6 +438,7 @@ func TestH2H1AddForwardedStrip(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -422,12 +449,13 @@ func TestH2H1AddForwardedStrip(t *testing.T) { func TestH2H1StripForwarded(t *testing.T) { opts := options{ args: []string{"--strip-incoming-forwarded"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, found := r.Header["Forwarded"]; found { t.Errorf("Forwarded = %v; want nothing", got) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -440,6 +468,7 @@ func TestH2H1StripForwarded(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -454,7 +483,7 @@ func TestH2H1AddForwardedStatic(t *testing.T) { "--add-forwarded=by,for", "--forwarded-by=_alpha", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { pattern := `by=_alpha;for=_[^;]+` validFwd := regexp.MustCompile(pattern) if got := r.Header.Get("Forwarded"); !validFwd.MatchString(got) { @@ -462,6 +491,7 @@ func TestH2H1AddForwardedStatic(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -471,6 +501,7 @@ func TestH2H1AddForwardedStatic(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -480,12 +511,13 @@ func TestH2H1AddForwardedStatic(t *testing.T) { // from backend server. func TestH2H1GenerateVia(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("Via"), "2 nghttpx"; got != want { t.Errorf("Via: %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -495,6 +527,7 @@ func TestH2H1GenerateVia(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.header.Get("Via"), "1.1 nghttpx"; got != want { t.Errorf("Via: %v; want %v", got, want) } @@ -511,6 +544,7 @@ func TestH2H1AppendVia(t *testing.T) { w.Header().Add("Via", "bar") }, } + st := newServerTester(t, opts) defer st.Close() @@ -523,6 +557,7 @@ func TestH2H1AppendVia(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.header.Get("Via"), "bar, 1.1 nghttpx"; got != want { t.Errorf("Via: %v; want %v", got, want) } @@ -540,6 +575,7 @@ func TestH2H1NoVia(t *testing.T) { w.Header().Add("Via", "bar") }, } + st := newServerTester(t, opts) defer st.Close() @@ -552,6 +588,7 @@ func TestH2H1NoVia(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.header.Get("Via"), "bar"; got != want { t.Errorf("Via: %v; want %v", got, want) } @@ -565,6 +602,7 @@ func TestH2H1HostRewrite(t *testing.T) { w.Header().Add("request-host", r.Host) }, } + st := newServerTester(t, opts) defer st.Close() @@ -574,9 +612,11 @@ func TestH2H1HostRewrite(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } + if got, want := res.header.Get("request-host"), st.backendHost; got != want { t.Errorf("request-host: %v; want %v", got, want) } @@ -590,6 +630,7 @@ func TestH2H1NoHostRewrite(t *testing.T) { w.Header().Add("request-host", r.Host) }, } + st := newServerTester(t, opts) defer st.Close() @@ -599,9 +640,11 @@ func TestH2H1NoHostRewrite(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } + if got, want := res.header.Get("request-host"), st.frontendHost; got != want { t.Errorf("request-host: %v; want %v", got, want) } @@ -639,7 +682,7 @@ func TestH2H1BadRequestCL(t *testing.T) { // response body size. func TestH2H1BadResponseCL(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { // we set content-length: 1024, but only send 3 bytes. w.Header().Add("Content-Length", "1024") if _, err := w.Write([]byte("foo")); err != nil { @@ -647,6 +690,7 @@ func TestH2H1BadResponseCL(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -667,13 +711,14 @@ func TestH2H1BadResponseCL(t *testing.T) { // works. func TestH2H1LocationRewrite(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { // TODO we cannot get st.ts's port number // here.. 8443 is just a place holder. We // ignore it on rewrite. w.Header().Add("Location", "http://127.0.0.1:8443/p/q?a=b#fragment") }, } + st := newServerTester(t, opts) defer st.Close() @@ -693,7 +738,7 @@ func TestH2H1LocationRewrite(t *testing.T) { // TestH2H1ChunkedRequestBody tests that chunked request body works. func TestH2H1ChunkedRequestBody(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { want := "[chunked]" if got := fmt.Sprint(r.TransferEncoding); got != want { t.Errorf("Transfer-Encoding: %v; want %v", got, want) @@ -708,6 +753,7 @@ func TestH2H1ChunkedRequestBody(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -719,6 +765,7 @@ func TestH2H1ChunkedRequestBody(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -728,10 +775,11 @@ func TestH2H1ChunkedRequestBody(t *testing.T) { // multiple Content-Length request header fields. func TestH2H1MultipleRequestCL(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward bad request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -745,6 +793,7 @@ func TestH2H1MultipleRequestCL(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.errCode, http2.ErrCodeProtocol; got != want { t.Errorf("res.errCode: %v; want %v", got, want) } @@ -754,10 +803,11 @@ func TestH2H1MultipleRequestCL(t *testing.T) { // Content-Length which cannot be parsed as a number. func TestH2H1InvalidRequestCL(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward bad request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -770,6 +820,7 @@ func TestH2H1InvalidRequestCL(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.errCode, http2.ErrCodeProtocol; got != want { t.Errorf("res.errCode: %v; want %v", got, want) } @@ -800,10 +851,11 @@ func TestH2H1InvalidRequestCL(t *testing.T) { // 501. func TestH2H1InvalidMethod(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -814,6 +866,7 @@ func TestH2H1InvalidMethod(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusNotImplemented; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -823,10 +876,11 @@ func TestH2H1InvalidMethod(t *testing.T) { // bad characters in :authority header field. func TestH2H1BadAuthority(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -837,6 +891,7 @@ func TestH2H1BadAuthority(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.errCode, http2.ErrCodeProtocol; got != want { t.Errorf("res.errCode: %v; want %v", got, want) } @@ -846,10 +901,11 @@ func TestH2H1BadAuthority(t *testing.T) { // bad characters in :scheme header field. func TestH2H1BadScheme(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -860,6 +916,7 @@ func TestH2H1BadScheme(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.errCode, http2.ErrCodeProtocol; got != want { t.Errorf("res.errCode: %v; want %v", got, want) } @@ -869,12 +926,13 @@ func TestH2H1BadScheme(t *testing.T) { // request is assembled into 1 when forwarding to HTTP/1 backend link. func TestH2H1AssembleCookies(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("Cookie"), "alpha; bravo; charlie"; got != want { t.Errorf("Cookie: %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -889,6 +947,7 @@ func TestH2H1AssembleCookies(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -909,6 +968,7 @@ func TestH2H1TETrailers(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -918,10 +978,11 @@ func TestH2H1TETrailers(t *testing.T) { // field contains gzip. func TestH2H1TEGzip(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Error("server should not forward bad request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -934,6 +995,7 @@ func TestH2H1TEGzip(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.errCode, http2.ErrCodeProtocol; got != want { t.Errorf("res.errCode = %v; want %v", res.errCode, want) } @@ -950,6 +1012,7 @@ func TestH2H1SNI(t *testing.T) { ServerName: "alt-domain", }, } + st := newServerTester(t, opts) defer st.Close() @@ -967,13 +1030,14 @@ func TestH2H1SNI(t *testing.T) { // connection is encrypted. func TestH2H1TLSXfp(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("x-forwarded-proto"), "http"; got != want { t.Errorf("x-forwarded-proto: want %v; got %v", want, got) } }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -983,6 +1047,7 @@ func TestH2H1TLSXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -999,6 +1064,7 @@ func TestH2H1ServerPush(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1008,16 +1074,20 @@ func TestH2H1ServerPush(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } + if got, want := len(res.pushResponse), 2; got != want { t.Fatalf("len(res.pushResponse): %v; want %v", got, want) } + mainCSS := res.pushResponse[0] if got, want := mainCSS.status, http.StatusOK; got != want { t.Errorf("mainCSS.status: %v; want %v", got, want) } + themeCSS := res.pushResponse[1] if got, want := themeCSS.status, http.StatusOK; got != want { t.Errorf("themeCSS.status: %v; want %v", got, want) @@ -1028,14 +1098,15 @@ func TestH2H1ServerPush(t *testing.T) { // backend. func TestH2H1RequestTrailer(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { buf := make([]byte, 4096) for { _, err := r.Body.Read(buf) - if err == io.EOF { - break - } if err != nil { + if errors.Is(err, io.EOF) { + break + } + t.Fatalf("r.Body.Read() = %v", err) } } @@ -1044,6 +1115,7 @@ func TestH2H1RequestTrailer(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1057,6 +1129,7 @@ func TestH2H1RequestTrailer(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -1067,10 +1140,11 @@ func TestH2H1RequestTrailer(t *testing.T) { func TestH2H1HeaderFieldBuffer(t *testing.T) { opts := options{ args: []string{"--request-header-field-buffer=10"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatal("execution path should not be here") }, } + st := newServerTester(t, opts) defer st.Close() @@ -1080,6 +1154,7 @@ func TestH2H1HeaderFieldBuffer(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusRequestHeaderFieldsTooLarge; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -1090,10 +1165,11 @@ func TestH2H1HeaderFieldBuffer(t *testing.T) { func TestH2H1HeaderFields(t *testing.T) { opts := options{ args: []string{"--max-request-header-fields=1"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatal("execution path should not be here") }, } + st := newServerTester(t, opts) defer st.Close() @@ -1105,6 +1181,7 @@ func TestH2H1HeaderFields(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusRequestHeaderFieldsTooLarge; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -1115,12 +1192,13 @@ func TestH2H1HeaderFields(t *testing.T) { func TestH2H1ReqPhaseSetHeader(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/req-set-header.rb"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("User-Agent"), "mruby"; got != want { t.Errorf("User-Agent = %v; want %v", got, want) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1141,10 +1219,11 @@ func TestH2H1ReqPhaseSetHeader(t *testing.T) { func TestH2H1ReqPhaseReturn(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/req-return.rb"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, } + st := newServerTester(t, opts) defer st.Close() @@ -1165,6 +1244,7 @@ func TestH2H1ReqPhaseReturn(t *testing.T) { {"content-length", "20"}, {"from", "mruby"}, } + for _, tt := range hdtests { if got, want := res.header.Get(tt.k), tt.v; got != want { t.Errorf("%v = %v; want %v", tt.k, got, want) @@ -1182,6 +1262,7 @@ func TestH2H1RespPhaseSetHeader(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/resp-set-header.rb"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1207,6 +1288,7 @@ func TestH2H1RespPhaseReturn(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/resp-return.rb"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1227,6 +1309,7 @@ func TestH2H1RespPhaseReturn(t *testing.T) { {"content-length", "21"}, {"from", "mruby"}, } + for _, tt := range hdtests { if got, want := res.header.Get(tt.k), tt.v; got != want { t.Errorf("%v = %v; want %v", tt.k, got, want) @@ -1266,6 +1349,7 @@ func TestH2H1Upgrade(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -1284,12 +1368,13 @@ func TestH2H1ProxyProtocolV1ForwardedForObfuscated(t *testing.T) { "--add-forwarded=for", "--forwarded-for=obfuscated", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got := r.Header.Get("Forwarded"); !validFwd.MatchString(got) { t.Errorf("Forwarded: %v; want pattern %v", got, pattern) } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1300,7 +1385,6 @@ func TestH2H1ProxyProtocolV1ForwardedForObfuscated(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1ForwardedForObfuscated", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -1321,7 +1405,7 @@ func TestH2H1ProxyProtocolV1TCP4(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "192.168.0.2"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -1330,6 +1414,7 @@ func TestH2H1ProxyProtocolV1TCP4(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1340,7 +1425,6 @@ func TestH2H1ProxyProtocolV1TCP4(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1TCP4", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -1361,7 +1445,7 @@ func TestH2H1ProxyProtocolV1TCP6(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "2001:0db8:85a3:0000:0000:8a2e:0370:7334"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -1370,6 +1454,7 @@ func TestH2H1ProxyProtocolV1TCP6(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1380,7 +1465,6 @@ func TestH2H1ProxyProtocolV1TCP6(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1TCP6", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -1401,7 +1485,7 @@ func TestH2H1ProxyProtocolV1TCP4TLS(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "192.168.0.2"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -1412,13 +1496,13 @@ func TestH2H1ProxyProtocolV1TCP4TLS(t *testing.T) { tls: true, tcpData: []byte("PROXY TCP4 192.168.0.2 192.168.0.100 12345 8080\r\n"), } + st := newServerTester(t, opts) defer st.Close() res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1TCP4TLS", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -1439,7 +1523,7 @@ func TestH2H1ProxyProtocolV1TCP6TLS(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "2001:0db8:85a3:0000:0000:8a2e:0370:7334"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -1450,13 +1534,13 @@ func TestH2H1ProxyProtocolV1TCP6TLS(t *testing.T) { tls: true, tcpData: []byte("PROXY TCP6 2001:0db8:85a3:0000:0000:8a2e:0370:7334 ::1 12345 8080\r\n"), } + st := newServerTester(t, opts) defer st.Close() res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1TCP6TLS", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -1476,7 +1560,7 @@ func TestH2H1ProxyProtocolV1Unknown(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, notWant := r.Header.Get("X-Forwarded-For"), "192.168.0.2"; got == notWant { t.Errorf("X-Forwarded-For: %v; want something else", got) } @@ -1485,6 +1569,7 @@ func TestH2H1ProxyProtocolV1Unknown(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1495,7 +1580,6 @@ func TestH2H1ProxyProtocolV1Unknown(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1Unknown", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -1514,6 +1598,7 @@ func TestH2H1ProxyProtocolV1JustUnknown(t *testing.T) { "--add-x-forwarded-for", }, } + st := newServerTester(t, opts) defer st.Close() @@ -1524,7 +1609,6 @@ func TestH2H1ProxyProtocolV1JustUnknown(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1JustUnknown", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -1543,6 +1627,7 @@ func TestH2H1ProxyProtocolV1TooLongLine(t *testing.T) { "--add-x-forwarded-for", }, } + st := newServerTester(t, opts) defer st.Close() @@ -1553,7 +1638,6 @@ func TestH2H1ProxyProtocolV1TooLongLine(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1TooLongLine", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1565,6 +1649,7 @@ func TestH2H1ProxyProtocolV1BadLineEnd(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1575,7 +1660,6 @@ func TestH2H1ProxyProtocolV1BadLineEnd(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1BadLineEnd", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1587,6 +1671,7 @@ func TestH2H1ProxyProtocolV1NoEnd(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1597,7 +1682,6 @@ func TestH2H1ProxyProtocolV1NoEnd(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1NoEnd", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1609,11 +1693,13 @@ func TestH2H1ProxyProtocolV1EmbeddedNULL(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() b := []byte("PROXY TCP6 ::1*foo ::1 12345 8080\r\n") b[14] = 0 + if _, err := st.conn.Write(b); err != nil { t.Fatalf("Error st.conn.Write() = %v", err) } @@ -1621,7 +1707,6 @@ func TestH2H1ProxyProtocolV1EmbeddedNULL(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1EmbeddedNULL", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1633,6 +1718,7 @@ func TestH2H1ProxyProtocolV1MissingSrcPort(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1643,7 +1729,6 @@ func TestH2H1ProxyProtocolV1MissingSrcPort(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1MissingSrcPort", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1655,6 +1740,7 @@ func TestH2H1ProxyProtocolV1MissingDstPort(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1665,7 +1751,6 @@ func TestH2H1ProxyProtocolV1MissingDstPort(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1MissingDstPort", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1677,6 +1762,7 @@ func TestH2H1ProxyProtocolV1InvalidSrcPort(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1687,7 +1773,6 @@ func TestH2H1ProxyProtocolV1InvalidSrcPort(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1InvalidSrcPort", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1699,6 +1784,7 @@ func TestH2H1ProxyProtocolV1InvalidDstPort(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1709,7 +1795,6 @@ func TestH2H1ProxyProtocolV1InvalidDstPort(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1InvalidDstPort", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1722,6 +1807,7 @@ func TestH2H1ProxyProtocolV1LeadingZeroPort(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1732,7 +1818,6 @@ func TestH2H1ProxyProtocolV1LeadingZeroPort(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1LeadingZeroPort", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1744,6 +1829,7 @@ func TestH2H1ProxyProtocolV1TooLargeSrcPort(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1754,7 +1840,6 @@ func TestH2H1ProxyProtocolV1TooLargeSrcPort(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1TooLargeSrcPort", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1766,6 +1851,7 @@ func TestH2H1ProxyProtocolV1TooLargeDstPort(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1776,7 +1862,6 @@ func TestH2H1ProxyProtocolV1TooLargeDstPort(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1TooLargeDstPort", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1788,6 +1873,7 @@ func TestH2H1ProxyProtocolV1InvalidSrcAddr(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1798,7 +1884,6 @@ func TestH2H1ProxyProtocolV1InvalidSrcAddr(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1InvalidSrcAddr", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1810,6 +1895,7 @@ func TestH2H1ProxyProtocolV1InvalidDstAddr(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1820,7 +1906,6 @@ func TestH2H1ProxyProtocolV1InvalidDstAddr(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1InvalidDstAddr", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1832,6 +1917,7 @@ func TestH2H1ProxyProtocolV1InvalidProtoFamily(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1842,7 +1928,6 @@ func TestH2H1ProxyProtocolV1InvalidProtoFamily(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1InvalidProtoFamily", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1854,6 +1939,7 @@ func TestH2H1ProxyProtocolV1InvalidID(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -1864,7 +1950,6 @@ func TestH2H1ProxyProtocolV1InvalidID(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV1InvalidID", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -1881,7 +1966,7 @@ func TestH2H1ProxyProtocolV2TCP4(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "192.168.0.2"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -1890,6 +1975,7 @@ func TestH2H1ProxyProtocolV2TCP4(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1916,7 +2002,6 @@ func TestH2H1ProxyProtocolV2TCP4(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV2TCP4", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -1937,7 +2022,7 @@ func TestH2H1ProxyProtocolV2TCP6(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "2001:db8:85a3::8a2e:370:7334"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -1946,6 +2031,7 @@ func TestH2H1ProxyProtocolV2TCP6(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -1972,7 +2058,6 @@ func TestH2H1ProxyProtocolV2TCP6(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV2TCP6", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -2009,7 +2094,7 @@ func TestH2H1ProxyProtocolV2TCP4TLS(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "192.168.0.2"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -2020,13 +2105,13 @@ func TestH2H1ProxyProtocolV2TCP4TLS(t *testing.T) { tls: true, tcpData: v2Hdr.Bytes(), } + st := newServerTester(t, opts) defer st.Close() res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV2TCP4TLS", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -2063,7 +2148,7 @@ func TestH2H1ProxyProtocolV2TCP6TLS(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "2001:db8:85a3::8a2e:370:7334"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -2074,13 +2159,13 @@ func TestH2H1ProxyProtocolV2TCP6TLS(t *testing.T) { tls: true, tcpData: v2Hdr.Bytes(), } + st := newServerTester(t, opts) defer st.Close() res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV2TCP6TLS", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -2100,7 +2185,7 @@ func TestH2H1ProxyProtocolV2Local(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "127.0.0.1"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -2109,6 +2194,7 @@ func TestH2H1ProxyProtocolV2Local(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -2135,7 +2221,6 @@ func TestH2H1ProxyProtocolV2Local(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV2Local", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -2151,6 +2236,7 @@ func TestH2H1ProxyProtocolV2UnknownCmd(t *testing.T) { opts := options{ args: []string{"--accept-proxy-protocol"}, } + st := newServerTester(t, opts) defer st.Close() @@ -2177,7 +2263,6 @@ func TestH2H1ProxyProtocolV2UnknownCmd(t *testing.T) { _, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV2UnknownCmd", }) - if err == nil { t.Fatalf("connection was not terminated") } @@ -2193,7 +2278,7 @@ func TestH2H1ProxyProtocolV2Unix(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "127.0.0.1"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -2202,6 +2287,7 @@ func TestH2H1ProxyProtocolV2Unix(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -2228,7 +2314,6 @@ func TestH2H1ProxyProtocolV2Unix(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV2Unix", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -2248,7 +2333,7 @@ func TestH2H1ProxyProtocolV2Unspec(t *testing.T) { "--add-forwarded=for", "--forwarded-for=ip", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("X-Forwarded-For"), "127.0.0.1"; got != want { t.Errorf("X-Forwarded-For: %v; want %v", got, want) } @@ -2257,6 +2342,7 @@ func TestH2H1ProxyProtocolV2Unspec(t *testing.T) { } }, } + st := newServerTester(t, opts) defer st.Close() @@ -2275,7 +2361,6 @@ func TestH2H1ProxyProtocolV2Unspec(t *testing.T) { res, err := st.http2(requestParam{ name: "TestH2H1ProxyProtocolV2Unspec", }) - if err != nil { t.Fatalf("Error st.http2() = %v", err) } @@ -2291,6 +2376,7 @@ func TestH2H1ExternalDNS(t *testing.T) { opts := options{ args: []string{"--external-dns"}, } + st := newServerTester(t, opts) defer st.Close() @@ -2312,6 +2398,7 @@ func TestH2H1DNS(t *testing.T) { opts := options{ args: []string{"--dns"}, } + st := newServerTester(t, opts) defer st.Close() @@ -2333,6 +2420,7 @@ func TestH2H1HTTPSRedirect(t *testing.T) { opts := options{ args: []string{"--redirect-if-not-tls"}, } + st := newServerTester(t, opts) defer st.Close() @@ -2346,6 +2434,7 @@ func TestH2H1HTTPSRedirect(t *testing.T) { if got, want := res.status, http.StatusPermanentRedirect; got != want { t.Errorf("status = %v; want %v", got, want) } + if got, want := res.header.Get("location"), "https://127.0.0.1/"; got != want { t.Errorf("location: %v; want %v", got, want) } @@ -2360,6 +2449,7 @@ func TestH2H1HTTPSRedirectPort(t *testing.T) { "--redirect-https-port=8443", }, } + st := newServerTester(t, opts) defer st.Close() @@ -2374,6 +2464,7 @@ func TestH2H1HTTPSRedirectPort(t *testing.T) { if got, want := res.status, http.StatusPermanentRedirect; got != want { t.Errorf("status = %v; want %v", got, want) } + if got, want := res.header.Get("location"), "https://127.0.0.1:8443/foo?bar"; got != want { t.Errorf("location: %v; want %v", got, want) } @@ -2383,10 +2474,11 @@ func TestH2H1HTTPSRedirectPort(t *testing.T) { // transfer-encoding is valid. func TestH2H1Code204(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusNoContent) }, } + st := newServerTester(t, opts) defer st.Close() @@ -2406,7 +2498,7 @@ func TestH2H1Code204(t *testing.T) { // is allowed. func TestH2H1Code204CL0(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { hj, ok := w.(http.Hijacker) if !ok { http.Error(w, "Could not hijack the connection", http.StatusInternalServerError) @@ -2424,6 +2516,7 @@ func TestH2H1Code204CL0(t *testing.T) { bufrw.Flush() }, } + st := newServerTester(t, opts) defer st.Close() @@ -2447,7 +2540,7 @@ func TestH2H1Code204CL0(t *testing.T) { // content-length is not allowed. func TestH2H1Code204CLNonzero(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { hj, ok := w.(http.Hijacker) if !ok { http.Error(w, "Could not hijack the connection", http.StatusInternalServerError) @@ -2465,6 +2558,7 @@ func TestH2H1Code204CLNonzero(t *testing.T) { bufrw.Flush() }, } + st := newServerTester(t, opts) defer st.Close() @@ -2484,7 +2578,7 @@ func TestH2H1Code204CLNonzero(t *testing.T) { // not allowed. func TestH2H1Code204TE(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { hj, ok := w.(http.Hijacker) if !ok { http.Error(w, "Could not hijack the connection", http.StatusInternalServerError) @@ -2502,6 +2596,7 @@ func TestH2H1Code204TE(t *testing.T) { bufrw.Flush() }, } + st := newServerTester(t, opts) defer st.Close() @@ -2523,6 +2618,7 @@ func TestH2H1AffinityCookie(t *testing.T) { opts := options{ args: []string{"--affinity-cookie"}, } + st := newServerTester(t, opts) defer st.Close() @@ -2539,6 +2635,7 @@ func TestH2H1AffinityCookie(t *testing.T) { const pattern = `affinity=[0-9a-f]{8}; Path=/foo/bar` validCookie := regexp.MustCompile(pattern) + if got := res.header.Get("Set-Cookie"); !validCookie.MatchString(got) { t.Errorf("Set-Cookie: %v; want pattern %v", got, pattern) } @@ -2551,6 +2648,7 @@ func TestH2H1AffinityCookieTLS(t *testing.T) { args: []string{"--affinity-cookie"}, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -2568,6 +2666,7 @@ func TestH2H1AffinityCookieTLS(t *testing.T) { const pattern = `affinity=[0-9a-f]{8}; Path=/foo/bar; Secure` validCookie := regexp.MustCompile(pattern) + if got := res.header.Get("Set-Cookie"); !validCookie.MatchString(got) { t.Errorf("Set-Cookie: %v; want pattern %v", got, pattern) } @@ -2579,6 +2678,7 @@ func TestH2H1GracefulShutdown(t *testing.T) { defer st.Close() fmt.Fprint(st.conn, "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n") + if err := st.fr.WriteSettings(); err != nil { t.Fatalf("st.fr.WriteSettings(): %v", err) } @@ -2620,22 +2720,27 @@ func TestH2H1GracefulShutdown(t *testing.T) { for { fr, err := st.readFrame() if err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { want := 2 if got := numGoAway; got != want { t.Fatalf("numGoAway: %v; want %v", got, want) } + return } + t.Fatalf("st.readFrame(): %v", err) } + switch f := fr.(type) { case *http2.GoAwayFrame: numGoAway++ + want := http2.ErrCodeNo if got := f.ErrCode; got != want { t.Fatalf("f.ErrCode(%v): %v; want %v", numGoAway, got, want) } + switch numGoAway { case 1: want := (uint32(1) << 31) - 1 @@ -2659,11 +2764,12 @@ func TestH2H1GracefulShutdown(t *testing.T) { func TestH2H2MultipleResponseCL(t *testing.T) { opts := options{ args: []string{"--http2-bridge"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { w.Header().Add("content-length", "1") w.Header().Add("content-length", "1") }, } + st := newServerTester(t, opts) defer st.Close() @@ -2673,6 +2779,7 @@ func TestH2H2MultipleResponseCL(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.errCode, http2.ErrCodeInternal; got != want { t.Errorf("res.errCode: %v; want %v", got, want) } @@ -2684,10 +2791,11 @@ func TestH2H2MultipleResponseCL(t *testing.T) { func TestH2H2InvalidResponseCL(t *testing.T) { opts := options{ args: []string{"--http2-bridge"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { w.Header().Add("content-length", "") }, } + st := newServerTester(t, opts) defer st.Close() @@ -2697,6 +2805,7 @@ func TestH2H2InvalidResponseCL(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.errCode, http2.ErrCodeInternal; got != want { t.Errorf("res.errCode: %v; want %v", got, want) } @@ -2734,6 +2843,7 @@ func TestH2H2HostRewrite(t *testing.T) { w.Header().Add("request-host", r.Host) }, } + st := newServerTester(t, opts) defer st.Close() @@ -2743,9 +2853,11 @@ func TestH2H2HostRewrite(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } + if got, want := res.header.Get("request-host"), st.backendHost; got != want { t.Errorf("request-host: %v; want %v", got, want) } @@ -2760,6 +2872,7 @@ func TestH2H2NoHostRewrite(t *testing.T) { w.Header().Add("request-host", r.Host) }, } + st := newServerTester(t, opts) defer st.Close() @@ -2769,9 +2882,11 @@ func TestH2H2NoHostRewrite(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } + if got, want := res.header.Get("request-host"), st.frontendHost; got != want { t.Errorf("request-host: %v; want %v", got, want) } @@ -2783,13 +2898,14 @@ func TestH2H2NoHostRewrite(t *testing.T) { func TestH2H2TLSXfp(t *testing.T) { opts := options{ args: []string{"--http2-bridge"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("x-forwarded-proto"), "http"; got != want { t.Errorf("x-forwarded-proto: want %v; got %v", want, got) } }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -2799,6 +2915,7 @@ func TestH2H2TLSXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -2812,7 +2929,7 @@ func TestH2H2AddXfp(t *testing.T) { "--http2-bridge", "--no-strip-incoming-x-forwarded-proto", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xfp := r.Header.Get("X-Forwarded-Proto") if got, want := xfp, "foo, http"; got != want { t.Errorf("X-Forwarded-Proto = %q; want %q", got, want) @@ -2820,6 +2937,7 @@ func TestH2H2AddXfp(t *testing.T) { }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -2832,6 +2950,7 @@ func TestH2H2AddXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -2846,7 +2965,7 @@ func TestH2H2NoAddXfp(t *testing.T) { "--no-add-x-forwarded-proto", "--no-strip-incoming-x-forwarded-proto", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xfp := r.Header.Get("X-Forwarded-Proto") if got, want := xfp, "foo"; got != want { t.Errorf("X-Forwarded-Proto = %q; want %q", got, want) @@ -2854,6 +2973,7 @@ func TestH2H2NoAddXfp(t *testing.T) { }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -2866,6 +2986,7 @@ func TestH2H2NoAddXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -2876,7 +2997,7 @@ func TestH2H2NoAddXfp(t *testing.T) { func TestH2H2StripXfp(t *testing.T) { opts := options{ args: []string{"--http2-bridge"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xfp := r.Header.Get("X-Forwarded-Proto") if got, want := xfp, "http"; got != want { t.Errorf("X-Forwarded-Proto = %q; want %q", got, want) @@ -2884,6 +3005,7 @@ func TestH2H2StripXfp(t *testing.T) { }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -2896,6 +3018,7 @@ func TestH2H2StripXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -2906,13 +3029,14 @@ func TestH2H2StripXfp(t *testing.T) { func TestH2H2StripNoAddXfp(t *testing.T) { opts := options{ args: []string{"--http2-bridge", "--no-add-x-forwarded-proto"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, found := r.Header["X-Forwarded-Proto"]; found { t.Errorf("X-Forwarded-Proto = %q; want nothing", got) } }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -2925,6 +3049,7 @@ func TestH2H2StripNoAddXfp(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -2935,7 +3060,7 @@ func TestH2H2StripNoAddXfp(t *testing.T) { func TestH2H2AddXff(t *testing.T) { opts := options{ args: []string{"--http2-bridge", "--add-x-forwarded-for"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xff := r.Header.Get("X-Forwarded-For") want := "127.0.0.1" if xff != want { @@ -2944,6 +3069,7 @@ func TestH2H2AddXff(t *testing.T) { }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -2953,6 +3079,7 @@ func TestH2H2AddXff(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -2963,7 +3090,7 @@ func TestH2H2AddXff(t *testing.T) { func TestH2H2AddXff2(t *testing.T) { opts := options{ args: []string{"--http2-bridge", "--add-x-forwarded-for"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xff := r.Header.Get("X-Forwarded-For") want := "host, 127.0.0.1" if xff != want { @@ -2972,6 +3099,7 @@ func TestH2H2AddXff2(t *testing.T) { }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -2984,6 +3112,7 @@ func TestH2H2AddXff2(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -2997,13 +3126,14 @@ func TestH2H2StripXff(t *testing.T) { "--http2-bridge", "--strip-incoming-x-forwarded-for", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if xff, found := r.Header["X-Forwarded-For"]; found { t.Errorf("X-Forwarded-For = %v; want nothing", xff) } }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -3016,6 +3146,7 @@ func TestH2H2StripXff(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -3030,7 +3161,7 @@ func TestH2H2StripAddXff(t *testing.T) { "--strip-incoming-x-forwarded-for", "--add-x-forwarded-for", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { xff := r.Header.Get("X-Forwarded-For") want := "127.0.0.1" if xff != want { @@ -3039,6 +3170,7 @@ func TestH2H2StripAddXff(t *testing.T) { }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -3051,6 +3183,7 @@ func TestH2H2StripAddXff(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status = %v; want %v", got, want) } @@ -3065,7 +3198,7 @@ func TestH2H2AddForwarded(t *testing.T) { "--add-forwarded=by,for,host,proto", "--forwarded-by=_alpha", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { pattern := fmt.Sprintf(`by=_alpha;for=_[^;]+;host="127\.0\.0\.1:%v";proto=https`, serverPort) validFwd := regexp.MustCompile(pattern) if got := r.Header.Get("Forwarded"); !validFwd.MatchString(got) { @@ -3074,6 +3207,7 @@ func TestH2H2AddForwarded(t *testing.T) { }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -3084,6 +3218,7 @@ func TestH2H2AddForwarded(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -3099,7 +3234,7 @@ func TestH2H2AddForwardedMerge(t *testing.T) { "--add-forwarded=by,host,proto", "--forwarded-by=_alpha", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { want := fmt.Sprintf(`host=foo, by=_alpha;host="127.0.0.1:%v";proto=https`, serverPort) if got := r.Header.Get("Forwarded"); got != want { t.Errorf("Forwarded = %v; want %v", got, want) @@ -3107,6 +3242,7 @@ func TestH2H2AddForwardedMerge(t *testing.T) { }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -3120,6 +3256,7 @@ func TestH2H2AddForwardedMerge(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -3136,7 +3273,7 @@ func TestH2H2AddForwardedStrip(t *testing.T) { "--add-forwarded=by,host,proto", "--forwarded-by=_alpha", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { want := fmt.Sprintf(`by=_alpha;host="127.0.0.1:%v";proto=https`, serverPort) if got := r.Header.Get("Forwarded"); got != want { t.Errorf("Forwarded = %v; want %v", got, want) @@ -3144,6 +3281,7 @@ func TestH2H2AddForwardedStrip(t *testing.T) { }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -3157,6 +3295,7 @@ func TestH2H2AddForwardedStrip(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -3167,13 +3306,14 @@ func TestH2H2AddForwardedStrip(t *testing.T) { func TestH2H2StripForwarded(t *testing.T) { opts := options{ args: []string{"--http2-bridge", "--strip-incoming-forwarded"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, found := r.Header["Forwarded"]; found { t.Errorf("Forwarded = %v; want nothing", got) } }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -3187,6 +3327,7 @@ func TestH2H2StripForwarded(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("status: %v; want %v", got, want) } @@ -3200,10 +3341,11 @@ func TestH2H2ReqPhaseReturn(t *testing.T) { "--http2-bridge", "--mruby-file=" + testDir + "/req-return.rb", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, } + st := newServerTester(t, opts) defer st.Close() @@ -3224,6 +3366,7 @@ func TestH2H2ReqPhaseReturn(t *testing.T) { {"content-length", "20"}, {"from", "mruby"}, } + for _, tt := range hdtests { if got, want := res.header.Get(tt.k), tt.v; got != want { t.Errorf("%v = %v; want %v", tt.k, got, want) @@ -3244,6 +3387,7 @@ func TestH2H2RespPhaseReturn(t *testing.T) { "--mruby-file=" + testDir + "/resp-return.rb", }, } + st := newServerTester(t, opts) defer st.Close() @@ -3264,6 +3408,7 @@ func TestH2H2RespPhaseReturn(t *testing.T) { {"content-length", "21"}, {"from", "mruby"}, } + for _, tt := range hdtests { if got, want := res.header.Get(tt.k), tt.v; got != want { t.Errorf("%v = %v; want %v", tt.k, got, want) @@ -3281,6 +3426,7 @@ func TestH2H2ExternalDNS(t *testing.T) { opts := options{ args: []string{"--http2-bridge", "--external-dns"}, } + st := newServerTester(t, opts) defer st.Close() @@ -3302,6 +3448,7 @@ func TestH2H2DNS(t *testing.T) { opts := options{ args: []string{"--http2-bridge", "--dns"}, } + st := newServerTester(t, opts) defer st.Close() @@ -3322,10 +3469,11 @@ func TestH2H2DNS(t *testing.T) { func TestH2H2Code204(t *testing.T) { opts := options{ args: []string{"--http2-bridge"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusNoContent) }, } + st := newServerTester(t, opts) defer st.Close() @@ -3346,11 +3494,12 @@ func TestH2H2Code204(t *testing.T) { func TestH2APIBackendconfig(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -3366,18 +3515,21 @@ backend=127.0.0.1,3011 if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } var apiResp APIResponse - err = json.Unmarshal(res.body, &apiResp) - if err != nil { + + if err := json.Unmarshal(res.body, &apiResp); err != nil { t.Fatalf("Error unmarshaling API response: %v", err) } + if got, want := apiResp.Status, "Success"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 200; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } @@ -3388,11 +3540,12 @@ backend=127.0.0.1,3011 func TestH2APIBackendconfigQuery(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -3408,18 +3561,21 @@ backend=127.0.0.1,3011 if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } var apiResp APIResponse - err = json.Unmarshal(res.body, &apiResp) - if err != nil { + + if err := json.Unmarshal(res.body, &apiResp); err != nil { t.Fatalf("Error unmarshaling API response: %v", err) } + if got, want := apiResp.Status, "Success"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 200; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } @@ -3430,11 +3586,12 @@ backend=127.0.0.1,3011 func TestH2APIBackendconfigBadMethod(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -3450,18 +3607,21 @@ backend=127.0.0.1,3011 if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusMethodNotAllowed; got != want { t.Errorf("res.status: %v; want %v", got, want) } var apiResp APIResponse - err = json.Unmarshal(res.body, &apiResp) - if err != nil { + + if err := json.Unmarshal(res.body, &apiResp); err != nil { t.Fatalf("Error unmarshaling API response: %v", err) } + if got, want := apiResp.Status, "Failure"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 405; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } @@ -3471,11 +3631,12 @@ backend=127.0.0.1,3011 func TestH2APIConfigrevision(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -3487,23 +3648,28 @@ func TestH2APIConfigrevision(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want = %v", got, want) } var apiResp APIResponse + d := json.NewDecoder(bytes.NewBuffer(res.body)) d.UseNumber() - err = d.Decode(&apiResp) - if err != nil { + + if err := d.Decode(&apiResp); err != nil { t.Fatalf("Error unmarshalling API response: %v", err) } + if got, want := apiResp.Status, "Success"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 200; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Data["configRevision"], json.Number("0"); got != want { t.Errorf(`apiResp.Data["configRevision"]: %v %t; want %v`, got, got, want) } @@ -3514,11 +3680,12 @@ func TestH2APIConfigrevision(t *testing.T) { func TestH2APINotFound(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3010;api;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3010, } + st := newServerTester(t, opts) defer st.Close() @@ -3534,18 +3701,21 @@ backend=127.0.0.1,3011 if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusNotFound; got != want { t.Errorf("res.status: %v; want %v", got, want) } var apiResp APIResponse - err = json.Unmarshal(res.body, &apiResp) - if err != nil { + + if err := json.Unmarshal(res.body, &apiResp); err != nil { t.Fatalf("Error unmarshaling API response: %v", err) } + if got, want := apiResp.Status, "Failure"; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } + if got, want := apiResp.Code, 404; got != want { t.Errorf("apiResp.Status: %v; want %v", got, want) } @@ -3555,11 +3725,12 @@ backend=127.0.0.1,3011 func TestH2Healthmon(t *testing.T) { opts := options{ args: []string{"-f127.0.0.1,3011;healthmon;no-tls"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, connectPort: 3011, } + st := newServerTester(t, opts) defer st.Close() @@ -3570,6 +3741,7 @@ func TestH2Healthmon(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -3580,10 +3752,11 @@ func TestH2Healthmon(t *testing.T) { func TestH2ResponseBeforeRequestEnd(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/req-return.rb"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatal("request should not be forwarded") }, } + st := newServerTester(t, opts) defer st.Close() @@ -3594,6 +3767,7 @@ func TestH2ResponseBeforeRequestEnd(t *testing.T) { if err != nil { t.Fatalf("Error st.http2() = %v", err) } + if got, want := res.status, http.StatusNotFound; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -3603,24 +3777,29 @@ func TestH2ResponseBeforeRequestEnd(t *testing.T) { // backend chunked encoded response ends prematurely. func TestH2H1ChunkedEndsPrematurely(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { hj, ok := w.(http.Hijacker) if !ok { http.Error(w, "Could not hijack the connection", http.StatusInternalServerError) return } + conn, bufrw, err := hj.Hijack() if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } + defer conn.Close() + if _, err := bufrw.WriteString("HTTP/1.1 200\r\nTransfer-Encoding: chunked\r\n\r\n"); err != nil { t.Fatalf("Error bufrw.WriteString() = %v", err) } + bufrw.Flush() }, } + st := newServerTester(t, opts) defer st.Close() @@ -3641,10 +3820,11 @@ func TestH2H1ChunkedEndsPrematurely(t *testing.T) { func TestH2H1RequireHTTPSchemeHTTPSWithoutEncryption(t *testing.T) { opts := options{ args: []string{"--require-http-scheme"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -3666,11 +3846,12 @@ func TestH2H1RequireHTTPSchemeHTTPSWithoutEncryption(t *testing.T) { func TestH2H1RequireHTTPSchemeHTTPWithEncryption(t *testing.T) { opts := options{ args: []string{"--require-http-scheme"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, tls: true, } + st := newServerTester(t, opts) defer st.Close() @@ -3693,10 +3874,11 @@ func TestH2H1RequireHTTPSchemeHTTPWithEncryption(t *testing.T) { func TestH2H1RequireHTTPSchemeUnknownSchemeWithoutEncryption(t *testing.T) { opts := options{ args: []string{"--require-http-scheme"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, } + st := newServerTester(t, opts) defer st.Close() @@ -3718,11 +3900,12 @@ func TestH2H1RequireHTTPSchemeUnknownSchemeWithoutEncryption(t *testing.T) { func TestH2H1RequireHTTPSchemeUnknownSchemeWithEncryption(t *testing.T) { opts := options{ args: []string{"--require-http-scheme"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Errorf("server should not forward this request") }, tls: true, } + st := newServerTester(t, opts) defer st.Close() diff --git a/lib/nghttp2/integration-tests/nghttpx_http3_test.go b/lib/nghttp2-1.65.0/integration-tests/nghttpx_http3_test.go similarity index 95% rename from lib/nghttp2/integration-tests/nghttpx_http3_test.go rename to lib/nghttp2-1.65.0/integration-tests/nghttpx_http3_test.go index 9ea85d7447c..7a76080b403 100644 --- a/lib/nghttp2/integration-tests/nghttpx_http3_test.go +++ b/lib/nghttp2-1.65.0/integration-tests/nghttpx_http3_test.go @@ -5,6 +5,7 @@ package nghttp2 import ( "bytes" "crypto/rand" + "errors" "io" "net/http" "regexp" @@ -35,13 +36,14 @@ func TestH3H1PlainGET(t *testing.T) { // TestH3H1RequestBody tests HTTP/3 request with body works. func TestH3H1RequestBody(t *testing.T) { body := make([]byte, 3333) + _, err := rand.Read(body) if err != nil { t.Fatalf("Unable to create request body: %v", err) } opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { buf := make([]byte, 4096) buflen := 0 p := buf @@ -57,7 +59,7 @@ func TestH3H1RequestBody(t *testing.T) { buflen += n if err != nil { - if err == io.EOF { + if errors.Is(err, io.EOF) { break } @@ -73,6 +75,7 @@ func TestH3H1RequestBody(t *testing.T) { }, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -83,6 +86,7 @@ func TestH3H1RequestBody(t *testing.T) { if err != nil { t.Fatalf("Error st.http3() = %v", err) } + if got, want := res.status, http.StatusOK; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -92,13 +96,14 @@ func TestH3H1RequestBody(t *testing.T) { // and from backend server. func TestH3H1GenerateVia(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(_ http.ResponseWriter, r *http.Request) { if got, want := r.Header.Get("Via"), "3 nghttpx"; got != want { t.Errorf("Via: %v; want %v", got, want) } }, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -108,6 +113,7 @@ func TestH3H1GenerateVia(t *testing.T) { if err != nil { t.Fatalf("Error st.http3() = %v", err) } + if got, want := res.header.Get("Via"), "1.1 nghttpx"; got != want { t.Errorf("Via: %v; want %v", got, want) } @@ -125,6 +131,7 @@ func TestH3H1AppendVia(t *testing.T) { }, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -137,6 +144,7 @@ func TestH3H1AppendVia(t *testing.T) { if err != nil { t.Fatalf("Error st.http3() = %v", err) } + if got, want := res.header.Get("Via"), "bar, 1.1 nghttpx"; got != want { t.Errorf("Via: %v; want %v", got, want) } @@ -155,6 +163,7 @@ func TestH3H1NoVia(t *testing.T) { }, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -167,6 +176,7 @@ func TestH3H1NoVia(t *testing.T) { if err != nil { t.Fatalf("Error st.http3() = %v", err) } + if got, want := res.header.Get("Via"), "bar"; got != want { t.Errorf("Via: %v; want %v", got, want) } @@ -177,7 +187,7 @@ func TestH3H1NoVia(t *testing.T) { // response body size. func TestH3H1BadResponseCL(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { // we set content-length: 1024, but only send 3 bytes. w.Header().Add("Content-Length", "1024") if _, err := w.Write([]byte("foo")); err != nil { @@ -186,6 +196,7 @@ func TestH3H1BadResponseCL(t *testing.T) { }, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -204,6 +215,7 @@ func TestH3H1HTTPSRedirect(t *testing.T) { args: []string{"--redirect-if-not-tls"}, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -226,6 +238,7 @@ func TestH3H1AffinityCookieTLS(t *testing.T) { args: []string{"--affinity-cookie"}, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -243,6 +256,7 @@ func TestH3H1AffinityCookieTLS(t *testing.T) { const pattern = `affinity=[0-9a-f]{8}; Path=/foo/bar; Secure` validCookie := regexp.MustCompile(pattern) + if got := res.header.Get("Set-Cookie"); !validCookie.MatchString(got) { t.Errorf("Set-Cookie: %v; want pattern %v", got, pattern) } @@ -256,11 +270,12 @@ func TestH3H2ReqPhaseReturn(t *testing.T) { "--http2-bridge", "--mruby-file=" + testDir + "/req-return.rb", }, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatalf("request should not be forwarded") }, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -302,6 +317,7 @@ func TestH3H2RespPhaseReturn(t *testing.T) { }, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -338,11 +354,12 @@ func TestH3H2RespPhaseReturn(t *testing.T) { func TestH3ResponseBeforeRequestEnd(t *testing.T) { opts := options{ args: []string{"--mruby-file=" + testDir + "/req-return.rb"}, - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(http.ResponseWriter, *http.Request) { t.Fatal("request should not be forwarded") }, quic: true, } + st := newServerTester(t, opts) defer st.Close() @@ -353,6 +370,7 @@ func TestH3ResponseBeforeRequestEnd(t *testing.T) { if err != nil { t.Fatalf("Error st.http3() = %v", err) } + if got, want := res.status, http.StatusNotFound; got != want { t.Errorf("res.status: %v; want %v", got, want) } @@ -362,7 +380,7 @@ func TestH3ResponseBeforeRequestEnd(t *testing.T) { // backend chunked encoded response ends prematurely. func TestH3H1ChunkedEndsPrematurely(t *testing.T) { opts := options{ - handler: func(w http.ResponseWriter, r *http.Request) { + handler: func(w http.ResponseWriter, _ *http.Request) { hj, ok := w.(http.Hijacker) if !ok { http.Error(w, "Could not hijack the connection", http.StatusInternalServerError) @@ -381,6 +399,7 @@ func TestH3H1ChunkedEndsPrematurely(t *testing.T) { }, quic: true, } + st := newServerTester(t, opts) defer st.Close() diff --git a/lib/nghttp2/integration-tests/req-return.rb b/lib/nghttp2-1.65.0/integration-tests/req-return.rb similarity index 100% rename from lib/nghttp2/integration-tests/req-return.rb rename to lib/nghttp2-1.65.0/integration-tests/req-return.rb diff --git a/lib/nghttp2/integration-tests/req-set-header.rb b/lib/nghttp2-1.65.0/integration-tests/req-set-header.rb similarity index 100% rename from lib/nghttp2/integration-tests/req-set-header.rb rename to lib/nghttp2-1.65.0/integration-tests/req-set-header.rb diff --git a/lib/nghttp2/integration-tests/resp-return.rb b/lib/nghttp2-1.65.0/integration-tests/resp-return.rb similarity index 100% rename from lib/nghttp2/integration-tests/resp-return.rb rename to lib/nghttp2-1.65.0/integration-tests/resp-return.rb diff --git a/lib/nghttp2/integration-tests/resp-set-header.rb b/lib/nghttp2-1.65.0/integration-tests/resp-set-header.rb similarity index 100% rename from lib/nghttp2/integration-tests/resp-set-header.rb rename to lib/nghttp2-1.65.0/integration-tests/resp-set-header.rb diff --git a/lib/nghttp2/integration-tests/server.crt b/lib/nghttp2-1.65.0/integration-tests/server.crt similarity index 100% rename from lib/nghttp2/integration-tests/server.crt rename to lib/nghttp2-1.65.0/integration-tests/server.crt diff --git a/lib/nghttp2/integration-tests/server_tester.go b/lib/nghttp2-1.65.0/integration-tests/server_tester.go similarity index 96% rename from lib/nghttp2/integration-tests/server_tester.go rename to lib/nghttp2-1.65.0/integration-tests/server_tester.go index 6a4ce650d7c..4ab158f33db 100644 --- a/lib/nghttp2/integration-tests/server_tester.go +++ b/lib/nghttp2-1.65.0/integration-tests/server_tester.go @@ -3,6 +3,7 @@ package nghttp2 import ( "bufio" "bytes" + "cmp" "context" "crypto/tls" "encoding/binary" @@ -15,7 +16,7 @@ import ( "net/url" "os" "os/exec" - "sort" + "slices" "strconv" "strings" "syscall" @@ -94,14 +95,17 @@ func newServerTester(t *testing.T, opts options) *serverTester { if opts.handler == nil { opts.handler = noopHandler } + if opts.connectPort == 0 { opts.connectPort = serverPort } ts := httptest.NewUnstartedServer(opts.handler) - var args []string - var backendTLS, dns, externalDNS, acceptProxyProtocol, redirectIfNotTLS, affinityCookie, alpnH1 bool + var ( + args []string + backendTLS, dns, externalDNS, acceptProxyProtocol, redirectIfNotTLS, affinityCookie, alpnH1 bool + ) for _, k := range opts.args { switch k { @@ -124,6 +128,7 @@ func newServerTester(t *testing.T, opts options) *serverTester { args = append(args, k) } } + if backendTLS { nghttp2.ConfigureServer(ts.Config, &nghttp2.Server{}) // According to httptest/server.go, we have to set @@ -132,13 +137,17 @@ func newServerTester(t *testing.T, opts options) *serverTester { ts.TLS = new(tls.Config) ts.TLS.NextProtos = append(ts.TLS.NextProtos, "h2") ts.StartTLS() + args = append(args, "-k") } else { ts.Start() } + scheme := "http" + if opts.tls { scheme = "https" + args = append(args, testDir+"/server.key", testDir+"/server.crt") } @@ -150,6 +159,7 @@ func newServerTester(t *testing.T, opts options) *serverTester { // URL.Host looks like "127.0.0.1:8080", but we want // "127.0.0.1,8080" b := "-b" + if !externalDNS { b += fmt.Sprintf("%v;", strings.Replace(backendURL.Host, ":", ",", -1)) } else { @@ -157,6 +167,7 @@ func newServerTester(t *testing.T, opts options) *serverTester { if sep == -1 { t.Fatalf("backendURL.Host %v does not contain separator ':'", backendURL.Host) } + // We use awesome service nip.io. b += fmt.Sprintf("%v.nip.io,%v;", backendURL.Host[:sep], backendURL.Host[sep+1:]) } @@ -164,6 +175,7 @@ func newServerTester(t *testing.T, opts options) *serverTester { if backendTLS { b += ";proto=h2;tls" } + if dns { b += ";dns" } @@ -177,11 +189,13 @@ func newServerTester(t *testing.T, opts options) *serverTester { } noTLS := ";no-tls" + if opts.tls { noTLS = "" } var proxyProto string + if acceptProxyProtocol { proxyProto = ";proxyproto" } @@ -218,6 +232,7 @@ func newServerTester(t *testing.T, opts options) *serverTester { } retry := 0 + for { time.Sleep(50 * time.Millisecond) @@ -231,32 +246,41 @@ func newServerTester(t *testing.T, opts options) *serverTester { } var tlsConfig *tls.Config + if opts.tlsConfig == nil { tlsConfig = new(tls.Config) } else { tlsConfig = opts.tlsConfig.Clone() } + tlsConfig.InsecureSkipVerify = true + if alpnH1 { tlsConfig.NextProtos = []string{"http/1.1"} } else { tlsConfig.NextProtos = []string{"h2"} } + tlsConn := tls.Client(conn, tlsConfig) + err = tlsConn.Handshake() if err == nil { conn = tlsConn } } + if err != nil { retry++ if retry >= 100 { st.Close() st.t.Fatalf("Error server is not responding too long; server command-line arguments may be invalid") } + continue } + st.conn = conn + break } @@ -273,12 +297,15 @@ func (st *serverTester) Close() { if st.conn != nil { st.conn.Close() } + if st.cmd != nil { done := make(chan struct{}) + go func() { if err := st.cmd.Wait(); err != nil { st.t.Errorf("Error st.cmd.Wait() = %v", err) } + close(done) }() @@ -292,9 +319,11 @@ func (st *serverTester) Close() { if err := st.cmd.Process.Kill(); err != nil { st.t.Errorf("Error st.cmd.Process.Kill() = %v", err) } + <-done } } + if st.ts != nil { st.ts.Close() } @@ -307,6 +336,7 @@ func (st *serverTester) readFrame() (http2.Frame, error) { st.errCh <- err return } + st.frCh <- f }() @@ -347,10 +377,12 @@ func (cbr *chunkedBodyReader) Read(p []byte) (n int, err error) { // after request was sent and before body returns EOF. if !cbr.trailerWritten { cbr.trailerWritten = true + for _, h := range cbr.trailer { cbr.req.Trailer.Set(h.Name, h.Value) } } + return cbr.body.Read(p) } @@ -363,6 +395,7 @@ func (st *serverTester) websocket(rp requestParam) *serverResponse { } config.Header.Add("Test-Case", rp.name) + for _, h := range rp.header { config.Header.Add(h.Name, h.Value) } @@ -377,7 +410,9 @@ func (st *serverTester) websocket(rp requestParam) *serverResponse { } msg := make([]byte, 1024) + var n int + if n, err = ws.Read(msg); err != nil { st.t.Fatalf("ws.Read() returned error: %v", err) } @@ -391,19 +426,25 @@ func (st *serverTester) websocket(rp requestParam) *serverResponse { func (st *serverTester) http1(rp requestParam) (*serverResponse, error) { method := "GET" + if rp.method != "" { method = rp.method } - var body io.Reader - var cbr *chunkedBodyReader + var ( + body io.Reader + cbr *chunkedBodyReader + ) + if rp.body != nil { body = bytes.NewBuffer(rp.body) + if len(rp.trailer) != 0 { cbr = &chunkedBodyReader{ trailer: rp.trailer, body: body, } + body = cbr } } @@ -415,6 +456,7 @@ func (st *serverTester) http1(rp requestParam) (*serverResponse, error) { if err != nil { st.t.Fatalf("Error parsing URL from st.url %v: %v", st.url, err) } + u.Path = "" u.RawQuery = "" reqURL = u.String() + rp.path @@ -427,30 +469,38 @@ func (st *serverTester) http1(rp requestParam) (*serverResponse, error) { if err != nil { return nil, err } + for _, h := range rp.header { req.Header.Add(h.Name, h.Value) } + req.Header.Add("Test-Case", rp.name) + if cbr != nil { cbr.req = req // this makes request use chunked encoding req.ContentLength = -1 req.Trailer = make(http.Header) + for _, h := range cbr.trailer { req.Trailer.Set(h.Name, "") } } + if err := req.Write(st.conn); err != nil { return nil, err } + resp, err := http.ReadResponse(bufio.NewReader(st.conn), req) if err != nil { return nil, err } + respBody, err := io.ReadAll(resp.Body) if err != nil { return nil, err } + resp.Body.Close() res := &serverResponse{ @@ -468,6 +518,7 @@ func (st *serverTester) http2(rp requestParam) (*serverResponse, error) { st.header = make(http.Header) var id uint32 + if rp.streamID != 0 { id = rp.streamID if id >= st.nextStreamID && id%2 == 1 { @@ -481,6 +532,7 @@ func (st *serverTester) http2(rp requestParam) (*serverResponse, error) { if !st.h2PrefaceSent { st.h2PrefaceSent = true fmt.Fprint(st.conn, "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n") + if err := st.fr.WriteSettings(); err != nil { return nil, err } @@ -498,26 +550,32 @@ func (st *serverTester) http2(rp requestParam) (*serverResponse, error) { if rp.method != "" { method = rp.method } + _ = st.enc.WriteField(pair(":method", method)) scheme := "http" + if rp.scheme != "" { scheme = rp.scheme } + _ = st.enc.WriteField(pair(":scheme", scheme)) authority := st.authority + if rp.authority != "" { authority = rp.authority } + _ = st.enc.WriteField(pair(":authority", authority)) path := "/" + if rp.path != "" { path = rp.path } - _ = st.enc.WriteField(pair(":path", path)) + _ = st.enc.WriteField(pair(":path", path)) _ = st.enc.WriteField(pair("test-case", rp.name)) for _, h := range rp.header { @@ -543,9 +601,11 @@ func (st *serverTester) http2(rp requestParam) (*serverResponse, error) { if len(rp.trailer) != 0 { st.headerBlkBuf.Reset() + for _, h := range rp.trailer { _ = st.enc.WriteField(h) } + err := st.fr.WriteHeaders(http2.HeadersFrameParam{ StreamID: id, EndStream: true, @@ -563,56 +623,65 @@ loop: if err != nil { return res, err } + switch f := fr.(type) { case *http2.HeadersFrame: _, err := st.dec.Write(f.HeaderBlockFragment()) if err != nil { return res, err } + sr, ok := streams[f.FrameHeader.StreamID] if !ok { st.header = make(http.Header) break } + sr.header = cloneHeader(st.header) + var status int + status, err = strconv.Atoi(sr.header.Get(":status")) if err != nil { return res, fmt.Errorf("Error parsing status code: %w", err) } + sr.status = status - if f.StreamEnded() { - if streamEnded(res, streams, sr) { - break loop - } + + if f.StreamEnded() && streamEnded(res, streams, sr) { + break loop } case *http2.PushPromiseFrame: _, err := st.dec.Write(f.HeaderBlockFragment()) if err != nil { return res, err } + sr := &serverResponse{ streamID: f.PromiseID, reqHeader: cloneHeader(st.header), } + streams[sr.streamID] = sr case *http2.DataFrame: sr, ok := streams[f.FrameHeader.StreamID] if !ok { break } + sr.body = append(sr.body, f.Data()...) - if f.StreamEnded() { - if streamEnded(res, streams, sr) { - break loop - } + + if f.StreamEnded() && streamEnded(res, streams, sr) { + break loop } case *http2.RSTStreamFrame: sr, ok := streams[f.FrameHeader.StreamID] if !ok { break } + sr.errCode = f.ErrCode + if streamEnded(res, streams, sr) { break loop } @@ -620,27 +689,36 @@ loop: if f.ErrCode == http2.ErrCodeNo { break } + res.errCode = f.ErrCode res.connErr = true + break loop case *http2.SettingsFrame: if f.IsAck() { break } + if err := st.fr.WriteSettingsAck(); err != nil { return res, err } } } - sort.Sort(ByStreamID(res.pushResponse)) + + slices.SortFunc(res.pushResponse, func(a, b *serverResponse) int { + return cmp.Compare(a.streamID, b.streamID) + }) + return res, nil } func streamEnded(mainSr *serverResponse, streams map[uint32]*serverResponse, sr *serverResponse) bool { delete(streams, sr.streamID) + if mainSr.streamID != sr.streamID { mainSr.pushResponse = append(mainSr.pushResponse, sr) } + return len(streams) == 0 } @@ -652,31 +730,19 @@ type serverResponse struct { errCode http2.ErrCode // error code received in HTTP/2 RST_STREAM or GOAWAY connErr bool // true if HTTP/2 connection error connClose bool // Connection: close is included in response header in HTTP/1 test - reqHeader http.Header // http request header, currently only sotres pushed request header + reqHeader http.Header // http request header, currently only stores pushed request header pushResponse []*serverResponse // pushed response } -type ByStreamID []*serverResponse - -func (b ByStreamID) Len() int { - return len(b) -} - -func (b ByStreamID) Swap(i, j int) { - b[i], b[j] = b[j], b[i] -} - -func (b ByStreamID) Less(i, j int) bool { - return b[i].streamID < b[j].streamID -} - func cloneHeader(h http.Header) http.Header { h2 := make(http.Header, len(h)) + for k, vv := range h { vv2 := make([]string, len(vv)) copy(vv2, vv) h2[k] = vv2 } + return h2 } @@ -727,6 +793,7 @@ func writeProxyProtocolV2(w io.Writer, hdr proxyProtocolV2) error { if _, err := w.Write([]byte{0x0D, 0x0A, 0x0D, 0x0A, 0x00, 0x0D, 0x0A, 0x51, 0x55, 0x49, 0x54, 0x0A}); err != nil { return err } + if _, err := w.Write([]byte{byte(0x20 | hdr.command)}); err != nil { return err } @@ -734,44 +801,59 @@ func writeProxyProtocolV2(w io.Writer, hdr proxyProtocolV2) error { switch srcAddr := hdr.sourceAddress.(type) { case *net.TCPAddr: dstAddr := hdr.destinationAddress.(*net.TCPAddr) + if len(srcAddr.IP) != len(dstAddr.IP) { panic("len(srcAddr.IP) != len(dstAddr.IP)") } + var fam byte + if len(srcAddr.IP) == 4 { fam = byte(proxyProtocolV2FamilyInet << 4) } else { fam = byte(proxyProtocolV2FamilyInet6 << 4) } + fam |= byte(proxyProtocolV2ProtocolStream) + if _, err := w.Write([]byte{fam}); err != nil { return err } + length := uint16(len(srcAddr.IP)*2 + 4 + len(hdr.additionalData)) + if err := binary.Write(w, binary.BigEndian, length); err != nil { return err } + if _, err := w.Write(srcAddr.IP); err != nil { return err } + if _, err := w.Write(dstAddr.IP); err != nil { return err } + if err := binary.Write(w, binary.BigEndian, uint16(srcAddr.Port)); err != nil { return err } + if err := binary.Write(w, binary.BigEndian, uint16(dstAddr.Port)); err != nil { return err } case *net.UnixAddr: dstAddr := hdr.destinationAddress.(*net.UnixAddr) + if len(srcAddr.Name) > 108 { panic("too long Unix source address") } + if len(dstAddr.Name) > 108 { panic("too long Unix destination address") } + fam := byte(proxyProtocolV2FamilyUnix << 4) + switch srcAddr.Net { case "unix": fam |= byte(proxyProtocolV2ProtocolStream) @@ -780,32 +862,43 @@ func writeProxyProtocolV2(w io.Writer, hdr proxyProtocolV2) error { default: fam |= byte(proxyProtocolV2ProtocolUnspec) } + if _, err := w.Write([]byte{fam}); err != nil { return err } + length := uint16(216 + len(hdr.additionalData)) + if err := binary.Write(w, binary.BigEndian, length); err != nil { return err } + zeros := make([]byte, 108) + if _, err := w.Write([]byte(srcAddr.Name)); err != nil { return err } + if _, err := w.Write(zeros[:108-len(srcAddr.Name)]); err != nil { return err } + if _, err := w.Write([]byte(dstAddr.Name)); err != nil { return err } + if _, err := w.Write(zeros[:108-len(dstAddr.Name)]); err != nil { return err } default: fam := byte(proxyProtocolV2FamilyUnspec<<4) | byte(proxyProtocolV2ProtocolUnspec) + if _, err := w.Write([]byte{fam}); err != nil { return err } + length := uint16(len(hdr.additionalData)) + if err := binary.Write(w, binary.BigEndian, length); err != nil { return err } diff --git a/lib/nghttp2/integration-tests/server_tester_http3.go b/lib/nghttp2-1.65.0/integration-tests/server_tester_http3.go similarity index 99% rename from lib/nghttp2/integration-tests/server_tester_http3.go rename to lib/nghttp2-1.65.0/integration-tests/server_tester_http3.go index 7bbc4e74c02..d20ddeee1e8 100644 --- a/lib/nghttp2/integration-tests/server_tester_http3.go +++ b/lib/nghttp2-1.65.0/integration-tests/server_tester_http3.go @@ -45,6 +45,7 @@ func (st *serverTester) http3(rp requestParam) (*serverResponse, error) { if err != nil { st.t.Fatalf("Error parsing URL from st.url %v: %v", st.url, err) } + u.Path = "" u.RawQuery = "" reqURL = u.String() + rp.path diff --git a/lib/nghttp2-1.65.0/integration-tests/setenv b/lib/nghttp2-1.65.0/integration-tests/setenv new file mode 100644 index 00000000000..ce7850d81db --- /dev/null +++ b/lib/nghttp2-1.65.0/integration-tests/setenv @@ -0,0 +1,14 @@ +#!/bin/sh -e + +libdir="/home/runner/work/nghttp2/nghttp2/lib" +if [ -d "$libdir/.libs" ]; then + libdir="$libdir/.libs" +fi + +export CGO_CFLAGS="-I/home/runner/work/nghttp2/nghttp2/lib/includes -I/home/runner/work/nghttp2/nghttp2/lib/includes -g -O2" +export CGO_CPPFLAGS="" +export CGO_LDFLAGS="-L$libdir " +export LD_LIBRARY_PATH="$libdir" +export DYLD_LIBRARY_PATH="$libdir" +export GODEBUG=cgocheck=0 +"$@" diff --git a/lib/nghttp2/integration-tests/setenv.in b/lib/nghttp2-1.65.0/integration-tests/setenv.in similarity index 90% rename from lib/nghttp2/integration-tests/setenv.in rename to lib/nghttp2-1.65.0/integration-tests/setenv.in index 7177200e9e0..17e320ce18d 100644 --- a/lib/nghttp2/integration-tests/setenv.in +++ b/lib/nghttp2-1.65.0/integration-tests/setenv.in @@ -9,5 +9,6 @@ export CGO_CFLAGS="-I@abs_top_srcdir@/lib/includes -I@abs_top_builddir@/lib/incl export CGO_CPPFLAGS="@CPPFLAGS@" export CGO_LDFLAGS="-L$libdir @LDFLAGS@" export LD_LIBRARY_PATH="$libdir" +export DYLD_LIBRARY_PATH="$libdir" export GODEBUG=cgocheck=0 "$@" diff --git a/lib/nghttp2-1.65.0/lib/CMakeLists.txt b/lib/nghttp2-1.65.0/lib/CMakeLists.txt new file mode 100644 index 00000000000..fda8dcb7fc7 --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/CMakeLists.txt @@ -0,0 +1,107 @@ +add_subdirectory(includes) + +include_directories( + "${CMAKE_CURRENT_SOURCE_DIR}/includes" + "${CMAKE_CURRENT_BINARY_DIR}/includes" +) + +add_definitions(-DBUILDING_NGHTTP2) + +set(NGHTTP2_SOURCES + nghttp2_pq.c nghttp2_map.c nghttp2_queue.c + nghttp2_frame.c + nghttp2_buf.c + nghttp2_stream.c nghttp2_outbound_item.c + nghttp2_session.c nghttp2_submit.c + nghttp2_helper.c + nghttp2_alpn.c + nghttp2_hd.c nghttp2_hd_huffman.c nghttp2_hd_huffman_data.c + nghttp2_version.c + nghttp2_priority_spec.c + nghttp2_option.c + nghttp2_callbacks.c + nghttp2_mem.c + nghttp2_http.c + nghttp2_rcbuf.c + nghttp2_extpri.c + nghttp2_ratelim.c + nghttp2_time.c + nghttp2_debug.c + sfparse.c +) + +set(NGHTTP2_RES "") +set(STATIC_LIB "nghttp2_static") +set(SHARED_LIB "nghttp2") + +if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS AND MSVC AND NOT STATIC_LIB_SUFFIX) + set(STATIC_LIB_SUFFIX "_static") +endif() + +if(WIN32) + configure_file( + version.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/version.rc + @ONLY) + + set(NGHTTP2_RES ${CMAKE_CURRENT_BINARY_DIR}/version.rc) +endif() + +set(EXPORT_SET "${PROJECT_NAME}-targets") + +# Public shared library +if(BUILD_SHARED_LIBS) + add_library(${SHARED_LIB} SHARED ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) + + set_target_properties(${SHARED_LIB} PROPERTIES + COMPILE_FLAGS "${WARNCFLAGS}" + VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} + C_VISIBILITY_PRESET hidden + ) + + target_include_directories(${SHARED_LIB} INTERFACE + $ + $ + $ + ) + + install(TARGETS ${SHARED_LIB} EXPORT ${EXPORT_SET}) + list(APPEND nghttp2_exports ${SHARED_LIB}) +endif() + +# Static library (for unittests because of symbol visibility) +if(BUILD_STATIC_LIBS) + add_library(${STATIC_LIB} STATIC ${NGHTTP2_SOURCES}) + + set_target_properties(${STATIC_LIB} PROPERTIES + COMPILE_FLAGS "${WARNCFLAGS}" + VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} + ARCHIVE_OUTPUT_NAME nghttp2${STATIC_LIB_SUFFIX} + ) + + target_include_directories(${STATIC_LIB} INTERFACE + $ + $ + $ + ) + + target_compile_definitions(${STATIC_LIB} PUBLIC "-DNGHTTP2_STATICLIB") + + install(TARGETS ${STATIC_LIB} EXPORT ${EXPORT_SET}) + list(APPEND nghttp2_exports ${STATIC_LIB}) +endif() + +if(BUILD_SHARED_LIBS) + set(LIB_SELECTED ${SHARED_LIB}) +else() + set(LIB_SELECTED ${STATIC_LIB}) +endif() + +add_library(${PROJECT_NAME}::nghttp2 ALIAS ${LIB_SELECTED}) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + +install(EXPORT ${EXPORT_SET} + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} + NAMESPACE ${PROJECT_NAME}::) diff --git a/lib/nghttp2/lib/Makefile.am b/lib/nghttp2-1.65.0/lib/Makefile.am similarity index 98% rename from lib/nghttp2/lib/Makefile.am rename to lib/nghttp2-1.65.0/lib/Makefile.am index c3ace4029a6..1168c1e6135 100644 --- a/lib/nghttp2/lib/Makefile.am +++ b/lib/nghttp2-1.65.0/lib/Makefile.am @@ -41,7 +41,7 @@ OBJECTS = nghttp2_pq.c nghttp2_map.c nghttp2_queue.c \ nghttp2_stream.c nghttp2_outbound_item.c \ nghttp2_session.c nghttp2_submit.c \ nghttp2_helper.c \ - nghttp2_npn.c \ + nghttp2_alpn.c \ nghttp2_hd.c nghttp2_hd_huffman.c nghttp2_hd_huffman_data.c \ nghttp2_version.c \ nghttp2_priority_spec.c \ @@ -60,7 +60,7 @@ HFILES = nghttp2_pq.h nghttp2_int.h nghttp2_map.h nghttp2_queue.h \ nghttp2_frame.h \ nghttp2_buf.h \ nghttp2_session.h nghttp2_helper.h nghttp2_stream.h nghttp2_int.h \ - nghttp2_npn.h \ + nghttp2_alpn.h \ nghttp2_submit.h nghttp2_outbound_item.h \ nghttp2_net.h \ nghttp2_hd.h nghttp2_hd_huffman.h \ diff --git a/lib/nghttp2-1.65.0/lib/Makefile.in b/lib/nghttp2-1.65.0/lib/Makefile.in new file mode 100644 index 00000000000..14686ef14b1 --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/Makefile.in @@ -0,0 +1,1053 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = lib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = libnghttp2.pc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libnghttp2_la_LIBADD = +am__objects_1 = +am__objects_2 = nghttp2_pq.lo nghttp2_map.lo nghttp2_queue.lo \ + nghttp2_frame.lo nghttp2_buf.lo nghttp2_stream.lo \ + nghttp2_outbound_item.lo nghttp2_session.lo nghttp2_submit.lo \ + nghttp2_helper.lo nghttp2_alpn.lo nghttp2_hd.lo \ + nghttp2_hd_huffman.lo nghttp2_hd_huffman_data.lo \ + nghttp2_version.lo nghttp2_priority_spec.lo nghttp2_option.lo \ + nghttp2_callbacks.lo nghttp2_mem.lo nghttp2_http.lo \ + nghttp2_rcbuf.lo nghttp2_extpri.lo nghttp2_ratelim.lo \ + nghttp2_time.lo nghttp2_debug.lo sfparse.lo +am_libnghttp2_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libnghttp2_la_OBJECTS = $(am_libnghttp2_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libnghttp2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libnghttp2_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/nghttp2_alpn.Plo \ + ./$(DEPDIR)/nghttp2_buf.Plo ./$(DEPDIR)/nghttp2_callbacks.Plo \ + ./$(DEPDIR)/nghttp2_debug.Plo ./$(DEPDIR)/nghttp2_extpri.Plo \ + ./$(DEPDIR)/nghttp2_frame.Plo ./$(DEPDIR)/nghttp2_hd.Plo \ + ./$(DEPDIR)/nghttp2_hd_huffman.Plo \ + ./$(DEPDIR)/nghttp2_hd_huffman_data.Plo \ + ./$(DEPDIR)/nghttp2_helper.Plo ./$(DEPDIR)/nghttp2_http.Plo \ + ./$(DEPDIR)/nghttp2_map.Plo ./$(DEPDIR)/nghttp2_mem.Plo \ + ./$(DEPDIR)/nghttp2_option.Plo \ + ./$(DEPDIR)/nghttp2_outbound_item.Plo \ + ./$(DEPDIR)/nghttp2_pq.Plo \ + ./$(DEPDIR)/nghttp2_priority_spec.Plo \ + ./$(DEPDIR)/nghttp2_queue.Plo ./$(DEPDIR)/nghttp2_ratelim.Plo \ + ./$(DEPDIR)/nghttp2_rcbuf.Plo ./$(DEPDIR)/nghttp2_session.Plo \ + ./$(DEPDIR)/nghttp2_stream.Plo ./$(DEPDIR)/nghttp2_submit.Plo \ + ./$(DEPDIR)/nghttp2_time.Plo ./$(DEPDIR)/nghttp2_version.Plo \ + ./$(DEPDIR)/sfparse.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libnghttp2_la_SOURCES) +DIST_SOURCES = $(libnghttp2_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libnghttp2.pc.in \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +SUBDIRS = includes +EXTRA_DIST = Makefile.msvc CMakeLists.txt version.rc.in +AM_CFLAGS = $(WARNCFLAGS) $(EXTRACFLAG) +AM_CPPFLAGS = -I$(srcdir)/includes -I$(builddir)/includes -DBUILDING_NGHTTP2 \ + @DEFS@ + +AM_LDFLAGS = @LIBTOOL_LDFLAGS@ +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libnghttp2.pc +DISTCLEANFILES = $(pkgconfig_DATA) +lib_LTLIBRARIES = libnghttp2.la +OBJECTS = nghttp2_pq.c nghttp2_map.c nghttp2_queue.c \ + nghttp2_frame.c \ + nghttp2_buf.c \ + nghttp2_stream.c nghttp2_outbound_item.c \ + nghttp2_session.c nghttp2_submit.c \ + nghttp2_helper.c \ + nghttp2_alpn.c \ + nghttp2_hd.c nghttp2_hd_huffman.c nghttp2_hd_huffman_data.c \ + nghttp2_version.c \ + nghttp2_priority_spec.c \ + nghttp2_option.c \ + nghttp2_callbacks.c \ + nghttp2_mem.c \ + nghttp2_http.c \ + nghttp2_rcbuf.c \ + nghttp2_extpri.c \ + nghttp2_ratelim.c \ + nghttp2_time.c \ + nghttp2_debug.c \ + sfparse.c + +HFILES = nghttp2_pq.h nghttp2_int.h nghttp2_map.h nghttp2_queue.h \ + nghttp2_frame.h \ + nghttp2_buf.h \ + nghttp2_session.h nghttp2_helper.h nghttp2_stream.h nghttp2_int.h \ + nghttp2_alpn.h \ + nghttp2_submit.h nghttp2_outbound_item.h \ + nghttp2_net.h \ + nghttp2_hd.h nghttp2_hd_huffman.h \ + nghttp2_priority_spec.h \ + nghttp2_option.h \ + nghttp2_callbacks.h \ + nghttp2_mem.h \ + nghttp2_http.h \ + nghttp2_rcbuf.h \ + nghttp2_extpri.h \ + nghttp2_ratelim.h \ + nghttp2_time.h \ + nghttp2_debug.h \ + sfparse.h + +libnghttp2_la_SOURCES = $(HFILES) $(OBJECTS) +libnghttp2_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu lib/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +libnghttp2.pc: $(top_builddir)/config.status $(srcdir)/libnghttp2.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libnghttp2.la: $(libnghttp2_la_OBJECTS) $(libnghttp2_la_DEPENDENCIES) $(EXTRA_libnghttp2_la_DEPENDENCIES) + $(AM_V_CCLD)$(libnghttp2_la_LINK) -rpath $(libdir) $(libnghttp2_la_OBJECTS) $(libnghttp2_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_alpn.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_buf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_callbacks.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_debug.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_extpri.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_frame.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_hd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_hd_huffman.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_hd_huffman_data.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_helper.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_http.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_map.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_mem.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_option.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_outbound_item.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_pq.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_priority_spec.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_queue.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_ratelim.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_rcbuf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_session.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_stream.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_submit.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_time.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_version.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfparse.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/nghttp2_alpn.Plo + -rm -f ./$(DEPDIR)/nghttp2_buf.Plo + -rm -f ./$(DEPDIR)/nghttp2_callbacks.Plo + -rm -f ./$(DEPDIR)/nghttp2_debug.Plo + -rm -f ./$(DEPDIR)/nghttp2_extpri.Plo + -rm -f ./$(DEPDIR)/nghttp2_frame.Plo + -rm -f ./$(DEPDIR)/nghttp2_hd.Plo + -rm -f ./$(DEPDIR)/nghttp2_hd_huffman.Plo + -rm -f ./$(DEPDIR)/nghttp2_hd_huffman_data.Plo + -rm -f ./$(DEPDIR)/nghttp2_helper.Plo + -rm -f ./$(DEPDIR)/nghttp2_http.Plo + -rm -f ./$(DEPDIR)/nghttp2_map.Plo + -rm -f ./$(DEPDIR)/nghttp2_mem.Plo + -rm -f ./$(DEPDIR)/nghttp2_option.Plo + -rm -f ./$(DEPDIR)/nghttp2_outbound_item.Plo + -rm -f ./$(DEPDIR)/nghttp2_pq.Plo + -rm -f ./$(DEPDIR)/nghttp2_priority_spec.Plo + -rm -f ./$(DEPDIR)/nghttp2_queue.Plo + -rm -f ./$(DEPDIR)/nghttp2_ratelim.Plo + -rm -f ./$(DEPDIR)/nghttp2_rcbuf.Plo + -rm -f ./$(DEPDIR)/nghttp2_session.Plo + -rm -f ./$(DEPDIR)/nghttp2_stream.Plo + -rm -f ./$(DEPDIR)/nghttp2_submit.Plo + -rm -f ./$(DEPDIR)/nghttp2_time.Plo + -rm -f ./$(DEPDIR)/nghttp2_version.Plo + -rm -f ./$(DEPDIR)/sfparse.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-pkgconfigDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/nghttp2_alpn.Plo + -rm -f ./$(DEPDIR)/nghttp2_buf.Plo + -rm -f ./$(DEPDIR)/nghttp2_callbacks.Plo + -rm -f ./$(DEPDIR)/nghttp2_debug.Plo + -rm -f ./$(DEPDIR)/nghttp2_extpri.Plo + -rm -f ./$(DEPDIR)/nghttp2_frame.Plo + -rm -f ./$(DEPDIR)/nghttp2_hd.Plo + -rm -f ./$(DEPDIR)/nghttp2_hd_huffman.Plo + -rm -f ./$(DEPDIR)/nghttp2_hd_huffman_data.Plo + -rm -f ./$(DEPDIR)/nghttp2_helper.Plo + -rm -f ./$(DEPDIR)/nghttp2_http.Plo + -rm -f ./$(DEPDIR)/nghttp2_map.Plo + -rm -f ./$(DEPDIR)/nghttp2_mem.Plo + -rm -f ./$(DEPDIR)/nghttp2_option.Plo + -rm -f ./$(DEPDIR)/nghttp2_outbound_item.Plo + -rm -f ./$(DEPDIR)/nghttp2_pq.Plo + -rm -f ./$(DEPDIR)/nghttp2_priority_spec.Plo + -rm -f ./$(DEPDIR)/nghttp2_queue.Plo + -rm -f ./$(DEPDIR)/nghttp2_ratelim.Plo + -rm -f ./$(DEPDIR)/nghttp2_rcbuf.Plo + -rm -f ./$(DEPDIR)/nghttp2_session.Plo + -rm -f ./$(DEPDIR)/nghttp2_stream.Plo + -rm -f ./$(DEPDIR)/nghttp2_submit.Plo + -rm -f ./$(DEPDIR)/nghttp2_time.Plo + -rm -f ./$(DEPDIR)/nghttp2_version.Plo + -rm -f ./$(DEPDIR)/sfparse.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgconfigDATA + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-libLTLIBRARIES uninstall-pkgconfigDATA + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/lib/Makefile.msvc b/lib/nghttp2-1.65.0/lib/Makefile.msvc similarity index 96% rename from lib/nghttp2/lib/Makefile.msvc rename to lib/nghttp2-1.65.0/lib/Makefile.msvc index 611b39d0b1d..752389e0fc4 100644 --- a/lib/nghttp2/lib/Makefile.msvc +++ b/lib/nghttp2-1.65.0/lib/Makefile.msvc @@ -74,7 +74,7 @@ NGHTTP2_SRC := nghttp2_pq.c \ nghttp2_session.c \ nghttp2_submit.c \ nghttp2_helper.c \ - nghttp2_npn.c \ + nghttp2_alpn.c \ nghttp2_hd.c \ nghttp2_hd_huffman.c \ nghttp2_hd_huffman_data.c \ diff --git a/lib/nghttp2/lib/includes/CMakeLists.txt b/lib/nghttp2-1.65.0/lib/includes/CMakeLists.txt similarity index 100% rename from lib/nghttp2/lib/includes/CMakeLists.txt rename to lib/nghttp2-1.65.0/lib/includes/CMakeLists.txt diff --git a/lib/nghttp2/lib/includes/Makefile.am b/lib/nghttp2-1.65.0/lib/includes/Makefile.am similarity index 100% rename from lib/nghttp2/lib/includes/Makefile.am rename to lib/nghttp2-1.65.0/lib/includes/Makefile.am diff --git a/lib/nghttp2-1.65.0/lib/includes/Makefile.in b/lib/nghttp2-1.65.0/lib/includes/Makefile.in new file mode 100644 index 00000000000..778dcb874c9 --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/includes/Makefile.in @@ -0,0 +1,664 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2012 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = lib/includes +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(nobase_include_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(includedir)" +HEADERS = $(nobase_include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = CMakeLists.txt +nobase_include_HEADERS = nghttp2/nghttp2.h nghttp2/nghttp2ver.h +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/includes/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu lib/includes/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-nobase_includeHEADERS: $(nobase_include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + $(am__nobase_list) | while read dir files; do \ + xfiles=; for file in $$files; do \ + if test -f "$$file"; then xfiles="$$xfiles $$file"; \ + else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ + test -z "$$xfiles" || { \ + test "x$$dir" = x. || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \ + echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \ + $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \ + done + +uninstall-nobase_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ + $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-nobase_includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-nobase_includeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man \ + install-nobase_includeHEADERS install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-nobase_includeHEADERS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/lib/includes/nghttp2/nghttp2.h b/lib/nghttp2-1.65.0/lib/includes/nghttp2/nghttp2.h similarity index 78% rename from lib/nghttp2/lib/includes/nghttp2/nghttp2.h rename to lib/nghttp2-1.65.0/lib/includes/nghttp2/nghttp2.h index 5378daf434f..3d91af55109 100644 --- a/lib/nghttp2/lib/includes/nghttp2/nghttp2.h +++ b/lib/nghttp2-1.65.0/lib/includes/nghttp2/nghttp2.h @@ -51,13 +51,14 @@ extern "C" { #endif /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */ #include #include +#include #include #ifdef NGHTTP2_STATICLIB # define NGHTTP2_EXTERN -#elif defined(WIN32) || (__has_declspec_attribute(dllexport) && \ - __has_declspec_attribute(dllimport)) +#elif defined(WIN32) || \ + (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport)) # ifdef BUILDING_NGHTTP2 # define NGHTTP2_EXTERN __declspec(dllexport) # else /* !BUILDING_NGHTTP2 */ @@ -71,6 +72,17 @@ extern "C" { # endif /* !BUILDING_NGHTTP2 */ #endif /* !defined(WIN32) */ +#ifdef BUILDING_NGHTTP2 +# undef NGHTTP2_NO_SSIZE_T +#endif /* BUILDING_NGHTTP2 */ + +/** + * @typedef + * + * :type:`nghttp2_ssize` is a signed counterpart of size_t. + */ +typedef ptrdiff_t nghttp2_ssize; + /** * @macro * @@ -168,6 +180,12 @@ typedef struct { /** * @macro * + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * * The default weight of stream dependency. */ #define NGHTTP2_DEFAULT_WEIGHT 16 @@ -175,6 +193,12 @@ typedef struct { /** * @macro * + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * * The maximum weight of stream dependency. */ #define NGHTTP2_MAX_WEIGHT 256 @@ -182,6 +206,12 @@ typedef struct { /** * @macro * + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * * The minimum weight of stream dependency. */ #define NGHTTP2_MIN_WEIGHT 1 @@ -255,7 +285,7 @@ typedef enum { */ NGHTTP2_ERR_UNSUPPORTED_VERSION = -503, /** - * Used as a return value from :type:`nghttp2_send_callback`, + * Used as a return value from :type:`nghttp2_send_callback2`, * :type:`nghttp2_recv_callback` and * :type:`nghttp2_send_data_callback` to indicate that the operation * would block. @@ -275,9 +305,9 @@ typedef enum { NGHTTP2_ERR_EOF = -507, /** * Used as a return value from - * :func:`nghttp2_data_source_read_callback` to indicate that data + * :func:`nghttp2_data_source_read_callback2` to indicate that data * transfer is postponed. See - * :func:`nghttp2_data_source_read_callback` for details. + * :func:`nghttp2_data_source_read_callback2` for details. */ NGHTTP2_ERR_DEFERRED = -508, /** @@ -835,7 +865,7 @@ typedef struct { * @union * * This union represents the some kind of data source passed to - * :type:`nghttp2_data_source_read_callback`. + * :type:`nghttp2_data_source_read_callback2`. */ typedef union { /** @@ -852,7 +882,7 @@ typedef union { * @enum * * The flags used to set in |data_flags| output parameter in - * :type:`nghttp2_data_source_read_callback`. + * :type:`nghttp2_data_source_read_callback2`. */ typedef enum { /** @@ -866,8 +896,8 @@ typedef enum { /** * Indicates that END_STREAM flag must not be set even if * NGHTTP2_DATA_FLAG_EOF is set. Usually this flag is used to send - * trailer fields with `nghttp2_submit_request()` or - * `nghttp2_submit_response()`. + * trailer fields with `nghttp2_submit_request2()` or + * `nghttp2_submit_response2()`. */ NGHTTP2_DATA_FLAG_NO_END_STREAM = 0x02, /** @@ -877,9 +907,15 @@ typedef enum { NGHTTP2_DATA_FLAG_NO_COPY = 0x04 } nghttp2_data_flag; +#ifndef NGHTTP2_NO_SSIZE_T /** * @functypedef * + * .. warning:: + * + * Deprecated. Use :type:`nghttp2_data_source_read_callback2` + * instead. + * * Callback function invoked when the library wants to read data from * the |source|. The read data is sent in the stream |stream_id|. * The implementation of this function must read at most |length| @@ -941,12 +977,86 @@ typedef enum { * signal the entire session failure. */ typedef ssize_t (*nghttp2_data_source_read_callback)( - nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t length, - uint32_t *data_flags, nghttp2_data_source *source, void *user_data); + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t length, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data); + +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @functypedef + * + * Callback function invoked when the library wants to read data from + * the |source|. The read data is sent in the stream |stream_id|. + * The implementation of this function must read at most |length| + * bytes of data from |source| (or possibly other places) and store + * them in |buf| and return number of data stored in |buf|. If EOF is + * reached, set :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF` flag + * in |*data_flags|. + * + * Sometime it is desirable to avoid copying data into |buf| and let + * application to send data directly. To achieve this, set + * :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_COPY` to + * |*data_flags| (and possibly other flags, just like when we do + * copy), and return the number of bytes to send without copying data + * into |buf|. The library, seeing + * :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_COPY`, will invoke + * :type:`nghttp2_send_data_callback`. The application must send + * complete DATA frame in that callback. + * + * If this callback is set by `nghttp2_submit_request2()`, + * `nghttp2_submit_response2()` or `nghttp2_submit_headers()` and + * `nghttp2_submit_data2()` with flag parameter + * :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM` set, and + * :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF` flag is set to + * |*data_flags|, DATA frame will have END_STREAM flag set. Usually, + * this is expected behaviour and all are fine. One exception is send + * trailer fields. You cannot send trailer fields after sending frame + * with END_STREAM set. To avoid this problem, one can set + * :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_END_STREAM` along + * with :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF` to signal the + * library not to set END_STREAM in DATA frame. Then application can + * use `nghttp2_submit_trailer()` to send trailer fields. + * `nghttp2_submit_trailer()` can be called inside this callback. + * + * If the application wants to postpone DATA frames (e.g., + * asynchronous I/O, or reading data blocks for long time), it is + * achieved by returning :enum:`nghttp2_error.NGHTTP2_ERR_DEFERRED` + * without reading any data in this invocation. The library removes + * DATA frame from the outgoing queue temporarily. To move back + * deferred DATA frame to outgoing queue, call + * `nghttp2_session_resume_data()`. + * + * By default, |length| is limited to 16KiB at maximum. If peer + * allows larger frames, application can enlarge transmission buffer + * size. See :type:`nghttp2_data_source_read_length_callback` for + * more details. + * + * If the application just wants to return from + * `nghttp2_session_send()` or `nghttp2_session_mem_send2()` without + * sending anything, return :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE`. + * + * In case of error, there are 2 choices. Returning + * :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE` will + * close the stream by issuing RST_STREAM with + * :enum:`nghttp2_error_code.NGHTTP2_INTERNAL_ERROR`. If a different + * error code is desirable, use `nghttp2_submit_rst_stream()` with a + * desired error code and then return + * :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. + * Returning :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` will + * signal the entire session failure. + */ +typedef nghttp2_ssize (*nghttp2_data_source_read_callback2)( + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t length, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data); +#ifndef NGHTTP2_NO_SSIZE_T /** * @struct * + * .. warning:: + * + * Deprecated. Use :type:`nghttp2_data_provider2` instead. + * * This struct represents the data source and the way to read a chunk * of data from it. */ @@ -961,6 +1071,25 @@ typedef struct { nghttp2_data_source_read_callback read_callback; } nghttp2_data_provider; +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @struct + * + * This struct represents the data source and the way to read a chunk + * of data from it. + */ +typedef struct { + /** + * The data source. + */ + nghttp2_data_source source; + /** + * The callback function to read a chunk of data from the |source|. + */ + nghttp2_data_source_read_callback2 read_callback; +} nghttp2_data_provider2; + /** * @struct * @@ -1013,6 +1142,12 @@ typedef enum { /** * @struct * + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * * The structure to specify stream dependency. */ typedef struct { @@ -1047,6 +1182,12 @@ typedef struct { */ size_t padlen; /** + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * * The priority specification */ nghttp2_priority_spec pri_spec; @@ -1067,6 +1208,12 @@ typedef struct { /** * @struct * + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * * The PRIORITY frame. It has the following members: */ typedef struct { @@ -1310,9 +1457,14 @@ typedef union { nghttp2_extension ext; } nghttp2_frame; +#ifndef NGHTTP2_NO_SSIZE_T /** * @functypedef * + * .. warning:: + * + * Deprecated. Use :type:`nghttp2_send_callback2` instead. + * * Callback function invoked when |session| wants to send data to the * remote peer. The implementation of this function must send at most * |length| bytes of data stored in |data|. The |flags| is currently @@ -1345,6 +1497,44 @@ typedef ssize_t (*nghttp2_send_callback)(nghttp2_session *session, const uint8_t *data, size_t length, int flags, void *user_data); +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @functypedef + * + * Callback function invoked when |session| wants to send data to the + * remote peer. The implementation of this function must send at most + * |length| bytes of data stored in |data|. The |flags| is currently + * not used and always 0. It must return the number of bytes sent if + * it succeeds. If it cannot send any single byte without blocking, + * it must return :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. For + * other errors, it must return + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. The + * |user_data| pointer is the third argument passed in to the call to + * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + * + * This callback is required if the application uses + * `nghttp2_session_send()` to send data to the remote endpoint. If + * the application uses solely `nghttp2_session_mem_send2()` instead, + * this callback function is unnecessary. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_send_callback2()`. + * + * .. note:: + * + * The |length| may be very small. If that is the case, and + * application disables Nagle algorithm (``TCP_NODELAY``), then just + * writing |data| to the network stack leads to very small packet, + * and it is very inefficient. An application should be responsible + * to buffer up small chunks of data as necessary to avoid this + * situation. + */ +typedef nghttp2_ssize (*nghttp2_send_callback2)(nghttp2_session *session, + const uint8_t *data, + size_t length, int flags, + void *user_data); + /** * @functypedef * @@ -1375,7 +1565,7 @@ typedef ssize_t (*nghttp2_send_callback)(nghttp2_session *session, * error; if partial frame data has already sent, it is impossible to * send another data in that state, and all we can do is tear down * connection). When data is fully processed, but application wants - * to make `nghttp2_session_mem_send()` or `nghttp2_session_send()` + * to make `nghttp2_session_mem_send2()` or `nghttp2_session_send()` * return immediately without processing next frames, return * :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE`. If application decided to * reset this stream, return @@ -1392,9 +1582,14 @@ typedef int (*nghttp2_send_data_callback)(nghttp2_session *session, nghttp2_data_source *source, void *user_data); +#ifndef NGHTTP2_NO_SSIZE_T /** * @functypedef * + * .. warning:: + * + * Deprecated. Use :type:`nghttp2_recv_callback2` instead. + * * Callback function invoked when |session| wants to receive data from * the remote peer. The implementation of this function must read at * most |length| bytes of data and store it in |buf|. The |flags| is @@ -1422,11 +1617,43 @@ typedef ssize_t (*nghttp2_recv_callback)(nghttp2_session *session, uint8_t *buf, size_t length, int flags, void *user_data); +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @functypedef + * + * Callback function invoked when |session| wants to receive data from + * the remote peer. The implementation of this function must read at + * most |length| bytes of data and store it in |buf|. The |flags| is + * currently not used and always 0. It must return the number of + * bytes written in |buf| if it succeeds. If it cannot read any + * single byte without blocking, it must return + * :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. If it gets EOF + * before it reads any single byte, it must return + * :enum:`nghttp2_error.NGHTTP2_ERR_EOF`. For other errors, it must + * return :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + * Returning 0 is treated as + * :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`. The |user_data| + * pointer is the third argument passed in to the call to + * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. + * + * This callback is required if the application uses + * `nghttp2_session_recv()` to receive data from the remote endpoint. + * If the application uses solely `nghttp2_session_mem_recv2()` + * instead, this callback function is unnecessary. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_recv_callback2()`. + */ +typedef nghttp2_ssize (*nghttp2_recv_callback2)(nghttp2_session *session, + uint8_t *buf, size_t length, + int flags, void *user_data); + /** * @functypedef * * Callback function invoked by `nghttp2_session_recv()` and - * `nghttp2_session_mem_recv()` when a frame is received. The + * `nghttp2_session_mem_recv2()` when a frame is received. The * |user_data| pointer is the third argument passed in to the call to * `nghttp2_session_client_new()` or `nghttp2_session_server_new()`. * @@ -1444,8 +1671,8 @@ typedef ssize_t (*nghttp2_recv_callback)(nghttp2_session *session, uint8_t *buf, * * The implementation of this function must return 0 if it succeeds. * If nonzero value is returned, it is treated as fatal error and - * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions - * immediately return + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * * To set this callback to :type:`nghttp2_session_callbacks`, use @@ -1459,7 +1686,7 @@ typedef int (*nghttp2_on_frame_recv_callback)(nghttp2_session *session, * @functypedef * * Callback function invoked by `nghttp2_session_recv()` and - * `nghttp2_session_mem_recv()` when an invalid non-DATA frame is + * `nghttp2_session_mem_recv2()` when an invalid non-DATA frame is * received. The error is indicated by the |lib_error_code|, which is * one of the values defined in :type:`nghttp2_error`. When this * callback function is invoked, the library automatically submits @@ -1473,16 +1700,16 @@ typedef int (*nghttp2_on_frame_recv_callback)(nghttp2_session *session, * * The implementation of this function must return 0 if it succeeds. * If nonzero is returned, it is treated as fatal error and - * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions - * immediately return + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * * To set this callback to :type:`nghttp2_session_callbacks`, use * `nghttp2_session_callbacks_set_on_invalid_frame_recv_callback()`. */ typedef int (*nghttp2_on_invalid_frame_recv_callback)( - nghttp2_session *session, const nghttp2_frame *frame, int lib_error_code, - void *user_data); + nghttp2_session *session, const nghttp2_frame *frame, int lib_error_code, + void *user_data); /** * @functypedef @@ -1497,19 +1724,19 @@ typedef int (*nghttp2_on_invalid_frame_recv_callback)( * argument passed in to the call to `nghttp2_session_client_new()` or * `nghttp2_session_server_new()`. * - * If the application uses `nghttp2_session_mem_recv()`, it can return - * :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` to make - * `nghttp2_session_mem_recv()` return without processing further + * If the application uses `nghttp2_session_mem_recv2()`, it can + * return :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` to make + * `nghttp2_session_mem_recv2()` return without processing further * input bytes. The memory by pointed by the |data| is retained until - * `nghttp2_session_mem_recv()` or `nghttp2_session_recv()` is called. - * The application must retain the input bytes which was used to - * produce the |data| parameter, because it may refer to the memory + * `nghttp2_session_mem_recv2()` or `nghttp2_session_recv()` is + * called. The application must retain the input bytes which was used + * to produce the |data| parameter, because it may refer to the memory * region included in the input bytes. * * The implementation of this function must return 0 if it succeeds. * If nonzero is returned, it is treated as fatal error, and - * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions - * immediately return + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * * To set this callback to :type:`nghttp2_session_callbacks`, use @@ -1536,8 +1763,8 @@ typedef int (*nghttp2_on_data_chunk_recv_callback)(nghttp2_session *session, * If there is a fatal error while executing this callback, the * implementation should return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`, which makes - * `nghttp2_session_send()` and `nghttp2_session_mem_send()` functions - * immediately return + * `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * * If the other value is returned, it is treated as if @@ -1561,8 +1788,8 @@ typedef int (*nghttp2_before_frame_send_callback)(nghttp2_session *session, * * The implementation of this function must return 0 if it succeeds. * If nonzero is returned, it is treated as fatal error and - * `nghttp2_session_send()` and `nghttp2_session_mem_send()` functions - * immediately return + * `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * * To set this callback to :type:`nghttp2_session_callbacks`, use @@ -1584,8 +1811,8 @@ typedef int (*nghttp2_on_frame_send_callback)(nghttp2_session *session, * * The implementation of this function must return 0 if it succeeds. * If nonzero is returned, it is treated as fatal error and - * `nghttp2_session_send()` and `nghttp2_session_mem_send()` functions - * immediately return + * `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * * `nghttp2_session_get_stream_user_data()` can be used to get @@ -1606,7 +1833,7 @@ typedef int (*nghttp2_on_frame_not_send_callback)(nghttp2_session *session, * The reason of closure is indicated by the |error_code|. The * |error_code| is usually one of :enum:`nghttp2_error_code`, but that * is not guaranteed. The stream_user_data, which was specified in - * `nghttp2_submit_request()` or `nghttp2_submit_headers()`, is still + * `nghttp2_submit_request2()` or `nghttp2_submit_headers()`, is still * available in this function. The |user_data| pointer is the third * argument passed in to the call to `nghttp2_session_client_new()` or * `nghttp2_session_server_new()`. @@ -1615,8 +1842,8 @@ typedef int (*nghttp2_on_frame_not_send_callback)(nghttp2_session *session, * * The implementation of this function must return 0 if it succeeds. * If nonzero is returned, it is treated as fatal error and - * `nghttp2_session_recv()`, `nghttp2_session_mem_recv()`, - * `nghttp2_session_send()`, and `nghttp2_session_mem_send()` + * `nghttp2_session_recv()`, `nghttp2_session_mem_recv2()`, + * `nghttp2_session_send()`, and `nghttp2_session_mem_send2()` * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * @@ -1686,7 +1913,7 @@ typedef int (*nghttp2_on_stream_close_callback)(nghttp2_session *session, * value is returned, it is treated as if * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` is returned. If * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` is returned, - * `nghttp2_session_mem_recv()` function will immediately return + * `nghttp2_session_mem_recv2()` function will immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * * To set this callback to :type:`nghttp2_session_callbacks`, use @@ -1731,11 +1958,11 @@ typedef int (*nghttp2_on_begin_headers_callback)(nghttp2_session *session, * performs validation based on HTTP Messaging rule, which is briefly * explained in :ref:`http-messaging` section. * - * If the application uses `nghttp2_session_mem_recv()`, it can return - * :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` to make - * `nghttp2_session_mem_recv()` return without processing further + * If the application uses `nghttp2_session_mem_recv2()`, it can + * return :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` to make + * `nghttp2_session_mem_recv2()` return without processing further * input bytes. The memory pointed by |frame|, |name| and |value| - * parameters are retained until `nghttp2_session_mem_recv()` or + * parameters are retained until `nghttp2_session_mem_recv2()` or * `nghttp2_session_recv()` is called. The application must retain * the input bytes which was used to produce these parameters, because * it may refer to the memory region included in the input bytes. @@ -1762,8 +1989,8 @@ typedef int (*nghttp2_on_begin_headers_callback)(nghttp2_session *session, * nonzero value is returned, it is treated as * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` is returned, - * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions - * immediately return + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * * To set this callback to :type:`nghttp2_session_callbacks`, use @@ -1842,9 +2069,9 @@ typedef int (*nghttp2_on_header_callback2)(nghttp2_session *session, * not reset. */ typedef int (*nghttp2_on_invalid_header_callback)( - nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, - size_t namelen, const uint8_t *value, size_t valuelen, uint8_t flags, - void *user_data); + nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, + size_t namelen, const uint8_t *value, size_t valuelen, uint8_t flags, + void *user_data); /** * @functypedef @@ -1875,12 +2102,18 @@ typedef int (*nghttp2_on_invalid_header_callback)( * :enum:`nghttp2_error.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE`. */ typedef int (*nghttp2_on_invalid_header_callback2)( - nghttp2_session *session, const nghttp2_frame *frame, nghttp2_rcbuf *name, - nghttp2_rcbuf *value, uint8_t flags, void *user_data); + nghttp2_session *session, const nghttp2_frame *frame, nghttp2_rcbuf *name, + nghttp2_rcbuf *value, uint8_t flags, void *user_data); +#ifndef NGHTTP2_NO_SSIZE_T /** * @functypedef * + * .. warning:: + * + * Deprecated. Use :type:`nghttp2_select_padding_callback2` + * instead. + * * Callback function invoked when the library asks application how * many padding bytes are required for the transmission of the * |frame|. The application must choose the total length of payload @@ -1901,9 +2134,39 @@ typedef ssize_t (*nghttp2_select_padding_callback)(nghttp2_session *session, size_t max_payloadlen, void *user_data); +#endif /* NGHTTP2_NO_SSIZE_T */ + /** * @functypedef * + * Callback function invoked when the library asks application how + * many padding bytes are required for the transmission of the + * |frame|. The application must choose the total length of payload + * including padded bytes in range [frame->hd.length, max_payloadlen], + * inclusive. Choosing number not in this range will be treated as + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. Returning + * ``frame->hd.length`` means no padding is added. Returning + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` will make + * `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + * functions immediately return + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_select_padding_callback2()`. + */ +typedef nghttp2_ssize (*nghttp2_select_padding_callback2)( + nghttp2_session *session, const nghttp2_frame *frame, size_t max_payloadlen, + void *user_data); + +#ifndef NGHTTP2_NO_SSIZE_T +/** + * @functypedef + * + * .. warning:: + * + * Deprecated. Use + * :type:`nghttp2_data_source_read_length_callback2` instead. + * * Callback function invoked when library wants to get max length of * data to send data to the remote peer. The implementation of this * function should return a value in the following range. [1, @@ -1927,9 +2190,41 @@ typedef ssize_t (*nghttp2_select_padding_callback)(nghttp2_session *session, * `nghttp2_session_callbacks_set_data_source_read_length_callback()`. */ typedef ssize_t (*nghttp2_data_source_read_length_callback)( - nghttp2_session *session, uint8_t frame_type, int32_t stream_id, - int32_t session_remote_window_size, int32_t stream_remote_window_size, - uint32_t remote_max_frame_size, void *user_data); + nghttp2_session *session, uint8_t frame_type, int32_t stream_id, + int32_t session_remote_window_size, int32_t stream_remote_window_size, + uint32_t remote_max_frame_size, void *user_data); + +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @functypedef + * + * Callback function invoked when library wants to get max length of + * data to send data to the remote peer. The implementation of this + * function should return a value in the following range. [1, + * min(|session_remote_window_size|, |stream_remote_window_size|, + * |remote_max_frame_size|)]. If a value greater than this range is + * returned than the max allow value will be used. Returning a value + * smaller than this range is treated as + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. The + * |frame_type| is provided for future extensibility and identifies + * the type of frame (see :type:`nghttp2_frame_type`) for which to get + * the length for. Currently supported frame types are: + * :enum:`nghttp2_frame_type.NGHTTP2_DATA`. + * + * This callback can be used to control the length in bytes for which + * :type:`nghttp2_data_source_read_callback` is allowed to send to the + * remote endpoint. This callback is optional. Returning + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` will signal the + * entire session failure. + * + * To set this callback to :type:`nghttp2_session_callbacks`, use + * `nghttp2_session_callbacks_set_data_source_read_length_callback2()`. + */ +typedef nghttp2_ssize (*nghttp2_data_source_read_length_callback2)( + nghttp2_session *session, uint8_t frame_type, int32_t stream_id, + int32_t session_remote_window_size, int32_t stream_remote_window_size, + uint32_t remote_max_frame_size, void *user_data); /** * @functypedef @@ -1947,8 +2242,8 @@ typedef ssize_t (*nghttp2_data_source_read_length_callback)( * * The implementation of this function must return 0 if it succeeds. * If nonzero value is returned, it is treated as fatal error and - * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions - * immediately return + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. * * To set this callback to :type:`nghttp2_session_callbacks`, use @@ -1972,15 +2267,15 @@ typedef int (*nghttp2_on_begin_frame_callback)(nghttp2_session *session, * * If fatal error occurred, application should return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, - * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions - * immediately return + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the other * values are returned, currently they are treated as * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. */ typedef int (*nghttp2_on_extension_chunk_recv_callback)( - nghttp2_session *session, const nghttp2_frame_hd *hd, const uint8_t *data, - size_t len, void *user_data); + nghttp2_session *session, const nghttp2_frame_hd *hd, const uint8_t *data, + size_t len, void *user_data); /** * @functypedef @@ -2002,7 +2297,7 @@ typedef int (*nghttp2_on_extension_chunk_recv_callback)( * ``NULL``. The |*payload| is available as ``frame->ext.payload`` in * :type:`nghttp2_on_frame_recv_callback`. Therefore if application * can free that memory inside :type:`nghttp2_on_frame_recv_callback` - * callback. Of course, application has a liberty not ot use + * callback. Of course, application has a liberty not to use * |*payload|, and do its own mechanism to process extension frames. * * To abort processing this extension frame, return @@ -2010,8 +2305,8 @@ typedef int (*nghttp2_on_extension_chunk_recv_callback)( * * If fatal error occurred, application should return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, - * `nghttp2_session_recv()` and `nghttp2_session_mem_recv()` functions - * immediately return + * `nghttp2_session_recv()` and `nghttp2_session_mem_recv2()` + * functions immediately return * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the other * values are returned, currently they are treated as * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. @@ -2021,9 +2316,15 @@ typedef int (*nghttp2_unpack_extension_callback)(nghttp2_session *session, const nghttp2_frame_hd *hd, void *user_data); +#ifndef NGHTTP2_NO_SSIZE_T /** * @functypedef * + * .. warning:: + * + * Deprecated. Use :type:`nghttp2_pack_extension_callback2` + * instead. + * * Callback function invoked when library asks the application to pack * extension payload in its wire format. The frame header will be * packed by library. Application must pack payload only. @@ -2054,19 +2355,54 @@ typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session, const nghttp2_frame *frame, void *user_data); +#endif /* NGHTTP2_NO_SSIZE_T */ + /** * @functypedef * - * Callback function invoked when library provides the error message - * intended for human consumption. This callback is solely for - * debugging purpose. The |msg| is typically NULL-terminated string - * of length |len|. |len| does not include the sentinel NULL - * character. - * - * This function is deprecated. The new application should use - * :type:`nghttp2_error_callback2`. - * - * The format of error message may change between nghttp2 library + * Callback function invoked when library asks the application to pack + * extension payload in its wire format. The frame header will be + * packed by library. Application must pack payload only. + * ``frame->ext.payload`` is the object passed to + * `nghttp2_submit_extension()` as payload parameter. Application + * must pack extension payload to the |buf| of its capacity |len| + * bytes. The |len| is at least 16KiB. + * + * The implementation of this function should return the number of + * bytes written into |buf| when it succeeds. + * + * To abort processing this extension frame, return + * :enum:`nghttp2_error.NGHTTP2_ERR_CANCEL`, and + * :type:`nghttp2_on_frame_not_send_callback` will be invoked. + * + * If fatal error occurred, application should return + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. In this case, + * `nghttp2_session_send()` and `nghttp2_session_mem_send2()` + * functions immediately return + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the other + * values are returned, currently they are treated as + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. If the return + * value is strictly larger than |len|, it is treated as + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE`. + */ +typedef nghttp2_ssize (*nghttp2_pack_extension_callback2)( + nghttp2_session *session, uint8_t *buf, size_t len, + const nghttp2_frame *frame, void *user_data); + +/** + * @functypedef + * + * .. warning:: + * + * Deprecated. Use :type:`nghttp2_error_callback2` instead. + * + * Callback function invoked when library provides the error message + * intended for human consumption. This callback is solely for + * debugging purpose. The |msg| is typically NULL-terminated string + * of length |len|. |len| does not include the sentinel NULL + * character. + * + * The format of error message may change between nghttp2 library * versions. The application should not depend on the particular * format. * @@ -2148,49 +2484,87 @@ nghttp2_session_callbacks_new(nghttp2_session_callbacks **callbacks_ptr); NGHTTP2_EXTERN void nghttp2_session_callbacks_del(nghttp2_session_callbacks *callbacks); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use `nghttp2_session_callbacks_set_send_callback2()` + * with :type:`nghttp2_send_callback2` instead. + * * Sets callback function invoked when a session wants to send data to * the remote peer. This callback is not necessary if the application * uses solely `nghttp2_session_mem_send()` to serialize data to * transmit. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_send_callback( - nghttp2_session_callbacks *cbs, nghttp2_send_callback send_callback); + nghttp2_session_callbacks *cbs, nghttp2_send_callback send_callback); + +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Sets callback function invoked when a session wants to send data to + * the remote peer. This callback is not necessary if the application + * uses solely `nghttp2_session_mem_send2()` to serialize data to + * transmit. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_send_callback2( + nghttp2_session_callbacks *cbs, nghttp2_send_callback2 send_callback); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use `nghttp2_session_callbacks_set_recv_callback2()` + * with :type:`nghttp2_recv_callback2` instead. + * * Sets callback function invoked when the a session wants to receive * data from the remote peer. This callback is not necessary if the * application uses solely `nghttp2_session_mem_recv()` to process * received data. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_recv_callback( - nghttp2_session_callbacks *cbs, nghttp2_recv_callback recv_callback); + nghttp2_session_callbacks *cbs, nghttp2_recv_callback recv_callback); + +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Sets callback function invoked when the a session wants to receive + * data from the remote peer. This callback is not necessary if the + * application uses solely `nghttp2_session_mem_recv2()` to process + * received data. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_recv_callback2( + nghttp2_session_callbacks *cbs, nghttp2_recv_callback2 recv_callback); /** * @function * * Sets callback function invoked by `nghttp2_session_recv()` and - * `nghttp2_session_mem_recv()` when a frame is received. + * `nghttp2_session_mem_recv2()` when a frame is received. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_frame_recv_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_frame_recv_callback on_frame_recv_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_recv_callback on_frame_recv_callback); /** * @function * * Sets callback function invoked by `nghttp2_session_recv()` and - * `nghttp2_session_mem_recv()` when an invalid non-DATA frame is + * `nghttp2_session_mem_recv2()` when an invalid non-DATA frame is * received. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_invalid_frame_recv_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback); /** * @function @@ -2199,8 +2573,8 @@ nghttp2_session_callbacks_set_on_invalid_frame_recv_callback( * is received. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback); /** * @function @@ -2208,8 +2582,8 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_data_chunk_recv_callback( * Sets callback function invoked before a non-DATA frame is sent. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_before_frame_send_callback( - nghttp2_session_callbacks *cbs, - nghttp2_before_frame_send_callback before_frame_send_callback); + nghttp2_session_callbacks *cbs, + nghttp2_before_frame_send_callback before_frame_send_callback); /** * @function @@ -2217,8 +2591,8 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_before_frame_send_callback( * Sets callback function invoked after a frame is sent. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_frame_send_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_frame_send_callback on_frame_send_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_send_callback on_frame_send_callback); /** * @function @@ -2227,8 +2601,8 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_frame_send_callback( * because of an error. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_frame_not_send_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_frame_not_send_callback on_frame_not_send_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_not_send_callback on_frame_not_send_callback); /** * @function @@ -2236,8 +2610,8 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_frame_not_send_callback( * Sets callback function invoked when the stream is closed. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_stream_close_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_stream_close_callback on_stream_close_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_stream_close_callback on_stream_close_callback); /** * @function @@ -2246,8 +2620,8 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_stream_close_callback( * in HEADERS or PUSH_PROMISE is started. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_begin_headers_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_begin_headers_callback on_begin_headers_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_begin_headers_callback on_begin_headers_callback); /** * @function @@ -2259,8 +2633,8 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_begin_headers_callback( * set callbacks, the latter has the precedence. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_header_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_header_callback on_header_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_header_callback on_header_callback); /** * @function @@ -2269,8 +2643,8 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_header_callback( * received. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_header_callback2( - nghttp2_session_callbacks *cbs, - nghttp2_on_header_callback2 on_header_callback2); + nghttp2_session_callbacks *cbs, + nghttp2_on_header_callback2 on_header_callback2); /** * @function @@ -2282,8 +2656,8 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_header_callback2( * used to set callbacks, the latter takes the precedence. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_invalid_header_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_invalid_header_callback on_invalid_header_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_invalid_header_callback on_invalid_header_callback); /** * @function @@ -2292,30 +2666,70 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_invalid_header_callback( * pair is received. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_invalid_header_callback2( - nghttp2_session_callbacks *cbs, - nghttp2_on_invalid_header_callback2 on_invalid_header_callback2); + nghttp2_session_callbacks *cbs, + nghttp2_on_invalid_header_callback2 on_invalid_header_callback2); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use + * `nghttp2_session_callbacks_set_select_padding_callback2()` with + * :type:`nghttp2_select_padding_callback2` instead. + * * Sets callback function invoked when the library asks application * how many padding bytes are required for the transmission of the * given frame. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_select_padding_callback( - nghttp2_session_callbacks *cbs, - nghttp2_select_padding_callback select_padding_callback); + nghttp2_session_callbacks *cbs, + nghttp2_select_padding_callback select_padding_callback); + +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Sets callback function invoked when the library asks application + * how many padding bytes are required for the transmission of the + * given frame. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_select_padding_callback2( + nghttp2_session_callbacks *cbs, + nghttp2_select_padding_callback2 select_padding_callback); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use + * `nghttp2_session_callbacks_set_data_source_read_length_callback2()` + * with :type:`nghttp2_data_source_read_length_callback2` instead. + * * Sets callback function determine the length allowed in * :type:`nghttp2_data_source_read_callback`. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_data_source_read_length_callback( - nghttp2_session_callbacks *cbs, - nghttp2_data_source_read_length_callback data_source_read_length_callback); + nghttp2_session_callbacks *cbs, + nghttp2_data_source_read_length_callback data_source_read_length_callback); + +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Sets callback function determine the length allowed in + * :type:`nghttp2_data_source_read_callback2`. + */ +NGHTTP2_EXTERN void +nghttp2_session_callbacks_set_data_source_read_length_callback2( + nghttp2_session_callbacks *cbs, + nghttp2_data_source_read_length_callback2 data_source_read_length_callback); /** * @function @@ -2323,29 +2737,48 @@ nghttp2_session_callbacks_set_data_source_read_length_callback( * Sets callback function invoked when a frame header is received. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_begin_frame_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_begin_frame_callback on_begin_frame_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_begin_frame_callback on_begin_frame_callback); /** * @function * * Sets callback function invoked when * :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_COPY` is used in - * :type:`nghttp2_data_source_read_callback` to avoid data copy. + * :type:`nghttp2_data_source_read_callback2` to avoid data copy. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_send_data_callback( - nghttp2_session_callbacks *cbs, - nghttp2_send_data_callback send_data_callback); + nghttp2_session_callbacks *cbs, + nghttp2_send_data_callback send_data_callback); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use + * `nghttp2_session_callbacks_set_pack_extension_callback2()` with + * :type:`nghttp2_pack_extension_callback2` instead. + * * Sets callback function invoked when the library asks the * application to pack extension frame payload in wire format. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_pack_extension_callback( - nghttp2_session_callbacks *cbs, - nghttp2_pack_extension_callback pack_extension_callback); + nghttp2_session_callbacks *cbs, + nghttp2_pack_extension_callback pack_extension_callback); + +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Sets callback function invoked when the library asks the + * application to pack extension frame payload in wire format. + */ +NGHTTP2_EXTERN void nghttp2_session_callbacks_set_pack_extension_callback2( + nghttp2_session_callbacks *cbs, + nghttp2_pack_extension_callback2 pack_extension_callback); /** * @function @@ -2354,8 +2787,8 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_pack_extension_callback( * application to unpack extension frame payload from wire format. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_unpack_extension_callback( - nghttp2_session_callbacks *cbs, - nghttp2_unpack_extension_callback unpack_extension_callback); + nghttp2_session_callbacks *cbs, + nghttp2_unpack_extension_callback unpack_extension_callback); /** * @function @@ -2365,24 +2798,27 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_unpack_extension_callback( */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_on_extension_chunk_recv_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback); + nghttp2_session_callbacks *cbs, + nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback); /** * @function * + * .. warning:: + * + * Deprecated. Use + * `nghttp2_session_callbacks_set_error_callback2()` with + * :type:`nghttp2_error_callback2` instead. + * * Sets callback function invoked when library tells error message to * the application. * - * This function is deprecated. The new application should use - * `nghttp2_session_callbacks_set_error_callback2()`. - * * If both :type:`nghttp2_error_callback` and * :type:`nghttp2_error_callback2` are set, the latter takes * precedence. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback( - nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback); + nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback); /** * @function @@ -2395,7 +2831,7 @@ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback( * precedence. */ NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback2( - nghttp2_session_callbacks *cbs, nghttp2_error_callback2 error_callback2); + nghttp2_session_callbacks *cbs, nghttp2_error_callback2 error_callback2); /** * @functypedef @@ -2573,7 +3009,7 @@ nghttp2_option_set_peer_max_concurrent_streams(nghttp2_option *option, * * If this option is not used or used with zero value, if MAGIC does * not match :macro:`NGHTTP2_CLIENT_MAGIC`, `nghttp2_session_recv()` - * and `nghttp2_session_mem_recv()` will return error + * and `nghttp2_session_mem_recv2()` will return error * :enum:`nghttp2_error.NGHTTP2_ERR_BAD_CLIENT_MAGIC`, which is fatal * error. */ @@ -2697,14 +3133,12 @@ nghttp2_option_set_max_deflate_dynamic_table_size(nghttp2_option *option, /** * @function * - * This option prevents the library from retaining closed streams to - * maintain the priority tree. If this option is set to nonzero, - * applications can discard closed stream completely to save memory. + * .. warning:: * - * If - * :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` - * of value of 1 is submitted via `nghttp2_submit_settings()`, any - * closed streams are not retained regardless of this option. + * Deprecated. Closed streams are not retained anymore. + * + * This function works as before, but it does not take any effect + * against :type:`nghttp2_session`. */ NGHTTP2_EXTERN void nghttp2_option_set_no_closed_streams(nghttp2_option *option, int val); @@ -2734,16 +3168,11 @@ NGHTTP2_EXTERN void nghttp2_option_set_max_settings(nghttp2_option *option, /** * @function * - * This option, if set to nonzero, allows server to fallback to - * :rfc:`7540` priorities if SETTINGS_NO_RFC7540_PRIORITIES was not - * received from client, and server submitted - * :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` - * = 1 via `nghttp2_submit_settings()`. Most of the advanced - * functionality for RFC 7540 priorities are still disabled. This - * fallback only enables the minimal feature set of RFC 7540 - * priorities to deal with priority signaling from client. + * .. warning:: + * Deprecated. :rfc:`7540` priorities have been removed. * - * Client session ignores this option. + * This function works as before, but it does not take any effect + * against :type:`nghttp2_session`. */ NGHTTP2_EXTERN void nghttp2_option_set_server_fallback_rfc7540_priorities(nghttp2_option *option, @@ -2759,7 +3188,7 @@ nghttp2_option_set_server_fallback_rfc7540_priorities(nghttp2_option *option, */ NGHTTP2_EXTERN void nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation( - nghttp2_option *option, int val); + nghttp2_option *option, int val); /** * @function @@ -2778,6 +3207,17 @@ NGHTTP2_EXTERN void nghttp2_option_set_stream_reset_rate_limit(nghttp2_option *option, uint64_t burst, uint64_t rate); +/** + * @function + * + * This function sets the maximum number of CONTINUATION frames + * following an incoming HEADER frame. If more than those frames are + * received, the remote endpoint is considered to be misbehaving and + * session will be closed. The default value is 8. + */ +NGHTTP2_EXTERN void nghttp2_option_set_max_continuations(nghttp2_option *option, + size_t val); + /** * @function * @@ -2786,7 +3226,7 @@ nghttp2_option_set_stream_reset_rate_limit(nghttp2_option *option, * does not store |callbacks|. The |user_data| is an arbitrary user * supplied data, which will be passed to the callback functions. * - * The :type:`nghttp2_send_callback` must be specified. If the + * The :type:`nghttp2_send_callback2` must be specified. If the * application code uses `nghttp2_session_recv()`, the * :type:`nghttp2_recv_callback` must be specified. The other members * of |callbacks| can be ``NULL``. @@ -2812,7 +3252,7 @@ nghttp2_session_client_new(nghttp2_session **session_ptr, * does not store |callbacks|. The |user_data| is an arbitrary user * supplied data, which will be passed to the callback functions. * - * The :type:`nghttp2_send_callback` must be specified. If the + * The :type:`nghttp2_send_callback2` must be specified. If the * application code uses `nghttp2_session_recv()`, the * :type:`nghttp2_recv_callback` must be specified. The other members * of |callbacks| can be ``NULL``. @@ -2904,8 +3344,8 @@ nghttp2_session_server_new2(nghttp2_session **session_ptr, * Out of memory. */ NGHTTP2_EXTERN int nghttp2_session_client_new3( - nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, - void *user_data, const nghttp2_option *option, nghttp2_mem *mem); + nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option, nghttp2_mem *mem); /** * @function @@ -2929,8 +3369,8 @@ NGHTTP2_EXTERN int nghttp2_session_client_new3( * Out of memory. */ NGHTTP2_EXTERN int nghttp2_session_server_new3( - nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, - void *user_data, const nghttp2_option *option, nghttp2_mem *mem); + nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks, + void *user_data, const nghttp2_option *option, nghttp2_mem *mem); /** * @function @@ -2948,7 +3388,7 @@ NGHTTP2_EXTERN void nghttp2_session_del(nghttp2_session *session); * This function retrieves the highest prioritized frame from the * outbound queue and sends it to the remote peer. It does this as * many times as possible until the user callback - * :type:`nghttp2_send_callback` returns + * :type:`nghttp2_send_callback2` returns * :enum:`nghttp2_error.NGHTTP2_ERR_WOULDBLOCK`, the outbound queue * becomes empty or flow control is triggered (remote window size * becomes depleted or maximum number of concurrent streams is @@ -2978,7 +3418,7 @@ NGHTTP2_EXTERN void nghttp2_session_del(nghttp2_session *session); * :type:`nghttp2_on_frame_not_send_callback` is invoked. Abort * the following steps. * - * 8. :type:`nghttp2_send_callback` is invoked one or more times to + * 8. :type:`nghttp2_send_callback2` is invoked one or more times to * send the frame. * * 9. :type:`nghttp2_on_frame_send_callback` is invoked. @@ -2997,9 +3437,14 @@ NGHTTP2_EXTERN void nghttp2_session_del(nghttp2_session *session); */ NGHTTP2_EXTERN int nghttp2_session_send(nghttp2_session *session); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use `nghttp2_session_mem_send2()` instead. + * * Returns the serialized data to send. * * This function behaves like `nghttp2_session_send()` except that it @@ -3039,6 +3484,50 @@ NGHTTP2_EXTERN int nghttp2_session_send(nghttp2_session *session); NGHTTP2_EXTERN ssize_t nghttp2_session_mem_send(nghttp2_session *session, const uint8_t **data_ptr); +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Returns the serialized data to send. + * + * This function behaves like `nghttp2_session_send()` except that it + * does not use :type:`nghttp2_send_callback2` to transmit data. + * Instead, it assigns the pointer to the serialized data to the + * |*data_ptr| and returns its length. The other callbacks are called + * in the same way as they are in `nghttp2_session_send()`. + * + * If no data is available to send, this function returns 0. + * + * This function may not return all serialized data in one invocation. + * To get all data, call this function repeatedly until it returns 0 + * or one of negative error codes. + * + * The assigned |*data_ptr| is valid until the next call of + * `nghttp2_session_mem_send2()` or `nghttp2_session_send()`. + * + * The caller must send all data before sending the next chunk of + * data. + * + * This function returns the length of the data pointed by the + * |*data_ptr| if it succeeds, or one of the following negative error + * codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + * Out of memory. + * + * .. note:: + * + * This function may produce very small byte string. If that is the + * case, and application disables Nagle algorithm (``TCP_NODELAY``), + * then writing this small chunk leads to very small packet, and it + * is very inefficient. An application should be responsible to + * buffer up small chunks of data as necessary to avoid this + * situation. + */ +NGHTTP2_EXTERN nghttp2_ssize +nghttp2_session_mem_send2(nghttp2_session *session, const uint8_t **data_ptr); + /** * @function * @@ -3109,9 +3598,14 @@ NGHTTP2_EXTERN ssize_t nghttp2_session_mem_send(nghttp2_session *session, */ NGHTTP2_EXTERN int nghttp2_session_recv(nghttp2_session *session); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use `nghttp2_session_mem_recv2()` instead. + * * Processes data |in| as an input from the remote endpoint. The * |inlen| indicates the number of bytes to receive in the |in|. * @@ -3150,6 +3644,49 @@ NGHTTP2_EXTERN ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, size_t inlen); +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Processes data |in| as an input from the remote endpoint. The + * |inlen| indicates the number of bytes to receive in the |in|. + * + * This function behaves like `nghttp2_session_recv()` except that it + * does not use :type:`nghttp2_recv_callback` to receive data; the + * |in| is the only data for the invocation of this function. If all + * bytes are processed, this function returns. The other callbacks + * are called in the same way as they are in `nghttp2_session_recv()`. + * + * In the current implementation, this function always tries to + * processes |inlen| bytes of input data unless either an error occurs or + * :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` is returned from + * :type:`nghttp2_on_header_callback` or + * :type:`nghttp2_on_data_chunk_recv_callback`. If + * :enum:`nghttp2_error.NGHTTP2_ERR_PAUSE` is used, the return value + * includes the number of bytes which was used to produce the data or + * frame for the callback. + * + * This function returns the number of processed bytes, or one of the + * following negative error codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`nghttp2_error.NGHTTP2_ERR_CALLBACK_FAILURE` + * The callback function failed. + * :enum:`nghttp2_error.NGHTTP2_ERR_BAD_CLIENT_MAGIC` + * Invalid client magic was detected. This error only returns + * when |session| was configured as server and + * `nghttp2_option_set_no_recv_client_magic()` is not used with + * nonzero value. + * :enum:`nghttp2_error.NGHTTP2_ERR_FLOODED` + * Flooding was detected in this HTTP/2 session, and it must be + * closed. This is most likely caused by misbehaviour of peer. + */ +NGHTTP2_EXTERN nghttp2_ssize nghttp2_session_mem_recv2(nghttp2_session *session, + const uint8_t *in, + size_t inlen); + /** * @function * @@ -3195,7 +3732,7 @@ NGHTTP2_EXTERN int nghttp2_session_want_write(nghttp2_session *session); * @function * * Returns stream_user_data for the stream |stream_id|. The - * stream_user_data is provided by `nghttp2_submit_request()`, + * stream_user_data is provided by `nghttp2_submit_request2()`, * `nghttp2_submit_headers()` or * `nghttp2_session_set_stream_user_data()`. Unless it is set using * `nghttp2_session_set_stream_user_data()`, if the stream is @@ -3263,7 +3800,7 @@ nghttp2_session_get_outbound_queue_size(nghttp2_session *session); * This function returns -1 if it fails. */ NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_effective_recv_data_length( - nghttp2_session *session, int32_t stream_id); + nghttp2_session *session, int32_t stream_id); /** * @function @@ -3283,7 +3820,7 @@ NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_effective_recv_data_length( * This function returns -1 if it fails. */ NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_effective_local_window_size( - nghttp2_session *session, int32_t stream_id); + nghttp2_session *session, int32_t stream_id); /** * @function @@ -3298,7 +3835,7 @@ NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_effective_local_window_size( * This function returns -1 if it fails. */ NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_local_window_size( - nghttp2_session *session, int32_t stream_id); + nghttp2_session *session, int32_t stream_id); /** * @function @@ -3366,7 +3903,7 @@ nghttp2_session_get_local_window_size(nghttp2_session *session); * This function returns -1 if it fails. */ NGHTTP2_EXTERN int32_t nghttp2_session_get_stream_remote_window_size( - nghttp2_session *session, int32_t stream_id); + nghttp2_session *session, int32_t stream_id); /** * @function @@ -3520,7 +4057,7 @@ NGHTTP2_EXTERN int nghttp2_submit_shutdown_notice(nghttp2_session *session); * :enum:`nghttp2_settings_id`. */ NGHTTP2_EXTERN uint32_t nghttp2_session_get_remote_settings( - nghttp2_session *session, nghttp2_settings_id id); + nghttp2_session *session, nghttp2_settings_id id); /** * @function @@ -3530,7 +4067,7 @@ NGHTTP2_EXTERN uint32_t nghttp2_session_get_remote_settings( * in :enum:`nghttp2_settings_id`. */ NGHTTP2_EXTERN uint32_t nghttp2_session_get_local_settings( - nghttp2_session *session, nghttp2_settings_id id); + nghttp2_session *session, nghttp2_settings_id id); /** * @function @@ -3631,36 +4168,13 @@ NGHTTP2_EXTERN int nghttp2_session_consume_stream(nghttp2_session *session, /** * @function * - * Changes priority of existing stream denoted by |stream_id|. The - * new priority specification is |pri_spec|. - * - * The priority is changed silently and instantly, and no PRIORITY - * frame will be sent to notify the peer of this change. This - * function may be useful for server to change the priority of pushed - * stream. - * - * If |session| is initialized as server, and ``pri_spec->stream_id`` - * points to the idle stream, the idle stream is created if it does - * not exist. The created idle stream will depend on root stream - * (stream 0) with weight 16. - * - * Otherwise, if stream denoted by ``pri_spec->stream_id`` is not - * found, we use default priority instead of given |pri_spec|. That - * is make stream depend on root stream with weight 16. - * - * If - * :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` - * of value of 1 is submitted via `nghttp2_submit_settings()`, this - * function does nothing and returns 0. + * .. warning:: * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. * - * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` - * Out of memory. - * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` - * Attempted to depend on itself; or no stream exist for the given - * |stream_id|; or |stream_id| is 0 + * This function is noop. It always returns 0. */ NGHTTP2_EXTERN int nghttp2_session_change_stream_priority(nghttp2_session *session, @@ -3670,48 +4184,13 @@ nghttp2_session_change_stream_priority(nghttp2_session *session, /** * @function * - * Creates idle stream with the given |stream_id|, and priority - * |pri_spec|. - * - * The stream creation is done without sending PRIORITY frame, which - * means that peer does not know about the existence of this idle - * stream in the local endpoint. - * - * RFC 7540 does not disallow the use of creation of idle stream with - * odd or even stream ID regardless of client or server. So this - * function can create odd or even stream ID regardless of client or - * server. But probably it is a bit safer to use the stream ID the - * local endpoint can initiate (in other words, use odd stream ID for - * client, and even stream ID for server), to avoid potential - * collision from peer's instruction. Also we can use - * `nghttp2_session_set_next_stream_id()` to avoid to open created - * idle streams accidentally if we follow this recommendation. - * - * If |session| is initialized as server, and ``pri_spec->stream_id`` - * points to the idle stream, the idle stream is created if it does - * not exist. The created idle stream will depend on root stream - * (stream 0) with weight 16. - * - * Otherwise, if stream denoted by ``pri_spec->stream_id`` is not - * found, we use default priority instead of given |pri_spec|. That - * is make stream depend on root stream with weight 16. - * - * If - * :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` - * of value of 1 is submitted via `nghttp2_submit_settings()`, this - * function does nothing and returns 0. + * .. warning:: * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. * - * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` - * Out of memory. - * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` - * Attempted to depend on itself; or stream denoted by |stream_id| - * already exists; or |stream_id| cannot be used to create idle - * stream (in other words, local endpoint has already opened - * stream ID greater than or equal to the given stream ID; or - * |stream_id| is 0 + * This function is noop. It always returns 0. */ NGHTTP2_EXTERN int nghttp2_session_create_idle_stream(nghttp2_session *session, int32_t stream_id, @@ -3720,10 +4199,6 @@ nghttp2_session_create_idle_stream(nghttp2_session *session, int32_t stream_id, /** * @function * - * Performs post-process of HTTP Upgrade request. This function can - * be called from both client and server, but the behavior is very - * different in each other. - * * .. warning:: * * This function is deprecated in favor of @@ -3735,6 +4210,10 @@ nghttp2_session_create_idle_stream(nghttp2_session *session, int32_t stream_id, * HEAD is used in request, the length of response body must be 0 * regardless of value included in content-length header field. * + * Performs post-process of HTTP Upgrade request. This function can + * be called from both client and server, but the behavior is very + * different in each other. + * * If called from client side, the |settings_payload| must be the * value sent in ``HTTP2-Settings`` header field and must be decoded * by base64url decoder. The |settings_payloadlen| is the length of @@ -3814,9 +4293,14 @@ NGHTTP2_EXTERN int nghttp2_session_upgrade2(nghttp2_session *session, int head_request, void *stream_user_data); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use `nghttp2_pack_settings_payload2()` instead. + * * Serializes the SETTINGS values |iv| in the |buf|. The size of the * |buf| is specified by |buflen|. The number of entries in the |iv| * array is given by |niv|. The required space in |buf| for the |niv| @@ -3836,7 +4320,33 @@ NGHTTP2_EXTERN int nghttp2_session_upgrade2(nghttp2_session *session, * The provided |buflen| size is too small to hold the output. */ NGHTTP2_EXTERN ssize_t nghttp2_pack_settings_payload( - uint8_t *buf, size_t buflen, const nghttp2_settings_entry *iv, size_t niv); + uint8_t *buf, size_t buflen, const nghttp2_settings_entry *iv, size_t niv); + +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Serializes the SETTINGS values |iv| in the |buf|. The size of the + * |buf| is specified by |buflen|. The number of entries in the |iv| + * array is given by |niv|. The required space in |buf| for the |niv| + * entries is ``6*niv`` bytes and if the given buffer is too small, an + * error is returned. This function is used mainly for creating a + * SETTINGS payload to be sent with the ``HTTP2-Settings`` header + * field in an HTTP Upgrade request. The data written in |buf| is NOT + * base64url encoded and the application is responsible for encoding. + * + * This function returns the number of bytes written in |buf|, or one + * of the following negative error codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + * The |iv| contains duplicate settings ID or invalid value. + * + * :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE` + * The provided |buflen| size is too small to hold the output. + */ +NGHTTP2_EXTERN nghttp2_ssize nghttp2_pack_settings_payload2( + uint8_t *buf, size_t buflen, const nghttp2_settings_entry *iv, size_t niv); /** * @function @@ -3859,8 +4369,14 @@ NGHTTP2_EXTERN const char *nghttp2_http2_strerror(uint32_t error_code); /** * @function * - * Initializes |pri_spec| with the |stream_id| of the stream to depend - * on with |weight| and its exclusive flag. If |exclusive| is + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * + * Initializes |pri_spec| with the |stream_id| of the stream to depend + * on with |weight| and its exclusive flag. If |exclusive| is * nonzero, exclusive flag is set. * * The |weight| must be in [:macro:`NGHTTP2_MIN_WEIGHT`, @@ -3873,6 +4389,12 @@ NGHTTP2_EXTERN void nghttp2_priority_spec_init(nghttp2_priority_spec *pri_spec, /** * @function * + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * * Initializes |pri_spec| with the default values. The default values * are: stream_id = 0, weight = :macro:`NGHTTP2_DEFAULT_WEIGHT` and * exclusive = 0. @@ -3883,33 +4405,28 @@ nghttp2_priority_spec_default_init(nghttp2_priority_spec *pri_spec); /** * @function * + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * * Returns nonzero if the |pri_spec| is filled with default values. */ NGHTTP2_EXTERN int nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * - * Submits HEADERS frame and optionally one or more DATA frames. + * .. warning:: * - * The |pri_spec| is priority specification of this request. ``NULL`` - * means the default priority (see - * `nghttp2_priority_spec_default_init()`). To specify the priority, - * use `nghttp2_priority_spec_init()`. If |pri_spec| is not ``NULL``, - * this function will copy its data members. + * Deprecated. Use `nghttp2_submit_request2()` instead. * - * The ``pri_spec->weight`` must be in [:macro:`NGHTTP2_MIN_WEIGHT`, - * :macro:`NGHTTP2_MAX_WEIGHT`], inclusive. If ``pri_spec->weight`` - * is strictly less than :macro:`NGHTTP2_MIN_WEIGHT`, it becomes - * :macro:`NGHTTP2_MIN_WEIGHT`. If it is strictly greater than - * :macro:`NGHTTP2_MAX_WEIGHT`, it becomes - * :macro:`NGHTTP2_MAX_WEIGHT`. + * Submits HEADERS frame and optionally one or more DATA frames. * - * If - * :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` - * of value of 1 is received by a remote endpoint, |pri_spec| is - * ignored, and treated as if ``NULL`` is specified. + * The |pri_spec| is ignored. * * The |nva| is an array of name/value pair :type:`nghttp2_nv` with * |nvlen| elements. The application is responsible to include @@ -3952,9 +4469,6 @@ nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec); * :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE` * No stream ID is available because maximum stream ID was * reached. - * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` - * Trying to depend on itself (new stream ID equals - * ``pri_spec->stream_id``). * :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` * The |session| is server session. * @@ -3971,13 +4485,88 @@ nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec); * */ NGHTTP2_EXTERN int32_t nghttp2_submit_request( - nghttp2_session *session, const nghttp2_priority_spec *pri_spec, - const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider *data_prd, - void *stream_user_data); + nghttp2_session *session, const nghttp2_priority_spec *pri_spec, + const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider *data_prd, + void *stream_user_data); + +#endif /* NGHTTP2_NO_SSIZE_T */ /** * @function * + * Submits HEADERS frame and optionally one or more DATA frames. + * + * The |pri_spec| is ignored. + * + * The |nva| is an array of name/value pair :type:`nghttp2_nv` with + * |nvlen| elements. The application is responsible to include + * required pseudo-header fields (header field whose name starts with + * ":") in |nva| and must place pseudo-headers before regular header + * fields. + * + * This function creates copies of all name/value pairs in |nva|. It + * also lower-cases all names in |nva|. The order of elements in + * |nva| is preserved. For header fields with + * :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME` and + * :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, + * header field name and value are not copied respectively. With + * :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`, application + * is responsible to pass header field name in lowercase. The + * application should maintain the references to them until + * :type:`nghttp2_on_frame_send_callback` or + * :type:`nghttp2_on_frame_not_send_callback` is called. + * + * HTTP/2 specification has requirement about header fields in the + * request HEADERS. See the specification for more details. + * + * If |data_prd| is not ``NULL``, it provides data which will be sent + * in subsequent DATA frames. In this case, a method that allows + * request message bodies + * (https://tools.ietf.org/html/rfc7231#section-4) must be specified + * with ``:method`` key in |nva| (e.g. ``POST``). This function does + * not take ownership of the |data_prd|. The function copies the + * members of the |data_prd|. If |data_prd| is ``NULL``, HEADERS have + * END_STREAM set. The |stream_user_data| is data associated to the + * stream opened by this request and can be an arbitrary pointer, + * which can be retrieved later by + * `nghttp2_session_get_stream_user_data()`. + * + * This function returns assigned stream ID if it succeeds, or one of + * the following negative error codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE` + * No stream ID is available because maximum stream ID was + * reached. + * :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + * The |session| is server session. + * + * .. warning:: + * + * This function returns assigned stream ID if it succeeds. But + * that stream is not created yet. The application must not submit + * frame to that stream ID before + * :type:`nghttp2_before_frame_send_callback` is called for this + * frame. This means `nghttp2_session_get_stream_user_data()` does + * not work before the callback. But + * `nghttp2_session_set_stream_user_data()` handles this situation + * specially, and it can set data to a stream during this period. + * + */ +NGHTTP2_EXTERN int32_t nghttp2_submit_request2( + nghttp2_session *session, const nghttp2_priority_spec *pri_spec, + const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider2 *data_prd, + void *stream_user_data); + +#ifndef NGHTTP2_NO_SSIZE_T +/** + * @function + * + * .. warning:: + * + * Deprecated. Use `nghttp2_submit_response2()` instead. + * * Submits response HEADERS frame and optionally one or more DATA * frames against the stream |stream_id|. * @@ -4044,6 +4633,77 @@ nghttp2_submit_response(nghttp2_session *session, int32_t stream_id, const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider *data_prd); +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Submits response HEADERS frame and optionally one or more DATA + * frames against the stream |stream_id|. + * + * The |nva| is an array of name/value pair :type:`nghttp2_nv` with + * |nvlen| elements. The application is responsible to include + * required pseudo-header fields (header field whose name starts with + * ":") in |nva| and must place pseudo-headers before regular header + * fields. + * + * This function creates copies of all name/value pairs in |nva|. It + * also lower-cases all names in |nva|. The order of elements in + * |nva| is preserved. For header fields with + * :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME` and + * :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_VALUE` are set, + * header field name and value are not copied respectively. With + * :enum:`nghttp2_nv_flag.NGHTTP2_NV_FLAG_NO_COPY_NAME`, application + * is responsible to pass header field name in lowercase. The + * application should maintain the references to them until + * :type:`nghttp2_on_frame_send_callback` or + * :type:`nghttp2_on_frame_not_send_callback` is called. + * + * HTTP/2 specification has requirement about header fields in the + * response HEADERS. See the specification for more details. + * + * If |data_prd| is not ``NULL``, it provides data which will be sent + * in subsequent DATA frames. This function does not take ownership + * of the |data_prd|. The function copies the members of the + * |data_prd|. If |data_prd| is ``NULL``, HEADERS will have + * END_STREAM flag set. + * + * This method can be used as normal HTTP response and push response. + * When pushing a resource using this function, the |session| must be + * configured using `nghttp2_session_server_new()` or its variants and + * the target stream denoted by the |stream_id| must be reserved using + * `nghttp2_submit_push_promise()`. + * + * To send non-final response headers (e.g., HTTP status 101), don't + * use this function because this function half-closes the outbound + * stream. Instead, use `nghttp2_submit_headers()` for this purpose. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + * The |stream_id| is 0. + * :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` + * DATA or HEADERS has been already submitted and not fully + * processed yet. Normally, this does not happen, but when + * application wrongly calls `nghttp2_submit_response2()` twice, + * this may happen. + * :enum:`nghttp2_error.NGHTTP2_ERR_PROTO` + * The |session| is client session. + * + * .. warning:: + * + * Calling this function twice for the same stream ID may lead to + * program crash. It is generally considered to a programming error + * to commit response twice. + */ +NGHTTP2_EXTERN int +nghttp2_submit_response2(nghttp2_session *session, int32_t stream_id, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider2 *data_prd); + /** * @function * @@ -4069,22 +4729,23 @@ nghttp2_submit_response(nghttp2_session *session, int32_t stream_id, * DATA without END_STREAM flat set. The library does not enforce * this requirement, and applications should do this for themselves. * If `nghttp2_submit_trailer()` is called before any response HEADERS - * submission (usually by `nghttp2_submit_response()`), the content of - * |nva| will be sent as response headers, which will result in error. + * submission (usually by `nghttp2_submit_response2()`), the content + * of |nva| will be sent as response headers, which will result in + * error. * * This function has the same effect with `nghttp2_submit_headers()`, * with flags = :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM` and both * pri_spec and stream_user_data to NULL. * - * To submit trailer fields after `nghttp2_submit_response()` is + * To submit trailer fields after `nghttp2_submit_response2()` is * called, the application has to specify - * :type:`nghttp2_data_provider` to `nghttp2_submit_response()`. - * Inside of :type:`nghttp2_data_source_read_callback`, when setting + * :type:`nghttp2_data_provider2` to `nghttp2_submit_response2()`. + * Inside of :type:`nghttp2_data_source_read_callback2`, when setting * :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_EOF`, also set * :enum:`nghttp2_data_flag.NGHTTP2_DATA_FLAG_NO_END_STREAM`. After * that, the application can send trailer fields using * `nghttp2_submit_trailer()`. `nghttp2_submit_trailer()` can be used - * inside :type:`nghttp2_data_source_read_callback`. + * inside :type:`nghttp2_data_source_read_callback2`. * * This function returns 0 if it succeeds and |stream_id| is -1. * Otherwise, this function returns 0 if it succeeds, or one of the @@ -4119,22 +4780,7 @@ NGHTTP2_EXTERN int nghttp2_submit_trailer(nghttp2_session *session, * assigned stream ID will be returned. Otherwise, specify stream ID * in |stream_id|. * - * The |pri_spec| is priority specification of this request. ``NULL`` - * means the default priority (see - * `nghttp2_priority_spec_default_init()`). To specify the priority, - * use `nghttp2_priority_spec_init()`. If |pri_spec| is not ``NULL``, - * this function will copy its data members. - * - * The ``pri_spec->weight`` must be in [:macro:`NGHTTP2_MIN_WEIGHT`, - * :macro:`NGHTTP2_MAX_WEIGHT`], inclusive. If ``pri_spec->weight`` - * is strictly less than :macro:`NGHTTP2_MIN_WEIGHT`, it becomes - * :macro:`NGHTTP2_MIN_WEIGHT`. If it is strictly greater than - * :macro:`NGHTTP2_MAX_WEIGHT`, it becomes :macro:`NGHTTP2_MAX_WEIGHT`. - * - * If - * :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` - * of value of 1 is received by a remote endpoint, |pri_spec| is - * ignored, and treated as if ``NULL`` is specified. + * The |pri_spec| is ignored. * * The |nva| is an array of name/value pair :type:`nghttp2_nv` with * |nvlen| elements. The application is responsible to include @@ -4161,8 +4807,8 @@ NGHTTP2_EXTERN int nghttp2_submit_trailer(nghttp2_session *session, * * This function is low-level in a sense that the application code can * specify flags directly. For usual HTTP request, - * `nghttp2_submit_request()` is useful. Likewise, for HTTP response, - * prefer `nghttp2_submit_response()`. + * `nghttp2_submit_request2()` is useful. Likewise, for HTTP + * response, prefer `nghttp2_submit_response2()`. * * This function returns newly assigned stream ID if it succeeds and * |stream_id| is -1. Otherwise, this function returns 0 if it @@ -4174,8 +4820,7 @@ NGHTTP2_EXTERN int nghttp2_submit_trailer(nghttp2_session *session, * No stream ID is available because maximum stream ID was * reached. * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` - * The |stream_id| is 0; or trying to depend on itself (stream ID - * equals ``pri_spec->stream_id``). + * The |stream_id| is 0. * :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` * DATA or HEADERS has been already submitted and not fully * processed yet. This happens if stream denoted by |stream_id| @@ -4193,13 +4838,18 @@ NGHTTP2_EXTERN int nghttp2_submit_trailer(nghttp2_session *session, * */ NGHTTP2_EXTERN int32_t nghttp2_submit_headers( - nghttp2_session *session, uint8_t flags, int32_t stream_id, - const nghttp2_priority_spec *pri_spec, const nghttp2_nv *nva, size_t nvlen, - void *stream_user_data); + nghttp2_session *session, uint8_t flags, int32_t stream_id, + const nghttp2_priority_spec *pri_spec, const nghttp2_nv *nva, size_t nvlen, + void *stream_user_data); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use `nghttp2_submit_data2()` instead. + * * Submits one or more DATA frames to the stream |stream_id|. The * data to be sent are provided by |data_prd|. If |flags| contains * :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM`, the last DATA frame @@ -4242,40 +4892,63 @@ NGHTTP2_EXTERN int nghttp2_submit_data(nghttp2_session *session, uint8_t flags, int32_t stream_id, const nghttp2_data_provider *data_prd); +#endif /* NGHTTP2_NO_SSIZE_T */ + /** * @function * - * Submits PRIORITY frame to change the priority of stream |stream_id| - * to the priority specification |pri_spec|. - * - * The |flags| is currently ignored and should be - * :enum:`nghttp2_flag.NGHTTP2_FLAG_NONE`. - * - * The |pri_spec| is priority specification of this request. ``NULL`` - * is not allowed for this function. To specify the priority, use - * `nghttp2_priority_spec_init()`. This function will copy its data - * members. - * - * The ``pri_spec->weight`` must be in [:macro:`NGHTTP2_MIN_WEIGHT`, - * :macro:`NGHTTP2_MAX_WEIGHT`], inclusive. If ``pri_spec->weight`` - * is strictly less than :macro:`NGHTTP2_MIN_WEIGHT`, it becomes - * :macro:`NGHTTP2_MIN_WEIGHT`. If it is strictly greater than - * :macro:`NGHTTP2_MAX_WEIGHT`, it becomes - * :macro:`NGHTTP2_MAX_WEIGHT`. + * Submits one or more DATA frames to the stream |stream_id|. The + * data to be sent are provided by |data_prd|. If |flags| contains + * :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM`, the last DATA frame + * has END_STREAM flag set. * - * If - * :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` - * of value of 1 is received by a remote endpoint, this function does - * nothing and returns 0. + * This function does not take ownership of the |data_prd|. The + * function copies the members of the |data_prd|. * * This function returns 0 if it succeeds, or one of the following * negative error codes: * * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` * Out of memory. + * :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` + * DATA or HEADERS has been already submitted and not fully + * processed yet. * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` - * The |stream_id| is 0; or the |pri_spec| is NULL; or trying to - * depend on itself. + * The |stream_id| is 0. + * :enum:`nghttp2_error.NGHTTP2_ERR_STREAM_CLOSED` + * The stream was already closed; or the |stream_id| is invalid. + * + * .. note:: + * + * Currently, only one DATA or HEADERS is allowed for a stream at a + * time. Submitting these frames more than once before first DATA + * or HEADERS is finished results in + * :enum:`nghttp2_error.NGHTTP2_ERR_DATA_EXIST` error code. The + * earliest callback which tells that previous frame is done is + * :type:`nghttp2_on_frame_send_callback`. In side that callback, + * new data can be submitted using `nghttp2_submit_data2()`. Of + * course, all data except for last one must not have + * :enum:`nghttp2_flag.NGHTTP2_FLAG_END_STREAM` flag set in |flags|. + * This sounds a bit complicated, and we recommend to use + * `nghttp2_submit_request2()` and `nghttp2_submit_response2()` to + * avoid this cascading issue. The experience shows that for HTTP + * use, these two functions are enough to implement both client and + * server. + */ +NGHTTP2_EXTERN int nghttp2_submit_data2(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_data_provider2 *data_prd); + +/** + * @function + * + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * + * This function is noop. It always returns 0. */ NGHTTP2_EXTERN int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags, @@ -4434,7 +5107,7 @@ NGHTTP2_EXTERN int nghttp2_submit_settings(nghttp2_session *session, * The client side is not allowed to use this function. * * To submit response headers and data, use - * `nghttp2_submit_response()`. + * `nghttp2_submit_response2()`. * * This function returns assigned promised stream ID if it succeeds, * or one of the following negative error codes: @@ -4467,8 +5140,8 @@ NGHTTP2_EXTERN int nghttp2_submit_settings(nghttp2_session *session, * */ NGHTTP2_EXTERN int32_t nghttp2_submit_push_promise( - nghttp2_session *session, uint8_t flags, int32_t stream_id, - const nghttp2_nv *nva, size_t nvlen, void *promised_stream_user_data); + nghttp2_session *session, uint8_t flags, int32_t stream_id, + const nghttp2_nv *nva, size_t nvlen, void *promised_stream_user_data); /** * @function @@ -4573,10 +5246,11 @@ nghttp2_session_get_last_proc_stream_id(nghttp2_session *session); * reasons are: session is server; stream ID has been spent; GOAWAY * has been sent or received. * - * The application can call `nghttp2_submit_request()` without - * consulting this function. In that case, `nghttp2_submit_request()` - * may return error. Or, request is failed to sent, and - * :type:`nghttp2_on_stream_close_callback` is called. + * The application can call `nghttp2_submit_request2()` without + * consulting this function. In that case, + * `nghttp2_submit_request2()` may return error. Or, request is + * failed to sent, and :type:`nghttp2_on_stream_close_callback` is + * called. */ NGHTTP2_EXTERN int nghttp2_session_check_request_allowed(nghttp2_session *session); @@ -4678,11 +5352,11 @@ nghttp2_session_set_local_window_size(nghttp2_session *session, uint8_t flags, * Application can pass arbitrary frame flags and stream ID in |flags| * and |stream_id| respectively. The |payload| is opaque pointer, and * it can be accessible though ``frame->ext.payload`` in - * :type:`nghttp2_pack_extension_callback`. The library will not own + * :type:`nghttp2_pack_extension_callback2`. The library will not own * passed |payload| pointer. * - * The application must set :type:`nghttp2_pack_extension_callback` - * using `nghttp2_session_callbacks_set_pack_extension_callback()`. + * The application must set :type:`nghttp2_pack_extension_callback2` + * using `nghttp2_session_callbacks_set_pack_extension_callback2()`. * * The application should retain the memory pointed by |payload| until * the transmission of extension frame is done (which is indicated by @@ -4690,7 +5364,7 @@ nghttp2_session_set_local_window_size(nghttp2_session *session, uint8_t flags, * (which is indicated by :type:`nghttp2_on_frame_not_send_callback`). * If application does not touch this memory region after packing it * into a wire format, application can free it inside - * :type:`nghttp2_pack_extension_callback`. + * :type:`nghttp2_pack_extension_callback2`. * * The standard HTTP/2 frame cannot be sent with this function, so * |type| must be strictly grater than 0x9. Otherwise, this function @@ -4701,7 +5375,7 @@ nghttp2_session_set_local_window_size(nghttp2_session *session, uint8_t flags, * negative error codes: * * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` - * If :type:`nghttp2_pack_extension_callback` is not set. + * If :type:`nghttp2_pack_extension_callback2` is not set. * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` * If |type| specifies standard HTTP/2 frame type. The frame * types in the rage [0x0, 0x9], both inclusive, are standard @@ -4960,8 +5634,8 @@ NGHTTP2_EXTERN int nghttp2_submit_priority_update(nghttp2_session *session, * found. */ NGHTTP2_EXTERN int nghttp2_session_change_extpri_stream_priority( - nghttp2_session *session, int32_t stream_id, const nghttp2_extpri *extpri, - int ignore_client_signal); + nghttp2_session *session, int32_t stream_id, const nghttp2_extpri *extpri, + int ignore_client_signal); /** * @function @@ -4989,7 +5663,7 @@ NGHTTP2_EXTERN int nghttp2_session_change_extpri_stream_priority( * found. */ NGHTTP2_EXTERN int nghttp2_session_get_extpri_stream_priority( - nghttp2_session *session, nghttp2_extpri *extpri, int32_t stream_id); + nghttp2_session *session, nghttp2_extpri *extpri, int32_t stream_id); /** * @function @@ -5027,11 +5701,14 @@ NGHTTP2_EXTERN int nghttp2_nv_compare_name(const nghttp2_nv *lhs, /** * @function * - * A helper function for dealing with NPN in client side or ALPN in - * server side. The |in| contains peer's protocol list in preferable - * order. The format of |in| is length-prefixed and not - * null-terminated. For example, ``h2`` and - * ``http/1.1`` stored in |in| like this:: + * .. warning:: + * + * Deprecated. Use `nghttp2_select_alpn` instead. + * + * A helper function for dealing with ALPN in server side. The |in| + * contains peer's protocol list in preferable order. The format of + * |in| is length-prefixed and not null-terminated. For example, + * ``h2`` and ``http/1.1`` stored in |in| like this:: * * in[0] = 2 * in[1..2] = "h2" @@ -5056,20 +5733,18 @@ NGHTTP2_EXTERN int nghttp2_nv_compare_name(const nghttp2_nv *lhs, * * For ALPN, refer to https://tools.ietf.org/html/rfc7301 * - * See http://technotes.googlecode.com/git/nextprotoneg.html for more - * details about NPN. - * - * For NPN, to use this method you should do something like:: + * To use this method you should do something like:: * - * static int select_next_proto_cb(SSL* ssl, - * unsigned char **out, + * static int alpn_select_proto_cb(SSL* ssl, + * const unsigned char **out, * unsigned char *outlen, * const unsigned char *in, * unsigned int inlen, * void *arg) * { * int rv; - * rv = nghttp2_select_next_protocol(out, outlen, in, inlen); + * rv = nghttp2_select_next_protocol((unsigned char**)out, outlen, + * in, inlen); * if (rv == -1) { * return SSL_TLSEXT_ERR_NOACK; * } @@ -5079,7 +5754,7 @@ NGHTTP2_EXTERN int nghttp2_nv_compare_name(const nghttp2_nv *lhs, * return SSL_TLSEXT_ERR_OK; * } * ... - * SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, my_obj); + * SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, my_obj); * */ NGHTTP2_EXTERN int nghttp2_select_next_protocol(unsigned char **out, @@ -5087,6 +5762,65 @@ NGHTTP2_EXTERN int nghttp2_select_next_protocol(unsigned char **out, const unsigned char *in, unsigned int inlen); +/** + * @function + * + * A helper function for dealing with ALPN in server side. The |in| + * contains peer's protocol list in preferable order. The format of + * |in| is length-prefixed and not null-terminated. For example, + * ``h2`` and ``http/1.1`` stored in |in| like this:: + * + * in[0] = 2 + * in[1..2] = "h2" + * in[3] = 8 + * in[4..11] = "http/1.1" + * inlen = 12 + * + * The selection algorithm is as follows: + * + * 1. If peer's list contains HTTP/2 protocol the library supports, + * it is selected and returns 1. The following step is not taken. + * + * 2. If peer's list contains ``http/1.1``, this function selects + * ``http/1.1`` and returns 0. The following step is not taken. + * + * 3. This function selects nothing and returns -1 (So called + * non-overlap case). In this case, |out| and |outlen| are left + * untouched. + * + * Selecting ``h2`` means that ``h2`` is written into |*out| and its + * length (which is 2) is assigned to |*outlen|. + * + * For ALPN, refer to https://tools.ietf.org/html/rfc7301 + * + * To use this method you should do something like:: + * + * static int alpn_select_proto_cb(SSL* ssl, + * const unsigned char **out, + * unsigned char *outlen, + * const unsigned char *in, + * unsigned int inlen, + * void *arg) + * { + * int rv; + * rv = nghttp2_select_alpn(out, outlen, in, inlen); + * if (rv == -1) { + * return SSL_TLSEXT_ERR_NOACK; + * } + * if (rv == 1) { + * ((MyType*)arg)->http2_selected = 1; + * } + * return SSL_TLSEXT_ERR_OK; + * } + * ... + * SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, my_obj); + * + */ +NGHTTP2_EXTERN int nghttp2_select_alpn(const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen); + /** * @function * @@ -5171,6 +5905,12 @@ NGHTTP2_EXTERN int nghttp2_check_path(const uint8_t *value, size_t len); * :authority or host header field is valid according to * https://tools.ietf.org/html/rfc3986#section-3.2 * + * Note that :authority and host field values are not authority. They + * do not include userinfo in RFC 3986, see + * https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2, that + * is, it does not include '@'. This function treats '@' as a valid + * character. + * * |value| is valid if it merely consists of the allowed characters. * In particular, it does not check whether |value| follows the syntax * of authority. @@ -5262,9 +6002,14 @@ NGHTTP2_EXTERN int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, size_t settings_max_dynamic_table_size); +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use `nghttp2_hd_deflate_hd2()` instead. + * * Deflates the |nva|, which has the |nvlen| name/value pairs, into * the |buf| of length |buflen|. * @@ -5294,10 +6039,48 @@ NGHTTP2_EXTERN ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, const nghttp2_nv *nva, size_t nvlen); +#endif /* NGHTTP2_NO_SSIZE_T */ + /** * @function * * Deflates the |nva|, which has the |nvlen| name/value pairs, into + * the |buf| of length |buflen|. + * + * If |buf| is not large enough to store the deflated header block, + * this function fails with + * :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE`. The caller + * should use `nghttp2_hd_deflate_bound()` to know the upper bound of + * buffer size required to deflate given header name/value pairs. + * + * Once this function fails, subsequent call of this function always + * returns :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP`. + * + * After this function returns, it is safe to delete the |nva|. + * + * This function returns the number of bytes written to |buf| if it + * succeeds, or one of the following negative error codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + * Deflation process has failed. + * :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE` + * The provided |buflen| size is too small to hold the output. + */ +NGHTTP2_EXTERN nghttp2_ssize +nghttp2_hd_deflate_hd2(nghttp2_hd_deflater *deflater, uint8_t *buf, + size_t buflen, const nghttp2_nv *nva, size_t nvlen); + +#ifndef NGHTTP2_NO_SSIZE_T +/** + * @function + * + * .. warning:: + * + * Deprecated. Use `nghttp2_hd_deflate_hd_vec2()` instead. + * + * Deflates the |nva|, which has the |nvlen| name/value pairs, into * the |veclen| size of buf vector |vec|. The each size of buffer * must be set in len field of :type:`nghttp2_vec`. If and only if * one chunk is filled up completely, next chunk will be used. If @@ -5328,6 +6111,40 @@ NGHTTP2_EXTERN ssize_t nghttp2_hd_deflate_hd_vec(nghttp2_hd_deflater *deflater, const nghttp2_nv *nva, size_t nvlen); +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Deflates the |nva|, which has the |nvlen| name/value pairs, into + * the |veclen| size of buf vector |vec|. The each size of buffer + * must be set in len field of :type:`nghttp2_vec`. If and only if + * one chunk is filled up completely, next chunk will be used. If + * |vec| is not large enough to store the deflated header block, this + * function fails with + * :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE`. The caller + * should use `nghttp2_hd_deflate_bound()` to know the upper bound of + * buffer size required to deflate given header name/value pairs. + * + * Once this function fails, subsequent call of this function always + * returns :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP`. + * + * After this function returns, it is safe to delete the |nva|. + * + * This function returns the number of bytes written to |vec| if it + * succeeds, or one of the following negative error codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + * Deflation process has failed. + * :enum:`nghttp2_error.NGHTTP2_ERR_INSUFF_BUFSIZE` + * The provided |buflen| size is too small to hold the output. + */ +NGHTTP2_EXTERN nghttp2_ssize nghttp2_hd_deflate_hd_vec2( + nghttp2_hd_deflater *deflater, const nghttp2_vec *vec, size_t veclen, + const nghttp2_nv *nva, size_t nvlen); + /** * @function * @@ -5441,7 +6258,7 @@ NGHTTP2_EXTERN void nghttp2_hd_inflate_del(nghttp2_hd_inflater *inflater); * This function must not be called while header block is being * inflated. In other words, this function must be called after * initialization of |inflater|, but before calling - * `nghttp2_hd_inflate_hd2()`, or after + * `nghttp2_hd_inflate_hd3()`, or after * `nghttp2_hd_inflate_end_headers()`. Otherwise, * `NGHTTP2_ERR_INVALID_STATE` was returned. * @@ -5479,6 +6296,7 @@ typedef enum { NGHTTP2_HD_INFLATE_EMIT = 0x02 } nghttp2_hd_inflate_flag; +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * @@ -5566,9 +6384,16 @@ NGHTTP2_EXTERN ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater, int *inflate_flags, uint8_t *in, size_t inlen, int in_final); +#endif /* NGHTTP2_NO_SSIZE_T */ + +#ifndef NGHTTP2_NO_SSIZE_T /** * @function * + * .. warning:: + * + * Deprecated. Use `nghttp2_hd_inflate_hd3()` instead. + * * Inflates name/value block stored in |in| with length |inlen|. This * function performs decompression. For each successful emission of * header name/value pair, @@ -5655,6 +6480,95 @@ NGHTTP2_EXTERN ssize_t nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater, const uint8_t *in, size_t inlen, int in_final); +#endif /* NGHTTP2_NO_SSIZE_T */ + +/** + * @function + * + * Inflates name/value block stored in |in| with length |inlen|. This + * function performs decompression. For each successful emission of + * header name/value pair, + * :enum:`nghttp2_hd_inflate_flag.NGHTTP2_HD_INFLATE_EMIT` is set in + * |*inflate_flags| and name/value pair is assigned to the |nv_out| + * and the function returns. The caller must not free the members of + * |nv_out|. + * + * The |nv_out| may include pointers to the memory region in the |in|. + * The caller must retain the |in| while the |nv_out| is used. + * + * The application should call this function repeatedly until the + * ``(*inflate_flags) & NGHTTP2_HD_INFLATE_FINAL`` is nonzero and + * return value is non-negative. If that happens, all given input + * data (|inlen| bytes) are processed successfully. Then the + * application must call `nghttp2_hd_inflate_end_headers()` to prepare + * for the next header block input. + * + * In other words, if |in_final| is nonzero, and this function returns + * |inlen|, you can assert that + * :enum:`nghttp2_hd_inflate_final.NGHTTP2_HD_INFLATE_FINAL` is set in + * |*inflate_flags|. + * + * The caller can feed complete compressed header block. It also can + * feed it in several chunks. The caller must set |in_final| to + * nonzero if the given input is the last block of the compressed + * header. + * + * This function returns the number of bytes processed if it succeeds, + * or one of the following negative error codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_NOMEM` + * Out of memory. + * :enum:`nghttp2_error.NGHTTP2_ERR_HEADER_COMP` + * Inflation process has failed. + * :enum:`nghttp2_error.NGHTTP2_ERR_BUFFER_ERROR` + * The header field name or value is too large. + * + * Example follows:: + * + * int inflate_header_block(nghttp2_hd_inflater *hd_inflater, + * uint8_t *in, size_t inlen, int final) + * { + * nghttp2_ssize rv; + * + * for(;;) { + * nghttp2_nv nv; + * int inflate_flags = 0; + * + * rv = nghttp2_hd_inflate_hd3(hd_inflater, &nv, &inflate_flags, + * in, inlen, final); + * + * if(rv < 0) { + * fprintf(stderr, "inflate failed with error code %td", rv); + * return -1; + * } + * + * in += rv; + * inlen -= rv; + * + * if(inflate_flags & NGHTTP2_HD_INFLATE_EMIT) { + * fwrite(nv.name, nv.namelen, 1, stderr); + * fprintf(stderr, ": "); + * fwrite(nv.value, nv.valuelen, 1, stderr); + * fprintf(stderr, "\n"); + * } + * if(inflate_flags & NGHTTP2_HD_INFLATE_FINAL) { + * nghttp2_hd_inflate_end_headers(hd_inflater); + * break; + * } + * if((inflate_flags & NGHTTP2_HD_INFLATE_EMIT) == 0 && + * inlen == 0) { + * break; + * } + * } + * + * return 0; + * } + * + */ +NGHTTP2_EXTERN nghttp2_ssize nghttp2_hd_inflate_hd3( + nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out, int *inflate_flags, + const uint8_t *in, size_t inlen, int in_final); + /** * @function * @@ -5728,8 +6642,8 @@ typedef struct nghttp2_stream nghttp2_stream; * `nghttp2_session_get_root_stream()`) if 0 is given in |stream_id|. * * Unless |stream_id| == 0, the returned pointer is valid until next - * call of `nghttp2_session_send()`, `nghttp2_session_mem_send()`, - * `nghttp2_session_recv()`, and `nghttp2_session_mem_recv()`. + * call of `nghttp2_session_send()`, `nghttp2_session_mem_send2()`, + * `nghttp2_session_recv()`, and `nghttp2_session_mem_recv2()`. */ NGHTTP2_EXTERN nghttp2_stream * nghttp2_session_find_stream(nghttp2_session *session, int32_t stream_id); @@ -5783,6 +6697,12 @@ nghttp2_stream_get_state(nghttp2_stream *stream); /** * @function * + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * * Returns root of dependency tree, which is imaginary stream with * stream ID 0. The returned pointer is valid until |session| is * freed by `nghttp2_session_del()`. @@ -5793,8 +6713,13 @@ nghttp2_session_get_root_stream(nghttp2_session *session); /** * @function * - * Returns the parent stream of |stream| in dependency tree. Returns - * NULL if there is no such stream. + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * + * This function always returns NULL. */ NGHTTP2_EXTERN nghttp2_stream * nghttp2_stream_get_parent(nghttp2_stream *stream); @@ -5804,8 +6729,13 @@ NGHTTP2_EXTERN int32_t nghttp2_stream_get_stream_id(nghttp2_stream *stream); /** * @function * - * Returns the next sibling stream of |stream| in dependency tree. - * Returns NULL if there is no such stream. + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * + * This function always returns NULL. */ NGHTTP2_EXTERN nghttp2_stream * nghttp2_stream_get_next_sibling(nghttp2_stream *stream); @@ -5813,8 +6743,13 @@ nghttp2_stream_get_next_sibling(nghttp2_stream *stream); /** * @function * - * Returns the previous sibling stream of |stream| in dependency tree. - * Returns NULL if there is no such stream. + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * + * This function always returns NULL. */ NGHTTP2_EXTERN nghttp2_stream * nghttp2_stream_get_previous_sibling(nghttp2_stream *stream); @@ -5822,8 +6757,13 @@ nghttp2_stream_get_previous_sibling(nghttp2_stream *stream); /** * @function * - * Returns the first child stream of |stream| in dependency tree. - * Returns NULL if there is no such stream. + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * + * This function always returns NULL. */ NGHTTP2_EXTERN nghttp2_stream * nghttp2_stream_get_first_child(nghttp2_stream *stream); @@ -5831,14 +6771,26 @@ nghttp2_stream_get_first_child(nghttp2_stream *stream); /** * @function * - * Returns dependency weight to the parent stream of |stream|. + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * + * This function always returns :macro:`NGHTTP2_DEFAULT_WEIGHT`. */ NGHTTP2_EXTERN int32_t nghttp2_stream_get_weight(nghttp2_stream *stream); /** * @function * - * Returns the sum of the weight for |stream|'s children. + * .. warning:: + * + * Deprecated. :rfc:`7540` priorities are deprecated by + * :rfc:`9113`. Consider migrating to :rfc:`9218` extensible + * prioritization scheme. + * + * This function always returns 0. */ NGHTTP2_EXTERN int32_t nghttp2_stream_get_sum_dependency_weight(nghttp2_stream *stream); @@ -5877,7 +6829,7 @@ typedef void (*nghttp2_debug_vprintf_callback)(const char *format, * this is important. */ NGHTTP2_EXTERN void nghttp2_set_debug_vprintf_callback( - nghttp2_debug_vprintf_callback debug_vprintf_callback); + nghttp2_debug_vprintf_callback debug_vprintf_callback); #ifdef __cplusplus } diff --git a/lib/nghttp2-1.65.0/lib/includes/nghttp2/nghttp2ver.h b/lib/nghttp2-1.65.0/lib/includes/nghttp2/nghttp2ver.h new file mode 100644 index 00000000000..1302eb57bc5 --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/includes/nghttp2/nghttp2ver.h @@ -0,0 +1,42 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2VER_H +#define NGHTTP2VER_H + +/** + * @macro + * Version number of the nghttp2 library release + */ +#define NGHTTP2_VERSION "1.65.0" + +/** + * @macro + * Numerical representation of the version number of the nghttp2 library + * release. This is a 24 bit number with 8 bits for major number, 8 bits + * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. + */ +#define NGHTTP2_VERSION_NUM 0x014100 + +#endif /* NGHTTP2VER_H */ diff --git a/lib/nghttp2/lib/includes/nghttp2/nghttp2ver.h.in b/lib/nghttp2-1.65.0/lib/includes/nghttp2/nghttp2ver.h.in similarity index 100% rename from lib/nghttp2/lib/includes/nghttp2/nghttp2ver.h.in rename to lib/nghttp2-1.65.0/lib/includes/nghttp2/nghttp2ver.h.in diff --git a/lib/nghttp2/lib/libnghttp2.pc.in b/lib/nghttp2-1.65.0/lib/libnghttp2.pc.in similarity index 100% rename from lib/nghttp2/lib/libnghttp2.pc.in rename to lib/nghttp2-1.65.0/lib/libnghttp2.pc.in diff --git a/lib/nghttp2/lib/nghttp2_npn.c b/lib/nghttp2-1.65.0/lib/nghttp2_alpn.c similarity index 65% rename from lib/nghttp2/lib/nghttp2_npn.c rename to lib/nghttp2-1.65.0/lib/nghttp2_alpn.c index d1384c80758..33c5885f8d8 100644 --- a/lib/nghttp2/lib/nghttp2_npn.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_alpn.c @@ -22,13 +22,13 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "nghttp2_npn.h" +#include "nghttp2_alpn.h" #include -static int select_next_protocol(unsigned char **out, unsigned char *outlen, - const unsigned char *in, unsigned int inlen, - const char *key, unsigned int keylen) { +static int select_alpn(const unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen, + const char *key, unsigned int keylen) { unsigned int i; for (i = 0; i + keylen <= inlen; i += (unsigned int)(in[i] + 1)) { if (memcmp(&in[i], key, keylen) == 0) { @@ -45,12 +45,25 @@ static int select_next_protocol(unsigned char **out, unsigned char *outlen, int nghttp2_select_next_protocol(unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen) { - if (select_next_protocol(out, outlen, in, inlen, NGHTTP2_PROTO_ALPN, - NGHTTP2_PROTO_ALPN_LEN) == 0) { + if (select_alpn((const unsigned char **)out, outlen, in, inlen, + NGHTTP2_PROTO_ALPN, NGHTTP2_PROTO_ALPN_LEN) == 0) { return 1; } - if (select_next_protocol(out, outlen, in, inlen, NGHTTP2_HTTP_1_1_ALPN, - NGHTTP2_HTTP_1_1_ALPN_LEN) == 0) { + if (select_alpn((const unsigned char **)out, outlen, in, inlen, + NGHTTP2_HTTP_1_1_ALPN, NGHTTP2_HTTP_1_1_ALPN_LEN) == 0) { + return 0; + } + return -1; +} + +int nghttp2_select_alpn(const unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen) { + if (select_alpn(out, outlen, in, inlen, NGHTTP2_PROTO_ALPN, + NGHTTP2_PROTO_ALPN_LEN) == 0) { + return 1; + } + if (select_alpn(out, outlen, in, inlen, NGHTTP2_HTTP_1_1_ALPN, + NGHTTP2_HTTP_1_1_ALPN_LEN) == 0) { return 0; } return -1; diff --git a/lib/nghttp2/lib/nghttp2_npn.h b/lib/nghttp2-1.65.0/lib/nghttp2_alpn.h similarity index 94% rename from lib/nghttp2/lib/nghttp2_npn.h rename to lib/nghttp2-1.65.0/lib/nghttp2_alpn.h index c6f1c04b683..09810fd8214 100644 --- a/lib/nghttp2/lib/nghttp2_npn.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_alpn.h @@ -22,8 +22,8 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef NGHTTP2_NPN_H -#define NGHTTP2_NPN_H +#ifndef NGHTTP2_ALPN_H +#define NGHTTP2_ALPN_H #ifdef HAVE_CONFIG_H # include @@ -31,4 +31,4 @@ #include -#endif /* NGHTTP2_NPN_H */ +#endif /* NGHTTP2_ALPN_H */ diff --git a/lib/nghttp2/lib/nghttp2_buf.c b/lib/nghttp2-1.65.0/lib/nghttp2_buf.c similarity index 98% rename from lib/nghttp2/lib/nghttp2_buf.c rename to lib/nghttp2-1.65.0/lib/nghttp2_buf.c index a32844712e4..15cd674a650 100644 --- a/lib/nghttp2/lib/nghttp2_buf.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_buf.c @@ -61,7 +61,7 @@ int nghttp2_buf_reserve(nghttp2_buf *buf, size_t new_cap, nghttp2_mem *mem) { return 0; } - new_cap = nghttp2_max(new_cap, cap * 2); + new_cap = nghttp2_max_size(new_cap, cap * 2); ptr = nghttp2_mem_realloc(mem, buf->begin, new_cap); if (ptr == NULL) { @@ -343,7 +343,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len) { while (len) { buf = &bufs->cur->buf; - nwrite = nghttp2_min(nghttp2_buf_avail(buf), len); + nwrite = nghttp2_min_size(nghttp2_buf_avail(buf), len); if (nwrite == 0) { rv = bufs_alloc_chain(bufs); if (rv != 0) { @@ -430,7 +430,7 @@ int nghttp2_bufs_orb_hold(nghttp2_bufs *bufs, uint8_t b) { return 0; } -ssize_t nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out) { +nghttp2_ssize nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out) { size_t len; nghttp2_buf_chain *chain; nghttp2_buf *buf; @@ -462,7 +462,7 @@ ssize_t nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out) { *out = res; - return (ssize_t)len; + return (nghttp2_ssize)len; } size_t nghttp2_bufs_remove_copy(nghttp2_bufs *bufs, uint8_t *out) { diff --git a/lib/nghttp2/lib/nghttp2_buf.h b/lib/nghttp2-1.65.0/lib/nghttp2_buf.h similarity index 99% rename from lib/nghttp2/lib/nghttp2_buf.h rename to lib/nghttp2-1.65.0/lib/nghttp2_buf.h index 45f62f16e27..95ff3706a23 100644 --- a/lib/nghttp2/lib/nghttp2_buf.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_buf.h @@ -349,7 +349,7 @@ int nghttp2_bufs_orb_hold(nghttp2_bufs *bufs, uint8_t b); * NGHTTP2_ERR_NOMEM * Out of memory */ -ssize_t nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out); +nghttp2_ssize nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out); /* * Copies all data stored in |bufs| to |out|. This function assumes diff --git a/lib/nghttp2/lib/nghttp2_callbacks.c b/lib/nghttp2-1.65.0/lib/nghttp2_callbacks.c similarity index 57% rename from lib/nghttp2/lib/nghttp2_callbacks.c rename to lib/nghttp2-1.65.0/lib/nghttp2_callbacks.c index 3c38214859b..32fedd52d85 100644 --- a/lib/nghttp2/lib/nghttp2_callbacks.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_callbacks.c @@ -41,135 +41,163 @@ void nghttp2_session_callbacks_del(nghttp2_session_callbacks *callbacks) { } void nghttp2_session_callbacks_set_send_callback( - nghttp2_session_callbacks *cbs, nghttp2_send_callback send_callback) { + nghttp2_session_callbacks *cbs, nghttp2_send_callback send_callback) { cbs->send_callback = send_callback; } +void nghttp2_session_callbacks_set_send_callback2( + nghttp2_session_callbacks *cbs, nghttp2_send_callback2 send_callback) { + cbs->send_callback2 = send_callback; +} + void nghttp2_session_callbacks_set_recv_callback( - nghttp2_session_callbacks *cbs, nghttp2_recv_callback recv_callback) { + nghttp2_session_callbacks *cbs, nghttp2_recv_callback recv_callback) { cbs->recv_callback = recv_callback; } +void nghttp2_session_callbacks_set_recv_callback2( + nghttp2_session_callbacks *cbs, nghttp2_recv_callback2 recv_callback) { + cbs->recv_callback2 = recv_callback; +} + void nghttp2_session_callbacks_set_on_frame_recv_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_frame_recv_callback on_frame_recv_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_recv_callback on_frame_recv_callback) { cbs->on_frame_recv_callback = on_frame_recv_callback; } void nghttp2_session_callbacks_set_on_invalid_frame_recv_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_invalid_frame_recv_callback on_invalid_frame_recv_callback) { cbs->on_invalid_frame_recv_callback = on_invalid_frame_recv_callback; } void nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_data_chunk_recv_callback on_data_chunk_recv_callback) { cbs->on_data_chunk_recv_callback = on_data_chunk_recv_callback; } void nghttp2_session_callbacks_set_before_frame_send_callback( - nghttp2_session_callbacks *cbs, - nghttp2_before_frame_send_callback before_frame_send_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_before_frame_send_callback before_frame_send_callback) { cbs->before_frame_send_callback = before_frame_send_callback; } void nghttp2_session_callbacks_set_on_frame_send_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_frame_send_callback on_frame_send_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_send_callback on_frame_send_callback) { cbs->on_frame_send_callback = on_frame_send_callback; } void nghttp2_session_callbacks_set_on_frame_not_send_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_frame_not_send_callback on_frame_not_send_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_frame_not_send_callback on_frame_not_send_callback) { cbs->on_frame_not_send_callback = on_frame_not_send_callback; } void nghttp2_session_callbacks_set_on_stream_close_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_stream_close_callback on_stream_close_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_stream_close_callback on_stream_close_callback) { cbs->on_stream_close_callback = on_stream_close_callback; } void nghttp2_session_callbacks_set_on_begin_headers_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_begin_headers_callback on_begin_headers_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_begin_headers_callback on_begin_headers_callback) { cbs->on_begin_headers_callback = on_begin_headers_callback; } void nghttp2_session_callbacks_set_on_header_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_header_callback on_header_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_header_callback on_header_callback) { cbs->on_header_callback = on_header_callback; } void nghttp2_session_callbacks_set_on_header_callback2( - nghttp2_session_callbacks *cbs, - nghttp2_on_header_callback2 on_header_callback2) { + nghttp2_session_callbacks *cbs, + nghttp2_on_header_callback2 on_header_callback2) { cbs->on_header_callback2 = on_header_callback2; } void nghttp2_session_callbacks_set_on_invalid_header_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_invalid_header_callback on_invalid_header_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_invalid_header_callback on_invalid_header_callback) { cbs->on_invalid_header_callback = on_invalid_header_callback; } void nghttp2_session_callbacks_set_on_invalid_header_callback2( - nghttp2_session_callbacks *cbs, - nghttp2_on_invalid_header_callback2 on_invalid_header_callback2) { + nghttp2_session_callbacks *cbs, + nghttp2_on_invalid_header_callback2 on_invalid_header_callback2) { cbs->on_invalid_header_callback2 = on_invalid_header_callback2; } void nghttp2_session_callbacks_set_select_padding_callback( - nghttp2_session_callbacks *cbs, - nghttp2_select_padding_callback select_padding_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_select_padding_callback select_padding_callback) { cbs->select_padding_callback = select_padding_callback; } +void nghttp2_session_callbacks_set_select_padding_callback2( + nghttp2_session_callbacks *cbs, + nghttp2_select_padding_callback2 select_padding_callback) { + cbs->select_padding_callback2 = select_padding_callback; +} + void nghttp2_session_callbacks_set_data_source_read_length_callback( - nghttp2_session_callbacks *cbs, - nghttp2_data_source_read_length_callback data_source_read_length_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_data_source_read_length_callback data_source_read_length_callback) { cbs->read_length_callback = data_source_read_length_callback; } +void nghttp2_session_callbacks_set_data_source_read_length_callback2( + nghttp2_session_callbacks *cbs, + nghttp2_data_source_read_length_callback2 data_source_read_length_callback) { + cbs->read_length_callback2 = data_source_read_length_callback; +} + void nghttp2_session_callbacks_set_on_begin_frame_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_begin_frame_callback on_begin_frame_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_begin_frame_callback on_begin_frame_callback) { cbs->on_begin_frame_callback = on_begin_frame_callback; } void nghttp2_session_callbacks_set_send_data_callback( - nghttp2_session_callbacks *cbs, - nghttp2_send_data_callback send_data_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_send_data_callback send_data_callback) { cbs->send_data_callback = send_data_callback; } void nghttp2_session_callbacks_set_pack_extension_callback( - nghttp2_session_callbacks *cbs, - nghttp2_pack_extension_callback pack_extension_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_pack_extension_callback pack_extension_callback) { cbs->pack_extension_callback = pack_extension_callback; } +void nghttp2_session_callbacks_set_pack_extension_callback2( + nghttp2_session_callbacks *cbs, + nghttp2_pack_extension_callback2 pack_extension_callback) { + cbs->pack_extension_callback2 = pack_extension_callback; +} + void nghttp2_session_callbacks_set_unpack_extension_callback( - nghttp2_session_callbacks *cbs, - nghttp2_unpack_extension_callback unpack_extension_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_unpack_extension_callback unpack_extension_callback) { cbs->unpack_extension_callback = unpack_extension_callback; } void nghttp2_session_callbacks_set_on_extension_chunk_recv_callback( - nghttp2_session_callbacks *cbs, - nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback) { + nghttp2_session_callbacks *cbs, + nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback) { cbs->on_extension_chunk_recv_callback = on_extension_chunk_recv_callback; } void nghttp2_session_callbacks_set_error_callback( - nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback) { + nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback) { cbs->error_callback = error_callback; } void nghttp2_session_callbacks_set_error_callback2( - nghttp2_session_callbacks *cbs, nghttp2_error_callback2 error_callback2) { + nghttp2_session_callbacks *cbs, nghttp2_error_callback2 error_callback2) { cbs->error_callback2 = error_callback2; } diff --git a/lib/nghttp2/lib/nghttp2_callbacks.h b/lib/nghttp2-1.65.0/lib/nghttp2_callbacks.h similarity index 75% rename from lib/nghttp2/lib/nghttp2_callbacks.h rename to lib/nghttp2-1.65.0/lib/nghttp2_callbacks.h index 61e51fa5363..a611f485481 100644 --- a/lib/nghttp2/lib/nghttp2_callbacks.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_callbacks.h @@ -35,20 +35,34 @@ * Callback functions. */ struct nghttp2_session_callbacks { + /** + * Deprecated. Use send_callback2 instead. Callback function + * invoked when the session wants to send data to the remote peer. + * This callback is not necessary if the application uses solely + * `nghttp2_session_mem_send()` to serialize data to transmit. + */ + nghttp2_send_callback send_callback; /** * Callback function invoked when the session wants to send data to * the remote peer. This callback is not necessary if the - * application uses solely `nghttp2_session_mem_send()` to serialize - * data to transmit. + * application uses solely `nghttp2_session_mem_send2()` to + * serialize data to transmit. */ - nghttp2_send_callback send_callback; + nghttp2_send_callback2 send_callback2; + /** + * Deprecated. Use recv_callback2 instead. Callback function + * invoked when the session wants to receive data from the remote + * peer. This callback is not necessary if the application uses + * solely `nghttp2_session_mem_recv()` to process received data. + */ + nghttp2_recv_callback recv_callback; /** * Callback function invoked when the session wants to receive data * from the remote peer. This callback is not necessary if the - * application uses solely `nghttp2_session_mem_recv()` to process + * application uses solely `nghttp2_session_mem_recv2()` to process * received data. */ - nghttp2_recv_callback recv_callback; + nghttp2_recv_callback2 recv_callback2; /** * Callback function invoked by `nghttp2_session_recv()` when a * frame is received. @@ -99,23 +113,40 @@ struct nghttp2_session_callbacks { */ nghttp2_on_invalid_header_callback on_invalid_header_callback; nghttp2_on_invalid_header_callback2 on_invalid_header_callback2; + /** + * Deprecated. Use select_padding_callback2 instead. Callback + * function invoked when the library asks application how many + * padding bytes are required for the transmission of the given + * frame. + */ + nghttp2_select_padding_callback select_padding_callback; /** * Callback function invoked when the library asks application how * many padding bytes are required for the transmission of the given * frame. */ - nghttp2_select_padding_callback select_padding_callback; + nghttp2_select_padding_callback2 select_padding_callback2; /** - * The callback function used to determine the length allowed in + * Deprecated. Use read_length_callback2 instead. The callback + * function used to determine the length allowed in * `nghttp2_data_source_read_callback()` */ nghttp2_data_source_read_length_callback read_length_callback; + /** + * The callback function used to determine the length allowed in + * `nghttp2_data_source_read_callback2()` + */ + nghttp2_data_source_read_length_callback2 read_length_callback2; /** * Sets callback function invoked when a frame header is received. */ nghttp2_on_begin_frame_callback on_begin_frame_callback; nghttp2_send_data_callback send_data_callback; + /** + * Deprecated. Use pack_extension_callback2 instead. + */ nghttp2_pack_extension_callback pack_extension_callback; + nghttp2_pack_extension_callback2 pack_extension_callback2; nghttp2_unpack_extension_callback unpack_extension_callback; nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback; nghttp2_error_callback error_callback; diff --git a/lib/nghttp2/lib/nghttp2_debug.c b/lib/nghttp2-1.65.0/lib/nghttp2_debug.c similarity index 91% rename from lib/nghttp2/lib/nghttp2_debug.c rename to lib/nghttp2-1.65.0/lib/nghttp2_debug.c index cb2779700bd..09dd2b28587 100644 --- a/lib/nghttp2/lib/nghttp2_debug.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_debug.c @@ -34,7 +34,7 @@ static void nghttp2_default_debug_vfprintf_callback(const char *fmt, } static nghttp2_debug_vprintf_callback static_debug_vprintf_callback = - nghttp2_default_debug_vfprintf_callback; + nghttp2_default_debug_vfprintf_callback; void nghttp2_debug_vprintf(const char *format, ...) { if (static_debug_vprintf_callback) { @@ -46,14 +46,14 @@ void nghttp2_debug_vprintf(const char *format, ...) { } void nghttp2_set_debug_vprintf_callback( - nghttp2_debug_vprintf_callback debug_vprintf_callback) { + nghttp2_debug_vprintf_callback debug_vprintf_callback) { static_debug_vprintf_callback = debug_vprintf_callback; } #else /* !DEBUGBUILD */ void nghttp2_set_debug_vprintf_callback( - nghttp2_debug_vprintf_callback debug_vprintf_callback) { + nghttp2_debug_vprintf_callback debug_vprintf_callback) { (void)debug_vprintf_callback; } diff --git a/lib/nghttp2/lib/nghttp2_debug.h b/lib/nghttp2-1.65.0/lib/nghttp2_debug.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_debug.h rename to lib/nghttp2-1.65.0/lib/nghttp2_debug.h diff --git a/lib/nghttp2/lib/nghttp2_extpri.c b/lib/nghttp2-1.65.0/lib/nghttp2_extpri.c similarity index 100% rename from lib/nghttp2/lib/nghttp2_extpri.c rename to lib/nghttp2-1.65.0/lib/nghttp2_extpri.c diff --git a/lib/nghttp2/lib/nghttp2_extpri.h b/lib/nghttp2-1.65.0/lib/nghttp2_extpri.h similarity index 96% rename from lib/nghttp2/lib/nghttp2_extpri.h rename to lib/nghttp2-1.65.0/lib/nghttp2_extpri.h index 23c6ddc0c05..db911972084 100644 --- a/lib/nghttp2/lib/nghttp2_extpri.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_extpri.h @@ -60,6 +60,6 @@ void nghttp2_extpri_from_uint8(nghttp2_extpri *extpri, uint8_t u8extpri); * nghttp2_extpri_uint8_inc extracts inc from |PRI| which is supposed to * be constructed by nghttp2_extpri_to_uint8. */ -#define nghttp2_extpri_uint8_inc(PRI) (((PRI)&NGHTTP2_EXTPRI_INC_MASK) != 0) +#define nghttp2_extpri_uint8_inc(PRI) (((PRI) & NGHTTP2_EXTPRI_INC_MASK) != 0) #endif /* NGHTTP2_EXTPRI_H */ diff --git a/lib/nghttp2/lib/nghttp2_frame.c b/lib/nghttp2-1.65.0/lib/nghttp2_frame.c similarity index 98% rename from lib/nghttp2/lib/nghttp2_frame.c rename to lib/nghttp2-1.65.0/lib/nghttp2_frame.c index 77cb463df54..edc2aaaae9e 100644 --- a/lib/nghttp2/lib/nghttp2_frame.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_frame.c @@ -492,7 +492,7 @@ int nghttp2_frame_pack_settings(nghttp2_bufs *bufs, nghttp2_settings *frame) { nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); buf->last += - nghttp2_frame_pack_settings_payload(buf->last, frame->iv, frame->niv); + nghttp2_frame_pack_settings_payload(buf->last, frame->iv, frame->niv); return 0; } @@ -537,7 +537,7 @@ int nghttp2_frame_unpack_settings_payload2(nghttp2_settings_entry **iv_ptr, } *iv_ptr = - nghttp2_mem_malloc(mem, (*niv_ptr) * sizeof(nghttp2_settings_entry)); + nghttp2_mem_malloc(mem, (*niv_ptr) * sizeof(nghttp2_settings_entry)); if (*iv_ptr == NULL) { return NGHTTP2_ERR_NOMEM; @@ -589,7 +589,7 @@ int nghttp2_frame_pack_push_promise(nghttp2_bufs *bufs, void nghttp2_frame_unpack_push_promise_payload(nghttp2_push_promise *frame, const uint8_t *payload) { frame->promised_stream_id = - nghttp2_get_uint32(payload) & NGHTTP2_STREAM_ID_MASK; + nghttp2_get_uint32(payload) & NGHTTP2_STREAM_ID_MASK; frame->nva = NULL; frame->nvlen = 0; } @@ -608,7 +608,7 @@ void nghttp2_frame_pack_ping(nghttp2_bufs *bufs, nghttp2_ping *frame) { nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); buf->last = - nghttp2_cpymem(buf->last, frame->opaque_data, sizeof(frame->opaque_data)); + nghttp2_cpymem(buf->last, frame->opaque_data, sizeof(frame->opaque_data)); } void nghttp2_frame_unpack_ping_payload(nghttp2_ping *frame, @@ -709,7 +709,7 @@ void nghttp2_frame_pack_window_update(nghttp2_bufs *bufs, void nghttp2_frame_unpack_window_update_payload(nghttp2_window_update *frame, const uint8_t *payload) { frame->window_size_increment = - nghttp2_get_uint32(payload) & NGHTTP2_WINDOW_SIZE_INCREMENT_MASK; + nghttp2_get_uint32(payload) & NGHTTP2_WINDOW_SIZE_INCREMENT_MASK; } void nghttp2_frame_pack_altsvc(nghttp2_bufs *bufs, nghttp2_extension *frame) { @@ -926,7 +926,7 @@ void nghttp2_frame_unpack_priority_update_payload(nghttp2_extension *frame, priority_update = frame->payload; priority_update->stream_id = - nghttp2_get_uint32(payload) & NGHTTP2_STREAM_ID_MASK; + nghttp2_get_uint32(payload) & NGHTTP2_STREAM_ID_MASK; if (payloadlen > 4) { priority_update->field_value = payload + 4; diff --git a/lib/nghttp2/lib/nghttp2_frame.h b/lib/nghttp2-1.65.0/lib/nghttp2_frame.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_frame.h rename to lib/nghttp2-1.65.0/lib/nghttp2_frame.h diff --git a/lib/nghttp2/lib/nghttp2_hd.c b/lib/nghttp2-1.65.0/lib/nghttp2_hd.c similarity index 86% rename from lib/nghttp2/lib/nghttp2_hd.c rename to lib/nghttp2-1.65.0/lib/nghttp2_hd.c index 8a2bda64c1f..ad85eed1e13 100644 --- a/lib/nghttp2/lib/nghttp2_hd.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_hd.c @@ -36,9 +36,10 @@ #define MAKE_STATIC_ENT(N, V, T, H) \ { \ {NULL, NULL, (uint8_t *)(N), sizeof((N)) - 1, -1}, \ - {NULL, NULL, (uint8_t *)(V), sizeof((V)) - 1, -1}, \ - {(uint8_t *)(N), (uint8_t *)(V), sizeof((N)) - 1, sizeof((V)) - 1, 0}, \ - T, H \ + {NULL, NULL, (uint8_t *)(V), sizeof((V)) - 1, -1}, \ + {(uint8_t *)(N), (uint8_t *)(V), sizeof((N)) - 1, sizeof((V)) - 1, 0}, \ + T, \ + H, \ } /* Generated by mkstatictbl.py */ @@ -46,67 +47,67 @@ first enum value if same header names are repeated (e.g., :status). */ static const nghttp2_hd_static_entry static_table[] = { - MAKE_STATIC_ENT(":authority", "", 0, 3153725150u), - MAKE_STATIC_ENT(":method", "GET", 1, 695666056u), - MAKE_STATIC_ENT(":method", "POST", 1, 695666056u), - MAKE_STATIC_ENT(":path", "/", 3, 3292848686u), - MAKE_STATIC_ENT(":path", "/index.html", 3, 3292848686u), - MAKE_STATIC_ENT(":scheme", "http", 5, 2510477674u), - MAKE_STATIC_ENT(":scheme", "https", 5, 2510477674u), - MAKE_STATIC_ENT(":status", "200", 7, 4000288983u), - MAKE_STATIC_ENT(":status", "204", 7, 4000288983u), - MAKE_STATIC_ENT(":status", "206", 7, 4000288983u), - MAKE_STATIC_ENT(":status", "304", 7, 4000288983u), - MAKE_STATIC_ENT(":status", "400", 7, 4000288983u), - MAKE_STATIC_ENT(":status", "404", 7, 4000288983u), - MAKE_STATIC_ENT(":status", "500", 7, 4000288983u), - MAKE_STATIC_ENT("accept-charset", "", 14, 3664010344u), - MAKE_STATIC_ENT("accept-encoding", "gzip, deflate", 15, 3379649177u), - MAKE_STATIC_ENT("accept-language", "", 16, 1979086614u), - MAKE_STATIC_ENT("accept-ranges", "", 17, 1713753958u), - MAKE_STATIC_ENT("accept", "", 18, 136609321u), - MAKE_STATIC_ENT("access-control-allow-origin", "", 19, 2710797292u), - MAKE_STATIC_ENT("age", "", 20, 742476188u), - MAKE_STATIC_ENT("allow", "", 21, 2930878514u), - MAKE_STATIC_ENT("authorization", "", 22, 2436257726u), - MAKE_STATIC_ENT("cache-control", "", 23, 1355326669u), - MAKE_STATIC_ENT("content-disposition", "", 24, 3889184348u), - MAKE_STATIC_ENT("content-encoding", "", 25, 65203592u), - MAKE_STATIC_ENT("content-language", "", 26, 24973587u), - MAKE_STATIC_ENT("content-length", "", 27, 1308181789u), - MAKE_STATIC_ENT("content-location", "", 28, 2302364718u), - MAKE_STATIC_ENT("content-range", "", 29, 3555523146u), - MAKE_STATIC_ENT("content-type", "", 30, 4244048277u), - MAKE_STATIC_ENT("cookie", "", 31, 2007449791u), - MAKE_STATIC_ENT("date", "", 32, 3564297305u), - MAKE_STATIC_ENT("etag", "", 33, 113792960u), - MAKE_STATIC_ENT("expect", "", 34, 2530896728u), - MAKE_STATIC_ENT("expires", "", 35, 1049544579u), - MAKE_STATIC_ENT("from", "", 36, 2513272949u), - MAKE_STATIC_ENT("host", "", 37, 2952701295u), - MAKE_STATIC_ENT("if-match", "", 38, 3597694698u), - MAKE_STATIC_ENT("if-modified-since", "", 39, 2213050793u), - MAKE_STATIC_ENT("if-none-match", "", 40, 2536202615u), - MAKE_STATIC_ENT("if-range", "", 41, 2340978238u), - MAKE_STATIC_ENT("if-unmodified-since", "", 42, 3794814858u), - MAKE_STATIC_ENT("last-modified", "", 43, 3226950251u), - MAKE_STATIC_ENT("link", "", 44, 232457833u), - MAKE_STATIC_ENT("location", "", 45, 200649126u), - MAKE_STATIC_ENT("max-forwards", "", 46, 1826162134u), - MAKE_STATIC_ENT("proxy-authenticate", "", 47, 2709445359u), - MAKE_STATIC_ENT("proxy-authorization", "", 48, 2686392507u), - MAKE_STATIC_ENT("range", "", 49, 4208725202u), - MAKE_STATIC_ENT("referer", "", 50, 3969579366u), - MAKE_STATIC_ENT("refresh", "", 51, 3572655668u), - MAKE_STATIC_ENT("retry-after", "", 52, 3336180598u), - MAKE_STATIC_ENT("server", "", 53, 1085029842u), - MAKE_STATIC_ENT("set-cookie", "", 54, 1848371000u), - MAKE_STATIC_ENT("strict-transport-security", "", 55, 4138147361u), - MAKE_STATIC_ENT("transfer-encoding", "", 56, 3719590988u), - MAKE_STATIC_ENT("user-agent", "", 57, 606444526u), - MAKE_STATIC_ENT("vary", "", 58, 1085005381u), - MAKE_STATIC_ENT("via", "", 59, 1762798611u), - MAKE_STATIC_ENT("www-authenticate", "", 60, 779865858u), + MAKE_STATIC_ENT(":authority", "", 0, 3153725150u), + MAKE_STATIC_ENT(":method", "GET", 1, 695666056u), + MAKE_STATIC_ENT(":method", "POST", 1, 695666056u), + MAKE_STATIC_ENT(":path", "/", 3, 3292848686u), + MAKE_STATIC_ENT(":path", "/index.html", 3, 3292848686u), + MAKE_STATIC_ENT(":scheme", "http", 5, 2510477674u), + MAKE_STATIC_ENT(":scheme", "https", 5, 2510477674u), + MAKE_STATIC_ENT(":status", "200", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "204", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "206", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "304", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "400", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "404", 7, 4000288983u), + MAKE_STATIC_ENT(":status", "500", 7, 4000288983u), + MAKE_STATIC_ENT("accept-charset", "", 14, 3664010344u), + MAKE_STATIC_ENT("accept-encoding", "gzip, deflate", 15, 3379649177u), + MAKE_STATIC_ENT("accept-language", "", 16, 1979086614u), + MAKE_STATIC_ENT("accept-ranges", "", 17, 1713753958u), + MAKE_STATIC_ENT("accept", "", 18, 136609321u), + MAKE_STATIC_ENT("access-control-allow-origin", "", 19, 2710797292u), + MAKE_STATIC_ENT("age", "", 20, 742476188u), + MAKE_STATIC_ENT("allow", "", 21, 2930878514u), + MAKE_STATIC_ENT("authorization", "", 22, 2436257726u), + MAKE_STATIC_ENT("cache-control", "", 23, 1355326669u), + MAKE_STATIC_ENT("content-disposition", "", 24, 3889184348u), + MAKE_STATIC_ENT("content-encoding", "", 25, 65203592u), + MAKE_STATIC_ENT("content-language", "", 26, 24973587u), + MAKE_STATIC_ENT("content-length", "", 27, 1308181789u), + MAKE_STATIC_ENT("content-location", "", 28, 2302364718u), + MAKE_STATIC_ENT("content-range", "", 29, 3555523146u), + MAKE_STATIC_ENT("content-type", "", 30, 4244048277u), + MAKE_STATIC_ENT("cookie", "", 31, 2007449791u), + MAKE_STATIC_ENT("date", "", 32, 3564297305u), + MAKE_STATIC_ENT("etag", "", 33, 113792960u), + MAKE_STATIC_ENT("expect", "", 34, 2530896728u), + MAKE_STATIC_ENT("expires", "", 35, 1049544579u), + MAKE_STATIC_ENT("from", "", 36, 2513272949u), + MAKE_STATIC_ENT("host", "", 37, 2952701295u), + MAKE_STATIC_ENT("if-match", "", 38, 3597694698u), + MAKE_STATIC_ENT("if-modified-since", "", 39, 2213050793u), + MAKE_STATIC_ENT("if-none-match", "", 40, 2536202615u), + MAKE_STATIC_ENT("if-range", "", 41, 2340978238u), + MAKE_STATIC_ENT("if-unmodified-since", "", 42, 3794814858u), + MAKE_STATIC_ENT("last-modified", "", 43, 3226950251u), + MAKE_STATIC_ENT("link", "", 44, 232457833u), + MAKE_STATIC_ENT("location", "", 45, 200649126u), + MAKE_STATIC_ENT("max-forwards", "", 46, 1826162134u), + MAKE_STATIC_ENT("proxy-authenticate", "", 47, 2709445359u), + MAKE_STATIC_ENT("proxy-authorization", "", 48, 2686392507u), + MAKE_STATIC_ENT("range", "", 49, 4208725202u), + MAKE_STATIC_ENT("referer", "", 50, 3969579366u), + MAKE_STATIC_ENT("refresh", "", 51, 3572655668u), + MAKE_STATIC_ENT("retry-after", "", 52, 3336180598u), + MAKE_STATIC_ENT("server", "", 53, 1085029842u), + MAKE_STATIC_ENT("set-cookie", "", 54, 1848371000u), + MAKE_STATIC_ENT("strict-transport-security", "", 55, 4138147361u), + MAKE_STATIC_ENT("transfer-encoding", "", 56, 3719590988u), + MAKE_STATIC_ENT("user-agent", "", 57, 606444526u), + MAKE_STATIC_ENT("vary", "", 58, 1085005381u), + MAKE_STATIC_ENT("via", "", 59, 1762798611u), + MAKE_STATIC_ENT("www-authenticate", "", 60, 779865858u), }; static int memeq(const void *s1, const void *s2, size_t n) { @@ -593,8 +594,19 @@ static void hd_map_remove(nghttp2_hd_map *map, nghttp2_hd_entry *ent) { static int hd_ringbuf_init(nghttp2_hd_ringbuf *ringbuf, size_t bufsize, nghttp2_mem *mem) { size_t size; + const size_t max_size = SIZE_MAX / sizeof(nghttp2_hd_entry *); + + if (bufsize > max_size) { + return NGHTTP2_ERR_NOMEM; + } + for (size = 1; size < bufsize; size <<= 1) ; + + if (size > max_size) { + return NGHTTP2_ERR_NOMEM; + } + ringbuf->buffer = nghttp2_mem_malloc(mem, sizeof(nghttp2_hd_entry *) * size); if (ringbuf->buffer == NULL) { return NGHTTP2_ERR_NOMEM; @@ -677,8 +689,8 @@ static int hd_context_init(nghttp2_hd_context *context, nghttp2_mem *mem) { context->bad = 0; context->hd_table_bufsize_max = NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE; rv = hd_ringbuf_init( - &context->hd_table, - context->hd_table_bufsize_max / NGHTTP2_HD_ENTRY_OVERHEAD, mem); + &context->hd_table, + context->hd_table_bufsize_max / NGHTTP2_HD_ENTRY_OVERHEAD, mem); if (rv != 0) { return rv; } @@ -695,7 +707,7 @@ static void hd_context_free(nghttp2_hd_context *context) { int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater, nghttp2_mem *mem) { return nghttp2_hd_deflate_init2( - deflater, NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE, mem); + deflater, NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE, mem); } int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater, @@ -850,9 +862,10 @@ static size_t encode_length(uint8_t *buf, size_t n, size_t prefix) { * in the next call will be stored in |*shift_ptr|) and returns number * of bytes processed, or returns -1, indicating decoding error. */ -static ssize_t decode_length(uint32_t *res, size_t *shift_ptr, int *fin, - uint32_t initial, size_t shift, const uint8_t *in, - const uint8_t *last, size_t prefix) { +static nghttp2_ssize decode_length(uint32_t *res, size_t *shift_ptr, int *fin, + uint32_t initial, size_t shift, + const uint8_t *in, const uint8_t *last, + size_t prefix) { uint32_t k = (uint8_t)((1 << prefix) - 1); uint32_t n = initial; const uint8_t *start = in; @@ -871,7 +884,7 @@ static ssize_t decode_length(uint32_t *res, size_t *shift_ptr, int *fin, if (++in == last) { *res = n; - return (ssize_t)(in - start); + return (nghttp2_ssize)(in - start); } } @@ -906,12 +919,12 @@ static ssize_t decode_length(uint32_t *res, size_t *shift_ptr, int *fin, if (in == last) { *res = n; - return (ssize_t)(in - start); + return (nghttp2_ssize)(in - start); } *res = n; *fin = 1; - return (ssize_t)(in + 1 - start); + return (nghttp2_ssize)(in + 1 - start); } static int emit_table_size(nghttp2_bufs *bufs, size_t table_size) { @@ -1076,8 +1089,8 @@ static int emit_newname_block(nghttp2_bufs *bufs, const nghttp2_nv *nv, int rv; DEBUGF( - "deflatehd: emit newname namelen=%zu, valuelen=%zu, indexing_mode=%d\n", - nv->namelen, nv->valuelen, indexing_mode); + "deflatehd: emit newname namelen=%zu, valuelen=%zu, indexing_mode=%d\n", + nv->namelen, nv->valuelen, indexing_mode); rv = nghttp2_bufs_addb(bufs, pack_first_byte(indexing_mode)); if (rv != 0) { @@ -1110,12 +1123,11 @@ static int add_hd_table_incremental(nghttp2_hd_context *context, while (context->hd_table_bufsize + room > context->hd_table_bufsize_max && context->hd_table.len > 0) { - size_t idx = context->hd_table.len - 1; nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, idx); context->hd_table_bufsize -= - entry_room(ent->nv.name->len, ent->nv.value->len); + entry_room(ent->nv.name->len, ent->nv.value->len); DEBUGF("hpack: remove item from header table: %s: %s\n", (char *)ent->nv.name->base, (char *)ent->nv.value->base); @@ -1164,7 +1176,7 @@ static int add_hd_table_incremental(nghttp2_hd_context *context, } typedef struct { - ssize_t index; + nghttp2_ssize index; /* Nonzero if both name and value are matched. */ int name_value_match; } search_result; @@ -1213,8 +1225,8 @@ static search_result search_hd_table(nghttp2_hd_context *context, return res; } - res.index = - (ssize_t)(context->next_seq - 1 - ent->seq + NGHTTP2_STATIC_TABLE_LENGTH); + res.index = (nghttp2_ssize)(context->next_seq - 1 - ent->seq + + NGHTTP2_STATIC_TABLE_LENGTH); res.name_value_match = exact_match; return res; @@ -1231,7 +1243,7 @@ static void hd_context_shrink_table_size(nghttp2_hd_context *context, size_t idx = context->hd_table.len - 1; nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, idx); context->hd_table_bufsize -= - entry_room(ent->nv.name->len, ent->nv.value->len); + entry_room(ent->nv.name->len, ent->nv.value->len); hd_ringbuf_pop_back(&context->hd_table); if (map) { hd_map_remove(map, ent); @@ -1243,14 +1255,14 @@ static void hd_context_shrink_table_size(nghttp2_hd_context *context, } int nghttp2_hd_deflate_change_table_size( - nghttp2_hd_deflater *deflater, size_t settings_max_dynamic_table_size) { - size_t next_bufsize = nghttp2_min(settings_max_dynamic_table_size, - deflater->deflate_hd_table_bufsize_max); + nghttp2_hd_deflater *deflater, size_t settings_max_dynamic_table_size) { + size_t next_bufsize = nghttp2_min_size( + settings_max_dynamic_table_size, deflater->deflate_hd_table_bufsize_max); deflater->ctx.hd_table_bufsize_max = next_bufsize; deflater->min_hd_table_bufsize_max = - nghttp2_min(deflater->min_hd_table_bufsize_max, next_bufsize); + nghttp2_min_size(deflater->min_hd_table_bufsize_max, next_bufsize); deflater->notify_table_size_change = 1; @@ -1259,7 +1271,7 @@ int nghttp2_hd_deflate_change_table_size( } int nghttp2_hd_inflate_change_table_size( - nghttp2_hd_inflater *inflater, size_t settings_max_dynamic_table_size) { + nghttp2_hd_inflater *inflater, size_t settings_max_dynamic_table_size) { switch (inflater->state) { case NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE: case NGHTTP2_HD_STATE_INFLATE_START: @@ -1302,7 +1314,7 @@ nghttp2_hd_nv nghttp2_hd_table_get(nghttp2_hd_context *context, size_t idx) { assert(INDEX_RANGE_VALID(context, idx)); if (idx >= NGHTTP2_STATIC_TABLE_LENGTH) { return hd_ringbuf_get(&context->hd_table, idx - NGHTTP2_STATIC_TABLE_LENGTH) - ->nv; + ->nv; } else { const nghttp2_hd_static_entry *ent = &static_table[idx]; nghttp2_hd_nv nv = {(nghttp2_rcbuf *)&ent->name, @@ -1318,7 +1330,7 @@ static const nghttp2_nv *nghttp2_hd_table_get2(nghttp2_hd_context *context, if (idx >= NGHTTP2_STATIC_TABLE_LENGTH) { return &hd_ringbuf_get(&context->hd_table, idx - NGHTTP2_STATIC_TABLE_LENGTH) - ->cnv; + ->cnv; } return &static_table[idx].cnv; @@ -1332,7 +1344,7 @@ static int hd_deflate_decide_indexing(nghttp2_hd_deflater *deflater, token == NGHTTP2_TOKEN_IF_NONE_MATCH || token == NGHTTP2_TOKEN_LOCATION || token == NGHTTP2_TOKEN_SET_COOKIE || entry_room(nv->namelen, nv->valuelen) > - deflater->ctx.hd_table_bufsize_max * 3 / 4) { + deflater->ctx.hd_table_bufsize_max * 3 / 4) { return NGHTTP2_HD_WITHOUT_INDEXING; } @@ -1343,7 +1355,7 @@ static int deflate_nv(nghttp2_hd_deflater *deflater, nghttp2_bufs *bufs, const nghttp2_nv *nv) { int rv; search_result res; - ssize_t idx; + nghttp2_ssize idx; int indexing_mode; int32_t token; nghttp2_mem *mem; @@ -1365,12 +1377,11 @@ static int deflate_nv(nghttp2_hd_deflater *deflater, nghttp2_bufs *bufs, entropy secret data (e.g., id/password). Also cookie header field with less than 20 bytes value is also never indexed. This is the same criteria used in Firefox codebase. */ - indexing_mode = - token == NGHTTP2_TOKEN_AUTHORIZATION || - (token == NGHTTP2_TOKEN_COOKIE && nv->valuelen < 20) || - (nv->flags & NGHTTP2_NV_FLAG_NO_INDEX) - ? NGHTTP2_HD_NEVER_INDEXING - : hd_deflate_decide_indexing(deflater, nv, token); + indexing_mode = token == NGHTTP2_TOKEN_AUTHORIZATION || + (token == NGHTTP2_TOKEN_COOKIE && nv->valuelen < 20) || + (nv->flags & NGHTTP2_NV_FLAG_NO_INDEX) + ? NGHTTP2_HD_NEVER_INDEXING + : hd_deflate_decide_indexing(deflater, nv, token); res = search_hd_table(&deflater->ctx, nv, token, indexing_mode, &deflater->map, hash); @@ -1378,8 +1389,7 @@ static int deflate_nv(nghttp2_hd_deflater *deflater, nghttp2_bufs *bufs, idx = res.index; if (res.name_value_match) { - - DEBUGF("deflatehd: name/value match index=%zd\n", idx); + DEBUGF("deflatehd: name/value match index=%td\n", idx); rv = emit_indexed_block(bufs, (size_t)idx); if (rv != 0) { @@ -1390,7 +1400,7 @@ static int deflate_nv(nghttp2_hd_deflater *deflater, nghttp2_bufs *bufs, } if (res.index != -1) { - DEBUGF("deflatehd: name match index=%zd\n", res.index); + DEBUGF("deflatehd: name match index=%td\n", res.index); } if (indexing_mode == NGHTTP2_HD_WITH_INDEXING) { @@ -1456,7 +1466,6 @@ int nghttp2_hd_deflate_hd_bufs(nghttp2_hd_deflater *deflater, deflater->min_hd_table_bufsize_max = UINT32_MAX; if (deflater->ctx.hd_table_bufsize_max > min_hd_table_bufsize_max) { - rv = emit_table_size(bufs, min_hd_table_bufsize_max); if (rv != 0) { @@ -1491,6 +1500,12 @@ int nghttp2_hd_deflate_hd_bufs(nghttp2_hd_deflater *deflater, ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, uint8_t *buf, size_t buflen, const nghttp2_nv *nv, size_t nvlen) { + return (ssize_t)nghttp2_hd_deflate_hd2(deflater, buf, buflen, nv, nvlen); +} + +nghttp2_ssize nghttp2_hd_deflate_hd2(nghttp2_hd_deflater *deflater, + uint8_t *buf, size_t buflen, + const nghttp2_nv *nv, size_t nvlen) { nghttp2_bufs bufs; int rv; nghttp2_mem *mem; @@ -1517,12 +1532,18 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, uint8_t *buf, return rv; } - return (ssize_t)buflen; + return (nghttp2_ssize)buflen; } ssize_t nghttp2_hd_deflate_hd_vec(nghttp2_hd_deflater *deflater, const nghttp2_vec *vec, size_t veclen, const nghttp2_nv *nv, size_t nvlen) { + return (ssize_t)nghttp2_hd_deflate_hd_vec2(deflater, vec, veclen, nv, nvlen); +} + +nghttp2_ssize nghttp2_hd_deflate_hd_vec2(nghttp2_hd_deflater *deflater, + const nghttp2_vec *vec, size_t veclen, + const nghttp2_nv *nv, size_t nvlen) { nghttp2_bufs bufs; int rv; nghttp2_mem *mem; @@ -1550,7 +1571,7 @@ ssize_t nghttp2_hd_deflate_hd_vec(nghttp2_hd_deflater *deflater, return rv; } - return (ssize_t)buflen; + return (nghttp2_ssize)buflen; } size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater, @@ -1643,10 +1664,11 @@ static void hd_inflate_set_huffman_encoded(nghttp2_hd_inflater *inflater, * NGHTTP2_ERR_HEADER_COMP * Integer decoding failed */ -static ssize_t hd_inflate_read_len(nghttp2_hd_inflater *inflater, int *rfin, - const uint8_t *in, const uint8_t *last, - size_t prefix, size_t maxlen) { - ssize_t rv; +static nghttp2_ssize hd_inflate_read_len(nghttp2_hd_inflater *inflater, + int *rfin, const uint8_t *in, + const uint8_t *last, size_t prefix, + size_t maxlen) { + nghttp2_ssize rv; uint32_t out; *rfin = 0; @@ -1684,10 +1706,10 @@ static ssize_t hd_inflate_read_len(nghttp2_hd_inflater *inflater, int *rfin, * NGHTTP2_ERR_HEADER_COMP * Huffman decoding failed */ -static ssize_t hd_inflate_read_huff(nghttp2_hd_inflater *inflater, - nghttp2_buf *buf, const uint8_t *in, - const uint8_t *last) { - ssize_t readlen; +static nghttp2_ssize hd_inflate_read_huff(nghttp2_hd_inflater *inflater, + nghttp2_buf *buf, const uint8_t *in, + const uint8_t *last) { + nghttp2_ssize readlen; int fin = 0; if ((size_t)(last - in) >= inflater->left) { last = in + inflater->left; @@ -1721,14 +1743,15 @@ static ssize_t hd_inflate_read_huff(nghttp2_hd_inflater *inflater, * NGHTTP2_ERR_HEADER_COMP * Header decompression failed */ -static ssize_t hd_inflate_read(nghttp2_hd_inflater *inflater, nghttp2_buf *buf, - const uint8_t *in, const uint8_t *last) { - size_t len = nghttp2_min((size_t)(last - in), inflater->left); +static nghttp2_ssize hd_inflate_read(nghttp2_hd_inflater *inflater, + nghttp2_buf *buf, const uint8_t *in, + const uint8_t *last) { + size_t len = nghttp2_min_size((size_t)(last - in), inflater->left); buf->last = nghttp2_cpymem(buf->last, in, len); inflater->left -= len; - return (ssize_t)len; + return (nghttp2_ssize)len; } /* @@ -1843,7 +1866,15 @@ ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out, ssize_t nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater, nghttp2_nv *nv_out, int *inflate_flags, const uint8_t *in, size_t inlen, int in_final) { - ssize_t rv; + return (nghttp2_ssize)nghttp2_hd_inflate_hd3(inflater, nv_out, inflate_flags, + in, inlen, in_final); +} + +nghttp2_ssize nghttp2_hd_inflate_hd3(nghttp2_hd_inflater *inflater, + nghttp2_nv *nv_out, int *inflate_flags, + const uint8_t *in, size_t inlen, + int in_final) { + nghttp2_ssize rv; nghttp2_hd_nv hd_nv; rv = nghttp2_hd_inflate_hd_nv(inflater, &hd_nv, inflate_flags, in, inlen, @@ -1866,11 +1897,11 @@ ssize_t nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater, return rv; } -ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, - nghttp2_hd_nv *nv_out, int *inflate_flags, - const uint8_t *in, size_t inlen, - int in_final) { - ssize_t rv = 0; +nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, + nghttp2_hd_nv *nv_out, + int *inflate_flags, const uint8_t *in, + size_t inlen, int in_final) { + nghttp2_ssize rv = 0; const uint8_t *first = in; const uint8_t *last = in + inlen; int rfin = 0; @@ -1938,9 +1969,9 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, case NGHTTP2_HD_STATE_READ_TABLE_SIZE: rfin = 0; rv = hd_inflate_read_len( - inflater, &rfin, in, last, 5, - nghttp2_min(inflater->min_hd_table_bufsize_max, - inflater->settings_hd_table_bufsize_max)); + inflater, &rfin, in, last, 5, + nghttp2_min_size(inflater->min_hd_table_bufsize_max, + inflater->settings_hd_table_bufsize_max)); if (rv < 0) { goto fail; } @@ -1992,7 +2023,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, inflater->state = NGHTTP2_HD_STATE_OPCODE; *inflate_flags |= NGHTTP2_HD_INFLATE_EMIT; - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } else { inflater->index = inflater->left; --inflater->index; @@ -2027,8 +2058,8 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAMEHUFF; - rv = nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left * 2 + 1, - mem); + rv = + nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left * 2 + 1, mem); } else { inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAME; rv = nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left + 1, mem); @@ -2050,7 +2081,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, in += rv; - DEBUGF("inflatehd: %zd bytes read\n", rv); + DEBUGF("inflatehd: %td bytes read\n", rv); if (inflater->left) { DEBUGF("inflatehd: still %zu bytes to go\n", inflater->left); @@ -2072,7 +2103,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, in += rv; - DEBUGF("inflatehd: %zd bytes read\n", rv); + DEBUGF("inflatehd: %td bytes read\n", rv); if (inflater->left) { DEBUGF("inflatehd: still %zu bytes to go\n", inflater->left); @@ -2112,8 +2143,8 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, inflater->state = NGHTTP2_HD_STATE_READ_VALUEHUFF; - rv = nghttp2_rcbuf_new(&inflater->valuercbuf, inflater->left * 2 + 1, - mem); + rv = + nghttp2_rcbuf_new(&inflater->valuercbuf, inflater->left * 2 + 1, mem); } else { inflater->state = NGHTTP2_HD_STATE_READ_VALUE; @@ -2138,7 +2169,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, in += rv; - DEBUGF("inflatehd: %zd bytes read\n", rv); + DEBUGF("inflatehd: %td bytes read\n", rv); if (inflater->left) { DEBUGF("inflatehd: still %zu bytes to go\n", inflater->left); @@ -2162,18 +2193,18 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, inflater->state = NGHTTP2_HD_STATE_OPCODE; *inflate_flags |= NGHTTP2_HD_INFLATE_EMIT; - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); case NGHTTP2_HD_STATE_READ_VALUE: rv = hd_inflate_read(inflater, &inflater->valuebuf, in, last); if (rv < 0) { - DEBUGF("inflatehd: value read failure %zd: %s\n", rv, + DEBUGF("inflatehd: value read failure %td: %s\n", rv, nghttp2_strerror((int)rv)); goto fail; } in += rv; - DEBUGF("inflatehd: %zd bytes read\n", rv); + DEBUGF("inflatehd: %td bytes read\n", rv); if (inflater->left) { DEBUGF("inflatehd: still %zu bytes to go\n", inflater->left); @@ -2196,7 +2227,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, inflater->state = NGHTTP2_HD_STATE_OPCODE; *inflate_flags |= NGHTTP2_HD_INFLATE_EMIT; - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } } @@ -2216,7 +2247,7 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, } *inflate_flags |= NGHTTP2_HD_INFLATE_FINAL; } - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); almost_ok: if (in_final) { @@ -2226,10 +2257,10 @@ ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, goto fail; } - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); fail: - DEBUGF("inflatehd: error return %zd\n", rv); + DEBUGF("inflatehd: error return %td\n", rv); inflater->ctx.bad = 1; return rv; @@ -2284,7 +2315,6 @@ void nghttp2_hd_inflate_del(nghttp2_hd_inflater *inflater) { int nghttp2_hd_emit_indname_block(nghttp2_bufs *bufs, size_t idx, nghttp2_nv *nv, int indexing_mode) { - return emit_indname_block(bufs, idx, nv, indexing_mode); } @@ -2297,9 +2327,10 @@ int nghttp2_hd_emit_table_size(nghttp2_bufs *bufs, size_t table_size) { return emit_table_size(bufs, table_size); } -ssize_t nghttp2_hd_decode_length(uint32_t *res, size_t *shift_ptr, int *fin, - uint32_t initial, size_t shift, uint8_t *in, - uint8_t *last, size_t prefix) { +nghttp2_ssize nghttp2_hd_decode_length(uint32_t *res, size_t *shift_ptr, + int *fin, uint32_t initial, size_t shift, + uint8_t *in, uint8_t *last, + size_t prefix) { return decode_length(res, shift_ptr, fin, initial, shift, in, last, prefix); } diff --git a/lib/nghttp2/lib/nghttp2_hd.h b/lib/nghttp2-1.65.0/lib/nghttp2_hd.h similarity index 94% rename from lib/nghttp2/lib/nghttp2_hd.h rename to lib/nghttp2-1.65.0/lib/nghttp2_hd.h index 6de0052aaea..38a31a83c38 100644 --- a/lib/nghttp2/lib/nghttp2_hd.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_hd.h @@ -357,9 +357,10 @@ void nghttp2_hd_inflate_free(nghttp2_hd_inflater *inflater); * that return values and semantics are the same as * nghttp2_hd_inflate_hd(). */ -ssize_t nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, - nghttp2_hd_nv *nv_out, int *inflate_flags, - const uint8_t *in, size_t inlen, int in_final); +nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, + nghttp2_hd_nv *nv_out, + int *inflate_flags, const uint8_t *in, + size_t inlen, int in_final); /* For unittesting purpose */ int nghttp2_hd_emit_indname_block(nghttp2_bufs *bufs, size_t index, @@ -376,9 +377,10 @@ int nghttp2_hd_emit_table_size(nghttp2_bufs *bufs, size_t table_size); nghttp2_hd_nv nghttp2_hd_table_get(nghttp2_hd_context *context, size_t index); /* For unittesting purpose */ -ssize_t nghttp2_hd_decode_length(uint32_t *res, size_t *shift_ptr, int *fin, - uint32_t initial, size_t shift, uint8_t *in, - uint8_t *last, size_t prefix); +nghttp2_ssize nghttp2_hd_decode_length(uint32_t *res, size_t *shift_ptr, + int *fin, uint32_t initial, size_t shift, + uint8_t *in, uint8_t *last, + size_t prefix); /* Huffman encoding/decoding functions */ @@ -427,9 +429,9 @@ void nghttp2_hd_huff_decode_context_init(nghttp2_hd_huff_decode_context *ctx); * NGHTTP2_ERR_HEADER_COMP * Decoding process has failed. */ -ssize_t nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx, - nghttp2_buf *buf, const uint8_t *src, - size_t srclen, int fin); +nghttp2_ssize nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx, + nghttp2_buf *buf, const uint8_t *src, + size_t srclen, int fin); /* * nghttp2_hd_huff_decode_failure_state returns nonzero if |ctx| diff --git a/lib/nghttp2/lib/nghttp2_hd_huffman.c b/lib/nghttp2-1.65.0/lib/nghttp2_hd_huffman.c similarity index 87% rename from lib/nghttp2/lib/nghttp2_hd_huffman.c rename to lib/nghttp2-1.65.0/lib/nghttp2_hd_huffman.c index ac90f49c44f..de2620076a6 100644 --- a/lib/nghttp2/lib/nghttp2_hd_huffman.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_hd_huffman.c @@ -94,7 +94,7 @@ int nghttp2_hd_huff_encode(nghttp2_bufs *bufs, const uint8_t *src, if (nbits) { rv = nghttp2_bufs_addb( - bufs, (uint8_t)((uint8_t)(code >> 56) | ((1 << (8 - nbits)) - 1))); + bufs, (uint8_t)((uint8_t)(code >> 56) | ((1 << (8 - nbits)) - 1))); if (rv != 0) { return rv; } @@ -107,16 +107,18 @@ void nghttp2_hd_huff_decode_context_init(nghttp2_hd_huff_decode_context *ctx) { ctx->fstate = NGHTTP2_HUFF_ACCEPTED; } -ssize_t nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx, - nghttp2_buf *buf, const uint8_t *src, - size_t srclen, int final) { +nghttp2_ssize nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx, + nghttp2_buf *buf, const uint8_t *src, + size_t srclen, int final) { const uint8_t *end = src + srclen; nghttp2_huff_decode node = {ctx->fstate, 0}; const nghttp2_huff_decode *t = &node; uint8_t c; /* We use the decoding algorithm described in - http://graphics.ics.uci.edu/pub/Prefix.pdf */ + - http://graphics.ics.uci.edu/pub/Prefix.pdf [!!! NO LONGER VALID !!!] + - https://ics.uci.edu/~dan/pubs/Prefix.pdf + - https://github.com/nghttp2/nghttp2/files/15141264/Prefix.pdf */ for (; src != end;) { c = *src++; t = &huff_decode_table[t->fstate & 0x1ff][c >> 4]; @@ -136,7 +138,7 @@ ssize_t nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx, return NGHTTP2_ERR_HEADER_COMP; } - return (ssize_t)srclen; + return (nghttp2_ssize)srclen; } int nghttp2_hd_huff_decode_failure_state(nghttp2_hd_huff_decode_context *ctx) { diff --git a/lib/nghttp2/lib/nghttp2_hd_huffman.h b/lib/nghttp2-1.65.0/lib/nghttp2_hd_huffman.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_hd_huffman.h rename to lib/nghttp2-1.65.0/lib/nghttp2_hd_huffman.h diff --git a/lib/nghttp2-1.65.0/lib/nghttp2_hd_huffman_data.c b/lib/nghttp2-1.65.0/lib/nghttp2_hd_huffman_data.c new file mode 100644 index 00000000000..c8f4a6fa266 --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/nghttp2_hd_huffman_data.c @@ -0,0 +1,4980 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_hd_huffman.h" + +/* Generated by mkhufftbl.py */ + +const nghttp2_huff_sym huff_sym_table[] = { + {13, 0xffc00000u}, {23, 0xffffb000u}, {28, 0xfffffe20u}, {28, 0xfffffe30u}, + {28, 0xfffffe40u}, {28, 0xfffffe50u}, {28, 0xfffffe60u}, {28, 0xfffffe70u}, + {28, 0xfffffe80u}, {24, 0xffffea00u}, {30, 0xfffffff0u}, {28, 0xfffffe90u}, + {28, 0xfffffea0u}, {30, 0xfffffff4u}, {28, 0xfffffeb0u}, {28, 0xfffffec0u}, + {28, 0xfffffed0u}, {28, 0xfffffee0u}, {28, 0xfffffef0u}, {28, 0xffffff00u}, + {28, 0xffffff10u}, {28, 0xffffff20u}, {30, 0xfffffff8u}, {28, 0xffffff30u}, + {28, 0xffffff40u}, {28, 0xffffff50u}, {28, 0xffffff60u}, {28, 0xffffff70u}, + {28, 0xffffff80u}, {28, 0xffffff90u}, {28, 0xffffffa0u}, {28, 0xffffffb0u}, + {6, 0x50000000u}, {10, 0xfe000000u}, {10, 0xfe400000u}, {12, 0xffa00000u}, + {13, 0xffc80000u}, {6, 0x54000000u}, {8, 0xf8000000u}, {11, 0xff400000u}, + {10, 0xfe800000u}, {10, 0xfec00000u}, {8, 0xf9000000u}, {11, 0xff600000u}, + {8, 0xfa000000u}, {6, 0x58000000u}, {6, 0x5c000000u}, {6, 0x60000000u}, + {5, 0x0u}, {5, 0x8000000u}, {5, 0x10000000u}, {6, 0x64000000u}, + {6, 0x68000000u}, {6, 0x6c000000u}, {6, 0x70000000u}, {6, 0x74000000u}, + {6, 0x78000000u}, {6, 0x7c000000u}, {7, 0xb8000000u}, {8, 0xfb000000u}, + {15, 0xfff80000u}, {6, 0x80000000u}, {12, 0xffb00000u}, {10, 0xff000000u}, + {13, 0xffd00000u}, {6, 0x84000000u}, {7, 0xba000000u}, {7, 0xbc000000u}, + {7, 0xbe000000u}, {7, 0xc0000000u}, {7, 0xc2000000u}, {7, 0xc4000000u}, + {7, 0xc6000000u}, {7, 0xc8000000u}, {7, 0xca000000u}, {7, 0xcc000000u}, + {7, 0xce000000u}, {7, 0xd0000000u}, {7, 0xd2000000u}, {7, 0xd4000000u}, + {7, 0xd6000000u}, {7, 0xd8000000u}, {7, 0xda000000u}, {7, 0xdc000000u}, + {7, 0xde000000u}, {7, 0xe0000000u}, {7, 0xe2000000u}, {7, 0xe4000000u}, + {8, 0xfc000000u}, {7, 0xe6000000u}, {8, 0xfd000000u}, {13, 0xffd80000u}, + {19, 0xfffe0000u}, {13, 0xffe00000u}, {14, 0xfff00000u}, {6, 0x88000000u}, + {15, 0xfffa0000u}, {5, 0x18000000u}, {6, 0x8c000000u}, {5, 0x20000000u}, + {6, 0x90000000u}, {5, 0x28000000u}, {6, 0x94000000u}, {6, 0x98000000u}, + {6, 0x9c000000u}, {5, 0x30000000u}, {7, 0xe8000000u}, {7, 0xea000000u}, + {6, 0xa0000000u}, {6, 0xa4000000u}, {6, 0xa8000000u}, {5, 0x38000000u}, + {6, 0xac000000u}, {7, 0xec000000u}, {6, 0xb0000000u}, {5, 0x40000000u}, + {5, 0x48000000u}, {6, 0xb4000000u}, {7, 0xee000000u}, {7, 0xf0000000u}, + {7, 0xf2000000u}, {7, 0xf4000000u}, {7, 0xf6000000u}, {15, 0xfffc0000u}, + {11, 0xff800000u}, {14, 0xfff40000u}, {13, 0xffe80000u}, {28, 0xffffffc0u}, + {20, 0xfffe6000u}, {22, 0xffff4800u}, {20, 0xfffe7000u}, {20, 0xfffe8000u}, + {22, 0xffff4c00u}, {22, 0xffff5000u}, {22, 0xffff5400u}, {23, 0xffffb200u}, + {22, 0xffff5800u}, {23, 0xffffb400u}, {23, 0xffffb600u}, {23, 0xffffb800u}, + {23, 0xffffba00u}, {23, 0xffffbc00u}, {24, 0xffffeb00u}, {23, 0xffffbe00u}, + {24, 0xffffec00u}, {24, 0xffffed00u}, {22, 0xffff5c00u}, {23, 0xffffc000u}, + {24, 0xffffee00u}, {23, 0xffffc200u}, {23, 0xffffc400u}, {23, 0xffffc600u}, + {23, 0xffffc800u}, {21, 0xfffee000u}, {22, 0xffff6000u}, {23, 0xffffca00u}, + {22, 0xffff6400u}, {23, 0xffffcc00u}, {23, 0xffffce00u}, {24, 0xffffef00u}, + {22, 0xffff6800u}, {21, 0xfffee800u}, {20, 0xfffe9000u}, {22, 0xffff6c00u}, + {22, 0xffff7000u}, {23, 0xffffd000u}, {23, 0xffffd200u}, {21, 0xfffef000u}, + {23, 0xffffd400u}, {22, 0xffff7400u}, {22, 0xffff7800u}, {24, 0xfffff000u}, + {21, 0xfffef800u}, {22, 0xffff7c00u}, {23, 0xffffd600u}, {23, 0xffffd800u}, + {21, 0xffff0000u}, {21, 0xffff0800u}, {22, 0xffff8000u}, {21, 0xffff1000u}, + {23, 0xffffda00u}, {22, 0xffff8400u}, {23, 0xffffdc00u}, {23, 0xffffde00u}, + {20, 0xfffea000u}, {22, 0xffff8800u}, {22, 0xffff8c00u}, {22, 0xffff9000u}, + {23, 0xffffe000u}, {22, 0xffff9400u}, {22, 0xffff9800u}, {23, 0xffffe200u}, + {26, 0xfffff800u}, {26, 0xfffff840u}, {20, 0xfffeb000u}, {19, 0xfffe2000u}, + {22, 0xffff9c00u}, {23, 0xffffe400u}, {22, 0xffffa000u}, {25, 0xfffff600u}, + {26, 0xfffff880u}, {26, 0xfffff8c0u}, {26, 0xfffff900u}, {27, 0xfffffbc0u}, + {27, 0xfffffbe0u}, {26, 0xfffff940u}, {24, 0xfffff100u}, {25, 0xfffff680u}, + {19, 0xfffe4000u}, {21, 0xffff1800u}, {26, 0xfffff980u}, {27, 0xfffffc00u}, + {27, 0xfffffc20u}, {26, 0xfffff9c0u}, {27, 0xfffffc40u}, {24, 0xfffff200u}, + {21, 0xffff2000u}, {21, 0xffff2800u}, {26, 0xfffffa00u}, {26, 0xfffffa40u}, + {28, 0xffffffd0u}, {27, 0xfffffc60u}, {27, 0xfffffc80u}, {27, 0xfffffca0u}, + {20, 0xfffec000u}, {24, 0xfffff300u}, {20, 0xfffed000u}, {21, 0xffff3000u}, + {22, 0xffffa400u}, {21, 0xffff3800u}, {21, 0xffff4000u}, {23, 0xffffe600u}, + {22, 0xffffa800u}, {22, 0xffffac00u}, {25, 0xfffff700u}, {25, 0xfffff780u}, + {24, 0xfffff400u}, {24, 0xfffff500u}, {26, 0xfffffa80u}, {23, 0xffffe800u}, + {26, 0xfffffac0u}, {27, 0xfffffcc0u}, {26, 0xfffffb00u}, {26, 0xfffffb40u}, + {27, 0xfffffce0u}, {27, 0xfffffd00u}, {27, 0xfffffd20u}, {27, 0xfffffd40u}, + {27, 0xfffffd60u}, {28, 0xffffffe0u}, {27, 0xfffffd80u}, {27, 0xfffffda0u}, + {27, 0xfffffdc0u}, {27, 0xfffffde0u}, {27, 0xfffffe00u}, {26, 0xfffffb80u}, + {30, 0xfffffffcu}}; + +const nghttp2_huff_decode huff_decode_table[][16] = { + /* 0 */ + { + {0x04, 0}, + {0x05, 0}, + {0x07, 0}, + {0x08, 0}, + {0x0b, 0}, + {0x0c, 0}, + {0x10, 0}, + {0x13, 0}, + {0x19, 0}, + {0x1c, 0}, + {0x20, 0}, + {0x23, 0}, + {0x2a, 0}, + {0x31, 0}, + {0x39, 0}, + {0x4040, 0}, + }, + /* 1 */ + { + {0xc000, 48}, + {0xc000, 49}, + {0xc000, 50}, + {0xc000, 97}, + {0xc000, 99}, + {0xc000, 101}, + {0xc000, 105}, + {0xc000, 111}, + {0xc000, 115}, + {0xc000, 116}, + {0x0d, 0}, + {0x0e, 0}, + {0x11, 0}, + {0x12, 0}, + {0x14, 0}, + {0x15, 0}, + }, + /* 2 */ + { + {0x8001, 48}, + {0xc016, 48}, + {0x8001, 49}, + {0xc016, 49}, + {0x8001, 50}, + {0xc016, 50}, + {0x8001, 97}, + {0xc016, 97}, + {0x8001, 99}, + {0xc016, 99}, + {0x8001, 101}, + {0xc016, 101}, + {0x8001, 105}, + {0xc016, 105}, + {0x8001, 111}, + {0xc016, 111}, + }, + /* 3 */ + { + {0x8002, 48}, + {0x8009, 48}, + {0x8017, 48}, + {0xc028, 48}, + {0x8002, 49}, + {0x8009, 49}, + {0x8017, 49}, + {0xc028, 49}, + {0x8002, 50}, + {0x8009, 50}, + {0x8017, 50}, + {0xc028, 50}, + {0x8002, 97}, + {0x8009, 97}, + {0x8017, 97}, + {0xc028, 97}, + }, + /* 4 */ + { + {0x8003, 48}, + {0x8006, 48}, + {0x800a, 48}, + {0x800f, 48}, + {0x8018, 48}, + {0x801f, 48}, + {0x8029, 48}, + {0xc038, 48}, + {0x8003, 49}, + {0x8006, 49}, + {0x800a, 49}, + {0x800f, 49}, + {0x8018, 49}, + {0x801f, 49}, + {0x8029, 49}, + {0xc038, 49}, + }, + /* 5 */ + { + {0x8003, 50}, + {0x8006, 50}, + {0x800a, 50}, + {0x800f, 50}, + {0x8018, 50}, + {0x801f, 50}, + {0x8029, 50}, + {0xc038, 50}, + {0x8003, 97}, + {0x8006, 97}, + {0x800a, 97}, + {0x800f, 97}, + {0x8018, 97}, + {0x801f, 97}, + {0x8029, 97}, + {0xc038, 97}, + }, + /* 6 */ + { + {0x8002, 99}, + {0x8009, 99}, + {0x8017, 99}, + {0xc028, 99}, + {0x8002, 101}, + {0x8009, 101}, + {0x8017, 101}, + {0xc028, 101}, + {0x8002, 105}, + {0x8009, 105}, + {0x8017, 105}, + {0xc028, 105}, + {0x8002, 111}, + {0x8009, 111}, + {0x8017, 111}, + {0xc028, 111}, + }, + /* 7 */ + { + {0x8003, 99}, + {0x8006, 99}, + {0x800a, 99}, + {0x800f, 99}, + {0x8018, 99}, + {0x801f, 99}, + {0x8029, 99}, + {0xc038, 99}, + {0x8003, 101}, + {0x8006, 101}, + {0x800a, 101}, + {0x800f, 101}, + {0x8018, 101}, + {0x801f, 101}, + {0x8029, 101}, + {0xc038, 101}, + }, + /* 8 */ + { + {0x8003, 105}, + {0x8006, 105}, + {0x800a, 105}, + {0x800f, 105}, + {0x8018, 105}, + {0x801f, 105}, + {0x8029, 105}, + {0xc038, 105}, + {0x8003, 111}, + {0x8006, 111}, + {0x800a, 111}, + {0x800f, 111}, + {0x8018, 111}, + {0x801f, 111}, + {0x8029, 111}, + {0xc038, 111}, + }, + /* 9 */ + { + {0x8001, 115}, + {0xc016, 115}, + {0x8001, 116}, + {0xc016, 116}, + {0xc000, 32}, + {0xc000, 37}, + {0xc000, 45}, + {0xc000, 46}, + {0xc000, 47}, + {0xc000, 51}, + {0xc000, 52}, + {0xc000, 53}, + {0xc000, 54}, + {0xc000, 55}, + {0xc000, 56}, + {0xc000, 57}, + }, + /* 10 */ + { + {0x8002, 115}, + {0x8009, 115}, + {0x8017, 115}, + {0xc028, 115}, + {0x8002, 116}, + {0x8009, 116}, + {0x8017, 116}, + {0xc028, 116}, + {0x8001, 32}, + {0xc016, 32}, + {0x8001, 37}, + {0xc016, 37}, + {0x8001, 45}, + {0xc016, 45}, + {0x8001, 46}, + {0xc016, 46}, + }, + /* 11 */ + { + {0x8003, 115}, + {0x8006, 115}, + {0x800a, 115}, + {0x800f, 115}, + {0x8018, 115}, + {0x801f, 115}, + {0x8029, 115}, + {0xc038, 115}, + {0x8003, 116}, + {0x8006, 116}, + {0x800a, 116}, + {0x800f, 116}, + {0x8018, 116}, + {0x801f, 116}, + {0x8029, 116}, + {0xc038, 116}, + }, + /* 12 */ + { + {0x8002, 32}, + {0x8009, 32}, + {0x8017, 32}, + {0xc028, 32}, + {0x8002, 37}, + {0x8009, 37}, + {0x8017, 37}, + {0xc028, 37}, + {0x8002, 45}, + {0x8009, 45}, + {0x8017, 45}, + {0xc028, 45}, + {0x8002, 46}, + {0x8009, 46}, + {0x8017, 46}, + {0xc028, 46}, + }, + /* 13 */ + { + {0x8003, 32}, + {0x8006, 32}, + {0x800a, 32}, + {0x800f, 32}, + {0x8018, 32}, + {0x801f, 32}, + {0x8029, 32}, + {0xc038, 32}, + {0x8003, 37}, + {0x8006, 37}, + {0x800a, 37}, + {0x800f, 37}, + {0x8018, 37}, + {0x801f, 37}, + {0x8029, 37}, + {0xc038, 37}, + }, + /* 14 */ + { + {0x8003, 45}, + {0x8006, 45}, + {0x800a, 45}, + {0x800f, 45}, + {0x8018, 45}, + {0x801f, 45}, + {0x8029, 45}, + {0xc038, 45}, + {0x8003, 46}, + {0x8006, 46}, + {0x800a, 46}, + {0x800f, 46}, + {0x8018, 46}, + {0x801f, 46}, + {0x8029, 46}, + {0xc038, 46}, + }, + /* 15 */ + { + {0x8001, 47}, + {0xc016, 47}, + {0x8001, 51}, + {0xc016, 51}, + {0x8001, 52}, + {0xc016, 52}, + {0x8001, 53}, + {0xc016, 53}, + {0x8001, 54}, + {0xc016, 54}, + {0x8001, 55}, + {0xc016, 55}, + {0x8001, 56}, + {0xc016, 56}, + {0x8001, 57}, + {0xc016, 57}, + }, + /* 16 */ + { + {0x8002, 47}, + {0x8009, 47}, + {0x8017, 47}, + {0xc028, 47}, + {0x8002, 51}, + {0x8009, 51}, + {0x8017, 51}, + {0xc028, 51}, + {0x8002, 52}, + {0x8009, 52}, + {0x8017, 52}, + {0xc028, 52}, + {0x8002, 53}, + {0x8009, 53}, + {0x8017, 53}, + {0xc028, 53}, + }, + /* 17 */ + { + {0x8003, 47}, + {0x8006, 47}, + {0x800a, 47}, + {0x800f, 47}, + {0x8018, 47}, + {0x801f, 47}, + {0x8029, 47}, + {0xc038, 47}, + {0x8003, 51}, + {0x8006, 51}, + {0x800a, 51}, + {0x800f, 51}, + {0x8018, 51}, + {0x801f, 51}, + {0x8029, 51}, + {0xc038, 51}, + }, + /* 18 */ + { + {0x8003, 52}, + {0x8006, 52}, + {0x800a, 52}, + {0x800f, 52}, + {0x8018, 52}, + {0x801f, 52}, + {0x8029, 52}, + {0xc038, 52}, + {0x8003, 53}, + {0x8006, 53}, + {0x800a, 53}, + {0x800f, 53}, + {0x8018, 53}, + {0x801f, 53}, + {0x8029, 53}, + {0xc038, 53}, + }, + /* 19 */ + { + {0x8002, 54}, + {0x8009, 54}, + {0x8017, 54}, + {0xc028, 54}, + {0x8002, 55}, + {0x8009, 55}, + {0x8017, 55}, + {0xc028, 55}, + {0x8002, 56}, + {0x8009, 56}, + {0x8017, 56}, + {0xc028, 56}, + {0x8002, 57}, + {0x8009, 57}, + {0x8017, 57}, + {0xc028, 57}, + }, + /* 20 */ + { + {0x8003, 54}, + {0x8006, 54}, + {0x800a, 54}, + {0x800f, 54}, + {0x8018, 54}, + {0x801f, 54}, + {0x8029, 54}, + {0xc038, 54}, + {0x8003, 55}, + {0x8006, 55}, + {0x800a, 55}, + {0x800f, 55}, + {0x8018, 55}, + {0x801f, 55}, + {0x8029, 55}, + {0xc038, 55}, + }, + /* 21 */ + { + {0x8003, 56}, + {0x8006, 56}, + {0x800a, 56}, + {0x800f, 56}, + {0x8018, 56}, + {0x801f, 56}, + {0x8029, 56}, + {0xc038, 56}, + {0x8003, 57}, + {0x8006, 57}, + {0x800a, 57}, + {0x800f, 57}, + {0x8018, 57}, + {0x801f, 57}, + {0x8029, 57}, + {0xc038, 57}, + }, + /* 22 */ + { + {0x1a, 0}, + {0x1b, 0}, + {0x1d, 0}, + {0x1e, 0}, + {0x21, 0}, + {0x22, 0}, + {0x24, 0}, + {0x25, 0}, + {0x2b, 0}, + {0x2e, 0}, + {0x32, 0}, + {0x35, 0}, + {0x3a, 0}, + {0x3d, 0}, + {0x41, 0}, + {0x4044, 0}, + }, + /* 23 */ + { + {0xc000, 61}, + {0xc000, 65}, + {0xc000, 95}, + {0xc000, 98}, + {0xc000, 100}, + {0xc000, 102}, + {0xc000, 103}, + {0xc000, 104}, + {0xc000, 108}, + {0xc000, 109}, + {0xc000, 110}, + {0xc000, 112}, + {0xc000, 114}, + {0xc000, 117}, + {0x26, 0}, + {0x27, 0}, + }, + /* 24 */ + { + {0x8001, 61}, + {0xc016, 61}, + {0x8001, 65}, + {0xc016, 65}, + {0x8001, 95}, + {0xc016, 95}, + {0x8001, 98}, + {0xc016, 98}, + {0x8001, 100}, + {0xc016, 100}, + {0x8001, 102}, + {0xc016, 102}, + {0x8001, 103}, + {0xc016, 103}, + {0x8001, 104}, + {0xc016, 104}, + }, + /* 25 */ + { + {0x8002, 61}, + {0x8009, 61}, + {0x8017, 61}, + {0xc028, 61}, + {0x8002, 65}, + {0x8009, 65}, + {0x8017, 65}, + {0xc028, 65}, + {0x8002, 95}, + {0x8009, 95}, + {0x8017, 95}, + {0xc028, 95}, + {0x8002, 98}, + {0x8009, 98}, + {0x8017, 98}, + {0xc028, 98}, + }, + /* 26 */ + { + {0x8003, 61}, + {0x8006, 61}, + {0x800a, 61}, + {0x800f, 61}, + {0x8018, 61}, + {0x801f, 61}, + {0x8029, 61}, + {0xc038, 61}, + {0x8003, 65}, + {0x8006, 65}, + {0x800a, 65}, + {0x800f, 65}, + {0x8018, 65}, + {0x801f, 65}, + {0x8029, 65}, + {0xc038, 65}, + }, + /* 27 */ + { + {0x8003, 95}, + {0x8006, 95}, + {0x800a, 95}, + {0x800f, 95}, + {0x8018, 95}, + {0x801f, 95}, + {0x8029, 95}, + {0xc038, 95}, + {0x8003, 98}, + {0x8006, 98}, + {0x800a, 98}, + {0x800f, 98}, + {0x8018, 98}, + {0x801f, 98}, + {0x8029, 98}, + {0xc038, 98}, + }, + /* 28 */ + { + {0x8002, 100}, + {0x8009, 100}, + {0x8017, 100}, + {0xc028, 100}, + {0x8002, 102}, + {0x8009, 102}, + {0x8017, 102}, + {0xc028, 102}, + {0x8002, 103}, + {0x8009, 103}, + {0x8017, 103}, + {0xc028, 103}, + {0x8002, 104}, + {0x8009, 104}, + {0x8017, 104}, + {0xc028, 104}, + }, + /* 29 */ + { + {0x8003, 100}, + {0x8006, 100}, + {0x800a, 100}, + {0x800f, 100}, + {0x8018, 100}, + {0x801f, 100}, + {0x8029, 100}, + {0xc038, 100}, + {0x8003, 102}, + {0x8006, 102}, + {0x800a, 102}, + {0x800f, 102}, + {0x8018, 102}, + {0x801f, 102}, + {0x8029, 102}, + {0xc038, 102}, + }, + /* 30 */ + { + {0x8003, 103}, + {0x8006, 103}, + {0x800a, 103}, + {0x800f, 103}, + {0x8018, 103}, + {0x801f, 103}, + {0x8029, 103}, + {0xc038, 103}, + {0x8003, 104}, + {0x8006, 104}, + {0x800a, 104}, + {0x800f, 104}, + {0x8018, 104}, + {0x801f, 104}, + {0x8029, 104}, + {0xc038, 104}, + }, + /* 31 */ + { + {0x8001, 108}, + {0xc016, 108}, + {0x8001, 109}, + {0xc016, 109}, + {0x8001, 110}, + {0xc016, 110}, + {0x8001, 112}, + {0xc016, 112}, + {0x8001, 114}, + {0xc016, 114}, + {0x8001, 117}, + {0xc016, 117}, + {0xc000, 58}, + {0xc000, 66}, + {0xc000, 67}, + {0xc000, 68}, + }, + /* 32 */ + { + {0x8002, 108}, + {0x8009, 108}, + {0x8017, 108}, + {0xc028, 108}, + {0x8002, 109}, + {0x8009, 109}, + {0x8017, 109}, + {0xc028, 109}, + {0x8002, 110}, + {0x8009, 110}, + {0x8017, 110}, + {0xc028, 110}, + {0x8002, 112}, + {0x8009, 112}, + {0x8017, 112}, + {0xc028, 112}, + }, + /* 33 */ + { + {0x8003, 108}, + {0x8006, 108}, + {0x800a, 108}, + {0x800f, 108}, + {0x8018, 108}, + {0x801f, 108}, + {0x8029, 108}, + {0xc038, 108}, + {0x8003, 109}, + {0x8006, 109}, + {0x800a, 109}, + {0x800f, 109}, + {0x8018, 109}, + {0x801f, 109}, + {0x8029, 109}, + {0xc038, 109}, + }, + /* 34 */ + { + {0x8003, 110}, + {0x8006, 110}, + {0x800a, 110}, + {0x800f, 110}, + {0x8018, 110}, + {0x801f, 110}, + {0x8029, 110}, + {0xc038, 110}, + {0x8003, 112}, + {0x8006, 112}, + {0x800a, 112}, + {0x800f, 112}, + {0x8018, 112}, + {0x801f, 112}, + {0x8029, 112}, + {0xc038, 112}, + }, + /* 35 */ + { + {0x8002, 114}, + {0x8009, 114}, + {0x8017, 114}, + {0xc028, 114}, + {0x8002, 117}, + {0x8009, 117}, + {0x8017, 117}, + {0xc028, 117}, + {0x8001, 58}, + {0xc016, 58}, + {0x8001, 66}, + {0xc016, 66}, + {0x8001, 67}, + {0xc016, 67}, + {0x8001, 68}, + {0xc016, 68}, + }, + /* 36 */ + { + {0x8003, 114}, + {0x8006, 114}, + {0x800a, 114}, + {0x800f, 114}, + {0x8018, 114}, + {0x801f, 114}, + {0x8029, 114}, + {0xc038, 114}, + {0x8003, 117}, + {0x8006, 117}, + {0x800a, 117}, + {0x800f, 117}, + {0x8018, 117}, + {0x801f, 117}, + {0x8029, 117}, + {0xc038, 117}, + }, + /* 37 */ + { + {0x8002, 58}, + {0x8009, 58}, + {0x8017, 58}, + {0xc028, 58}, + {0x8002, 66}, + {0x8009, 66}, + {0x8017, 66}, + {0xc028, 66}, + {0x8002, 67}, + {0x8009, 67}, + {0x8017, 67}, + {0xc028, 67}, + {0x8002, 68}, + {0x8009, 68}, + {0x8017, 68}, + {0xc028, 68}, + }, + /* 38 */ + { + {0x8003, 58}, + {0x8006, 58}, + {0x800a, 58}, + {0x800f, 58}, + {0x8018, 58}, + {0x801f, 58}, + {0x8029, 58}, + {0xc038, 58}, + {0x8003, 66}, + {0x8006, 66}, + {0x800a, 66}, + {0x800f, 66}, + {0x8018, 66}, + {0x801f, 66}, + {0x8029, 66}, + {0xc038, 66}, + }, + /* 39 */ + { + {0x8003, 67}, + {0x8006, 67}, + {0x800a, 67}, + {0x800f, 67}, + {0x8018, 67}, + {0x801f, 67}, + {0x8029, 67}, + {0xc038, 67}, + {0x8003, 68}, + {0x8006, 68}, + {0x800a, 68}, + {0x800f, 68}, + {0x8018, 68}, + {0x801f, 68}, + {0x8029, 68}, + {0xc038, 68}, + }, + /* 40 */ + { + {0x2c, 0}, + {0x2d, 0}, + {0x2f, 0}, + {0x30, 0}, + {0x33, 0}, + {0x34, 0}, + {0x36, 0}, + {0x37, 0}, + {0x3b, 0}, + {0x3c, 0}, + {0x3e, 0}, + {0x3f, 0}, + {0x42, 0}, + {0x43, 0}, + {0x45, 0}, + {0x4048, 0}, + }, + /* 41 */ + { + {0xc000, 69}, + {0xc000, 70}, + {0xc000, 71}, + {0xc000, 72}, + {0xc000, 73}, + {0xc000, 74}, + {0xc000, 75}, + {0xc000, 76}, + {0xc000, 77}, + {0xc000, 78}, + {0xc000, 79}, + {0xc000, 80}, + {0xc000, 81}, + {0xc000, 82}, + {0xc000, 83}, + {0xc000, 84}, + }, + /* 42 */ + { + {0x8001, 69}, + {0xc016, 69}, + {0x8001, 70}, + {0xc016, 70}, + {0x8001, 71}, + {0xc016, 71}, + {0x8001, 72}, + {0xc016, 72}, + {0x8001, 73}, + {0xc016, 73}, + {0x8001, 74}, + {0xc016, 74}, + {0x8001, 75}, + {0xc016, 75}, + {0x8001, 76}, + {0xc016, 76}, + }, + /* 43 */ + { + {0x8002, 69}, + {0x8009, 69}, + {0x8017, 69}, + {0xc028, 69}, + {0x8002, 70}, + {0x8009, 70}, + {0x8017, 70}, + {0xc028, 70}, + {0x8002, 71}, + {0x8009, 71}, + {0x8017, 71}, + {0xc028, 71}, + {0x8002, 72}, + {0x8009, 72}, + {0x8017, 72}, + {0xc028, 72}, + }, + /* 44 */ + { + {0x8003, 69}, + {0x8006, 69}, + {0x800a, 69}, + {0x800f, 69}, + {0x8018, 69}, + {0x801f, 69}, + {0x8029, 69}, + {0xc038, 69}, + {0x8003, 70}, + {0x8006, 70}, + {0x800a, 70}, + {0x800f, 70}, + {0x8018, 70}, + {0x801f, 70}, + {0x8029, 70}, + {0xc038, 70}, + }, + /* 45 */ + { + {0x8003, 71}, + {0x8006, 71}, + {0x800a, 71}, + {0x800f, 71}, + {0x8018, 71}, + {0x801f, 71}, + {0x8029, 71}, + {0xc038, 71}, + {0x8003, 72}, + {0x8006, 72}, + {0x800a, 72}, + {0x800f, 72}, + {0x8018, 72}, + {0x801f, 72}, + {0x8029, 72}, + {0xc038, 72}, + }, + /* 46 */ + { + {0x8002, 73}, + {0x8009, 73}, + {0x8017, 73}, + {0xc028, 73}, + {0x8002, 74}, + {0x8009, 74}, + {0x8017, 74}, + {0xc028, 74}, + {0x8002, 75}, + {0x8009, 75}, + {0x8017, 75}, + {0xc028, 75}, + {0x8002, 76}, + {0x8009, 76}, + {0x8017, 76}, + {0xc028, 76}, + }, + /* 47 */ + { + {0x8003, 73}, + {0x8006, 73}, + {0x800a, 73}, + {0x800f, 73}, + {0x8018, 73}, + {0x801f, 73}, + {0x8029, 73}, + {0xc038, 73}, + {0x8003, 74}, + {0x8006, 74}, + {0x800a, 74}, + {0x800f, 74}, + {0x8018, 74}, + {0x801f, 74}, + {0x8029, 74}, + {0xc038, 74}, + }, + /* 48 */ + { + {0x8003, 75}, + {0x8006, 75}, + {0x800a, 75}, + {0x800f, 75}, + {0x8018, 75}, + {0x801f, 75}, + {0x8029, 75}, + {0xc038, 75}, + {0x8003, 76}, + {0x8006, 76}, + {0x800a, 76}, + {0x800f, 76}, + {0x8018, 76}, + {0x801f, 76}, + {0x8029, 76}, + {0xc038, 76}, + }, + /* 49 */ + { + {0x8001, 77}, + {0xc016, 77}, + {0x8001, 78}, + {0xc016, 78}, + {0x8001, 79}, + {0xc016, 79}, + {0x8001, 80}, + {0xc016, 80}, + {0x8001, 81}, + {0xc016, 81}, + {0x8001, 82}, + {0xc016, 82}, + {0x8001, 83}, + {0xc016, 83}, + {0x8001, 84}, + {0xc016, 84}, + }, + /* 50 */ + { + {0x8002, 77}, + {0x8009, 77}, + {0x8017, 77}, + {0xc028, 77}, + {0x8002, 78}, + {0x8009, 78}, + {0x8017, 78}, + {0xc028, 78}, + {0x8002, 79}, + {0x8009, 79}, + {0x8017, 79}, + {0xc028, 79}, + {0x8002, 80}, + {0x8009, 80}, + {0x8017, 80}, + {0xc028, 80}, + }, + /* 51 */ + { + {0x8003, 77}, + {0x8006, 77}, + {0x800a, 77}, + {0x800f, 77}, + {0x8018, 77}, + {0x801f, 77}, + {0x8029, 77}, + {0xc038, 77}, + {0x8003, 78}, + {0x8006, 78}, + {0x800a, 78}, + {0x800f, 78}, + {0x8018, 78}, + {0x801f, 78}, + {0x8029, 78}, + {0xc038, 78}, + }, + /* 52 */ + { + {0x8003, 79}, + {0x8006, 79}, + {0x800a, 79}, + {0x800f, 79}, + {0x8018, 79}, + {0x801f, 79}, + {0x8029, 79}, + {0xc038, 79}, + {0x8003, 80}, + {0x8006, 80}, + {0x800a, 80}, + {0x800f, 80}, + {0x8018, 80}, + {0x801f, 80}, + {0x8029, 80}, + {0xc038, 80}, + }, + /* 53 */ + { + {0x8002, 81}, + {0x8009, 81}, + {0x8017, 81}, + {0xc028, 81}, + {0x8002, 82}, + {0x8009, 82}, + {0x8017, 82}, + {0xc028, 82}, + {0x8002, 83}, + {0x8009, 83}, + {0x8017, 83}, + {0xc028, 83}, + {0x8002, 84}, + {0x8009, 84}, + {0x8017, 84}, + {0xc028, 84}, + }, + /* 54 */ + { + {0x8003, 81}, + {0x8006, 81}, + {0x800a, 81}, + {0x800f, 81}, + {0x8018, 81}, + {0x801f, 81}, + {0x8029, 81}, + {0xc038, 81}, + {0x8003, 82}, + {0x8006, 82}, + {0x800a, 82}, + {0x800f, 82}, + {0x8018, 82}, + {0x801f, 82}, + {0x8029, 82}, + {0xc038, 82}, + }, + /* 55 */ + { + {0x8003, 83}, + {0x8006, 83}, + {0x800a, 83}, + {0x800f, 83}, + {0x8018, 83}, + {0x801f, 83}, + {0x8029, 83}, + {0xc038, 83}, + {0x8003, 84}, + {0x8006, 84}, + {0x800a, 84}, + {0x800f, 84}, + {0x8018, 84}, + {0x801f, 84}, + {0x8029, 84}, + {0xc038, 84}, + }, + /* 56 */ + { + {0xc000, 85}, + {0xc000, 86}, + {0xc000, 87}, + {0xc000, 89}, + {0xc000, 106}, + {0xc000, 107}, + {0xc000, 113}, + {0xc000, 118}, + {0xc000, 119}, + {0xc000, 120}, + {0xc000, 121}, + {0xc000, 122}, + {0x46, 0}, + {0x47, 0}, + {0x49, 0}, + {0x404a, 0}, + }, + /* 57 */ + { + {0x8001, 85}, + {0xc016, 85}, + {0x8001, 86}, + {0xc016, 86}, + {0x8001, 87}, + {0xc016, 87}, + {0x8001, 89}, + {0xc016, 89}, + {0x8001, 106}, + {0xc016, 106}, + {0x8001, 107}, + {0xc016, 107}, + {0x8001, 113}, + {0xc016, 113}, + {0x8001, 118}, + {0xc016, 118}, + }, + /* 58 */ + { + {0x8002, 85}, + {0x8009, 85}, + {0x8017, 85}, + {0xc028, 85}, + {0x8002, 86}, + {0x8009, 86}, + {0x8017, 86}, + {0xc028, 86}, + {0x8002, 87}, + {0x8009, 87}, + {0x8017, 87}, + {0xc028, 87}, + {0x8002, 89}, + {0x8009, 89}, + {0x8017, 89}, + {0xc028, 89}, + }, + /* 59 */ + { + {0x8003, 85}, + {0x8006, 85}, + {0x800a, 85}, + {0x800f, 85}, + {0x8018, 85}, + {0x801f, 85}, + {0x8029, 85}, + {0xc038, 85}, + {0x8003, 86}, + {0x8006, 86}, + {0x800a, 86}, + {0x800f, 86}, + {0x8018, 86}, + {0x801f, 86}, + {0x8029, 86}, + {0xc038, 86}, + }, + /* 60 */ + { + {0x8003, 87}, + {0x8006, 87}, + {0x800a, 87}, + {0x800f, 87}, + {0x8018, 87}, + {0x801f, 87}, + {0x8029, 87}, + {0xc038, 87}, + {0x8003, 89}, + {0x8006, 89}, + {0x800a, 89}, + {0x800f, 89}, + {0x8018, 89}, + {0x801f, 89}, + {0x8029, 89}, + {0xc038, 89}, + }, + /* 61 */ + { + {0x8002, 106}, + {0x8009, 106}, + {0x8017, 106}, + {0xc028, 106}, + {0x8002, 107}, + {0x8009, 107}, + {0x8017, 107}, + {0xc028, 107}, + {0x8002, 113}, + {0x8009, 113}, + {0x8017, 113}, + {0xc028, 113}, + {0x8002, 118}, + {0x8009, 118}, + {0x8017, 118}, + {0xc028, 118}, + }, + /* 62 */ + { + {0x8003, 106}, + {0x8006, 106}, + {0x800a, 106}, + {0x800f, 106}, + {0x8018, 106}, + {0x801f, 106}, + {0x8029, 106}, + {0xc038, 106}, + {0x8003, 107}, + {0x8006, 107}, + {0x800a, 107}, + {0x800f, 107}, + {0x8018, 107}, + {0x801f, 107}, + {0x8029, 107}, + {0xc038, 107}, + }, + /* 63 */ + { + {0x8003, 113}, + {0x8006, 113}, + {0x800a, 113}, + {0x800f, 113}, + {0x8018, 113}, + {0x801f, 113}, + {0x8029, 113}, + {0xc038, 113}, + {0x8003, 118}, + {0x8006, 118}, + {0x800a, 118}, + {0x800f, 118}, + {0x8018, 118}, + {0x801f, 118}, + {0x8029, 118}, + {0xc038, 118}, + }, + /* 64 */ + { + {0x8001, 119}, + {0xc016, 119}, + {0x8001, 120}, + {0xc016, 120}, + {0x8001, 121}, + {0xc016, 121}, + {0x8001, 122}, + {0xc016, 122}, + {0xc000, 38}, + {0xc000, 42}, + {0xc000, 44}, + {0xc000, 59}, + {0xc000, 88}, + {0xc000, 90}, + {0x4b, 0}, + {0x4e, 0}, + }, + /* 65 */ + { + {0x8002, 119}, + {0x8009, 119}, + {0x8017, 119}, + {0xc028, 119}, + {0x8002, 120}, + {0x8009, 120}, + {0x8017, 120}, + {0xc028, 120}, + {0x8002, 121}, + {0x8009, 121}, + {0x8017, 121}, + {0xc028, 121}, + {0x8002, 122}, + {0x8009, 122}, + {0x8017, 122}, + {0xc028, 122}, + }, + /* 66 */ + { + {0x8003, 119}, + {0x8006, 119}, + {0x800a, 119}, + {0x800f, 119}, + {0x8018, 119}, + {0x801f, 119}, + {0x8029, 119}, + {0xc038, 119}, + {0x8003, 120}, + {0x8006, 120}, + {0x800a, 120}, + {0x800f, 120}, + {0x8018, 120}, + {0x801f, 120}, + {0x8029, 120}, + {0xc038, 120}, + }, + /* 67 */ + { + {0x8003, 121}, + {0x8006, 121}, + {0x800a, 121}, + {0x800f, 121}, + {0x8018, 121}, + {0x801f, 121}, + {0x8029, 121}, + {0xc038, 121}, + {0x8003, 122}, + {0x8006, 122}, + {0x800a, 122}, + {0x800f, 122}, + {0x8018, 122}, + {0x801f, 122}, + {0x8029, 122}, + {0xc038, 122}, + }, + /* 68 */ + { + {0x8001, 38}, + {0xc016, 38}, + {0x8001, 42}, + {0xc016, 42}, + {0x8001, 44}, + {0xc016, 44}, + {0x8001, 59}, + {0xc016, 59}, + {0x8001, 88}, + {0xc016, 88}, + {0x8001, 90}, + {0xc016, 90}, + {0x4c, 0}, + {0x4d, 0}, + {0x4f, 0}, + {0x51, 0}, + }, + /* 69 */ + { + {0x8002, 38}, + {0x8009, 38}, + {0x8017, 38}, + {0xc028, 38}, + {0x8002, 42}, + {0x8009, 42}, + {0x8017, 42}, + {0xc028, 42}, + {0x8002, 44}, + {0x8009, 44}, + {0x8017, 44}, + {0xc028, 44}, + {0x8002, 59}, + {0x8009, 59}, + {0x8017, 59}, + {0xc028, 59}, + }, + /* 70 */ + { + {0x8003, 38}, + {0x8006, 38}, + {0x800a, 38}, + {0x800f, 38}, + {0x8018, 38}, + {0x801f, 38}, + {0x8029, 38}, + {0xc038, 38}, + {0x8003, 42}, + {0x8006, 42}, + {0x800a, 42}, + {0x800f, 42}, + {0x8018, 42}, + {0x801f, 42}, + {0x8029, 42}, + {0xc038, 42}, + }, + /* 71 */ + { + {0x8003, 44}, + {0x8006, 44}, + {0x800a, 44}, + {0x800f, 44}, + {0x8018, 44}, + {0x801f, 44}, + {0x8029, 44}, + {0xc038, 44}, + {0x8003, 59}, + {0x8006, 59}, + {0x800a, 59}, + {0x800f, 59}, + {0x8018, 59}, + {0x801f, 59}, + {0x8029, 59}, + {0xc038, 59}, + }, + /* 72 */ + { + {0x8002, 88}, + {0x8009, 88}, + {0x8017, 88}, + {0xc028, 88}, + {0x8002, 90}, + {0x8009, 90}, + {0x8017, 90}, + {0xc028, 90}, + {0xc000, 33}, + {0xc000, 34}, + {0xc000, 40}, + {0xc000, 41}, + {0xc000, 63}, + {0x50, 0}, + {0x52, 0}, + {0x54, 0}, + }, + /* 73 */ + { + {0x8003, 88}, + {0x8006, 88}, + {0x800a, 88}, + {0x800f, 88}, + {0x8018, 88}, + {0x801f, 88}, + {0x8029, 88}, + {0xc038, 88}, + {0x8003, 90}, + {0x8006, 90}, + {0x800a, 90}, + {0x800f, 90}, + {0x8018, 90}, + {0x801f, 90}, + {0x8029, 90}, + {0xc038, 90}, + }, + /* 74 */ + { + {0x8001, 33}, + {0xc016, 33}, + {0x8001, 34}, + {0xc016, 34}, + {0x8001, 40}, + {0xc016, 40}, + {0x8001, 41}, + {0xc016, 41}, + {0x8001, 63}, + {0xc016, 63}, + {0xc000, 39}, + {0xc000, 43}, + {0xc000, 124}, + {0x53, 0}, + {0x55, 0}, + {0x58, 0}, + }, + /* 75 */ + { + {0x8002, 33}, + {0x8009, 33}, + {0x8017, 33}, + {0xc028, 33}, + {0x8002, 34}, + {0x8009, 34}, + {0x8017, 34}, + {0xc028, 34}, + {0x8002, 40}, + {0x8009, 40}, + {0x8017, 40}, + {0xc028, 40}, + {0x8002, 41}, + {0x8009, 41}, + {0x8017, 41}, + {0xc028, 41}, + }, + /* 76 */ + { + {0x8003, 33}, + {0x8006, 33}, + {0x800a, 33}, + {0x800f, 33}, + {0x8018, 33}, + {0x801f, 33}, + {0x8029, 33}, + {0xc038, 33}, + {0x8003, 34}, + {0x8006, 34}, + {0x800a, 34}, + {0x800f, 34}, + {0x8018, 34}, + {0x801f, 34}, + {0x8029, 34}, + {0xc038, 34}, + }, + /* 77 */ + { + {0x8003, 40}, + {0x8006, 40}, + {0x800a, 40}, + {0x800f, 40}, + {0x8018, 40}, + {0x801f, 40}, + {0x8029, 40}, + {0xc038, 40}, + {0x8003, 41}, + {0x8006, 41}, + {0x800a, 41}, + {0x800f, 41}, + {0x8018, 41}, + {0x801f, 41}, + {0x8029, 41}, + {0xc038, 41}, + }, + /* 78 */ + { + {0x8002, 63}, + {0x8009, 63}, + {0x8017, 63}, + {0xc028, 63}, + {0x8001, 39}, + {0xc016, 39}, + {0x8001, 43}, + {0xc016, 43}, + {0x8001, 124}, + {0xc016, 124}, + {0xc000, 35}, + {0xc000, 62}, + {0x56, 0}, + {0x57, 0}, + {0x59, 0}, + {0x5a, 0}, + }, + /* 79 */ + { + {0x8003, 63}, + {0x8006, 63}, + {0x800a, 63}, + {0x800f, 63}, + {0x8018, 63}, + {0x801f, 63}, + {0x8029, 63}, + {0xc038, 63}, + {0x8002, 39}, + {0x8009, 39}, + {0x8017, 39}, + {0xc028, 39}, + {0x8002, 43}, + {0x8009, 43}, + {0x8017, 43}, + {0xc028, 43}, + }, + /* 80 */ + { + {0x8003, 39}, + {0x8006, 39}, + {0x800a, 39}, + {0x800f, 39}, + {0x8018, 39}, + {0x801f, 39}, + {0x8029, 39}, + {0xc038, 39}, + {0x8003, 43}, + {0x8006, 43}, + {0x800a, 43}, + {0x800f, 43}, + {0x8018, 43}, + {0x801f, 43}, + {0x8029, 43}, + {0xc038, 43}, + }, + /* 81 */ + { + {0x8002, 124}, + {0x8009, 124}, + {0x8017, 124}, + {0xc028, 124}, + {0x8001, 35}, + {0xc016, 35}, + {0x8001, 62}, + {0xc016, 62}, + {0xc000, 0}, + {0xc000, 36}, + {0xc000, 64}, + {0xc000, 91}, + {0xc000, 93}, + {0xc000, 126}, + {0x5b, 0}, + {0x5c, 0}, + }, + /* 82 */ + { + {0x8003, 124}, + {0x8006, 124}, + {0x800a, 124}, + {0x800f, 124}, + {0x8018, 124}, + {0x801f, 124}, + {0x8029, 124}, + {0xc038, 124}, + {0x8002, 35}, + {0x8009, 35}, + {0x8017, 35}, + {0xc028, 35}, + {0x8002, 62}, + {0x8009, 62}, + {0x8017, 62}, + {0xc028, 62}, + }, + /* 83 */ + { + {0x8003, 35}, + {0x8006, 35}, + {0x800a, 35}, + {0x800f, 35}, + {0x8018, 35}, + {0x801f, 35}, + {0x8029, 35}, + {0xc038, 35}, + {0x8003, 62}, + {0x8006, 62}, + {0x800a, 62}, + {0x800f, 62}, + {0x8018, 62}, + {0x801f, 62}, + {0x8029, 62}, + {0xc038, 62}, + }, + /* 84 */ + { + {0x8001, 0}, + {0xc016, 0}, + {0x8001, 36}, + {0xc016, 36}, + {0x8001, 64}, + {0xc016, 64}, + {0x8001, 91}, + {0xc016, 91}, + {0x8001, 93}, + {0xc016, 93}, + {0x8001, 126}, + {0xc016, 126}, + {0xc000, 94}, + {0xc000, 125}, + {0x5d, 0}, + {0x5e, 0}, + }, + /* 85 */ + { + {0x8002, 0}, + {0x8009, 0}, + {0x8017, 0}, + {0xc028, 0}, + {0x8002, 36}, + {0x8009, 36}, + {0x8017, 36}, + {0xc028, 36}, + {0x8002, 64}, + {0x8009, 64}, + {0x8017, 64}, + {0xc028, 64}, + {0x8002, 91}, + {0x8009, 91}, + {0x8017, 91}, + {0xc028, 91}, + }, + /* 86 */ + { + {0x8003, 0}, + {0x8006, 0}, + {0x800a, 0}, + {0x800f, 0}, + {0x8018, 0}, + {0x801f, 0}, + {0x8029, 0}, + {0xc038, 0}, + {0x8003, 36}, + {0x8006, 36}, + {0x800a, 36}, + {0x800f, 36}, + {0x8018, 36}, + {0x801f, 36}, + {0x8029, 36}, + {0xc038, 36}, + }, + /* 87 */ + { + {0x8003, 64}, + {0x8006, 64}, + {0x800a, 64}, + {0x800f, 64}, + {0x8018, 64}, + {0x801f, 64}, + {0x8029, 64}, + {0xc038, 64}, + {0x8003, 91}, + {0x8006, 91}, + {0x800a, 91}, + {0x800f, 91}, + {0x8018, 91}, + {0x801f, 91}, + {0x8029, 91}, + {0xc038, 91}, + }, + /* 88 */ + { + {0x8002, 93}, + {0x8009, 93}, + {0x8017, 93}, + {0xc028, 93}, + {0x8002, 126}, + {0x8009, 126}, + {0x8017, 126}, + {0xc028, 126}, + {0x8001, 94}, + {0xc016, 94}, + {0x8001, 125}, + {0xc016, 125}, + {0xc000, 60}, + {0xc000, 96}, + {0xc000, 123}, + {0x5f, 0}, + }, + /* 89 */ + { + {0x8003, 93}, + {0x8006, 93}, + {0x800a, 93}, + {0x800f, 93}, + {0x8018, 93}, + {0x801f, 93}, + {0x8029, 93}, + {0xc038, 93}, + {0x8003, 126}, + {0x8006, 126}, + {0x800a, 126}, + {0x800f, 126}, + {0x8018, 126}, + {0x801f, 126}, + {0x8029, 126}, + {0xc038, 126}, + }, + /* 90 */ + { + {0x8002, 94}, + {0x8009, 94}, + {0x8017, 94}, + {0xc028, 94}, + {0x8002, 125}, + {0x8009, 125}, + {0x8017, 125}, + {0xc028, 125}, + {0x8001, 60}, + {0xc016, 60}, + {0x8001, 96}, + {0xc016, 96}, + {0x8001, 123}, + {0xc016, 123}, + {0x60, 0}, + {0x6e, 0}, + }, + /* 91 */ + { + {0x8003, 94}, + {0x8006, 94}, + {0x800a, 94}, + {0x800f, 94}, + {0x8018, 94}, + {0x801f, 94}, + {0x8029, 94}, + {0xc038, 94}, + {0x8003, 125}, + {0x8006, 125}, + {0x800a, 125}, + {0x800f, 125}, + {0x8018, 125}, + {0x801f, 125}, + {0x8029, 125}, + {0xc038, 125}, + }, + /* 92 */ + { + {0x8002, 60}, + {0x8009, 60}, + {0x8017, 60}, + {0xc028, 60}, + {0x8002, 96}, + {0x8009, 96}, + {0x8017, 96}, + {0xc028, 96}, + {0x8002, 123}, + {0x8009, 123}, + {0x8017, 123}, + {0xc028, 123}, + {0x61, 0}, + {0x65, 0}, + {0x6f, 0}, + {0x85, 0}, + }, + /* 93 */ + { + {0x8003, 60}, + {0x8006, 60}, + {0x800a, 60}, + {0x800f, 60}, + {0x8018, 60}, + {0x801f, 60}, + {0x8029, 60}, + {0xc038, 60}, + {0x8003, 96}, + {0x8006, 96}, + {0x800a, 96}, + {0x800f, 96}, + {0x8018, 96}, + {0x801f, 96}, + {0x8029, 96}, + {0xc038, 96}, + }, + /* 94 */ + { + {0x8003, 123}, + {0x8006, 123}, + {0x800a, 123}, + {0x800f, 123}, + {0x8018, 123}, + {0x801f, 123}, + {0x8029, 123}, + {0xc038, 123}, + {0x62, 0}, + {0x63, 0}, + {0x66, 0}, + {0x69, 0}, + {0x70, 0}, + {0x77, 0}, + {0x86, 0}, + {0x99, 0}, + }, + /* 95 */ + { + {0xc000, 92}, + {0xc000, 195}, + {0xc000, 208}, + {0x64, 0}, + {0x67, 0}, + {0x68, 0}, + {0x6a, 0}, + {0x6b, 0}, + {0x71, 0}, + {0x74, 0}, + {0x78, 0}, + {0x7e, 0}, + {0x87, 0}, + {0x8e, 0}, + {0x9a, 0}, + {0xa9, 0}, + }, + /* 96 */ + { + {0x8001, 92}, + {0xc016, 92}, + {0x8001, 195}, + {0xc016, 195}, + {0x8001, 208}, + {0xc016, 208}, + {0xc000, 128}, + {0xc000, 130}, + {0xc000, 131}, + {0xc000, 162}, + {0xc000, 184}, + {0xc000, 194}, + {0xc000, 224}, + {0xc000, 226}, + {0x6c, 0}, + {0x6d, 0}, + }, + /* 97 */ + { + {0x8002, 92}, + {0x8009, 92}, + {0x8017, 92}, + {0xc028, 92}, + {0x8002, 195}, + {0x8009, 195}, + {0x8017, 195}, + {0xc028, 195}, + {0x8002, 208}, + {0x8009, 208}, + {0x8017, 208}, + {0xc028, 208}, + {0x8001, 128}, + {0xc016, 128}, + {0x8001, 130}, + {0xc016, 130}, + }, + /* 98 */ + { + {0x8003, 92}, + {0x8006, 92}, + {0x800a, 92}, + {0x800f, 92}, + {0x8018, 92}, + {0x801f, 92}, + {0x8029, 92}, + {0xc038, 92}, + {0x8003, 195}, + {0x8006, 195}, + {0x800a, 195}, + {0x800f, 195}, + {0x8018, 195}, + {0x801f, 195}, + {0x8029, 195}, + {0xc038, 195}, + }, + /* 99 */ + { + {0x8003, 208}, + {0x8006, 208}, + {0x800a, 208}, + {0x800f, 208}, + {0x8018, 208}, + {0x801f, 208}, + {0x8029, 208}, + {0xc038, 208}, + {0x8002, 128}, + {0x8009, 128}, + {0x8017, 128}, + {0xc028, 128}, + {0x8002, 130}, + {0x8009, 130}, + {0x8017, 130}, + {0xc028, 130}, + }, + /* 100 */ + { + {0x8003, 128}, + {0x8006, 128}, + {0x800a, 128}, + {0x800f, 128}, + {0x8018, 128}, + {0x801f, 128}, + {0x8029, 128}, + {0xc038, 128}, + {0x8003, 130}, + {0x8006, 130}, + {0x800a, 130}, + {0x800f, 130}, + {0x8018, 130}, + {0x801f, 130}, + {0x8029, 130}, + {0xc038, 130}, + }, + /* 101 */ + { + {0x8001, 131}, + {0xc016, 131}, + {0x8001, 162}, + {0xc016, 162}, + {0x8001, 184}, + {0xc016, 184}, + {0x8001, 194}, + {0xc016, 194}, + {0x8001, 224}, + {0xc016, 224}, + {0x8001, 226}, + {0xc016, 226}, + {0xc000, 153}, + {0xc000, 161}, + {0xc000, 167}, + {0xc000, 172}, + }, + /* 102 */ + { + {0x8002, 131}, + {0x8009, 131}, + {0x8017, 131}, + {0xc028, 131}, + {0x8002, 162}, + {0x8009, 162}, + {0x8017, 162}, + {0xc028, 162}, + {0x8002, 184}, + {0x8009, 184}, + {0x8017, 184}, + {0xc028, 184}, + {0x8002, 194}, + {0x8009, 194}, + {0x8017, 194}, + {0xc028, 194}, + }, + /* 103 */ + { + {0x8003, 131}, + {0x8006, 131}, + {0x800a, 131}, + {0x800f, 131}, + {0x8018, 131}, + {0x801f, 131}, + {0x8029, 131}, + {0xc038, 131}, + {0x8003, 162}, + {0x8006, 162}, + {0x800a, 162}, + {0x800f, 162}, + {0x8018, 162}, + {0x801f, 162}, + {0x8029, 162}, + {0xc038, 162}, + }, + /* 104 */ + { + {0x8003, 184}, + {0x8006, 184}, + {0x800a, 184}, + {0x800f, 184}, + {0x8018, 184}, + {0x801f, 184}, + {0x8029, 184}, + {0xc038, 184}, + {0x8003, 194}, + {0x8006, 194}, + {0x800a, 194}, + {0x800f, 194}, + {0x8018, 194}, + {0x801f, 194}, + {0x8029, 194}, + {0xc038, 194}, + }, + /* 105 */ + { + {0x8002, 224}, + {0x8009, 224}, + {0x8017, 224}, + {0xc028, 224}, + {0x8002, 226}, + {0x8009, 226}, + {0x8017, 226}, + {0xc028, 226}, + {0x8001, 153}, + {0xc016, 153}, + {0x8001, 161}, + {0xc016, 161}, + {0x8001, 167}, + {0xc016, 167}, + {0x8001, 172}, + {0xc016, 172}, + }, + /* 106 */ + { + {0x8003, 224}, + {0x8006, 224}, + {0x800a, 224}, + {0x800f, 224}, + {0x8018, 224}, + {0x801f, 224}, + {0x8029, 224}, + {0xc038, 224}, + {0x8003, 226}, + {0x8006, 226}, + {0x800a, 226}, + {0x800f, 226}, + {0x8018, 226}, + {0x801f, 226}, + {0x8029, 226}, + {0xc038, 226}, + }, + /* 107 */ + { + {0x8002, 153}, + {0x8009, 153}, + {0x8017, 153}, + {0xc028, 153}, + {0x8002, 161}, + {0x8009, 161}, + {0x8017, 161}, + {0xc028, 161}, + {0x8002, 167}, + {0x8009, 167}, + {0x8017, 167}, + {0xc028, 167}, + {0x8002, 172}, + {0x8009, 172}, + {0x8017, 172}, + {0xc028, 172}, + }, + /* 108 */ + { + {0x8003, 153}, + {0x8006, 153}, + {0x800a, 153}, + {0x800f, 153}, + {0x8018, 153}, + {0x801f, 153}, + {0x8029, 153}, + {0xc038, 153}, + {0x8003, 161}, + {0x8006, 161}, + {0x800a, 161}, + {0x800f, 161}, + {0x8018, 161}, + {0x801f, 161}, + {0x8029, 161}, + {0xc038, 161}, + }, + /* 109 */ + { + {0x8003, 167}, + {0x8006, 167}, + {0x800a, 167}, + {0x800f, 167}, + {0x8018, 167}, + {0x801f, 167}, + {0x8029, 167}, + {0xc038, 167}, + {0x8003, 172}, + {0x8006, 172}, + {0x800a, 172}, + {0x800f, 172}, + {0x8018, 172}, + {0x801f, 172}, + {0x8029, 172}, + {0xc038, 172}, + }, + /* 110 */ + { + {0x72, 0}, + {0x73, 0}, + {0x75, 0}, + {0x76, 0}, + {0x79, 0}, + {0x7b, 0}, + {0x7f, 0}, + {0x82, 0}, + {0x88, 0}, + {0x8b, 0}, + {0x8f, 0}, + {0x92, 0}, + {0x9b, 0}, + {0xa2, 0}, + {0xaa, 0}, + {0xb4, 0}, + }, + /* 111 */ + { + {0xc000, 176}, + {0xc000, 177}, + {0xc000, 179}, + {0xc000, 209}, + {0xc000, 216}, + {0xc000, 217}, + {0xc000, 227}, + {0xc000, 229}, + {0xc000, 230}, + {0x7a, 0}, + {0x7c, 0}, + {0x7d, 0}, + {0x80, 0}, + {0x81, 0}, + {0x83, 0}, + {0x84, 0}, + }, + /* 112 */ + { + {0x8001, 176}, + {0xc016, 176}, + {0x8001, 177}, + {0xc016, 177}, + {0x8001, 179}, + {0xc016, 179}, + {0x8001, 209}, + {0xc016, 209}, + {0x8001, 216}, + {0xc016, 216}, + {0x8001, 217}, + {0xc016, 217}, + {0x8001, 227}, + {0xc016, 227}, + {0x8001, 229}, + {0xc016, 229}, + }, + /* 113 */ + { + {0x8002, 176}, + {0x8009, 176}, + {0x8017, 176}, + {0xc028, 176}, + {0x8002, 177}, + {0x8009, 177}, + {0x8017, 177}, + {0xc028, 177}, + {0x8002, 179}, + {0x8009, 179}, + {0x8017, 179}, + {0xc028, 179}, + {0x8002, 209}, + {0x8009, 209}, + {0x8017, 209}, + {0xc028, 209}, + }, + /* 114 */ + { + {0x8003, 176}, + {0x8006, 176}, + {0x800a, 176}, + {0x800f, 176}, + {0x8018, 176}, + {0x801f, 176}, + {0x8029, 176}, + {0xc038, 176}, + {0x8003, 177}, + {0x8006, 177}, + {0x800a, 177}, + {0x800f, 177}, + {0x8018, 177}, + {0x801f, 177}, + {0x8029, 177}, + {0xc038, 177}, + }, + /* 115 */ + { + {0x8003, 179}, + {0x8006, 179}, + {0x800a, 179}, + {0x800f, 179}, + {0x8018, 179}, + {0x801f, 179}, + {0x8029, 179}, + {0xc038, 179}, + {0x8003, 209}, + {0x8006, 209}, + {0x800a, 209}, + {0x800f, 209}, + {0x8018, 209}, + {0x801f, 209}, + {0x8029, 209}, + {0xc038, 209}, + }, + /* 116 */ + { + {0x8002, 216}, + {0x8009, 216}, + {0x8017, 216}, + {0xc028, 216}, + {0x8002, 217}, + {0x8009, 217}, + {0x8017, 217}, + {0xc028, 217}, + {0x8002, 227}, + {0x8009, 227}, + {0x8017, 227}, + {0xc028, 227}, + {0x8002, 229}, + {0x8009, 229}, + {0x8017, 229}, + {0xc028, 229}, + }, + /* 117 */ + { + {0x8003, 216}, + {0x8006, 216}, + {0x800a, 216}, + {0x800f, 216}, + {0x8018, 216}, + {0x801f, 216}, + {0x8029, 216}, + {0xc038, 216}, + {0x8003, 217}, + {0x8006, 217}, + {0x800a, 217}, + {0x800f, 217}, + {0x8018, 217}, + {0x801f, 217}, + {0x8029, 217}, + {0xc038, 217}, + }, + /* 118 */ + { + {0x8003, 227}, + {0x8006, 227}, + {0x800a, 227}, + {0x800f, 227}, + {0x8018, 227}, + {0x801f, 227}, + {0x8029, 227}, + {0xc038, 227}, + {0x8003, 229}, + {0x8006, 229}, + {0x800a, 229}, + {0x800f, 229}, + {0x8018, 229}, + {0x801f, 229}, + {0x8029, 229}, + {0xc038, 229}, + }, + /* 119 */ + { + {0x8001, 230}, + {0xc016, 230}, + {0xc000, 129}, + {0xc000, 132}, + {0xc000, 133}, + {0xc000, 134}, + {0xc000, 136}, + {0xc000, 146}, + {0xc000, 154}, + {0xc000, 156}, + {0xc000, 160}, + {0xc000, 163}, + {0xc000, 164}, + {0xc000, 169}, + {0xc000, 170}, + {0xc000, 173}, + }, + /* 120 */ + { + {0x8002, 230}, + {0x8009, 230}, + {0x8017, 230}, + {0xc028, 230}, + {0x8001, 129}, + {0xc016, 129}, + {0x8001, 132}, + {0xc016, 132}, + {0x8001, 133}, + {0xc016, 133}, + {0x8001, 134}, + {0xc016, 134}, + {0x8001, 136}, + {0xc016, 136}, + {0x8001, 146}, + {0xc016, 146}, + }, + /* 121 */ + { + {0x8003, 230}, + {0x8006, 230}, + {0x800a, 230}, + {0x800f, 230}, + {0x8018, 230}, + {0x801f, 230}, + {0x8029, 230}, + {0xc038, 230}, + {0x8002, 129}, + {0x8009, 129}, + {0x8017, 129}, + {0xc028, 129}, + {0x8002, 132}, + {0x8009, 132}, + {0x8017, 132}, + {0xc028, 132}, + }, + /* 122 */ + { + {0x8003, 129}, + {0x8006, 129}, + {0x800a, 129}, + {0x800f, 129}, + {0x8018, 129}, + {0x801f, 129}, + {0x8029, 129}, + {0xc038, 129}, + {0x8003, 132}, + {0x8006, 132}, + {0x800a, 132}, + {0x800f, 132}, + {0x8018, 132}, + {0x801f, 132}, + {0x8029, 132}, + {0xc038, 132}, + }, + /* 123 */ + { + {0x8002, 133}, + {0x8009, 133}, + {0x8017, 133}, + {0xc028, 133}, + {0x8002, 134}, + {0x8009, 134}, + {0x8017, 134}, + {0xc028, 134}, + {0x8002, 136}, + {0x8009, 136}, + {0x8017, 136}, + {0xc028, 136}, + {0x8002, 146}, + {0x8009, 146}, + {0x8017, 146}, + {0xc028, 146}, + }, + /* 124 */ + { + {0x8003, 133}, + {0x8006, 133}, + {0x800a, 133}, + {0x800f, 133}, + {0x8018, 133}, + {0x801f, 133}, + {0x8029, 133}, + {0xc038, 133}, + {0x8003, 134}, + {0x8006, 134}, + {0x800a, 134}, + {0x800f, 134}, + {0x8018, 134}, + {0x801f, 134}, + {0x8029, 134}, + {0xc038, 134}, + }, + /* 125 */ + { + {0x8003, 136}, + {0x8006, 136}, + {0x800a, 136}, + {0x800f, 136}, + {0x8018, 136}, + {0x801f, 136}, + {0x8029, 136}, + {0xc038, 136}, + {0x8003, 146}, + {0x8006, 146}, + {0x800a, 146}, + {0x800f, 146}, + {0x8018, 146}, + {0x801f, 146}, + {0x8029, 146}, + {0xc038, 146}, + }, + /* 126 */ + { + {0x8001, 154}, + {0xc016, 154}, + {0x8001, 156}, + {0xc016, 156}, + {0x8001, 160}, + {0xc016, 160}, + {0x8001, 163}, + {0xc016, 163}, + {0x8001, 164}, + {0xc016, 164}, + {0x8001, 169}, + {0xc016, 169}, + {0x8001, 170}, + {0xc016, 170}, + {0x8001, 173}, + {0xc016, 173}, + }, + /* 127 */ + { + {0x8002, 154}, + {0x8009, 154}, + {0x8017, 154}, + {0xc028, 154}, + {0x8002, 156}, + {0x8009, 156}, + {0x8017, 156}, + {0xc028, 156}, + {0x8002, 160}, + {0x8009, 160}, + {0x8017, 160}, + {0xc028, 160}, + {0x8002, 163}, + {0x8009, 163}, + {0x8017, 163}, + {0xc028, 163}, + }, + /* 128 */ + { + {0x8003, 154}, + {0x8006, 154}, + {0x800a, 154}, + {0x800f, 154}, + {0x8018, 154}, + {0x801f, 154}, + {0x8029, 154}, + {0xc038, 154}, + {0x8003, 156}, + {0x8006, 156}, + {0x800a, 156}, + {0x800f, 156}, + {0x8018, 156}, + {0x801f, 156}, + {0x8029, 156}, + {0xc038, 156}, + }, + /* 129 */ + { + {0x8003, 160}, + {0x8006, 160}, + {0x800a, 160}, + {0x800f, 160}, + {0x8018, 160}, + {0x801f, 160}, + {0x8029, 160}, + {0xc038, 160}, + {0x8003, 163}, + {0x8006, 163}, + {0x800a, 163}, + {0x800f, 163}, + {0x8018, 163}, + {0x801f, 163}, + {0x8029, 163}, + {0xc038, 163}, + }, + /* 130 */ + { + {0x8002, 164}, + {0x8009, 164}, + {0x8017, 164}, + {0xc028, 164}, + {0x8002, 169}, + {0x8009, 169}, + {0x8017, 169}, + {0xc028, 169}, + {0x8002, 170}, + {0x8009, 170}, + {0x8017, 170}, + {0xc028, 170}, + {0x8002, 173}, + {0x8009, 173}, + {0x8017, 173}, + {0xc028, 173}, + }, + /* 131 */ + { + {0x8003, 164}, + {0x8006, 164}, + {0x800a, 164}, + {0x800f, 164}, + {0x8018, 164}, + {0x801f, 164}, + {0x8029, 164}, + {0xc038, 164}, + {0x8003, 169}, + {0x8006, 169}, + {0x800a, 169}, + {0x800f, 169}, + {0x8018, 169}, + {0x801f, 169}, + {0x8029, 169}, + {0xc038, 169}, + }, + /* 132 */ + { + {0x8003, 170}, + {0x8006, 170}, + {0x800a, 170}, + {0x800f, 170}, + {0x8018, 170}, + {0x801f, 170}, + {0x8029, 170}, + {0xc038, 170}, + {0x8003, 173}, + {0x8006, 173}, + {0x800a, 173}, + {0x800f, 173}, + {0x8018, 173}, + {0x801f, 173}, + {0x8029, 173}, + {0xc038, 173}, + }, + /* 133 */ + { + {0x89, 0}, + {0x8a, 0}, + {0x8c, 0}, + {0x8d, 0}, + {0x90, 0}, + {0x91, 0}, + {0x93, 0}, + {0x96, 0}, + {0x9c, 0}, + {0x9f, 0}, + {0xa3, 0}, + {0xa6, 0}, + {0xab, 0}, + {0xae, 0}, + {0xb5, 0}, + {0xbe, 0}, + }, + /* 134 */ + { + {0xc000, 178}, + {0xc000, 181}, + {0xc000, 185}, + {0xc000, 186}, + {0xc000, 187}, + {0xc000, 189}, + {0xc000, 190}, + {0xc000, 196}, + {0xc000, 198}, + {0xc000, 228}, + {0xc000, 232}, + {0xc000, 233}, + {0x94, 0}, + {0x95, 0}, + {0x97, 0}, + {0x98, 0}, + }, + /* 135 */ + { + {0x8001, 178}, + {0xc016, 178}, + {0x8001, 181}, + {0xc016, 181}, + {0x8001, 185}, + {0xc016, 185}, + {0x8001, 186}, + {0xc016, 186}, + {0x8001, 187}, + {0xc016, 187}, + {0x8001, 189}, + {0xc016, 189}, + {0x8001, 190}, + {0xc016, 190}, + {0x8001, 196}, + {0xc016, 196}, + }, + /* 136 */ + { + {0x8002, 178}, + {0x8009, 178}, + {0x8017, 178}, + {0xc028, 178}, + {0x8002, 181}, + {0x8009, 181}, + {0x8017, 181}, + {0xc028, 181}, + {0x8002, 185}, + {0x8009, 185}, + {0x8017, 185}, + {0xc028, 185}, + {0x8002, 186}, + {0x8009, 186}, + {0x8017, 186}, + {0xc028, 186}, + }, + /* 137 */ + { + {0x8003, 178}, + {0x8006, 178}, + {0x800a, 178}, + {0x800f, 178}, + {0x8018, 178}, + {0x801f, 178}, + {0x8029, 178}, + {0xc038, 178}, + {0x8003, 181}, + {0x8006, 181}, + {0x800a, 181}, + {0x800f, 181}, + {0x8018, 181}, + {0x801f, 181}, + {0x8029, 181}, + {0xc038, 181}, + }, + /* 138 */ + { + {0x8003, 185}, + {0x8006, 185}, + {0x800a, 185}, + {0x800f, 185}, + {0x8018, 185}, + {0x801f, 185}, + {0x8029, 185}, + {0xc038, 185}, + {0x8003, 186}, + {0x8006, 186}, + {0x800a, 186}, + {0x800f, 186}, + {0x8018, 186}, + {0x801f, 186}, + {0x8029, 186}, + {0xc038, 186}, + }, + /* 139 */ + { + {0x8002, 187}, + {0x8009, 187}, + {0x8017, 187}, + {0xc028, 187}, + {0x8002, 189}, + {0x8009, 189}, + {0x8017, 189}, + {0xc028, 189}, + {0x8002, 190}, + {0x8009, 190}, + {0x8017, 190}, + {0xc028, 190}, + {0x8002, 196}, + {0x8009, 196}, + {0x8017, 196}, + {0xc028, 196}, + }, + /* 140 */ + { + {0x8003, 187}, + {0x8006, 187}, + {0x800a, 187}, + {0x800f, 187}, + {0x8018, 187}, + {0x801f, 187}, + {0x8029, 187}, + {0xc038, 187}, + {0x8003, 189}, + {0x8006, 189}, + {0x800a, 189}, + {0x800f, 189}, + {0x8018, 189}, + {0x801f, 189}, + {0x8029, 189}, + {0xc038, 189}, + }, + /* 141 */ + { + {0x8003, 190}, + {0x8006, 190}, + {0x800a, 190}, + {0x800f, 190}, + {0x8018, 190}, + {0x801f, 190}, + {0x8029, 190}, + {0xc038, 190}, + {0x8003, 196}, + {0x8006, 196}, + {0x800a, 196}, + {0x800f, 196}, + {0x8018, 196}, + {0x801f, 196}, + {0x8029, 196}, + {0xc038, 196}, + }, + /* 142 */ + { + {0x8001, 198}, + {0xc016, 198}, + {0x8001, 228}, + {0xc016, 228}, + {0x8001, 232}, + {0xc016, 232}, + {0x8001, 233}, + {0xc016, 233}, + {0xc000, 1}, + {0xc000, 135}, + {0xc000, 137}, + {0xc000, 138}, + {0xc000, 139}, + {0xc000, 140}, + {0xc000, 141}, + {0xc000, 143}, + }, + /* 143 */ + { + {0x8002, 198}, + {0x8009, 198}, + {0x8017, 198}, + {0xc028, 198}, + {0x8002, 228}, + {0x8009, 228}, + {0x8017, 228}, + {0xc028, 228}, + {0x8002, 232}, + {0x8009, 232}, + {0x8017, 232}, + {0xc028, 232}, + {0x8002, 233}, + {0x8009, 233}, + {0x8017, 233}, + {0xc028, 233}, + }, + /* 144 */ + { + {0x8003, 198}, + {0x8006, 198}, + {0x800a, 198}, + {0x800f, 198}, + {0x8018, 198}, + {0x801f, 198}, + {0x8029, 198}, + {0xc038, 198}, + {0x8003, 228}, + {0x8006, 228}, + {0x800a, 228}, + {0x800f, 228}, + {0x8018, 228}, + {0x801f, 228}, + {0x8029, 228}, + {0xc038, 228}, + }, + /* 145 */ + { + {0x8003, 232}, + {0x8006, 232}, + {0x800a, 232}, + {0x800f, 232}, + {0x8018, 232}, + {0x801f, 232}, + {0x8029, 232}, + {0xc038, 232}, + {0x8003, 233}, + {0x8006, 233}, + {0x800a, 233}, + {0x800f, 233}, + {0x8018, 233}, + {0x801f, 233}, + {0x8029, 233}, + {0xc038, 233}, + }, + /* 146 */ + { + {0x8001, 1}, + {0xc016, 1}, + {0x8001, 135}, + {0xc016, 135}, + {0x8001, 137}, + {0xc016, 137}, + {0x8001, 138}, + {0xc016, 138}, + {0x8001, 139}, + {0xc016, 139}, + {0x8001, 140}, + {0xc016, 140}, + {0x8001, 141}, + {0xc016, 141}, + {0x8001, 143}, + {0xc016, 143}, + }, + /* 147 */ + { + {0x8002, 1}, + {0x8009, 1}, + {0x8017, 1}, + {0xc028, 1}, + {0x8002, 135}, + {0x8009, 135}, + {0x8017, 135}, + {0xc028, 135}, + {0x8002, 137}, + {0x8009, 137}, + {0x8017, 137}, + {0xc028, 137}, + {0x8002, 138}, + {0x8009, 138}, + {0x8017, 138}, + {0xc028, 138}, + }, + /* 148 */ + { + {0x8003, 1}, + {0x8006, 1}, + {0x800a, 1}, + {0x800f, 1}, + {0x8018, 1}, + {0x801f, 1}, + {0x8029, 1}, + {0xc038, 1}, + {0x8003, 135}, + {0x8006, 135}, + {0x800a, 135}, + {0x800f, 135}, + {0x8018, 135}, + {0x801f, 135}, + {0x8029, 135}, + {0xc038, 135}, + }, + /* 149 */ + { + {0x8003, 137}, + {0x8006, 137}, + {0x800a, 137}, + {0x800f, 137}, + {0x8018, 137}, + {0x801f, 137}, + {0x8029, 137}, + {0xc038, 137}, + {0x8003, 138}, + {0x8006, 138}, + {0x800a, 138}, + {0x800f, 138}, + {0x8018, 138}, + {0x801f, 138}, + {0x8029, 138}, + {0xc038, 138}, + }, + /* 150 */ + { + {0x8002, 139}, + {0x8009, 139}, + {0x8017, 139}, + {0xc028, 139}, + {0x8002, 140}, + {0x8009, 140}, + {0x8017, 140}, + {0xc028, 140}, + {0x8002, 141}, + {0x8009, 141}, + {0x8017, 141}, + {0xc028, 141}, + {0x8002, 143}, + {0x8009, 143}, + {0x8017, 143}, + {0xc028, 143}, + }, + /* 151 */ + { + {0x8003, 139}, + {0x8006, 139}, + {0x800a, 139}, + {0x800f, 139}, + {0x8018, 139}, + {0x801f, 139}, + {0x8029, 139}, + {0xc038, 139}, + {0x8003, 140}, + {0x8006, 140}, + {0x800a, 140}, + {0x800f, 140}, + {0x8018, 140}, + {0x801f, 140}, + {0x8029, 140}, + {0xc038, 140}, + }, + /* 152 */ + { + {0x8003, 141}, + {0x8006, 141}, + {0x800a, 141}, + {0x800f, 141}, + {0x8018, 141}, + {0x801f, 141}, + {0x8029, 141}, + {0xc038, 141}, + {0x8003, 143}, + {0x8006, 143}, + {0x800a, 143}, + {0x800f, 143}, + {0x8018, 143}, + {0x801f, 143}, + {0x8029, 143}, + {0xc038, 143}, + }, + /* 153 */ + { + {0x9d, 0}, + {0x9e, 0}, + {0xa0, 0}, + {0xa1, 0}, + {0xa4, 0}, + {0xa5, 0}, + {0xa7, 0}, + {0xa8, 0}, + {0xac, 0}, + {0xad, 0}, + {0xaf, 0}, + {0xb1, 0}, + {0xb6, 0}, + {0xb9, 0}, + {0xbf, 0}, + {0xcf, 0}, + }, + /* 154 */ + { + {0xc000, 147}, + {0xc000, 149}, + {0xc000, 150}, + {0xc000, 151}, + {0xc000, 152}, + {0xc000, 155}, + {0xc000, 157}, + {0xc000, 158}, + {0xc000, 165}, + {0xc000, 166}, + {0xc000, 168}, + {0xc000, 174}, + {0xc000, 175}, + {0xc000, 180}, + {0xc000, 182}, + {0xc000, 183}, + }, + /* 155 */ + { + {0x8001, 147}, + {0xc016, 147}, + {0x8001, 149}, + {0xc016, 149}, + {0x8001, 150}, + {0xc016, 150}, + {0x8001, 151}, + {0xc016, 151}, + {0x8001, 152}, + {0xc016, 152}, + {0x8001, 155}, + {0xc016, 155}, + {0x8001, 157}, + {0xc016, 157}, + {0x8001, 158}, + {0xc016, 158}, + }, + /* 156 */ + { + {0x8002, 147}, + {0x8009, 147}, + {0x8017, 147}, + {0xc028, 147}, + {0x8002, 149}, + {0x8009, 149}, + {0x8017, 149}, + {0xc028, 149}, + {0x8002, 150}, + {0x8009, 150}, + {0x8017, 150}, + {0xc028, 150}, + {0x8002, 151}, + {0x8009, 151}, + {0x8017, 151}, + {0xc028, 151}, + }, + /* 157 */ + { + {0x8003, 147}, + {0x8006, 147}, + {0x800a, 147}, + {0x800f, 147}, + {0x8018, 147}, + {0x801f, 147}, + {0x8029, 147}, + {0xc038, 147}, + {0x8003, 149}, + {0x8006, 149}, + {0x800a, 149}, + {0x800f, 149}, + {0x8018, 149}, + {0x801f, 149}, + {0x8029, 149}, + {0xc038, 149}, + }, + /* 158 */ + { + {0x8003, 150}, + {0x8006, 150}, + {0x800a, 150}, + {0x800f, 150}, + {0x8018, 150}, + {0x801f, 150}, + {0x8029, 150}, + {0xc038, 150}, + {0x8003, 151}, + {0x8006, 151}, + {0x800a, 151}, + {0x800f, 151}, + {0x8018, 151}, + {0x801f, 151}, + {0x8029, 151}, + {0xc038, 151}, + }, + /* 159 */ + { + {0x8002, 152}, + {0x8009, 152}, + {0x8017, 152}, + {0xc028, 152}, + {0x8002, 155}, + {0x8009, 155}, + {0x8017, 155}, + {0xc028, 155}, + {0x8002, 157}, + {0x8009, 157}, + {0x8017, 157}, + {0xc028, 157}, + {0x8002, 158}, + {0x8009, 158}, + {0x8017, 158}, + {0xc028, 158}, + }, + /* 160 */ + { + {0x8003, 152}, + {0x8006, 152}, + {0x800a, 152}, + {0x800f, 152}, + {0x8018, 152}, + {0x801f, 152}, + {0x8029, 152}, + {0xc038, 152}, + {0x8003, 155}, + {0x8006, 155}, + {0x800a, 155}, + {0x800f, 155}, + {0x8018, 155}, + {0x801f, 155}, + {0x8029, 155}, + {0xc038, 155}, + }, + /* 161 */ + { + {0x8003, 157}, + {0x8006, 157}, + {0x800a, 157}, + {0x800f, 157}, + {0x8018, 157}, + {0x801f, 157}, + {0x8029, 157}, + {0xc038, 157}, + {0x8003, 158}, + {0x8006, 158}, + {0x800a, 158}, + {0x800f, 158}, + {0x8018, 158}, + {0x801f, 158}, + {0x8029, 158}, + {0xc038, 158}, + }, + /* 162 */ + { + {0x8001, 165}, + {0xc016, 165}, + {0x8001, 166}, + {0xc016, 166}, + {0x8001, 168}, + {0xc016, 168}, + {0x8001, 174}, + {0xc016, 174}, + {0x8001, 175}, + {0xc016, 175}, + {0x8001, 180}, + {0xc016, 180}, + {0x8001, 182}, + {0xc016, 182}, + {0x8001, 183}, + {0xc016, 183}, + }, + /* 163 */ + { + {0x8002, 165}, + {0x8009, 165}, + {0x8017, 165}, + {0xc028, 165}, + {0x8002, 166}, + {0x8009, 166}, + {0x8017, 166}, + {0xc028, 166}, + {0x8002, 168}, + {0x8009, 168}, + {0x8017, 168}, + {0xc028, 168}, + {0x8002, 174}, + {0x8009, 174}, + {0x8017, 174}, + {0xc028, 174}, + }, + /* 164 */ + { + {0x8003, 165}, + {0x8006, 165}, + {0x800a, 165}, + {0x800f, 165}, + {0x8018, 165}, + {0x801f, 165}, + {0x8029, 165}, + {0xc038, 165}, + {0x8003, 166}, + {0x8006, 166}, + {0x800a, 166}, + {0x800f, 166}, + {0x8018, 166}, + {0x801f, 166}, + {0x8029, 166}, + {0xc038, 166}, + }, + /* 165 */ + { + {0x8003, 168}, + {0x8006, 168}, + {0x800a, 168}, + {0x800f, 168}, + {0x8018, 168}, + {0x801f, 168}, + {0x8029, 168}, + {0xc038, 168}, + {0x8003, 174}, + {0x8006, 174}, + {0x800a, 174}, + {0x800f, 174}, + {0x8018, 174}, + {0x801f, 174}, + {0x8029, 174}, + {0xc038, 174}, + }, + /* 166 */ + { + {0x8002, 175}, + {0x8009, 175}, + {0x8017, 175}, + {0xc028, 175}, + {0x8002, 180}, + {0x8009, 180}, + {0x8017, 180}, + {0xc028, 180}, + {0x8002, 182}, + {0x8009, 182}, + {0x8017, 182}, + {0xc028, 182}, + {0x8002, 183}, + {0x8009, 183}, + {0x8017, 183}, + {0xc028, 183}, + }, + /* 167 */ + { + {0x8003, 175}, + {0x8006, 175}, + {0x800a, 175}, + {0x800f, 175}, + {0x8018, 175}, + {0x801f, 175}, + {0x8029, 175}, + {0xc038, 175}, + {0x8003, 180}, + {0x8006, 180}, + {0x800a, 180}, + {0x800f, 180}, + {0x8018, 180}, + {0x801f, 180}, + {0x8029, 180}, + {0xc038, 180}, + }, + /* 168 */ + { + {0x8003, 182}, + {0x8006, 182}, + {0x800a, 182}, + {0x800f, 182}, + {0x8018, 182}, + {0x801f, 182}, + {0x8029, 182}, + {0xc038, 182}, + {0x8003, 183}, + {0x8006, 183}, + {0x800a, 183}, + {0x800f, 183}, + {0x8018, 183}, + {0x801f, 183}, + {0x8029, 183}, + {0xc038, 183}, + }, + /* 169 */ + { + {0xc000, 188}, + {0xc000, 191}, + {0xc000, 197}, + {0xc000, 231}, + {0xc000, 239}, + {0xb0, 0}, + {0xb2, 0}, + {0xb3, 0}, + {0xb7, 0}, + {0xb8, 0}, + {0xba, 0}, + {0xbb, 0}, + {0xc0, 0}, + {0xc7, 0}, + {0xd0, 0}, + {0xdf, 0}, + }, + /* 170 */ + { + {0x8001, 188}, + {0xc016, 188}, + {0x8001, 191}, + {0xc016, 191}, + {0x8001, 197}, + {0xc016, 197}, + {0x8001, 231}, + {0xc016, 231}, + {0x8001, 239}, + {0xc016, 239}, + {0xc000, 9}, + {0xc000, 142}, + {0xc000, 144}, + {0xc000, 145}, + {0xc000, 148}, + {0xc000, 159}, + }, + /* 171 */ + { + {0x8002, 188}, + {0x8009, 188}, + {0x8017, 188}, + {0xc028, 188}, + {0x8002, 191}, + {0x8009, 191}, + {0x8017, 191}, + {0xc028, 191}, + {0x8002, 197}, + {0x8009, 197}, + {0x8017, 197}, + {0xc028, 197}, + {0x8002, 231}, + {0x8009, 231}, + {0x8017, 231}, + {0xc028, 231}, + }, + /* 172 */ + { + {0x8003, 188}, + {0x8006, 188}, + {0x800a, 188}, + {0x800f, 188}, + {0x8018, 188}, + {0x801f, 188}, + {0x8029, 188}, + {0xc038, 188}, + {0x8003, 191}, + {0x8006, 191}, + {0x800a, 191}, + {0x800f, 191}, + {0x8018, 191}, + {0x801f, 191}, + {0x8029, 191}, + {0xc038, 191}, + }, + /* 173 */ + { + {0x8003, 197}, + {0x8006, 197}, + {0x800a, 197}, + {0x800f, 197}, + {0x8018, 197}, + {0x801f, 197}, + {0x8029, 197}, + {0xc038, 197}, + {0x8003, 231}, + {0x8006, 231}, + {0x800a, 231}, + {0x800f, 231}, + {0x8018, 231}, + {0x801f, 231}, + {0x8029, 231}, + {0xc038, 231}, + }, + /* 174 */ + { + {0x8002, 239}, + {0x8009, 239}, + {0x8017, 239}, + {0xc028, 239}, + {0x8001, 9}, + {0xc016, 9}, + {0x8001, 142}, + {0xc016, 142}, + {0x8001, 144}, + {0xc016, 144}, + {0x8001, 145}, + {0xc016, 145}, + {0x8001, 148}, + {0xc016, 148}, + {0x8001, 159}, + {0xc016, 159}, + }, + /* 175 */ + { + {0x8003, 239}, + {0x8006, 239}, + {0x800a, 239}, + {0x800f, 239}, + {0x8018, 239}, + {0x801f, 239}, + {0x8029, 239}, + {0xc038, 239}, + {0x8002, 9}, + {0x8009, 9}, + {0x8017, 9}, + {0xc028, 9}, + {0x8002, 142}, + {0x8009, 142}, + {0x8017, 142}, + {0xc028, 142}, + }, + /* 176 */ + { + {0x8003, 9}, + {0x8006, 9}, + {0x800a, 9}, + {0x800f, 9}, + {0x8018, 9}, + {0x801f, 9}, + {0x8029, 9}, + {0xc038, 9}, + {0x8003, 142}, + {0x8006, 142}, + {0x800a, 142}, + {0x800f, 142}, + {0x8018, 142}, + {0x801f, 142}, + {0x8029, 142}, + {0xc038, 142}, + }, + /* 177 */ + { + {0x8002, 144}, + {0x8009, 144}, + {0x8017, 144}, + {0xc028, 144}, + {0x8002, 145}, + {0x8009, 145}, + {0x8017, 145}, + {0xc028, 145}, + {0x8002, 148}, + {0x8009, 148}, + {0x8017, 148}, + {0xc028, 148}, + {0x8002, 159}, + {0x8009, 159}, + {0x8017, 159}, + {0xc028, 159}, + }, + /* 178 */ + { + {0x8003, 144}, + {0x8006, 144}, + {0x800a, 144}, + {0x800f, 144}, + {0x8018, 144}, + {0x801f, 144}, + {0x8029, 144}, + {0xc038, 144}, + {0x8003, 145}, + {0x8006, 145}, + {0x800a, 145}, + {0x800f, 145}, + {0x8018, 145}, + {0x801f, 145}, + {0x8029, 145}, + {0xc038, 145}, + }, + /* 179 */ + { + {0x8003, 148}, + {0x8006, 148}, + {0x800a, 148}, + {0x800f, 148}, + {0x8018, 148}, + {0x801f, 148}, + {0x8029, 148}, + {0xc038, 148}, + {0x8003, 159}, + {0x8006, 159}, + {0x800a, 159}, + {0x800f, 159}, + {0x8018, 159}, + {0x801f, 159}, + {0x8029, 159}, + {0xc038, 159}, + }, + /* 180 */ + { + {0xc000, 171}, + {0xc000, 206}, + {0xc000, 215}, + {0xc000, 225}, + {0xc000, 236}, + {0xc000, 237}, + {0xbc, 0}, + {0xbd, 0}, + {0xc1, 0}, + {0xc4, 0}, + {0xc8, 0}, + {0xcb, 0}, + {0xd1, 0}, + {0xd8, 0}, + {0xe0, 0}, + {0xee, 0}, + }, + /* 181 */ + { + {0x8001, 171}, + {0xc016, 171}, + {0x8001, 206}, + {0xc016, 206}, + {0x8001, 215}, + {0xc016, 215}, + {0x8001, 225}, + {0xc016, 225}, + {0x8001, 236}, + {0xc016, 236}, + {0x8001, 237}, + {0xc016, 237}, + {0xc000, 199}, + {0xc000, 207}, + {0xc000, 234}, + {0xc000, 235}, + }, + /* 182 */ + { + {0x8002, 171}, + {0x8009, 171}, + {0x8017, 171}, + {0xc028, 171}, + {0x8002, 206}, + {0x8009, 206}, + {0x8017, 206}, + {0xc028, 206}, + {0x8002, 215}, + {0x8009, 215}, + {0x8017, 215}, + {0xc028, 215}, + {0x8002, 225}, + {0x8009, 225}, + {0x8017, 225}, + {0xc028, 225}, + }, + /* 183 */ + { + {0x8003, 171}, + {0x8006, 171}, + {0x800a, 171}, + {0x800f, 171}, + {0x8018, 171}, + {0x801f, 171}, + {0x8029, 171}, + {0xc038, 171}, + {0x8003, 206}, + {0x8006, 206}, + {0x800a, 206}, + {0x800f, 206}, + {0x8018, 206}, + {0x801f, 206}, + {0x8029, 206}, + {0xc038, 206}, + }, + /* 184 */ + { + {0x8003, 215}, + {0x8006, 215}, + {0x800a, 215}, + {0x800f, 215}, + {0x8018, 215}, + {0x801f, 215}, + {0x8029, 215}, + {0xc038, 215}, + {0x8003, 225}, + {0x8006, 225}, + {0x800a, 225}, + {0x800f, 225}, + {0x8018, 225}, + {0x801f, 225}, + {0x8029, 225}, + {0xc038, 225}, + }, + /* 185 */ + { + {0x8002, 236}, + {0x8009, 236}, + {0x8017, 236}, + {0xc028, 236}, + {0x8002, 237}, + {0x8009, 237}, + {0x8017, 237}, + {0xc028, 237}, + {0x8001, 199}, + {0xc016, 199}, + {0x8001, 207}, + {0xc016, 207}, + {0x8001, 234}, + {0xc016, 234}, + {0x8001, 235}, + {0xc016, 235}, + }, + /* 186 */ + { + {0x8003, 236}, + {0x8006, 236}, + {0x800a, 236}, + {0x800f, 236}, + {0x8018, 236}, + {0x801f, 236}, + {0x8029, 236}, + {0xc038, 236}, + {0x8003, 237}, + {0x8006, 237}, + {0x800a, 237}, + {0x800f, 237}, + {0x8018, 237}, + {0x801f, 237}, + {0x8029, 237}, + {0xc038, 237}, + }, + /* 187 */ + { + {0x8002, 199}, + {0x8009, 199}, + {0x8017, 199}, + {0xc028, 199}, + {0x8002, 207}, + {0x8009, 207}, + {0x8017, 207}, + {0xc028, 207}, + {0x8002, 234}, + {0x8009, 234}, + {0x8017, 234}, + {0xc028, 234}, + {0x8002, 235}, + {0x8009, 235}, + {0x8017, 235}, + {0xc028, 235}, + }, + /* 188 */ + { + {0x8003, 199}, + {0x8006, 199}, + {0x800a, 199}, + {0x800f, 199}, + {0x8018, 199}, + {0x801f, 199}, + {0x8029, 199}, + {0xc038, 199}, + {0x8003, 207}, + {0x8006, 207}, + {0x800a, 207}, + {0x800f, 207}, + {0x8018, 207}, + {0x801f, 207}, + {0x8029, 207}, + {0xc038, 207}, + }, + /* 189 */ + { + {0x8003, 234}, + {0x8006, 234}, + {0x800a, 234}, + {0x800f, 234}, + {0x8018, 234}, + {0x801f, 234}, + {0x8029, 234}, + {0xc038, 234}, + {0x8003, 235}, + {0x8006, 235}, + {0x800a, 235}, + {0x800f, 235}, + {0x8018, 235}, + {0x801f, 235}, + {0x8029, 235}, + {0xc038, 235}, + }, + /* 190 */ + { + {0xc2, 0}, + {0xc3, 0}, + {0xc5, 0}, + {0xc6, 0}, + {0xc9, 0}, + {0xca, 0}, + {0xcc, 0}, + {0xcd, 0}, + {0xd2, 0}, + {0xd5, 0}, + {0xd9, 0}, + {0xdc, 0}, + {0xe1, 0}, + {0xe7, 0}, + {0xef, 0}, + {0xf6, 0}, + }, + /* 191 */ + { + {0xc000, 192}, + {0xc000, 193}, + {0xc000, 200}, + {0xc000, 201}, + {0xc000, 202}, + {0xc000, 205}, + {0xc000, 210}, + {0xc000, 213}, + {0xc000, 218}, + {0xc000, 219}, + {0xc000, 238}, + {0xc000, 240}, + {0xc000, 242}, + {0xc000, 243}, + {0xc000, 255}, + {0xce, 0}, + }, + /* 192 */ + { + {0x8001, 192}, + {0xc016, 192}, + {0x8001, 193}, + {0xc016, 193}, + {0x8001, 200}, + {0xc016, 200}, + {0x8001, 201}, + {0xc016, 201}, + {0x8001, 202}, + {0xc016, 202}, + {0x8001, 205}, + {0xc016, 205}, + {0x8001, 210}, + {0xc016, 210}, + {0x8001, 213}, + {0xc016, 213}, + }, + /* 193 */ + { + {0x8002, 192}, + {0x8009, 192}, + {0x8017, 192}, + {0xc028, 192}, + {0x8002, 193}, + {0x8009, 193}, + {0x8017, 193}, + {0xc028, 193}, + {0x8002, 200}, + {0x8009, 200}, + {0x8017, 200}, + {0xc028, 200}, + {0x8002, 201}, + {0x8009, 201}, + {0x8017, 201}, + {0xc028, 201}, + }, + /* 194 */ + { + {0x8003, 192}, + {0x8006, 192}, + {0x800a, 192}, + {0x800f, 192}, + {0x8018, 192}, + {0x801f, 192}, + {0x8029, 192}, + {0xc038, 192}, + {0x8003, 193}, + {0x8006, 193}, + {0x800a, 193}, + {0x800f, 193}, + {0x8018, 193}, + {0x801f, 193}, + {0x8029, 193}, + {0xc038, 193}, + }, + /* 195 */ + { + {0x8003, 200}, + {0x8006, 200}, + {0x800a, 200}, + {0x800f, 200}, + {0x8018, 200}, + {0x801f, 200}, + {0x8029, 200}, + {0xc038, 200}, + {0x8003, 201}, + {0x8006, 201}, + {0x800a, 201}, + {0x800f, 201}, + {0x8018, 201}, + {0x801f, 201}, + {0x8029, 201}, + {0xc038, 201}, + }, + /* 196 */ + { + {0x8002, 202}, + {0x8009, 202}, + {0x8017, 202}, + {0xc028, 202}, + {0x8002, 205}, + {0x8009, 205}, + {0x8017, 205}, + {0xc028, 205}, + {0x8002, 210}, + {0x8009, 210}, + {0x8017, 210}, + {0xc028, 210}, + {0x8002, 213}, + {0x8009, 213}, + {0x8017, 213}, + {0xc028, 213}, + }, + /* 197 */ + { + {0x8003, 202}, + {0x8006, 202}, + {0x800a, 202}, + {0x800f, 202}, + {0x8018, 202}, + {0x801f, 202}, + {0x8029, 202}, + {0xc038, 202}, + {0x8003, 205}, + {0x8006, 205}, + {0x800a, 205}, + {0x800f, 205}, + {0x8018, 205}, + {0x801f, 205}, + {0x8029, 205}, + {0xc038, 205}, + }, + /* 198 */ + { + {0x8003, 210}, + {0x8006, 210}, + {0x800a, 210}, + {0x800f, 210}, + {0x8018, 210}, + {0x801f, 210}, + {0x8029, 210}, + {0xc038, 210}, + {0x8003, 213}, + {0x8006, 213}, + {0x800a, 213}, + {0x800f, 213}, + {0x8018, 213}, + {0x801f, 213}, + {0x8029, 213}, + {0xc038, 213}, + }, + /* 199 */ + { + {0x8001, 218}, + {0xc016, 218}, + {0x8001, 219}, + {0xc016, 219}, + {0x8001, 238}, + {0xc016, 238}, + {0x8001, 240}, + {0xc016, 240}, + {0x8001, 242}, + {0xc016, 242}, + {0x8001, 243}, + {0xc016, 243}, + {0x8001, 255}, + {0xc016, 255}, + {0xc000, 203}, + {0xc000, 204}, + }, + /* 200 */ + { + {0x8002, 218}, + {0x8009, 218}, + {0x8017, 218}, + {0xc028, 218}, + {0x8002, 219}, + {0x8009, 219}, + {0x8017, 219}, + {0xc028, 219}, + {0x8002, 238}, + {0x8009, 238}, + {0x8017, 238}, + {0xc028, 238}, + {0x8002, 240}, + {0x8009, 240}, + {0x8017, 240}, + {0xc028, 240}, + }, + /* 201 */ + { + {0x8003, 218}, + {0x8006, 218}, + {0x800a, 218}, + {0x800f, 218}, + {0x8018, 218}, + {0x801f, 218}, + {0x8029, 218}, + {0xc038, 218}, + {0x8003, 219}, + {0x8006, 219}, + {0x800a, 219}, + {0x800f, 219}, + {0x8018, 219}, + {0x801f, 219}, + {0x8029, 219}, + {0xc038, 219}, + }, + /* 202 */ + { + {0x8003, 238}, + {0x8006, 238}, + {0x800a, 238}, + {0x800f, 238}, + {0x8018, 238}, + {0x801f, 238}, + {0x8029, 238}, + {0xc038, 238}, + {0x8003, 240}, + {0x8006, 240}, + {0x800a, 240}, + {0x800f, 240}, + {0x8018, 240}, + {0x801f, 240}, + {0x8029, 240}, + {0xc038, 240}, + }, + /* 203 */ + { + {0x8002, 242}, + {0x8009, 242}, + {0x8017, 242}, + {0xc028, 242}, + {0x8002, 243}, + {0x8009, 243}, + {0x8017, 243}, + {0xc028, 243}, + {0x8002, 255}, + {0x8009, 255}, + {0x8017, 255}, + {0xc028, 255}, + {0x8001, 203}, + {0xc016, 203}, + {0x8001, 204}, + {0xc016, 204}, + }, + /* 204 */ + { + {0x8003, 242}, + {0x8006, 242}, + {0x800a, 242}, + {0x800f, 242}, + {0x8018, 242}, + {0x801f, 242}, + {0x8029, 242}, + {0xc038, 242}, + {0x8003, 243}, + {0x8006, 243}, + {0x800a, 243}, + {0x800f, 243}, + {0x8018, 243}, + {0x801f, 243}, + {0x8029, 243}, + {0xc038, 243}, + }, + /* 205 */ + { + {0x8003, 255}, + {0x8006, 255}, + {0x800a, 255}, + {0x800f, 255}, + {0x8018, 255}, + {0x801f, 255}, + {0x8029, 255}, + {0xc038, 255}, + {0x8002, 203}, + {0x8009, 203}, + {0x8017, 203}, + {0xc028, 203}, + {0x8002, 204}, + {0x8009, 204}, + {0x8017, 204}, + {0xc028, 204}, + }, + /* 206 */ + { + {0x8003, 203}, + {0x8006, 203}, + {0x800a, 203}, + {0x800f, 203}, + {0x8018, 203}, + {0x801f, 203}, + {0x8029, 203}, + {0xc038, 203}, + {0x8003, 204}, + {0x8006, 204}, + {0x800a, 204}, + {0x800f, 204}, + {0x8018, 204}, + {0x801f, 204}, + {0x8029, 204}, + {0xc038, 204}, + }, + /* 207 */ + { + {0xd3, 0}, + {0xd4, 0}, + {0xd6, 0}, + {0xd7, 0}, + {0xda, 0}, + {0xdb, 0}, + {0xdd, 0}, + {0xde, 0}, + {0xe2, 0}, + {0xe4, 0}, + {0xe8, 0}, + {0xeb, 0}, + {0xf0, 0}, + {0xf3, 0}, + {0xf7, 0}, + {0xfa, 0}, + }, + /* 208 */ + { + {0xc000, 211}, + {0xc000, 212}, + {0xc000, 214}, + {0xc000, 221}, + {0xc000, 222}, + {0xc000, 223}, + {0xc000, 241}, + {0xc000, 244}, + {0xc000, 245}, + {0xc000, 246}, + {0xc000, 247}, + {0xc000, 248}, + {0xc000, 250}, + {0xc000, 251}, + {0xc000, 252}, + {0xc000, 253}, + }, + /* 209 */ + { + {0x8001, 211}, + {0xc016, 211}, + {0x8001, 212}, + {0xc016, 212}, + {0x8001, 214}, + {0xc016, 214}, + {0x8001, 221}, + {0xc016, 221}, + {0x8001, 222}, + {0xc016, 222}, + {0x8001, 223}, + {0xc016, 223}, + {0x8001, 241}, + {0xc016, 241}, + {0x8001, 244}, + {0xc016, 244}, + }, + /* 210 */ + { + {0x8002, 211}, + {0x8009, 211}, + {0x8017, 211}, + {0xc028, 211}, + {0x8002, 212}, + {0x8009, 212}, + {0x8017, 212}, + {0xc028, 212}, + {0x8002, 214}, + {0x8009, 214}, + {0x8017, 214}, + {0xc028, 214}, + {0x8002, 221}, + {0x8009, 221}, + {0x8017, 221}, + {0xc028, 221}, + }, + /* 211 */ + { + {0x8003, 211}, + {0x8006, 211}, + {0x800a, 211}, + {0x800f, 211}, + {0x8018, 211}, + {0x801f, 211}, + {0x8029, 211}, + {0xc038, 211}, + {0x8003, 212}, + {0x8006, 212}, + {0x800a, 212}, + {0x800f, 212}, + {0x8018, 212}, + {0x801f, 212}, + {0x8029, 212}, + {0xc038, 212}, + }, + /* 212 */ + { + {0x8003, 214}, + {0x8006, 214}, + {0x800a, 214}, + {0x800f, 214}, + {0x8018, 214}, + {0x801f, 214}, + {0x8029, 214}, + {0xc038, 214}, + {0x8003, 221}, + {0x8006, 221}, + {0x800a, 221}, + {0x800f, 221}, + {0x8018, 221}, + {0x801f, 221}, + {0x8029, 221}, + {0xc038, 221}, + }, + /* 213 */ + { + {0x8002, 222}, + {0x8009, 222}, + {0x8017, 222}, + {0xc028, 222}, + {0x8002, 223}, + {0x8009, 223}, + {0x8017, 223}, + {0xc028, 223}, + {0x8002, 241}, + {0x8009, 241}, + {0x8017, 241}, + {0xc028, 241}, + {0x8002, 244}, + {0x8009, 244}, + {0x8017, 244}, + {0xc028, 244}, + }, + /* 214 */ + { + {0x8003, 222}, + {0x8006, 222}, + {0x800a, 222}, + {0x800f, 222}, + {0x8018, 222}, + {0x801f, 222}, + {0x8029, 222}, + {0xc038, 222}, + {0x8003, 223}, + {0x8006, 223}, + {0x800a, 223}, + {0x800f, 223}, + {0x8018, 223}, + {0x801f, 223}, + {0x8029, 223}, + {0xc038, 223}, + }, + /* 215 */ + { + {0x8003, 241}, + {0x8006, 241}, + {0x800a, 241}, + {0x800f, 241}, + {0x8018, 241}, + {0x801f, 241}, + {0x8029, 241}, + {0xc038, 241}, + {0x8003, 244}, + {0x8006, 244}, + {0x800a, 244}, + {0x800f, 244}, + {0x8018, 244}, + {0x801f, 244}, + {0x8029, 244}, + {0xc038, 244}, + }, + /* 216 */ + { + {0x8001, 245}, + {0xc016, 245}, + {0x8001, 246}, + {0xc016, 246}, + {0x8001, 247}, + {0xc016, 247}, + {0x8001, 248}, + {0xc016, 248}, + {0x8001, 250}, + {0xc016, 250}, + {0x8001, 251}, + {0xc016, 251}, + {0x8001, 252}, + {0xc016, 252}, + {0x8001, 253}, + {0xc016, 253}, + }, + /* 217 */ + { + {0x8002, 245}, + {0x8009, 245}, + {0x8017, 245}, + {0xc028, 245}, + {0x8002, 246}, + {0x8009, 246}, + {0x8017, 246}, + {0xc028, 246}, + {0x8002, 247}, + {0x8009, 247}, + {0x8017, 247}, + {0xc028, 247}, + {0x8002, 248}, + {0x8009, 248}, + {0x8017, 248}, + {0xc028, 248}, + }, + /* 218 */ + { + {0x8003, 245}, + {0x8006, 245}, + {0x800a, 245}, + {0x800f, 245}, + {0x8018, 245}, + {0x801f, 245}, + {0x8029, 245}, + {0xc038, 245}, + {0x8003, 246}, + {0x8006, 246}, + {0x800a, 246}, + {0x800f, 246}, + {0x8018, 246}, + {0x801f, 246}, + {0x8029, 246}, + {0xc038, 246}, + }, + /* 219 */ + { + {0x8003, 247}, + {0x8006, 247}, + {0x800a, 247}, + {0x800f, 247}, + {0x8018, 247}, + {0x801f, 247}, + {0x8029, 247}, + {0xc038, 247}, + {0x8003, 248}, + {0x8006, 248}, + {0x800a, 248}, + {0x800f, 248}, + {0x8018, 248}, + {0x801f, 248}, + {0x8029, 248}, + {0xc038, 248}, + }, + /* 220 */ + { + {0x8002, 250}, + {0x8009, 250}, + {0x8017, 250}, + {0xc028, 250}, + {0x8002, 251}, + {0x8009, 251}, + {0x8017, 251}, + {0xc028, 251}, + {0x8002, 252}, + {0x8009, 252}, + {0x8017, 252}, + {0xc028, 252}, + {0x8002, 253}, + {0x8009, 253}, + {0x8017, 253}, + {0xc028, 253}, + }, + /* 221 */ + { + {0x8003, 250}, + {0x8006, 250}, + {0x800a, 250}, + {0x800f, 250}, + {0x8018, 250}, + {0x801f, 250}, + {0x8029, 250}, + {0xc038, 250}, + {0x8003, 251}, + {0x8006, 251}, + {0x800a, 251}, + {0x800f, 251}, + {0x8018, 251}, + {0x801f, 251}, + {0x8029, 251}, + {0xc038, 251}, + }, + /* 222 */ + { + {0x8003, 252}, + {0x8006, 252}, + {0x800a, 252}, + {0x800f, 252}, + {0x8018, 252}, + {0x801f, 252}, + {0x8029, 252}, + {0xc038, 252}, + {0x8003, 253}, + {0x8006, 253}, + {0x800a, 253}, + {0x800f, 253}, + {0x8018, 253}, + {0x801f, 253}, + {0x8029, 253}, + {0xc038, 253}, + }, + /* 223 */ + { + {0xc000, 254}, + {0xe3, 0}, + {0xe5, 0}, + {0xe6, 0}, + {0xe9, 0}, + {0xea, 0}, + {0xec, 0}, + {0xed, 0}, + {0xf1, 0}, + {0xf2, 0}, + {0xf4, 0}, + {0xf5, 0}, + {0xf8, 0}, + {0xf9, 0}, + {0xfb, 0}, + {0xfc, 0}, + }, + /* 224 */ + { + {0x8001, 254}, + {0xc016, 254}, + {0xc000, 2}, + {0xc000, 3}, + {0xc000, 4}, + {0xc000, 5}, + {0xc000, 6}, + {0xc000, 7}, + {0xc000, 8}, + {0xc000, 11}, + {0xc000, 12}, + {0xc000, 14}, + {0xc000, 15}, + {0xc000, 16}, + {0xc000, 17}, + {0xc000, 18}, + }, + /* 225 */ + { + {0x8002, 254}, + {0x8009, 254}, + {0x8017, 254}, + {0xc028, 254}, + {0x8001, 2}, + {0xc016, 2}, + {0x8001, 3}, + {0xc016, 3}, + {0x8001, 4}, + {0xc016, 4}, + {0x8001, 5}, + {0xc016, 5}, + {0x8001, 6}, + {0xc016, 6}, + {0x8001, 7}, + {0xc016, 7}, + }, + /* 226 */ + { + {0x8003, 254}, + {0x8006, 254}, + {0x800a, 254}, + {0x800f, 254}, + {0x8018, 254}, + {0x801f, 254}, + {0x8029, 254}, + {0xc038, 254}, + {0x8002, 2}, + {0x8009, 2}, + {0x8017, 2}, + {0xc028, 2}, + {0x8002, 3}, + {0x8009, 3}, + {0x8017, 3}, + {0xc028, 3}, + }, + /* 227 */ + { + {0x8003, 2}, + {0x8006, 2}, + {0x800a, 2}, + {0x800f, 2}, + {0x8018, 2}, + {0x801f, 2}, + {0x8029, 2}, + {0xc038, 2}, + {0x8003, 3}, + {0x8006, 3}, + {0x800a, 3}, + {0x800f, 3}, + {0x8018, 3}, + {0x801f, 3}, + {0x8029, 3}, + {0xc038, 3}, + }, + /* 228 */ + { + {0x8002, 4}, + {0x8009, 4}, + {0x8017, 4}, + {0xc028, 4}, + {0x8002, 5}, + {0x8009, 5}, + {0x8017, 5}, + {0xc028, 5}, + {0x8002, 6}, + {0x8009, 6}, + {0x8017, 6}, + {0xc028, 6}, + {0x8002, 7}, + {0x8009, 7}, + {0x8017, 7}, + {0xc028, 7}, + }, + /* 229 */ + { + {0x8003, 4}, + {0x8006, 4}, + {0x800a, 4}, + {0x800f, 4}, + {0x8018, 4}, + {0x801f, 4}, + {0x8029, 4}, + {0xc038, 4}, + {0x8003, 5}, + {0x8006, 5}, + {0x800a, 5}, + {0x800f, 5}, + {0x8018, 5}, + {0x801f, 5}, + {0x8029, 5}, + {0xc038, 5}, + }, + /* 230 */ + { + {0x8003, 6}, + {0x8006, 6}, + {0x800a, 6}, + {0x800f, 6}, + {0x8018, 6}, + {0x801f, 6}, + {0x8029, 6}, + {0xc038, 6}, + {0x8003, 7}, + {0x8006, 7}, + {0x800a, 7}, + {0x800f, 7}, + {0x8018, 7}, + {0x801f, 7}, + {0x8029, 7}, + {0xc038, 7}, + }, + /* 231 */ + { + {0x8001, 8}, + {0xc016, 8}, + {0x8001, 11}, + {0xc016, 11}, + {0x8001, 12}, + {0xc016, 12}, + {0x8001, 14}, + {0xc016, 14}, + {0x8001, 15}, + {0xc016, 15}, + {0x8001, 16}, + {0xc016, 16}, + {0x8001, 17}, + {0xc016, 17}, + {0x8001, 18}, + {0xc016, 18}, + }, + /* 232 */ + { + {0x8002, 8}, + {0x8009, 8}, + {0x8017, 8}, + {0xc028, 8}, + {0x8002, 11}, + {0x8009, 11}, + {0x8017, 11}, + {0xc028, 11}, + {0x8002, 12}, + {0x8009, 12}, + {0x8017, 12}, + {0xc028, 12}, + {0x8002, 14}, + {0x8009, 14}, + {0x8017, 14}, + {0xc028, 14}, + }, + /* 233 */ + { + {0x8003, 8}, + {0x8006, 8}, + {0x800a, 8}, + {0x800f, 8}, + {0x8018, 8}, + {0x801f, 8}, + {0x8029, 8}, + {0xc038, 8}, + {0x8003, 11}, + {0x8006, 11}, + {0x800a, 11}, + {0x800f, 11}, + {0x8018, 11}, + {0x801f, 11}, + {0x8029, 11}, + {0xc038, 11}, + }, + /* 234 */ + { + {0x8003, 12}, + {0x8006, 12}, + {0x800a, 12}, + {0x800f, 12}, + {0x8018, 12}, + {0x801f, 12}, + {0x8029, 12}, + {0xc038, 12}, + {0x8003, 14}, + {0x8006, 14}, + {0x800a, 14}, + {0x800f, 14}, + {0x8018, 14}, + {0x801f, 14}, + {0x8029, 14}, + {0xc038, 14}, + }, + /* 235 */ + { + {0x8002, 15}, + {0x8009, 15}, + {0x8017, 15}, + {0xc028, 15}, + {0x8002, 16}, + {0x8009, 16}, + {0x8017, 16}, + {0xc028, 16}, + {0x8002, 17}, + {0x8009, 17}, + {0x8017, 17}, + {0xc028, 17}, + {0x8002, 18}, + {0x8009, 18}, + {0x8017, 18}, + {0xc028, 18}, + }, + /* 236 */ + { + {0x8003, 15}, + {0x8006, 15}, + {0x800a, 15}, + {0x800f, 15}, + {0x8018, 15}, + {0x801f, 15}, + {0x8029, 15}, + {0xc038, 15}, + {0x8003, 16}, + {0x8006, 16}, + {0x800a, 16}, + {0x800f, 16}, + {0x8018, 16}, + {0x801f, 16}, + {0x8029, 16}, + {0xc038, 16}, + }, + /* 237 */ + { + {0x8003, 17}, + {0x8006, 17}, + {0x800a, 17}, + {0x800f, 17}, + {0x8018, 17}, + {0x801f, 17}, + {0x8029, 17}, + {0xc038, 17}, + {0x8003, 18}, + {0x8006, 18}, + {0x800a, 18}, + {0x800f, 18}, + {0x8018, 18}, + {0x801f, 18}, + {0x8029, 18}, + {0xc038, 18}, + }, + /* 238 */ + { + {0xc000, 19}, + {0xc000, 20}, + {0xc000, 21}, + {0xc000, 23}, + {0xc000, 24}, + {0xc000, 25}, + {0xc000, 26}, + {0xc000, 27}, + {0xc000, 28}, + {0xc000, 29}, + {0xc000, 30}, + {0xc000, 31}, + {0xc000, 127}, + {0xc000, 220}, + {0xc000, 249}, + {0xfd, 0}, + }, + /* 239 */ + { + {0x8001, 19}, + {0xc016, 19}, + {0x8001, 20}, + {0xc016, 20}, + {0x8001, 21}, + {0xc016, 21}, + {0x8001, 23}, + {0xc016, 23}, + {0x8001, 24}, + {0xc016, 24}, + {0x8001, 25}, + {0xc016, 25}, + {0x8001, 26}, + {0xc016, 26}, + {0x8001, 27}, + {0xc016, 27}, + }, + /* 240 */ + { + {0x8002, 19}, + {0x8009, 19}, + {0x8017, 19}, + {0xc028, 19}, + {0x8002, 20}, + {0x8009, 20}, + {0x8017, 20}, + {0xc028, 20}, + {0x8002, 21}, + {0x8009, 21}, + {0x8017, 21}, + {0xc028, 21}, + {0x8002, 23}, + {0x8009, 23}, + {0x8017, 23}, + {0xc028, 23}, + }, + /* 241 */ + { + {0x8003, 19}, + {0x8006, 19}, + {0x800a, 19}, + {0x800f, 19}, + {0x8018, 19}, + {0x801f, 19}, + {0x8029, 19}, + {0xc038, 19}, + {0x8003, 20}, + {0x8006, 20}, + {0x800a, 20}, + {0x800f, 20}, + {0x8018, 20}, + {0x801f, 20}, + {0x8029, 20}, + {0xc038, 20}, + }, + /* 242 */ + { + {0x8003, 21}, + {0x8006, 21}, + {0x800a, 21}, + {0x800f, 21}, + {0x8018, 21}, + {0x801f, 21}, + {0x8029, 21}, + {0xc038, 21}, + {0x8003, 23}, + {0x8006, 23}, + {0x800a, 23}, + {0x800f, 23}, + {0x8018, 23}, + {0x801f, 23}, + {0x8029, 23}, + {0xc038, 23}, + }, + /* 243 */ + { + {0x8002, 24}, + {0x8009, 24}, + {0x8017, 24}, + {0xc028, 24}, + {0x8002, 25}, + {0x8009, 25}, + {0x8017, 25}, + {0xc028, 25}, + {0x8002, 26}, + {0x8009, 26}, + {0x8017, 26}, + {0xc028, 26}, + {0x8002, 27}, + {0x8009, 27}, + {0x8017, 27}, + {0xc028, 27}, + }, + /* 244 */ + { + {0x8003, 24}, + {0x8006, 24}, + {0x800a, 24}, + {0x800f, 24}, + {0x8018, 24}, + {0x801f, 24}, + {0x8029, 24}, + {0xc038, 24}, + {0x8003, 25}, + {0x8006, 25}, + {0x800a, 25}, + {0x800f, 25}, + {0x8018, 25}, + {0x801f, 25}, + {0x8029, 25}, + {0xc038, 25}, + }, + /* 245 */ + { + {0x8003, 26}, + {0x8006, 26}, + {0x800a, 26}, + {0x800f, 26}, + {0x8018, 26}, + {0x801f, 26}, + {0x8029, 26}, + {0xc038, 26}, + {0x8003, 27}, + {0x8006, 27}, + {0x800a, 27}, + {0x800f, 27}, + {0x8018, 27}, + {0x801f, 27}, + {0x8029, 27}, + {0xc038, 27}, + }, + /* 246 */ + { + {0x8001, 28}, + {0xc016, 28}, + {0x8001, 29}, + {0xc016, 29}, + {0x8001, 30}, + {0xc016, 30}, + {0x8001, 31}, + {0xc016, 31}, + {0x8001, 127}, + {0xc016, 127}, + {0x8001, 220}, + {0xc016, 220}, + {0x8001, 249}, + {0xc016, 249}, + {0xfe, 0}, + {0xff, 0}, + }, + /* 247 */ + { + {0x8002, 28}, + {0x8009, 28}, + {0x8017, 28}, + {0xc028, 28}, + {0x8002, 29}, + {0x8009, 29}, + {0x8017, 29}, + {0xc028, 29}, + {0x8002, 30}, + {0x8009, 30}, + {0x8017, 30}, + {0xc028, 30}, + {0x8002, 31}, + {0x8009, 31}, + {0x8017, 31}, + {0xc028, 31}, + }, + /* 248 */ + { + {0x8003, 28}, + {0x8006, 28}, + {0x800a, 28}, + {0x800f, 28}, + {0x8018, 28}, + {0x801f, 28}, + {0x8029, 28}, + {0xc038, 28}, + {0x8003, 29}, + {0x8006, 29}, + {0x800a, 29}, + {0x800f, 29}, + {0x8018, 29}, + {0x801f, 29}, + {0x8029, 29}, + {0xc038, 29}, + }, + /* 249 */ + { + {0x8003, 30}, + {0x8006, 30}, + {0x800a, 30}, + {0x800f, 30}, + {0x8018, 30}, + {0x801f, 30}, + {0x8029, 30}, + {0xc038, 30}, + {0x8003, 31}, + {0x8006, 31}, + {0x800a, 31}, + {0x800f, 31}, + {0x8018, 31}, + {0x801f, 31}, + {0x8029, 31}, + {0xc038, 31}, + }, + /* 250 */ + { + {0x8002, 127}, + {0x8009, 127}, + {0x8017, 127}, + {0xc028, 127}, + {0x8002, 220}, + {0x8009, 220}, + {0x8017, 220}, + {0xc028, 220}, + {0x8002, 249}, + {0x8009, 249}, + {0x8017, 249}, + {0xc028, 249}, + {0xc000, 10}, + {0xc000, 13}, + {0xc000, 22}, + {0x100, 0}, + }, + /* 251 */ + { + {0x8003, 127}, + {0x8006, 127}, + {0x800a, 127}, + {0x800f, 127}, + {0x8018, 127}, + {0x801f, 127}, + {0x8029, 127}, + {0xc038, 127}, + {0x8003, 220}, + {0x8006, 220}, + {0x800a, 220}, + {0x800f, 220}, + {0x8018, 220}, + {0x801f, 220}, + {0x8029, 220}, + {0xc038, 220}, + }, + /* 252 */ + { + {0x8003, 249}, + {0x8006, 249}, + {0x800a, 249}, + {0x800f, 249}, + {0x8018, 249}, + {0x801f, 249}, + {0x8029, 249}, + {0xc038, 249}, + {0x8001, 10}, + {0xc016, 10}, + {0x8001, 13}, + {0xc016, 13}, + {0x8001, 22}, + {0xc016, 22}, + {0x100, 0}, + {0x100, 0}, + }, + /* 253 */ + { + {0x8002, 10}, + {0x8009, 10}, + {0x8017, 10}, + {0xc028, 10}, + {0x8002, 13}, + {0x8009, 13}, + {0x8017, 13}, + {0xc028, 13}, + {0x8002, 22}, + {0x8009, 22}, + {0x8017, 22}, + {0xc028, 22}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + }, + /* 254 */ + { + {0x8003, 10}, + {0x8006, 10}, + {0x800a, 10}, + {0x800f, 10}, + {0x8018, 10}, + {0x801f, 10}, + {0x8029, 10}, + {0xc038, 10}, + {0x8003, 13}, + {0x8006, 13}, + {0x800a, 13}, + {0x800f, 13}, + {0x8018, 13}, + {0x801f, 13}, + {0x8029, 13}, + {0xc038, 13}, + }, + /* 255 */ + { + {0x8003, 22}, + {0x8006, 22}, + {0x800a, 22}, + {0x800f, 22}, + {0x8018, 22}, + {0x801f, 22}, + {0x8029, 22}, + {0xc038, 22}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + }, + /* 256 */ + { + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + {0x100, 0}, + }, +}; diff --git a/lib/nghttp2-1.65.0/lib/nghttp2_helper.c b/lib/nghttp2-1.65.0/lib/nghttp2_helper.c new file mode 100644 index 00000000000..f54f37c13e2 --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/nghttp2_helper.c @@ -0,0 +1,805 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_helper.h" + +#include +#include + +#include "nghttp2_net.h" + +void nghttp2_put_uint16be(uint8_t *buf, uint16_t n) { + uint16_t x = htons(n); + memcpy(buf, &x, sizeof(uint16_t)); +} + +void nghttp2_put_uint32be(uint8_t *buf, uint32_t n) { + uint32_t x = htonl(n); + memcpy(buf, &x, sizeof(uint32_t)); +} + +uint16_t nghttp2_get_uint16(const uint8_t *data) { + uint16_t n; + memcpy(&n, data, sizeof(uint16_t)); + return ntohs(n); +} + +uint32_t nghttp2_get_uint32(const uint8_t *data) { + uint32_t n; + memcpy(&n, data, sizeof(uint32_t)); + return ntohl(n); +} + +/* Generated by gendowncasetbl.py */ +static const uint8_t DOWNCASE_TBL[] = { + 0 /* NUL */, 1 /* SOH */, 2 /* STX */, 3 /* ETX */, + 4 /* EOT */, 5 /* ENQ */, 6 /* ACK */, 7 /* BEL */, + 8 /* BS */, 9 /* HT */, 10 /* LF */, 11 /* VT */, + 12 /* FF */, 13 /* CR */, 14 /* SO */, 15 /* SI */, + 16 /* DLE */, 17 /* DC1 */, 18 /* DC2 */, 19 /* DC3 */, + 20 /* DC4 */, 21 /* NAK */, 22 /* SYN */, 23 /* ETB */, + 24 /* CAN */, 25 /* EM */, 26 /* SUB */, 27 /* ESC */, + 28 /* FS */, 29 /* GS */, 30 /* RS */, 31 /* US */, + 32 /* SPC */, 33 /* ! */, 34 /* " */, 35 /* # */, + 36 /* $ */, 37 /* % */, 38 /* & */, 39 /* ' */, + 40 /* ( */, 41 /* ) */, 42 /* * */, 43 /* + */, + 44 /* , */, 45 /* - */, 46 /* . */, 47 /* / */, + 48 /* 0 */, 49 /* 1 */, 50 /* 2 */, 51 /* 3 */, + 52 /* 4 */, 53 /* 5 */, 54 /* 6 */, 55 /* 7 */, + 56 /* 8 */, 57 /* 9 */, 58 /* : */, 59 /* ; */, + 60 /* < */, 61 /* = */, 62 /* > */, 63 /* ? */, + 64 /* @ */, 97 /* A */, 98 /* B */, 99 /* C */, + 100 /* D */, 101 /* E */, 102 /* F */, 103 /* G */, + 104 /* H */, 105 /* I */, 106 /* J */, 107 /* K */, + 108 /* L */, 109 /* M */, 110 /* N */, 111 /* O */, + 112 /* P */, 113 /* Q */, 114 /* R */, 115 /* S */, + 116 /* T */, 117 /* U */, 118 /* V */, 119 /* W */, + 120 /* X */, 121 /* Y */, 122 /* Z */, 91 /* [ */, + 92 /* \ */, 93 /* ] */, 94 /* ^ */, 95 /* _ */, + 96 /* ` */, 97 /* a */, 98 /* b */, 99 /* c */, + 100 /* d */, 101 /* e */, 102 /* f */, 103 /* g */, + 104 /* h */, 105 /* i */, 106 /* j */, 107 /* k */, + 108 /* l */, 109 /* m */, 110 /* n */, 111 /* o */, + 112 /* p */, 113 /* q */, 114 /* r */, 115 /* s */, + 116 /* t */, 117 /* u */, 118 /* v */, 119 /* w */, + 120 /* x */, 121 /* y */, 122 /* z */, 123 /* { */, + 124 /* | */, 125 /* } */, 126 /* ~ */, 127 /* DEL */, + 128 /* 0x80 */, 129 /* 0x81 */, 130 /* 0x82 */, 131 /* 0x83 */, + 132 /* 0x84 */, 133 /* 0x85 */, 134 /* 0x86 */, 135 /* 0x87 */, + 136 /* 0x88 */, 137 /* 0x89 */, 138 /* 0x8a */, 139 /* 0x8b */, + 140 /* 0x8c */, 141 /* 0x8d */, 142 /* 0x8e */, 143 /* 0x8f */, + 144 /* 0x90 */, 145 /* 0x91 */, 146 /* 0x92 */, 147 /* 0x93 */, + 148 /* 0x94 */, 149 /* 0x95 */, 150 /* 0x96 */, 151 /* 0x97 */, + 152 /* 0x98 */, 153 /* 0x99 */, 154 /* 0x9a */, 155 /* 0x9b */, + 156 /* 0x9c */, 157 /* 0x9d */, 158 /* 0x9e */, 159 /* 0x9f */, + 160 /* 0xa0 */, 161 /* 0xa1 */, 162 /* 0xa2 */, 163 /* 0xa3 */, + 164 /* 0xa4 */, 165 /* 0xa5 */, 166 /* 0xa6 */, 167 /* 0xa7 */, + 168 /* 0xa8 */, 169 /* 0xa9 */, 170 /* 0xaa */, 171 /* 0xab */, + 172 /* 0xac */, 173 /* 0xad */, 174 /* 0xae */, 175 /* 0xaf */, + 176 /* 0xb0 */, 177 /* 0xb1 */, 178 /* 0xb2 */, 179 /* 0xb3 */, + 180 /* 0xb4 */, 181 /* 0xb5 */, 182 /* 0xb6 */, 183 /* 0xb7 */, + 184 /* 0xb8 */, 185 /* 0xb9 */, 186 /* 0xba */, 187 /* 0xbb */, + 188 /* 0xbc */, 189 /* 0xbd */, 190 /* 0xbe */, 191 /* 0xbf */, + 192 /* 0xc0 */, 193 /* 0xc1 */, 194 /* 0xc2 */, 195 /* 0xc3 */, + 196 /* 0xc4 */, 197 /* 0xc5 */, 198 /* 0xc6 */, 199 /* 0xc7 */, + 200 /* 0xc8 */, 201 /* 0xc9 */, 202 /* 0xca */, 203 /* 0xcb */, + 204 /* 0xcc */, 205 /* 0xcd */, 206 /* 0xce */, 207 /* 0xcf */, + 208 /* 0xd0 */, 209 /* 0xd1 */, 210 /* 0xd2 */, 211 /* 0xd3 */, + 212 /* 0xd4 */, 213 /* 0xd5 */, 214 /* 0xd6 */, 215 /* 0xd7 */, + 216 /* 0xd8 */, 217 /* 0xd9 */, 218 /* 0xda */, 219 /* 0xdb */, + 220 /* 0xdc */, 221 /* 0xdd */, 222 /* 0xde */, 223 /* 0xdf */, + 224 /* 0xe0 */, 225 /* 0xe1 */, 226 /* 0xe2 */, 227 /* 0xe3 */, + 228 /* 0xe4 */, 229 /* 0xe5 */, 230 /* 0xe6 */, 231 /* 0xe7 */, + 232 /* 0xe8 */, 233 /* 0xe9 */, 234 /* 0xea */, 235 /* 0xeb */, + 236 /* 0xec */, 237 /* 0xed */, 238 /* 0xee */, 239 /* 0xef */, + 240 /* 0xf0 */, 241 /* 0xf1 */, 242 /* 0xf2 */, 243 /* 0xf3 */, + 244 /* 0xf4 */, 245 /* 0xf5 */, 246 /* 0xf6 */, 247 /* 0xf7 */, + 248 /* 0xf8 */, 249 /* 0xf9 */, 250 /* 0xfa */, 251 /* 0xfb */, + 252 /* 0xfc */, 253 /* 0xfd */, 254 /* 0xfe */, 255 /* 0xff */, +}; + +void nghttp2_downcase(uint8_t *s, size_t len) { + size_t i; + for (i = 0; i < len; ++i) { + s[i] = DOWNCASE_TBL[s[i]]; + } +} + +/* + * local_window_size + * ^ * + * | * recv_window_size + * | * * ^ + * | * * | + * 0+++++++++ + * | * * \ + * | * * | This rage is hidden in flow control. But it must be + * v * * / kept in order to restore it when window size is enlarged. + * recv_reduction + * (+ for negative direction) + * + * recv_window_size could be negative if we decrease + * local_window_size more than recv_window_size: + * + * local_window_size + * ^ * + * | * + * | * + * 0++++++++ + * | * ^ recv_window_size (negative) + * | * | + * v * * + * recv_reduction + */ +int nghttp2_adjust_local_window_size(int32_t *local_window_size_ptr, + int32_t *recv_window_size_ptr, + int32_t *recv_reduction_ptr, + int32_t *delta_ptr) { + if (*delta_ptr > 0) { + int32_t recv_reduction_delta; + int32_t delta; + int32_t new_recv_window_size = + nghttp2_max_int32(0, *recv_window_size_ptr) - *delta_ptr; + + if (new_recv_window_size >= 0) { + *recv_window_size_ptr = new_recv_window_size; + return 0; + } + + delta = -new_recv_window_size; + + /* The delta size is strictly more than received bytes. Increase + local_window_size by that difference |delta|. */ + if (*local_window_size_ptr > NGHTTP2_MAX_WINDOW_SIZE - delta) { + return NGHTTP2_ERR_FLOW_CONTROL; + } + *local_window_size_ptr += delta; + /* If there is recv_reduction due to earlier window_size + reduction, we have to adjust it too. */ + recv_reduction_delta = nghttp2_min_int32(*recv_reduction_ptr, delta); + *recv_reduction_ptr -= recv_reduction_delta; + if (*recv_window_size_ptr < 0) { + *recv_window_size_ptr += recv_reduction_delta; + } else { + /* If *recv_window_size_ptr > 0, then those bytes are going to + be returned to the remote peer (by WINDOW_UPDATE with the + adjusted *delta_ptr), so it is effectively 0 now. We set to + *recv_reduction_delta, because caller does not take into + account it in *delta_ptr. */ + *recv_window_size_ptr = recv_reduction_delta; + } + /* recv_reduction_delta must be paid from *delta_ptr, since it was + added in window size reduction (see below). */ + *delta_ptr -= recv_reduction_delta; + + return 0; + } + + if (*local_window_size_ptr + *delta_ptr < 0 || + *recv_window_size_ptr < INT32_MIN - *delta_ptr || + *recv_reduction_ptr > INT32_MAX + *delta_ptr) { + return NGHTTP2_ERR_FLOW_CONTROL; + } + /* Decreasing local window size. Note that we achieve this without + noticing to the remote peer. To do this, we cut + recv_window_size by -delta. This means that we don't send + WINDOW_UPDATE for -delta bytes. */ + *local_window_size_ptr += *delta_ptr; + *recv_window_size_ptr += *delta_ptr; + *recv_reduction_ptr -= *delta_ptr; + *delta_ptr = 0; + + return 0; +} + +int nghttp2_increase_local_window_size(int32_t *local_window_size_ptr, + int32_t *recv_window_size_ptr, + int32_t *recv_reduction_ptr, + int32_t *delta_ptr) { + int32_t recv_reduction_delta; + int32_t delta; + + delta = *delta_ptr; + + assert(delta >= 0); + + /* The delta size is strictly more than received bytes. Increase + local_window_size by that difference |delta|. */ + if (*local_window_size_ptr > NGHTTP2_MAX_WINDOW_SIZE - delta) { + return NGHTTP2_ERR_FLOW_CONTROL; + } + + *local_window_size_ptr += delta; + /* If there is recv_reduction due to earlier window_size + reduction, we have to adjust it too. */ + recv_reduction_delta = nghttp2_min_int32(*recv_reduction_ptr, delta); + *recv_reduction_ptr -= recv_reduction_delta; + + *recv_window_size_ptr += recv_reduction_delta; + + /* recv_reduction_delta must be paid from *delta_ptr, since it was + added in window size reduction (see below). */ + *delta_ptr -= recv_reduction_delta; + + return 0; +} + +int nghttp2_should_send_window_update(int32_t local_window_size, + int32_t recv_window_size) { + return recv_window_size > 0 && recv_window_size >= local_window_size / 2; +} + +const char *nghttp2_strerror(int error_code) { + switch (error_code) { + case 0: + return "Success"; + case NGHTTP2_ERR_INVALID_ARGUMENT: + return "Invalid argument"; + case NGHTTP2_ERR_BUFFER_ERROR: + return "Out of buffer space"; + case NGHTTP2_ERR_UNSUPPORTED_VERSION: + return "Unsupported SPDY version"; + case NGHTTP2_ERR_WOULDBLOCK: + return "Operation would block"; + case NGHTTP2_ERR_PROTO: + return "Protocol error"; + case NGHTTP2_ERR_INVALID_FRAME: + return "Invalid frame octets"; + case NGHTTP2_ERR_EOF: + return "EOF"; + case NGHTTP2_ERR_DEFERRED: + return "Data transfer deferred"; + case NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE: + return "No more Stream ID available"; + case NGHTTP2_ERR_STREAM_CLOSED: + return "Stream was already closed or invalid"; + case NGHTTP2_ERR_STREAM_CLOSING: + return "Stream is closing"; + case NGHTTP2_ERR_STREAM_SHUT_WR: + return "The transmission is not allowed for this stream"; + case NGHTTP2_ERR_INVALID_STREAM_ID: + return "Stream ID is invalid"; + case NGHTTP2_ERR_INVALID_STREAM_STATE: + return "Invalid stream state"; + case NGHTTP2_ERR_DEFERRED_DATA_EXIST: + return "Another DATA frame has already been deferred"; + case NGHTTP2_ERR_START_STREAM_NOT_ALLOWED: + return "request HEADERS is not allowed"; + case NGHTTP2_ERR_GOAWAY_ALREADY_SENT: + return "GOAWAY has already been sent"; + case NGHTTP2_ERR_INVALID_HEADER_BLOCK: + return "Invalid header block"; + case NGHTTP2_ERR_INVALID_STATE: + return "Invalid state"; + case NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE: + return "The user callback function failed due to the temporal error"; + case NGHTTP2_ERR_FRAME_SIZE_ERROR: + return "The length of the frame is invalid"; + case NGHTTP2_ERR_HEADER_COMP: + return "Header compression/decompression error"; + case NGHTTP2_ERR_FLOW_CONTROL: + return "Flow control error"; + case NGHTTP2_ERR_INSUFF_BUFSIZE: + return "Insufficient buffer size given to function"; + case NGHTTP2_ERR_PAUSE: + return "Callback was paused by the application"; + case NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS: + return "Too many inflight SETTINGS"; + case NGHTTP2_ERR_PUSH_DISABLED: + return "Server push is disabled by peer"; + case NGHTTP2_ERR_DATA_EXIST: + return "DATA or HEADERS frame has already been submitted for the stream"; + case NGHTTP2_ERR_SESSION_CLOSING: + return "The current session is closing"; + case NGHTTP2_ERR_HTTP_HEADER: + return "Invalid HTTP header field was received"; + case NGHTTP2_ERR_HTTP_MESSAGING: + return "Violation in HTTP messaging rule"; + case NGHTTP2_ERR_REFUSED_STREAM: + return "Stream was refused"; + case NGHTTP2_ERR_INTERNAL: + return "Internal error"; + case NGHTTP2_ERR_CANCEL: + return "Cancel"; + case NGHTTP2_ERR_SETTINGS_EXPECTED: + return "When a local endpoint expects to receive SETTINGS frame, it " + "receives an other type of frame"; + case NGHTTP2_ERR_NOMEM: + return "Out of memory"; + case NGHTTP2_ERR_CALLBACK_FAILURE: + return "The user callback function failed"; + case NGHTTP2_ERR_BAD_CLIENT_MAGIC: + return "Received bad client magic byte string"; + case NGHTTP2_ERR_FLOODED: + return "Flooding was detected in this HTTP/2 session, and it must be " + "closed"; + case NGHTTP2_ERR_TOO_MANY_SETTINGS: + return "SETTINGS frame contained more than the maximum allowed entries"; + case NGHTTP2_ERR_TOO_MANY_CONTINUATIONS: + return "Too many CONTINUATION frames following a HEADER frame"; + default: + return "Unknown error code"; + } +} + +/* Generated by gennmchartbl.py */ +static const int VALID_HD_NAME_CHARS[] = { + 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, + 0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, + 0 /* BS */, 0 /* HT */, 0 /* LF */, 0 /* VT */, + 0 /* FF */, 0 /* CR */, 0 /* SO */, 0 /* SI */, + 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */, + 0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, + 0 /* CAN */, 0 /* EM */, 0 /* SUB */, 0 /* ESC */, + 0 /* FS */, 0 /* GS */, 0 /* RS */, 0 /* US */, + 0 /* SPC */, 1 /* ! */, 0 /* " */, 1 /* # */, + 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */, + 0 /* ( */, 0 /* ) */, 1 /* * */, 1 /* + */, + 0 /* , */, 1 /* - */, 1 /* . */, 0 /* / */, + 1 /* 0 */, 1 /* 1 */, 1 /* 2 */, 1 /* 3 */, + 1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */, + 1 /* 8 */, 1 /* 9 */, 0 /* : */, 0 /* ; */, + 0 /* < */, 0 /* = */, 0 /* > */, 0 /* ? */, + 0 /* @ */, 0 /* A */, 0 /* B */, 0 /* C */, + 0 /* D */, 0 /* E */, 0 /* F */, 0 /* G */, + 0 /* H */, 0 /* I */, 0 /* J */, 0 /* K */, + 0 /* L */, 0 /* M */, 0 /* N */, 0 /* O */, + 0 /* P */, 0 /* Q */, 0 /* R */, 0 /* S */, + 0 /* T */, 0 /* U */, 0 /* V */, 0 /* W */, + 0 /* X */, 0 /* Y */, 0 /* Z */, 0 /* [ */, + 0 /* \ */, 0 /* ] */, 1 /* ^ */, 1 /* _ */, + 1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */, + 1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, + 1 /* h */, 1 /* i */, 1 /* j */, 1 /* k */, + 1 /* l */, 1 /* m */, 1 /* n */, 1 /* o */, + 1 /* p */, 1 /* q */, 1 /* r */, 1 /* s */, + 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */, + 1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */, + 1 /* | */, 0 /* } */, 1 /* ~ */, 0 /* DEL */, + 0 /* 0x80 */, 0 /* 0x81 */, 0 /* 0x82 */, 0 /* 0x83 */, + 0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, 0 /* 0x87 */, + 0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */, + 0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */, + 0 /* 0x90 */, 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */, + 0 /* 0x94 */, 0 /* 0x95 */, 0 /* 0x96 */, 0 /* 0x97 */, + 0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, 0 /* 0x9b */, + 0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */, + 0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */, + 0 /* 0xa4 */, 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */, + 0 /* 0xa8 */, 0 /* 0xa9 */, 0 /* 0xaa */, 0 /* 0xab */, + 0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, 0 /* 0xaf */, + 0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */, + 0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */, + 0 /* 0xb8 */, 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */, + 0 /* 0xbc */, 0 /* 0xbd */, 0 /* 0xbe */, 0 /* 0xbf */, + 0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, 0 /* 0xc3 */, + 0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */, + 0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */, + 0 /* 0xcc */, 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */, + 0 /* 0xd0 */, 0 /* 0xd1 */, 0 /* 0xd2 */, 0 /* 0xd3 */, + 0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, 0 /* 0xd7 */, + 0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */, + 0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */, + 0 /* 0xe0 */, 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */, + 0 /* 0xe4 */, 0 /* 0xe5 */, 0 /* 0xe6 */, 0 /* 0xe7 */, + 0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, 0 /* 0xeb */, + 0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */, + 0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */, + 0 /* 0xf4 */, 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */, + 0 /* 0xf8 */, 0 /* 0xf9 */, 0 /* 0xfa */, 0 /* 0xfb */, + 0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, 0 /* 0xff */ +}; + +int nghttp2_check_header_name(const uint8_t *name, size_t len) { + const uint8_t *last; + if (len == 0) { + return 0; + } + if (*name == ':') { + if (len == 1) { + return 0; + } + ++name; + --len; + } + for (last = name + len; name != last; ++name) { + if (!VALID_HD_NAME_CHARS[*name]) { + return 0; + } + } + return 1; +} + +/* Generated by genvchartbl.py */ +static const int VALID_HD_VALUE_CHARS[] = { + 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, + 0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, + 0 /* BS */, 1 /* HT */, 0 /* LF */, 0 /* VT */, + 0 /* FF */, 0 /* CR */, 0 /* SO */, 0 /* SI */, + 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */, + 0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, + 0 /* CAN */, 0 /* EM */, 0 /* SUB */, 0 /* ESC */, + 0 /* FS */, 0 /* GS */, 0 /* RS */, 0 /* US */, + 1 /* SPC */, 1 /* ! */, 1 /* " */, 1 /* # */, + 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */, + 1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */, + 1 /* , */, 1 /* - */, 1 /* . */, 1 /* / */, + 1 /* 0 */, 1 /* 1 */, 1 /* 2 */, 1 /* 3 */, + 1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */, + 1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */, + 1 /* < */, 1 /* = */, 1 /* > */, 1 /* ? */, + 1 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */, + 1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */, + 1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */, + 1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */, + 1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */, + 1 /* T */, 1 /* U */, 1 /* V */, 1 /* W */, + 1 /* X */, 1 /* Y */, 1 /* Z */, 1 /* [ */, + 1 /* \ */, 1 /* ] */, 1 /* ^ */, 1 /* _ */, + 1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */, + 1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, + 1 /* h */, 1 /* i */, 1 /* j */, 1 /* k */, + 1 /* l */, 1 /* m */, 1 /* n */, 1 /* o */, + 1 /* p */, 1 /* q */, 1 /* r */, 1 /* s */, + 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */, + 1 /* x */, 1 /* y */, 1 /* z */, 1 /* { */, + 1 /* | */, 1 /* } */, 1 /* ~ */, 0 /* DEL */, + 1 /* 0x80 */, 1 /* 0x81 */, 1 /* 0x82 */, 1 /* 0x83 */, + 1 /* 0x84 */, 1 /* 0x85 */, 1 /* 0x86 */, 1 /* 0x87 */, + 1 /* 0x88 */, 1 /* 0x89 */, 1 /* 0x8a */, 1 /* 0x8b */, + 1 /* 0x8c */, 1 /* 0x8d */, 1 /* 0x8e */, 1 /* 0x8f */, + 1 /* 0x90 */, 1 /* 0x91 */, 1 /* 0x92 */, 1 /* 0x93 */, + 1 /* 0x94 */, 1 /* 0x95 */, 1 /* 0x96 */, 1 /* 0x97 */, + 1 /* 0x98 */, 1 /* 0x99 */, 1 /* 0x9a */, 1 /* 0x9b */, + 1 /* 0x9c */, 1 /* 0x9d */, 1 /* 0x9e */, 1 /* 0x9f */, + 1 /* 0xa0 */, 1 /* 0xa1 */, 1 /* 0xa2 */, 1 /* 0xa3 */, + 1 /* 0xa4 */, 1 /* 0xa5 */, 1 /* 0xa6 */, 1 /* 0xa7 */, + 1 /* 0xa8 */, 1 /* 0xa9 */, 1 /* 0xaa */, 1 /* 0xab */, + 1 /* 0xac */, 1 /* 0xad */, 1 /* 0xae */, 1 /* 0xaf */, + 1 /* 0xb0 */, 1 /* 0xb1 */, 1 /* 0xb2 */, 1 /* 0xb3 */, + 1 /* 0xb4 */, 1 /* 0xb5 */, 1 /* 0xb6 */, 1 /* 0xb7 */, + 1 /* 0xb8 */, 1 /* 0xb9 */, 1 /* 0xba */, 1 /* 0xbb */, + 1 /* 0xbc */, 1 /* 0xbd */, 1 /* 0xbe */, 1 /* 0xbf */, + 1 /* 0xc0 */, 1 /* 0xc1 */, 1 /* 0xc2 */, 1 /* 0xc3 */, + 1 /* 0xc4 */, 1 /* 0xc5 */, 1 /* 0xc6 */, 1 /* 0xc7 */, + 1 /* 0xc8 */, 1 /* 0xc9 */, 1 /* 0xca */, 1 /* 0xcb */, + 1 /* 0xcc */, 1 /* 0xcd */, 1 /* 0xce */, 1 /* 0xcf */, + 1 /* 0xd0 */, 1 /* 0xd1 */, 1 /* 0xd2 */, 1 /* 0xd3 */, + 1 /* 0xd4 */, 1 /* 0xd5 */, 1 /* 0xd6 */, 1 /* 0xd7 */, + 1 /* 0xd8 */, 1 /* 0xd9 */, 1 /* 0xda */, 1 /* 0xdb */, + 1 /* 0xdc */, 1 /* 0xdd */, 1 /* 0xde */, 1 /* 0xdf */, + 1 /* 0xe0 */, 1 /* 0xe1 */, 1 /* 0xe2 */, 1 /* 0xe3 */, + 1 /* 0xe4 */, 1 /* 0xe5 */, 1 /* 0xe6 */, 1 /* 0xe7 */, + 1 /* 0xe8 */, 1 /* 0xe9 */, 1 /* 0xea */, 1 /* 0xeb */, + 1 /* 0xec */, 1 /* 0xed */, 1 /* 0xee */, 1 /* 0xef */, + 1 /* 0xf0 */, 1 /* 0xf1 */, 1 /* 0xf2 */, 1 /* 0xf3 */, + 1 /* 0xf4 */, 1 /* 0xf5 */, 1 /* 0xf6 */, 1 /* 0xf7 */, + 1 /* 0xf8 */, 1 /* 0xf9 */, 1 /* 0xfa */, 1 /* 0xfb */, + 1 /* 0xfc */, 1 /* 0xfd */, 1 /* 0xfe */, 1 /* 0xff */ +}; + +int nghttp2_check_header_value(const uint8_t *value, size_t len) { + const uint8_t *last; + for (last = value + len; value != last; ++value) { + if (!VALID_HD_VALUE_CHARS[*value]) { + return 0; + } + } + return 1; +} + +int nghttp2_check_header_value_rfc9113(const uint8_t *value, size_t len) { + if (len == 0) { + return 1; + } + + if (*value == ' ' || *value == '\t' || *(value + len - 1) == ' ' || + *(value + len - 1) == '\t') { + return 0; + } + + return nghttp2_check_header_value(value, len); +} + +/* Generated by genmethodchartbl.py */ +static char VALID_METHOD_CHARS[] = { + 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, + 0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, + 0 /* BS */, 0 /* HT */, 0 /* LF */, 0 /* VT */, + 0 /* FF */, 0 /* CR */, 0 /* SO */, 0 /* SI */, + 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */, + 0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, + 0 /* CAN */, 0 /* EM */, 0 /* SUB */, 0 /* ESC */, + 0 /* FS */, 0 /* GS */, 0 /* RS */, 0 /* US */, + 0 /* SPC */, 1 /* ! */, 0 /* " */, 1 /* # */, + 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */, + 0 /* ( */, 0 /* ) */, 1 /* * */, 1 /* + */, + 0 /* , */, 1 /* - */, 1 /* . */, 0 /* / */, + 1 /* 0 */, 1 /* 1 */, 1 /* 2 */, 1 /* 3 */, + 1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */, + 1 /* 8 */, 1 /* 9 */, 0 /* : */, 0 /* ; */, + 0 /* < */, 0 /* = */, 0 /* > */, 0 /* ? */, + 0 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */, + 1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */, + 1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */, + 1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */, + 1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */, + 1 /* T */, 1 /* U */, 1 /* V */, 1 /* W */, + 1 /* X */, 1 /* Y */, 1 /* Z */, 0 /* [ */, + 0 /* \ */, 0 /* ] */, 1 /* ^ */, 1 /* _ */, + 1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */, + 1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, + 1 /* h */, 1 /* i */, 1 /* j */, 1 /* k */, + 1 /* l */, 1 /* m */, 1 /* n */, 1 /* o */, + 1 /* p */, 1 /* q */, 1 /* r */, 1 /* s */, + 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */, + 1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */, + 1 /* | */, 0 /* } */, 1 /* ~ */, 0 /* DEL */, + 0 /* 0x80 */, 0 /* 0x81 */, 0 /* 0x82 */, 0 /* 0x83 */, + 0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, 0 /* 0x87 */, + 0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */, + 0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */, + 0 /* 0x90 */, 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */, + 0 /* 0x94 */, 0 /* 0x95 */, 0 /* 0x96 */, 0 /* 0x97 */, + 0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, 0 /* 0x9b */, + 0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */, + 0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */, + 0 /* 0xa4 */, 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */, + 0 /* 0xa8 */, 0 /* 0xa9 */, 0 /* 0xaa */, 0 /* 0xab */, + 0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, 0 /* 0xaf */, + 0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */, + 0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */, + 0 /* 0xb8 */, 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */, + 0 /* 0xbc */, 0 /* 0xbd */, 0 /* 0xbe */, 0 /* 0xbf */, + 0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, 0 /* 0xc3 */, + 0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */, + 0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */, + 0 /* 0xcc */, 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */, + 0 /* 0xd0 */, 0 /* 0xd1 */, 0 /* 0xd2 */, 0 /* 0xd3 */, + 0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, 0 /* 0xd7 */, + 0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */, + 0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */, + 0 /* 0xe0 */, 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */, + 0 /* 0xe4 */, 0 /* 0xe5 */, 0 /* 0xe6 */, 0 /* 0xe7 */, + 0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, 0 /* 0xeb */, + 0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */, + 0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */, + 0 /* 0xf4 */, 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */, + 0 /* 0xf8 */, 0 /* 0xf9 */, 0 /* 0xfa */, 0 /* 0xfb */, + 0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, 0 /* 0xff */ +}; + +int nghttp2_check_method(const uint8_t *value, size_t len) { + const uint8_t *last; + if (len == 0) { + return 0; + } + for (last = value + len; value != last; ++value) { + if (!VALID_METHOD_CHARS[*value]) { + return 0; + } + } + return 1; +} + +/* Generated by genpathchartbl.py */ +static char VALID_PATH_CHARS[] = { + 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, + 0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, + 0 /* BS */, 0 /* HT */, 0 /* LF */, 0 /* VT */, + 0 /* FF */, 0 /* CR */, 0 /* SO */, 0 /* SI */, + 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */, + 0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, + 0 /* CAN */, 0 /* EM */, 0 /* SUB */, 0 /* ESC */, + 0 /* FS */, 0 /* GS */, 0 /* RS */, 0 /* US */, + 0 /* SPC */, 1 /* ! */, 1 /* " */, 1 /* # */, + 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */, + 1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */, + 1 /* , */, 1 /* - */, 1 /* . */, 1 /* / */, + 1 /* 0 */, 1 /* 1 */, 1 /* 2 */, 1 /* 3 */, + 1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */, + 1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */, + 1 /* < */, 1 /* = */, 1 /* > */, 1 /* ? */, + 1 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */, + 1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */, + 1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */, + 1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */, + 1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */, + 1 /* T */, 1 /* U */, 1 /* V */, 1 /* W */, + 1 /* X */, 1 /* Y */, 1 /* Z */, 1 /* [ */, + 1 /* \ */, 1 /* ] */, 1 /* ^ */, 1 /* _ */, + 1 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */, + 1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, + 1 /* h */, 1 /* i */, 1 /* j */, 1 /* k */, + 1 /* l */, 1 /* m */, 1 /* n */, 1 /* o */, + 1 /* p */, 1 /* q */, 1 /* r */, 1 /* s */, + 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */, + 1 /* x */, 1 /* y */, 1 /* z */, 1 /* { */, + 1 /* | */, 1 /* } */, 1 /* ~ */, 0 /* DEL */, + 1 /* 0x80 */, 1 /* 0x81 */, 1 /* 0x82 */, 1 /* 0x83 */, + 1 /* 0x84 */, 1 /* 0x85 */, 1 /* 0x86 */, 1 /* 0x87 */, + 1 /* 0x88 */, 1 /* 0x89 */, 1 /* 0x8a */, 1 /* 0x8b */, + 1 /* 0x8c */, 1 /* 0x8d */, 1 /* 0x8e */, 1 /* 0x8f */, + 1 /* 0x90 */, 1 /* 0x91 */, 1 /* 0x92 */, 1 /* 0x93 */, + 1 /* 0x94 */, 1 /* 0x95 */, 1 /* 0x96 */, 1 /* 0x97 */, + 1 /* 0x98 */, 1 /* 0x99 */, 1 /* 0x9a */, 1 /* 0x9b */, + 1 /* 0x9c */, 1 /* 0x9d */, 1 /* 0x9e */, 1 /* 0x9f */, + 1 /* 0xa0 */, 1 /* 0xa1 */, 1 /* 0xa2 */, 1 /* 0xa3 */, + 1 /* 0xa4 */, 1 /* 0xa5 */, 1 /* 0xa6 */, 1 /* 0xa7 */, + 1 /* 0xa8 */, 1 /* 0xa9 */, 1 /* 0xaa */, 1 /* 0xab */, + 1 /* 0xac */, 1 /* 0xad */, 1 /* 0xae */, 1 /* 0xaf */, + 1 /* 0xb0 */, 1 /* 0xb1 */, 1 /* 0xb2 */, 1 /* 0xb3 */, + 1 /* 0xb4 */, 1 /* 0xb5 */, 1 /* 0xb6 */, 1 /* 0xb7 */, + 1 /* 0xb8 */, 1 /* 0xb9 */, 1 /* 0xba */, 1 /* 0xbb */, + 1 /* 0xbc */, 1 /* 0xbd */, 1 /* 0xbe */, 1 /* 0xbf */, + 1 /* 0xc0 */, 1 /* 0xc1 */, 1 /* 0xc2 */, 1 /* 0xc3 */, + 1 /* 0xc4 */, 1 /* 0xc5 */, 1 /* 0xc6 */, 1 /* 0xc7 */, + 1 /* 0xc8 */, 1 /* 0xc9 */, 1 /* 0xca */, 1 /* 0xcb */, + 1 /* 0xcc */, 1 /* 0xcd */, 1 /* 0xce */, 1 /* 0xcf */, + 1 /* 0xd0 */, 1 /* 0xd1 */, 1 /* 0xd2 */, 1 /* 0xd3 */, + 1 /* 0xd4 */, 1 /* 0xd5 */, 1 /* 0xd6 */, 1 /* 0xd7 */, + 1 /* 0xd8 */, 1 /* 0xd9 */, 1 /* 0xda */, 1 /* 0xdb */, + 1 /* 0xdc */, 1 /* 0xdd */, 1 /* 0xde */, 1 /* 0xdf */, + 1 /* 0xe0 */, 1 /* 0xe1 */, 1 /* 0xe2 */, 1 /* 0xe3 */, + 1 /* 0xe4 */, 1 /* 0xe5 */, 1 /* 0xe6 */, 1 /* 0xe7 */, + 1 /* 0xe8 */, 1 /* 0xe9 */, 1 /* 0xea */, 1 /* 0xeb */, + 1 /* 0xec */, 1 /* 0xed */, 1 /* 0xee */, 1 /* 0xef */, + 1 /* 0xf0 */, 1 /* 0xf1 */, 1 /* 0xf2 */, 1 /* 0xf3 */, + 1 /* 0xf4 */, 1 /* 0xf5 */, 1 /* 0xf6 */, 1 /* 0xf7 */, + 1 /* 0xf8 */, 1 /* 0xf9 */, 1 /* 0xfa */, 1 /* 0xfb */, + 1 /* 0xfc */, 1 /* 0xfd */, 1 /* 0xfe */, 1 /* 0xff */ +}; + +int nghttp2_check_path(const uint8_t *value, size_t len) { + const uint8_t *last; + for (last = value + len; value != last; ++value) { + if (!VALID_PATH_CHARS[*value]) { + return 0; + } + } + return 1; +} + +/* Generated by genauthoritychartbl.py */ +static char VALID_AUTHORITY_CHARS[] = { + 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, + 0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, + 0 /* BS */, 0 /* HT */, 0 /* LF */, 0 /* VT */, + 0 /* FF */, 0 /* CR */, 0 /* SO */, 0 /* SI */, + 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */, + 0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, + 0 /* CAN */, 0 /* EM */, 0 /* SUB */, 0 /* ESC */, + 0 /* FS */, 0 /* GS */, 0 /* RS */, 0 /* US */, + 0 /* SPC */, 1 /* ! */, 0 /* " */, 0 /* # */, + 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */, + 1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */, + 1 /* , */, 1 /* - */, 1 /* . */, 0 /* / */, + 1 /* 0 */, 1 /* 1 */, 1 /* 2 */, 1 /* 3 */, + 1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */, + 1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */, + 0 /* < */, 1 /* = */, 0 /* > */, 0 /* ? */, + 1 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */, + 1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */, + 1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */, + 1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */, + 1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */, + 1 /* T */, 1 /* U */, 1 /* V */, 1 /* W */, + 1 /* X */, 1 /* Y */, 1 /* Z */, 1 /* [ */, + 0 /* \ */, 1 /* ] */, 0 /* ^ */, 1 /* _ */, + 0 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */, + 1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, + 1 /* h */, 1 /* i */, 1 /* j */, 1 /* k */, + 1 /* l */, 1 /* m */, 1 /* n */, 1 /* o */, + 1 /* p */, 1 /* q */, 1 /* r */, 1 /* s */, + 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */, + 1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */, + 0 /* | */, 0 /* } */, 1 /* ~ */, 0 /* DEL */, + 0 /* 0x80 */, 0 /* 0x81 */, 0 /* 0x82 */, 0 /* 0x83 */, + 0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, 0 /* 0x87 */, + 0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */, + 0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */, + 0 /* 0x90 */, 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */, + 0 /* 0x94 */, 0 /* 0x95 */, 0 /* 0x96 */, 0 /* 0x97 */, + 0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, 0 /* 0x9b */, + 0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */, + 0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */, + 0 /* 0xa4 */, 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */, + 0 /* 0xa8 */, 0 /* 0xa9 */, 0 /* 0xaa */, 0 /* 0xab */, + 0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, 0 /* 0xaf */, + 0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */, + 0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */, + 0 /* 0xb8 */, 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */, + 0 /* 0xbc */, 0 /* 0xbd */, 0 /* 0xbe */, 0 /* 0xbf */, + 0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, 0 /* 0xc3 */, + 0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */, + 0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */, + 0 /* 0xcc */, 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */, + 0 /* 0xd0 */, 0 /* 0xd1 */, 0 /* 0xd2 */, 0 /* 0xd3 */, + 0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, 0 /* 0xd7 */, + 0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */, + 0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */, + 0 /* 0xe0 */, 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */, + 0 /* 0xe4 */, 0 /* 0xe5 */, 0 /* 0xe6 */, 0 /* 0xe7 */, + 0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, 0 /* 0xeb */, + 0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */, + 0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */, + 0 /* 0xf4 */, 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */, + 0 /* 0xf8 */, 0 /* 0xf9 */, 0 /* 0xfa */, 0 /* 0xfb */, + 0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, 0 /* 0xff */ +}; + +int nghttp2_check_authority(const uint8_t *value, size_t len) { + const uint8_t *last; + for (last = value + len; value != last; ++value) { + if (!VALID_AUTHORITY_CHARS[*value]) { + return 0; + } + } + return 1; +} + +uint8_t *nghttp2_cpymem(uint8_t *dest, const void *src, size_t len) { + if (len == 0) { + return dest; + } + + memcpy(dest, src, len); + + return dest + len; +} + +const char *nghttp2_http2_strerror(uint32_t error_code) { + switch (error_code) { + case NGHTTP2_NO_ERROR: + return "NO_ERROR"; + case NGHTTP2_PROTOCOL_ERROR: + return "PROTOCOL_ERROR"; + case NGHTTP2_INTERNAL_ERROR: + return "INTERNAL_ERROR"; + case NGHTTP2_FLOW_CONTROL_ERROR: + return "FLOW_CONTROL_ERROR"; + case NGHTTP2_SETTINGS_TIMEOUT: + return "SETTINGS_TIMEOUT"; + case NGHTTP2_STREAM_CLOSED: + return "STREAM_CLOSED"; + case NGHTTP2_FRAME_SIZE_ERROR: + return "FRAME_SIZE_ERROR"; + case NGHTTP2_REFUSED_STREAM: + return "REFUSED_STREAM"; + case NGHTTP2_CANCEL: + return "CANCEL"; + case NGHTTP2_COMPRESSION_ERROR: + return "COMPRESSION_ERROR"; + case NGHTTP2_CONNECT_ERROR: + return "CONNECT_ERROR"; + case NGHTTP2_ENHANCE_YOUR_CALM: + return "ENHANCE_YOUR_CALM"; + case NGHTTP2_INADEQUATE_SECURITY: + return "INADEQUATE_SECURITY"; + case NGHTTP2_HTTP_1_1_REQUIRED: + return "HTTP_1_1_REQUIRED"; + default: + return "unknown"; + } +} diff --git a/lib/nghttp2/lib/nghttp2_helper.h b/lib/nghttp2-1.65.0/lib/nghttp2_helper.h similarity index 81% rename from lib/nghttp2/lib/nghttp2_helper.h rename to lib/nghttp2-1.65.0/lib/nghttp2_helper.h index b1f18ce541a..f5de6290dab 100644 --- a/lib/nghttp2/lib/nghttp2_helper.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_helper.h @@ -35,13 +35,36 @@ #include #include "nghttp2_mem.h" -#define nghttp2_min(A, B) ((A) < (B) ? (A) : (B)) -#define nghttp2_max(A, B) ((A) > (B) ? (A) : (B)) +#define nghttp2_max_def(SUFFIX, T) \ + static inline T nghttp2_max_##SUFFIX(T a, T b) { return a < b ? b : a; } + +nghttp2_max_def(int8, int8_t) +nghttp2_max_def(int16, int16_t) +nghttp2_max_def(int32, int32_t) +nghttp2_max_def(int64, int64_t) +nghttp2_max_def(uint8, uint8_t) +nghttp2_max_def(uint16, uint16_t) +nghttp2_max_def(uint32, uint32_t) +nghttp2_max_def(uint64, uint64_t) +nghttp2_max_def(size, size_t) + +#define nghttp2_min_def(SUFFIX, T) \ + static inline T nghttp2_min_##SUFFIX(T a, T b) { return a < b ? a : b; } + +nghttp2_min_def(int8, int8_t) +nghttp2_min_def(int16, int16_t) +nghttp2_min_def(int32, int32_t) +nghttp2_min_def(int64, int64_t) +nghttp2_min_def(uint8, uint8_t) +nghttp2_min_def(uint16, uint16_t) +nghttp2_min_def(uint32, uint32_t) +nghttp2_min_def(uint64, uint64_t) +nghttp2_min_def(size, size_t) #define lstreq(A, B, N) ((sizeof((A)) - 1) == (N) && memcmp((A), (B), (N)) == 0) #define nghttp2_struct_of(ptr, type, member) \ - ((type *)(void *)((char *)(ptr)-offsetof(type, member))) + ((type *)(void *)((char *)(ptr) - offsetof(type, member))) /* * Copies 2 byte unsigned integer |n| in host byte order to |buf| in diff --git a/lib/nghttp2/lib/nghttp2_http.c b/lib/nghttp2-1.65.0/lib/nghttp2_http.c similarity index 79% rename from lib/nghttp2/lib/nghttp2_http.c rename to lib/nghttp2-1.65.0/lib/nghttp2_http.c index ecdeb21ddb6..60a0b01e66c 100644 --- a/lib/nghttp2/lib/nghttp2_http.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_http.c @@ -207,7 +207,6 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_hd_nv *nv, if (!trailer && /* Do not parse the header field in PUSH_PROMISE. */ (stream->stream_id & 1) && - (stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES) && !(stream->http_flags & NGHTTP2_HTTP_FLAG_BAD_PRIORITY)) { nghttp2_extpri_from_uint8(&extpri, stream->http_extpri); if (nghttp2_http_parse_priority(&extpri, nv->value->base, @@ -347,6 +346,84 @@ static int lws(const uint8_t *s, size_t n) { return 1; } +/* Generated by genauthoritychartbl.py, but '@' is not allowed */ +static char VALID_AUTHORITY_CHARS[] = { + 0 /* NUL */, 0 /* SOH */, 0 /* STX */, 0 /* ETX */, + 0 /* EOT */, 0 /* ENQ */, 0 /* ACK */, 0 /* BEL */, + 0 /* BS */, 0 /* HT */, 0 /* LF */, 0 /* VT */, + 0 /* FF */, 0 /* CR */, 0 /* SO */, 0 /* SI */, + 0 /* DLE */, 0 /* DC1 */, 0 /* DC2 */, 0 /* DC3 */, + 0 /* DC4 */, 0 /* NAK */, 0 /* SYN */, 0 /* ETB */, + 0 /* CAN */, 0 /* EM */, 0 /* SUB */, 0 /* ESC */, + 0 /* FS */, 0 /* GS */, 0 /* RS */, 0 /* US */, + 0 /* SPC */, 1 /* ! */, 0 /* " */, 0 /* # */, + 1 /* $ */, 1 /* % */, 1 /* & */, 1 /* ' */, + 1 /* ( */, 1 /* ) */, 1 /* * */, 1 /* + */, + 1 /* , */, 1 /* - */, 1 /* . */, 0 /* / */, + 1 /* 0 */, 1 /* 1 */, 1 /* 2 */, 1 /* 3 */, + 1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */, + 1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */, + 0 /* < */, 1 /* = */, 0 /* > */, 0 /* ? */, + 0 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */, + 1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */, + 1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */, + 1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */, + 1 /* P */, 1 /* Q */, 1 /* R */, 1 /* S */, + 1 /* T */, 1 /* U */, 1 /* V */, 1 /* W */, + 1 /* X */, 1 /* Y */, 1 /* Z */, 1 /* [ */, + 0 /* \ */, 1 /* ] */, 0 /* ^ */, 1 /* _ */, + 0 /* ` */, 1 /* a */, 1 /* b */, 1 /* c */, + 1 /* d */, 1 /* e */, 1 /* f */, 1 /* g */, + 1 /* h */, 1 /* i */, 1 /* j */, 1 /* k */, + 1 /* l */, 1 /* m */, 1 /* n */, 1 /* o */, + 1 /* p */, 1 /* q */, 1 /* r */, 1 /* s */, + 1 /* t */, 1 /* u */, 1 /* v */, 1 /* w */, + 1 /* x */, 1 /* y */, 1 /* z */, 0 /* { */, + 0 /* | */, 0 /* } */, 1 /* ~ */, 0 /* DEL */, + 0 /* 0x80 */, 0 /* 0x81 */, 0 /* 0x82 */, 0 /* 0x83 */, + 0 /* 0x84 */, 0 /* 0x85 */, 0 /* 0x86 */, 0 /* 0x87 */, + 0 /* 0x88 */, 0 /* 0x89 */, 0 /* 0x8a */, 0 /* 0x8b */, + 0 /* 0x8c */, 0 /* 0x8d */, 0 /* 0x8e */, 0 /* 0x8f */, + 0 /* 0x90 */, 0 /* 0x91 */, 0 /* 0x92 */, 0 /* 0x93 */, + 0 /* 0x94 */, 0 /* 0x95 */, 0 /* 0x96 */, 0 /* 0x97 */, + 0 /* 0x98 */, 0 /* 0x99 */, 0 /* 0x9a */, 0 /* 0x9b */, + 0 /* 0x9c */, 0 /* 0x9d */, 0 /* 0x9e */, 0 /* 0x9f */, + 0 /* 0xa0 */, 0 /* 0xa1 */, 0 /* 0xa2 */, 0 /* 0xa3 */, + 0 /* 0xa4 */, 0 /* 0xa5 */, 0 /* 0xa6 */, 0 /* 0xa7 */, + 0 /* 0xa8 */, 0 /* 0xa9 */, 0 /* 0xaa */, 0 /* 0xab */, + 0 /* 0xac */, 0 /* 0xad */, 0 /* 0xae */, 0 /* 0xaf */, + 0 /* 0xb0 */, 0 /* 0xb1 */, 0 /* 0xb2 */, 0 /* 0xb3 */, + 0 /* 0xb4 */, 0 /* 0xb5 */, 0 /* 0xb6 */, 0 /* 0xb7 */, + 0 /* 0xb8 */, 0 /* 0xb9 */, 0 /* 0xba */, 0 /* 0xbb */, + 0 /* 0xbc */, 0 /* 0xbd */, 0 /* 0xbe */, 0 /* 0xbf */, + 0 /* 0xc0 */, 0 /* 0xc1 */, 0 /* 0xc2 */, 0 /* 0xc3 */, + 0 /* 0xc4 */, 0 /* 0xc5 */, 0 /* 0xc6 */, 0 /* 0xc7 */, + 0 /* 0xc8 */, 0 /* 0xc9 */, 0 /* 0xca */, 0 /* 0xcb */, + 0 /* 0xcc */, 0 /* 0xcd */, 0 /* 0xce */, 0 /* 0xcf */, + 0 /* 0xd0 */, 0 /* 0xd1 */, 0 /* 0xd2 */, 0 /* 0xd3 */, + 0 /* 0xd4 */, 0 /* 0xd5 */, 0 /* 0xd6 */, 0 /* 0xd7 */, + 0 /* 0xd8 */, 0 /* 0xd9 */, 0 /* 0xda */, 0 /* 0xdb */, + 0 /* 0xdc */, 0 /* 0xdd */, 0 /* 0xde */, 0 /* 0xdf */, + 0 /* 0xe0 */, 0 /* 0xe1 */, 0 /* 0xe2 */, 0 /* 0xe3 */, + 0 /* 0xe4 */, 0 /* 0xe5 */, 0 /* 0xe6 */, 0 /* 0xe7 */, + 0 /* 0xe8 */, 0 /* 0xe9 */, 0 /* 0xea */, 0 /* 0xeb */, + 0 /* 0xec */, 0 /* 0xed */, 0 /* 0xee */, 0 /* 0xef */, + 0 /* 0xf0 */, 0 /* 0xf1 */, 0 /* 0xf2 */, 0 /* 0xf3 */, + 0 /* 0xf4 */, 0 /* 0xf5 */, 0 /* 0xf6 */, 0 /* 0xf7 */, + 0 /* 0xf8 */, 0 /* 0xf9 */, 0 /* 0xfa */, 0 /* 0xfb */, + 0 /* 0xfc */, 0 /* 0xfd */, 0 /* 0xfe */, 0 /* 0xff */ +}; + +static int check_authority(const uint8_t *value, size_t len) { + const uint8_t *last; + for (last = value + len; value != last; ++value) { + if (!VALID_AUTHORITY_CHARS[*value]) { + return 0; + } + } + return 1; +} + int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream, nghttp2_frame *frame, nghttp2_hd_nv *nv, int trailer) { @@ -388,10 +465,10 @@ int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream, case NGHTTP2_TOKEN__AUTHORITY: case NGHTTP2_TOKEN_HOST: if (session->server || frame->hd.type == NGHTTP2_PUSH_PROMISE) { - rv = nghttp2_check_authority(nv->value->base, nv->value->len); + rv = check_authority(nv->value->base, nv->value->len); } else if ( - stream->flags & - NGHTTP2_STREAM_FLAG_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION) { + stream->flags & + NGHTTP2_STREAM_FLAG_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION) { rv = nghttp2_check_header_value(nv->value->base, nv->value->len); } else { rv = nghttp2_check_header_value_rfc9113(nv->value->base, nv->value->len); @@ -435,7 +512,7 @@ int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream, if (session->server || frame->hd.type == NGHTTP2_PUSH_PROMISE) { return http_request_on_header(stream, nv, trailer, session->server && - session->pending_enable_connect_protocol); + session->pending_enable_connect_protocol); } return http_response_on_header(stream, nv, trailer); @@ -453,7 +530,7 @@ int nghttp2_http_on_request_headers(nghttp2_stream *stream, stream->content_length = -1; } else { if ((stream->http_flags & NGHTTP2_HTTP_FLAG_REQ_HEADERS) != - NGHTTP2_HTTP_FLAG_REQ_HEADERS || + NGHTTP2_HTTP_FLAG_REQ_HEADERS || (stream->http_flags & (NGHTTP2_HTTP_FLAG__AUTHORITY | NGHTTP2_HTTP_FLAG_HOST)) == 0) { return -1; @@ -493,7 +570,7 @@ int nghttp2_http_on_response_headers(nghttp2_stream *stream) { } stream->http_flags = - stream->http_flags & (uint32_t)~NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE; + stream->http_flags & (uint32_t)~NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE; if (!expect_response_body(stream)) { stream->content_length = 0; @@ -582,17 +659,17 @@ void nghttp2_http_record_request_method(nghttp2_stream *stream, int nghttp2_http_parse_priority(nghttp2_extpri *dest, const uint8_t *value, size_t valuelen) { nghttp2_extpri pri = *dest; - sf_parser sfp; - sf_vec key; - sf_value val; + sfparse_parser sfp; + sfparse_vec key; + sfparse_value val; int rv; - sf_parser_init(&sfp, value, valuelen); + sfparse_parser_init(&sfp, value, valuelen); for (;;) { - rv = sf_parser_dict(&sfp, &key, &val); + rv = sfparse_parser_dict(&sfp, &key, &val); if (rv != 0) { - if (rv == SF_ERR_EOF) { + if (rv == SFPARSE_ERR_EOF) { break; } @@ -605,7 +682,7 @@ int nghttp2_http_parse_priority(nghttp2_extpri *dest, const uint8_t *value, switch (key.base[0]) { case 'i': - if (val.type != SF_TYPE_BOOLEAN) { + if (val.type != SFPARSE_TYPE_BOOLEAN) { return NGHTTP2_ERR_INVALID_ARGUMENT; } @@ -613,7 +690,7 @@ int nghttp2_http_parse_priority(nghttp2_extpri *dest, const uint8_t *value, break; case 'u': - if (val.type != SF_TYPE_INTEGER || + if (val.type != SFPARSE_TYPE_INTEGER || val.integer < NGHTTP2_EXTPRI_URGENCY_HIGH || NGHTTP2_EXTPRI_URGENCY_LOW < val.integer) { return NGHTTP2_ERR_INVALID_ARGUMENT; diff --git a/lib/nghttp2/lib/nghttp2_http.h b/lib/nghttp2-1.65.0/lib/nghttp2_http.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_http.h rename to lib/nghttp2-1.65.0/lib/nghttp2_http.h diff --git a/lib/nghttp2/lib/nghttp2_int.h b/lib/nghttp2-1.65.0/lib/nghttp2_int.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_int.h rename to lib/nghttp2-1.65.0/lib/nghttp2_int.h diff --git a/lib/nghttp2-1.65.0/lib/nghttp2_map.c b/lib/nghttp2-1.65.0/lib/nghttp2_map.c new file mode 100644 index 00000000000..ee6bb1967ec --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/nghttp2_map.c @@ -0,0 +1,302 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2017 ngtcp2 contributors + * Copyright (c) 2012 nghttp2 contributors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_map.h" + +#include +#include +#include + +#include "nghttp2_helper.h" + +#define NGHTTP2_INITIAL_TABLE_LENBITS 4 + +void nghttp2_map_init(nghttp2_map *map, nghttp2_mem *mem) { + map->mem = mem; + map->hashbits = 0; + map->table = NULL; + map->size = 0; +} + +void nghttp2_map_free(nghttp2_map *map) { + if (!map) { + return; + } + + nghttp2_mem_free(map->mem, map->table); +} + +int nghttp2_map_each(const nghttp2_map *map, int (*func)(void *data, void *ptr), + void *ptr) { + int rv; + size_t i; + nghttp2_map_bucket *bkt; + size_t tablelen; + + if (map->size == 0) { + return 0; + } + + tablelen = 1u << map->hashbits; + + for (i = 0; i < tablelen; ++i) { + bkt = &map->table[i]; + + if (bkt->data == NULL) { + continue; + } + + rv = func(bkt->data, ptr); + if (rv != 0) { + return rv; + } + } + + return 0; +} + +static size_t hash(nghttp2_map_key_type key, size_t bits) { + return (size_t)(((uint32_t)key * 2654435769u) >> (32 - bits)); +} + +static void map_bucket_swap(nghttp2_map_bucket *a, nghttp2_map_bucket *b) { + nghttp2_map_bucket c = *a; + + *a = *b; + *b = c; +} + +#ifndef WIN32 +void nghttp2_map_print_distance(const nghttp2_map *map) { + size_t i; + size_t idx; + nghttp2_map_bucket *bkt; + size_t tablelen; + + if (map->size == 0) { + return; + } + + tablelen = 1u << map->hashbits; + + for (i = 0; i < tablelen; ++i) { + bkt = &map->table[i]; + + if (bkt->data == NULL) { + fprintf(stderr, "@%zu \n", i); + continue; + } + + idx = hash(bkt->key, map->hashbits); + fprintf(stderr, "@%zu hash=%zu key=%d base=%zu distance=%u\n", i, + hash(bkt->key, map->hashbits), bkt->key, idx, bkt->psl); + } +} +#endif /* !WIN32 */ + +static int insert(nghttp2_map_bucket *table, size_t hashbits, + nghttp2_map_key_type key, void *data) { + size_t idx = hash(key, hashbits); + nghttp2_map_bucket b = {0, key, data}, *bkt; + size_t mask = (1u << hashbits) - 1; + + for (;;) { + bkt = &table[idx]; + + if (bkt->data == NULL) { + *bkt = b; + return 0; + } + + if (b.psl > bkt->psl) { + map_bucket_swap(bkt, &b); + } else if (bkt->key == key) { + /* TODO This check is just a waste after first swap or if this + function is called from map_resize. That said, there is no + difference with or without this conditional in performance + wise. */ + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + ++b.psl; + idx = (idx + 1) & mask; + } +} + +static int map_resize(nghttp2_map *map, size_t new_hashbits) { + size_t i; + nghttp2_map_bucket *new_table; + nghttp2_map_bucket *bkt; + size_t tablelen; + int rv; + (void)rv; + + new_table = nghttp2_mem_calloc(map->mem, 1u << new_hashbits, + sizeof(nghttp2_map_bucket)); + if (new_table == NULL) { + return NGHTTP2_ERR_NOMEM; + } + + if (map->size) { + tablelen = 1u << map->hashbits; + + for (i = 0; i < tablelen; ++i) { + bkt = &map->table[i]; + if (bkt->data == NULL) { + continue; + } + + rv = insert(new_table, new_hashbits, bkt->key, bkt->data); + + assert(0 == rv); + } + } + + nghttp2_mem_free(map->mem, map->table); + map->hashbits = new_hashbits; + map->table = new_table; + + return 0; +} + +int nghttp2_map_insert(nghttp2_map *map, nghttp2_map_key_type key, void *data) { + int rv; + + assert(data); + + /* Load factor is 0.75 */ + /* Under the very initial condition, that is map->size == 0 and + map->hashbits == 0, 4 > 3 still holds nicely. */ + if ((map->size + 1) * 4 > (1u << map->hashbits) * 3) { + if (map->hashbits) { + rv = map_resize(map, map->hashbits + 1); + if (rv != 0) { + return rv; + } + } else { + rv = map_resize(map, NGHTTP2_INITIAL_TABLE_LENBITS); + if (rv != 0) { + return rv; + } + } + } + + rv = insert(map->table, map->hashbits, key, data); + if (rv != 0) { + return rv; + } + + ++map->size; + + return 0; +} + +void *nghttp2_map_find(const nghttp2_map *map, nghttp2_map_key_type key) { + size_t idx; + nghttp2_map_bucket *bkt; + size_t psl = 0; + size_t mask; + + if (map->size == 0) { + return NULL; + } + + idx = hash(key, map->hashbits); + mask = (1u << map->hashbits) - 1; + + for (;;) { + bkt = &map->table[idx]; + + if (bkt->data == NULL || psl > bkt->psl) { + return NULL; + } + + if (bkt->key == key) { + return bkt->data; + } + + ++psl; + idx = (idx + 1) & mask; + } +} + +int nghttp2_map_remove(nghttp2_map *map, nghttp2_map_key_type key) { + size_t idx; + nghttp2_map_bucket *b, *bkt; + size_t psl = 0; + size_t mask; + + if (map->size == 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + idx = hash(key, map->hashbits); + mask = (1u << map->hashbits) - 1; + + for (;;) { + bkt = &map->table[idx]; + + if (bkt->data == NULL || psl > bkt->psl) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + if (bkt->key == key) { + b = bkt; + idx = (idx + 1) & mask; + + for (;;) { + bkt = &map->table[idx]; + if (bkt->data == NULL || bkt->psl == 0) { + b->data = NULL; + break; + } + + --bkt->psl; + *b = *bkt; + b = bkt; + + idx = (idx + 1) & mask; + } + + --map->size; + + return 0; + } + + ++psl; + idx = (idx + 1) & mask; + } +} + +void nghttp2_map_clear(nghttp2_map *map) { + if (map->size == 0) { + return; + } + + memset(map->table, 0, sizeof(*map->table) * (1u << map->hashbits)); + map->size = 0; +} + +size_t nghttp2_map_size(const nghttp2_map *map) { return map->size; } diff --git a/lib/nghttp2/lib/nghttp2_map.h b/lib/nghttp2-1.65.0/lib/nghttp2_map.h similarity index 63% rename from lib/nghttp2/lib/nghttp2_map.h rename to lib/nghttp2-1.65.0/lib/nghttp2_map.h index 236d28296e3..5adfb78d027 100644 --- a/lib/nghttp2/lib/nghttp2_map.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_map.h @@ -39,7 +39,7 @@ typedef int32_t nghttp2_map_key_type; typedef struct nghttp2_map_bucket { - uint32_t hash; + uint32_t psl; nghttp2_map_key_type key; void *data; } nghttp2_map_bucket; @@ -48,33 +48,24 @@ typedef struct nghttp2_map { nghttp2_map_bucket *table; nghttp2_mem *mem; size_t size; - uint32_t tablelen; - uint32_t tablelenbits; + size_t hashbits; } nghttp2_map; /* - * Initializes the map |map|. + * nghttp2_map_init initializes the map |map|. */ void nghttp2_map_init(nghttp2_map *map, nghttp2_mem *mem); /* - * Deallocates any resources allocated for |map|. The stored entries - * are not freed by this function. Use nghttp2_map_each_free() to free - * each entries. + * nghttp2_map_free deallocates any resources allocated for |map|. + * The stored entries are not freed by this function. Use + * nghttp2_map_each() to free each entry. */ void nghttp2_map_free(nghttp2_map *map); /* - * Deallocates each entries using |func| function and any resources - * allocated for |map|. The |func| function is responsible for freeing - * given the |data| object. The |ptr| will be passed to the |func| as - * send argument. The return value of the |func| will be ignored. - */ -void nghttp2_map_each_free(nghttp2_map *map, int (*func)(void *data, void *ptr), - void *ptr); - -/* - * Inserts the new |data| with the |key| to the map |map|. + * nghttp2_map_insert inserts the new |data| with the |key| to the map + * |map|. * * This function returns 0 if it succeeds, or one of the following * negative error codes: @@ -82,57 +73,56 @@ void nghttp2_map_each_free(nghttp2_map *map, int (*func)(void *data, void *ptr), * NGHTTP2_ERR_INVALID_ARGUMENT * The item associated by |key| already exists. * NGHTTP2_ERR_NOMEM - * Out of memory + * Out of memory */ int nghttp2_map_insert(nghttp2_map *map, nghttp2_map_key_type key, void *data); /* - * Returns the data associated by the key |key|. If there is no such - * data, this function returns NULL. + * nghttp2_map_find returns the entry associated by the key |key|. If + * there is no such entry, this function returns NULL. */ -void *nghttp2_map_find(nghttp2_map *map, nghttp2_map_key_type key); +void *nghttp2_map_find(const nghttp2_map *map, nghttp2_map_key_type key); /* - * Removes the data associated by the key |key| from the |map|. The - * removed data is not freed by this function. + * nghttp2_map_remove removes the entry associated by the key |key| + * from the |map|. The removed entry is not freed by this function. * * This function returns 0 if it succeeds, or one of the following * negative error codes: * * NGHTTP2_ERR_INVALID_ARGUMENT - * The data associated by |key| does not exist. + * The entry associated by |key| does not exist. */ int nghttp2_map_remove(nghttp2_map *map, nghttp2_map_key_type key); /* - * Removes all entries from |map|. + * nghttp2_map_clear removes all entries from |map|. The removed + * entry is not freed by this function. */ void nghttp2_map_clear(nghttp2_map *map); /* - * Returns the number of items stored in the map |map|. + * nghttp2_map_size returns the number of items stored in the map + * |map|. */ -size_t nghttp2_map_size(nghttp2_map *map); +size_t nghttp2_map_size(const nghttp2_map *map); /* - * Applies the function |func| to each data in the |map| with the - * optional user supplied pointer |ptr|. + * nghttp2_map_each applies the function |func| to each entry in the + * |map| with the optional user supplied pointer |ptr|. * * If the |func| returns 0, this function calls the |func| with the - * next data. If the |func| returns nonzero, it will not call the + * next entry. If the |func| returns nonzero, it will not call the * |func| for further entries and return the return value of the * |func| immediately. Thus, this function returns 0 if all the * invocations of the |func| return 0, or nonzero value which the last * invocation of |func| returns. - * - * Don't use this function to free each data. Use - * nghttp2_map_each_free() instead. */ -int nghttp2_map_each(nghttp2_map *map, int (*func)(void *data, void *ptr), +int nghttp2_map_each(const nghttp2_map *map, int (*func)(void *data, void *ptr), void *ptr); #ifndef WIN32 -void nghttp2_map_print_distance(nghttp2_map *map); +void nghttp2_map_print_distance(const nghttp2_map *map); #endif /* !WIN32 */ #endif /* NGHTTP2_MAP_H */ diff --git a/lib/nghttp2/lib/nghttp2_mem.c b/lib/nghttp2-1.65.0/lib/nghttp2_mem.c similarity index 100% rename from lib/nghttp2/lib/nghttp2_mem.c rename to lib/nghttp2-1.65.0/lib/nghttp2_mem.c diff --git a/lib/nghttp2/lib/nghttp2_mem.h b/lib/nghttp2-1.65.0/lib/nghttp2_mem.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_mem.h rename to lib/nghttp2-1.65.0/lib/nghttp2_mem.h diff --git a/lib/nghttp2/lib/nghttp2_net.h b/lib/nghttp2-1.65.0/lib/nghttp2_net.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_net.h rename to lib/nghttp2-1.65.0/lib/nghttp2_net.h diff --git a/lib/nghttp2/lib/nghttp2_option.c b/lib/nghttp2-1.65.0/lib/nghttp2_option.c similarity index 94% rename from lib/nghttp2/lib/nghttp2_option.c rename to lib/nghttp2-1.65.0/lib/nghttp2_option.c index 43d4e952291..02a24eee6b2 100644 --- a/lib/nghttp2/lib/nghttp2_option.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_option.c @@ -132,15 +132,15 @@ void nghttp2_option_set_max_settings(nghttp2_option *option, size_t val) { } void nghttp2_option_set_server_fallback_rfc7540_priorities( - nghttp2_option *option, int val) { + nghttp2_option *option, int val) { option->opt_set_mask |= NGHTTP2_OPT_SERVER_FALLBACK_RFC7540_PRIORITIES; option->server_fallback_rfc7540_priorities = val; } void nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation( - nghttp2_option *option, int val) { + nghttp2_option *option, int val) { option->opt_set_mask |= - NGHTTP2_OPT_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION; + NGHTTP2_OPT_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION; option->no_rfc9113_leading_and_trailing_ws_validation = val; } @@ -150,3 +150,8 @@ void nghttp2_option_set_stream_reset_rate_limit(nghttp2_option *option, option->stream_reset_burst = burst; option->stream_reset_rate = rate; } + +void nghttp2_option_set_max_continuations(nghttp2_option *option, size_t val) { + option->opt_set_mask |= NGHTTP2_OPT_MAX_CONTINUATIONS; + option->max_continuations = val; +} diff --git a/lib/nghttp2/lib/nghttp2_option.h b/lib/nghttp2-1.65.0/lib/nghttp2_option.h similarity index 97% rename from lib/nghttp2/lib/nghttp2_option.h rename to lib/nghttp2-1.65.0/lib/nghttp2_option.h index 2259e1849d8..c89cb97f8bb 100644 --- a/lib/nghttp2/lib/nghttp2_option.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_option.h @@ -71,6 +71,7 @@ typedef enum { NGHTTP2_OPT_SERVER_FALLBACK_RFC7540_PRIORITIES = 1 << 13, NGHTTP2_OPT_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION = 1 << 14, NGHTTP2_OPT_STREAM_RESET_RATE_LIMIT = 1 << 15, + NGHTTP2_OPT_MAX_CONTINUATIONS = 1 << 16, } nghttp2_option_flag; /** @@ -98,6 +99,10 @@ struct nghttp2_option { * NGHTTP2_OPT_MAX_SETTINGS */ size_t max_settings; + /** + * NGHTTP2_OPT_MAX_CONTINUATIONS + */ + size_t max_continuations; /** * Bitwise OR of nghttp2_option_flag to determine that which fields * are specified. diff --git a/lib/nghttp2/lib/nghttp2_outbound_item.c b/lib/nghttp2-1.65.0/lib/nghttp2_outbound_item.c similarity index 85% rename from lib/nghttp2/lib/nghttp2_outbound_item.c rename to lib/nghttp2-1.65.0/lib/nghttp2_outbound_item.c index 2a3041db195..a9e9f7693ed 100644 --- a/lib/nghttp2/lib/nghttp2_outbound_item.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_outbound_item.c @@ -27,6 +27,32 @@ #include #include +nghttp2_data_provider_wrap * +nghttp2_data_provider_wrap_v1(nghttp2_data_provider_wrap *dpw, + const nghttp2_data_provider *data_prd) { + if (!data_prd) { + return NULL; + } + + dpw->version = NGHTTP2_DATA_PROVIDER_V1; + dpw->data_prd.v1 = *data_prd; + + return dpw; +} + +nghttp2_data_provider_wrap * +nghttp2_data_provider_wrap_v2(nghttp2_data_provider_wrap *dpw, + const nghttp2_data_provider2 *data_prd) { + if (!data_prd) { + return NULL; + } + + dpw->version = NGHTTP2_DATA_PROVIDER_V2; + dpw->data_prd.v2 = *data_prd; + + return dpw; +} + void nghttp2_outbound_item_init(nghttp2_outbound_item *item) { item->cycle = 0; item->qnext = NULL; diff --git a/lib/nghttp2/lib/nghttp2_outbound_item.h b/lib/nghttp2-1.65.0/lib/nghttp2_outbound_item.h similarity index 88% rename from lib/nghttp2/lib/nghttp2_outbound_item.h rename to lib/nghttp2-1.65.0/lib/nghttp2_outbound_item.h index bd4611b551b..4e91750088f 100644 --- a/lib/nghttp2/lib/nghttp2_outbound_item.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_outbound_item.h @@ -33,9 +33,32 @@ #include "nghttp2_frame.h" #include "nghttp2_mem.h" +#define NGHTTP2_DATA_PROVIDER_V1 1 +#define NGHTTP2_DATA_PROVIDER_V2 2 + +typedef struct nghttp2_data_provider_wrap { + int version; + union { + struct { + nghttp2_data_source source; + void *read_callback; + }; + nghttp2_data_provider v1; + nghttp2_data_provider2 v2; + } data_prd; +} nghttp2_data_provider_wrap; + +nghttp2_data_provider_wrap * +nghttp2_data_provider_wrap_v1(nghttp2_data_provider_wrap *dpw, + const nghttp2_data_provider *data_prd); + +nghttp2_data_provider_wrap * +nghttp2_data_provider_wrap_v2(nghttp2_data_provider_wrap *dpw, + const nghttp2_data_provider2 *data_prd); + /* struct used for HEADERS and PUSH_PROMISE frame */ typedef struct { - nghttp2_data_provider data_prd; + nghttp2_data_provider_wrap dpw; void *stream_user_data; /* error code when request HEADERS is canceled by RST_STREAM while it is in queue. */ @@ -50,7 +73,7 @@ typedef struct { /** * The data to be sent for this DATA frame. */ - nghttp2_data_provider data_prd; + nghttp2_data_provider_wrap dpw; /** * The flags of DATA frame. We use separate flags here and * nghttp2_data frame. The latter contains flags actually sent to diff --git a/lib/nghttp2/lib/nghttp2_pq.c b/lib/nghttp2-1.65.0/lib/nghttp2_pq.c similarity index 98% rename from lib/nghttp2/lib/nghttp2_pq.c rename to lib/nghttp2-1.65.0/lib/nghttp2_pq.c index 64353acc961..e79ba8365e8 100644 --- a/lib/nghttp2/lib/nghttp2_pq.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_pq.c @@ -69,7 +69,7 @@ int nghttp2_pq_push(nghttp2_pq *pq, nghttp2_pq_entry *item) { void *nq; size_t ncapacity; - ncapacity = nghttp2_max(4, (pq->capacity * 2)); + ncapacity = nghttp2_max_size(4, (pq->capacity * 2)); nq = nghttp2_mem_realloc(pq->mem, pq->q, ncapacity * sizeof(nghttp2_pq_entry *)); diff --git a/lib/nghttp2/lib/nghttp2_pq.h b/lib/nghttp2-1.65.0/lib/nghttp2_pq.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_pq.h rename to lib/nghttp2-1.65.0/lib/nghttp2_pq.h diff --git a/lib/nghttp2/lib/nghttp2_priority_spec.c b/lib/nghttp2-1.65.0/lib/nghttp2_priority_spec.c similarity index 100% rename from lib/nghttp2/lib/nghttp2_priority_spec.c rename to lib/nghttp2-1.65.0/lib/nghttp2_priority_spec.c diff --git a/lib/nghttp2/lib/nghttp2_priority_spec.h b/lib/nghttp2-1.65.0/lib/nghttp2_priority_spec.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_priority_spec.h rename to lib/nghttp2-1.65.0/lib/nghttp2_priority_spec.h diff --git a/lib/nghttp2/lib/nghttp2_queue.c b/lib/nghttp2-1.65.0/lib/nghttp2_queue.c similarity index 97% rename from lib/nghttp2/lib/nghttp2_queue.c rename to lib/nghttp2-1.65.0/lib/nghttp2_queue.c index 055eb69c7e5..3b631585245 100644 --- a/lib/nghttp2/lib/nghttp2_queue.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_queue.c @@ -46,7 +46,7 @@ void nghttp2_queue_free(nghttp2_queue *queue) { int nghttp2_queue_push(nghttp2_queue *queue, void *data) { nghttp2_queue_cell *new_cell = - (nghttp2_queue_cell *)malloc(sizeof(nghttp2_queue_cell)); + (nghttp2_queue_cell *)malloc(sizeof(nghttp2_queue_cell)); if (!new_cell) { return NGHTTP2_ERR_NOMEM; } diff --git a/lib/nghttp2/lib/nghttp2_queue.h b/lib/nghttp2-1.65.0/lib/nghttp2_queue.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_queue.h rename to lib/nghttp2-1.65.0/lib/nghttp2_queue.h diff --git a/lib/nghttp2/lib/nghttp2_ratelim.c b/lib/nghttp2-1.65.0/lib/nghttp2_ratelim.c similarity index 97% rename from lib/nghttp2/lib/nghttp2_ratelim.c rename to lib/nghttp2-1.65.0/lib/nghttp2_ratelim.c index 7011655b006..604ac0801a7 100644 --- a/lib/nghttp2/lib/nghttp2_ratelim.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_ratelim.c @@ -61,7 +61,7 @@ void nghttp2_ratelim_update(nghttp2_ratelim *rl, uint64_t tstamp) { } rl->val += gain; - rl->val = nghttp2_min(rl->val, rl->burst); + rl->val = nghttp2_min_uint64(rl->val, rl->burst); } int nghttp2_ratelim_drain(nghttp2_ratelim *rl, uint64_t n) { diff --git a/lib/nghttp2/lib/nghttp2_ratelim.h b/lib/nghttp2-1.65.0/lib/nghttp2_ratelim.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_ratelim.h rename to lib/nghttp2-1.65.0/lib/nghttp2_ratelim.h diff --git a/lib/nghttp2/lib/nghttp2_rcbuf.c b/lib/nghttp2-1.65.0/lib/nghttp2_rcbuf.c similarity index 100% rename from lib/nghttp2/lib/nghttp2_rcbuf.c rename to lib/nghttp2-1.65.0/lib/nghttp2_rcbuf.c diff --git a/lib/nghttp2/lib/nghttp2_rcbuf.h b/lib/nghttp2-1.65.0/lib/nghttp2_rcbuf.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_rcbuf.h rename to lib/nghttp2-1.65.0/lib/nghttp2_rcbuf.h diff --git a/lib/nghttp2/lib/nghttp2_session.c b/lib/nghttp2-1.65.0/lib/nghttp2_session.c similarity index 84% rename from lib/nghttp2/lib/nghttp2_session.c rename to lib/nghttp2-1.65.0/lib/nghttp2_session.c index 51ed4494edb..f5bda333f83 100644 --- a/lib/nghttp2/lib/nghttp2_session.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_session.c @@ -39,6 +39,9 @@ #include "nghttp2_extpri.h" #include "nghttp2_time.h" #include "nghttp2_debug.h" +#include "nghttp2_submit.h" + +nghttp2_stream root; /* * Returns non-zero if the number of outgoing opened streams is larger @@ -145,11 +148,6 @@ static int session_detect_idle_stream(nghttp2_session *session, return 0; } -static int session_no_rfc7540_pri_no_fallback(nghttp2_session *session) { - return session->pending_no_rfc7540_priorities == 1 && - !session->fallback_rfc7540_priorities; -} - static int check_ext_type_set(const uint8_t *ext_types, uint8_t type) { return (ext_types[type / 8] & (1 << (type & 0x7))) > 0; } @@ -238,9 +236,9 @@ static int session_terminate_session(nghttp2_session *session, debug_datalen = strlen(reason); } - rv = nghttp2_session_add_goaway(session, last_stream_id, error_code, - debug_data, debug_datalen, - NGHTTP2_GOAWAY_AUX_TERM_ON_SEND); + rv = + nghttp2_session_add_goaway(session, last_stream_id, error_code, debug_data, + debug_datalen, NGHTTP2_GOAWAY_AUX_TERM_ON_SEND); if (rv != 0) { return rv; @@ -438,7 +436,7 @@ static int session_new(nghttp2_session **session_ptr, int rv; size_t nbuffer; size_t max_deflate_dynamic_table_size = - NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE; + NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE; size_t i; if (mem == NULL) { @@ -457,10 +455,6 @@ static int session_new(nghttp2_session **session_ptr, /* next_stream_id is initialized in either nghttp2_session_client_new2 or nghttp2_session_server_new2 */ - nghttp2_stream_init(&(*session_ptr)->root, 0, NGHTTP2_STREAM_FLAG_NONE, - NGHTTP2_STREAM_IDLE, NGHTTP2_DEFAULT_WEIGHT, 0, 0, NULL, - mem); - (*session_ptr)->remote_window_size = NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE; (*session_ptr)->recv_window_size = 0; (*session_ptr)->consumed_size = 0; @@ -472,7 +466,7 @@ static int session_new(nghttp2_session **session_ptr, (*session_ptr)->remote_last_stream_id = (1u << 31) - 1; (*session_ptr)->pending_local_max_concurrent_stream = - NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS; + NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS; (*session_ptr)->pending_enable_push = 1; (*session_ptr)->pending_no_rfc7540_priorities = UINT8_MAX; @@ -488,7 +482,7 @@ static int session_new(nghttp2_session **session_ptr, init_settings(&(*session_ptr)->local_settings); (*session_ptr)->max_incoming_reserved_streams = - NGHTTP2_MAX_INCOMING_RESERVED_STREAMS; + NGHTTP2_MAX_INCOMING_RESERVED_STREAMS; /* Limit max outgoing concurrent streams to sensible value */ (*session_ptr)->remote_settings.max_concurrent_streams = 100; @@ -501,31 +495,26 @@ static int session_new(nghttp2_session **session_ptr, if (option) { if ((option->opt_set_mask & NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE) && option->no_auto_window_update) { - (*session_ptr)->opt_flags |= NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE; } if (option->opt_set_mask & NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS) { - (*session_ptr)->remote_settings.max_concurrent_streams = - option->peer_max_concurrent_streams; + option->peer_max_concurrent_streams; } if (option->opt_set_mask & NGHTTP2_OPT_MAX_RESERVED_REMOTE_STREAMS) { - (*session_ptr)->max_incoming_reserved_streams = - option->max_reserved_remote_streams; + option->max_reserved_remote_streams; } if ((option->opt_set_mask & NGHTTP2_OPT_NO_RECV_CLIENT_MAGIC) && option->no_recv_client_magic) { - (*session_ptr)->opt_flags |= NGHTTP2_OPTMASK_NO_RECV_CLIENT_MAGIC; } if ((option->opt_set_mask & NGHTTP2_OPT_NO_HTTP_MESSAGING) && option->no_http_messaging) { - (*session_ptr)->opt_flags |= NGHTTP2_OPTMASK_NO_HTTP_MESSAGING; } @@ -545,18 +534,13 @@ static int session_new(nghttp2_session **session_ptr, if (option->opt_set_mask & NGHTTP2_OPT_MAX_SEND_HEADER_BLOCK_LENGTH) { (*session_ptr)->max_send_header_block_length = - option->max_send_header_block_length; + option->max_send_header_block_length; } if (option->opt_set_mask & NGHTTP2_OPT_MAX_DEFLATE_DYNAMIC_TABLE_SIZE) { max_deflate_dynamic_table_size = option->max_deflate_dynamic_table_size; } - if ((option->opt_set_mask & NGHTTP2_OPT_NO_CLOSED_STREAMS) && - option->no_closed_streams) { - (*session_ptr)->opt_flags |= NGHTTP2_OPTMASK_NO_CLOSED_STREAMS; - } - if (option->opt_set_mask & NGHTTP2_OPT_MAX_OUTBOUND_ACK) { (*session_ptr)->max_outbound_ack = option->max_outbound_ack; } @@ -566,18 +550,11 @@ static int session_new(nghttp2_session **session_ptr, (*session_ptr)->max_settings = option->max_settings; } - if ((option->opt_set_mask & - NGHTTP2_OPT_SERVER_FALLBACK_RFC7540_PRIORITIES) && - option->server_fallback_rfc7540_priorities) { - (*session_ptr)->opt_flags |= - NGHTTP2_OPTMASK_SERVER_FALLBACK_RFC7540_PRIORITIES; - } - if ((option->opt_set_mask & NGHTTP2_OPT_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION) && option->no_rfc9113_leading_and_trailing_ws_validation) { (*session_ptr)->opt_flags |= - NGHTTP2_OPTMASK_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION; + NGHTTP2_OPTMASK_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION; } if (option->opt_set_mask & NGHTTP2_OPT_STREAM_RESET_RATE_LIMIT) { @@ -585,6 +562,10 @@ static int session_new(nghttp2_session **session_ptr, option->stream_reset_burst, option->stream_reset_rate); } + + if (option->opt_set_mask & NGHTTP2_OPT_MAX_CONTINUATIONS) { + (*session_ptr)->max_continuations = option->max_continuations; + } } rv = nghttp2_hd_deflate_init2(&(*session_ptr)->hd_deflater, @@ -810,11 +791,10 @@ void nghttp2_session_del(nghttp2_session *session) { for (i = 0; i < NGHTTP2_EXTPRI_URGENCY_LEVELS; ++i) { nghttp2_pq_free(&session->sched[i].ob_data); } - nghttp2_stream_free(&session->root); /* Have to free streams first, so that we can check stream->item->queued */ - nghttp2_map_each_free(&session->streams, free_streams, session); + nghttp2_map_each(&session->streams, free_streams, session); nghttp2_map_free(&session->streams); ob_q_free(&session->ob_urgent, mem); @@ -829,83 +809,6 @@ void nghttp2_session_del(nghttp2_session *session) { nghttp2_mem_free(mem, session); } -int nghttp2_session_reprioritize_stream( - nghttp2_session *session, nghttp2_stream *stream, - const nghttp2_priority_spec *pri_spec_in) { - int rv; - nghttp2_stream *dep_stream = NULL; - nghttp2_priority_spec pri_spec_default; - const nghttp2_priority_spec *pri_spec = pri_spec_in; - - assert((!session->server && session->pending_no_rfc7540_priorities != 1) || - (session->server && !session_no_rfc7540_pri_no_fallback(session))); - assert(pri_spec->stream_id != stream->stream_id); - - if (!nghttp2_stream_in_dep_tree(stream)) { - return 0; - } - - if (pri_spec->stream_id != 0) { - dep_stream = nghttp2_session_get_stream_raw(session, pri_spec->stream_id); - - if (!dep_stream && - session_detect_idle_stream(session, pri_spec->stream_id)) { - - nghttp2_priority_spec_default_init(&pri_spec_default); - - dep_stream = nghttp2_session_open_stream( - session, pri_spec->stream_id, NGHTTP2_FLAG_NONE, &pri_spec_default, - NGHTTP2_STREAM_IDLE, NULL); - - if (dep_stream == NULL) { - return NGHTTP2_ERR_NOMEM; - } - } else if (!dep_stream || !nghttp2_stream_in_dep_tree(dep_stream)) { - nghttp2_priority_spec_default_init(&pri_spec_default); - pri_spec = &pri_spec_default; - } - } - - if (pri_spec->stream_id == 0) { - dep_stream = &session->root; - } else if (nghttp2_stream_dep_find_ancestor(dep_stream, stream)) { - DEBUGF("stream: cycle detected, dep_stream(%p)=%d stream(%p)=%d\n", - dep_stream, dep_stream->stream_id, stream, stream->stream_id); - - nghttp2_stream_dep_remove_subtree(dep_stream); - rv = nghttp2_stream_dep_add_subtree(stream->dep_prev, dep_stream); - if (rv != 0) { - return rv; - } - } - - assert(dep_stream); - - if (dep_stream == stream->dep_prev && !pri_spec->exclusive) { - /* This is minor optimization when just weight is changed. */ - nghttp2_stream_change_weight(stream, pri_spec->weight); - - return 0; - } - - nghttp2_stream_dep_remove_subtree(stream); - - /* We have to update weight after removing stream from tree */ - stream->weight = pri_spec->weight; - - if (pri_spec->exclusive) { - rv = nghttp2_stream_dep_insert_subtree(dep_stream, stream); - } else { - rv = nghttp2_stream_dep_add_subtree(dep_stream, stream); - } - - if (rv != 0) { - return rv; - } - - return 0; -} - static uint64_t pq_get_first_cycle(nghttp2_pq *pq) { nghttp2_stream *stream; @@ -924,7 +827,6 @@ static int session_ob_data_push(nghttp2_session *session, int inc; nghttp2_pq *pq; - assert(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES); assert(stream->queued == 0); urgency = nghttp2_extpri_uint8_urgency(stream->extpri); @@ -953,7 +855,6 @@ static void session_ob_data_remove(nghttp2_session *session, nghttp2_stream *stream) { uint32_t urgency; - assert(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES); assert(stream->queued == 1); urgency = nghttp2_extpri_uint8_urgency(stream->extpri); @@ -970,24 +871,23 @@ static int session_attach_stream_item(nghttp2_session *session, nghttp2_outbound_item *item) { int rv; - rv = nghttp2_stream_attach_item(stream, item); + nghttp2_stream_attach_item(stream, item); + + rv = session_ob_data_push(session, stream); if (rv != 0) { - return rv; - } + nghttp2_stream_detach_item(stream); - if (!(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES)) { - return 0; + return rv; } - return session_ob_data_push(session, stream); + return 0; } static void session_detach_stream_item(nghttp2_session *session, nghttp2_stream *stream) { nghttp2_stream_detach_item(stream); - if (!(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES) || - !stream->queued) { + if (!stream->queued) { return; } @@ -998,8 +898,7 @@ static void session_defer_stream_item(nghttp2_session *session, nghttp2_stream *stream, uint8_t flags) { nghttp2_stream_defer_item(stream, flags); - if (!(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES) || - !stream->queued) { + if (!stream->queued) { return; } @@ -1009,15 +908,9 @@ static void session_defer_stream_item(nghttp2_session *session, static int session_resume_deferred_stream_item(nghttp2_session *session, nghttp2_stream *stream, uint8_t flags) { - int rv; + nghttp2_stream_resume_deferred_item(stream, flags); - rv = nghttp2_stream_resume_deferred_item(stream, flags); - if (rv != 0) { - return rv; - } - - if (!(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES) || - (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL)) { + if (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL) { return 0; } @@ -1162,7 +1055,6 @@ int nghttp2_session_add_item(nghttp2_session *session, return 0; case NGHTTP2_PUSH_PROMISE: { nghttp2_headers_aux_data *aux_data; - nghttp2_priority_spec pri_spec; aux_data = &item->aux_data.headers; @@ -1170,20 +1062,13 @@ int nghttp2_session_add_item(nghttp2_session *session, return NGHTTP2_ERR_STREAM_CLOSED; } - nghttp2_priority_spec_init(&pri_spec, stream->stream_id, - NGHTTP2_DEFAULT_WEIGHT, 0); - if (!nghttp2_session_open_stream( - session, frame->push_promise.promised_stream_id, - NGHTTP2_STREAM_FLAG_NONE, &pri_spec, NGHTTP2_STREAM_RESERVED, - aux_data->stream_user_data)) { + session, frame->push_promise.promised_stream_id, + NGHTTP2_STREAM_FLAG_NONE, NGHTTP2_STREAM_RESERVED, + aux_data->stream_user_data)) { return NGHTTP2_ERR_NOMEM; } - /* We don't have to call nghttp2_session_adjust_closed_stream() - here, since stream->stream_id is local stream_id, and it does - not affect closed stream count. */ - nghttp2_outbound_queue_push(&session->ob_reg, item); item->queued = 1; @@ -1242,7 +1127,6 @@ int nghttp2_session_add_rst_stream(nghttp2_session *session, int32_t stream_id, assert(headers_frame->hd.type == NGHTTP2_HEADERS); if (headers_frame->hd.stream_id <= stream_id) { - for (item = session->ob_syn.head; item; item = item->qnext) { aux_data = &item->aux_data.headers; @@ -1285,15 +1169,11 @@ int nghttp2_session_add_rst_stream(nghttp2_session *session, int32_t stream_id, nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, int32_t stream_id, uint8_t flags, - nghttp2_priority_spec *pri_spec_in, nghttp2_stream_state initial_state, void *stream_user_data) { int rv; nghttp2_stream *stream; - nghttp2_stream *dep_stream = NULL; int stream_alloc = 0; - nghttp2_priority_spec pri_spec_default; - nghttp2_priority_spec *pri_spec = pri_spec_in; nghttp2_mem *mem; mem = &session->mem; @@ -1306,21 +1186,9 @@ nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, if (stream) { assert(stream->state == NGHTTP2_STREAM_IDLE); - assert((stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES) || - nghttp2_stream_in_dep_tree(stream)); + assert(initial_state != NGHTTP2_STREAM_IDLE); - if (nghttp2_stream_in_dep_tree(stream)) { - assert(!(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES)); - nghttp2_session_detach_idle_stream(session, stream); - rv = nghttp2_stream_dep_remove(stream); - if (rv != 0) { - return NULL; - } - - if (session_no_rfc7540_pri_no_fallback(session)) { - stream->flags |= NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES; - } - } + --session->num_idle_streams; } else { stream = nghttp2_mem_malloc(mem, sizeof(nghttp2_stream)); if (stream == NULL) { @@ -1330,69 +1198,16 @@ nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, stream_alloc = 1; } - if (session_no_rfc7540_pri_no_fallback(session) || - session->remote_settings.no_rfc7540_priorities == 1) { - /* For client which has not received server - SETTINGS_NO_RFC7540_PRIORITIES = 1, send a priority signal - opportunistically. */ - if (session->server || - session->remote_settings.no_rfc7540_priorities == 1) { - nghttp2_priority_spec_default_init(&pri_spec_default); - pri_spec = &pri_spec_default; - } - - if (session->pending_no_rfc7540_priorities == 1) { - flags |= NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES; - } - } else if (pri_spec->stream_id != 0) { - dep_stream = nghttp2_session_get_stream_raw(session, pri_spec->stream_id); - - if (!dep_stream && - session_detect_idle_stream(session, pri_spec->stream_id)) { - /* Depends on idle stream, which does not exist in memory. - Assign default priority for it. */ - nghttp2_priority_spec_default_init(&pri_spec_default); - - dep_stream = nghttp2_session_open_stream( - session, pri_spec->stream_id, NGHTTP2_FLAG_NONE, &pri_spec_default, - NGHTTP2_STREAM_IDLE, NULL); - - if (dep_stream == NULL) { - if (stream_alloc) { - nghttp2_mem_free(mem, stream); - } - - return NULL; - } - } else if (!dep_stream || !nghttp2_stream_in_dep_tree(dep_stream)) { - /* If dep_stream is not part of dependency tree, stream will get - default priority. This handles the case when - pri_spec->stream_id == stream_id. This happens because we - don't check pri_spec->stream_id against new stream ID in - nghttp2_submit_request. This also handles the case when idle - stream created by PRIORITY frame was opened. Somehow we - first remove the idle stream from dependency tree. This is - done to simplify code base, but ideally we should retain old - dependency. But I'm not sure this adds values. */ - nghttp2_priority_spec_default_init(&pri_spec_default); - pri_spec = &pri_spec_default; - } - } - if (initial_state == NGHTTP2_STREAM_RESERVED) { flags |= NGHTTP2_STREAM_FLAG_PUSH; } if (stream_alloc) { nghttp2_stream_init(stream, stream_id, flags, initial_state, - pri_spec->weight, (int32_t)session->remote_settings.initial_window_size, (int32_t)session->local_settings.initial_window_size, - stream_user_data, mem); - - if (session_no_rfc7540_pri_no_fallback(session)) { - stream->seq = session->stream_seq++; - } + stream_user_data); + stream->seq = session->stream_seq++; rv = nghttp2_map_insert(&session->streams, stream_id, stream); if (rv != 0) { @@ -1403,7 +1218,6 @@ nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, } else { stream->flags = flags; stream->state = initial_state; - stream->weight = pri_spec->weight; stream->stream_user_data = stream_user_data; } @@ -1421,9 +1235,7 @@ nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, limit. That is one of the DOS vector. */ break; case NGHTTP2_STREAM_IDLE: - /* Idle stream does not count toward the concurrent streams limit. - This is used as anchor node in dependency tree. */ - nghttp2_session_keep_idle_stream(session, stream); + ++session->num_idle_streams; break; default: if (nghttp2_session_is_my_stream_id(session, stream_id)) { @@ -1433,31 +1245,11 @@ nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, } } - if (stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES) { - return stream; - } - - if (pri_spec->stream_id == 0) { - dep_stream = &session->root; - } - - assert(dep_stream); - - if (pri_spec->exclusive) { - rv = nghttp2_stream_dep_insert(dep_stream, stream); - if (rv != 0) { - return NULL; - } - } else { - nghttp2_stream_dep_add(dep_stream, stream); - } - return stream; } int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id, uint32_t error_code) { - int rv; nghttp2_stream *stream; nghttp2_mem *mem; int is_my_stream_id; @@ -1471,6 +1263,20 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id, DEBUGF("stream: stream(%p)=%d close\n", stream, stream->stream_id); + /* We call on_stream_close_callback even if stream->state is + NGHTTP2_STREAM_INITIAL. This will happen while sending request + HEADERS, a local endpoint receives RST_STREAM for that stream. It + may be PROTOCOL_ERROR, but without notifying stream closure will + hang the stream in a local endpoint. + */ + + if (session->callbacks.on_stream_close_callback) { + if (session->callbacks.on_stream_close_callback( + session, stream_id, error_code, session->user_data) != 0) { + return NGHTTP2_ERR_CALLBACK_FAILURE; + } + } + if (stream->item) { nghttp2_outbound_item *item; @@ -1488,21 +1294,6 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id, } } - /* We call on_stream_close_callback even if stream->state is - NGHTTP2_STREAM_INITIAL. This will happen while sending request - HEADERS, a local endpoint receives RST_STREAM for that stream. It - may be PROTOCOL_ERROR, but without notifying stream closure will - hang the stream in a local endpoint. - */ - - if (session->callbacks.on_stream_close_callback) { - if (session->callbacks.on_stream_close_callback( - session, stream_id, error_code, session->user_data) != 0) { - - return NGHTTP2_ERR_CALLBACK_FAILURE; - } - } - is_my_stream_id = nghttp2_session_is_my_stream_id(session, stream_id); /* pushed streams which is not opened yet is not counted toward max @@ -1522,201 +1313,26 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id, /* Closes both directions just in case they are not closed yet */ stream->flags |= NGHTTP2_STREAM_FLAG_CLOSED; - if (session->pending_no_rfc7540_priorities == 1) { - return nghttp2_session_destroy_stream(session, stream); - } - - if ((session->opt_flags & NGHTTP2_OPTMASK_NO_CLOSED_STREAMS) == 0 && - session->server && !is_my_stream_id && - nghttp2_stream_in_dep_tree(stream)) { - /* On server side, retain stream at most MAX_CONCURRENT_STREAMS - combined with the current active incoming streams to make - dependency tree work better. */ - nghttp2_session_keep_closed_stream(session, stream); - } else { - rv = nghttp2_session_destroy_stream(session, stream); - if (rv != 0) { - return rv; - } - } + nghttp2_session_destroy_stream(session, stream); return 0; } -int nghttp2_session_destroy_stream(nghttp2_session *session, - nghttp2_stream *stream) { +void nghttp2_session_destroy_stream(nghttp2_session *session, + nghttp2_stream *stream) { nghttp2_mem *mem; - int rv; DEBUGF("stream: destroy closed stream(%p)=%d\n", stream, stream->stream_id); mem = &session->mem; - if (nghttp2_stream_in_dep_tree(stream)) { - rv = nghttp2_stream_dep_remove(stream); - if (rv != 0) { - return rv; - } + if (stream->queued) { + session_ob_data_remove(session, stream); } nghttp2_map_remove(&session->streams, stream->stream_id); nghttp2_stream_free(stream); nghttp2_mem_free(mem, stream); - - return 0; -} - -void nghttp2_session_keep_closed_stream(nghttp2_session *session, - nghttp2_stream *stream) { - DEBUGF("stream: keep closed stream(%p)=%d, state=%d\n", stream, - stream->stream_id, stream->state); - - if (session->closed_stream_tail) { - session->closed_stream_tail->closed_next = stream; - stream->closed_prev = session->closed_stream_tail; - } else { - session->closed_stream_head = stream; - } - session->closed_stream_tail = stream; - - ++session->num_closed_streams; -} - -void nghttp2_session_keep_idle_stream(nghttp2_session *session, - nghttp2_stream *stream) { - DEBUGF("stream: keep idle stream(%p)=%d, state=%d\n", stream, - stream->stream_id, stream->state); - - if (session->idle_stream_tail) { - session->idle_stream_tail->closed_next = stream; - stream->closed_prev = session->idle_stream_tail; - } else { - session->idle_stream_head = stream; - } - session->idle_stream_tail = stream; - - ++session->num_idle_streams; -} - -void nghttp2_session_detach_idle_stream(nghttp2_session *session, - nghttp2_stream *stream) { - nghttp2_stream *prev_stream, *next_stream; - - DEBUGF("stream: detach idle stream(%p)=%d, state=%d\n", stream, - stream->stream_id, stream->state); - - prev_stream = stream->closed_prev; - next_stream = stream->closed_next; - - if (prev_stream) { - prev_stream->closed_next = next_stream; - } else { - session->idle_stream_head = next_stream; - } - - if (next_stream) { - next_stream->closed_prev = prev_stream; - } else { - session->idle_stream_tail = prev_stream; - } - - stream->closed_prev = NULL; - stream->closed_next = NULL; - - --session->num_idle_streams; -} - -int nghttp2_session_adjust_closed_stream(nghttp2_session *session) { - size_t num_stream_max; - int rv; - - if (session->local_settings.max_concurrent_streams == - NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS) { - num_stream_max = session->pending_local_max_concurrent_stream; - } else { - num_stream_max = session->local_settings.max_concurrent_streams; - } - - DEBUGF("stream: adjusting kept closed streams num_closed_streams=%zu, " - "num_incoming_streams=%zu, max_concurrent_streams=%zu\n", - session->num_closed_streams, session->num_incoming_streams, - num_stream_max); - - while (session->num_closed_streams > 0 && - session->num_closed_streams + session->num_incoming_streams > - num_stream_max) { - nghttp2_stream *head_stream; - nghttp2_stream *next; - - head_stream = session->closed_stream_head; - - assert(head_stream); - - next = head_stream->closed_next; - - rv = nghttp2_session_destroy_stream(session, head_stream); - if (rv != 0) { - return rv; - } - - /* head_stream is now freed */ - - session->closed_stream_head = next; - - if (session->closed_stream_head) { - session->closed_stream_head->closed_prev = NULL; - } else { - session->closed_stream_tail = NULL; - } - - --session->num_closed_streams; - } - - return 0; -} - -int nghttp2_session_adjust_idle_stream(nghttp2_session *session) { - size_t max; - int rv; - - /* Make minimum number of idle streams 16, and maximum 100, which - are arbitrary chosen numbers. */ - max = nghttp2_min( - 100, nghttp2_max( - 16, nghttp2_min(session->local_settings.max_concurrent_streams, - session->pending_local_max_concurrent_stream))); - - DEBUGF("stream: adjusting kept idle streams num_idle_streams=%zu, max=%zu\n", - session->num_idle_streams, max); - - while (session->num_idle_streams > max) { - nghttp2_stream *head; - nghttp2_stream *next; - - head = session->idle_stream_head; - assert(head); - - next = head->closed_next; - - rv = nghttp2_session_destroy_stream(session, head); - if (rv != 0) { - return rv; - } - - /* head is now destroyed */ - - session->idle_stream_head = next; - - if (session->idle_stream_head) { - session->idle_stream_head->closed_prev = NULL; - } else { - session->idle_stream_tail = NULL; - } - - --session->num_idle_streams; - } - - return 0; } /* @@ -2104,19 +1720,19 @@ static int session_predicate_priority_update_send(nghttp2_session *session, /* Take into account settings max frame size and both connection-level flow control here */ -static ssize_t -nghttp2_session_enforce_flow_control_limits(nghttp2_session *session, - nghttp2_stream *stream, - ssize_t requested_window_size) { +static nghttp2_ssize nghttp2_session_enforce_flow_control_limits( + nghttp2_session *session, nghttp2_stream *stream, + nghttp2_ssize requested_window_size) { DEBUGF("send: remote windowsize connection=%d, remote maxframsize=%u, " "stream(id %d)=%d\n", session->remote_window_size, session->remote_settings.max_frame_size, stream->stream_id, stream->remote_window_size); - return nghttp2_min(nghttp2_min(nghttp2_min(requested_window_size, - stream->remote_window_size), - session->remote_window_size), - (int32_t)session->remote_settings.max_frame_size); + return nghttp2_min_int32( + nghttp2_min_int32(nghttp2_min_int32((int32_t)requested_window_size, + stream->remote_window_size), + session->remote_window_size), + (int32_t)session->remote_settings.max_frame_size); } /* @@ -2127,12 +1743,12 @@ nghttp2_session_enforce_flow_control_limits(nghttp2_session *session, */ static size_t nghttp2_session_next_data_read(nghttp2_session *session, nghttp2_stream *stream) { - ssize_t window_size; + nghttp2_ssize window_size; window_size = nghttp2_session_enforce_flow_control_limits( - session, stream, NGHTTP2_DATA_PAYLOADLEN); + session, stream, NGHTTP2_DATA_PAYLOADLEN); - DEBUGF("send: available window=%zd\n", window_size); + DEBUGF("send: available window=%td\n", window_size); return window_size > 0 ? (size_t)window_size : 0; } @@ -2187,29 +1803,33 @@ static int nghttp2_session_predicate_data_send(nghttp2_session *session, return NGHTTP2_ERR_INVALID_STREAM_STATE; } -static ssize_t session_call_select_padding(nghttp2_session *session, - const nghttp2_frame *frame, - size_t max_payloadlen) { - ssize_t rv; +static nghttp2_ssize session_call_select_padding(nghttp2_session *session, + const nghttp2_frame *frame, + size_t max_payloadlen) { + nghttp2_ssize rv; + size_t max_paddedlen; - if (frame->hd.length >= max_payloadlen) { - return (ssize_t)frame->hd.length; + if (frame->hd.length >= max_payloadlen || + (!session->callbacks.select_padding_callback2 && + !session->callbacks.select_padding_callback)) { + return (nghttp2_ssize)frame->hd.length; } - if (session->callbacks.select_padding_callback) { - size_t max_paddedlen; + max_paddedlen = + nghttp2_min_size(frame->hd.length + NGHTTP2_MAX_PADLEN, max_payloadlen); - max_paddedlen = - nghttp2_min(frame->hd.length + NGHTTP2_MAX_PADLEN, max_payloadlen); - - rv = session->callbacks.select_padding_callback( - session, frame, max_paddedlen, session->user_data); - if (rv < (ssize_t)frame->hd.length || rv > (ssize_t)max_paddedlen) { - return NGHTTP2_ERR_CALLBACK_FAILURE; - } - return rv; + if (session->callbacks.select_padding_callback2) { + rv = session->callbacks.select_padding_callback2( + session, frame, max_paddedlen, session->user_data); + } else { + rv = (nghttp2_ssize)session->callbacks.select_padding_callback( + session, frame, max_paddedlen, session->user_data); + } + if (rv < (nghttp2_ssize)frame->hd.length || + rv > (nghttp2_ssize)max_paddedlen) { + return NGHTTP2_ERR_CALLBACK_FAILURE; } - return (ssize_t)frame->hd.length; + return rv; } /* Add padding to HEADERS or PUSH_PROMISE. We use @@ -2217,7 +1837,7 @@ static ssize_t session_call_select_padding(nghttp2_session *session, frame->push_promise has also padlen in the same position. */ static int session_headers_add_pad(nghttp2_session *session, nghttp2_frame *frame) { - ssize_t padded_payloadlen; + nghttp2_ssize padded_payloadlen; nghttp2_active_outbound_item *aob; nghttp2_bufs *framebufs; size_t padlen; @@ -2226,11 +1846,11 @@ static int session_headers_add_pad(nghttp2_session *session, aob = &session->aob; framebufs = &aob->framebufs; - max_payloadlen = nghttp2_min(NGHTTP2_MAX_PAYLOADLEN, - frame->hd.length + NGHTTP2_MAX_PADLEN); + max_payloadlen = nghttp2_min_size(NGHTTP2_MAX_PAYLOADLEN, + frame->hd.length + NGHTTP2_MAX_PADLEN); padded_payloadlen = - session_call_select_padding(session, frame, max_payloadlen); + session_call_select_padding(session, frame, max_payloadlen); if (nghttp2_is_fatal((int)padded_payloadlen)) { return (int)padded_payloadlen; @@ -2238,7 +1858,7 @@ static int session_headers_add_pad(nghttp2_session *session, padlen = (size_t)padded_payloadlen - frame->hd.length; - DEBUGF("send: padding selected: payloadlen=%zd, padlen=%zu\n", + DEBUGF("send: padding selected: payloadlen=%td, padlen=%zu\n", padded_payloadlen, padlen); nghttp2_frame_add_pad(framebufs, &frame->hd, padlen, 0); @@ -2258,18 +1878,24 @@ static size_t session_estimate_headers_payload(nghttp2_session *session, static int session_pack_extension(nghttp2_session *session, nghttp2_bufs *bufs, nghttp2_frame *frame) { - ssize_t rv; + nghttp2_ssize rv; nghttp2_buf *buf; size_t buflen; size_t framelen; - assert(session->callbacks.pack_extension_callback); + assert(session->callbacks.pack_extension_callback2 || + session->callbacks.pack_extension_callback); buf = &bufs->head->buf; - buflen = nghttp2_min(nghttp2_buf_avail(buf), NGHTTP2_MAX_PAYLOADLEN); + buflen = nghttp2_min_size(nghttp2_buf_avail(buf), NGHTTP2_MAX_PAYLOADLEN); - rv = session->callbacks.pack_extension_callback(session, buf->last, buflen, - frame, session->user_data); + if (session->callbacks.pack_extension_callback2) { + rv = session->callbacks.pack_extension_callback2(session, buf->last, buflen, + frame, session->user_data); + } else { + rv = (nghttp2_ssize)session->callbacks.pack_extension_callback( + session, buf->last, buflen, frame, session->user_data); + } if (rv == NGHTTP2_ERR_CANCEL) { return (int)rv; } @@ -2334,7 +1960,6 @@ static int session_prep_frame(nghttp2_session *session, next_readmax = nghttp2_session_next_data_read(session, stream); if (next_readmax == 0) { - /* This must be true since we only pop DATA frame item from queue when session->remote_window_size > 0 */ assert(session->remote_window_size > 0); @@ -2347,9 +1972,9 @@ static int session_prep_frame(nghttp2_session *session, return NGHTTP2_ERR_DEFERRED; } - rv = nghttp2_session_pack_data(session, &session->aob.framebufs, - next_readmax, frame, &item->aux_data.data, - stream); + rv = + nghttp2_session_pack_data(session, &session->aob.framebufs, next_readmax, + frame, &item->aux_data.data, stream); if (rv == NGHTTP2_ERR_PAUSE) { return rv; } @@ -2389,17 +2014,13 @@ static int session_prep_frame(nghttp2_session *session, nghttp2_stream *stream; stream = nghttp2_session_open_stream( - session, frame->hd.stream_id, NGHTTP2_STREAM_FLAG_NONE, - &frame->headers.pri_spec, NGHTTP2_STREAM_INITIAL, - aux_data->stream_user_data); + session, frame->hd.stream_id, NGHTTP2_STREAM_FLAG_NONE, + NGHTTP2_STREAM_INITIAL, aux_data->stream_user_data); if (stream == NULL) { return NGHTTP2_ERR_NOMEM; } - /* We don't call nghttp2_session_adjust_closed_stream() here, - since we don't keep closed stream in client side */ - rv = session_predicate_request_headers_send(session, item); if (rv != 0) { return rv; @@ -2438,8 +2059,8 @@ static int session_prep_frame(nghttp2_session *session, } estimated_payloadlen = session_estimate_headers_payload( - session, frame->headers.nva, frame->headers.nvlen, - NGHTTP2_PRIORITY_SPECLEN); + session, frame->headers.nva, frame->headers.nvlen, + NGHTTP2_PRIORITY_SPECLEN); if (estimated_payloadlen > session->max_send_header_block_length) { return NGHTTP2_ERR_FRAME_SIZE_ERROR; @@ -2452,7 +2073,7 @@ static int session_prep_frame(nghttp2_session *session, return rv; } - DEBUGF("send: before padding, HEADERS serialized in %zd bytes\n", + DEBUGF("send: before padding, HEADERS serialized in %zu bytes\n", nghttp2_bufs_len(&session->aob.framebufs)); rv = session_headers_add_pad(session, frame); @@ -2461,7 +2082,7 @@ static int session_prep_frame(nghttp2_session *session, return rv; } - DEBUGF("send: HEADERS finally serialized in %zd bytes\n", + DEBUGF("send: HEADERS finally serialized in %zu bytes\n", nghttp2_bufs_len(&session->aob.framebufs)); if (frame->headers.cat == NGHTTP2_HCAT_REQUEST) { @@ -2527,14 +2148,14 @@ static int session_prep_frame(nghttp2_session *session, assert(stream); estimated_payloadlen = session_estimate_headers_payload( - session, frame->push_promise.nva, frame->push_promise.nvlen, 0); + session, frame->push_promise.nva, frame->push_promise.nvlen, 0); if (estimated_payloadlen > session->max_send_header_block_length) { return NGHTTP2_ERR_FRAME_SIZE_ERROR; } rv = nghttp2_frame_pack_push_promise( - &session->aob.framebufs, &frame->push_promise, &session->hd_deflater); + &session->aob.framebufs, &frame->push_promise, &session->hd_deflater); if (rv != 0) { return rv; } @@ -2641,8 +2262,6 @@ static int session_prep_frame(nghttp2_session *session, nghttp2_outbound_item * nghttp2_session_get_next_ob_item(nghttp2_session *session) { - nghttp2_outbound_item *item; - if (nghttp2_outbound_queue_top(&session->ob_urgent)) { return nghttp2_outbound_queue_top(&session->ob_urgent); } @@ -2658,11 +2277,6 @@ nghttp2_session_get_next_ob_item(nghttp2_session *session) { } if (session->remote_window_size > 0) { - item = nghttp2_stream_next_outbound_item(&session->root); - if (item) { - return item; - } - return session_sched_get_next_outbound_item(session); } @@ -2697,11 +2311,6 @@ nghttp2_session_pop_next_ob_item(nghttp2_session *session) { } if (session->remote_window_size > 0) { - item = nghttp2_stream_next_outbound_item(&session->root); - if (item) { - return item; - } - return session_sched_get_next_outbound_item(session); } @@ -2760,7 +2369,6 @@ static int find_stream_on_goaway_func(void *entry, void *ptr) { nghttp2_session_close_stream() inside nghttp2_map_each(). Reuse closed_next member.. bad choice? */ assert(stream->closed_next == NULL); - assert(stream->closed_prev == NULL); if (arg->head) { stream->closed_next = arg->head; @@ -2816,11 +2424,6 @@ static void session_reschedule_stream(nghttp2_session *session, nghttp2_stream *stream) { stream->last_writelen = stream->item->frame.hd.length; - if (!(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES)) { - nghttp2_stream_reschedule(stream); - return; - } - if (!session->server) { return; } @@ -2878,7 +2481,7 @@ static int session_after_frame_sent1(nghttp2_session *session) { /* Call on_frame_send_callback after nghttp2_stream_detach_item(), so that application can issue - nghttp2_submit_data() in the callback. */ + nghttp2_submit_data2() in the callback. */ if (session->callbacks.on_frame_send_callback) { rv = session_call_on_frame_send(session, frame); if (nghttp2_is_fatal(rv)) { @@ -2890,7 +2493,7 @@ static int session_after_frame_sent1(nghttp2_session *session) { int stream_closed; stream_closed = - (stream->shut_flags & NGHTTP2_SHUT_RDWR) == NGHTTP2_SHUT_RDWR; + (stream->shut_flags & NGHTTP2_SHUT_RDWR) == NGHTTP2_SHUT_RDWR; nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_WR); @@ -2950,15 +2553,17 @@ static int session_after_frame_sent1(nghttp2_session *session) { } /* We assume aux_data is a pointer to nghttp2_headers_aux_data */ aux_data = &item->aux_data.headers; - if (aux_data->data_prd.read_callback) { - /* nghttp2_submit_data() makes a copy of aux_data->data_prd */ - rv = nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, - frame->hd.stream_id, &aux_data->data_prd); + if (aux_data->dpw.data_prd.read_callback) { + /* nghttp2_submit_data_shared() makes a copy of + aux_data->dpw */ + rv = nghttp2_submit_data_shared(session, NGHTTP2_FLAG_END_STREAM, + frame->hd.stream_id, &aux_data->dpw); if (nghttp2_is_fatal(rv)) { return rv; } - /* TODO nghttp2_submit_data() may fail if stream has already - DATA frame item. We might have to handle it here. */ + /* TODO nghttp2_submit_data_shared() may fail if stream has + already DATA frame item. We might have to handle it + here. */ } return 0; } @@ -2979,14 +2584,15 @@ static int session_after_frame_sent1(nghttp2_session *session) { } /* We assume aux_data is a pointer to nghttp2_headers_aux_data */ aux_data = &item->aux_data.headers; - if (aux_data->data_prd.read_callback) { - rv = nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, - frame->hd.stream_id, &aux_data->data_prd); + if (aux_data->dpw.data_prd.read_callback) { + rv = nghttp2_submit_data_shared(session, NGHTTP2_FLAG_END_STREAM, + frame->hd.stream_id, &aux_data->dpw); if (nghttp2_is_fatal(rv)) { return rv; } - /* TODO nghttp2_submit_data() may fail if stream has already - DATA frame item. We might have to handle it here. */ + /* TODO nghttp2_submit_data_shared() may fail if stream has + already DATA frame item. We might have to handle it + here. */ } return 0; default: @@ -2996,37 +2602,6 @@ static int session_after_frame_sent1(nghttp2_session *session) { } } case NGHTTP2_PRIORITY: - if (session->server || session->pending_no_rfc7540_priorities == 1) { - return 0; - } - - stream = nghttp2_session_get_stream_raw(session, frame->hd.stream_id); - - if (!stream) { - if (!session_detect_idle_stream(session, frame->hd.stream_id)) { - return 0; - } - - stream = nghttp2_session_open_stream( - session, frame->hd.stream_id, NGHTTP2_FLAG_NONE, - &frame->priority.pri_spec, NGHTTP2_STREAM_IDLE, NULL); - if (!stream) { - return NGHTTP2_ERR_NOMEM; - } - } else { - rv = nghttp2_session_reprioritize_stream(session, stream, - &frame->priority.pri_spec); - if (nghttp2_is_fatal(rv)) { - return rv; - } - } - - rv = nghttp2_session_adjust_idle_stream(session); - - if (nghttp2_is_fatal(rv)) { - return rv; - } - return 0; case NGHTTP2_RST_STREAM: rv = nghttp2_session_close_stream(session, frame->hd.stream_id, @@ -3041,7 +2616,6 @@ static int session_after_frame_sent1(nghttp2_session *session) { aux_data = &item->aux_data.goaway; if ((aux_data->flags & NGHTTP2_GOAWAY_AUX_SHUTDOWN_NOTICE) == 0) { - if (aux_data->flags & NGHTTP2_GOAWAY_AUX_TERM_ON_SEND) { session->goaway_flags |= NGHTTP2_GOAWAY_TERM_SENT; } @@ -3091,7 +2665,7 @@ static int session_after_frame_sent1(nghttp2_session *session) { rv = session_update_stream_consumed_size(session, stream, 0); } else { rv = - nghttp2_session_update_recv_stream_window_size(session, stream, 0, 1); + nghttp2_session_update_recv_stream_window_size(session, stream, 0, 1); } if (nghttp2_is_fatal(rv)) { @@ -3121,10 +2695,8 @@ static void session_after_frame_sent2(nghttp2_session *session) { frame = &item->frame; if (frame->hd.type != NGHTTP2_DATA) { - if (frame->hd.type == NGHTTP2_HEADERS || frame->hd.type == NGHTTP2_PUSH_PROMISE) { - if (nghttp2_bufs_next_present(framebufs)) { framebufs->cur = framebufs->cur->next; @@ -3145,7 +2717,7 @@ static void session_after_frame_sent2(nghttp2_session *session) { aux_data = &item->aux_data.data; /* On EOF, we have already detached data. Please note that - application may issue nghttp2_submit_data() in + application may issue nghttp2_submit_data2() in on_frame_send_callback (call from session_after_frame_sent1), which attach data to stream. We don't want to detach it. */ if (aux_data->eof) { @@ -3192,7 +2764,7 @@ static int session_call_send_data(nghttp2_session *session, aux_data = &item->aux_data.data; rv = session->callbacks.send_data_callback(session, frame, buf->pos, length, - &aux_data->data_prd.source, + &aux_data->dpw.data_prd.source, session->user_data); switch (rv) { @@ -3206,9 +2778,9 @@ static int session_call_send_data(nghttp2_session *session, } } -static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, - const uint8_t **data_ptr, - int fast_cb) { +static nghttp2_ssize nghttp2_session_mem_send_internal(nghttp2_session *session, + const uint8_t **data_ptr, + int fast_cb) { int rv; nghttp2_active_outbound_item *aob; nghttp2_bufs *framebufs; @@ -3218,14 +2790,6 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, aob = &session->aob; framebufs = &aob->framebufs; - /* We may have idle streams more than we expect (e.g., - nghttp2_session_change_stream_priority() or - nghttp2_session_create_idle_stream()). Adjust them here. */ - rv = nghttp2_session_adjust_idle_stream(session); - if (nghttp2_is_fatal(rv)) { - return rv; - } - for (;;) { switch (aob->state) { case NGHTTP2_OB_POP_ITEM: { @@ -3261,8 +2825,7 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, it. */ if (frame->hd.type != NGHTTP2_WINDOW_UPDATE && session->callbacks.on_frame_not_send_callback( - session, frame, rv, session->user_data) != 0) { - + session, frame, rv, session->user_data) != 0) { nghttp2_outbound_item_free(item, mem); nghttp2_mem_free(mem, item); @@ -3290,8 +2853,8 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, } if (opened_stream_id) { /* careful not to override rv */ - rv2 = nghttp2_session_close_stream(session, opened_stream_id, - error_code); + rv2 = + nghttp2_session_close_stream(session, opened_stream_id, error_code); } nghttp2_outbound_item_free(item, mem); @@ -3303,10 +2866,10 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, } if (rv == NGHTTP2_ERR_HEADER_COMP) { - /* If header compression error occurred, should terminiate + /* If header compression error occurred, should terminate connection. */ - rv = nghttp2_session_terminate_session(session, - NGHTTP2_INTERNAL_ERROR); + rv = + nghttp2_session_terminate_session(session, NGHTTP2_INTERNAL_ERROR); } if (nghttp2_is_fatal(rv)) { return rv; @@ -3339,7 +2902,7 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, if (session->callbacks.on_frame_not_send_callback) { if (session->callbacks.on_frame_not_send_callback( - session, frame, rv, session->user_data) != 0) { + session, frame, rv, session->user_data) != 0) { return NGHTTP2_ERR_CALLBACK_FAILURE; } } @@ -3386,7 +2949,7 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, } } - DEBUGF("send: start transmitting frame type=%u, length=%zd\n", + DEBUGF("send: start transmitting frame type=%u, length=%td\n", framebufs->cur->buf.pos[3], framebufs->cur->buf.last - framebufs->cur->buf.pos); @@ -3426,7 +2989,7 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, everything, we will adjust it. */ buf->pos += datalen; - return (ssize_t)datalen; + return (nghttp2_ssize)datalen; } case NGHTTP2_OB_SEND_NO_COPY: { nghttp2_stream *stream; @@ -3503,7 +3066,7 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, buf->pos += datalen; - return (ssize_t)datalen; + return (nghttp2_ssize)datalen; } } } @@ -3511,8 +3074,13 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, ssize_t nghttp2_session_mem_send(nghttp2_session *session, const uint8_t **data_ptr) { + return (ssize_t)nghttp2_session_mem_send2(session, data_ptr); +} + +nghttp2_ssize nghttp2_session_mem_send2(nghttp2_session *session, + const uint8_t **data_ptr) { int rv; - ssize_t len; + nghttp2_ssize len; *data_ptr = NULL; @@ -3529,7 +3097,7 @@ ssize_t nghttp2_session_mem_send(nghttp2_session *session, rv = session_after_frame_sent1(session); if (rv < 0) { assert(nghttp2_is_fatal(rv)); - return (ssize_t)rv; + return (nghttp2_ssize)rv; } } @@ -3538,8 +3106,8 @@ ssize_t nghttp2_session_mem_send(nghttp2_session *session, int nghttp2_session_send(nghttp2_session *session) { const uint8_t *data = NULL; - ssize_t datalen; - ssize_t sentlen; + nghttp2_ssize datalen; + nghttp2_ssize sentlen; nghttp2_bufs *framebufs; framebufs = &session->aob.framebufs; @@ -3549,8 +3117,13 @@ int nghttp2_session_send(nghttp2_session *session) { if (datalen <= 0) { return (int)datalen; } - sentlen = session->callbacks.send_callback(session, data, (size_t)datalen, - 0, session->user_data); + if (session->callbacks.send_callback2) { + sentlen = session->callbacks.send_callback2( + session, data, (size_t)datalen, 0, session->user_data); + } else { + sentlen = (nghttp2_ssize)session->callbacks.send_callback( + session, data, (size_t)datalen, 0, session->user_data); + } if (sentlen < 0) { if (sentlen == NGHTTP2_ERR_WOULDBLOCK) { /* Transmission canceled. Rewind the offset */ @@ -3565,11 +3138,17 @@ int nghttp2_session_send(nghttp2_session *session) { } } -static ssize_t session_recv(nghttp2_session *session, uint8_t *buf, - size_t len) { - ssize_t rv; - rv = session->callbacks.recv_callback(session, buf, len, 0, - session->user_data); +static nghttp2_ssize session_recv(nghttp2_session *session, uint8_t *buf, + size_t len) { + nghttp2_ssize rv; + + if (session->callbacks.recv_callback2) { + rv = session->callbacks.recv_callback2(session, buf, len, 0, + session->user_data); + } else { + rv = (nghttp2_ssize)session->callbacks.recv_callback(session, buf, len, 0, + session->user_data); + } if (rv > 0) { if ((size_t)rv > len) { return NGHTTP2_ERR_CALLBACK_FAILURE; @@ -3585,7 +3164,6 @@ static int session_call_on_begin_frame(nghttp2_session *session, int rv; if (session->callbacks.on_begin_frame_callback) { - rv = session->callbacks.on_begin_frame_callback(session, hd, session->user_data); @@ -3634,11 +3212,11 @@ static int session_call_on_header(nghttp2_session *session, int rv = 0; if (session->callbacks.on_header_callback2) { rv = session->callbacks.on_header_callback2( - session, frame, nv->name, nv->value, nv->flags, session->user_data); + session, frame, nv->name, nv->value, nv->flags, session->user_data); } else if (session->callbacks.on_header_callback) { rv = session->callbacks.on_header_callback( - session, frame, nv->name->base, nv->name->len, nv->value->base, - nv->value->len, nv->flags, session->user_data); + session, frame, nv->name->base, nv->name->len, nv->value->base, + nv->value->len, nv->flags, session->user_data); } if (rv == NGHTTP2_ERR_PAUSE || rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { @@ -3657,11 +3235,11 @@ static int session_call_on_invalid_header(nghttp2_session *session, int rv; if (session->callbacks.on_invalid_header_callback2) { rv = session->callbacks.on_invalid_header_callback2( - session, frame, nv->name, nv->value, nv->flags, session->user_data); + session, frame, nv->name, nv->value, nv->flags, session->user_data); } else if (session->callbacks.on_invalid_header_callback) { rv = session->callbacks.on_invalid_header_callback( - session, frame, nv->name->base, nv->name->len, nv->value->base, - nv->value->len, nv->flags, session->user_data); + session, frame, nv->name->base, nv->name->len, nv->value->base, + nv->value->len, nv->flags, session->user_data); } else { return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } @@ -3685,7 +3263,7 @@ session_call_on_extension_chunk_recv_callback(nghttp2_session *session, if (session->callbacks.on_extension_chunk_recv_callback) { rv = session->callbacks.on_extension_chunk_recv_callback( - session, &frame->hd, data, len, session->user_data); + session, &frame->hd, data, len, session->user_data); if (rv == NGHTTP2_ERR_CANCEL) { return rv; } @@ -3704,7 +3282,7 @@ static int session_call_unpack_extension_callback(nghttp2_session *session) { void *payload = NULL; rv = session->callbacks.unpack_extension_callback( - session, &payload, &frame->hd, session->user_data); + session, &payload, &frame->hd, session->user_data); if (rv == NGHTTP2_ERR_CANCEL) { return rv; } @@ -3767,7 +3345,7 @@ static int session_call_on_invalid_frame_recv_callback(nghttp2_session *session, int lib_error_code) { if (session->callbacks.on_invalid_frame_recv_callback) { if (session->callbacks.on_invalid_frame_recv_callback( - session, frame, lib_error_code, session->user_data) != 0) { + session, frame, lib_error_code, session->user_data) != 0) { return NGHTTP2_ERR_CALLBACK_FAILURE; } } @@ -3780,13 +3358,13 @@ static int session_handle_invalid_stream2(nghttp2_session *session, int lib_error_code) { int rv; rv = nghttp2_session_add_rst_stream( - session, stream_id, get_error_code_from_lib_error_code(lib_error_code)); + session, stream_id, get_error_code_from_lib_error_code(lib_error_code)); if (rv != 0) { return rv; } if (session->callbacks.on_invalid_frame_recv_callback) { if (session->callbacks.on_invalid_frame_recv_callback( - session, frame, lib_error_code, session->user_data) != 0) { + session, frame, lib_error_code, session->user_data) != 0) { return NGHTTP2_ERR_CALLBACK_FAILURE; } } @@ -3820,12 +3398,12 @@ static int session_handle_invalid_connection(nghttp2_session *session, const char *reason) { if (session->callbacks.on_invalid_frame_recv_callback) { if (session->callbacks.on_invalid_frame_recv_callback( - session, frame, lib_error_code, session->user_data) != 0) { + session, frame, lib_error_code, session->user_data) != 0) { return NGHTTP2_ERR_CALLBACK_FAILURE; } } return nghttp2_session_terminate_session_with_reason( - session, get_error_code_from_lib_error_code(lib_error_code), reason); + session, get_error_code_from_lib_error_code(lib_error_code), reason); } static int session_inflate_handle_invalid_connection(nghttp2_session *session, @@ -3834,7 +3412,7 @@ static int session_inflate_handle_invalid_connection(nghttp2_session *session, const char *reason) { int rv; rv = - session_handle_invalid_connection(session, frame, lib_error_code, reason); + session_handle_invalid_connection(session, frame, lib_error_code, reason); if (nghttp2_is_fatal(rv)) { return rv; } @@ -3871,7 +3449,7 @@ static int session_inflate_handle_invalid_connection(nghttp2_session *session, static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, size_t *readlen_ptr, uint8_t *in, size_t inlen, int final, int call_header_cb) { - ssize_t proclen; + nghttp2_ssize proclen; int rv; int inflate_flags; nghttp2_hd_nv nv; @@ -3884,7 +3462,7 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, if (frame->hd.type == NGHTTP2_PUSH_PROMISE) { subject_stream = nghttp2_session_get_stream( - session, frame->push_promise.promised_stream_id); + session, frame->push_promise.promised_stream_id); } else { subject_stream = stream; trailer = session_trailer_headers(session, stream, frame); @@ -3905,7 +3483,7 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, from invoking subsequent callbacks for the same stream ID. */ rv = nghttp2_session_add_rst_stream( - session, subject_stream->stream_id, NGHTTP2_COMPRESSION_ERROR); + session, subject_stream->stream_id, NGHTTP2_COMPRESSION_ERROR); if (nghttp2_is_fatal(rv)) { return rv; @@ -3913,7 +3491,7 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, } } rv = - nghttp2_session_terminate_session(session, NGHTTP2_COMPRESSION_ERROR); + nghttp2_session_terminate_session(session, NGHTTP2_COMPRESSION_ERROR); if (nghttp2_is_fatal(rv)) { return rv; } @@ -3924,7 +3502,7 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, inlen -= (size_t)proclen; *readlen_ptr += (size_t)proclen; - DEBUGF("recv: proclen=%zd\n", proclen); + DEBUGF("recv: proclen=%td\n", proclen); if (call_header_cb && (inflate_flags & NGHTTP2_HD_INFLATE_EMIT)) { rv = 0; @@ -3951,11 +3529,11 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, nv.name->base, (int)nv.value->len, nv.value->base); rv2 = session_call_error_callback( - session, NGHTTP2_ERR_HTTP_HEADER, - "Ignoring received invalid HTTP header field: frame type: " - "%u, stream: %d, name: [%.*s], value: [%.*s]", - frame->hd.type, frame->hd.stream_id, (int)nv.name->len, - nv.name->base, (int)nv.value->len, nv.value->base); + session, NGHTTP2_ERR_HTTP_HEADER, + "Ignoring received invalid HTTP header field: frame type: " + "%u, stream: %d, name: [%.*s], value: [%.*s]", + frame->hd.type, frame->hd.stream_id, (int)nv.name->len, + nv.name->base, (int)nv.value->len, nv.value->base); if (nghttp2_is_fatal(rv2)) { return rv2; @@ -3969,19 +3547,19 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame, nv.name->base, (int)nv.value->len, nv.value->base); rv = session_call_error_callback( - session, NGHTTP2_ERR_HTTP_HEADER, - "Invalid HTTP header field was received: frame type: " - "%u, stream: %d, name: [%.*s], value: [%.*s]", - frame->hd.type, frame->hd.stream_id, (int)nv.name->len, - nv.name->base, (int)nv.value->len, nv.value->base); + session, NGHTTP2_ERR_HTTP_HEADER, + "Invalid HTTP header field was received: frame type: " + "%u, stream: %d, name: [%.*s], value: [%.*s]", + frame->hd.type, frame->hd.stream_id, (int)nv.name->len, + nv.name->base, (int)nv.value->len, nv.value->base); if (nghttp2_is_fatal(rv)) { return rv; } - rv = session_handle_invalid_stream2(session, - subject_stream->stream_id, - frame, NGHTTP2_ERR_HTTP_HEADER); + rv = + session_handle_invalid_stream2(session, subject_stream->stream_id, + frame, NGHTTP2_ERR_HTTP_HEADER); if (nghttp2_is_fatal(rv)) { return rv; } @@ -4029,7 +3607,6 @@ static int session_end_stream_headers_received(nghttp2_session *session, if (session->server && session_enforce_http_messaging(session) && frame->headers.cat == NGHTTP2_HCAT_REQUEST && - (stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES) && !(stream->flags & NGHTTP2_STREAM_FLAG_IGNORE_CLIENT_PRIORITIES) && (stream->http_flags & NGHTTP2_HTTP_FLAG_PRIORITY)) { rv = session_update_stream_priority(session, stream, stream->http_extpri); @@ -4069,7 +3646,7 @@ static int session_after_header_block_received(nghttp2_session *session) { nghttp2_stream *subject_stream; subject_stream = nghttp2_session_get_stream( - session, frame->push_promise.promised_stream_id); + session, frame->push_promise.promised_stream_id); if (subject_stream) { rv = nghttp2_http_on_request_headers(subject_stream, frame); } @@ -4141,7 +3718,7 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session, nghttp2_stream *stream; if (frame->hd.stream_id == 0) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "request HEADERS: stream_id == 0"); + session, frame, NGHTTP2_ERR_PROTO, "request HEADERS: stream_id == 0"); } /* If client receives idle stream from server, it is invalid @@ -4150,8 +3727,8 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session, if (!session->server) { if (session_detect_idle_stream(session, frame->hd.stream_id)) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "request HEADERS: client received request"); + session, frame, NGHTTP2_ERR_PROTO, + "request HEADERS: client received request"); } return NGHTTP2_ERR_IGN_HEADER_BLOCK; @@ -4163,8 +3740,8 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session, if (frame->hd.stream_id == 0 || nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "request HEADERS: invalid stream_id"); + session, frame, NGHTTP2_ERR_PROTO, + "request HEADERS: invalid stream_id"); } /* RFC 7540 says if an endpoint receives a HEADERS with invalid @@ -4190,7 +3767,7 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session, stream = nghttp2_session_get_stream_raw(session, frame->hd.stream_id); if (stream && (stream->shut_flags & NGHTTP2_SHUT_RD)) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_STREAM_CLOSED, "HEADERS: stream closed"); + session, frame, NGHTTP2_ERR_STREAM_CLOSED, "HEADERS: stream closed"); } return NGHTTP2_ERR_IGN_HEADER_BLOCK; @@ -4199,8 +3776,8 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session, if (session_is_incoming_concurrent_streams_max(session)) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "request HEADERS: max concurrent streams exceeded"); + session, frame, NGHTTP2_ERR_PROTO, + "request HEADERS: max concurrent streams exceeded"); } if (!session_allow_incoming_new_stream(session)) { @@ -4210,7 +3787,7 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session, if (frame->headers.pri_spec.stream_id == frame->hd.stream_id) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "request HEADERS: depend on itself"); + session, frame, NGHTTP2_ERR_PROTO, "request HEADERS: depend on itself"); } if (session_is_incoming_concurrent_streams_pending_max(session)) { @@ -4218,18 +3795,13 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session, NGHTTP2_ERR_REFUSED_STREAM); } - stream = nghttp2_session_open_stream( - session, frame->hd.stream_id, NGHTTP2_STREAM_FLAG_NONE, - &frame->headers.pri_spec, NGHTTP2_STREAM_OPENING, NULL); + stream = nghttp2_session_open_stream(session, frame->hd.stream_id, + NGHTTP2_STREAM_FLAG_NONE, + NGHTTP2_STREAM_OPENING, NULL); if (!stream) { return NGHTTP2_ERR_NOMEM; } - rv = nghttp2_session_adjust_closed_stream(session); - if (nghttp2_is_fatal(rv)) { - return rv; - } - session->last_proc_stream_id = session->last_recv_stream_id; rv = session_call_on_begin_headers(session, frame); @@ -4249,7 +3821,7 @@ int nghttp2_session_on_response_headers_received(nghttp2_session *session, nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)); if (frame->hd.stream_id == 0) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "response HEADERS: stream_id == 0"); + session, frame, NGHTTP2_ERR_PROTO, "response HEADERS: stream_id == 0"); } if (stream->shut_flags & NGHTTP2_SHUT_RD) { /* half closed (remote): from the spec: @@ -4261,7 +3833,7 @@ int nghttp2_session_on_response_headers_received(nghttp2_session *session, We go further, and make it connection error. */ return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_STREAM_CLOSED, "HEADERS: stream closed"); + session, frame, NGHTTP2_ERR_STREAM_CLOSED, "HEADERS: stream closed"); } stream->state = NGHTTP2_STREAM_OPENED; rv = session_call_on_begin_headers(session, frame); @@ -4278,20 +3850,20 @@ int nghttp2_session_on_push_response_headers_received(nghttp2_session *session, assert(stream->state == NGHTTP2_STREAM_RESERVED); if (frame->hd.stream_id == 0) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "push response HEADERS: stream_id == 0"); + session, frame, NGHTTP2_ERR_PROTO, + "push response HEADERS: stream_id == 0"); } if (session->server) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "HEADERS: no HEADERS allowed from client in reserved state"); + session, frame, NGHTTP2_ERR_PROTO, + "HEADERS: no HEADERS allowed from client in reserved state"); } if (session_is_incoming_concurrent_streams_max(session)) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "push response HEADERS: max concurrent streams exceeded"); + session, frame, NGHTTP2_ERR_PROTO, + "push response HEADERS: max concurrent streams exceeded"); } if (!session_allow_incoming_new_stream(session)) { @@ -4322,7 +3894,7 @@ int nghttp2_session_on_headers_received(nghttp2_session *session, int rv = 0; if (frame->hd.stream_id == 0) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "HEADERS: stream_id == 0"); + session, frame, NGHTTP2_ERR_PROTO, "HEADERS: stream_id == 0"); } if ((stream->shut_flags & NGHTTP2_SHUT_RD)) { /* half closed (remote): from the spec: @@ -4334,7 +3906,7 @@ int nghttp2_session_on_headers_received(nghttp2_session *session, we go further, and make it connection error. */ return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_STREAM_CLOSED, "HEADERS: stream closed"); + session, frame, NGHTTP2_ERR_STREAM_CLOSED, "HEADERS: stream closed"); } if (nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) { if (stream->state == NGHTTP2_STREAM_OPENED) { @@ -4390,77 +3962,6 @@ static int session_process_headers_frame(nghttp2_session *session) { return nghttp2_session_on_headers_received(session, frame, stream); } -int nghttp2_session_on_priority_received(nghttp2_session *session, - nghttp2_frame *frame) { - int rv; - nghttp2_stream *stream; - - assert(!session_no_rfc7540_pri_no_fallback(session)); - - if (frame->hd.stream_id == 0) { - return session_handle_invalid_connection(session, frame, NGHTTP2_ERR_PROTO, - "PRIORITY: stream_id == 0"); - } - - if (frame->priority.pri_spec.stream_id == frame->hd.stream_id) { - return nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, "depend on itself"); - } - - if (!session->server) { - /* Re-prioritization works only in server */ - return session_call_on_frame_received(session, frame); - } - - stream = nghttp2_session_get_stream_raw(session, frame->hd.stream_id); - - if (!stream) { - /* PRIORITY against idle stream can create anchor node in - dependency tree. */ - if (!session_detect_idle_stream(session, frame->hd.stream_id)) { - return 0; - } - - stream = nghttp2_session_open_stream( - session, frame->hd.stream_id, NGHTTP2_STREAM_FLAG_NONE, - &frame->priority.pri_spec, NGHTTP2_STREAM_IDLE, NULL); - - if (stream == NULL) { - return NGHTTP2_ERR_NOMEM; - } - - rv = nghttp2_session_adjust_idle_stream(session); - if (nghttp2_is_fatal(rv)) { - return rv; - } - } else { - rv = nghttp2_session_reprioritize_stream(session, stream, - &frame->priority.pri_spec); - - if (nghttp2_is_fatal(rv)) { - return rv; - } - - rv = nghttp2_session_adjust_idle_stream(session); - if (nghttp2_is_fatal(rv)) { - return rv; - } - } - - return session_call_on_frame_received(session, frame); -} - -static int session_process_priority_frame(nghttp2_session *session) { - nghttp2_inbound_frame *iframe = &session->iframe; - nghttp2_frame *frame = &iframe->frame; - - assert(!session_no_rfc7540_pri_no_fallback(session)); - - nghttp2_frame_unpack_priority_payload(&frame->priority, iframe->sbuf.pos); - - return nghttp2_session_on_priority_received(session, frame); -} - static int session_update_stream_reset_ratelim(nghttp2_session *session) { if (!session->server || (session->goaway_flags & NGHTTP2_GOAWAY_SUBMITTED)) { return 0; @@ -4529,7 +4030,7 @@ static int update_remote_initial_window_size_func(void *entry, void *ptr) { stream = (nghttp2_stream *)entry; rv = nghttp2_stream_update_remote_initial_window_size( - stream, arg->new_window_size, arg->old_window_size); + stream, arg->new_window_size, arg->old_window_size); if (rv != 0) { return nghttp2_session_add_rst_stream(arg->session, stream->stream_id, NGHTTP2_FLOW_CONTROL_ERROR); @@ -4539,9 +4040,8 @@ static int update_remote_initial_window_size_func(void *entry, void *ptr) { outbound queue. */ if (stream->remote_window_size > 0 && nghttp2_stream_check_deferred_by_flow_control(stream)) { - rv = session_resume_deferred_stream_item( - arg->session, stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); + arg->session, stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); if (nghttp2_is_fatal(rv)) { return rv; @@ -4580,7 +4080,7 @@ static int update_local_initial_window_size_func(void *entry, void *ptr) { arg = (nghttp2_update_window_size_arg *)ptr; stream = (nghttp2_stream *)entry; rv = nghttp2_stream_update_local_initial_window_size( - stream, arg->new_window_size, arg->old_window_size); + stream, arg->new_window_size, arg->old_window_size); if (rv != 0) { return nghttp2_session_add_rst_stream(arg->session, stream->stream_id, NGHTTP2_FLOW_CONTROL_ERROR); @@ -4596,7 +4096,6 @@ static int update_local_initial_window_size_func(void *entry, void *ptr) { if (nghttp2_should_send_window_update(stream->local_window_size, stream->recv_window_size)) { - rv = nghttp2_session_add_window_update(arg->session, NGHTTP2_FLAG_NONE, stream->stream_id, stream->recv_window_size); @@ -4661,7 +4160,8 @@ int nghttp2_session_update_local_settings(nghttp2_session *session, case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: header_table_size_seen = 1; header_table_size = iv[i].value; - min_header_table_size = nghttp2_min(min_header_table_size, iv[i].value); + min_header_table_size = + nghttp2_min_uint32(min_header_table_size, iv[i].value); break; case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: new_initial_window_size = (int32_t)iv[i].value; @@ -4685,8 +4185,8 @@ int nghttp2_session_update_local_settings(nghttp2_session *session, } if (new_initial_window_size != -1) { rv = session_update_local_initial_window_size( - session, new_initial_window_size, - (int32_t)session->local_settings.initial_window_size); + session, new_initial_window_size, + (int32_t)session->local_settings.initial_window_size); if (rv != 0) { return rv; } @@ -4740,15 +4240,15 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, if (frame->hd.flags & NGHTTP2_FLAG_ACK) { if (frame->settings.niv != 0) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_FRAME_SIZE_ERROR, - "SETTINGS: ACK and payload != 0"); + session, frame, NGHTTP2_ERR_FRAME_SIZE_ERROR, + "SETTINGS: ACK and payload != 0"); } settings = session->inflight_settings_head; if (!settings) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "SETTINGS: unexpected ACK"); + session, frame, NGHTTP2_ERR_PROTO, "SETTINGS: unexpected ACK"); } rv = nghttp2_session_update_local_settings(session, settings->iv, @@ -4769,7 +4269,7 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, if (!session->remote_settings_received) { session->remote_settings.max_concurrent_streams = - NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS; + NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS; session->remote_settings_received = 1; } @@ -4786,7 +4286,7 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, return rv; } else { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_HEADER_COMP, NULL); + session, frame, NGHTTP2_ERR_HEADER_COMP, NULL); } } @@ -4797,14 +4297,14 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, if (entry->value != 0 && entry->value != 1) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "SETTINGS: invalid SETTINGS_ENBLE_PUSH"); + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: invalid SETTINGS_ENBLE_PUSH"); } if (!session->server && entry->value != 0) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "SETTINGS: server attempted to enable push"); + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: server attempted to enable push"); } session->remote_settings.enable_push = entry->value; @@ -4821,8 +4321,8 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, /* Check that initial_window_size < (1u << 31) */ if (entry->value > NGHTTP2_MAX_WINDOW_SIZE) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_FLOW_CONTROL, - "SETTINGS: too large SETTINGS_INITIAL_WINDOW_SIZE"); + session, frame, NGHTTP2_ERR_FLOW_CONTROL, + "SETTINGS: too large SETTINGS_INITIAL_WINDOW_SIZE"); } rv = session_update_remote_initial_window_size(session, @@ -4834,7 +4334,7 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, if (rv != 0) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_FLOW_CONTROL, NULL); + session, frame, NGHTTP2_ERR_FLOW_CONTROL, NULL); } session->remote_settings.initial_window_size = entry->value; @@ -4845,8 +4345,8 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, if (entry->value < NGHTTP2_MAX_FRAME_SIZE_MIN || entry->value > NGHTTP2_MAX_FRAME_SIZE_MAX) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "SETTINGS: invalid SETTINGS_MAX_FRAME_SIZE"); + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: invalid SETTINGS_MAX_FRAME_SIZE"); } session->remote_settings.max_frame_size = entry->value; @@ -4861,17 +4361,17 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, if (entry->value != 0 && entry->value != 1) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "SETTINGS: invalid SETTINGS_ENABLE_CONNECT_PROTOCOL"); + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: invalid SETTINGS_ENABLE_CONNECT_PROTOCOL"); } if (!session->server && session->remote_settings.enable_connect_protocol && entry->value == 0) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "SETTINGS: server attempted to disable " - "SETTINGS_ENABLE_CONNECT_PROTOCOL"); + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: server attempted to disable " + "SETTINGS_ENABLE_CONNECT_PROTOCOL"); } session->remote_settings.enable_connect_protocol = entry->value; @@ -4881,15 +4381,15 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, if (entry->value != 0 && entry->value != 1) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "SETTINGS: invalid SETTINGS_NO_RFC7540_PRIORITIES"); + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: invalid SETTINGS_NO_RFC7540_PRIORITIES"); } if (session->remote_settings.no_rfc7540_priorities != UINT32_MAX && session->remote_settings.no_rfc7540_priorities != entry->value) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "SETTINGS: SETTINGS_NO_RFC7540_PRIORITIES cannot be changed"); + session, frame, NGHTTP2_ERR_PROTO, + "SETTINGS: SETTINGS_NO_RFC7540_PRIORITIES cannot be changed"); } session->remote_settings.no_rfc7540_priorities = entry->value; @@ -4900,12 +4400,6 @@ int nghttp2_session_on_settings_received(nghttp2_session *session, if (session->remote_settings.no_rfc7540_priorities == UINT32_MAX) { session->remote_settings.no_rfc7540_priorities = 0; - - if (session->server && session->pending_no_rfc7540_priorities && - (session->opt_flags & - NGHTTP2_OPTMASK_SERVER_FALLBACK_RFC7540_PRIORITIES)) { - session->fallback_rfc7540_priorities = 1; - } } if (!noack && !session_is_closing(session)) { @@ -4966,20 +4460,19 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session, int rv; nghttp2_stream *stream; nghttp2_stream *promised_stream; - nghttp2_priority_spec pri_spec; if (frame->hd.stream_id == 0) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: stream_id == 0"); + session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: stream_id == 0"); } if (session->server || session->local_settings.enable_push == 0) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: push disabled"); + session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: push disabled"); } if (!nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: invalid stream_id"); + session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: invalid stream_id"); } if (!session_allow_incoming_new_stream(session)) { @@ -4993,13 +4486,13 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session, illegal stream ID is subject to a connection error of type PROTOCOL_ERROR. */ return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "PUSH_PROMISE: invalid promised_stream_id"); + session, frame, NGHTTP2_ERR_PROTO, + "PUSH_PROMISE: invalid promised_stream_id"); } if (session_detect_idle_stream(session, frame->hd.stream_id)) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: stream in idle"); + session, frame, NGHTTP2_ERR_PROTO, "PUSH_PROMISE: stream in idle"); } session->last_recv_stream_id = frame->push_promise.promised_stream_id; @@ -5007,12 +4500,12 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session, if (!stream || stream->state == NGHTTP2_STREAM_CLOSING || !session->pending_enable_push || session->num_incoming_reserved_streams >= - session->max_incoming_reserved_streams) { + session->max_incoming_reserved_streams) { /* Currently, client does not retain closed stream, so we don't check NGHTTP2_SHUT_RD condition here. */ rv = nghttp2_session_add_rst_stream( - session, frame->push_promise.promised_stream_id, NGHTTP2_CANCEL); + session, frame->push_promise.promised_stream_id, NGHTTP2_CANCEL); if (rv != 0) { return rv; } @@ -5021,24 +4514,17 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session, if (stream->shut_flags & NGHTTP2_SHUT_RD) { return session_inflate_handle_invalid_connection( - session, frame, NGHTTP2_ERR_STREAM_CLOSED, - "PUSH_PROMISE: stream closed"); + session, frame, NGHTTP2_ERR_STREAM_CLOSED, "PUSH_PROMISE: stream closed"); } - nghttp2_priority_spec_init(&pri_spec, stream->stream_id, - NGHTTP2_DEFAULT_WEIGHT, 0); - promised_stream = nghttp2_session_open_stream( - session, frame->push_promise.promised_stream_id, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec, NGHTTP2_STREAM_RESERVED, NULL); + session, frame->push_promise.promised_stream_id, NGHTTP2_STREAM_FLAG_NONE, + NGHTTP2_STREAM_RESERVED, NULL); if (!promised_stream) { return NGHTTP2_ERR_NOMEM; } - /* We don't call nghttp2_session_adjust_closed_stream(), since we - don't keep closed stream in client side */ - session->last_proc_stream_id = session->last_recv_stream_id; rv = session_call_on_begin_headers(session, frame); if (rv != 0) { @@ -5137,8 +4623,8 @@ session_on_connection_window_update_received(nghttp2_session *session, /* Handle connection-level flow control */ if (frame->window_update.window_size_increment == 0) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "WINDOW_UPDATE: window_size_increment == 0"); + session, frame, NGHTTP2_ERR_PROTO, + "WINDOW_UPDATE: window_size_increment == 0"); } if (NGHTTP2_MAX_WINDOW_SIZE - frame->window_update.window_size_increment < @@ -5167,12 +4653,12 @@ static int session_on_stream_window_update_received(nghttp2_session *session, } if (state_reserved_remote(session, stream)) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, "WINDOW_UPADATE to reserved stream"); + session, frame, NGHTTP2_ERR_PROTO, "WINDOW_UPADATE to reserved stream"); } if (frame->window_update.window_size_increment == 0) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "WINDOW_UPDATE: window_size_increment == 0"); + session, frame, NGHTTP2_ERR_PROTO, + "WINDOW_UPDATE: window_size_increment == 0"); } if (NGHTTP2_MAX_WINDOW_SIZE - frame->window_update.window_size_increment < stream->remote_window_size) { @@ -5183,9 +4669,8 @@ static int session_on_stream_window_update_received(nghttp2_session *session, if (stream->remote_window_size > 0 && nghttp2_stream_check_deferred_by_flow_control(stream)) { - rv = session_resume_deferred_stream_item( - session, stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); + session, stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); if (nghttp2_is_fatal(rv)) { return rv; @@ -5260,7 +4745,6 @@ int nghttp2_session_on_priority_update_received(nghttp2_session *session, nghttp2_frame *frame) { nghttp2_ext_priority_update *priority_update; nghttp2_stream *stream; - nghttp2_priority_spec pri_spec; nghttp2_extpri extpri; int rv; @@ -5276,8 +4760,8 @@ int nghttp2_session_on_priority_update_received(nghttp2_session *session, if (nghttp2_session_is_my_stream_id(session, priority_update->stream_id)) { if (session_detect_idle_stream(session, priority_update->stream_id)) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "PRIORITY_UPDATE: prioritizing idle push is not allowed"); + session, frame, NGHTTP2_ERR_PROTO, + "PRIORITY_UPDATE: prioritizing idle push is not allowed"); } /* TODO Ignore priority signal to a push stream for now */ @@ -5294,14 +4778,13 @@ int nghttp2_session_on_priority_update_received(nghttp2_session *session, if (session->num_idle_streams + session->num_incoming_streams >= session->local_settings.max_concurrent_streams) { return session_handle_invalid_connection( - session, frame, NGHTTP2_ERR_PROTO, - "PRIORITY_UPDATE: max concurrent streams exceeded"); + session, frame, NGHTTP2_ERR_PROTO, + "PRIORITY_UPDATE: max concurrent streams exceeded"); } - nghttp2_priority_spec_default_init(&pri_spec); - stream = nghttp2_session_open_stream(session, priority_update->stream_id, - NGHTTP2_FLAG_NONE, &pri_spec, - NGHTTP2_STREAM_IDLE, NULL); + stream = + nghttp2_session_open_stream(session, priority_update->stream_id, + NGHTTP2_FLAG_NONE, NGHTTP2_STREAM_IDLE, NULL); if (!stream) { return NGHTTP2_ERR_NOMEM; } @@ -5335,8 +4818,8 @@ static int session_process_altsvc_frame(nghttp2_session *session) { nghttp2_frame *frame = &iframe->frame; nghttp2_frame_unpack_altsvc_payload( - &frame->ext, nghttp2_get_uint16(iframe->sbuf.pos), iframe->lbuf.pos, - nghttp2_buf_len(&iframe->lbuf)); + &frame->ext, nghttp2_get_uint16(iframe->sbuf.pos), iframe->lbuf.pos, + nghttp2_buf_len(&iframe->lbuf)); /* nghttp2_frame_unpack_altsvc_payload steals buffer from iframe->lbuf */ @@ -5489,9 +4972,8 @@ int nghttp2_session_update_recv_stream_window_size(nghttp2_session *session, stream->window_update_queued == 0 && nghttp2_should_send_window_update(stream->local_window_size, stream->recv_window_size)) { - rv = nghttp2_session_add_window_update(session, NGHTTP2_FLAG_NONE, - stream->stream_id, - stream->recv_window_size); + rv = nghttp2_session_add_window_update( + session, NGHTTP2_FLAG_NONE, stream->stream_id, stream->recv_window_size); if (rv != 0) { return rv; } @@ -5547,7 +5029,7 @@ static int session_update_consumed_size(nghttp2_session *session, /* recv_window_size may be smaller than consumed_size, because it may be decreased by negative value with nghttp2_submit_window_update(). */ - recv_size = nghttp2_min(*consumed_size_ptr, *recv_window_size_ptr); + recv_size = nghttp2_min_int32(*consumed_size_ptr, *recv_window_size_ptr); if (nghttp2_should_send_window_update(local_window_size, recv_size)) { rv = nghttp2_session_add_window_update(session, NGHTTP2_FLAG_NONE, @@ -5569,16 +5051,16 @@ static int session_update_stream_consumed_size(nghttp2_session *session, nghttp2_stream *stream, size_t delta_size) { return session_update_consumed_size( - session, &stream->consumed_size, &stream->recv_window_size, - stream->window_update_queued, stream->stream_id, delta_size, - stream->local_window_size); + session, &stream->consumed_size, &stream->recv_window_size, + stream->window_update_queued, stream->stream_id, delta_size, + stream->local_window_size); } static int session_update_connection_consumed_size(nghttp2_session *session, size_t delta_size) { return session_update_consumed_size( - session, &session->consumed_size, &session->recv_window_size, - session->window_update_queued, 0, delta_size, session->local_window_size); + session, &session->consumed_size, &session->recv_window_size, + session->window_update_queued, 0, delta_size, session->local_window_size); } /* @@ -5670,7 +5152,7 @@ static int session_on_data_received_fail_fast(nghttp2_session *session) { static size_t inbound_frame_payload_readlen(nghttp2_inbound_frame *iframe, const uint8_t *in, const uint8_t *last) { - return nghttp2_min((size_t)(last - in), iframe->payloadleft); + return nghttp2_min_size((size_t)(last - in), iframe->payloadleft); } /* @@ -5685,8 +5167,8 @@ static size_t inbound_frame_buf_read(nghttp2_inbound_frame *iframe, const uint8_t *in, const uint8_t *last) { size_t readlen; - readlen = - nghttp2_min((size_t)(last - in), nghttp2_buf_mark_avail(&iframe->sbuf)); + readlen = nghttp2_min_size((size_t)(last - in), + nghttp2_buf_mark_avail(&iframe->sbuf)); iframe->sbuf.last = nghttp2_cpymem(iframe->sbuf.last, in, readlen); @@ -5764,7 +5246,7 @@ static int inbound_frame_handle_pad(nghttp2_inbound_frame *iframe, * Computes number of padding based on flags. This function returns * the calculated length if it succeeds, or -1. */ -static ssize_t inbound_frame_compute_pad(nghttp2_inbound_frame *iframe) { +static nghttp2_ssize inbound_frame_compute_pad(nghttp2_inbound_frame *iframe) { size_t padlen; /* 1 for Pad Length field */ @@ -5779,7 +5261,7 @@ static ssize_t inbound_frame_compute_pad(nghttp2_inbound_frame *iframe) { iframe->padlen = padlen; - return (ssize_t)padlen; + return (nghttp2_ssize)padlen; } /* @@ -5788,11 +5270,11 @@ static ssize_t inbound_frame_compute_pad(nghttp2_inbound_frame *iframe) { * |payloadleft| does not include |readlen|. If padding was started * strictly before this data chunk, this function returns -1. */ -static ssize_t inbound_frame_effective_readlen(nghttp2_inbound_frame *iframe, - size_t payloadleft, - size_t readlen) { +static nghttp2_ssize +inbound_frame_effective_readlen(nghttp2_inbound_frame *iframe, + size_t payloadleft, size_t readlen) { size_t trail_padlen = - nghttp2_frame_trail_padlen(&iframe->frame, iframe->padlen); + nghttp2_frame_trail_padlen(&iframe->frame, iframe->padlen); if (trail_padlen > payloadleft) { size_t padlen; @@ -5800,19 +5282,24 @@ static ssize_t inbound_frame_effective_readlen(nghttp2_inbound_frame *iframe, if (readlen < padlen) { return -1; } - return (ssize_t)(readlen - padlen); + return (nghttp2_ssize)(readlen - padlen); } - return (ssize_t)(readlen); + return (nghttp2_ssize)(readlen); } static const uint8_t static_in[] = {0}; ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, size_t inlen) { + return (ssize_t)nghttp2_session_mem_recv2(session, in, inlen); +} + +nghttp2_ssize nghttp2_session_mem_recv2(nghttp2_session *session, + const uint8_t *in, size_t inlen) { const uint8_t *first, *last; nghttp2_inbound_frame *iframe = &session->iframe; size_t readlen; - ssize_t padlen; + nghttp2_ssize padlen; int rv; int busy = 0; nghttp2_frame_hd cont_hd; @@ -5833,22 +5320,14 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, mem = &session->mem; - /* We may have idle streams more than we expect (e.g., - nghttp2_session_change_stream_priority() or - nghttp2_session_create_idle_stream()). Adjust them here. */ - rv = nghttp2_session_adjust_idle_stream(session); - if (nghttp2_is_fatal(rv)) { - return rv; - } - if (!nghttp2_session_want_read(session)) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } for (;;) { switch (iframe->state) { case NGHTTP2_IB_READ_CLIENT_MAGIC: - readlen = nghttp2_min(inlen, iframe->payloadleft); + readlen = nghttp2_min_size(inlen, iframe->payloadleft); if (memcmp(&NGHTTP2_CLIENT_MAGIC[NGHTTP2_CLIENT_MAGIC_LEN - iframe->payloadleft], @@ -5872,29 +5351,29 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, in += readlen; if (nghttp2_buf_mark_avail(&iframe->sbuf)) { - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } if (iframe->sbuf.pos[3] != NGHTTP2_SETTINGS || (iframe->sbuf.pos[4] & NGHTTP2_FLAG_ACK)) { rv = session_call_error_callback( - session, NGHTTP2_ERR_SETTINGS_EXPECTED, - "Remote peer returned unexpected data while we expected " - "SETTINGS frame. Perhaps, peer does not support HTTP/2 " - "properly."); + session, NGHTTP2_ERR_SETTINGS_EXPECTED, + "Remote peer returned unexpected data while we expected " + "SETTINGS frame. Perhaps, peer does not support HTTP/2 " + "properly."); if (nghttp2_is_fatal(rv)) { return rv; } rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, "SETTINGS expected"); + session, NGHTTP2_PROTOCOL_ERROR, "SETTINGS expected"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } iframe->state = NGHTTP2_IB_READ_HEAD; @@ -5909,7 +5388,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, in += readlen; if (nghttp2_buf_mark_avail(&iframe->sbuf)) { - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } nghttp2_frame_unpack_frame_hd(&iframe->frame.hd, iframe->sbuf.pos); @@ -5924,13 +5403,13 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, session->local_settings.max_frame_size); rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_FRAME_SIZE_ERROR, "too large frame size"); + session, NGHTTP2_FRAME_SIZE_ERROR, "too large frame size"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } switch (iframe->frame.hd.type) { @@ -5938,14 +5417,14 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, DEBUGF("recv: DATA\n"); iframe->frame.hd.flags &= - (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_PADDED); + (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_PADDED); /* Check stream is open. If it is not open or closing, ignore payload. */ busy = 1; rv = session_on_data_received_fail_fast(session); if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (rv == NGHTTP2_ERR_IGN_PAYLOAD) { DEBUGF("recv: DATA not allowed stream_id=%d\n", @@ -5961,13 +5440,13 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); if (rv < 0) { rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, - "DATA: insufficient padding space"); + session, NGHTTP2_PROTOCOL_ERROR, + "DATA: insufficient padding space"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (rv == 1) { @@ -5983,18 +5462,18 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, DEBUGF("recv: HEADERS\n"); iframe->frame.hd.flags &= - (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS | - NGHTTP2_FLAG_PADDED | NGHTTP2_FLAG_PRIORITY); + (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS | + NGHTTP2_FLAG_PADDED | NGHTTP2_FLAG_PRIORITY); rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); if (rv < 0) { rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, - "HEADERS: insufficient padding space"); + session, NGHTTP2_PROTOCOL_ERROR, + "HEADERS: insufficient padding space"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (rv == 1) { @@ -6037,12 +5516,12 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, busy = 1; if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { rv = nghttp2_session_add_rst_stream( - session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); + session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); if (nghttp2_is_fatal(rv)) { return rv; } @@ -6129,20 +5608,20 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, /* We allocate iv with additional one entry, to store the minimum header table size. */ iframe->max_niv = - iframe->frame.hd.length / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH + 1; + iframe->frame.hd.length / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH + 1; if (iframe->max_niv - 1 > session->max_settings) { rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_ENHANCE_YOUR_CALM, - "SETTINGS: too many setting entries"); + session, NGHTTP2_ENHANCE_YOUR_CALM, + "SETTINGS: too many setting entries"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } iframe->iv = nghttp2_mem_malloc(mem, sizeof(nghttp2_settings_entry) * - iframe->max_niv); + iframe->max_niv); if (!iframe->iv) { return NGHTTP2_ERR_NOMEM; @@ -6150,7 +5629,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, min_header_table_size_entry = &iframe->iv[iframe->max_niv - 1]; min_header_table_size_entry->settings_id = - NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; + NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; min_header_table_size_entry->value = UINT32_MAX; inbound_frame_set_mark(iframe, NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH); @@ -6166,17 +5645,17 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, DEBUGF("recv: PUSH_PROMISE\n"); iframe->frame.hd.flags &= - (NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PADDED); + (NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PADDED); rv = inbound_frame_handle_pad(iframe, &iframe->frame.hd); if (rv < 0) { rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, - "PUSH_PROMISE: insufficient padding space"); + session, NGHTTP2_PROTOCOL_ERROR, + "PUSH_PROMISE: insufficient padding space"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (rv == 1) { @@ -6231,12 +5710,12 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, /* Receiving CONTINUATION in this state are subject to connection error of type PROTOCOL_ERROR */ rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, "CONTINUATION: unexpected"); + session, NGHTTP2_PROTOCOL_ERROR, "CONTINUATION: unexpected"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; default: DEBUGF("recv: extension frame\n"); @@ -6338,16 +5817,16 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; iframe->frame.ext.payload = - &iframe->ext_frame_payload.priority_update; + &iframe->ext_frame_payload.priority_update; if (!session->server) { rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, - "PRIORITY_UPDATE is received from server"); + session, NGHTTP2_PROTOCOL_ERROR, + "PRIORITY_UPDATE is received from server"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (iframe->payloadleft < 4) { @@ -6356,8 +5835,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, break; } - if (!session_no_rfc7540_pri_no_fallback(session) || - iframe->payloadleft > sizeof(iframe->raw_sbuf)) { + if (iframe->payloadleft > sizeof(iframe->raw_sbuf)) { busy = 1; iframe->state = NGHTTP2_IB_IGN_PAYLOAD; break; @@ -6405,11 +5883,11 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, in += readlen; iframe->payloadleft -= readlen; - DEBUGF("recv: readlen=%zu, payloadleft=%zu, left=%zd\n", readlen, + DEBUGF("recv: readlen=%zu, payloadleft=%zu, left=%zu\n", readlen, iframe->payloadleft, nghttp2_buf_mark_avail(&iframe->sbuf)); if (nghttp2_buf_mark_avail(&iframe->sbuf)) { - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } switch (iframe->frame.hd.type) { @@ -6421,11 +5899,11 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, if (padlen < 0 || (size_t)padlen + pri_fieldlen > 1 + iframe->payloadleft) { rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, "HEADERS: invalid padding"); + session, NGHTTP2_PROTOCOL_ERROR, "HEADERS: invalid padding"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } iframe->frame.headers.padlen = (size_t)padlen; @@ -6452,12 +5930,12 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, busy = 1; if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { rv = nghttp2_session_add_rst_stream( - session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); + session, iframe->frame.hd.stream_id, NGHTTP2_INTERNAL_ERROR); if (nghttp2_is_fatal(rv)) { return rv; } @@ -6474,18 +5952,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, break; case NGHTTP2_PRIORITY: - if (!session_no_rfc7540_pri_no_fallback(session) && - session->remote_settings.no_rfc7540_priorities != 1) { - rv = session_process_priority_frame(session); - if (nghttp2_is_fatal(rv)) { - return rv; - } - - if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; - } - } - session_inbound_frame_reset(session); break; @@ -6496,7 +5962,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } session_inbound_frame_reset(session); @@ -6507,14 +5973,13 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, (iframe->frame.hd.flags & NGHTTP2_FLAG_PADDED)) { padlen = inbound_frame_compute_pad(iframe); if (padlen < 0 || (size_t)padlen + 4 /* promised stream id */ - > 1 + iframe->payloadleft) { + > 1 + iframe->payloadleft) { rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, - "PUSH_PROMISE: invalid padding"); + session, NGHTTP2_PROTOCOL_ERROR, "PUSH_PROMISE: invalid padding"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } iframe->frame.push_promise.padlen = (size_t)padlen; @@ -6540,13 +6005,13 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, busy = 1; if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { rv = nghttp2_session_add_rst_stream( - session, iframe->frame.push_promise.promised_stream_id, - NGHTTP2_INTERNAL_ERROR); + session, iframe->frame.push_promise.promised_stream_id, + NGHTTP2_INTERNAL_ERROR); if (nghttp2_is_fatal(rv)) { return rv; } @@ -6569,7 +6034,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } session_inbound_frame_reset(session); @@ -6604,7 +6069,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } session_inbound_frame_reset(session); @@ -6625,7 +6090,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, if (iframe->frame.hd.length > 2) { iframe->raw_lbuf = - nghttp2_mem_malloc(mem, iframe->frame.hd.length - 2); + nghttp2_mem_malloc(mem, iframe->frame.hd.length - 2); if (iframe->raw_lbuf == NULL) { return NGHTTP2_ERR_NOMEM; @@ -6662,7 +6127,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, break; case NGHTTP2_IB_READ_HEADER_BLOCK: case NGHTTP2_IB_IGN_HEADER_BLOCK: { - ssize_t data_readlen; + nghttp2_ssize data_readlen; size_t trail_padlen; int final; #ifdef DEBUGBUILD @@ -6679,7 +6144,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, iframe->payloadleft - readlen); data_readlen = inbound_frame_effective_readlen( - iframe, iframe->payloadleft - readlen, readlen); + iframe, iframe->payloadleft - readlen, readlen); if (data_readlen == -1) { /* everything is padding */ @@ -6697,23 +6162,23 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, DEBUGF("recv: block final=%d\n", final); rv = - inflate_header_block(session, &iframe->frame, &hd_proclen, - (uint8_t *)in, (size_t)data_readlen, final, - iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK); + inflate_header_block(session, &iframe->frame, &hd_proclen, + (uint8_t *)in, (size_t)data_readlen, final, + iframe->state == NGHTTP2_IB_READ_HEADER_BLOCK); if (nghttp2_is_fatal(rv)) { return rv; } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (rv == NGHTTP2_ERR_PAUSE) { in += hd_proclen; iframe->payloadleft -= hd_proclen; - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } if (rv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) { @@ -6725,11 +6190,11 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, /* Use promised stream ID for PUSH_PROMISE */ rv = nghttp2_session_add_rst_stream( - session, - iframe->frame.hd.type == NGHTTP2_PUSH_PROMISE - ? iframe->frame.push_promise.promised_stream_id - : iframe->frame.hd.stream_id, - NGHTTP2_INTERNAL_ERROR); + session, + iframe->frame.hd.type == NGHTTP2_PUSH_PROMISE + ? iframe->frame.push_promise.promised_stream_id + : iframe->frame.hd.stream_id, + NGHTTP2_INTERNAL_ERROR); if (nghttp2_is_fatal(rv)) { return rv; } @@ -6761,7 +6226,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if ((iframe->frame.hd.flags & NGHTTP2_FLAG_END_HEADERS) == 0) { - inbound_frame_set_mark(iframe, NGHTTP2_FRAME_HDLEN); iframe->padlen = 0; @@ -6822,7 +6286,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, assert(iframe->state == NGHTTP2_IB_IGN_ALL); - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; case NGHTTP2_IB_READ_SETTINGS: DEBUGF("recv: [IB_READ_SETTINGS]\n"); @@ -6852,7 +6316,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } session_inbound_frame_reset(session); @@ -6886,7 +6350,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } session_inbound_frame_reset(session); @@ -6910,7 +6374,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, in += readlen; if (nghttp2_buf_mark_avail(&iframe->sbuf)) { - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } nghttp2_frame_unpack_frame_hd(&cont_hd, iframe->sbuf.pos); @@ -6926,20 +6390,20 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, iframe->frame.hd.stream_id, NGHTTP2_CONTINUATION, cont_hd.stream_id, cont_hd.type); rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, - "unexpected non-CONTINUATION frame or stream_id is invalid"); + session, NGHTTP2_PROTOCOL_ERROR, + "unexpected non-CONTINUATION frame or stream_id is invalid"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } /* CONTINUATION won't bear NGHTTP2_PADDED flag */ iframe->frame.hd.flags = - (uint8_t)(iframe->frame.hd.flags | - (cont_hd.flags & NGHTTP2_FLAG_END_HEADERS)); + (uint8_t)(iframe->frame.hd.flags | + (cont_hd.flags & NGHTTP2_FLAG_END_HEADERS)); iframe->frame.hd.length += cont_hd.length; busy = 1; @@ -6968,7 +6432,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, iframe->payloadleft, nghttp2_buf_mark_avail(&iframe->sbuf)); if (nghttp2_buf_mark_avail(&iframe->sbuf)) { - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } /* Pad Length field is subject to flow control */ @@ -6978,27 +6442,27 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } /* Pad Length field is consumed immediately */ rv = - nghttp2_session_consume(session, iframe->frame.hd.stream_id, readlen); + nghttp2_session_consume(session, iframe->frame.hd.stream_id, readlen); if (nghttp2_is_fatal(rv)) { return rv; } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } stream = nghttp2_session_get_stream(session, iframe->frame.hd.stream_id); if (stream) { rv = nghttp2_session_update_recv_stream_window_size( - session, stream, readlen, - iframe->payloadleft || - (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); + session, stream, readlen, + iframe->payloadleft || + (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); if (nghttp2_is_fatal(rv)) { return rv; } @@ -7009,11 +6473,11 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, padlen = inbound_frame_compute_pad(iframe); if (padlen < 0) { rv = nghttp2_session_terminate_session_with_reason( - session, NGHTTP2_PROTOCOL_ERROR, "DATA: invalid padding"); + session, NGHTTP2_PROTOCOL_ERROR, "DATA: invalid padding"); if (nghttp2_is_fatal(rv)) { return rv; } - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } iframe->frame.data.padlen = (size_t)padlen; @@ -7040,35 +6504,35 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, iframe->payloadleft); if (readlen > 0) { - ssize_t data_readlen; + nghttp2_ssize data_readlen; - rv = nghttp2_session_update_recv_connection_window_size(session, - readlen); + rv = + nghttp2_session_update_recv_connection_window_size(session, readlen); if (nghttp2_is_fatal(rv)) { return rv; } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } rv = nghttp2_session_update_recv_stream_window_size( - session, stream, readlen, - iframe->payloadleft || - (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); + session, stream, readlen, + iframe->payloadleft || + (iframe->frame.hd.flags & NGHTTP2_FLAG_END_STREAM) == 0); if (nghttp2_is_fatal(rv)) { return rv; } - data_readlen = inbound_frame_effective_readlen( - iframe, iframe->payloadleft, readlen); + data_readlen = + inbound_frame_effective_readlen(iframe, iframe->payloadleft, readlen); if (data_readlen == -1) { /* everything is padding */ data_readlen = 0; } - padlen = (ssize_t)readlen - data_readlen; + padlen = (nghttp2_ssize)readlen - data_readlen; if (padlen > 0) { /* Padding is considered as "consumed" immediately */ @@ -7080,11 +6544,11 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } } - DEBUGF("recv: data_readlen=%zd\n", data_readlen); + DEBUGF("recv: data_readlen=%td\n", data_readlen); if (data_readlen > 0) { if (session_enforce_http_messaging(session)) { @@ -7092,19 +6556,19 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, if (session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) { /* Consume all data for connection immediately here */ rv = session_update_connection_consumed_size( - session, (size_t)data_readlen); + session, (size_t)data_readlen); if (nghttp2_is_fatal(rv)) { return rv; } if (iframe->state == NGHTTP2_IB_IGN_DATA) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } } rv = nghttp2_session_add_rst_stream( - session, iframe->frame.hd.stream_id, NGHTTP2_PROTOCOL_ERROR); + session, iframe->frame.hd.stream_id, NGHTTP2_PROTOCOL_ERROR); if (nghttp2_is_fatal(rv)) { return rv; } @@ -7115,10 +6579,10 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (session->callbacks.on_data_chunk_recv_callback) { rv = session->callbacks.on_data_chunk_recv_callback( - session, iframe->frame.hd.flags, iframe->frame.hd.stream_id, - in - readlen, (size_t)data_readlen, session->user_data); + session, iframe->frame.hd.flags, iframe->frame.hd.stream_id, + in - readlen, (size_t)data_readlen, session->user_data); if (rv == NGHTTP2_ERR_PAUSE) { - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } if (nghttp2_is_fatal(rv)) { @@ -7153,18 +6617,17 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, if (readlen > 0) { /* Update connection-level flow control window for ignored DATA frame too */ - rv = nghttp2_session_update_recv_connection_window_size(session, - readlen); + rv = + nghttp2_session_update_recv_connection_window_size(session, readlen); if (nghttp2_is_fatal(rv)) { return rv; } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } if (session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) { - /* Ignored DATA is considered as "consumed" immediately. */ rv = session_update_connection_consumed_size(session, readlen); @@ -7173,7 +6636,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } } } @@ -7186,7 +6649,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, break; case NGHTTP2_IB_IGN_ALL: - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; case NGHTTP2_IB_READ_EXTENSION_PAYLOAD: DEBUGF("recv: [IB_READ_EXTENSION_PAYLOAD]\n"); @@ -7199,7 +6662,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, if (readlen > 0) { rv = session_call_on_extension_chunk_recv_callback( - session, in - readlen, readlen); + session, in - readlen, readlen); if (nghttp2_is_fatal(rv)) { return rv; } @@ -7281,7 +6744,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, } if (iframe->state == NGHTTP2_IB_IGN_ALL) { - return (ssize_t)inlen; + return (nghttp2_ssize)inlen; } session_inbound_frame_reset(session); @@ -7298,16 +6761,17 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, assert(in == last); - return (ssize_t)(in - first); + return (nghttp2_ssize)(in - first); } int nghttp2_session_recv(nghttp2_session *session) { uint8_t buf[NGHTTP2_INBOUND_BUFFER_LENGTH]; while (1) { - ssize_t readlen; + nghttp2_ssize readlen; readlen = session_recv(session, buf, sizeof(buf)); if (readlen > 0) { - ssize_t proclen = nghttp2_session_mem_recv(session, buf, (size_t)readlen); + nghttp2_ssize proclen = + nghttp2_session_mem_recv2(session, buf, (size_t)readlen); if (proclen < 0) { return (int)proclen; } @@ -7370,9 +6834,7 @@ int nghttp2_session_want_write(nghttp2_session *session) { */ return session->aob.item || nghttp2_outbound_queue_top(&session->ob_urgent) || nghttp2_outbound_queue_top(&session->ob_reg) || - ((!nghttp2_pq_empty(&session->root.obq) || - !session_sched_empty(session)) && - session->remote_window_size > 0) || + (!session_sched_empty(session) && session->remote_window_size > 0) || (nghttp2_outbound_queue_top(&session->ob_syn) && !session_is_outgoing_concurrent_streams_max(session)); } @@ -7456,7 +6918,8 @@ int nghttp2_session_add_goaway(nghttp2_session *session, int32_t last_stream_id, /* last_stream_id must not be increased from the value previously sent */ - last_stream_id = nghttp2_min(last_stream_id, session->local_last_stream_id); + last_stream_id = + nghttp2_min_int32(last_stream_id, session->local_last_stream_id); nghttp2_frame_goaway_init(&frame->goaway, last_stream_id, error_code, opaque_data_copy, opaque_data_len); @@ -7649,8 +7112,8 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs, nghttp2_stream *stream) { int rv; uint32_t data_flags; - ssize_t payloadlen; - ssize_t padded_payloadlen; + nghttp2_ssize payloadlen; + nghttp2_ssize padded_payloadlen; nghttp2_buf *buf; size_t max_payloadlen; @@ -7658,19 +7121,26 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs, buf = &bufs->cur->buf; - if (session->callbacks.read_length_callback) { - - payloadlen = session->callbacks.read_length_callback( + if (session->callbacks.read_length_callback2 || + session->callbacks.read_length_callback) { + if (session->callbacks.read_length_callback2) { + payloadlen = session->callbacks.read_length_callback2( session, frame->hd.type, stream->stream_id, session->remote_window_size, stream->remote_window_size, session->remote_settings.max_frame_size, session->user_data); + } else { + payloadlen = (nghttp2_ssize)session->callbacks.read_length_callback( + session, frame->hd.type, stream->stream_id, session->remote_window_size, + stream->remote_window_size, session->remote_settings.max_frame_size, + session->user_data); + } - DEBUGF("send: read_length_callback=%zd\n", payloadlen); + DEBUGF("send: read_length_callback=%td\n", payloadlen); - payloadlen = nghttp2_session_enforce_flow_control_limits(session, stream, - payloadlen); + payloadlen = + nghttp2_session_enforce_flow_control_limits(session, stream, payloadlen); - DEBUGF("send: read_length_callback after flow control=%zd\n", payloadlen); + DEBUGF("send: read_length_callback after flow control=%td\n", payloadlen); if (payloadlen <= 0) { return NGHTTP2_ERR_CALLBACK_FAILURE; @@ -7686,9 +7156,9 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs, DEBUGF("send: realloc buffer failed rv=%d", rv); /* If reallocation failed, old buffers are still in tact. So use safe limit. */ - payloadlen = (ssize_t)datamax; + payloadlen = (nghttp2_ssize)datamax; - DEBUGF("send: use safe limit payloadlen=%zd", payloadlen); + DEBUGF("send: use safe limit payloadlen=%td", payloadlen); } else { assert(&session->aob.framebufs == bufs); @@ -7702,9 +7172,23 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs, assert(nghttp2_buf_avail(buf) >= datamax); data_flags = NGHTTP2_DATA_FLAG_NONE; - payloadlen = aux_data->data_prd.read_callback( + switch (aux_data->dpw.version) { + case NGHTTP2_DATA_PROVIDER_V1: + payloadlen = (nghttp2_ssize)aux_data->dpw.data_prd.v1.read_callback( session, frame->hd.stream_id, buf->pos, datamax, &data_flags, - &aux_data->data_prd.source, session->user_data); + &aux_data->dpw.data_prd.source, session->user_data); + + break; + case NGHTTP2_DATA_PROVIDER_V2: + payloadlen = aux_data->dpw.data_prd.v2.read_callback( + session, frame->hd.stream_id, buf->pos, datamax, &data_flags, + &aux_data->dpw.data_prd.source, session->user_data); + + break; + default: + assert(0); + abort(); + } if (payloadlen == NGHTTP2_ERR_DEFERRED || payloadlen == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE || @@ -7749,10 +7233,11 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs, frame->hd.length = (size_t)payloadlen; frame->data.padlen = 0; - max_payloadlen = nghttp2_min(datamax, frame->hd.length + NGHTTP2_MAX_PADLEN); + max_payloadlen = + nghttp2_min_size(datamax, frame->hd.length + NGHTTP2_MAX_PADLEN); padded_payloadlen = - session_call_select_padding(session, frame, max_payloadlen); + session_call_select_padding(session, frame, max_payloadlen); if (nghttp2_is_fatal((int)padded_payloadlen)) { return (int)padded_payloadlen; @@ -7923,7 +7408,7 @@ int32_t nghttp2_session_get_stream_remote_window_size(nghttp2_session *session, /* stream->remote_window_size can be negative when SETTINGS_INITIAL_WINDOW_SIZE is changed. */ - return nghttp2_max(0, stream->remote_window_size); + return nghttp2_max_int32(0, stream->remote_window_size); } int32_t nghttp2_session_get_remote_window_size(nghttp2_session *session) { @@ -7989,7 +7474,6 @@ static int nghttp2_session_upgrade_internal(nghttp2_session *session, nghttp2_settings_entry *iv; size_t niv; int rv; - nghttp2_priority_spec pri_spec; nghttp2_mem *mem; mem = &session->mem; @@ -8026,18 +7510,13 @@ static int nghttp2_session_upgrade_internal(nghttp2_session *session, return rv; } - nghttp2_priority_spec_default_init(&pri_spec); - stream = nghttp2_session_open_stream( - session, 1, NGHTTP2_STREAM_FLAG_NONE, &pri_spec, NGHTTP2_STREAM_OPENING, - session->server ? NULL : stream_user_data); + session, 1, NGHTTP2_STREAM_FLAG_NONE, NGHTTP2_STREAM_OPENING, + session->server ? NULL : stream_user_data); if (stream == NULL) { return NGHTTP2_ERR_NOMEM; } - /* We don't call nghttp2_session_adjust_closed_stream(), since this - should be the first stream open. */ - if (session->server) { nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); session->last_recv_stream_id = 1; @@ -8236,14 +7715,16 @@ int32_t nghttp2_session_get_last_proc_stream_id(nghttp2_session *session) { nghttp2_stream *nghttp2_session_find_stream(nghttp2_session *session, int32_t stream_id) { if (stream_id == 0) { - return &session->root; + return &root; } return nghttp2_session_get_stream_raw(session, stream_id); } nghttp2_stream *nghttp2_session_get_root_stream(nghttp2_session *session) { - return &session->root; + (void)session; + + return &root; } int nghttp2_session_check_server_session(nghttp2_session *session) { @@ -8251,77 +7732,22 @@ int nghttp2_session_check_server_session(nghttp2_session *session) { } int nghttp2_session_change_stream_priority( - nghttp2_session *session, int32_t stream_id, - const nghttp2_priority_spec *pri_spec) { - int rv; - nghttp2_stream *stream; - nghttp2_priority_spec pri_spec_copy; - - if (session->pending_no_rfc7540_priorities == 1) { - return 0; - } - - if (stream_id == 0 || stream_id == pri_spec->stream_id) { - return NGHTTP2_ERR_INVALID_ARGUMENT; - } - - stream = nghttp2_session_get_stream_raw(session, stream_id); - if (!stream) { - return NGHTTP2_ERR_INVALID_ARGUMENT; - } - - pri_spec_copy = *pri_spec; - nghttp2_priority_spec_normalize_weight(&pri_spec_copy); - - rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec_copy); + nghttp2_session *session, int32_t stream_id, + const nghttp2_priority_spec *pri_spec) { + (void)session; + (void)stream_id; + (void)pri_spec; - if (nghttp2_is_fatal(rv)) { - return rv; - } - - /* We don't intentionally call nghttp2_session_adjust_idle_stream() - so that idle stream created by this function, and existing ones - are kept for application. We will adjust number of idle stream - in nghttp2_session_mem_send or nghttp2_session_mem_recv is - called. */ return 0; } int nghttp2_session_create_idle_stream(nghttp2_session *session, int32_t stream_id, const nghttp2_priority_spec *pri_spec) { - nghttp2_stream *stream; - nghttp2_priority_spec pri_spec_copy; - - if (session->pending_no_rfc7540_priorities == 1) { - return 0; - } - - if (stream_id == 0 || stream_id == pri_spec->stream_id || - !session_detect_idle_stream(session, stream_id)) { - return NGHTTP2_ERR_INVALID_ARGUMENT; - } - - stream = nghttp2_session_get_stream_raw(session, stream_id); - if (stream) { - return NGHTTP2_ERR_INVALID_ARGUMENT; - } - - pri_spec_copy = *pri_spec; - nghttp2_priority_spec_normalize_weight(&pri_spec_copy); - - stream = - nghttp2_session_open_stream(session, stream_id, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec_copy, NGHTTP2_STREAM_IDLE, NULL); - if (!stream) { - return NGHTTP2_ERR_NOMEM; - } + (void)session; + (void)stream_id; + (void)pri_spec; - /* We don't intentionally call nghttp2_session_adjust_idle_stream() - so that idle stream created by this function, and existing ones - are kept for application. We will adjust number of idle stream - in nghttp2_session_mem_send or nghttp2_session_mem_recv is - called. */ return 0; } @@ -8340,8 +7766,8 @@ void nghttp2_session_set_user_data(nghttp2_session *session, void *user_data) { } int nghttp2_session_change_extpri_stream_priority( - nghttp2_session *session, int32_t stream_id, - const nghttp2_extpri *extpri_in, int ignore_client_signal) { + nghttp2_session *session, int32_t stream_id, const nghttp2_extpri *extpri_in, + int ignore_client_signal) { nghttp2_stream *stream; nghttp2_extpri extpri = *extpri_in; diff --git a/lib/nghttp2/lib/nghttp2_session.h b/lib/nghttp2-1.65.0/lib/nghttp2_session.h similarity index 88% rename from lib/nghttp2/lib/nghttp2_session.h rename to lib/nghttp2-1.65.0/lib/nghttp2_session.h index ef8f7b27d67..6a54d35fcab 100644 --- a/lib/nghttp2/lib/nghttp2_session.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_session.h @@ -45,6 +45,8 @@ preface handling. */ extern int nghttp2_enable_strict_preface; +extern nghttp2_stream root; + /* * Option flags. */ @@ -53,8 +55,6 @@ typedef enum { NGHTTP2_OPTMASK_NO_RECV_CLIENT_MAGIC = 1 << 1, NGHTTP2_OPTMASK_NO_HTTP_MESSAGING = 1 << 2, NGHTTP2_OPTMASK_NO_AUTO_PING_ACK = 1 << 3, - NGHTTP2_OPTMASK_NO_CLOSED_STREAMS = 1 << 4, - NGHTTP2_OPTMASK_SERVER_FALLBACK_RFC7540_PRIORITIES = 1 << 5, NGHTTP2_OPTMASK_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION = 1 << 6, } nghttp2_optmask; @@ -89,10 +89,6 @@ typedef struct { /* The default maximum number of incoming reserved streams */ #define NGHTTP2_MAX_INCOMING_RESERVED_STREAMS 200 -/* Even if we have less SETTINGS_MAX_CONCURRENT_STREAMS than this - number, we keep NGHTTP2_MIN_IDLE_STREAMS streams in idle state */ -#define NGHTTP2_MIN_IDLE_STREAMS 16 - /* The maximum number of items in outbound queue, which is considered as flooding caused by peer. All frames are not considered here. We only consider PING + ACK and SETTINGS + ACK. This is because @@ -205,8 +201,6 @@ typedef struct nghttp2_inflight_settings nghttp2_inflight_settings; struct nghttp2_session { nghttp2_map /* */ streams; - /* root of dependency tree*/ - nghttp2_stream root; /* Queue for outbound urgent frames (PING and SETTINGS) */ nghttp2_outbound_queue ob_urgent; /* Queue for non-DATA frames */ @@ -229,20 +223,6 @@ struct nghttp2_session { /* Memory allocator */ nghttp2_mem mem; void *user_data; - /* Points to the latest incoming closed stream. NULL if there is no - closed stream. Only used when session is initialized as - server. */ - nghttp2_stream *closed_stream_head; - /* Points to the oldest incoming closed stream. NULL if there is no - closed stream. Only used when session is initialized as - server. */ - nghttp2_stream *closed_stream_tail; - /* Points to the latest idle stream. NULL if there is no idle - stream. Only used when session is initialized as server .*/ - nghttp2_stream *idle_stream_head; - /* Points to the oldest idle stream. NULL if there is no idle - stream. Only used when session is initialized as erver. */ - nghttp2_stream *idle_stream_tail; /* Queue of In-flight SETTINGS values. SETTINGS bearing ACK is not considered as in-flight. */ nghttp2_inflight_settings *inflight_settings_head; @@ -276,10 +256,9 @@ struct nghttp2_session { |closed_stream_head|. The current implementation only keeps incoming streams and session is initialized as server. */ size_t num_closed_streams; - /* The number of idle streams kept in |streams| hash. The idle - streams can be accessed through doubly linked list - |idle_stream_head|. The current implementation only keeps idle - streams if session is initialized as server. */ + /* The number of idle streams kept in |streams| hash. The current + implementation only keeps idle streams if session is initialized + as server. */ size_t num_idle_streams; /* The number of bytes allocated for nvbuf */ size_t nvbuflen; @@ -362,8 +341,6 @@ struct nghttp2_session { /* Unacked local SETTINGS_NO_RFC7540_PRIORITIES value, which is effective before it is acknowledged. */ uint8_t pending_no_rfc7540_priorities; - /* Turn on fallback to RFC 7540 priorities; for server use only. */ - uint8_t fallback_rfc7540_priorities; /* Nonzero if the session is server side. */ uint8_t server; /* Flags indicating GOAWAY is sent and/or received. The flags are @@ -527,15 +504,9 @@ int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags, * * This function returns a pointer to created new stream object, or * NULL. - * - * This function adjusts neither the number of closed streams or idle - * streams. The caller should manually call - * nghttp2_session_adjust_closed_stream() or - * nghttp2_session_adjust_idle_stream() respectively. */ nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, int32_t stream_id, uint8_t flags, - nghttp2_priority_spec *pri_spec, nghttp2_stream_state initial_state, void *stream_user_data); @@ -544,11 +515,6 @@ nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session, * is indicated by the |error_code|. When closing the stream, * on_stream_close_callback will be called. * - * If the session is initialized as server and |stream| is incoming - * stream, stream is just marked closed and this function calls - * nghttp2_session_keep_closed_stream() with |stream|. Otherwise, - * |stream| will be deleted from memory. - * * This function returns 0 if it succeeds, or one the following * negative error codes: * @@ -565,63 +531,9 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id, /* * Deletes |stream| from memory. After this function returns, stream * cannot be accessed. - * - * This function returns 0 if it succeeds, or one the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory */ -int nghttp2_session_destroy_stream(nghttp2_session *session, - nghttp2_stream *stream); - -/* - * Tries to keep incoming closed stream |stream|. Due to the - * limitation of maximum number of streams in memory, |stream| is not - * closed and just deleted from memory (see - * nghttp2_session_destroy_stream). - */ -void nghttp2_session_keep_closed_stream(nghttp2_session *session, - nghttp2_stream *stream); - -/* - * Appends |stream| to linked list |session->idle_stream_head|. We - * apply fixed limit for list size. To fit into that limit, one or - * more oldest streams are removed from list as necessary. - */ -void nghttp2_session_keep_idle_stream(nghttp2_session *session, - nghttp2_stream *stream); - -/* - * Detaches |stream| from idle streams linked list. - */ -void nghttp2_session_detach_idle_stream(nghttp2_session *session, - nghttp2_stream *stream); - -/* - * Deletes closed stream to ensure that number of incoming streams - * including active and closed is in the maximum number of allowed - * stream. - * - * This function returns 0 if it succeeds, or one the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory - */ -int nghttp2_session_adjust_closed_stream(nghttp2_session *session); - -/* - * Deletes idle stream to ensure that number of idle streams is in - * certain limit. - * - * This function returns 0 if it succeeds, or one the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory - */ -int nghttp2_session_adjust_idle_stream(nghttp2_session *session); +void nghttp2_session_destroy_stream(nghttp2_session *session, + nghttp2_stream *stream); /* * If further receptions and transmissions over the stream |stream_id| @@ -915,24 +827,6 @@ int nghttp2_session_update_local_settings(nghttp2_session *session, nghttp2_settings_entry *iv, size_t niv); -/* - * Re-prioritize |stream|. The new priority specification is - * |pri_spec|. Caller must ensure that stream->hd.stream_id != - * pri_spec->stream_id. - * - * This function does not adjust the number of idle streams. The - * caller should call nghttp2_session_adjust_idle_stream() later. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory - */ -int nghttp2_session_reprioritize_stream(nghttp2_session *session, - nghttp2_stream *stream, - const nghttp2_priority_spec *pri_spec); - /* * Terminates current |session| with the |error_code|. The |reason| * is NULL-terminated debug string. diff --git a/lib/nghttp2-1.65.0/lib/nghttp2_stream.c b/lib/nghttp2-1.65.0/lib/nghttp2_stream.c new file mode 100644 index 00000000000..afbd7c2d9e0 --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/nghttp2_stream.c @@ -0,0 +1,225 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_stream.h" + +#include + +#include "nghttp2_session.h" +#include "nghttp2_helper.h" +#include "nghttp2_debug.h" +#include "nghttp2_frame.h" + +void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id, + uint8_t flags, nghttp2_stream_state initial_state, + int32_t remote_initial_window_size, + int32_t local_initial_window_size, + void *stream_user_data) { + stream->stream_id = stream_id; + stream->flags = flags; + stream->state = initial_state; + stream->shut_flags = NGHTTP2_SHUT_NONE; + stream->stream_user_data = stream_user_data; + stream->item = NULL; + stream->remote_window_size = remote_initial_window_size; + stream->local_window_size = local_initial_window_size; + stream->recv_window_size = 0; + stream->consumed_size = 0; + stream->recv_reduction = 0; + stream->window_update_queued = 0; + + stream->closed_next = NULL; + + stream->http_flags = NGHTTP2_HTTP_FLAG_NONE; + stream->content_length = -1; + stream->recv_content_length = 0; + stream->status_code = -1; + + stream->queued = 0; + stream->cycle = 0; + stream->pending_penalty = 0; + stream->seq = 0; + stream->last_writelen = 0; + + stream->extpri = stream->http_extpri = NGHTTP2_EXTPRI_DEFAULT_URGENCY; +} + +void nghttp2_stream_free(nghttp2_stream *stream) { (void)stream; } + +void nghttp2_stream_shutdown(nghttp2_stream *stream, nghttp2_shut_flag flag) { + stream->shut_flags = (uint8_t)(stream->shut_flags | flag); +} + +void nghttp2_stream_attach_item(nghttp2_stream *stream, + nghttp2_outbound_item *item) { + assert((stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL) == 0); + assert(stream->item == NULL); + + DEBUGF("stream: stream=%d attach item=%p\n", stream->stream_id, item); + + stream->item = item; +} + +void nghttp2_stream_detach_item(nghttp2_stream *stream) { + DEBUGF("stream: stream=%d detach item=%p\n", stream->stream_id, stream->item); + + stream->item = NULL; + stream->flags = (uint8_t)(stream->flags & ~NGHTTP2_STREAM_FLAG_DEFERRED_ALL); +} + +void nghttp2_stream_defer_item(nghttp2_stream *stream, uint8_t flags) { + assert(stream->item); + + DEBUGF("stream: stream=%d defer item=%p cause=%02x\n", stream->stream_id, + stream->item, flags); + + stream->flags |= flags; +} + +void nghttp2_stream_resume_deferred_item(nghttp2_stream *stream, + uint8_t flags) { + assert(stream->item); + + DEBUGF("stream: stream=%d resume item=%p flags=%02x\n", stream->stream_id, + stream->item, flags); + + stream->flags = (uint8_t)(stream->flags & ~flags); +} + +int nghttp2_stream_check_deferred_item(nghttp2_stream *stream) { + return stream->item && (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL); +} + +int nghttp2_stream_check_deferred_by_flow_control(nghttp2_stream *stream) { + return stream->item && + (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); +} + +static int update_initial_window_size(int32_t *window_size_ptr, + int32_t new_initial_window_size, + int32_t old_initial_window_size) { + int64_t new_window_size = (int64_t)(*window_size_ptr) + + new_initial_window_size - old_initial_window_size; + if (INT32_MIN > new_window_size || + new_window_size > NGHTTP2_MAX_WINDOW_SIZE) { + return -1; + } + *window_size_ptr = (int32_t)new_window_size; + return 0; +} + +int nghttp2_stream_update_remote_initial_window_size( + nghttp2_stream *stream, int32_t new_initial_window_size, + int32_t old_initial_window_size) { + return update_initial_window_size(&stream->remote_window_size, + new_initial_window_size, + old_initial_window_size); +} + +int nghttp2_stream_update_local_initial_window_size( + nghttp2_stream *stream, int32_t new_initial_window_size, + int32_t old_initial_window_size) { + return update_initial_window_size(&stream->local_window_size, + new_initial_window_size, + old_initial_window_size); +} + +void nghttp2_stream_promise_fulfilled(nghttp2_stream *stream) { + stream->state = NGHTTP2_STREAM_OPENED; + stream->flags = (uint8_t)(stream->flags & ~NGHTTP2_STREAM_FLAG_PUSH); +} + +nghttp2_stream_proto_state nghttp2_stream_get_state(nghttp2_stream *stream) { + if (stream == &root) { + return NGHTTP2_STREAM_STATE_IDLE; + } + + if (stream->flags & NGHTTP2_STREAM_FLAG_CLOSED) { + return NGHTTP2_STREAM_STATE_CLOSED; + } + + if (stream->flags & NGHTTP2_STREAM_FLAG_PUSH) { + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + return NGHTTP2_STREAM_STATE_RESERVED_LOCAL; + } + + if (stream->shut_flags & NGHTTP2_SHUT_WR) { + return NGHTTP2_STREAM_STATE_RESERVED_REMOTE; + } + } + + if (stream->shut_flags & NGHTTP2_SHUT_RD) { + return NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE; + } + + if (stream->shut_flags & NGHTTP2_SHUT_WR) { + return NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL; + } + + if (stream->state == NGHTTP2_STREAM_IDLE) { + return NGHTTP2_STREAM_STATE_IDLE; + } + + return NGHTTP2_STREAM_STATE_OPEN; +} + +nghttp2_stream *nghttp2_stream_get_parent(nghttp2_stream *stream) { + (void)stream; + + return NULL; +} + +nghttp2_stream *nghttp2_stream_get_next_sibling(nghttp2_stream *stream) { + (void)stream; + + return NULL; +} + +nghttp2_stream *nghttp2_stream_get_previous_sibling(nghttp2_stream *stream) { + (void)stream; + + return NULL; +} + +nghttp2_stream *nghttp2_stream_get_first_child(nghttp2_stream *stream) { + (void)stream; + + return NULL; +} + +int32_t nghttp2_stream_get_weight(nghttp2_stream *stream) { + (void)stream; + + return NGHTTP2_DEFAULT_WEIGHT; +} + +int32_t nghttp2_stream_get_sum_dependency_weight(nghttp2_stream *stream) { + (void)stream; + + return 0; +} + +int32_t nghttp2_stream_get_stream_id(nghttp2_stream *stream) { + return stream->stream_id; +} diff --git a/lib/nghttp2/lib/nghttp2_stream.h b/lib/nghttp2-1.65.0/lib/nghttp2_stream.h similarity index 65% rename from lib/nghttp2/lib/nghttp2_stream.h rename to lib/nghttp2-1.65.0/lib/nghttp2_stream.h index 71b9fb1140c..e73cd283b1d 100644 --- a/lib/nghttp2/lib/nghttp2_stream.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_stream.h @@ -91,9 +91,6 @@ typedef enum { /* bitwise OR of NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL and NGHTTP2_STREAM_FLAG_DEFERRED_USER. */ NGHTTP2_STREAM_FLAG_DEFERRED_ALL = 0x0c, - /* Indicates that this stream is not subject to RFC7540 - priorities scheme. */ - NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES = 0x10, /* Ignore client RFC 9218 priority signal. */ NGHTTP2_STREAM_FLAG_IGNORE_CLIENT_PRIORITIES = 0x20, /* Indicates that RFC 9113 leading and trailing white spaces @@ -124,10 +121,9 @@ typedef enum { NGHTTP2_HTTP_FLAG_METH_HEAD = 1 << 8, NGHTTP2_HTTP_FLAG_METH_OPTIONS = 1 << 9, NGHTTP2_HTTP_FLAG_METH_UPGRADE_WORKAROUND = 1 << 10, - NGHTTP2_HTTP_FLAG_METH_ALL = NGHTTP2_HTTP_FLAG_METH_CONNECT | - NGHTTP2_HTTP_FLAG_METH_HEAD | - NGHTTP2_HTTP_FLAG_METH_OPTIONS | - NGHTTP2_HTTP_FLAG_METH_UPGRADE_WORKAROUND, + NGHTTP2_HTTP_FLAG_METH_ALL = + NGHTTP2_HTTP_FLAG_METH_CONNECT | NGHTTP2_HTTP_FLAG_METH_HEAD | + NGHTTP2_HTTP_FLAG_METH_OPTIONS | NGHTTP2_HTTP_FLAG_METH_UPGRADE_WORKAROUND, /* :path category */ /* path starts with "/" */ NGHTTP2_HTTP_FLAG_PATH_REGULAR = 1 << 11, @@ -147,39 +143,18 @@ typedef enum { } nghttp2_http_flag; struct nghttp2_stream { - /* Entry for dep_prev->obq */ + nghttp2_stream_state state; nghttp2_pq_entry pq_entry; - /* Priority Queue storing direct descendant (nghttp2_stream). Only - streams which itself has some data to send, or has a descendant - which has some data to sent. */ - nghttp2_pq obq; /* Content-Length of request/response body. -1 if unknown. */ int64_t content_length; /* Received body so far */ int64_t recv_content_length; - /* Base last_cycle for direct descendent streams. */ - uint64_t descendant_last_cycle; /* Next scheduled time to sent item */ uint64_t cycle; - /* Next seq used for direct descendant streams */ - uint64_t descendant_next_seq; /* Secondary key for prioritization to break a tie for cycle. This value is monotonically increased for single parent stream. */ uint64_t seq; - /* pointers to form dependency tree. If multiple streams depend on - a stream, only one stream (left most) has non-NULL dep_prev which - points to the stream it depends on. The remaining streams are - linked using sib_prev and sib_next. The stream which has - non-NULL dep_prev always NULL sib_prev. The right most stream - has NULL sib_next. If this stream is a root of dependency tree, - dep_prev and sib_prev are NULL. */ - nghttp2_stream *dep_prev, *dep_next; - nghttp2_stream *sib_prev, *sib_next; - /* When stream is kept after closure, it may be kept in doubly - linked list pointed by nghttp2_session closed_stream_head. - closed_next points to the next stream object if it is the element - of the list. */ - nghttp2_stream *closed_prev, *closed_next; + nghttp2_stream *closed_next; /* The arbitrary data provided by user for this stream. */ void *stream_user_data; /* Item to send */ @@ -206,13 +181,8 @@ struct nghttp2_stream { NGHTTP2_INITIAL_WINDOW_SIZE and could be increased/decreased by submitting WINDOW_UPDATE. See nghttp2_submit_window_update(). */ int32_t local_window_size; - /* weight of this stream */ - int32_t weight; /* This is unpaid penalty (offset) when calculating cycle. */ uint32_t pending_penalty; - /* sum of weight of direct descendants */ - int32_t sum_dep_weight; - nghttp2_stream_state state; /* status code from remote server */ int16_t status_code; /* Bitwise OR of zero or more nghttp2_http_flag values */ @@ -240,9 +210,9 @@ struct nghttp2_stream { void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id, uint8_t flags, nghttp2_stream_state initial_state, - int32_t weight, int32_t remote_initial_window_size, + int32_t remote_initial_window_size, int32_t local_initial_window_size, - void *stream_user_data, nghttp2_mem *mem); + void *stream_user_data); void nghttp2_stream_free(nghttp2_stream *stream); @@ -268,14 +238,8 @@ void nghttp2_stream_defer_item(nghttp2_stream *stream, uint8_t flags); * NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL and given masks are * cleared if they are set. So even if this function is called, if * one of flag is still set, data does not become active. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory */ -int nghttp2_stream_resume_deferred_item(nghttp2_stream *stream, uint8_t flags); +void nghttp2_stream_resume_deferred_item(nghttp2_stream *stream, uint8_t flags); /* * Returns nonzero if item is deferred by whatever reason. @@ -296,8 +260,8 @@ int nghttp2_stream_check_deferred_by_flow_control(nghttp2_stream *stream); * overflow. */ int nghttp2_stream_update_remote_initial_window_size( - nghttp2_stream *stream, int32_t new_initial_window_size, - int32_t old_initial_window_size); + nghttp2_stream *stream, int32_t new_initial_window_size, + int32_t old_initial_window_size); /* * Updates the local window size with the new value @@ -308,8 +272,8 @@ int nghttp2_stream_update_remote_initial_window_size( * overflow. */ int nghttp2_stream_update_local_initial_window_size( - nghttp2_stream *stream, int32_t new_initial_window_size, - int32_t old_initial_window_size); + nghttp2_stream *stream, int32_t new_initial_window_size, + int32_t old_initial_window_size); /* * Call this function if promised stream |stream| is replied with @@ -318,57 +282,11 @@ int nghttp2_stream_update_local_initial_window_size( */ void nghttp2_stream_promise_fulfilled(nghttp2_stream *stream); -/* - * Returns nonzero if |target| is an ancestor of |stream|. - */ -int nghttp2_stream_dep_find_ancestor(nghttp2_stream *stream, - nghttp2_stream *target); - -/* - * Computes distributed weight of a stream of the |weight| under the - * |stream| if |stream| is removed from a dependency tree. - */ -int32_t nghttp2_stream_dep_distributed_weight(nghttp2_stream *stream, - int32_t weight); - -/* - * Makes the |stream| depend on the |dep_stream|. This dependency is - * exclusive. All existing direct descendants of |dep_stream| become - * the descendants of the |stream|. This function assumes - * |stream->item| is NULL. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory - */ -int nghttp2_stream_dep_insert(nghttp2_stream *dep_stream, - nghttp2_stream *stream); - -/* - * Makes the |stream| depend on the |dep_stream|. This dependency is - * not exclusive. This function assumes |stream->item| is NULL. - */ -void nghttp2_stream_dep_add(nghttp2_stream *dep_stream, nghttp2_stream *stream); - -/* - * Removes the |stream| from the current dependency tree. This - * function assumes |stream->item| is NULL. - */ -int nghttp2_stream_dep_remove(nghttp2_stream *stream); - /* * Attaches |item| to |stream|. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory */ -int nghttp2_stream_attach_item(nghttp2_stream *stream, - nghttp2_outbound_item *item); +void nghttp2_stream_attach_item(nghttp2_stream *stream, + nghttp2_outbound_item *item); /* * Detaches |stream->item|. This function does not free @@ -376,66 +294,4 @@ int nghttp2_stream_attach_item(nghttp2_stream *stream, */ void nghttp2_stream_detach_item(nghttp2_stream *stream); -/* - * Makes the |stream| depend on the |dep_stream|. This dependency is - * exclusive. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory - */ -int nghttp2_stream_dep_insert_subtree(nghttp2_stream *dep_stream, - nghttp2_stream *stream); - -/* - * Makes the |stream| depend on the |dep_stream|. This dependency is - * not exclusive. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory - */ -int nghttp2_stream_dep_add_subtree(nghttp2_stream *dep_stream, - nghttp2_stream *stream); - -/* - * Removes subtree whose root stream is |stream|. The - * effective_weight of streams in removed subtree is not updated. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory - */ -void nghttp2_stream_dep_remove_subtree(nghttp2_stream *stream); - -/* - * Returns nonzero if |stream| is in any dependency tree. - */ -int nghttp2_stream_in_dep_tree(nghttp2_stream *stream); - -/* - * Schedules transmission of |stream|'s item, assuming stream->item is - * attached, and stream->last_writelen was updated. - */ -void nghttp2_stream_reschedule(nghttp2_stream *stream); - -/* - * Changes |stream|'s weight to |weight|. If |stream| is queued, it - * will be rescheduled based on new weight. - */ -void nghttp2_stream_change_weight(nghttp2_stream *stream, int32_t weight); - -/* - * Returns a stream which has highest priority, updating - * descendant_last_cycle of selected stream's ancestors. - */ -nghttp2_outbound_item * -nghttp2_stream_next_outbound_item(nghttp2_stream *stream); - #endif /* NGHTTP2_STREAM */ diff --git a/lib/nghttp2/lib/nghttp2_submit.c b/lib/nghttp2-1.65.0/lib/nghttp2_submit.c similarity index 78% rename from lib/nghttp2/lib/nghttp2_submit.c rename to lib/nghttp2-1.65.0/lib/nghttp2_submit.c index f5554eb5649..d481aebde22 100644 --- a/lib/nghttp2/lib/nghttp2_submit.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_submit.c @@ -32,43 +32,13 @@ #include "nghttp2_helper.h" #include "nghttp2_priority_spec.h" -/* - * Detects the dependency error, that is stream attempted to depend on - * itself. If |stream_id| is -1, we use session->next_stream_id as - * stream ID. - * - * This function returns 0 if it succeeds, or one of the following - * error codes: - * - * NGHTTP2_ERR_INVALID_ARGUMENT - * Stream attempted to depend on itself. - */ -static int detect_self_dependency(nghttp2_session *session, int32_t stream_id, - const nghttp2_priority_spec *pri_spec) { - assert(pri_spec); - - if (stream_id == -1) { - if ((int32_t)session->next_stream_id == pri_spec->stream_id) { - return NGHTTP2_ERR_INVALID_ARGUMENT; - } - return 0; - } - - if (stream_id == pri_spec->stream_id) { - return NGHTTP2_ERR_INVALID_ARGUMENT; - } - - return 0; -} - /* This function takes ownership of |nva_copy|. Regardless of the return value, the caller must not free |nva_copy| after this function returns. */ static int32_t submit_headers_shared(nghttp2_session *session, uint8_t flags, - int32_t stream_id, - const nghttp2_priority_spec *pri_spec, - nghttp2_nv *nva_copy, size_t nvlen, - const nghttp2_data_provider *data_prd, + int32_t stream_id, nghttp2_nv *nva_copy, + size_t nvlen, + const nghttp2_data_provider_wrap *dpw, void *stream_user_data) { int rv; uint8_t flags_copy; @@ -87,15 +57,15 @@ static int32_t submit_headers_shared(nghttp2_session *session, uint8_t flags, nghttp2_outbound_item_init(item); - if (data_prd != NULL && data_prd->read_callback != NULL) { - item->aux_data.headers.data_prd = *data_prd; + if (dpw != NULL && dpw->data_prd.read_callback != NULL) { + item->aux_data.headers.dpw = *dpw; } item->aux_data.headers.stream_user_data = stream_user_data; flags_copy = - (uint8_t)((flags & (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_PRIORITY)) | - NGHTTP2_FLAG_END_HEADERS); + (uint8_t)((flags & (NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_PRIORITY)) | + NGHTTP2_FLAG_END_HEADERS); if (stream_id == -1) { if (session->next_stream_id > INT32_MAX) { @@ -114,8 +84,8 @@ static int32_t submit_headers_shared(nghttp2_session *session, uint8_t flags, frame = &item->frame; - nghttp2_frame_headers_init(&frame->headers, flags_copy, stream_id, hcat, - pri_spec, nva_copy, nvlen); + nghttp2_frame_headers_init(&frame->headers, flags_copy, stream_id, hcat, NULL, + nva_copy, nvlen); rv = nghttp2_session_add_item(session, item); @@ -141,31 +111,22 @@ static int32_t submit_headers_shared(nghttp2_session *session, uint8_t flags, static int32_t submit_headers_shared_nva(nghttp2_session *session, uint8_t flags, int32_t stream_id, - const nghttp2_priority_spec *pri_spec, const nghttp2_nv *nva, size_t nvlen, - const nghttp2_data_provider *data_prd, + const nghttp2_data_provider_wrap *dpw, void *stream_user_data) { int rv; nghttp2_nv *nva_copy; - nghttp2_priority_spec copy_pri_spec; nghttp2_mem *mem; mem = &session->mem; - if (pri_spec) { - copy_pri_spec = *pri_spec; - nghttp2_priority_spec_normalize_weight(©_pri_spec); - } else { - nghttp2_priority_spec_default_init(©_pri_spec); - } - rv = nghttp2_nv_array_copy(&nva_copy, nva, nvlen, mem); if (rv < 0) { return rv; } - return submit_headers_shared(session, flags, stream_id, ©_pri_spec, - nva_copy, nvlen, data_prd, stream_user_data); + return submit_headers_shared(session, flags, stream_id, nva_copy, nvlen, dpw, + stream_user_data); } int nghttp2_submit_trailer(nghttp2_session *session, int32_t stream_id, @@ -175,8 +136,7 @@ int nghttp2_submit_trailer(nghttp2_session *session, int32_t stream_id, } return (int)submit_headers_shared_nva(session, NGHTTP2_FLAG_END_STREAM, - stream_id, NULL, nva, nvlen, NULL, - NULL); + stream_id, nva, nvlen, NULL, NULL); } int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, @@ -184,7 +144,7 @@ int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, const nghttp2_priority_spec *pri_spec, const nghttp2_nv *nva, size_t nvlen, void *stream_user_data) { - int rv; + (void)pri_spec; if (stream_id == -1) { if (session->server) { @@ -196,20 +156,8 @@ int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, flags &= NGHTTP2_FLAG_END_STREAM; - if (pri_spec && !nghttp2_priority_spec_check_default(pri_spec) && - session->remote_settings.no_rfc7540_priorities != 1) { - rv = detect_self_dependency(session, stream_id, pri_spec); - if (rv != 0) { - return rv; - } - - flags |= NGHTTP2_FLAG_PRIORITY; - } else { - pri_spec = NULL; - } - - return submit_headers_shared_nva(session, flags, stream_id, pri_spec, nva, - nvlen, NULL, stream_user_data); + return submit_headers_shared_nva(session, flags, stream_id, nva, nvlen, NULL, + stream_user_data); } int nghttp2_submit_ping(nghttp2_session *session, uint8_t flags, @@ -221,51 +169,10 @@ int nghttp2_submit_ping(nghttp2_session *session, uint8_t flags, int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags, int32_t stream_id, const nghttp2_priority_spec *pri_spec) { - int rv; - nghttp2_outbound_item *item; - nghttp2_frame *frame; - nghttp2_priority_spec copy_pri_spec; - nghttp2_mem *mem; + (void)session; (void)flags; - - mem = &session->mem; - - if (session->remote_settings.no_rfc7540_priorities == 1) { - return 0; - } - - if (stream_id == 0 || pri_spec == NULL) { - return NGHTTP2_ERR_INVALID_ARGUMENT; - } - - if (stream_id == pri_spec->stream_id) { - return NGHTTP2_ERR_INVALID_ARGUMENT; - } - - copy_pri_spec = *pri_spec; - - nghttp2_priority_spec_normalize_weight(©_pri_spec); - - item = nghttp2_mem_malloc(mem, sizeof(nghttp2_outbound_item)); - - if (item == NULL) { - return NGHTTP2_ERR_NOMEM; - } - - nghttp2_outbound_item_init(item); - - frame = &item->frame; - - nghttp2_frame_priority_init(&frame->priority, stream_id, ©_pri_spec); - - rv = nghttp2_session_add_item(session, item); - - if (rv != 0) { - nghttp2_frame_priority_free(&frame->priority); - nghttp2_mem_free(mem, item); - - return rv; - } + (void)stream_id; + (void)pri_spec; return 0; } @@ -389,8 +296,8 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags, } if (stream_id == 0) { rv = nghttp2_adjust_local_window_size( - &session->local_window_size, &session->recv_window_size, - &session->recv_reduction, &window_size_increment); + &session->local_window_size, &session->recv_window_size, + &session->recv_reduction, &window_size_increment); if (rv != 0) { return rv; } @@ -401,8 +308,8 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags, } rv = nghttp2_adjust_local_window_size( - &stream->local_window_size, &stream->recv_window_size, - &stream->recv_reduction, &window_size_increment); + &stream->local_window_size, &stream->recv_window_size, + &stream->recv_reduction, &window_size_increment); if (rv != 0) { return rv; } @@ -411,10 +318,10 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags, if (window_size_increment > 0) { if (stream_id == 0) { session->consumed_size = - nghttp2_max(0, session->consumed_size - window_size_increment); + nghttp2_max_int32(0, session->consumed_size - window_size_increment); } else { stream->consumed_size = - nghttp2_max(0, stream->consumed_size - window_size_increment); + nghttp2_max_int32(0, stream->consumed_size - window_size_increment); } return nghttp2_session_add_window_update(session, 0, stream_id, @@ -444,13 +351,13 @@ int nghttp2_session_set_local_window_size(nghttp2_session *session, if (window_size_increment < 0) { return nghttp2_adjust_local_window_size( - &session->local_window_size, &session->recv_window_size, - &session->recv_reduction, &window_size_increment); + &session->local_window_size, &session->recv_window_size, + &session->recv_reduction, &window_size_increment); } rv = nghttp2_increase_local_window_size( - &session->local_window_size, &session->recv_window_size, - &session->recv_reduction, &window_size_increment); + &session->local_window_size, &session->recv_window_size, + &session->recv_reduction, &window_size_increment); if (rv != 0) { return rv; @@ -477,13 +384,13 @@ int nghttp2_session_set_local_window_size(nghttp2_session *session, if (window_size_increment < 0) { return nghttp2_adjust_local_window_size( - &stream->local_window_size, &stream->recv_window_size, - &stream->recv_reduction, &window_size_increment); + &stream->local_window_size, &stream->recv_window_size, + &stream->recv_reduction, &window_size_increment); } rv = nghttp2_increase_local_window_size( - &stream->local_window_size, &stream->recv_window_size, - &stream->recv_reduction, &window_size_increment); + &stream->local_window_size, &stream->recv_window_size, + &stream->recv_reduction, &window_size_increment); if (rv != 0) { return rv; @@ -614,7 +521,7 @@ int nghttp2_submit_origin(nghttp2_session *session, uint8_t flags, /* The last nov is added for terminal NULL character. */ ov_copy = - nghttp2_mem_malloc(mem, nov * sizeof(nghttp2_origin_entry) + len + nov); + nghttp2_mem_malloc(mem, nov * sizeof(nghttp2_origin_entry) + len + nov); if (ov_copy == NULL) { return NGHTTP2_ERR_NOMEM; } @@ -739,59 +646,68 @@ int nghttp2_submit_priority_update(nghttp2_session *session, uint8_t flags, return rv; } -static uint8_t set_request_flags(const nghttp2_priority_spec *pri_spec, - const nghttp2_data_provider *data_prd) { +static uint8_t set_request_flags(const nghttp2_data_provider_wrap *dpw) { uint8_t flags = NGHTTP2_FLAG_NONE; - if (data_prd == NULL || data_prd->read_callback == NULL) { + if (dpw == NULL || dpw->data_prd.read_callback == NULL) { flags |= NGHTTP2_FLAG_END_STREAM; } - if (pri_spec) { - flags |= NGHTTP2_FLAG_PRIORITY; - } - return flags; } -int32_t nghttp2_submit_request(nghttp2_session *session, - const nghttp2_priority_spec *pri_spec, - const nghttp2_nv *nva, size_t nvlen, - const nghttp2_data_provider *data_prd, - void *stream_user_data) { +static int32_t submit_request_shared(nghttp2_session *session, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider_wrap *dpw, + void *stream_user_data) { uint8_t flags; - int rv; if (session->server) { return NGHTTP2_ERR_PROTO; } - if (pri_spec && !nghttp2_priority_spec_check_default(pri_spec) && - session->remote_settings.no_rfc7540_priorities != 1) { - rv = detect_self_dependency(session, -1, pri_spec); - if (rv != 0) { - return rv; - } - } else { - pri_spec = NULL; - } + flags = set_request_flags(dpw); + + return submit_headers_shared_nva(session, flags, -1, nva, nvlen, dpw, + stream_user_data); +} + +int32_t nghttp2_submit_request(nghttp2_session *session, + const nghttp2_priority_spec *pri_spec, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider *data_prd, + void *stream_user_data) { + nghttp2_data_provider_wrap dpw; + (void)pri_spec; - flags = set_request_flags(pri_spec, data_prd); + return submit_request_shared(session, nva, nvlen, + nghttp2_data_provider_wrap_v1(&dpw, data_prd), + stream_user_data); +} - return submit_headers_shared_nva(session, flags, -1, pri_spec, nva, nvlen, - data_prd, stream_user_data); +int32_t nghttp2_submit_request2(nghttp2_session *session, + const nghttp2_priority_spec *pri_spec, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider2 *data_prd, + void *stream_user_data) { + nghttp2_data_provider_wrap dpw; + (void)pri_spec; + + return submit_request_shared(session, nva, nvlen, + nghttp2_data_provider_wrap_v2(&dpw, data_prd), + stream_user_data); } -static uint8_t set_response_flags(const nghttp2_data_provider *data_prd) { +static uint8_t set_response_flags(const nghttp2_data_provider_wrap *dpw) { uint8_t flags = NGHTTP2_FLAG_NONE; - if (data_prd == NULL || data_prd->read_callback == NULL) { + if (dpw == NULL || dpw->data_prd.read_callback == NULL) { flags |= NGHTTP2_FLAG_END_STREAM; } return flags; } -int nghttp2_submit_response(nghttp2_session *session, int32_t stream_id, - const nghttp2_nv *nva, size_t nvlen, - const nghttp2_data_provider *data_prd) { +static int submit_response_shared(nghttp2_session *session, int32_t stream_id, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider_wrap *dpw) { uint8_t flags; if (stream_id <= 0) { @@ -802,14 +718,32 @@ int nghttp2_submit_response(nghttp2_session *session, int32_t stream_id, return NGHTTP2_ERR_PROTO; } - flags = set_response_flags(data_prd); - return submit_headers_shared_nva(session, flags, stream_id, NULL, nva, nvlen, - data_prd, NULL); + flags = set_response_flags(dpw); + return submit_headers_shared_nva(session, flags, stream_id, nva, nvlen, dpw, + NULL); } -int nghttp2_submit_data(nghttp2_session *session, uint8_t flags, - int32_t stream_id, - const nghttp2_data_provider *data_prd) { +int nghttp2_submit_response(nghttp2_session *session, int32_t stream_id, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider *data_prd) { + nghttp2_data_provider_wrap dpw; + + return submit_response_shared(session, stream_id, nva, nvlen, + nghttp2_data_provider_wrap_v1(&dpw, data_prd)); +} + +int nghttp2_submit_response2(nghttp2_session *session, int32_t stream_id, + const nghttp2_nv *nva, size_t nvlen, + const nghttp2_data_provider2 *data_prd) { + nghttp2_data_provider_wrap dpw; + + return submit_response_shared(session, stream_id, nva, nvlen, + nghttp2_data_provider_wrap_v2(&dpw, data_prd)); +} + +int nghttp2_submit_data_shared(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_data_provider_wrap *dpw) { int rv; nghttp2_outbound_item *item; nghttp2_frame *frame; @@ -832,7 +766,7 @@ int nghttp2_submit_data(nghttp2_session *session, uint8_t flags, frame = &item->frame; aux_data = &item->aux_data.data; - aux_data->data_prd = *data_prd; + aux_data->dpw = *dpw; aux_data->eof = 0; aux_data->flags = nflags; @@ -848,9 +782,37 @@ int nghttp2_submit_data(nghttp2_session *session, uint8_t flags, return 0; } +int nghttp2_submit_data(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_data_provider *data_prd) { + nghttp2_data_provider_wrap dpw; + + assert(data_prd); + + return nghttp2_submit_data_shared( + session, flags, stream_id, nghttp2_data_provider_wrap_v1(&dpw, data_prd)); +} + +int nghttp2_submit_data2(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_data_provider2 *data_prd) { + nghttp2_data_provider_wrap dpw; + + assert(data_prd); + + return nghttp2_submit_data_shared( + session, flags, stream_id, nghttp2_data_provider_wrap_v2(&dpw, data_prd)); +} + ssize_t nghttp2_pack_settings_payload(uint8_t *buf, size_t buflen, const nghttp2_settings_entry *iv, size_t niv) { + return (ssize_t)nghttp2_pack_settings_payload2(buf, buflen, iv, niv); +} + +nghttp2_ssize nghttp2_pack_settings_payload2(uint8_t *buf, size_t buflen, + const nghttp2_settings_entry *iv, + size_t niv) { if (!nghttp2_iv_check(iv, niv)) { return NGHTTP2_ERR_INVALID_ARGUMENT; } @@ -859,7 +821,7 @@ ssize_t nghttp2_pack_settings_payload(uint8_t *buf, size_t buflen, return NGHTTP2_ERR_INSUFF_BUFSIZE; } - return (ssize_t)nghttp2_frame_pack_settings_payload(buf, iv, niv); + return (nghttp2_ssize)nghttp2_frame_pack_settings_payload(buf, iv, niv); } int nghttp2_submit_extension(nghttp2_session *session, uint8_t type, @@ -875,7 +837,8 @@ int nghttp2_submit_extension(nghttp2_session *session, uint8_t type, return NGHTTP2_ERR_INVALID_ARGUMENT; } - if (!session->callbacks.pack_extension_callback) { + if (!session->callbacks.pack_extension_callback2 && + !session->callbacks.pack_extension_callback) { return NGHTTP2_ERR_INVALID_STATE; } diff --git a/lib/nghttp2/lib/nghttp2_submit.h b/lib/nghttp2-1.65.0/lib/nghttp2_submit.h similarity index 85% rename from lib/nghttp2/lib/nghttp2_submit.h rename to lib/nghttp2-1.65.0/lib/nghttp2_submit.h index 74d702fbcf0..350ee022759 100644 --- a/lib/nghttp2/lib/nghttp2_submit.h +++ b/lib/nghttp2-1.65.0/lib/nghttp2_submit.h @@ -31,4 +31,10 @@ #include +#include "nghttp2_outbound_item.h" + +int nghttp2_submit_data_shared(nghttp2_session *session, uint8_t flags, + int32_t stream_id, + const nghttp2_data_provider_wrap *dpw); + #endif /* NGHTTP2_SUBMIT_H */ diff --git a/lib/nghttp2/lib/nghttp2_time.c b/lib/nghttp2-1.65.0/lib/nghttp2_time.c similarity index 95% rename from lib/nghttp2/lib/nghttp2_time.c rename to lib/nghttp2-1.65.0/lib/nghttp2_time.c index bdc83d2ec7f..148ccfdce81 100644 --- a/lib/nghttp2/lib/nghttp2_time.c +++ b/lib/nghttp2-1.65.0/lib/nghttp2_time.c @@ -24,14 +24,12 @@ */ #include "nghttp2_time.h" -#ifdef HAVE_TIME_H -# include -#endif /* HAVE_TIME_H */ - #ifdef HAVE_WINDOWS_H # include #endif /* HAVE_WINDOWS_H */ +#include + #if !defined(HAVE_GETTICKCOUNT64) || defined(__CYGWIN__) static uint64_t time_now_sec(void) { time_t t = time(NULL); @@ -47,7 +45,7 @@ static uint64_t time_now_sec(void) { #if defined(HAVE_GETTICKCOUNT64) && !defined(__CYGWIN__) uint64_t nghttp2_time_now_sec(void) { return GetTickCount64() / 1000; } #elif defined(HAVE_CLOCK_GETTIME) && defined(HAVE_DECL_CLOCK_MONOTONIC) && \ - HAVE_DECL_CLOCK_MONOTONIC + HAVE_DECL_CLOCK_MONOTONIC uint64_t nghttp2_time_now_sec(void) { struct timespec tp; int rv = clock_gettime(CLOCK_MONOTONIC, &tp); diff --git a/lib/nghttp2/lib/nghttp2_time.h b/lib/nghttp2-1.65.0/lib/nghttp2_time.h similarity index 100% rename from lib/nghttp2/lib/nghttp2_time.h rename to lib/nghttp2-1.65.0/lib/nghttp2_time.h diff --git a/lib/nghttp2/lib/nghttp2_version.c b/lib/nghttp2-1.65.0/lib/nghttp2_version.c similarity index 100% rename from lib/nghttp2/lib/nghttp2_version.c rename to lib/nghttp2-1.65.0/lib/nghttp2_version.c diff --git a/lib/nghttp2-1.65.0/lib/sfparse.c b/lib/nghttp2-1.65.0/lib/sfparse.c new file mode 100644 index 00000000000..cee089d3944 --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/sfparse.c @@ -0,0 +1,1787 @@ +/* + * sfparse + * + * Copyright (c) 2023 sfparse contributors + * Copyright (c) 2019 nghttp3 contributors + * Copyright (c) 2015 nghttp2 contributors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "sfparse.h" + +#include +#include +#include + +#ifdef __AVX2__ +# include +#endif /* __AVX2__ */ + +#define SFPARSE_STATE_DICT 0x08u +#define SFPARSE_STATE_LIST 0x10u +#define SFPARSE_STATE_ITEM 0x18u + +#define SFPARSE_STATE_INNER_LIST 0x04u + +#define SFPARSE_STATE_BEFORE 0x00u +#define SFPARSE_STATE_BEFORE_PARAMS 0x01u +#define SFPARSE_STATE_PARAMS 0x02u +#define SFPARSE_STATE_AFTER 0x03u + +#define SFPARSE_STATE_OP_MASK 0x03u + +#define SFPARSE_SET_STATE_AFTER(NAME) \ + (SFPARSE_STATE_##NAME | SFPARSE_STATE_AFTER) +#define SFPARSE_SET_STATE_BEFORE_PARAMS(NAME) \ + (SFPARSE_STATE_##NAME | SFPARSE_STATE_BEFORE_PARAMS) +#define SFPARSE_SET_STATE_INNER_LIST_BEFORE(NAME) \ + (SFPARSE_STATE_##NAME | SFPARSE_STATE_INNER_LIST | SFPARSE_STATE_BEFORE) + +#define SFPARSE_STATE_DICT_AFTER SFPARSE_SET_STATE_AFTER(DICT) +#define SFPARSE_STATE_DICT_BEFORE_PARAMS SFPARSE_SET_STATE_BEFORE_PARAMS(DICT) +#define SFPARSE_STATE_DICT_INNER_LIST_BEFORE \ + SFPARSE_SET_STATE_INNER_LIST_BEFORE(DICT) + +#define SFPARSE_STATE_LIST_AFTER SFPARSE_SET_STATE_AFTER(LIST) +#define SFPARSE_STATE_LIST_BEFORE_PARAMS SFPARSE_SET_STATE_BEFORE_PARAMS(LIST) +#define SFPARSE_STATE_LIST_INNER_LIST_BEFORE \ + SFPARSE_SET_STATE_INNER_LIST_BEFORE(LIST) + +#define SFPARSE_STATE_ITEM_AFTER SFPARSE_SET_STATE_AFTER(ITEM) +#define SFPARSE_STATE_ITEM_BEFORE_PARAMS SFPARSE_SET_STATE_BEFORE_PARAMS(ITEM) +#define SFPARSE_STATE_ITEM_INNER_LIST_BEFORE \ + SFPARSE_SET_STATE_INNER_LIST_BEFORE(ITEM) + +#define SFPARSE_STATE_INITIAL 0x00u + +#define DIGIT_CASES \ + case '0': \ + case '1': \ + case '2': \ + case '3': \ + case '4': \ + case '5': \ + case '6': \ + case '7': \ + case '8': \ + case '9' + +#define LCALPHA_CASES \ + case 'a': \ + case 'b': \ + case 'c': \ + case 'd': \ + case 'e': \ + case 'f': \ + case 'g': \ + case 'h': \ + case 'i': \ + case 'j': \ + case 'k': \ + case 'l': \ + case 'm': \ + case 'n': \ + case 'o': \ + case 'p': \ + case 'q': \ + case 'r': \ + case 's': \ + case 't': \ + case 'u': \ + case 'v': \ + case 'w': \ + case 'x': \ + case 'y': \ + case 'z' + +#define UCALPHA_CASES \ + case 'A': \ + case 'B': \ + case 'C': \ + case 'D': \ + case 'E': \ + case 'F': \ + case 'G': \ + case 'H': \ + case 'I': \ + case 'J': \ + case 'K': \ + case 'L': \ + case 'M': \ + case 'N': \ + case 'O': \ + case 'P': \ + case 'Q': \ + case 'R': \ + case 'S': \ + case 'T': \ + case 'U': \ + case 'V': \ + case 'W': \ + case 'X': \ + case 'Y': \ + case 'Z' + +#define ALPHA_CASES \ + UCALPHA_CASES: \ + LCALPHA_CASES + +#define TOKEN_CASES \ + case '!': \ + case '#': \ + case '$': \ + case '%': \ + case '&': \ + case '\'': \ + case '*': \ + case '+': \ + case '-': \ + case '.': \ + case '/': \ + DIGIT_CASES: \ + case ':': \ + UCALPHA_CASES: \ + case '^': \ + case '_': \ + case '`': \ + LCALPHA_CASES: \ + case '|': \ + case '~' + +#define LCHEXALPHA_CASES \ + case 'a': \ + case 'b': \ + case 'c': \ + case 'd': \ + case 'e': \ + case 'f' + +#define X00_1F_CASES \ + case 0x00: \ + case 0x01: \ + case 0x02: \ + case 0x03: \ + case 0x04: \ + case 0x05: \ + case 0x06: \ + case 0x07: \ + case 0x08: \ + case 0x09: \ + case 0x0a: \ + case 0x0b: \ + case 0x0c: \ + case 0x0d: \ + case 0x0e: \ + case 0x0f: \ + case 0x10: \ + case 0x11: \ + case 0x12: \ + case 0x13: \ + case 0x14: \ + case 0x15: \ + case 0x16: \ + case 0x17: \ + case 0x18: \ + case 0x19: \ + case 0x1a: \ + case 0x1b: \ + case 0x1c: \ + case 0x1d: \ + case 0x1e: \ + case 0x1f + +#define X20_21_CASES \ + case ' ': \ + case '!' + +#define X23_5B_CASES \ + case '#': \ + case '$': \ + case '%': \ + case '&': \ + case '\'': \ + case '(': \ + case ')': \ + case '*': \ + case '+': \ + case ',': \ + case '-': \ + case '.': \ + case '/': \ + DIGIT_CASES: \ + case ':': \ + case ';': \ + case '<': \ + case '=': \ + case '>': \ + case '?': \ + case '@': \ + UCALPHA_CASES: \ + case '[' + +#define X5D_7E_CASES \ + case ']': \ + case '^': \ + case '_': \ + case '`': \ + LCALPHA_CASES: \ + case '{': \ + case '|': \ + case '}': \ + case '~' + +#define X7F_FF_CASES \ + case 0x7f: \ + case 0x80: \ + case 0x81: \ + case 0x82: \ + case 0x83: \ + case 0x84: \ + case 0x85: \ + case 0x86: \ + case 0x87: \ + case 0x88: \ + case 0x89: \ + case 0x8a: \ + case 0x8b: \ + case 0x8c: \ + case 0x8d: \ + case 0x8e: \ + case 0x8f: \ + case 0x90: \ + case 0x91: \ + case 0x92: \ + case 0x93: \ + case 0x94: \ + case 0x95: \ + case 0x96: \ + case 0x97: \ + case 0x98: \ + case 0x99: \ + case 0x9a: \ + case 0x9b: \ + case 0x9c: \ + case 0x9d: \ + case 0x9e: \ + case 0x9f: \ + case 0xa0: \ + case 0xa1: \ + case 0xa2: \ + case 0xa3: \ + case 0xa4: \ + case 0xa5: \ + case 0xa6: \ + case 0xa7: \ + case 0xa8: \ + case 0xa9: \ + case 0xaa: \ + case 0xab: \ + case 0xac: \ + case 0xad: \ + case 0xae: \ + case 0xaf: \ + case 0xb0: \ + case 0xb1: \ + case 0xb2: \ + case 0xb3: \ + case 0xb4: \ + case 0xb5: \ + case 0xb6: \ + case 0xb7: \ + case 0xb8: \ + case 0xb9: \ + case 0xba: \ + case 0xbb: \ + case 0xbc: \ + case 0xbd: \ + case 0xbe: \ + case 0xbf: \ + case 0xc0: \ + case 0xc1: \ + case 0xc2: \ + case 0xc3: \ + case 0xc4: \ + case 0xc5: \ + case 0xc6: \ + case 0xc7: \ + case 0xc8: \ + case 0xc9: \ + case 0xca: \ + case 0xcb: \ + case 0xcc: \ + case 0xcd: \ + case 0xce: \ + case 0xcf: \ + case 0xd0: \ + case 0xd1: \ + case 0xd2: \ + case 0xd3: \ + case 0xd4: \ + case 0xd5: \ + case 0xd6: \ + case 0xd7: \ + case 0xd8: \ + case 0xd9: \ + case 0xda: \ + case 0xdb: \ + case 0xdc: \ + case 0xdd: \ + case 0xde: \ + case 0xdf: \ + case 0xe0: \ + case 0xe1: \ + case 0xe2: \ + case 0xe3: \ + case 0xe4: \ + case 0xe5: \ + case 0xe6: \ + case 0xe7: \ + case 0xe8: \ + case 0xe9: \ + case 0xea: \ + case 0xeb: \ + case 0xec: \ + case 0xed: \ + case 0xee: \ + case 0xef: \ + case 0xf0: \ + case 0xf1: \ + case 0xf2: \ + case 0xf3: \ + case 0xf4: \ + case 0xf5: \ + case 0xf6: \ + case 0xf7: \ + case 0xf8: \ + case 0xf9: \ + case 0xfa: \ + case 0xfb: \ + case 0xfc: \ + case 0xfd: \ + case 0xfe: \ + case 0xff + +static int is_ws(uint8_t c) { + switch (c) { + case ' ': + case '\t': + return 1; + default: + return 0; + } +} + +#ifdef __AVX2__ +# ifdef _MSC_VER +# include + +static int ctz(unsigned int v) { + unsigned long n; + + /* Assume that v is not 0. */ + _BitScanForward(&n, v); + + return (int)n; +} +# else /* !_MSC_VER */ +# define ctz __builtin_ctz +# endif /* !_MSC_VER */ +#endif /* __AVX2__ */ + +static int parser_eof(sfparse_parser *sfp) { return sfp->pos == sfp->end; } + +static void parser_discard_ows(sfparse_parser *sfp) { + for (; !parser_eof(sfp) && is_ws(*sfp->pos); ++sfp->pos) + ; +} + +static void parser_discard_sp(sfparse_parser *sfp) { + for (; !parser_eof(sfp) && *sfp->pos == ' '; ++sfp->pos) + ; +} + +static void parser_set_op_state(sfparse_parser *sfp, uint32_t op) { + sfp->state &= ~SFPARSE_STATE_OP_MASK; + sfp->state |= op; +} + +static void parser_unset_inner_list_state(sfparse_parser *sfp) { + sfp->state &= ~SFPARSE_STATE_INNER_LIST; +} + +#ifdef __AVX2__ +static const uint8_t *find_char_key(const uint8_t *first, const uint8_t *last) { + const __m256i us = _mm256_set1_epi8('_'); + const __m256i ds = _mm256_set1_epi8('-'); + const __m256i dot = _mm256_set1_epi8('.'); + const __m256i ast = _mm256_set1_epi8('*'); + const __m256i r0l = _mm256_set1_epi8('0' - 1); + const __m256i r0r = _mm256_set1_epi8('9' + 1); + const __m256i r1l = _mm256_set1_epi8('a' - 1); + const __m256i r1r = _mm256_set1_epi8('z' + 1); + __m256i s, x; + uint32_t m; + + for (; first != last; first += 32) { + s = _mm256_loadu_si256((void *)first); + + x = _mm256_cmpeq_epi8(s, us); + x = _mm256_or_si256(_mm256_cmpeq_epi8(s, ds), x); + x = _mm256_or_si256(_mm256_cmpeq_epi8(s, dot), x); + x = _mm256_or_si256(_mm256_cmpeq_epi8(s, ast), x); + x = _mm256_or_si256( + _mm256_and_si256(_mm256_cmpgt_epi8(s, r0l), _mm256_cmpgt_epi8(r0r, s)), + x); + x = _mm256_or_si256( + _mm256_and_si256(_mm256_cmpgt_epi8(s, r1l), _mm256_cmpgt_epi8(r1r, s)), + x); + + m = ~(uint32_t)_mm256_movemask_epi8(x); + if (m) { + return first + ctz(m); + } + } + + return last; +} +#endif /* __AVX2__ */ + +static int parser_key(sfparse_parser *sfp, sfparse_vec *dest) { + const uint8_t *base; +#ifdef __AVX2__ + const uint8_t *last; +#endif /* __AVX2__ */ + + switch (*sfp->pos) { + case '*': + LCALPHA_CASES: + break; + default: + return SFPARSE_ERR_PARSE; + } + + base = sfp->pos++; + +#ifdef __AVX2__ + if (sfp->end - sfp->pos >= 32) { + last = sfp->pos + ((sfp->end - sfp->pos) & ~0x1fu); + + sfp->pos = find_char_key(sfp->pos, last); + if (sfp->pos != last) { + goto fin; + } + } +#endif /* __AVX2__ */ + + for (; !parser_eof(sfp); ++sfp->pos) { + switch (*sfp->pos) { + case '_': + case '-': + case '.': + case '*': + DIGIT_CASES: + LCALPHA_CASES: + continue; + } + + break; + } + +#ifdef __AVX2__ +fin: +#endif /* __AVX2__ */ + if (dest) { + dest->base = (uint8_t *)base; + dest->len = (size_t)(sfp->pos - dest->base); + } + + return 0; +} + +static int parser_number(sfparse_parser *sfp, sfparse_value *dest) { + int sign = 1; + int64_t value = 0; + size_t len = 0; + size_t fpos = 0; + + if (*sfp->pos == '-') { + ++sfp->pos; + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + sign = -1; + } + + assert(!parser_eof(sfp)); + + for (; !parser_eof(sfp); ++sfp->pos) { + switch (*sfp->pos) { + DIGIT_CASES: + if (++len > 15) { + return SFPARSE_ERR_PARSE; + } + + value *= 10; + value += *sfp->pos - '0'; + + continue; + } + + break; + } + + if (len == 0) { + return SFPARSE_ERR_PARSE; + } + + if (parser_eof(sfp) || *sfp->pos != '.') { + if (dest) { + dest->type = SFPARSE_TYPE_INTEGER; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + dest->integer = value * sign; + } + + return 0; + } + + /* decimal */ + + if (len > 12) { + return SFPARSE_ERR_PARSE; + } + + fpos = len; + + ++sfp->pos; + + for (; !parser_eof(sfp); ++sfp->pos) { + switch (*sfp->pos) { + DIGIT_CASES: + if (++len > 15) { + return SFPARSE_ERR_PARSE; + } + + value *= 10; + value += *sfp->pos - '0'; + + continue; + } + + break; + } + + if (fpos == len || len - fpos > 3) { + return SFPARSE_ERR_PARSE; + } + + if (dest) { + dest->type = SFPARSE_TYPE_DECIMAL; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + dest->decimal.numer = value * sign; + + switch (len - fpos) { + case 1: + dest->decimal.denom = 10; + + break; + case 2: + dest->decimal.denom = 100; + + break; + case 3: + dest->decimal.denom = 1000; + + break; + } + } + + return 0; +} + +static int parser_date(sfparse_parser *sfp, sfparse_value *dest) { + int rv; + sfparse_value val; + + /* The first byte has already been validated by the caller. */ + assert('@' == *sfp->pos); + + ++sfp->pos; + + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + rv = parser_number(sfp, &val); + if (rv != 0) { + return rv; + } + + if (val.type != SFPARSE_TYPE_INTEGER) { + return SFPARSE_ERR_PARSE; + } + + if (dest) { + *dest = val; + dest->type = SFPARSE_TYPE_DATE; + } + + return 0; +} + +#ifdef __AVX2__ +static const uint8_t *find_char_string(const uint8_t *first, + const uint8_t *last) { + const __m256i bs = _mm256_set1_epi8('\\'); + const __m256i dq = _mm256_set1_epi8('"'); + const __m256i del = _mm256_set1_epi8(0x7f); + const __m256i sp = _mm256_set1_epi8(' '); + __m256i s, x; + uint32_t m; + + for (; first != last; first += 32) { + s = _mm256_loadu_si256((void *)first); + + x = _mm256_cmpgt_epi8(sp, s); + x = _mm256_or_si256(_mm256_cmpeq_epi8(s, bs), x); + x = _mm256_or_si256(_mm256_cmpeq_epi8(s, dq), x); + x = _mm256_or_si256(_mm256_cmpeq_epi8(s, del), x); + + m = (uint32_t)_mm256_movemask_epi8(x); + if (m) { + return first + ctz(m); + } + } + + return last; +} +#endif /* __AVX2__ */ + +static int parser_string(sfparse_parser *sfp, sfparse_value *dest) { + const uint8_t *base; +#ifdef __AVX2__ + const uint8_t *last; +#endif /* __AVX2__ */ + uint32_t flags = SFPARSE_VALUE_FLAG_NONE; + + /* The first byte has already been validated by the caller. */ + assert('"' == *sfp->pos); + + base = ++sfp->pos; + +#ifdef __AVX2__ + for (; sfp->end - sfp->pos >= 32; ++sfp->pos) { + last = sfp->pos + ((sfp->end - sfp->pos) & ~0x1fu); + + sfp->pos = find_char_string(sfp->pos, last); + if (sfp->pos == last) { + break; + } + + switch (*sfp->pos) { + case '\\': + ++sfp->pos; + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + switch (*sfp->pos) { + case '"': + case '\\': + flags = SFPARSE_VALUE_FLAG_ESCAPED_STRING; + + break; + default: + return SFPARSE_ERR_PARSE; + } + + break; + case '"': + goto fin; + default: + return SFPARSE_ERR_PARSE; + } + } +#endif /* __AVX2__ */ + + for (; !parser_eof(sfp); ++sfp->pos) { + switch (*sfp->pos) { + X20_21_CASES: + X23_5B_CASES: + X5D_7E_CASES: + break; + case '\\': + ++sfp->pos; + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + switch (*sfp->pos) { + case '"': + case '\\': + flags = SFPARSE_VALUE_FLAG_ESCAPED_STRING; + + break; + default: + return SFPARSE_ERR_PARSE; + } + + break; + case '"': + goto fin; + default: + return SFPARSE_ERR_PARSE; + } + } + + return SFPARSE_ERR_PARSE; + +fin: + if (dest) { + dest->type = SFPARSE_TYPE_STRING; + dest->flags = flags; + dest->vec.len = (size_t)(sfp->pos - base); + dest->vec.base = dest->vec.len == 0 ? NULL : (uint8_t *)base; + } + + ++sfp->pos; + + return 0; +} + +#ifdef __AVX2__ +static const uint8_t *find_char_token(const uint8_t *first, + const uint8_t *last) { + /* r0: !..:, excluding "(), + r1: A..Z + r2: ^..~, excluding {} */ + const __m256i r0l = _mm256_set1_epi8('!' - 1); + const __m256i r0r = _mm256_set1_epi8(':' + 1); + const __m256i dq = _mm256_set1_epi8('"'); + const __m256i prl = _mm256_set1_epi8('('); + const __m256i prr = _mm256_set1_epi8(')'); + const __m256i comma = _mm256_set1_epi8(','); + const __m256i r1l = _mm256_set1_epi8('A' - 1); + const __m256i r1r = _mm256_set1_epi8('Z' + 1); + const __m256i r2l = _mm256_set1_epi8('^' - 1); + const __m256i r2r = _mm256_set1_epi8('~' + 1); + const __m256i cbl = _mm256_set1_epi8('{'); + const __m256i cbr = _mm256_set1_epi8('}'); + __m256i s, x; + uint32_t m; + + for (; first != last; first += 32) { + s = _mm256_loadu_si256((void *)first); + + x = _mm256_andnot_si256( + _mm256_cmpeq_epi8(s, comma), + _mm256_andnot_si256( + _mm256_cmpeq_epi8(s, prr), + _mm256_andnot_si256( + _mm256_cmpeq_epi8(s, prl), + _mm256_andnot_si256(_mm256_cmpeq_epi8(s, dq), + _mm256_and_si256(_mm256_cmpgt_epi8(s, r0l), + _mm256_cmpgt_epi8(r0r, s)))))); + x = _mm256_or_si256( + _mm256_and_si256(_mm256_cmpgt_epi8(s, r1l), _mm256_cmpgt_epi8(r1r, s)), + x); + x = _mm256_or_si256( + _mm256_andnot_si256( + _mm256_cmpeq_epi8(s, cbr), + _mm256_andnot_si256(_mm256_cmpeq_epi8(s, cbl), + _mm256_and_si256(_mm256_cmpgt_epi8(s, r2l), + _mm256_cmpgt_epi8(r2r, s)))), + x); + + m = ~(uint32_t)_mm256_movemask_epi8(x); + if (m) { + return first + ctz(m); + } + } + + return last; +} +#endif /* __AVX2__ */ + +static int parser_token(sfparse_parser *sfp, sfparse_value *dest) { + const uint8_t *base; +#ifdef __AVX2__ + const uint8_t *last; +#endif /* __AVX2__ */ + + /* The first byte has already been validated by the caller. */ + base = sfp->pos++; + +#ifdef __AVX2__ + if (sfp->end - sfp->pos >= 32) { + last = sfp->pos + ((sfp->end - sfp->pos) & ~0x1fu); + + sfp->pos = find_char_token(sfp->pos, last); + if (sfp->pos != last) { + goto fin; + } + } +#endif /* __AVX2__ */ + + for (; !parser_eof(sfp); ++sfp->pos) { + switch (*sfp->pos) { + TOKEN_CASES: + continue; + } + + break; + } + +#ifdef __AVX2__ +fin: +#endif /* __AVX2__ */ + if (dest) { + dest->type = SFPARSE_TYPE_TOKEN; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + dest->vec.base = (uint8_t *)base; + dest->vec.len = (size_t)(sfp->pos - base); + } + + return 0; +} + +#ifdef __AVX2__ +static const uint8_t *find_char_byteseq(const uint8_t *first, + const uint8_t *last) { + const __m256i pls = _mm256_set1_epi8('+'); + const __m256i fs = _mm256_set1_epi8('/'); + const __m256i r0l = _mm256_set1_epi8('0' - 1); + const __m256i r0r = _mm256_set1_epi8('9' + 1); + const __m256i r1l = _mm256_set1_epi8('A' - 1); + const __m256i r1r = _mm256_set1_epi8('Z' + 1); + const __m256i r2l = _mm256_set1_epi8('a' - 1); + const __m256i r2r = _mm256_set1_epi8('z' + 1); + __m256i s, x; + uint32_t m; + + for (; first != last; first += 32) { + s = _mm256_loadu_si256((void *)first); + + x = _mm256_cmpeq_epi8(s, pls); + x = _mm256_or_si256(_mm256_cmpeq_epi8(s, fs), x); + x = _mm256_or_si256( + _mm256_and_si256(_mm256_cmpgt_epi8(s, r0l), _mm256_cmpgt_epi8(r0r, s)), + x); + x = _mm256_or_si256( + _mm256_and_si256(_mm256_cmpgt_epi8(s, r1l), _mm256_cmpgt_epi8(r1r, s)), + x); + x = _mm256_or_si256( + _mm256_and_si256(_mm256_cmpgt_epi8(s, r2l), _mm256_cmpgt_epi8(r2r, s)), + x); + + m = ~(uint32_t)_mm256_movemask_epi8(x); + if (m) { + return first + ctz(m); + } + } + + return last; +} +#endif /* __AVX2__ */ + +static int parser_byteseq(sfparse_parser *sfp, sfparse_value *dest) { + const uint8_t *base; +#ifdef __AVX2__ + const uint8_t *last; +#endif /* __AVX2__ */ + + /* The first byte has already been validated by the caller. */ + assert(':' == *sfp->pos); + + base = ++sfp->pos; + +#ifdef __AVX2__ + if (sfp->end - sfp->pos >= 32) { + last = sfp->pos + ((sfp->end - sfp->pos) & ~0x1fu); + sfp->pos = find_char_byteseq(sfp->pos, last); + } +#endif /* __AVX2__ */ + + for (; !parser_eof(sfp); ++sfp->pos) { + switch (*sfp->pos) { + case '+': + case '/': + DIGIT_CASES: + ALPHA_CASES: + continue; + case '=': + switch ((sfp->pos - base) & 0x3) { + case 0: + case 1: + return SFPARSE_ERR_PARSE; + case 2: + ++sfp->pos; + + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + if (*sfp->pos == '=') { + ++sfp->pos; + } + + break; + case 3: + ++sfp->pos; + + break; + } + + if (parser_eof(sfp) || *sfp->pos != ':') { + return SFPARSE_ERR_PARSE; + } + + goto fin; + case ':': + if (((sfp->pos - base) & 0x3) == 1) { + return SFPARSE_ERR_PARSE; + } + + goto fin; + default: + return SFPARSE_ERR_PARSE; + } + } + + return SFPARSE_ERR_PARSE; + +fin: + if (dest) { + dest->type = SFPARSE_TYPE_BYTESEQ; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + dest->vec.len = (size_t)(sfp->pos - base); + dest->vec.base = dest->vec.len == 0 ? NULL : (uint8_t *)base; + } + + ++sfp->pos; + + return 0; +} + +static int parser_boolean(sfparse_parser *sfp, sfparse_value *dest) { + int b; + + /* The first byte has already been validated by the caller. */ + assert('?' == *sfp->pos); + + ++sfp->pos; + + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + switch (*sfp->pos) { + case '0': + b = 0; + + break; + case '1': + b = 1; + + break; + default: + return SFPARSE_ERR_PARSE; + } + + ++sfp->pos; + + if (dest) { + dest->type = SFPARSE_TYPE_BOOLEAN; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + dest->boolean = b; + } + + return 0; +} + +static int pctdecode(uint8_t *pc, const uint8_t **ppos) { + uint8_t c, b = **ppos; + + switch (b) { + DIGIT_CASES: + c = (uint8_t)((b - '0') << 4); + + break; + LCHEXALPHA_CASES: + c = (uint8_t)((b - 'a' + 10) << 4); + + break; + default: + return -1; + } + + b = *++*ppos; + + switch (b) { + DIGIT_CASES: + c |= (uint8_t)(b - '0'); + + break; + LCHEXALPHA_CASES: + c |= (uint8_t)(b - 'a' + 10); + + break; + default: + return -1; + } + + *pc = c; + ++*ppos; + + return 0; +} + +/* Start of utf8 dfa */ +/* Copyright (c) 2008-2010 Bjoern Hoehrmann + * See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. + * + * Copyright (c) 2008-2009 Bjoern Hoehrmann + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#define UTF8_ACCEPT 0 +#define UTF8_REJECT 12 + +/* clang-format off */ +static const uint8_t utf8d[] = { + /* + * The first part of the table maps bytes to character classes that + * to reduce the size of the transition table and create bitmasks. + */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8, + + /* + * The second part is a transition table that maps a combination + * of a state of the automaton and a character class to a state. + */ + 0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12, + 12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12, + 12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12, + 12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12, + 12,36,12,12,12,12,12,12,12,12,12,12, +}; +/* clang-format on */ + +static void utf8_decode(uint32_t *state, uint8_t byte) { + *state = utf8d[256 + *state + utf8d[byte]]; +} + +/* End of utf8 dfa */ + +static int parser_dispstring(sfparse_parser *sfp, sfparse_value *dest) { + const uint8_t *base; + uint8_t c; + uint32_t utf8state = UTF8_ACCEPT; + + assert('%' == *sfp->pos); + + ++sfp->pos; + + if (parser_eof(sfp) || *sfp->pos != '"') { + return SFPARSE_ERR_PARSE; + } + + base = ++sfp->pos; + + for (; !parser_eof(sfp);) { + switch (*sfp->pos) { + X00_1F_CASES: + X7F_FF_CASES: + return SFPARSE_ERR_PARSE; + case '%': + ++sfp->pos; + + if (sfp->pos + 2 > sfp->end) { + return SFPARSE_ERR_PARSE; + } + + if (pctdecode(&c, &sfp->pos) != 0) { + return SFPARSE_ERR_PARSE; + } + + utf8_decode(&utf8state, c); + if (utf8state == UTF8_REJECT) { + return SFPARSE_ERR_PARSE; + } + + break; + case '"': + if (utf8state != UTF8_ACCEPT) { + return SFPARSE_ERR_PARSE; + } + + if (dest) { + dest->type = SFPARSE_TYPE_DISPSTRING; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + dest->vec.len = (size_t)(sfp->pos - base); + dest->vec.base = dest->vec.len == 0 ? NULL : (uint8_t *)base; + } + + ++sfp->pos; + + return 0; + default: + if (utf8state != UTF8_ACCEPT) { + return SFPARSE_ERR_PARSE; + } + + ++sfp->pos; + } + } + + return SFPARSE_ERR_PARSE; +} + +static int parser_bare_item(sfparse_parser *sfp, sfparse_value *dest) { + switch (*sfp->pos) { + case '"': + return parser_string(sfp, dest); + case '-': + DIGIT_CASES: + return parser_number(sfp, dest); + case '@': + return parser_date(sfp, dest); + case ':': + return parser_byteseq(sfp, dest); + case '?': + return parser_boolean(sfp, dest); + case '*': + ALPHA_CASES: + return parser_token(sfp, dest); + case '%': + return parser_dispstring(sfp, dest); + default: + return SFPARSE_ERR_PARSE; + } +} + +static int parser_skip_inner_list(sfparse_parser *sfp); + +int sfparse_parser_param(sfparse_parser *sfp, sfparse_vec *dest_key, + sfparse_value *dest_value) { + int rv; + + switch (sfp->state & SFPARSE_STATE_OP_MASK) { + case SFPARSE_STATE_BEFORE: + rv = parser_skip_inner_list(sfp); + if (rv != 0) { + return rv; + } + + /* fall through */ + case SFPARSE_STATE_BEFORE_PARAMS: + parser_set_op_state(sfp, SFPARSE_STATE_PARAMS); + + break; + case SFPARSE_STATE_PARAMS: + break; + default: + assert(0); + abort(); + } + + if (parser_eof(sfp) || *sfp->pos != ';') { + parser_set_op_state(sfp, SFPARSE_STATE_AFTER); + + return SFPARSE_ERR_EOF; + } + + ++sfp->pos; + + parser_discard_sp(sfp); + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + rv = parser_key(sfp, dest_key); + if (rv != 0) { + return rv; + } + + if (parser_eof(sfp) || *sfp->pos != '=') { + if (dest_value) { + dest_value->type = SFPARSE_TYPE_BOOLEAN; + dest_value->flags = SFPARSE_VALUE_FLAG_NONE; + dest_value->boolean = 1; + } + + return 0; + } + + ++sfp->pos; + + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + return parser_bare_item(sfp, dest_value); +} + +static int parser_skip_params(sfparse_parser *sfp) { + int rv; + + for (;;) { + rv = sfparse_parser_param(sfp, NULL, NULL); + switch (rv) { + case 0: + break; + case SFPARSE_ERR_EOF: + return 0; + case SFPARSE_ERR_PARSE: + return rv; + default: + assert(0); + abort(); + } + } +} + +int sfparse_parser_inner_list(sfparse_parser *sfp, sfparse_value *dest) { + int rv; + + switch (sfp->state & SFPARSE_STATE_OP_MASK) { + case SFPARSE_STATE_BEFORE: + parser_discard_sp(sfp); + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + break; + case SFPARSE_STATE_BEFORE_PARAMS: + rv = parser_skip_params(sfp); + if (rv != 0) { + return rv; + } + + /* Technically, we are entering SFPARSE_STATE_AFTER, but we will set + another state without reading the state. */ + /* parser_set_op_state(sfp, SFPARSE_STATE_AFTER); */ + + /* fall through */ + case SFPARSE_STATE_AFTER: + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + switch (*sfp->pos) { + case ' ': + parser_discard_sp(sfp); + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + break; + case ')': + break; + default: + return SFPARSE_ERR_PARSE; + } + + break; + default: + assert(0); + abort(); + } + + if (*sfp->pos == ')') { + ++sfp->pos; + + parser_unset_inner_list_state(sfp); + parser_set_op_state(sfp, SFPARSE_STATE_BEFORE_PARAMS); + + return SFPARSE_ERR_EOF; + } + + rv = parser_bare_item(sfp, dest); + if (rv != 0) { + return rv; + } + + parser_set_op_state(sfp, SFPARSE_STATE_BEFORE_PARAMS); + + return 0; +} + +static int parser_skip_inner_list(sfparse_parser *sfp) { + int rv; + + for (;;) { + rv = sfparse_parser_inner_list(sfp, NULL); + switch (rv) { + case 0: + break; + case SFPARSE_ERR_EOF: + return 0; + case SFPARSE_ERR_PARSE: + return rv; + default: + assert(0); + abort(); + } + } +} + +static int parser_next_key_or_item(sfparse_parser *sfp) { + parser_discard_ows(sfp); + + if (parser_eof(sfp)) { + return SFPARSE_ERR_EOF; + } + + if (*sfp->pos != ',') { + return SFPARSE_ERR_PARSE; + } + + ++sfp->pos; + + parser_discard_ows(sfp); + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + return 0; +} + +static int parser_dict_value(sfparse_parser *sfp, sfparse_value *dest) { + int rv; + + if (parser_eof(sfp) || *(sfp->pos) != '=') { + /* Boolean true */ + if (dest) { + dest->type = SFPARSE_TYPE_BOOLEAN; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + dest->boolean = 1; + } + + sfp->state = SFPARSE_STATE_DICT_BEFORE_PARAMS; + + return 0; + } + + ++sfp->pos; + + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + if (*sfp->pos == '(') { + if (dest) { + dest->type = SFPARSE_TYPE_INNER_LIST; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + } + + ++sfp->pos; + + sfp->state = SFPARSE_STATE_DICT_INNER_LIST_BEFORE; + + return 0; + } + + rv = parser_bare_item(sfp, dest); + if (rv != 0) { + return rv; + } + + sfp->state = SFPARSE_STATE_DICT_BEFORE_PARAMS; + + return 0; +} + +int sfparse_parser_dict(sfparse_parser *sfp, sfparse_vec *dest_key, + sfparse_value *dest_value) { + int rv; + + switch (sfp->state) { + case SFPARSE_STATE_DICT_INNER_LIST_BEFORE: + rv = parser_skip_inner_list(sfp); + if (rv != 0) { + return rv; + } + + /* fall through */ + case SFPARSE_STATE_DICT_BEFORE_PARAMS: + rv = parser_skip_params(sfp); + if (rv != 0) { + return rv; + } + + /* fall through */ + case SFPARSE_STATE_DICT_AFTER: + rv = parser_next_key_or_item(sfp); + if (rv != 0) { + return rv; + } + + break; + case SFPARSE_STATE_INITIAL: + parser_discard_sp(sfp); + + if (parser_eof(sfp)) { + return SFPARSE_ERR_EOF; + } + + break; + default: + assert(0); + abort(); + } + + rv = parser_key(sfp, dest_key); + if (rv != 0) { + return rv; + } + + return parser_dict_value(sfp, dest_value); +} + +int sfparse_parser_list(sfparse_parser *sfp, sfparse_value *dest) { + int rv; + + switch (sfp->state) { + case SFPARSE_STATE_LIST_INNER_LIST_BEFORE: + rv = parser_skip_inner_list(sfp); + if (rv != 0) { + return rv; + } + + /* fall through */ + case SFPARSE_STATE_LIST_BEFORE_PARAMS: + rv = parser_skip_params(sfp); + if (rv != 0) { + return rv; + } + + /* fall through */ + case SFPARSE_STATE_LIST_AFTER: + rv = parser_next_key_or_item(sfp); + if (rv != 0) { + return rv; + } + + break; + case SFPARSE_STATE_INITIAL: + parser_discard_sp(sfp); + + if (parser_eof(sfp)) { + return SFPARSE_ERR_EOF; + } + + break; + default: + assert(0); + abort(); + } + + if (*sfp->pos == '(') { + if (dest) { + dest->type = SFPARSE_TYPE_INNER_LIST; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + } + + ++sfp->pos; + + sfp->state = SFPARSE_STATE_LIST_INNER_LIST_BEFORE; + + return 0; + } + + rv = parser_bare_item(sfp, dest); + if (rv != 0) { + return rv; + } + + sfp->state = SFPARSE_STATE_LIST_BEFORE_PARAMS; + + return 0; +} + +int sfparse_parser_item(sfparse_parser *sfp, sfparse_value *dest) { + int rv; + + switch (sfp->state) { + case SFPARSE_STATE_INITIAL: + parser_discard_sp(sfp); + + if (parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + break; + case SFPARSE_STATE_ITEM_INNER_LIST_BEFORE: + rv = parser_skip_inner_list(sfp); + if (rv != 0) { + return rv; + } + + /* fall through */ + case SFPARSE_STATE_ITEM_BEFORE_PARAMS: + rv = parser_skip_params(sfp); + if (rv != 0) { + return rv; + } + + /* fall through */ + case SFPARSE_STATE_ITEM_AFTER: + parser_discard_sp(sfp); + + if (!parser_eof(sfp)) { + return SFPARSE_ERR_PARSE; + } + + return SFPARSE_ERR_EOF; + default: + assert(0); + abort(); + } + + if (*sfp->pos == '(') { + if (dest) { + dest->type = SFPARSE_TYPE_INNER_LIST; + dest->flags = SFPARSE_VALUE_FLAG_NONE; + } + + ++sfp->pos; + + sfp->state = SFPARSE_STATE_ITEM_INNER_LIST_BEFORE; + + return 0; + } + + rv = parser_bare_item(sfp, dest); + if (rv != 0) { + return rv; + } + + sfp->state = SFPARSE_STATE_ITEM_BEFORE_PARAMS; + + return 0; +} + +void sfparse_parser_init(sfparse_parser *sfp, const uint8_t *data, + size_t datalen) { + if (datalen == 0) { + sfp->pos = sfp->end = NULL; + } else { + sfp->pos = data; + sfp->end = data + datalen; + } + + sfp->state = SFPARSE_STATE_INITIAL; +} + +void sfparse_unescape(sfparse_vec *dest, const sfparse_vec *src) { + const uint8_t *p, *q; + uint8_t *o; + size_t len, slen; + + if (src->len == 0) { + dest->len = 0; + + return; + } + + o = dest->base; + p = src->base; + len = src->len; + + for (;;) { + q = memchr(p, '\\', len); + if (q == NULL) { + memcpy(o, p, len); + o += len; + + dest->len = (size_t)(o - dest->base); + + return; + } + + slen = (size_t)(q - p); + memcpy(o, p, slen); + o += slen; + + p = q + 1; + *o++ = *p++; + len -= slen + 2; + } +} + +void sfparse_base64decode(sfparse_vec *dest, const sfparse_vec *src) { + static const int index_tbl[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, + -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1}; + uint8_t *o; + const uint8_t *p, *end; + uint32_t n; + size_t i, left; + int idx; + + if (src->len == 0) { + dest->len = 0; + + return; + } + + o = dest->base; + p = src->base; + left = src->len & 0x3; + if (left == 0 && src->base[src->len - 1] == '=') { + left = 4; + } + end = src->base + src->len - left; + + for (; p != end;) { + n = 0; + + for (i = 1; i <= 4; ++i, ++p) { + idx = index_tbl[*p]; + + assert(idx != -1); + + n += (uint32_t)(idx << (24 - i * 6)); + } + + *o++ = (uint8_t)(n >> 16); + *o++ = (n >> 8) & 0xffu; + *o++ = n & 0xffu; + } + + switch (left) { + case 0: + goto fin; + case 1: + assert(0); + abort(); + case 3: + if (src->base[src->len - 1] == '=') { + left = 2; + } + + break; + case 4: + assert('=' == src->base[src->len - 1]); + + if (src->base[src->len - 2] == '=') { + left = 2; + } else { + left = 3; + } + + break; + } + + switch (left) { + case 2: + *o = (uint8_t)(index_tbl[*p++] << 2); + *o++ |= (uint8_t)(index_tbl[*p++] >> 4); + + break; + case 3: + n = (uint32_t)(index_tbl[*p++] << 10); + n += (uint32_t)(index_tbl[*p++] << 4); + n += (uint32_t)(index_tbl[*p++] >> 2); + *o++ = (n >> 8) & 0xffu; + *o++ = n & 0xffu; + + break; + } + +fin: + dest->len = (size_t)(o - dest->base); +} + +void sfparse_pctdecode(sfparse_vec *dest, const sfparse_vec *src) { + const uint8_t *p, *q; + uint8_t *o; + size_t len, slen; + + if (src->len == 0) { + dest->len = 0; + + return; + } + + o = dest->base; + p = src->base; + len = src->len; + + for (;;) { + q = memchr(p, '%', len); + if (q == NULL) { + memcpy(o, p, len); + o += len; + + dest->len = (size_t)(o - dest->base); + + return; + } + + slen = (size_t)(q - p); + memcpy(o, p, slen); + o += slen; + + p = q + 1; + + pctdecode(o++, &p); + + len -= slen + 3; + } +} diff --git a/lib/nghttp2-1.65.0/lib/sfparse.h b/lib/nghttp2-1.65.0/lib/sfparse.h new file mode 100644 index 00000000000..9341221a099 --- /dev/null +++ b/lib/nghttp2-1.65.0/lib/sfparse.h @@ -0,0 +1,442 @@ +/* + * sfparse + * + * Copyright (c) 2023 sfparse contributors + * Copyright (c) 2019 nghttp3 contributors + * Copyright (c) 2015 nghttp2 contributors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef SFPARSE_H +#define SFPARSE_H + +/* Define WIN32 when build target is Win32 API (borrowed from + libcurl) */ +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +# define WIN32 +#endif /* (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) */ + +#ifdef __cplusplus +extern "C" { +#endif /* defined(__cplusplus) */ + +#if defined(_MSC_VER) && (_MSC_VER < 1800) +/* MSVC < 2013 does not have inttypes.h because it is not C99 + compliant. See compiler macros and version number in + https://sourceforge.net/p/predef/wiki/Compilers/ */ +# include +#else /* !(defined(_MSC_VER) && (_MSC_VER < 1800)) */ +# include +#endif /* !(defined(_MSC_VER) && (_MSC_VER < 1800)) */ +#include +#include + +/** + * @enum + * + * :type:`sfparse_type` defines value type. + */ +typedef enum sfparse_type { + /** + * :enum:`SFPARSE_TYPE_BOOLEAN` indicates boolean type. + */ + SFPARSE_TYPE_BOOLEAN, + /** + * :enum:`SFPARSE_TYPE_INTEGER` indicates integer type. + */ + SFPARSE_TYPE_INTEGER, + /** + * :enum:`SFPARSE_TYPE_DECIMAL` indicates decimal type. + */ + SFPARSE_TYPE_DECIMAL, + /** + * :enum:`SFPARSE_TYPE_STRING` indicates string type. + */ + SFPARSE_TYPE_STRING, + /** + * :enum:`SFPARSE_TYPE_TOKEN` indicates token type. + */ + SFPARSE_TYPE_TOKEN, + /** + * :enum:`SFPARSE_TYPE_BYTESEQ` indicates byte sequence type. + */ + SFPARSE_TYPE_BYTESEQ, + /** + * :enum:`SFPARSE_TYPE_INNER_LIST` indicates inner list type. + */ + SFPARSE_TYPE_INNER_LIST, + /** + * :enum:`SFPARSE_TYPE_DATE` indicates date type. + */ + SFPARSE_TYPE_DATE, + /** + * :enum:`SFPARSE_TYPE_DISPSTRING` indicates display string type. + */ + SFPARSE_TYPE_DISPSTRING +} sfparse_type; + +/** + * @macro + * + * :macro:`SFPARSE_ERR_PARSE` indicates fatal parse error has + * occurred, and it is not possible to continue the processing. + */ +#define SFPARSE_ERR_PARSE -1 + +/** + * @macro + * + * :macro:`SFPARSE_ERR_EOF` indicates that there is nothing left to + * read. The context of this error varies depending on the function + * that returns this error code. + */ +#define SFPARSE_ERR_EOF -2 + +/** + * @struct + * + * :type:`sfparse_vec` stores sequence of bytes. + */ +typedef struct sfparse_vec { + /** + * :member:`base` points to the beginning of the sequence of bytes. + */ + uint8_t *base; + /** + * :member:`len` is the number of bytes contained in this sequence. + */ + size_t len; +} sfparse_vec; + +/** + * @macro + * + * :macro:`SFPARSE_VALUE_FLAG_NONE` indicates no flag set. + */ +#define SFPARSE_VALUE_FLAG_NONE 0x0u + +/** + * @macro + * + * :macro:`SFPARSE_VALUE_FLAG_ESCAPED_STRING` indicates that a string + * contains escaped character(s). + */ +#define SFPARSE_VALUE_FLAG_ESCAPED_STRING 0x1u + +/** + * @struct + * + * :type:`sfparse_decimal` contains decimal value. + */ +typedef struct sfparse_decimal { + /** + * :member:`numer` contains numerator of the decimal value. + */ + int64_t numer; + /** + * :member:`denom` contains denominator of the decimal value. + */ + int64_t denom; +} sfparse_decimal; + +/** + * @struct + * + * :type:`sfparse_value` stores a Structured Field item. For Inner + * List, only type is set to + * :enum:`sfparse_type.SFPARSE_TYPE_INNER_LIST`. In order to read the + * items contained in an inner list, call `sfparse_parser_inner_list`. + */ +typedef struct sfparse_value { + /** + * :member:`type` is the type of the value contained in this + * particular object. + */ + sfparse_type type; + /** + * :member:`flags` is bitwise OR of one or more of + * :macro:`SFPARSE_VALUE_FLAG_* `. + */ + uint32_t flags; + /** + * @anonunion_start + * + * @sfparse_value_value + */ + union { + /** + * :member:`boolean` contains boolean value if :member:`type` == + * :enum:`sfparse_type.SFPARSE_TYPE_BOOLEAN`. 1 indicates true, + * and 0 indicates false. + */ + int boolean; + /** + * :member:`integer` contains integer value if :member:`type` is + * either :enum:`sfparse_type.SFPARSE_TYPE_INTEGER` or + * :enum:`sfparse_type.SFPARSE_TYPE_DATE`. + */ + int64_t integer; + /** + * :member:`decimal` contains decimal value if :member:`type` == + * :enum:`sfparse_type.SFPARSE_TYPE_DECIMAL`. + */ + sfparse_decimal decimal; + /** + * :member:`vec` contains sequence of bytes if :member:`type` is + * either :enum:`sfparse_type.SFPARSE_TYPE_STRING`, + * :enum:`sfparse_type.SFPARSE_TYPE_TOKEN`, + * :enum:`sfparse_type.SFPARSE_TYPE_BYTESEQ`, or + * :enum:`sfparse_type.SFPARSE_TYPE_DISPSTRING`. + * + * For :enum:`sfparse_type.SFPARSE_TYPE_STRING`, this field + * contains one or more escaped characters if :member:`flags` has + * :macro:`SFPARSE_VALUE_FLAG_ESCAPED_STRING` set. To unescape + * the string, use `sfparse_unescape`. + * + * For :enum:`sfparse_type.SFPARSE_TYPE_BYTESEQ`, this field + * contains base64 encoded string. To decode this byte string, + * use `sfparse_base64decode`. + * + * For :enum:`sfparse_type.SFPARSE_TYPE_DISPSTRING`, this field + * may contain percent-encoded UTF-8 byte sequences. To decode + * it, use `sfparse_pctdecode`. + * + * If :member:`vec.len ` == 0, :member:`vec.base + * ` is guaranteed to be NULL. + */ + sfparse_vec vec; + /** + * @anonunion_end + */ + }; +} sfparse_value; + +/** + * @struct + * + * :type:`sfparse_parser` is the Structured Field Values parser. Use + * `sfparse_parser_init` to initialize it. + */ +typedef struct sfparse_parser { + /* all fields are private */ + const uint8_t *pos; + const uint8_t *end; + uint32_t state; +} sfparse_parser; + +/** + * @function + * + * `sfparse_parser_init` initializes |sfp| with the given data encoded + * in Structured Field Values pointed by |data| of length |datalen|. + */ +void sfparse_parser_init(sfparse_parser *sfp, const uint8_t *data, + size_t datalen); + +/** + * @function + * + * `sfparse_parser_param` reads a parameter. If this function returns + * 0, it stores parameter key and value in |dest_key| and |dest_value| + * respectively, if they are not NULL. + * + * This function does no effort to find duplicated keys. Same key may + * be reported more than once. + * + * Caller should keep calling this function until it returns negative + * error code. If it returns :macro:`SFPARSE_ERR_EOF`, all parameters + * have read, and caller can continue to read rest of the values. If + * it returns :macro:`SFPARSE_ERR_PARSE`, it encountered fatal error + * while parsing field value. + */ +int sfparse_parser_param(sfparse_parser *sfp, sfparse_vec *dest_key, + sfparse_value *dest_value); + +/** + * @function + * + * `sfparse_parser_dict` reads the next dictionary key and value pair. + * If this function returns 0, it stores the key and value in + * |dest_key| and |dest_value| respectively, if they are not NULL. + * + * Caller can optionally read parameters attached to the pair by + * calling `sfparse_parser_param`. + * + * This function does no effort to find duplicated keys. Same key may + * be reported more than once. + * + * Caller should keep calling this function until it returns negative + * error code. If it returns :macro:`SFPARSE_ERR_EOF`, all key and + * value pairs have been read, and there is nothing left to read. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :macro:`SFPARSE_ERR_EOF` + * All values in the dictionary have read. + * :macro:`SFPARSE_ERR_PARSE` + * It encountered fatal error while parsing field value. + */ +int sfparse_parser_dict(sfparse_parser *sfp, sfparse_vec *dest_key, + sfparse_value *dest_value); + +/** + * @function + * + * `sfparse_parser_list` reads the next list item. If this function + * returns 0, it stores the item in |dest| if it is not NULL. + * + * Caller can optionally read parameters attached to the item by + * calling `sfparse_parser_param`. + * + * Caller should keep calling this function until it returns negative + * error code. If it returns :macro:`SFPARSE_ERR_EOF`, all values in + * the list have been read, and there is nothing left to read. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :macro:`SFPARSE_ERR_EOF` + * All values in the list have read. + * :macro:`SFPARSE_ERR_PARSE` + * It encountered fatal error while parsing field value. + */ +int sfparse_parser_list(sfparse_parser *sfp, sfparse_value *dest); + +/** + * @function + * + * `sfparse_parser_item` reads a single item. If this function + * returns 0, it stores the item in |dest| if it is not NULL. + * + * This function is only used for the field value that consists of a + * single item. + * + * Caller can optionally read parameters attached to the item by + * calling `sfparse_parser_param`. + * + * Caller should call this function again to make sure that there is + * nothing left to read. If this 2nd function call returns + * :macro:`SFPARSE_ERR_EOF`, all data have been processed + * successfully. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :macro:`SFPARSE_ERR_EOF` + * There is nothing left to read. + * :macro:`SFPARSE_ERR_PARSE` + * It encountered fatal error while parsing field value. + */ +int sfparse_parser_item(sfparse_parser *sfp, sfparse_value *dest); + +/** + * @function + * + * `sfparse_parser_inner_list` reads the next inner list item. If + * this function returns 0, it stores the item in |dest| if it is not + * NULL. + * + * Caller can optionally read parameters attached to the item by + * calling `sfparse_parser_param`. + * + * Caller should keep calling this function until it returns negative + * error code. If it returns :macro:`SFPARSE_ERR_EOF`, all values in + * this inner list have been read, and caller can optionally read + * parameters attached to this inner list by calling + * `sfparse_parser_param`. Then caller can continue to read rest of + * the values. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :macro:`SFPARSE_ERR_EOF` + * All values in the inner list have read. + * :macro:`SFPARSE_ERR_PARSE` + * It encountered fatal error while parsing field value. + */ +int sfparse_parser_inner_list(sfparse_parser *sfp, sfparse_value *dest); + +/** + * @function + * + * `sfparse_unescape` copies |src| to |dest| by removing escapes + * (``\``). |src| should be the pointer to + * :member:`sfparse_value.vec` of type + * :enum:`sfparse_type.SFPARSE_TYPE_STRING` produced by either + * `sfparse_parser_dict`, `sfparse_parser_list`, + * `sfparse_parser_inner_list`, `sfparse_parser_item`, or + * `sfparse_parser_param`, otherwise the behavior is undefined. + * + * :member:`dest->base ` must point to the buffer + * that has sufficient space to store the unescaped string. The + * memory areas pointed by :member:`dest->base ` and + * :member:`src->base ` must not overlap. + * + * This function sets the length of unescaped string to + * :member:`dest->len `. + */ +void sfparse_unescape(sfparse_vec *dest, const sfparse_vec *src); + +/** + * @function + * + * `sfparse_base64decode` decodes Base64 encoded string |src| and + * writes the result into |dest|. |src| should be the pointer to + * :member:`sfparse_value.vec` of type + * :enum:`sfparse_type.SFPARSE_TYPE_BYTESEQ` produced by either + * `sfparse_parser_dict`, `sfparse_parser_list`, + * `sfparse_parser_inner_list`, `sfparse_parser_item`, or + * `sfparse_parser_param`, otherwise the behavior is undefined. + * + * :member:`dest->base ` must point to the buffer + * that has sufficient space to store the decoded byte string. + * + * This function sets the length of decoded byte string to + * :member:`dest->len `. + */ +void sfparse_base64decode(sfparse_vec *dest, const sfparse_vec *src); + +/** + * @function + * + * `sfparse_pctdecode` decodes percent-encoded string |src| and writes + * the result into |dest|. |src| should be the pointer to + * :member:`sfparse_value.vec` of type + * :enum:`sfparse_type.SFPARSE_TYPE_DISPSTRING` produced by either + * `sfparse_parser_dict`, `sfparse_parser_list`, + * `sfparse_parser_inner_list`, `sfparse_parser_item`, or + * `sfparse_parser_param`, otherwise the behavior is undefined. + * + * :member:`dest->base ` must point to the buffer + * that has sufficient space to store the decoded byte string. The + * memory areas pointed by :member:`dest->base ` and + * :member:`src->base ` must not overlap. + * + * This function sets the length of decoded byte string to + * :member:`dest->len `. + */ +void sfparse_pctdecode(sfparse_vec *dest, const sfparse_vec *src); + +#ifdef __cplusplus +} +#endif /* defined(__cplusplus) */ + +#endif /* !defined(SFPARSE_H) */ diff --git a/lib/nghttp2/lib/version.rc.in b/lib/nghttp2-1.65.0/lib/version.rc.in similarity index 100% rename from lib/nghttp2/lib/version.rc.in rename to lib/nghttp2-1.65.0/lib/version.rc.in diff --git a/lib/nghttp2-1.65.0/ltmain.sh b/lib/nghttp2-1.65.0/ltmain.sh new file mode 100755 index 00000000000..977e5237bb0 --- /dev/null +++ b/lib/nghttp2-1.65.0/ltmain.sh @@ -0,0 +1,11436 @@ +#! /usr/bin/env sh +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in +## by inline-source v2019-02-19.15 + +# libtool (GNU libtool) 2.4.7 +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +PROGRAM=libtool +PACKAGE=libtool +VERSION="2.4.7 Debian-2.4.7-7build1" +package_revision=2.4.7 + + +## ------ ## +## Usage. ## +## ------ ## + +# Run './libtool --help' for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir. + +# Set a version string for this script. +scriptversion=2019-02-19.15; # UTC + +# General shell script boiler plate, and helper functions. +# Written by Gary V. Vaughan, 2004 + +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2004-2019, 2021 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 2 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. + +# Please report bugs or propose patches to: +# + + +## ------ ## +## Usage. ## +## ------ ## + +# Evaluate this file near the top of your script to gain access to +# the functions and variables defined here: +# +# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh +# +# If you need to override any of the default environment variable +# settings, do that before evaluating this file. + + +## -------------------- ## +## Shell normalisation. ## +## -------------------- ## + +# Some shells need a little help to be as Bourne compatible as possible. +# Before doing anything else, make sure all that help has been provided! + +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac +fi + +# NLS nuisances: We save the old values in case they are required later. +_G_user_locale= +_G_safe_locale= +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test set = \"\${$_G_var+set}\"; then + save_$_G_var=\$$_G_var + $_G_var=C + export $_G_var + _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" + _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" + fi" +done +# These NLS vars are set unconditionally (bootstrap issue #24). Unset those +# in case the environment reset is needed later and the $save_* variant is not +# defined (see the code above). +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +# Make sure IFS has a sensible default +sp=' ' +nl=' +' +IFS="$sp $nl" + +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# func_unset VAR +# -------------- +# Portably unset VAR. +# In some shells, an 'unset VAR' statement leaves a non-zero return +# status if VAR is already unset, which might be problematic if the +# statement is used at the end of a function (thus poisoning its return +# value) or when 'set -e' is active (causing even a spurious abort of +# the script in this case). +func_unset () +{ + { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } +} + + +# Make sure CDPATH doesn't cause `cd` commands to output the target dir. +func_unset CDPATH + +# Make sure ${,E,F}GREP behave sanely. +func_unset GREP_OPTIONS + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" + GREP=$func_path_progs_result +} + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase variable names are used for environment variables. These +# variables can be overridden by the user before calling a script that +# uses them if a suitable command of that name is not already available +# in the command search PATH. + +: ${CP="cp -f"} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} + + +## -------------------- ## +## Useful sed snippets. ## +## -------------------- ## + +sed_dirname='s|/[^/]*$||' +sed_basename='s|^.*/||' + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s|\([`"$\\]\)|\\\1|g' + +# Same as above, but do not quote variable references. +sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' + +# Sed substitution that converts a w32 file name or path +# that contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-'\' parameter expansions in output of sed_double_quote_subst that +# were '\'-ed in input to the same. If an odd number of '\' preceded a +# '$' in input to sed_double_quote_subst, that '$' was protected from +# expansion. Since each input '\' is now two '\'s, look for any number +# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. +_G_bs='\\' +_G_bs2='\\\\' +_G_bs4='\\\\\\\\' +_G_dollar='\$' +sed_double_backslash="\ + s/$_G_bs4/&\\ +/g + s/^$_G_bs2$_G_dollar/$_G_bs&/ + s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g + s/\n//g" + +# require_check_ifs_backslash +# --------------------------- +# Check if we can use backslash as IFS='\' separator, and set +# $check_ifs_backshlash_broken to ':' or 'false'. +require_check_ifs_backslash=func_require_check_ifs_backslash +func_require_check_ifs_backslash () +{ + _G_save_IFS=$IFS + IFS='\' + _G_check_ifs_backshlash='a\\b' + for _G_i in $_G_check_ifs_backshlash + do + case $_G_i in + a) + check_ifs_backshlash_broken=false + ;; + '') + break + ;; + *) + check_ifs_backshlash_broken=: + break + ;; + esac + done + IFS=$_G_save_IFS + require_check_ifs_backslash=: +} + + +## ----------------- ## +## Global variables. ## +## ----------------- ## + +# Except for the global variables explicitly listed below, the following +# functions in the '^func_' namespace, and the '^require_' namespace +# variables initialised in the 'Resource management' section, sourcing +# this file will not pollute your global namespace with anything +# else. There's no portable way to scope variables in Bourne shell +# though, so actually running these functions will sometimes place +# results into a variable named after the function, and often use +# temporary variables in the '^_G_' namespace. If you are careful to +# avoid using those namespaces casually in your sourcing script, things +# should continue to work as you expect. And, of course, you can freely +# overwrite any of the functions or variables defined here before +# calling anything to customize them. + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +# Allow overriding, eg assuming that you follow the convention of +# putting '$debug_cmd' at the start of all your functions, you can get +# bash to show function call trace with: +# +# debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +debug_cmd=${debug_cmd-":"} +exit_cmd=: + +# By convention, finish your script with: +# +# exit $exit_status +# +# so that you can set exit_status to non-zero if you want to indicate +# something went wrong during execution without actually bailing out at +# the point of failure. +exit_status=$EXIT_SUCCESS + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath=$0 + +# The name of this program. +progname=`$ECHO "$progpath" |$SED "$sed_basename"` + +# Make sure we have an absolute progpath for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` + progdir=`cd "$progdir" && pwd` + progpath=$progdir/$progname + ;; + *) + _G_IFS=$IFS + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS=$_G_IFS + test -x "$progdir/$progname" && break + done + IFS=$_G_IFS + test -n "$progdir" || progdir=`pwd` + progpath=$progdir/$progname + ;; +esac + + +## ----------------- ## +## Standard options. ## +## ----------------- ## + +# The following options affect the operation of the functions defined +# below, and should be set appropriately depending on run-time para- +# meters passed on the command line. + +opt_dry_run=false +opt_quiet=false +opt_verbose=false + +# Categories 'all' and 'none' are always available. Append any others +# you will pass as the first argument to func_warning from your own +# code. +warning_categories= + +# By default, display warnings according to 'opt_warning_types'. Set +# 'warning_func' to ':' to elide all warnings, or func_fatal_error to +# treat the next displayed warning as a fatal error. +warning_func=func_warn_and_continue + +# Set to 'all' to display all warnings, 'none' to suppress all +# warnings, or a space delimited list of some subset of +# 'warning_categories' to display only the listed warnings. +opt_warning_types=all + + +## -------------------- ## +## Resource management. ## +## -------------------- ## + +# This section contains definitions for functions that each ensure a +# particular resource (a file, or a non-empty configuration variable for +# example) is available, and if appropriate to extract default values +# from pertinent package files. Call them using their associated +# 'require_*' variable to ensure that they are executed, at most, once. +# +# It's entirely deliberate that calling these functions can set +# variables that don't obey the namespace limitations obeyed by the rest +# of this file, in order that that they be as useful as possible to +# callers. + + +# require_term_colors +# ------------------- +# Allow display of bold text on terminals that support it. +require_term_colors=func_require_term_colors +func_require_term_colors () +{ + $debug_cmd + + test -t 1 && { + # COLORTERM and USE_ANSI_COLORS environment variables take + # precedence, because most terminfo databases neglect to describe + # whether color sequences are supported. + test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} + + if test 1 = "$USE_ANSI_COLORS"; then + # Standard ANSI escape sequences + tc_reset='' + tc_bold=''; tc_standout='' + tc_red=''; tc_green='' + tc_blue=''; tc_cyan='' + else + # Otherwise trust the terminfo database after all. + test -n "`tput sgr0 2>/dev/null`" && { + tc_reset=`tput sgr0` + test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` + tc_standout=$tc_bold + test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` + test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` + test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` + test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` + test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` + } + fi + } + + require_term_colors=: +} + + +## ----------------- ## +## Function library. ## +## ----------------- ## + +# This section contains a variety of useful functions to call in your +# scripts. Take note of the portable wrappers for features provided by +# some modern shells, which will fall back to slower equivalents on +# less featureful shells. + + +# func_append VAR VALUE +# --------------------- +# Append VALUE onto the existing contents of VAR. + + # _G_HAVE_PLUSEQ_OP + # Can be empty, in which case the shell is probed, "yes" if += is + # useable or anything else if it does not work. + if test -z "$_G_HAVE_PLUSEQ_OP" && \ + __PLUSEQ_TEST="a" && \ + __PLUSEQ_TEST+=" b" 2>/dev/null && \ + test "a b" = "$__PLUSEQ_TEST"; then + _G_HAVE_PLUSEQ_OP=yes + fi + +if test yes = "$_G_HAVE_PLUSEQ_OP" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_append () + { + $debug_cmd + + eval "$1+=\$2" + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_append () + { + $debug_cmd + + eval "$1=\$$1\$2" + } +fi + + +# func_append_quoted VAR VALUE +# ---------------------------- +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +if test yes = "$_G_HAVE_PLUSEQ_OP"; then + eval 'func_append_quoted () + { + $debug_cmd + + func_quote_arg pretty "$2" + eval "$1+=\\ \$func_quote_arg_result" + }' +else + func_append_quoted () + { + $debug_cmd + + func_quote_arg pretty "$2" + eval "$1=\$$1\\ \$func_quote_arg_result" + } +fi + + +# func_append_uniq VAR VALUE +# -------------------------- +# Append unique VALUE onto the existing contents of VAR, assuming +# entries are delimited by the first character of VALUE. For example: +# +# func_append_uniq options " --another-option option-argument" +# +# will only append to $options if " --another-option option-argument " +# is not already present somewhere in $options already (note spaces at +# each end implied by leading space in second argument). +func_append_uniq () +{ + $debug_cmd + + eval _G_current_value='`$ECHO $'$1'`' + _G_delim=`expr "$2" : '\(.\)'` + + case $_G_delim$_G_current_value$_G_delim in + *"$2$_G_delim"*) ;; + *) func_append "$@" ;; + esac +} + + +# func_arith TERM... +# ------------------ +# Set func_arith_result to the result of evaluating TERMs. + test -z "$_G_HAVE_ARITH_OP" \ + && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ + && _G_HAVE_ARITH_OP=yes + +if test yes = "$_G_HAVE_ARITH_OP"; then + eval 'func_arith () + { + $debug_cmd + + func_arith_result=$(( $* )) + }' +else + func_arith () + { + $debug_cmd + + func_arith_result=`expr "$@"` + } +fi + + +# func_basename FILE +# ------------------ +# Set func_basename_result to FILE with everything up to and including +# the last / stripped. +if test yes = "$_G_HAVE_XSI_OPS"; then + # If this shell supports suffix pattern removal, then use it to avoid + # forking. Hide the definitions single quotes in case the shell chokes + # on unsupported syntax... + _b='func_basename_result=${1##*/}' + _d='case $1 in + */*) func_dirname_result=${1%/*}$2 ;; + * ) func_dirname_result=$3 ;; + esac' + +else + # ...otherwise fall back to using sed. + _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' + _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` + if test "X$func_dirname_result" = "X$1"; then + func_dirname_result=$3 + else + func_append func_dirname_result "$2" + fi' +fi + +eval 'func_basename () +{ + $debug_cmd + + '"$_b"' +}' + + +# func_dirname FILE APPEND NONDIR_REPLACEMENT +# ------------------------------------------- +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +eval 'func_dirname () +{ + $debug_cmd + + '"$_d"' +}' + + +# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT +# -------------------------------------------------------- +# Perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# For efficiency, we do not delegate to the functions above but instead +# duplicate the functionality here. +eval 'func_dirname_and_basename () +{ + $debug_cmd + + '"$_b"' + '"$_d"' +}' + + +# func_echo ARG... +# ---------------- +# Echo program name prefixed message. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_echo_all ARG... +# -------------------- +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + + +# func_echo_infix_1 INFIX ARG... +# ------------------------------ +# Echo program name, followed by INFIX on the first line, with any +# additional lines not showing INFIX. +func_echo_infix_1 () +{ + $debug_cmd + + $require_term_colors + + _G_infix=$1; shift + _G_indent=$_G_infix + _G_prefix="$progname: $_G_infix: " + _G_message=$* + + # Strip color escape sequences before counting printable length + for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" + do + test -n "$_G_tc" && { + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` + } + done + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + + func_echo_infix_1_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_infix_1_IFS + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + _G_prefix=$_G_indent + done + IFS=$func_echo_infix_1_IFS +} + + +# func_error ARG... +# ----------------- +# Echo program name prefixed message to standard error. +func_error () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 +} + + +# func_fatal_error ARG... +# ----------------------- +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + $debug_cmd + + func_error "$*" + exit $EXIT_FAILURE +} + + +# func_grep EXPRESSION FILENAME +# ----------------------------- +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $debug_cmd + + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_len STRING +# --------------- +# Set func_len_result to the length of STRING. STRING may not +# start with a hyphen. + test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_len () + { + $debug_cmd + + func_len_result=${#1} + }' +else + func_len () + { + $debug_cmd + + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` + } +fi + + +# func_mkdir_p DIRECTORY-PATH +# --------------------------- +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + $debug_cmd + + _G_directory_path=$1 + _G_dir_list= + + if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then + + # Protect directory names starting with '-' + case $_G_directory_path in + -*) _G_directory_path=./$_G_directory_path ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$_G_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + _G_dir_list=$_G_directory_path:$_G_dir_list + + # If the last portion added has no slash in it, the list is done + case $_G_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` + done + _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` + + func_mkdir_p_IFS=$IFS; IFS=: + for _G_dir in $_G_dir_list; do + IFS=$func_mkdir_p_IFS + # mkdir can fail with a 'File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$_G_dir" 2>/dev/null || : + done + IFS=$func_mkdir_p_IFS + + # Bail out if we (or some other process) failed to create a directory. + test -d "$_G_directory_path" || \ + func_fatal_error "Failed to create '$1'" + fi +} + + +# func_mktempdir [BASENAME] +# ------------------------- +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, BASENAME is the basename for that directory. +func_mktempdir () +{ + $debug_cmd + + _G_template=${TMPDIR-/tmp}/${1-$progname} + + if test : = "$opt_dry_run"; then + # Return a directory name, but don't create it in dry-run mode + _G_tmpdir=$_G_template-$$ + else + + # If mktemp works, use that first and foremost + _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` + + if test ! -d "$_G_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + _G_tmpdir=$_G_template-${RANDOM-0}$$ + + func_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$_G_tmpdir" + umask $func_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$_G_tmpdir" || \ + func_fatal_error "cannot create temporary directory '$_G_tmpdir'" + fi + + $ECHO "$_G_tmpdir" +} + + +# func_normal_abspath PATH +# ------------------------ +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +func_normal_abspath () +{ + $debug_cmd + + # These SED scripts presuppose an absolute path with a trailing slash. + _G_pathcar='s|^/\([^/]*\).*$|\1|' + _G_pathcdr='s|^/[^/]*||' + _G_removedotparts=':dotsl + s|/\./|/|g + t dotsl + s|/\.$|/|' + _G_collapseslashes='s|/\{1,\}|/|g' + _G_finalslash='s|/*$|/|' + + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` + while :; do + # Processed it all yet? + if test / = "$func_normal_abspath_tpath"; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result"; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + + +# func_notquiet ARG... +# -------------------- +# Echo program name prefixed message only when not in quiet mode. +func_notquiet () +{ + $debug_cmd + + $opt_quiet || func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + + +# func_relative_path SRCDIR DSTDIR +# -------------------------------- +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. +func_relative_path () +{ + $debug_cmd + + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=$func_dirname_result + if test -z "$func_relative_path_tlibdir"; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test -n "$func_stripname_result"; then + func_append func_relative_path_result "/$func_stripname_result" + fi + + # Normalisation. If bindir is libdir, return '.' else relative path. + if test -n "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + fi + + test -n "$func_relative_path_result" || func_relative_path_result=. + + : +} + + +# func_quote_portable EVAL ARG +# ---------------------------- +# Internal function to portably implement func_quote_arg. Note that we still +# keep attention to performance here so we as much as possible try to avoid +# calling sed binary (so far O(N) complexity as long as func_append is O(1)). +func_quote_portable () +{ + $debug_cmd + + $require_check_ifs_backslash + + func_quote_portable_result=$2 + + # one-time-loop (easy break) + while true + do + if $1; then + func_quote_portable_result=`$ECHO "$2" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` + break + fi + + # Quote for eval. + case $func_quote_portable_result in + *[\\\`\"\$]*) + # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string + # contains the shell wildcard characters. + case $check_ifs_backshlash_broken$func_quote_portable_result in + :*|*[\[\*\?]*) + func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ + | $SED "$sed_quote_subst"` + break + ;; + esac + + func_quote_portable_old_IFS=$IFS + for _G_char in '\' '`' '"' '$' + do + # STATE($1) PREV($2) SEPARATOR($3) + set start "" "" + func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy + IFS=$_G_char + for _G_part in $func_quote_portable_result + do + case $1 in + quote) + func_append func_quote_portable_result "$3$2" + set quote "$_G_part" "\\$_G_char" + ;; + start) + set first "" "" + func_quote_portable_result= + ;; + first) + set quote "$_G_part" "" + ;; + esac + done + done + IFS=$func_quote_portable_old_IFS + ;; + *) ;; + esac + break + done + + func_quote_portable_unquoted_result=$func_quote_portable_result + case $func_quote_portable_result in + # double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # many bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_portable_result=\"$func_quote_portable_result\" + ;; + esac +} + + +# func_quotefast_eval ARG +# ----------------------- +# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', +# but optimized for speed. Result is stored in $func_quotefast_eval. +if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then + printf -v _GL_test_printf_tilde %q '~' + if test '\~' = "$_GL_test_printf_tilde"; then + func_quotefast_eval () + { + printf -v func_quotefast_eval_result %q "$1" + } + else + # Broken older Bash implementations. Make those faster too if possible. + func_quotefast_eval () + { + case $1 in + '~'*) + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + ;; + *) + printf -v func_quotefast_eval_result %q "$1" + ;; + esac + } + fi +else + func_quotefast_eval () + { + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + } +fi + + +# func_quote_arg MODEs ARG +# ------------------------ +# Quote one ARG to be evaled later. MODEs argument may contain zero or more +# specifiers listed below separated by ',' character. This function returns two +# values: +# i) func_quote_arg_result +# double-quoted (when needed), suitable for a subsequent eval +# ii) func_quote_arg_unquoted_result +# has all characters that are still active within double +# quotes backslashified. Available only if 'unquoted' is specified. +# +# Available modes: +# ---------------- +# 'eval' (default) +# - escape shell special characters +# 'expand' +# - the same as 'eval'; but do not quote variable references +# 'pretty' +# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might +# be used later in func_quote to get output like: 'echo "a b"' instead +# of 'echo a\ b'. This is slower than default on some shells. +# 'unquoted' +# - produce also $func_quote_arg_unquoted_result which does not contain +# wrapping double-quotes. +# +# Examples for 'func_quote_arg pretty,unquoted string': +# +# string | *_result | *_unquoted_result +# ------------+-----------------------+------------------- +# " | \" | \" +# a b | "a b" | a b +# "a b" | "\"a b\"" | \"a b\" +# * | "*" | * +# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" +# +# Examples for 'func_quote_arg pretty,unquoted,expand string': +# +# string | *_result | *_unquoted_result +# --------------+---------------------+-------------------- +# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" +func_quote_arg () +{ + _G_quote_expand=false + case ,$1, in + *,expand,*) + _G_quote_expand=: + ;; + esac + + case ,$1, in + *,pretty,*|*,expand,*|*,unquoted,*) + func_quote_portable $_G_quote_expand "$2" + func_quote_arg_result=$func_quote_portable_result + func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result + ;; + *) + # Faster quote-for-eval for some shells. + func_quotefast_eval "$2" + func_quote_arg_result=$func_quotefast_eval_result + ;; + esac +} + + +# func_quote MODEs ARGs... +# ------------------------ +# Quote all ARGs to be evaled later and join them into single command. See +# func_quote_arg's description for more info. +func_quote () +{ + $debug_cmd + _G_func_quote_mode=$1 ; shift + func_quote_result= + while test 0 -lt $#; do + func_quote_arg "$_G_func_quote_mode" "$1" + if test -n "$func_quote_result"; then + func_append func_quote_result " $func_quote_arg_result" + else + func_append func_quote_result "$func_quote_arg_result" + fi + shift + done +} + + +# func_stripname PREFIX SUFFIX NAME +# --------------------------------- +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_stripname () + { + $debug_cmd + + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary variable first. + func_stripname_result=$3 + func_stripname_result=${func_stripname_result#"$1"} + func_stripname_result=${func_stripname_result%"$2"} + }' +else + func_stripname () + { + $debug_cmd + + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; + esac + } +fi + + +# func_show_eval CMD [FAIL_EXP] +# ----------------------------- +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + func_quote_arg pretty,expand "$_G_cmd" + eval "func_notquiet $func_quote_arg_result" + + $opt_dry_run || { + eval "$_G_cmd" + _G_status=$? + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_show_eval_locale CMD [FAIL_EXP] +# ------------------------------------ +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + $opt_quiet || { + func_quote_arg expand,pretty "$_G_cmd" + eval "func_echo $func_quote_arg_result" + } + + $opt_dry_run || { + eval "$_G_user_locale + $_G_cmd" + _G_status=$? + eval "$_G_safe_locale" + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_tr_sh +# ---------- +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + $debug_cmd + + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_verbose ARG... +# ------------------- +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $debug_cmd + + $opt_verbose && func_echo "$*" + + : +} + + +# func_warn_and_continue ARG... +# ----------------------------- +# Echo program name prefixed warning message to standard error. +func_warn_and_continue () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 +} + + +# func_warning CATEGORY ARG... +# ---------------------------- +# Echo program name prefixed warning message to standard error. Warning +# messages can be filtered according to CATEGORY, where this function +# elides messages where CATEGORY is not listed in the global variable +# 'opt_warning_types'. +func_warning () +{ + $debug_cmd + + # CATEGORY must be in the warning_categories list! + case " $warning_categories " in + *" $1 "*) ;; + *) func_internal_error "invalid warning category '$1'" ;; + esac + + _G_category=$1 + shift + + case " $opt_warning_types " in + *" $_G_category "*) $warning_func ${1+"$@"} ;; + esac +} + + +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: +#! /bin/sh + +# A portable, pluggable option parser for Bourne shell. +# Written by Gary V. Vaughan, 2010 + +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2010-2019, 2021 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 2 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. + +# Please report bugs or propose patches to: +# + +# Set a version string for this script. +scriptversion=2019-02-19.15; # UTC + + +## ------ ## +## Usage. ## +## ------ ## + +# This file is a library for parsing options in your shell scripts along +# with assorted other useful supporting features that you can make use +# of too. +# +# For the simplest scripts you might need only: +# +# #!/bin/sh +# . relative/path/to/funclib.sh +# . relative/path/to/options-parser +# scriptversion=1.0 +# func_options ${1+"$@"} +# eval set dummy "$func_options_result"; shift +# ...rest of your script... +# +# In order for the '--version' option to work, you will need to have a +# suitably formatted comment like the one at the top of this file +# starting with '# Written by ' and ending with '# Copyright'. +# +# For '-h' and '--help' to work, you will also need a one line +# description of your script's purpose in a comment directly above the +# '# Written by ' line, like the one at the top of this file. +# +# The default options also support '--debug', which will turn on shell +# execution tracing (see the comment above debug_cmd below for another +# use), and '--verbose' and the func_verbose function to allow your script +# to display verbose messages only when your user has specified +# '--verbose'. +# +# After sourcing this file, you can plug in processing for additional +# options by amending the variables from the 'Configuration' section +# below, and following the instructions in the 'Option parsing' +# section further down. + +## -------------- ## +## Configuration. ## +## -------------- ## + +# You should override these variables in your script after sourcing this +# file so that they reflect the customisations you have added to the +# option parser. + +# The usage line for option parsing errors and the start of '-h' and +# '--help' output messages. You can embed shell variables for delayed +# expansion at the time the message is displayed, but you will need to +# quote other shell meta-characters carefully to prevent them being +# expanded when the contents are evaled. +usage='$progpath [OPTION]...' + +# Short help message in response to '-h' and '--help'. Add to this or +# override it after sourcing this library to reflect the full set of +# options your script accepts. +usage_message="\ + --debug enable verbose shell tracing + -W, --warnings=CATEGORY + report the warnings falling in CATEGORY [all] + -v, --verbose verbosely report processing + --version print version information and exit + -h, --help print short or long help message and exit +" + +# Additional text appended to 'usage_message' in response to '--help'. +long_help_message=" +Warning categories include: + 'all' show all warnings + 'none' turn off all the warnings + 'error' warnings are treated as fatal errors" + +# Help message printed before fatal option parsing errors. +fatal_help="Try '\$progname --help' for more information." + + + +## ------------------------- ## +## Hook function management. ## +## ------------------------- ## + +# This section contains functions for adding, removing, and running hooks +# in the main code. A hook is just a list of function names that can be +# run in order later on. + +# func_hookable FUNC_NAME +# ----------------------- +# Declare that FUNC_NAME will run hooks added with +# 'func_add_hook FUNC_NAME ...'. +func_hookable () +{ + $debug_cmd + + func_append hookable_fns " $1" +} + + +# func_add_hook FUNC_NAME HOOK_FUNC +# --------------------------------- +# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must +# first have been declared "hookable" by a call to 'func_hookable'. +func_add_hook () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not accept hook functions." ;; + esac + + eval func_append ${1}_hooks '" $2"' +} + + +# func_remove_hook FUNC_NAME HOOK_FUNC +# ------------------------------------ +# Remove HOOK_FUNC from the list of hook functions to be called by +# FUNC_NAME. +func_remove_hook () +{ + $debug_cmd + + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' +} + + +# func_propagate_result FUNC_NAME_A FUNC_NAME_B +# --------------------------------------------- +# If the *_result variable of FUNC_NAME_A _is set_, assign its value to +# *_result variable of FUNC_NAME_B. +func_propagate_result () +{ + $debug_cmd + + func_propagate_result_result=: + if eval "test \"\${${1}_result+set}\" = set" + then + eval "${2}_result=\$${1}_result" + else + func_propagate_result_result=false + fi +} + + +# func_run_hooks FUNC_NAME [ARG]... +# --------------------------------- +# Run all hook functions registered to FUNC_NAME. +# It's assumed that the list of hook functions contains nothing more +# than a whitespace-delimited list of legal shell function names, and +# no effort is wasted trying to catch shell meta-characters or preserve +# whitespace. +func_run_hooks () +{ + $debug_cmd + + _G_rc_run_hooks=false + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not support hook functions." ;; + esac + + eval _G_hook_fns=\$$1_hooks; shift + + for _G_hook in $_G_hook_fns; do + func_unset "${_G_hook}_result" + eval $_G_hook '${1+"$@"}' + func_propagate_result $_G_hook func_run_hooks + if $func_propagate_result_result; then + eval set dummy "$func_run_hooks_result"; shift + fi + done +} + + + +## --------------- ## +## Option parsing. ## +## --------------- ## + +# In order to add your own option parsing hooks, you must accept the +# full positional parameter list from your hook function. You may remove +# or edit any options that you action, and then pass back the remaining +# unprocessed options in '_result', escaped +# suitably for 'eval'. +# +# The '_result' variable is automatically unset +# before your hook gets called; for best performance, only set the +# *_result variable when necessary (i.e. don't call the 'func_quote' +# function unnecessarily because it can be an expensive operation on some +# machines). +# +# Like this: +# +# my_options_prep () +# { +# $debug_cmd +# +# # Extend the existing usage message. +# usage_message=$usage_message' +# -s, --silent don'\''t print informational messages +# ' +# # No change in '$@' (ignored completely by this hook). Leave +# # my_options_prep_result variable intact. +# } +# func_add_hook func_options_prep my_options_prep +# +# +# my_silent_option () +# { +# $debug_cmd +# +# args_changed=false +# +# # Note that, for efficiency, we parse as many options as we can +# # recognise in a loop before passing the remainder back to the +# # caller on the first unrecognised argument we encounter. +# while test $# -gt 0; do +# opt=$1; shift +# case $opt in +# --silent|-s) opt_silent=: +# args_changed=: +# ;; +# # Separate non-argument short options: +# -s*) func_split_short_opt "$_G_opt" +# set dummy "$func_split_short_opt_name" \ +# "-$func_split_short_opt_arg" ${1+"$@"} +# shift +# args_changed=: +# ;; +# *) # Make sure the first unrecognised option "$_G_opt" +# # is added back to "$@" in case we need it later, +# # if $args_changed was set to 'true'. +# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; +# esac +# done +# +# # Only call 'func_quote' here if we processed at least one argument. +# if $args_changed; then +# func_quote eval ${1+"$@"} +# my_silent_option_result=$func_quote_result +# fi +# } +# func_add_hook func_parse_options my_silent_option +# +# +# my_option_validation () +# { +# $debug_cmd +# +# $opt_silent && $opt_verbose && func_fatal_help "\ +# '--silent' and '--verbose' options are mutually exclusive." +# } +# func_add_hook func_validate_options my_option_validation +# +# You'll also need to manually amend $usage_message to reflect the extra +# options you parse. It's preferable to append if you can, so that +# multiple option parsing hooks can be added safely. + + +# func_options_finish [ARG]... +# ---------------------------- +# Finishing the option parse loop (call 'func_options' hooks ATM). +func_options_finish () +{ + $debug_cmd + + func_run_hooks func_options ${1+"$@"} + func_propagate_result func_run_hooks func_options_finish +} + + +# func_options [ARG]... +# --------------------- +# All the functions called inside func_options are hookable. See the +# individual implementations for details. +func_hookable func_options +func_options () +{ + $debug_cmd + + _G_options_quoted=false + + for my_func in options_prep parse_options validate_options options_finish + do + func_unset func_${my_func}_result + func_unset func_run_hooks_result + eval func_$my_func '${1+"$@"}' + func_propagate_result func_$my_func func_options + if $func_propagate_result_result; then + eval set dummy "$func_options_result"; shift + _G_options_quoted=: + fi + done + + $_G_options_quoted || { + # As we (func_options) are top-level options-parser function and + # nobody quoted "$@" for us yet, we need to do it explicitly for + # caller. + func_quote eval ${1+"$@"} + func_options_result=$func_quote_result + } +} + + +# func_options_prep [ARG]... +# -------------------------- +# All initialisations required before starting the option parse loop. +# Note that when calling hook functions, we pass through the list of +# positional parameters. If a hook function modifies that list, and +# needs to propagate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before returning. +func_hookable func_options_prep +func_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_verbose=false + opt_warning_types= + + func_run_hooks func_options_prep ${1+"$@"} + func_propagate_result func_run_hooks func_options_prep +} + + +# func_parse_options [ARG]... +# --------------------------- +# The main option parsing loop. +func_hookable func_parse_options +func_parse_options () +{ + $debug_cmd + + _G_parse_options_requote=false + # this just eases exit handling + while test $# -gt 0; do + # Defer to hook functions for initial option parsing, so they + # get priority in the event of reusing an option name. + func_run_hooks func_parse_options ${1+"$@"} + func_propagate_result func_run_hooks func_parse_options + if $func_propagate_result_result; then + eval set dummy "$func_parse_options_result"; shift + # Even though we may have changed "$@", we passed the "$@" array + # down into the hook and it quoted it for us (because we are in + # this if-branch). No need to quote it again. + _G_parse_options_requote=false + fi + + # Break out of the loop if we already parsed every option. + test $# -gt 0 || break + + # We expect that one of the options parsed in this function matches + # and thus we remove _G_opt from "$@" and need to re-quote. + _G_match_parse_options=: + _G_opt=$1 + shift + case $_G_opt in + --debug|-x) debug_cmd='set -x' + func_echo "enabling shell trace mode" >&2 + $debug_cmd + ;; + + --no-warnings|--no-warning|--no-warn) + set dummy --warnings none ${1+"$@"} + shift + ;; + + --warnings|--warning|-W) + if test $# = 0 && func_missing_arg $_G_opt; then + _G_parse_options_requote=: + break + fi + case " $warning_categories $1" in + *" $1 "*) + # trailing space prevents matching last $1 above + func_append_uniq opt_warning_types " $1" + ;; + *all) + opt_warning_types=$warning_categories + ;; + *none) + opt_warning_types=none + warning_func=: + ;; + *error) + opt_warning_types=$warning_categories + warning_func=func_fatal_error + ;; + *) + func_fatal_error \ + "unsupported warning category: '$1'" + ;; + esac + shift + ;; + + --verbose|-v) opt_verbose=: ;; + --version) func_version ;; + -\?|-h) func_usage ;; + --help) func_help ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + # Separate optargs to short options: + -W*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-v*|-x*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) _G_parse_options_requote=: ; break ;; + -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift + _G_match_parse_options=false + break + ;; + esac + + if $_G_match_parse_options; then + _G_parse_options_requote=: + fi + done + + if $_G_parse_options_requote; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + func_parse_options_result=$func_quote_result + fi +} + + +# func_validate_options [ARG]... +# ------------------------------ +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +func_hookable func_validate_options +func_validate_options () +{ + $debug_cmd + + # Display all warnings if -W was not given. + test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" + + func_run_hooks func_validate_options ${1+"$@"} + func_propagate_result func_run_hooks func_validate_options + + # Bail if the options were screwed! + $exit_cmd $EXIT_FAILURE +} + + + +## ----------------- ## +## Helper functions. ## +## ----------------- ## + +# This section contains the helper functions used by the rest of the +# hookable option parser framework in ascii-betical order. + + +# func_fatal_help ARG... +# ---------------------- +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + + +# func_help +# --------- +# Echo long help message to standard output and exit. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message" + exit 0 +} + + +# func_missing_arg ARGNAME +# ------------------------ +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $debug_cmd + + func_error "Missing argument for '$1'." + exit_cmd=exit +} + + +# func_split_equals STRING +# ------------------------ +# Set func_split_equals_lhs and func_split_equals_rhs shell variables +# after splitting STRING at the '=' sign. +test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=${1%%=*} + func_split_equals_rhs=${1#*=} + if test "x$func_split_equals_lhs" = "x$1"; then + func_split_equals_rhs= + fi + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` + func_split_equals_rhs= + test "x$func_split_equals_lhs=" = "x$1" \ + || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` + } +fi #func_split_equals + + +# func_split_short_opt SHORTOPT +# ----------------------------- +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"} + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'` + func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` + } +fi #func_split_short_opt + + +# func_usage +# ---------- +# Echo short help message to standard output and exit. +func_usage () +{ + $debug_cmd + + func_usage_message + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" + exit 0 +} + + +# func_usage_message +# ------------------ +# Echo short help message to standard output. +func_usage_message () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + echo + $SED -n 's|^# || + /^Written by/{ + x;p;x + } + h + /^Written by/q' < "$progpath" + echo + eval \$ECHO \""$usage_message"\" +} + + +# func_version +# ------------ +# Echo version message to standard output and exit. +# The version message is extracted from the calling file's header +# comments, with leading '# ' stripped: +# 1. First display the progname and version +# 2. Followed by the header comment line matching /^# Written by / +# 3. Then a blank line followed by the first following line matching +# /^# Copyright / +# 4. Immediately followed by any lines between the previous matches, +# except lines preceding the intervening completely blank line. +# For example, see the header comments of this file. +func_version () +{ + $debug_cmd + + printf '%s\n' "$progname $scriptversion" + $SED -n ' + /^# Written by /!b + s|^# ||; p; n + + :fwd2blnk + /./ { + n + b fwd2blnk + } + p; n + + :holdwrnt + s|^# || + s|^# *$|| + /^Copyright /!{ + /./H + n + b holdwrnt + } + + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + G + s|\(\n\)\n*|\1|g + p; q' < "$progpath" + + exit $? +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: + +# Set a version string. +scriptversion='(GNU libtool) 2.4.7' + + +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + $debug_cmd + + $warning_func ${1+"$@"} +} + + +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to '-h'. +usage_message="Options: + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --mode=MODE use operation mode MODE + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +" + +# Additional text appended to 'usage_message' in response to '--help'. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. When passed as first option, +'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. +Try '$progname --help --mode=MODE' for a more detailed description of MODE. + +When reporting a bug, please describe a test case to reproduce it and +include the following information: + + host-triplet: $host + shell: $SHELL + compiler: $LTCC + compiler flags: $LTCFLAGS + linker: $LD (gnu? $with_gnu_ld) + version: $progname $scriptversion Debian-2.4.7-7build1 + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to . +GNU libtool home page: . +General help using GNU software: ." + exit 0 +} + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_lo2o () + { + case $1 in + *.lo) func_lo2o_result=${1%.lo}.$objext ;; + * ) func_lo2o_result=$1 ;; + esac + }' + + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) + # suffix to a '.lo' libtool-object suffix. + eval 'func_xform () + { + func_xform_result=${1%.*}.lo + }' +else + # ...otherwise fall back to using sed. + func_lo2o () + { + func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` + } + + func_xform () + { + func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` + } +fi + + +# func_fatal_configuration ARG... +# ------------------------------- +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "Fatal configuration error." +} + + +# func_config +# ----------- +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + + +# func_features +# ------------- +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test yes = "$build_libtool_libs"; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test yes = "$build_old_libs"; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + + +# func_enable_tag TAGNAME +# ----------------------- +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname=$1 + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf=/$re_begincf/,/$re_endcf/p + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + + +# func_check_version_match +# ------------------------ +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode + + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false + + nonopt= + preserve_args= + + _G_rc_lt_options_prep=: + + _G_rc_lt_options_prep=: + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + *) + _G_rc_lt_options_prep=false + ;; + esac + + if $_G_rc_lt_options_prep; then + # Pass back the list of options. + func_quote eval ${1+"$@"} + libtool_options_prep_result=$func_quote_result + fi +} +func_add_hook func_options_prep libtool_options_prep + + +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd + + _G_rc_lt_parse_options=false + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_match_lt_parse_options=: + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; + + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"} ; shift + _G_match_lt_parse_options=false + break + ;; + esac + $_G_match_lt_parse_options && _G_rc_lt_parse_options=: + done + + if $_G_rc_lt_parse_options; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + libtool_parse_options_result=$func_quote_result + fi +} +func_add_hook func_parse_options libtool_parse_options + + + +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift + fi + + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 + # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 + *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; then + func_error "unrecognized option '-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help=$help + help="Try '$progname --help --mode=$opt_mode' for more information." + } + + # Pass back the unparsed argument list + func_quote eval ${1+"$@"} + libtool_validate_options_result=$func_quote_result +} +func_add_hook func_validate_options libtool_validate_options + + +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + + + +## ----------- ## +## Main. ## +## ----------- ## + +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# func_generated_by_libtool +# True iff stdin has been generated by Libtool. This function is only +# a basic sanity check; it will hardly flush out determined imposters. +func_generated_by_libtool_p () +{ + $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if 'file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case $lalib_p_line in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test yes = "$lalib_p" +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + test -f "$1" && + $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $debug_cmd + + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# 'FILE.' does not work on cygwin managed mounts. +func_source () +{ + $debug_cmd + + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case $lt_sysroot:$1 in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result='='$func_stripname_result + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $debug_cmd + + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with '--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=$1 + if test yes = "$build_libtool_libs"; then + write_lobj=\'$2\' + else + write_lobj=none + fi + + if test yes = "$build_old_libs"; then + write_oldobj=\'$3\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $debug_cmd + + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result= + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result"; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $debug_cmd + + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $debug_cmd + + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $debug_cmd + + if test -z "$2" && test -n "$1"; then + func_error "Could not determine host file name corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result=$1 + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $debug_cmd + + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " '$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result=$3 + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $debug_cmd + + case $4 in + $1 ) func_to_host_path_result=$3$func_to_host_path_result + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via '$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $debug_cmd + + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $debug_cmd + + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result=$1 +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result=$func_convert_core_msys_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result=$func_convert_core_file_wine_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via '$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $debug_cmd + + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd=func_convert_path_$func_stripname_result + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $debug_cmd + + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result=$1 +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_msys_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_path_wine_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_dll_def_p FILE +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with _LT_DLL_DEF_P in libtool.m4 +func_dll_def_p () +{ + $debug_cmd + + func_dll_def_p_tmp=`$SED -n \ + -e 's/^[ ]*//' \ + -e '/^\(;.*\)*$/d' \ + -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ + -e q \ + "$1"` + test DEF = "$func_dll_def_p_tmp" +} + + +# func_mode_compile arg... +func_mode_compile () +{ + $debug_cmd + + # Get the compilation command and the source file. + base_compile= + srcfile=$nonopt # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg=$arg + arg_mode=normal + ;; + + target ) + libobj=$arg + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify '-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs=$IFS; IFS=, + for arg in $args; do + IFS=$save_ifs + func_append_quoted lastarg "$arg" + done + IFS=$save_ifs + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg=$srcfile + srcfile=$arg + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with '-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj=$func_basename_result + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from '$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test yes = "$build_libtool_libs" \ + || func_fatal_configuration "cannot build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_arg pretty "$libobj" + test "X$libobj" != "X$func_quote_arg_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name '$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname=$func_basename_result + xdir=$func_dirname_result + lobj=$xdir$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test yes = "$build_old_libs"; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test no = "$compiler_c_o"; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext + lockfile=$output_obj.lock + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test yes = "$need_locks"; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test warn = "$need_locks"; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_arg pretty "$srcfile" + qsrcfile=$func_quote_arg_result + + # Only build a PIC object if we are building libtool libraries. + if test yes = "$build_libtool_libs"; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test no != "$pic_mode"; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test yes = "$suppress_opt"; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test yes = "$build_old_libs"; then + if test yes != "$pic_mode"; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test yes = "$compiler_c_o"; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test no != "$need_locks"; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test compile = "$opt_mode" && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a '.o' file suitable for static linking + -static only build a '.o' file suitable for static linking + -Wc,FLAG + -Xcompiler FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a 'standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix '.c' with the +library object suffix, '.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to '-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the '--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the 'install' or 'cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE use a list of object files found in FILE to specify objects + -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wa,FLAG + -Xassembler FLAG pass linker-specific FLAG directly to the assembler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with '-') are ignored. + +Every other argument is treated as a filename. Files ending in '.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in '.la', then a libtool library is created, +only library objects ('.lo' files) may be specified, and '-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created +using 'ar' and 'ranlib', or on Windows using 'lib'. + +If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode '$opt_mode'" + ;; + esac + + echo + $ECHO "Try '$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test : = "$opt_help"; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | $SED -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + $SED '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $debug_cmd + + # The first argument is the command name. + cmd=$nonopt + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "'$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "'$file' was not linked with '-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir=$func_dirname_result + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir=$func_dirname_result + ;; + + *) + func_warning "'-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir=$absdir + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic=$magic + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file=$progdir/$program + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file=$progdir/$program + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if $opt_dry_run; then + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + else + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd=\$cmd$args + fi +} + +test execute = "$opt_mode" && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $debug_cmd + + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "'$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument '$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and '=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_quiet && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the '-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the '$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the '$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the '$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test finish = "$opt_mode" && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $debug_cmd + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac + then + # Aesthetically quote it. + func_quote_arg pretty "$nonopt" + install_prog="$func_quote_arg_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_arg pretty "$arg" + func_append install_prog "$func_quote_arg_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=false + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=: ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test X-m = "X$prev" && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_arg pretty "$arg" + func_append install_prog " $func_quote_arg_result" + if test -n "$arg2"; then + func_quote_arg pretty "$arg2" + fi + func_append install_shared_prog " $func_quote_arg_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the '$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_arg pretty "$install_override_mode" + func_append install_shared_prog " -m $func_quote_arg_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=: + if $isdir; then + destdir=$dest + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir=$func_dirname_result + destname=$func_basename_result + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "'$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "'$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir=$func_dirname_result + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking '$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname=$1 + shift + + srcname=$realname + test -n "$relink_command" && srcname=${realname}T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme=$stripme + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme= + ;; + esac + ;; + os2*) + case $realname in + *_dll.a) + tstripme= + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try 'ln -sf' first, because the 'ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib=$destdir/$realname + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name=$func_basename_result + instname=$dir/${name}i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest=$destfile + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to '$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test yes = "$build_old_libs"; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext= + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=.exe + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script '$wrapper'" + + finalize=: + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "'$lib' has not been installed in '$libdir'" + finalize=false + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test no = "$fast_install" && test -n "$relink_command"; then + $opt_dry_run || { + if $finalize; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file=$func_basename_result + outputname=$tmpdir/$file + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_quiet || { + func_quote_arg expand,pretty "$relink_command" + eval "func_echo $func_quote_arg_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink '$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file=$outputname + else + func_warning "cannot relink '$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name=$func_basename_result + + # Set up the ranlib parameters. + oldlib=$destdir/$name + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run '$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test install = "$opt_mode" && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $debug_cmd + + my_outputname=$1 + my_originator=$2 + my_pic_p=${3-false} + my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms=${my_outputname}S.c + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist=$output_objdir/$my_outputname.nm + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* External symbol declarations for the compiler. */\ +" + + if test yes = "$dlself"; then + func_verbose "generating symbol list for '$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from '$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols=$output_objdir/$outputname.exp + $opt_dry_run || { + $RM $export_symbols + eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from '$dlprefile'" + func_basename "$dlprefile" + name=$func_basename_result + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename= + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname"; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename=$func_basename_result + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename"; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + func_show_eval '$RM "${nlist}I"' + if test -n "$global_symbol_to_import"; then + eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[];\ +" + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ +static void lt_syminit(void) +{ + LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; + for (; symbol->name; ++symbol) + {" + $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" + echo >> "$output_objdir/$my_dlsyms" "\ + } +}" + fi + echo >> "$output_objdir/$my_dlsyms" "\ +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{ {\"$my_originator\", (void *) 0}," + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ + {\"@INIT@\", (void *) <_syminit}," + fi + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + $my_pic_p && pic_flag_for_symtable=" $pic_flag" + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' + + # Transform the symbol file into the correct name. + symfileobj=$output_objdir/${my_outputname}S.$objext + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for '$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $debug_cmd + + win32_libid_type=unknown + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || + func_cygming_gnu_implib_p "$1" + then + win32_nmres=import + else + win32_nmres= + fi + ;; + *) + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s|.*|import| + p + q + } + }'` + ;; + esac + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $debug_cmd + + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $debug_cmd + + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive that possess that section. Heuristic: eliminate + # all those that have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $debug_cmd + + if func_cygming_gnu_implib_p "$1"; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1"; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result= + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $debug_cmd + + f_ex_an_ar_dir=$1; shift + f_ex_an_ar_oldlib=$1 + if test yes = "$lock_old_archive_extraction"; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test yes = "$lock_old_archive_extraction"; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $debug_cmd + + my_gentop=$1; shift + my_oldlibs=${1+"$@"} + my_oldobjs= + my_xlib= + my_xabs= + my_xdir= + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib=$func_basename_result + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir=$my_gentop/$my_xlib_u + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + func_basename "$darwin_archive" + darwin_base_archive=$func_basename_result + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches; do + func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" + $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" + cd "unfat-$$/$darwin_base_archive-$darwin_arch" + func_extract_an_archive "`pwd`" "$darwin_base_archive" + cd "$darwin_curdir" + $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result=$my_oldobjs +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory where it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + func_quote_arg pretty "$ECHO" + qECHO=$func_quote_arg_result + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=$qECHO + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ that is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options that match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test yes = "$fast_install"; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + \$ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* declarations of non-ANSI functions */ +#if defined __MINGW32__ +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined __CYGWIN__ +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined other_platform || defined ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined _MSC_VER +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +#elif defined __MINGW32__ +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined __CYGWIN__ +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined other platforms ... */ +#endif + +#if defined PATH_MAX +# define LT_PATHMAX PATH_MAX +#elif defined MAXPATHLEN +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ + defined __OS2__ +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free (stale); stale = 0; } \ +} while (0) + +#if defined LT_DEBUGWRAPPER +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + size_t tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined HAVE_DOS_BASED_FILE_SYSTEM + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined HAVE_DOS_BASED_FILE_SYSTEM + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = (size_t) (q - p); + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (STREQ (str, pat)) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + size_t len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + size_t orig_value_len = strlen (orig_value); + size_t add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + size_t len = strlen (new_value); + while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[--len] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $debug_cmd + + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $debug_cmd + + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # what system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll that has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + os2dllname= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=false + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module=$wl-single_module + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test yes != "$build_libtool_libs" \ + && func_fatal_configuration "cannot build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg=$1 + shift + func_quote_arg pretty,unquoted "$arg" + qarg=$func_quote_arg_unquoted_result + func_append libtool_args " $func_quote_arg_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir=$arg + prev= + continue + ;; + dlfiles|dlprefiles) + $preload || { + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=: + } + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test no = "$dlself"; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test dlprefiles = "$prev"; then + dlself=yes + elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test dlfiles = "$prev"; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols=$arg + test -f "$arg" \ + || func_fatal_error "symbol file '$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex=$arg + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir=$arg + prev= + continue + ;; + mllvm) + # Clang does not use LLVM to link, so we can simply discard any + # '-mllvm $arg' options when doing the link step. + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + if test none != "$pic_object"; then + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + fi + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file '$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + os2dllname) + os2dllname=$arg + prev= + continue + ;; + precious_regex) + precious_files_regex=$arg + prev= + continue + ;; + release) + release=-$arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test rpath = "$prev"; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds=$arg + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xassembler) + func_append compiler_flags " -Xassembler $qarg" + prev= + func_append compile_command " -Xassembler $qarg" + func_append finalize_command " -Xassembler $qarg" + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg=$arg + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "'-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test X-export-symbols = "X$arg"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between '-L' and '$1'" + else + func_fatal_error "need path for '-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of '$dir'" + dir=$absdir + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test X-lc = "X$arg" || test X-lm = "X$arg"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test X-lc = "X$arg" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + # Do not include libc due to us having libc/libc_r. + test X-lc = "X$arg" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test X-lc = "X$arg" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test X-lc = "X$arg" && continue + ;; + esac + elif test X-lc_r = "X$arg"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -mllvm) + prev=mllvm + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. + -pthread) + case $host in + *solaris2*) ;; + *) + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + ;; + esac + continue + ;; + -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module=$wl-multi_module + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "'-no-install' is ignored for $host" + func_warning "assuming '-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -os2dllname) + prev=os2dllname + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_arg pretty "$flag" + func_append arg " $func_quote_arg_result" + func_append compiler_flags " $func_quote_arg_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_arg pretty "$flag" + func_append arg " $wl$func_quote_arg_result" + func_append compiler_flags " $wl$func_quote_arg_result" + func_append linker_flags " $func_quote_arg_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xassembler) + prev=xassembler + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # -fstack-protector* stack protector flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer + # -fuse-ld=* Linker select flags for GCC + # -static-* direct GCC to link specific libraries statically + # -fcilkplus Cilk Plus language extension features for C/C++ + # -Wa,* Pass flags directly to the assembler + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ + -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Wa,*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + -Z*) + if test os2 = "`expr $host : '.*\(os2\)'`"; then + # OS/2 uses -Zxxx to specify OS/2-specific options + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) + prev=xcompiler + ;; + esac + continue + else + # Otherwise treat like 'Some other compiler flag' below + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + fi + ;; + + # Some other compiler flag. + -* | +*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + test none = "$pic_object" || { + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + } + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test dlfiles = "$prev"; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test dlprefiles = "$prev"; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the '$prevarg' option requires an argument" + + if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname=$func_basename_result + libobjs_save=$libobjs + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + + func_dirname "$output" "/" "" + output_objdir=$func_dirname_result$objdir + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test lib = "$linkmode"; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=false + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test lib,link = "$linkmode,$pass"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs=$tmp_deplibs + fi + + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass"; then + libs=$deplibs + deplibs= + fi + if test prog = "$linkmode"; then + case $pass in + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test lib,dlpreopen = "$linkmode,$pass"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs=$dlprefiles + fi + if test dlopen = "$pass"; then + # Collect dlpreopened libraries + save_deplibs=$deplibs + deplibs= + fi + + for deplib in $libs; do + lib= + found=false + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test lib != "$linkmode" && test prog != "$linkmode"; then + func_warning "'-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test lib = "$linkmode"; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib=$searchdir/lib$name$search_ext + if test -f "$lib"; then + if test .la = "$search_ext"; then + found=: + else + found=false + fi + break 2 + fi + done + done + if $found; then + # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll=$l + done + if test "X$ll" = "X$old_library"; then # only static version available + found=false + func_dirname "$lib" "" "." + ladir=$func_dirname_result + lib=$ladir/$old_library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + else + # deplib doesn't seem to be a libtool library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + *.ltframework) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test conv = "$pass" && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + if test scan = "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "'-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test link = "$pass"; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=false + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=: + fi + ;; + pass_all) + valid_a_lib=: + ;; + esac + if $valid_a_lib; then + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + else + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + fi + ;; + esac + continue + ;; + prog) + if test link != "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + elif test prog = "$linkmode"; then + if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=: + continue + ;; + esac # case $deplib + + $found || test -f "$lib" \ + || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "'$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir=$func_dirname_result + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass" || + { test prog != "$linkmode" && test lib != "$linkmode"; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test conv = "$pass"; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + elif test prog != "$linkmode" && test lib != "$linkmode"; then + func_fatal_error "'$lib' is not a convenience library" + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test yes = "$prefer_static_libs" || + test built,no = "$prefer_static_libs,$installed"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib=$l + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + + # This library was specified with -dlopen. + if test dlopen = "$pass"; then + test -z "$libdir" \ + && func_fatal_error "cannot -dlopen a convenience library: '$lib'" + if test -z "$dlname" || + test yes != "$dlopen_support" || + test no = "$build_libtool_libs" + then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of '$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir=$ladir + fi + ;; + esac + func_basename "$lib" + laname=$func_basename_result + + # Find the relevant object directory and library name. + if test yes = "$installed"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library '$lib' was moved." + dir=$ladir + absdir=$abs_ladir + libdir=$abs_ladir + else + dir=$lt_sysroot$libdir + absdir=$lt_sysroot$libdir + fi + test yes = "$hardcode_automatic" && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir=$ladir + absdir=$abs_ladir + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir=$ladir/$objdir + absdir=$abs_ladir/$objdir + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test dlpreopen = "$pass"; then + if test -z "$libdir" && test prog = "$linkmode"; then + func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" + fi + case $host in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test lib = "$linkmode"; then + deplibs="$dir/$old_library $deplibs" + elif test prog,link = "$linkmode,$pass"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test prog = "$linkmode" && test link != "$pass"; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=false + if test no != "$link_all_deplibs" || test -z "$library_names" || + test no = "$build_libtool_libs"; then + linkalldeplibs=: + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if $linkalldeplibs; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test prog,link = "$linkmode,$pass"; then + if test -n "$library_names" && + { { test no = "$prefer_static_libs" || + test built,yes = "$prefer_static_libs,$installed"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then + # Make sure the rpath contains only unique directories. + case $temp_rpath: in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if $alldeplibs && + { test pass_all = "$deplibs_check_method" || + { test yes = "$build_libtool_libs" && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test built = "$use_static_libs" && test yes = "$installed"; then + use_static_libs=no + fi + if test -n "$library_names" && + { test no = "$use_static_libs" || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc* | *os2*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test no = "$installed"; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule= + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule=$dlpremoduletest + break + fi + done + if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then + echo + if test prog = "$linkmode"; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test lib = "$linkmode" && + test yes = "$hardcode_into_libs"; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname=$1 + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname=$dlname + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc* | *os2*) + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + esac + eval soname=\"$soname_spec\" + else + soname=$realname + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot=$soname + func_basename "$soroot" + soname=$func_basename_result + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from '$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for '$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test prog = "$linkmode" || test relink != "$opt_mode"; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test no = "$hardcode_direct"; then + add=$dir/$linklib + case $host in + *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; + *-*-sysv4*uw2*) add_dir=-L$dir ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir=-L$dir ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we cannot + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library"; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add=$dir/$old_library + fi + elif test -n "$old_library"; then + add=$dir/$old_library + fi + fi + esac + elif test no = "$hardcode_minus_L"; then + case $host in + *-*-sunos*) add_shlibpath=$dir ;; + esac + add_dir=-L$dir + add=-l$name + elif test no = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + relink) + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$dir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$absdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test yes != "$lib_linked"; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test prog = "$linkmode"; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test yes != "$hardcode_direct" && + test yes != "$hardcode_minus_L" && + test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test prog = "$linkmode" || test relink = "$opt_mode"; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$libdir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$libdir + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add=-l$name + elif test yes = "$hardcode_automatic"; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib"; then + add=$inst_prefix_dir$libdir/$linklib + else + add=$libdir/$linklib + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir=-L$libdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + fi + + if test prog = "$linkmode"; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test prog = "$linkmode"; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test unsupported != "$hardcode_direct"; then + test -n "$old_library" && linklib=$old_library + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test yes = "$build_libtool_libs"; then + # Not a shared library + if test pass_all != "$deplibs_check_method"; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system cannot link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test yes = "$module"; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test lib = "$linkmode"; then + if test -n "$dependency_libs" && + { test yes != "$hardcode_into_libs" || + test yes = "$build_old_libs" || + test yes = "$link_static"; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs=$temp_deplibs + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test no != "$link_all_deplibs"; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path=$deplib ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of '$dir'" + absdir=$dir + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names"; then + for tmp in $deplibrary_names; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl"; then + depdepl=$absdir/$objdir/$depdepl + darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" + func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" + path= + fi + fi + ;; + *) + path=-L$absdir/$objdir + ;; + esac + else + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "'$deplib' seems to be moved" + + path=-L$absdir + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test link = "$pass"; then + if test prog = "$linkmode"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs=$newdependency_libs + if test dlpreopen = "$pass"; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test dlopen != "$pass"; then + test conv = "$pass" || { + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + } + + if test prog,link = "$linkmode,$pass"; then + vars="compile_deplibs finalize_deplibs" + else + vars=deplibs + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i= + ;; + esac + if test -n "$i"; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test prog = "$linkmode"; then + dlfiles=$newdlfiles + fi + if test prog = "$linkmode" || test lib = "$linkmode"; then + dlprefiles=$newdlprefiles + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "'-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "'-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs=$output + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form 'libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test no = "$module" \ + && func_fatal_help "libtool library '$output' must begin with 'lib'" + + if test no != "$need_lib_prefix"; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test pass_all != "$deplibs_check_method"; then + func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test no = "$dlself" \ + || func_warning "'-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test 1 -lt "$#" \ + && func_warning "ignoring multiple '-rpath's for a libtool library" + + install_libdir=$1 + + oldlibs= + if test -z "$rpath"; then + if test yes = "$build_libtool_libs"; then + # Building a libtool convenience library. + # Some compilers have problems with a '.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "'-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs=$IFS; IFS=: + set dummy $vinfo 0 0 0 + shift + IFS=$save_ifs + + test -n "$7" && \ + func_fatal_help "too many parameters to '-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major=$1 + number_minor=$2 + number_revision=$3 + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # that has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_revision + ;; + freebsd-aout|qnx|sunos) + current=$number_major + revision=$number_minor + age=0 + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_minor + lt_irix_increment=no + ;; + *) + func_fatal_configuration "$modename: unknown library version type '$version_type'" + ;; + esac + ;; + no) + current=$1 + revision=$2 + age=$3 + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT '$current' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION '$revision' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE '$age' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE '$age' is greater than the current interface number '$current'" + func_fatal_error "'$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # On Darwin other compilers + case $CC in + nagfor*) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + esac + ;; + + freebsd-aout) + major=.$current + versuffix=.$current.$revision + ;; + + freebsd-elf | midnightbsd-elf) + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + irix | nonstopux) + if test no = "$lt_irix_increment"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring=$verstring_prefix$major.$revision + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test 0 -ne "$loop"; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring_prefix$major.$iface:$verstring + done + + # Before this point, $major must not contain '.'. + major=.$major + versuffix=$major.$revision + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=.$current.$age.$revision + verstring=$current.$age.$revision + + # Add in all the interfaces that we are compatible with. + loop=$age + while test 0 -ne "$loop"; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring:$iface.0 + done + + # Make executables depend on our current version. + func_append verstring ":$current.0" + ;; + + qnx) + major=.$current + versuffix=.$current + ;; + + sco) + major=.$current + versuffix=.$current + ;; + + sunos) + major=.$current + versuffix=.$current.$revision + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 file systems. + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + + *) + func_fatal_configuration "unknown library version type '$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring=0.0 + ;; + esac + if test no = "$need_version"; then + versuffix= + else + versuffix=.0.0 + fi + fi + + # Remove version info from name if versioning should be avoided + if test yes,no = "$avoid_version,$need_version"; then + major= + versuffix= + verstring= + fi + + # Check to see if the archive will have undefined symbols. + if test yes = "$allow_undefined"; then + if test unsupported = "$allow_undefined_flag"; then + if test yes = "$build_old_libs"; then + func_warning "undefined symbols not allowed in $host shared libraries; building static only" + build_libtool_libs=no + else + func_fatal_error "can't build $host shared library unless -no-undefined is specified" + fi + fi + else + # Don't allow undefined symbols. + allow_undefined_flag=$no_undefined_flag + fi + + fi + + func_generate_dlsyms "$libname" "$libname" : + func_append libobjs " $symfileobj" + test " " = "$libobjs" && libobjs= + + if test relink != "$opt_mode"; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) + if test -n "$precious_files_regex"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles=$dlfiles + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles=$dlprefiles + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test yes = "$build_libtool_libs"; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test yes = "$build_libtool_need_lc"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release= + versuffix= + major= + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib=$potent_lib + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | $SED 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; + *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib= + ;; + esac + fi + if test -n "$a_deplib"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib=$potent_lib # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs= + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + for i in $predeps $postdeps; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test none = "$deplibs_check_method"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test yes = "$droppeddeps"; then + if test yes = "$module"; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test no = "$allow_undefined"; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs=$new_libs + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test yes = "$build_libtool_libs"; then + # Remove $wl instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test yes = "$hardcode_into_libs"; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath=$finalize_rpath + test relink = "$opt_mode" || rpath=$compile_rpath$rpath + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath=$finalize_shlibpath + test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname=$1 + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname=$realname + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib=$output_objdir/$realname + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols=$output_objdir/$libname.uexp + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + func_dll_def_p "$export_symbols" || { + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols=$export_symbols + export_symbols= + always_export_symbols=yes + } + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs=$IFS; IFS='~' + for cmd1 in $cmds; do + IFS=$save_ifs + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test yes = "$try_normal_branch" \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=$output_objdir/$output_la.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS=$save_ifs + if test -n "$export_symbols_regex" && test : != "$skipped_export"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test : != "$skipped_export" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs=$tmp_deplibs + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test yes = "$compiler_needs_object" && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test : != "$skipped_export" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then + output=$output_objdir/$output_la.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test yes = "$compiler_needs_object"; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-$k.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test -z "$objlist" || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test 1 -eq "$k"; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-$k.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-$k.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + ${skipped_export-false} && { + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + } + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs=$IFS; IFS='~' + for cmd in $concat_cmds; do + IFS=$save_ifs + $opt_quiet || { + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + ${skipped_export-false} && { + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + } + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs=$IFS; IFS='~' + for cmd in $cmds; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + $opt_quiet || { + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test yes = "$module" || test yes = "$export_dynamic"; then + # On all known operating systems, these are identical. + dlname=$soname + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "'-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object '$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj=$output + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # if reload_cmds runs $LD directly, get rid of -Wl from + # whole_archive_flag_spec and hope we can get by with turning comma + # into space. + case $reload_cmds in + *\$LD[\ \$]*) wl= ;; + esac + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags + else + gentop=$output_objdir/${obj}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test yes = "$build_libtool_libs" || libobjs=$non_pic_objects + + # Create the old-style object. + reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs + + output=$obj + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + test yes = "$build_libtool_libs" || { + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + } + + if test -n "$pic_flag" || test default != "$pic_mode"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output=$libobj + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "'-release' is ignored for programs" + + $preload \ + && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ + && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test CXX = "$tagname"; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " $wl-bind_at_load" + func_append finalize_command " $wl-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs=$new_libs + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath=$rpath + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath=$rpath + + if test -n "$libobjs" && test yes = "$build_old_libs"; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" false + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=: + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=false + ;; + *cygwin* | *mingw* ) + test yes = "$build_libtool_libs" || wrappers_required=false + ;; + *) + if test no = "$need_relink" || test yes != "$build_libtool_libs"; then + wrappers_required=false + fi + ;; + esac + $wrappers_required || { + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command=$compile_command$compile_rpath + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.$objext"; then + func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' + fi + + exit $exit_status + } + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test yes = "$no_install"; then + # We don't need to create a wrapper script. + link_command=$compile_var$compile_command$compile_rpath + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + case $hardcode_action,$fast_install in + relink,*) + # Fast installation is not supported + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "'$output' will be relinked during installation" + ;; + *,yes) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + ;; + *,no) + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + ;; + *,needless) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command= + ;; + esac + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_arg pretty "$var_value" + relink_command="$var=$func_quote_arg_result; export $var; $relink_command" + fi + done + func_quote eval cd "`pwd`" + func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" + relink_command=$func_quote_arg_unquoted_result + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource=$output_path/$objdir/lt-$output_name.c + cwrapper=$output_path/$output_name.exe + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host"; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + case $build_libtool_libs in + convenience) + oldobjs="$libobjs_save $symfileobj" + addlibs=$convenience + build_libtool_libs=no + ;; + module) + oldobjs=$libobjs_save + addlibs=$old_convenience + build_libtool_libs=no + ;; + *) + oldobjs="$old_deplibs $non_pic_objects" + $preload && test -f "$symfileobj" \ + && func_append oldobjs " $symfileobj" + addlibs=$old_convenience + ;; + esac + + if test -n "$addlibs"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase=$func_basename_result + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj"; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test -z "$oldobjs"; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test yes = "$build_old_libs" && old_library=$libname.$libext + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_arg pretty,unquoted "$var_value" + relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + func_quote eval cd "`pwd`" + relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + func_quote_arg pretty,unquoted "$relink_command" + relink_command=$func_quote_arg_unquoted_result + if test yes = "$hardcode_automatic"; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test yes = "$installed"; then + if test -z "$install_libdir"; then + break + fi + output=$output_objdir/${outputname}i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name=$func_basename_result + func_resolve_sysroot "$deplib" + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs=$newdependency_libs + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles=$newdlprefiles + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles=$newdlprefiles + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test -n "$bindir"; then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result/$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test no,yes = "$installed,$need_relink"; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +if test link = "$opt_mode" || test relink = "$opt_mode"; then + func_mode_link ${1+"$@"} +fi + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $debug_cmd + + RM=$nonopt + files= + rmforce=false + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=: ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir=$func_dirname_result + if test . = "$dir"; then + odir=$objdir + else + odir=$dir/$objdir + fi + func_basename "$file" + name=$func_basename_result + test uninstall = "$opt_mode" && odir=$dir + + # Remember odir for removal later, being careful to avoid duplicates + if test clean = "$opt_mode"; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif $rmforce; then + continue + fi + + rmfiles=$file + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case $opt_mode in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && test none != "$pic_object"; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && test none != "$non_pic_object"; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test clean = "$opt_mode"; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.$objext" + if test yes = "$fast_install" && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name"; then + func_append rmfiles " $odir/lt-$noexename.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the $objdir's in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then + func_mode_uninstall ${1+"$@"} +fi + +test -z "$opt_mode" && { + help=$generic_help + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode '$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# where we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/lib/nghttp2/m4/ax_check_compile_flag.m4 b/lib/nghttp2-1.65.0/m4/ax_check_compile_flag.m4 similarity index 100% rename from lib/nghttp2/m4/ax_check_compile_flag.m4 rename to lib/nghttp2-1.65.0/m4/ax_check_compile_flag.m4 diff --git a/lib/nghttp2/m4/ax_cxx_compile_stdcxx.m4 b/lib/nghttp2-1.65.0/m4/ax_cxx_compile_stdcxx.m4 similarity index 100% rename from lib/nghttp2/m4/ax_cxx_compile_stdcxx.m4 rename to lib/nghttp2-1.65.0/m4/ax_cxx_compile_stdcxx.m4 diff --git a/lib/nghttp2-1.65.0/m4/libtool.m4 b/lib/nghttp2-1.65.0/m4/libtool.m4 new file mode 100755 index 00000000000..e7b68334557 --- /dev/null +++ b/lib/nghttp2-1.65.0/m4/libtool.m4 @@ -0,0 +1,8427 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +]) + +# serial 59 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + +# _LT_CC_BASENAME(CC) +# ------------------- +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. +m4_defun([_LT_CC_BASENAME], +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_DECL_FILECMD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl +m4_require([_LT_CMD_TRUNCATE])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from 'configure', and 'config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# 'config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain=$ac_aux_dir/ltmain.sh +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the 'libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to 'config.status' so that its +# declaration there will have the same value as in 'configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags='_LT_TAGS'dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into 'config.status', and then the shell code to quote escape them in +# for loops in 'config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# '#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test 0 = "$lt_write_fail" && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $[#] +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try '$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try '$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +_LT_COPYING +_LT_LIBTOOL_TAGS + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + $SED '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS=$save_LDFLAGS + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR $AR_FLAGS libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) + case $MACOSX_DEPLOYMENT_TARGET,$host in + 10.[[012]],*|,*powerpc*-darwin[[5-8]]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + *) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test yes = "$lt_cv_ld_force_load"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + m4_if([$1], [CXX], +[ if test yes != "$lt_cv_apple_cc_single_mod"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script that will find a shell with a builtin +# printf (that we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case $ECHO in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[m4_require([_LT_DECL_SED])dnl +AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], + [Search for dependent libraries within DIR (or the compiler's sysroot + if not specified).])], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([$with_sysroot]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and where our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `$FILECMD conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + emul=elf + case `$FILECMD conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `$FILECMD conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `$FILECMD conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `$FILECMD conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `$FILECMD conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +_LT_DECL([], [AR], [1], [The archiver]) + +# Use ARFLAGS variable as AR's operation code to sync the variable naming with +# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have +# higher priority because thats what people were doing historically (setting +# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS +# variable obsoleted/removed. + +test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} +lt_ar_flags=$AR_FLAGS +_LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)]) + +# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override +# by AR_FLAGS because that was never working and AR_FLAGS is about to die. +_LT_DECL([], [AR_FLAGS], [\@S|@{ARFLAGS-"\@S|@lt_ar_flags"}], + [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test yes = "[$]$2"; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS +]) + +if test yes = "[$]$2"; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | $SED 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n "$lt_cv_sys_max_cmd_len"; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes = "$cross_compiling"; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen=shl_load], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen=dlopen], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links=nottested +if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test no = "$hard_links"; then + AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", + [Define to the sub-directory where libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then + + # We can hardcode non-existent directories. + if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && + test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || + test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -z "$STRIP"; then + AC_MSG_RESULT([no]) +else + if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) + else + case $host_os in + darwin*) + # FIXME - insert some real tests, host_os isn't really good enough + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + ;; + freebsd*) + if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac + fi +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a[(]lib.so.V[)]' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | $SED -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | $SED -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl* | *,icl*) + # Native MSVC or ICC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC and ICC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly* | midnightbsd*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program that can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$1"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac]) +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program that can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test no = "$withval" || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], +[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi]) +rm -f conftest.i conftest2.i conftest.out]) +])# _LT_PATH_DD + + +# _LT_CMD_TRUNCATE +# ---------------- +# find command to truncate a binary pipe +m4_defun([_LT_CMD_TRUNCATE], +[m4_require([_LT_PATH_DD]) +AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) +_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], + [Command to truncate a binary pipe]) +])# _LT_CMD_TRUNCATE + + +# _LT_CHECK_MAGIC_METHOD +# ---------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_MAGIC_METHOD], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[[45]]*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='$FILECMD -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly* | midnightbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=$FILECMD + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | $SED '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | $SED '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi]) +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# _LT_DLL_DEF_P([FILE]) +# --------------------- +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with func_dll_def_p in the libtool script +AC_DEFUN([_LT_DLL_DEF_P], +[dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +])# _LT_DLL_DEF_P + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM=-lm) + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="$SED -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="$SED -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="$SED -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="$SED -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++ or ICC, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="$SED -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | $SED '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], + [Transform the output of nm into a list of symbols to manually relocate]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], + [The name lister interface]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test yes = "$GCC"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl* | icl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++ or Intel C++ Compiler. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/([[^)]]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++ or Intel C++ Compiler. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl* | icl*) + # Native MSVC or ICC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC and ICC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly* | midnightbsd*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS=$save_LDFLAGS]) + if test yes = "$lt_cv_irix_exported_symbol"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + _LT_TAGVAR(link_all_deplibs, $1)=no + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(ld_shlibs, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + ;; + esac + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + ;; + + osf3*) + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting $shlibpath_var if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC=$CC +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report what library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC=$lt_save_CC +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl* | ,icl* | no,icl*) + # Native MSVC or ICC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$SED "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | $SED 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + + _LT_TAGVAR(GCC, $1)=$GXX + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case @S|@2 in + .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; + *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)=$prev$p + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)=$p + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)=$p + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test no = "$F77"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_F77"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$G77 + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_F77" + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test no = "$FC"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_FC"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_FC" + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code=$lt_simple_compile_test_code + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_FILECMD +# ---------------- +# Check for a file(cmd) program that can be used to detect file type and magic +m4_defun([_LT_DECL_FILECMD], +[AC_CHECK_TOOL([FILECMD], [file], [:]) +_LT_DECL([], [FILECMD], [1], [A file(cmd) program that detects file types]) +])# _LD_DECL_FILECMD + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f "$lt_ac_sed" && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test 10 -lt "$lt_ac_count" && break + lt_ac_count=`expr $lt_ac_count + 1` + if test "$lt_ac_count" -gt "$lt_ac_max"; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine what file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/lib/nghttp2-1.65.0/m4/ltoptions.m4 b/lib/nghttp2-1.65.0/m4/ltoptions.m4 new file mode 100755 index 00000000000..b0b5e9c2126 --- /dev/null +++ b/lib/nghttp2-1.65.0/m4/ltoptions.m4 @@ -0,0 +1,437 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free +# Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 8 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option '$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl 'shared' nor 'disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], + [_LT_WITH_AIX_SONAME([aix])]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the 'shared' and +# 'disable-shared' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the 'static' and +# 'disable-static' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the 'fast-install' +# and 'disable-fast-install' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_AIX_SONAME([DEFAULT]) +# ---------------------------------- +# implement the --with-aix-soname flag, and support the `aix-soname=aix' +# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT +# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +m4_define([_LT_WITH_AIX_SONAME], +[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl +shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[[5-9]]*,yes) + AC_MSG_CHECKING([which variant of shared library versioning to provide]) + AC_ARG_WITH([aix-soname], + [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) + with_aix_soname=$lt_cv_with_aix_soname]) + AC_MSG_RESULT([$with_aix_soname]) + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + +_LT_DECL([], [shared_archive_member_spec], [0], + [Shared archive member basename, for filename based shared library versioning on AIX])dnl +])# _LT_WITH_AIX_SONAME + +LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' +# LT_INIT options. +# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [pic_mode=m4_default([$1], [default])]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/lib/nghttp2-1.65.0/m4/ltsugar.m4 b/lib/nghttp2-1.65.0/m4/ltsugar.m4 new file mode 100755 index 00000000000..902508bd93a --- /dev/null +++ b/lib/nghttp2-1.65.0/m4/ltsugar.m4 @@ -0,0 +1,124 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59, which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/lib/nghttp2-1.65.0/m4/ltversion.m4 b/lib/nghttp2-1.65.0/m4/ltversion.m4 new file mode 100755 index 00000000000..b155d0aceca --- /dev/null +++ b/lib/nghttp2-1.65.0/m4/ltversion.m4 @@ -0,0 +1,24 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, +# Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 4245 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.7]) +m4_define([LT_PACKAGE_REVISION], [2.4.7]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.7' +macro_revision='2.4.7' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/lib/nghttp2-1.65.0/m4/lt~obsolete.m4 b/lib/nghttp2-1.65.0/m4/lt~obsolete.m4 new file mode 100755 index 00000000000..0f7a8759da8 --- /dev/null +++ b/lib/nghttp2-1.65.0/m4/lt~obsolete.m4 @@ -0,0 +1,99 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free +# Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/lib/nghttp2-1.65.0/missing b/lib/nghttp2-1.65.0/missing new file mode 100755 index 00000000000..1fe1611f185 --- /dev/null +++ b/lib/nghttp2-1.65.0/missing @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try '$0 --help' for more information" + exit 1 +fi + +case $1 in + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; + + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" + exit 1 + ;; + +esac + +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'autom4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" + ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/lib/nghttp2/nghttpx.conf.sample b/lib/nghttp2-1.65.0/nghttpx.conf.sample similarity index 100% rename from lib/nghttp2/nghttpx.conf.sample rename to lib/nghttp2-1.65.0/nghttpx.conf.sample diff --git a/lib/nghttp2/proxy.pac.sample b/lib/nghttp2-1.65.0/proxy.pac.sample similarity index 100% rename from lib/nghttp2/proxy.pac.sample rename to lib/nghttp2-1.65.0/proxy.pac.sample diff --git a/lib/nghttp2/script/CMakeLists.txt b/lib/nghttp2-1.65.0/script/CMakeLists.txt similarity index 100% rename from lib/nghttp2/script/CMakeLists.txt rename to lib/nghttp2-1.65.0/script/CMakeLists.txt diff --git a/lib/nghttp2/script/Makefile.am b/lib/nghttp2-1.65.0/script/Makefile.am similarity index 100% rename from lib/nghttp2/script/Makefile.am rename to lib/nghttp2-1.65.0/script/Makefile.am diff --git a/lib/nghttp2-1.65.0/script/Makefile.in b/lib/nghttp2-1.65.0/script/Makefile.in new file mode 100644 index 00000000000..5b6dd551284 --- /dev/null +++ b/lib/nghttp2-1.65.0/script/Makefile.in @@ -0,0 +1,612 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2015 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = script +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(dist_pkgdata_SCRIPTS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkgdatadir)" +SCRIPTS = $(dist_pkgdata_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = README.rst CMakeLists.txt +dist_pkgdata_SCRIPTS = fetch-ocsp-response +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu script/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu script/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-dist_pkgdataSCRIPTS: $(dist_pkgdata_SCRIPTS) + @$(NORMAL_INSTALL) + @list='$(dist_pkgdata_SCRIPTS)'; test -n "$(pkgdatadir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n' \ + -e 'h;s|.*|.|' \ + -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) { files[d] = files[d] " " $$1; \ + if (++n[d] == $(am__install_max)) { \ + print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ + else { print "f", d "/" $$4, $$1 } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(pkgdatadir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(pkgdatadir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-dist_pkgdataSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(dist_pkgdata_SCRIPTS)'; test -n "$(pkgdatadir)" || exit 0; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 's,.*/,,;$(transform)'`; \ + dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: + for dir in "$(DESTDIR)$(pkgdatadir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-dist_pkgdataSCRIPTS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dist_pkgdataSCRIPTS + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-dist_pkgdataSCRIPTS install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-dist_pkgdataSCRIPTS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/script/README.rst b/lib/nghttp2-1.65.0/script/README.rst similarity index 100% rename from lib/nghttp2/script/README.rst rename to lib/nghttp2-1.65.0/script/README.rst diff --git a/lib/nghttp2/script/fetch-ocsp-response b/lib/nghttp2-1.65.0/script/fetch-ocsp-response similarity index 99% rename from lib/nghttp2/script/fetch-ocsp-response rename to lib/nghttp2-1.65.0/script/fetch-ocsp-response index 0ff7461ee2e..f9c21002926 100755 --- a/lib/nghttp2/script/fetch-ocsp-response +++ b/lib/nghttp2-1.65.0/script/fetch-ocsp-response @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # nghttp2 - HTTP/2 C Library @@ -96,7 +96,7 @@ def run_openssl(args, allow_tempfail=False): raise Exception('nonzero return code {}'.format(p.returncode)) return buf.getvalue() except Exception as e: - msg = 'OpenSSL exitted abnormally: {}:{}'.format(args, e) + msg = 'OpenSSL exited abnormally: {}:{}'.format(args, e) tempfail(msg) if allow_tempfail else die(msg) diff --git a/lib/nghttp2/src/CMakeLists.txt b/lib/nghttp2-1.65.0/src/CMakeLists.txt similarity index 85% rename from lib/nghttp2/src/CMakeLists.txt rename to lib/nghttp2-1.65.0/src/CMakeLists.txt index 201c5a2d511..b290170c645 100644 --- a/lib/nghttp2/src/CMakeLists.txt +++ b/lib/nghttp2-1.65.0/src/CMakeLists.txt @@ -7,7 +7,7 @@ set_source_files_properties(${cxx_sources} PROPERTIES include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/includes" - "${CMAKE_CURRENT_SOURCE_DIR}/../third-party" + "${CMAKE_CURRENT_SOURCE_DIR}/../third-party/urlparse" "${CMAKE_CURRENT_SOURCE_DIR}/../third-party/llhttp/include" ${JEMALLOC_INCLUDE_DIRS} @@ -16,11 +16,15 @@ include_directories( ${LIBNGHTTP3_INCLUDE_DIRS} ${LIBNGTCP2_INCLUDE_DIRS} ${LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIRS} + ${LIBNGTCP2_CRYPTO_WOLFSSL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS} + ${WOLFSSL_INCLUDE_DIRS} ${LIBCARES_INCLUDE_DIRS} ${JANSSON_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${LIBBPF_INCLUDE_DIRS} + ${LIBBROTLIENC_INCLUDE_DIRS} + ${LIBBROTLIDEC_INCLUDE_DIRS} ) # XXX per-target? @@ -32,12 +36,16 @@ link_libraries( ${LIBNGHTTP3_LIBRARIES} ${LIBNGTCP2_LIBRARIES} ${LIBNGTCP2_CRYPTO_QUICTLS_LIBRARIES} + ${LIBNGTCP2_CRYPTO_WOLFSSL_LIBRARIES} ${OPENSSL_LIBRARIES} + ${WOLFSSL_LIBRARIES} ${LIBCARES_LIBRARIES} ${JANSSON_LIBRARIES} ${ZLIB_LIBRARIES} ${APP_LIBRARIES} ${LIBBPF_LIBRARIES} + ${LIBBROTLIENC_LIBRARIES} + ${LIBBROTLIDEC_LIBRARIES} ) if(ENABLE_APP) @@ -140,6 +148,7 @@ if(ENABLE_APP) shrpx_http3_upstream.cc http3.cc quic.cc + siphash.cc ) endif() add_library(nghttpx_static STATIC ${NGHTTPX_SRCS}) @@ -163,8 +172,7 @@ if(ENABLE_APP) target_link_libraries(nghttpx_static neverbleed) endif() - - if(HAVE_CUNIT) + if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) set(NGHTTPX_UNITTEST_SOURCES shrpx-unittest.cc shrpx_tls_test.cc @@ -181,17 +189,23 @@ if(ENABLE_APP) memchunk_test.cc template_test.cc base64_test.cc + ${CMAKE_SOURCE_DIR}/tests/munit/munit.c ) + if(ENABLE_HTTP3) + list(APPEND NGHTTPX_UNITTEST_SOURCES siphash_test.cc) + endif() add_executable(nghttpx-unittest EXCLUDE_FROM_ALL ${NGHTTPX_UNITTEST_SOURCES} $ - $ + $ + ) + target_include_directories(nghttpx-unittest PRIVATE + ${CMAKE_SOURCE_DIR}/tests/munit ) - target_include_directories(nghttpx-unittest PRIVATE ${CUNIT_INCLUDE_DIRS}) target_compile_definitions(nghttpx-unittest PRIVATE "-DNGHTTP2_SRC_DIR=\"${CMAKE_SOURCE_DIR}/src\"" ) - target_link_libraries(nghttpx-unittest nghttpx_static ${CUNIT_LIBRARIES}) + target_link_libraries(nghttpx-unittest nghttpx_static) if(HAVE_MRUBY) target_link_libraries(nghttpx-unittest mruby-lib) endif() @@ -204,13 +218,13 @@ if(ENABLE_APP) endif() add_executable(nghttp ${NGHTTP_SOURCES} $ - $ + $ ) add_executable(nghttpd ${NGHTTPD_SOURCES} $ - $ + $ ) add_executable(nghttpx ${NGHTTPX-bin_SOURCES} $ - $ + $ ) target_compile_definitions(nghttpx PRIVATE "-DPKGDATADIR=\"${PKGDATADIR}\"" @@ -218,11 +232,10 @@ if(ENABLE_APP) ) target_link_libraries(nghttpx nghttpx_static) add_executable(h2load ${H2LOAD_SOURCES} $ - $ + $ ) - install(TARGETS nghttp nghttpd nghttpx h2load - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(TARGETS nghttp nghttpd nghttpx h2load) endif() if(ENABLE_HPACK_TOOLS) @@ -238,6 +251,5 @@ if(ENABLE_HPACK_TOOLS) ) add_executable(inflatehd ${inflatehd_SOURCES}) add_executable(deflatehd ${deflatehd_SOURCES}) - install(TARGETS inflatehd deflatehd - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(TARGETS inflatehd deflatehd) endif() diff --git a/lib/nghttp2/src/HtmlParser.cc b/lib/nghttp2-1.65.0/src/HtmlParser.cc similarity index 55% rename from lib/nghttp2/src/HtmlParser.cc rename to lib/nghttp2-1.65.0/src/HtmlParser.cc index 591c4c7e020..ffda348c5fb 100644 --- a/lib/nghttp2/src/HtmlParser.cc +++ b/lib/nghttp2-1.65.0/src/HtmlParser.cc @@ -31,10 +31,10 @@ namespace nghttp2 { ParserData::ParserData(const std::string &base_uri) - : base_uri(base_uri), inside_head(0) {} + : base_uri(base_uri), inside_head(0) {} HtmlParser::HtmlParser(const std::string &base_uri) - : base_uri_(base_uri), parser_ctx_(nullptr), parser_data_(base_uri) {} + : base_uri_(base_uri), parser_ctx_(nullptr), parser_data_(base_uri) {} HtmlParser::~HtmlParser() { htmlFreeParserCtxt(parser_ctx_); } @@ -44,9 +44,9 @@ StringRef get_attr(const xmlChar **attrs, const StringRef &name) { return StringRef{}; } for (; *attrs; attrs += 2) { - if (util::strieq(StringRef{attrs[0], strlen(reinterpret_cast( - attrs[0]))}, - name)) { + if (util::strieq( + StringRef{attrs[0], strlen(reinterpret_cast(attrs[0]))}, + name)) { return StringRef{attrs[1], strlen(reinterpret_cast(attrs[1]))}; } @@ -58,11 +58,11 @@ StringRef get_attr(const xmlChar **attrs, const StringRef &name) { namespace { ResourceType get_resource_type_for_preload_as(const StringRef &attribute_value) { - if (util::strieq_l("image", attribute_value)) { + if (util::strieq("image"_sr, attribute_value)) { return REQ_IMG; - } else if (util::strieq_l("style", attribute_value)) { + } else if (util::strieq("style"_sr, attribute_value)) { return REQ_CSS; - } else if (util::strieq_l("script", attribute_value)) { + } else if (util::strieq("script"_sr, attribute_value)) { return REQ_UNBLOCK_JS; } else { return REQ_OTHERS; @@ -74,12 +74,12 @@ namespace { void add_link(ParserData *parser_data, const StringRef &uri, ResourceType res_type) { auto u = xmlBuildURI( - reinterpret_cast(uri.c_str()), - reinterpret_cast(parser_data->base_uri.c_str())); + reinterpret_cast(uri.data()), + reinterpret_cast(parser_data->base_uri.c_str())); if (u) { parser_data->links.push_back( - std::make_pair(reinterpret_cast(u), res_type)); - free(u); + std::make_pair(reinterpret_cast(u), res_type)); + xmlFree(u); } } } // namespace @@ -89,36 +89,36 @@ void start_element_func(void *user_data, const xmlChar *src_name, const xmlChar **attrs) { auto parser_data = static_cast(user_data); auto name = - StringRef{src_name, strlen(reinterpret_cast(src_name))}; - if (util::strieq_l("head", name)) { + StringRef{src_name, strlen(reinterpret_cast(src_name))}; + if (util::strieq("head"_sr, name)) { ++parser_data->inside_head; } - if (util::strieq_l("link", name)) { - auto rel_attr = get_attr(attrs, StringRef::from_lit("rel")); - auto href_attr = get_attr(attrs, StringRef::from_lit("href")); + if (util::strieq("link"_sr, name)) { + auto rel_attr = get_attr(attrs, "rel"_sr); + auto href_attr = get_attr(attrs, "href"_sr); if (rel_attr.empty() || href_attr.empty()) { return; } - if (util::strieq_l("shortcut icon", rel_attr)) { + if (util::strieq("shortcut icon"_sr, rel_attr)) { add_link(parser_data, href_attr, REQ_OTHERS); - } else if (util::strieq_l("stylesheet", rel_attr)) { + } else if (util::strieq("stylesheet"_sr, rel_attr)) { add_link(parser_data, href_attr, REQ_CSS); - } else if (util::strieq_l("preload", rel_attr)) { - auto as_attr = get_attr(attrs, StringRef::from_lit("as")); + } else if (util::strieq("preload"_sr, rel_attr)) { + auto as_attr = get_attr(attrs, "as"_sr); if (as_attr.empty()) { return; } add_link(parser_data, href_attr, get_resource_type_for_preload_as(as_attr)); } - } else if (util::strieq_l("img", name)) { - auto src_attr = get_attr(attrs, StringRef::from_lit("src")); + } else if (util::strieq("img"_sr, name)) { + auto src_attr = get_attr(attrs, "src"_sr); if (src_attr.empty()) { return; } add_link(parser_data, src_attr, REQ_IMG); - } else if (util::strieq_l("script", name)) { - auto src_attr = get_attr(attrs, StringRef::from_lit("src")); + } else if (util::strieq("script"_sr, name)) { + auto src_attr = get_attr(attrs, "src"_sr); if (src_attr.empty()) { return; } @@ -134,9 +134,9 @@ void start_element_func(void *user_data, const xmlChar *src_name, namespace { void end_element_func(void *user_data, const xmlChar *name) { auto parser_data = static_cast(user_data); - if (util::strieq_l( - "head", - StringRef{name, strlen(reinterpret_cast(name))})) { + if (util::strieq( + "head"_sr, + StringRef{name, strlen(reinterpret_cast(name))})) { --parser_data->inside_head; } } @@ -144,46 +144,46 @@ void end_element_func(void *user_data, const xmlChar *name) { namespace { xmlSAXHandler saxHandler = { - nullptr, // internalSubsetSAXFunc - nullptr, // isStandaloneSAXFunc - nullptr, // hasInternalSubsetSAXFunc - nullptr, // hasExternalSubsetSAXFunc - nullptr, // resolveEntitySAXFunc - nullptr, // getEntitySAXFunc - nullptr, // entityDeclSAXFunc - nullptr, // notationDeclSAXFunc - nullptr, // attributeDeclSAXFunc - nullptr, // elementDeclSAXFunc - nullptr, // unparsedEntityDeclSAXFunc - nullptr, // setDocumentLocatorSAXFunc - nullptr, // startDocumentSAXFunc - nullptr, // endDocumentSAXFunc - &start_element_func, // startElementSAXFunc - &end_element_func, // endElementSAXFunc - nullptr, // referenceSAXFunc - nullptr, // charactersSAXFunc - nullptr, // ignorableWhitespaceSAXFunc - nullptr, // processingInstructionSAXFunc - nullptr, // commentSAXFunc - nullptr, // warningSAXFunc - nullptr, // errorSAXFunc - nullptr, // fatalErrorSAXFunc - nullptr, // getParameterEntitySAXFunc - nullptr, // cdataBlockSAXFunc - nullptr, // externalSubsetSAXFunc - 0, // unsigned int initialized - nullptr, // void * _private - nullptr, // startElementNsSAX2Func - nullptr, // endElementNsSAX2Func - nullptr, // xmlStructuredErrorFunc + nullptr, // internalSubsetSAXFunc + nullptr, // isStandaloneSAXFunc + nullptr, // hasInternalSubsetSAXFunc + nullptr, // hasExternalSubsetSAXFunc + nullptr, // resolveEntitySAXFunc + nullptr, // getEntitySAXFunc + nullptr, // entityDeclSAXFunc + nullptr, // notationDeclSAXFunc + nullptr, // attributeDeclSAXFunc + nullptr, // elementDeclSAXFunc + nullptr, // unparsedEntityDeclSAXFunc + nullptr, // setDocumentLocatorSAXFunc + nullptr, // startDocumentSAXFunc + nullptr, // endDocumentSAXFunc + &start_element_func, // startElementSAXFunc + &end_element_func, // endElementSAXFunc + nullptr, // referenceSAXFunc + nullptr, // charactersSAXFunc + nullptr, // ignorableWhitespaceSAXFunc + nullptr, // processingInstructionSAXFunc + nullptr, // commentSAXFunc + nullptr, // warningSAXFunc + nullptr, // errorSAXFunc + nullptr, // fatalErrorSAXFunc + nullptr, // getParameterEntitySAXFunc + nullptr, // cdataBlockSAXFunc + nullptr, // externalSubsetSAXFunc + 0, // unsigned int initialized + nullptr, // void * _private + nullptr, // startElementNsSAX2Func + nullptr, // endElementNsSAX2Func + nullptr, // xmlStructuredErrorFunc }; } // namespace int HtmlParser::parse_chunk(const char *chunk, size_t size, int fin) { if (!parser_ctx_) { parser_ctx_ = - htmlCreatePushParserCtxt(&saxHandler, &parser_data_, chunk, size, - base_uri_.c_str(), XML_CHAR_ENCODING_NONE); + htmlCreatePushParserCtxt(&saxHandler, &parser_data_, chunk, size, + base_uri_.c_str(), XML_CHAR_ENCODING_NONE); if (!parser_ctx_) { return -1; } else { diff --git a/lib/nghttp2/src/HtmlParser.h b/lib/nghttp2-1.65.0/src/HtmlParser.h similarity index 100% rename from lib/nghttp2/src/HtmlParser.h rename to lib/nghttp2-1.65.0/src/HtmlParser.h diff --git a/lib/nghttp2/src/HttpServer.cc b/lib/nghttp2-1.65.0/src/HttpServer.cc similarity index 81% rename from lib/nghttp2/src/HttpServer.cc rename to lib/nghttp2-1.65.0/src/HttpServer.cc index 23cba25d804..96179ac9843 100644 --- a/lib/nghttp2/src/HttpServer.cc +++ b/lib/nghttp2-1.65.0/src/HttpServer.cc @@ -54,11 +54,17 @@ #include "ssl_compat.h" -#include -#include -#if OPENSSL_3_0_0_API -# include -#endif // OPENSSL_3_0_0_API +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# if OPENSSL_3_0_0_API +# include +# endif // OPENSSL_3_0_0_API +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include @@ -78,9 +84,8 @@ namespace nghttp2 { namespace { // TODO could be constexpr -constexpr auto DEFAULT_HTML = StringRef::from_lit("index.html"); -constexpr auto NGHTTPD_SERVER = - StringRef::from_lit("nghttpd nghttp2/" NGHTTP2_VERSION); +constexpr auto DEFAULT_HTML = "index.html"_sr; +constexpr auto NGHTTPD_SERVER = "nghttpd nghttp2/" NGHTTP2_VERSION ""_sr; } // namespace namespace { @@ -95,29 +100,28 @@ void print_session_id(int64_t id) { std::cout << "[id=" << id << "] "; } } // namespace Config::Config() - : mime_types_file("/etc/mime.types"), - stream_read_timeout(1_min), - stream_write_timeout(1_min), - data_ptr(nullptr), - padding(0), - num_worker(1), - max_concurrent_streams(100), - header_table_size(-1), - encoder_header_table_size(-1), - window_bits(-1), - connection_window_bits(-1), - port(0), - verbose(false), - daemon(false), - verify_client(false), - no_tls(false), - error_gzip(false), - early_response(false), - hexdump(false), - echo_upload(false), - no_content_length(false), - ktls(false), - no_rfc7540_pri(false) {} + : mime_types_file("/etc/mime.types"), + stream_read_timeout(1_min), + stream_write_timeout(1_min), + data_ptr(nullptr), + padding(0), + num_worker(1), + max_concurrent_streams(100), + header_table_size(-1), + encoder_header_table_size(-1), + window_bits(-1), + connection_window_bits(-1), + port(0), + verbose(false), + daemon(false), + verify_client(false), + no_tls(false), + error_gzip(false), + early_response(false), + hexdump(false), + echo_upload(false), + no_content_length(false), + ktls(false) {} Config::~Config() {} @@ -205,7 +209,7 @@ constexpr size_t FILE_ENTRY_EVICT_THRES = 2048; namespace { bool need_validation_file_entry( - const FileEntry *ent, const std::chrono::steady_clock::time_point &now) { + const FileEntry *ent, const std::chrono::steady_clock::time_point &now) { return ent->last_valid + FILE_ENTRY_MAX_AGE < now; } } // namespace @@ -238,15 +242,15 @@ class Sessions { public: Sessions(HttpServer *sv, struct ev_loop *loop, const Config *config, SSL_CTX *ssl_ctx) - : sv_(sv), - loop_(loop), - config_(config), - ssl_ctx_(ssl_ctx), - callbacks_(nullptr), - option_(nullptr), - next_session_id_(1), - tstamp_cached_(ev_now(loop)), - cached_date_(util::http_date(tstamp_cached_)) { + : sv_(sv), + loop_(loop), + config_(config), + ssl_ctx_(ssl_ctx), + callbacks_(nullptr), + option_(nullptr), + next_session_id_(1), + tstamp_cached_(ev_now(loop)), + cached_date_(util::http_date(tstamp_cached_)) { nghttp2_session_callbacks_new(&callbacks_); fill_callback(callbacks_, config_); @@ -255,7 +259,7 @@ class Sessions { if (config_->encoder_header_table_size != -1) { nghttp2_option_set_max_deflate_dynamic_table_size( - option_, config_->encoder_header_table_size); + option_, config_->encoder_header_table_size); } ev_timer_init(&release_fd_timer_, release_fd_cb, 0., RELEASE_FD_TIMEOUT); @@ -314,7 +318,7 @@ class Sessions { } } auto handler = - std::make_unique(this, fd, ssl, get_next_session_id()); + std::make_unique(this, fd, ssl, get_next_session_id()); if (!ssl) { if (handler->connection_made() != 0) { return; @@ -370,8 +374,8 @@ class Sessions { auto rv = fd_cache_.emplace(path, std::make_unique(ent)); #else // !HAVE_STD_MAP_EMPLACE // for gcc-4.7 - auto rv = fd_cache_.insert( - std::make_pair(path, std::make_unique(ent))); + auto rv = + fd_cache_.insert(std::make_pair(path, std::make_unique(ent))); #endif // !HAVE_STD_MAP_EMPLACE auto &res = (*rv).second; res->it = rv; @@ -450,15 +454,15 @@ void release_fd_cb(struct ev_loop *loop, ev_timer *w, int revents) { } // namespace Stream::Stream(Http2Handler *handler, int32_t stream_id) - : balloc(1024, 1024), - header{}, - handler(handler), - file_ent(nullptr), - body_length(0), - body_offset(0), - header_buffer_size(0), - stream_id(stream_id), - echo_upload(false) { + : balloc(1024, 1024), + header{}, + handler(handler), + file_ent(nullptr), + body_length(0), + body_offset(0), + header_buffer_size(0), + stream_id(stream_id), + echo_upload(false) { auto config = handler->get_config(); ev_timer_init(&rtimer, stream_timeout_cb, 0., config->stream_read_timeout); ev_timer_init(&wtimer, stream_timeout_cb, 0., config->stream_write_timeout); @@ -534,13 +538,13 @@ void writecb(struct ev_loop *loop, ev_io *w, int revents) { Http2Handler::Http2Handler(Sessions *sessions, int fd, SSL *ssl, int64_t session_id) - : session_id_(session_id), - session_(nullptr), - sessions_(sessions), - ssl_(ssl), - data_pending_(nullptr), - data_pendinglen_(0), - fd_(fd) { + : session_id_(session_id), + session_(nullptr), + sessions_(sessions), + ssl_(ssl), + data_pending_(nullptr), + data_pendinglen_(0), + fd_(fd) { ev_timer_init(&settings_timerev_, settings_timeout_cb, 10., 0.); ev_io_init(&wev_, writecb, fd, EV_WRITE); ev_io_init(&rev_, readcb, fd, EV_READ); @@ -607,10 +611,10 @@ int Http2Handler::fill_wb() { for (;;) { const uint8_t *data; - auto datalen = nghttp2_session_mem_send(session_, &data); + auto datalen = nghttp2_session_mem_send2(session_, &data); if (datalen < 0) { - std::cerr << "nghttp2_session_mem_send() returned error: " + std::cerr << "nghttp2_session_mem_send2() returned error: " << nghttp2_strerror(datalen) << std::endl; return -1; } @@ -648,10 +652,10 @@ int Http2Handler::read_clear() { util::hexdump(stdout, buf.data(), nread); } - rv = nghttp2_session_mem_recv(session_, buf.data(), nread); + rv = nghttp2_session_mem_recv2(session_, buf.data(), nread); if (rv < 0) { if (rv != NGHTTP2_ERR_BAD_CLIENT_MAGIC) { - std::cerr << "nghttp2_session_mem_recv() returned error: " + std::cerr << "nghttp2_session_mem_recv2() returned error: " << nghttp2_strerror(rv) << std::endl; } return -1; @@ -725,7 +729,7 @@ int Http2Handler::tls_handshake() { std::cerr << "SSL/TLS handshake completed" << std::endl; } - if (verify_npn_result() != 0) { + if (verify_alpn_result() != 0) { return -1; } @@ -750,34 +754,40 @@ int Http2Handler::read_tls() { ERR_clear_error(); - auto rv = SSL_read(ssl_, buf.data(), buf.size()); - - if (rv <= 0) { - auto err = SSL_get_error(ssl_, rv); - switch (err) { - case SSL_ERROR_WANT_READ: - return write_(*this); - case SSL_ERROR_WANT_WRITE: - // renegotiation started - return -1; - default: - return -1; + for (;;) { + auto rv = SSL_read(ssl_, buf.data(), buf.size()); + + if (rv <= 0) { + auto err = SSL_get_error(ssl_, rv); + switch (err) { + case SSL_ERROR_WANT_READ: + return write_(*this); + case SSL_ERROR_WANT_WRITE: + // renegotiation started + return -1; + default: + return -1; + } } - } - auto nread = rv; + auto nread = rv; - if (get_config()->hexdump) { - util::hexdump(stdout, buf.data(), nread); - } + if (get_config()->hexdump) { + util::hexdump(stdout, buf.data(), nread); + } - rv = nghttp2_session_mem_recv(session_, buf.data(), nread); - if (rv < 0) { - if (rv != NGHTTP2_ERR_BAD_CLIENT_MAGIC) { - std::cerr << "nghttp2_session_mem_recv() returned error: " - << nghttp2_strerror(rv) << std::endl; + rv = nghttp2_session_mem_recv2(session_, buf.data(), nread); + if (rv < 0) { + if (rv != NGHTTP2_ERR_BAD_CLIENT_MAGIC) { + std::cerr << "nghttp2_session_mem_recv2() returned error: " + << nghttp2_strerror(rv) << std::endl; + } + return -1; + } + + if (SSL_pending(ssl_) == 0) { + break; } - return -1; } return write_(*this); @@ -848,11 +858,14 @@ int Http2Handler::connection_made() { auto config = sessions_->get_config(); std::array entry; - size_t niv = 1; + size_t niv = 2; entry[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; entry[0].value = config->max_concurrent_streams; + entry[1].settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; + entry[1].value = 1; + if (config->header_table_size >= 0) { entry[niv].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; entry[niv].value = config->header_table_size; @@ -865,12 +878,6 @@ int Http2Handler::connection_made() { ++niv; } - if (config->no_rfc7540_pri) { - entry[niv].settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; - entry[niv].value = 1; - ++niv; - } - r = nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, entry.data(), niv); if (r != 0) { return r; @@ -878,8 +885,8 @@ int Http2Handler::connection_made() { if (config->connection_window_bits != -1) { r = nghttp2_session_set_local_window_size( - session_, NGHTTP2_FLAG_NONE, 0, - (1 << config->connection_window_bits) - 1); + session_, NGHTTP2_FLAG_NONE, 0, + (1 << config->connection_window_bits) - 1); if (r != 0) { return r; } @@ -892,29 +899,18 @@ int Http2Handler::connection_made() { return on_write(); } -int Http2Handler::verify_npn_result() { +int Http2Handler::verify_alpn_result() { const unsigned char *next_proto = nullptr; unsigned int next_proto_len; - // Check the negotiated protocol in NPN or ALPN -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_get0_next_proto_negotiated(ssl_, &next_proto, &next_proto_len); -#endif // !OPENSSL_NO_NEXTPROTONEG - for (int i = 0; i < 2; ++i) { - if (next_proto) { - auto proto = StringRef{next_proto, next_proto_len}; - if (sessions_->get_config()->verbose) { - std::cout << "The negotiated protocol: " << proto << std::endl; - } - if (util::check_h2_is_selected(proto)) { - return 0; - } - break; - } else { -#if OPENSSL_VERSION_NUMBER >= 0x10002000L - SSL_get0_alpn_selected(ssl_, &next_proto, &next_proto_len); -#else // OPENSSL_VERSION_NUMBER < 0x10002000L - break; -#endif // OPENSSL_VERSION_NUMBER < 0x10002000L + // Check the negotiated protocol in ALPN + SSL_get0_alpn_selected(ssl_, &next_proto, &next_proto_len); + if (next_proto) { + auto proto = StringRef{next_proto, next_proto_len}; + if (sessions_->get_config()->verbose) { + std::cout << "The negotiated protocol: " << proto << std::endl; + } + if (util::check_h2_is_selected(proto)) { + return 0; } } if (sessions_->get_config()->verbose) { @@ -928,81 +924,88 @@ int Http2Handler::verify_npn_result() { int Http2Handler::submit_file_response(const StringRef &status, Stream *stream, time_t last_modified, off_t file_length, const std::string *content_type, - nghttp2_data_provider *data_prd) { + nghttp2_data_provider2 *data_prd) { std::string last_modified_str; - auto nva = make_array(http2::make_nv_ls_nocopy(":status", status), - http2::make_nv_ls_nocopy("server", NGHTTPD_SERVER), - http2::make_nv_ll("cache-control", "max-age=3600"), - http2::make_nv_ls("date", sessions_->get_cached_date()), - http2::make_nv_ll("", ""), http2::make_nv_ll("", ""), - http2::make_nv_ll("", ""), http2::make_nv_ll("", "")); + auto nva = std::to_array({ + http2::make_field(":status"_sr, status), + http2::make_field("server"_sr, NGHTTPD_SERVER), + http2::make_field("cache-control"_sr, "max-age=3600"_sr), + http2::make_field_v("date"_sr, sessions_->get_cached_date()), + {}, + {}, + {}, + {}, + }); size_t nvlen = 4; if (!get_config()->no_content_length) { - nva[nvlen++] = http2::make_nv_ls_nocopy( - "content-length", - util::make_string_ref_uint(stream->balloc, file_length)); + nva[nvlen++] = http2::make_field( + "content-length"_sr, + util::make_string_ref_uint(stream->balloc, file_length)); } if (last_modified != 0) { last_modified_str = util::http_date(last_modified); - nva[nvlen++] = http2::make_nv_ls("last-modified", last_modified_str); + nva[nvlen++] = http2::make_field_v("last-modified"_sr, last_modified_str); } if (content_type) { - nva[nvlen++] = http2::make_nv_ls("content-type", *content_type); + nva[nvlen++] = http2::make_field_v("content-type"_sr, *content_type); } auto &trailer_names = get_config()->trailer_names; if (!trailer_names.empty()) { - nva[nvlen++] = http2::make_nv_ls_nocopy("trailer", trailer_names); + nva[nvlen++] = http2::make_field("trailer"_sr, trailer_names); } - return nghttp2_submit_response(session_, stream->stream_id, nva.data(), nvlen, - data_prd); + return nghttp2_submit_response2(session_, stream->stream_id, nva.data(), + nvlen, data_prd); } int Http2Handler::submit_response(const StringRef &status, int32_t stream_id, const HeaderRefs &headers, - nghttp2_data_provider *data_prd) { + nghttp2_data_provider2 *data_prd) { auto nva = std::vector(); nva.reserve(4 + headers.size()); - nva.push_back(http2::make_nv_ls_nocopy(":status", status)); - nva.push_back(http2::make_nv_ls_nocopy("server", NGHTTPD_SERVER)); - nva.push_back(http2::make_nv_ls("date", sessions_->get_cached_date())); + nva.push_back(http2::make_field(":status"_sr, status)); + nva.push_back(http2::make_field("server"_sr, NGHTTPD_SERVER)); + nva.push_back(http2::make_field_v("date"_sr, sessions_->get_cached_date())); if (data_prd) { auto &trailer_names = get_config()->trailer_names; if (!trailer_names.empty()) { - nva.push_back(http2::make_nv_ls_nocopy("trailer", trailer_names)); + nva.push_back(http2::make_field("trailer"_sr, trailer_names)); } } for (auto &nv : headers) { - nva.push_back(http2::make_nv_nocopy(nv.name, nv.value, nv.no_index)); + nva.push_back( + http2::make_field(nv.name, nv.value, http2::no_index(nv.no_index))); } - int r = nghttp2_submit_response(session_, stream_id, nva.data(), nva.size(), - data_prd); + int r = nghttp2_submit_response2(session_, stream_id, nva.data(), nva.size(), + data_prd); return r; } int Http2Handler::submit_response(const StringRef &status, int32_t stream_id, - nghttp2_data_provider *data_prd) { - auto nva = make_array(http2::make_nv_ls_nocopy(":status", status), - http2::make_nv_ls_nocopy("server", NGHTTPD_SERVER), - http2::make_nv_ls("date", sessions_->get_cached_date()), - http2::make_nv_ll("", "")); + nghttp2_data_provider2 *data_prd) { + auto nva = std::to_array({ + http2::make_field(":status"_sr, status), + http2::make_field("server"_sr, NGHTTPD_SERVER), + http2::make_field_v("date"_sr, sessions_->get_cached_date()), + {}, + }); size_t nvlen = 3; if (data_prd) { auto &trailer_names = get_config()->trailer_names; if (!trailer_names.empty()) { - nva[nvlen++] = http2::make_nv_ls_nocopy("trailer", trailer_names); + nva[nvlen++] = http2::make_field("trailer"_sr, trailer_names); } } - return nghttp2_submit_response(session_, stream_id, nva.data(), nvlen, - data_prd); + return nghttp2_submit_response2(session_, stream_id, nva.data(), nvlen, + data_prd); } int Http2Handler::submit_non_final_response(const std::string &status, int32_t stream_id) { - auto nva = make_array(http2::make_nv_ls(":status", status)); + auto nva = std::to_array({http2::make_field_v(":status"_sr, status)}); return nghttp2_submit_headers(session_, NGHTTP2_FLAG_NONE, stream_id, nullptr, nva.data(), nva.size(), nullptr); } @@ -1015,17 +1018,16 @@ int Http2Handler::submit_push_promise(Stream *stream, authority = stream->header.host; } - auto scheme = get_config()->no_tls ? StringRef::from_lit("http") - : StringRef::from_lit("https"); + auto scheme = get_config()->no_tls ? "http"_sr : "https"_sr; - auto nva = make_array(http2::make_nv_ll(":method", "GET"), - http2::make_nv_ls_nocopy(":path", push_path), - http2::make_nv_ls_nocopy(":scheme", scheme), - http2::make_nv_ls_nocopy(":authority", authority)); + auto nva = std::to_array({http2::make_field(":method"_sr, "GET"_sr), + http2::make_field(":path"_sr, push_path), + http2::make_field(":scheme"_sr, scheme), + http2::make_field(":authority"_sr, authority)}); auto promised_stream_id = nghttp2_submit_push_promise( - session_, NGHTTP2_FLAG_END_HEADERS, stream->stream_id, nva.data(), - nva.size(), nullptr); + session_, NGHTTP2_FLAG_END_HEADERS, stream->stream_id, nva.data(), + nva.size(), nullptr); if (promised_stream_id < 0) { return promised_stream_id; @@ -1034,11 +1036,11 @@ int Http2Handler::submit_push_promise(Stream *stream, auto promised_stream = std::make_unique(this, promised_stream_id); auto &promised_header = promised_stream->header; - promised_header.method = StringRef::from_lit("GET"); + promised_header.method = "GET"_sr; promised_header.path = push_path; promised_header.scheme = scheme; promised_header.authority = - make_string_ref(promised_stream->balloc, authority); + make_string_ref(promised_stream->balloc, authority); add_stream(promised_stream_id, std::move(promised_stream)); @@ -1087,9 +1089,10 @@ void Http2Handler::terminate_session(uint32_t error_code) { nghttp2_session_terminate_session(session_, error_code); } -ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t length, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) { +nghttp2_ssize file_read_callback(nghttp2_session *session, int32_t stream_id, + uint8_t *buf, size_t length, + uint32_t *data_flags, + nghttp2_data_source *source, void *user_data) { int rv; auto hd = static_cast(user_data); auto stream = hd->get_stream(stream_id); @@ -1107,7 +1110,8 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, std::vector nva; nva.reserve(config->trailer.size()); for (auto &kv : config->trailer) { - nva.push_back(http2::make_nv(kv.name, kv.value, kv.no_index)); + nva.push_back(http2::make_field_nv(kv.name, kv.value, + http2::no_index(kv.no_index))); } rv = nghttp2_submit_trailer(session, stream_id, nva.data(), nva.size()); if (rv != 0) { @@ -1138,17 +1142,16 @@ void prepare_status_response(Stream *stream, Http2Handler *hd, int status) { // we don't set stream->file_ent since we don't want to expire it. stream->body_length = file_ent->length; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; data_prd.source.fd = file_ent->fd; data_prd.read_callback = file_read_callback; HeaderRefs headers; headers.reserve(2); - headers.emplace_back(StringRef::from_lit("content-type"), - StringRef::from_lit("text/html; charset=UTF-8")); + headers.emplace_back("content-type"_sr, "text/html; charset=UTF-8"_sr); headers.emplace_back( - StringRef::from_lit("content-length"), - util::make_string_ref_uint(stream->balloc, file_ent->length)); + "content-length"_sr, + util::make_string_ref_uint(stream->balloc, file_ent->length)); hd->submit_response(StringRef{status_page->status}, stream->stream_id, headers, &data_prd); } @@ -1166,20 +1169,18 @@ void prepare_echo_response(Stream *stream, Http2Handler *hd) { hd->submit_rst_stream(stream, NGHTTP2_INTERNAL_ERROR); return; } - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; data_prd.source.fd = stream->file_ent->fd; data_prd.read_callback = file_read_callback; HeaderRefs headers; - headers.emplace_back(StringRef::from_lit("nghttpd-response"), - StringRef::from_lit("echo")); + headers.emplace_back("nghttpd-response"_sr, "echo"_sr); if (!hd->get_config()->no_content_length) { - headers.emplace_back(StringRef::from_lit("content-length"), + headers.emplace_back("content-length"_sr, util::make_string_ref_uint(stream->balloc, length)); } - hd->submit_response(StringRef::from_lit("200"), stream->stream_id, headers, - &data_prd); + hd->submit_response("200"_sr, stream->stream_id, headers, &data_prd); } } // namespace @@ -1197,7 +1198,7 @@ bool prepare_upload_temp_store(Stream *stream, Http2Handler *hd) { // now. We will update it when we get whole request body. auto path = std::string("echo:") + tempfn; stream->file_ent = - sessions->cache_fd(path, FileEntry(path, 0, 0, fd, nullptr, {}, true)); + sessions->cache_fd(path, FileEntry(path, 0, 0, fd, nullptr, {}, true)); stream->echo_upload = true; return true; } @@ -1213,10 +1214,10 @@ void prepare_redirect_response(Stream *stream, Http2Handler *hd, authority = stream->header.host; } - auto location = concat_string_ref( - stream->balloc, scheme, StringRef::from_lit("://"), authority, path); + auto location = + concat_string_ref(stream->balloc, scheme, "://"_sr, authority, path); - auto headers = HeaderRefs{{StringRef::from_lit("location"), location}}; + auto headers = HeaderRefs{{"location"_sr, location}}; auto sessions = hd->get_sessions(); auto status_page = sessions->get_server()->get_status_page(status); @@ -1249,8 +1250,8 @@ void prepare_response(Stream *stream, Http2Handler *hd, auto query_pos = std::find(std::begin(reqpath), std::end(reqpath), '?'); if (query_pos != std::end(reqpath)) { // Do not response to this request to allow clients to test timeouts. - if (util::streq_l("nghttpd_do_not_respond_to_req=yes", - StringRef{query_pos, std::end(reqpath)})) { + if ("nghttpd_do_not_respond_to_req=yes"_sr == + StringRef{query_pos, std::end(reqpath)}) { return; } raw_path = StringRef{std::begin(reqpath), query_pos}; @@ -1282,7 +1283,7 @@ void prepare_response(Stream *stream, Http2Handler *hd, } if (!hd->get_config()->push.empty()) { - auto push_itr = hd->get_config()->push.find(path.str()); + auto push_itr = hd->get_config()->push.find(std::string{path}); if (allow_push && push_itr != std::end(hd->get_config()->push)) { for (auto &push_path : (*push_itr).second) { rv = hd->submit_push_promise(stream, StringRef{push_path}); @@ -1343,8 +1344,8 @@ void prepare_response(Stream *stream, Http2Handler *hd, if (buf.st_mode & S_IFDIR) { close(file); - auto reqpath = concat_string_ref(stream->balloc, raw_path, - StringRef::from_lit("/"), raw_query); + auto reqpath = + concat_string_ref(stream->balloc, raw_path, "/"_sr, raw_query); prepare_redirect_response(stream, hd, reqpath, 301); @@ -1367,35 +1368,34 @@ void prepare_response(Stream *stream, Http2Handler *hd, } file_ent = sessions->cache_fd( - file_path, FileEntry(file_path, buf.st_size, buf.st_mtime, file, - content_type, std::chrono::steady_clock::now())); + file_path, FileEntry(file_path, buf.st_size, buf.st_mtime, file, + content_type, std::chrono::steady_clock::now())); } stream->file_ent = file_ent; if (last_mod_found && file_ent->mtime <= last_mod) { - hd->submit_response(StringRef::from_lit("304"), stream->stream_id, nullptr); + hd->submit_response("304"_sr, stream->stream_id, nullptr); return; } auto method = stream->header.method; - if (method == StringRef::from_lit("HEAD")) { - hd->submit_file_response(StringRef::from_lit("200"), stream, - file_ent->mtime, file_ent->length, - file_ent->content_type, nullptr); + if (method == "HEAD"_sr) { + hd->submit_file_response("200"_sr, stream, file_ent->mtime, + file_ent->length, file_ent->content_type, nullptr); return; } stream->body_length = file_ent->length; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; data_prd.source.fd = file_ent->fd; data_prd.read_callback = file_read_callback; - hd->submit_file_response(StringRef::from_lit("200"), stream, file_ent->mtime, - file_ent->length, file_ent->content_type, &data_prd); + hd->submit_file_response("200"_sr, stream, file_ent->mtime, file_ent->length, + file_ent->content_type, &data_prd); } } // namespace @@ -1429,7 +1429,7 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, stream->header_buffer_size += namebuf.len + valuebuf.len; - auto token = http2::lookup_token(namebuf.base, namebuf.len); + auto token = http2::lookup_token(StringRef{namebuf.base, namebuf.len}); auto &header = stream->header; @@ -1529,17 +1529,15 @@ int hd_on_frame_recv_callback(nghttp2_session *session, } if (frame->headers.cat == NGHTTP2_HCAT_REQUEST) { - auto expect100 = stream->header.expect; - if (util::strieq_l("100-continue", expect100)) { + if (util::strieq("100-continue"_sr, expect100)) { hd->submit_non_final_response("100", frame->hd.stream_id); } auto method = stream->header.method; if (hd->get_config()->echo_upload && - (method == StringRef::from_lit("POST") || - method == StringRef::from_lit("PUT"))) { + (method == "POST"_sr || method == "PUT"_sr)) { if (!prepare_upload_temp_store(stream, hd)) { hd->submit_rst_stream(stream, NGHTTP2_INTERNAL_ERROR); return 0; @@ -1594,7 +1592,7 @@ int hd_on_frame_send_callback(nghttp2_session *session, if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { remove_stream_write_timeout(stream); } else if (std::min(nghttp2_session_get_stream_remote_window_size( - session, frame->hd.stream_id), + session, frame->hd.stream_id), nghttp2_session_get_remote_window_size(session)) <= 0) { // If stream is blocked by flow control, enable write timeout. add_stream_read_timeout_if_pending(stream); @@ -1687,9 +1685,9 @@ int send_data_callback(nghttp2_session *session, nghttp2_frame *frame, } // namespace namespace { -ssize_t select_padding_callback(nghttp2_session *session, - const nghttp2_frame *frame, size_t max_payload, - void *user_data) { +nghttp2_ssize select_padding_callback(nghttp2_session *session, + const nghttp2_frame *frame, + size_t max_payload, void *user_data) { auto hd = static_cast(user_data); return std::min(max_payload, frame->hd.length + hd->get_config()->padding); } @@ -1747,37 +1745,37 @@ int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, namespace { void fill_callback(nghttp2_session_callbacks *callbacks, const Config *config) { nghttp2_session_callbacks_set_on_stream_close_callback( - callbacks, on_stream_close_callback); + callbacks, on_stream_close_callback); nghttp2_session_callbacks_set_on_frame_recv_callback( - callbacks, hd_on_frame_recv_callback); + callbacks, hd_on_frame_recv_callback); nghttp2_session_callbacks_set_on_frame_send_callback( - callbacks, hd_on_frame_send_callback); + callbacks, hd_on_frame_send_callback); if (config->verbose) { nghttp2_session_callbacks_set_on_invalid_frame_recv_callback( - callbacks, verbose_on_invalid_frame_recv_callback); + callbacks, verbose_on_invalid_frame_recv_callback); nghttp2_session_callbacks_set_error_callback2(callbacks, verbose_error_callback); } nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - callbacks, on_data_chunk_recv_callback); + callbacks, on_data_chunk_recv_callback); nghttp2_session_callbacks_set_on_header_callback2(callbacks, on_header_callback2); nghttp2_session_callbacks_set_on_begin_headers_callback( - callbacks, on_begin_headers_callback); + callbacks, on_begin_headers_callback); nghttp2_session_callbacks_set_send_data_callback(callbacks, send_data_callback); if (config->padding) { - nghttp2_session_callbacks_set_select_padding_callback( - callbacks, select_padding_callback); + nghttp2_session_callbacks_set_select_padding_callback2( + callbacks, select_padding_callback); } } } // namespace @@ -1816,6 +1814,10 @@ void run_worker(Worker *worker) { auto loop = worker->sessions->get_loop(); ev_run(loop, 0); + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL + wc_ecc_fp_free(); +#endif // NGHTTP2_OPENSSL_IS_WOLFSSL } } // namespace @@ -1832,7 +1834,7 @@ int get_ev_loop_flags() { class AcceptHandler { public: AcceptHandler(HttpServer *sv, Sessions *sessions, const Config *config) - : sessions_(sessions), config_(config), next_worker_(0) { + : sessions_(sessions), config_(config), next_worker_(0) { if (config_->num_worker == 1) { return; } @@ -1842,8 +1844,8 @@ class AcceptHandler { } auto worker = std::make_unique(); auto loop = ev_loop_new(get_ev_loop_flags()); - worker->sessions = std::make_unique(sv, loop, config_, - sessions_->get_ssl_ctx()); + worker->sessions = + std::make_unique(sv, loop, config_, sessions_->get_ssl_ctx()); ev_async_init(&worker->w, worker_acceptcb); worker->w.data = worker.get(); ev_async_start(loop, &worker->w); @@ -1891,7 +1893,7 @@ class ListenEventHandler { public: ListenEventHandler(Sessions *sessions, int fd, std::shared_ptr acceptor) - : acceptor_(std::move(acceptor)), sessions_(sessions), fd_(fd) { + : acceptor_(std::move(acceptor)), sessions_(sessions), fd_(fd) { ev_io_init(&w_, acceptcb, fd, EV_READ); w_.data = this; ev_io_start(sessions_->get_loop(), &w_); @@ -1984,26 +1986,14 @@ enum { HttpServer::HttpServer(const Config *config) : config_(config) { status_pages_ = std::vector{ - {"200", make_status_body(200, config_->port)}, - {"301", make_status_body(301, config_->port)}, - {"400", make_status_body(400, config_->port)}, - {"404", make_status_body(404, config_->port)}, - {"405", make_status_body(405, config_->port)}, + {"200", make_status_body(200, config_->port)}, + {"301", make_status_body(301, config_->port)}, + {"400", make_status_body(400, config_->port)}, + {"404", make_status_body(404, config_->port)}, + {"405", make_status_body(405, config_->port)}, }; } -#ifndef OPENSSL_NO_NEXTPROTONEG -namespace { -int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len, - void *arg) { - auto next_proto = static_cast *>(arg); - *data = next_proto->data(); - *len = next_proto->size(); - return SSL_TLSEXT_ERR_OK; -} -} // namespace -#endif // !OPENSSL_NO_NEXTPROTONEG - namespace { int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) { // We don't verify the client certificate. Just request it for the @@ -2089,7 +2079,6 @@ int start_listen(HttpServer *sv, struct ev_loop *loop, Sessions *sessions, } } // namespace -#if OPENSSL_VERSION_NUMBER >= 0x10002000L namespace { int alpn_select_proto_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, @@ -2111,7 +2100,6 @@ int alpn_select_proto_cb(SSL *ssl, const unsigned char **out, return SSL_TLSEXT_ERR_OK; } } // namespace -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L int HttpServer::run() { SSL_CTX *ssl_ctx = nullptr; @@ -2141,39 +2129,37 @@ int HttpServer::run() { SSL_CTX_set_mode(ssl_ctx, SSL_MODE_RELEASE_BUFFERS); if (nghttp2::tls::ssl_ctx_set_proto_versions( - ssl_ctx, nghttp2::tls::NGHTTP2_TLS_MIN_VERSION, - nghttp2::tls::NGHTTP2_TLS_MAX_VERSION) != 0) { + ssl_ctx, nghttp2::tls::NGHTTP2_TLS_MIN_VERSION, + nghttp2::tls::NGHTTP2_TLS_MAX_VERSION) != 0) { std::cerr << "Could not set TLS versions" << std::endl; return -1; } - if (SSL_CTX_set_cipher_list(ssl_ctx, tls::DEFAULT_CIPHER_LIST) == 0) { + if (SSL_CTX_set_cipher_list(ssl_ctx, tls::DEFAULT_CIPHER_LIST.data()) == + 0) { + std::cerr << ERR_error_string(ERR_get_error(), nullptr) << std::endl; + return -1; + } + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL + if (SSL_CTX_set_ciphersuites(ssl_ctx, + tls::DEFAULT_TLS13_CIPHER_LIST.data()) == 0) { std::cerr << ERR_error_string(ERR_get_error(), nullptr) << std::endl; return -1; } +#endif // NGHTTP2_OPENSSL_IS_WOLFSSL const unsigned char sid_ctx[] = "nghttpd"; SSL_CTX_set_session_id_context(ssl_ctx, sid_ctx, sizeof(sid_ctx) - 1); SSL_CTX_set_session_cache_mode(ssl_ctx, SSL_SESS_CACHE_SERVER); #ifndef OPENSSL_NO_EC -# if !LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L if (SSL_CTX_set1_curves_list(ssl_ctx, "P-256") != 1) { std::cerr << "SSL_CTX_set1_curves_list failed: " << ERR_error_string(ERR_get_error(), nullptr); return -1; } -# else // !(!LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L) - auto ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); - if (ecdh == nullptr) { - std::cerr << "EC_KEY_new_by_curv_name failed: " - << ERR_error_string(ERR_get_error(), nullptr); - return -1; - } - SSL_CTX_set_tmp_ecdh(ssl_ctx, ecdh); - EC_KEY_free(ecdh); -# endif // !(!LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L) -#endif // OPENSSL_NO_EC +#endif // OPENSSL_NO_EC if (!config_->dh_param_file.empty()) { // Read DH parameters from file @@ -2187,8 +2173,8 @@ int HttpServer::run() { #if OPENSSL_3_0_0_API EVP_PKEY *dh = nullptr; auto dctx = OSSL_DECODER_CTX_new_for_pkey( - &dh, "PEM", nullptr, "DH", OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS, - nullptr, nullptr); + &dh, "PEM", nullptr, "DH", OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS, + nullptr, nullptr); if (!OSSL_DECODER_from_bio(dctx, bio)) { std::cerr << "OSSL_DECODER_from_bio() failed: " @@ -2233,19 +2219,23 @@ int HttpServer::run() { if (config_->verify_client) { SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE | - SSL_VERIFY_FAIL_IF_NO_PEER_CERT, + SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_callback); } next_proto = util::get_default_alpn(); -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, &next_proto); -#endif // !OPENSSL_NO_NEXTPROTONEG -#if OPENSSL_VERSION_NUMBER >= 0x10002000L // ALPN selection callback SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, this); -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L + +#if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI) + if (!SSL_CTX_add_cert_compression_alg( + ssl_ctx, nghttp2::tls::CERTIFICATE_COMPRESSION_ALGO_BROTLI, + nghttp2::tls::cert_compress, nghttp2::tls::cert_decompress)) { + std::cerr << "SSL_CTX_add_cert_compression_alg failed." << std::endl; + return -1; + } +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI } auto loop = EV_DEFAULT; @@ -2260,6 +2250,9 @@ int HttpServer::run() { } ev_run(loop, 0); + + SSL_CTX_free(ssl_ctx); + return 0; } diff --git a/lib/nghttp2/src/HttpServer.h b/lib/nghttp2-1.65.0/src/HttpServer.h similarity index 85% rename from lib/nghttp2/src/HttpServer.h rename to lib/nghttp2-1.65.0/src/HttpServer.h index f825b83e338..a4d581e3ee5 100644 --- a/lib/nghttp2/src/HttpServer.h +++ b/lib/nghttp2-1.65.0/src/HttpServer.h @@ -37,10 +37,18 @@ #include #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include +#define NGHTTP2_NO_SSIZE_T #include #include "http2.h" @@ -83,7 +91,6 @@ struct Config { bool echo_upload; bool no_content_length; bool ktls; - bool no_rfc7540_pri; Config(); ~Config(); }; @@ -95,16 +102,16 @@ struct FileEntry { const std::string *content_type, const std::chrono::steady_clock::time_point &last_valid, bool stale = false) - : path(std::move(path)), - length(length), - mtime(mtime), - last_valid(last_valid), - content_type(content_type), - dlnext(nullptr), - dlprev(nullptr), - fd(fd), - usecount(1), - stale(stale) {} + : path(std::move(path)), + length(length), + mtime(mtime), + last_valid(last_valid), + content_type(content_type), + dlnext(nullptr), + dlprev(nullptr), + fd(fd), + usecount(1), + stale(stale) {} std::string path; std::multimap>::iterator it; int64_t length; @@ -167,19 +174,19 @@ class Http2Handler { int on_read(); int on_write(); int connection_made(); - int verify_npn_result(); + int verify_alpn_result(); int submit_file_response(const StringRef &status, Stream *stream, time_t last_modified, off_t file_length, const std::string *content_type, - nghttp2_data_provider *data_prd); + nghttp2_data_provider2 *data_prd); int submit_response(const StringRef &status, int32_t stream_id, - nghttp2_data_provider *data_prd); + nghttp2_data_provider2 *data_prd); int submit_response(const StringRef &status, int32_t stream_id, const HeaderRefs &headers, - nghttp2_data_provider *data_prd); + nghttp2_data_provider2 *data_prd); int submit_non_final_response(const std::string &status, int32_t stream_id); @@ -244,9 +251,10 @@ class HttpServer { const Config *config_; }; -ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t length, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data); +nghttp2_ssize file_read_callback(nghttp2_session *session, int32_t stream_id, + uint8_t *buf, size_t length, + uint32_t *data_flags, + nghttp2_data_source *source, void *user_data); } // namespace nghttp2 diff --git a/lib/nghttp2/src/Makefile.am b/lib/nghttp2-1.65.0/src/Makefile.am similarity index 92% rename from lib/nghttp2/src/Makefile.am rename to lib/nghttp2-1.65.0/src/Makefile.am index f112ac2cbcb..97ee184d455 100644 --- a/lib/nghttp2/src/Makefile.am +++ b/lib/nghttp2-1.65.0/src/Makefile.am @@ -39,40 +39,48 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/includes \ -I$(top_builddir)/lib/includes \ -I$(top_srcdir)/lib \ - -I$(top_srcdir)/third-party \ + -I$(top_srcdir)/third-party/urlparse \ -I$(top_srcdir)/third-party/llhttp/include \ @JEMALLOC_CFLAGS@ \ @LIBXML2_CFLAGS@ \ @LIBEV_CFLAGS@ \ @LIBNGHTTP3_CFLAGS@ \ + @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ \ @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ \ @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ \ @LIBNGTCP2_CFLAGS@ \ + @WOLFSSL_CFLAGS@ \ @OPENSSL_CFLAGS@ \ @LIBCARES_CFLAGS@ \ @JANSSON_CFLAGS@ \ @LIBBPF_CFLAGS@ \ @ZLIB_CFLAGS@ \ + @LIBBROTLIENC_CFLAGS@ \ + @LIBBROTLIDEC_CFLAGS@ \ @EXTRA_DEFS@ \ @DEFS@ AM_LDFLAGS = @LIBTOOL_LDFLAGS@ LDADD = $(top_builddir)/lib/libnghttp2.la \ - $(top_builddir)/third-party/liburl-parser.la \ + $(top_builddir)/third-party/liburlparse.la \ $(top_builddir)/third-party/libllhttp.la \ @JEMALLOC_LIBS@ \ @LIBXML2_LIBS@ \ @LIBEV_LIBS@ \ @LIBNGHTTP3_LIBS@ \ + @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ \ @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ \ @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ \ @LIBNGTCP2_LIBS@ \ + @WOLFSSL_LIBS@ \ @OPENSSL_LIBS@ \ @LIBCARES_LIBS@ \ @SYSTEMD_LIBS@ \ @JANSSON_LIBS@ \ @LIBBPF_LIBS@ \ @ZLIB_LIBS@ \ + @LIBBROTLIENC_LIBS@ \ + @LIBBROTLIDEC_LIBS@ \ @APPLDFLAGS@ if ENABLE_APP @@ -181,7 +189,8 @@ NGHTTPX_SRCS += \ shrpx_quic_connection_handler.cc shrpx_quic_connection_handler.h \ shrpx_http3_upstream.cc shrpx_http3_upstream.h \ http3.cc http3.h \ - quic.cc quic.h + quic.cc quic.h \ + siphash.cc siphash.h endif # ENABLE_HTTP3 noinst_LIBRARIES = libnghttpx.a @@ -203,7 +212,6 @@ libnghttpx_a_CPPFLAGS += -I${top_srcdir}/third-party/neverbleed nghttpx_LDADD += ${top_builddir}/third-party/libneverbleed.la endif # HAVE_NEVERBLEED -if HAVE_CUNIT check_PROGRAMS += nghttpx-unittest nghttpx_unittest_SOURCES = shrpx-unittest.cc \ shrpx_tls_test.cc shrpx_tls_test.h \ @@ -219,10 +227,16 @@ nghttpx_unittest_SOURCES = shrpx-unittest.cc \ buffer_test.cc buffer_test.h \ memchunk_test.cc memchunk_test.h \ template_test.cc template_test.h \ - base64_test.cc base64_test.h + base64_test.cc base64_test.h \ + $(top_srcdir)/tests/munit/munit.c $(top_srcdir)/tests/munit/munit.h \ + $(top_srcdir)/tests/munit/munitxx.h +if ENABLE_HTTP3 +nghttpx_unittest_SOURCES += siphash_test.cc siphash_test.h +endif # ENABLE_HTTP3 nghttpx_unittest_CPPFLAGS = ${AM_CPPFLAGS} \ + -I$(top_srcdir)/tests/munit \ -DNGHTTP2_SRC_DIR=\"$(top_srcdir)/src\" -nghttpx_unittest_LDADD = libnghttpx.a ${LDADD} @CUNIT_LIBS@ @TESTLDADD@ +nghttpx_unittest_LDADD = libnghttpx.a ${LDADD} @TESTLDADD@ if HAVE_MRUBY nghttpx_unittest_CPPFLAGS += \ @@ -237,7 +251,6 @@ nghttpx_unittest_LDADD += ${top_builddir}/third-party/libneverbleed.la endif # HAVE_NEVERBLEED TESTS += nghttpx-unittest -endif # HAVE_CUNIT endif # ENABLE_APP diff --git a/lib/nghttp2-1.65.0/src/Makefile.in b/lib/nghttp2-1.65.0/src/Makefile.in new file mode 100644 index 00000000000..e6f04cad98c --- /dev/null +++ b/lib/nghttp2-1.65.0/src/Makefile.in @@ -0,0 +1,3129 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2012 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) +check_PROGRAMS = $(am__EXEEXT_3) +TESTS = $(am__EXEEXT_3) +@ENABLE_APP_TRUE@am__append_1 = nghttp nghttpd nghttpx h2load +@ENABLE_APP_TRUE@@HAVE_LIBXML2_TRUE@am__append_2 = HtmlParser.cc +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@am__append_3 = \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ h2load_http3_session.cc h2load_http3_session.h \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ h2load_quic.cc h2load_quic.h \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ quic.cc quic.h + +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@am__append_4 = \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ shrpx_mruby.cc shrpx_mruby.h \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ shrpx_mruby_module.cc shrpx_mruby_module.h \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ shrpx_mruby_module_env.cc shrpx_mruby_module_env.h \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ shrpx_mruby_module_request.cc shrpx_mruby_module_request.h \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ shrpx_mruby_module_response.cc shrpx_mruby_module_response.h + +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@am__append_5 = \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ shrpx_quic.cc shrpx_quic.h \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ shrpx_quic_listener.cc shrpx_quic_listener.h \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ shrpx_quic_connection_handler.cc shrpx_quic_connection_handler.h \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ shrpx_http3_upstream.cc shrpx_http3_upstream.h \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ http3.cc http3.h \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ quic.cc quic.h \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ siphash.cc siphash.h + +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@am__append_6 = \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ -I${top_srcdir}/third-party/mruby/include @LIBMRUBY_CFLAGS@ + +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@am__append_7 = -L${top_builddir}/third-party/mruby/build/lib @LIBMRUBY_LIBS@ +@ENABLE_APP_TRUE@@HAVE_NEVERBLEED_TRUE@am__append_8 = -I${top_srcdir}/third-party/neverbleed +@ENABLE_APP_TRUE@@HAVE_NEVERBLEED_TRUE@am__append_9 = ${top_builddir}/third-party/libneverbleed.la +@ENABLE_APP_TRUE@am__append_10 = nghttpx-unittest +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@am__append_11 = siphash_test.cc siphash_test.h +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@am__append_12 = \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ -I${top_srcdir}/third-party/mruby/include @LIBMRUBY_CFLAGS@ + +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@am__append_13 = \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ -L${top_builddir}/third-party/mruby/build/lib @LIBMRUBY_LIBS@ + +@ENABLE_APP_TRUE@@HAVE_NEVERBLEED_TRUE@am__append_14 = -I${top_srcdir}/third-party/neverbleed +@ENABLE_APP_TRUE@@HAVE_NEVERBLEED_TRUE@am__append_15 = ${top_builddir}/third-party/libneverbleed.la +@ENABLE_APP_TRUE@am__append_16 = nghttpx-unittest +@ENABLE_HPACK_TOOLS_TRUE@am__append_17 = inflatehd deflatehd +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@ENABLE_APP_TRUE@am__EXEEXT_1 = nghttp$(EXEEXT) nghttpd$(EXEEXT) \ +@ENABLE_APP_TRUE@ nghttpx$(EXEEXT) h2load$(EXEEXT) +@ENABLE_HPACK_TOOLS_TRUE@am__EXEEXT_2 = inflatehd$(EXEEXT) \ +@ENABLE_HPACK_TOOLS_TRUE@ deflatehd$(EXEEXT) +am__installdirs = "$(DESTDIR)$(bindir)" +@ENABLE_APP_TRUE@am__EXEEXT_3 = nghttpx-unittest$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libnghttpx_a_AR = $(AR) $(ARFLAGS) +libnghttpx_a_LIBADD = +am__libnghttpx_a_SOURCES_DIST = util.cc util.h http2.cc http2.h \ + timegm.c timegm.h base64.h app_helper.cc app_helper.h tls.cc \ + tls.h ssl_compat.h shrpx_config.cc shrpx_config.h \ + shrpx_error.h shrpx_accept_handler.cc shrpx_accept_handler.h \ + shrpx_connection_handler.cc shrpx_connection_handler.h \ + shrpx_client_handler.cc shrpx_client_handler.h \ + shrpx_upstream.h shrpx_http2_upstream.cc \ + shrpx_http2_upstream.h shrpx_https_upstream.cc \ + shrpx_https_upstream.h shrpx_downstream.cc shrpx_downstream.h \ + shrpx_downstream_connection.cc shrpx_downstream_connection.h \ + shrpx_http_downstream_connection.cc \ + shrpx_http_downstream_connection.h \ + shrpx_http2_downstream_connection.cc \ + shrpx_http2_downstream_connection.h shrpx_http2_session.cc \ + shrpx_http2_session.h shrpx_downstream_queue.cc \ + shrpx_downstream_queue.h shrpx_log.cc shrpx_log.h \ + shrpx_http.cc shrpx_http.h shrpx_io_control.cc \ + shrpx_io_control.h shrpx_tls.cc shrpx_tls.h shrpx_worker.cc \ + shrpx_worker.h shrpx_log_config.cc shrpx_log_config.h \ + shrpx_connect_blocker.cc shrpx_connect_blocker.h \ + shrpx_live_check.cc shrpx_live_check.h \ + shrpx_downstream_connection_pool.cc \ + shrpx_downstream_connection_pool.h shrpx_rate_limit.cc \ + shrpx_rate_limit.h shrpx_connection.cc shrpx_connection.h \ + shrpx_memcached_dispatcher.cc shrpx_memcached_dispatcher.h \ + shrpx_memcached_connection.cc shrpx_memcached_connection.h \ + shrpx_memcached_request.h shrpx_memcached_result.h \ + shrpx_worker_process.cc shrpx_worker_process.h shrpx_process.h \ + shrpx_signal.cc shrpx_signal.h shrpx_router.cc shrpx_router.h \ + shrpx_api_downstream_connection.cc \ + shrpx_api_downstream_connection.h \ + shrpx_health_monitor_downstream_connection.cc \ + shrpx_health_monitor_downstream_connection.h \ + shrpx_null_downstream_connection.cc \ + shrpx_null_downstream_connection.h shrpx_exec.cc shrpx_exec.h \ + shrpx_dns_resolver.cc shrpx_dns_resolver.h \ + shrpx_dual_dns_resolver.cc shrpx_dual_dns_resolver.h \ + shrpx_dns_tracker.cc shrpx_dns_tracker.h buffer.h memchunk.h \ + template.h allocator.h xsi_strerror.c xsi_strerror.h \ + shrpx_mruby.cc shrpx_mruby.h shrpx_mruby_module.cc \ + shrpx_mruby_module.h shrpx_mruby_module_env.cc \ + shrpx_mruby_module_env.h shrpx_mruby_module_request.cc \ + shrpx_mruby_module_request.h shrpx_mruby_module_response.cc \ + shrpx_mruby_module_response.h shrpx_quic.cc shrpx_quic.h \ + shrpx_quic_listener.cc shrpx_quic_listener.h \ + shrpx_quic_connection_handler.cc \ + shrpx_quic_connection_handler.h shrpx_http3_upstream.cc \ + shrpx_http3_upstream.h http3.cc http3.h quic.cc quic.h \ + siphash.cc siphash.h +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@am__objects_1 = libnghttpx_a-shrpx_mruby.$(OBJEXT) \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ libnghttpx_a-shrpx_mruby_module.$(OBJEXT) \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ libnghttpx_a-shrpx_mruby_module_env.$(OBJEXT) \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ libnghttpx_a-shrpx_mruby_module_request.$(OBJEXT) \ +@ENABLE_APP_TRUE@@HAVE_MRUBY_TRUE@ libnghttpx_a-shrpx_mruby_module_response.$(OBJEXT) +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@am__objects_2 = libnghttpx_a-shrpx_quic.$(OBJEXT) \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ libnghttpx_a-shrpx_quic_listener.$(OBJEXT) \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ libnghttpx_a-shrpx_quic_connection_handler.$(OBJEXT) \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ libnghttpx_a-shrpx_http3_upstream.$(OBJEXT) \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ libnghttpx_a-http3.$(OBJEXT) \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ libnghttpx_a-quic.$(OBJEXT) \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ libnghttpx_a-siphash.$(OBJEXT) +@ENABLE_APP_TRUE@am__objects_3 = libnghttpx_a-util.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-http2.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-timegm.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-app_helper.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-tls.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_config.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_accept_handler.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_connection_handler.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_client_handler.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_http2_upstream.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_https_upstream.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_downstream.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_downstream_connection.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_http_downstream_connection.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_http2_downstream_connection.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_http2_session.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_downstream_queue.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_log.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_http.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_io_control.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_tls.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_worker.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_log_config.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_connect_blocker.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_live_check.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_downstream_connection_pool.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_rate_limit.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_connection.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_memcached_dispatcher.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_memcached_connection.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_worker_process.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_signal.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_router.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_api_downstream_connection.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_health_monitor_downstream_connection.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_null_downstream_connection.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_exec.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_dns_resolver.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_dual_dns_resolver.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-shrpx_dns_tracker.$(OBJEXT) \ +@ENABLE_APP_TRUE@ libnghttpx_a-xsi_strerror.$(OBJEXT) \ +@ENABLE_APP_TRUE@ $(am__objects_1) $(am__objects_2) +@ENABLE_APP_TRUE@am_libnghttpx_a_OBJECTS = $(am__objects_3) +libnghttpx_a_OBJECTS = $(am_libnghttpx_a_OBJECTS) +am__deflatehd_SOURCES_DIST = deflatehd.cc comp_helper.c comp_helper.h \ + util.cc util.h timegm.c timegm.h +@ENABLE_HPACK_TOOLS_TRUE@am__objects_4 = comp_helper.$(OBJEXT) \ +@ENABLE_HPACK_TOOLS_TRUE@ util.$(OBJEXT) timegm.$(OBJEXT) +@ENABLE_HPACK_TOOLS_TRUE@am_deflatehd_OBJECTS = deflatehd.$(OBJEXT) \ +@ENABLE_HPACK_TOOLS_TRUE@ $(am__objects_4) +deflatehd_OBJECTS = $(am_deflatehd_OBJECTS) +deflatehd_LDADD = $(LDADD) +deflatehd_DEPENDENCIES = $(top_builddir)/lib/libnghttp2.la \ + $(top_builddir)/third-party/liburlparse.la \ + $(top_builddir)/third-party/libllhttp.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am__h2load_SOURCES_DIST = util.cc util.h http2.cc http2.h h2load.cc \ + h2load.h timegm.c timegm.h tls.cc tls.h ssl_compat.h \ + h2load_session.h h2load_http2_session.cc \ + h2load_http2_session.h h2load_http1_session.cc \ + h2load_http1_session.h h2load_http3_session.cc \ + h2load_http3_session.h h2load_quic.cc h2load_quic.h quic.cc \ + quic.h +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@am__objects_5 = h2load_http3_session.$(OBJEXT) \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ h2load_quic.$(OBJEXT) \ +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@ quic.$(OBJEXT) +@ENABLE_APP_TRUE@am_h2load_OBJECTS = util.$(OBJEXT) http2.$(OBJEXT) \ +@ENABLE_APP_TRUE@ h2load.$(OBJEXT) timegm.$(OBJEXT) \ +@ENABLE_APP_TRUE@ tls.$(OBJEXT) h2load_http2_session.$(OBJEXT) \ +@ENABLE_APP_TRUE@ h2load_http1_session.$(OBJEXT) \ +@ENABLE_APP_TRUE@ $(am__objects_5) +h2load_OBJECTS = $(am_h2load_OBJECTS) +h2load_LDADD = $(LDADD) +h2load_DEPENDENCIES = $(top_builddir)/lib/libnghttp2.la \ + $(top_builddir)/third-party/liburlparse.la \ + $(top_builddir)/third-party/libllhttp.la +am__inflatehd_SOURCES_DIST = inflatehd.cc comp_helper.c comp_helper.h \ + util.cc util.h timegm.c timegm.h +@ENABLE_HPACK_TOOLS_TRUE@am_inflatehd_OBJECTS = inflatehd.$(OBJEXT) \ +@ENABLE_HPACK_TOOLS_TRUE@ $(am__objects_4) +inflatehd_OBJECTS = $(am_inflatehd_OBJECTS) +inflatehd_LDADD = $(LDADD) +inflatehd_DEPENDENCIES = $(top_builddir)/lib/libnghttp2.la \ + $(top_builddir)/third-party/liburlparse.la \ + $(top_builddir)/third-party/libllhttp.la +am__nghttp_SOURCES_DIST = util.cc http2.cc timegm.c app_helper.cc \ + nghttp2_gzip.c util.h http2.h timegm.h app_helper.h \ + nghttp2_config.h nghttp2_gzip.h network.h nghttp.cc nghttp.h \ + HtmlParser.cc HtmlParser.h tls.cc tls.h ssl_compat.h +@ENABLE_APP_TRUE@am__objects_6 = util.$(OBJEXT) http2.$(OBJEXT) \ +@ENABLE_APP_TRUE@ timegm.$(OBJEXT) app_helper.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttp2_gzip.$(OBJEXT) +am__objects_7 = +@ENABLE_APP_TRUE@@HAVE_LIBXML2_TRUE@am__objects_8 = \ +@ENABLE_APP_TRUE@@HAVE_LIBXML2_TRUE@ HtmlParser.$(OBJEXT) +@ENABLE_APP_TRUE@am__objects_9 = $(am__objects_8) +@ENABLE_APP_TRUE@am_nghttp_OBJECTS = $(am__objects_6) $(am__objects_7) \ +@ENABLE_APP_TRUE@ nghttp.$(OBJEXT) $(am__objects_9) \ +@ENABLE_APP_TRUE@ $(am__objects_7) tls.$(OBJEXT) +nghttp_OBJECTS = $(am_nghttp_OBJECTS) +nghttp_LDADD = $(LDADD) +nghttp_DEPENDENCIES = $(top_builddir)/lib/libnghttp2.la \ + $(top_builddir)/third-party/liburlparse.la \ + $(top_builddir)/third-party/libllhttp.la +am__nghttpd_SOURCES_DIST = util.cc http2.cc timegm.c app_helper.cc \ + nghttp2_gzip.c util.h http2.h timegm.h app_helper.h \ + nghttp2_config.h nghttp2_gzip.h network.h nghttpd.cc tls.cc \ + tls.h ssl_compat.h HttpServer.cc HttpServer.h +@ENABLE_APP_TRUE@am_nghttpd_OBJECTS = $(am__objects_6) \ +@ENABLE_APP_TRUE@ $(am__objects_7) nghttpd.$(OBJEXT) \ +@ENABLE_APP_TRUE@ tls.$(OBJEXT) HttpServer.$(OBJEXT) +nghttpd_OBJECTS = $(am_nghttpd_OBJECTS) +nghttpd_LDADD = $(LDADD) +nghttpd_DEPENDENCIES = $(top_builddir)/lib/libnghttp2.la \ + $(top_builddir)/third-party/liburlparse.la \ + $(top_builddir)/third-party/libllhttp.la +am__nghttpx_SOURCES_DIST = shrpx.cc shrpx.h +@ENABLE_APP_TRUE@am_nghttpx_OBJECTS = nghttpx-shrpx.$(OBJEXT) +nghttpx_OBJECTS = $(am_nghttpx_OBJECTS) +am__DEPENDENCIES_1 = $(top_builddir)/lib/libnghttp2.la \ + $(top_builddir)/third-party/liburlparse.la \ + $(top_builddir)/third-party/libllhttp.la +am__DEPENDENCIES_2 = +@ENABLE_APP_TRUE@nghttpx_DEPENDENCIES = libnghttpx.a \ +@ENABLE_APP_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ +@ENABLE_APP_TRUE@ $(am__append_9) +am__nghttpx_unittest_SOURCES_DIST = shrpx-unittest.cc \ + shrpx_tls_test.cc shrpx_tls_test.h shrpx_downstream_test.cc \ + shrpx_downstream_test.h shrpx_config_test.cc \ + shrpx_config_test.h shrpx_worker_test.cc shrpx_worker_test.h \ + shrpx_http_test.cc shrpx_http_test.h shrpx_router_test.cc \ + shrpx_router_test.h http2_test.cc http2_test.h util_test.cc \ + util_test.h nghttp2_gzip_test.c nghttp2_gzip_test.h \ + nghttp2_gzip.c nghttp2_gzip.h buffer_test.cc buffer_test.h \ + memchunk_test.cc memchunk_test.h template_test.cc \ + template_test.h base64_test.cc base64_test.h \ + $(top_srcdir)/tests/munit/munit.c \ + $(top_srcdir)/tests/munit/munit.h \ + $(top_srcdir)/tests/munit/munitxx.h siphash_test.cc \ + siphash_test.h +am__dirstamp = $(am__leading_dot)dirstamp +@ENABLE_APP_TRUE@@ENABLE_HTTP3_TRUE@am__objects_10 = nghttpx_unittest-siphash_test.$(OBJEXT) +@ENABLE_APP_TRUE@am_nghttpx_unittest_OBJECTS = \ +@ENABLE_APP_TRUE@ nghttpx_unittest-shrpx-unittest.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-shrpx_tls_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-shrpx_downstream_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-shrpx_config_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-shrpx_worker_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-shrpx_http_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-shrpx_router_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-http2_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-util_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-nghttp2_gzip_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-nghttp2_gzip.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-buffer_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-memchunk_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-template_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ nghttpx_unittest-base64_test.$(OBJEXT) \ +@ENABLE_APP_TRUE@ $(top_builddir)/tests/munit/nghttpx_unittest-munit.$(OBJEXT) \ +@ENABLE_APP_TRUE@ $(am__objects_10) +nghttpx_unittest_OBJECTS = $(am_nghttpx_unittest_OBJECTS) +@ENABLE_APP_TRUE@nghttpx_unittest_DEPENDENCIES = libnghttpx.a \ +@ENABLE_APP_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ +@ENABLE_APP_TRUE@ $(am__append_15) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = $(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Po \ + ./$(DEPDIR)/HtmlParser.Po ./$(DEPDIR)/HttpServer.Po \ + ./$(DEPDIR)/app_helper.Po ./$(DEPDIR)/comp_helper.Po \ + ./$(DEPDIR)/deflatehd.Po ./$(DEPDIR)/h2load.Po \ + ./$(DEPDIR)/h2load_http1_session.Po \ + ./$(DEPDIR)/h2load_http2_session.Po \ + ./$(DEPDIR)/h2load_http3_session.Po ./$(DEPDIR)/h2load_quic.Po \ + ./$(DEPDIR)/http2.Po ./$(DEPDIR)/inflatehd.Po \ + ./$(DEPDIR)/libnghttpx_a-app_helper.Po \ + ./$(DEPDIR)/libnghttpx_a-http2.Po \ + ./$(DEPDIR)/libnghttpx_a-http3.Po \ + ./$(DEPDIR)/libnghttpx_a-quic.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_client_handler.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_config.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_connection.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_downstream.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_exec.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_http.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_http2_session.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_io_control.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_live_check.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_log.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_log_config.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_mruby.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_quic.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_router.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_signal.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_tls.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_worker.Po \ + ./$(DEPDIR)/libnghttpx_a-shrpx_worker_process.Po \ + ./$(DEPDIR)/libnghttpx_a-siphash.Po \ + ./$(DEPDIR)/libnghttpx_a-timegm.Po \ + ./$(DEPDIR)/libnghttpx_a-tls.Po \ + ./$(DEPDIR)/libnghttpx_a-util.Po \ + ./$(DEPDIR)/libnghttpx_a-xsi_strerror.Po ./$(DEPDIR)/nghttp.Po \ + ./$(DEPDIR)/nghttp2_gzip.Po ./$(DEPDIR)/nghttpd.Po \ + ./$(DEPDIR)/nghttpx-shrpx.Po \ + ./$(DEPDIR)/nghttpx_unittest-base64_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-buffer_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-http2_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-memchunk_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Po \ + ./$(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-shrpx-unittest.Po \ + ./$(DEPDIR)/nghttpx_unittest-shrpx_config_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-shrpx_http_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-shrpx_router_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-siphash_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-template_test.Po \ + ./$(DEPDIR)/nghttpx_unittest-util_test.Po ./$(DEPDIR)/quic.Po \ + ./$(DEPDIR)/timegm.Po ./$(DEPDIR)/tls.Po ./$(DEPDIR)/util.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libnghttpx_a_SOURCES) $(deflatehd_SOURCES) \ + $(h2load_SOURCES) $(inflatehd_SOURCES) $(nghttp_SOURCES) \ + $(nghttpd_SOURCES) $(nghttpx_SOURCES) \ + $(nghttpx_unittest_SOURCES) +DIST_SOURCES = $(am__libnghttpx_a_SOURCES_DIST) \ + $(am__deflatehd_SOURCES_DIST) $(am__h2load_SOURCES_DIST) \ + $(am__inflatehd_SOURCES_DIST) $(am__nghttp_SOURCES_DIST) \ + $(am__nghttpd_SOURCES_DIST) $(am__nghttpx_SOURCES_DIST) \ + $(am__nghttpx_unittest_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + check recheck distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +SUBDIRS = testdata +EXTRA_DIST = \ + CMakeLists.txt \ + test.example.com.pem \ + test.nghttp2.org.pem + +AM_CFLAGS = $(WARNCFLAGS) +AM_CXXFLAGS = $(WARNCXXFLAGS) $(CXX1XCXXFLAGS) +AM_CPPFLAGS = \ + -DPKGDATADIR='"$(pkgdatadir)"' \ + -DPKGLIBDIR='"$(pkglibdir)"' \ + -I$(top_srcdir)/lib/includes \ + -I$(top_builddir)/lib/includes \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/third-party/urlparse \ + -I$(top_srcdir)/third-party/llhttp/include \ + @JEMALLOC_CFLAGS@ \ + @LIBXML2_CFLAGS@ \ + @LIBEV_CFLAGS@ \ + @LIBNGHTTP3_CFLAGS@ \ + @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ \ + @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ \ + @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ \ + @LIBNGTCP2_CFLAGS@ \ + @WOLFSSL_CFLAGS@ \ + @OPENSSL_CFLAGS@ \ + @LIBCARES_CFLAGS@ \ + @JANSSON_CFLAGS@ \ + @LIBBPF_CFLAGS@ \ + @ZLIB_CFLAGS@ \ + @LIBBROTLIENC_CFLAGS@ \ + @LIBBROTLIDEC_CFLAGS@ \ + @EXTRA_DEFS@ \ + @DEFS@ + +AM_LDFLAGS = @LIBTOOL_LDFLAGS@ +LDADD = $(top_builddir)/lib/libnghttp2.la \ + $(top_builddir)/third-party/liburlparse.la \ + $(top_builddir)/third-party/libllhttp.la \ + @JEMALLOC_LIBS@ \ + @LIBXML2_LIBS@ \ + @LIBEV_LIBS@ \ + @LIBNGHTTP3_LIBS@ \ + @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ \ + @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ \ + @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ \ + @LIBNGTCP2_LIBS@ \ + @WOLFSSL_LIBS@ \ + @OPENSSL_LIBS@ \ + @LIBCARES_LIBS@ \ + @SYSTEMD_LIBS@ \ + @JANSSON_LIBS@ \ + @LIBBPF_LIBS@ \ + @ZLIB_LIBS@ \ + @LIBBROTLIENC_LIBS@ \ + @LIBBROTLIDEC_LIBS@ \ + @APPLDFLAGS@ + +@ENABLE_APP_TRUE@HELPER_OBJECTS = util.cc \ +@ENABLE_APP_TRUE@ http2.cc timegm.c app_helper.cc nghttp2_gzip.c + +@ENABLE_APP_TRUE@HELPER_HFILES = util.h \ +@ENABLE_APP_TRUE@ http2.h timegm.h app_helper.h nghttp2_config.h \ +@ENABLE_APP_TRUE@ nghttp2_gzip.h network.h + +@ENABLE_APP_TRUE@HTML_PARSER_OBJECTS = $(am__append_2) +@ENABLE_APP_TRUE@HTML_PARSER_HFILES = HtmlParser.h +@ENABLE_APP_TRUE@nghttp_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttp.cc nghttp.h \ +@ENABLE_APP_TRUE@ ${HTML_PARSER_OBJECTS} ${HTML_PARSER_HFILES} \ +@ENABLE_APP_TRUE@ tls.cc tls.h ssl_compat.h + +@ENABLE_APP_TRUE@nghttpd_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttpd.cc \ +@ENABLE_APP_TRUE@ tls.cc tls.h ssl_compat.h \ +@ENABLE_APP_TRUE@ HttpServer.cc HttpServer.h + +@ENABLE_APP_TRUE@h2load_SOURCES = util.cc util.h http2.cc http2.h \ +@ENABLE_APP_TRUE@ h2load.cc h2load.h timegm.c timegm.h tls.cc \ +@ENABLE_APP_TRUE@ tls.h ssl_compat.h h2load_session.h \ +@ENABLE_APP_TRUE@ h2load_http2_session.cc \ +@ENABLE_APP_TRUE@ h2load_http2_session.h \ +@ENABLE_APP_TRUE@ h2load_http1_session.cc \ +@ENABLE_APP_TRUE@ h2load_http1_session.h $(am__append_3) +@ENABLE_APP_TRUE@NGHTTPX_SRCS = util.cc util.h http2.cc http2.h \ +@ENABLE_APP_TRUE@ timegm.c timegm.h base64.h app_helper.cc \ +@ENABLE_APP_TRUE@ app_helper.h tls.cc tls.h ssl_compat.h \ +@ENABLE_APP_TRUE@ shrpx_config.cc shrpx_config.h shrpx_error.h \ +@ENABLE_APP_TRUE@ shrpx_accept_handler.cc \ +@ENABLE_APP_TRUE@ shrpx_accept_handler.h \ +@ENABLE_APP_TRUE@ shrpx_connection_handler.cc \ +@ENABLE_APP_TRUE@ shrpx_connection_handler.h \ +@ENABLE_APP_TRUE@ shrpx_client_handler.cc \ +@ENABLE_APP_TRUE@ shrpx_client_handler.h shrpx_upstream.h \ +@ENABLE_APP_TRUE@ shrpx_http2_upstream.cc \ +@ENABLE_APP_TRUE@ shrpx_http2_upstream.h \ +@ENABLE_APP_TRUE@ shrpx_https_upstream.cc \ +@ENABLE_APP_TRUE@ shrpx_https_upstream.h shrpx_downstream.cc \ +@ENABLE_APP_TRUE@ shrpx_downstream.h \ +@ENABLE_APP_TRUE@ shrpx_downstream_connection.cc \ +@ENABLE_APP_TRUE@ shrpx_downstream_connection.h \ +@ENABLE_APP_TRUE@ shrpx_http_downstream_connection.cc \ +@ENABLE_APP_TRUE@ shrpx_http_downstream_connection.h \ +@ENABLE_APP_TRUE@ shrpx_http2_downstream_connection.cc \ +@ENABLE_APP_TRUE@ shrpx_http2_downstream_connection.h \ +@ENABLE_APP_TRUE@ shrpx_http2_session.cc shrpx_http2_session.h \ +@ENABLE_APP_TRUE@ shrpx_downstream_queue.cc \ +@ENABLE_APP_TRUE@ shrpx_downstream_queue.h shrpx_log.cc \ +@ENABLE_APP_TRUE@ shrpx_log.h shrpx_http.cc shrpx_http.h \ +@ENABLE_APP_TRUE@ shrpx_io_control.cc shrpx_io_control.h \ +@ENABLE_APP_TRUE@ shrpx_tls.cc shrpx_tls.h shrpx_worker.cc \ +@ENABLE_APP_TRUE@ shrpx_worker.h shrpx_log_config.cc \ +@ENABLE_APP_TRUE@ shrpx_log_config.h shrpx_connect_blocker.cc \ +@ENABLE_APP_TRUE@ shrpx_connect_blocker.h shrpx_live_check.cc \ +@ENABLE_APP_TRUE@ shrpx_live_check.h \ +@ENABLE_APP_TRUE@ shrpx_downstream_connection_pool.cc \ +@ENABLE_APP_TRUE@ shrpx_downstream_connection_pool.h \ +@ENABLE_APP_TRUE@ shrpx_rate_limit.cc shrpx_rate_limit.h \ +@ENABLE_APP_TRUE@ shrpx_connection.cc shrpx_connection.h \ +@ENABLE_APP_TRUE@ shrpx_memcached_dispatcher.cc \ +@ENABLE_APP_TRUE@ shrpx_memcached_dispatcher.h \ +@ENABLE_APP_TRUE@ shrpx_memcached_connection.cc \ +@ENABLE_APP_TRUE@ shrpx_memcached_connection.h \ +@ENABLE_APP_TRUE@ shrpx_memcached_request.h \ +@ENABLE_APP_TRUE@ shrpx_memcached_result.h \ +@ENABLE_APP_TRUE@ shrpx_worker_process.cc \ +@ENABLE_APP_TRUE@ shrpx_worker_process.h shrpx_process.h \ +@ENABLE_APP_TRUE@ shrpx_signal.cc shrpx_signal.h \ +@ENABLE_APP_TRUE@ shrpx_router.cc shrpx_router.h \ +@ENABLE_APP_TRUE@ shrpx_api_downstream_connection.cc \ +@ENABLE_APP_TRUE@ shrpx_api_downstream_connection.h \ +@ENABLE_APP_TRUE@ shrpx_health_monitor_downstream_connection.cc \ +@ENABLE_APP_TRUE@ shrpx_health_monitor_downstream_connection.h \ +@ENABLE_APP_TRUE@ shrpx_null_downstream_connection.cc \ +@ENABLE_APP_TRUE@ shrpx_null_downstream_connection.h \ +@ENABLE_APP_TRUE@ shrpx_exec.cc shrpx_exec.h \ +@ENABLE_APP_TRUE@ shrpx_dns_resolver.cc shrpx_dns_resolver.h \ +@ENABLE_APP_TRUE@ shrpx_dual_dns_resolver.cc \ +@ENABLE_APP_TRUE@ shrpx_dual_dns_resolver.h \ +@ENABLE_APP_TRUE@ shrpx_dns_tracker.cc shrpx_dns_tracker.h \ +@ENABLE_APP_TRUE@ buffer.h memchunk.h template.h allocator.h \ +@ENABLE_APP_TRUE@ xsi_strerror.c xsi_strerror.h $(am__append_4) \ +@ENABLE_APP_TRUE@ $(am__append_5) +@ENABLE_APP_TRUE@noinst_LIBRARIES = libnghttpx.a +@ENABLE_APP_TRUE@libnghttpx_a_SOURCES = ${NGHTTPX_SRCS} +@ENABLE_APP_TRUE@libnghttpx_a_CPPFLAGS = ${AM_CPPFLAGS} \ +@ENABLE_APP_TRUE@ $(am__append_6) $(am__append_8) +@ENABLE_APP_TRUE@nghttpx_SOURCES = shrpx.cc shrpx.h +@ENABLE_APP_TRUE@nghttpx_CPPFLAGS = ${libnghttpx_a_CPPFLAGS} +@ENABLE_APP_TRUE@nghttpx_LDADD = libnghttpx.a ${LDADD} $(am__append_7) \ +@ENABLE_APP_TRUE@ $(am__append_9) +@ENABLE_APP_TRUE@nghttpx_unittest_SOURCES = shrpx-unittest.cc \ +@ENABLE_APP_TRUE@ shrpx_tls_test.cc shrpx_tls_test.h \ +@ENABLE_APP_TRUE@ shrpx_downstream_test.cc \ +@ENABLE_APP_TRUE@ shrpx_downstream_test.h shrpx_config_test.cc \ +@ENABLE_APP_TRUE@ shrpx_config_test.h shrpx_worker_test.cc \ +@ENABLE_APP_TRUE@ shrpx_worker_test.h shrpx_http_test.cc \ +@ENABLE_APP_TRUE@ shrpx_http_test.h shrpx_router_test.cc \ +@ENABLE_APP_TRUE@ shrpx_router_test.h http2_test.cc \ +@ENABLE_APP_TRUE@ http2_test.h util_test.cc util_test.h \ +@ENABLE_APP_TRUE@ nghttp2_gzip_test.c nghttp2_gzip_test.h \ +@ENABLE_APP_TRUE@ nghttp2_gzip.c nghttp2_gzip.h buffer_test.cc \ +@ENABLE_APP_TRUE@ buffer_test.h memchunk_test.cc \ +@ENABLE_APP_TRUE@ memchunk_test.h template_test.cc \ +@ENABLE_APP_TRUE@ template_test.h base64_test.cc base64_test.h \ +@ENABLE_APP_TRUE@ $(top_srcdir)/tests/munit/munit.c \ +@ENABLE_APP_TRUE@ $(top_srcdir)/tests/munit/munit.h \ +@ENABLE_APP_TRUE@ $(top_srcdir)/tests/munit/munitxx.h \ +@ENABLE_APP_TRUE@ $(am__append_11) +@ENABLE_APP_TRUE@nghttpx_unittest_CPPFLAGS = ${AM_CPPFLAGS} \ +@ENABLE_APP_TRUE@ -I$(top_srcdir)/tests/munit \ +@ENABLE_APP_TRUE@ -DNGHTTP2_SRC_DIR=\"$(top_srcdir)/src\" \ +@ENABLE_APP_TRUE@ $(am__append_12) $(am__append_14) +@ENABLE_APP_TRUE@nghttpx_unittest_LDADD = libnghttpx.a ${LDADD} \ +@ENABLE_APP_TRUE@ @TESTLDADD@ $(am__append_13) $(am__append_15) +@ENABLE_HPACK_TOOLS_TRUE@HPACK_TOOLS_COMMON_SRCS = \ +@ENABLE_HPACK_TOOLS_TRUE@ comp_helper.c comp_helper.h \ +@ENABLE_HPACK_TOOLS_TRUE@ util.cc util.h \ +@ENABLE_HPACK_TOOLS_TRUE@ timegm.c timegm.h + +@ENABLE_HPACK_TOOLS_TRUE@inflatehd_SOURCES = inflatehd.cc $(HPACK_TOOLS_COMMON_SRCS) +@ENABLE_HPACK_TOOLS_TRUE@deflatehd_SOURCES = deflatehd.cc $(HPACK_TOOLS_COMMON_SRCS) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .cc .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +libnghttpx.a: $(libnghttpx_a_OBJECTS) $(libnghttpx_a_DEPENDENCIES) $(EXTRA_libnghttpx_a_DEPENDENCIES) + $(AM_V_at)-rm -f libnghttpx.a + $(AM_V_AR)$(libnghttpx_a_AR) libnghttpx.a $(libnghttpx_a_OBJECTS) $(libnghttpx_a_LIBADD) + $(AM_V_at)$(RANLIB) libnghttpx.a + +deflatehd$(EXEEXT): $(deflatehd_OBJECTS) $(deflatehd_DEPENDENCIES) $(EXTRA_deflatehd_DEPENDENCIES) + @rm -f deflatehd$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(deflatehd_OBJECTS) $(deflatehd_LDADD) $(LIBS) + +h2load$(EXEEXT): $(h2load_OBJECTS) $(h2load_DEPENDENCIES) $(EXTRA_h2load_DEPENDENCIES) + @rm -f h2load$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(h2load_OBJECTS) $(h2load_LDADD) $(LIBS) + +inflatehd$(EXEEXT): $(inflatehd_OBJECTS) $(inflatehd_DEPENDENCIES) $(EXTRA_inflatehd_DEPENDENCIES) + @rm -f inflatehd$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(inflatehd_OBJECTS) $(inflatehd_LDADD) $(LIBS) + +nghttp$(EXEEXT): $(nghttp_OBJECTS) $(nghttp_DEPENDENCIES) $(EXTRA_nghttp_DEPENDENCIES) + @rm -f nghttp$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(nghttp_OBJECTS) $(nghttp_LDADD) $(LIBS) + +nghttpd$(EXEEXT): $(nghttpd_OBJECTS) $(nghttpd_DEPENDENCIES) $(EXTRA_nghttpd_DEPENDENCIES) + @rm -f nghttpd$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(nghttpd_OBJECTS) $(nghttpd_LDADD) $(LIBS) + +nghttpx$(EXEEXT): $(nghttpx_OBJECTS) $(nghttpx_DEPENDENCIES) $(EXTRA_nghttpx_DEPENDENCIES) + @rm -f nghttpx$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(nghttpx_OBJECTS) $(nghttpx_LDADD) $(LIBS) +$(top_builddir)/tests/munit/$(am__dirstamp): + @$(MKDIR_P) $(top_builddir)/tests/munit + @: > $(top_builddir)/tests/munit/$(am__dirstamp) +$(top_builddir)/tests/munit/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) $(top_builddir)/tests/munit/$(DEPDIR) + @: > $(top_builddir)/tests/munit/$(DEPDIR)/$(am__dirstamp) +$(top_builddir)/tests/munit/nghttpx_unittest-munit.$(OBJEXT): \ + $(top_builddir)/tests/munit/$(am__dirstamp) \ + $(top_builddir)/tests/munit/$(DEPDIR)/$(am__dirstamp) + +nghttpx-unittest$(EXEEXT): $(nghttpx_unittest_OBJECTS) $(nghttpx_unittest_DEPENDENCIES) $(EXTRA_nghttpx_unittest_DEPENDENCIES) + @rm -f nghttpx-unittest$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(nghttpx_unittest_OBJECTS) $(nghttpx_unittest_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f $(top_builddir)/tests/munit/*.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HtmlParser.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HttpServer.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/app_helper.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comp_helper.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deflatehd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h2load.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h2load_http1_session.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h2load_http2_session.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h2load_http3_session.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h2load_quic.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inflatehd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-app_helper.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-http2.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-http3.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-quic.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_client_handler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_config.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_connection.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_downstream.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_exec.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_http.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_http2_session.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_io_control.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_live_check.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_log.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_log_config.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_mruby.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_quic.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_router.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_signal.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_tls.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_worker.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-shrpx_worker_process.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-siphash.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-timegm.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-tls.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-util.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnghttpx_a-xsi_strerror.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_gzip.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpd.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx-shrpx.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-base64_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-buffer_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-http2_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-memchunk_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-shrpx-unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-shrpx_config_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-shrpx_http_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-shrpx_router_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-siphash_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-template_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttpx_unittest-util_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quic.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timegm.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libnghttpx_a-timegm.o: timegm.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnghttpx_a-timegm.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-timegm.Tpo -c -o libnghttpx_a-timegm.o `test -f 'timegm.c' || echo '$(srcdir)/'`timegm.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-timegm.Tpo $(DEPDIR)/libnghttpx_a-timegm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='timegm.c' object='libnghttpx_a-timegm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnghttpx_a-timegm.o `test -f 'timegm.c' || echo '$(srcdir)/'`timegm.c + +libnghttpx_a-timegm.obj: timegm.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnghttpx_a-timegm.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-timegm.Tpo -c -o libnghttpx_a-timegm.obj `if test -f 'timegm.c'; then $(CYGPATH_W) 'timegm.c'; else $(CYGPATH_W) '$(srcdir)/timegm.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-timegm.Tpo $(DEPDIR)/libnghttpx_a-timegm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='timegm.c' object='libnghttpx_a-timegm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnghttpx_a-timegm.obj `if test -f 'timegm.c'; then $(CYGPATH_W) 'timegm.c'; else $(CYGPATH_W) '$(srcdir)/timegm.c'; fi` + +libnghttpx_a-xsi_strerror.o: xsi_strerror.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnghttpx_a-xsi_strerror.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-xsi_strerror.Tpo -c -o libnghttpx_a-xsi_strerror.o `test -f 'xsi_strerror.c' || echo '$(srcdir)/'`xsi_strerror.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-xsi_strerror.Tpo $(DEPDIR)/libnghttpx_a-xsi_strerror.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsi_strerror.c' object='libnghttpx_a-xsi_strerror.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnghttpx_a-xsi_strerror.o `test -f 'xsi_strerror.c' || echo '$(srcdir)/'`xsi_strerror.c + +libnghttpx_a-xsi_strerror.obj: xsi_strerror.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnghttpx_a-xsi_strerror.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-xsi_strerror.Tpo -c -o libnghttpx_a-xsi_strerror.obj `if test -f 'xsi_strerror.c'; then $(CYGPATH_W) 'xsi_strerror.c'; else $(CYGPATH_W) '$(srcdir)/xsi_strerror.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-xsi_strerror.Tpo $(DEPDIR)/libnghttpx_a-xsi_strerror.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsi_strerror.c' object='libnghttpx_a-xsi_strerror.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnghttpx_a-xsi_strerror.obj `if test -f 'xsi_strerror.c'; then $(CYGPATH_W) 'xsi_strerror.c'; else $(CYGPATH_W) '$(srcdir)/xsi_strerror.c'; fi` + +nghttpx_unittest-nghttp2_gzip_test.o: nghttp2_gzip_test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nghttpx_unittest-nghttp2_gzip_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Tpo -c -o nghttpx_unittest-nghttp2_gzip_test.o `test -f 'nghttp2_gzip_test.c' || echo '$(srcdir)/'`nghttp2_gzip_test.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Tpo $(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nghttp2_gzip_test.c' object='nghttpx_unittest-nghttp2_gzip_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nghttpx_unittest-nghttp2_gzip_test.o `test -f 'nghttp2_gzip_test.c' || echo '$(srcdir)/'`nghttp2_gzip_test.c + +nghttpx_unittest-nghttp2_gzip_test.obj: nghttp2_gzip_test.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nghttpx_unittest-nghttp2_gzip_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Tpo -c -o nghttpx_unittest-nghttp2_gzip_test.obj `if test -f 'nghttp2_gzip_test.c'; then $(CYGPATH_W) 'nghttp2_gzip_test.c'; else $(CYGPATH_W) '$(srcdir)/nghttp2_gzip_test.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Tpo $(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nghttp2_gzip_test.c' object='nghttpx_unittest-nghttp2_gzip_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nghttpx_unittest-nghttp2_gzip_test.obj `if test -f 'nghttp2_gzip_test.c'; then $(CYGPATH_W) 'nghttp2_gzip_test.c'; else $(CYGPATH_W) '$(srcdir)/nghttp2_gzip_test.c'; fi` + +nghttpx_unittest-nghttp2_gzip.o: nghttp2_gzip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nghttpx_unittest-nghttp2_gzip.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Tpo -c -o nghttpx_unittest-nghttp2_gzip.o `test -f 'nghttp2_gzip.c' || echo '$(srcdir)/'`nghttp2_gzip.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Tpo $(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nghttp2_gzip.c' object='nghttpx_unittest-nghttp2_gzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nghttpx_unittest-nghttp2_gzip.o `test -f 'nghttp2_gzip.c' || echo '$(srcdir)/'`nghttp2_gzip.c + +nghttpx_unittest-nghttp2_gzip.obj: nghttp2_gzip.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nghttpx_unittest-nghttp2_gzip.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Tpo -c -o nghttpx_unittest-nghttp2_gzip.obj `if test -f 'nghttp2_gzip.c'; then $(CYGPATH_W) 'nghttp2_gzip.c'; else $(CYGPATH_W) '$(srcdir)/nghttp2_gzip.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Tpo $(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nghttp2_gzip.c' object='nghttpx_unittest-nghttp2_gzip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nghttpx_unittest-nghttp2_gzip.obj `if test -f 'nghttp2_gzip.c'; then $(CYGPATH_W) 'nghttp2_gzip.c'; else $(CYGPATH_W) '$(srcdir)/nghttp2_gzip.c'; fi` + +$(top_builddir)/tests/munit/nghttpx_unittest-munit.o: $(top_builddir)/tests/munit/munit.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT $(top_builddir)/tests/munit/nghttpx_unittest-munit.o -MD -MP -MF $(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Tpo -c -o $(top_builddir)/tests/munit/nghttpx_unittest-munit.o `test -f '$(top_builddir)/tests/munit/munit.c' || echo '$(srcdir)/'`$(top_builddir)/tests/munit/munit.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Tpo $(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/tests/munit/munit.c' object='$(top_builddir)/tests/munit/nghttpx_unittest-munit.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o $(top_builddir)/tests/munit/nghttpx_unittest-munit.o `test -f '$(top_builddir)/tests/munit/munit.c' || echo '$(srcdir)/'`$(top_builddir)/tests/munit/munit.c + +$(top_builddir)/tests/munit/nghttpx_unittest-munit.obj: $(top_builddir)/tests/munit/munit.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT $(top_builddir)/tests/munit/nghttpx_unittest-munit.obj -MD -MP -MF $(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Tpo -c -o $(top_builddir)/tests/munit/nghttpx_unittest-munit.obj `if test -f '$(top_builddir)/tests/munit/munit.c'; then $(CYGPATH_W) '$(top_builddir)/tests/munit/munit.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/tests/munit/munit.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Tpo $(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/tests/munit/munit.c' object='$(top_builddir)/tests/munit/nghttpx_unittest-munit.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o $(top_builddir)/tests/munit/nghttpx_unittest-munit.obj `if test -f '$(top_builddir)/tests/munit/munit.c'; then $(CYGPATH_W) '$(top_builddir)/tests/munit/munit.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/tests/munit/munit.c'; fi` + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +libnghttpx_a-util.o: util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-util.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-util.Tpo -c -o libnghttpx_a-util.o `test -f 'util.cc' || echo '$(srcdir)/'`util.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-util.Tpo $(DEPDIR)/libnghttpx_a-util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='util.cc' object='libnghttpx_a-util.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-util.o `test -f 'util.cc' || echo '$(srcdir)/'`util.cc + +libnghttpx_a-util.obj: util.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-util.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-util.Tpo -c -o libnghttpx_a-util.obj `if test -f 'util.cc'; then $(CYGPATH_W) 'util.cc'; else $(CYGPATH_W) '$(srcdir)/util.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-util.Tpo $(DEPDIR)/libnghttpx_a-util.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='util.cc' object='libnghttpx_a-util.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-util.obj `if test -f 'util.cc'; then $(CYGPATH_W) 'util.cc'; else $(CYGPATH_W) '$(srcdir)/util.cc'; fi` + +libnghttpx_a-http2.o: http2.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-http2.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-http2.Tpo -c -o libnghttpx_a-http2.o `test -f 'http2.cc' || echo '$(srcdir)/'`http2.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-http2.Tpo $(DEPDIR)/libnghttpx_a-http2.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='http2.cc' object='libnghttpx_a-http2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-http2.o `test -f 'http2.cc' || echo '$(srcdir)/'`http2.cc + +libnghttpx_a-http2.obj: http2.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-http2.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-http2.Tpo -c -o libnghttpx_a-http2.obj `if test -f 'http2.cc'; then $(CYGPATH_W) 'http2.cc'; else $(CYGPATH_W) '$(srcdir)/http2.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-http2.Tpo $(DEPDIR)/libnghttpx_a-http2.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='http2.cc' object='libnghttpx_a-http2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-http2.obj `if test -f 'http2.cc'; then $(CYGPATH_W) 'http2.cc'; else $(CYGPATH_W) '$(srcdir)/http2.cc'; fi` + +libnghttpx_a-app_helper.o: app_helper.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-app_helper.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-app_helper.Tpo -c -o libnghttpx_a-app_helper.o `test -f 'app_helper.cc' || echo '$(srcdir)/'`app_helper.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-app_helper.Tpo $(DEPDIR)/libnghttpx_a-app_helper.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='app_helper.cc' object='libnghttpx_a-app_helper.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-app_helper.o `test -f 'app_helper.cc' || echo '$(srcdir)/'`app_helper.cc + +libnghttpx_a-app_helper.obj: app_helper.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-app_helper.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-app_helper.Tpo -c -o libnghttpx_a-app_helper.obj `if test -f 'app_helper.cc'; then $(CYGPATH_W) 'app_helper.cc'; else $(CYGPATH_W) '$(srcdir)/app_helper.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-app_helper.Tpo $(DEPDIR)/libnghttpx_a-app_helper.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='app_helper.cc' object='libnghttpx_a-app_helper.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-app_helper.obj `if test -f 'app_helper.cc'; then $(CYGPATH_W) 'app_helper.cc'; else $(CYGPATH_W) '$(srcdir)/app_helper.cc'; fi` + +libnghttpx_a-tls.o: tls.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-tls.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-tls.Tpo -c -o libnghttpx_a-tls.o `test -f 'tls.cc' || echo '$(srcdir)/'`tls.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-tls.Tpo $(DEPDIR)/libnghttpx_a-tls.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tls.cc' object='libnghttpx_a-tls.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-tls.o `test -f 'tls.cc' || echo '$(srcdir)/'`tls.cc + +libnghttpx_a-tls.obj: tls.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-tls.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-tls.Tpo -c -o libnghttpx_a-tls.obj `if test -f 'tls.cc'; then $(CYGPATH_W) 'tls.cc'; else $(CYGPATH_W) '$(srcdir)/tls.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-tls.Tpo $(DEPDIR)/libnghttpx_a-tls.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='tls.cc' object='libnghttpx_a-tls.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-tls.obj `if test -f 'tls.cc'; then $(CYGPATH_W) 'tls.cc'; else $(CYGPATH_W) '$(srcdir)/tls.cc'; fi` + +libnghttpx_a-shrpx_config.o: shrpx_config.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_config.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_config.Tpo -c -o libnghttpx_a-shrpx_config.o `test -f 'shrpx_config.cc' || echo '$(srcdir)/'`shrpx_config.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_config.Tpo $(DEPDIR)/libnghttpx_a-shrpx_config.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_config.cc' object='libnghttpx_a-shrpx_config.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_config.o `test -f 'shrpx_config.cc' || echo '$(srcdir)/'`shrpx_config.cc + +libnghttpx_a-shrpx_config.obj: shrpx_config.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_config.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_config.Tpo -c -o libnghttpx_a-shrpx_config.obj `if test -f 'shrpx_config.cc'; then $(CYGPATH_W) 'shrpx_config.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_config.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_config.Tpo $(DEPDIR)/libnghttpx_a-shrpx_config.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_config.cc' object='libnghttpx_a-shrpx_config.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_config.obj `if test -f 'shrpx_config.cc'; then $(CYGPATH_W) 'shrpx_config.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_config.cc'; fi` + +libnghttpx_a-shrpx_accept_handler.o: shrpx_accept_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_accept_handler.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Tpo -c -o libnghttpx_a-shrpx_accept_handler.o `test -f 'shrpx_accept_handler.cc' || echo '$(srcdir)/'`shrpx_accept_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Tpo $(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_accept_handler.cc' object='libnghttpx_a-shrpx_accept_handler.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_accept_handler.o `test -f 'shrpx_accept_handler.cc' || echo '$(srcdir)/'`shrpx_accept_handler.cc + +libnghttpx_a-shrpx_accept_handler.obj: shrpx_accept_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_accept_handler.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Tpo -c -o libnghttpx_a-shrpx_accept_handler.obj `if test -f 'shrpx_accept_handler.cc'; then $(CYGPATH_W) 'shrpx_accept_handler.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_accept_handler.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Tpo $(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_accept_handler.cc' object='libnghttpx_a-shrpx_accept_handler.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_accept_handler.obj `if test -f 'shrpx_accept_handler.cc'; then $(CYGPATH_W) 'shrpx_accept_handler.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_accept_handler.cc'; fi` + +libnghttpx_a-shrpx_connection_handler.o: shrpx_connection_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_connection_handler.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Tpo -c -o libnghttpx_a-shrpx_connection_handler.o `test -f 'shrpx_connection_handler.cc' || echo '$(srcdir)/'`shrpx_connection_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Tpo $(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_connection_handler.cc' object='libnghttpx_a-shrpx_connection_handler.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_connection_handler.o `test -f 'shrpx_connection_handler.cc' || echo '$(srcdir)/'`shrpx_connection_handler.cc + +libnghttpx_a-shrpx_connection_handler.obj: shrpx_connection_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_connection_handler.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Tpo -c -o libnghttpx_a-shrpx_connection_handler.obj `if test -f 'shrpx_connection_handler.cc'; then $(CYGPATH_W) 'shrpx_connection_handler.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_connection_handler.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Tpo $(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_connection_handler.cc' object='libnghttpx_a-shrpx_connection_handler.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_connection_handler.obj `if test -f 'shrpx_connection_handler.cc'; then $(CYGPATH_W) 'shrpx_connection_handler.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_connection_handler.cc'; fi` + +libnghttpx_a-shrpx_client_handler.o: shrpx_client_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_client_handler.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_client_handler.Tpo -c -o libnghttpx_a-shrpx_client_handler.o `test -f 'shrpx_client_handler.cc' || echo '$(srcdir)/'`shrpx_client_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_client_handler.Tpo $(DEPDIR)/libnghttpx_a-shrpx_client_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_client_handler.cc' object='libnghttpx_a-shrpx_client_handler.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_client_handler.o `test -f 'shrpx_client_handler.cc' || echo '$(srcdir)/'`shrpx_client_handler.cc + +libnghttpx_a-shrpx_client_handler.obj: shrpx_client_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_client_handler.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_client_handler.Tpo -c -o libnghttpx_a-shrpx_client_handler.obj `if test -f 'shrpx_client_handler.cc'; then $(CYGPATH_W) 'shrpx_client_handler.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_client_handler.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_client_handler.Tpo $(DEPDIR)/libnghttpx_a-shrpx_client_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_client_handler.cc' object='libnghttpx_a-shrpx_client_handler.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_client_handler.obj `if test -f 'shrpx_client_handler.cc'; then $(CYGPATH_W) 'shrpx_client_handler.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_client_handler.cc'; fi` + +libnghttpx_a-shrpx_http2_upstream.o: shrpx_http2_upstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http2_upstream.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Tpo -c -o libnghttpx_a-shrpx_http2_upstream.o `test -f 'shrpx_http2_upstream.cc' || echo '$(srcdir)/'`shrpx_http2_upstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http2_upstream.cc' object='libnghttpx_a-shrpx_http2_upstream.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http2_upstream.o `test -f 'shrpx_http2_upstream.cc' || echo '$(srcdir)/'`shrpx_http2_upstream.cc + +libnghttpx_a-shrpx_http2_upstream.obj: shrpx_http2_upstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http2_upstream.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Tpo -c -o libnghttpx_a-shrpx_http2_upstream.obj `if test -f 'shrpx_http2_upstream.cc'; then $(CYGPATH_W) 'shrpx_http2_upstream.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http2_upstream.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http2_upstream.cc' object='libnghttpx_a-shrpx_http2_upstream.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http2_upstream.obj `if test -f 'shrpx_http2_upstream.cc'; then $(CYGPATH_W) 'shrpx_http2_upstream.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http2_upstream.cc'; fi` + +libnghttpx_a-shrpx_https_upstream.o: shrpx_https_upstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_https_upstream.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Tpo -c -o libnghttpx_a-shrpx_https_upstream.o `test -f 'shrpx_https_upstream.cc' || echo '$(srcdir)/'`shrpx_https_upstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Tpo $(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_https_upstream.cc' object='libnghttpx_a-shrpx_https_upstream.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_https_upstream.o `test -f 'shrpx_https_upstream.cc' || echo '$(srcdir)/'`shrpx_https_upstream.cc + +libnghttpx_a-shrpx_https_upstream.obj: shrpx_https_upstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_https_upstream.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Tpo -c -o libnghttpx_a-shrpx_https_upstream.obj `if test -f 'shrpx_https_upstream.cc'; then $(CYGPATH_W) 'shrpx_https_upstream.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_https_upstream.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Tpo $(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_https_upstream.cc' object='libnghttpx_a-shrpx_https_upstream.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_https_upstream.obj `if test -f 'shrpx_https_upstream.cc'; then $(CYGPATH_W) 'shrpx_https_upstream.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_https_upstream.cc'; fi` + +libnghttpx_a-shrpx_downstream.o: shrpx_downstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_downstream.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_downstream.Tpo -c -o libnghttpx_a-shrpx_downstream.o `test -f 'shrpx_downstream.cc' || echo '$(srcdir)/'`shrpx_downstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_downstream.Tpo $(DEPDIR)/libnghttpx_a-shrpx_downstream.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream.cc' object='libnghttpx_a-shrpx_downstream.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_downstream.o `test -f 'shrpx_downstream.cc' || echo '$(srcdir)/'`shrpx_downstream.cc + +libnghttpx_a-shrpx_downstream.obj: shrpx_downstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_downstream.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_downstream.Tpo -c -o libnghttpx_a-shrpx_downstream.obj `if test -f 'shrpx_downstream.cc'; then $(CYGPATH_W) 'shrpx_downstream.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_downstream.Tpo $(DEPDIR)/libnghttpx_a-shrpx_downstream.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream.cc' object='libnghttpx_a-shrpx_downstream.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_downstream.obj `if test -f 'shrpx_downstream.cc'; then $(CYGPATH_W) 'shrpx_downstream.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream.cc'; fi` + +libnghttpx_a-shrpx_downstream_connection.o: shrpx_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_downstream_connection.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_downstream_connection.o `test -f 'shrpx_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream_connection.cc' object='libnghttpx_a-shrpx_downstream_connection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_downstream_connection.o `test -f 'shrpx_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_downstream_connection.cc + +libnghttpx_a-shrpx_downstream_connection.obj: shrpx_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_downstream_connection.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_downstream_connection.obj `if test -f 'shrpx_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream_connection.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream_connection.cc' object='libnghttpx_a-shrpx_downstream_connection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_downstream_connection.obj `if test -f 'shrpx_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream_connection.cc'; fi` + +libnghttpx_a-shrpx_http_downstream_connection.o: shrpx_http_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http_downstream_connection.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_http_downstream_connection.o `test -f 'shrpx_http_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_http_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http_downstream_connection.cc' object='libnghttpx_a-shrpx_http_downstream_connection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http_downstream_connection.o `test -f 'shrpx_http_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_http_downstream_connection.cc + +libnghttpx_a-shrpx_http_downstream_connection.obj: shrpx_http_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http_downstream_connection.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_http_downstream_connection.obj `if test -f 'shrpx_http_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_http_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http_downstream_connection.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http_downstream_connection.cc' object='libnghttpx_a-shrpx_http_downstream_connection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http_downstream_connection.obj `if test -f 'shrpx_http_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_http_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http_downstream_connection.cc'; fi` + +libnghttpx_a-shrpx_http2_downstream_connection.o: shrpx_http2_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http2_downstream_connection.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_http2_downstream_connection.o `test -f 'shrpx_http2_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_http2_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http2_downstream_connection.cc' object='libnghttpx_a-shrpx_http2_downstream_connection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http2_downstream_connection.o `test -f 'shrpx_http2_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_http2_downstream_connection.cc + +libnghttpx_a-shrpx_http2_downstream_connection.obj: shrpx_http2_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http2_downstream_connection.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_http2_downstream_connection.obj `if test -f 'shrpx_http2_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_http2_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http2_downstream_connection.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http2_downstream_connection.cc' object='libnghttpx_a-shrpx_http2_downstream_connection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http2_downstream_connection.obj `if test -f 'shrpx_http2_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_http2_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http2_downstream_connection.cc'; fi` + +libnghttpx_a-shrpx_http2_session.o: shrpx_http2_session.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http2_session.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http2_session.Tpo -c -o libnghttpx_a-shrpx_http2_session.o `test -f 'shrpx_http2_session.cc' || echo '$(srcdir)/'`shrpx_http2_session.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http2_session.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http2_session.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http2_session.cc' object='libnghttpx_a-shrpx_http2_session.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http2_session.o `test -f 'shrpx_http2_session.cc' || echo '$(srcdir)/'`shrpx_http2_session.cc + +libnghttpx_a-shrpx_http2_session.obj: shrpx_http2_session.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http2_session.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http2_session.Tpo -c -o libnghttpx_a-shrpx_http2_session.obj `if test -f 'shrpx_http2_session.cc'; then $(CYGPATH_W) 'shrpx_http2_session.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http2_session.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http2_session.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http2_session.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http2_session.cc' object='libnghttpx_a-shrpx_http2_session.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http2_session.obj `if test -f 'shrpx_http2_session.cc'; then $(CYGPATH_W) 'shrpx_http2_session.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http2_session.cc'; fi` + +libnghttpx_a-shrpx_downstream_queue.o: shrpx_downstream_queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_downstream_queue.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Tpo -c -o libnghttpx_a-shrpx_downstream_queue.o `test -f 'shrpx_downstream_queue.cc' || echo '$(srcdir)/'`shrpx_downstream_queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Tpo $(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream_queue.cc' object='libnghttpx_a-shrpx_downstream_queue.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_downstream_queue.o `test -f 'shrpx_downstream_queue.cc' || echo '$(srcdir)/'`shrpx_downstream_queue.cc + +libnghttpx_a-shrpx_downstream_queue.obj: shrpx_downstream_queue.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_downstream_queue.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Tpo -c -o libnghttpx_a-shrpx_downstream_queue.obj `if test -f 'shrpx_downstream_queue.cc'; then $(CYGPATH_W) 'shrpx_downstream_queue.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream_queue.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Tpo $(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream_queue.cc' object='libnghttpx_a-shrpx_downstream_queue.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_downstream_queue.obj `if test -f 'shrpx_downstream_queue.cc'; then $(CYGPATH_W) 'shrpx_downstream_queue.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream_queue.cc'; fi` + +libnghttpx_a-shrpx_log.o: shrpx_log.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_log.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_log.Tpo -c -o libnghttpx_a-shrpx_log.o `test -f 'shrpx_log.cc' || echo '$(srcdir)/'`shrpx_log.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_log.Tpo $(DEPDIR)/libnghttpx_a-shrpx_log.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_log.cc' object='libnghttpx_a-shrpx_log.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_log.o `test -f 'shrpx_log.cc' || echo '$(srcdir)/'`shrpx_log.cc + +libnghttpx_a-shrpx_log.obj: shrpx_log.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_log.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_log.Tpo -c -o libnghttpx_a-shrpx_log.obj `if test -f 'shrpx_log.cc'; then $(CYGPATH_W) 'shrpx_log.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_log.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_log.Tpo $(DEPDIR)/libnghttpx_a-shrpx_log.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_log.cc' object='libnghttpx_a-shrpx_log.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_log.obj `if test -f 'shrpx_log.cc'; then $(CYGPATH_W) 'shrpx_log.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_log.cc'; fi` + +libnghttpx_a-shrpx_http.o: shrpx_http.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http.Tpo -c -o libnghttpx_a-shrpx_http.o `test -f 'shrpx_http.cc' || echo '$(srcdir)/'`shrpx_http.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http.cc' object='libnghttpx_a-shrpx_http.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http.o `test -f 'shrpx_http.cc' || echo '$(srcdir)/'`shrpx_http.cc + +libnghttpx_a-shrpx_http.obj: shrpx_http.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http.Tpo -c -o libnghttpx_a-shrpx_http.obj `if test -f 'shrpx_http.cc'; then $(CYGPATH_W) 'shrpx_http.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http.cc' object='libnghttpx_a-shrpx_http.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http.obj `if test -f 'shrpx_http.cc'; then $(CYGPATH_W) 'shrpx_http.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http.cc'; fi` + +libnghttpx_a-shrpx_io_control.o: shrpx_io_control.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_io_control.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_io_control.Tpo -c -o libnghttpx_a-shrpx_io_control.o `test -f 'shrpx_io_control.cc' || echo '$(srcdir)/'`shrpx_io_control.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_io_control.Tpo $(DEPDIR)/libnghttpx_a-shrpx_io_control.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_io_control.cc' object='libnghttpx_a-shrpx_io_control.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_io_control.o `test -f 'shrpx_io_control.cc' || echo '$(srcdir)/'`shrpx_io_control.cc + +libnghttpx_a-shrpx_io_control.obj: shrpx_io_control.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_io_control.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_io_control.Tpo -c -o libnghttpx_a-shrpx_io_control.obj `if test -f 'shrpx_io_control.cc'; then $(CYGPATH_W) 'shrpx_io_control.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_io_control.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_io_control.Tpo $(DEPDIR)/libnghttpx_a-shrpx_io_control.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_io_control.cc' object='libnghttpx_a-shrpx_io_control.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_io_control.obj `if test -f 'shrpx_io_control.cc'; then $(CYGPATH_W) 'shrpx_io_control.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_io_control.cc'; fi` + +libnghttpx_a-shrpx_tls.o: shrpx_tls.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_tls.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_tls.Tpo -c -o libnghttpx_a-shrpx_tls.o `test -f 'shrpx_tls.cc' || echo '$(srcdir)/'`shrpx_tls.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_tls.Tpo $(DEPDIR)/libnghttpx_a-shrpx_tls.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_tls.cc' object='libnghttpx_a-shrpx_tls.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_tls.o `test -f 'shrpx_tls.cc' || echo '$(srcdir)/'`shrpx_tls.cc + +libnghttpx_a-shrpx_tls.obj: shrpx_tls.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_tls.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_tls.Tpo -c -o libnghttpx_a-shrpx_tls.obj `if test -f 'shrpx_tls.cc'; then $(CYGPATH_W) 'shrpx_tls.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_tls.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_tls.Tpo $(DEPDIR)/libnghttpx_a-shrpx_tls.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_tls.cc' object='libnghttpx_a-shrpx_tls.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_tls.obj `if test -f 'shrpx_tls.cc'; then $(CYGPATH_W) 'shrpx_tls.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_tls.cc'; fi` + +libnghttpx_a-shrpx_worker.o: shrpx_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_worker.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_worker.Tpo -c -o libnghttpx_a-shrpx_worker.o `test -f 'shrpx_worker.cc' || echo '$(srcdir)/'`shrpx_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_worker.Tpo $(DEPDIR)/libnghttpx_a-shrpx_worker.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_worker.cc' object='libnghttpx_a-shrpx_worker.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_worker.o `test -f 'shrpx_worker.cc' || echo '$(srcdir)/'`shrpx_worker.cc + +libnghttpx_a-shrpx_worker.obj: shrpx_worker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_worker.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_worker.Tpo -c -o libnghttpx_a-shrpx_worker.obj `if test -f 'shrpx_worker.cc'; then $(CYGPATH_W) 'shrpx_worker.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_worker.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_worker.Tpo $(DEPDIR)/libnghttpx_a-shrpx_worker.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_worker.cc' object='libnghttpx_a-shrpx_worker.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_worker.obj `if test -f 'shrpx_worker.cc'; then $(CYGPATH_W) 'shrpx_worker.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_worker.cc'; fi` + +libnghttpx_a-shrpx_log_config.o: shrpx_log_config.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_log_config.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_log_config.Tpo -c -o libnghttpx_a-shrpx_log_config.o `test -f 'shrpx_log_config.cc' || echo '$(srcdir)/'`shrpx_log_config.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_log_config.Tpo $(DEPDIR)/libnghttpx_a-shrpx_log_config.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_log_config.cc' object='libnghttpx_a-shrpx_log_config.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_log_config.o `test -f 'shrpx_log_config.cc' || echo '$(srcdir)/'`shrpx_log_config.cc + +libnghttpx_a-shrpx_log_config.obj: shrpx_log_config.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_log_config.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_log_config.Tpo -c -o libnghttpx_a-shrpx_log_config.obj `if test -f 'shrpx_log_config.cc'; then $(CYGPATH_W) 'shrpx_log_config.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_log_config.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_log_config.Tpo $(DEPDIR)/libnghttpx_a-shrpx_log_config.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_log_config.cc' object='libnghttpx_a-shrpx_log_config.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_log_config.obj `if test -f 'shrpx_log_config.cc'; then $(CYGPATH_W) 'shrpx_log_config.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_log_config.cc'; fi` + +libnghttpx_a-shrpx_connect_blocker.o: shrpx_connect_blocker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_connect_blocker.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Tpo -c -o libnghttpx_a-shrpx_connect_blocker.o `test -f 'shrpx_connect_blocker.cc' || echo '$(srcdir)/'`shrpx_connect_blocker.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Tpo $(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_connect_blocker.cc' object='libnghttpx_a-shrpx_connect_blocker.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_connect_blocker.o `test -f 'shrpx_connect_blocker.cc' || echo '$(srcdir)/'`shrpx_connect_blocker.cc + +libnghttpx_a-shrpx_connect_blocker.obj: shrpx_connect_blocker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_connect_blocker.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Tpo -c -o libnghttpx_a-shrpx_connect_blocker.obj `if test -f 'shrpx_connect_blocker.cc'; then $(CYGPATH_W) 'shrpx_connect_blocker.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_connect_blocker.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Tpo $(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_connect_blocker.cc' object='libnghttpx_a-shrpx_connect_blocker.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_connect_blocker.obj `if test -f 'shrpx_connect_blocker.cc'; then $(CYGPATH_W) 'shrpx_connect_blocker.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_connect_blocker.cc'; fi` + +libnghttpx_a-shrpx_live_check.o: shrpx_live_check.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_live_check.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_live_check.Tpo -c -o libnghttpx_a-shrpx_live_check.o `test -f 'shrpx_live_check.cc' || echo '$(srcdir)/'`shrpx_live_check.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_live_check.Tpo $(DEPDIR)/libnghttpx_a-shrpx_live_check.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_live_check.cc' object='libnghttpx_a-shrpx_live_check.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_live_check.o `test -f 'shrpx_live_check.cc' || echo '$(srcdir)/'`shrpx_live_check.cc + +libnghttpx_a-shrpx_live_check.obj: shrpx_live_check.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_live_check.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_live_check.Tpo -c -o libnghttpx_a-shrpx_live_check.obj `if test -f 'shrpx_live_check.cc'; then $(CYGPATH_W) 'shrpx_live_check.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_live_check.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_live_check.Tpo $(DEPDIR)/libnghttpx_a-shrpx_live_check.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_live_check.cc' object='libnghttpx_a-shrpx_live_check.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_live_check.obj `if test -f 'shrpx_live_check.cc'; then $(CYGPATH_W) 'shrpx_live_check.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_live_check.cc'; fi` + +libnghttpx_a-shrpx_downstream_connection_pool.o: shrpx_downstream_connection_pool.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_downstream_connection_pool.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Tpo -c -o libnghttpx_a-shrpx_downstream_connection_pool.o `test -f 'shrpx_downstream_connection_pool.cc' || echo '$(srcdir)/'`shrpx_downstream_connection_pool.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Tpo $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream_connection_pool.cc' object='libnghttpx_a-shrpx_downstream_connection_pool.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_downstream_connection_pool.o `test -f 'shrpx_downstream_connection_pool.cc' || echo '$(srcdir)/'`shrpx_downstream_connection_pool.cc + +libnghttpx_a-shrpx_downstream_connection_pool.obj: shrpx_downstream_connection_pool.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_downstream_connection_pool.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Tpo -c -o libnghttpx_a-shrpx_downstream_connection_pool.obj `if test -f 'shrpx_downstream_connection_pool.cc'; then $(CYGPATH_W) 'shrpx_downstream_connection_pool.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream_connection_pool.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Tpo $(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream_connection_pool.cc' object='libnghttpx_a-shrpx_downstream_connection_pool.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_downstream_connection_pool.obj `if test -f 'shrpx_downstream_connection_pool.cc'; then $(CYGPATH_W) 'shrpx_downstream_connection_pool.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream_connection_pool.cc'; fi` + +libnghttpx_a-shrpx_rate_limit.o: shrpx_rate_limit.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_rate_limit.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Tpo -c -o libnghttpx_a-shrpx_rate_limit.o `test -f 'shrpx_rate_limit.cc' || echo '$(srcdir)/'`shrpx_rate_limit.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Tpo $(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_rate_limit.cc' object='libnghttpx_a-shrpx_rate_limit.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_rate_limit.o `test -f 'shrpx_rate_limit.cc' || echo '$(srcdir)/'`shrpx_rate_limit.cc + +libnghttpx_a-shrpx_rate_limit.obj: shrpx_rate_limit.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_rate_limit.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Tpo -c -o libnghttpx_a-shrpx_rate_limit.obj `if test -f 'shrpx_rate_limit.cc'; then $(CYGPATH_W) 'shrpx_rate_limit.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_rate_limit.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Tpo $(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_rate_limit.cc' object='libnghttpx_a-shrpx_rate_limit.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_rate_limit.obj `if test -f 'shrpx_rate_limit.cc'; then $(CYGPATH_W) 'shrpx_rate_limit.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_rate_limit.cc'; fi` + +libnghttpx_a-shrpx_connection.o: shrpx_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_connection.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_connection.Tpo -c -o libnghttpx_a-shrpx_connection.o `test -f 'shrpx_connection.cc' || echo '$(srcdir)/'`shrpx_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_connection.cc' object='libnghttpx_a-shrpx_connection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_connection.o `test -f 'shrpx_connection.cc' || echo '$(srcdir)/'`shrpx_connection.cc + +libnghttpx_a-shrpx_connection.obj: shrpx_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_connection.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_connection.Tpo -c -o libnghttpx_a-shrpx_connection.obj `if test -f 'shrpx_connection.cc'; then $(CYGPATH_W) 'shrpx_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_connection.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_connection.cc' object='libnghttpx_a-shrpx_connection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_connection.obj `if test -f 'shrpx_connection.cc'; then $(CYGPATH_W) 'shrpx_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_connection.cc'; fi` + +libnghttpx_a-shrpx_memcached_dispatcher.o: shrpx_memcached_dispatcher.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_memcached_dispatcher.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Tpo -c -o libnghttpx_a-shrpx_memcached_dispatcher.o `test -f 'shrpx_memcached_dispatcher.cc' || echo '$(srcdir)/'`shrpx_memcached_dispatcher.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Tpo $(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_memcached_dispatcher.cc' object='libnghttpx_a-shrpx_memcached_dispatcher.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_memcached_dispatcher.o `test -f 'shrpx_memcached_dispatcher.cc' || echo '$(srcdir)/'`shrpx_memcached_dispatcher.cc + +libnghttpx_a-shrpx_memcached_dispatcher.obj: shrpx_memcached_dispatcher.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_memcached_dispatcher.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Tpo -c -o libnghttpx_a-shrpx_memcached_dispatcher.obj `if test -f 'shrpx_memcached_dispatcher.cc'; then $(CYGPATH_W) 'shrpx_memcached_dispatcher.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_memcached_dispatcher.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Tpo $(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_memcached_dispatcher.cc' object='libnghttpx_a-shrpx_memcached_dispatcher.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_memcached_dispatcher.obj `if test -f 'shrpx_memcached_dispatcher.cc'; then $(CYGPATH_W) 'shrpx_memcached_dispatcher.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_memcached_dispatcher.cc'; fi` + +libnghttpx_a-shrpx_memcached_connection.o: shrpx_memcached_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_memcached_connection.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Tpo -c -o libnghttpx_a-shrpx_memcached_connection.o `test -f 'shrpx_memcached_connection.cc' || echo '$(srcdir)/'`shrpx_memcached_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_memcached_connection.cc' object='libnghttpx_a-shrpx_memcached_connection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_memcached_connection.o `test -f 'shrpx_memcached_connection.cc' || echo '$(srcdir)/'`shrpx_memcached_connection.cc + +libnghttpx_a-shrpx_memcached_connection.obj: shrpx_memcached_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_memcached_connection.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Tpo -c -o libnghttpx_a-shrpx_memcached_connection.obj `if test -f 'shrpx_memcached_connection.cc'; then $(CYGPATH_W) 'shrpx_memcached_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_memcached_connection.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_memcached_connection.cc' object='libnghttpx_a-shrpx_memcached_connection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_memcached_connection.obj `if test -f 'shrpx_memcached_connection.cc'; then $(CYGPATH_W) 'shrpx_memcached_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_memcached_connection.cc'; fi` + +libnghttpx_a-shrpx_worker_process.o: shrpx_worker_process.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_worker_process.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_worker_process.Tpo -c -o libnghttpx_a-shrpx_worker_process.o `test -f 'shrpx_worker_process.cc' || echo '$(srcdir)/'`shrpx_worker_process.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_worker_process.Tpo $(DEPDIR)/libnghttpx_a-shrpx_worker_process.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_worker_process.cc' object='libnghttpx_a-shrpx_worker_process.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_worker_process.o `test -f 'shrpx_worker_process.cc' || echo '$(srcdir)/'`shrpx_worker_process.cc + +libnghttpx_a-shrpx_worker_process.obj: shrpx_worker_process.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_worker_process.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_worker_process.Tpo -c -o libnghttpx_a-shrpx_worker_process.obj `if test -f 'shrpx_worker_process.cc'; then $(CYGPATH_W) 'shrpx_worker_process.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_worker_process.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_worker_process.Tpo $(DEPDIR)/libnghttpx_a-shrpx_worker_process.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_worker_process.cc' object='libnghttpx_a-shrpx_worker_process.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_worker_process.obj `if test -f 'shrpx_worker_process.cc'; then $(CYGPATH_W) 'shrpx_worker_process.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_worker_process.cc'; fi` + +libnghttpx_a-shrpx_signal.o: shrpx_signal.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_signal.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_signal.Tpo -c -o libnghttpx_a-shrpx_signal.o `test -f 'shrpx_signal.cc' || echo '$(srcdir)/'`shrpx_signal.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_signal.Tpo $(DEPDIR)/libnghttpx_a-shrpx_signal.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_signal.cc' object='libnghttpx_a-shrpx_signal.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_signal.o `test -f 'shrpx_signal.cc' || echo '$(srcdir)/'`shrpx_signal.cc + +libnghttpx_a-shrpx_signal.obj: shrpx_signal.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_signal.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_signal.Tpo -c -o libnghttpx_a-shrpx_signal.obj `if test -f 'shrpx_signal.cc'; then $(CYGPATH_W) 'shrpx_signal.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_signal.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_signal.Tpo $(DEPDIR)/libnghttpx_a-shrpx_signal.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_signal.cc' object='libnghttpx_a-shrpx_signal.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_signal.obj `if test -f 'shrpx_signal.cc'; then $(CYGPATH_W) 'shrpx_signal.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_signal.cc'; fi` + +libnghttpx_a-shrpx_router.o: shrpx_router.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_router.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_router.Tpo -c -o libnghttpx_a-shrpx_router.o `test -f 'shrpx_router.cc' || echo '$(srcdir)/'`shrpx_router.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_router.Tpo $(DEPDIR)/libnghttpx_a-shrpx_router.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_router.cc' object='libnghttpx_a-shrpx_router.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_router.o `test -f 'shrpx_router.cc' || echo '$(srcdir)/'`shrpx_router.cc + +libnghttpx_a-shrpx_router.obj: shrpx_router.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_router.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_router.Tpo -c -o libnghttpx_a-shrpx_router.obj `if test -f 'shrpx_router.cc'; then $(CYGPATH_W) 'shrpx_router.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_router.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_router.Tpo $(DEPDIR)/libnghttpx_a-shrpx_router.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_router.cc' object='libnghttpx_a-shrpx_router.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_router.obj `if test -f 'shrpx_router.cc'; then $(CYGPATH_W) 'shrpx_router.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_router.cc'; fi` + +libnghttpx_a-shrpx_api_downstream_connection.o: shrpx_api_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_api_downstream_connection.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_api_downstream_connection.o `test -f 'shrpx_api_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_api_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_api_downstream_connection.cc' object='libnghttpx_a-shrpx_api_downstream_connection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_api_downstream_connection.o `test -f 'shrpx_api_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_api_downstream_connection.cc + +libnghttpx_a-shrpx_api_downstream_connection.obj: shrpx_api_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_api_downstream_connection.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_api_downstream_connection.obj `if test -f 'shrpx_api_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_api_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_api_downstream_connection.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_api_downstream_connection.cc' object='libnghttpx_a-shrpx_api_downstream_connection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_api_downstream_connection.obj `if test -f 'shrpx_api_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_api_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_api_downstream_connection.cc'; fi` + +libnghttpx_a-shrpx_health_monitor_downstream_connection.o: shrpx_health_monitor_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_health_monitor_downstream_connection.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_health_monitor_downstream_connection.o `test -f 'shrpx_health_monitor_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_health_monitor_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_health_monitor_downstream_connection.cc' object='libnghttpx_a-shrpx_health_monitor_downstream_connection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_health_monitor_downstream_connection.o `test -f 'shrpx_health_monitor_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_health_monitor_downstream_connection.cc + +libnghttpx_a-shrpx_health_monitor_downstream_connection.obj: shrpx_health_monitor_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_health_monitor_downstream_connection.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_health_monitor_downstream_connection.obj `if test -f 'shrpx_health_monitor_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_health_monitor_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_health_monitor_downstream_connection.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_health_monitor_downstream_connection.cc' object='libnghttpx_a-shrpx_health_monitor_downstream_connection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_health_monitor_downstream_connection.obj `if test -f 'shrpx_health_monitor_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_health_monitor_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_health_monitor_downstream_connection.cc'; fi` + +libnghttpx_a-shrpx_null_downstream_connection.o: shrpx_null_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_null_downstream_connection.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_null_downstream_connection.o `test -f 'shrpx_null_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_null_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_null_downstream_connection.cc' object='libnghttpx_a-shrpx_null_downstream_connection.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_null_downstream_connection.o `test -f 'shrpx_null_downstream_connection.cc' || echo '$(srcdir)/'`shrpx_null_downstream_connection.cc + +libnghttpx_a-shrpx_null_downstream_connection.obj: shrpx_null_downstream_connection.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_null_downstream_connection.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Tpo -c -o libnghttpx_a-shrpx_null_downstream_connection.obj `if test -f 'shrpx_null_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_null_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_null_downstream_connection.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Tpo $(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_null_downstream_connection.cc' object='libnghttpx_a-shrpx_null_downstream_connection.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_null_downstream_connection.obj `if test -f 'shrpx_null_downstream_connection.cc'; then $(CYGPATH_W) 'shrpx_null_downstream_connection.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_null_downstream_connection.cc'; fi` + +libnghttpx_a-shrpx_exec.o: shrpx_exec.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_exec.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_exec.Tpo -c -o libnghttpx_a-shrpx_exec.o `test -f 'shrpx_exec.cc' || echo '$(srcdir)/'`shrpx_exec.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_exec.Tpo $(DEPDIR)/libnghttpx_a-shrpx_exec.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_exec.cc' object='libnghttpx_a-shrpx_exec.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_exec.o `test -f 'shrpx_exec.cc' || echo '$(srcdir)/'`shrpx_exec.cc + +libnghttpx_a-shrpx_exec.obj: shrpx_exec.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_exec.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_exec.Tpo -c -o libnghttpx_a-shrpx_exec.obj `if test -f 'shrpx_exec.cc'; then $(CYGPATH_W) 'shrpx_exec.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_exec.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_exec.Tpo $(DEPDIR)/libnghttpx_a-shrpx_exec.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_exec.cc' object='libnghttpx_a-shrpx_exec.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_exec.obj `if test -f 'shrpx_exec.cc'; then $(CYGPATH_W) 'shrpx_exec.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_exec.cc'; fi` + +libnghttpx_a-shrpx_dns_resolver.o: shrpx_dns_resolver.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_dns_resolver.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Tpo -c -o libnghttpx_a-shrpx_dns_resolver.o `test -f 'shrpx_dns_resolver.cc' || echo '$(srcdir)/'`shrpx_dns_resolver.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Tpo $(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_dns_resolver.cc' object='libnghttpx_a-shrpx_dns_resolver.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_dns_resolver.o `test -f 'shrpx_dns_resolver.cc' || echo '$(srcdir)/'`shrpx_dns_resolver.cc + +libnghttpx_a-shrpx_dns_resolver.obj: shrpx_dns_resolver.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_dns_resolver.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Tpo -c -o libnghttpx_a-shrpx_dns_resolver.obj `if test -f 'shrpx_dns_resolver.cc'; then $(CYGPATH_W) 'shrpx_dns_resolver.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_dns_resolver.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Tpo $(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_dns_resolver.cc' object='libnghttpx_a-shrpx_dns_resolver.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_dns_resolver.obj `if test -f 'shrpx_dns_resolver.cc'; then $(CYGPATH_W) 'shrpx_dns_resolver.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_dns_resolver.cc'; fi` + +libnghttpx_a-shrpx_dual_dns_resolver.o: shrpx_dual_dns_resolver.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_dual_dns_resolver.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Tpo -c -o libnghttpx_a-shrpx_dual_dns_resolver.o `test -f 'shrpx_dual_dns_resolver.cc' || echo '$(srcdir)/'`shrpx_dual_dns_resolver.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Tpo $(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_dual_dns_resolver.cc' object='libnghttpx_a-shrpx_dual_dns_resolver.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_dual_dns_resolver.o `test -f 'shrpx_dual_dns_resolver.cc' || echo '$(srcdir)/'`shrpx_dual_dns_resolver.cc + +libnghttpx_a-shrpx_dual_dns_resolver.obj: shrpx_dual_dns_resolver.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_dual_dns_resolver.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Tpo -c -o libnghttpx_a-shrpx_dual_dns_resolver.obj `if test -f 'shrpx_dual_dns_resolver.cc'; then $(CYGPATH_W) 'shrpx_dual_dns_resolver.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_dual_dns_resolver.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Tpo $(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_dual_dns_resolver.cc' object='libnghttpx_a-shrpx_dual_dns_resolver.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_dual_dns_resolver.obj `if test -f 'shrpx_dual_dns_resolver.cc'; then $(CYGPATH_W) 'shrpx_dual_dns_resolver.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_dual_dns_resolver.cc'; fi` + +libnghttpx_a-shrpx_dns_tracker.o: shrpx_dns_tracker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_dns_tracker.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Tpo -c -o libnghttpx_a-shrpx_dns_tracker.o `test -f 'shrpx_dns_tracker.cc' || echo '$(srcdir)/'`shrpx_dns_tracker.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Tpo $(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_dns_tracker.cc' object='libnghttpx_a-shrpx_dns_tracker.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_dns_tracker.o `test -f 'shrpx_dns_tracker.cc' || echo '$(srcdir)/'`shrpx_dns_tracker.cc + +libnghttpx_a-shrpx_dns_tracker.obj: shrpx_dns_tracker.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_dns_tracker.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Tpo -c -o libnghttpx_a-shrpx_dns_tracker.obj `if test -f 'shrpx_dns_tracker.cc'; then $(CYGPATH_W) 'shrpx_dns_tracker.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_dns_tracker.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Tpo $(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_dns_tracker.cc' object='libnghttpx_a-shrpx_dns_tracker.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_dns_tracker.obj `if test -f 'shrpx_dns_tracker.cc'; then $(CYGPATH_W) 'shrpx_dns_tracker.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_dns_tracker.cc'; fi` + +libnghttpx_a-shrpx_mruby.o: shrpx_mruby.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby.Tpo -c -o libnghttpx_a-shrpx_mruby.o `test -f 'shrpx_mruby.cc' || echo '$(srcdir)/'`shrpx_mruby.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby.cc' object='libnghttpx_a-shrpx_mruby.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby.o `test -f 'shrpx_mruby.cc' || echo '$(srcdir)/'`shrpx_mruby.cc + +libnghttpx_a-shrpx_mruby.obj: shrpx_mruby.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby.Tpo -c -o libnghttpx_a-shrpx_mruby.obj `if test -f 'shrpx_mruby.cc'; then $(CYGPATH_W) 'shrpx_mruby.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby.cc' object='libnghttpx_a-shrpx_mruby.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby.obj `if test -f 'shrpx_mruby.cc'; then $(CYGPATH_W) 'shrpx_mruby.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby.cc'; fi` + +libnghttpx_a-shrpx_mruby_module.o: shrpx_mruby_module.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby_module.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Tpo -c -o libnghttpx_a-shrpx_mruby_module.o `test -f 'shrpx_mruby_module.cc' || echo '$(srcdir)/'`shrpx_mruby_module.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby_module.cc' object='libnghttpx_a-shrpx_mruby_module.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby_module.o `test -f 'shrpx_mruby_module.cc' || echo '$(srcdir)/'`shrpx_mruby_module.cc + +libnghttpx_a-shrpx_mruby_module.obj: shrpx_mruby_module.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby_module.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Tpo -c -o libnghttpx_a-shrpx_mruby_module.obj `if test -f 'shrpx_mruby_module.cc'; then $(CYGPATH_W) 'shrpx_mruby_module.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby_module.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby_module.cc' object='libnghttpx_a-shrpx_mruby_module.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby_module.obj `if test -f 'shrpx_mruby_module.cc'; then $(CYGPATH_W) 'shrpx_mruby_module.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby_module.cc'; fi` + +libnghttpx_a-shrpx_mruby_module_env.o: shrpx_mruby_module_env.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby_module_env.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Tpo -c -o libnghttpx_a-shrpx_mruby_module_env.o `test -f 'shrpx_mruby_module_env.cc' || echo '$(srcdir)/'`shrpx_mruby_module_env.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby_module_env.cc' object='libnghttpx_a-shrpx_mruby_module_env.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby_module_env.o `test -f 'shrpx_mruby_module_env.cc' || echo '$(srcdir)/'`shrpx_mruby_module_env.cc + +libnghttpx_a-shrpx_mruby_module_env.obj: shrpx_mruby_module_env.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby_module_env.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Tpo -c -o libnghttpx_a-shrpx_mruby_module_env.obj `if test -f 'shrpx_mruby_module_env.cc'; then $(CYGPATH_W) 'shrpx_mruby_module_env.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby_module_env.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby_module_env.cc' object='libnghttpx_a-shrpx_mruby_module_env.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby_module_env.obj `if test -f 'shrpx_mruby_module_env.cc'; then $(CYGPATH_W) 'shrpx_mruby_module_env.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby_module_env.cc'; fi` + +libnghttpx_a-shrpx_mruby_module_request.o: shrpx_mruby_module_request.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby_module_request.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Tpo -c -o libnghttpx_a-shrpx_mruby_module_request.o `test -f 'shrpx_mruby_module_request.cc' || echo '$(srcdir)/'`shrpx_mruby_module_request.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby_module_request.cc' object='libnghttpx_a-shrpx_mruby_module_request.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby_module_request.o `test -f 'shrpx_mruby_module_request.cc' || echo '$(srcdir)/'`shrpx_mruby_module_request.cc + +libnghttpx_a-shrpx_mruby_module_request.obj: shrpx_mruby_module_request.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby_module_request.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Tpo -c -o libnghttpx_a-shrpx_mruby_module_request.obj `if test -f 'shrpx_mruby_module_request.cc'; then $(CYGPATH_W) 'shrpx_mruby_module_request.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby_module_request.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby_module_request.cc' object='libnghttpx_a-shrpx_mruby_module_request.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby_module_request.obj `if test -f 'shrpx_mruby_module_request.cc'; then $(CYGPATH_W) 'shrpx_mruby_module_request.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby_module_request.cc'; fi` + +libnghttpx_a-shrpx_mruby_module_response.o: shrpx_mruby_module_response.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby_module_response.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Tpo -c -o libnghttpx_a-shrpx_mruby_module_response.o `test -f 'shrpx_mruby_module_response.cc' || echo '$(srcdir)/'`shrpx_mruby_module_response.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby_module_response.cc' object='libnghttpx_a-shrpx_mruby_module_response.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby_module_response.o `test -f 'shrpx_mruby_module_response.cc' || echo '$(srcdir)/'`shrpx_mruby_module_response.cc + +libnghttpx_a-shrpx_mruby_module_response.obj: shrpx_mruby_module_response.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_mruby_module_response.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Tpo -c -o libnghttpx_a-shrpx_mruby_module_response.obj `if test -f 'shrpx_mruby_module_response.cc'; then $(CYGPATH_W) 'shrpx_mruby_module_response.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby_module_response.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Tpo $(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_mruby_module_response.cc' object='libnghttpx_a-shrpx_mruby_module_response.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_mruby_module_response.obj `if test -f 'shrpx_mruby_module_response.cc'; then $(CYGPATH_W) 'shrpx_mruby_module_response.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_mruby_module_response.cc'; fi` + +libnghttpx_a-shrpx_quic.o: shrpx_quic.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_quic.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_quic.Tpo -c -o libnghttpx_a-shrpx_quic.o `test -f 'shrpx_quic.cc' || echo '$(srcdir)/'`shrpx_quic.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_quic.Tpo $(DEPDIR)/libnghttpx_a-shrpx_quic.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_quic.cc' object='libnghttpx_a-shrpx_quic.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_quic.o `test -f 'shrpx_quic.cc' || echo '$(srcdir)/'`shrpx_quic.cc + +libnghttpx_a-shrpx_quic.obj: shrpx_quic.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_quic.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_quic.Tpo -c -o libnghttpx_a-shrpx_quic.obj `if test -f 'shrpx_quic.cc'; then $(CYGPATH_W) 'shrpx_quic.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_quic.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_quic.Tpo $(DEPDIR)/libnghttpx_a-shrpx_quic.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_quic.cc' object='libnghttpx_a-shrpx_quic.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_quic.obj `if test -f 'shrpx_quic.cc'; then $(CYGPATH_W) 'shrpx_quic.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_quic.cc'; fi` + +libnghttpx_a-shrpx_quic_listener.o: shrpx_quic_listener.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_quic_listener.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Tpo -c -o libnghttpx_a-shrpx_quic_listener.o `test -f 'shrpx_quic_listener.cc' || echo '$(srcdir)/'`shrpx_quic_listener.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Tpo $(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_quic_listener.cc' object='libnghttpx_a-shrpx_quic_listener.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_quic_listener.o `test -f 'shrpx_quic_listener.cc' || echo '$(srcdir)/'`shrpx_quic_listener.cc + +libnghttpx_a-shrpx_quic_listener.obj: shrpx_quic_listener.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_quic_listener.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Tpo -c -o libnghttpx_a-shrpx_quic_listener.obj `if test -f 'shrpx_quic_listener.cc'; then $(CYGPATH_W) 'shrpx_quic_listener.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_quic_listener.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Tpo $(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_quic_listener.cc' object='libnghttpx_a-shrpx_quic_listener.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_quic_listener.obj `if test -f 'shrpx_quic_listener.cc'; then $(CYGPATH_W) 'shrpx_quic_listener.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_quic_listener.cc'; fi` + +libnghttpx_a-shrpx_quic_connection_handler.o: shrpx_quic_connection_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_quic_connection_handler.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Tpo -c -o libnghttpx_a-shrpx_quic_connection_handler.o `test -f 'shrpx_quic_connection_handler.cc' || echo '$(srcdir)/'`shrpx_quic_connection_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Tpo $(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_quic_connection_handler.cc' object='libnghttpx_a-shrpx_quic_connection_handler.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_quic_connection_handler.o `test -f 'shrpx_quic_connection_handler.cc' || echo '$(srcdir)/'`shrpx_quic_connection_handler.cc + +libnghttpx_a-shrpx_quic_connection_handler.obj: shrpx_quic_connection_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_quic_connection_handler.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Tpo -c -o libnghttpx_a-shrpx_quic_connection_handler.obj `if test -f 'shrpx_quic_connection_handler.cc'; then $(CYGPATH_W) 'shrpx_quic_connection_handler.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_quic_connection_handler.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Tpo $(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_quic_connection_handler.cc' object='libnghttpx_a-shrpx_quic_connection_handler.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_quic_connection_handler.obj `if test -f 'shrpx_quic_connection_handler.cc'; then $(CYGPATH_W) 'shrpx_quic_connection_handler.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_quic_connection_handler.cc'; fi` + +libnghttpx_a-shrpx_http3_upstream.o: shrpx_http3_upstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http3_upstream.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Tpo -c -o libnghttpx_a-shrpx_http3_upstream.o `test -f 'shrpx_http3_upstream.cc' || echo '$(srcdir)/'`shrpx_http3_upstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http3_upstream.cc' object='libnghttpx_a-shrpx_http3_upstream.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http3_upstream.o `test -f 'shrpx_http3_upstream.cc' || echo '$(srcdir)/'`shrpx_http3_upstream.cc + +libnghttpx_a-shrpx_http3_upstream.obj: shrpx_http3_upstream.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-shrpx_http3_upstream.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Tpo -c -o libnghttpx_a-shrpx_http3_upstream.obj `if test -f 'shrpx_http3_upstream.cc'; then $(CYGPATH_W) 'shrpx_http3_upstream.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http3_upstream.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Tpo $(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http3_upstream.cc' object='libnghttpx_a-shrpx_http3_upstream.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-shrpx_http3_upstream.obj `if test -f 'shrpx_http3_upstream.cc'; then $(CYGPATH_W) 'shrpx_http3_upstream.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http3_upstream.cc'; fi` + +libnghttpx_a-http3.o: http3.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-http3.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-http3.Tpo -c -o libnghttpx_a-http3.o `test -f 'http3.cc' || echo '$(srcdir)/'`http3.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-http3.Tpo $(DEPDIR)/libnghttpx_a-http3.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='http3.cc' object='libnghttpx_a-http3.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-http3.o `test -f 'http3.cc' || echo '$(srcdir)/'`http3.cc + +libnghttpx_a-http3.obj: http3.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-http3.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-http3.Tpo -c -o libnghttpx_a-http3.obj `if test -f 'http3.cc'; then $(CYGPATH_W) 'http3.cc'; else $(CYGPATH_W) '$(srcdir)/http3.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-http3.Tpo $(DEPDIR)/libnghttpx_a-http3.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='http3.cc' object='libnghttpx_a-http3.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-http3.obj `if test -f 'http3.cc'; then $(CYGPATH_W) 'http3.cc'; else $(CYGPATH_W) '$(srcdir)/http3.cc'; fi` + +libnghttpx_a-quic.o: quic.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-quic.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-quic.Tpo -c -o libnghttpx_a-quic.o `test -f 'quic.cc' || echo '$(srcdir)/'`quic.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-quic.Tpo $(DEPDIR)/libnghttpx_a-quic.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='quic.cc' object='libnghttpx_a-quic.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-quic.o `test -f 'quic.cc' || echo '$(srcdir)/'`quic.cc + +libnghttpx_a-quic.obj: quic.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-quic.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-quic.Tpo -c -o libnghttpx_a-quic.obj `if test -f 'quic.cc'; then $(CYGPATH_W) 'quic.cc'; else $(CYGPATH_W) '$(srcdir)/quic.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-quic.Tpo $(DEPDIR)/libnghttpx_a-quic.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='quic.cc' object='libnghttpx_a-quic.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-quic.obj `if test -f 'quic.cc'; then $(CYGPATH_W) 'quic.cc'; else $(CYGPATH_W) '$(srcdir)/quic.cc'; fi` + +libnghttpx_a-siphash.o: siphash.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-siphash.o -MD -MP -MF $(DEPDIR)/libnghttpx_a-siphash.Tpo -c -o libnghttpx_a-siphash.o `test -f 'siphash.cc' || echo '$(srcdir)/'`siphash.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-siphash.Tpo $(DEPDIR)/libnghttpx_a-siphash.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='siphash.cc' object='libnghttpx_a-siphash.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-siphash.o `test -f 'siphash.cc' || echo '$(srcdir)/'`siphash.cc + +libnghttpx_a-siphash.obj: siphash.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libnghttpx_a-siphash.obj -MD -MP -MF $(DEPDIR)/libnghttpx_a-siphash.Tpo -c -o libnghttpx_a-siphash.obj `if test -f 'siphash.cc'; then $(CYGPATH_W) 'siphash.cc'; else $(CYGPATH_W) '$(srcdir)/siphash.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnghttpx_a-siphash.Tpo $(DEPDIR)/libnghttpx_a-siphash.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='siphash.cc' object='libnghttpx_a-siphash.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnghttpx_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libnghttpx_a-siphash.obj `if test -f 'siphash.cc'; then $(CYGPATH_W) 'siphash.cc'; else $(CYGPATH_W) '$(srcdir)/siphash.cc'; fi` + +nghttpx-shrpx.o: shrpx.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx-shrpx.o -MD -MP -MF $(DEPDIR)/nghttpx-shrpx.Tpo -c -o nghttpx-shrpx.o `test -f 'shrpx.cc' || echo '$(srcdir)/'`shrpx.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx-shrpx.Tpo $(DEPDIR)/nghttpx-shrpx.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx.cc' object='nghttpx-shrpx.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx-shrpx.o `test -f 'shrpx.cc' || echo '$(srcdir)/'`shrpx.cc + +nghttpx-shrpx.obj: shrpx.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx-shrpx.obj -MD -MP -MF $(DEPDIR)/nghttpx-shrpx.Tpo -c -o nghttpx-shrpx.obj `if test -f 'shrpx.cc'; then $(CYGPATH_W) 'shrpx.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx-shrpx.Tpo $(DEPDIR)/nghttpx-shrpx.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx.cc' object='nghttpx-shrpx.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx-shrpx.obj `if test -f 'shrpx.cc'; then $(CYGPATH_W) 'shrpx.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx.cc'; fi` + +nghttpx_unittest-shrpx-unittest.o: shrpx-unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx-unittest.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx-unittest.Tpo -c -o nghttpx_unittest-shrpx-unittest.o `test -f 'shrpx-unittest.cc' || echo '$(srcdir)/'`shrpx-unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx-unittest.Tpo $(DEPDIR)/nghttpx_unittest-shrpx-unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx-unittest.cc' object='nghttpx_unittest-shrpx-unittest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx-unittest.o `test -f 'shrpx-unittest.cc' || echo '$(srcdir)/'`shrpx-unittest.cc + +nghttpx_unittest-shrpx-unittest.obj: shrpx-unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx-unittest.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx-unittest.Tpo -c -o nghttpx_unittest-shrpx-unittest.obj `if test -f 'shrpx-unittest.cc'; then $(CYGPATH_W) 'shrpx-unittest.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx-unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx-unittest.Tpo $(DEPDIR)/nghttpx_unittest-shrpx-unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx-unittest.cc' object='nghttpx_unittest-shrpx-unittest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx-unittest.obj `if test -f 'shrpx-unittest.cc'; then $(CYGPATH_W) 'shrpx-unittest.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx-unittest.cc'; fi` + +nghttpx_unittest-shrpx_tls_test.o: shrpx_tls_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_tls_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Tpo -c -o nghttpx_unittest-shrpx_tls_test.o `test -f 'shrpx_tls_test.cc' || echo '$(srcdir)/'`shrpx_tls_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_tls_test.cc' object='nghttpx_unittest-shrpx_tls_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_tls_test.o `test -f 'shrpx_tls_test.cc' || echo '$(srcdir)/'`shrpx_tls_test.cc + +nghttpx_unittest-shrpx_tls_test.obj: shrpx_tls_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_tls_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Tpo -c -o nghttpx_unittest-shrpx_tls_test.obj `if test -f 'shrpx_tls_test.cc'; then $(CYGPATH_W) 'shrpx_tls_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_tls_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_tls_test.cc' object='nghttpx_unittest-shrpx_tls_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_tls_test.obj `if test -f 'shrpx_tls_test.cc'; then $(CYGPATH_W) 'shrpx_tls_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_tls_test.cc'; fi` + +nghttpx_unittest-shrpx_downstream_test.o: shrpx_downstream_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_downstream_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Tpo -c -o nghttpx_unittest-shrpx_downstream_test.o `test -f 'shrpx_downstream_test.cc' || echo '$(srcdir)/'`shrpx_downstream_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream_test.cc' object='nghttpx_unittest-shrpx_downstream_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_downstream_test.o `test -f 'shrpx_downstream_test.cc' || echo '$(srcdir)/'`shrpx_downstream_test.cc + +nghttpx_unittest-shrpx_downstream_test.obj: shrpx_downstream_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_downstream_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Tpo -c -o nghttpx_unittest-shrpx_downstream_test.obj `if test -f 'shrpx_downstream_test.cc'; then $(CYGPATH_W) 'shrpx_downstream_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_downstream_test.cc' object='nghttpx_unittest-shrpx_downstream_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_downstream_test.obj `if test -f 'shrpx_downstream_test.cc'; then $(CYGPATH_W) 'shrpx_downstream_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_downstream_test.cc'; fi` + +nghttpx_unittest-shrpx_config_test.o: shrpx_config_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_config_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_config_test.Tpo -c -o nghttpx_unittest-shrpx_config_test.o `test -f 'shrpx_config_test.cc' || echo '$(srcdir)/'`shrpx_config_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_config_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_config_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_config_test.cc' object='nghttpx_unittest-shrpx_config_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_config_test.o `test -f 'shrpx_config_test.cc' || echo '$(srcdir)/'`shrpx_config_test.cc + +nghttpx_unittest-shrpx_config_test.obj: shrpx_config_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_config_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_config_test.Tpo -c -o nghttpx_unittest-shrpx_config_test.obj `if test -f 'shrpx_config_test.cc'; then $(CYGPATH_W) 'shrpx_config_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_config_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_config_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_config_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_config_test.cc' object='nghttpx_unittest-shrpx_config_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_config_test.obj `if test -f 'shrpx_config_test.cc'; then $(CYGPATH_W) 'shrpx_config_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_config_test.cc'; fi` + +nghttpx_unittest-shrpx_worker_test.o: shrpx_worker_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_worker_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Tpo -c -o nghttpx_unittest-shrpx_worker_test.o `test -f 'shrpx_worker_test.cc' || echo '$(srcdir)/'`shrpx_worker_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_worker_test.cc' object='nghttpx_unittest-shrpx_worker_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_worker_test.o `test -f 'shrpx_worker_test.cc' || echo '$(srcdir)/'`shrpx_worker_test.cc + +nghttpx_unittest-shrpx_worker_test.obj: shrpx_worker_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_worker_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Tpo -c -o nghttpx_unittest-shrpx_worker_test.obj `if test -f 'shrpx_worker_test.cc'; then $(CYGPATH_W) 'shrpx_worker_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_worker_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_worker_test.cc' object='nghttpx_unittest-shrpx_worker_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_worker_test.obj `if test -f 'shrpx_worker_test.cc'; then $(CYGPATH_W) 'shrpx_worker_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_worker_test.cc'; fi` + +nghttpx_unittest-shrpx_http_test.o: shrpx_http_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_http_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_http_test.Tpo -c -o nghttpx_unittest-shrpx_http_test.o `test -f 'shrpx_http_test.cc' || echo '$(srcdir)/'`shrpx_http_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_http_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_http_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http_test.cc' object='nghttpx_unittest-shrpx_http_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_http_test.o `test -f 'shrpx_http_test.cc' || echo '$(srcdir)/'`shrpx_http_test.cc + +nghttpx_unittest-shrpx_http_test.obj: shrpx_http_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_http_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_http_test.Tpo -c -o nghttpx_unittest-shrpx_http_test.obj `if test -f 'shrpx_http_test.cc'; then $(CYGPATH_W) 'shrpx_http_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_http_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_http_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_http_test.cc' object='nghttpx_unittest-shrpx_http_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_http_test.obj `if test -f 'shrpx_http_test.cc'; then $(CYGPATH_W) 'shrpx_http_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_http_test.cc'; fi` + +nghttpx_unittest-shrpx_router_test.o: shrpx_router_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_router_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_router_test.Tpo -c -o nghttpx_unittest-shrpx_router_test.o `test -f 'shrpx_router_test.cc' || echo '$(srcdir)/'`shrpx_router_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_router_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_router_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_router_test.cc' object='nghttpx_unittest-shrpx_router_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_router_test.o `test -f 'shrpx_router_test.cc' || echo '$(srcdir)/'`shrpx_router_test.cc + +nghttpx_unittest-shrpx_router_test.obj: shrpx_router_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-shrpx_router_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-shrpx_router_test.Tpo -c -o nghttpx_unittest-shrpx_router_test.obj `if test -f 'shrpx_router_test.cc'; then $(CYGPATH_W) 'shrpx_router_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_router_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-shrpx_router_test.Tpo $(DEPDIR)/nghttpx_unittest-shrpx_router_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='shrpx_router_test.cc' object='nghttpx_unittest-shrpx_router_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-shrpx_router_test.obj `if test -f 'shrpx_router_test.cc'; then $(CYGPATH_W) 'shrpx_router_test.cc'; else $(CYGPATH_W) '$(srcdir)/shrpx_router_test.cc'; fi` + +nghttpx_unittest-http2_test.o: http2_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-http2_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-http2_test.Tpo -c -o nghttpx_unittest-http2_test.o `test -f 'http2_test.cc' || echo '$(srcdir)/'`http2_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-http2_test.Tpo $(DEPDIR)/nghttpx_unittest-http2_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='http2_test.cc' object='nghttpx_unittest-http2_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-http2_test.o `test -f 'http2_test.cc' || echo '$(srcdir)/'`http2_test.cc + +nghttpx_unittest-http2_test.obj: http2_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-http2_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-http2_test.Tpo -c -o nghttpx_unittest-http2_test.obj `if test -f 'http2_test.cc'; then $(CYGPATH_W) 'http2_test.cc'; else $(CYGPATH_W) '$(srcdir)/http2_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-http2_test.Tpo $(DEPDIR)/nghttpx_unittest-http2_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='http2_test.cc' object='nghttpx_unittest-http2_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-http2_test.obj `if test -f 'http2_test.cc'; then $(CYGPATH_W) 'http2_test.cc'; else $(CYGPATH_W) '$(srcdir)/http2_test.cc'; fi` + +nghttpx_unittest-util_test.o: util_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-util_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-util_test.Tpo -c -o nghttpx_unittest-util_test.o `test -f 'util_test.cc' || echo '$(srcdir)/'`util_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-util_test.Tpo $(DEPDIR)/nghttpx_unittest-util_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='util_test.cc' object='nghttpx_unittest-util_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-util_test.o `test -f 'util_test.cc' || echo '$(srcdir)/'`util_test.cc + +nghttpx_unittest-util_test.obj: util_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-util_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-util_test.Tpo -c -o nghttpx_unittest-util_test.obj `if test -f 'util_test.cc'; then $(CYGPATH_W) 'util_test.cc'; else $(CYGPATH_W) '$(srcdir)/util_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-util_test.Tpo $(DEPDIR)/nghttpx_unittest-util_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='util_test.cc' object='nghttpx_unittest-util_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-util_test.obj `if test -f 'util_test.cc'; then $(CYGPATH_W) 'util_test.cc'; else $(CYGPATH_W) '$(srcdir)/util_test.cc'; fi` + +nghttpx_unittest-buffer_test.o: buffer_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-buffer_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-buffer_test.Tpo -c -o nghttpx_unittest-buffer_test.o `test -f 'buffer_test.cc' || echo '$(srcdir)/'`buffer_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-buffer_test.Tpo $(DEPDIR)/nghttpx_unittest-buffer_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='buffer_test.cc' object='nghttpx_unittest-buffer_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-buffer_test.o `test -f 'buffer_test.cc' || echo '$(srcdir)/'`buffer_test.cc + +nghttpx_unittest-buffer_test.obj: buffer_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-buffer_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-buffer_test.Tpo -c -o nghttpx_unittest-buffer_test.obj `if test -f 'buffer_test.cc'; then $(CYGPATH_W) 'buffer_test.cc'; else $(CYGPATH_W) '$(srcdir)/buffer_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-buffer_test.Tpo $(DEPDIR)/nghttpx_unittest-buffer_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='buffer_test.cc' object='nghttpx_unittest-buffer_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-buffer_test.obj `if test -f 'buffer_test.cc'; then $(CYGPATH_W) 'buffer_test.cc'; else $(CYGPATH_W) '$(srcdir)/buffer_test.cc'; fi` + +nghttpx_unittest-memchunk_test.o: memchunk_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-memchunk_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-memchunk_test.Tpo -c -o nghttpx_unittest-memchunk_test.o `test -f 'memchunk_test.cc' || echo '$(srcdir)/'`memchunk_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-memchunk_test.Tpo $(DEPDIR)/nghttpx_unittest-memchunk_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='memchunk_test.cc' object='nghttpx_unittest-memchunk_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-memchunk_test.o `test -f 'memchunk_test.cc' || echo '$(srcdir)/'`memchunk_test.cc + +nghttpx_unittest-memchunk_test.obj: memchunk_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-memchunk_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-memchunk_test.Tpo -c -o nghttpx_unittest-memchunk_test.obj `if test -f 'memchunk_test.cc'; then $(CYGPATH_W) 'memchunk_test.cc'; else $(CYGPATH_W) '$(srcdir)/memchunk_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-memchunk_test.Tpo $(DEPDIR)/nghttpx_unittest-memchunk_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='memchunk_test.cc' object='nghttpx_unittest-memchunk_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-memchunk_test.obj `if test -f 'memchunk_test.cc'; then $(CYGPATH_W) 'memchunk_test.cc'; else $(CYGPATH_W) '$(srcdir)/memchunk_test.cc'; fi` + +nghttpx_unittest-template_test.o: template_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-template_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-template_test.Tpo -c -o nghttpx_unittest-template_test.o `test -f 'template_test.cc' || echo '$(srcdir)/'`template_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-template_test.Tpo $(DEPDIR)/nghttpx_unittest-template_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='template_test.cc' object='nghttpx_unittest-template_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-template_test.o `test -f 'template_test.cc' || echo '$(srcdir)/'`template_test.cc + +nghttpx_unittest-template_test.obj: template_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-template_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-template_test.Tpo -c -o nghttpx_unittest-template_test.obj `if test -f 'template_test.cc'; then $(CYGPATH_W) 'template_test.cc'; else $(CYGPATH_W) '$(srcdir)/template_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-template_test.Tpo $(DEPDIR)/nghttpx_unittest-template_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='template_test.cc' object='nghttpx_unittest-template_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-template_test.obj `if test -f 'template_test.cc'; then $(CYGPATH_W) 'template_test.cc'; else $(CYGPATH_W) '$(srcdir)/template_test.cc'; fi` + +nghttpx_unittest-base64_test.o: base64_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-base64_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-base64_test.Tpo -c -o nghttpx_unittest-base64_test.o `test -f 'base64_test.cc' || echo '$(srcdir)/'`base64_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-base64_test.Tpo $(DEPDIR)/nghttpx_unittest-base64_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='base64_test.cc' object='nghttpx_unittest-base64_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-base64_test.o `test -f 'base64_test.cc' || echo '$(srcdir)/'`base64_test.cc + +nghttpx_unittest-base64_test.obj: base64_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-base64_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-base64_test.Tpo -c -o nghttpx_unittest-base64_test.obj `if test -f 'base64_test.cc'; then $(CYGPATH_W) 'base64_test.cc'; else $(CYGPATH_W) '$(srcdir)/base64_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-base64_test.Tpo $(DEPDIR)/nghttpx_unittest-base64_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='base64_test.cc' object='nghttpx_unittest-base64_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-base64_test.obj `if test -f 'base64_test.cc'; then $(CYGPATH_W) 'base64_test.cc'; else $(CYGPATH_W) '$(srcdir)/base64_test.cc'; fi` + +nghttpx_unittest-siphash_test.o: siphash_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-siphash_test.o -MD -MP -MF $(DEPDIR)/nghttpx_unittest-siphash_test.Tpo -c -o nghttpx_unittest-siphash_test.o `test -f 'siphash_test.cc' || echo '$(srcdir)/'`siphash_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-siphash_test.Tpo $(DEPDIR)/nghttpx_unittest-siphash_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='siphash_test.cc' object='nghttpx_unittest-siphash_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-siphash_test.o `test -f 'siphash_test.cc' || echo '$(srcdir)/'`siphash_test.cc + +nghttpx_unittest-siphash_test.obj: siphash_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nghttpx_unittest-siphash_test.obj -MD -MP -MF $(DEPDIR)/nghttpx_unittest-siphash_test.Tpo -c -o nghttpx_unittest-siphash_test.obj `if test -f 'siphash_test.cc'; then $(CYGPATH_W) 'siphash_test.cc'; else $(CYGPATH_W) '$(srcdir)/siphash_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nghttpx_unittest-siphash_test.Tpo $(DEPDIR)/nghttpx_unittest-siphash_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='siphash_test.cc' object='nghttpx_unittest-siphash_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nghttpx_unittest_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nghttpx_unittest-siphash_test.obj `if test -f 'siphash_test.cc'; then $(CYGPATH_W) 'siphash_test.cc'; else $(CYGPATH_W) '$(srcdir)/siphash_test.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +nghttpx-unittest.log: nghttpx-unittest$(EXEEXT) + @p='nghttpx-unittest$(EXEEXT)'; \ + b='nghttpx-unittest'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile $(PROGRAMS) $(LIBRARIES) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(top_builddir)/tests/munit/$(DEPDIR)/$(am__dirstamp)" || rm -f $(top_builddir)/tests/munit/$(DEPDIR)/$(am__dirstamp) + -test -z "$(top_builddir)/tests/munit/$(am__dirstamp)" || rm -f $(top_builddir)/tests/munit/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + clean-libtool clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f $(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Po + -rm -f ./$(DEPDIR)/HtmlParser.Po + -rm -f ./$(DEPDIR)/HttpServer.Po + -rm -f ./$(DEPDIR)/app_helper.Po + -rm -f ./$(DEPDIR)/comp_helper.Po + -rm -f ./$(DEPDIR)/deflatehd.Po + -rm -f ./$(DEPDIR)/h2load.Po + -rm -f ./$(DEPDIR)/h2load_http1_session.Po + -rm -f ./$(DEPDIR)/h2load_http2_session.Po + -rm -f ./$(DEPDIR)/h2load_http3_session.Po + -rm -f ./$(DEPDIR)/h2load_quic.Po + -rm -f ./$(DEPDIR)/http2.Po + -rm -f ./$(DEPDIR)/inflatehd.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-app_helper.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-http2.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-http3.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-quic.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_client_handler.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_config.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_downstream.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_exec.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http2_session.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_io_control.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_live_check.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_log.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_log_config.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_quic.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_router.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_signal.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_tls.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_worker.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_worker_process.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-siphash.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-timegm.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-tls.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-util.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-xsi_strerror.Po + -rm -f ./$(DEPDIR)/nghttp.Po + -rm -f ./$(DEPDIR)/nghttp2_gzip.Po + -rm -f ./$(DEPDIR)/nghttpd.Po + -rm -f ./$(DEPDIR)/nghttpx-shrpx.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-base64_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-buffer_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-http2_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-memchunk_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx-unittest.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_config_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_http_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_router_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-siphash_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-template_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-util_test.Po + -rm -f ./$(DEPDIR)/quic.Po + -rm -f ./$(DEPDIR)/timegm.Po + -rm -f ./$(DEPDIR)/tls.Po + -rm -f ./$(DEPDIR)/util.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(top_builddir)/tests/munit/$(DEPDIR)/nghttpx_unittest-munit.Po + -rm -f ./$(DEPDIR)/HtmlParser.Po + -rm -f ./$(DEPDIR)/HttpServer.Po + -rm -f ./$(DEPDIR)/app_helper.Po + -rm -f ./$(DEPDIR)/comp_helper.Po + -rm -f ./$(DEPDIR)/deflatehd.Po + -rm -f ./$(DEPDIR)/h2load.Po + -rm -f ./$(DEPDIR)/h2load_http1_session.Po + -rm -f ./$(DEPDIR)/h2load_http2_session.Po + -rm -f ./$(DEPDIR)/h2load_http3_session.Po + -rm -f ./$(DEPDIR)/h2load_quic.Po + -rm -f ./$(DEPDIR)/http2.Po + -rm -f ./$(DEPDIR)/inflatehd.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-app_helper.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-http2.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-http3.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-quic.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_accept_handler.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_api_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_client_handler.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_config.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_connect_blocker.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_connection_handler.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_dns_resolver.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_dns_tracker.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_downstream.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_downstream_connection_pool.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_downstream_queue.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_dual_dns_resolver.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_exec.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_health_monitor_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http2_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http2_session.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http2_upstream.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http3_upstream.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_http_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_https_upstream.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_io_control.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_live_check.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_log.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_log_config.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_memcached_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_memcached_dispatcher.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_env.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_request.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_mruby_module_response.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_null_downstream_connection.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_quic.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_quic_connection_handler.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_quic_listener.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_rate_limit.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_router.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_signal.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_tls.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_worker.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-shrpx_worker_process.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-siphash.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-timegm.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-tls.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-util.Po + -rm -f ./$(DEPDIR)/libnghttpx_a-xsi_strerror.Po + -rm -f ./$(DEPDIR)/nghttp.Po + -rm -f ./$(DEPDIR)/nghttp2_gzip.Po + -rm -f ./$(DEPDIR)/nghttpd.Po + -rm -f ./$(DEPDIR)/nghttpx-shrpx.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-base64_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-buffer_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-http2_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-memchunk_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-nghttp2_gzip.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-nghttp2_gzip_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx-unittest.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_config_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_downstream_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_http_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_router_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_tls_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-shrpx_worker_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-siphash_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-template_test.Po + -rm -f ./$(DEPDIR)/nghttpx_unittest-util_test.Po + -rm -f ./$(DEPDIR)/quic.Po + -rm -f ./$(DEPDIR)/timegm.Po + -rm -f ./$(DEPDIR)/tls.Po + -rm -f ./$(DEPDIR)/util.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-TESTS check-am clean \ + clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + clean-libtool clean-noinstLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am recheck tags tags-am uninstall \ + uninstall-am uninstall-binPROGRAMS + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/src/allocator.h b/lib/nghttp2-1.65.0/src/allocator.h similarity index 80% rename from lib/nghttp2/src/allocator.h rename to lib/nghttp2-1.65.0/src/allocator.h index 97b9a418182..4126e45b1cc 100644 --- a/lib/nghttp2/src/allocator.h +++ b/lib/nghttp2-1.65.0/src/allocator.h @@ -33,6 +33,7 @@ #include #include +#include #include "template.h" @@ -48,6 +49,18 @@ struct MemBlock { uint8_t *begin, *last, *end; }; +static_assert((sizeof(MemBlock) & 0xf) == 0); + +struct ChunkHead { + union { + size_t size; + uint64_t pad1; + }; + uint64_t pad2; +}; + +static_assert(sizeof(ChunkHead) == 16); + // BlockAllocator allocates memory block with given size at once, and // cuts the region from it when allocation is requested. If the // requested size is larger than given threshold (plus small internal @@ -56,20 +69,20 @@ struct MemBlock { // |block_size|. struct BlockAllocator { BlockAllocator(size_t block_size, size_t isolation_threshold) - : retain(nullptr), - head(nullptr), - block_size(block_size), - isolation_threshold(std::min(block_size, isolation_threshold)) { + : retain(nullptr), + head(nullptr), + block_size(block_size), + isolation_threshold(std::min(block_size, isolation_threshold)) { assert(isolation_threshold <= block_size); } ~BlockAllocator() { reset(); } BlockAllocator(BlockAllocator &&other) noexcept - : retain{std::exchange(other.retain, nullptr)}, - head{std::exchange(other.head, nullptr)}, - block_size(other.block_size), - isolation_threshold(other.isolation_threshold) {} + : retain{std::exchange(other.retain, nullptr)}, + head{std::exchange(other.head, nullptr)}, + block_size(other.block_size), + isolation_threshold(other.isolation_threshold) {} BlockAllocator &operator=(BlockAllocator &&other) noexcept { reset(); @@ -88,7 +101,7 @@ struct BlockAllocator { void reset() { for (auto mb = retain; mb;) { auto next = mb->next; - delete[] reinterpret_cast(mb); + operator delete[](reinterpret_cast(mb), std::align_val_t(16)); mb = next; } @@ -97,39 +110,43 @@ struct BlockAllocator { } MemBlock *alloc_mem_block(size_t size) { - auto block = new uint8_t[sizeof(MemBlock) + size]; + auto block = new (std::align_val_t(16)) uint8_t[sizeof(MemBlock) + size]; auto mb = reinterpret_cast(block); mb->next = retain; - mb->begin = mb->last = block + sizeof(MemBlock); + mb->begin = mb->last = reinterpret_cast( + (reinterpret_cast(block + sizeof(MemBlock)) + 0xf) & ~0xf); mb->end = mb->begin + size; retain = mb; return mb; } + constexpr size_t alloc_unit(size_t size) { return sizeof(ChunkHead) + size; } + void *alloc(size_t size) { - if (size + sizeof(size_t) >= isolation_threshold) { - auto len = std::max(static_cast(16), size); + auto au = alloc_unit(size); + + if (au >= isolation_threshold) { + size = std::max(static_cast(16), size); // We will store the allocated size in size_t field. - auto mb = alloc_mem_block(len + sizeof(size_t)); - auto sp = reinterpret_cast(mb->begin); - *sp = len; + auto mb = alloc_mem_block(alloc_unit(size)); + auto ch = reinterpret_cast(mb->begin); + ch->size = size; mb->last = mb->end; - return mb->begin + sizeof(size_t); + return mb->begin + sizeof(ChunkHead); } - if (!head || - head->end - head->last < static_cast(size + sizeof(size_t))) { + if (!head || static_cast(head->end - head->last) < au) { head = alloc_mem_block(block_size); } // We will store the allocated size in size_t field. - auto res = head->last + sizeof(size_t); - auto sp = reinterpret_cast(head->last); - *sp = size; + auto res = head->last + sizeof(ChunkHead); + auto ch = reinterpret_cast(head->last); + ch->size = size; head->last = reinterpret_cast( - (reinterpret_cast(res + size) + 0xf) & ~0xf); + (reinterpret_cast(res + size) + 0xf) & ~0xf); return res; } @@ -137,8 +154,9 @@ struct BlockAllocator { // Returns allocated size for memory pointed by |ptr|. We assume // that |ptr| was returned from alloc() or realloc(). size_t get_alloc_length(void *ptr) { - return *reinterpret_cast(static_cast(ptr) - - sizeof(size_t)); + return reinterpret_cast(static_cast(ptr) - + sizeof(ChunkHead)) + ->size; } // Allocates memory of at least |size| bytes. If |ptr| is nullptr, @@ -243,9 +261,9 @@ StringRef realloc_concat_string_ref(BlockAllocator &alloc, } auto len = - value.size() + concat_string_ref_count(0, std::forward(args)...); + value.size() + concat_string_ref_count(0, std::forward(args)...); auto dst = static_cast( - alloc.realloc(const_cast(value.byte()), len + 1)); + alloc.realloc(const_cast(value.byte()), len + 1)); auto p = dst + value.size(); p = concat_string_ref_copy(p, std::forward(args)...); *p = '\0'; @@ -253,19 +271,10 @@ StringRef realloc_concat_string_ref(BlockAllocator &alloc, return StringRef{dst, len}; } -struct ByteRef { - // The pointer to the beginning of the buffer. - uint8_t *base; - // The length of the buffer. - size_t len; -}; - -// Makes a buffer with given size. The resulting byte string might -// not be NULL-terminated. +// Makes an uninitialized buffer with given size. template -ByteRef make_byte_ref(BlockAllocator &alloc, size_t size) { - auto dst = static_cast(alloc.alloc(size)); - return {dst, size}; +std::span make_byte_ref(BlockAllocator &alloc, size_t size) { + return {static_cast(alloc.alloc(size)), size}; } } // namespace nghttp2 diff --git a/lib/nghttp2/src/app_helper.cc b/lib/nghttp2-1.65.0/src/app_helper.cc similarity index 90% rename from lib/nghttp2/src/app_helper.cc rename to lib/nghttp2-1.65.0/src/app_helper.cc index ef9276285a7..078b84f19c0 100644 --- a/lib/nghttp2/src/app_helper.cc +++ b/lib/nghttp2-1.65.0/src/app_helper.cc @@ -53,8 +53,6 @@ #include #include -#include - #include "app_helper.h" #include "util.h" #include "http2.h" @@ -117,11 +115,11 @@ std::string strframetype(uint8_t type) { } std::string s = "extension(0x"; - s += util::format_hex(&type, 1); + s += util::format_hex(std::span{&type, 1}); s += ')'; return s; -}; +} } // namespace namespace { @@ -331,20 +329,20 @@ void print_frame(print_type ptype, const nghttp2_frame *frame) { case NGHTTP2_PING: print_frame_attr_indent(); fprintf(outfile, "(opaque_data=%s)\n", - util::format_hex(frame->ping.opaque_data, 8).c_str()); + util::format_hex(frame->ping.opaque_data).c_str()); break; case NGHTTP2_GOAWAY: print_frame_attr_indent(); - fprintf(outfile, - "(last_stream_id=%d, error_code=%s(0x%02x), " - "opaque_data(%u)=[%s])\n", - frame->goaway.last_stream_id, - nghttp2_http2_strerror(frame->goaway.error_code), - frame->goaway.error_code, - static_cast(frame->goaway.opaque_data_len), - util::ascii_dump(frame->goaway.opaque_data, - frame->goaway.opaque_data_len) - .c_str()); + fprintf( + outfile, + "(last_stream_id=%d, error_code=%s(0x%02x), " + "opaque_data(%u)=[%s])\n", + frame->goaway.last_stream_id, + nghttp2_http2_strerror(frame->goaway.error_code), + frame->goaway.error_code, + static_cast(frame->goaway.opaque_data_len), + util::ascii_dump(frame->goaway.opaque_data, frame->goaway.opaque_data_len) + .c_str()); break; case NGHTTP2_WINDOW_UPDATE: print_frame_attr_indent(); @@ -370,7 +368,7 @@ void print_frame(print_type ptype, const nghttp2_frame *frame) { } case NGHTTP2_PRIORITY_UPDATE: { auto priority_update = - static_cast(frame->ext.payload); + static_cast(frame->ext.payload); print_frame_attr_indent(); fprintf(outfile, "(prioritized_stream_id=%d, priority_field_value=[%.*s])\n", @@ -443,7 +441,7 @@ int verbose_on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags, size_t len, void *user_data) { print_timer(); auto srecv = - nghttp2_session_get_stream_effective_recv_data_length(session, stream_id); + nghttp2_session_get_stream_effective_recv_data_length(session, stream_id); auto crecv = nghttp2_session_get_effective_recv_data_length(session); fprintf(outfile, @@ -477,42 +475,4 @@ std::chrono::steady_clock::time_point get_time() { return std::chrono::steady_clock::now(); } -ssize_t deflate_data(uint8_t *out, size_t outlen, const uint8_t *in, - size_t inlen) { - int rv; - z_stream zst{}; - uint8_t temp_out[8_k]; - auto temp_outlen = sizeof(temp_out); - - rv = deflateInit2(&zst, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 31, 9, - Z_DEFAULT_STRATEGY); - - if (rv != Z_OK) { - return -1; - } - - zst.avail_in = inlen; - zst.next_in = (uint8_t *)in; - zst.avail_out = temp_outlen; - zst.next_out = temp_out; - - rv = deflate(&zst, Z_FINISH); - - deflateEnd(&zst); - - if (rv != Z_STREAM_END) { - return -1; - } - - temp_outlen -= zst.avail_out; - - if (temp_outlen > outlen) { - return -1; - } - - memcpy(out, temp_out, temp_outlen); - - return temp_outlen; -} - } // namespace nghttp2 diff --git a/lib/nghttp2/src/app_helper.h b/lib/nghttp2-1.65.0/src/app_helper.h similarity index 97% rename from lib/nghttp2/src/app_helper.h rename to lib/nghttp2-1.65.0/src/app_helper.h index 5424054ffa0..a7ef7ccfcb8 100644 --- a/lib/nghttp2/src/app_helper.h +++ b/lib/nghttp2-1.65.0/src/app_helper.h @@ -90,9 +90,6 @@ void set_color_output(bool f); // used. void set_output(FILE *file); -ssize_t deflate_data(uint8_t *out, size_t outlen, const uint8_t *in, - size_t inlen); - } // namespace nghttp2 #endif // APP_HELPER_H diff --git a/lib/nghttp2/src/base64.h b/lib/nghttp2-1.65.0/src/base64.h similarity index 76% rename from lib/nghttp2/src/base64.h rename to lib/nghttp2-1.65.0/src/base64.h index 1bd51afa1dd..a19f9eba75e 100644 --- a/lib/nghttp2/src/base64.h +++ b/lib/nghttp2-1.65.0/src/base64.h @@ -38,11 +38,11 @@ namespace base64 { namespace { constexpr char B64_CHARS[] = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', - 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', - 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', }; } // namespace @@ -139,21 +139,20 @@ InputIt next_decode_input(InputIt first, InputIt last, const int *tbl) { template OutputIt decode(InputIt first, InputIt last, OutputIt d_first) { static constexpr int INDEX_TABLE[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1}; + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, + -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1}; assert(std::distance(first, last) % 4 == 0); auto p = d_first; for (; first != last;) { @@ -204,18 +203,19 @@ template std::string decode(InputIt first, InputIt last) { } template -StringRef decode(BlockAllocator &balloc, InputIt first, InputIt last) { +std::span decode(BlockAllocator &balloc, InputIt first, + InputIt last) { auto len = std::distance(first, last); if (len % 4 != 0) { - return StringRef::from_lit(""); + return {}; } auto iov = make_byte_ref(balloc, len / 4 * 3 + 1); - auto p = iov.base; + auto p = std::begin(iov); p = decode(first, last, p); *p = '\0'; - return StringRef{iov.base, p}; + return {std::begin(iov), p}; } } // namespace base64 diff --git a/lib/nghttp2/src/base64_test.cc b/lib/nghttp2-1.65.0/src/base64_test.cc similarity index 57% rename from lib/nghttp2/src/base64_test.cc rename to lib/nghttp2-1.65.0/src/base64_test.cc index 4324bd744ca..bc98326975c 100644 --- a/lib/nghttp2/src/base64_test.cc +++ b/lib/nghttp2-1.65.0/src/base64_test.cc @@ -27,94 +27,115 @@ #include #include -#include +#include "munitxx.h" #include #include "base64.h" +using namespace std::literals; + namespace nghttp2 { +namespace { +const MunitTest tests[]{ + munit_void_test(test_base64_encode), + munit_void_test(test_base64_decode), + munit_test_end(), +}; +} // namespace + +const MunitSuite base64_suite{ + "/base64", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + void test_base64_encode(void) { { std::string in = "\xff"; auto out = base64::encode(std::begin(in), std::end(in)); - CU_ASSERT("/w==" == out); + assert_stdstring_equal("/w==", out); } { std::string in = "\xff\xfe"; auto out = base64::encode(std::begin(in), std::end(in)); - CU_ASSERT("//4=" == out); + assert_stdstring_equal("//4=", out); } { std::string in = "\xff\xfe\xfd"; auto out = base64::encode(std::begin(in), std::end(in)); - CU_ASSERT("//79" == out); + assert_stdstring_equal("//79", out); } { std::string in = "\xff\xfe\xfd\xfc"; auto out = base64::encode(std::begin(in), std::end(in)); - CU_ASSERT("//79/A==" == out); + assert_stdstring_equal("//79/A==", out); } } void test_base64_decode(void) { BlockAllocator balloc(4096, 4096); { - std::string in = "/w=="; + auto in = "/w=="sv; auto out = base64::decode(std::begin(in), std::end(in)); - CU_ASSERT("\xff" == out); - CU_ASSERT("\xff" == base64::decode(balloc, std::begin(in), std::end(in))); + assert_stdsv_equal("\xff"sv, out); + assert_stdsv_equal("\xff"sv, StringRef{base64::decode( + balloc, std::begin(in), std::end(in))}); } { - std::string in = "//4="; + auto in = "//4="sv; auto out = base64::decode(std::begin(in), std::end(in)); - CU_ASSERT("\xff\xfe" == out); - CU_ASSERT("\xff\xfe" == - base64::decode(balloc, std::begin(in), std::end(in))); + assert_stdsv_equal("\xff\xfe"sv, out); + assert_stdsv_equal("\xff\xfe"sv, StringRef{base64::decode( + balloc, std::begin(in), std::end(in))}); } { - std::string in = "//79"; + auto in = "//79"sv; auto out = base64::decode(std::begin(in), std::end(in)); - CU_ASSERT("\xff\xfe\xfd" == out); - CU_ASSERT("\xff\xfe\xfd" == - base64::decode(balloc, std::begin(in), std::end(in))); + assert_stdsv_equal("\xff\xfe\xfd"sv, out); + assert_stdsv_equal( + "\xff\xfe\xfd"sv, + StringRef{base64::decode(balloc, std::begin(in), std::end(in))}); } { - std::string in = "//79/A=="; + auto in = "//79/A=="sv; auto out = base64::decode(std::begin(in), std::end(in)); - CU_ASSERT("\xff\xfe\xfd\xfc" == out); - CU_ASSERT("\xff\xfe\xfd\xfc" == - base64::decode(balloc, std::begin(in), std::end(in))); + assert_stdsv_equal("\xff\xfe\xfd\xfc"sv, out); + assert_stdsv_equal( + "\xff\xfe\xfd\xfc"sv, + StringRef{base64::decode(balloc, std::begin(in), std::end(in))}); } { // we check the number of valid input must be multiples of 4 - std::string in = "//79="; + auto in = "//79="sv; auto out = base64::decode(std::begin(in), std::end(in)); - CU_ASSERT("" == out); - CU_ASSERT("" == base64::decode(balloc, std::begin(in), std::end(in))); + assert_stdsv_equal(""sv, out); + assert_stdsv_equal( + ""sv, StringRef{base64::decode(balloc, std::begin(in), std::end(in))}); } { // ending invalid character at the boundary of multiples of 4 is // bad - std::string in = "bmdodHRw\n"; + auto in = "bmdodHRw\n"sv; auto out = base64::decode(std::begin(in), std::end(in)); - CU_ASSERT("" == out); - CU_ASSERT("" == base64::decode(balloc, std::begin(in), std::end(in))); + assert_stdsv_equal("", out); + assert_stdsv_equal( + ""sv, StringRef{base64::decode(balloc, std::begin(in), std::end(in))}); } { // after seeing '=', subsequent input must be also '='. - std::string in = "//79/A=A"; + auto in = "//79/A=A"sv; auto out = base64::decode(std::begin(in), std::end(in)); - CU_ASSERT("" == out); - CU_ASSERT("" == base64::decode(balloc, std::begin(in), std::end(in))); + assert_stdsv_equal(""sv, out); + assert_stdsv_equal( + ""sv, StringRef{base64::decode(balloc, std::begin(in), std::end(in))}); } { // additional '=' at the end is bad - std::string in = "//79/A======"; + auto in = "//79/A======"sv; auto out = base64::decode(std::begin(in), std::end(in)); - CU_ASSERT("" == out); - CU_ASSERT("" == base64::decode(balloc, std::begin(in), std::end(in))); + assert_stdsv_equal(""sv, out); + assert_stdsv_equal( + ""sv, StringRef{base64::decode(balloc, std::begin(in), std::end(in))}); } } diff --git a/lib/nghttp2/src/base64_test.h b/lib/nghttp2-1.65.0/src/base64_test.h similarity index 88% rename from lib/nghttp2/src/base64_test.h rename to lib/nghttp2-1.65.0/src/base64_test.h index 8bdb84f8ec2..1601a3fd8ee 100644 --- a/lib/nghttp2/src/base64_test.h +++ b/lib/nghttp2-1.65.0/src/base64_test.h @@ -29,10 +29,16 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace nghttp2 { -void test_base64_encode(void); -void test_base64_decode(void); +extern const MunitSuite base64_suite; + +munit_void_test_decl(test_base64_encode) +munit_void_test_decl(test_base64_decode) } // namespace nghttp2 diff --git a/lib/nghttp2/src/buffer.h b/lib/nghttp2-1.65.0/src/buffer.h similarity index 100% rename from lib/nghttp2/src/buffer.h rename to lib/nghttp2-1.65.0/src/buffer.h diff --git a/lib/nghttp2/src/buffer_test.cc b/lib/nghttp2-1.65.0/src/buffer_test.cc similarity index 61% rename from lib/nghttp2/src/buffer_test.cc rename to lib/nghttp2-1.65.0/src/buffer_test.cc index 38688edc7ad..2f66107a393 100644 --- a/lib/nghttp2/src/buffer_test.cc +++ b/lib/nghttp2-1.65.0/src/buffer_test.cc @@ -28,7 +28,7 @@ #include #include -#include +#include "munitxx.h" #include @@ -36,43 +36,54 @@ namespace nghttp2 { +namespace { +const MunitTest tests[]{ + munit_void_test(test_buffer_write), + munit_test_end(), +}; +} // namespace + +const MunitSuite buffer_suite{ + "/buffer", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + void test_buffer_write(void) { Buffer<16> b; - CU_ASSERT(0 == b.rleft()); - CU_ASSERT(16 == b.wleft()); + assert_size(0, ==, b.rleft()); + assert_size(16, ==, b.wleft()); b.write("012", 3); - CU_ASSERT(3 == b.rleft()); - CU_ASSERT(13 == b.wleft()); - CU_ASSERT(b.pos == std::begin(b.buf)); + assert_size(3, ==, b.rleft()); + assert_size(13, ==, b.wleft()); + assert_ptr_equal(b.pos, std::begin(b.buf)); b.drain(3); - CU_ASSERT(0 == b.rleft()); - CU_ASSERT(13 == b.wleft()); - CU_ASSERT(3 == b.pos - std::begin(b.buf)); + assert_size(0, ==, b.rleft()); + assert_size(13, ==, b.wleft()); + assert_ptrdiff(3, ==, b.pos - std::begin(b.buf)); auto n = b.write("0123456789ABCDEF", 16); - CU_ASSERT(n == 13); + assert_ssize(13, ==, n); - CU_ASSERT(13 == b.rleft()); - CU_ASSERT(0 == b.wleft()); - CU_ASSERT(3 == b.pos - std::begin(b.buf)); - CU_ASSERT(0 == memcmp(b.pos, "0123456789ABC", 13)); + assert_size(13, ==, b.rleft()); + assert_size(0, ==, b.wleft()); + assert_ptrdiff(3, ==, b.pos - std::begin(b.buf)); + assert_memory_equal(13, b.pos, "0123456789ABC"); b.reset(); - CU_ASSERT(0 == b.rleft()); - CU_ASSERT(16 == b.wleft()); - CU_ASSERT(b.pos == std::begin(b.buf)); + assert_size(0, ==, b.rleft()); + assert_size(16, ==, b.wleft()); + assert_ptr_equal(b.pos, std::begin(b.buf)); b.write(5); - CU_ASSERT(5 == b.rleft()); - CU_ASSERT(11 == b.wleft()); - CU_ASSERT(b.pos == std::begin(b.buf)); + assert_size(5, ==, b.rleft()); + assert_size(11, ==, b.wleft()); + assert_ptr_equal(b.pos, std::begin(b.buf)); } } // namespace nghttp2 diff --git a/lib/nghttp2/src/buffer_test.h b/lib/nghttp2-1.65.0/src/buffer_test.h similarity index 90% rename from lib/nghttp2/src/buffer_test.h rename to lib/nghttp2-1.65.0/src/buffer_test.h index 6789aa39bc5..562cb1e2182 100644 --- a/lib/nghttp2/src/buffer_test.h +++ b/lib/nghttp2-1.65.0/src/buffer_test.h @@ -29,9 +29,15 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace nghttp2 { -void test_buffer_write(void); +extern const MunitSuite buffer_suite; + +munit_void_test_decl(test_buffer_write) } // namespace nghttp2 diff --git a/lib/nghttp2/src/comp_helper.c b/lib/nghttp2-1.65.0/src/comp_helper.c similarity index 90% rename from lib/nghttp2/src/comp_helper.c rename to lib/nghttp2-1.65.0/src/comp_helper.c index 98db08a487a..b83e2e20170 100644 --- a/lib/nghttp2/src/comp_helper.c +++ b/lib/nghttp2-1.65.0/src/comp_helper.c @@ -52,13 +52,13 @@ json_t *dump_deflate_header_table(nghttp2_hd_deflater *deflater) { } json_object_set_new(obj, "entries", entries); json_object_set_new( - obj, "size", - json_integer( - (json_int_t)nghttp2_hd_deflate_get_dynamic_table_size(deflater))); + obj, "size", + json_integer( + (json_int_t)nghttp2_hd_deflate_get_dynamic_table_size(deflater))); json_object_set_new( - obj, "max_size", - json_integer( - (json_int_t)nghttp2_hd_deflate_get_max_dynamic_table_size(deflater))); + obj, "max_size", + json_integer( + (json_int_t)nghttp2_hd_deflate_get_max_dynamic_table_size(deflater))); return obj; } @@ -84,13 +84,13 @@ json_t *dump_inflate_header_table(nghttp2_hd_inflater *inflater) { } json_object_set_new(obj, "entries", entries); json_object_set_new( - obj, "size", - json_integer( - (json_int_t)nghttp2_hd_inflate_get_dynamic_table_size(inflater))); + obj, "size", + json_integer( + (json_int_t)nghttp2_hd_inflate_get_dynamic_table_size(inflater))); json_object_set_new( - obj, "max_size", - json_integer( - (json_int_t)nghttp2_hd_inflate_get_max_dynamic_table_size(inflater))); + obj, "max_size", + json_integer( + (json_int_t)nghttp2_hd_inflate_get_max_dynamic_table_size(inflater))); return obj; } diff --git a/lib/nghttp2/src/comp_helper.h b/lib/nghttp2-1.65.0/src/comp_helper.h similarity index 100% rename from lib/nghttp2/src/comp_helper.h rename to lib/nghttp2-1.65.0/src/comp_helper.h diff --git a/lib/nghttp2/src/deflatehd.cc b/lib/nghttp2-1.65.0/src/deflatehd.cc similarity index 95% rename from lib/nghttp2/src/deflatehd.cc rename to lib/nghttp2-1.65.0/src/deflatehd.cc index 7dcfccffcf7..ab38495eaf1 100644 --- a/lib/nghttp2/src/deflatehd.cc +++ b/lib/nghttp2-1.65.0/src/deflatehd.cc @@ -41,6 +41,7 @@ #include +#define NGHTTP2_NO_SSIZE_T #include #include "template.h" @@ -113,11 +114,10 @@ static void output_to_json(nghttp2_hd_deflater *deflater, const uint8_t *buf, static void deflate_hd(nghttp2_hd_deflater *deflater, const std::vector &nva, size_t inputlen, int seq) { - ssize_t rv; std::array buf; - rv = nghttp2_hd_deflate_hd(deflater, buf.data(), buf.size(), - (nghttp2_nv *)nva.data(), nva.size()); + auto rv = nghttp2_hd_deflate_hd2(deflater, buf.data(), buf.size(), + (nghttp2_nv *)nva.data(), nva.size()); if (rv < 0) { fprintf(stderr, "deflate failed with error code %zd at %d\n", rv, seq); exit(EXIT_FAILURE); @@ -375,11 +375,11 @@ The output of this program can be used as input for inflatehd. } constexpr static struct option long_options[] = { - {"http1text", no_argument, nullptr, 't'}, - {"table-size", required_argument, nullptr, 's'}, - {"deflate-table-size", required_argument, nullptr, 'S'}, - {"dump-header-table", no_argument, nullptr, 'd'}, - {nullptr, 0, nullptr, 0}}; + {"http1text", no_argument, nullptr, 't'}, + {"table-size", required_argument, nullptr, 's'}, + {"deflate-table-size", required_argument, nullptr, 'S'}, + {"dump-header-table", no_argument, nullptr, 'd'}, + {nullptr, 0, nullptr, 0}}; int main(int argc, char **argv) { config.table_size = 4_k; @@ -403,21 +403,21 @@ int main(int argc, char **argv) { case 's': { // --table-size auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { fprintf(stderr, "-s: Bad option value\n"); exit(EXIT_FAILURE); } - config.table_size = n; + config.table_size = *n; break; } case 'S': { // --deflate-table-size auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { fprintf(stderr, "-S: Bad option value\n"); exit(EXIT_FAILURE); } - config.deflate_table_size = n; + config.deflate_table_size = *n; break; } case 'd': diff --git a/lib/nghttp2/src/h2load.cc b/lib/nghttp2-1.65.0/src/h2load.cc similarity index 83% rename from lib/nghttp2/src/h2load.cc rename to lib/nghttp2-1.65.0/src/h2load.cc index 1c0fbc3b7db..dae69cd7aae 100644 --- a/lib/nghttp2/src/h2load.cc +++ b/lib/nghttp2-1.65.0/src/h2load.cc @@ -47,8 +47,16 @@ #include #include #include +#include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #ifdef ENABLE_HTTP3 # ifdef HAVE_LIBNGTCP2_CRYPTO_QUICTLS @@ -57,9 +65,12 @@ # ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL # include # endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL +# ifdef HAVE_LIBNGTCP2_CRYPTO_WOLFSSL +# include +# endif // HAVE_LIBNGTCP2_CRYPTO_WOLFSSL #endif // ENABLE_HTTP3 -#include "url-parser/url_parser.h" +#include "urlparse.h" #include "h2load_http1_session.h" #include "h2load_http2_session.h" @@ -71,7 +82,6 @@ #include "http2.h" #include "util.h" #include "template.h" -#include "ssl_compat.h" #ifndef O_BINARY # define O_BINARY (0) @@ -87,55 +97,44 @@ bool recorded(const std::chrono::steady_clock::time_point &t) { } } // namespace -#if OPENSSL_1_1_1_API -namespace { -std::ofstream keylog_file; -void keylog_callback(const SSL *ssl, const char *line) { - keylog_file.write(line, strlen(line)); - keylog_file.put('\n'); - keylog_file.flush(); -} -} // namespace -#endif // OPENSSL_1_1_1_API - Config::Config() - : ciphers(tls::DEFAULT_CIPHER_LIST), - tls13_ciphers("TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_" - "CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256"), - groups("X25519:P-256:P-384:P-521"), - data_length(-1), - data(nullptr), - addrs(nullptr), - nreqs(1), - nclients(1), - nthreads(1), - max_concurrent_streams(1), - window_bits(30), - connection_window_bits(30), - max_frame_size(16_k), - rate(0), - rate_period(1.0), - duration(0.0), - warm_up_time(0.0), - conn_active_timeout(0.), - conn_inactivity_timeout(0.), - no_tls_proto(PROTO_HTTP2), - header_table_size(4_k), - encoder_header_table_size(4_k), - data_fd(-1), - log_fd(-1), - qlog_file_base(), - port(0), - default_port(0), - connect_to_port(0), - verbose(false), - timing_script(false), - base_uri_unix(false), - unix_addr{}, - rps(0.), - no_udp_gso(false), - max_udp_payload_size(0), - ktls(false) {} + : ciphers(tls::DEFAULT_CIPHER_LIST), + tls13_ciphers("TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_" + "CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256"), + groups("X25519:P-256:P-384:P-521"), + data_length(-1), + data(nullptr), + addrs(nullptr), + nreqs(1), + nclients(1), + nthreads(1), + max_concurrent_streams(1), + window_bits(30), + connection_window_bits(30), + max_frame_size(16_k), + rate(0), + rate_period(1.0), + duration(0.0), + warm_up_time(0.0), + conn_active_timeout(0.), + conn_inactivity_timeout(0.), + no_tls_proto(PROTO_HTTP2), + header_table_size(4_k), + encoder_header_table_size(4_k), + data_fd(-1), + log_fd(-1), + qlog_file_base(), + port(0), + default_port(0), + connect_to_port(0), + verbose(false), + timing_script(false), + base_uri_unix(false), + unix_addr{}, + rps(0.), + no_udp_gso(false), + max_udp_payload_size(0), + ktls(false) {} Config::~Config() { if (addrs) { @@ -157,8 +156,8 @@ bool Config::has_base_uri() const { return (!this->base_uri.empty()); } bool Config::rps_enabled() const { return this->rps > 0.0; } bool Config::is_quic() const { #ifdef ENABLE_HTTP3 - return !npn_list.empty() && - (npn_list[0] == NGHTTP3_ALPN_H3 || npn_list[0] == "\x5h3-29"); + return !alpn_list.empty() && + (alpn_list[0] == NGHTTP3_ALPN_H3 || alpn_list[0] == "\x5h3-29"); #else // !ENABLE_HTTP3 return false; #endif // !ENABLE_HTTP3 @@ -170,21 +169,21 @@ constexpr size_t MAX_SAMPLES = 1000000; } // namespace Stats::Stats(size_t req_todo, size_t nclients) - : req_todo(req_todo), - req_started(0), - req_done(0), - req_success(0), - req_status_success(0), - req_failed(0), - req_error(0), - req_timedout(0), - bytes_total(0), - bytes_head(0), - bytes_head_decomp(0), - bytes_body(0), - status(), - udp_dgram_recv(0), - udp_dgram_sent(0) {} + : req_todo(req_todo), + req_started(0), + req_done(0), + req_success(0), + req_status_success(0), + req_failed(0), + req_error(0), + req_timedout(0), + bytes_total(0), + bytes_head(0), + bytes_head_decomp(0), + bytes_body(0), + status(), + udp_dgram_recv(0), + udp_dgram_sent(0) {} Stream::Stream() : req_stat{}, status_success(-1) {} @@ -260,7 +259,7 @@ void rate_period_timeout_w_cb(struct ev_loop *loop, ev_timer *w, int revents) { --worker->nreqs_rem; } auto client = - std::make_unique(worker->next_client_id++, worker, req_todo); + std::make_unique(worker->next_client_id++, worker, req_todo); ++worker->nconns_made; @@ -348,10 +347,10 @@ void rps_cb(struct ev_loop *loop, ev_timer *w, int revents) { auto now = std::chrono::steady_clock::now(); auto d = now - client->rps_duration_started; auto n = static_cast( - round(std::chrono::duration(d).count() * config.rps)); + round(std::chrono::duration(d).count() * config.rps)); client->rps_req_pending += n; client->rps_duration_started += - util::duration_from(static_cast(n) / config.rps); + util::duration_from(static_cast(n) / config.rps); if (client->rps_req_pending == 0) { return; @@ -412,7 +411,7 @@ namespace { void client_request_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { auto client = static_cast(w->data); - if (client->streams.size() >= (size_t)config.max_concurrent_streams) { + if (client->streams.size() >= config.max_concurrent_streams) { ev_timer_stop(client->worker->loop, w); return; } @@ -429,7 +428,7 @@ void client_request_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { } auto duration = - config.timings[client->reqidx] - config.timings[client->reqidx - 1]; + config.timings[client->reqidx] - config.timings[client->reqidx - 1]; while (duration < std::chrono::duration(1e-9)) { if (client->submit_request() != 0) { @@ -443,7 +442,7 @@ void client_request_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { } duration = - config.timings[client->reqidx] - config.timings[client->reqidx - 1]; + config.timings[client->reqidx] - config.timings[client->reqidx - 1]; } client->request_timeout_watcher.repeat = util::ev_tstamp_from(duration); @@ -452,29 +451,29 @@ void client_request_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { } // namespace Client::Client(uint32_t id, Worker *worker, size_t req_todo) - : wb(&worker->mcpool), - cstat{}, - worker(worker), - ssl(nullptr), + : wb(&worker->mcpool), + cstat{}, + worker(worker), + ssl(nullptr), #ifdef ENABLE_HTTP3 - quic{}, + quic{}, #endif // ENABLE_HTTP3 - next_addr(config.addrs), - current_addr(nullptr), - reqidx(0), - state(CLIENT_IDLE), - req_todo(req_todo), - req_left(req_todo), - req_inflight(0), - req_started(0), - req_done(0), - id(id), - fd(-1), - local_addr{}, - new_connection_requested(false), - final(false), - rps_req_pending(0), - rps_req_inflight(0) { + next_addr(config.addrs), + current_addr(nullptr), + reqidx(0), + state(CLIENT_IDLE), + req_todo(req_todo), + req_left(req_todo), + req_inflight(0), + req_started(0), + req_done(0), + id(id), + fd(-1), + local_addr{}, + new_connection_requested(false), + final(false), + rps_req_pending(0), + rps_req_inflight(0) { if (req_todo == 0) { // this means infinite number of requests are to be made // This ensures that number of requests are unbounded // Just a positive number is fine, we chose the first positive number @@ -584,8 +583,12 @@ int Client::make_socket(addrinfo *addr) { } } - if (ssl && !util::numeric_host(config.host.c_str())) { - SSL_set_tlsext_host_name(ssl, config.host.c_str()); + if (ssl) { + if (!config.sni.empty()) { + SSL_set_tlsext_host_name(ssl, config.sni.c_str()); + } else if (!util::numeric_host(config.host.c_str())) { + SSL_set_tlsext_host_name(ssl, config.host.c_str()); + } } if (config.is_quic()) { @@ -687,7 +690,6 @@ int Client::try_again_or_fail() { new_connection_requested = false; if (req_left) { - if (worker->current_phase == Phase::MAIN_DURATION) { // At the moment, we don't have a facility to re-start request // already in in-flight. Make them fail. @@ -695,6 +697,10 @@ int Client::try_again_or_fail() { worker->stats.req_error += req_inflight; req_inflight = 0; + } else if (worker->current_phase == Phase::DURATION_OVER) { + // fix a race condition when h2load is sending connection: close over h1 + // prevents new clients from spawning after the test should have ended. + return -1; } // Keep using current address @@ -833,10 +839,9 @@ void Client::process_request_failure() { << std::endl; } +#ifndef NGHTTP2_OPENSSL_IS_BORINGSSL namespace { void print_server_tmp_key(SSL *ssl) { -// libressl does not have SSL_get_server_tmp_key -#if OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_get_server_tmp_key) EVP_PKEY *key; if (!SSL_get_server_tmp_key(ssl, &key)) { @@ -884,9 +889,9 @@ void print_server_tmp_key(SSL *ssl) { << std::endl; break; } -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L } } // namespace +#endif // !NGHTTP2_OPENSSL_IS_BORINGSSL void Client::report_tls_info() { if (worker->id == 0 && !worker->tls_info_report_done) { @@ -894,7 +899,9 @@ void Client::report_tls_info() { auto cipher = SSL_get_current_cipher(ssl); std::cout << "TLS Protocol: " << tls::get_tls_protocol(ssl) << "\n" << "Cipher: " << SSL_CIPHER_get_name(cipher) << std::endl; +#ifndef NGHTTP2_OPENSSL_IS_BORINGSSL print_server_tmp_key(ssl); +#endif // !NGHTTP2_OPENSSL_IS_BORINGSSL } } @@ -937,7 +944,7 @@ void Client::on_header(int32_t stream_id, const uint8_t *name, size_t namelen, } if (stream.status_success == -1 && namelen == 7 && - util::streq_l(":status", name, namelen)) { + ":status"_sr == StringRef{name, namelen}) { int status = 0; for (size_t i = 0; i < valuelen; ++i) { if ('0' <= value[i] && value[i] <= '9') { @@ -952,6 +959,10 @@ void Client::on_header(int32_t stream_id, const uint8_t *name, size_t namelen, } } + if (status < 200) { + return; + } + stream.req_stat.status = status; if (status >= 200 && status < 300) { ++worker->stats.status[2]; @@ -1030,9 +1041,9 @@ void Client::on_stream_close(int32_t stream_id, bool success, bool final) { if (worker->config->log_fd != -1) { auto start = std::chrono::duration_cast( - req_stat->request_wall_time.time_since_epoch()); + req_stat->request_wall_time.time_since_epoch()); auto delta = std::chrono::duration_cast( - req_stat->stream_close_time - req_stat->request_time); + req_stat->stream_close_time - req_stat->request_time); std::array buf; auto p = std::begin(buf); @@ -1100,34 +1111,26 @@ int Client::connection_made() { const unsigned char *next_proto = nullptr; unsigned int next_proto_len; -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_get0_next_proto_negotiated(ssl, &next_proto, &next_proto_len); -#endif // !OPENSSL_NO_NEXTPROTONEG -#if OPENSSL_VERSION_NUMBER >= 0x10002000L - if (next_proto == nullptr) { - SSL_get0_alpn_selected(ssl, &next_proto, &next_proto_len); - } -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L + SSL_get0_alpn_selected(ssl, &next_proto, &next_proto_len); if (next_proto) { auto proto = StringRef{next_proto, next_proto_len}; if (config.is_quic()) { #ifdef ENABLE_HTTP3 assert(session); - if (!util::streq(StringRef{&NGHTTP3_ALPN_H3[1]}, proto) && - !util::streq_l("h3-29", proto)) { + if ("h3"_sr != proto && "h3-29"_sr != proto) { return -1; } #endif // ENABLE_HTTP3 } else if (util::check_h2_is_selected(proto)) { session = std::make_unique(this); - } else if (util::streq(NGHTTP2_H1_1, proto)) { + } else if (NGHTTP2_H1_1 == proto) { session = std::make_unique(this); } // Just assign next_proto to selected_proto anyway to show the // negotiation result. - selected_proto = proto.str(); + selected_proto = proto; } else if (config.is_quic()) { std::cerr << "QUIC requires ALPN negotiation" << std::endl; return -1; @@ -1135,13 +1138,12 @@ int Client::connection_made() { std::cout << "No protocol negotiated. Fallback behaviour may be activated" << std::endl; - for (const auto &proto : config.npn_list) { - if (util::streq(NGHTTP2_H1_1_ALPN, StringRef{proto})) { - std::cout - << "Server does not support NPN/ALPN. Falling back to HTTP/1.1." - << std::endl; + for (const auto &proto : config.alpn_list) { + if (NGHTTP2_H1_1_ALPN == proto) { + std::cout << "Server does not support ALPN. Falling back to HTTP/1.1." + << std::endl; session = std::make_unique(this); - selected_proto = NGHTTP2_H1_1.str(); + selected_proto = NGHTTP2_H1_1; break; } } @@ -1153,9 +1155,9 @@ int Client::connection_made() { if (!session) { std::cout - << "No supported protocol was negotiated. Supported protocols were:" - << std::endl; - for (const auto &proto : config.npn_list) { + << "No supported protocol was negotiated. Supported protocols were:" + << std::endl; + for (const auto &proto : config.alpn_list) { std::cout << proto.substr(1) << std::endl; } disconnect(); @@ -1169,7 +1171,7 @@ int Client::connection_made() { break; case Config::PROTO_HTTP1_1: session = std::make_unique(this); - selected_proto = NGHTTP2_H1_1.str(); + selected_proto = NGHTTP2_H1_1; break; default: // unreachable @@ -1201,8 +1203,8 @@ int Client::connection_made() { } } else if (!config.timing_script) { auto nreq = config.is_timing_based_mode() - ? std::max(req_left, session->max_concurrent_streams()) - : std::min(req_left, session->max_concurrent_streams()); + ? std::max(req_left, session->max_concurrent_streams()) + : std::min(req_left, session->max_concurrent_streams()); for (; nreq > 0; --nreq) { if (submit_request() != 0) { @@ -1211,7 +1213,6 @@ int Client::connection_made() { } } } else { - auto duration = config.timings[reqidx]; while (duration < std::chrono::duration(1e-9)) { @@ -1241,12 +1242,12 @@ int Client::connection_made() { int Client::on_read(const uint8_t *data, size_t len) { auto rv = session->on_read(data, len); - if (rv != 0) { - return -1; - } if (worker->current_phase == Phase::MAIN_DURATION) { worker->stats.bytes_total += len; } + if (rv != 0) { + return -1; + } signal_write(); return 0; } @@ -1482,6 +1483,8 @@ int Client::write_udp(const sockaddr *addr, socklen_t addrlen, } std::cerr << "sendmsg: errno=" << errno << std::endl; + } else if (gso_size) { + worker->stats.udp_dgram_sent += (datalen + gso_size - 1) / gso_size; } else { ++worker->stats.udp_dgram_sent; } @@ -1551,21 +1554,21 @@ int get_ev_loop_flags() { Worker::Worker(uint32_t id, SSL_CTX *ssl_ctx, size_t req_todo, size_t nclients, size_t rate, size_t max_samples, Config *config) - : randgen(util::make_mt19937()), - stats(req_todo, nclients), - loop(ev_loop_new(get_ev_loop_flags())), - ssl_ctx(ssl_ctx), - config(config), - id(id), - tls_info_report_done(false), - app_info_report_done(false), - nconns_made(0), - nclients(nclients), - nreqs_per_client(req_todo / nclients), - nreqs_rem(req_todo % nclients), - rate(rate), - max_samples(max_samples), - next_client_id(0) { + : randgen(util::make_mt19937()), + stats(req_todo, nclients), + loop(ev_loop_new(get_ev_loop_flags())), + ssl_ctx(ssl_ctx), + config(config), + id(id), + tls_info_report_done(false), + app_info_report_done(false), + nconns_made(0), + nclients(nclients), + nreqs_per_client(req_todo / nclients), + nreqs_rem(req_todo % nclients), + rate(rate), + max_samples(max_samples), + next_client_id(0) { if (!config->is_rate_mode() && !config->is_timing_based_mode()) { progress_interval = std::max(static_cast(1), req_todo / 10); } else { @@ -1710,8 +1713,8 @@ double within_sd(const std::vector &samples, double mean, double sd) { auto lower = mean - sd; auto upper = mean + sd; auto m = std::count_if( - std::begin(samples), std::end(samples), - [&lower, &upper](double t) { return lower <= t && t <= upper; }); + std::begin(samples), std::end(samples), + [&lower, &upper](double t) { return lower <= t && t <= upper; }); return (m / static_cast(samples.size())) * 100; } } // namespace @@ -1782,9 +1785,9 @@ process_time_stats(const std::vector> &workers) { continue; } request_times.push_back( - std::chrono::duration_cast>( - req_stat.stream_close_time - req_stat.request_time) - .count()); + std::chrono::duration_cast>( + req_stat.stream_close_time - req_stat.request_time) + .count()); } const auto &stat = w->stats; @@ -1793,8 +1796,8 @@ process_time_stats(const std::vector> &workers) { if (recorded(cstat.client_start_time) && recorded(cstat.client_end_time)) { auto t = std::chrono::duration_cast>( - cstat.client_end_time - cstat.client_start_time) - .count(); + cstat.client_end_time - cstat.client_start_time) + .count(); if (t > 1e-9) { rps_values.push_back(cstat.req_success / t); } @@ -1807,18 +1810,18 @@ process_time_stats(const std::vector> &workers) { } connect_times.push_back( - std::chrono::duration_cast>( - cstat.connect_time - cstat.connect_start_time) - .count()); + std::chrono::duration_cast>( + cstat.connect_time - cstat.connect_start_time) + .count()); if (!recorded(cstat.ttfb)) { continue; } ttfb_times.push_back( - std::chrono::duration_cast>( - cstat.ttfb - cstat.connect_start_time) - .count()); + std::chrono::duration_cast>( + cstat.ttfb - cstat.connect_start_time) + .count()); } } @@ -1837,7 +1840,7 @@ void resolve_host() { res->ai_socktype = SOCK_STREAM; res->ai_addrlen = sizeof(config.unix_addr); res->ai_addr = - static_cast(static_cast(&config.unix_addr)); + static_cast(static_cast(&config.unix_addr)); config.addrs = res.release(); return; @@ -1852,12 +1855,12 @@ void resolve_host() { hints.ai_flags = AI_ADDRCONFIG; const auto &resolve_host = - config.connect_to_host.empty() ? config.host : config.connect_to_host; + config.connect_to_host.empty() ? config.host : config.connect_to_host; auto port = - config.connect_to_port == 0 ? config.port : config.connect_to_port; + config.connect_to_port == 0 ? config.port : config.connect_to_port; rv = - getaddrinfo(resolve_host.c_str(), util::utos(port).c_str(), &hints, &res); + getaddrinfo(resolve_host.c_str(), util::utos(port).c_str(), &hints, &res); if (rv != 0) { std::cerr << "getaddrinfo() failed: " << gai_strerror(rv) << std::endl; exit(EXIT_FAILURE); @@ -1871,57 +1874,41 @@ void resolve_host() { } // namespace namespace { -std::string get_reqline(const char *uri, const http_parser_url &u) { +std::string get_reqline(const char *uri, const urlparse_url &u) { std::string reqline; - if (util::has_uri_field(u, UF_PATH)) { - reqline = util::get_uri_field(uri, u, UF_PATH).str(); + if (util::has_uri_field(u, URLPARSE_PATH)) { + reqline = util::get_uri_field(uri, u, URLPARSE_PATH); } else { reqline = "/"; } - if (util::has_uri_field(u, UF_QUERY)) { + if (util::has_uri_field(u, URLPARSE_QUERY)) { reqline += '?'; - reqline += util::get_uri_field(uri, u, UF_QUERY); + reqline += util::get_uri_field(uri, u, URLPARSE_QUERY); } return reqline; } } // namespace -#ifndef OPENSSL_NO_NEXTPROTONEG -namespace { -int client_select_next_proto_cb(SSL *ssl, unsigned char **out, - unsigned char *outlen, const unsigned char *in, - unsigned int inlen, void *arg) { - if (util::select_protocol(const_cast(out), outlen, in, - inlen, config.npn_list)) { - return SSL_TLSEXT_ERR_OK; - } - - // OpenSSL will terminate handshake with fatal alert if we return - // NOACK. So there is no way to fallback. - return SSL_TLSEXT_ERR_NOACK; -} -} // namespace -#endif // !OPENSSL_NO_NEXTPROTONEG - namespace { -constexpr char UNIX_PATH_PREFIX[] = "unix:"; +constexpr auto UNIX_PATH_PREFIX = "unix:"_sr; } // namespace namespace { bool parse_base_uri(const StringRef &base_uri) { - http_parser_url u{}; - if (http_parser_parse_url(base_uri.c_str(), base_uri.size(), 0, &u) != 0 || - !util::has_uri_field(u, UF_SCHEMA) || !util::has_uri_field(u, UF_HOST)) { + urlparse_url u; + if (urlparse_parse_url(base_uri.data(), base_uri.size(), 0, &u) != 0 || + !util::has_uri_field(u, URLPARSE_SCHEMA) || + !util::has_uri_field(u, URLPARSE_HOST)) { return false; } - config.scheme = util::get_uri_field(base_uri.c_str(), u, UF_SCHEMA).str(); - config.host = util::get_uri_field(base_uri.c_str(), u, UF_HOST).str(); - config.default_port = util::get_default_port(base_uri.c_str(), u); - if (util::has_uri_field(u, UF_PORT)) { + config.scheme = util::get_uri_field(base_uri.data(), u, URLPARSE_SCHEMA); + config.host = util::get_uri_field(base_uri.data(), u, URLPARSE_HOST); + config.default_port = util::get_default_port(base_uri.data(), u); + if (util::has_uri_field(u, URLPARSE_PORT)) { config.port = u.port; } else { config.port = config.default_port; @@ -1932,7 +1919,7 @@ bool parse_base_uri(const StringRef &base_uri) { } // namespace namespace { // Use std::vector::iterator explicitly, without that, -// http_parser_url u{} fails with clang-3.4. +// urlparse_url u{} fails with clang-3.4. std::vector parse_uris(std::vector::iterator first, std::vector::iterator last) { std::vector reqlines; @@ -1943,7 +1930,6 @@ std::vector parse_uris(std::vector::iterator first, } if (!config.has_base_uri()) { - if (!parse_base_uri(StringRef{*first})) { std::cerr << "invalid URI: " << *first << std::endl; exit(EXIT_FAILURE); @@ -1953,11 +1939,11 @@ std::vector parse_uris(std::vector::iterator first, } for (; first != last; ++first) { - http_parser_url u{}; + urlparse_url u; auto uri = (*first).c_str(); - if (http_parser_parse_url(uri, (*first).size(), 0, &u) != 0) { + if (urlparse_parse_url(uri, (*first).size(), 0, &u) != 0) { std::cerr << "invalid URI: " << uri << std::endl; exit(EXIT_FAILURE); } @@ -1983,9 +1969,9 @@ std::vector read_uri_from_file(std::istream &infile) { namespace { void read_script_from_file( - std::istream &infile, - std::vector &timings, - std::vector &uris) { + std::istream &infile, + std::vector &timings, + std::vector &uris) { std::string script_line; int line_count = 0; while (std::getline(infile, script_line)) { @@ -2019,8 +2005,8 @@ void read_script_from_file( } timings.emplace_back( - std::chrono::duration_cast( - std::chrono::duration(v))); + std::chrono::duration_cast( + std::chrono::duration(v))); uris.push_back(script_line.substr(pos + 1, script_line.size())); } } @@ -2064,7 +2050,7 @@ namespace { int parse_header_table_size(uint32_t &dst, const char *opt, const char *optarg) { auto n = util::parse_uint_with_unit(optarg); - if (n == -1) { + if (!n) { std::cerr << "--" << opt << ": Bad option value: " << optarg << std::endl; return -1; } @@ -2075,7 +2061,7 @@ int parse_header_table_size(uint32_t &dst, const char *opt, return -1; } - dst = n; + dst = *n; return 0; } @@ -2117,7 +2103,7 @@ benchmarking tool for HTTP/2 server)" } // namespace namespace { -constexpr char DEFAULT_NPN_LIST[] = "h2,h2-16,h2-14,http/1.1"; +constexpr auto DEFAULT_ALPN_LIST = "h2,h2-16,h2-14,http/1.1"_sr; } // namespace namespace { @@ -2277,16 +2263,15 @@ void print_help(std::ostream &out) { instead of TCP. In this case, scheme is inferred from the first URI appeared in the command line or inside input files as usual. - --npn-list= + --alpn-list= Comma delimited list of ALPN protocol identifier sorted in the order of preference. That means most desirable - protocol comes first. This is used in both ALPN and - NPN. The parameter must be delimited by a single comma - only and any white spaces are treated as a part of - protocol string. + protocol comes first. The parameter must be delimited + by a single comma only and any white spaces are treated + as a part of protocol string. Default: )" - << DEFAULT_NPN_LIST << R"( - --h1 Short hand for --npn-list=http/1.1 + << DEFAULT_ALPN_LIST << R"( + --h1 Short hand for --alpn-list=http/1.1 --no-tls-proto=http/1.1, which effectively force http/1.1 for both http and https URI. --header-table-size= @@ -2328,6 +2313,9 @@ void print_help(std::ostream &out) { --max-udp-payload-size= Specify the maximum outgoing UDP datagram payload size. --ktls Enable ktls. + --sni= + Send in TLS SNI, overriding the host name + specified in URI. -v, --verbose Output debug information. --version Display version information and exit. @@ -2347,56 +2335,51 @@ void print_help(std::ostream &out) { } // namespace int main(int argc, char **argv) { - tls::libssl_init(); - -#ifndef NOTHREADS - tls::LibsslGlobalLock lock; -#endif // NOTHREADS - std::string datafile; std::string logfile; - std::string qlog_base; bool nreqs_set_manually = false; while (1) { static int flag = 0; constexpr static option long_options[] = { - {"requests", required_argument, nullptr, 'n'}, - {"clients", required_argument, nullptr, 'c'}, - {"data", required_argument, nullptr, 'd'}, - {"threads", required_argument, nullptr, 't'}, - {"max-concurrent-streams", required_argument, nullptr, 'm'}, - {"window-bits", required_argument, nullptr, 'w'}, - {"max-frame-size", required_argument, nullptr, 'f'}, - {"connection-window-bits", required_argument, nullptr, 'W'}, - {"input-file", required_argument, nullptr, 'i'}, - {"header", required_argument, nullptr, 'H'}, - {"no-tls-proto", required_argument, nullptr, 'p'}, - {"verbose", no_argument, nullptr, 'v'}, - {"help", no_argument, nullptr, 'h'}, - {"version", no_argument, &flag, 1}, - {"ciphers", required_argument, &flag, 2}, - {"rate", required_argument, nullptr, 'r'}, - {"connection-active-timeout", required_argument, nullptr, 'T'}, - {"connection-inactivity-timeout", required_argument, nullptr, 'N'}, - {"duration", required_argument, nullptr, 'D'}, - {"timing-script-file", required_argument, &flag, 3}, - {"base-uri", required_argument, nullptr, 'B'}, - {"npn-list", required_argument, &flag, 4}, - {"rate-period", required_argument, &flag, 5}, - {"h1", no_argument, &flag, 6}, - {"header-table-size", required_argument, &flag, 7}, - {"encoder-header-table-size", required_argument, &flag, 8}, - {"warm-up-time", required_argument, &flag, 9}, - {"log-file", required_argument, &flag, 10}, - {"connect-to", required_argument, &flag, 11}, - {"rps", required_argument, &flag, 12}, - {"groups", required_argument, &flag, 13}, - {"tls13-ciphers", required_argument, &flag, 14}, - {"no-udp-gso", no_argument, &flag, 15}, - {"qlog-file-base", required_argument, &flag, 16}, - {"max-udp-payload-size", required_argument, &flag, 17}, - {"ktls", no_argument, &flag, 18}, - {nullptr, 0, nullptr, 0}}; + {"requests", required_argument, nullptr, 'n'}, + {"clients", required_argument, nullptr, 'c'}, + {"data", required_argument, nullptr, 'd'}, + {"threads", required_argument, nullptr, 't'}, + {"max-concurrent-streams", required_argument, nullptr, 'm'}, + {"window-bits", required_argument, nullptr, 'w'}, + {"max-frame-size", required_argument, nullptr, 'f'}, + {"connection-window-bits", required_argument, nullptr, 'W'}, + {"input-file", required_argument, nullptr, 'i'}, + {"header", required_argument, nullptr, 'H'}, + {"no-tls-proto", required_argument, nullptr, 'p'}, + {"verbose", no_argument, nullptr, 'v'}, + {"help", no_argument, nullptr, 'h'}, + {"version", no_argument, &flag, 1}, + {"ciphers", required_argument, &flag, 2}, + {"rate", required_argument, nullptr, 'r'}, + {"connection-active-timeout", required_argument, nullptr, 'T'}, + {"connection-inactivity-timeout", required_argument, nullptr, 'N'}, + {"duration", required_argument, nullptr, 'D'}, + {"timing-script-file", required_argument, &flag, 3}, + {"base-uri", required_argument, nullptr, 'B'}, + {"npn-list", required_argument, &flag, 4}, + {"rate-period", required_argument, &flag, 5}, + {"h1", no_argument, &flag, 6}, + {"header-table-size", required_argument, &flag, 7}, + {"encoder-header-table-size", required_argument, &flag, 8}, + {"warm-up-time", required_argument, &flag, 9}, + {"log-file", required_argument, &flag, 10}, + {"connect-to", required_argument, &flag, 11}, + {"rps", required_argument, &flag, 12}, + {"groups", required_argument, &flag, 13}, + {"tls13-ciphers", required_argument, &flag, 14}, + {"no-udp-gso", no_argument, &flag, 15}, + {"qlog-file-base", required_argument, &flag, 16}, + {"max-udp-payload-size", required_argument, &flag, 17}, + {"ktls", no_argument, &flag, 18}, + {"alpn-list", required_argument, &flag, 19}, + {"sni", required_argument, &flag, 20}, + {nullptr, 0, nullptr, 0}}; int option_index = 0; auto c = getopt_long(argc, argv, "hvW:c:d:m:n:p:t:w:f:H:i:r:T:N:D:B:", long_options, @@ -2407,21 +2390,21 @@ int main(int argc, char **argv) { switch (c) { case 'n': { auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-n: bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.nreqs = n; + config.nreqs = *n; nreqs_set_manually = true; break; } case 'c': { auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-c: bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.nclients = n; + config.nclients = *n; break; } case 'd': @@ -2433,55 +2416,55 @@ int main(int argc, char **argv) { << "no threads created." << std::endl; #else auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-t: bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.nthreads = n; + config.nthreads = *n; #endif // NOTHREADS break; } case 'm': { auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-m: bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.max_concurrent_streams = n; + config.max_concurrent_streams = *n; break; } case 'w': case 'W': { auto n = util::parse_uint(optarg); - if (n == -1 || n > 30) { + if (!n || n > 30) { std::cerr << "-" << static_cast(c) << ": specify the integer in the range [0, 30], inclusive" << std::endl; exit(EXIT_FAILURE); } if (c == 'w') { - config.window_bits = n; + config.window_bits = *n; } else { - config.connection_window_bits = n; + config.connection_window_bits = *n; } break; } case 'f': { auto n = util::parse_uint_with_unit(optarg); - if (n == -1) { + if (!n) { std::cerr << "--max-frame-size: bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - if (static_cast(n) < 16_k) { + if (static_cast(*n) < 16_k) { std::cerr << "--max-frame-size: minimum 16384" << std::endl; exit(EXIT_FAILURE); } - if (static_cast(n) > 16_m - 1) { + if (static_cast(*n) > 16_m - 1) { std::cerr << "--max-frame-size: maximum 16777215" << std::endl; exit(EXIT_FAILURE); } - config.max_frame_size = n; + config.max_frame_size = *n; break; } case 'H': { @@ -2515,8 +2498,7 @@ int main(int argc, char **argv) { break; case 'p': { auto proto = StringRef{optarg}; - if (util::strieq(StringRef::from_lit(NGHTTP2_CLEARTEXT_PROTO_VERSION_ID), - proto)) { + if (util::strieq(NGHTTP2_CLEARTEXT_PROTO_VERSION_ID ""_sr, proto)) { config.no_tls_proto = Config::PROTO_HTTP2; } else if (util::strieq(NGHTTP2_H1_1, proto)) { config.no_tls_proto = Config::PROTO_HTTP1_1; @@ -2528,7 +2510,7 @@ int main(int argc, char **argv) { } case 'r': { auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-r: bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } @@ -2537,36 +2519,40 @@ int main(int argc, char **argv) { << "must be positive." << std::endl; exit(EXIT_FAILURE); } - config.rate = n; + config.rate = *n; break; } - case 'T': - config.conn_active_timeout = util::parse_duration_with_unit(optarg); - if (!std::isfinite(config.conn_active_timeout)) { + case 'T': { + auto d = util::parse_duration_with_unit(optarg); + if (!d) { std::cerr << "-T: bad value for the conn_active_timeout wait time: " << optarg << std::endl; exit(EXIT_FAILURE); } + config.conn_active_timeout = *d; break; - case 'N': - config.conn_inactivity_timeout = util::parse_duration_with_unit(optarg); - if (!std::isfinite(config.conn_inactivity_timeout)) { + } + case 'N': { + auto d = util::parse_duration_with_unit(optarg); + if (!d) { std::cerr << "-N: bad value for the conn_inactivity_timeout wait time: " << optarg << std::endl; exit(EXIT_FAILURE); } + config.conn_inactivity_timeout = *d; break; + } case 'B': { auto arg = StringRef{optarg}; config.base_uri = ""; config.base_uri_unix = false; - if (util::istarts_with_l(arg, UNIX_PATH_PREFIX)) { + if (util::istarts_with(arg, UNIX_PATH_PREFIX)) { // UNIX domain socket path sockaddr_un un; - auto path = StringRef{std::begin(arg) + str_size(UNIX_PATH_PREFIX), - std::end(arg)}; + auto path = + StringRef{std::begin(arg) + UNIX_PATH_PREFIX.size(), std::end(arg)}; if (path.size() == 0 || path.size() + 1 > sizeof(un.sun_path)) { std::cerr << "--base-uri: invalid UNIX domain socket path: " << arg @@ -2589,16 +2575,18 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - config.base_uri = arg.str(); + config.base_uri = arg; break; } - case 'D': - config.duration = util::parse_duration_with_unit(optarg); - if (!std::isfinite(config.duration)) { + case 'D': { + auto d = util::parse_duration_with_unit(optarg); + if (!d) { std::cerr << "-D: value error " << optarg << std::endl; exit(EXIT_FAILURE); } + config.duration = *d; break; + } case 'v': config.verbose = true; break; @@ -2623,22 +2611,19 @@ int main(int argc, char **argv) { config.ifile = optarg; config.timing_script = true; break; - case 4: - // npn-list option - config.npn_list = util::parse_config_str_list(StringRef{optarg}); - break; - case 5: + case 5: { // rate-period - config.rate_period = util::parse_duration_with_unit(optarg); - if (!std::isfinite(config.rate_period)) { + auto d = util::parse_duration_with_unit(optarg); + if (!d) { std::cerr << "--rate-period: value error " << optarg << std::endl; exit(EXIT_FAILURE); } + config.rate_period = *d; break; + } case 6: // --h1 - config.npn_list = - util::parse_config_str_list(StringRef::from_lit("http/1.1")); + config.alpn_list = util::parse_config_str_list("http/1.1"_sr); config.no_tls_proto = Config::PROTO_HTTP1_1; break; case 7: @@ -2655,14 +2640,16 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } break; - case 9: + case 9: { // --warm-up-time - config.warm_up_time = util::parse_duration_with_unit(optarg); - if (!std::isfinite(config.warm_up_time)) { + auto d = util::parse_duration_with_unit(optarg); + if (!d) { std::cerr << "--warm-up-time: value error " << optarg << std::endl; exit(EXIT_FAILURE); } + config.warm_up_time = *d; break; + } case 10: // --log-file logfile = optarg; @@ -2672,11 +2659,12 @@ int main(int argc, char **argv) { auto p = util::split_hostport(StringRef{optarg}); int64_t port = 0; if (p.first.empty() || - (!p.second.empty() && (port = util::parse_uint(p.second)) == -1)) { + (!p.second.empty() && + (port = util::parse_uint(p.second).value_or(-1)) == -1)) { std::cerr << "--connect-to: Invalid value " << optarg << std::endl; exit(EXIT_FAILURE); } - config.connect_to_host = p.first.str(); + config.connect_to_host = p.first; config.connect_to_port = port; break; } @@ -2705,28 +2693,41 @@ int main(int argc, char **argv) { break; case 16: // --qlog-file-base - qlog_base = optarg; + config.qlog_file_base = optarg; break; case 17: { // --max-udp-payload-size auto n = util::parse_uint_with_unit(optarg); - if (n == -1) { + if (!n) { std::cerr << "--max-udp-payload-size: bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - if (static_cast(n) > 64_k) { + if (static_cast(*n) > 64_k) { std::cerr << "--max-udp-payload-size: must not exceed 65536" << std::endl; exit(EXIT_FAILURE); } - config.max_udp_payload_size = n; + config.max_udp_payload_size = *n; break; } case 18: // --ktls config.ktls = true; break; + case 4: + // npn-list option + std::cerr << "--npn-list: deprecated. Use --alpn-list instead." + << std::endl; + // fall through + case 19: + // alpn-list option + config.alpn_list = util::parse_config_str_list(StringRef{optarg}); + break; + case 20: + // --sni + config.sni = optarg; + break; } break; default: @@ -2747,13 +2748,12 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - if (config.npn_list.empty()) { - config.npn_list = - util::parse_config_str_list(StringRef::from_lit(DEFAULT_NPN_LIST)); + if (config.alpn_list.empty()) { + config.alpn_list = util::parse_config_str_list(DEFAULT_ALPN_LIST); } // serialize the APLN tokens - for (auto &proto : config.npn_list) { + for (auto &proto : config.alpn_list) { proto.insert(proto.begin(), static_cast(proto.size())); } @@ -2911,16 +2911,9 @@ int main(int argc, char **argv) { } } - if (!qlog_base.empty()) { - if (!config.is_quic()) { - std::cerr - << "Warning: --qlog-file-base: only effective in quic, ignoring." - << std::endl; - } else { -#ifdef ENABLE_HTTP3 - config.qlog_file_base = qlog_base; -#endif // ENABLE_HTTP3 - } + if (!config.qlog_file_base.empty() && !config.is_quic()) { + std::cerr << "Warning: --qlog-file-base: only effective in quic, ignoring." + << std::endl; } struct sigaction act {}; @@ -2964,10 +2957,17 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } # endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL +# ifdef HAVE_LIBNGTCP2_CRYPTO_WOLFSSL + if (ngtcp2_crypto_wolfssl_configure_client_context(ssl_ctx) != 0) { + std::cerr << "ngtcp2_crypto_wolfssl_configure_client_context failed" + << std::endl; + exit(EXIT_FAILURE); + } +# endif // HAVE_LIBNGTCP2_CRYPTO_WOLFSSL #endif // ENABLE_HTTP3 } else if (nghttp2::tls::ssl_ctx_set_proto_versions( - ssl_ctx, nghttp2::tls::NGHTTP2_TLS_MIN_VERSION, - nghttp2::tls::NGHTTP2_TLS_MAX_VERSION) != 0) { + ssl_ctx, nghttp2::tls::NGHTTP2_TLS_MIN_VERSION, + nghttp2::tls::NGHTTP2_TLS_MAX_VERSION) != 0) { std::cerr << "Could not set TLS versions" << std::endl; exit(EXIT_FAILURE); } @@ -2979,50 +2979,53 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) || defined(NGHTTP2_OPENSSL_IS_WOLFSSL) if (SSL_CTX_set_ciphersuites(ssl_ctx, config.tls13_ciphers.c_str()) == 0) { std::cerr << "SSL_CTX_set_ciphersuites with " << config.tls13_ciphers << " failed: " << ERR_error_string(ERR_get_error(), nullptr) << std::endl; exit(EXIT_FAILURE); } -#endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_LIBRESSL || + // NGHTTP2_OPENSSL_IS_WOLFSSL -#if OPENSSL_1_1_1_API - if (SSL_CTX_set1_groups_list(ssl_ctx, config.groups.c_str()) != 1) { - std::cerr << "SSL_CTX_set1_groups_list failed" << std::endl; +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL + // Passing X25519 to SSL_CTX_set1_groups_list fails for some reason. + if (SSL_CTX_set1_curves_list( + ssl_ctx, const_cast(config.groups.c_str())) != 1) { + std::cerr << "SSL_CTX_set1_curves_list failed: " + << ERR_error_string(ERR_get_error(), nullptr) << std::endl; exit(EXIT_FAILURE); } -#else // !OPENSSL_1_1_1_API - if (SSL_CTX_set1_curves_list(ssl_ctx, config.groups.c_str()) != 1) { - std::cerr << "SSL_CTX_set1_curves_list failed" << std::endl; +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL + if (SSL_CTX_set1_groups_list(ssl_ctx, config.groups.c_str()) != 1) { + std::cerr << "SSL_CTX_set1_groups_list failed" << std::endl; exit(EXIT_FAILURE); } -#endif // !OPENSSL_1_1_1_API +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_CTX_set_next_proto_select_cb(ssl_ctx, client_select_next_proto_cb, - nullptr); -#endif // !OPENSSL_NO_NEXTPROTONEG - -#if OPENSSL_VERSION_NUMBER >= 0x10002000L std::vector proto_list; - for (const auto &proto : config.npn_list) { + for (const auto &proto : config.alpn_list) { std::copy_n(proto.c_str(), proto.size(), std::back_inserter(proto_list)); } SSL_CTX_set_alpn_protos(ssl_ctx, proto_list.data(), proto_list.size()); -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L -#if OPENSSL_1_1_1_API - auto keylog_filename = getenv("SSLKEYLOGFILE"); - if (keylog_filename) { - keylog_file.open(keylog_filename, std::ios_base::app); - if (keylog_file) { - SSL_CTX_set_keylog_callback(ssl_ctx, keylog_callback); - } + if (tls::setup_keylog_callback(ssl_ctx) != 0) { + std::cerr << "Failed to setup keylog" << std::endl; + + exit(EXIT_FAILURE); } -#endif // OPENSSL_1_1_1_API + +#if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI) + if (!SSL_CTX_add_cert_compression_alg( + ssl_ctx, nghttp2::tls::CERTIFICATE_COMPRESSION_ALGO_BROTLI, + nghttp2::tls::cert_compress, nghttp2::tls::cert_decompress)) { + std::cerr << "SSL_CTX_add_cert_compression_alg failed" << std::endl; + exit(EXIT_FAILURE); + } +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI std::string user_agent = "h2load nghttp2/" NGHTTP2_VERSION; Headers shared_nva; @@ -3032,15 +3035,15 @@ int main(int argc, char **argv) { shared_nva.emplace_back("user-agent", user_agent); // list header fields that can be overridden. - auto override_hdrs = make_array(":authority", ":host", ":method", - ":scheme", "user-agent"); + auto override_hdrs = std::to_array( + {":authority", "host", ":method", ":scheme", "user-agent"}); for (auto &kv : config.custom_headers) { if (std::find(std::begin(override_hdrs), std::end(override_hdrs), kv.name) != std::end(override_hdrs)) { // override header for (auto &nv : shared_nva) { - if ((nv.name == ":authority" && kv.name == ":host") || + if ((nv.name == ":authority" && kv.name == "host") || (nv.name == kv.name)) { nv.value = kv.value; } @@ -3057,8 +3060,8 @@ int main(int argc, char **argv) { } auto method_it = - std::find_if(std::begin(shared_nva), std::end(shared_nva), - [](const Header &nv) { return nv.name == ":method"; }); + std::find_if(std::begin(shared_nva), std::end(shared_nva), + [](const Header &nv) { return nv.name == ":method"; }); assert(method_it != std::end(shared_nva)); config.h1reqs.reserve(reqlines.size()); @@ -3100,15 +3103,15 @@ int main(int argc, char **argv) { // 2 for :path, and possible content-length nva.reserve(2 + shared_nva.size()); - nva.push_back(http2::make_nv_ls(":path", req)); + nva.push_back(http2::make_field_v(":path"_sr, req)); for (auto &nv : shared_nva) { - nva.push_back(http2::make_nv(nv.name, nv.value, false)); + nva.push_back(http2::make_field_nv(nv.name, nv.value)); } if (!content_length_str.empty()) { - nva.push_back(http2::make_nv(StringRef::from_lit("content-length"), - StringRef{content_length_str})); + nva.push_back( + http2::make_field_nv("content-length"_sr, content_length_str)); } config.nva.push_back(std::move(nva)); @@ -3130,21 +3133,21 @@ int main(int argc, char **argv) { #ifndef NOTHREADS size_t nreqs_per_thread = 0; - ssize_t nreqs_rem = 0; + size_t nreqs_rem = 0; if (!config.timing_script) { nreqs_per_thread = config.nreqs / config.nthreads; nreqs_rem = config.nreqs % config.nthreads; } - size_t nclients_per_thread = config.nclients / config.nthreads; - ssize_t nclients_rem = config.nclients % config.nthreads; + auto nclients_per_thread = config.nclients / config.nthreads; + auto nclients_rem = config.nclients % config.nthreads; - size_t rate_per_thread = config.rate / config.nthreads; - ssize_t rate_per_thread_rem = config.rate % config.nthreads; + auto rate_per_thread = config.rate / config.nthreads; + auto rate_per_thread_rem = config.rate % config.nthreads; size_t max_samples_per_thread = - std::max(static_cast(256), MAX_SAMPLES / config.nthreads); + std::max(static_cast(256), MAX_SAMPLES / config.nthreads); std::mutex mu; std::condition_variable cv; @@ -3178,17 +3181,21 @@ int main(int argc, char **argv) { } } - workers.push_back(create_worker(i, ssl_ctx, nreqs, nclients, rate, - max_samples_per_thread)); + workers.push_back( + create_worker(i, ssl_ctx, nreqs, nclients, rate, max_samples_per_thread)); auto &worker = workers.back(); futures.push_back( - std::async(std::launch::async, [&worker, &mu, &cv, &ready]() { - { - std::unique_lock ulk(mu); - cv.wait(ulk, [&ready] { return ready; }); - } - worker->run(); - })); + std::async(std::launch::async, [&worker, &mu, &cv, &ready]() { + { + std::unique_lock ulk(mu); + cv.wait(ulk, [&ready] { return ready; }); + } + worker->run(); + +# ifdef NGHTTP2_OPENSSL_IS_WOLFSSL + wc_ecc_fp_free(); +# endif // NGHTTP2_OPENSSL_IS_WOLFSSL + })); } { @@ -3207,10 +3214,10 @@ int main(int argc, char **argv) { auto rate = config.rate; auto nclients = config.nclients; auto nreqs = - config.timing_script ? config.nreqs * config.nclients : config.nreqs; + config.timing_script ? config.nreqs * config.nclients : config.nreqs; workers.push_back( - create_worker(0, ssl_ctx, nreqs, nclients, rate, MAX_SAMPLES)); + create_worker(0, ssl_ctx, nreqs, nclients, rate, MAX_SAMPLES)); auto start = std::chrono::steady_clock::now(); @@ -3219,7 +3226,7 @@ int main(int argc, char **argv) { auto end = std::chrono::steady_clock::now(); auto duration = - std::chrono::duration_cast(end - start); + std::chrono::duration_cast(end - start); Stats stats(0, 0); for (const auto &w : workers) { @@ -3250,7 +3257,7 @@ int main(int argc, char **argv) { // Requests which have not been issued due to connection errors, are // counted towards req_failed and req_error. auto req_not_issued = - (stats.req_todo - stats.req_status_success - stats.req_failed); + (stats.req_todo - stats.req_status_success - stats.req_failed); stats.req_failed += req_not_issued; stats.req_error += req_not_issued; @@ -3267,8 +3274,7 @@ int main(int argc, char **argv) { bps = stats.bytes_total / config.duration; } else { auto secd = std::chrono::duration_cast< - std::chrono::duration>( - duration); + std::chrono::duration>(duration); rps = stats.req_success / secd.count(); bps = stats.bytes_total / secd.count(); } @@ -3277,7 +3283,7 @@ int main(int argc, char **argv) { double header_space_savings = 0.; if (stats.bytes_head_decomp > 0) { header_space_savings = - 1. - static_cast(stats.bytes_head) / stats.bytes_head_decomp; + 1. - static_cast(stats.bytes_head) / stats.bytes_head_decomp; } std::cout << std::fixed << std::setprecision(2) << R"( @@ -3305,29 +3311,29 @@ traffic: )" << util::utos_funit(stats.bytes_total) } #endif // ENABLE_HTTP3 std::cout - << R"( min max mean sd +/- sd + << R"( min max mean sd +/- sd time for request: )" - << std::setw(10) << util::format_duration(ts.request.min) << " " - << std::setw(10) << util::format_duration(ts.request.max) << " " - << std::setw(10) << util::format_duration(ts.request.mean) << " " - << std::setw(10) << util::format_duration(ts.request.sd) << std::setw(9) - << util::dtos(ts.request.within_sd) << "%" - << "\ntime for connect: " << std::setw(10) - << util::format_duration(ts.connect.min) << " " << std::setw(10) - << util::format_duration(ts.connect.max) << " " << std::setw(10) - << util::format_duration(ts.connect.mean) << " " << std::setw(10) - << util::format_duration(ts.connect.sd) << std::setw(9) - << util::dtos(ts.connect.within_sd) << "%" - << "\ntime to 1st byte: " << std::setw(10) - << util::format_duration(ts.ttfb.min) << " " << std::setw(10) - << util::format_duration(ts.ttfb.max) << " " << std::setw(10) - << util::format_duration(ts.ttfb.mean) << " " << std::setw(10) - << util::format_duration(ts.ttfb.sd) << std::setw(9) - << util::dtos(ts.ttfb.within_sd) << "%" - << "\nreq/s : " << std::setw(10) << ts.rps.min << " " - << std::setw(10) << ts.rps.max << " " << std::setw(10) << ts.rps.mean - << " " << std::setw(10) << ts.rps.sd << std::setw(9) - << util::dtos(ts.rps.within_sd) << "%" << std::endl; + << std::setw(10) << util::format_duration(ts.request.min) << " " + << std::setw(10) << util::format_duration(ts.request.max) << " " + << std::setw(10) << util::format_duration(ts.request.mean) << " " + << std::setw(10) << util::format_duration(ts.request.sd) << std::setw(9) + << util::dtos(ts.request.within_sd) << "%" + << "\ntime for connect: " << std::setw(10) + << util::format_duration(ts.connect.min) << " " << std::setw(10) + << util::format_duration(ts.connect.max) << " " << std::setw(10) + << util::format_duration(ts.connect.mean) << " " << std::setw(10) + << util::format_duration(ts.connect.sd) << std::setw(9) + << util::dtos(ts.connect.within_sd) << "%" + << "\ntime to 1st byte: " << std::setw(10) + << util::format_duration(ts.ttfb.min) << " " << std::setw(10) + << util::format_duration(ts.ttfb.max) << " " << std::setw(10) + << util::format_duration(ts.ttfb.mean) << " " << std::setw(10) + << util::format_duration(ts.ttfb.sd) << std::setw(9) + << util::dtos(ts.ttfb.within_sd) << "%" + << "\nreq/s : " << std::setw(10) << ts.rps.min << " " + << std::setw(10) << ts.rps.max << " " << std::setw(10) << ts.rps.mean + << " " << std::setw(10) << ts.rps.sd << std::setw(9) + << util::dtos(ts.rps.within_sd) << "%" << std::endl; SSL_CTX_free(ssl_ctx); diff --git a/lib/nghttp2/src/h2load.h b/lib/nghttp2-1.65.0/src/h2load.h similarity index 97% rename from lib/nghttp2/src/h2load.h rename to lib/nghttp2-1.65.0/src/h2load.h index d848fdf2ee2..343830e6dcd 100644 --- a/lib/nghttp2/src/h2load.h +++ b/lib/nghttp2-1.65.0/src/h2load.h @@ -43,6 +43,7 @@ #include #include +#define NGHTTP2_NO_SSIZE_T #include #ifdef ENABLE_HTTP3 @@ -52,7 +53,14 @@ #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include "http2.h" #ifdef ENABLE_HTTP3 @@ -92,7 +100,7 @@ struct Config { size_t nclients; size_t nthreads; // The maximum number of concurrent streams per session. - ssize_t max_concurrent_streams; + size_t max_concurrent_streams; size_t window_bits; size_t connection_window_bits; size_t max_frame_size; @@ -127,9 +135,9 @@ struct Config { bool base_uri_unix; // used when UNIX domain socket is used (base_uri_unix is true). sockaddr_un unix_addr; - // list of supported NPN/ALPN protocol strings in the order of + // list of supported ALPN protocol strings in the order of // preference. - std::vector npn_list; + std::vector alpn_list; // The number of request per second for each client. double rps; // Disables GSO for UDP connections. @@ -138,6 +146,9 @@ struct Config { size_t max_udp_payload_size; // Enable ktls. bool ktls; + // sni is the value sent in TLS SNI, overriding DNS name of the + // remote host. + std::string sni; Config(); ~Config(); diff --git a/lib/nghttp2/src/h2load_http1_session.cc b/lib/nghttp2-1.65.0/src/h2load_http1_session.cc similarity index 78% rename from lib/nghttp2/src/h2load_http1_session.cc rename to lib/nghttp2-1.65.0/src/h2load_http1_session.cc index 6bdcd0471e6..1ae44a0d43d 100644 --- a/lib/nghttp2/src/h2load_http1_session.cc +++ b/lib/nghttp2-1.65.0/src/h2load_http1_session.cc @@ -147,38 +147,38 @@ int htp_body_cb(llhttp_t *htp, const char *data, size_t len) { namespace { constexpr llhttp_settings_t htp_hooks = { - htp_msg_begincb, // llhttp_cb on_message_begin; - nullptr, // llhttp_data_cb on_url; - htp_statuscb, // llhttp_data_cb on_status; - nullptr, // llhttp_data_cb on_method; - nullptr, // llhttp_data_cb on_version; - htp_hdr_keycb, // llhttp_data_cb on_header_field; - htp_hdr_valcb, // llhttp_data_cb on_header_value; - nullptr, // llhttp_data_cb on_chunk_extension_name; - nullptr, // llhttp_data_cb on_chunk_extension_value; - htp_hdrs_completecb, // llhttp_cb on_headers_complete; - htp_body_cb, // llhttp_data_cb on_body; - htp_msg_completecb, // llhttp_cb on_message_complete; - nullptr, // llhttp_cb on_url_complete; - nullptr, // llhttp_cb on_status_complete; - nullptr, // llhttp_cb on_method_complete; - nullptr, // llhttp_cb on_version_complete; - nullptr, // llhttp_cb on_header_field_complete; - nullptr, // llhttp_cb on_header_value_complete; - nullptr, // llhttp_cb on_chunk_extension_name_complete; - nullptr, // llhttp_cb on_chunk_extension_value_complete; - nullptr, // llhttp_cb on_chunk_header; - nullptr, // llhttp_cb on_chunk_complete; - nullptr, // llhttp_cb on_reset; + htp_msg_begincb, // llhttp_cb on_message_begin; + nullptr, // llhttp_data_cb on_url; + htp_statuscb, // llhttp_data_cb on_status; + nullptr, // llhttp_data_cb on_method; + nullptr, // llhttp_data_cb on_version; + htp_hdr_keycb, // llhttp_data_cb on_header_field; + htp_hdr_valcb, // llhttp_data_cb on_header_value; + nullptr, // llhttp_data_cb on_chunk_extension_name; + nullptr, // llhttp_data_cb on_chunk_extension_value; + htp_hdrs_completecb, // llhttp_cb on_headers_complete; + htp_body_cb, // llhttp_data_cb on_body; + htp_msg_completecb, // llhttp_cb on_message_complete; + nullptr, // llhttp_cb on_url_complete; + nullptr, // llhttp_cb on_status_complete; + nullptr, // llhttp_cb on_method_complete; + nullptr, // llhttp_cb on_version_complete; + nullptr, // llhttp_cb on_header_field_complete; + nullptr, // llhttp_cb on_header_value_complete; + nullptr, // llhttp_cb on_chunk_extension_name_complete; + nullptr, // llhttp_cb on_chunk_extension_value_complete; + nullptr, // llhttp_cb on_chunk_header; + nullptr, // llhttp_cb on_chunk_complete; + nullptr, // llhttp_cb on_reset; }; } // namespace Http1Session::Http1Session(Client *client) - : stream_req_counter_(1), - stream_resp_counter_(1), - client_(client), - htp_(), - complete_(false) { + : stream_req_counter_(1), + stream_resp_counter_(1), + client_(client), + htp_(), + complete_(false) { llhttp_init(&htp_, HTTP_RESPONSE, &htp_hooks); htp_.data = this; } @@ -215,12 +215,12 @@ int Http1Session::submit_request() { int Http1Session::on_read(const uint8_t *data, size_t len) { auto htperr = - llhttp_execute(&htp_, reinterpret_cast(data), len); + llhttp_execute(&htp_, reinterpret_cast(data), len); auto nread = htperr == HPE_OK - ? len - : static_cast(reinterpret_cast( - llhttp_get_error_pos(&htp_)) - - data); + ? len + : static_cast(reinterpret_cast( + llhttp_get_error_pos(&htp_)) - + data); if (client_->worker->config->verbose) { std::cout.write(reinterpret_cast(data), nread); diff --git a/lib/nghttp2/src/h2load_http1_session.h b/lib/nghttp2-1.65.0/src/h2load_http1_session.h similarity index 100% rename from lib/nghttp2/src/h2load_http1_session.h rename to lib/nghttp2-1.65.0/src/h2load_http1_session.h diff --git a/lib/nghttp2/src/h2load_http2_session.cc b/lib/nghttp2-1.65.0/src/h2load_http2_session.cc similarity index 85% rename from lib/nghttp2/src/h2load_http2_session.cc rename to lib/nghttp2-1.65.0/src/h2load_http2_session.cc index 9cafa0e384a..538a4a793b6 100644 --- a/lib/nghttp2/src/h2load_http2_session.cc +++ b/lib/nghttp2-1.65.0/src/h2load_http2_session.cc @@ -37,7 +37,7 @@ using namespace nghttp2; namespace h2load { Http2Session::Http2Session(Client *client) - : client_(client), session_(nullptr) {} + : client_(client), session_(nullptr) {} Http2Session::~Http2Session() { nghttp2_session_del(session_); } @@ -47,8 +47,7 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *value, size_t valuelen, uint8_t flags, void *user_data) { auto client = static_cast(user_data); - if (frame->hd.type != NGHTTP2_HEADERS || - frame->headers.cat != NGHTTP2_HCAT_RESPONSE) { + if (frame->hd.type != NGHTTP2_HEADERS) { return 0; } client->on_header(frame->hd.stream_id, name, namelen, value, valuelen); @@ -70,15 +69,17 @@ namespace { int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, void *user_data) { auto client = static_cast(user_data); - if (frame->hd.type != NGHTTP2_HEADERS || - frame->headers.cat != NGHTTP2_HCAT_RESPONSE) { - return 0; - } - client->worker->stats.bytes_head += + switch (frame->hd.type) { + case NGHTTP2_HEADERS: + client->worker->stats.bytes_head += frame->hd.length - frame->headers.padlen - ((frame->hd.flags & NGHTTP2_FLAG_PRIORITY) ? 5 : 0); - if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { - client->record_ttfb(); + // fall through + case NGHTTP2_DATA: + if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { + client->record_ttfb(); + } + break; } return 0; } @@ -123,16 +124,17 @@ int before_frame_send_callback(nghttp2_session *session, } // namespace namespace { -ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t length, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) { +nghttp2_ssize file_read_callback(nghttp2_session *session, int32_t stream_id, + uint8_t *buf, size_t length, + uint32_t *data_flags, + nghttp2_data_source *source, void *user_data) { auto client = static_cast(user_data); auto config = client->worker->config; auto req_stat = client->get_req_stat(stream_id); assert(req_stat); ssize_t nread; while ((nread = pread(config->data_fd, buf, length, req_stat->data_offset)) == - -1 && + -1 && errno == EINTR) ; @@ -157,8 +159,8 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, } // namespace namespace { -ssize_t send_callback(nghttp2_session *session, const uint8_t *data, - size_t length, int flags, void *user_data) { +nghttp2_ssize send_callback(nghttp2_session *session, const uint8_t *data, + size_t length, int flags, void *user_data) { auto client = static_cast(user_data); auto &wb = client->wb; @@ -186,18 +188,18 @@ void Http2Session::on_connect() { on_frame_recv_callback); nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - callbacks, on_data_chunk_recv_callback); + callbacks, on_data_chunk_recv_callback); nghttp2_session_callbacks_set_on_stream_close_callback( - callbacks, on_stream_close_callback); + callbacks, on_stream_close_callback); nghttp2_session_callbacks_set_on_header_callback(callbacks, on_header_callback); nghttp2_session_callbacks_set_before_frame_send_callback( - callbacks, before_frame_send_callback); + callbacks, before_frame_send_callback); - nghttp2_session_callbacks_set_send_callback(callbacks, send_callback); + nghttp2_session_callbacks_set_send_callback2(callbacks, send_callback); nghttp2_option *opt; @@ -208,7 +210,7 @@ void Http2Session::on_connect() { if (config->encoder_header_table_size != NGHTTP2_DEFAULT_HEADER_TABLE_SIZE) { nghttp2_option_set_max_deflate_dynamic_table_size( - opt, config->encoder_header_table_size); + opt, config->encoder_header_table_size); } nghttp2_session_client_new2(&session_, callbacks, client_, opt); @@ -256,11 +258,11 @@ int Http2Session::submit_request() { client_->reqidx = 0; } - nghttp2_data_provider prd{{0}, file_read_callback}; + nghttp2_data_provider2 prd{{0}, file_read_callback}; auto stream_id = - nghttp2_submit_request(session_, nullptr, nva.data(), nva.size(), - config->data_fd == -1 ? nullptr : &prd, nullptr); + nghttp2_submit_request2(session_, nullptr, nva.data(), nva.size(), + config->data_fd == -1 ? nullptr : &prd, nullptr); if (stream_id < 0) { return -1; } @@ -271,7 +273,7 @@ int Http2Session::submit_request() { } int Http2Session::on_read(const uint8_t *data, size_t len) { - auto rv = nghttp2_session_mem_recv(session_, data, len); + auto rv = nghttp2_session_mem_recv2(session_, data, len); if (rv < 0) { return -1; } @@ -307,7 +309,7 @@ void Http2Session::terminate() { } size_t Http2Session::max_concurrent_streams() { - return (size_t)client_->worker->config->max_concurrent_streams; + return client_->worker->config->max_concurrent_streams; } } // namespace h2load diff --git a/lib/nghttp2/src/h2load_http2_session.h b/lib/nghttp2-1.65.0/src/h2load_http2_session.h similarity index 100% rename from lib/nghttp2/src/h2load_http2_session.h rename to lib/nghttp2-1.65.0/src/h2load_http2_session.h diff --git a/lib/nghttp2/src/h2load_http3_session.cc b/lib/nghttp2-1.65.0/src/h2load_http3_session.cc similarity index 88% rename from lib/nghttp2/src/h2load_http3_session.cc rename to lib/nghttp2-1.65.0/src/h2load_http3_session.cc index f4779beb5f3..c61e8cb9ba2 100644 --- a/lib/nghttp2/src/h2load_http3_session.cc +++ b/lib/nghttp2-1.65.0/src/h2load_http3_session.cc @@ -33,7 +33,7 @@ namespace h2load { Http3Session::Http3Session(Client *client) - : client_(client), conn_(nullptr), npending_request_(0), reqidx_(0) {} + : client_(client), conn_(nullptr), npending_request_(0), reqidx_(0) {} Http3Session::~Http3Session() { nghttp3_conn_del(conn_); } @@ -103,8 +103,8 @@ int64_t Http3Session::submit_request_internal() { dr.read_data = h2load::read_data; rv = nghttp3_conn_submit_request( - conn_, stream_id, reinterpret_cast(nva.data()), nva.size(), - config->data_fd == -1 ? nullptr : &dr, nullptr); + conn_, stream_id, reinterpret_cast(nva.data()), nva.size(), + config->data_fd == -1 ? nullptr : &dr, nullptr); if (rv != 0) { return rv; } @@ -124,7 +124,7 @@ int Http3Session::on_write() { return -1; } void Http3Session::terminate() {} size_t Http3Session::max_concurrent_streams() { - return (size_t)client_->worker->config->max_concurrent_streams; + return client_->worker->config->max_concurrent_streams; } namespace { @@ -147,6 +147,23 @@ int Http3Session::stream_close(int64_t stream_id, uint64_t app_error_code) { return 0; } +namespace { +int end_stream(nghttp3_conn *conn, int64_t stream_id, void *user_data, + void *stream_user_data) { + auto s = static_cast(user_data); + if (s->end_stream(stream_id) != 0) { + return NGHTTP3_ERR_CALLBACK_FAILURE; + } + return 0; +} +} // namespace + +int Http3Session::end_stream(int64_t stream_id) { + client_->record_ttfb(); + + return 0; +} + namespace { int recv_data(nghttp3_conn *conn, int64_t stream_id, const uint8_t *data, size_t datalen, void *user_data, void *stream_user_data) { @@ -310,20 +327,20 @@ int Http3Session::init_conn() { } nghttp3_callbacks callbacks{ - nullptr, // acked_stream_data - h2load::stream_close, - h2load::recv_data, - h2load::deferred_consume, - h2load::begin_headers, - h2load::recv_header, - nullptr, // end_headers - nullptr, // begin_trailers - h2load::recv_header, - nullptr, // end_trailers - h2load::stop_sending, - nullptr, // end_stream - h2load::reset_stream, - nullptr, // shutdown + nullptr, // acked_stream_data + h2load::stream_close, + h2load::recv_data, + h2load::deferred_consume, + h2load::begin_headers, + h2load::recv_header, + nullptr, // end_headers + nullptr, // begin_trailers + h2load::recv_header, + nullptr, // end_trailers + h2load::stop_sending, + h2load::end_stream, + h2load::reset_stream, + nullptr, // shutdown }; auto config = client_->worker->config; @@ -345,7 +362,7 @@ int Http3Session::init_conn() { int64_t ctrl_stream_id; rv = - ngtcp2_conn_open_uni_stream(client_->quic.conn, &ctrl_stream_id, nullptr); + ngtcp2_conn_open_uni_stream(client_->quic.conn, &ctrl_stream_id, nullptr); if (rv != 0) { std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv) << std::endl; @@ -391,13 +408,13 @@ int Http3Session::init_conn() { ssize_t Http3Session::read_stream(uint32_t flags, int64_t stream_id, const uint8_t *data, size_t datalen) { auto nconsumed = nghttp3_conn_read_stream( - conn_, stream_id, data, datalen, flags & NGTCP2_STREAM_DATA_FLAG_FIN); + conn_, stream_id, data, datalen, flags & NGTCP2_STREAM_DATA_FLAG_FIN); if (nconsumed < 0) { std::cerr << "nghttp3_conn_read_stream: " << nghttp3_strerror(nconsumed) << std::endl; ngtcp2_ccerr_set_application_error( - &client_->quic.last_error, - nghttp3_err_infer_quic_app_error_code(nconsumed), nullptr, 0); + &client_->quic.last_error, + nghttp3_err_infer_quic_app_error_code(nconsumed), nullptr, 0); return -1; } return nconsumed; @@ -406,11 +423,11 @@ ssize_t Http3Session::read_stream(uint32_t flags, int64_t stream_id, ssize_t Http3Session::write_stream(int64_t &stream_id, int &fin, nghttp3_vec *vec, size_t veccnt) { auto sveccnt = - nghttp3_conn_writev_stream(conn_, &stream_id, &fin, vec, veccnt); + nghttp3_conn_writev_stream(conn_, &stream_id, &fin, vec, veccnt); if (sveccnt < 0) { ngtcp2_ccerr_set_application_error( - &client_->quic.last_error, - nghttp3_err_infer_quic_app_error_code(sveccnt), nullptr, 0); + &client_->quic.last_error, nghttp3_err_infer_quic_app_error_code(sveccnt), + nullptr, 0); return -1; } return sveccnt; @@ -436,8 +453,8 @@ int Http3Session::add_write_offset(int64_t stream_id, size_t ndatalen) { auto rv = nghttp3_conn_add_write_offset(conn_, stream_id, ndatalen); if (rv != 0) { ngtcp2_ccerr_set_application_error( - &client_->quic.last_error, nghttp3_err_infer_quic_app_error_code(rv), - nullptr, 0); + &client_->quic.last_error, nghttp3_err_infer_quic_app_error_code(rv), + nullptr, 0); return -1; } return 0; @@ -447,8 +464,8 @@ int Http3Session::add_ack_offset(int64_t stream_id, size_t datalen) { auto rv = nghttp3_conn_add_ack_offset(conn_, stream_id, datalen); if (rv != 0) { ngtcp2_ccerr_set_application_error( - &client_->quic.last_error, nghttp3_err_infer_quic_app_error_code(rv), - nullptr, 0); + &client_->quic.last_error, nghttp3_err_infer_quic_app_error_code(rv), + nullptr, 0); return -1; } return 0; diff --git a/lib/nghttp2/src/h2load_http3_session.h b/lib/nghttp2-1.65.0/src/h2load_http3_session.h similarity index 98% rename from lib/nghttp2/src/h2load_http3_session.h rename to lib/nghttp2-1.65.0/src/h2load_http3_session.h index 89c7ca00f5e..861041796ac 100644 --- a/lib/nghttp2/src/h2load_http3_session.h +++ b/lib/nghttp2-1.65.0/src/h2load_http3_session.h @@ -46,6 +46,7 @@ class Http3Session : public Session { int init_conn(); int stream_close(int64_t stream_id, uint64_t app_error_code); + int end_stream(int64_t stream_id); void recv_data(int64_t stream_id, const uint8_t *data, size_t datalen); void consume(int64_t stream_id, size_t nconsumed); void begin_headers(int64_t stream_id); diff --git a/lib/nghttp2/src/h2load_quic.cc b/lib/nghttp2-1.65.0/src/h2load_quic.cc similarity index 85% rename from lib/nghttp2/src/h2load_quic.cc rename to lib/nghttp2-1.65.0/src/h2load_quic.cc index 65fbc109cb1..d3a4d49b3ae 100644 --- a/lib/nghttp2/src/h2load_quic.cc +++ b/lib/nghttp2-1.65.0/src/h2load_quic.cc @@ -35,8 +35,16 @@ # include #endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL -#include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include "h2load_http3_session.h" @@ -262,8 +270,8 @@ int generate_cid(ngtcp2_cid &dest) { namespace { ngtcp2_tstamp quic_timestamp() { return std::chrono::duration_cast( - std::chrono::steady_clock::now().time_since_epoch()) - .count(); + std::chrono::steady_clock::now().time_since_epoch()) + .count(); } } // namespace @@ -338,45 +346,45 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen, } auto callbacks = ngtcp2_callbacks{ - ngtcp2_crypto_client_initial_cb, - nullptr, // recv_client_initial - ngtcp2_crypto_recv_crypto_data_cb, - h2load::handshake_completed, - nullptr, // recv_version_negotiation - ngtcp2_crypto_encrypt_cb, - ngtcp2_crypto_decrypt_cb, - ngtcp2_crypto_hp_mask_cb, - h2load::recv_stream_data, - h2load::acked_stream_data_offset, - nullptr, // stream_open - h2load::stream_close, - nullptr, // recv_stateless_reset - ngtcp2_crypto_recv_retry_cb, - h2load::extend_max_local_streams_bidi, - nullptr, // extend_max_local_streams_uni - h2load::rand, - get_new_connection_id, - nullptr, // remove_connection_id - ngtcp2_crypto_update_key_cb, - nullptr, // path_validation - nullptr, // select_preferred_addr - h2load::stream_reset, - nullptr, // extend_max_remote_streams_bidi - nullptr, // extend_max_remote_streams_uni - h2load::extend_max_stream_data, - nullptr, // dcid_status - nullptr, // handshake_confirmed - nullptr, // recv_new_token - ngtcp2_crypto_delete_crypto_aead_ctx_cb, - ngtcp2_crypto_delete_crypto_cipher_ctx_cb, - nullptr, // recv_datagram - nullptr, // ack_datagram - nullptr, // lost_datagram - ngtcp2_crypto_get_path_challenge_data_cb, - h2load::stream_stop_sending, - nullptr, // version_negotiation - h2load::recv_rx_key, - nullptr, // recv_tx_key + ngtcp2_crypto_client_initial_cb, + nullptr, // recv_client_initial + ngtcp2_crypto_recv_crypto_data_cb, + h2load::handshake_completed, + nullptr, // recv_version_negotiation + ngtcp2_crypto_encrypt_cb, + ngtcp2_crypto_decrypt_cb, + ngtcp2_crypto_hp_mask_cb, + h2load::recv_stream_data, + h2load::acked_stream_data_offset, + nullptr, // stream_open + h2load::stream_close, + nullptr, // recv_stateless_reset + ngtcp2_crypto_recv_retry_cb, + h2load::extend_max_local_streams_bidi, + nullptr, // extend_max_local_streams_uni + h2load::rand, + get_new_connection_id, + nullptr, // remove_connection_id + ngtcp2_crypto_update_key_cb, + nullptr, // path_validation + nullptr, // select_preferred_addr + h2load::stream_reset, + nullptr, // extend_max_remote_streams_bidi + nullptr, // extend_max_remote_streams_uni + h2load::extend_max_stream_data, + nullptr, // dcid_status + nullptr, // handshake_confirmed + nullptr, // recv_new_token + ngtcp2_crypto_delete_crypto_aead_ctx_cb, + ngtcp2_crypto_delete_crypto_cipher_ctx_cb, + nullptr, // recv_datagram + nullptr, // ack_datagram + nullptr, // lost_datagram + ngtcp2_crypto_get_path_challenge_data_cb, + h2load::stream_stop_sending, + nullptr, // version_negotiation + h2load::recv_rx_key, + nullptr, // recv_tx_key }; ngtcp2_cid scid, dcid; @@ -419,7 +427,7 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen, ngtcp2_transport_params params; ngtcp2_transport_params_default(¶ms); auto max_stream_data = - std::min((1 << 26) - 1, (1 << config->window_bits) - 1); + std::min((1 << 26) - 1, (1 << config->window_bits) - 1); params.initial_max_stream_data_bidi_local = max_stream_data; params.initial_max_stream_data_uni = max_stream_data; params.initial_max_data = (1 << config->connection_window_bits) - 1; @@ -428,21 +436,21 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen, params.max_idle_timeout = 30 * NGTCP2_SECONDS; auto path = ngtcp2_path{ - { - const_cast(local_addr), - local_addrlen, - }, - { - const_cast(remote_addr), - remote_addrlen, - }, + { + const_cast(local_addr), + local_addrlen, + }, + { + const_cast(remote_addr), + remote_addrlen, + }, }; - assert(config->npn_list.size()); + assert(config->alpn_list.size()); uint32_t quic_version; - if (config->npn_list[0] == NGHTTP3_ALPN_H3) { + if (config->alpn_list[0] == NGHTTP3_ALPN_H3) { quic_version = NGTCP2_PROTO_VER_V1; } else { quic_version = NGTCP2_PROTO_VER_MIN; @@ -477,8 +485,8 @@ void Client::quic_close_connection() { ngtcp2_path_storage_zero(&ps); auto nwrite = ngtcp2_conn_write_connection_close( - quic.conn, &ps.path, nullptr, buf.data(), buf.size(), &quic.last_error, - quic_timestamp()); + quic.conn, &ps.path, nullptr, buf.data(), buf.size(), &quic.last_error, + quic_timestamp()); if (nwrite <= 0) { return; @@ -531,14 +539,14 @@ int Client::quic_pkt_timeout() { void Client::quic_restart_pkt_timer() { auto expiry = ngtcp2_conn_get_expiry(quic.conn); auto now = quic_timestamp(); - auto t = expiry > now ? static_cast(expiry - now) / NGTCP2_SECONDS - : 1e-9; + auto t = + expiry > now ? static_cast(expiry - now) / NGTCP2_SECONDS : 1e-9; quic.pkt_timer.repeat = t; ev_timer_again(worker->loop, &quic.pkt_timer); } int Client::read_quic() { - std::array buf; + std::array buf; sockaddr_union su; int rv; size_t pktcnt = 0; @@ -553,7 +561,7 @@ int Client::read_quic() { msg.msg_iov = &msg_iov; msg.msg_iovlen = 1; - uint8_t msg_ctrl[CMSG_SPACE(sizeof(uint16_t))]; + uint8_t msg_ctrl[CMSG_SPACE(sizeof(int))]; msg.msg_control = msg_ctrl; auto ts = quic_timestamp(); @@ -574,17 +582,21 @@ int Client::read_quic() { assert(quic.conn); - ++worker->stats.udp_dgram_recv; + if (gso_size) { + worker->stats.udp_dgram_recv += (nread + gso_size - 1) / gso_size; + } else { + ++worker->stats.udp_dgram_recv; + } auto path = ngtcp2_path{ - { - &local_addr.su.sa, - static_cast(local_addr.len), - }, - { - &su.sa, - msg.msg_namelen, - }, + { + &local_addr.su.sa, + static_cast(local_addr.len), + }, + { + &su.sa, + msg.msg_namelen, + }, }; auto data = buf.data(); @@ -646,16 +658,13 @@ int Client::write_quic() { } std::array vec; - size_t pktcnt = 0; auto max_udp_payload_size = - ngtcp2_conn_get_max_tx_udp_payload_size(quic.conn); -#ifdef UDP_SEGMENT + ngtcp2_conn_get_max_tx_udp_payload_size(quic.conn); auto path_max_udp_payload_size = - ngtcp2_conn_get_path_max_tx_udp_payload_size(quic.conn); -#endif // UDP_SEGMENT - auto max_pktcnt = - ngtcp2_conn_get_send_quantum(quic.conn) / max_udp_payload_size; + ngtcp2_conn_get_path_max_tx_udp_payload_size(quic.conn); uint8_t *bufpos = quic.tx.data.get(); + auto bufleft = std::max(ngtcp2_conn_get_send_quantum(quic.conn), + path_max_udp_payload_size); ngtcp2_path_storage ps; size_t gso_size = 0; @@ -685,9 +694,11 @@ int Client::write_quic() { flags |= NGTCP2_WRITE_STREAM_FLAG_FIN; } + auto buflen = bufleft >= max_udp_payload_size ? max_udp_payload_size + : path_max_udp_payload_size; auto nwrite = ngtcp2_conn_writev_stream( - quic.conn, &ps.path, nullptr, bufpos, max_udp_payload_size, &ndatalen, - flags, stream_id, reinterpret_cast(v), vcnt, ts); + quic.conn, &ps.path, nullptr, bufpos, buflen, &ndatalen, flags, stream_id, + reinterpret_cast(v), vcnt, ts); if (nwrite < 0) { switch (nwrite) { case NGTCP2_ERR_STREAM_DATA_BLOCKED: @@ -729,7 +740,11 @@ int Client::write_quic() { return 0; } + auto first_pkt = bufpos == quic.tx.data.get(); + (void)first_pkt; + bufpos += nwrite; + bufleft -= nwrite; #ifdef UDP_SEGMENT if (worker->config->no_udp_gso) { @@ -744,7 +759,7 @@ int Client::write_quic() { return 0; } - if (++pktcnt == max_pktcnt) { + if (bufleft < path_max_udp_payload_size) { signal_write(); return 0; } @@ -757,7 +772,7 @@ int Client::write_quic() { #endif // UDP_SEGMENT #ifdef UDP_SEGMENT - if (pktcnt == 0) { + if (first_pkt) { gso_size = nwrite; } else if (static_cast(nwrite) > gso_size || (gso_size > path_max_udp_payload_size && @@ -783,7 +798,8 @@ int Client::write_quic() { } // Assume that the path does not change. - if (++pktcnt == max_pktcnt || static_cast(nwrite) < gso_size) { + if (bufleft < path_max_udp_payload_size || + static_cast(nwrite) < gso_size) { auto data = quic.tx.data.get(); auto datalen = bufpos - quic.tx.data.get(); rv = write_udp(ps.path.remote.addr, ps.path.remote.addrlen, data, datalen, diff --git a/lib/nghttp2/src/h2load_quic.h b/lib/nghttp2-1.65.0/src/h2load_quic.h similarity index 100% rename from lib/nghttp2/src/h2load_quic.h rename to lib/nghttp2-1.65.0/src/h2load_quic.h diff --git a/lib/nghttp2/src/h2load_session.h b/lib/nghttp2-1.65.0/src/h2load_session.h similarity index 100% rename from lib/nghttp2/src/h2load_session.h rename to lib/nghttp2-1.65.0/src/h2load_session.h diff --git a/lib/nghttp2/src/http2.cc b/lib/nghttp2-1.65.0/src/http2.cc similarity index 72% rename from lib/nghttp2/src/http2.cc rename to lib/nghttp2-1.65.0/src/http2.cc index acbb4e4a525..3c950fbd7b1 100644 --- a/lib/nghttp2/src/http2.cc +++ b/lib/nghttp2-1.65.0/src/http2.cc @@ -35,107 +35,107 @@ namespace http2 { StringRef get_reason_phrase(unsigned int status_code) { switch (status_code) { case 100: - return StringRef::from_lit("Continue"); + return "Continue"_sr; case 101: - return StringRef::from_lit("Switching Protocols"); + return "Switching Protocols"_sr; case 103: - return StringRef::from_lit("Early Hints"); + return "Early Hints"_sr; case 200: - return StringRef::from_lit("OK"); + return "OK"_sr; case 201: - return StringRef::from_lit("Created"); + return "Created"_sr; case 202: - return StringRef::from_lit("Accepted"); + return "Accepted"_sr; case 203: - return StringRef::from_lit("Non-Authoritative Information"); + return "Non-Authoritative Information"_sr; case 204: - return StringRef::from_lit("No Content"); + return "No Content"_sr; case 205: - return StringRef::from_lit("Reset Content"); + return "Reset Content"_sr; case 206: - return StringRef::from_lit("Partial Content"); + return "Partial Content"_sr; case 300: - return StringRef::from_lit("Multiple Choices"); + return "Multiple Choices"_sr; case 301: - return StringRef::from_lit("Moved Permanently"); + return "Moved Permanently"_sr; case 302: - return StringRef::from_lit("Found"); + return "Found"_sr; case 303: - return StringRef::from_lit("See Other"); + return "See Other"_sr; case 304: - return StringRef::from_lit("Not Modified"); + return "Not Modified"_sr; case 305: - return StringRef::from_lit("Use Proxy"); - // case 306: return StringRef::from_lit("(Unused)"); + return "Use Proxy"_sr; + // case 306: return "(Unused)"_sr; case 307: - return StringRef::from_lit("Temporary Redirect"); + return "Temporary Redirect"_sr; case 308: - return StringRef::from_lit("Permanent Redirect"); + return "Permanent Redirect"_sr; case 400: - return StringRef::from_lit("Bad Request"); + return "Bad Request"_sr; case 401: - return StringRef::from_lit("Unauthorized"); + return "Unauthorized"_sr; case 402: - return StringRef::from_lit("Payment Required"); + return "Payment Required"_sr; case 403: - return StringRef::from_lit("Forbidden"); + return "Forbidden"_sr; case 404: - return StringRef::from_lit("Not Found"); + return "Not Found"_sr; case 405: - return StringRef::from_lit("Method Not Allowed"); + return "Method Not Allowed"_sr; case 406: - return StringRef::from_lit("Not Acceptable"); + return "Not Acceptable"_sr; case 407: - return StringRef::from_lit("Proxy Authentication Required"); + return "Proxy Authentication Required"_sr; case 408: - return StringRef::from_lit("Request Timeout"); + return "Request Timeout"_sr; case 409: - return StringRef::from_lit("Conflict"); + return "Conflict"_sr; case 410: - return StringRef::from_lit("Gone"); + return "Gone"_sr; case 411: - return StringRef::from_lit("Length Required"); + return "Length Required"_sr; case 412: - return StringRef::from_lit("Precondition Failed"); + return "Precondition Failed"_sr; case 413: - return StringRef::from_lit("Payload Too Large"); + return "Payload Too Large"_sr; case 414: - return StringRef::from_lit("URI Too Long"); + return "URI Too Long"_sr; case 415: - return StringRef::from_lit("Unsupported Media Type"); + return "Unsupported Media Type"_sr; case 416: - return StringRef::from_lit("Requested Range Not Satisfiable"); + return "Requested Range Not Satisfiable"_sr; case 417: - return StringRef::from_lit("Expectation Failed"); + return "Expectation Failed"_sr; case 421: - return StringRef::from_lit("Misdirected Request"); + return "Misdirected Request"_sr; case 425: // https://tools.ietf.org/html/rfc8470 - return StringRef::from_lit("Too Early"); + return "Too Early"_sr; case 426: - return StringRef::from_lit("Upgrade Required"); + return "Upgrade Required"_sr; case 428: - return StringRef::from_lit("Precondition Required"); + return "Precondition Required"_sr; case 429: - return StringRef::from_lit("Too Many Requests"); + return "Too Many Requests"_sr; case 431: - return StringRef::from_lit("Request Header Fields Too Large"); + return "Request Header Fields Too Large"_sr; case 451: - return StringRef::from_lit("Unavailable For Legal Reasons"); + return "Unavailable For Legal Reasons"_sr; case 500: - return StringRef::from_lit("Internal Server Error"); + return "Internal Server Error"_sr; case 501: - return StringRef::from_lit("Not Implemented"); + return "Not Implemented"_sr; case 502: - return StringRef::from_lit("Bad Gateway"); + return "Bad Gateway"_sr; case 503: - return StringRef::from_lit("Service Unavailable"); + return "Service Unavailable"_sr; case 504: - return StringRef::from_lit("Gateway Timeout"); + return "Gateway Timeout"_sr; case 505: - return StringRef::from_lit("HTTP Version Not Supported"); + return "HTTP Version Not Supported"_sr; case 511: - return StringRef::from_lit("Network Authentication Required"); + return "Network Authentication Required"_sr; default: return StringRef{}; } @@ -144,104 +144,104 @@ StringRef get_reason_phrase(unsigned int status_code) { StringRef stringify_status(BlockAllocator &balloc, unsigned int status_code) { switch (status_code) { case 100: - return StringRef::from_lit("100"); + return "100"_sr; case 101: - return StringRef::from_lit("101"); + return "101"_sr; case 103: - return StringRef::from_lit("103"); + return "103"_sr; case 200: - return StringRef::from_lit("200"); + return "200"_sr; case 201: - return StringRef::from_lit("201"); + return "201"_sr; case 202: - return StringRef::from_lit("202"); + return "202"_sr; case 203: - return StringRef::from_lit("203"); + return "203"_sr; case 204: - return StringRef::from_lit("204"); + return "204"_sr; case 205: - return StringRef::from_lit("205"); + return "205"_sr; case 206: - return StringRef::from_lit("206"); + return "206"_sr; case 300: - return StringRef::from_lit("300"); + return "300"_sr; case 301: - return StringRef::from_lit("301"); + return "301"_sr; case 302: - return StringRef::from_lit("302"); + return "302"_sr; case 303: - return StringRef::from_lit("303"); + return "303"_sr; case 304: - return StringRef::from_lit("304"); + return "304"_sr; case 305: - return StringRef::from_lit("305"); - // case 306: return StringRef::from_lit("306"); + return "305"_sr; + // case 306: return "306"_sr; case 307: - return StringRef::from_lit("307"); + return "307"_sr; case 308: - return StringRef::from_lit("308"); + return "308"_sr; case 400: - return StringRef::from_lit("400"); + return "400"_sr; case 401: - return StringRef::from_lit("401"); + return "401"_sr; case 402: - return StringRef::from_lit("402"); + return "402"_sr; case 403: - return StringRef::from_lit("403"); + return "403"_sr; case 404: - return StringRef::from_lit("404"); + return "404"_sr; case 405: - return StringRef::from_lit("405"); + return "405"_sr; case 406: - return StringRef::from_lit("406"); + return "406"_sr; case 407: - return StringRef::from_lit("407"); + return "407"_sr; case 408: - return StringRef::from_lit("408"); + return "408"_sr; case 409: - return StringRef::from_lit("409"); + return "409"_sr; case 410: - return StringRef::from_lit("410"); + return "410"_sr; case 411: - return StringRef::from_lit("411"); + return "411"_sr; case 412: - return StringRef::from_lit("412"); + return "412"_sr; case 413: - return StringRef::from_lit("413"); + return "413"_sr; case 414: - return StringRef::from_lit("414"); + return "414"_sr; case 415: - return StringRef::from_lit("415"); + return "415"_sr; case 416: - return StringRef::from_lit("416"); + return "416"_sr; case 417: - return StringRef::from_lit("417"); + return "417"_sr; case 421: - return StringRef::from_lit("421"); + return "421"_sr; case 426: - return StringRef::from_lit("426"); + return "426"_sr; case 428: - return StringRef::from_lit("428"); + return "428"_sr; case 429: - return StringRef::from_lit("429"); + return "429"_sr; case 431: - return StringRef::from_lit("431"); + return "431"_sr; case 451: - return StringRef::from_lit("451"); + return "451"_sr; case 500: - return StringRef::from_lit("500"); + return "500"_sr; case 501: - return StringRef::from_lit("501"); + return "501"_sr; case 502: - return StringRef::from_lit("502"); + return "502"_sr; case 503: - return StringRef::from_lit("503"); + return "503"_sr; case 504: - return StringRef::from_lit("504"); + return "504"_sr; case 505: - return StringRef::from_lit("505"); + return "505"_sr; case 511: - return StringRef::from_lit("511"); + return "511"_sr; default: return util::make_string_ref_uint(balloc, status_code); } @@ -271,34 +271,23 @@ bool lws(const char *value) { return true; } -void copy_url_component(std::string &dest, const http_parser_url *u, int field, +void copy_url_component(std::string &dest, const urlparse_url *u, int field, const char *url) { if (u->field_set & (1 << field)) { dest.assign(url + u->field_data[field].off, u->field_data[field].len); } } -Headers::value_type to_header(const uint8_t *name, size_t namelen, - const uint8_t *value, size_t valuelen, +Headers::value_type to_header(const StringRef &name, const StringRef &value, bool no_index, int32_t token) { - return Header(std::string(reinterpret_cast(name), namelen), - std::string(reinterpret_cast(value), valuelen), - no_index, token); + return Header(std::string{std::begin(name), std::end(name)}, + std::string{std::begin(value), std::end(value)}, no_index, + token); } -void add_header(Headers &nva, const uint8_t *name, size_t namelen, - const uint8_t *value, size_t valuelen, bool no_index, - int32_t token) { - if (valuelen > 0) { - size_t i, j; - for (i = 0; i < valuelen && (value[i] == ' ' || value[i] == '\t'); ++i) - ; - for (j = valuelen - 1; j > i && (value[j] == ' ' || value[j] == '\t'); --j) - ; - value += i; - valuelen -= i + (valuelen - j - 1); - } - nva.push_back(to_header(name, namelen, value, valuelen, no_index, token)); +void add_header(Headers &nva, const StringRef &name, const StringRef &value, + bool no_index, int32_t token) { + nva.push_back(to_header(name, value, no_index, token)); } const Headers::value_type *get_header(const Headers &nva, const char *name) { @@ -315,56 +304,6 @@ bool non_empty_value(const HeaderRefs::value_type *nv) { return nv && !nv->value.empty(); } -namespace { -nghttp2_nv make_nv_internal(const std::string &name, const std::string &value, - bool no_index, uint8_t nv_flags) { - uint8_t flags; - - flags = - nv_flags | (no_index ? NGHTTP2_NV_FLAG_NO_INDEX : NGHTTP2_NV_FLAG_NONE); - - return {(uint8_t *)name.c_str(), (uint8_t *)value.c_str(), name.size(), - value.size(), flags}; -} -} // namespace - -namespace { -nghttp2_nv make_nv_internal(const StringRef &name, const StringRef &value, - bool no_index, uint8_t nv_flags) { - uint8_t flags; - - flags = - nv_flags | (no_index ? NGHTTP2_NV_FLAG_NO_INDEX : NGHTTP2_NV_FLAG_NONE); - - return {(uint8_t *)name.c_str(), (uint8_t *)value.c_str(), name.size(), - value.size(), flags}; -} -} // namespace - -nghttp2_nv make_nv(const std::string &name, const std::string &value, - bool no_index) { - return make_nv_internal(name, value, no_index, NGHTTP2_NV_FLAG_NONE); -} - -nghttp2_nv make_nv(const StringRef &name, const StringRef &value, - bool no_index) { - return make_nv_internal(name, value, no_index, NGHTTP2_NV_FLAG_NONE); -} - -nghttp2_nv make_nv_nocopy(const std::string &name, const std::string &value, - bool no_index) { - return make_nv_internal(name, value, no_index, - NGHTTP2_NV_FLAG_NO_COPY_NAME | - NGHTTP2_NV_FLAG_NO_COPY_VALUE); -} - -nghttp2_nv make_nv_nocopy(const StringRef &name, const StringRef &value, - bool no_index) { - return make_nv_internal(name, value, no_index, - NGHTTP2_NV_FLAG_NO_COPY_NAME | - NGHTTP2_NV_FLAG_NO_COPY_VALUE); -} - namespace { void copy_headers_to_nva_internal(std::vector &nva, const HeaderRefs &headers, uint8_t nv_flags, @@ -460,7 +399,7 @@ void copy_headers_to_nva_internal(std::vector &nva, break; } nva.push_back( - make_nv_internal(kv->name, kv->value, kv->no_index, nv_flags)); + make_field_flags(kv->name, kv->value, nv_flags | no_index(kv->no_index))); } } } // namespace @@ -473,8 +412,8 @@ void copy_headers_to_nva(std::vector &nva, void copy_headers_to_nva_nocopy(std::vector &nva, const HeaderRefs &headers, uint32_t flags) { copy_headers_to_nva_internal( - nva, headers, - NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE, flags); + nva, headers, NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE, + flags); } void build_http1_headers_from_headers(DefaultMemchunks *buf, @@ -577,10 +516,10 @@ int32_t determine_window_update_transmission(nghttp2_session *session, recv_length = nghttp2_session_get_effective_recv_data_length(session); window_size = nghttp2_session_get_effective_local_window_size(session); } else { - recv_length = nghttp2_session_get_stream_effective_recv_data_length( - session, stream_id); + recv_length = + nghttp2_session_get_stream_effective_recv_data_length(session, stream_id); window_size = nghttp2_session_get_stream_effective_local_window_size( - session, stream_id); + session, stream_id); } if (recv_length != -1 && window_size != -1) { if (recv_length >= window_size / 2) { @@ -617,7 +556,7 @@ void dump_nv(FILE *out, const Headers &nva) { void dump_nv(FILE *out, const HeaderRefs &nva) { for (auto &nv : nva) { - fprintf(out, "%s: %s\n", nv.name.c_str(), nv.value.c_str()); + fprintf(out, "%s: %s\n", nv.name.data(), nv.value.data()); } fputc('\n', out); fflush(out); @@ -629,15 +568,15 @@ void erase_header(HeaderRef *hd) { } StringRef rewrite_location_uri(BlockAllocator &balloc, const StringRef &uri, - const http_parser_url &u, + const urlparse_url &u, const StringRef &match_host, const StringRef &request_authority, const StringRef &upstream_scheme) { // We just rewrite scheme and authority. - if ((u.field_set & (1 << UF_HOST)) == 0) { + if ((u.field_set & (1 << URLPARSE_HOST)) == 0) { return StringRef{}; } - auto field = &u.field_data[UF_HOST]; + auto field = &u.field_data[URLPARSE_HOST]; if (!util::starts_with(std::begin(match_host), std::end(match_host), &uri[field->off], &uri[field->off] + field->len) || (match_host.size() != field->len && match_host[field->len] != ':')) { @@ -649,48 +588,48 @@ StringRef rewrite_location_uri(BlockAllocator &balloc, const StringRef &uri, len += upstream_scheme.size() + str_size("://") + request_authority.size(); } - if (u.field_set & (1 << UF_PATH)) { - field = &u.field_data[UF_PATH]; + if (u.field_set & (1 << URLPARSE_PATH)) { + field = &u.field_data[URLPARSE_PATH]; len += field->len; } - if (u.field_set & (1 << UF_QUERY)) { - field = &u.field_data[UF_QUERY]; + if (u.field_set & (1 << URLPARSE_QUERY)) { + field = &u.field_data[URLPARSE_QUERY]; len += 1 + field->len; } - if (u.field_set & (1 << UF_FRAGMENT)) { - field = &u.field_data[UF_FRAGMENT]; + if (u.field_set & (1 << URLPARSE_FRAGMENT)) { + field = &u.field_data[URLPARSE_FRAGMENT]; len += 1 + field->len; } auto iov = make_byte_ref(balloc, len + 1); - auto p = iov.base; + auto p = std::begin(iov); if (!request_authority.empty()) { p = std::copy(std::begin(upstream_scheme), std::end(upstream_scheme), p); p = util::copy_lit(p, "://"); - p = std::copy(std::begin(request_authority), std::end(request_authority), - p); + p = + std::copy(std::begin(request_authority), std::end(request_authority), p); } - if (u.field_set & (1 << UF_PATH)) { - field = &u.field_data[UF_PATH]; + if (u.field_set & (1 << URLPARSE_PATH)) { + field = &u.field_data[URLPARSE_PATH]; p = std::copy_n(&uri[field->off], field->len, p); } - if (u.field_set & (1 << UF_QUERY)) { - field = &u.field_data[UF_QUERY]; + if (u.field_set & (1 << URLPARSE_QUERY)) { + field = &u.field_data[URLPARSE_QUERY]; *p++ = '?'; p = std::copy_n(&uri[field->off], field->len, p); } - if (u.field_set & (1 << UF_FRAGMENT)) { - field = &u.field_data[UF_FRAGMENT]; + if (u.field_set & (1 << URLPARSE_FRAGMENT)) { + field = &u.field_data[URLPARSE_FRAGMENT]; *p++ = '#'; p = std::copy_n(&uri[field->off], field->len, p); } *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } int parse_http_status_code(const StringRef &src) { @@ -714,18 +653,14 @@ int parse_http_status_code(const StringRef &src) { return status; } -int lookup_token(const StringRef &name) { - return lookup_token(name.byte(), name.size()); -} - // This function was generated by genheaderfunc.py. Inspired by h2o // header lookup. https://github.com/h2o/h2o -int lookup_token(const uint8_t *name, size_t namelen) { - switch (namelen) { +int lookup_token(const StringRef &name) { + switch (name.size()) { case 2: switch (name[1]) { case 'e': - if (util::streq_l("t", name, 1)) { + if (util::streq("t"_sr, name, 1)) { return HD_TE; } break; @@ -734,7 +669,7 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 3: switch (name[2]) { case 'a': - if (util::streq_l("vi", name, 2)) { + if (util::streq("vi"_sr, name, 2)) { return HD_VIA; } break; @@ -743,17 +678,17 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 4: switch (name[3]) { case 'e': - if (util::streq_l("dat", name, 3)) { + if (util::streq("dat"_sr, name, 3)) { return HD_DATE; } break; case 'k': - if (util::streq_l("lin", name, 3)) { + if (util::streq("lin"_sr, name, 3)) { return HD_LINK; } break; case 't': - if (util::streq_l("hos", name, 3)) { + if (util::streq("hos"_sr, name, 3)) { return HD_HOST; } break; @@ -762,12 +697,12 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 5: switch (name[4]) { case 'h': - if (util::streq_l(":pat", name, 4)) { + if (util::streq(":pat"_sr, name, 4)) { return HD__PATH; } break; case 't': - if (util::streq_l(":hos", name, 4)) { + if (util::streq(":hos"_sr, name, 4)) { return HD__HOST; } break; @@ -776,17 +711,17 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 6: switch (name[5]) { case 'e': - if (util::streq_l("cooki", name, 5)) { + if (util::streq("cooki"_sr, name, 5)) { return HD_COOKIE; } break; case 'r': - if (util::streq_l("serve", name, 5)) { + if (util::streq("serve"_sr, name, 5)) { return HD_SERVER; } break; case 't': - if (util::streq_l("expec", name, 5)) { + if (util::streq("expec"_sr, name, 5)) { return HD_EXPECT; } break; @@ -795,30 +730,30 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 7: switch (name[6]) { case 'c': - if (util::streq_l("alt-sv", name, 6)) { + if (util::streq("alt-sv"_sr, name, 6)) { return HD_ALT_SVC; } break; case 'd': - if (util::streq_l(":metho", name, 6)) { + if (util::streq(":metho"_sr, name, 6)) { return HD__METHOD; } break; case 'e': - if (util::streq_l(":schem", name, 6)) { + if (util::streq(":schem"_sr, name, 6)) { return HD__SCHEME; } - if (util::streq_l("upgrad", name, 6)) { + if (util::streq("upgrad"_sr, name, 6)) { return HD_UPGRADE; } break; case 'r': - if (util::streq_l("traile", name, 6)) { + if (util::streq("traile"_sr, name, 6)) { return HD_TRAILER; } break; case 's': - if (util::streq_l(":statu", name, 6)) { + if (util::streq(":statu"_sr, name, 6)) { return HD__STATUS; } break; @@ -827,12 +762,12 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 8: switch (name[7]) { case 'n': - if (util::streq_l("locatio", name, 7)) { + if (util::streq("locatio"_sr, name, 7)) { return HD_LOCATION; } break; case 'y': - if (util::streq_l("priorit", name, 7)) { + if (util::streq("priorit"_sr, name, 7)) { return HD_PRIORITY; } break; @@ -841,12 +776,12 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 9: switch (name[8]) { case 'd': - if (util::streq_l("forwarde", name, 8)) { + if (util::streq("forwarde"_sr, name, 8)) { return HD_FORWARDED; } break; case 'l': - if (util::streq_l(":protoco", name, 8)) { + if (util::streq(":protoco"_sr, name, 8)) { return HD__PROTOCOL; } break; @@ -855,27 +790,27 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 10: switch (name[9]) { case 'a': - if (util::streq_l("early-dat", name, 9)) { + if (util::streq("early-dat"_sr, name, 9)) { return HD_EARLY_DATA; } break; case 'e': - if (util::streq_l("keep-aliv", name, 9)) { + if (util::streq("keep-aliv"_sr, name, 9)) { return HD_KEEP_ALIVE; } break; case 'n': - if (util::streq_l("connectio", name, 9)) { + if (util::streq("connectio"_sr, name, 9)) { return HD_CONNECTION; } break; case 't': - if (util::streq_l("user-agen", name, 9)) { + if (util::streq("user-agen"_sr, name, 9)) { return HD_USER_AGENT; } break; case 'y': - if (util::streq_l(":authorit", name, 9)) { + if (util::streq(":authorit"_sr, name, 9)) { return HD__AUTHORITY; } break; @@ -884,7 +819,7 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 12: switch (name[11]) { case 'e': - if (util::streq_l("content-typ", name, 11)) { + if (util::streq("content-typ"_sr, name, 11)) { return HD_CONTENT_TYPE; } break; @@ -893,7 +828,7 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 13: switch (name[12]) { case 'l': - if (util::streq_l("cache-contro", name, 12)) { + if (util::streq("cache-contro"_sr, name, 12)) { return HD_CACHE_CONTROL; } break; @@ -902,12 +837,12 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 14: switch (name[13]) { case 'h': - if (util::streq_l("content-lengt", name, 13)) { + if (util::streq("content-lengt"_sr, name, 13)) { return HD_CONTENT_LENGTH; } break; case 's': - if (util::streq_l("http2-setting", name, 13)) { + if (util::streq("http2-setting"_sr, name, 13)) { return HD_HTTP2_SETTINGS; } break; @@ -916,17 +851,17 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 15: switch (name[14]) { case 'e': - if (util::streq_l("accept-languag", name, 14)) { + if (util::streq("accept-languag"_sr, name, 14)) { return HD_ACCEPT_LANGUAGE; } break; case 'g': - if (util::streq_l("accept-encodin", name, 14)) { + if (util::streq("accept-encodin"_sr, name, 14)) { return HD_ACCEPT_ENCODING; } break; case 'r': - if (util::streq_l("x-forwarded-fo", name, 14)) { + if (util::streq("x-forwarded-fo"_sr, name, 14)) { return HD_X_FORWARDED_FOR; } break; @@ -935,7 +870,7 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 16: switch (name[15]) { case 'n': - if (util::streq_l("proxy-connectio", name, 15)) { + if (util::streq("proxy-connectio"_sr, name, 15)) { return HD_PROXY_CONNECTION; } break; @@ -944,22 +879,22 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 17: switch (name[16]) { case 'e': - if (util::streq_l("if-modified-sinc", name, 16)) { + if (util::streq("if-modified-sinc"_sr, name, 16)) { return HD_IF_MODIFIED_SINCE; } break; case 'g': - if (util::streq_l("transfer-encodin", name, 16)) { + if (util::streq("transfer-encodin"_sr, name, 16)) { return HD_TRANSFER_ENCODING; } break; case 'o': - if (util::streq_l("x-forwarded-prot", name, 16)) { + if (util::streq("x-forwarded-prot"_sr, name, 16)) { return HD_X_FORWARDED_PROTO; } break; case 'y': - if (util::streq_l("sec-websocket-ke", name, 16)) { + if (util::streq("sec-websocket-ke"_sr, name, 16)) { return HD_SEC_WEBSOCKET_KEY; } break; @@ -968,7 +903,7 @@ int lookup_token(const uint8_t *name, size_t namelen) { case 20: switch (name[19]) { case 't': - if (util::streq_l("sec-websocket-accep", name, 19)) { + if (util::streq("sec-websocket-accep"_sr, name, 19)) { return HD_SEC_WEBSOCKET_ACCEPT; } break; @@ -1062,7 +997,7 @@ InputIt skip_to_right_dquote(InputIt first, InputIt last) { break; default: if ((0x21 <= *first && *first <= 0x7e) /* VCHAR */ || - (0x80 <= *first && *first <= 0xff) /* obs-text */) { + 0x80 <= *first /* obs-text */) { break; } @@ -1097,7 +1032,7 @@ bool check_link_param_empty(const char *first, const char *last, const char *pat, size_t patlen) { if (first + patlen <= last) { if (std::equal(pat, pat + patlen, first, util::CaseCmp())) { - // we only accept URI if pat is followd by "" (e.g., + // we only accept URI if pat is followed by "" (e.g., // loadpolicy="") here. if (first + patlen + 2 <= last) { if (*(first + patlen) != '"' || *(first + patlen + 1) != '"') { @@ -1384,7 +1319,8 @@ std::string path_join(const StringRef &base_path, const StringRef &base_query, const StringRef &rel_path, const StringRef &rel_query) { BlockAllocator balloc(1024, 1024); - return path_join(balloc, base_path, base_query, rel_path, rel_query).str(); + return std::string{ + path_join(balloc, base_path, base_query, rel_path, rel_query)}; } bool expect_response_body(int status_code) { @@ -1400,25 +1336,21 @@ bool expect_response_body(int method_token, int status_code) { return method_token != HTTP_HEAD && expect_response_body(status_code); } -int lookup_method_token(const StringRef &name) { - return lookup_method_token(name.byte(), name.size()); -} - // This function was generated by genmethodfunc.py. -int lookup_method_token(const uint8_t *name, size_t namelen) { - switch (namelen) { +int lookup_method_token(const StringRef &name) { + switch (name.size()) { case 3: switch (name[2]) { case 'L': - if (util::streq_l("AC", name, 2)) { + if (util::streq("AC"_sr, name, 2)) { return HTTP_ACL; } break; case 'T': - if (util::streq_l("GE", name, 2)) { + if (util::streq("GE"_sr, name, 2)) { return HTTP_GET; } - if (util::streq_l("PU", name, 2)) { + if (util::streq("PU"_sr, name, 2)) { return HTTP_PUT; } break; @@ -1427,33 +1359,33 @@ int lookup_method_token(const uint8_t *name, size_t namelen) { case 4: switch (name[3]) { case 'D': - if (util::streq_l("BIN", name, 3)) { + if (util::streq("BIN"_sr, name, 3)) { return HTTP_BIND; } - if (util::streq_l("HEA", name, 3)) { + if (util::streq("HEA"_sr, name, 3)) { return HTTP_HEAD; } break; case 'E': - if (util::streq_l("MOV", name, 3)) { + if (util::streq("MOV"_sr, name, 3)) { return HTTP_MOVE; } break; case 'K': - if (util::streq_l("LIN", name, 3)) { + if (util::streq("LIN"_sr, name, 3)) { return HTTP_LINK; } - if (util::streq_l("LOC", name, 3)) { + if (util::streq("LOC"_sr, name, 3)) { return HTTP_LOCK; } break; case 'T': - if (util::streq_l("POS", name, 3)) { + if (util::streq("POS"_sr, name, 3)) { return HTTP_POST; } break; case 'Y': - if (util::streq_l("COP", name, 3)) { + if (util::streq("COP"_sr, name, 3)) { return HTTP_COPY; } break; @@ -1462,23 +1394,23 @@ int lookup_method_token(const uint8_t *name, size_t namelen) { case 5: switch (name[4]) { case 'E': - if (util::streq_l("MERG", name, 4)) { + if (util::streq("MERG"_sr, name, 4)) { return HTTP_MERGE; } - if (util::streq_l("PURG", name, 4)) { + if (util::streq("PURG"_sr, name, 4)) { return HTTP_PURGE; } - if (util::streq_l("TRAC", name, 4)) { + if (util::streq("TRAC"_sr, name, 4)) { return HTTP_TRACE; } break; case 'H': - if (util::streq_l("PATC", name, 4)) { + if (util::streq("PATC"_sr, name, 4)) { return HTTP_PATCH; } break; case 'L': - if (util::streq_l("MKCO", name, 4)) { + if (util::streq("MKCO"_sr, name, 4)) { return HTTP_MKCOL; } break; @@ -1487,41 +1419,41 @@ int lookup_method_token(const uint8_t *name, size_t namelen) { case 6: switch (name[5]) { case 'D': - if (util::streq_l("REBIN", name, 5)) { + if (util::streq("REBIN"_sr, name, 5)) { return HTTP_REBIND; } - if (util::streq_l("UNBIN", name, 5)) { + if (util::streq("UNBIN"_sr, name, 5)) { return HTTP_UNBIND; } break; case 'E': - if (util::streq_l("DELET", name, 5)) { + if (util::streq("DELET"_sr, name, 5)) { return HTTP_DELETE; } - if (util::streq_l("SOURC", name, 5)) { + if (util::streq("SOURC"_sr, name, 5)) { return HTTP_SOURCE; } break; case 'H': - if (util::streq_l("SEARC", name, 5)) { + if (util::streq("SEARC"_sr, name, 5)) { return HTTP_SEARCH; } break; case 'K': - if (util::streq_l("UNLIN", name, 5)) { + if (util::streq("UNLIN"_sr, name, 5)) { return HTTP_UNLINK; } - if (util::streq_l("UNLOC", name, 5)) { + if (util::streq("UNLOC"_sr, name, 5)) { return HTTP_UNLOCK; } break; case 'T': - if (util::streq_l("REPOR", name, 5)) { + if (util::streq("REPOR"_sr, name, 5)) { return HTTP_REPORT; } break; case 'Y': - if (util::streq_l("NOTIF", name, 5)) { + if (util::streq("NOTIF"_sr, name, 5)) { return HTTP_NOTIFY; } break; @@ -1530,17 +1462,17 @@ int lookup_method_token(const uint8_t *name, size_t namelen) { case 7: switch (name[6]) { case 'H': - if (util::streq_l("MSEARC", name, 6)) { + if (util::streq("MSEARC"_sr, name, 6)) { return HTTP_MSEARCH; } break; case 'S': - if (util::streq_l("OPTION", name, 6)) { + if (util::streq("OPTION"_sr, name, 6)) { return HTTP_OPTIONS; } break; case 'T': - if (util::streq_l("CONNEC", name, 6)) { + if (util::streq("CONNEC"_sr, name, 6)) { return HTTP_CONNECT; } break; @@ -1549,12 +1481,12 @@ int lookup_method_token(const uint8_t *name, size_t namelen) { case 8: switch (name[7]) { case 'D': - if (util::streq_l("PROPFIN", name, 7)) { + if (util::streq("PROPFIN"_sr, name, 7)) { return HTTP_PROPFIND; } break; case 'T': - if (util::streq_l("CHECKOU", name, 7)) { + if (util::streq("CHECKOU"_sr, name, 7)) { return HTTP_CHECKOUT; } break; @@ -1563,12 +1495,12 @@ int lookup_method_token(const uint8_t *name, size_t namelen) { case 9: switch (name[8]) { case 'E': - if (util::streq_l("SUBSCRIB", name, 8)) { + if (util::streq("SUBSCRIB"_sr, name, 8)) { return HTTP_SUBSCRIBE; } break; case 'H': - if (util::streq_l("PROPPATC", name, 8)) { + if (util::streq("PROPPATC"_sr, name, 8)) { return HTTP_PROPPATCH; } break; @@ -1577,12 +1509,12 @@ int lookup_method_token(const uint8_t *name, size_t namelen) { case 10: switch (name[9]) { case 'R': - if (util::streq_l("MKCALENDA", name, 9)) { + if (util::streq("MKCALENDA"_sr, name, 9)) { return HTTP_MKCALENDAR; } break; case 'Y': - if (util::streq_l("MKACTIVIT", name, 9)) { + if (util::streq("MKACTIVIT"_sr, name, 9)) { return HTTP_MKACTIVITY; } break; @@ -1591,7 +1523,7 @@ int lookup_method_token(const uint8_t *name, size_t namelen) { case 11: switch (name[10]) { case 'E': - if (util::streq_l("UNSUBSCRIB", name, 10)) { + if (util::streq("UNSUBSCRIB"_sr, name, 10)) { return HTTP_UNSUBSCRIBE; } break; @@ -1604,24 +1536,24 @@ int lookup_method_token(const uint8_t *name, size_t namelen) { StringRef to_method_string(int method_token) { // we happened to use same value for method with llhttp. return StringRef{ - llhttp_method_name(static_cast(method_token))}; + llhttp_method_name(static_cast(method_token))}; } StringRef get_pure_path_component(const StringRef &uri) { int rv; - http_parser_url u{}; - rv = http_parser_parse_url(uri.c_str(), uri.size(), 0, &u); + urlparse_url u; + rv = urlparse_parse_url(uri.data(), uri.size(), 0, &u); if (rv != 0) { return StringRef{}; } - if (u.field_set & (1 << UF_PATH)) { - auto &f = u.field_data[UF_PATH]; - return StringRef{uri.c_str() + f.off, f.len}; + if (u.field_set & (1 << URLPARSE_PATH)) { + auto &f = u.field_data[URLPARSE_PATH]; + return StringRef{uri.data() + f.off, f.len}; } - return StringRef::from_lit("/"); + return "/"_sr; } int construct_push_component(BlockAllocator &balloc, StringRef &scheme, @@ -1634,9 +1566,9 @@ int construct_push_component(BlockAllocator &balloc, StringRef &scheme, return -1; } - http_parser_url u{}; + urlparse_url u; - rv = http_parser_parse_url(uri.c_str(), uri.size(), 0, &u); + rv = urlparse_parse_url(uri.data(), uri.size(), 0, &u); if (rv != 0) { if (uri[0] == '/') { @@ -1652,19 +1584,19 @@ int construct_push_component(BlockAllocator &balloc, StringRef &scheme, relq = StringRef{q + 1, std::end(uri)}; } } else { - if (u.field_set & (1 << UF_SCHEMA)) { - scheme = util::get_uri_field(uri.c_str(), u, UF_SCHEMA); + if (u.field_set & (1 << URLPARSE_SCHEMA)) { + scheme = util::get_uri_field(uri.data(), u, URLPARSE_SCHEMA); } - if (u.field_set & (1 << UF_HOST)) { - auto auth = util::get_uri_field(uri.c_str(), u, UF_HOST); + if (u.field_set & (1 << URLPARSE_HOST)) { + auto auth = util::get_uri_field(uri.data(), u, URLPARSE_HOST); auto len = auth.size(); - auto port_exists = u.field_set & (1 << UF_PORT); + auto port_exists = u.field_set & (1 << URLPARSE_PORT); if (port_exists) { len += 1 + str_size("65535"); } auto iov = make_byte_ref(balloc, len + 1); - auto p = iov.base; + auto p = std::begin(iov); p = std::copy(std::begin(auth), std::end(auth), p); if (port_exists) { *p++ = ':'; @@ -1672,23 +1604,23 @@ int construct_push_component(BlockAllocator &balloc, StringRef &scheme, } *p = '\0'; - authority = StringRef{iov.base, p}; + authority = StringRef{std::span{std::begin(iov), p}}; } - if (u.field_set & (1 << UF_PATH)) { - auto &f = u.field_data[UF_PATH]; - rel = StringRef{uri.c_str() + f.off, f.len}; + if (u.field_set & (1 << URLPARSE_PATH)) { + auto &f = u.field_data[URLPARSE_PATH]; + rel = StringRef{uri.data() + f.off, f.len}; } else { - rel = StringRef::from_lit("/"); + rel = "/"_sr; } - if (u.field_set & (1 << UF_QUERY)) { - auto &f = u.field_data[UF_QUERY]; - relq = StringRef{uri.c_str() + f.off, f.len}; + if (u.field_set & (1 << URLPARSE_QUERY)) { + auto &f = u.field_data[URLPARSE_QUERY]; + relq = StringRef{uri.data() + f.off, f.len}; } } - path = http2::path_join(balloc, base, StringRef{}, rel, relq); + path = path_join(balloc, base, StringRef{}, rel, relq); return 0; } @@ -1733,11 +1665,11 @@ template InputIt eat_dir(InputIt first, InputIt last) { StringRef path_join(BlockAllocator &balloc, const StringRef &base_path, const StringRef &base_query, const StringRef &rel_path, const StringRef &rel_query) { - auto res = make_byte_ref( - balloc, std::max(static_cast(1), base_path.size()) + - rel_path.size() + 1 + - std::max(base_query.size(), rel_query.size()) + 1); - auto p = res.base; + auto res = + make_byte_ref(balloc, std::max(static_cast(1), base_path.size()) + + rel_path.size() + 1 + + std::max(base_query.size(), rel_query.size()) + 1); + auto p = std::begin(res); if (rel_path.empty()) { if (base_path.empty()) { @@ -1751,12 +1683,12 @@ StringRef path_join(BlockAllocator &balloc, const StringRef &base_path, p = std::copy(std::begin(base_query), std::end(base_query), p); } *p = '\0'; - return StringRef{res.base, p}; + return StringRef{std::span{std::begin(res), p}}; } *p++ = '?'; p = std::copy(std::begin(rel_query), std::end(rel_query), p); *p = '\0'; - return StringRef{res.base, p}; + return StringRef{std::span{std::begin(res), p}}; } auto first = std::begin(rel_path); @@ -1777,31 +1709,31 @@ StringRef path_join(BlockAllocator &balloc, const StringRef &base_path, if (*first == '.') { if (first + 1 == last) { if (*(p - 1) != '/') { - p = eat_file(res.base, p); + p = eat_file(std::begin(res), p); } break; } if (*(first + 1) == '/') { if (*(p - 1) != '/') { - p = eat_file(res.base, p); + p = eat_file(std::begin(res), p); } first += 2; continue; } if (*(first + 1) == '.') { if (first + 2 == last) { - p = eat_dir(res.base, p); + p = eat_dir(std::begin(res), p); break; } if (*(first + 2) == '/') { - p = eat_dir(res.base, p); + p = eat_dir(std::begin(res), p); first += 3; continue; } } } if (*(p - 1) != '/') { - p = eat_file(res.base, p); + p = eat_file(std::begin(res), p); } auto slash = std::find(first, last, '/'); if (slash == last) { @@ -1818,7 +1750,7 @@ StringRef path_join(BlockAllocator &balloc, const StringRef &base_path, p = std::copy(std::begin(rel_query), std::end(rel_query), p); } *p = '\0'; - return StringRef{res.base, p}; + return StringRef{std::span{std::begin(res), p}}; } StringRef normalize_path(BlockAllocator &balloc, const StringRef &path, @@ -1834,14 +1766,14 @@ StringRef normalize_path(BlockAllocator &balloc, const StringRef &path, // includes last terminal NULL. auto result = make_byte_ref(balloc, path.size() + 1); - auto p = result.base; + auto p = std::begin(result); auto it = std::begin(path); for (; it + 2 < std::end(path);) { if (*it == '%') { if (util::is_hex_digit(*(it + 1)) && util::is_hex_digit(*(it + 2))) { auto c = - (util::hex_to_uint(*(it + 1)) << 4) + util::hex_to_uint(*(it + 2)); + (util::hex_to_uint(*(it + 1)) << 4) + util::hex_to_uint(*(it + 2)); if (util::in_rfc3986_unreserved_chars(c)) { *p++ = c; @@ -1864,8 +1796,8 @@ StringRef normalize_path(BlockAllocator &balloc, const StringRef &path, p = std::copy(it, std::end(path), p); *p = '\0'; - return path_join(balloc, StringRef{}, StringRef{}, StringRef{result.base, p}, - query); + return path_join(balloc, StringRef{}, StringRef{}, + StringRef{std::span{std::begin(result), p}}, query); } StringRef normalize_path_colon(BlockAllocator &balloc, const StringRef &path, @@ -1881,14 +1813,14 @@ StringRef normalize_path_colon(BlockAllocator &balloc, const StringRef &path, // includes last terminal NULL. auto result = make_byte_ref(balloc, path.size() + 1); - auto p = result.base; + auto p = std::begin(result); auto it = std::begin(path); for (; it + 2 < std::end(path);) { if (*it == '%') { if (util::is_hex_digit(*(it + 1)) && util::is_hex_digit(*(it + 2))) { auto c = - (util::hex_to_uint(*(it + 1)) << 4) + util::hex_to_uint(*(it + 2)); + (util::hex_to_uint(*(it + 1)) << 4) + util::hex_to_uint(*(it + 2)); if (util::in_rfc3986_unreserved_chars(c) || c == ':') { *p++ = c; @@ -1911,14 +1843,14 @@ StringRef normalize_path_colon(BlockAllocator &balloc, const StringRef &path, p = std::copy(it, std::end(path), p); *p = '\0'; - return path_join(balloc, StringRef{}, StringRef{}, StringRef{result.base, p}, - query); + return path_join(balloc, StringRef{}, StringRef{}, + StringRef{std::span{std::begin(result), p}}, query); } std::string normalize_path(const StringRef &path, const StringRef &query) { BlockAllocator balloc(1024, 1024); - return normalize_path(balloc, path, query).str(); + return std::string{normalize_path(balloc, path, query)}; } StringRef rewrite_clean_path(BlockAllocator &balloc, const StringRef &src) { @@ -1938,15 +1870,15 @@ StringRef rewrite_clean_path(BlockAllocator &balloc, const StringRef &src) { StringRef copy_lower(BlockAllocator &balloc, const StringRef &src) { auto iov = make_byte_ref(balloc, src.size() + 1); - auto p = iov.base; + auto p = std::begin(iov); p = std::copy(std::begin(src), std::end(src), p); *p = '\0'; - util::inp_strlower(iov.base, p); - return StringRef{iov.base, p}; + util::inp_strlower(std::begin(iov), p); + return StringRef{std::span{std::begin(iov), p}}; } bool contains_trailers(const StringRef &s) { - constexpr auto trailers = StringRef::from_lit("trailers"); + constexpr auto trailers = "trailers"_sr; for (auto p = std::begin(s), end = std::end(s);; ++p) { p = std::find_if(p, end, [](char c) { return c != ' ' && c != '\t'; }); @@ -1971,18 +1903,18 @@ bool contains_trailers(const StringRef &s) { } StringRef make_websocket_accept_token(uint8_t *dest, const StringRef &key) { - static constexpr uint8_t magic[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; - std::array s; + static constexpr char magic[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + std::array s; auto p = std::copy(std::begin(key), std::end(key), std::begin(s)); std::copy_n(magic, str_size(magic), p); std::array h; - if (util::sha1(h.data(), StringRef{std::begin(s), std::end(s)}) != 0) { + if (util::sha1(h.data(), StringRef{s}) != 0) { return StringRef{}; } auto end = base64::encode(std::begin(h), std::end(h), dest); - return StringRef{dest, end}; + return StringRef{std::span{dest, end}}; } bool legacy_http1(int major, int minor) { @@ -2091,6 +2023,17 @@ bool check_transfer_encoding(const StringRef &s) { } } +std::string encode_extpri(const nghttp2_extpri &extpri) { + std::string res = "u="; + + res += extpri.urgency + '0'; + if (extpri.inc) { + res += ",i"; + } + + return res; +} + } // namespace http2 } // namespace nghttp2 diff --git a/lib/nghttp2/src/http2.h b/lib/nghttp2-1.65.0/src/http2.h similarity index 80% rename from lib/nghttp2/src/http2.h rename to lib/nghttp2-1.65.0/src/http2.h index 7cfe46193f7..9398ddbc0c4 100644 --- a/lib/nghttp2/src/http2.h +++ b/lib/nghttp2-1.65.0/src/http2.h @@ -35,7 +35,7 @@ #include -#include "url-parser/url_parser.h" +#include "urlparse.h" #include "util.h" #include "memchunk.h" @@ -48,10 +48,10 @@ namespace nghttp2 { struct Header { Header(std::string name, std::string value, bool no_index = false, int32_t token = -1) - : name(std::move(name)), - value(std::move(value)), - token(token), - no_index(no_index) {} + : name(std::move(name)), + value(std::move(value)), + token(token), + no_index(no_index) {} Header() : token(-1), no_index(false) {} @@ -72,7 +72,7 @@ struct Header { struct HeaderRef { HeaderRef(const StringRef &name, const StringRef &value, bool no_index = false, int32_t token = -1) - : name(name), value(value), token(token), no_index(no_index) {} + : name(name), value(value), token(token), no_index(no_index) {} HeaderRef() : token(-1), no_index(false) {} @@ -110,19 +110,17 @@ bool lws(const char *value); // Copies the |field| component value from |u| and |url| to the // |dest|. If |u| does not have |field|, then this function does // nothing. -void copy_url_component(std::string &dest, const http_parser_url *u, int field, +void copy_url_component(std::string &dest, const urlparse_url *u, int field, const char *url); -Headers::value_type to_header(const uint8_t *name, size_t namelen, - const uint8_t *value, size_t valuelen, +Headers::value_type to_header(const StringRef &name, const StringRef &value, bool no_index, int32_t token); // Add name/value pairs to |nva|. If |no_index| is true, this // name/value pair won't be indexed when it is forwarded to the next -// hop. This function strips white spaces around |value|. -void add_header(Headers &nva, const uint8_t *name, size_t namelen, - const uint8_t *value, size_t valuelen, bool no_index, - int32_t token); +// hop. +void add_header(Headers &nva, const StringRef &name, const StringRef &value, + bool no_index, int32_t token); // Returns pointer to the entry in |nva| which has name |name|. If // more than one entries which have the name |name|, last occurrence @@ -132,60 +130,48 @@ const Headers::value_type *get_header(const Headers &nva, const char *name); // Returns true if the value of |nv| is not empty. bool non_empty_value(const HeaderRefs::value_type *nv); -// Creates nghttp2_nv using |name| and |value| and returns it. The -// returned value only references the data pointer to name.c_str() and -// value.c_str(). If |no_index| is true, nghttp2_nv flags member has -// NGHTTP2_NV_FLAG_NO_INDEX flag set. -nghttp2_nv make_nv(const std::string &name, const std::string &value, - bool no_index = false); +// Create nghttp2_nv from |name|, |value| and |flags|. +inline nghttp2_nv make_field_flags(const StringRef &name, + const StringRef &value, + uint8_t flags = NGHTTP2_NV_FLAG_NONE) { + auto ns = as_uint8_span(std::span{name}); + auto vs = as_uint8_span(std::span{value}); -nghttp2_nv make_nv(const StringRef &name, const StringRef &value, - bool no_index = false); - -nghttp2_nv make_nv_nocopy(const std::string &name, const std::string &value, - bool no_index = false); - -nghttp2_nv make_nv_nocopy(const StringRef &name, const StringRef &value, - bool no_index = false); - -// Create nghttp2_nv from string literal |name| and |value|. -template -constexpr nghttp2_nv make_nv_ll(const char (&name)[N], const char (&value)[M]) { - return {(uint8_t *)name, (uint8_t *)value, N - 1, M - 1, - NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE}; + return {const_cast(ns.data()), const_cast(vs.data()), + ns.size(), vs.size(), flags}; } -// Create nghttp2_nv from string literal |name| and c-string |value|. -template -nghttp2_nv make_nv_lc(const char (&name)[N], const char *value) { - return {(uint8_t *)name, (uint8_t *)value, N - 1, strlen(value), - NGHTTP2_NV_FLAG_NO_COPY_NAME}; +// Creates nghttp2_nv from |name|, |value| and |flags|. nghttp2 +// library does not copy them. +inline nghttp2_nv make_field(const StringRef &name, const StringRef &value, + uint8_t flags = NGHTTP2_NV_FLAG_NONE) { + return make_field_flags(name, value, + static_cast(NGHTTP2_NV_FLAG_NO_COPY_NAME | + NGHTTP2_NV_FLAG_NO_COPY_VALUE | + flags)); } -template -nghttp2_nv make_nv_lc_nocopy(const char (&name)[N], const char *value) { - return {(uint8_t *)name, (uint8_t *)value, N - 1, strlen(value), - NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE}; +// Creates nghttp2_nv from |name|, |value| and |flags|. nghttp2 +// library copies |value| unless |flags| includes +// NGHTTP2_NV_FLAG_NO_COPY_VALUE. +inline nghttp2_nv make_field_v(const StringRef &name, const StringRef &value, + uint8_t flags = NGHTTP2_NV_FLAG_NONE) { + return make_field_flags( + name, value, static_cast(NGHTTP2_NV_FLAG_NO_COPY_NAME | flags)); } -// Create nghttp2_nv from string literal |name| and std::string -// |value|. -template -nghttp2_nv make_nv_ls(const char (&name)[N], const std::string &value) { - return {(uint8_t *)name, (uint8_t *)value.c_str(), N - 1, value.size(), - NGHTTP2_NV_FLAG_NO_COPY_NAME}; +// Creates nghttp2_nv from |name|, |value| and |flags|. nghttp2 +// library copies |name| and |value| unless |flags| includes +// NGHTTP2_NV_FLAG_NO_COPY_NAME or NGHTTP2_NV_FLAG_NO_COPY_VALUE. +inline nghttp2_nv make_field_nv(const StringRef &name, const StringRef &value, + uint8_t flags = NGHTTP2_NV_FLAG_NONE) { + return make_field_flags(name, value, flags); } -template -nghttp2_nv make_nv_ls_nocopy(const char (&name)[N], const std::string &value) { - return {(uint8_t *)name, (uint8_t *)value.c_str(), N - 1, value.size(), - NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE}; -} - -template -nghttp2_nv make_nv_ls_nocopy(const char (&name)[N], const StringRef &value) { - return {(uint8_t *)name, (uint8_t *)value.c_str(), N - 1, value.size(), - NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE}; +// Returns NGHTTP2_NV_FLAG_NO_INDEX if |no_index| is true, otherwise +// NGHTTP2_NV_FLAG_NONE. +inline uint8_t no_index(bool no_index) { + return no_index ? NGHTTP2_NV_FLAG_NO_INDEX : NGHTTP2_NV_FLAG_NONE; } enum HeaderBuildOp { @@ -284,7 +270,7 @@ void erase_header(HeaderRef *hd); // location URI is not subject to the rewrite, this function returns // empty string. StringRef rewrite_location_uri(BlockAllocator &balloc, const StringRef &uri, - const http_parser_url &u, + const urlparse_url &u, const StringRef &match_host, const StringRef &request_authority, const StringRef &upstream_scheme); @@ -340,10 +326,9 @@ enum { using HeaderIndex = std::array; -// Looks up header token for header name |name| of length |namelen|. -// Only headers we are interested in are tokenized. If header name -// cannot be tokenized, returns -1. -int lookup_token(const uint8_t *name, size_t namelen); +// Looks up header token for header name |name|. Only headers we are +// interested in are tokenized. If header name cannot be tokenized, +// returns -1. int lookup_token(const StringRef &name); // Initializes |hdidx|, header index. The |hdidx| must point to the @@ -390,10 +375,9 @@ bool expect_response_body(int method_token, int status_code); // true if response has body, taking into account status code only. bool expect_response_body(int status_code); -// Looks up method token for method name |name| of length |namelen|. -// Only methods defined in llhttp.h (llhttp_method) are tokenized. If -// method name cannot be tokenized, returns -1. -int lookup_method_token(const uint8_t *name, size_t namelen); +// Looks up method token for method name |name|. Only methods defined +// in llhttp.h (llhttp_method) are tokenized. If method name cannot +// be tokenized, returns -1. int lookup_method_token(const StringRef &name); // Returns string representation of |method_token|. This is wrapper @@ -450,6 +434,9 @@ bool legacy_http1(int major, int minor); // list elements. bool check_transfer_encoding(const StringRef &s); +// Encodes |extpri| in the wire format. +std::string encode_extpri(const nghttp2_extpri &extpri); + } // namespace http2 } // namespace nghttp2 diff --git a/lib/nghttp2-1.65.0/src/http2_test.cc b/lib/nghttp2-1.65.0/src/http2_test.cc new file mode 100644 index 00000000000..3986d15cc0b --- /dev/null +++ b/lib/nghttp2-1.65.0/src/http2_test.cc @@ -0,0 +1,1190 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "http2_test.h" + +#include +#include +#include + +#include "munitxx.h" + +#include "urlparse.h" + +#include "http2.h" +#include "util.h" + +using namespace nghttp2; +using namespace std::literals; + +#define MAKE_NV(K, V) \ + { \ + (uint8_t *)K, (uint8_t *)V, sizeof(K) - 1, \ + sizeof(V) - 1, NGHTTP2_NV_FLAG_NONE, \ + } + +namespace shrpx { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_http2_add_header), + munit_void_test(test_http2_get_header), + munit_void_test(test_http2_copy_headers_to_nva), + munit_void_test(test_http2_build_http1_headers_from_headers), + munit_void_test(test_http2_lws), + munit_void_test(test_http2_rewrite_location_uri), + munit_void_test(test_http2_parse_http_status_code), + munit_void_test(test_http2_index_header), + munit_void_test(test_http2_lookup_token), + munit_void_test(test_http2_parse_link_header), + munit_void_test(test_http2_path_join), + munit_void_test(test_http2_normalize_path), + munit_void_test(test_http2_rewrite_clean_path), + munit_void_test(test_http2_get_pure_path_component), + munit_void_test(test_http2_construct_push_component), + munit_void_test(test_http2_contains_trailers), + munit_void_test(test_http2_check_transfer_encoding), + munit_test_end(), +}; +} // namespace + +const MunitSuite http2_suite{ + "/http2", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +namespace { +void check_nv(const HeaderRef &a, const nghttp2_nv *b) { + assert_size(a.name.size(), ==, b->namelen); + assert_size(a.value.size(), ==, b->valuelen); + assert_memory_equal(b->namelen, a.name.data(), b->name); + assert_memory_equal(b->valuelen, a.value.data(), b->value); +} +} // namespace + +void test_http2_add_header(void) { + auto nva = Headers(); + + http2::add_header(nva, "alpha"_sr, "123"_sr, false, -1); + assert_true(Headers::value_type("alpha", "123") == nva[0]); + assert_false(nva[0].no_index); + + nva.clear(); + + http2::add_header(nva, "alpha"_sr, ""_sr, true, -1); + assert_true(Headers::value_type("alpha", "") == nva[0]); + assert_true(nva[0].no_index); + + nva.clear(); + + http2::add_header(nva, "a"_sr, "b"_sr, false, -1); + assert_true(Headers::value_type("a", "b") == nva[0]); + + nva.clear(); + + http2::add_header(nva, "te"_sr, "trailers"_sr, false, http2::HD_TE); + assert_int32(http2::HD_TE, ==, nva[0].token); +} + +void test_http2_get_header(void) { + auto nva = Headers{{"alpha", "1"}, {"bravo", "2"}, {"bravo", "3"}, + {"charlie", "4"}, {"delta", "5"}, {"echo", "6"}, + {"content-length", "7"}}; + const Headers::value_type *rv; + rv = http2::get_header(nva, "delta"); + assert_not_null(rv); + assert_stdstring_equal("delta", rv->name); + + rv = http2::get_header(nva, "bravo"); + assert_not_null(rv); + assert_stdstring_equal("bravo", rv->name); + + rv = http2::get_header(nva, "foxtrot"); + assert_null(rv); + + http2::HeaderIndex hdidx; + http2::init_hdidx(hdidx); + hdidx[http2::HD_CONTENT_LENGTH] = 6; + rv = http2::get_header(hdidx, http2::HD_CONTENT_LENGTH, nva); + assert_stdstring_equal("content-length", rv->name); +} + +namespace { +auto headers = HeaderRefs{ + {"alpha"_sr, "0"_sr, true}, + {"bravo"_sr, "1"_sr}, + {"connection"_sr, "2"_sr, false, http2::HD_CONNECTION}, + {"connection"_sr, "3"_sr, false, http2::HD_CONNECTION}, + {"delta"_sr, "4"_sr}, + {"expect"_sr, "5"_sr}, + {"foxtrot"_sr, "6"_sr}, + {"tango"_sr, "7"_sr}, + {"te"_sr, "8"_sr, false, http2::HD_TE}, + {"te"_sr, "9"_sr, false, http2::HD_TE}, + {"x-forwarded-proto"_sr, "10"_sr, false, http2::HD_X_FORWARDED_FOR}, + {"x-forwarded-proto"_sr, "11"_sr, false, http2::HD_X_FORWARDED_FOR}, + {"zulu"_sr, "12"_sr}}; +} // namespace + +namespace { +auto headers2 = HeaderRefs{ + {"x-forwarded-for"_sr, "xff1"_sr, false, http2::HD_X_FORWARDED_FOR}, + {"x-forwarded-for"_sr, "xff2"_sr, false, http2::HD_X_FORWARDED_FOR}, + {"x-forwarded-proto"_sr, "xfp1"_sr, false, http2::HD_X_FORWARDED_PROTO}, + {"x-forwarded-proto"_sr, "xfp2"_sr, false, http2::HD_X_FORWARDED_PROTO}, + {"forwarded"_sr, "fwd1"_sr, false, http2::HD_FORWARDED}, + {"forwarded"_sr, "fwd2"_sr, false, http2::HD_FORWARDED}, + {"via"_sr, "via1"_sr, false, http2::HD_VIA}, + {"via"_sr, "via2"_sr, false, http2::HD_VIA}, +}; +} // namespace + +void test_http2_copy_headers_to_nva(void) { + auto ans = std::vector{0, 1, 4, 5, 6, 7, 12}; + std::vector nva; + + http2::copy_headers_to_nva_nocopy(nva, headers, + http2::HDOP_STRIP_X_FORWARDED_FOR); + assert_size(7, ==, nva.size()); + for (size_t i = 0; i < ans.size(); ++i) { + check_nv(headers[ans[i]], &nva[i]); + + if (ans[i] == 0) { + assert_uint8((NGHTTP2_NV_FLAG_NO_COPY_NAME | + NGHTTP2_NV_FLAG_NO_COPY_VALUE | NGHTTP2_NV_FLAG_NO_INDEX), + ==, nva[i].flags); + } else { + assert_uint8( + (NGHTTP2_NV_FLAG_NO_COPY_NAME | NGHTTP2_NV_FLAG_NO_COPY_VALUE), ==, + nva[i].flags); + } + } + + nva.clear(); + http2::copy_headers_to_nva(nva, headers, http2::HDOP_STRIP_X_FORWARDED_FOR); + assert_size(7, ==, nva.size()); + for (size_t i = 0; i < ans.size(); ++i) { + check_nv(headers[ans[i]], &nva[i]); + + if (ans[i] == 0) { + assert_true(nva[i].flags & NGHTTP2_NV_FLAG_NO_INDEX); + } else { + assert_false(nva[i].flags); + } + } + + nva.clear(); + + auto ans2 = std::vector{0, 2, 4, 6}; + http2::copy_headers_to_nva(nva, headers2, http2::HDOP_NONE); + assert_size(ans2.size(), ==, nva.size()); + for (size_t i = 0; i < ans2.size(); ++i) { + check_nv(headers2[ans2[i]], &nva[i]); + } + + nva.clear(); + + http2::copy_headers_to_nva(nva, headers2, http2::HDOP_STRIP_ALL); + assert_true(nva.empty()); +} + +void test_http2_build_http1_headers_from_headers(void) { + MemchunkPool pool; + DefaultMemchunks buf(&pool); + http2::build_http1_headers_from_headers(&buf, headers, + http2::HDOP_STRIP_X_FORWARDED_FOR); + auto hdrs = std::string(buf.head->pos, buf.head->last); + assert_stdstring_equal("Alpha: 0\r\n" + "Bravo: 1\r\n" + "Delta: 4\r\n" + "Expect: 5\r\n" + "Foxtrot: 6\r\n" + "Tango: 7\r\n" + "Te: 8\r\n" + "Te: 9\r\n" + "Zulu: 12\r\n", + hdrs); + + buf.reset(); + + http2::build_http1_headers_from_headers(&buf, headers2, http2::HDOP_NONE); + hdrs = std::string(buf.head->pos, buf.head->last); + assert_stdstring_equal("X-Forwarded-For: xff1\r\n" + "X-Forwarded-Proto: xfp1\r\n" + "Forwarded: fwd1\r\n" + "Via: via1\r\n", + hdrs); + + buf.reset(); + + http2::build_http1_headers_from_headers(&buf, headers2, + http2::HDOP_STRIP_ALL); + assert_size(0, ==, buf.rleft()); +} + +void test_http2_lws(void) { + assert_false(http2::lws("alpha")); + assert_true(http2::lws(" ")); + assert_true(http2::lws("")); +} + +namespace { +void check_rewrite_location_uri(const std::string &want, const std::string &uri, + const std::string &match_host, + const std::string &req_authority, + const std::string &upstream_scheme) { + BlockAllocator balloc(4096, 4096); + urlparse_url u; + assert_int(0, ==, urlparse_parse_url(uri.c_str(), uri.size(), 0, &u)); + auto got = http2::rewrite_location_uri( + balloc, StringRef{uri}, u, StringRef{match_host}, StringRef{req_authority}, + StringRef{upstream_scheme}); + assert_stdsv_equal(want, got); +} +} // namespace + +void test_http2_rewrite_location_uri(void) { + check_rewrite_location_uri("https://localhost:3000/alpha?bravo#charlie", + "http://localhost:3001/alpha?bravo#charlie", + "localhost:3001", "localhost:3000", "https"); + check_rewrite_location_uri("https://localhost/", "http://localhost:3001/", + "localhost", "localhost", "https"); + check_rewrite_location_uri("http://localhost/", "http://localhost:3001/", + "localhost", "localhost", "http"); + check_rewrite_location_uri("http://localhost:443/", "http://localhost:3001/", + "localhost", "localhost:443", "http"); + check_rewrite_location_uri("https://localhost:80/", "http://localhost:3001/", + "localhost", "localhost:80", "https"); + check_rewrite_location_uri("", "http://localhost:3001/", "127.0.0.1", + "127.0.0.1", "https"); + check_rewrite_location_uri("https://localhost:3000/", + "http://localhost:3001/", "localhost", + "localhost:3000", "https"); + check_rewrite_location_uri("https://localhost:3000/", "http://localhost/", + "localhost", "localhost:3000", "https"); + + // match_host != req_authority + check_rewrite_location_uri("https://example.org", "http://127.0.0.1:8080", + "127.0.0.1", "example.org", "https"); + check_rewrite_location_uri("", "http://example.org", "127.0.0.1", + "example.org", "https"); +} + +void test_http2_parse_http_status_code(void) { + assert_int(200, ==, http2::parse_http_status_code("200"_sr)); + assert_int(102, ==, http2::parse_http_status_code("102"_sr)); + assert_int(-1, ==, http2::parse_http_status_code("099"_sr)); + assert_int(-1, ==, http2::parse_http_status_code("99"_sr)); + assert_int(-1, ==, http2::parse_http_status_code("-1"_sr)); + assert_int(-1, ==, http2::parse_http_status_code("20a"_sr)); + assert_int(-1, ==, http2::parse_http_status_code(StringRef{})); +} + +void test_http2_index_header(void) { + http2::HeaderIndex hdidx; + http2::init_hdidx(hdidx); + + http2::index_header(hdidx, http2::HD__AUTHORITY, 0); + http2::index_header(hdidx, -1, 1); + + assert_uint16(0, ==, hdidx[http2::HD__AUTHORITY]); +} + +void test_http2_lookup_token(void) { + assert_int(http2::HD__AUTHORITY, ==, http2::lookup_token(":authority"_sr)); + assert_int(-1, ==, http2::lookup_token(":authorit"_sr)); + assert_int(-1, ==, http2::lookup_token(":Authority"_sr)); + assert_int(http2::HD_EXPECT, ==, http2::lookup_token("expect"_sr)); +} + +void test_http2_parse_link_header(void) { + { + // only URI appears; we don't extract URI unless it bears rel=preload + auto res = http2::parse_link_header(""_sr); + assert_size(0, ==, res.size()); + } + { + // URI url should be extracted + auto res = http2::parse_link_header("; rel=preload"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // With extra link-param. URI url should be extracted + auto res = http2::parse_link_header("; rel=preload; as=file"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // With extra link-param. URI url should be extracted + auto res = http2::parse_link_header("; as=file; rel=preload"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // With extra link-param and quote-string. URI url should be + // extracted + auto res = + http2::parse_link_header(R"(; rel=preload; title="foo,bar")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // With extra link-param and quote-string. URI url should be + // extracted + auto res = + http2::parse_link_header(R"(; title="foo,bar"; rel=preload)"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // ',' after quote-string + auto res = http2::parse_link_header( + R"(; title="foo,bar", ; rel=preload)"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url2"sv, res[0].uri); + } + { + // Only first URI should be extracted. + auto res = http2::parse_link_header("; rel=preload, "_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // Both have rel=preload, so both urls should be extracted + auto res = + http2::parse_link_header("; rel=preload, ; rel=preload"_sr); + assert_size(2, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + assert_stdsv_equal("url2"sv, res[1].uri); + } + { + // Second URI uri should be extracted. + auto res = http2::parse_link_header(", ;rel=preload"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url2"sv, res[0].uri); + } + { + // Error if input ends with ';' + auto res = http2::parse_link_header(";rel=preload;"_sr); + assert_size(0, ==, res.size()); + } + { + // Error if link header ends with ';' + auto res = http2::parse_link_header(";rel=preload;, "_sr); + assert_size(0, ==, res.size()); + } + { + // OK if input ends with ',' + auto res = http2::parse_link_header(";rel=preload,"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // Multiple repeated ','s between fields is OK + auto res = http2::parse_link_header(",,,;rel=preload"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url2"sv, res[0].uri); + } + { + // Error if url is not enclosed by <> + auto res = http2::parse_link_header("url>;rel=preload"_sr); + assert_size(0, ==, res.size()); + } + { + // Error if url is not enclosed by <> + auto res = http2::parse_link_header(";rel=preload; as="_sr); + assert_size(0, ==, res.size()); + } + { + // Empty parameter value is not allowed + auto res = http2::parse_link_header(";as=;rel=preload"_sr); + assert_size(0, ==, res.size()); + } + { + // Empty parameter value is not allowed + auto res = http2::parse_link_header(";as=, ;rel=preload"_sr); + assert_size(0, ==, res.size()); + } + { + // Empty parameter name is not allowed + auto res = http2::parse_link_header("; =file; rel=preload"_sr); + assert_size(0, ==, res.size()); + } + { + // Without whitespaces + auto res = http2::parse_link_header( + ";as=file;rel=preload,;rel=preload"_sr); + assert_size(2, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + assert_stdsv_equal("url2"sv, res[1].uri); + } + { + // link-extension may have no value + auto res = http2::parse_link_header("; as; rel=preload"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // ext-name-star + auto res = http2::parse_link_header("; foo*=bar; rel=preload"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // '*' is not allowed expect for trailing one + auto res = http2::parse_link_header("; *=bar; rel=preload"_sr); + assert_size(0, ==, res.size()); + } + { + // '*' is not allowed expect for trailing one + auto res = http2::parse_link_header("; foo*bar=buzz; rel=preload"_sr); + assert_size(0, ==, res.size()); + } + { + // ext-name-star must be followed by '=' + auto res = http2::parse_link_header("; foo*; rel=preload"_sr); + assert_size(0, ==, res.size()); + } + { + // '>' is not followed by ';' + auto res = http2::parse_link_header(" rel=preload"_sr); + assert_size(0, ==, res.size()); + } + { + // Starting with whitespace is no problem. + auto res = http2::parse_link_header(" ; rel=preload"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // preload is a prefix of bogus rel parameter value + auto res = http2::parse_link_header("; rel=preloadx"_sr); + assert_size(0, ==, res.size()); + } + { + // preload in relation-types list + auto res = http2::parse_link_header(R"(; rel="preload")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // preload in relation-types list followed by another parameter + auto res = http2::parse_link_header(R"(; rel="preload foo")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // preload in relation-types list following another parameter + auto res = http2::parse_link_header(R"(; rel="foo preload")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // preload in relation-types list between other parameters + auto res = http2::parse_link_header(R"(; rel="foo preload bar")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // preload in relation-types list between other parameters + auto res = + http2::parse_link_header(R"(; rel="foo preload bar")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // no preload in relation-types list + auto res = http2::parse_link_header(R"(; rel="foo")"_sr); + assert_size(0, ==, res.size()); + } + { + // no preload in relation-types list, multiple unrelated elements. + auto res = http2::parse_link_header(R"(; rel="foo bar")"_sr); + assert_size(0, ==, res.size()); + } + { + // preload in relation-types list, followed by another link-value. + auto res = http2::parse_link_header(R"(; rel="preload", )"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // preload in relation-types list, following another link-value. + auto res = http2::parse_link_header(R"(, ; rel="preload")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url2"sv, res[0].uri); + } + { + // preload in relation-types list, followed by another link-param. + auto res = + http2::parse_link_header(R"(; rel="preload"; as="font")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // preload in relation-types list, followed by character other + // than ';' or ',' + auto res = http2::parse_link_header(R"(; rel="preload".)"_sr); + assert_size(0, ==, res.size()); + } + { + // preload in relation-types list, followed by ';' but it + // terminates input + auto res = http2::parse_link_header(R"(; rel="preload";)"_sr); + assert_size(0, ==, res.size()); + } + { + // preload in relation-types list, followed by ',' but it + // terminates input + auto res = http2::parse_link_header(R"(; rel="preload",)"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // preload in relation-types list but there is preceding white + // space. + auto res = http2::parse_link_header(R"(; rel=" preload")"_sr); + assert_size(0, ==, res.size()); + } + { + // preload in relation-types list but there is trailing white + // space. + auto res = http2::parse_link_header(R"(; rel="preload ")"_sr); + assert_size(0, ==, res.size()); + } + { + // backslash escaped characters in quoted-string + auto res = http2::parse_link_header( + R"(; rel=preload; title="foo\"baz\"bar")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // anchor="" is acceptable + auto res = http2::parse_link_header(R"(; rel=preload; anchor="")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // With anchor="#foo", url should be ignored + auto res = + http2::parse_link_header(R"(; rel=preload; anchor="#foo")"_sr); + assert_size(0, ==, res.size()); + } + { + // With anchor=f, url should be ignored + auto res = http2::parse_link_header("; rel=preload; anchor=f"_sr); + assert_size(0, ==, res.size()); + } + { + // First url is ignored With anchor="#foo", but url should be + // accepted. + auto res = http2::parse_link_header( + R"(; rel=preload; anchor="#foo", ; rel=preload)"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url2"sv, res[0].uri); + } + { + // With loadpolicy="next", url should be ignored + auto res = + http2::parse_link_header(R"(; rel=preload; loadpolicy="next")"_sr); + assert_size(0, ==, res.size()); + } + { + // url should be picked up if empty loadpolicy is specified + auto res = + http2::parse_link_header(R"(; rel=preload; loadpolicy="")"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // case-insensitive match + auto res = http2::parse_link_header( + R"(; rel=preload; ANCHOR="#foo", ; )" + R"(REL=PRELOAD, ; REL="foo PRELOAD bar")"_sr); + assert_size(2, ==, res.size()); + assert_stdsv_equal("url2"sv, res[0].uri); + assert_stdsv_equal("url3"sv, res[1].uri); + } + { + // nopush at the end of input + auto res = http2::parse_link_header("; rel=preload; nopush"_sr); + assert_size(0, ==, res.size()); + } + { + // nopush followed by ';' + auto res = http2::parse_link_header("; rel=preload; nopush; foo"_sr); + assert_size(0, ==, res.size()); + } + { + // nopush followed by ',' + auto res = http2::parse_link_header("; nopush; rel=preload"_sr); + assert_size(0, ==, res.size()); + } + { + // string whose prefix is nopush + auto res = http2::parse_link_header("; nopushyes; rel=preload"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } + { + // rel=preload twice + auto res = http2::parse_link_header("; rel=preload; rel=preload"_sr); + assert_size(1, ==, res.size()); + assert_stdsv_equal("url"sv, res[0].uri); + } +} + +void test_http2_path_join(void) { + { + auto base = "/"_sr; + auto rel = "/"_sr; + assert_stdstring_equal( + "/", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + auto base = "/"_sr; + auto rel = "/alpha"_sr; + assert_stdstring_equal( + "/alpha", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // rel ends with trailing '/' + auto base = "/"_sr; + auto rel = "/alpha/"_sr; + assert_stdstring_equal( + "/alpha/", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // rel contains multiple components + auto base = "/"_sr; + auto rel = "/alpha/bravo"_sr; + assert_stdstring_equal( + "/alpha/bravo", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // rel is relative + auto base = "/"_sr; + auto rel = "alpha/bravo"_sr; + assert_stdstring_equal( + "/alpha/bravo", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // rel is relative and base ends without /, which means it refers + // to file. + auto base = "/alpha"_sr; + auto rel = "bravo/charlie"_sr; + assert_stdstring_equal( + "/bravo/charlie", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // rel contains repeated '/'s + auto base = "/"_sr; + auto rel = "/alpha/////bravo/////"_sr; + assert_stdstring_equal( + "/alpha/bravo/", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // base ends with '/', so '..' eats 'bravo' + auto base = "/alpha/bravo/"_sr; + auto rel = "../charlie/delta"_sr; + assert_stdstring_equal( + "/alpha/charlie/delta", + http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // base does not end with '/', so '..' eats 'alpha/bravo' + auto base = "/alpha/bravo"_sr; + auto rel = "../charlie"_sr; + assert_stdstring_equal( + "/charlie", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // 'charlie' is eaten by following '..' + auto base = "/alpha/bravo/"_sr; + auto rel = "../charlie/../delta"_sr; + assert_stdstring_equal( + "/alpha/delta", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // excessive '..' results in '/' + auto base = "/alpha/bravo/"_sr; + auto rel = "../../../"_sr; + assert_stdstring_equal( + "/", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // excessive '..' and path component + auto base = "/alpha/bravo/"_sr; + auto rel = "../../../charlie"_sr; + assert_stdstring_equal( + "/charlie", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // rel ends with '..' + auto base = "/alpha/bravo/"_sr; + auto rel = "charlie/.."_sr; + assert_stdstring_equal( + "/alpha/bravo/", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // base empty and rel contains '..' + auto base = StringRef{}; + auto rel = "charlie/.."_sr; + assert_stdstring_equal( + "/", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // '.' is ignored + auto base = "/"_sr; + auto rel = "charlie/././././delta"_sr; + assert_stdstring_equal( + "/charlie/delta", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // trailing '.' is ignored + auto base = "/"_sr; + auto rel = "charlie/."_sr; + assert_stdstring_equal( + "/charlie/", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // query + auto base = "/"_sr; + auto rel = "/"_sr; + auto relq = "q"_sr; + assert_stdstring_equal("/?q", + http2::path_join(base, StringRef{}, rel, relq)); + } + { + // empty rel and query + auto base = "/alpha"_sr; + auto rel = StringRef{}; + auto relq = "q"_sr; + assert_stdstring_equal("/alpha?q", + http2::path_join(base, StringRef{}, rel, relq)); + } + { + // both rel and query are empty + auto base = "/alpha"_sr; + auto baseq = "r"_sr; + auto rel = StringRef{}; + auto relq = StringRef{}; + assert_stdstring_equal("/alpha?r", + http2::path_join(base, baseq, rel, relq)); + } + { + // empty base + auto base = StringRef{}; + auto rel = "/alpha"_sr; + assert_stdstring_equal( + "/alpha", http2::path_join(base, StringRef{}, rel, StringRef{})); + } + { + // everything is empty + assert_stdstring_equal("/", http2::path_join(StringRef{}, StringRef{}, + StringRef{}, StringRef{})); + } + { + // only baseq is not empty + auto base = StringRef{}; + auto baseq = "r"_sr; + auto rel = StringRef{}; + assert_stdstring_equal("/?r", + http2::path_join(base, baseq, rel, StringRef{})); + } + { + // path starts with multiple '/'s. + auto base = StringRef{}; + auto baseq = StringRef{}; + auto rel = "//alpha//bravo"_sr; + auto relq = "charlie"_sr; + assert_stdstring_equal("/alpha/bravo?charlie", + http2::path_join(base, baseq, rel, relq)); + } + // Test cases from RFC 3986, section 5.4. + constexpr auto base = "/b/c/d;p"_sr; + constexpr auto baseq = "q"_sr; + { + auto rel = "g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "./g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g/"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/g/", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "/g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = StringRef{}; + auto relq = "y"_sr; + assert_stdstring_equal("/b/c/d;p?y", + http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g"_sr; + auto relq = "y"_sr; + assert_stdstring_equal("/b/c/g?y", + http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = ";x"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/;x", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g;x"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/g;x", + http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g;x"_sr; + auto relq = "y"_sr; + assert_stdstring_equal("/b/c/g;x?y", + http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = StringRef{}; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/d;p?q", + http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "."_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "./"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = ".."_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "../"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "../g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "../.."_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "../../"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "../../g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "../../../g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "../../../../g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "/./g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "/../g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g."_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/g.", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = ".g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/.g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g.."_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/g..", + http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "..g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/..g", + http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "./../g"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/g", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "./g/."_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/g/", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g/./h"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/g/h", + http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g/../h"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/h", http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g;x=1/./y"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/g;x=1/y", + http2::path_join(base, baseq, rel, relq)); + } + { + auto rel = "g;x=1/../y"_sr; + auto relq = StringRef{}; + assert_stdstring_equal("/b/c/y", http2::path_join(base, baseq, rel, relq)); + } +} + +void test_http2_normalize_path(void) { + assert_stdstring_equal( + "/alpha/charlie", + http2::normalize_path("/alpha/bravo/../charlie"_sr, StringRef{})); + + assert_stdstring_equal( + "/alpha", http2::normalize_path("/a%6c%70%68%61"_sr, StringRef{})); + + assert_stdstring_equal("/alpha%2F%3A", + http2::normalize_path("/alpha%2f%3a"_sr, StringRef{})); + + assert_stdstring_equal("/%2F", http2::normalize_path("%2f"_sr, StringRef{})); + + assert_stdstring_equal("/%f", http2::normalize_path("%f"_sr, StringRef{})); + + assert_stdstring_equal("/%", http2::normalize_path("%"_sr, StringRef{})); + + assert_stdstring_equal("/", http2::normalize_path(StringRef{}, StringRef{})); + + assert_stdstring_equal("/alpha?bravo", + http2::normalize_path("/alpha"_sr, "bravo"_sr)); +} + +void test_http2_rewrite_clean_path(void) { + BlockAllocator balloc(4096, 4096); + + // unreserved characters + assert_stdsv_equal("/alpha/bravo/"sv, + http2::rewrite_clean_path(balloc, "/alpha/%62ravo/"_sr)); + + // percent-encoding is converted to upper case. + assert_stdsv_equal("/delta%3A"sv, + http2::rewrite_clean_path(balloc, "/delta%3a"_sr)); + + // path component is normalized before matching + assert_stdsv_equal("/alpha/bravo/"sv, + http2::rewrite_clean_path( + balloc, "/alpha/charlie/%2e././bravo/delta/.."_sr)); + + assert_stdsv_equal("alpha%3a"sv, + http2::rewrite_clean_path(balloc, "alpha%3a"_sr)); + + assert_stdsv_equal(""sv, http2::rewrite_clean_path(balloc, StringRef{})); + + assert_stdsv_equal("/alpha?bravo"sv, + http2::rewrite_clean_path(balloc, "//alpha?bravo"_sr)); +} + +void test_http2_get_pure_path_component(void) { + assert_stdsv_equal("/"sv, http2::get_pure_path_component("/"_sr)); + + assert_stdsv_equal("/foo"sv, http2::get_pure_path_component("/foo"_sr)); + + assert_stdsv_equal( + "/bar"sv, http2::get_pure_path_component("https://example.org/bar"_sr)); + + assert_stdsv_equal("/alpha"sv, http2::get_pure_path_component( + "https://example.org/alpha?q=a"_sr)); + + assert_stdsv_equal("/bravo"sv, + http2::get_pure_path_component( + "https://example.org/bravo?q=a#fragment"_sr)); + + assert_stdsv_equal(""sv, http2::get_pure_path_component("\x01\x02"_sr)); +} + +void test_http2_construct_push_component(void) { + BlockAllocator balloc(4096, 4096); + StringRef base, uri; + StringRef scheme, authority, path; + + base = "/b/"_sr; + uri = "https://example.org/foo"_sr; + + assert_int(0, ==, + http2::construct_push_component(balloc, scheme, authority, path, + base, uri)); + assert_stdsv_equal("https"sv, scheme); + assert_stdsv_equal("example.org"sv, authority); + assert_stdsv_equal("/foo"sv, path); + + scheme = StringRef{}; + authority = StringRef{}; + path = StringRef{}; + + uri = "/foo/bar?q=a"_sr; + + assert_int(0, ==, + http2::construct_push_component(balloc, scheme, authority, path, + base, uri)); + assert_stdsv_equal(""sv, scheme); + assert_stdsv_equal(""sv, authority); + assert_stdsv_equal("/foo/bar?q=a"sv, path); + + scheme = StringRef{}; + authority = StringRef{}; + path = StringRef{}; + + uri = "foo/../bar?q=a"_sr; + + assert_int(0, ==, + http2::construct_push_component(balloc, scheme, authority, path, + base, uri)); + assert_stdsv_equal(""sv, scheme); + assert_stdsv_equal(""sv, authority); + assert_stdsv_equal("/b/bar?q=a"sv, path); + + scheme = StringRef{}; + authority = StringRef{}; + path = StringRef{}; + + uri = StringRef{}; + + assert_int(-1, ==, + http2::construct_push_component(balloc, scheme, authority, path, + base, uri)); + scheme = StringRef{}; + authority = StringRef{}; + path = StringRef{}; + + uri = "?q=a"_sr; + + assert_int(0, ==, + http2::construct_push_component(balloc, scheme, authority, path, + base, uri)); + assert_stdsv_equal(""sv, scheme); + assert_stdsv_equal(""sv, authority); + assert_stdsv_equal("/b/?q=a"sv, path); +} + +void test_http2_contains_trailers(void) { + assert_false(http2::contains_trailers(""_sr)); + assert_true(http2::contains_trailers("trailers"_sr)); + // Match must be case-insensitive. + assert_true(http2::contains_trailers("TRAILERS"_sr)); + assert_false(http2::contains_trailers("trailer"_sr)); + assert_false(http2::contains_trailers("trailers 3"_sr)); + assert_true(http2::contains_trailers("trailers,"_sr)); + assert_true(http2::contains_trailers("trailers,foo"_sr)); + assert_true(http2::contains_trailers("foo,trailers"_sr)); + assert_true(http2::contains_trailers("foo,trailers,bar"_sr)); + assert_true(http2::contains_trailers("foo, trailers ,bar"_sr)); + assert_true(http2::contains_trailers(",trailers"_sr)); +} + +void test_http2_check_transfer_encoding(void) { + assert_true(http2::check_transfer_encoding("chunked"_sr)); + assert_true(http2::check_transfer_encoding("foo,chunked"_sr)); + assert_true(http2::check_transfer_encoding("foo, chunked"_sr)); + assert_true(http2::check_transfer_encoding("foo , chunked"_sr)); + assert_true(http2::check_transfer_encoding("chunked;foo=bar"_sr)); + assert_true(http2::check_transfer_encoding("chunked ; foo=bar"_sr)); + assert_true(http2::check_transfer_encoding(R"(chunked;foo="bar")"_sr)); + assert_true( + http2::check_transfer_encoding(R"(chunked;foo="\bar\"";FOO=BAR)"_sr)); + assert_true(http2::check_transfer_encoding(R"(chunked;foo="")"_sr)); + assert_true(http2::check_transfer_encoding(R"(chunked;foo="bar" , gzip)"_sr)); + + assert_false(http2::check_transfer_encoding(StringRef{})); + assert_false(http2::check_transfer_encoding(",chunked"_sr)); + assert_false(http2::check_transfer_encoding("chunked,"_sr)); + assert_false(http2::check_transfer_encoding("chunked, "_sr)); + assert_false(http2::check_transfer_encoding("foo,,chunked"_sr)); + assert_false(http2::check_transfer_encoding("chunked;foo"_sr)); + assert_false(http2::check_transfer_encoding("chunked;"_sr)); + assert_false(http2::check_transfer_encoding("chunked;foo=bar;"_sr)); + assert_false(http2::check_transfer_encoding("chunked;?=bar"_sr)); + assert_false(http2::check_transfer_encoding("chunked;=bar"_sr)); + assert_false(http2::check_transfer_encoding("chunked;;"_sr)); + assert_false(http2::check_transfer_encoding("chunked?"_sr)); + assert_false(http2::check_transfer_encoding(","_sr)); + assert_false(http2::check_transfer_encoding(" "_sr)); + assert_false(http2::check_transfer_encoding(";"_sr)); + assert_false(http2::check_transfer_encoding("\""_sr)); + assert_false(http2::check_transfer_encoding(R"(chunked;foo="bar)"_sr)); + assert_false(http2::check_transfer_encoding(R"(chunked;foo="bar\)"_sr)); + assert_false(http2::check_transfer_encoding(R"(chunked;foo="bar\)" + "\x0a" + R"(")"_sr)); + assert_false(http2::check_transfer_encoding(R"(chunked;foo=")" + "\x0a" + R"(")"_sr)); + assert_false(http2::check_transfer_encoding(R"(chunked;foo="bar",,gzip)"_sr)); +} + +} // namespace shrpx diff --git a/lib/nghttp2/src/http2_test.h b/lib/nghttp2-1.65.0/src/http2_test.h similarity index 58% rename from lib/nghttp2/src/http2_test.h rename to lib/nghttp2-1.65.0/src/http2_test.h index 382470d471f..531f618ea43 100644 --- a/lib/nghttp2/src/http2_test.h +++ b/lib/nghttp2-1.65.0/src/http2_test.h @@ -29,25 +29,31 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace shrpx { -void test_http2_add_header(void); -void test_http2_get_header(void); -void test_http2_copy_headers_to_nva(void); -void test_http2_build_http1_headers_from_headers(void); -void test_http2_lws(void); -void test_http2_rewrite_location_uri(void); -void test_http2_parse_http_status_code(void); -void test_http2_index_header(void); -void test_http2_lookup_token(void); -void test_http2_parse_link_header(void); -void test_http2_path_join(void); -void test_http2_normalize_path(void); -void test_http2_rewrite_clean_path(void); -void test_http2_get_pure_path_component(void); -void test_http2_construct_push_component(void); -void test_http2_contains_trailers(void); -void test_http2_check_transfer_encoding(void); +extern const MunitSuite http2_suite; + +munit_void_test_decl(test_http2_add_header) +munit_void_test_decl(test_http2_get_header) +munit_void_test_decl(test_http2_copy_headers_to_nva) +munit_void_test_decl(test_http2_build_http1_headers_from_headers) +munit_void_test_decl(test_http2_lws) +munit_void_test_decl(test_http2_rewrite_location_uri) +munit_void_test_decl(test_http2_parse_http_status_code) +munit_void_test_decl(test_http2_index_header) +munit_void_test_decl(test_http2_lookup_token) +munit_void_test_decl(test_http2_parse_link_header) +munit_void_test_decl(test_http2_path_join) +munit_void_test_decl(test_http2_normalize_path) +munit_void_test_decl(test_http2_rewrite_clean_path) +munit_void_test_decl(test_http2_get_pure_path_component) +munit_void_test_decl(test_http2_construct_push_component) +munit_void_test_decl(test_http2_contains_trailers) +munit_void_test_decl(test_http2_check_transfer_encoding) } // namespace shrpx diff --git a/lib/nghttp2/src/http3.cc b/lib/nghttp2-1.65.0/src/http3.cc similarity index 61% rename from lib/nghttp2/src/http3.cc rename to lib/nghttp2-1.65.0/src/http3.cc index 61134ad74dc..10687035b11 100644 --- a/lib/nghttp2/src/http3.cc +++ b/lib/nghttp2-1.65.0/src/http3.cc @@ -28,56 +28,6 @@ namespace nghttp2 { namespace http3 { -namespace { -nghttp3_nv make_nv_internal(const std::string &name, const std::string &value, - bool never_index, uint8_t nv_flags) { - uint8_t flags; - - flags = nv_flags | - (never_index ? NGHTTP3_NV_FLAG_NEVER_INDEX : NGHTTP3_NV_FLAG_NONE); - - return {(uint8_t *)name.c_str(), (uint8_t *)value.c_str(), name.size(), - value.size(), flags}; -} -} // namespace - -namespace { -nghttp3_nv make_nv_internal(const StringRef &name, const StringRef &value, - bool never_index, uint8_t nv_flags) { - uint8_t flags; - - flags = nv_flags | - (never_index ? NGHTTP3_NV_FLAG_NEVER_INDEX : NGHTTP3_NV_FLAG_NONE); - - return {(uint8_t *)name.c_str(), (uint8_t *)value.c_str(), name.size(), - value.size(), flags}; -} -} // namespace - -nghttp3_nv make_nv(const std::string &name, const std::string &value, - bool never_index) { - return make_nv_internal(name, value, never_index, NGHTTP3_NV_FLAG_NONE); -} - -nghttp3_nv make_nv(const StringRef &name, const StringRef &value, - bool never_index) { - return make_nv_internal(name, value, never_index, NGHTTP3_NV_FLAG_NONE); -} - -nghttp3_nv make_nv_nocopy(const std::string &name, const std::string &value, - bool never_index) { - return make_nv_internal(name, value, never_index, - NGHTTP3_NV_FLAG_NO_COPY_NAME | - NGHTTP3_NV_FLAG_NO_COPY_VALUE); -} - -nghttp3_nv make_nv_nocopy(const StringRef &name, const StringRef &value, - bool never_index) { - return make_nv_internal(name, value, never_index, - NGHTTP3_NV_FLAG_NO_COPY_NAME | - NGHTTP3_NV_FLAG_NO_COPY_VALUE); -} - namespace { void copy_headers_to_nva_internal(std::vector &nva, const HeaderRefs &headers, uint8_t nv_flags, @@ -172,33 +122,17 @@ void copy_headers_to_nva_internal(std::vector &nva, it_via = it; break; } - nva.push_back( - make_nv_internal(kv->name, kv->value, kv->no_index, nv_flags)); + nva.push_back(make_field_flags(kv->name, kv->value, + nv_flags | never_index(kv->no_index))); } } } // namespace -void copy_headers_to_nva(std::vector &nva, - const HeaderRefs &headers, uint32_t flags) { - copy_headers_to_nva_internal(nva, headers, NGHTTP3_NV_FLAG_NONE, flags); -} - void copy_headers_to_nva_nocopy(std::vector &nva, const HeaderRefs &headers, uint32_t flags) { copy_headers_to_nva_internal( - nva, headers, - NGHTTP3_NV_FLAG_NO_COPY_NAME | NGHTTP3_NV_FLAG_NO_COPY_VALUE, flags); -} - -int check_nv(const uint8_t *name, size_t namelen, const uint8_t *value, - size_t valuelen) { - if (!nghttp3_check_header_name(name, namelen)) { - return 0; - } - if (!nghttp3_check_header_value(value, valuelen)) { - return 0; - } - return 1; + nva, headers, NGHTTP3_NV_FLAG_NO_COPY_NAME | NGHTTP3_NV_FLAG_NO_COPY_VALUE, + flags); } } // namespace http3 diff --git a/lib/nghttp2-1.65.0/src/http3.h b/lib/nghttp2-1.65.0/src/http3.h new file mode 100644 index 00000000000..cd68922f2e0 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/http3.h @@ -0,0 +1,79 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2021 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef HTTP3_H +#define HTTP3_H + +#include "nghttp2_config.h" + +#include +#include +#include + +#include + +#include "http2.h" +#include "template.h" + +namespace nghttp2 { + +namespace http3 { + +// Create nghttp3_nv from |name|, |value| and |flags|. +inline nghttp3_nv make_field_flags(const StringRef &name, + const StringRef &value, + uint8_t flags = NGHTTP3_NV_FLAG_NONE) { + auto ns = as_uint8_span(std::span{name}); + auto vs = as_uint8_span(std::span{value}); + + return {const_cast(ns.data()), const_cast(vs.data()), + ns.size(), vs.size(), flags}; +} + +// Creates nghttp3_nv from |name|, |value| and |flags|. nghttp3 +// library does not copy them. +inline nghttp3_nv make_field(const StringRef &name, const StringRef &value, + uint8_t flags = NGHTTP3_NV_FLAG_NONE) { + return make_field_flags(name, value, + static_cast(NGHTTP3_NV_FLAG_NO_COPY_NAME | + NGHTTP3_NV_FLAG_NO_COPY_VALUE | + flags)); +} + +// Returns NGHTTP3_NV_FLAG_NEVER_INDEX if |never_index| is true, +// otherwise NGHTTP3_NV_FLAG_NONE. +inline uint8_t never_index(bool never_index) { + return never_index ? NGHTTP3_NV_FLAG_NEVER_INDEX : NGHTTP3_NV_FLAG_NONE; +} + +// Just like copy_headers_to_nva(), but this adds +// NGHTTP3_NV_FLAG_NO_COPY_NAME and NGHTTP3_NV_FLAG_NO_COPY_VALUE. +void copy_headers_to_nva_nocopy(std::vector &nva, + const HeaderRefs &headers, uint32_t flags); + +} // namespace http3 + +} // namespace nghttp2 + +#endif // HTTP3_H diff --git a/lib/nghttp2/src/inflatehd.cc b/lib/nghttp2-1.65.0/src/inflatehd.cc similarity index 93% rename from lib/nghttp2/src/inflatehd.cc rename to lib/nghttp2-1.65.0/src/inflatehd.cc index f484042a3aa..b5e8f9327ac 100644 --- a/lib/nghttp2/src/inflatehd.cc +++ b/lib/nghttp2-1.65.0/src/inflatehd.cc @@ -41,6 +41,7 @@ #include +#define NGHTTP2_NO_SSIZE_T #include #include "template.h" @@ -78,7 +79,7 @@ static void to_json(nghttp2_hd_inflater *inflater, json_t *headers, json_object_set(obj, "wire", wire); json_object_set(obj, "headers", headers); auto max_dyn_table_size = - nghttp2_hd_inflate_get_max_dynamic_table_size(inflater); + nghttp2_hd_inflate_get_max_dynamic_table_size(inflater); if (old_settings_table_size != max_dyn_table_size) { json_object_set_new(obj, "header_table_size", json_integer(max_dyn_table_size)); @@ -93,11 +94,10 @@ static void to_json(nghttp2_hd_inflater *inflater, json_t *headers, } static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq) { - ssize_t rv; nghttp2_nv nv; int inflate_flags; size_t old_settings_table_size = - nghttp2_hd_inflate_get_max_dynamic_table_size(inflater); + nghttp2_hd_inflate_get_max_dynamic_table_size(inflater); auto wire = json_object_get(obj, "wire"); @@ -120,8 +120,8 @@ static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq) { seq); return -1; } - rv = nghttp2_hd_inflate_change_table_size(inflater, - json_integer_value(table_size)); + auto rv = nghttp2_hd_inflate_change_table_size( + inflater, json_integer_value(table_size)); if (rv != 0) { fprintf(stderr, "nghttp2_hd_change_table_size() failed with error %s at %d\n", @@ -147,7 +147,8 @@ static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq) { auto p = buf.data(); for (;;) { inflate_flags = 0; - rv = nghttp2_hd_inflate_hd(inflater, &nv, &inflate_flags, p, buflen, 1); + auto rv = + nghttp2_hd_inflate_hd3(inflater, &nv, &inflate_flags, p, buflen, 1); if (rv < 0) { fprintf(stderr, "inflate failed with error code %zd at %d\n", rv, seq); exit(EXIT_FAILURE); @@ -156,7 +157,7 @@ static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq) { buflen -= rv; if (inflate_flags & NGHTTP2_HD_INFLATE_EMIT) { json_array_append_new( - headers, dump_header(nv.name, nv.namelen, nv.value, nv.valuelen)); + headers, dump_header(nv.name, nv.namelen, nv.value, nv.valuelen)); } if (inflate_flags & NGHTTP2_HD_INFLATE_FINAL) { break; @@ -254,7 +255,7 @@ The output of this program can be used as input for deflatehd. } constexpr static struct option long_options[] = { - {"dump-header-table", no_argument, nullptr, 'd'}, {nullptr, 0, nullptr, 0}}; + {"dump-header-table", no_argument, nullptr, 'd'}, {nullptr, 0, nullptr, 0}}; int main(int argc, char **argv) { config.dump_header_table = 0; diff --git a/lib/nghttp2/src/memchunk.h b/lib/nghttp2-1.65.0/src/memchunk.h similarity index 92% rename from lib/nghttp2/src/memchunk.h rename to lib/nghttp2-1.65.0/src/memchunk.h index 7a7f2e9b056..f0d52b46957 100644 --- a/lib/nghttp2/src/memchunk.h +++ b/lib/nghttp2-1.65.0/src/memchunk.h @@ -60,7 +60,7 @@ namespace nghttp2 { template struct Memchunk { Memchunk(Memchunk *next_chunk) - : pos(std::begin(buf)), last(pos), knext(next_chunk), next(nullptr) {} + : pos(std::begin(buf)), last(pos), knext(next_chunk), next(nullptr) {} size_t len() const { return last - pos; } size_t left() const { return std::end(buf) - last; } void reset() { pos = last = std::begin(buf); } @@ -113,22 +113,22 @@ template struct Pool { template struct Memchunks { Memchunks(Pool *pool) - : pool(pool), - head(nullptr), - tail(nullptr), - len(0), - mark(nullptr), - mark_pos(nullptr), - mark_offset(0) {} + : pool(pool), + head(nullptr), + tail(nullptr), + len(0), + mark(nullptr), + mark_pos(nullptr), + mark_offset(0) {} Memchunks(const Memchunks &) = delete; Memchunks(Memchunks &&other) noexcept - : pool{other.pool}, // keep other.pool - head{std::exchange(other.head, nullptr)}, - tail{std::exchange(other.tail, nullptr)}, - len{std::exchange(other.len, 0)}, - mark{std::exchange(other.mark, nullptr)}, - mark_pos{std::exchange(other.mark_pos, nullptr)}, - mark_offset{std::exchange(other.mark_offset, 0)} {} + : pool{other.pool}, // keep other.pool + head{std::exchange(other.head, nullptr)}, + tail{std::exchange(other.tail, nullptr)}, + len{std::exchange(other.len, 0)}, + mark{std::exchange(other.mark, nullptr)}, + mark_pos{std::exchange(other.mark_pos, nullptr)}, + mark_offset{std::exchange(other.mark_offset, 0)} {} Memchunks &operator=(const Memchunks &) = delete; Memchunks &operator=(Memchunks &&other) noexcept { if (this == &other) { @@ -199,7 +199,7 @@ template struct Memchunks { return append(s, N - 1); } size_t append(const std::string &s) { return append(s.c_str(), s.size()); } - size_t append(const StringRef &s) { return append(s.c_str(), s.size()); } + size_t append(const StringRef &s) { return append(s.data(), s.size()); } size_t append(const ImmutableString &s) { return append(s.c_str(), s.size()); } @@ -426,20 +426,20 @@ template struct Memchunks { // Wrapper around Memchunks to offer "peeking" functionality. template struct PeekMemchunks { PeekMemchunks(Pool *pool) - : memchunks(pool), - cur(nullptr), - cur_pos(nullptr), - cur_last(nullptr), - len(0), - peeking(true) {} + : memchunks(pool), + cur(nullptr), + cur_pos(nullptr), + cur_last(nullptr), + len(0), + peeking(true) {} PeekMemchunks(const PeekMemchunks &) = delete; PeekMemchunks(PeekMemchunks &&other) noexcept - : memchunks{std::move(other.memchunks)}, - cur{std::exchange(other.cur, nullptr)}, - cur_pos{std::exchange(other.cur_pos, nullptr)}, - cur_last{std::exchange(other.cur_last, nullptr)}, - len{std::exchange(other.len, 0)}, - peeking{std::exchange(other.peeking, true)} {} + : memchunks{std::move(other.memchunks)}, + cur{std::exchange(other.cur, nullptr)}, + cur_pos{std::exchange(other.cur_pos, nullptr)}, + cur_last{std::exchange(other.cur_last, nullptr)}, + len{std::exchange(other.len, 0)}, + peeking{std::exchange(other.peeking, true)} {} PeekMemchunks &operator=(const PeekMemchunks &) = delete; PeekMemchunks &operator=(PeekMemchunks &&other) noexcept { if (this == &other) { @@ -569,7 +569,7 @@ template struct MemchunkBuffer { MemchunkBuffer(Pool *pool) : pool(pool), chunk(nullptr) {} MemchunkBuffer(const MemchunkBuffer &) = delete; MemchunkBuffer(MemchunkBuffer &&other) noexcept - : pool(other.pool), chunk(other.chunk) { + : pool(other.pool), chunk(other.chunk) { other.chunk = nullptr; } MemchunkBuffer &operator=(const MemchunkBuffer &) = delete; diff --git a/lib/nghttp2-1.65.0/src/memchunk_test.cc b/lib/nghttp2-1.65.0/src/memchunk_test.cc new file mode 100644 index 00000000000..f49aca3fef9 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/memchunk_test.cc @@ -0,0 +1,360 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2015 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "memchunk_test.h" + +#include "munitxx.h" + +#include + +#include "memchunk.h" +#include "util.h" + +namespace nghttp2 { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_pool_recycle), + munit_void_test(test_memchunks_append), + munit_void_test(test_memchunks_drain), + munit_void_test(test_memchunks_riovec), + munit_void_test(test_memchunks_recycle), + munit_void_test(test_memchunks_reset), + munit_void_test(test_peek_memchunks_append), + munit_void_test(test_peek_memchunks_disable_peek_drain), + munit_void_test(test_peek_memchunks_disable_peek_no_drain), + munit_void_test(test_peek_memchunks_reset), + munit_test_end(), +}; +} // namespace + +const MunitSuite memchunk_suite{ + "/memchunk", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +void test_pool_recycle(void) { + MemchunkPool pool; + + assert_null(pool.pool); + assert_size(0, ==, pool.poolsize); + assert_null(pool.freelist); + + auto m1 = pool.get(); + + assert_ptr_equal(m1, pool.pool); + assert_size(MemchunkPool::value_type::size, ==, pool.poolsize); + assert_null(pool.freelist); + + auto m2 = pool.get(); + + assert_ptr_equal(m2, pool.pool); + assert_size(2 * MemchunkPool::value_type::size, ==, pool.poolsize); + assert_null(pool.freelist); + assert_ptr_equal(m1, m2->knext); + assert_null(m1->knext); + + auto m3 = pool.get(); + + assert_ptr_equal(m3, pool.pool); + assert_size(3 * MemchunkPool::value_type::size, ==, pool.poolsize); + assert_null(pool.freelist); + + pool.recycle(m3); + + assert_ptr_equal(m3, pool.pool); + assert_size(3 * MemchunkPool::value_type::size, ==, pool.poolsize); + assert_ptr_equal(m3, pool.freelist); + + auto m4 = pool.get(); + + assert_ptr_equal(m3, m4); + assert_ptr_equal(m4, pool.pool); + assert_size(3 * MemchunkPool::value_type::size, ==, pool.poolsize); + assert_null(pool.freelist); + + pool.recycle(m2); + pool.recycle(m1); + + assert_ptr_equal(m1, pool.freelist); + assert_ptr_equal(m2, m1->next); + assert_null(m2->next); +} + +using Memchunk16 = Memchunk<16>; +using MemchunkPool16 = Pool; +using Memchunks16 = Memchunks; +using PeekMemchunks16 = PeekMemchunks; + +void test_memchunks_append(void) { + MemchunkPool16 pool; + Memchunks16 chunks(&pool); + + chunks.append("012"); + + auto m = chunks.tail; + + assert_size(3, ==, m->len()); + assert_size(13, ==, m->left()); + + chunks.append("3456789abcdef@"); + + assert_size(16, ==, m->len()); + assert_size(0, ==, m->left()); + + m = chunks.tail; + + assert_size(1, ==, m->len()); + assert_size(15, ==, m->left()); + assert_size(17, ==, chunks.rleft()); + + char buf[16]; + size_t nread; + + nread = chunks.remove(buf, 8); + + assert_size(8, ==, nread); + assert_memory_equal(nread, "01234567", buf); + assert_size(9, ==, chunks.rleft()); + + nread = chunks.remove(buf, sizeof(buf)); + + assert_size(9, ==, nread); + assert_memory_equal(nread, "89abcdef@", buf); + assert_size(0, ==, chunks.rleft()); + assert_null(chunks.head); + assert_null(chunks.tail); + assert_size(32, ==, pool.poolsize); +} + +void test_memchunks_drain(void) { + MemchunkPool16 pool; + Memchunks16 chunks(&pool); + + chunks.append("0123456789"); + + size_t nread; + + nread = chunks.drain(3); + + assert_size(3, ==, nread); + + char buf[16]; + + nread = chunks.remove(buf, sizeof(buf)); + + assert_size(7, ==, nread); + assert_memory_equal(nread, "3456789", buf); +} + +void test_memchunks_riovec(void) { + MemchunkPool16 pool; + Memchunks16 chunks(&pool); + + std::array buf{}; + + chunks.append(buf.data(), buf.size()); + + std::array iov; + auto iovcnt = chunks.riovec(iov.data(), iov.size()); + + auto m = chunks.head; + + assert_int(2, ==, iovcnt); + assert_ptr_equal(m->buf.data(), iov[0].iov_base); + assert_size(m->len(), ==, iov[0].iov_len); + + m = m->next; + + assert_ptr_equal(m->buf.data(), iov[1].iov_base); + assert_size(m->len(), ==, iov[1].iov_len); + + chunks.drain(2 * 16); + + iovcnt = chunks.riovec(iov.data(), iov.size()); + + assert_int(1, ==, iovcnt); + + m = chunks.head; + assert_ptr_equal(m->buf.data(), iov[0].iov_base); + assert_size(m->len(), ==, iov[0].iov_len); +} + +void test_memchunks_recycle(void) { + MemchunkPool16 pool; + { + Memchunks16 chunks(&pool); + std::array buf{}; + chunks.append(buf.data(), buf.size()); + } + assert_size(32, ==, pool.poolsize); + assert_not_null(pool.freelist); + + auto m = pool.freelist; + m = m->next; + + assert_not_null(m); + assert_null(m->next); +} + +void test_memchunks_reset(void) { + MemchunkPool16 pool; + Memchunks16 chunks(&pool); + + std::array b{}; + + chunks.append(b.data(), b.size()); + + assert_size(32, ==, chunks.rleft()); + + chunks.reset(); + + assert_size(0, ==, chunks.rleft()); + assert_null(chunks.head); + assert_null(chunks.tail); + + auto m = pool.freelist; + + assert_not_null(m); + assert_not_null(m->next); + assert_null(m->next->next); +} + +void test_peek_memchunks_append(void) { + MemchunkPool16 pool; + PeekMemchunks16 pchunks(&pool); + + std::array b{ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', + }, + d; + + pchunks.append(b.data(), b.size()); + + assert_size(32, ==, pchunks.rleft()); + assert_size(32, ==, pchunks.rleft_buffered()); + + assert_size(0, ==, pchunks.remove(nullptr, 0)); + + assert_size(32, ==, pchunks.rleft()); + assert_size(32, ==, pchunks.rleft_buffered()); + + assert_size(12, ==, pchunks.remove(d.data(), 12)); + + assert_true(std::equal(std::begin(b), std::begin(b) + 12, std::begin(d))); + + assert_size(20, ==, pchunks.rleft()); + assert_size(32, ==, pchunks.rleft_buffered()); + + assert_size(20, ==, pchunks.remove(d.data(), d.size())); + + assert_true(std::equal(std::begin(b) + 12, std::end(b), std::begin(d))); + + assert_size(0, ==, pchunks.rleft()); + assert_size(32, ==, pchunks.rleft_buffered()); +} + +void test_peek_memchunks_disable_peek_drain(void) { + MemchunkPool16 pool; + PeekMemchunks16 pchunks(&pool); + + std::array b{ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', + }, + d; + + pchunks.append(b.data(), b.size()); + + assert_size(12, ==, pchunks.remove(d.data(), 12)); + + pchunks.disable_peek(true); + + assert_false(pchunks.peeking); + assert_size(20, ==, pchunks.rleft()); + assert_size(20, ==, pchunks.rleft_buffered()); + + assert_size(20, ==, pchunks.remove(d.data(), d.size())); + + assert_true(std::equal(std::begin(b) + 12, std::end(b), std::begin(d))); + + assert_size(0, ==, pchunks.rleft()); + assert_size(0, ==, pchunks.rleft_buffered()); +} + +void test_peek_memchunks_disable_peek_no_drain(void) { + MemchunkPool16 pool; + PeekMemchunks16 pchunks(&pool); + + std::array b{ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', + }, + d; + + pchunks.append(b.data(), b.size()); + + assert_size(12, ==, pchunks.remove(d.data(), 12)); + + pchunks.disable_peek(false); + + assert_false(pchunks.peeking); + assert_size(32, ==, pchunks.rleft()); + assert_size(32, ==, pchunks.rleft_buffered()); + + assert_size(32, ==, pchunks.remove(d.data(), d.size())); + + assert_true(std::equal(std::begin(b), std::end(b), std::begin(d))); + + assert_size(0, ==, pchunks.rleft()); + assert_size(0, ==, pchunks.rleft_buffered()); +} + +void test_peek_memchunks_reset(void) { + MemchunkPool16 pool; + PeekMemchunks16 pchunks(&pool); + + std::array b{ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', + }, + d; + + pchunks.append(b.data(), b.size()); + + assert_size(12, ==, pchunks.remove(d.data(), 12)); + + pchunks.disable_peek(true); + pchunks.reset(); + + assert_size(0, ==, pchunks.rleft()); + assert_size(0, ==, pchunks.rleft_buffered()); + + assert_null(pchunks.cur); + assert_null(pchunks.cur_pos); + assert_null(pchunks.cur_last); + assert_true(pchunks.peeking); +} + +} // namespace nghttp2 diff --git a/lib/nghttp2-1.65.0/src/memchunk_test.h b/lib/nghttp2-1.65.0/src/memchunk_test.h new file mode 100644 index 00000000000..07328dce561 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/memchunk_test.h @@ -0,0 +1,53 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2015 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef MEMCHUNK_TEST_H +#define MEMCHUNK_TEST_H + +#ifdef HAVE_CONFIG_H +# include +#endif // HAVE_CONFIG_H + +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +namespace nghttp2 { + +extern const MunitSuite memchunk_suite; + +munit_void_test_decl(test_pool_recycle) +munit_void_test_decl(test_memchunks_append) +munit_void_test_decl(test_memchunks_drain) +munit_void_test_decl(test_memchunks_riovec) +munit_void_test_decl(test_memchunks_recycle) +munit_void_test_decl(test_memchunks_reset) +munit_void_test_decl(test_peek_memchunks_append) +munit_void_test_decl(test_peek_memchunks_disable_peek_drain) +munit_void_test_decl(test_peek_memchunks_disable_peek_no_drain) +munit_void_test_decl(test_peek_memchunks_reset) + +} // namespace nghttp2 + +#endif // MEMCHUNK_TEST_H diff --git a/lib/nghttp2/src/network.h b/lib/nghttp2-1.65.0/src/network.h similarity index 100% rename from lib/nghttp2/src/network.h rename to lib/nghttp2-1.65.0/src/network.h diff --git a/lib/nghttp2/src/nghttp.cc b/lib/nghttp2-1.65.0/src/nghttp.cc similarity index 75% rename from lib/nghttp2/src/nghttp.cc rename to lib/nghttp2-1.65.0/src/nghttp.cc index cb6a3b15358..2a3833676fe 100644 --- a/lib/nghttp2/src/nghttp.cc +++ b/lib/nghttp2-1.65.0/src/nghttp.cc @@ -47,7 +47,14 @@ #include #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #ifdef HAVE_JANSSON # include @@ -59,7 +66,6 @@ #include "base64.h" #include "tls.h" #include "template.h" -#include "ssl_compat.h" #ifndef O_BINARY # define O_BINARY (0) @@ -67,64 +73,31 @@ namespace nghttp2 { -// The anchor stream nodes when --no-dep is not used. The stream ID = -// 1 is excluded since it is used as first stream in upgrade case. We -// follows the same dependency anchor nodes as Firefox does. -struct Anchor { - int32_t stream_id; - // stream ID this anchor depends on - int32_t dep_stream_id; - // .. with this weight. - int32_t weight; -}; - -// This is index into anchors. Firefox uses ANCHOR_FOLLOWERS for html -// file. -enum { - ANCHOR_LEADERS, - ANCHOR_UNBLOCKED, - ANCHOR_BACKGROUND, - ANCHOR_SPECULATIVE, - ANCHOR_FOLLOWERS, -}; - -namespace { -constexpr auto anchors = std::array{{ - {3, 0, 201}, - {5, 0, 101}, - {7, 0, 1}, - {9, 7, 1}, - {11, 3, 1}, -}}; -} // namespace - Config::Config() - : header_table_size(-1), - min_header_table_size(std::numeric_limits::max()), - encoder_header_table_size(-1), - padding(0), - max_concurrent_streams(100), - peer_max_concurrent_streams(100), - multiply(1), - timeout(0.), - window_bits(-1), - connection_window_bits(-1), - verbose(0), - port_override(0), - null_out(false), - remote_name(false), - get_assets(false), - stat(false), - upgrade(false), - continuation(false), - no_content_length(false), - no_dep(false), - hexdump(false), - no_push(false), - expect_continue(false), - verify_peer(true), - ktls(false), - no_rfc7540_pri(false) { + : header_table_size(-1), + min_header_table_size(std::numeric_limits::max()), + encoder_header_table_size(-1), + padding(0), + max_concurrent_streams(100), + peer_max_concurrent_streams(100), + multiply(1), + timeout(0.), + window_bits(-1), + connection_window_bits(-1), + verbose(0), + port_override(0), + null_out(false), + remote_name(false), + get_assets(false), + stat(false), + upgrade(false), + continuation(false), + no_content_length(false), + hexdump(false), + no_push(false), + expect_continue(false), + verify_peer(true), + ktls(false) { nghttp2_option_new(&http2_option); nghttp2_option_set_peer_max_concurrent_streams(http2_option, peer_max_concurrent_streams); @@ -156,22 +129,22 @@ std::string strip_fragment(const char *raw_uri) { } } // namespace -Request::Request(const std::string &uri, const http_parser_url &u, - const nghttp2_data_provider *data_prd, int64_t data_length, - const nghttp2_priority_spec &pri_spec, int level) - : uri(uri), - u(u), - pri_spec(pri_spec), - data_length(data_length), - data_offset(0), - response_len(0), - inflater(nullptr), - data_prd(data_prd), - header_buffer_size(0), - stream_id(-1), - status(0), - level(level), - expect_final_response(false) { +Request::Request(const std::string &uri, const urlparse_url &u, + const nghttp2_data_provider2 *data_prd, int64_t data_length, + const nghttp2_extpri &extpri, int level) + : uri(uri), + u(u), + extpri(extpri), + data_length(data_length), + data_offset(0), + response_len(0), + inflater(nullptr), + data_prd(data_prd), + header_buffer_size(0), + stream_id(-1), + status(0), + level(level), + expect_final_response(false) { http2::init_hdidx(res_hdidx); http2::init_hdidx(req_hdidx); } @@ -188,22 +161,23 @@ void Request::init_inflater() { StringRef Request::get_real_scheme() const { return config.scheme_override.empty() - ? util::get_uri_field(uri.c_str(), u, UF_SCHEMA) - : StringRef{config.scheme_override}; + ? util::get_uri_field(uri.c_str(), u, URLPARSE_SCHEMA) + : StringRef{config.scheme_override}; } StringRef Request::get_real_host() const { return config.host_override.empty() - ? util::get_uri_field(uri.c_str(), u, UF_HOST) - : StringRef{config.host_override}; + ? util::get_uri_field(uri.c_str(), u, URLPARSE_HOST) + : StringRef{config.host_override}; } uint16_t Request::get_real_port() const { auto scheme = get_real_scheme(); - return config.host_override.empty() ? util::has_uri_field(u, UF_PORT) ? u.port - : scheme == "https" ? 443 - : 80 - : config.port_override == 0 ? scheme == "https" ? 443 : 80 + return config.host_override.empty() ? util::has_uri_field(u, URLPARSE_PORT) + ? u.port + : scheme == "https"_sr ? 443 + : 80 + : config.port_override == 0 ? scheme == "https"_sr ? 443 : 80 : config.port_override; } @@ -213,9 +187,9 @@ void Request::init_html_parser() { auto host = get_real_host(); auto port = get_real_port(); auto ipv6_lit = - std::find(std::begin(host), std::end(host), ':') != std::end(host); + std::find(std::begin(host), std::end(host), ':') != std::end(host); - auto base_uri = scheme.str(); + auto base_uri = std::string{scheme}; base_uri += "://"; if (ipv6_lit) { base_uri += '['; @@ -224,15 +198,15 @@ void Request::init_html_parser() { if (ipv6_lit) { base_uri += ']'; } - if (!((scheme == "https" && port == 443) || - (scheme == "http" && port == 80))) { + if (!((scheme == "https"_sr && port == 443) || + (scheme == "http"_sr && port == 80))) { base_uri += ':'; base_uri += util::utos(port); } - base_uri += util::get_uri_field(uri.c_str(), u, UF_PATH); - if (util::has_uri_field(u, UF_QUERY)) { + base_uri += util::get_uri_field(uri.c_str(), u, URLPARSE_PATH); + if (util::has_uri_field(u, URLPARSE_QUERY)) { base_uri += '?'; - base_uri += util::get_uri_field(uri.c_str(), u, UF_QUERY); + base_uri += util::get_uri_field(uri.c_str(), u, URLPARSE_QUERY); } html_parser = std::make_unique(base_uri); @@ -247,13 +221,14 @@ int Request::update_html_parser(const uint8_t *data, size_t len, int fin) { } std::string Request::make_reqpath() const { - std::string path = util::has_uri_field(u, UF_PATH) - ? util::get_uri_field(uri.c_str(), u, UF_PATH).str() - : "/"; - if (util::has_uri_field(u, UF_QUERY)) { + auto path = + util::has_uri_field(u, URLPARSE_PATH) + ? std::string{util::get_uri_field(uri.c_str(), u, URLPARSE_PATH)} + : "/"s; + if (util::has_uri_field(u, URLPARSE_QUERY)) { path += '?'; - path.append(uri.c_str() + u.field_data[UF_QUERY].off, - u.field_data[UF_QUERY].len); + path.append(uri.c_str() + u.field_data[URLPARSE_QUERY].off, + u.field_data[URLPARSE_QUERY].len); } return path; } @@ -265,22 +240,22 @@ std::string decode_host(const StringRef &host) { auto zone_start = std::find(std::begin(host), std::end(host), '%'); if (zone_start == std::end(host) || !util::ipv6_numeric_addr( - std::string(std::begin(host), zone_start).c_str())) { - return host.str(); + std::string(std::begin(host), zone_start).c_str())) { + return std::string{host}; } // case: ::1% if (zone_start + 1 == std::end(host)) { - return StringRef{host.c_str(), host.size() - 1}.str(); + return {host.data(), host.size() - 1}; } // case: ::1%12 or ::1%1 if (zone_start + 3 >= std::end(host)) { - return host.str(); + return std::string{host}; } // If we see "%25", followed by more characters, then decode %25 as // '%'. auto zone_id_src = (*(zone_start + 1) == '2' && *(zone_start + 2) == '5') - ? zone_start + 3 - : zone_start + 1; + ? zone_start + 3 + : zone_start + 1; auto zone_id = util::percent_decode(zone_id_src, std::end(host)); auto res = std::string(std::begin(host), zone_start + 1); res += zone_id; @@ -289,45 +264,34 @@ std::string decode_host(const StringRef &host) { } // namespace namespace { -nghttp2_priority_spec resolve_dep(int res_type) { - nghttp2_priority_spec pri_spec; - - if (config.no_dep) { - nghttp2_priority_spec_default_init(&pri_spec); - - return pri_spec; - } - - int32_t anchor_id; - int32_t weight; +nghttp2_extpri resolve_pri(int res_type) { switch (res_type) { case REQ_CSS: case REQ_JS: - anchor_id = anchors[ANCHOR_LEADERS].stream_id; - weight = 32; - break; + return { + .urgency = 0, + }; case REQ_UNBLOCK_JS: - anchor_id = anchors[ANCHOR_UNBLOCKED].stream_id; - weight = 32; - break; + return { + .urgency = 1, + }; case REQ_IMG: - anchor_id = anchors[ANCHOR_FOLLOWERS].stream_id; - weight = 12; - break; + return { + .urgency = NGHTTP2_EXTPRI_DEFAULT_URGENCY, + .inc = 1, + }; default: - anchor_id = anchors[ANCHOR_FOLLOWERS].stream_id; - weight = 32; + return { + .urgency = NGHTTP2_EXTPRI_DEFAULT_URGENCY, + }; } - - nghttp2_priority_spec_init(&pri_spec, anchor_id, weight, 0); - return pri_spec; } } // namespace bool Request::is_ipv6_literal_addr() const { - if (util::has_uri_field(u, UF_HOST)) { - return memchr(uri.c_str() + u.field_data[UF_HOST].off, ':', - u.field_data[UF_HOST].len); + if (util::has_uri_field(u, URLPARSE_HOST)) { + return memchr(uri.c_str() + u.field_data[URLPARSE_HOST].off, ':', + u.field_data[URLPARSE_HOST].len); } else { return false; } @@ -370,11 +334,11 @@ void continue_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { auto req = static_cast(w->data); int error; - error = nghttp2_submit_data(client->session, NGHTTP2_FLAG_END_STREAM, - req->stream_id, req->data_prd); + error = nghttp2_submit_data2(client->session, NGHTTP2_FLAG_END_STREAM, + req->stream_id, req->data_prd); if (error) { - std::cerr << "[ERROR] nghttp2_submit_data() returned error: " + std::cerr << "[ERROR] nghttp2_submit_data2() returned error: " << nghttp2_strerror(error) << std::endl; nghttp2_submit_rst_stream(client->session, NGHTTP2_FLAG_NONE, req->stream_id, NGHTTP2_INTERNAL_ERROR); @@ -423,39 +387,40 @@ int htp_msg_completecb(llhttp_t *htp) { namespace { constexpr llhttp_settings_t htp_hooks = { - htp_msg_begincb, // llhttp_cb on_message_begin; - nullptr, // llhttp_data_cb on_url; - nullptr, // llhttp_data_cb on_status; - nullptr, // llhttp_data_cb on_method; - nullptr, // llhttp_data_cb on_version; - nullptr, // llhttp_data_cb on_header_field; - nullptr, // llhttp_data_cb on_header_value; - nullptr, // llhttp_data_cb on_chunk_extension_name; - nullptr, // llhttp_data_cb on_chunk_extension_value; - nullptr, // llhttp_cb on_headers_complete; - nullptr, // llhttp_data_cb on_body; - htp_msg_completecb, // llhttp_cb on_message_complete; - nullptr, // llhttp_cb on_url_complete; - nullptr, // llhttp_cb on_status_complete; - nullptr, // llhttp_cb on_method_complete; - nullptr, // llhttp_cb on_version_complete; - nullptr, // llhttp_cb on_header_field_complete; - nullptr, // llhttp_cb on_header_value_complete; - nullptr, // llhttp_cb on_chunk_extension_name_complete; - nullptr, // llhttp_cb on_chunk_extension_value_complete; - nullptr, // llhttp_cb on_chunk_header; - nullptr, // llhttp_cb on_chunk_complete; - nullptr, // llhttp_cb on_reset; + htp_msg_begincb, // llhttp_cb on_message_begin; + nullptr, // llhttp_data_cb on_url; + nullptr, // llhttp_data_cb on_status; + nullptr, // llhttp_data_cb on_method; + nullptr, // llhttp_data_cb on_version; + nullptr, // llhttp_data_cb on_header_field; + nullptr, // llhttp_data_cb on_header_value; + nullptr, // llhttp_data_cb on_chunk_extension_name; + nullptr, // llhttp_data_cb on_chunk_extension_value; + nullptr, // llhttp_cb on_headers_complete; + nullptr, // llhttp_data_cb on_body; + htp_msg_completecb, // llhttp_cb on_message_complete; + nullptr, // llhttp_cb on_url_complete; + nullptr, // llhttp_cb on_status_complete; + nullptr, // llhttp_cb on_method_complete; + nullptr, // llhttp_cb on_version_complete; + nullptr, // llhttp_cb on_header_field_complete; + nullptr, // llhttp_cb on_header_value_complete; + nullptr, // llhttp_cb on_chunk_extension_name_complete; + nullptr, // llhttp_cb on_chunk_extension_value_complete; + nullptr, // llhttp_cb on_chunk_header; + nullptr, // llhttp_cb on_chunk_complete; + nullptr, // llhttp_cb on_reset; }; } // namespace namespace { int submit_request(HttpClient *client, const Headers &headers, Request *req) { - auto scheme = util::get_uri_field(req->uri.c_str(), req->u, UF_SCHEMA); + auto scheme = util::get_uri_field(req->uri.c_str(), req->u, URLPARSE_SCHEMA); auto build_headers = Headers{{":method", req->data_prd ? "POST" : "GET"}, {":path", req->make_reqpath()}, - {":scheme", scheme.str()}, + {":scheme", std::string{scheme}}, {":authority", client->hostport}, + {"priority", http2::encode_extpri(req->extpri)}, {"accept", "*/*"}, {"accept-encoding", "gzip, deflate"}, {"user-agent", "nghttp2/" NGHTTP2_VERSION}}; @@ -500,7 +465,8 @@ int submit_request(HttpClient *client, const Headers &headers, Request *req) { nva.reserve(build_headers.size()); for (auto &kv : build_headers) { - nva.push_back(http2::make_nv(kv.name, kv.value, kv.no_index)); + nva.push_back( + http2::make_field_nv(kv.name, kv.value, http2::no_index(kv.no_index))); } auto method = http2::get_header(build_headers, ":method"); @@ -515,23 +481,22 @@ int submit_request(HttpClient *client, const Headers &headers, Request *req) { trailer_names += ", "; trailer_names += config.trailer[i].name; } - nva.push_back(http2::make_nv_ls("trailer", trailer_names)); + nva.push_back(http2::make_field_v("trailer"_sr, trailer_names)); } int32_t stream_id; if (expect_continue) { - stream_id = nghttp2_submit_headers(client->session, 0, -1, &req->pri_spec, + stream_id = nghttp2_submit_headers(client->session, 0, -1, nullptr, nva.data(), nva.size(), req); } else { - stream_id = - nghttp2_submit_request(client->session, &req->pri_spec, nva.data(), - nva.size(), req->data_prd, req); + stream_id = nghttp2_submit_request2(client->session, nullptr, nva.data(), + nva.size(), req->data_prd, req); } if (stream_id < 0) { std::cerr << "[ERROR] nghttp2_submit_" - << (expect_continue ? "headers" : "request") + << (expect_continue ? "headers" : "request2") << "() returned error: " << nghttp2_strerror(stream_id) << std::endl; return -1; @@ -595,22 +560,22 @@ void settings_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { HttpClient::HttpClient(const nghttp2_session_callbacks *callbacks, struct ev_loop *loop, SSL_CTX *ssl_ctx) - : wb(&mcpool), - session(nullptr), - callbacks(callbacks), - loop(loop), - ssl_ctx(ssl_ctx), - ssl(nullptr), - addrs(nullptr), - next_addr(nullptr), - cur_addr(nullptr), - complete(0), - success(0), - settings_payloadlen(0), - state(ClientState::IDLE), - upgrade_response_status_code(0), - fd(-1), - upgrade_response_complete(false) { + : wb(&mcpool), + session(nullptr), + callbacks(callbacks), + loop(loop), + ssl_ctx(ssl_ctx), + ssl(nullptr), + addrs(nullptr), + next_addr(nullptr), + cur_addr(nullptr), + complete(0), + success(0), + settings_payloadlen(0), + state(ClientState::IDLE), + upgrade_response_status_code(0), + fd(-1), + upgrade_response_complete(false) { ev_io_init(&wev, writecb, 0, EV_WRITE); ev_io_init(&rev, readcb, 0, EV_READ); @@ -695,18 +660,12 @@ int HttpClient::initiate_connection() { // If the user overrode the :authority or host header, use that // value for the SNI extension const auto &host_string = - config.host_override.empty() ? host : config.host_override; + config.host_override.empty() ? host : config.host_override; -#if LIBRESSL_2_7_API || \ - (!LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L) || \ - defined(NGHTTP2_OPENSSL_IS_BORINGSSL) auto param = SSL_get0_param(ssl); X509_VERIFY_PARAM_set_hostflags(param, 0); X509_VERIFY_PARAM_set1_host(param, host_string.c_str(), host_string.size()); -#endif // LIBRESSL_2_7_API || (!LIBRESSL_IN_USE && - // OPENSSL_VERSION_NUMBER >= 0x10002000L) || - // defined(NGHTTP2_OPENSSL_IS_BORINGSSL) SSL_set_verify(ssl, SSL_VERIFY_PEER, verify_cb); if (!util::numeric_host(host_string.c_str())) { @@ -918,7 +877,7 @@ int HttpClient::connected() { namespace { size_t populate_settings(nghttp2_settings_entry *iv) { - size_t niv = 2; + size_t niv = 3; iv[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; iv[0].value = config.max_concurrent_streams; @@ -930,6 +889,9 @@ size_t populate_settings(nghttp2_settings_entry *iv) { iv[1].value = NGHTTP2_INITIAL_WINDOW_SIZE; } + iv[2].settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; + iv[2].value = 1; + if (config.header_table_size >= 0) { if (config.min_header_table_size < config.header_table_size) { iv[niv].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; @@ -948,32 +910,26 @@ size_t populate_settings(nghttp2_settings_entry *iv) { ++niv; } - if (config.no_rfc7540_pri) { - iv[niv].settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; - iv[niv].value = 1; - ++niv; - } - return niv; } } // namespace int HttpClient::on_upgrade_connect() { - ssize_t rv; + nghttp2_ssize rv; record_connect_end_time(); assert(!reqvec.empty()); std::array iv; size_t niv = populate_settings(iv.data()); assert(settings_payload.size() >= 8 * niv); - rv = nghttp2_pack_settings_payload(settings_payload.data(), - settings_payload.size(), iv.data(), niv); + rv = nghttp2_pack_settings_payload2(settings_payload.data(), + settings_payload.size(), iv.data(), niv); if (rv < 0) { return -1; } settings_payloadlen = rv; auto token68 = - base64::encode(std::begin(settings_payload), - std::begin(settings_payload) + settings_payloadlen); + base64::encode(std::begin(settings_payload), + std::begin(settings_payload) + settings_payloadlen); util::to_token68(token68); std::string req; @@ -981,9 +937,9 @@ int HttpClient::on_upgrade_connect() { // If the request contains upload data, use OPTIONS * to upgrade req = "OPTIONS *"; } else { - auto meth = std::find_if( - std::begin(config.headers), std::end(config.headers), - [](const Header &kv) { return util::streq_l(":method", kv.name); }); + auto meth = + std::find_if(std::begin(config.headers), std::end(config.headers), + [](const auto &kv) { return ":method"_sr == kv.name; }); if (meth == std::end(config.headers)) { req = "GET "; @@ -999,11 +955,16 @@ int HttpClient::on_upgrade_connect() { auto headers = Headers{{"host", hostport}, {"connection", "Upgrade, HTTP2-Settings"}, {"upgrade", NGHTTP2_CLEARTEXT_PROTO_VERSION_ID}, - {"http2-settings", token68}, + {"http2-settings", std::move(token68)}, {"accept", "*/*"}, {"user-agent", "nghttp2/" NGHTTP2_VERSION}}; auto initial_headerslen = headers.size(); + if (!reqvec[0]->data_prd) { + headers.emplace_back("priority", http2::encode_extpri(reqvec[0]->extpri)); + ++initial_headerslen; + } + for (auto &kv : config.headers) { size_t i; if (kv.name.empty() || kv.name[0] == ':') { @@ -1055,12 +1016,12 @@ int HttpClient::on_upgrade_read(const uint8_t *data, size_t len) { int rv; auto htperr = - llhttp_execute(htp.get(), reinterpret_cast(data), len); + llhttp_execute(htp.get(), reinterpret_cast(data), len); auto nread = htperr == HPE_OK - ? len - : static_cast(reinterpret_cast( - llhttp_get_error_pos(htp.get())) - - data); + ? len + : static_cast(reinterpret_cast( + llhttp_get_error_pos(htp.get())) - + data); if (config.verbose) { std::cout.write(reinterpret_cast(data), nread); @@ -1121,28 +1082,19 @@ int HttpClient::connection_made() { } if (ssl) { - // Check NPN or ALPN result + // Check ALPN result const unsigned char *next_proto = nullptr; unsigned int next_proto_len; -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_get0_next_proto_negotiated(ssl, &next_proto, &next_proto_len); -#endif // !OPENSSL_NO_NEXTPROTONEG - for (int i = 0; i < 2; ++i) { - if (next_proto) { - auto proto = StringRef{next_proto, next_proto_len}; - if (config.verbose) { - std::cout << "The negotiated protocol: " << proto << std::endl; - } - if (!util::check_h2_is_selected(proto)) { - next_proto = nullptr; - } - break; + + SSL_get0_alpn_selected(ssl, &next_proto, &next_proto_len); + if (next_proto) { + auto proto = StringRef{next_proto, next_proto_len}; + if (config.verbose) { + std::cout << "The negotiated protocol: " << proto << std::endl; + } + if (!util::check_h2_is_selected(proto)) { + next_proto = nullptr; } -#if OPENSSL_VERSION_NUMBER >= 0x10002000L - SSL_get0_alpn_selected(ssl, &next_proto, &next_proto_len); -#else // OPENSSL_VERSION_NUMBER < 0x10002000L - break; -#endif // OPENSSL_VERSION_NUMBER < 0x10002000L } if (!next_proto) { print_protocol_nego_error(); @@ -1150,8 +1102,8 @@ int HttpClient::connection_made() { } } - rv = nghttp2_session_client_new2(&session, callbacks, this, - config.http2_option); + rv = + nghttp2_session_client_new2(&session, callbacks, this, config.http2_option); if (rv != 0) { return -1; @@ -1190,51 +1142,6 @@ int HttpClient::connection_made() { return -1; } } - if (!config.no_dep) { - // Create anchor stream nodes - nghttp2_priority_spec pri_spec; - - for (auto &anchor : anchors) { - nghttp2_priority_spec_init(&pri_spec, anchor.dep_stream_id, anchor.weight, - 0); - rv = nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, anchor.stream_id, - &pri_spec); - if (rv != 0) { - return -1; - } - } - - rv = nghttp2_session_set_next_stream_id( - session, anchors[ANCHOR_FOLLOWERS].stream_id + 2); - if (rv != 0) { - return -1; - } - - if (need_upgrade() && !reqvec[0]->data_prd) { - // Amend the priority because we cannot send priority in - // HTTP/1.1 Upgrade. - auto &anchor = anchors[ANCHOR_FOLLOWERS]; - nghttp2_priority_spec_init(&pri_spec, anchor.stream_id, - reqvec[0]->pri_spec.weight, 0); - - rv = nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 1, &pri_spec); - if (rv != 0) { - return -1; - } - } - } else if (need_upgrade() && !reqvec[0]->data_prd && - reqvec[0]->pri_spec.weight != NGHTTP2_DEFAULT_WEIGHT) { - // Amend the priority because we cannot send priority in HTTP/1.1 - // Upgrade. - nghttp2_priority_spec pri_spec; - - nghttp2_priority_spec_init(&pri_spec, 0, reqvec[0]->pri_spec.weight, 0); - - rv = nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 1, &pri_spec); - if (rv != 0) { - return -1; - } - } ev_timer_again(loop, &settings_timer); @@ -1265,9 +1172,9 @@ int HttpClient::on_read(const uint8_t *data, size_t len) { util::hexdump(stdout, data, len); } - auto rv = nghttp2_session_mem_recv(session, data, len); + auto rv = nghttp2_session_mem_recv2(session, data, len); if (rv < 0) { - std::cerr << "[ERROR] nghttp2_session_mem_recv() returned error: " + std::cerr << "[ERROR] nghttp2_session_mem_recv2() returned error: " << nghttp2_strerror(rv) << std::endl; return -1; } @@ -1291,9 +1198,9 @@ int HttpClient::on_write() { } const uint8_t *data; - auto len = nghttp2_session_mem_send(session, &data); + auto len = nghttp2_session_mem_send2(session, &data); if (len < 0) { - std::cerr << "[ERROR] nghttp2_session_send() returned error: " + std::cerr << "[ERROR] nghttp2_session_send2() returned error: " << nghttp2_strerror(len) << std::endl; return -1; } @@ -1439,36 +1346,37 @@ void HttpClient::update_hostport() { if (reqvec.empty()) { return; } - scheme = util::get_uri_field(reqvec[0]->uri.c_str(), reqvec[0]->u, UF_SCHEMA) - .str(); + scheme = + util::get_uri_field(reqvec[0]->uri.c_str(), reqvec[0]->u, URLPARSE_SCHEMA); std::stringstream ss; if (reqvec[0]->is_ipv6_literal_addr()) { // we may have zone ID, which must start with "%25", or "%". RFC // 6874 defines "%25" only, and just "%" is allowed for just // convenience to end-user input. auto host = - util::get_uri_field(reqvec[0]->uri.c_str(), reqvec[0]->u, UF_HOST); + util::get_uri_field(reqvec[0]->uri.c_str(), reqvec[0]->u, URLPARSE_HOST); auto end = std::find(std::begin(host), std::end(host), '%'); ss << "["; - ss.write(host.c_str(), end - std::begin(host)); + ss.write(host.data(), end - std::begin(host)); ss << "]"; } else { - util::write_uri_field(ss, reqvec[0]->uri.c_str(), reqvec[0]->u, UF_HOST); + util::write_uri_field(ss, reqvec[0]->uri.c_str(), reqvec[0]->u, + URLPARSE_HOST); } - if (util::has_uri_field(reqvec[0]->u, UF_PORT) && + if (util::has_uri_field(reqvec[0]->u, URLPARSE_PORT) && reqvec[0]->u.port != - util::get_default_port(reqvec[0]->uri.c_str(), reqvec[0]->u)) { + util::get_default_port(reqvec[0]->uri.c_str(), reqvec[0]->u)) { ss << ":" << reqvec[0]->u.port; } hostport = ss.str(); } bool HttpClient::add_request(const std::string &uri, - const nghttp2_data_provider *data_prd, - int64_t data_length, - const nghttp2_priority_spec &pri_spec, int level) { - http_parser_url u{}; - if (http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { + const nghttp2_data_provider2 *data_prd, + int64_t data_length, const nghttp2_extpri &extpri, + int level) { + urlparse_url u; + if (urlparse_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { return false; } if (path_cache.count(uri)) { @@ -1479,8 +1387,8 @@ bool HttpClient::add_request(const std::string &uri, path_cache.insert(uri); } - reqvec.push_back(std::make_unique(uri, u, data_prd, data_length, - pri_spec, level)); + reqvec.push_back( + std::make_unique(uri, u, data_prd, data_length, extpri, level)); return true; } @@ -1525,8 +1433,8 @@ void HttpClient::output_har(FILE *outfile) { json_array_append_new(pages, page); json_object_set_new( - page, "startedDateTime", - json_string(util::format_iso8601(timing.system_start_time).c_str())); + page, "startedDateTime", + json_string(util::format_iso8601(timing.system_start_time).c_str())); json_object_set_new(page, "id", json_string(PAGE_ID)); json_object_set_new(page, "title", json_string("")); @@ -1536,14 +1444,14 @@ void HttpClient::output_har(FILE *outfile) { json_object_set_new(log, "entries", entries); auto dns_delta = std::chrono::duration_cast( - timing.domain_lookup_end_time - timing.start_time) - .count() / + timing.domain_lookup_end_time - timing.start_time) + .count() / 1000.0; auto connect_delta = - std::chrono::duration_cast( - timing.connect_end_time - timing.domain_lookup_end_time) - .count() / - 1000.0; + std::chrono::duration_cast( + timing.connect_end_time - timing.domain_lookup_end_time) + .count() / + 1000.0; for (size_t i = 0; i < reqvec.size(); ++i) { auto &req = reqvec[i]; @@ -1557,34 +1465,34 @@ void HttpClient::output_har(FILE *outfile) { auto &req_timing = req->timing; auto request_time = - (i == 0) ? timing.system_start_time - : timing.system_start_time + - std::chrono::duration_cast< - std::chrono::system_clock::duration>( - req_timing.request_start_time - timing.start_time); + (i == 0) + ? timing.system_start_time + : timing.system_start_time + + std::chrono::duration_cast( + req_timing.request_start_time - timing.start_time); auto wait_delta = - std::chrono::duration_cast( - req_timing.response_start_time - req_timing.request_start_time) - .count() / - 1000.0; + std::chrono::duration_cast( + req_timing.response_start_time - req_timing.request_start_time) + .count() / + 1000.0; auto receive_delta = - std::chrono::duration_cast( - req_timing.response_end_time - req_timing.response_start_time) - .count() / - 1000.0; + std::chrono::duration_cast( + req_timing.response_end_time - req_timing.response_start_time) + .count() / + 1000.0; auto time_sum = - std::chrono::duration_cast( - (i == 0) ? (req_timing.response_end_time - timing.start_time) - : (req_timing.response_end_time - - req_timing.request_start_time)) - .count() / - 1000.0; + std::chrono::duration_cast( + (i == 0) + ? (req_timing.response_end_time - timing.start_time) + : (req_timing.response_end_time - req_timing.request_start_time)) + .count() / + 1000.0; json_object_set_new( - entry, "startedDateTime", - json_string(util::format_iso8601(request_time).c_str())); + entry, "startedDateTime", + json_string(util::format_iso8601(request_time).c_str())); json_object_set_new(entry, "time", json_real(time_sum)); auto pushed = req->stream_id % 2 == 0; @@ -1692,28 +1600,28 @@ void update_html_parser(HttpClient *client, Request *req, const uint8_t *data, auto uri = strip_fragment(p.first.c_str()); auto res_type = p.second; - http_parser_url u{}; - if (http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { + urlparse_url u; + if (urlparse_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { continue; } - if (!util::fieldeq(uri.c_str(), u, UF_SCHEMA, scheme) || - !util::fieldeq(uri.c_str(), u, UF_HOST, host)) { + if (!util::fieldeq(uri.c_str(), u, URLPARSE_SCHEMA, scheme) || + !util::fieldeq(uri.c_str(), u, URLPARSE_HOST, host)) { continue; } - auto link_port = util::has_uri_field(u, UF_PORT) ? u.port - : scheme == "https" ? 443 - : 80; + auto link_port = util::has_uri_field(u, URLPARSE_PORT) ? u.port + : scheme == "https"_sr ? 443 + : 80; if (port != link_port) { continue; } // No POST data for assets - auto pri_spec = resolve_dep(res_type); + auto extpri = resolve_pri(res_type); - if (client->add_request(uri, nullptr, 0, pri_spec, req->level + 1)) { + if (client->add_request(uri, nullptr, 0, extpri, req->level + 1)) { submit_request(client, config.headers, client->reqvec.back().get()); } } @@ -1733,7 +1641,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags, size_t len, void *user_data) { auto client = get_client(user_data); auto req = static_cast( - nghttp2_session_get_stream_user_data(session, stream_id)); + nghttp2_session_get_stream_user_data(session, stream_id)); if (!req) { return 0; @@ -1753,7 +1661,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags, size_t outlen = MAX_OUTLEN; size_t tlen = len; int rv = - nghttp2_gzip_inflate(req->inflater, out.data(), &outlen, data, &tlen); + nghttp2_gzip_inflate(req->inflater, out.data(), &outlen, data, &tlen); if (rv != 0) { nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, stream_id, NGHTTP2_INTERNAL_ERROR); @@ -1783,9 +1691,9 @@ int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags, } // namespace namespace { -ssize_t select_padding_callback(nghttp2_session *session, - const nghttp2_frame *frame, size_t max_payload, - void *user_data) { +nghttp2_ssize select_padding_callback(nghttp2_session *session, + const nghttp2_frame *frame, + size_t max_payload, void *user_data) { return std::min(max_payload, frame->hd.length + config.padding); } } // namespace @@ -1815,8 +1723,8 @@ void check_response_header(nghttp2_session *session, Request *req) { for (auto &nv : req->res_nva) { if ("content-encoding" == nv.name) { - gzip = util::strieq_l("gzip", nv.value) || - util::strieq_l("deflate", nv.value); + gzip = util::strieq("gzip"_sr, nv.value) || + util::strieq("deflate"_sr, nv.value); continue; } } @@ -1857,7 +1765,7 @@ int on_begin_headers_callback(nghttp2_session *session, switch (frame->hd.type) { case NGHTTP2_HEADERS: { auto req = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!req) { break; } @@ -1875,13 +1783,12 @@ int on_begin_headers_callback(nghttp2_session *session, } case NGHTTP2_PUSH_PROMISE: { auto stream_id = frame->push_promise.promised_stream_id; - http_parser_url u{}; - // TODO Set pri and level - nghttp2_priority_spec pri_spec; - - nghttp2_priority_spec_default_init(&pri_spec); + urlparse_url u{}; + nghttp2_extpri extpri{ + .urgency = NGHTTP2_EXTPRI_DEFAULT_URGENCY, + }; - auto req = std::make_unique("", u, nullptr, 0, pri_spec); + auto req = std::make_unique("", u, nullptr, 0, extpri); req->stream_id = stream_id; nghttp2_session_set_stream_user_data(session, stream_id, req.get()); @@ -1910,7 +1817,7 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame, switch (frame->hd.type) { case NGHTTP2_HEADERS: { auto req = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!req) { break; @@ -1930,16 +1837,18 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame, req->header_buffer_size += namelen + valuelen; - auto token = http2::lookup_token(name, namelen); + auto nameref = StringRef{name, namelen}; + auto valueref = StringRef{value, valuelen}; + auto token = http2::lookup_token(nameref); http2::index_header(req->res_hdidx, token, req->res_nva.size()); - http2::add_header(req->res_nva, name, namelen, value, valuelen, + http2::add_header(req->res_nva, nameref, valueref, flags & NGHTTP2_NV_FLAG_NO_INDEX, token); break; } case NGHTTP2_PUSH_PROMISE: { auto req = static_cast(nghttp2_session_get_stream_user_data( - session, frame->push_promise.promised_stream_id)); + session, frame->push_promise.promised_stream_id)); if (!req) { break; @@ -1954,10 +1863,12 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame, req->header_buffer_size += namelen + valuelen; - auto token = http2::lookup_token(name, namelen); + auto nameref = StringRef{name, namelen}; + auto valueref = StringRef{value, valuelen}; + auto token = http2::lookup_token(nameref); http2::index_header(req->req_hdidx, token, req->req_nva.size()); - http2::add_header(req->req_nva, name, namelen, value, valuelen, + http2::add_header(req->req_nva, nameref, valueref, flags & NGHTTP2_NV_FLAG_NO_INDEX, token); break; } @@ -1979,7 +1890,7 @@ int on_frame_recv_callback2(nghttp2_session *session, switch (frame->hd.type) { case NGHTTP2_DATA: { auto req = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!req) { return 0; ; @@ -1994,7 +1905,7 @@ int on_frame_recv_callback2(nghttp2_session *session, } case NGHTTP2_HEADERS: { auto req = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); // If this is the HTTP Upgrade with OPTIONS method to avoid POST, // req is nullptr. if (!req) { @@ -2037,7 +1948,7 @@ int on_frame_recv_callback2(nghttp2_session *session, break; case NGHTTP2_PUSH_PROMISE: { auto req = static_cast(nghttp2_session_get_stream_user_data( - session, frame->push_promise.promised_stream_id)); + session, frame->push_promise.promised_stream_id)); if (!req) { break; } @@ -2065,8 +1976,8 @@ int on_frame_recv_callback2(nghttp2_session *session, uri += "://"; uri += authority->value; uri += path->value; - http_parser_url u{}; - if (http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { + urlparse_url u; + if (urlparse_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, frame->push_promise.promised_stream_id, NGHTTP2_PROTOCOL_ERROR); @@ -2083,7 +1994,7 @@ int on_frame_recv_callback2(nghttp2_session *session, } if (config.multiply == 1) { - client->path_cache.insert(uri); + client->path_cache.emplace(std::move(uri)); } break; @@ -2101,7 +2012,7 @@ int before_frame_send_callback(nghttp2_session *session, return 0; } auto req = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); assert(req); req->record_request_start_time(); return 0; @@ -2122,7 +2033,7 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, } auto req = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!req) { return 0; } @@ -2146,7 +2057,7 @@ int on_frame_not_send_callback(nghttp2_session *session, } auto req = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!req) { return 0; } @@ -2163,7 +2074,7 @@ int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, uint32_t error_code, void *user_data) { auto client = get_client(user_data); auto req = static_cast( - nghttp2_session_get_stream_user_data(session, stream_id)); + nghttp2_session_get_stream_user_data(session, stream_id)); if (!req) { return 0; @@ -2233,11 +2144,11 @@ id responseEnd requestStart process code size request path)" const auto &base = client.timing.connect_end_time; for (const auto &req : reqs) { auto response_end = std::chrono::duration_cast( - req->timing.response_end_time - base); + req->timing.response_end_time - base); auto request_start = std::chrono::duration_cast( - req->timing.request_start_time - base); + req->timing.request_start_time - base); auto total = std::chrono::duration_cast( - req->timing.response_end_time - req->timing.request_start_time); + req->timing.response_end_time - req->timing.request_start_time); auto pushed = req->stream_id % 2 == 0; std::cout << std::setw(3) << req->stream_id << " " << std::setw(11) @@ -2252,39 +2163,13 @@ id responseEnd requestStart process code size request path)" } } // namespace -#ifndef OPENSSL_NO_NEXTPROTONEG -namespace { -int client_select_next_proto_cb(SSL *ssl, unsigned char **out, - unsigned char *outlen, const unsigned char *in, - unsigned int inlen, void *arg) { - if (config.verbose) { - print_timer(); - std::cout << "[NPN] server offers:" << std::endl; - } - for (unsigned int i = 0; i < inlen; i += in[i] + 1) { - if (config.verbose) { - std::cout << " * "; - std::cout.write(reinterpret_cast(&in[i + 1]), in[i]); - std::cout << std::endl; - } - } - if (!util::select_h2(const_cast(out), outlen, in, - inlen)) { - print_protocol_nego_error(); - return SSL_TLSEXT_ERR_NOACK; - } - return SSL_TLSEXT_ERR_OK; -} -} // namespace -#endif // !OPENSSL_NO_NEXTPROTONEG - namespace { int communicate( - const std::string &scheme, const std::string &host, uint16_t port, - std::vector< - std::tuple> - requests, - const nghttp2_session_callbacks *callbacks) { + const std::string &scheme, const std::string &host, uint16_t port, + std::vector< + std::tuple> + requests, + const nghttp2_session_callbacks *callbacks) { int result = 0; auto loop = EV_DEFAULT; SSL_CTX *ssl_ctx = nullptr; @@ -2317,19 +2202,31 @@ int communicate( } if (nghttp2::tls::ssl_ctx_set_proto_versions( - ssl_ctx, nghttp2::tls::NGHTTP2_TLS_MIN_VERSION, - nghttp2::tls::NGHTTP2_TLS_MAX_VERSION) != 0) { + ssl_ctx, nghttp2::tls::NGHTTP2_TLS_MIN_VERSION, + nghttp2::tls::NGHTTP2_TLS_MAX_VERSION) != 0) { std::cerr << "[ERROR] Could not set TLS versions" << std::endl; result = -1; goto fin; } - if (SSL_CTX_set_cipher_list(ssl_ctx, tls::DEFAULT_CIPHER_LIST) == 0) { + if (SSL_CTX_set_cipher_list(ssl_ctx, tls::DEFAULT_CIPHER_LIST.data()) == + 0) { std::cerr << "[ERROR] " << ERR_error_string(ERR_get_error(), nullptr) << std::endl; result = -1; goto fin; } + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL + if (SSL_CTX_set_ciphersuites(ssl_ctx, + tls::DEFAULT_TLS13_CIPHER_LIST.data()) == 0) { + std::cerr << "[ERROR] " << ERR_error_string(ERR_get_error(), nullptr) + << std::endl; + result = -1; + goto fin; + } +#endif // NGHTTP2_OPENSSL_IS_WOLFSSL + if (!config.keyfile.empty()) { if (SSL_CTX_use_PrivateKey_file(ssl_ctx, config.keyfile.c_str(), SSL_FILETYPE_PEM) != 1) { @@ -2348,34 +2245,37 @@ int communicate( goto fin; } } -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_CTX_set_next_proto_select_cb(ssl_ctx, client_select_next_proto_cb, - nullptr); -#endif // !OPENSSL_NO_NEXTPROTONEG -#if OPENSSL_VERSION_NUMBER >= 0x10002000L auto proto_list = util::get_default_alpn(); SSL_CTX_set_alpn_protos(ssl_ctx, proto_list.data(), proto_list.size()); -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L - } - { - HttpClient client{callbacks, loop, ssl_ctx}; - - int32_t dep_stream_id = 0; - if (!config.no_dep) { - dep_stream_id = anchors[ANCHOR_FOLLOWERS].stream_id; +#if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI) + if (!SSL_CTX_add_cert_compression_alg( + ssl_ctx, nghttp2::tls::CERTIFICATE_COMPRESSION_ALGO_BROTLI, + nghttp2::tls::cert_compress, nghttp2::tls::cert_decompress)) { + std::cerr << "[ERROR] SSL_CTX_add_cert_compression_alg failed." + << std::endl; + result = -1; + goto fin; } +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI - for (auto &req : requests) { - nghttp2_priority_spec pri_spec; + if (tls::setup_keylog_callback(ssl_ctx) != 0) { + std::cerr << "[ERROR] Failed to setup keylog" << std::endl; + + result = -1; - nghttp2_priority_spec_init(&pri_spec, dep_stream_id, std::get<3>(req), 0); + goto fin; + } + } + { + HttpClient client{callbacks, loop, ssl_ctx}; + for (auto &req : requests) { for (int i = 0; i < config.multiply; ++i) { client.add_request(std::get<0>(req), std::get<1>(req), std::get<2>(req), - pri_spec); + std::get<3>(req)); } } client.update_hostport(); @@ -2438,12 +2338,13 @@ int communicate( } // namespace namespace { -ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t length, uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) { +nghttp2_ssize file_read_callback(nghttp2_session *session, int32_t stream_id, + uint8_t *buf, size_t length, + uint32_t *data_flags, + nghttp2_data_source *source, void *user_data) { int rv; auto req = static_cast( - nghttp2_session_get_stream_user_data(session, stream_id)); + nghttp2_session_get_stream_user_data(session, stream_id)); assert(req); int fd = source->fd; ssize_t nread; @@ -2464,7 +2365,8 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, std::vector nva; nva.reserve(config.trailer.size()); for (auto &kv : config.trailer) { - nva.push_back(http2::make_nv(kv.name, kv.value, kv.no_index)); + nva.push_back(http2::make_field_nv(kv.name, kv.value, + http2::no_index(kv.no_index))); } rv = nghttp2_submit_trailer(session, stream_id, nva.data(), nva.size()); if (rv != 0) { @@ -2476,14 +2378,14 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id, } } - return nread; + return static_cast(nread); } if (req->data_offset > req->data_length || nread == 0) { return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } - return nread; + return static_cast(nread); } } // namespace @@ -2495,40 +2397,40 @@ int run(char **uris, int n) { auto cbsdel = defer(nghttp2_session_callbacks_del, callbacks); nghttp2_session_callbacks_set_on_stream_close_callback( - callbacks, on_stream_close_callback); + callbacks, on_stream_close_callback); nghttp2_session_callbacks_set_on_frame_recv_callback(callbacks, on_frame_recv_callback2); if (config.verbose) { nghttp2_session_callbacks_set_on_invalid_frame_recv_callback( - callbacks, verbose_on_invalid_frame_recv_callback); + callbacks, verbose_on_invalid_frame_recv_callback); nghttp2_session_callbacks_set_error_callback2(callbacks, verbose_error_callback); } nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - callbacks, on_data_chunk_recv_callback); + callbacks, on_data_chunk_recv_callback); nghttp2_session_callbacks_set_on_begin_headers_callback( - callbacks, on_begin_headers_callback); + callbacks, on_begin_headers_callback); nghttp2_session_callbacks_set_on_header_callback(callbacks, on_header_callback); nghttp2_session_callbacks_set_before_frame_send_callback( - callbacks, before_frame_send_callback); + callbacks, before_frame_send_callback); nghttp2_session_callbacks_set_on_frame_send_callback(callbacks, on_frame_send_callback); nghttp2_session_callbacks_set_on_frame_not_send_callback( - callbacks, on_frame_not_send_callback); + callbacks, on_frame_not_send_callback); if (config.padding) { - nghttp2_session_callbacks_set_select_padding_callback( - callbacks, select_padding_callback); + nghttp2_session_callbacks_set_select_padding_callback2( + callbacks, select_padding_callback); } std::string prev_scheme; @@ -2536,8 +2438,8 @@ int run(char **uris, int n) { uint16_t prev_port = 0; int failures = 0; int data_fd = -1; - nghttp2_data_provider data_prd; - struct stat data_stat; + nghttp2_data_provider2 data_prd; + struct stat data_stat {}; if (!config.datafile.empty()) { if (config.datafile == "-") { @@ -2604,30 +2506,30 @@ int run(char **uris, int n) { data_prd.read_callback = file_read_callback; } std::vector< - std::tuple> - requests; + std::tuple> + requests; - size_t next_weight_idx = 0; + size_t next_extpri_idx = 0; for (int i = 0; i < n; ++i) { - http_parser_url u{}; + urlparse_url u; auto uri = strip_fragment(uris[i]); - if (http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { - ++next_weight_idx; + if (urlparse_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { + ++next_extpri_idx; std::cerr << "[ERROR] Could not parse URI " << uri << std::endl; continue; } - if (!util::has_uri_field(u, UF_SCHEMA)) { - ++next_weight_idx; + if (!util::has_uri_field(u, URLPARSE_SCHEMA)) { + ++next_extpri_idx; std::cerr << "[ERROR] URI " << uri << " does not have scheme part" << std::endl; continue; } - auto port = util::has_uri_field(u, UF_PORT) - ? u.port - : util::get_default_port(uri.c_str(), u); - auto host = decode_host(util::get_uri_field(uri.c_str(), u, UF_HOST)); - if (!util::fieldeq(uri.c_str(), u, UF_SCHEMA, prev_scheme.c_str()) || + auto port = util::has_uri_field(u, URLPARSE_PORT) + ? u.port + : util::get_default_port(uri.c_str(), u); + auto host = decode_host(util::get_uri_field(uri.c_str(), u, URLPARSE_HOST)); + if (!util::fieldeq(uri.c_str(), u, URLPARSE_SCHEMA, prev_scheme.c_str()) || host != prev_host || port != prev_port) { if (!requests.empty()) { if (communicate(prev_scheme, prev_host, prev_port, std::move(requests), @@ -2636,12 +2538,12 @@ int run(char **uris, int n) { } requests.clear(); } - prev_scheme = util::get_uri_field(uri.c_str(), u, UF_SCHEMA).str(); + prev_scheme = util::get_uri_field(uri.c_str(), u, URLPARSE_SCHEMA); prev_host = std::move(host); prev_port = port; } requests.emplace_back(uri, data_fd == -1 ? nullptr : &data_prd, - data_stat.st_size, config.weight[next_weight_idx++]); + data_stat.st_size, config.extpris[next_extpri_idx++]); } if (!requests.empty()) { if (communicate(prev_scheme, prev_host, prev_port, std::move(requests), @@ -2723,15 +2625,15 @@ void print_help(std::ostream &out) { Perform HTTP Upgrade for HTTP/2. This option is ignored if the request URI has https scheme. If -d is used, the HTTP upgrade request is performed with OPTIONS method. - -p, --weight= - Sets weight of given URI. This option can be used - multiple times, and N-th -p option sets weight of N-th - URI in the command line. If the number of -p option is - less than the number of URI, the last -p option value is - repeated. If there is no -p option, default weight, 16, - is assumed. The valid value range is - [)" - << NGHTTP2_MIN_WEIGHT << ", " << NGHTTP2_MAX_WEIGHT << R"(], inclusive. + --extpri= + Sets RFC 9218 priority of given URI. must be the + wire format of priority header field (e.g., "u=3,i"). + This option can be used multiple times, and N-th + --extpri option sets priority of N-th URI in the command + line. If the number of this option is less than the + number of URI, the last option value is repeated. If + there is no --extpri option, urgency is 3, and + incremental is false. -M, --peer-max-concurrent-streams= Use as SETTINGS_MAX_CONCURRENT_STREAMS value of remote endpoint as if it is received in SETTINGS frame. @@ -2759,7 +2661,6 @@ void print_help(std::ostream &out) { Send large header to test CONTINUATION. --no-content-length Don't send content-length header field. - --no-dep Don't send dependency based priority hint to server. --hexdump Display the incoming traffic in hexadecimal (Canonical hex+ASCII display). If SSL/TLS is used, decrypted data are used. @@ -2776,8 +2677,6 @@ void print_help(std::ostream &out) { Suppress warning on server certificate verification failure. --ktls Enable ktls. - --no-rfc7540-pri - Disable RFC7540 priorities. --version Display version information and exit. -h, --help Display this help and exit. @@ -2795,51 +2694,50 @@ void print_help(std::ostream &out) { } // namespace int main(int argc, char **argv) { - tls::libssl_init(); - bool color = false; while (1) { static int flag = 0; constexpr static option long_options[] = { - {"verbose", no_argument, nullptr, 'v'}, - {"null-out", no_argument, nullptr, 'n'}, - {"remote-name", no_argument, nullptr, 'O'}, - {"timeout", required_argument, nullptr, 't'}, - {"window-bits", required_argument, nullptr, 'w'}, - {"connection-window-bits", required_argument, nullptr, 'W'}, - {"get-assets", no_argument, nullptr, 'a'}, - {"stat", no_argument, nullptr, 's'}, - {"help", no_argument, nullptr, 'h'}, - {"header", required_argument, nullptr, 'H'}, - {"data", required_argument, nullptr, 'd'}, - {"multiply", required_argument, nullptr, 'm'}, - {"upgrade", no_argument, nullptr, 'u'}, - {"weight", required_argument, nullptr, 'p'}, - {"peer-max-concurrent-streams", required_argument, nullptr, 'M'}, - {"header-table-size", required_argument, nullptr, 'c'}, - {"padding", required_argument, nullptr, 'b'}, - {"har", required_argument, nullptr, 'r'}, - {"no-verify-peer", no_argument, nullptr, 'y'}, - {"cert", required_argument, &flag, 1}, - {"key", required_argument, &flag, 2}, - {"color", no_argument, &flag, 3}, - {"continuation", no_argument, &flag, 4}, - {"version", no_argument, &flag, 5}, - {"no-content-length", no_argument, &flag, 6}, - {"no-dep", no_argument, &flag, 7}, - {"trailer", required_argument, &flag, 9}, - {"hexdump", no_argument, &flag, 10}, - {"no-push", no_argument, &flag, 11}, - {"max-concurrent-streams", required_argument, &flag, 12}, - {"expect-continue", no_argument, &flag, 13}, - {"encoder-header-table-size", required_argument, &flag, 14}, - {"ktls", no_argument, &flag, 15}, - {"no-rfc7540-pri", no_argument, &flag, 16}, - {nullptr, 0, nullptr, 0}}; + {"verbose", no_argument, nullptr, 'v'}, + {"null-out", no_argument, nullptr, 'n'}, + {"remote-name", no_argument, nullptr, 'O'}, + {"timeout", required_argument, nullptr, 't'}, + {"window-bits", required_argument, nullptr, 'w'}, + {"connection-window-bits", required_argument, nullptr, 'W'}, + {"get-assets", no_argument, nullptr, 'a'}, + {"stat", no_argument, nullptr, 's'}, + {"help", no_argument, nullptr, 'h'}, + {"header", required_argument, nullptr, 'H'}, + {"data", required_argument, nullptr, 'd'}, + {"multiply", required_argument, nullptr, 'm'}, + {"upgrade", no_argument, nullptr, 'u'}, + {"weight", required_argument, nullptr, 'p'}, + {"peer-max-concurrent-streams", required_argument, nullptr, 'M'}, + {"header-table-size", required_argument, nullptr, 'c'}, + {"padding", required_argument, nullptr, 'b'}, + {"har", required_argument, nullptr, 'r'}, + {"no-verify-peer", no_argument, nullptr, 'y'}, + {"cert", required_argument, &flag, 1}, + {"key", required_argument, &flag, 2}, + {"color", no_argument, &flag, 3}, + {"continuation", no_argument, &flag, 4}, + {"version", no_argument, &flag, 5}, + {"no-content-length", no_argument, &flag, 6}, + {"no-dep", no_argument, &flag, 7}, + {"trailer", required_argument, &flag, 9}, + {"hexdump", no_argument, &flag, 10}, + {"no-push", no_argument, &flag, 11}, + {"max-concurrent-streams", required_argument, &flag, 12}, + {"expect-continue", no_argument, &flag, 13}, + {"encoder-header-table-size", required_argument, &flag, 14}, + {"ktls", no_argument, &flag, 15}, + {"no-rfc7540-pri", no_argument, &flag, 16}, + {"extpri", required_argument, &flag, 17}, + {nullptr, 0, nullptr, 0}}; int option_index = 0; int c = - getopt_long(argc, argv, "M:Oab:c:d:m:np:r:hH:vst:uw:yW:", long_options, - &option_index); + getopt_long(argc, argv, "M:Oab:c:d:m:np:r:hH:vst:uw:yW:", long_options, + &option_index); if (c == -1) { break; } @@ -2847,11 +2745,11 @@ int main(int argc, char **argv) { case 'M': { // peer-max-concurrent-streams option auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-M: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.peer_max_concurrent_streams = n; + config.peer_max_concurrent_streams = *n; break; } case 'O': @@ -2862,27 +2760,20 @@ int main(int argc, char **argv) { exit(EXIT_SUCCESS); case 'b': { auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-b: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.padding = n; + config.padding = *n; break; } case 'n': config.null_out = true; break; - case 'p': { - auto n = util::parse_uint(optarg); - if (n == -1 || NGHTTP2_MIN_WEIGHT > n || n > NGHTTP2_MAX_WEIGHT) { - std::cerr << "-p: specify the integer in the range [" - << NGHTTP2_MIN_WEIGHT << ", " << NGHTTP2_MAX_WEIGHT - << "], inclusive" << std::endl; - exit(EXIT_FAILURE); - } - config.weight.push_back(n); + case 'p': + std::cerr << "[WARNING]: --weight option has been deprecated." + << std::endl; break; - } case 'r': #ifdef HAVE_JANSSON config.harfile = optarg; @@ -2894,29 +2785,31 @@ int main(int argc, char **argv) { case 'v': ++config.verbose; break; - case 't': - config.timeout = util::parse_duration_with_unit(optarg); - if (config.timeout == std::numeric_limits::infinity()) { + case 't': { + auto d = util::parse_duration_with_unit(optarg); + if (!d) { std::cerr << "-t: bad timeout value: " << optarg << std::endl; exit(EXIT_FAILURE); } + config.timeout = *d; break; + } case 'u': config.upgrade = true; break; case 'w': case 'W': { auto n = util::parse_uint(optarg); - if (n == -1 || n > 30) { + if (!n || n > 30) { std::cerr << "-" << static_cast(c) << ": specify the integer in the range [0, 30], inclusive" << std::endl; exit(EXIT_FAILURE); } if (c == 'w') { - config.window_bits = n; + config.window_bits = *n; } else { - config.connection_window_bits = n; + config.connection_window_bits = *n; } break; } @@ -2960,16 +2853,16 @@ int main(int argc, char **argv) { break; case 'm': { auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-m: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.multiply = n; + config.multiply = *n; break; } case 'c': { auto n = util::parse_uint_with_unit(optarg); - if (n == -1) { + if (!n) { std::cerr << "-c: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } @@ -2978,8 +2871,8 @@ int main(int argc, char **argv) { << std::numeric_limits::max() << std::endl; exit(EXIT_FAILURE); } - config.header_table_size = n; - config.min_header_table_size = std::min(config.min_header_table_size, n); + config.header_table_size = *n; + config.min_header_table_size = std::min(config.min_header_table_size, *n); break; } case 'y': @@ -3016,7 +2909,8 @@ int main(int argc, char **argv) { break; case 7: // no-dep option - config.no_dep = true; + std::cerr << "[WARNING]: --no-dep option has been deprecated." + << std::endl; break; case 9: { // trailer option @@ -3053,12 +2947,12 @@ int main(int argc, char **argv) { case 12: { // max-concurrent-streams option auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "--max-concurrent-streams: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.max_concurrent_streams = n; + config.max_concurrent_streams = *n; break; } case 13: @@ -3068,7 +2962,7 @@ int main(int argc, char **argv) { case 14: { // encoder-header-table-size option auto n = util::parse_uint_with_unit(optarg); - if (n == -1) { + if (!n) { std::cerr << "--encoder-header-table-size: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); @@ -3079,7 +2973,7 @@ int main(int argc, char **argv) { << std::numeric_limits::max() << std::endl; exit(EXIT_FAILURE); } - config.encoder_header_table_size = n; + config.encoder_header_table_size = *n; break; } case 15: @@ -3088,8 +2982,26 @@ int main(int argc, char **argv) { break; case 16: // no-rfc7540-pri option - config.no_rfc7540_pri = true; + std::cerr << "[WARNING]: --no-rfc7540-pri option has been deprecated." + << std::endl; break; + case 17: { + // extpri option + nghttp2_extpri pri{ + .urgency = NGHTTP2_EXTPRI_DEFAULT_URGENCY, + }; + + if (nghttp2_extpri_parse_priority( + &pri, reinterpret_cast(optarg), + strlen(optarg)) != 0) { + std::cerr << "--extpri: Bad option value: " << optarg << std::endl; + exit(EXIT_FAILURE); + } + + config.extpris.emplace_back(std::move(pri)); + + break; + } } break; default: @@ -3097,45 +3009,47 @@ int main(int argc, char **argv) { } } - int32_t weight_to_fill; - if (config.weight.empty()) { - weight_to_fill = NGHTTP2_DEFAULT_WEIGHT; - } else { - weight_to_fill = config.weight.back(); + nghttp2_extpri extpri_to_fill{ + .urgency = NGHTTP2_EXTPRI_DEFAULT_URGENCY, + }; + + if (!config.extpris.empty()) { + extpri_to_fill = config.extpris.back(); } - config.weight.insert(std::end(config.weight), argc - optind, weight_to_fill); + config.extpris.insert(std::end(config.extpris), argc - optind, + extpri_to_fill); // Find scheme overridden by extra header fields. auto scheme_it = - std::find_if(std::begin(config.headers), std::end(config.headers), - [](const Header &nv) { return nv.name == ":scheme"; }); + std::find_if(std::begin(config.headers), std::end(config.headers), + [](const Header &nv) { return nv.name == ":scheme"; }); if (scheme_it != std::end(config.headers)) { config.scheme_override = (*scheme_it).value; } // Find host and port overridden by extra header fields. auto authority_it = - std::find_if(std::begin(config.headers), std::end(config.headers), - [](const Header &nv) { return nv.name == ":authority"; }); + std::find_if(std::begin(config.headers), std::end(config.headers), + [](const Header &nv) { return nv.name == ":authority"; }); if (authority_it == std::end(config.headers)) { authority_it = - std::find_if(std::begin(config.headers), std::end(config.headers), - [](const Header &nv) { return nv.name == "host"; }); + std::find_if(std::begin(config.headers), std::end(config.headers), + [](const Header &nv) { return nv.name == "host"; }); } if (authority_it != std::end(config.headers)) { // authority_it may looks like "host:port". auto uri = "https://" + (*authority_it).value; - http_parser_url u{}; - if (http_parser_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { + urlparse_url u; + if (urlparse_parse_url(uri.c_str(), uri.size(), 0, &u) != 0) { std::cerr << "[ERROR] Could not parse authority in " << (*authority_it).name << ": " << (*authority_it).value << std::endl; exit(EXIT_FAILURE); } - config.host_override = util::get_uri_field(uri.c_str(), u, UF_HOST).str(); - if (util::has_uri_field(u, UF_PORT)) { + config.host_override = util::get_uri_field(uri.c_str(), u, URLPARSE_HOST); + if (util::has_uri_field(u, URLPARSE_PORT)) { config.port_override = u.port; } } @@ -3143,11 +3057,11 @@ int main(int argc, char **argv) { set_color_output(color || isatty(fileno(stdout))); nghttp2_option_set_peer_max_concurrent_streams( - config.http2_option, config.peer_max_concurrent_streams); + config.http2_option, config.peer_max_concurrent_streams); if (config.encoder_header_table_size != -1) { nghttp2_option_set_max_deflate_dynamic_table_size( - config.http2_option, config.encoder_header_table_size); + config.http2_option, config.encoder_header_table_size); } struct sigaction act {}; diff --git a/lib/nghttp2/src/nghttp.h b/lib/nghttp2-1.65.0/src/nghttp.h similarity index 91% rename from lib/nghttp2/src/nghttp.h rename to lib/nghttp2-1.65.0/src/nghttp.h index a8804142275..44742e3b227 100644 --- a/lib/nghttp2/src/nghttp.h +++ b/lib/nghttp2-1.65.0/src/nghttp.h @@ -41,10 +41,18 @@ #include #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include +#define NGHTTP2_NO_SSIZE_T #include #include "llhttp.h" @@ -64,7 +72,7 @@ struct Config { Headers headers; Headers trailer; - std::vector weight; + std::vector extpris; std::string certfile; std::string keyfile; std::string datafile; @@ -77,7 +85,7 @@ struct Config { int64_t encoder_header_table_size; size_t padding; size_t max_concurrent_streams; - ssize_t peer_max_concurrent_streams; + size_t peer_max_concurrent_streams; int multiply; // milliseconds ev_tstamp timeout; @@ -92,13 +100,11 @@ struct Config { bool upgrade; bool continuation; bool no_content_length; - bool no_dep; bool hexdump; bool no_push; bool expect_continue; bool verify_peer; bool ktls; - bool no_rfc7540_pri; }; enum class RequestState { INITIAL, ON_REQUEST, ON_RESPONSE, ON_COMPLETE }; @@ -136,9 +142,9 @@ struct ContinueTimer { struct Request { // For pushed request, |uri| is empty and |u| is zero-cleared. - Request(const std::string &uri, const http_parser_url &u, - const nghttp2_data_provider *data_prd, int64_t data_length, - const nghttp2_priority_spec &pri_spec, int level = 0); + Request(const std::string &uri, const urlparse_url &u, + const nghttp2_data_provider2 *data_prd, int64_t data_length, + const nghttp2_extpri &extpri, int level = 0); ~Request(); void init_inflater(); @@ -171,8 +177,8 @@ struct Request { std::string method; // URI without fragment std::string uri; - http_parser_url u; - nghttp2_priority_spec pri_spec; + urlparse_url u; + nghttp2_extpri extpri; RequestTiming timing; int64_t data_length; int64_t data_offset; @@ -180,7 +186,7 @@ struct Request { int64_t response_len; nghttp2_gzip *inflater; std::unique_ptr html_parser; - const nghttp2_data_provider *data_prd; + const nghttp2_data_provider2 *data_prd; size_t header_buffer_size; int32_t stream_id; int status; @@ -246,8 +252,8 @@ struct HttpClient { bool all_requests_processed() const; void update_hostport(); bool add_request(const std::string &uri, - const nghttp2_data_provider *data_prd, int64_t data_length, - const nghttp2_priority_spec &pri_spec, int level = 0); + const nghttp2_data_provider2 *data_prd, int64_t data_length, + const nghttp2_extpri &extpri, int level = 0); void record_start_time(); void record_domain_lookup_end_time(); diff --git a/lib/nghttp2/src/nghttp2_config.h b/lib/nghttp2-1.65.0/src/nghttp2_config.h similarity index 100% rename from lib/nghttp2/src/nghttp2_config.h rename to lib/nghttp2-1.65.0/src/nghttp2_config.h diff --git a/lib/nghttp2/src/nghttp2_gzip.c b/lib/nghttp2-1.65.0/src/nghttp2_gzip.c similarity index 100% rename from lib/nghttp2/src/nghttp2_gzip.c rename to lib/nghttp2-1.65.0/src/nghttp2_gzip.c diff --git a/lib/nghttp2/src/nghttp2_gzip.h b/lib/nghttp2-1.65.0/src/nghttp2_gzip.h similarity index 100% rename from lib/nghttp2/src/nghttp2_gzip.h rename to lib/nghttp2-1.65.0/src/nghttp2_gzip.h diff --git a/lib/nghttp2/src/nghttp2_gzip_test.c b/lib/nghttp2-1.65.0/src/nghttp2_gzip_test.c similarity index 62% rename from lib/nghttp2/src/nghttp2_gzip_test.c rename to lib/nghttp2-1.65.0/src/nghttp2_gzip_test.c index de19d5da338..e1688daf987 100644 --- a/lib/nghttp2/src/nghttp2_gzip_test.c +++ b/lib/nghttp2-1.65.0/src/nghttp2_gzip_test.c @@ -27,26 +27,35 @@ #include #include -#include +#include "munit.h" #include #include "nghttp2_gzip.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_gzip_inflate), + munit_test_end(), +}; + +const MunitSuite gzip_suite = { + "/gzip", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + static size_t deflate_data(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen) { int rv; z_stream zst = {0}; rv = deflateInit(&zst, Z_DEFAULT_COMPRESSION); - CU_ASSERT(rv == Z_OK); + assert_int(Z_OK, ==, rv); zst.avail_in = (unsigned int)inlen; zst.next_in = (uint8_t *)in; zst.avail_out = (unsigned int)outlen; zst.next_out = out; rv = deflate(&zst, Z_SYNC_FLUSH); - CU_ASSERT(rv == Z_OK); + assert_int(Z_OK, ==, rv); deflateEnd(&zst); @@ -54,13 +63,13 @@ static size_t deflate_data(uint8_t *out, size_t outlen, const uint8_t *in, } static const char input[] = - "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND " - "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " - "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND " - "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE " - "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION " - "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION " - "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."; + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND " + "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " + "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND " + "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE " + "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION " + "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION " + "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."; void test_nghttp2_gzip_inflate(void) { nghttp2_gzip *inflater; @@ -71,41 +80,41 @@ void test_nghttp2_gzip_inflate(void) { inlen = deflate_data(in, inlen, (const uint8_t *)input, sizeof(input) - 1); - CU_ASSERT(0 == nghttp2_gzip_inflate_new(&inflater)); + assert_int(0, ==, nghttp2_gzip_inflate_new(&inflater)); /* First 16 bytes */ inptr = in; inproclen = inlen; outproclen = 16; - CU_ASSERT( - 0 == nghttp2_gzip_inflate(inflater, out, &outproclen, inptr, &inproclen)); - CU_ASSERT(16 == outproclen); - CU_ASSERT(inproclen > 0); - CU_ASSERT(0 == memcmp(inputptr, out, outproclen)); + assert_int( + 0, ==, nghttp2_gzip_inflate(inflater, out, &outproclen, inptr, &inproclen)); + assert_size(16, ==, outproclen); + assert_size(0, <, inproclen); + assert_memory_equal(outproclen, inputptr, out); /* Next 32 bytes */ inptr += inproclen; inlen -= inproclen; inproclen = inlen; inputptr += outproclen; outproclen = 32; - CU_ASSERT( - 0 == nghttp2_gzip_inflate(inflater, out, &outproclen, inptr, &inproclen)); - CU_ASSERT(32 == outproclen); - CU_ASSERT(inproclen > 0); - CU_ASSERT(0 == memcmp(inputptr, out, outproclen)); + assert_int( + 0, ==, nghttp2_gzip_inflate(inflater, out, &outproclen, inptr, &inproclen)); + assert_size(32, ==, outproclen); + assert_size(0, <, inproclen); + assert_memory_equal(outproclen, inputptr, out); /* Rest */ inptr += inproclen; inlen -= inproclen; inproclen = inlen; inputptr += outproclen; outproclen = sizeof(out); - CU_ASSERT( - 0 == nghttp2_gzip_inflate(inflater, out, &outproclen, inptr, &inproclen)); - CU_ASSERT(sizeof(input) - 49 == outproclen); - CU_ASSERT(inproclen > 0); - CU_ASSERT(0 == memcmp(inputptr, out, outproclen)); + assert_int( + 0, ==, nghttp2_gzip_inflate(inflater, out, &outproclen, inptr, &inproclen)); + assert_size(sizeof(input) - 49, ==, outproclen); + assert_size(0, <, inproclen); + assert_memory_equal(outproclen, inputptr, out); inlen -= inproclen; - CU_ASSERT(0 == inlen); + assert_size(0, ==, inlen); nghttp2_gzip_inflate_del(inflater); } diff --git a/lib/nghttp2/src/nghttp2_gzip_test.h b/lib/nghttp2-1.65.0/src/nghttp2_gzip_test.h similarity index 90% rename from lib/nghttp2/src/nghttp2_gzip_test.h rename to lib/nghttp2-1.65.0/src/nghttp2_gzip_test.h index 8d554f7209a..c1bd9153f44 100644 --- a/lib/nghttp2/src/nghttp2_gzip_test.h +++ b/lib/nghttp2-1.65.0/src/nghttp2_gzip_test.h @@ -33,7 +33,13 @@ extern "C" { #endif -void test_nghttp2_gzip_inflate(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite gzip_suite; + +munit_void_test_decl(test_nghttp2_gzip_inflate) #ifdef __cplusplus } diff --git a/lib/nghttp2/src/nghttpd.cc b/lib/nghttp2-1.65.0/src/nghttpd.cc similarity index 86% rename from lib/nghttp2/src/nghttpd.cc rename to lib/nghttp2-1.65.0/src/nghttpd.cc index 3c5f5b4bec1..5a3d4658879 100644 --- a/lib/nghttp2/src/nghttpd.cc +++ b/lib/nghttp2-1.65.0/src/nghttpd.cc @@ -41,8 +41,6 @@ #include #include -#include -#include #include #include "app_helper.h" @@ -179,8 +177,6 @@ void print_help(std::ostream &out) { --no-content-length Don't send content-length header field. --ktls Enable ktls. - --no-rfc7540-pri - Disable RFC7540 priorities. --version Display version information and exit. -h, --help Display this help and exit. @@ -193,12 +189,6 @@ void print_help(std::ostream &out) { } // namespace int main(int argc, char **argv) { - tls::libssl_init(); - -#ifndef NOTHREADS - tls::LibsslGlobalLock lock; -#endif // NOTHREADS - Config config; bool color = false; auto mime_types_file_set_manually = false; @@ -206,34 +196,34 @@ int main(int argc, char **argv) { while (1) { static int flag = 0; constexpr static option long_options[] = { - {"address", required_argument, nullptr, 'a'}, - {"daemon", no_argument, nullptr, 'D'}, - {"htdocs", required_argument, nullptr, 'd'}, - {"help", no_argument, nullptr, 'h'}, - {"verbose", no_argument, nullptr, 'v'}, - {"verify-client", no_argument, nullptr, 'V'}, - {"header-table-size", required_argument, nullptr, 'c'}, - {"push", required_argument, nullptr, 'p'}, - {"padding", required_argument, nullptr, 'b'}, - {"max-concurrent-streams", required_argument, nullptr, 'm'}, - {"workers", required_argument, nullptr, 'n'}, - {"error-gzip", no_argument, nullptr, 'e'}, - {"window-bits", required_argument, nullptr, 'w'}, - {"connection-window-bits", required_argument, nullptr, 'W'}, - {"no-tls", no_argument, &flag, 1}, - {"color", no_argument, &flag, 2}, - {"version", no_argument, &flag, 3}, - {"dh-param-file", required_argument, &flag, 4}, - {"early-response", no_argument, &flag, 5}, - {"trailer", required_argument, &flag, 6}, - {"hexdump", no_argument, &flag, 7}, - {"echo-upload", no_argument, &flag, 8}, - {"mime-types-file", required_argument, &flag, 9}, - {"no-content-length", no_argument, &flag, 10}, - {"encoder-header-table-size", required_argument, &flag, 11}, - {"ktls", no_argument, &flag, 12}, - {"no-rfc7540-pri", no_argument, &flag, 13}, - {nullptr, 0, nullptr, 0}}; + {"address", required_argument, nullptr, 'a'}, + {"daemon", no_argument, nullptr, 'D'}, + {"htdocs", required_argument, nullptr, 'd'}, + {"help", no_argument, nullptr, 'h'}, + {"verbose", no_argument, nullptr, 'v'}, + {"verify-client", no_argument, nullptr, 'V'}, + {"header-table-size", required_argument, nullptr, 'c'}, + {"push", required_argument, nullptr, 'p'}, + {"padding", required_argument, nullptr, 'b'}, + {"max-concurrent-streams", required_argument, nullptr, 'm'}, + {"workers", required_argument, nullptr, 'n'}, + {"error-gzip", no_argument, nullptr, 'e'}, + {"window-bits", required_argument, nullptr, 'w'}, + {"connection-window-bits", required_argument, nullptr, 'W'}, + {"no-tls", no_argument, &flag, 1}, + {"color", no_argument, &flag, 2}, + {"version", no_argument, &flag, 3}, + {"dh-param-file", required_argument, &flag, 4}, + {"early-response", no_argument, &flag, 5}, + {"trailer", required_argument, &flag, 6}, + {"hexdump", no_argument, &flag, 7}, + {"echo-upload", no_argument, &flag, 8}, + {"mime-types-file", required_argument, &flag, 9}, + {"no-content-length", no_argument, &flag, 10}, + {"encoder-header-table-size", required_argument, &flag, 11}, + {"ktls", no_argument, &flag, 12}, + {"no-rfc7540-pri", no_argument, &flag, 13}, + {nullptr, 0, nullptr, 0}}; int option_index = 0; int c = getopt_long(argc, argv, "DVb:c:d:ehm:n:p:va:w:W:", long_options, &option_index); @@ -252,11 +242,11 @@ int main(int argc, char **argv) { break; case 'b': { auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-b: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.padding = n; + config.padding = *n; break; } case 'd': @@ -268,11 +258,11 @@ int main(int argc, char **argv) { case 'm': { // max-concurrent-streams option auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-m: invalid argument: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.max_concurrent_streams = n; + config.max_concurrent_streams = *n; break; } case 'n': { @@ -281,11 +271,11 @@ int main(int argc, char **argv) { << "no threads created." << std::endl; #else auto n = util::parse_uint(optarg); - if (n == -1) { + if (!n) { std::cerr << "-n: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } - config.num_worker = n; + config.num_worker = *n; #endif // NOTHREADS break; } @@ -297,7 +287,7 @@ int main(int argc, char **argv) { break; case 'c': { auto n = util::parse_uint_with_unit(optarg); - if (n == -1) { + if (!n) { std::cerr << "-c: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); } @@ -306,7 +296,7 @@ int main(int argc, char **argv) { << std::numeric_limits::max() << std::endl; exit(EXIT_FAILURE); } - config.header_table_size = n; + config.header_table_size = *n; break; } case 'p': @@ -317,7 +307,7 @@ int main(int argc, char **argv) { case 'w': case 'W': { auto n = util::parse_uint(optarg); - if (n == -1 || n > 30) { + if (!n || n > 30) { std::cerr << "-" << static_cast(c) << ": specify the integer in the range [0, 30], inclusive" << std::endl; @@ -325,9 +315,9 @@ int main(int argc, char **argv) { } if (c == 'w') { - config.window_bits = n; + config.window_bits = *n; } else { - config.connection_window_bits = n; + config.connection_window_bits = *n; } break; @@ -401,7 +391,7 @@ int main(int argc, char **argv) { case 11: { // encoder-header-table-size option auto n = util::parse_uint_with_unit(optarg); - if (n == -1) { + if (!n) { std::cerr << "--encoder-header-table-size: Bad option value: " << optarg << std::endl; exit(EXIT_FAILURE); @@ -412,7 +402,7 @@ int main(int argc, char **argv) { << std::numeric_limits::max() << std::endl; exit(EXIT_FAILURE); } - config.encoder_header_table_size = n; + config.encoder_header_table_size = *n; break; } case 12: @@ -421,7 +411,8 @@ int main(int argc, char **argv) { break; case 13: // no-rfc7540-pri option - config.no_rfc7540_pri = true; + std::cerr << "[WARNING]: --no-rfc7540-pri option has been deprecated." + << std::endl; break; } break; @@ -438,11 +429,11 @@ int main(int argc, char **argv) { { auto portStr = argv[optind++]; auto n = util::parse_uint(portStr); - if (n == -1 || n > std::numeric_limits::max()) { + if (!n || n > std::numeric_limits::max()) { std::cerr << ": Bad value: " << portStr << std::endl; exit(EXIT_FAILURE); } - config.port = n; + config.port = *n; } if (!config.no_tls) { diff --git a/lib/nghttp2/src/quic.cc b/lib/nghttp2-1.65.0/src/quic.cc similarity index 96% rename from lib/nghttp2/src/quic.cc rename to lib/nghttp2-1.65.0/src/quic.cc index 1c68a5bed46..99636050442 100644 --- a/lib/nghttp2/src/quic.cc +++ b/lib/nghttp2-1.65.0/src/quic.cc @@ -49,7 +49,7 @@ Error err_transport_idle_timeout() { Error err_transport_tls(int alert) { return {ErrorType::Transport, ngtcp2_err_infer_quic_transport_error_code( - NGTCP2_CRYPTO_ERROR | alert)}; + NGTCP2_CRYPTO_ERROR | alert)}; } Error err_application(int liberr) { diff --git a/lib/nghttp2/src/quic.h b/lib/nghttp2-1.65.0/src/quic.h similarity index 100% rename from lib/nghttp2/src/quic.h rename to lib/nghttp2-1.65.0/src/quic.h diff --git a/lib/nghttp2/tests/nghttp2_hd_test.h b/lib/nghttp2-1.65.0/src/shrpx-unittest.cc similarity index 50% rename from lib/nghttp2/tests/nghttp2_hd_test.h rename to lib/nghttp2-1.65.0/src/shrpx-unittest.cc index ab0117cb9cc..929aa3f3350 100644 --- a/lib/nghttp2/tests/nghttp2_hd_test.h +++ b/lib/nghttp2-1.65.0/src/shrpx-unittest.cc @@ -22,34 +22,58 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef NGHTTP2_HD_TEST_H -#define NGHTTP2_HD_TEST_H - #ifdef HAVE_CONFIG_H # include -#endif /* HAVE_CONFIG_H */ +#endif // HAVE_CONFIG_H + +#include "munit.h" + +// include test cases' include files here +#include "shrpx_tls_test.h" +#include "shrpx_downstream_test.h" +#include "shrpx_config_test.h" +#include "shrpx_worker_test.h" +#include "http2_test.h" +#include "util_test.h" +#include "nghttp2_gzip_test.h" +#include "buffer_test.h" +#include "memchunk_test.h" +#include "template_test.h" +#include "shrpx_http_test.h" +#include "base64_test.h" +#include "shrpx_config.h" +#include "tls.h" +#include "shrpx_router_test.h" +#include "shrpx_log.h" +#ifdef ENABLE_HTTP3 +# include "siphash_test.h" +#endif // ENABLE_HTTP3 + +int main(int argc, char *argv[]) { + shrpx::create_config(); -void test_nghttp2_hd_deflate(void); -void test_nghttp2_hd_deflate_same_indexed_repr(void); -void test_nghttp2_hd_inflate_indexed(void); -void test_nghttp2_hd_inflate_indname_noinc(void); -void test_nghttp2_hd_inflate_indname_inc(void); -void test_nghttp2_hd_inflate_indname_inc_eviction(void); -void test_nghttp2_hd_inflate_newname_noinc(void); -void test_nghttp2_hd_inflate_newname_inc(void); -void test_nghttp2_hd_inflate_clearall_inc(void); -void test_nghttp2_hd_inflate_zero_length_huffman(void); -void test_nghttp2_hd_inflate_expect_table_size_update(void); -void test_nghttp2_hd_inflate_unexpected_table_size_update(void); -void test_nghttp2_hd_ringbuf_reserve(void); -void test_nghttp2_hd_change_table_size(void); -void test_nghttp2_hd_deflate_inflate(void); -void test_nghttp2_hd_no_index(void); -void test_nghttp2_hd_deflate_bound(void); -void test_nghttp2_hd_public_api(void); -void test_nghttp2_hd_deflate_hd_vec(void); -void test_nghttp2_hd_decode_length(void); -void test_nghttp2_hd_huff_encode(void); -void test_nghttp2_hd_huff_decode(void); + const MunitSuite suites[] = { + shrpx::tls_suite, + shrpx::downstream_suite, + shrpx::config_suite, + shrpx::worker_suite, + shrpx::http_suite, + shrpx::router_suite, + shrpx::http2_suite, + shrpx::util_suite, + gzip_suite, + buffer_suite, + memchunk_suite, + template_suite, + base64_suite, +#ifdef ENABLE_HTTP3 + siphash_suite, +#endif // ENABLE_HTTP3 + {}, + }; + const MunitSuite suite = { + "", nullptr, suites, 1, MUNIT_SUITE_OPTION_NONE, + }; -#endif /* NGHTTP2_HD_TEST_H */ + return munit_suite_main(&suite, nullptr, argc, argv); +} diff --git a/lib/nghttp2/src/shrpx.cc b/lib/nghttp2-1.65.0/src/shrpx.cc similarity index 83% rename from lib/nghttp2/src/shrpx.cc rename to lib/nghttp2-1.65.0/src/shrpx.cc index ccd9e0642cb..9aabd13f11f 100644 --- a/lib/nghttp2/src/shrpx.cc +++ b/lib/nghttp2-1.65.0/src/shrpx.cc @@ -71,10 +71,20 @@ #include #include #include +#include -#include -#include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include #include @@ -101,7 +111,6 @@ #include "tls.h" #include "template.h" #include "allocator.h" -#include "ssl_compat.h" #include "xsi_strerror.h" extern char **environ; @@ -112,19 +121,19 @@ namespace shrpx { // Deprecated: Environment variables to tell new binary the listening // socket's file descriptors. They are not close-on-exec. -constexpr auto ENV_LISTENER4_FD = StringRef::from_lit("NGHTTPX_LISTENER4_FD"); -constexpr auto ENV_LISTENER6_FD = StringRef::from_lit("NGHTTPX_LISTENER6_FD"); +constexpr auto ENV_LISTENER4_FD = "NGHTTPX_LISTENER4_FD"_sr; +constexpr auto ENV_LISTENER6_FD = "NGHTTPX_LISTENER6_FD"_sr; // Deprecated: Environment variable to tell new binary the port number // the current binary is listening to. -constexpr auto ENV_PORT = StringRef::from_lit("NGHTTPX_PORT"); +constexpr auto ENV_PORT = "NGHTTPX_PORT"_sr; // Deprecated: Environment variable to tell new binary the listening // socket's file descriptor if frontend listens UNIX domain socket. -constexpr auto ENV_UNIX_FD = StringRef::from_lit("NGHTTP2_UNIX_FD"); +constexpr auto ENV_UNIX_FD = "NGHTTP2_UNIX_FD"_sr; // Deprecated: Environment variable to tell new binary the UNIX domain // socket path. -constexpr auto ENV_UNIX_PATH = StringRef::from_lit("NGHTTP2_UNIX_PATH"); +constexpr auto ENV_UNIX_PATH = "NGHTTP2_UNIX_PATH"_sr; // Prefix of environment variables to tell new binary the listening // socket's file descriptor. They are not close-on-exec. For TCP @@ -132,22 +141,24 @@ constexpr auto ENV_UNIX_PATH = StringRef::from_lit("NGHTTP2_UNIX_PATH"); // is file descriptor. For UNIX domain socket, the value must be // comma separated 3 parameters: unix,,. is file // descriptor. is a path to UNIX domain socket. -constexpr auto ENV_ACCEPT_PREFIX = StringRef::from_lit("NGHTTPX_ACCEPT_"); +constexpr auto ENV_ACCEPT_PREFIX = "NGHTTPX_ACCEPT_"_sr; // This environment variable contains PID of the original main // process, assuming that it created this main process as a result of // SIGUSR2. The new main process is expected to send QUIT signal to // the original main process to shut it down gracefully. -constexpr auto ENV_ORIG_PID = StringRef::from_lit("NGHTTPX_ORIG_PID"); +constexpr auto ENV_ORIG_PID = "NGHTTPX_ORIG_PID"_sr; // Prefix of environment variables to tell new binary the QUIC IPC -// file descriptor and CID prefix of the lingering worker process. -// The value must be comma separated parameters: -// ,,,... is the file -// descriptor. is the I-th CID prefix in hex encoded -// string. +// file descriptor and Worker ID of the lingering worker process. The +// value must be comma separated parameters: +// +// ,,,..., +// +// is the file descriptor. is the I-th Worker ID +// in hex encoded string. constexpr auto ENV_QUIC_WORKER_PROCESS_PREFIX = - StringRef::from_lit("NGHTTPX_QUIC_WORKER_PROCESS_"); + "NGHTTPX_QUIC_WORKER_PROCESS_"_sr; #ifndef _KERNEL_FASTOPEN # define _KERNEL_FASTOPEN @@ -203,18 +214,17 @@ struct WorkerProcess { WorkerProcess(struct ev_loop *loop, pid_t worker_pid, int ipc_fd #ifdef ENABLE_HTTP3 , - int quic_ipc_fd, - const std::vector> - &cid_prefixes + int quic_ipc_fd, std::vector worker_ids, uint16_t seq #endif // ENABLE_HTTP3 ) - : loop(loop), - worker_pid(worker_pid), - ipc_fd(ipc_fd) + : loop(loop), + worker_pid(worker_pid), + ipc_fd(ipc_fd) #ifdef ENABLE_HTTP3 - , - quic_ipc_fd(quic_ipc_fd), - cid_prefixes(cid_prefixes) + , + quic_ipc_fd(quic_ipc_fd), + worker_ids(std::move(worker_ids)), + seq(seq) #endif // ENABLE_HTTP3 { ev_child_init(&worker_process_childev, worker_process_child_cb, worker_pid, @@ -245,7 +255,8 @@ struct WorkerProcess { std::chrono::steady_clock::time_point termination_deadline; #ifdef ENABLE_HTTP3 int quic_ipc_fd; - std::vector> cid_prefixes; + std::vector worker_ids; + uint16_t seq; #endif // ENABLE_HTTP3 }; @@ -255,6 +266,10 @@ void reload_config(); namespace { std::deque> worker_processes; + +#ifdef ENABLE_HTTP3 +uint16_t worker_process_seq; +#endif // ENABLE_HTTP3 } // namespace namespace { @@ -315,12 +330,12 @@ void worker_process_set_termination_deadline(WorkerProcess *wp, } wp->termination_deadline = - std::chrono::steady_clock::now() + - util::duration_from(config->worker_process_grace_shutdown_period); + std::chrono::steady_clock::now() + + util::duration_from(config->worker_process_grace_shutdown_period); if (!ev_is_active(&worker_process_grace_period_timer)) { worker_process_grace_period_timer.repeat = - config->worker_process_grace_shutdown_period; + config->worker_process_grace_shutdown_period; ev_timer_again(loop, &worker_process_grace_period_timer); } @@ -392,7 +407,7 @@ int save_pid() { std::array errbuf; auto config = get_config(); - constexpr auto SUFFIX = StringRef::from_lit(".XXXXXX"); + constexpr auto SUFFIX = ".XXXXXX"_sr; auto &pid_file = config->pid_file; auto len = config->pid_file.size() + SUFFIX.size(); @@ -431,7 +446,7 @@ int save_pid() { close(fd); - if (rename(temp_path, pid_file.c_str()) == -1) { + if (rename(temp_path, pid_file.data()) == -1) { auto error = errno; LOG(ERROR) << "Could not save PID to file " << pid_file << ": " << xsi_strerror(error, errbuf.data(), errbuf.size()); @@ -442,7 +457,7 @@ int save_pid() { } if (config->uid != 0) { - if (chown(pid_file.c_str(), config->uid, config->gid) == -1) { + if (chown(pid_file.data(), config->uid, config->gid) == -1) { auto error = errno; LOG(WARN) << "Changing owner of pid file " << pid_file << " failed: " << xsi_strerror(error, errbuf.data(), errbuf.size()); @@ -522,7 +537,7 @@ void exec_binary() { } auto exec_path = - util::get_exec_path(suconfig.argc, suconfig.argv, suconfig.cwd); + util::get_exec_path(suconfig.argc, suconfig.argv, suconfig.cwd); if (!exec_path) { LOG(ERROR) << "Could not resolve the executable path"; @@ -552,7 +567,7 @@ void exec_binary() { std::vector fd_envs; for (size_t i = 0; i < listenerconf.addrs.size(); ++i) { auto &addr = listenerconf.addrs[i]; - auto s = ENV_ACCEPT_PREFIX.str(); + auto s = std::string{ENV_ACCEPT_PREFIX}; s += util::utos(i + 1); s += '='; if (addr.host_unix) { @@ -569,7 +584,7 @@ void exec_binary() { envp[envidx++] = const_cast(fd_envs.back().c_str()); } - auto ipc_fd_str = ENV_ORIG_PID.str(); + auto ipc_fd_str = std::string{ENV_ORIG_PID}; ipc_fd_str += '='; ipc_fd_str += util::utos(config->pid); envp[envidx++] = const_cast(ipc_fd_str.c_str()); @@ -578,13 +593,13 @@ void exec_binary() { std::vector quic_lwps; for (size_t i = 0; i < worker_processes.size(); ++i) { auto &wp = worker_processes[i]; - auto s = ENV_QUIC_WORKER_PROCESS_PREFIX.str(); + auto s = std::string{ENV_QUIC_WORKER_PROCESS_PREFIX}; s += util::utos(i + 1); s += '='; s += util::utos(wp->quic_ipc_fd); - for (auto &cid_prefix : wp->cid_prefixes) { + for (auto &wid : wp->worker_ids) { s += ','; - s += util::format_hex(cid_prefix); + s += util::format_hex(std::span{&wid, 1}); } quic_lwps.emplace_back(s); @@ -725,16 +740,16 @@ int create_unix_domain_server_socket(UpstreamAddr &faddr, std::vector &iaddrs) { std::array errbuf; auto found = std::find_if( - std::begin(iaddrs), std::end(iaddrs), [&faddr](const InheritedAddr &ia) { - return !ia.used && ia.host_unix && ia.host == faddr.host; - }); + std::begin(iaddrs), std::end(iaddrs), [&faddr](const InheritedAddr &ia) { + return !ia.used && ia.host_unix && ia.host == faddr.host; + }); if (found != std::end(iaddrs)) { LOG(NOTICE) << "Listening on UNIX domain socket " << faddr.host << (faddr.tls ? ", tls" : ""); (*found).used = true; faddr.fd = (*found).fd; - faddr.hostport = StringRef::from_lit("localhost"); + faddr.hostport = "localhost"_sr; return 0; } @@ -776,10 +791,10 @@ int create_unix_domain_server_socket(UpstreamAddr &faddr, return -1; } // copy path including terminal NULL - std::copy_n(faddr.host.c_str(), faddr.host.size() + 1, addr.un.sun_path); + std::copy_n(faddr.host.data(), faddr.host.size() + 1, addr.un.sun_path); // unlink (remove) already existing UNIX domain socket path - unlink(faddr.host.c_str()); + unlink(faddr.host.data()); if (bind(fd, &addr.sa, sizeof(addr.un)) != 0) { auto error = errno; @@ -803,7 +818,7 @@ int create_unix_domain_server_socket(UpstreamAddr &faddr, << (faddr.tls ? ", tls" : ""); faddr.fd = fd; - faddr.hostport = StringRef::from_lit("localhost"); + faddr.hostport = "localhost"_sr; return 0; } @@ -827,8 +842,7 @@ int create_tcp_server_socket(UpstreamAddr &faddr, hints.ai_flags |= AI_ADDRCONFIG; #endif // AI_ADDRCONFIG - auto node = - faddr.host == StringRef::from_lit("*") ? nullptr : faddr.host.c_str(); + auto node = faddr.host == "*"_sr ? nullptr : faddr.host.data(); addrinfo *res, *rp; rv = getaddrinfo(node, service.c_str(), &hints, &res); @@ -851,7 +865,6 @@ int create_tcp_server_socket(UpstreamAddr &faddr, std::array host; for (rp = res; rp; rp = rp->ai_next) { - rv = getnameinfo(rp->ai_addr, rp->ai_addrlen, host.data(), host.size(), nullptr, 0, NI_NUMERICHOST); @@ -860,10 +873,12 @@ int create_tcp_server_socket(UpstreamAddr &faddr, continue; } + auto host_sr = StringRef{host.data()}; + auto found = std::find_if(std::begin(iaddrs), std::end(iaddrs), - [&host, &faddr](const InheritedAddr &ia) { + [&host_sr, &faddr](const InheritedAddr &ia) { return !ia.used && !ia.host_unix && - ia.host == host.data() && + ia.host == host_sr && ia.port == faddr.port; }); @@ -875,7 +890,7 @@ int create_tcp_server_socket(UpstreamAddr &faddr, #ifdef SOCK_NONBLOCK fd = - socket(rp->ai_family, rp->ai_socktype | SOCK_NONBLOCK, rp->ai_protocol); + socket(rp->ai_family, rp->ai_socktype | SOCK_NONBLOCK, rp->ai_protocol); if (fd == -1) { auto error = errno; LOG(WARN) << "socket() syscall failed: " @@ -1049,13 +1064,13 @@ std::vector get_inherited_addr_from_env(Config *config) { { // Upgrade from 1.7.0 or earlier - auto portenv = getenv(ENV_PORT.c_str()); + auto portenv = getenv(ENV_PORT.data()); if (portenv) { size_t i = 1; for (const auto &env_name : {ENV_LISTENER4_FD, ENV_LISTENER6_FD}) { - auto fdenv = getenv(env_name.c_str()); + auto fdenv = getenv(env_name.data()); if (fdenv) { - auto name = ENV_ACCEPT_PREFIX.str(); + auto name = std::string{ENV_ACCEPT_PREFIX}; name += util::utos(i); std::string value = "tcp,"; value += fdenv; @@ -1065,20 +1080,20 @@ std::vector get_inherited_addr_from_env(Config *config) { } } else { // The return value of getenv may be allocated statically. - if (getenv(ENV_UNIX_PATH.c_str()) && getenv(ENV_UNIX_FD.c_str())) { - auto name = ENV_ACCEPT_PREFIX.str(); + if (getenv(ENV_UNIX_PATH.data()) && getenv(ENV_UNIX_FD.data())) { + auto name = std::string{ENV_ACCEPT_PREFIX}; name += '1'; std::string value = "unix,"; - value += getenv(ENV_UNIX_FD.c_str()); + value += getenv(ENV_UNIX_FD.data()); value += ','; - value += getenv(ENV_UNIX_PATH.c_str()); + value += getenv(ENV_UNIX_PATH.data()); setenv(name.c_str(), value.c_str(), 0); } } } for (size_t i = 1;; ++i) { - auto name = ENV_ACCEPT_PREFIX.str(); + auto name = std::string{ENV_ACCEPT_PREFIX}; name += util::utos(i); auto env = getenv(name.c_str()); if (!env) { @@ -1097,14 +1112,13 @@ std::vector get_inherited_addr_from_env(Config *config) { auto type = StringRef(env, end_type); auto value = end_type + 1; - if (type == StringRef::from_lit("unix")) { + if (type == "unix"_sr) { auto endfd = strchr(value, ','); if (!endfd) { continue; } - auto fd = util::parse_uint(reinterpret_cast(value), - endfd - value); - if (fd == -1) { + auto fd = util::parse_uint(StringRef{value, endfd}); + if (!fd) { LOG(WARN) << "Could not parse file descriptor from " << std::string(value, endfd - value); continue; @@ -1112,26 +1126,26 @@ std::vector get_inherited_addr_from_env(Config *config) { auto path = endfd + 1; if (strlen(path) == 0) { - LOG(WARN) << "Empty UNIX domain socket path (fd=" << fd << ")"; - close(fd); + LOG(WARN) << "Empty UNIX domain socket path (fd=" << *fd << ")"; + close(*fd); continue; } if (LOG_ENABLED(INFO)) { - LOG(INFO) << "Inherit UNIX domain socket fd=" << fd + LOG(INFO) << "Inherit UNIX domain socket fd=" << *fd << ", path=" << path; } InheritedAddr addr{}; addr.host = make_string_ref(config->balloc, StringRef{path}); addr.host_unix = true; - addr.fd = static_cast(fd); + addr.fd = static_cast(*fd); iaddrs.push_back(std::move(addr)); } - if (type == StringRef::from_lit("tcp")) { + if (type == "tcp"_sr) { auto fd = util::parse_uint(value); - if (fd == -1) { + if (!fd) { LOG(WARN) << "Could not parse file descriptor from " << value; continue; } @@ -1139,11 +1153,11 @@ std::vector get_inherited_addr_from_env(Config *config) { sockaddr_union su; socklen_t salen = sizeof(su); - if (getsockname(fd, &su.sa, &salen) != 0) { + if (getsockname(*fd, &su.sa, &salen) != 0) { auto error = errno; - LOG(WARN) << "getsockname() syscall failed (fd=" << fd + LOG(WARN) << "getsockname() syscall failed (fd=" << *fd << "): " << xsi_strerror(error, errbuf.data(), errbuf.size()); - close(fd); + close(*fd); continue; } @@ -1157,7 +1171,7 @@ std::vector get_inherited_addr_from_env(Config *config) { port = ntohs(su.in6.sin6_port); break; default: - close(fd); + close(*fd); continue; } @@ -1165,21 +1179,21 @@ std::vector get_inherited_addr_from_env(Config *config) { rv = getnameinfo(&su.sa, salen, host.data(), host.size(), nullptr, 0, NI_NUMERICHOST); if (rv != 0) { - LOG(WARN) << "getnameinfo() failed (fd=" << fd + LOG(WARN) << "getnameinfo() failed (fd=" << *fd << "): " << gai_strerror(rv); - close(fd); + close(*fd); continue; } if (LOG_ENABLED(INFO)) { - LOG(INFO) << "Inherit TCP socket fd=" << fd + LOG(INFO) << "Inherit TCP socket fd=" << *fd << ", address=" << host.data() << ", port=" << port; } InheritedAddr addr{}; addr.host = make_string_ref(config->balloc, StringRef{host.data()}); addr.port = static_cast(port); - addr.fd = static_cast(fd); + addr.fd = static_cast(*fd); iaddrs.push_back(std::move(addr)); continue; } @@ -1206,27 +1220,27 @@ namespace { // Returns the PID of the original main process from environment // variable ENV_ORIG_PID. pid_t get_orig_pid_from_env() { - auto s = getenv(ENV_ORIG_PID.c_str()); + auto s = getenv(ENV_ORIG_PID.data()); if (s == nullptr) { return -1; } - return util::parse_uint(s); + return util::parse_uint(s).value_or(-1); } } // namespace #ifdef ENABLE_HTTP3 namespace { std::vector - inherited_quic_lingering_worker_processes; + inherited_quic_lingering_worker_processes; } // namespace namespace { std::vector get_inherited_quic_lingering_worker_process_from_env() { - std::vector iwps; + std::vector lwps; for (size_t i = 1;; ++i) { - auto name = ENV_QUIC_WORKER_PROCESS_PREFIX.str(); + auto name = std::string{ENV_QUIC_WORKER_PROCESS_PREFIX}; name += util::utos(i); auto env = getenv(name.c_str()); if (!env) { @@ -1244,40 +1258,40 @@ get_inherited_quic_lingering_worker_process_from_env() { continue; } - auto fd = - util::parse_uint(reinterpret_cast(env), end_fd - env); - if (fd == -1) { + auto fd = util::parse_uint(StringRef{env, end_fd}); + if (!fd) { LOG(WARN) << "Could not parse file descriptor from " << StringRef{env, static_cast(end_fd - env)}; continue; } if (LOG_ENABLED(INFO)) { - LOG(INFO) << "Inherit worker process QUIC IPC socket fd=" << fd; + LOG(INFO) << "Inherit worker process QUIC IPC socket fd=" << *fd; } - util::make_socket_closeonexec(fd); + util::make_socket_closeonexec(*fd); - std::vector> cid_prefixes; + std::vector worker_ids; auto p = end_fd + 1; for (;;) { auto end = std::find(p, envend, ','); - auto hex_cid_prefix = StringRef{p, end}; - if (hex_cid_prefix.size() != SHRPX_QUIC_CID_PREFIXLEN * 2 || - !util::is_hex_string(hex_cid_prefix)) { - LOG(WARN) << "Found invalid CID prefix=" << hex_cid_prefix; + auto hex_wid = StringRef{p, end}; + if (hex_wid.size() != SHRPX_QUIC_WORKER_IDLEN * 2 || + !util::is_hex_string(hex_wid)) { + LOG(WARN) << "Found invalid WorkerID=" << hex_wid; break; } if (LOG_ENABLED(INFO)) { - LOG(INFO) << "Inherit worker process CID prefix=" << hex_cid_prefix; + LOG(INFO) << "Inherit worker process WorkerID=" << hex_wid; } - cid_prefixes.emplace_back(); + worker_ids.emplace_back(); - util::decode_hex(std::begin(cid_prefixes.back()), hex_cid_prefix); + util::decode_hex(reinterpret_cast(&worker_ids.back()), + hex_wid); if (end == envend) { break; @@ -1286,10 +1300,20 @@ get_inherited_quic_lingering_worker_process_from_env() { p = end + 1; } - iwps.emplace_back(std::move(cid_prefixes), fd); + lwps.emplace_back(std::move(worker_ids), *fd); + } + + if (!lwps.empty()) { + const auto &lwp = lwps.back(); + + if (!lwp.worker_ids.empty() && + worker_process_seq <= lwp.worker_ids[0].worker_process) { + worker_process_seq = lwp.worker_ids[0].worker_process; + ++worker_process_seq; + } } - return iwps; + return lwps; } } // namespace #endif // ENABLE_HTTP3 @@ -1308,7 +1332,7 @@ int create_acceptor_socket(Config *config, std::vector &iaddrs) { if (config->uid != 0) { // fd is not associated to inode, so we cannot use fchown(2) // here. https://lkml.org/lkml/2004/11/1/84 - if (chown(addr.host.c_str(), config->uid, config->gid) == -1) { + if (chown(addr.host.data(), config->uid, config->gid) == -1) { auto error = errno; LOG(WARN) << "Changing owner of UNIX domain socket " << addr.host << " failed: " @@ -1349,7 +1373,7 @@ namespace { // communication is unidirectional; that is main process sends // messages to the worker process. On success, ipc_fd[0] is for // reading, and ipc_fd[1] for writing, just like pipe(2). -int create_ipc_socket(std::array &ipc_fd) { +int create_ipc_socket(std::span ipc_fd) { std::array errbuf; int rv; @@ -1361,8 +1385,7 @@ int create_ipc_socket(std::array &ipc_fd) { return -1; } - for (int i = 0; i < 2; ++i) { - auto fd = ipc_fd[i]; + for (auto fd : ipc_fd) { util::make_socket_nonblocking(fd); util::make_socket_closeonexec(fd); } @@ -1372,7 +1395,7 @@ int create_ipc_socket(std::array &ipc_fd) { } // namespace namespace { -int create_worker_process_ready_ipc_socket(std::array &ipc_fd) { +int create_worker_process_ready_ipc_socket(std::span ipc_fd) { std::array errbuf; int rv; @@ -1397,7 +1420,7 @@ int create_worker_process_ready_ipc_socket(std::array &ipc_fd) { #ifdef ENABLE_HTTP3 namespace { -int create_quic_ipc_socket(std::array &quic_ipc_fd) { +int create_quic_ipc_socket(std::span quic_ipc_fd) { std::array errbuf; int rv; @@ -1418,32 +1441,33 @@ int create_quic_ipc_socket(std::array &quic_ipc_fd) { } // namespace namespace { -int generate_cid_prefix( - std::vector> &cid_prefixes, - const Config *config) { +int generate_worker_id(std::vector &worker_ids, uint16_t wp_seq, + const Config *config) { auto &apiconf = config->api; auto &quicconf = config->quic; - size_t num_cid_prefix; + size_t num_wid; if (config->single_thread) { - num_cid_prefix = 1; + num_wid = 1; } else { - num_cid_prefix = config->num_worker; + num_wid = config->num_worker; // API endpoint occupies the one dedicated worker thread. - // Although such worker never gets QUIC traffic, we create CID - // prefix for it to make code a bit simpler. + // Although such worker never gets QUIC traffic, we create Worker + // ID for it to make code a bit simpler. if (apiconf.enabled) { - ++num_cid_prefix; + ++num_wid; } } - cid_prefixes.resize(num_cid_prefix); + worker_ids.resize(num_wid); - for (auto &cid_prefix : cid_prefixes) { - if (create_cid_prefix(cid_prefix.data(), quicconf.server_id.data()) != 0) { - return -1; - } + uint16_t idx = 0; + + for (auto &wid : worker_ids) { + wid.server = quicconf.server_id; + wid.worker_process = wp_seq; + wid.thread = idx++; } return 0; @@ -1454,11 +1478,11 @@ namespace { std::vector collect_quic_lingering_worker_processes() { std::vector quic_lwps{ - std::begin(inherited_quic_lingering_worker_processes), - std::end(inherited_quic_lingering_worker_processes)}; + std::begin(inherited_quic_lingering_worker_processes), + std::end(inherited_quic_lingering_worker_processes)}; for (auto &wp : worker_processes) { - quic_lwps.emplace_back(wp->cid_prefixes, wp->quic_ipc_fd); + quic_lwps.emplace_back(wp->worker_ids, wp->quic_ipc_fd); } return quic_lwps; @@ -1596,19 +1620,17 @@ namespace { // |main_ipc_fd|. In child process, we will close file descriptors // which are inherited from previous configuration/process, but not // used in the current configuration. -pid_t fork_worker_process( - int &main_ipc_fd +pid_t fork_worker_process(int &main_ipc_fd #ifdef ENABLE_HTTP3 - , - int &wp_quic_ipc_fd + , + int &wp_quic_ipc_fd #endif // ENABLE_HTTP3 - , - const std::vector &iaddrs + , + const std::vector &iaddrs #ifdef ENABLE_HTTP3 - , - const std::vector> - &cid_prefixes, - const std::vector &quic_lwps + , + std::vector worker_ids, + std::vector quic_lwps #endif // ENABLE_HTTP3 ) { std::array errbuf; @@ -1711,12 +1733,12 @@ pid_t fork_worker_process( } WorkerProcessConfig wpconf{ - .ipc_fd = ipc_fd[0], - .ready_ipc_fd = worker_process_ready_ipc_fd[1], + .ipc_fd = ipc_fd[0], + .ready_ipc_fd = worker_process_ready_ipc_fd[1], #ifdef ENABLE_HTTP3 - .cid_prefixes = cid_prefixes, - .quic_ipc_fd = quic_ipc_fd[0], - .quic_lingering_worker_processes = quic_lwps, + .worker_ids = std::move(worker_ids), + .quic_ipc_fd = quic_ipc_fd[0], + .quic_lingering_worker_processes = std::move(quic_lwps), #endif // ENABLE_HTTP3 }; rv = worker_process_event_loop(&wpconf); @@ -1824,7 +1846,7 @@ int event_loop() { #ifdef ENABLE_HTTP3 inherited_quic_lingering_worker_processes = - get_inherited_quic_lingering_worker_process_from_env(); + get_inherited_quic_lingering_worker_process_from_env(); #endif // ENABLE_HTTP3 auto loop = ev_default_loop(config->ev_loop_flags); @@ -1835,9 +1857,9 @@ int event_loop() { auto quic_lwps = collect_quic_lingering_worker_processes(); - std::vector> cid_prefixes; + std::vector worker_ids; - if (generate_cid_prefix(cid_prefixes, config) != 0) { + if (generate_worker_id(worker_ids, worker_process_seq, config) != 0) { return -1; } #endif // ENABLE_HTTP3 @@ -1858,7 +1880,7 @@ int event_loop() { {} #ifdef ENABLE_HTTP3 , - cid_prefixes, quic_lwps + worker_ids, std::move(quic_lwps) #endif // ENABLE_HTTP3 ); @@ -1869,12 +1891,13 @@ int event_loop() { ev_timer_init(&worker_process_grace_period_timer, worker_process_grace_period_timercb, 0., 0.); - worker_process_add(std::make_unique(loop, pid, ipc_fd + worker_process_add(std::make_unique( + loop, pid, ipc_fd #ifdef ENABLE_HTTP3 - , - quic_ipc_fd, cid_prefixes + , + quic_ipc_fd, std::move(worker_ids), worker_process_seq++ #endif // ENABLE_HTTP3 - )); + )); // Write PID file when we are ready to accept connection from peer. // This makes easier to write restart script for nghttpx. Because @@ -1911,30 +1934,29 @@ bool conf_exists(const char *path) { } // namespace namespace { -constexpr auto DEFAULT_NPN_LIST = - StringRef::from_lit("h2,h2-16,h2-14,http/1.1"); +constexpr auto DEFAULT_ALPN_LIST = "h2,h2-16,h2-14,http/1.1"_sr; } // namespace namespace { -constexpr auto DEFAULT_TLS_MIN_PROTO_VERSION = StringRef::from_lit("TLSv1.2"); +constexpr auto DEFAULT_TLS_MIN_PROTO_VERSION = "TLSv1.2"_sr; #ifdef TLS1_3_VERSION -constexpr auto DEFAULT_TLS_MAX_PROTO_VERSION = StringRef::from_lit("TLSv1.3"); +constexpr auto DEFAULT_TLS_MAX_PROTO_VERSION = "TLSv1.3"_sr; #else // !TLS1_3_VERSION -constexpr auto DEFAULT_TLS_MAX_PROTO_VERSION = StringRef::from_lit("TLSv1.2"); +constexpr auto DEFAULT_TLS_MAX_PROTO_VERSION = "TLSv1.2"_sr; #endif // !TLS1_3_VERSION } // namespace namespace { constexpr auto DEFAULT_ACCESSLOG_FORMAT = - StringRef::from_lit(R"($remote_addr - - [$time_local] )" - R"("$request" $status $body_bytes_sent )" - R"("$http_referer" "$http_user_agent")"); + R"($remote_addr - - [$time_local] )" + R"("$request" $status $body_bytes_sent )" + R"("$http_referer" "$http_user_agent")"_sr; } // namespace namespace { void fill_default_config(Config *config) { config->num_worker = 1; - config->conf_path = StringRef::from_lit("/etc/nghttpx/nghttpx.conf"); + config->conf_path = "/etc/nghttpx/nghttpx.conf"_sr; config->pid = getpid(); #ifdef NOTHREADS @@ -1969,8 +1991,7 @@ void fill_default_config(Config *config) { auto &ocspconf = tlsconf.ocsp; // ocsp update interval = 14400 secs = 4 hours, borrowed from h2o ocspconf.update_interval = 4_h; - ocspconf.fetch_ocsp_response_file = - StringRef::from_lit(PKGDATADIR "/fetch-ocsp-response"); + ocspconf.fetch_ocsp_response_file = PKGDATADIR "/fetch-ocsp-response"_sr; } { @@ -1980,36 +2001,31 @@ void fill_default_config(Config *config) { } tlsconf.session_timeout = std::chrono::hours(12); - tlsconf.ciphers = StringRef::from_lit(nghttp2::tls::DEFAULT_CIPHER_LIST); - tlsconf.tls13_ciphers = - StringRef::from_lit(nghttp2::tls::DEFAULT_TLS13_CIPHER_LIST); - tlsconf.client.ciphers = - StringRef::from_lit(nghttp2::tls::DEFAULT_CIPHER_LIST); + tlsconf.ciphers = StringRef{nghttp2::tls::DEFAULT_CIPHER_LIST}; + tlsconf.tls13_ciphers = StringRef{nghttp2::tls::DEFAULT_TLS13_CIPHER_LIST}; + tlsconf.client.ciphers = StringRef{nghttp2::tls::DEFAULT_CIPHER_LIST}; tlsconf.client.tls13_ciphers = - StringRef::from_lit(nghttp2::tls::DEFAULT_TLS13_CIPHER_LIST); + StringRef{nghttp2::tls::DEFAULT_TLS13_CIPHER_LIST}; tlsconf.min_proto_version = - tls::proto_version_from_string(DEFAULT_TLS_MIN_PROTO_VERSION); + tls::proto_version_from_string(DEFAULT_TLS_MIN_PROTO_VERSION); tlsconf.max_proto_version = - tls::proto_version_from_string(DEFAULT_TLS_MAX_PROTO_VERSION); + tls::proto_version_from_string(DEFAULT_TLS_MAX_PROTO_VERSION); tlsconf.max_early_data = 16_k; -#if OPENSSL_1_1_API || defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - tlsconf.ecdh_curves = StringRef::from_lit("X25519:P-256:P-384:P-521"); -#else // !OPENSSL_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - tlsconf.ecdh_curves = StringRef::from_lit("P-256:P-384:P-521"); -#endif // !OPENSSL_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) + tlsconf.ecdh_curves = "X25519:P-256:P-384:P-521"_sr; auto &httpconf = config->http; - httpconf.server_name = StringRef::from_lit("nghttpx"); + httpconf.server_name = "nghttpx"_sr; httpconf.no_host_rewrite = true; httpconf.request_header_field_buffer = 64_k; httpconf.max_request_header_fields = 100; httpconf.response_header_field_buffer = 64_k; httpconf.max_response_header_fields = 500; - httpconf.redirect_https_port = StringRef::from_lit("443"); + httpconf.redirect_https_port = "443"_sr; httpconf.max_requests = std::numeric_limits::max(); httpconf.xfp.add = true; httpconf.xfp.strip_incoming = true; httpconf.early_data.strip_incoming = true; + httpconf.timeout.header = 1_min; auto &http2conf = config->http2; { @@ -2035,7 +2051,7 @@ void fill_default_config(Config *config) { nghttp2_option_set_no_auto_window_update(upstreamconf.option, 1); nghttp2_option_set_no_recv_client_magic(upstreamconf.option, 1); nghttp2_option_set_max_deflate_dynamic_table_size( - upstreamconf.option, upstreamconf.encoder_dynamic_table_size); + upstreamconf.option, upstreamconf.encoder_dynamic_table_size); nghttp2_option_set_server_fallback_rfc7540_priorities(upstreamconf.option, 1); nghttp2_option_set_builtin_recv_extension_type(upstreamconf.option, @@ -2046,7 +2062,7 @@ void fill_default_config(Config *config) { nghttp2_option_new(&upstreamconf.alt_mode_option); nghttp2_option_set_no_recv_client_magic(upstreamconf.alt_mode_option, 1); nghttp2_option_set_max_deflate_dynamic_table_size( - upstreamconf.alt_mode_option, upstreamconf.encoder_dynamic_table_size); + upstreamconf.alt_mode_option, upstreamconf.encoder_dynamic_table_size); } http2conf.timeout.stream_write = 1_min; @@ -2070,7 +2086,7 @@ void fill_default_config(Config *config) { nghttp2_option_set_no_auto_window_update(downstreamconf.option, 1); nghttp2_option_set_peer_max_concurrent_streams(downstreamconf.option, 100); nghttp2_option_set_max_deflate_dynamic_table_size( - downstreamconf.option, downstreamconf.encoder_dynamic_table_size); + downstreamconf.option, downstreamconf.encoder_dynamic_table_size); } #ifdef ENABLE_HTTP3 @@ -2084,15 +2100,16 @@ void fill_default_config(Config *config) { } auto &bpfconf = quicconf.bpf; - bpfconf.prog_file = StringRef::from_lit(PKGLIBDIR "/reuseport_kern.o"); + bpfconf.prog_file = PKGLIBDIR "/reuseport_kern.o"_sr; upstreamconf.congestion_controller = NGTCP2_CC_ALGO_CUBIC; upstreamconf.initial_rtt = - static_cast(NGTCP2_DEFAULT_INITIAL_RTT) / NGTCP2_SECONDS; + static_cast(NGTCP2_DEFAULT_INITIAL_RTT) / NGTCP2_SECONDS; } - if (RAND_bytes(quicconf.server_id.data(), quicconf.server_id.size()) != 1) { + if (RAND_bytes(reinterpret_cast(&quicconf.server_id), + sizeof(quicconf.server_id)) != 1) { assert(0); abort(); } @@ -2113,10 +2130,10 @@ void fill_default_config(Config *config) { { auto &accessconf = loggingconf.access; accessconf.format = - parse_log_format(config->balloc, DEFAULT_ACCESSLOG_FORMAT); + parse_log_format(config->balloc, DEFAULT_ACCESSLOG_FORMAT); auto &errorconf = loggingconf.error; - errorconf.file = StringRef::from_lit("/dev/stderr"); + errorconf.file = "/dev/stderr"_sr; } loggingconf.syslog_facility = LOG_DAEMON; @@ -2136,20 +2153,17 @@ void fill_default_config(Config *config) { auto &upstreamconf = connconf.upstream; { auto &timeoutconf = upstreamconf.timeout; - // Read timeout for HTTP2 upstream connection - timeoutconf.http2_read = 3_min; + // Idle timeout for HTTP2 upstream connection + timeoutconf.http2_idle = 3_min; - // Read timeout for HTTP3 upstream connection - timeoutconf.http3_read = 3_min; - - // Read timeout for non-HTTP2 upstream connection - timeoutconf.read = 1_min; + // Idle timeout for HTTP3 upstream connection + timeoutconf.http3_idle = 3_min; // Write timeout for HTTP2/non-HTTP2 upstream connection timeoutconf.write = 30_s; - // Keep alive timeout for HTTP/1 upstream connection - timeoutconf.idle_read = 1_min; + // Keep alive (idle) timeout for HTTP/1 upstream connection + timeoutconf.idle = 1_min; } } @@ -2648,18 +2662,18 @@ void print_help(std::ostream &out) { this option will be simply ignored. Timeout: - --frontend-http2-read-timeout= - Specify read timeout for HTTP/2 frontend connection. - Default: )" - << util::duration_str(config->conn.upstream.timeout.http2_read) << R"( - --frontend-http3-read-timeout= - Specify read timeout for HTTP/3 frontend connection. + --frontend-http2-idle-timeout= + Specify idle timeout for HTTP/2 frontend connection. If + no active streams exist for this duration, connection is + closed. Default: )" - << util::duration_str(config->conn.upstream.timeout.http3_read) << R"( - --frontend-read-timeout= - Specify read timeout for HTTP/1.1 frontend connection. + << util::duration_str(config->conn.upstream.timeout.http2_idle) << R"( + --frontend-http3-idle-timeout= + Specify idle timeout for HTTP/3 frontend connection. If + no active streams exist for this duration, connection is + closed. Default: )" - << util::duration_str(config->conn.upstream.timeout.read) << R"( + << util::duration_str(config->conn.upstream.timeout.http3_idle) << R"( --frontend-write-timeout= Specify write timeout for all frontend connections. Default: )" @@ -2668,7 +2682,15 @@ void print_help(std::ostream &out) { Specify keep-alive timeout for frontend HTTP/1 connection. Default: )" - << util::duration_str(config->conn.upstream.timeout.idle_read) << R"( + << util::duration_str(config->conn.upstream.timeout.idle) << R"( + --frontend-header-timeout= + Specify duration that the server waits for an HTTP + request header fields to be received completely. On + timeout, HTTP/1 and HTTP/2 connections are closed. For + HTTP/3, the stream is shutdown, and the connection + itself is left intact. + Default: )" + << util::duration_str(config->http.timeout.header) << R"( --stream-read-timeout= Specify read timeout for HTTP/2 streams. 0 means no timeout. @@ -2802,15 +2824,14 @@ SSL/TLS: Path to file that contains DH parameters in PEM format. Without this option, DHE cipher suites are not available. - --npn-list= + --alpn-list= Comma delimited list of ALPN protocol identifier sorted in the order of preference. That means most desirable - protocol comes first. This is used in both ALPN and - NPN. The parameter must be delimited by a single comma - only and any white spaces are treated as a part of - protocol string. + protocol comes first. The parameter must be delimited + by a single comma only and any white spaces are treated + as a part of protocol string. Default: )" - << DEFAULT_NPN_LIST + << DEFAULT_ALPN_LIST << R"( --verify-client Require and verify client certificate. @@ -3526,8 +3547,8 @@ HTTP/3 and QUIC: "bbr". Default: )" << (config->quic.upstream.congestion_controller == NGTCP2_CC_ALGO_CUBIC - ? "cubic" - : "bbr") + ? "cubic" + : "bbr") << R"( --frontend-quic-secret-file= Path to file that contains secure random data to be used @@ -3535,12 +3556,12 @@ HTTP/3 and QUIC: encrypting tokens and Connection IDs. It is not used to encrypt QUIC packets. Each line of this file must contain exactly 136 bytes hex-encoded string (when - decoded the byte string is 68 bytes long). The first 2 + decoded the byte string is 68 bytes long). The first 3 bits of decoded byte string are used to identify the keying material. An empty line or a line which starts '#' is ignored. The file can contain more than one - keying materials. Because the identifier is 2 bits, at - most 4 keying materials are read and the remaining data + keying materials. Because the identifier is 3 bits, at + most 8 keying materials are read and the remaining data is discarded. The first keying material in the file is primarily used for encryption and decryption for new connection. The other ones are used to decrypt data for @@ -3639,10 +3660,10 @@ int process_options(Config *config, std::vector> &cmdcfgs) { std::array errbuf; std::map pattern_addr_indexer; - if (conf_exists(config->conf_path.c_str())) { + if (conf_exists(config->conf_path.data())) { LOG(NOTICE) << "Loading configuration from " << config->conf_path; std::set include_set; - if (load_config(config, config->conf_path.c_str(), include_set, + if (load_config(config, config->conf_path.data(), include_set, pattern_addr_indexer) == -1) { LOG(FATAL) << "Failed to load configuration from " << config->conf_path; return -1; @@ -3708,7 +3729,7 @@ int process_options(Config *config, auto &dumpconf = http2conf.upstream.debug.dump; if (!dumpconf.request_header_file.empty()) { - auto path = dumpconf.request_header_file.c_str(); + auto path = dumpconf.request_header_file.data(); auto f = open_file_for_write(path); if (f == nullptr) { @@ -3730,7 +3751,7 @@ int process_options(Config *config, } if (!dumpconf.response_header_file.empty()) { - auto path = dumpconf.response_header_file.c_str(); + auto path = dumpconf.response_header_file.data(); auto f = open_file_for_write(path); if (f == nullptr) { @@ -3754,8 +3775,8 @@ int process_options(Config *config, auto &tlsconf = config->tls; - if (tlsconf.npn_list.empty()) { - tlsconf.npn_list = util::split_str(DEFAULT_NPN_LIST, ','); + if (tlsconf.alpn_list.empty()) { + tlsconf.alpn_list = util::split_str(DEFAULT_ALPN_LIST, ','); } if (!tlsconf.tls_proto_list.empty()) { @@ -3770,18 +3791,23 @@ int process_options(Config *config, return -1; } - if (tls::set_alpn_prefs(tlsconf.alpn_prefs, tlsconf.npn_list) != 0) { + if (tls::set_alpn_prefs(tlsconf.alpn_prefs, tlsconf.alpn_list) != 0) { return -1; } +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_BORINGSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) tlsconf.bio_method = create_bio_method(); +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_BORINGSSL || + // NGHTTP2_OPENSSL_IS_LIBRESSL auto &listenerconf = config->conn.listener; auto &upstreamconf = config->conn.upstream; if (listenerconf.addrs.empty()) { UpstreamAddr addr{}; - addr.host = StringRef::from_lit("*"); + addr.host = "*"_sr; addr.port = 3000; addr.tls = true; addr.family = AF_INET; @@ -3806,7 +3832,7 @@ int process_options(Config *config, if (tls::upstream_tls_enabled(config->conn) && !tlsconf.ocsp.disabled) { struct stat buf; - if (stat(tlsconf.ocsp.fetch_ocsp_response_file.c_str(), &buf) != 0) { + if (stat(tlsconf.ocsp.fetch_ocsp_response_file.data(), &buf) != 0) { tlsconf.ocsp.disabled = true; LOG(WARN) << "--fetch-ocsp-response-file: " << tlsconf.ocsp.fetch_ocsp_response_file @@ -3825,7 +3851,7 @@ int process_options(Config *config, if (!proxy.host.empty()) { auto hostport = util::make_hostport(std::begin(hostport_buf), StringRef{proxy.host}, proxy.port); - if (resolve_hostname(&proxy.addr, proxy.host.c_str(), proxy.port, + if (resolve_hostname(&proxy.addr, proxy.host.data(), proxy.port, AF_UNSPEC) == -1) { LOG(FATAL) << "Resolving backend HTTP proxy address failed: " << hostport; return -1; @@ -3837,14 +3863,14 @@ int process_options(Config *config, { auto &memcachedconf = tlsconf.session_cache.memcached; if (!memcachedconf.host.empty()) { - auto hostport = util::make_hostport(std::begin(hostport_buf), - StringRef{memcachedconf.host}, - memcachedconf.port); - if (resolve_hostname(&memcachedconf.addr, memcachedconf.host.c_str(), + auto hostport = + util::make_hostport(std::begin(hostport_buf), + StringRef{memcachedconf.host}, memcachedconf.port); + if (resolve_hostname(&memcachedconf.addr, memcachedconf.host.data(), memcachedconf.port, memcachedconf.family) == -1) { LOG(FATAL) - << "Resolving memcached address for TLS session cache failed: " - << hostport; + << "Resolving memcached address for TLS session cache failed: " + << hostport; return -1; } LOG(NOTICE) << "Memcached address for TLS session cache: " << hostport @@ -3859,10 +3885,10 @@ int process_options(Config *config, { auto &memcachedconf = tlsconf.ticket.memcached; if (!memcachedconf.host.empty()) { - auto hostport = util::make_hostport(std::begin(hostport_buf), - StringRef{memcachedconf.host}, - memcachedconf.port); - if (resolve_hostname(&memcachedconf.addr, memcachedconf.host.c_str(), + auto hostport = + util::make_hostport(std::begin(hostport_buf), + StringRef{memcachedconf.host}, memcachedconf.port); + if (resolve_hostname(&memcachedconf.addr, memcachedconf.host.data(), memcachedconf.port, memcachedconf.family) == -1) { LOG(FATAL) << "Resolving memcached address for TLS ticket key failed: " << hostport; @@ -3905,12 +3931,12 @@ int process_options(Config *config, fwdconf.by_obfuscated.empty()) { // 2 for '_' and terminal NULL auto iov = make_byte_ref(config->balloc, SHRPX_OBFUSCATED_NODE_LENGTH + 2); - auto p = iov.base; + auto p = std::begin(iov); *p++ = '_'; auto gen = util::make_mt19937(); p = util::random_alpha_digit(p, p + SHRPX_OBFUSCATED_NODE_LENGTH, gen); *p = '\0'; - fwdconf.by_obfuscated = StringRef{iov.base, p}; + fwdconf.by_obfuscated = StringRef{std::span{std::begin(iov), p}}; } if (config->http2.upstream.debug.frame_debug) { @@ -3927,12 +3953,12 @@ int process_options(Config *config, if (!config->http.altsvcs.empty()) { config->http.altsvc_header_value = - http::create_altsvc_header_value(config->balloc, config->http.altsvcs); + http::create_altsvc_header_value(config->balloc, config->http.altsvcs); } if (!config->http.http2_altsvcs.empty()) { config->http.http2_altsvc_header_value = http::create_altsvc_header_value( - config->balloc, config->http.http2_altsvcs); + config->balloc, config->http.http2_altsvcs); } return 0; @@ -3948,8 +3974,8 @@ void close_not_inherited_fd(Config *config, for (auto &addr : listenerconf.addrs) { auto inherited = std::find_if( - std::begin(iaddrs), std::end(iaddrs), - [&addr](const InheritedAddr &iaddr) { return addr.fd == iaddr.fd; }); + std::begin(iaddrs), std::end(iaddrs), + [&addr](const InheritedAddr &iaddr) { return addr.fd == iaddr.fd; }); if (inherited != std::end(iaddrs)) { continue; @@ -3972,7 +3998,7 @@ void reload_config() { fill_default_config(new_config.get()); new_config->conf_path = - make_string_ref(new_config->balloc, cur_config->conf_path); + make_string_ref(new_config->balloc, cur_config->conf_path); // daemon option is ignored here. new_config->daemon = cur_config->daemon; // loop is reused, and ev_loop_flags gets ignored @@ -4002,9 +4028,10 @@ void reload_config() { auto quic_lwps = collect_quic_lingering_worker_processes(); - std::vector> cid_prefixes; + std::vector worker_ids; - if (generate_cid_prefix(cid_prefixes, new_config.get()) != 0) { + if (generate_worker_id(worker_ids, worker_process_seq, new_config.get()) != + 0) { close_not_inherited_fd(new_config.get(), iaddrs); return; } @@ -4025,7 +4052,7 @@ void reload_config() { iaddrs #ifdef ENABLE_HTTP3 , - cid_prefixes, quic_lwps + worker_ids, std::move(quic_lwps) #endif // ENABLE_HTTP3 ); @@ -4040,12 +4067,13 @@ void reload_config() { close_unused_inherited_addr(iaddrs); - worker_process_add(std::make_unique(loop, pid, ipc_fd + worker_process_add(std::make_unique( + loop, pid, ipc_fd #ifdef ENABLE_HTTP3 - , - quic_ipc_fd, cid_prefixes + , + quic_ipc_fd, std::move(worker_ids), worker_process_seq++ #endif // ENABLE_HTTP3 - )); + )); worker_process_adjust_limit(); @@ -4059,16 +4087,10 @@ int main(int argc, char **argv) { int rv; std::array errbuf; - nghttp2::tls::libssl_init(); - #ifdef HAVE_LIBBPF libbpf_set_strict_mode(LIBBPF_STRICT_ALL); #endif // HAVE_LIBBPF -#ifndef NOTHREADS - nghttp2::tls::LibsslGlobalLock lock; -#endif // NOTHREADS - Log::set_severity_level(NOTICE); create_config(); fill_default_config(mod_config()); @@ -4108,296 +4130,282 @@ int main(int argc, char **argv) { while (1) { static int flag = 0; static constexpr option long_options[] = { - {SHRPX_OPT_DAEMON.c_str(), no_argument, nullptr, 'D'}, - {SHRPX_OPT_LOG_LEVEL.c_str(), required_argument, nullptr, 'L'}, - {SHRPX_OPT_BACKEND.c_str(), required_argument, nullptr, 'b'}, - {SHRPX_OPT_HTTP2_MAX_CONCURRENT_STREAMS.c_str(), required_argument, - nullptr, 'c'}, - {SHRPX_OPT_FRONTEND.c_str(), required_argument, nullptr, 'f'}, - {"help", no_argument, nullptr, 'h'}, - {SHRPX_OPT_INSECURE.c_str(), no_argument, nullptr, 'k'}, - {SHRPX_OPT_WORKERS.c_str(), required_argument, nullptr, 'n'}, - {SHRPX_OPT_CLIENT_PROXY.c_str(), no_argument, nullptr, 'p'}, - {SHRPX_OPT_HTTP2_PROXY.c_str(), no_argument, nullptr, 's'}, - {"version", no_argument, nullptr, 'v'}, - {SHRPX_OPT_FRONTEND_FRAME_DEBUG.c_str(), no_argument, nullptr, 'o'}, - {SHRPX_OPT_ADD_X_FORWARDED_FOR.c_str(), no_argument, &flag, 1}, - {SHRPX_OPT_FRONTEND_HTTP2_READ_TIMEOUT.c_str(), required_argument, - &flag, 2}, - {SHRPX_OPT_FRONTEND_READ_TIMEOUT.c_str(), required_argument, &flag, 3}, - {SHRPX_OPT_FRONTEND_WRITE_TIMEOUT.c_str(), required_argument, &flag, 4}, - {SHRPX_OPT_BACKEND_READ_TIMEOUT.c_str(), required_argument, &flag, 5}, - {SHRPX_OPT_BACKEND_WRITE_TIMEOUT.c_str(), required_argument, &flag, 6}, - {SHRPX_OPT_ACCESSLOG_FILE.c_str(), required_argument, &flag, 7}, - {SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT.c_str(), required_argument, &flag, - 8}, - {SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS.c_str(), required_argument, &flag, - 9}, - {SHRPX_OPT_PID_FILE.c_str(), required_argument, &flag, 10}, - {SHRPX_OPT_USER.c_str(), required_argument, &flag, 11}, - {"conf", required_argument, &flag, 12}, - {SHRPX_OPT_SYSLOG_FACILITY.c_str(), required_argument, &flag, 14}, - {SHRPX_OPT_BACKLOG.c_str(), required_argument, &flag, 15}, - {SHRPX_OPT_CIPHERS.c_str(), required_argument, &flag, 16}, - {SHRPX_OPT_CLIENT.c_str(), no_argument, &flag, 17}, - {SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS.c_str(), required_argument, &flag, - 18}, - {SHRPX_OPT_CACERT.c_str(), required_argument, &flag, 19}, - {SHRPX_OPT_BACKEND_IPV4.c_str(), no_argument, &flag, 20}, - {SHRPX_OPT_BACKEND_IPV6.c_str(), no_argument, &flag, 21}, - {SHRPX_OPT_PRIVATE_KEY_PASSWD_FILE.c_str(), required_argument, &flag, - 22}, - {SHRPX_OPT_NO_VIA.c_str(), no_argument, &flag, 23}, - {SHRPX_OPT_SUBCERT.c_str(), required_argument, &flag, 24}, - {SHRPX_OPT_HTTP2_BRIDGE.c_str(), no_argument, &flag, 25}, - {SHRPX_OPT_BACKEND_HTTP_PROXY_URI.c_str(), required_argument, &flag, - 26}, - {SHRPX_OPT_BACKEND_NO_TLS.c_str(), no_argument, &flag, 27}, - {SHRPX_OPT_OCSP_STARTUP.c_str(), no_argument, &flag, 28}, - {SHRPX_OPT_FRONTEND_NO_TLS.c_str(), no_argument, &flag, 29}, - {SHRPX_OPT_NO_VERIFY_OCSP.c_str(), no_argument, &flag, 30}, - {SHRPX_OPT_BACKEND_TLS_SNI_FIELD.c_str(), required_argument, &flag, 31}, - {SHRPX_OPT_DH_PARAM_FILE.c_str(), required_argument, &flag, 33}, - {SHRPX_OPT_READ_RATE.c_str(), required_argument, &flag, 34}, - {SHRPX_OPT_READ_BURST.c_str(), required_argument, &flag, 35}, - {SHRPX_OPT_WRITE_RATE.c_str(), required_argument, &flag, 36}, - {SHRPX_OPT_WRITE_BURST.c_str(), required_argument, &flag, 37}, - {SHRPX_OPT_NPN_LIST.c_str(), required_argument, &flag, 38}, - {SHRPX_OPT_VERIFY_CLIENT.c_str(), no_argument, &flag, 39}, - {SHRPX_OPT_VERIFY_CLIENT_CACERT.c_str(), required_argument, &flag, 40}, - {SHRPX_OPT_CLIENT_PRIVATE_KEY_FILE.c_str(), required_argument, &flag, - 41}, - {SHRPX_OPT_CLIENT_CERT_FILE.c_str(), required_argument, &flag, 42}, - {SHRPX_OPT_FRONTEND_HTTP2_DUMP_REQUEST_HEADER.c_str(), - required_argument, &flag, 43}, - {SHRPX_OPT_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER.c_str(), - required_argument, &flag, 44}, - {SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING.c_str(), no_argument, &flag, 45}, - {SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS.c_str(), - required_argument, &flag, 46}, - {SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_BITS.c_str(), - required_argument, &flag, 47}, - {SHRPX_OPT_TLS_PROTO_LIST.c_str(), required_argument, &flag, 48}, - {SHRPX_OPT_PADDING.c_str(), required_argument, &flag, 49}, - {SHRPX_OPT_WORKER_READ_RATE.c_str(), required_argument, &flag, 50}, - {SHRPX_OPT_WORKER_READ_BURST.c_str(), required_argument, &flag, 51}, - {SHRPX_OPT_WORKER_WRITE_RATE.c_str(), required_argument, &flag, 52}, - {SHRPX_OPT_WORKER_WRITE_BURST.c_str(), required_argument, &flag, 53}, - {SHRPX_OPT_ALTSVC.c_str(), required_argument, &flag, 54}, - {SHRPX_OPT_ADD_RESPONSE_HEADER.c_str(), required_argument, &flag, 55}, - {SHRPX_OPT_WORKER_FRONTEND_CONNECTIONS.c_str(), required_argument, - &flag, 56}, - {SHRPX_OPT_ACCESSLOG_SYSLOG.c_str(), no_argument, &flag, 57}, - {SHRPX_OPT_ERRORLOG_FILE.c_str(), required_argument, &flag, 58}, - {SHRPX_OPT_ERRORLOG_SYSLOG.c_str(), no_argument, &flag, 59}, - {SHRPX_OPT_STREAM_READ_TIMEOUT.c_str(), required_argument, &flag, 60}, - {SHRPX_OPT_STREAM_WRITE_TIMEOUT.c_str(), required_argument, &flag, 61}, - {SHRPX_OPT_NO_LOCATION_REWRITE.c_str(), no_argument, &flag, 62}, - {SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_HOST.c_str(), - required_argument, &flag, 63}, - {SHRPX_OPT_LISTENER_DISABLE_TIMEOUT.c_str(), required_argument, &flag, - 64}, - {SHRPX_OPT_STRIP_INCOMING_X_FORWARDED_FOR.c_str(), no_argument, &flag, - 65}, - {SHRPX_OPT_ACCESSLOG_FORMAT.c_str(), required_argument, &flag, 66}, - {SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND.c_str(), - required_argument, &flag, 67}, - {SHRPX_OPT_TLS_TICKET_KEY_FILE.c_str(), required_argument, &flag, 68}, - {SHRPX_OPT_RLIMIT_NOFILE.c_str(), required_argument, &flag, 69}, - {SHRPX_OPT_BACKEND_RESPONSE_BUFFER.c_str(), required_argument, &flag, - 71}, - {SHRPX_OPT_BACKEND_REQUEST_BUFFER.c_str(), required_argument, &flag, - 72}, - {SHRPX_OPT_NO_HOST_REWRITE.c_str(), no_argument, &flag, 73}, - {SHRPX_OPT_NO_SERVER_PUSH.c_str(), no_argument, &flag, 74}, - {SHRPX_OPT_BACKEND_HTTP2_CONNECTIONS_PER_WORKER.c_str(), - required_argument, &flag, 76}, - {SHRPX_OPT_FETCH_OCSP_RESPONSE_FILE.c_str(), required_argument, &flag, - 77}, - {SHRPX_OPT_OCSP_UPDATE_INTERVAL.c_str(), required_argument, &flag, 78}, - {SHRPX_OPT_NO_OCSP.c_str(), no_argument, &flag, 79}, - {SHRPX_OPT_HEADER_FIELD_BUFFER.c_str(), required_argument, &flag, 80}, - {SHRPX_OPT_MAX_HEADER_FIELDS.c_str(), required_argument, &flag, 81}, - {SHRPX_OPT_ADD_REQUEST_HEADER.c_str(), required_argument, &flag, 82}, - {SHRPX_OPT_INCLUDE.c_str(), required_argument, &flag, 83}, - {SHRPX_OPT_TLS_TICKET_KEY_CIPHER.c_str(), required_argument, &flag, 84}, - {SHRPX_OPT_HOST_REWRITE.c_str(), no_argument, &flag, 85}, - {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED.c_str(), required_argument, - &flag, 86}, - {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED.c_str(), required_argument, &flag, - 87}, - {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_INTERVAL.c_str(), required_argument, - &flag, 88}, - {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_MAX_RETRY.c_str(), - required_argument, &flag, 89}, - {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_MAX_FAIL.c_str(), required_argument, - &flag, 90}, - {SHRPX_OPT_MRUBY_FILE.c_str(), required_argument, &flag, 91}, - {SHRPX_OPT_ACCEPT_PROXY_PROTOCOL.c_str(), no_argument, &flag, 93}, - {SHRPX_OPT_FASTOPEN.c_str(), required_argument, &flag, 94}, - {SHRPX_OPT_TLS_DYN_REC_WARMUP_THRESHOLD.c_str(), required_argument, - &flag, 95}, - {SHRPX_OPT_TLS_DYN_REC_IDLE_TIMEOUT.c_str(), required_argument, &flag, - 96}, - {SHRPX_OPT_ADD_FORWARDED.c_str(), required_argument, &flag, 97}, - {SHRPX_OPT_STRIP_INCOMING_FORWARDED.c_str(), no_argument, &flag, 98}, - {SHRPX_OPT_FORWARDED_BY.c_str(), required_argument, &flag, 99}, - {SHRPX_OPT_FORWARDED_FOR.c_str(), required_argument, &flag, 100}, - {SHRPX_OPT_RESPONSE_HEADER_FIELD_BUFFER.c_str(), required_argument, - &flag, 101}, - {SHRPX_OPT_MAX_RESPONSE_HEADER_FIELDS.c_str(), required_argument, &flag, - 102}, - {SHRPX_OPT_NO_HTTP2_CIPHER_BLACK_LIST.c_str(), no_argument, &flag, 103}, - {SHRPX_OPT_REQUEST_HEADER_FIELD_BUFFER.c_str(), required_argument, - &flag, 104}, - {SHRPX_OPT_MAX_REQUEST_HEADER_FIELDS.c_str(), required_argument, &flag, - 105}, - {SHRPX_OPT_BACKEND_HTTP1_TLS.c_str(), no_argument, &flag, 106}, - {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_TLS.c_str(), no_argument, &flag, - 108}, - {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_CERT_FILE.c_str(), - required_argument, &flag, 109}, - {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE.c_str(), - required_argument, &flag, 110}, - {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_TLS.c_str(), no_argument, &flag, - 111}, - {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_CERT_FILE.c_str(), - required_argument, &flag, 112}, - {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE.c_str(), - required_argument, &flag, 113}, - {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY.c_str(), - required_argument, &flag, 114}, - {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY.c_str(), - required_argument, &flag, 115}, - {SHRPX_OPT_BACKEND_ADDRESS_FAMILY.c_str(), required_argument, &flag, - 116}, - {SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS.c_str(), - required_argument, &flag, 117}, - {SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS.c_str(), - required_argument, &flag, 118}, - {SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND.c_str(), required_argument, - &flag, 119}, - {SHRPX_OPT_BACKEND_TLS.c_str(), no_argument, &flag, 120}, - {SHRPX_OPT_BACKEND_CONNECTIONS_PER_HOST.c_str(), required_argument, - &flag, 121}, - {SHRPX_OPT_ERROR_PAGE.c_str(), required_argument, &flag, 122}, - {SHRPX_OPT_NO_KQUEUE.c_str(), no_argument, &flag, 123}, - {SHRPX_OPT_FRONTEND_HTTP2_SETTINGS_TIMEOUT.c_str(), required_argument, - &flag, 124}, - {SHRPX_OPT_BACKEND_HTTP2_SETTINGS_TIMEOUT.c_str(), required_argument, - &flag, 125}, - {SHRPX_OPT_API_MAX_REQUEST_BODY.c_str(), required_argument, &flag, 126}, - {SHRPX_OPT_BACKEND_MAX_BACKOFF.c_str(), required_argument, &flag, 127}, - {SHRPX_OPT_SERVER_NAME.c_str(), required_argument, &flag, 128}, - {SHRPX_OPT_NO_SERVER_REWRITE.c_str(), no_argument, &flag, 129}, - {SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE.c_str(), - no_argument, &flag, 130}, - {SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WINDOW_SIZE.c_str(), no_argument, - &flag, 131}, - {SHRPX_OPT_FRONTEND_HTTP2_WINDOW_SIZE.c_str(), required_argument, &flag, - 132}, - {SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_SIZE.c_str(), - required_argument, &flag, 133}, - {SHRPX_OPT_BACKEND_HTTP2_WINDOW_SIZE.c_str(), required_argument, &flag, - 134}, - {SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_SIZE.c_str(), - required_argument, &flag, 135}, - {SHRPX_OPT_FRONTEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE.c_str(), - required_argument, &flag, 136}, - {SHRPX_OPT_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE.c_str(), - required_argument, &flag, 137}, - {SHRPX_OPT_BACKEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE.c_str(), - required_argument, &flag, 138}, - {SHRPX_OPT_BACKEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE.c_str(), - required_argument, &flag, 139}, - {SHRPX_OPT_ECDH_CURVES.c_str(), required_argument, &flag, 140}, - {SHRPX_OPT_TLS_SCT_DIR.c_str(), required_argument, &flag, 141}, - {SHRPX_OPT_BACKEND_CONNECT_TIMEOUT.c_str(), required_argument, &flag, - 142}, - {SHRPX_OPT_DNS_CACHE_TIMEOUT.c_str(), required_argument, &flag, 143}, - {SHRPX_OPT_DNS_LOOKUP_TIMEOUT.c_str(), required_argument, &flag, 144}, - {SHRPX_OPT_DNS_MAX_TRY.c_str(), required_argument, &flag, 145}, - {SHRPX_OPT_FRONTEND_KEEP_ALIVE_TIMEOUT.c_str(), required_argument, - &flag, 146}, - {SHRPX_OPT_PSK_SECRETS.c_str(), required_argument, &flag, 147}, - {SHRPX_OPT_CLIENT_PSK_SECRETS.c_str(), required_argument, &flag, 148}, - {SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLACK_LIST.c_str(), no_argument, - &flag, 149}, - {SHRPX_OPT_CLIENT_CIPHERS.c_str(), required_argument, &flag, 150}, - {SHRPX_OPT_ACCESSLOG_WRITE_EARLY.c_str(), no_argument, &flag, 151}, - {SHRPX_OPT_TLS_MIN_PROTO_VERSION.c_str(), required_argument, &flag, - 152}, - {SHRPX_OPT_TLS_MAX_PROTO_VERSION.c_str(), required_argument, &flag, - 153}, - {SHRPX_OPT_REDIRECT_HTTPS_PORT.c_str(), required_argument, &flag, 154}, - {SHRPX_OPT_FRONTEND_MAX_REQUESTS.c_str(), required_argument, &flag, - 155}, - {SHRPX_OPT_SINGLE_THREAD.c_str(), no_argument, &flag, 156}, - {SHRPX_OPT_NO_ADD_X_FORWARDED_PROTO.c_str(), no_argument, &flag, 157}, - {SHRPX_OPT_NO_STRIP_INCOMING_X_FORWARDED_PROTO.c_str(), no_argument, - &flag, 158}, - {SHRPX_OPT_SINGLE_PROCESS.c_str(), no_argument, &flag, 159}, - {SHRPX_OPT_VERIFY_CLIENT_TOLERATE_EXPIRED.c_str(), no_argument, &flag, - 160}, - {SHRPX_OPT_IGNORE_PER_PATTERN_MRUBY_ERROR.c_str(), no_argument, &flag, - 161}, - {SHRPX_OPT_TLS_NO_POSTPONE_EARLY_DATA.c_str(), no_argument, &flag, 162}, - {SHRPX_OPT_TLS_MAX_EARLY_DATA.c_str(), required_argument, &flag, 163}, - {SHRPX_OPT_TLS13_CIPHERS.c_str(), required_argument, &flag, 164}, - {SHRPX_OPT_TLS13_CLIENT_CIPHERS.c_str(), required_argument, &flag, 165}, - {SHRPX_OPT_NO_STRIP_INCOMING_EARLY_DATA.c_str(), no_argument, &flag, - 166}, - {SHRPX_OPT_NO_HTTP2_CIPHER_BLOCK_LIST.c_str(), no_argument, &flag, 167}, - {SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST.c_str(), no_argument, - &flag, 168}, - {SHRPX_OPT_QUIC_BPF_PROGRAM_FILE.c_str(), required_argument, &flag, - 169}, - {SHRPX_OPT_NO_QUIC_BPF.c_str(), no_argument, &flag, 170}, - {SHRPX_OPT_HTTP2_ALTSVC.c_str(), required_argument, &flag, 171}, - {SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT.c_str(), required_argument, - &flag, 172}, - {SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT.c_str(), required_argument, &flag, - 173}, - {SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG.c_str(), no_argument, &flag, 174}, - {SHRPX_OPT_FRONTEND_HTTP3_WINDOW_SIZE.c_str(), required_argument, &flag, - 175}, - {SHRPX_OPT_FRONTEND_HTTP3_CONNECTION_WINDOW_SIZE.c_str(), - required_argument, &flag, 176}, - {SHRPX_OPT_FRONTEND_HTTP3_MAX_WINDOW_SIZE.c_str(), required_argument, - &flag, 177}, - {SHRPX_OPT_FRONTEND_HTTP3_MAX_CONNECTION_WINDOW_SIZE.c_str(), - required_argument, &flag, 178}, - {SHRPX_OPT_FRONTEND_HTTP3_MAX_CONCURRENT_STREAMS.c_str(), - required_argument, &flag, 179}, - {SHRPX_OPT_FRONTEND_QUIC_EARLY_DATA.c_str(), no_argument, &flag, 180}, - {SHRPX_OPT_FRONTEND_QUIC_QLOG_DIR.c_str(), required_argument, &flag, - 181}, - {SHRPX_OPT_FRONTEND_QUIC_REQUIRE_TOKEN.c_str(), no_argument, &flag, - 182}, - {SHRPX_OPT_FRONTEND_QUIC_CONGESTION_CONTROLLER.c_str(), - required_argument, &flag, 183}, - {SHRPX_OPT_QUIC_SERVER_ID.c_str(), required_argument, &flag, 185}, - {SHRPX_OPT_FRONTEND_QUIC_SECRET_FILE.c_str(), required_argument, &flag, - 186}, - {SHRPX_OPT_RLIMIT_MEMLOCK.c_str(), required_argument, &flag, 187}, - {SHRPX_OPT_MAX_WORKER_PROCESSES.c_str(), required_argument, &flag, 188}, - {SHRPX_OPT_WORKER_PROCESS_GRACE_SHUTDOWN_PERIOD.c_str(), - required_argument, &flag, 189}, - {SHRPX_OPT_FRONTEND_QUIC_INITIAL_RTT.c_str(), required_argument, &flag, - 190}, - {SHRPX_OPT_REQUIRE_HTTP_SCHEME.c_str(), no_argument, &flag, 191}, - {SHRPX_OPT_TLS_KTLS.c_str(), no_argument, &flag, 192}, - {nullptr, 0, nullptr, 0}}; + {SHRPX_OPT_DAEMON.data(), no_argument, nullptr, 'D'}, + {SHRPX_OPT_LOG_LEVEL.data(), required_argument, nullptr, 'L'}, + {SHRPX_OPT_BACKEND.data(), required_argument, nullptr, 'b'}, + {SHRPX_OPT_HTTP2_MAX_CONCURRENT_STREAMS.data(), required_argument, + nullptr, 'c'}, + {SHRPX_OPT_FRONTEND.data(), required_argument, nullptr, 'f'}, + {"help", no_argument, nullptr, 'h'}, + {SHRPX_OPT_INSECURE.data(), no_argument, nullptr, 'k'}, + {SHRPX_OPT_WORKERS.data(), required_argument, nullptr, 'n'}, + {SHRPX_OPT_CLIENT_PROXY.data(), no_argument, nullptr, 'p'}, + {SHRPX_OPT_HTTP2_PROXY.data(), no_argument, nullptr, 's'}, + {"version", no_argument, nullptr, 'v'}, + {SHRPX_OPT_FRONTEND_FRAME_DEBUG.data(), no_argument, nullptr, 'o'}, + {SHRPX_OPT_ADD_X_FORWARDED_FOR.data(), no_argument, &flag, 1}, + {SHRPX_OPT_FRONTEND_HTTP2_READ_TIMEOUT.data(), required_argument, &flag, + 2}, + {SHRPX_OPT_FRONTEND_READ_TIMEOUT.data(), required_argument, &flag, 3}, + {SHRPX_OPT_FRONTEND_WRITE_TIMEOUT.data(), required_argument, &flag, 4}, + {SHRPX_OPT_BACKEND_READ_TIMEOUT.data(), required_argument, &flag, 5}, + {SHRPX_OPT_BACKEND_WRITE_TIMEOUT.data(), required_argument, &flag, 6}, + {SHRPX_OPT_ACCESSLOG_FILE.data(), required_argument, &flag, 7}, + {SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT.data(), required_argument, &flag, + 8}, + {SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS.data(), required_argument, &flag, + 9}, + {SHRPX_OPT_PID_FILE.data(), required_argument, &flag, 10}, + {SHRPX_OPT_USER.data(), required_argument, &flag, 11}, + {"conf", required_argument, &flag, 12}, + {SHRPX_OPT_SYSLOG_FACILITY.data(), required_argument, &flag, 14}, + {SHRPX_OPT_BACKLOG.data(), required_argument, &flag, 15}, + {SHRPX_OPT_CIPHERS.data(), required_argument, &flag, 16}, + {SHRPX_OPT_CLIENT.data(), no_argument, &flag, 17}, + {SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS.data(), required_argument, &flag, + 18}, + {SHRPX_OPT_CACERT.data(), required_argument, &flag, 19}, + {SHRPX_OPT_BACKEND_IPV4.data(), no_argument, &flag, 20}, + {SHRPX_OPT_BACKEND_IPV6.data(), no_argument, &flag, 21}, + {SHRPX_OPT_PRIVATE_KEY_PASSWD_FILE.data(), required_argument, &flag, 22}, + {SHRPX_OPT_NO_VIA.data(), no_argument, &flag, 23}, + {SHRPX_OPT_SUBCERT.data(), required_argument, &flag, 24}, + {SHRPX_OPT_HTTP2_BRIDGE.data(), no_argument, &flag, 25}, + {SHRPX_OPT_BACKEND_HTTP_PROXY_URI.data(), required_argument, &flag, 26}, + {SHRPX_OPT_BACKEND_NO_TLS.data(), no_argument, &flag, 27}, + {SHRPX_OPT_OCSP_STARTUP.data(), no_argument, &flag, 28}, + {SHRPX_OPT_FRONTEND_NO_TLS.data(), no_argument, &flag, 29}, + {SHRPX_OPT_NO_VERIFY_OCSP.data(), no_argument, &flag, 30}, + {SHRPX_OPT_BACKEND_TLS_SNI_FIELD.data(), required_argument, &flag, 31}, + {SHRPX_OPT_DH_PARAM_FILE.data(), required_argument, &flag, 33}, + {SHRPX_OPT_READ_RATE.data(), required_argument, &flag, 34}, + {SHRPX_OPT_READ_BURST.data(), required_argument, &flag, 35}, + {SHRPX_OPT_WRITE_RATE.data(), required_argument, &flag, 36}, + {SHRPX_OPT_WRITE_BURST.data(), required_argument, &flag, 37}, + {SHRPX_OPT_NPN_LIST.data(), required_argument, &flag, 38}, + {SHRPX_OPT_VERIFY_CLIENT.data(), no_argument, &flag, 39}, + {SHRPX_OPT_VERIFY_CLIENT_CACERT.data(), required_argument, &flag, 40}, + {SHRPX_OPT_CLIENT_PRIVATE_KEY_FILE.data(), required_argument, &flag, 41}, + {SHRPX_OPT_CLIENT_CERT_FILE.data(), required_argument, &flag, 42}, + {SHRPX_OPT_FRONTEND_HTTP2_DUMP_REQUEST_HEADER.data(), required_argument, + &flag, 43}, + {SHRPX_OPT_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER.data(), required_argument, + &flag, 44}, + {SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING.data(), no_argument, &flag, 45}, + {SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS.data(), + required_argument, &flag, 46}, + {SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_BITS.data(), required_argument, + &flag, 47}, + {SHRPX_OPT_TLS_PROTO_LIST.data(), required_argument, &flag, 48}, + {SHRPX_OPT_PADDING.data(), required_argument, &flag, 49}, + {SHRPX_OPT_WORKER_READ_RATE.data(), required_argument, &flag, 50}, + {SHRPX_OPT_WORKER_READ_BURST.data(), required_argument, &flag, 51}, + {SHRPX_OPT_WORKER_WRITE_RATE.data(), required_argument, &flag, 52}, + {SHRPX_OPT_WORKER_WRITE_BURST.data(), required_argument, &flag, 53}, + {SHRPX_OPT_ALTSVC.data(), required_argument, &flag, 54}, + {SHRPX_OPT_ADD_RESPONSE_HEADER.data(), required_argument, &flag, 55}, + {SHRPX_OPT_WORKER_FRONTEND_CONNECTIONS.data(), required_argument, &flag, + 56}, + {SHRPX_OPT_ACCESSLOG_SYSLOG.data(), no_argument, &flag, 57}, + {SHRPX_OPT_ERRORLOG_FILE.data(), required_argument, &flag, 58}, + {SHRPX_OPT_ERRORLOG_SYSLOG.data(), no_argument, &flag, 59}, + {SHRPX_OPT_STREAM_READ_TIMEOUT.data(), required_argument, &flag, 60}, + {SHRPX_OPT_STREAM_WRITE_TIMEOUT.data(), required_argument, &flag, 61}, + {SHRPX_OPT_NO_LOCATION_REWRITE.data(), no_argument, &flag, 62}, + {SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_HOST.data(), required_argument, + &flag, 63}, + {SHRPX_OPT_LISTENER_DISABLE_TIMEOUT.data(), required_argument, &flag, 64}, + {SHRPX_OPT_STRIP_INCOMING_X_FORWARDED_FOR.data(), no_argument, &flag, 65}, + {SHRPX_OPT_ACCESSLOG_FORMAT.data(), required_argument, &flag, 66}, + {SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND.data(), + required_argument, &flag, 67}, + {SHRPX_OPT_TLS_TICKET_KEY_FILE.data(), required_argument, &flag, 68}, + {SHRPX_OPT_RLIMIT_NOFILE.data(), required_argument, &flag, 69}, + {SHRPX_OPT_BACKEND_RESPONSE_BUFFER.data(), required_argument, &flag, 71}, + {SHRPX_OPT_BACKEND_REQUEST_BUFFER.data(), required_argument, &flag, 72}, + {SHRPX_OPT_NO_HOST_REWRITE.data(), no_argument, &flag, 73}, + {SHRPX_OPT_NO_SERVER_PUSH.data(), no_argument, &flag, 74}, + {SHRPX_OPT_BACKEND_HTTP2_CONNECTIONS_PER_WORKER.data(), required_argument, + &flag, 76}, + {SHRPX_OPT_FETCH_OCSP_RESPONSE_FILE.data(), required_argument, &flag, 77}, + {SHRPX_OPT_OCSP_UPDATE_INTERVAL.data(), required_argument, &flag, 78}, + {SHRPX_OPT_NO_OCSP.data(), no_argument, &flag, 79}, + {SHRPX_OPT_HEADER_FIELD_BUFFER.data(), required_argument, &flag, 80}, + {SHRPX_OPT_MAX_HEADER_FIELDS.data(), required_argument, &flag, 81}, + {SHRPX_OPT_ADD_REQUEST_HEADER.data(), required_argument, &flag, 82}, + {SHRPX_OPT_INCLUDE.data(), required_argument, &flag, 83}, + {SHRPX_OPT_TLS_TICKET_KEY_CIPHER.data(), required_argument, &flag, 84}, + {SHRPX_OPT_HOST_REWRITE.data(), no_argument, &flag, 85}, + {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED.data(), required_argument, &flag, + 86}, + {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED.data(), required_argument, &flag, 87}, + {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_INTERVAL.data(), required_argument, + &flag, 88}, + {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_MAX_RETRY.data(), required_argument, + &flag, 89}, + {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_MAX_FAIL.data(), required_argument, + &flag, 90}, + {SHRPX_OPT_MRUBY_FILE.data(), required_argument, &flag, 91}, + {SHRPX_OPT_ACCEPT_PROXY_PROTOCOL.data(), no_argument, &flag, 93}, + {SHRPX_OPT_FASTOPEN.data(), required_argument, &flag, 94}, + {SHRPX_OPT_TLS_DYN_REC_WARMUP_THRESHOLD.data(), required_argument, &flag, + 95}, + {SHRPX_OPT_TLS_DYN_REC_IDLE_TIMEOUT.data(), required_argument, &flag, 96}, + {SHRPX_OPT_ADD_FORWARDED.data(), required_argument, &flag, 97}, + {SHRPX_OPT_STRIP_INCOMING_FORWARDED.data(), no_argument, &flag, 98}, + {SHRPX_OPT_FORWARDED_BY.data(), required_argument, &flag, 99}, + {SHRPX_OPT_FORWARDED_FOR.data(), required_argument, &flag, 100}, + {SHRPX_OPT_RESPONSE_HEADER_FIELD_BUFFER.data(), required_argument, &flag, + 101}, + {SHRPX_OPT_MAX_RESPONSE_HEADER_FIELDS.data(), required_argument, &flag, + 102}, + {SHRPX_OPT_NO_HTTP2_CIPHER_BLACK_LIST.data(), no_argument, &flag, 103}, + {SHRPX_OPT_REQUEST_HEADER_FIELD_BUFFER.data(), required_argument, &flag, + 104}, + {SHRPX_OPT_MAX_REQUEST_HEADER_FIELDS.data(), required_argument, &flag, + 105}, + {SHRPX_OPT_BACKEND_HTTP1_TLS.data(), no_argument, &flag, 106}, + {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_TLS.data(), no_argument, &flag, + 108}, + {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_CERT_FILE.data(), + required_argument, &flag, 109}, + {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE.data(), + required_argument, &flag, 110}, + {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_TLS.data(), no_argument, &flag, 111}, + {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_CERT_FILE.data(), required_argument, + &flag, 112}, + {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE.data(), + required_argument, &flag, 113}, + {SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY.data(), + required_argument, &flag, 114}, + {SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY.data(), + required_argument, &flag, 115}, + {SHRPX_OPT_BACKEND_ADDRESS_FAMILY.data(), required_argument, &flag, 116}, + {SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS.data(), + required_argument, &flag, 117}, + {SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS.data(), required_argument, + &flag, 118}, + {SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND.data(), required_argument, + &flag, 119}, + {SHRPX_OPT_BACKEND_TLS.data(), no_argument, &flag, 120}, + {SHRPX_OPT_BACKEND_CONNECTIONS_PER_HOST.data(), required_argument, &flag, + 121}, + {SHRPX_OPT_ERROR_PAGE.data(), required_argument, &flag, 122}, + {SHRPX_OPT_NO_KQUEUE.data(), no_argument, &flag, 123}, + {SHRPX_OPT_FRONTEND_HTTP2_SETTINGS_TIMEOUT.data(), required_argument, + &flag, 124}, + {SHRPX_OPT_BACKEND_HTTP2_SETTINGS_TIMEOUT.data(), required_argument, + &flag, 125}, + {SHRPX_OPT_API_MAX_REQUEST_BODY.data(), required_argument, &flag, 126}, + {SHRPX_OPT_BACKEND_MAX_BACKOFF.data(), required_argument, &flag, 127}, + {SHRPX_OPT_SERVER_NAME.data(), required_argument, &flag, 128}, + {SHRPX_OPT_NO_SERVER_REWRITE.data(), no_argument, &flag, 129}, + {SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE.data(), no_argument, + &flag, 130}, + {SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WINDOW_SIZE.data(), no_argument, &flag, + 131}, + {SHRPX_OPT_FRONTEND_HTTP2_WINDOW_SIZE.data(), required_argument, &flag, + 132}, + {SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_SIZE.data(), + required_argument, &flag, 133}, + {SHRPX_OPT_BACKEND_HTTP2_WINDOW_SIZE.data(), required_argument, &flag, + 134}, + {SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_SIZE.data(), required_argument, + &flag, 135}, + {SHRPX_OPT_FRONTEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE.data(), + required_argument, &flag, 136}, + {SHRPX_OPT_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE.data(), + required_argument, &flag, 137}, + {SHRPX_OPT_BACKEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE.data(), + required_argument, &flag, 138}, + {SHRPX_OPT_BACKEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE.data(), + required_argument, &flag, 139}, + {SHRPX_OPT_ECDH_CURVES.data(), required_argument, &flag, 140}, + {SHRPX_OPT_TLS_SCT_DIR.data(), required_argument, &flag, 141}, + {SHRPX_OPT_BACKEND_CONNECT_TIMEOUT.data(), required_argument, &flag, 142}, + {SHRPX_OPT_DNS_CACHE_TIMEOUT.data(), required_argument, &flag, 143}, + {SHRPX_OPT_DNS_LOOKUP_TIMEOUT.data(), required_argument, &flag, 144}, + {SHRPX_OPT_DNS_MAX_TRY.data(), required_argument, &flag, 145}, + {SHRPX_OPT_FRONTEND_KEEP_ALIVE_TIMEOUT.data(), required_argument, &flag, + 146}, + {SHRPX_OPT_PSK_SECRETS.data(), required_argument, &flag, 147}, + {SHRPX_OPT_CLIENT_PSK_SECRETS.data(), required_argument, &flag, 148}, + {SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLACK_LIST.data(), no_argument, &flag, + 149}, + {SHRPX_OPT_CLIENT_CIPHERS.data(), required_argument, &flag, 150}, + {SHRPX_OPT_ACCESSLOG_WRITE_EARLY.data(), no_argument, &flag, 151}, + {SHRPX_OPT_TLS_MIN_PROTO_VERSION.data(), required_argument, &flag, 152}, + {SHRPX_OPT_TLS_MAX_PROTO_VERSION.data(), required_argument, &flag, 153}, + {SHRPX_OPT_REDIRECT_HTTPS_PORT.data(), required_argument, &flag, 154}, + {SHRPX_OPT_FRONTEND_MAX_REQUESTS.data(), required_argument, &flag, 155}, + {SHRPX_OPT_SINGLE_THREAD.data(), no_argument, &flag, 156}, + {SHRPX_OPT_NO_ADD_X_FORWARDED_PROTO.data(), no_argument, &flag, 157}, + {SHRPX_OPT_NO_STRIP_INCOMING_X_FORWARDED_PROTO.data(), no_argument, &flag, + 158}, + {SHRPX_OPT_SINGLE_PROCESS.data(), no_argument, &flag, 159}, + {SHRPX_OPT_VERIFY_CLIENT_TOLERATE_EXPIRED.data(), no_argument, &flag, + 160}, + {SHRPX_OPT_IGNORE_PER_PATTERN_MRUBY_ERROR.data(), no_argument, &flag, + 161}, + {SHRPX_OPT_TLS_NO_POSTPONE_EARLY_DATA.data(), no_argument, &flag, 162}, + {SHRPX_OPT_TLS_MAX_EARLY_DATA.data(), required_argument, &flag, 163}, + {SHRPX_OPT_TLS13_CIPHERS.data(), required_argument, &flag, 164}, + {SHRPX_OPT_TLS13_CLIENT_CIPHERS.data(), required_argument, &flag, 165}, + {SHRPX_OPT_NO_STRIP_INCOMING_EARLY_DATA.data(), no_argument, &flag, 166}, + {SHRPX_OPT_NO_HTTP2_CIPHER_BLOCK_LIST.data(), no_argument, &flag, 167}, + {SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST.data(), no_argument, &flag, + 168}, + {SHRPX_OPT_QUIC_BPF_PROGRAM_FILE.data(), required_argument, &flag, 169}, + {SHRPX_OPT_NO_QUIC_BPF.data(), no_argument, &flag, 170}, + {SHRPX_OPT_HTTP2_ALTSVC.data(), required_argument, &flag, 171}, + {SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT.data(), required_argument, &flag, + 172}, + {SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT.data(), required_argument, &flag, + 173}, + {SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG.data(), no_argument, &flag, 174}, + {SHRPX_OPT_FRONTEND_HTTP3_WINDOW_SIZE.data(), required_argument, &flag, + 175}, + {SHRPX_OPT_FRONTEND_HTTP3_CONNECTION_WINDOW_SIZE.data(), + required_argument, &flag, 176}, + {SHRPX_OPT_FRONTEND_HTTP3_MAX_WINDOW_SIZE.data(), required_argument, + &flag, 177}, + {SHRPX_OPT_FRONTEND_HTTP3_MAX_CONNECTION_WINDOW_SIZE.data(), + required_argument, &flag, 178}, + {SHRPX_OPT_FRONTEND_HTTP3_MAX_CONCURRENT_STREAMS.data(), + required_argument, &flag, 179}, + {SHRPX_OPT_FRONTEND_QUIC_EARLY_DATA.data(), no_argument, &flag, 180}, + {SHRPX_OPT_FRONTEND_QUIC_QLOG_DIR.data(), required_argument, &flag, 181}, + {SHRPX_OPT_FRONTEND_QUIC_REQUIRE_TOKEN.data(), no_argument, &flag, 182}, + {SHRPX_OPT_FRONTEND_QUIC_CONGESTION_CONTROLLER.data(), required_argument, + &flag, 183}, + {SHRPX_OPT_QUIC_SERVER_ID.data(), required_argument, &flag, 185}, + {SHRPX_OPT_FRONTEND_QUIC_SECRET_FILE.data(), required_argument, &flag, + 186}, + {SHRPX_OPT_RLIMIT_MEMLOCK.data(), required_argument, &flag, 187}, + {SHRPX_OPT_MAX_WORKER_PROCESSES.data(), required_argument, &flag, 188}, + {SHRPX_OPT_WORKER_PROCESS_GRACE_SHUTDOWN_PERIOD.data(), required_argument, + &flag, 189}, + {SHRPX_OPT_FRONTEND_QUIC_INITIAL_RTT.data(), required_argument, &flag, + 190}, + {SHRPX_OPT_REQUIRE_HTTP_SCHEME.data(), no_argument, &flag, 191}, + {SHRPX_OPT_TLS_KTLS.data(), no_argument, &flag, 192}, + {SHRPX_OPT_ALPN_LIST.data(), required_argument, &flag, 193}, + {SHRPX_OPT_FRONTEND_HEADER_TIMEOUT.data(), required_argument, &flag, 194}, + {SHRPX_OPT_FRONTEND_HTTP2_IDLE_TIMEOUT.data(), required_argument, &flag, + 195}, + {SHRPX_OPT_FRONTEND_HTTP3_IDLE_TIMEOUT.data(), required_argument, &flag, + 196}, + {nullptr, 0, nullptr, 0}}; int option_index = 0; - int c = getopt_long(argc, argv, "DL:b:c:f:hkn:opsv", long_options, - &option_index); + int c = + getopt_long(argc, argv, "DL:b:c:f:hkn:opsv", long_options, &option_index); if (c == -1) { break; } switch (c) { case 'D': - cmdcfgs.emplace_back(SHRPX_OPT_DAEMON, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_DAEMON, "yes"_sr); break; case 'L': cmdcfgs.emplace_back(SHRPX_OPT_LOG_LEVEL, StringRef{optarg}); @@ -4416,20 +4424,19 @@ int main(int argc, char **argv) { print_help(std::cout); exit(EXIT_SUCCESS); case 'k': - cmdcfgs.emplace_back(SHRPX_OPT_INSECURE, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_INSECURE, "yes"_sr); break; case 'n': cmdcfgs.emplace_back(SHRPX_OPT_WORKERS, StringRef{optarg}); break; case 'o': - cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_FRAME_DEBUG, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_FRAME_DEBUG, "yes"_sr); break; case 'p': - cmdcfgs.emplace_back(SHRPX_OPT_CLIENT_PROXY, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_CLIENT_PROXY, "yes"_sr); break; case 's': - cmdcfgs.emplace_back(SHRPX_OPT_HTTP2_PROXY, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_HTTP2_PROXY, "yes"_sr); break; case 'v': print_version(std::cout); @@ -4441,8 +4448,7 @@ int main(int argc, char **argv) { switch (flag) { case 1: // --add-x-forwarded-for - cmdcfgs.emplace_back(SHRPX_OPT_ADD_X_FORWARDED_FOR, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_ADD_X_FORWARDED_FOR, "yes"_sr); break; case 2: // --frontend-http2-read-timeout @@ -4490,7 +4496,7 @@ int main(int argc, char **argv) { case 12: // --conf mod_config()->conf_path = - make_string_ref(mod_config()->balloc, StringRef{optarg}); + make_string_ref(mod_config()->balloc, StringRef{optarg}); break; case 14: // --syslog-facility @@ -4506,7 +4512,7 @@ int main(int argc, char **argv) { break; case 17: // --client - cmdcfgs.emplace_back(SHRPX_OPT_CLIENT, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_CLIENT, "yes"_sr); break; case 18: // --backend-http2-window-bits @@ -4519,13 +4525,11 @@ int main(int argc, char **argv) { break; case 20: // --backend-ipv4 - cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_IPV4, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_IPV4, "yes"_sr); break; case 21: // --backend-ipv6 - cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_IPV6, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_IPV6, "yes"_sr); break; case 22: // --private-key-passwd-file @@ -4534,7 +4538,7 @@ int main(int argc, char **argv) { break; case 23: // --no-via - cmdcfgs.emplace_back(SHRPX_OPT_NO_VIA, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_VIA, "yes"_sr); break; case 24: // --subcert @@ -4542,8 +4546,7 @@ int main(int argc, char **argv) { break; case 25: // --http2-bridge - cmdcfgs.emplace_back(SHRPX_OPT_HTTP2_BRIDGE, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_HTTP2_BRIDGE, "yes"_sr); break; case 26: // --backend-http-proxy-uri @@ -4552,23 +4555,19 @@ int main(int argc, char **argv) { break; case 27: // --backend-no-tls - cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_NO_TLS, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_NO_TLS, "yes"_sr); break; case 28: // --ocsp-startup - cmdcfgs.emplace_back(SHRPX_OPT_OCSP_STARTUP, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_OCSP_STARTUP, "yes"_sr); break; case 29: // --frontend-no-tls - cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_NO_TLS, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_NO_TLS, "yes"_sr); break; case 30: // --no-verify-ocsp - cmdcfgs.emplace_back(SHRPX_OPT_NO_VERIFY_OCSP, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_VERIFY_OCSP, "yes"_sr); break; case 31: // --backend-tls-sni-field @@ -4601,8 +4600,7 @@ int main(int argc, char **argv) { break; case 39: // --verify-client - cmdcfgs.emplace_back(SHRPX_OPT_VERIFY_CLIENT, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_VERIFY_CLIENT, "yes"_sr); break; case 40: // --verify-client-cacert @@ -4629,8 +4627,7 @@ int main(int argc, char **argv) { break; case 45: // --http2-no-cookie-crumbling - cmdcfgs.emplace_back(SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING, "yes"_sr); break; case 46: // --frontend-http2-connection-window-bits @@ -4681,8 +4678,7 @@ int main(int argc, char **argv) { break; case 57: // --accesslog-syslog - cmdcfgs.emplace_back(SHRPX_OPT_ACCESSLOG_SYSLOG, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_ACCESSLOG_SYSLOG, "yes"_sr); break; case 58: // --errorlog-file @@ -4690,8 +4686,7 @@ int main(int argc, char **argv) { break; case 59: // --errorlog-syslog - cmdcfgs.emplace_back(SHRPX_OPT_ERRORLOG_SYSLOG, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_ERRORLOG_SYSLOG, "yes"_sr); break; case 60: // --stream-read-timeout @@ -4703,8 +4698,7 @@ int main(int argc, char **argv) { break; case 62: // --no-location-rewrite - cmdcfgs.emplace_back(SHRPX_OPT_NO_LOCATION_REWRITE, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_LOCATION_REWRITE, "yes"_sr); break; case 63: // --backend-http1-connections-per-host @@ -4719,7 +4713,7 @@ int main(int argc, char **argv) { case 65: // --strip-incoming-x-forwarded-for cmdcfgs.emplace_back(SHRPX_OPT_STRIP_INCOMING_X_FORWARDED_FOR, - StringRef::from_lit("yes")); + "yes"_sr); break; case 66: // --accesslog-format @@ -4750,13 +4744,11 @@ int main(int argc, char **argv) { break; case 73: // --no-host-rewrite - cmdcfgs.emplace_back(SHRPX_OPT_NO_HOST_REWRITE, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_HOST_REWRITE, "yes"_sr); break; case 74: // --no-server-push - cmdcfgs.emplace_back(SHRPX_OPT_NO_SERVER_PUSH, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_SERVER_PUSH, "yes"_sr); break; case 76: // --backend-http2-connections-per-worker @@ -4774,7 +4766,7 @@ int main(int argc, char **argv) { break; case 79: // --no-ocsp - cmdcfgs.emplace_back(SHRPX_OPT_NO_OCSP, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_OCSP, "yes"_sr); break; case 80: // --header-field-buffer @@ -4799,8 +4791,7 @@ int main(int argc, char **argv) { break; case 85: // --host-rewrite - cmdcfgs.emplace_back(SHRPX_OPT_HOST_REWRITE, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_HOST_REWRITE, "yes"_sr); break; case 86: // --tls-session-cache-memcached @@ -4833,8 +4824,7 @@ int main(int argc, char **argv) { break; case 93: // --accept-proxy-protocol - cmdcfgs.emplace_back(SHRPX_OPT_ACCEPT_PROXY_PROTOCOL, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_ACCEPT_PROXY_PROTOCOL, "yes"_sr); break; case 94: // --fastopen @@ -4856,8 +4846,7 @@ int main(int argc, char **argv) { break; case 98: // --strip-incoming-forwarded - cmdcfgs.emplace_back(SHRPX_OPT_STRIP_INCOMING_FORWARDED, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_STRIP_INCOMING_FORWARDED, "yes"_sr); break; case 99: // --forwarded-by @@ -4879,8 +4868,7 @@ int main(int argc, char **argv) { break; case 103: // --no-http2-cipher-black-list - cmdcfgs.emplace_back(SHRPX_OPT_NO_HTTP2_CIPHER_BLACK_LIST, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_HTTP2_CIPHER_BLACK_LIST, "yes"_sr); break; case 104: // --request-header-field-buffer @@ -4894,13 +4882,12 @@ int main(int argc, char **argv) { break; case 106: // --backend-http1-tls - cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_HTTP1_TLS, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_HTTP1_TLS, "yes"_sr); break; case 108: // --tls-session-cache-memcached-tls cmdcfgs.emplace_back(SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_TLS, - StringRef::from_lit("yes")); + "yes"_sr); break; case 109: // --tls-session-cache-memcached-cert-file @@ -4910,13 +4897,12 @@ int main(int argc, char **argv) { case 110: // --tls-session-cache-memcached-private-key-file cmdcfgs.emplace_back( - SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE, - StringRef{optarg}); + SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE, + StringRef{optarg}); break; case 111: // --tls-ticket-key-memcached-tls - cmdcfgs.emplace_back(SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_TLS, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_TLS, "yes"_sr); break; case 112: // --tls-ticket-key-memcached-cert-file @@ -4926,8 +4912,8 @@ int main(int argc, char **argv) { case 113: // --tls-ticket-key-memcached-private-key-file cmdcfgs.emplace_back( - SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE, - StringRef{optarg}); + SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE, + StringRef{optarg}); break; case 114: // --tls-ticket-key-memcached-address-family @@ -4937,8 +4923,8 @@ int main(int argc, char **argv) { case 115: // --tls-session-cache-memcached-address-family cmdcfgs.emplace_back( - SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY, - StringRef{optarg}); + SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY, + StringRef{optarg}); break; case 116: // --backend-address-family @@ -4962,7 +4948,7 @@ int main(int argc, char **argv) { break; case 120: // --backend-tls - cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_TLS, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_TLS, "yes"_sr); break; case 121: // --backend-connections-per-host @@ -4975,7 +4961,7 @@ int main(int argc, char **argv) { break; case 123: // --no-kqueue - cmdcfgs.emplace_back(SHRPX_OPT_NO_KQUEUE, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_KQUEUE, "yes"_sr); break; case 124: // --frontend-http2-settings-timeout @@ -5001,19 +4987,17 @@ int main(int argc, char **argv) { break; case 129: // --no-server-rewrite - cmdcfgs.emplace_back(SHRPX_OPT_NO_SERVER_REWRITE, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_SERVER_REWRITE, "yes"_sr); break; case 130: // --frontend-http2-optimize-write-buffer-size cmdcfgs.emplace_back( - SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE, - StringRef::from_lit("yes")); + SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE, "yes"_sr); break; case 131: // --frontend-http2-optimize-window-size cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WINDOW_SIZE, - StringRef::from_lit("yes")); + "yes"_sr); break; case 132: // --frontend-http2-window-size @@ -5038,14 +5022,14 @@ int main(int argc, char **argv) { case 136: // --frontend-http2-encoder-dynamic-table-size cmdcfgs.emplace_back( - SHRPX_OPT_FRONTEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE, - StringRef{optarg}); + SHRPX_OPT_FRONTEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE, + StringRef{optarg}); break; case 137: // --frontend-http2-decoder-dynamic-table-size cmdcfgs.emplace_back( - SHRPX_OPT_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE, - StringRef{optarg}); + SHRPX_OPT_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE, + StringRef{optarg}); break; case 138: // --backend-http2-encoder-dynamic-table-size @@ -5098,7 +5082,7 @@ int main(int argc, char **argv) { case 149: // --client-no-http2-cipher-black-list cmdcfgs.emplace_back(SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLACK_LIST, - StringRef::from_lit("yes")); + "yes"_sr); break; case 150: // --client-ciphers @@ -5106,8 +5090,7 @@ int main(int argc, char **argv) { break; case 151: // --accesslog-write-early - cmdcfgs.emplace_back(SHRPX_OPT_ACCESSLOG_WRITE_EARLY, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_ACCESSLOG_WRITE_EARLY, "yes"_sr); break; case 152: // --tls-min-proto-version @@ -5130,38 +5113,34 @@ int main(int argc, char **argv) { break; case 156: // --single-thread - cmdcfgs.emplace_back(SHRPX_OPT_SINGLE_THREAD, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_SINGLE_THREAD, "yes"_sr); break; case 157: // --no-add-x-forwarded-proto - cmdcfgs.emplace_back(SHRPX_OPT_NO_ADD_X_FORWARDED_PROTO, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_ADD_X_FORWARDED_PROTO, "yes"_sr); break; case 158: // --no-strip-incoming-x-forwarded-proto cmdcfgs.emplace_back(SHRPX_OPT_NO_STRIP_INCOMING_X_FORWARDED_PROTO, - StringRef::from_lit("yes")); + "yes"_sr); break; case 159: // --single-process - cmdcfgs.emplace_back(SHRPX_OPT_SINGLE_PROCESS, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_SINGLE_PROCESS, "yes"_sr); break; case 160: // --verify-client-tolerate-expired cmdcfgs.emplace_back(SHRPX_OPT_VERIFY_CLIENT_TOLERATE_EXPIRED, - StringRef::from_lit("yes")); + "yes"_sr); break; case 161: // --ignore-per-pattern-mruby-error cmdcfgs.emplace_back(SHRPX_OPT_IGNORE_PER_PATTERN_MRUBY_ERROR, - StringRef::from_lit("yes")); + "yes"_sr); break; case 162: // --tls-no-postpone-early-data - cmdcfgs.emplace_back(SHRPX_OPT_TLS_NO_POSTPONE_EARLY_DATA, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_TLS_NO_POSTPONE_EARLY_DATA, "yes"_sr); break; case 163: // --tls-max-early-data @@ -5177,18 +5156,16 @@ int main(int argc, char **argv) { break; case 166: // --no-strip-incoming-early-data - cmdcfgs.emplace_back(SHRPX_OPT_NO_STRIP_INCOMING_EARLY_DATA, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_STRIP_INCOMING_EARLY_DATA, "yes"_sr); break; case 167: // --no-http2-cipher-block-list - cmdcfgs.emplace_back(SHRPX_OPT_NO_HTTP2_CIPHER_BLOCK_LIST, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_HTTP2_CIPHER_BLOCK_LIST, "yes"_sr); break; case 168: // --client-no-http2-cipher-block-list cmdcfgs.emplace_back(SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST, - StringRef::from_lit("yes")); + "yes"_sr); break; case 169: // --quic-bpf-program-file @@ -5197,7 +5174,7 @@ int main(int argc, char **argv) { break; case 170: // --no-quic-bpf - cmdcfgs.emplace_back(SHRPX_OPT_NO_QUIC_BPF, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_NO_QUIC_BPF, "yes"_sr); break; case 171: // --http2-altsvc @@ -5215,8 +5192,7 @@ int main(int argc, char **argv) { break; case 174: // --frontend-quic-debug-log - cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG, "yes"_sr); break; case 175: // --frontend-http3-window-size @@ -5236,8 +5212,8 @@ int main(int argc, char **argv) { case 178: // --frontend-http3-max-connection-window-size cmdcfgs.emplace_back( - SHRPX_OPT_FRONTEND_HTTP3_MAX_CONNECTION_WINDOW_SIZE, - StringRef{optarg}); + SHRPX_OPT_FRONTEND_HTTP3_MAX_CONNECTION_WINDOW_SIZE, + StringRef{optarg}); break; case 179: // --frontend-http3-max-concurrent-streams @@ -5246,8 +5222,7 @@ int main(int argc, char **argv) { break; case 180: // --frontend-quic-early-data - cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_EARLY_DATA, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_EARLY_DATA, "yes"_sr); break; case 181: // --frontend-quic-qlog-dir @@ -5256,8 +5231,7 @@ int main(int argc, char **argv) { break; case 182: // --frontend-quic-require-token - cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_REQUIRE_TOKEN, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_QUIC_REQUIRE_TOKEN, "yes"_sr); break; case 183: // --frontend-quic-congestion-controller @@ -5293,12 +5267,30 @@ int main(int argc, char **argv) { break; case 191: // --require-http-scheme - cmdcfgs.emplace_back(SHRPX_OPT_REQUIRE_HTTP_SCHEME, - StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_REQUIRE_HTTP_SCHEME, "yes"_sr); break; case 192: // --tls-ktls - cmdcfgs.emplace_back(SHRPX_OPT_TLS_KTLS, StringRef::from_lit("yes")); + cmdcfgs.emplace_back(SHRPX_OPT_TLS_KTLS, "yes"_sr); + break; + case 193: + // --alpn-list + cmdcfgs.emplace_back(SHRPX_OPT_ALPN_LIST, StringRef{optarg}); + break; + case 194: + // --frontend-header-timeout + cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_HEADER_TIMEOUT, + StringRef{optarg}); + break; + case 195: + // --frontend-http2-idle-timeout + cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_HTTP2_IDLE_TIMEOUT, + StringRef{optarg}); + break; + case 196: + // --frontend-http3-idle-timeout + cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_HTTP3_IDLE_TIMEOUT, + StringRef{optarg}); break; default: break; diff --git a/lib/nghttp2/src/shrpx.h b/lib/nghttp2-1.65.0/src/shrpx.h similarity index 98% rename from lib/nghttp2/src/shrpx.h rename to lib/nghttp2-1.65.0/src/shrpx.h index d881ef5d9d4..e6379bd8b26 100644 --- a/lib/nghttp2/src/shrpx.h +++ b/lib/nghttp2-1.65.0/src/shrpx.h @@ -36,6 +36,8 @@ #include +#define NGHTTP2_NO_SSIZE_T + #ifndef HAVE__EXIT # define nghttp2_Exit(status) _exit(status) #else // HAVE__EXIT diff --git a/lib/nghttp2/src/shrpx_accept_handler.cc b/lib/nghttp2-1.65.0/src/shrpx_accept_handler.cc similarity index 96% rename from lib/nghttp2/src/shrpx_accept_handler.cc rename to lib/nghttp2-1.65.0/src/shrpx_accept_handler.cc index 01b641580c1..e8728570d62 100644 --- a/lib/nghttp2/src/shrpx_accept_handler.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_accept_handler.cc @@ -47,7 +47,7 @@ void acceptcb(struct ev_loop *loop, ev_io *w, int revent) { } // namespace AcceptHandler::AcceptHandler(const UpstreamAddr *faddr, ConnectionHandler *h) - : conn_hnr_(h), faddr_(faddr) { + : conn_hnr_(h), faddr_(faddr) { ev_io_init(&wev_, acceptcb, faddr_->fd, EV_READ); wev_.data = this; ev_io_start(conn_hnr_->get_loop(), &wev_); @@ -64,7 +64,7 @@ void AcceptHandler::accept_connection() { #ifdef HAVE_ACCEPT4 auto cfd = - accept4(faddr_->fd, &sockaddr.sa, &addrlen, SOCK_NONBLOCK | SOCK_CLOEXEC); + accept4(faddr_->fd, &sockaddr.sa, &addrlen, SOCK_NONBLOCK | SOCK_CLOEXEC); #else // !HAVE_ACCEPT4 auto cfd = accept(faddr_->fd, &sockaddr.sa, &addrlen); #endif // !HAVE_ACCEPT4 diff --git a/lib/nghttp2/src/shrpx_accept_handler.h b/lib/nghttp2-1.65.0/src/shrpx_accept_handler.h similarity index 100% rename from lib/nghttp2/src/shrpx_accept_handler.h rename to lib/nghttp2-1.65.0/src/shrpx_accept_handler.h diff --git a/lib/nghttp2/src/shrpx_api_downstream_connection.cc b/lib/nghttp2-1.65.0/src/shrpx_api_downstream_connection.cc similarity index 81% rename from lib/nghttp2/src/shrpx_api_downstream_connection.cc rename to lib/nghttp2-1.65.0/src/shrpx_api_downstream_connection.cc index 254ab59e2bb..fcc84ace97c 100644 --- a/lib/nghttp2/src/shrpx_api_downstream_connection.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_api_downstream_connection.cc @@ -39,38 +39,32 @@ namespace shrpx { namespace { -// List of API endpoints -const std::array &apis() { - static const auto apis = new std::array{ - APIEndpoint{ - StringRef::from_lit("/api/v1beta1/backendconfig"), - true, - (1 << API_METHOD_POST) | (1 << API_METHOD_PUT), - &APIDownstreamConnection::handle_backendconfig, - }, - APIEndpoint{ - StringRef::from_lit("/api/v1beta1/configrevision"), - true, - (1 << API_METHOD_GET), - &APIDownstreamConnection::handle_configrevision, - }, - }; - - return *apis; -} +const auto backendconfig_endpoint = APIEndpoint{ + "/api/v1beta1/backendconfig"_sr, + true, + (1 << API_METHOD_POST) | (1 << API_METHOD_PUT), + &APIDownstreamConnection::handle_backendconfig, +}; + +const auto configrevision_endpoint = APIEndpoint{ + "/api/v1beta1/configrevision"_sr, + true, + (1 << API_METHOD_GET), + &APIDownstreamConnection::handle_configrevision, +}; } // namespace namespace { // The method string. This must be same order of APIMethod. constexpr StringRef API_METHOD_STRING[] = { - StringRef::from_lit("GET"), - StringRef::from_lit("POST"), - StringRef::from_lit("PUT"), + "GET"_sr, + "POST"_sr, + "PUT"_sr, }; } // namespace APIDownstreamConnection::APIDownstreamConnection(Worker *worker) - : worker_(worker), api_(nullptr), fd_(-1), shutdown_read_(false) {} + : worker_(worker), api_(nullptr), fd_(-1), shutdown_read_(false) {} APIDownstreamConnection::~APIDownstreamConnection() { if (fd_ != -1) { @@ -112,26 +106,26 @@ int APIDownstreamConnection::send_reply(unsigned int http_status, switch (api_status) { case APIStatusCode::SUCCESS: - api_status_str = StringRef::from_lit("Success"); + api_status_str = "Success"_sr; break; case APIStatusCode::FAILURE: - api_status_str = StringRef::from_lit("Failure"); + api_status_str = "Failure"_sr; break; default: assert(0); } - constexpr auto M1 = StringRef::from_lit("{\"status\":\""); - constexpr auto M2 = StringRef::from_lit("\",\"code\":"); - constexpr auto M3 = StringRef::from_lit("}"); + constexpr auto M1 = "{\"status\":\""_sr; + constexpr auto M2 = "\",\"code\":"_sr; + constexpr auto M3 = "}"_sr; // 3 is the number of digits in http_status, assuming it is 3 digits // number. - auto buflen = M1.size() + M2.size() + M3.size() + data.size() + - api_status_str.size() + 3; + auto buflen = + M1.size() + M2.size() + M3.size() + data.size() + api_status_str.size() + 3; auto buf = make_byte_ref(balloc, buflen); - auto p = buf.base; + auto p = std::begin(buf); p = std::copy(std::begin(M1), std::end(M1), p); p = std::copy(std::begin(api_status_str), std::end(api_status_str), p); @@ -140,24 +134,23 @@ int APIDownstreamConnection::send_reply(unsigned int http_status, p = std::copy(std::begin(data), std::end(data), p); p = std::copy(std::begin(M3), std::end(M3), p); - buf.len = p - buf.base; + buf = buf.subspan(0, p - std::begin(buf)); - auto content_length = util::make_string_ref_uint(balloc, buf.len); + auto content_length = util::make_string_ref_uint(balloc, buf.size()); - resp.fs.add_header_token(StringRef::from_lit("content-length"), - content_length, false, http2::HD_CONTENT_LENGTH); + resp.fs.add_header_token("content-length"_sr, content_length, false, + http2::HD_CONTENT_LENGTH); switch (http_status) { case 400: case 405: case 413: - resp.fs.add_header_token(StringRef::from_lit("connection"), - StringRef::from_lit("close"), false, + resp.fs.add_header_token("connection"_sr, "close"_sr, false, http2::HD_CONNECTION); break; } - if (upstream->send_reply(downstream_, buf.base, buf.len) != 0) { + if (upstream->send_reply(downstream_, buf.data(), buf.size()) != 0) { return -1; } @@ -170,8 +163,8 @@ const APIEndpoint *lookup_api(const StringRef &path) { case 26: switch (path[25]) { case 'g': - if (util::streq_l("/api/v1beta1/backendconfi", std::begin(path), 25)) { - return &apis()[0]; + if (util::streq("/api/v1beta1/backendconfi"_sr, path, 25)) { + return &backendconfig_endpoint; } break; } @@ -179,8 +172,8 @@ const APIEndpoint *lookup_api(const StringRef &path) { case 27: switch (path[26]) { case 'n': - if (util::streq_l("/api/v1beta1/configrevisio", std::begin(path), 26)) { - return &apis()[1]; + if (util::streq("/api/v1beta1/configrevisio"_sr, path, 26)) { + return &configrevision_endpoint; } break; } @@ -194,8 +187,8 @@ int APIDownstreamConnection::push_request_headers() { auto &req = downstream_->request(); auto path = - StringRef{std::begin(req.path), - std::find(std::begin(req.path), std::end(req.path), '?')}; + StringRef{std::begin(req.path), + std::find(std::begin(req.path), std::end(req.path), '?')}; api_ = lookup_api(path); @@ -283,7 +276,7 @@ int APIDownstreamConnection::error_method_not_allowed() { auto &balloc = downstream_->get_block_allocator(); auto iov = make_byte_ref(balloc, len + 1); - auto p = iov.base; + auto p = std::begin(iov); for (uint8_t i = 0; i < API_METHOD_MAX; ++i) { if (api_->allowed_methods & (1 << i)) { auto &s = API_METHOD_STRING[i]; @@ -295,7 +288,7 @@ int APIDownstreamConnection::error_method_not_allowed() { p -= 2; *p = '\0'; - resp.fs.add_header_token(StringRef::from_lit("allow"), StringRef{iov.base, p}, + resp.fs.add_header_token("allow"_sr, StringRef{std::span{std::begin(iov), p}}, false, -1); return send_reply(405, APIStatusCode::FAILURE); } @@ -394,10 +387,10 @@ int APIDownstreamConnection::handle_backendconfig() { return 0; } - auto opt = StringRef{first, eq}; - auto optval = StringRef{eq + 1, eol}; + auto opt = StringRef{std::span{first, eq}}; + auto optval = StringRef{std::span{eq + 1, eol}}; - auto optid = option_lookup_token(opt.c_str(), opt.size()); + auto optid = option_lookup_token(opt); switch (optid) { case SHRPX_OPTID_BACKEND: @@ -442,9 +435,8 @@ int APIDownstreamConnection::handle_configrevision() { // "configRevision": N // } auto data = concat_string_ref( - balloc, StringRef::from_lit(R"(,"data":{"configRevision":)"), - util::make_string_ref_uint(balloc, config->config_revision), - StringRef::from_lit("}")); + balloc, R"(,"data":{"configRevision":)"_sr, + util::make_string_ref_uint(balloc, config->config_revision), "}"_sr); send_reply(200, APIStatusCode::SUCCESS, data); diff --git a/lib/nghttp2/src/shrpx_api_downstream_connection.h b/lib/nghttp2-1.65.0/src/shrpx_api_downstream_connection.h similarity index 100% rename from lib/nghttp2/src/shrpx_api_downstream_connection.h rename to lib/nghttp2-1.65.0/src/shrpx_api_downstream_connection.h diff --git a/lib/nghttp2/src/shrpx_client_handler.cc b/lib/nghttp2-1.65.0/src/shrpx_client_handler.cc similarity index 88% rename from lib/nghttp2/src/shrpx_client_handler.cc rename to lib/nghttp2-1.65.0/src/shrpx_client_handler.cc index ac7a65ec94a..b4f0b30f175 100644 --- a/lib/nghttp2/src/shrpx_client_handler.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_client_handler.cc @@ -322,11 +322,11 @@ int ClientHandler::write_tls() { int ClientHandler::read_quic(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, - const ngtcp2_pkt_info &pi, const uint8_t *data, - size_t datalen) { + const ngtcp2_pkt_info &pi, + std::span data) { auto upstream = static_cast(upstream_.get()); - return upstream->on_read(faddr, remote_addr, local_addr, pi, data, datalen); + return upstream->on_read(faddr, remote_addr, local_addr, pi, data); } int ClientHandler::write_quic() { return upstream_->on_write(); } @@ -433,32 +433,31 @@ int ClientHandler::upstream_http1_connhd_read() { ClientHandler::ClientHandler(Worker *worker, int fd, SSL *ssl, const StringRef &ipaddr, const StringRef &port, int family, const UpstreamAddr *faddr) - : // We use balloc_ for TLS session ID (64), ipaddr (IPv6) (39), - // port (5), forwarded-for (IPv6) (41), alpn (5), proxyproto - // ipaddr (15), proxyproto port (5), sni (32, estimated). we - // need terminal NULL byte for each. We also require 8 bytes - // header for each allocation. We align at 16 bytes boundary, - // so the required space is 64 + 48 + 16 + 48 + 16 + 16 + 16 + - // 32 + 8 + 8 * 8 = 328. - balloc_(512, 512), - rb_(worker->get_mcpool()), - conn_(worker->get_loop(), fd, ssl, worker->get_mcpool(), - get_config()->conn.upstream.timeout.write, - get_config()->conn.upstream.timeout.read, - get_config()->conn.upstream.ratelimit.write, - get_config()->conn.upstream.ratelimit.read, writecb, readcb, - timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold, - get_config()->tls.dyn_rec.idle_timeout, - faddr->quic ? Proto::HTTP3 : Proto::NONE), - ipaddr_(make_string_ref(balloc_, ipaddr)), - port_(make_string_ref(balloc_, port)), - faddr_(faddr), - worker_(worker), - left_connhd_len_(NGHTTP2_CLIENT_MAGIC_LEN), - affinity_hash_(0), - should_close_after_write_(false), - affinity_hash_computed_(false) { - + : // We use balloc_ for TLS session ID (64), ipaddr (IPv6) (39), + // port (5), forwarded-for (IPv6) (41), alpn (5), proxyproto + // ipaddr (15), proxyproto port (5), sni (32, estimated). we + // need terminal NULL byte for each. We also require 8 bytes + // header for each allocation. We align at 16 bytes boundary, + // so the required space is 64 + 48 + 16 + 48 + 16 + 16 + 16 + + // 32 + 8 + 8 * 8 = 328. + balloc_(512, 512), + rb_(worker->get_mcpool()), + conn_(worker->get_loop(), fd, ssl, worker->get_mcpool(), + get_config()->conn.upstream.timeout.write, + get_config()->conn.upstream.timeout.idle, + get_config()->conn.upstream.ratelimit.write, + get_config()->conn.upstream.ratelimit.read, writecb, readcb, + timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold, + get_config()->tls.dyn_rec.idle_timeout, + faddr->quic ? Proto::HTTP3 : Proto::NONE), + ipaddr_(make_string_ref(balloc_, ipaddr)), + port_(make_string_ref(balloc_, port)), + faddr_(faddr), + worker_(worker), + left_connhd_len_(NGHTTP2_CLIENT_MAGIC_LEN), + affinity_hash_(0), + should_close_after_write_(false), + affinity_hash_computed_(false) { ++worker_->get_worker_stat()->num_connections; ev_timer_init(&reneg_shutdown_timer_, shutdowncb, 0., 0.); @@ -492,13 +491,13 @@ ClientHandler::ClientHandler(Worker *worker, int fd, SSL *ssl, auto len = SHRPX_OBFUSCATED_NODE_LENGTH + 1; // 1 for terminating NUL. auto buf = make_byte_ref(balloc_, len + 1); - auto p = buf.base; + auto p = std::begin(buf); *p++ = '_'; p = util::random_alpha_digit(p, p + SHRPX_OBFUSCATED_NODE_LENGTH, worker_->get_randgen()); *p = '\0'; - forwarded_for_ = StringRef{buf.base, p}; + forwarded_for_ = StringRef{std::span{std::begin(buf), p}}; } else { init_forwarded_for(family, ipaddr_); } @@ -511,13 +510,13 @@ void ClientHandler::init_forwarded_for(int family, const StringRef &ipaddr) { auto len = 2 + ipaddr.size(); // 1 for terminating NUL. auto buf = make_byte_ref(balloc_, len + 1); - auto p = buf.base; + auto p = std::begin(buf); *p++ = '['; p = std::copy(std::begin(ipaddr), std::end(ipaddr), p); *p++ = ']'; *p = '\0'; - forwarded_for_ = StringRef{buf.base, p}; + forwarded_for_ = StringRef{std::span{std::begin(buf), p}}; } else { // family == AF_INET or family == AF_UNIX forwarded_for_ = ipaddr; @@ -535,7 +534,7 @@ void ClientHandler::setup_upstream_io_callback() { // upgraded to HTTP/2 through HTTP Upgrade or direct HTTP/2 // connection. upstream_ = std::make_unique(this); - alpn_ = StringRef::from_lit("http/1.1"); + alpn_ = "http/1.1"_sr; read_ = &ClientHandler::read_clear; write_ = &ClientHandler::write_clear; on_read_ = &ClientHandler::upstream_http1_connhd_read; @@ -545,13 +544,13 @@ void ClientHandler::setup_upstream_io_callback() { #ifdef ENABLE_HTTP3 void ClientHandler::setup_http3_upstream( - std::unique_ptr &&upstream) { + std::unique_ptr &&upstream) { upstream_ = std::move(upstream); write_ = &ClientHandler::write_quic; auto config = get_config(); - reset_upstream_read_timeout(config->conn.upstream.timeout.http3_read); + reset_upstream_read_timeout(config->conn.upstream.timeout.http3_idle); } #endif // ENABLE_HTTP3 @@ -591,16 +590,14 @@ struct ev_loop *ClientHandler::get_loop() const { return conn_.loop; } void ClientHandler::reset_upstream_read_timeout(ev_tstamp t) { conn_.rt.repeat = t; - if (ev_is_active(&conn_.rt)) { - ev_timer_again(conn_.loop, &conn_.rt); - } + + ev_timer_again(conn_.loop, &conn_.rt); } void ClientHandler::reset_upstream_write_timeout(ev_tstamp t) { conn_.wt.repeat = t; - if (ev_is_active(&conn_.wt)) { - ev_timer_again(conn_.loop, &conn_.wt); - } + + ev_timer_again(conn_.loop, &conn_.wt); } void ClientHandler::repeat_read_timer() { @@ -616,14 +613,7 @@ int ClientHandler::validate_next_proto() { // First set callback for catch all cases on_read_ = &ClientHandler::upstream_read; -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_get0_next_proto_negotiated(conn_.tls.ssl, &next_proto, &next_proto_len); -#endif // !OPENSSL_NO_NEXTPROTONEG -#if OPENSSL_VERSION_NUMBER >= 0x10002000L - if (next_proto == nullptr) { - SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len); - } -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L + SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len); StringRef proto; @@ -638,10 +628,10 @@ int ClientHandler::validate_next_proto() { CLOG(INFO, this) << "No protocol negotiated. Fallback to HTTP/1.1"; } - proto = StringRef::from_lit("http/1.1"); + proto = "http/1.1"_sr; } - if (!tls::in_proto_list(get_config()->tls.npn_list, proto)) { + if (!tls::in_proto_list(get_config()->tls.alpn_list, proto)) { if (LOG_ENABLED(INFO)) { CLOG(INFO, this) << "The negotiated protocol is not supported: " << proto; } @@ -666,9 +656,9 @@ int ClientHandler::validate_next_proto() { return 0; } - if (proto == StringRef::from_lit("http/1.1")) { + if (proto == "http/1.1"_sr) { upstream_ = std::make_unique(this); - alpn_ = StringRef::from_lit("http/1.1"); + alpn_ = "http/1.1"_sr; // At this point, input buffer is already filled with some bytes. // The read callback is not called until new data come. So consume @@ -711,7 +701,7 @@ void ClientHandler::set_should_close_after_write(bool f) { } void ClientHandler::pool_downstream_connection( - std::unique_ptr dconn) { + std::unique_ptr dconn) { if (!dconn->poolable()) { return; } @@ -750,7 +740,7 @@ uint32_t compute_affinity_from_ip(const StringRef &ip) { } // namespace Http2Session *ClientHandler::get_http2_session( - const std::shared_ptr &group, DownstreamAddr *addr) { + const std::shared_ptr &group, DownstreamAddr *addr) { auto &shared_addr = group->shared_addr; if (LOG_ENABLED(INFO)) { @@ -764,8 +754,8 @@ Http2Session *ClientHandler::get_http2_session( if (session->max_concurrency_reached(0)) { if (LOG_ENABLED(INFO)) { CLOG(INFO, this) - << "Maximum streams have been reached for Http2Session(" << session - << "). Skip it"; + << "Maximum streams have been reached for Http2Session(" << session + << "). Skip it"; } session->remove_from_freelist(); @@ -811,8 +801,7 @@ uint32_t ClientHandler::get_affinity_cookie(Downstream *downstream, auto d = std::uniform_int_distribution(1); auto rh = d(worker_->get_randgen()); - h = util::hash32(StringRef{reinterpret_cast(&rh), - reinterpret_cast(&rh) + sizeof(rh)}); + h = util::hash32(StringRef{reinterpret_cast(&rh), sizeof(rh)}); downstream->renew_affinity_cookie(h); @@ -821,9 +810,9 @@ uint32_t ClientHandler::get_affinity_cookie(Downstream *downstream, namespace { void reschedule_addr( - std::priority_queue, - DownstreamAddrEntryGreater> &pq, - DownstreamAddr *addr) { + std::priority_queue, + DownstreamAddrEntryGreater> &pq, + DownstreamAddr *addr) { auto penalty = MAX_DOWNSTREAM_ADDR_WEIGHT + addr->pending_penalty; addr->cycle += penalty / addr->weight; addr->pending_penalty = penalty % addr->weight; @@ -835,9 +824,9 @@ void reschedule_addr( namespace { void reschedule_wg( - std::priority_queue, - WeightGroupEntryGreater> &pq, - WeightGroup *wg) { + std::priority_queue, + WeightGroupEntryGreater> &pq, + WeightGroup *wg) { auto penalty = MAX_DOWNSTREAM_ADDR_WEIGHT + wg->pending_penalty; wg->cycle += penalty / wg->weight; wg->pending_penalty = penalty % wg->weight; @@ -888,15 +877,15 @@ DownstreamAddr *ClientHandler::get_downstream_addr(int &err, const auto &affinity_hash = shared_addr->affinity_hash; auto it = std::lower_bound( - std::begin(affinity_hash), std::end(affinity_hash), hash, - [](const AffinityHash &lhs, uint32_t rhs) { return lhs.hash < rhs; }); + std::begin(affinity_hash), std::end(affinity_hash), hash, + [](const AffinityHash &lhs, uint32_t rhs) { return lhs.hash < rhs; }); if (it == std::end(affinity_hash)) { it = std::begin(affinity_hash); } auto aff_idx = - static_cast(std::distance(std::begin(affinity_hash), it)); + static_cast(std::distance(std::begin(affinity_hash), it)); auto idx = (*it).idx; auto addr = &shared_addr->addrs[idx]; @@ -956,8 +945,8 @@ DownstreamAddr *ClientHandler::get_downstream_addr(int &err, } DownstreamAddr *ClientHandler::get_downstream_addr_strict_affinity( - int &err, const std::shared_ptr &shared_addr, - Downstream *downstream) { + int &err, const std::shared_ptr &shared_addr, + Downstream *downstream) { const auto &affinity_hash = shared_addr->affinity_hash; auto h = downstream->find_affinity_cookie(shared_addr->affinity.cookie.name); @@ -972,8 +961,7 @@ DownstreamAddr *ClientHandler::get_downstream_addr_strict_affinity( } else { auto d = std::uniform_int_distribution(1); auto rh = d(worker_->get_randgen()); - h = util::hash32(StringRef{reinterpret_cast(&rh), - reinterpret_cast(&rh) + sizeof(rh)}); + h = util::hash32(StringRef{reinterpret_cast(&rh), sizeof(rh)}); } // Client is not bound to a particular backend, or the bound backend @@ -982,15 +970,15 @@ DownstreamAddr *ClientHandler::get_downstream_addr_strict_affinity( // It is preferable because multiple concurrent requests with the // stale cookie might be in-flight. auto it = std::lower_bound( - std::begin(affinity_hash), std::end(affinity_hash), h, - [](const AffinityHash &lhs, uint32_t rhs) { return lhs.hash < rhs; }); + std::begin(affinity_hash), std::end(affinity_hash), h, + [](const AffinityHash &lhs, uint32_t rhs) { return lhs.hash < rhs; }); if (it == std::end(affinity_hash)) { it = std::begin(affinity_hash); } auto aff_idx = - static_cast(std::distance(std::begin(affinity_hash), it)); + static_cast(std::distance(std::begin(affinity_hash), it)); auto idx = (*it).idx; auto addr = &shared_addr->addrs[idx]; @@ -1124,7 +1112,7 @@ ClientHandler::get_downstream_connection(int &err, Downstream *downstream) { if (worker_->get_connect_blocker()->blocked()) { if (LOG_ENABLED(INFO)) { DCLOG(INFO, this) - << "Worker wide backend connection was blocked temporarily"; + << "Worker wide backend connection was blocked temporarily"; } return nullptr; } @@ -1157,7 +1145,7 @@ SSL *ClientHandler::get_ssl() const { return conn_.tls.ssl; } void ClientHandler::direct_http2_upgrade() { upstream_ = std::make_unique(this); - alpn_ = StringRef::from_lit(NGHTTP2_CLEARTEXT_PROTO_VERSION_ID); + alpn_ = NGHTTP2_CLEARTEXT_PROTO_VERSION_ID ""_sr; on_read_ = &ClientHandler::upstream_read; write_ = &ClientHandler::write_clear; } @@ -1182,17 +1170,16 @@ int ClientHandler::perform_http2_upgrade(HttpsUpstream *http) { upstream_.release(); // TODO We might get other version id in HTTP2-settings, if we // support aliasing for h2, but we just use library default for now. - alpn_ = StringRef::from_lit(NGHTTP2_CLEARTEXT_PROTO_VERSION_ID); + alpn_ = NGHTTP2_CLEARTEXT_PROTO_VERSION_ID ""_sr; on_read_ = &ClientHandler::upstream_http2_connhd_read; write_ = &ClientHandler::write_clear; input->remove(*output, input->rleft()); - constexpr auto res = - StringRef::from_lit("HTTP/1.1 101 Switching Protocols\r\n" - "Connection: Upgrade\r\n" - "Upgrade: " NGHTTP2_CLEARTEXT_PROTO_VERSION_ID "\r\n" - "\r\n"); + constexpr auto res = "HTTP/1.1 101 Switching Protocols\r\n" + "Connection: Upgrade\r\n" + "Upgrade: " NGHTTP2_CLEARTEXT_PROTO_VERSION_ID "\r\n" + "\r\n"_sr; output->append(res); upstream_ = std::move(upstream); @@ -1205,9 +1192,9 @@ bool ClientHandler::get_http2_upgrade_allowed() const { return !conn_.tls.ssl; } StringRef ClientHandler::get_upstream_scheme() const { if (conn_.tls.ssl) { - return StringRef::from_lit("https"); + return "https"_sr; } else { - return StringRef::from_lit("http"); + return "http"_sr; } } @@ -1227,18 +1214,18 @@ void ClientHandler::write_accesslog(Downstream *downstream) { } upstream_accesslog( - config->logging.access.format, - LogSpec{ - downstream, - ipaddr_, - alpn_, - sni_, - conn_.tls.ssl, - std::chrono::high_resolution_clock::now(), // request_end_time - port_, - faddr_->port, - config->pid, - }); + config->logging.access.format, + LogSpec{ + downstream, + ipaddr_, + alpn_, + sni_, + conn_.tls.ssl, + std::chrono::high_resolution_clock::now(), // request_end_time + port_, + faddr_->port, + config->pid, + }); } ClientHandler::ReadBuf *ClientHandler::get_rb() { return &rb_; } @@ -1307,11 +1294,11 @@ int ClientHandler::on_proxy_protocol_finish() { namespace { // PROXY-protocol v2 header signature constexpr uint8_t PROXY_PROTO_V2_SIG[] = - "\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A"; + "\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A"; // PROXY-protocol v2 header length constexpr size_t PROXY_PROTO_V2_HDLEN = - str_size(PROXY_PROTO_V2_SIG) + /* ver_cmd(1) + fam(1) + len(2) = */ 4; + str_size(PROXY_PROTO_V2_SIG) + /* ver_cmd(1) + fam(1) + len(2) = */ 4; } // namespace // http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt @@ -1333,14 +1320,14 @@ int ClientHandler::proxy_protocol_read() { // NULL character really destroys functions which expects NULL // terminated string. We won't expect it in PROXY protocol line, so // find it here. - auto chrs = std::array{'\n', '\0'}; + auto chrs = std::to_array({'\n', '\0'}); constexpr size_t MAX_PROXY_LINELEN = 107; auto bufend = rb_.pos() + std::min(MAX_PROXY_LINELEN, rb_.rleft()); auto end = - std::find_first_of(rb_.pos(), bufend, std::begin(chrs), std::end(chrs)); + std::find_first_of(rb_.pos(), bufend, std::begin(chrs), std::end(chrs)); if (end == bufend || *end == '\0' || end == rb_.pos() || *(end - 1) != '\r') { if (LOG_ENABLED(INFO)) { @@ -1351,7 +1338,7 @@ int ClientHandler::proxy_protocol_read() { --end; - constexpr auto HEADER = StringRef::from_lit("PROXY "); + constexpr auto HEADER = "PROXY "_sr; if (static_cast(end - rb_.pos()) < HEADER.size()) { if (LOG_ENABLED(INFO)) { @@ -1360,7 +1347,7 @@ int ClientHandler::proxy_protocol_read() { return -1; } - if (!util::streq(HEADER, StringRef{rb_.pos(), HEADER.size()})) { + if (HEADER != StringRef{rb_.pos(), HEADER.size()}) { if (LOG_ENABLED(INFO)) { CLOG(INFO, this) << "PROXY-protocol-v1: Bad PROXY protocol version 1 ID"; } @@ -1408,7 +1395,7 @@ int ClientHandler::proxy_protocol_read() { } return -1; } - if (!util::streq_l("UNKNOWN", rb_.pos(), 7)) { + if ("UNKNOWN"_sr != StringRef{rb_.pos(), 7}) { if (LOG_ENABLED(INFO)) { CLOG(INFO, this) << "PROXY-protocol-v1: Unknown INET protocol family"; } @@ -1491,9 +1478,10 @@ int ClientHandler::proxy_protocol_read() { rb_.drain(end + 2 - rb_.pos()); - ipaddr_ = - make_string_ref(balloc_, StringRef{src_addr, src_addr + src_addrlen}); - port_ = make_string_ref(balloc_, StringRef{src_port, src_port + src_portlen}); + ipaddr_ = make_string_ref( + balloc_, StringRef{src_addr, static_cast(src_addrlen)}); + port_ = make_string_ref( + balloc_, StringRef{src_port, static_cast(src_portlen)}); if (LOG_ENABLED(INFO)) { CLOG(INFO, this) << "PROXY-protocol-v1: Finished, " << (rb_.pos() - first) @@ -1553,15 +1541,15 @@ int ClientHandler::proxy_protocol_v2_read() { if (rb_.last() - p < len) { if (LOG_ENABLED(INFO)) { CLOG(INFO, this) - << "PROXY-protocol-v2: Prematurely truncated header block; require " - << len << " bytes, " << rb_.last() - p << " bytes left"; + << "PROXY-protocol-v2: Prematurely truncated header block; require " + << len << " bytes, " << rb_.last() - p << " bytes left"; } return -1; } int family; std::array src_addr, - dst_addr; + dst_addr; size_t addrlen; switch (fam) { @@ -1635,7 +1623,7 @@ int ClientHandler::proxy_protocol_v2_read() { if (inet_ntop(family, p, dst_addr.data(), dst_addr.size()) == nullptr) { if (LOG_ENABLED(INFO)) { CLOG(INFO, this) - << "PROXY-protocol-v2: Unable to parse destination address"; + << "PROXY-protocol-v2: Unable to parse destination address"; } return -1; } @@ -1686,7 +1674,7 @@ StringRef ClientHandler::get_forwarded_for() const { return forwarded_for_; } const UpstreamAddr *ClientHandler::get_upstream_addr() const { return faddr_; } -Connection *ClientHandler::get_connection() { return &conn_; }; +Connection *ClientHandler::get_connection() { return &conn_; } void ClientHandler::set_tls_sni(const StringRef &sni) { sni_ = make_string_ref(balloc_, sni); diff --git a/lib/nghttp2/src/shrpx_client_handler.h b/lib/nghttp2-1.65.0/src/shrpx_client_handler.h similarity index 95% rename from lib/nghttp2/src/shrpx_client_handler.h rename to lib/nghttp2-1.65.0/src/shrpx_client_handler.h index 511dd9108e8..6d787b3f4d8 100644 --- a/lib/nghttp2/src/shrpx_client_handler.h +++ b/lib/nghttp2-1.65.0/src/shrpx_client_handler.h @@ -31,7 +31,14 @@ #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include "shrpx_rate_limit.h" #include "shrpx_connection.h" @@ -153,7 +160,7 @@ class ClientHandler { void setup_http3_upstream(std::unique_ptr &&upstream); int read_quic(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen); + std::span data); int write_quic(); #endif // ENABLE_HTTP3 @@ -174,8 +181,8 @@ class ClientHandler { const StringRef &cookie_name); DownstreamAddr *get_downstream_addr_strict_affinity( - int &err, const std::shared_ptr &shared_addr, - Downstream *downstream); + int &err, const std::shared_ptr &shared_addr, + Downstream *downstream); const UpstreamAddr *get_upstream_addr() const; diff --git a/lib/nghttp2/src/shrpx_config.cc b/lib/nghttp2-1.65.0/src/shrpx_config.cc similarity index 76% rename from lib/nghttp2/src/shrpx_config.cc rename to lib/nghttp2-1.65.0/src/shrpx_config.cc index bcb48ebccef..660284c5e2a 100644 --- a/lib/nghttp2/src/shrpx_config.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_config.cc @@ -49,9 +49,15 @@ #include #include +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL + #include -#include "url-parser/url_parser.h" +#include "urlparse.h" #include "shrpx_log.h" #include "shrpx_tls.h" @@ -64,13 +70,17 @@ #include "ssl_compat.h" #include "xsi_strerror.h" +#ifndef AI_NUMERICSERV +# define AI_NUMERICSERV 0 +#endif + namespace shrpx { namespace { Config *config; } // namespace -constexpr auto SHRPX_UNIX_PATH_PREFIX = StringRef::from_lit("unix:"); +constexpr auto SHRPX_UNIX_PATH_PREFIX = "unix:"_sr; const Config *get_config() { return config; } @@ -133,8 +143,8 @@ int split_host_port(char *host, size_t hostlen, uint16_t *port_ptr, auto portstr = StringRef{sep + 1, std::end(hostport)}; auto d = util::parse_uint(portstr); - if (1 <= d && d <= std::numeric_limits::max()) { - *port_ptr = d; + if (d && 1 <= d && d <= std::numeric_limits::max()) { + *port_ptr = *d; return 0; } @@ -146,7 +156,7 @@ int split_host_port(char *host, size_t hostlen, uint16_t *port_ptr, namespace { bool is_secure(const StringRef &filename) { struct stat buf; - int rv = stat(filename.c_str(), &buf); + int rv = stat(filename.data(), &buf); if (rv == 0) { if ((buf.st_mode & S_IRWXU) && !(buf.st_mode & S_IRWXG) && !(buf.st_mode & S_IRWXO)) { @@ -179,7 +189,7 @@ read_tls_ticket_key_file(const std::vector &files, for (auto &file : files) { struct stat fst {}; - if (stat(file.c_str(), &fst) == -1) { + if (stat(file.data(), &fst) == -1) { auto error = errno; LOG(ERROR) << "tls-ticket-key-file: could not stat file " << file << ", errno=" << error; @@ -192,7 +202,7 @@ read_tls_ticket_key_file(const std::vector &files, return nullptr; } - std::ifstream f(file.c_str()); + std::ifstream f(file.data()); if (!f) { LOG(ERROR) << "tls-ticket-key-file: could not open file " << file; return nullptr; @@ -234,12 +244,12 @@ read_tls_ticket_key_file(const std::vector &files, std::shared_ptr read_quic_secret_file(const StringRef &path) { constexpr size_t expectedlen = - SHRPX_QUIC_SECRET_RESERVEDLEN + SHRPX_QUIC_SECRETLEN + SHRPX_QUIC_SALTLEN; + SHRPX_QUIC_SECRET_RESERVEDLEN + SHRPX_QUIC_SECRETLEN + SHRPX_QUIC_SALTLEN; auto qkms = std::make_shared(); auto &kms = qkms->keying_materials; - std::ifstream f(path.c_str()); + std::ifstream f(path.data()); if (!f) { LOG(ERROR) << "frontend-quic-secret-file: could not open file " << path; return nullptr; @@ -276,24 +286,24 @@ read_quic_secret_file(const StringRef &path) { assert(static_cast(p - std::begin(s)) == expectedlen * 2); - qkm.id = qkm.reserved[0] & 0xc0; + qkm.id = qkm.reserved[0] & SHRPX_QUIC_DCID_KM_ID_MASK; - if (kms.size() == 4) { + if (kms.size() == 8) { break; } } if (f.bad() || (!f.eof() && f.fail())) { LOG(ERROR) - << "frontend-quic-secret-file: error occurred while reading file " - << path; + << "frontend-quic-secret-file: error occurred while reading file " + << path; return nullptr; } if (kms.empty()) { LOG(WARN) - << "frontend-quic-secret-file: no keying materials are present in file " - << path; + << "frontend-quic-secret-file: no keying materials are present in file " + << path; return nullptr; } @@ -305,8 +315,8 @@ FILE *open_file_for_write(const char *filename) { std::array errbuf; #ifdef O_CLOEXEC - auto fd = open(filename, O_WRONLY | O_CLOEXEC | O_CREAT | O_TRUNC, - S_IRUSR | S_IWUSR); + auto fd = + open(filename, O_WRONLY | O_CLOEXEC | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); #else auto fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); @@ -344,7 +354,7 @@ std::string read_passwd_from_file(const StringRef &opt, return line; } - std::ifstream in(filename.c_str(), std::ios::binary); + std::ifstream in(filename.data(), std::ios::binary); if (!in) { LOG(ERROR) << opt << ": Could not open key passwd file " << filename; return line; @@ -368,15 +378,14 @@ HeaderRefs::value_type parse_header(BlockAllocator &balloc, ; auto name_iov = - make_byte_ref(balloc, std::distance(std::begin(optarg), colon) + 1); - auto p = name_iov.base; - p = std::copy(std::begin(optarg), colon, p); - util::inp_strlower(name_iov.base, p); + make_byte_ref(balloc, std::distance(std::begin(optarg), colon) + 1); + auto p = std::copy(std::begin(optarg), colon, std::begin(name_iov)); + util::inp_strlower(std::begin(name_iov), p); *p = '\0'; auto nv = - HeaderRef(StringRef{name_iov.base, p}, - make_string_ref(balloc, StringRef{value, std::end(optarg)})); + HeaderRef(StringRef{std::span{std::begin(name_iov), p}}, + make_string_ref(balloc, StringRef{value, std::end(optarg)})); if (!nghttp2_check_header_name(nv.name.byte(), nv.name.size()) || !nghttp2_check_header_value_rfc9113(nv.value.byte(), nv.value.size())) { @@ -389,12 +398,12 @@ HeaderRefs::value_type parse_header(BlockAllocator &balloc, template int parse_uint(T *dest, const StringRef &opt, const StringRef &optarg) { auto val = util::parse_uint(optarg); - if (val == -1) { + if (!val) { LOG(ERROR) << opt << ": bad value. Specify an integer >= 0."; return -1; } - *dest = val; + *dest = *val; return 0; } @@ -404,20 +413,22 @@ template int parse_uint_with_unit(T *dest, const StringRef &opt, const StringRef &optarg) { auto n = util::parse_uint_with_unit(optarg); - if (n == -1) { + if (!n) { LOG(ERROR) << opt << ": bad value: '" << optarg << "'"; return -1; } - if (static_cast(std::numeric_limits::max()) < - static_cast(n)) { - LOG(ERROR) << opt - << ": too large. The value should be less than or equal to " - << std::numeric_limits::max(); - return -1; + if constexpr (!std::is_same_v) { + if (static_cast(std::numeric_limits::max()) < + static_cast(*n)) { + LOG(ERROR) << opt + << ": too large. The value should be less than or equal to " + << std::numeric_limits::max(); + return -1; + } } - *dest = n; + *dest = *n; return 0; } @@ -476,12 +487,12 @@ int parse_altsvc(AltSvc &altsvc, const StringRef &opt, namespace { // generated by gennghttpxfun.py -LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { - switch (namelen) { +LogFragmentType log_var_lookup_token(const StringRef &name) { + switch (name.size()) { case 3: switch (name[2]) { case 'd': - if (util::strieq_l("pi", name, 2)) { + if (util::strieq("pi"_sr, name, 2)) { return LogFragmentType::PID; } break; @@ -490,12 +501,12 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 4: switch (name[3]) { case 'h': - if (util::strieq_l("pat", name, 3)) { + if (util::strieq("pat"_sr, name, 3)) { return LogFragmentType::PATH; } break; case 'n': - if (util::strieq_l("alp", name, 3)) { + if (util::strieq("alp"_sr, name, 3)) { return LogFragmentType::ALPN; } break; @@ -504,12 +515,12 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 6: switch (name[5]) { case 'd': - if (util::strieq_l("metho", name, 5)) { + if (util::strieq("metho"_sr, name, 5)) { return LogFragmentType::METHOD; } break; case 's': - if (util::strieq_l("statu", name, 5)) { + if (util::strieq("statu"_sr, name, 5)) { return LogFragmentType::STATUS; } break; @@ -518,12 +529,12 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 7: switch (name[6]) { case 'i': - if (util::strieq_l("tls_sn", name, 6)) { + if (util::strieq("tls_sn"_sr, name, 6)) { return LogFragmentType::TLS_SNI; } break; case 't': - if (util::strieq_l("reques", name, 6)) { + if (util::strieq("reques"_sr, name, 6)) { return LogFragmentType::REQUEST; } break; @@ -532,15 +543,15 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 10: switch (name[9]) { case 'l': - if (util::strieq_l("time_loca", name, 9)) { + if (util::strieq("time_loca"_sr, name, 9)) { return LogFragmentType::TIME_LOCAL; } break; case 'r': - if (util::strieq_l("ssl_ciphe", name, 9)) { + if (util::strieq("ssl_ciphe"_sr, name, 9)) { return LogFragmentType::SSL_CIPHER; } - if (util::strieq_l("tls_ciphe", name, 9)) { + if (util::strieq("tls_ciphe"_sr, name, 9)) { return LogFragmentType::TLS_CIPHER; } break; @@ -549,15 +560,15 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 11: switch (name[10]) { case 'r': - if (util::strieq_l("remote_add", name, 10)) { + if (util::strieq("remote_add"_sr, name, 10)) { return LogFragmentType::REMOTE_ADDR; } break; case 't': - if (util::strieq_l("remote_por", name, 10)) { + if (util::strieq("remote_por"_sr, name, 10)) { return LogFragmentType::REMOTE_PORT; } - if (util::strieq_l("server_por", name, 10)) { + if (util::strieq("server_por"_sr, name, 10)) { return LogFragmentType::SERVER_PORT; } break; @@ -566,28 +577,28 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 12: switch (name[11]) { case '1': - if (util::strieq_l("time_iso860", name, 11)) { + if (util::strieq("time_iso860"_sr, name, 11)) { return LogFragmentType::TIME_ISO8601; } break; case 'e': - if (util::strieq_l("request_tim", name, 11)) { + if (util::strieq("request_tim"_sr, name, 11)) { return LogFragmentType::REQUEST_TIME; } break; case 'l': - if (util::strieq_l("ssl_protoco", name, 11)) { + if (util::strieq("ssl_protoco"_sr, name, 11)) { return LogFragmentType::SSL_PROTOCOL; } - if (util::strieq_l("tls_protoco", name, 11)) { + if (util::strieq("tls_protoco"_sr, name, 11)) { return LogFragmentType::TLS_PROTOCOL; } break; case 't': - if (util::strieq_l("backend_hos", name, 11)) { + if (util::strieq("backend_hos"_sr, name, 11)) { return LogFragmentType::BACKEND_HOST; } - if (util::strieq_l("backend_por", name, 11)) { + if (util::strieq("backend_por"_sr, name, 11)) { return LogFragmentType::BACKEND_PORT; } break; @@ -596,10 +607,10 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 14: switch (name[13]) { case 'd': - if (util::strieq_l("ssl_session_i", name, 13)) { + if (util::strieq("ssl_session_i"_sr, name, 13)) { return LogFragmentType::SSL_SESSION_ID; } - if (util::strieq_l("tls_session_i", name, 13)) { + if (util::strieq("tls_session_i"_sr, name, 13)) { return LogFragmentType::TLS_SESSION_ID; } break; @@ -608,7 +619,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 15: switch (name[14]) { case 't': - if (util::strieq_l("body_bytes_sen", name, 14)) { + if (util::strieq("body_bytes_sen"_sr, name, 14)) { return LogFragmentType::BODY_BYTES_SENT; } break; @@ -617,7 +628,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 16: switch (name[15]) { case 'n': - if (util::strieq_l("protocol_versio", name, 15)) { + if (util::strieq("protocol_versio"_sr, name, 15)) { return LogFragmentType::PROTOCOL_VERSION; } break; @@ -626,7 +637,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 17: switch (name[16]) { case 'l': - if (util::strieq_l("tls_client_seria", name, 16)) { + if (util::strieq("tls_client_seria"_sr, name, 16)) { return LogFragmentType::TLS_CLIENT_SERIAL; } break; @@ -635,15 +646,15 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 18: switch (name[17]) { case 'd': - if (util::strieq_l("ssl_session_reuse", name, 17)) { + if (util::strieq("ssl_session_reuse"_sr, name, 17)) { return LogFragmentType::SSL_SESSION_REUSED; } - if (util::strieq_l("tls_session_reuse", name, 17)) { + if (util::strieq("tls_session_reuse"_sr, name, 17)) { return LogFragmentType::TLS_SESSION_REUSED; } break; case 'y': - if (util::strieq_l("path_without_quer", name, 17)) { + if (util::strieq("path_without_quer"_sr, name, 17)) { return LogFragmentType::PATH_WITHOUT_QUERY; } break; @@ -652,7 +663,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 22: switch (name[21]) { case 'e': - if (util::strieq_l("tls_client_issuer_nam", name, 21)) { + if (util::strieq("tls_client_issuer_nam"_sr, name, 21)) { return LogFragmentType::TLS_CLIENT_ISSUER_NAME; } break; @@ -661,7 +672,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 23: switch (name[22]) { case 'e': - if (util::strieq_l("tls_client_subject_nam", name, 22)) { + if (util::strieq("tls_client_subject_nam"_sr, name, 22)) { return LogFragmentType::TLS_CLIENT_SUBJECT_NAME; } break; @@ -670,7 +681,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 27: switch (name[26]) { case '1': - if (util::strieq_l("tls_client_fingerprint_sha", name, 26)) { + if (util::strieq("tls_client_fingerprint_sha"_sr, name, 26)) { return LogFragmentType::TLS_CLIENT_FINGERPRINT_SHA1; } break; @@ -679,7 +690,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) { case 29: switch (name[28]) { case '6': - if (util::strieq_l("tls_client_fingerprint_sha25", name, 28)) { + if (util::strieq("tls_client_fingerprint_sha25"_sr, name, 28)) { return LogFragmentType::TLS_CLIENT_FINGERPRINT_SHA256; } break; @@ -714,10 +725,9 @@ std::vector parse_log_format(BlockAllocator &balloc, ++p; - const char *var_name; - size_t var_namelen; + StringRef var_name; if (p != eop && *p == '{') { - var_name = ++p; + auto var_name_start = ++p; for (; p != eop && var_token(*p); ++p) ; @@ -726,64 +736,58 @@ std::vector parse_log_format(BlockAllocator &balloc, continue; } - var_namelen = p - var_name; + var_name = StringRef{var_name_start, p}; ++p; } else { - var_name = p; + auto var_name_start = p; for (; p != eop && var_token(*p); ++p) ; - var_namelen = p - var_name; + var_name = StringRef{var_name_start, p}; } - const char *value = nullptr; + auto value = std::begin(var_name); - auto type = log_var_lookup_token(var_name, var_namelen); + auto type = log_var_lookup_token(var_name); if (type == LogFragmentType::NONE) { - if (util::istarts_with_l(StringRef{var_name, var_namelen}, "http_")) { - if (util::streq_l("host", StringRef{var_name + str_size("http_"), - var_namelen - str_size("http_")})) { + if (util::istarts_with(var_name, "http_"_sr)) { + if ("host"_sr == var_name.substr(str_size("http_"))) { // Special handling of host header field. We will use // :authority header field if host header is missing. This // is a typical case in HTTP/2. type = LogFragmentType::AUTHORITY; } else { type = LogFragmentType::HTTP; - value = var_name + str_size("http_"); + value += str_size("http_"); } } else { - LOG(WARN) << "Unrecognized log format variable: " - << StringRef{var_name, var_namelen}; + LOG(WARN) << "Unrecognized log format variable: " << var_name; continue; } } if (literal_start < var_start) { res.emplace_back( - LogFragmentType::LITERAL, - make_string_ref(balloc, StringRef{literal_start, var_start})); + LogFragmentType::LITERAL, + make_string_ref(balloc, StringRef{literal_start, var_start})); } literal_start = p; - if (value == nullptr) { + if (value == std::begin(var_name)) { res.emplace_back(type); continue; } { - auto iov = make_byte_ref( - balloc, std::distance(value, var_name + var_namelen) + 1); - auto p = iov.base; - p = std::copy(value, var_name + var_namelen, p); - for (auto cp = iov.base; cp != p; ++cp) { - if (*cp == '_') { - *cp = '-'; - } - } + auto iov = + make_byte_ref(balloc, std::distance(value, std::end(var_name)) + 1); + auto p = std::copy(value, std::end(var_name), std::begin(iov)); + std::transform(std::begin(iov), p, std::begin(iov), + [](auto c) { return c == '_' ? '-' : c; }); *p = '\0'; - res.emplace_back(type, StringRef{iov.base, p}); + res.emplace_back(type, StringRef{std::span{std::begin(iov), p}}); } } @@ -798,15 +802,15 @@ std::vector parse_log_format(BlockAllocator &balloc, namespace { int parse_address_family(int *dest, const StringRef &opt, const StringRef &optarg) { - if (util::strieq_l("auto", optarg)) { + if (util::strieq("auto"_sr, optarg)) { *dest = AF_UNSPEC; return 0; } - if (util::strieq_l("IPv4", optarg)) { + if (util::strieq("IPv4"_sr, optarg)) { *dest = AF_INET; return 0; } - if (util::strieq_l("IPv6", optarg)) { + if (util::strieq("IPv6"_sr, optarg)) { *dest = AF_INET6; return 0; } @@ -820,12 +824,12 @@ namespace { int parse_duration(ev_tstamp *dest, const StringRef &opt, const StringRef &optarg) { auto t = util::parse_duration_with_unit(optarg); - if (t == std::numeric_limits::infinity()) { + if (!t) { LOG(ERROR) << opt << ": bad value: '" << optarg << "'"; return -1; } - *dest = t; + *dest = *t; return 0; } @@ -862,9 +866,9 @@ int parse_memcached_connection_params(MemcachedConnectionParams &out, auto end = std::find(first, last, ';'); auto param = StringRef{first, end}; - if (util::strieq_l("tls", param)) { + if (util::strieq("tls"_sr, param)) { out.tls = true; - } else if (util::strieq_l("no-tls", param)) { + } else if (util::strieq("no-tls"_sr, param)) { out.tls = false; } else if (!param.empty()) { LOG(ERROR) << opt << ": " << param << ": unknown keyword"; @@ -900,29 +904,29 @@ int parse_upstream_params(UpstreamParams &out, const StringRef &src_params) { auto end = std::find(first, last, ';'); auto param = StringRef{first, end}; - if (util::strieq_l("tls", param)) { + if (util::strieq("tls"_sr, param)) { out.tls = true; - } else if (util::strieq_l("sni-fwd", param)) { + } else if (util::strieq("sni-fwd"_sr, param)) { out.sni_fwd = true; - } else if (util::strieq_l("no-tls", param)) { + } else if (util::strieq("no-tls"_sr, param)) { out.tls = false; - } else if (util::strieq_l("api", param)) { + } else if (util::strieq("api"_sr, param)) { if (out.alt_mode != UpstreamAltMode::NONE && out.alt_mode != UpstreamAltMode::API) { LOG(ERROR) << "frontend: api and healthmon are mutually exclusive"; return -1; } out.alt_mode = UpstreamAltMode::API; - } else if (util::strieq_l("healthmon", param)) { + } else if (util::strieq("healthmon"_sr, param)) { if (out.alt_mode != UpstreamAltMode::NONE && out.alt_mode != UpstreamAltMode::HEALTHMON) { LOG(ERROR) << "frontend: api and healthmon are mutually exclusive"; return -1; } out.alt_mode = UpstreamAltMode::HEALTHMON; - } else if (util::strieq_l("proxyproto", param)) { + } else if (util::strieq("proxyproto"_sr, param)) { out.proxyproto = true; - } else if (util::strieq_l("quic", param)) { + } else if (util::strieq("quic"_sr, param)) { #ifdef ENABLE_HTTP3 out.quic = true; #else // !ENABLE_HTTP3 @@ -971,11 +975,11 @@ namespace { int parse_downstream_param_duration(ev_tstamp &dest, const StringRef &name, const StringRef &value) { auto t = util::parse_duration_with_unit(value); - if (t == std::numeric_limits::infinity()) { + if (!t) { LOG(ERROR) << "backend: " << name << ": bad value: '" << value << "'"; return -1; } - dest = t; + dest = *t; return 0; } } // namespace @@ -991,23 +995,22 @@ int parse_downstream_params(DownstreamParams &out, auto end = std::find(first, last, ';'); auto param = StringRef{first, end}; - if (util::istarts_with_l(param, "proto=")) { + if (util::istarts_with(param, "proto="_sr)) { auto protostr = StringRef{first + str_size("proto="), end}; if (protostr.empty()) { LOG(ERROR) << "backend: proto: protocol is empty"; return -1; } - if (util::streq_l("h2", std::begin(protostr), protostr.size())) { + if ("h2"_sr == protostr) { out.proto = Proto::HTTP2; - } else if (util::streq_l("http/1.1", std::begin(protostr), - protostr.size())) { + } else if ("http/1.1"_sr == protostr) { out.proto = Proto::HTTP1; } else { LOG(ERROR) << "backend: proto: unknown protocol " << protostr; return -1; } - } else if (util::istarts_with_l(param, "fall=")) { + } else if (util::istarts_with(param, "fall="_sr)) { auto valstr = StringRef{first + str_size("fall="), end}; if (valstr.empty()) { LOG(ERROR) << "backend: fall: non-negative integer is expected"; @@ -1015,13 +1018,13 @@ int parse_downstream_params(DownstreamParams &out, } auto n = util::parse_uint(valstr); - if (n == -1) { + if (!n) { LOG(ERROR) << "backend: fall: non-negative integer is expected"; return -1; } - out.fall = n; - } else if (util::istarts_with_l(param, "rise=")) { + out.fall = *n; + } else if (util::istarts_with(param, "rise="_sr)) { auto valstr = StringRef{first + str_size("rise="), end}; if (valstr.empty()) { LOG(ERROR) << "backend: rise: non-negative integer is expected"; @@ -1029,112 +1032,112 @@ int parse_downstream_params(DownstreamParams &out, } auto n = util::parse_uint(valstr); - if (n == -1) { + if (!n) { LOG(ERROR) << "backend: rise: non-negative integer is expected"; return -1; } - out.rise = n; - } else if (util::strieq_l("tls", param)) { + out.rise = *n; + } else if (util::strieq("tls"_sr, param)) { out.tls = true; - } else if (util::strieq_l("no-tls", param)) { + } else if (util::strieq("no-tls"_sr, param)) { out.tls = false; - } else if (util::istarts_with_l(param, "sni=")) { + } else if (util::istarts_with(param, "sni="_sr)) { out.sni = StringRef{first + str_size("sni="), end}; - } else if (util::istarts_with_l(param, "affinity=")) { + } else if (util::istarts_with(param, "affinity="_sr)) { auto valstr = StringRef{first + str_size("affinity="), end}; - if (util::strieq_l("none", valstr)) { + if (util::strieq("none"_sr, valstr)) { out.affinity.type = SessionAffinity::NONE; - } else if (util::strieq_l("ip", valstr)) { + } else if (util::strieq("ip"_sr, valstr)) { out.affinity.type = SessionAffinity::IP; - } else if (util::strieq_l("cookie", valstr)) { + } else if (util::strieq("cookie"_sr, valstr)) { out.affinity.type = SessionAffinity::COOKIE; } else { LOG(ERROR) - << "backend: affinity: value must be one of none, ip, and cookie"; + << "backend: affinity: value must be one of none, ip, and cookie"; return -1; } - } else if (util::istarts_with_l(param, "affinity-cookie-name=")) { + } else if (util::istarts_with(param, "affinity-cookie-name="_sr)) { auto val = StringRef{first + str_size("affinity-cookie-name="), end}; if (val.empty()) { LOG(ERROR) - << "backend: affinity-cookie-name: non empty string is expected"; + << "backend: affinity-cookie-name: non empty string is expected"; return -1; } out.affinity.cookie.name = val; - } else if (util::istarts_with_l(param, "affinity-cookie-path=")) { + } else if (util::istarts_with(param, "affinity-cookie-path="_sr)) { out.affinity.cookie.path = - StringRef{first + str_size("affinity-cookie-path="), end}; - } else if (util::istarts_with_l(param, "affinity-cookie-secure=")) { + StringRef{first + str_size("affinity-cookie-path="), end}; + } else if (util::istarts_with(param, "affinity-cookie-secure="_sr)) { auto valstr = StringRef{first + str_size("affinity-cookie-secure="), end}; - if (util::strieq_l("auto", valstr)) { + if (util::strieq("auto"_sr, valstr)) { out.affinity.cookie.secure = SessionAffinityCookieSecure::AUTO; - } else if (util::strieq_l("yes", valstr)) { + } else if (util::strieq("yes"_sr, valstr)) { out.affinity.cookie.secure = SessionAffinityCookieSecure::YES; - } else if (util::strieq_l("no", valstr)) { + } else if (util::strieq("no"_sr, valstr)) { out.affinity.cookie.secure = SessionAffinityCookieSecure::NO; } else { LOG(ERROR) << "backend: affinity-cookie-secure: value must be one of " "auto, yes, and no"; return -1; } - } else if (util::istarts_with_l(param, "affinity-cookie-stickiness=")) { + } else if (util::istarts_with(param, "affinity-cookie-stickiness="_sr)) { auto valstr = - StringRef{first + str_size("affinity-cookie-stickiness="), end}; - if (util::strieq_l("loose", valstr)) { + StringRef{first + str_size("affinity-cookie-stickiness="), end}; + if (util::strieq("loose"_sr, valstr)) { out.affinity.cookie.stickiness = SessionAffinityCookieStickiness::LOOSE; - } else if (util::strieq_l("strict", valstr)) { + } else if (util::strieq("strict"_sr, valstr)) { out.affinity.cookie.stickiness = - SessionAffinityCookieStickiness::STRICT; + SessionAffinityCookieStickiness::STRICT; } else { LOG(ERROR) << "backend: affinity-cookie-stickiness: value must be " "either loose or strict"; return -1; } - } else if (util::strieq_l("dns", param)) { + } else if (util::strieq("dns"_sr, param)) { out.dns = true; - } else if (util::strieq_l("redirect-if-not-tls", param)) { + } else if (util::strieq("redirect-if-not-tls"_sr, param)) { out.redirect_if_not_tls = true; - } else if (util::strieq_l("upgrade-scheme", param)) { + } else if (util::strieq("upgrade-scheme"_sr, param)) { out.upgrade_scheme = true; - } else if (util::istarts_with_l(param, "mruby=")) { + } else if (util::istarts_with(param, "mruby="_sr)) { auto valstr = StringRef{first + str_size("mruby="), end}; out.mruby = valstr; - } else if (util::istarts_with_l(param, "read-timeout=")) { + } else if (util::istarts_with(param, "read-timeout="_sr)) { if (parse_downstream_param_duration( - out.read_timeout, StringRef::from_lit("read-timeout"), - StringRef{first + str_size("read-timeout="), end}) == -1) { + out.read_timeout, "read-timeout"_sr, + StringRef{first + str_size("read-timeout="), end}) == -1) { return -1; } - } else if (util::istarts_with_l(param, "write-timeout=")) { + } else if (util::istarts_with(param, "write-timeout="_sr)) { if (parse_downstream_param_duration( - out.write_timeout, StringRef::from_lit("write-timeout"), - StringRef{first + str_size("write-timeout="), end}) == -1) { + out.write_timeout, "write-timeout"_sr, + StringRef{first + str_size("write-timeout="), end}) == -1) { return -1; } - } else if (util::istarts_with_l(param, "weight=")) { + } else if (util::istarts_with(param, "weight="_sr)) { auto valstr = StringRef{first + str_size("weight="), end}; if (valstr.empty()) { LOG(ERROR) - << "backend: weight: non-negative integer [1, 256] is expected"; + << "backend: weight: non-negative integer [1, 256] is expected"; return -1; } auto n = util::parse_uint(valstr); - if (n < 1 || n > 256) { + if (!n || (n < 1 || n > 256)) { LOG(ERROR) - << "backend: weight: non-negative integer [1, 256] is expected"; + << "backend: weight: non-negative integer [1, 256] is expected"; return -1; } - out.weight = n; - } else if (util::istarts_with_l(param, "group=")) { + out.weight = *n; + } else if (util::istarts_with(param, "group="_sr)) { auto valstr = StringRef{first + str_size("group="), end}; if (valstr.empty()) { LOG(ERROR) << "backend: group: empty string is not allowed"; return -1; } out.group = valstr; - } else if (util::istarts_with_l(param, "group-weight=")) { + } else if (util::istarts_with(param, "group-weight="_sr)) { auto valstr = StringRef{first + str_size("group-weight="), end}; if (valstr.empty()) { LOG(ERROR) << "backend: group-weight: non-negative integer [1, 256] is " @@ -1143,13 +1146,13 @@ int parse_downstream_params(DownstreamParams &out, } auto n = util::parse_uint(valstr); - if (n < 1 || n > 256) { + if (!n || (n < 1 || n > 256)) { LOG(ERROR) << "backend: group-weight: non-negative integer [1, 256] is " "expected"; return -1; } - out.group_weight = n; - } else if (util::strieq_l("dnf", param)) { + out.group_weight = *n; + } else if (util::strieq("dnf"_sr, param)) { out.dnf = true; } else if (!param.empty()) { LOG(ERROR) << "backend: " << param << ": unknown keyword"; @@ -1229,25 +1232,24 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, // This effectively makes empty pattern to "/". 2 for '/' and // terminal NULL character. auto iov = make_byte_ref(downstreamconf.balloc, raw_pattern.size() + 2); - auto p = iov.base; - p = std::copy(std::begin(raw_pattern), std::end(raw_pattern), p); - util::inp_strlower(iov.base, p); + auto p = std::copy(std::begin(raw_pattern), std::end(raw_pattern), + std::begin(iov)); + util::inp_strlower(std::begin(iov), p); *p++ = '/'; *p = '\0'; - pattern = StringRef{iov.base, p}; + pattern = StringRef{std::span{std::begin(iov), p}}; } else { auto path = http2::normalize_path_colon( - downstreamconf.balloc, StringRef{slash, std::end(raw_pattern)}, - StringRef{}); + downstreamconf.balloc, StringRef{slash, std::end(raw_pattern)}, + StringRef{}); auto iov = make_byte_ref(downstreamconf.balloc, std::distance(std::begin(raw_pattern), slash) + - path.size() + 1); - auto p = iov.base; - p = std::copy(std::begin(raw_pattern), slash, p); - util::inp_strlower(iov.base, p); + path.size() + 1); + auto p = std::copy(std::begin(raw_pattern), slash, std::begin(iov)); + util::inp_strlower(std::begin(iov), p); p = std::copy(std::begin(path), std::end(path), p); *p = '\0'; - pattern = StringRef{iov.base, p}; + pattern = StringRef{std::span{std::begin(iov), p}}; } auto it = pattern_addr_indexer.find(pattern); if (it != std::end(pattern_addr_indexer)) { @@ -1259,10 +1261,10 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, g.affinity.type = params.affinity.type; if (params.affinity.type == SessionAffinity::COOKIE) { g.affinity.cookie.name = make_string_ref( - downstreamconf.balloc, params.affinity.cookie.name); + downstreamconf.balloc, params.affinity.cookie.name); if (!params.affinity.cookie.path.empty()) { g.affinity.cookie.path = make_string_ref( - downstreamconf.balloc, params.affinity.cookie.path); + downstreamconf.balloc, params.affinity.cookie.path); } g.affinity.cookie.secure = params.affinity.cookie.secure; g.affinity.cookie.stickiness = params.affinity.cookie.stickiness; @@ -1272,7 +1274,7 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, g.affinity.cookie.path != params.affinity.cookie.path || g.affinity.cookie.secure != params.affinity.cookie.secure || g.affinity.cookie.stickiness != - params.affinity.cookie.stickiness) { + params.affinity.cookie.stickiness) { LOG(ERROR) << "backend: affinity: multiple different affinity " "configurations found in a single group"; return -1; @@ -1305,8 +1307,8 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, g.timeout.read = params.read_timeout; } else if (fabs(g.timeout.read - params.read_timeout) > 1e-9) { LOG(ERROR) - << "backend: read-timeout: multiple different read-timeout " - "found in a single group"; + << "backend: read-timeout: multiple different read-timeout " + "found in a single group"; return -1; } } @@ -1340,10 +1342,10 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, g.affinity.type = params.affinity.type; if (params.affinity.type == SessionAffinity::COOKIE) { g.affinity.cookie.name = - make_string_ref(downstreamconf.balloc, params.affinity.cookie.name); + make_string_ref(downstreamconf.balloc, params.affinity.cookie.name); if (!params.affinity.cookie.path.empty()) { g.affinity.cookie.path = - make_string_ref(downstreamconf.balloc, params.affinity.cookie.path); + make_string_ref(downstreamconf.balloc, params.affinity.cookie.path); } g.affinity.cookie.secure = params.affinity.cookie.secure; g.affinity.cookie.stickiness = params.affinity.cookie.stickiness; @@ -1357,7 +1359,7 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, if (pattern[0] == '*') { // wildcard pattern auto path_first = - std::find(std::begin(g.pattern), std::end(g.pattern), '/'); + std::find(std::begin(g.pattern), std::end(g.pattern), '/'); auto host = StringRef{std::begin(g.pattern) + 1, path_first}; auto path = StringRef{path_first, std::end(g.pattern)}; @@ -1369,8 +1371,8 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, } auto it = std::find_if( - std::begin(wildcard_patterns), std::end(wildcard_patterns), - [&host](const WildcardPattern &wp) { return wp.host == host; }); + std::begin(wildcard_patterns), std::end(wildcard_patterns), + [&host](const WildcardPattern &wp) { return wp.host == host; }); if (it == std::end(wildcard_patterns)) { wildcard_patterns.emplace_back(host); @@ -1379,10 +1381,10 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, router.add_route(path, idx, path_is_wildcard); auto iov = make_byte_ref(downstreamconf.balloc, host.size() + 1); - auto p = iov.base; - p = std::reverse_copy(std::begin(host), std::end(host), p); + auto p = + std::reverse_copy(std::begin(host), std::end(host), std::begin(iov)); *p = '\0'; - auto rev_host = StringRef{iov.base, p}; + auto rev_host = StringRef{std::span{std::begin(iov), p}}; rw_router.add_route(rev_host, wildcard_patterns.size() - 1); } else { @@ -1407,11 +1409,11 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, namespace { ForwardedNode parse_forwarded_node_type(const StringRef &optarg) { - if (util::strieq_l("obfuscated", optarg)) { + if (util::strieq("obfuscated"_sr, optarg)) { return ForwardedNode::OBFUSCATED; } - if (util::strieq_l("ip", optarg)) { + if (util::strieq("ip"_sr, optarg)) { return ForwardedNode::IP; } @@ -1444,23 +1446,23 @@ int parse_error_page(std::vector &error_pages, const StringRef &opt, auto codestr = StringRef{std::begin(optarg), eq}; unsigned int code; - if (codestr == StringRef::from_lit("*")) { + if (codestr == "*"_sr) { code = 0; } else { auto n = util::parse_uint(codestr); - if (n == -1 || n < 400 || n > 599) { + if (!n || n < 400 || n > 599) { LOG(ERROR) << opt << ": bad code: '" << codestr << "'"; return -1; } - code = static_cast(n); + code = static_cast(*n); } auto path = StringRef{eq + 1, std::end(optarg)}; std::vector content; - auto fd = open(path.c_str(), O_RDONLY); + auto fd = open(path.data(), O_RDONLY); if (fd == -1) { auto error = errno; LOG(ERROR) << opt << ": " << optarg << ": " @@ -1509,18 +1511,19 @@ int parse_subcert_params(SubcertParams &out, const StringRef &src_params) { auto end = std::find(first, last, ';'); auto param = StringRef{first, end}; - if (util::istarts_with_l(param, "sct-dir=")) { -#if !LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L + if (util::istarts_with(param, "sct-dir="_sr)) { +#if defined(NGHTTP2_GENUINE_OPENSSL) || defined(NGHTTP2_OPENSSL_IS_BORINGSSL) auto sct_dir = - StringRef{std::begin(param) + str_size("sct-dir="), std::end(param)}; + StringRef{std::begin(param) + str_size("sct-dir="), std::end(param)}; if (sct_dir.empty()) { LOG(ERROR) << "subcert: " << param << ": empty sct-dir"; return -1; } out.sct_dir = sct_dir; -#else // !(!LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L) - LOG(WARN) << "subcert: sct-dir requires OpenSSL >= 1.0.2"; -#endif // !(!LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L) +#else // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_BORINGSSL + LOG(WARN) << "subcert: sct-dir is ignored because underlying TLS library " + "does not support SCT"; +#endif // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_BORINGSSL } else if (!param.empty()) { LOG(ERROR) << "subcert: " << param << ": unknown keyword"; return -1; @@ -1544,7 +1547,7 @@ int read_tls_sct_from_dir(std::vector &dst, const StringRef &opt, const StringRef &dir_path) { std::array errbuf; - auto dir = opendir(dir_path.c_str()); + auto dir = opendir(dir_path.data()); if (dir == nullptr) { auto error = errno; LOG(ERROR) << opt << ": " << dir_path << ": " @@ -1573,7 +1576,7 @@ int read_tls_sct_from_dir(std::vector &dst, const StringRef &opt, auto name = StringRef{ent->d_name}; - if (name[0] == '.' || !util::iends_with_l(name, ".sct")) { + if (name[0] == '.' || !util::iends_with(name, ".sct"_sr)) { continue; } @@ -1652,7 +1655,7 @@ int read_tls_sct_from_dir(std::vector &dst, const StringRef &opt, } } // namespace -#if !LIBRESSL_LEGACY_API +#ifndef OPENSSL_NO_PSK namespace { // Reads PSK secrets from path, and parses each line. The result is // directly stored into config->tls.psk_secrets. This function @@ -1660,7 +1663,7 @@ namespace { int parse_psk_secrets(Config *config, const StringRef &path) { auto &tlsconf = config->tls; - std::ifstream f(path.c_str(), std::ios::binary); + std::ifstream f(path.data(), std::ios::binary); if (!f) { LOG(ERROR) << SHRPX_OPT_PSK_SECRETS << ": could not open file " << path; return -1; @@ -1700,10 +1703,10 @@ int parse_psk_secrets(Config *config, const StringRef &path) { } auto identity = - make_string_ref(config->balloc, StringRef{std::begin(line), sep_it}); + make_string_ref(config->balloc, StringRef{std::begin(line), sep_it}); auto secret = - util::decode_hex(config->balloc, StringRef{sep_it + 1, std::end(line)}); + util::decode_hex(config->balloc, StringRef{sep_it + 1, std::end(line)}); auto rv = tlsconf.psk_secrets.emplace(identity, secret); if (!rv.second) { @@ -1716,9 +1719,9 @@ int parse_psk_secrets(Config *config, const StringRef &path) { return 0; } } // namespace -#endif // !LIBRESSL_LEGACY_API +#endif // !OPENSSL_NO_PSK -#if !LIBRESSL_LEGACY_API +#ifndef OPENSSL_NO_PSK namespace { // Reads PSK secrets from path, and parses each line. The result is // directly stored into config->tls.client.psk. This function returns @@ -1726,7 +1729,7 @@ namespace { int parse_client_psk_secrets(Config *config, const StringRef &path) { auto &tlsconf = config->tls; - std::ifstream f(path.c_str(), std::ios::binary); + std::ifstream f(path.data(), std::ios::binary); if (!f) { LOG(ERROR) << SHRPX_OPT_CLIENT_PSK_SECRETS << ": could not open file " << path; @@ -1767,10 +1770,10 @@ int parse_client_psk_secrets(Config *config, const StringRef &path) { } tlsconf.client.psk.identity = - make_string_ref(config->balloc, StringRef{std::begin(line), sep_it}); + make_string_ref(config->balloc, StringRef{std::begin(line), sep_it}); - tlsconf.client.psk.secret = - util::decode_hex(config->balloc, StringRef{sep_it + 1, std::end(line)}); + tlsconf.client.psk.secret = StringRef{ + util::decode_hex(config->balloc, StringRef{sep_it + 1, std::end(line)})}; return 0; } @@ -1778,20 +1781,20 @@ int parse_client_psk_secrets(Config *config, const StringRef &path) { return 0; } } // namespace -#endif // !LIBRESSL_LEGACY_API +#endif // !OPENSSL_NO_PSK // generated by gennghttpxfun.py -int option_lookup_token(const char *name, size_t namelen) { - switch (namelen) { +int option_lookup_token(const StringRef &name) { + switch (name.size()) { case 4: switch (name[3]) { case 'f': - if (util::strieq_l("con", name, 3)) { + if (util::strieq("con"_sr, name, 3)) { return SHRPX_OPTID_CONF; } break; case 'r': - if (util::strieq_l("use", name, 3)) { + if (util::strieq("use"_sr, name, 3)) { return SHRPX_OPTID_USER; } break; @@ -1800,25 +1803,25 @@ int option_lookup_token(const char *name, size_t namelen) { case 6: switch (name[5]) { case 'a': - if (util::strieq_l("no-vi", name, 5)) { + if (util::strieq("no-vi"_sr, name, 5)) { return SHRPX_OPTID_NO_VIA; } break; case 'c': - if (util::strieq_l("altsv", name, 5)) { + if (util::strieq("altsv"_sr, name, 5)) { return SHRPX_OPTID_ALTSVC; } break; case 'n': - if (util::strieq_l("daemo", name, 5)) { + if (util::strieq("daemo"_sr, name, 5)) { return SHRPX_OPTID_DAEMON; } break; case 't': - if (util::strieq_l("cacer", name, 5)) { + if (util::strieq("cacer"_sr, name, 5)) { return SHRPX_OPTID_CACERT; } - if (util::strieq_l("clien", name, 5)) { + if (util::strieq("clien"_sr, name, 5)) { return SHRPX_OPTID_CLIENT; } break; @@ -1827,38 +1830,38 @@ int option_lookup_token(const char *name, size_t namelen) { case 7: switch (name[6]) { case 'd': - if (util::strieq_l("backen", name, 6)) { + if (util::strieq("backen"_sr, name, 6)) { return SHRPX_OPTID_BACKEND; } break; case 'e': - if (util::strieq_l("includ", name, 6)) { + if (util::strieq("includ"_sr, name, 6)) { return SHRPX_OPTID_INCLUDE; } break; case 'g': - if (util::strieq_l("backlo", name, 6)) { + if (util::strieq("backlo"_sr, name, 6)) { return SHRPX_OPTID_BACKLOG; } - if (util::strieq_l("paddin", name, 6)) { + if (util::strieq("paddin"_sr, name, 6)) { return SHRPX_OPTID_PADDING; } break; case 'p': - if (util::strieq_l("no-ocs", name, 6)) { + if (util::strieq("no-ocs"_sr, name, 6)) { return SHRPX_OPTID_NO_OCSP; } break; case 's': - if (util::strieq_l("cipher", name, 6)) { + if (util::strieq("cipher"_sr, name, 6)) { return SHRPX_OPTID_CIPHERS; } - if (util::strieq_l("worker", name, 6)) { + if (util::strieq("worker"_sr, name, 6)) { return SHRPX_OPTID_WORKERS; } break; case 't': - if (util::strieq_l("subcer", name, 6)) { + if (util::strieq("subcer"_sr, name, 6)) { return SHRPX_OPTID_SUBCERT; } break; @@ -1867,30 +1870,30 @@ int option_lookup_token(const char *name, size_t namelen) { case 8: switch (name[7]) { case 'd': - if (util::strieq_l("fronten", name, 7)) { + if (util::strieq("fronten"_sr, name, 7)) { return SHRPX_OPTID_FRONTEND; } break; case 'e': - if (util::strieq_l("insecur", name, 7)) { + if (util::strieq("insecur"_sr, name, 7)) { return SHRPX_OPTID_INSECURE; } - if (util::strieq_l("pid-fil", name, 7)) { + if (util::strieq("pid-fil"_sr, name, 7)) { return SHRPX_OPTID_PID_FILE; } break; case 'n': - if (util::strieq_l("fastope", name, 7)) { + if (util::strieq("fastope"_sr, name, 7)) { return SHRPX_OPTID_FASTOPEN; } break; case 's': - if (util::strieq_l("tls-ktl", name, 7)) { + if (util::strieq("tls-ktl"_sr, name, 7)) { return SHRPX_OPTID_TLS_KTLS; } break; case 't': - if (util::strieq_l("npn-lis", name, 7)) { + if (util::strieq("npn-lis"_sr, name, 7)) { return SHRPX_OPTID_NPN_LIST; } break; @@ -1899,35 +1902,40 @@ int option_lookup_token(const char *name, size_t namelen) { case 9: switch (name[8]) { case 'e': - if (util::strieq_l("no-kqueu", name, 8)) { + if (util::strieq("no-kqueu"_sr, name, 8)) { return SHRPX_OPTID_NO_KQUEUE; } - if (util::strieq_l("read-rat", name, 8)) { + if (util::strieq("read-rat"_sr, name, 8)) { return SHRPX_OPTID_READ_RATE; } break; case 'l': - if (util::strieq_l("log-leve", name, 8)) { + if (util::strieq("log-leve"_sr, name, 8)) { return SHRPX_OPTID_LOG_LEVEL; } break; + case 't': + if (util::strieq("alpn-lis"_sr, name, 8)) { + return SHRPX_OPTID_ALPN_LIST; + } + break; } break; case 10: switch (name[9]) { case 'e': - if (util::strieq_l("error-pag", name, 9)) { + if (util::strieq("error-pag"_sr, name, 9)) { return SHRPX_OPTID_ERROR_PAGE; } - if (util::strieq_l("mruby-fil", name, 9)) { + if (util::strieq("mruby-fil"_sr, name, 9)) { return SHRPX_OPTID_MRUBY_FILE; } - if (util::strieq_l("write-rat", name, 9)) { + if (util::strieq("write-rat"_sr, name, 9)) { return SHRPX_OPTID_WRITE_RATE; } break; case 't': - if (util::strieq_l("read-burs", name, 9)) { + if (util::strieq("read-burs"_sr, name, 9)) { return SHRPX_OPTID_READ_BURST; } break; @@ -1936,41 +1944,41 @@ int option_lookup_token(const char *name, size_t namelen) { case 11: switch (name[10]) { case 'e': - if (util::strieq_l("server-nam", name, 10)) { + if (util::strieq("server-nam"_sr, name, 10)) { return SHRPX_OPTID_SERVER_NAME; } break; case 'f': - if (util::strieq_l("no-quic-bp", name, 10)) { + if (util::strieq("no-quic-bp"_sr, name, 10)) { return SHRPX_OPTID_NO_QUIC_BPF; } break; case 'r': - if (util::strieq_l("tls-sct-di", name, 10)) { + if (util::strieq("tls-sct-di"_sr, name, 10)) { return SHRPX_OPTID_TLS_SCT_DIR; } break; case 's': - if (util::strieq_l("backend-tl", name, 10)) { + if (util::strieq("backend-tl"_sr, name, 10)) { return SHRPX_OPTID_BACKEND_TLS; } - if (util::strieq_l("ecdh-curve", name, 10)) { + if (util::strieq("ecdh-curve"_sr, name, 10)) { return SHRPX_OPTID_ECDH_CURVES; } - if (util::strieq_l("psk-secret", name, 10)) { + if (util::strieq("psk-secret"_sr, name, 10)) { return SHRPX_OPTID_PSK_SECRETS; } break; case 't': - if (util::strieq_l("write-burs", name, 10)) { + if (util::strieq("write-burs"_sr, name, 10)) { return SHRPX_OPTID_WRITE_BURST; } break; case 'y': - if (util::strieq_l("dns-max-tr", name, 10)) { + if (util::strieq("dns-max-tr"_sr, name, 10)) { return SHRPX_OPTID_DNS_MAX_TRY; } - if (util::strieq_l("http2-prox", name, 10)) { + if (util::strieq("http2-prox"_sr, name, 10)) { return SHRPX_OPTID_HTTP2_PROXY; } break; @@ -1979,38 +1987,38 @@ int option_lookup_token(const char *name, size_t namelen) { case 12: switch (name[11]) { case '4': - if (util::strieq_l("backend-ipv", name, 11)) { + if (util::strieq("backend-ipv"_sr, name, 11)) { return SHRPX_OPTID_BACKEND_IPV4; } break; case '6': - if (util::strieq_l("backend-ipv", name, 11)) { + if (util::strieq("backend-ipv"_sr, name, 11)) { return SHRPX_OPTID_BACKEND_IPV6; } break; case 'c': - if (util::strieq_l("http2-altsv", name, 11)) { + if (util::strieq("http2-altsv"_sr, name, 11)) { return SHRPX_OPTID_HTTP2_ALTSVC; } break; case 'e': - if (util::strieq_l("host-rewrit", name, 11)) { + if (util::strieq("host-rewrit"_sr, name, 11)) { return SHRPX_OPTID_HOST_REWRITE; } - if (util::strieq_l("http2-bridg", name, 11)) { + if (util::strieq("http2-bridg"_sr, name, 11)) { return SHRPX_OPTID_HTTP2_BRIDGE; } break; case 'p': - if (util::strieq_l("ocsp-startu", name, 11)) { + if (util::strieq("ocsp-startu"_sr, name, 11)) { return SHRPX_OPTID_OCSP_STARTUP; } break; case 'y': - if (util::strieq_l("client-prox", name, 11)) { + if (util::strieq("client-prox"_sr, name, 11)) { return SHRPX_OPTID_CLIENT_PROXY; } - if (util::strieq_l("forwarded-b", name, 11)) { + if (util::strieq("forwarded-b"_sr, name, 11)) { return SHRPX_OPTID_FORWARDED_BY; } break; @@ -2019,36 +2027,36 @@ int option_lookup_token(const char *name, size_t namelen) { case 13: switch (name[12]) { case 'd': - if (util::strieq_l("add-forwarde", name, 12)) { + if (util::strieq("add-forwarde"_sr, name, 12)) { return SHRPX_OPTID_ADD_FORWARDED; } - if (util::strieq_l("single-threa", name, 12)) { + if (util::strieq("single-threa"_sr, name, 12)) { return SHRPX_OPTID_SINGLE_THREAD; } break; case 'e': - if (util::strieq_l("dh-param-fil", name, 12)) { + if (util::strieq("dh-param-fil"_sr, name, 12)) { return SHRPX_OPTID_DH_PARAM_FILE; } - if (util::strieq_l("errorlog-fil", name, 12)) { + if (util::strieq("errorlog-fil"_sr, name, 12)) { return SHRPX_OPTID_ERRORLOG_FILE; } - if (util::strieq_l("rlimit-nofil", name, 12)) { + if (util::strieq("rlimit-nofil"_sr, name, 12)) { return SHRPX_OPTID_RLIMIT_NOFILE; } break; case 'r': - if (util::strieq_l("forwarded-fo", name, 12)) { + if (util::strieq("forwarded-fo"_sr, name, 12)) { return SHRPX_OPTID_FORWARDED_FOR; } break; case 's': - if (util::strieq_l("tls13-cipher", name, 12)) { + if (util::strieq("tls13-cipher"_sr, name, 12)) { return SHRPX_OPTID_TLS13_CIPHERS; } break; case 't': - if (util::strieq_l("verify-clien", name, 12)) { + if (util::strieq("verify-clien"_sr, name, 12)) { return SHRPX_OPTID_VERIFY_CLIENT; } break; @@ -2057,43 +2065,43 @@ int option_lookup_token(const char *name, size_t namelen) { case 14: switch (name[13]) { case 'd': - if (util::strieq_l("quic-server-i", name, 13)) { + if (util::strieq("quic-server-i"_sr, name, 13)) { return SHRPX_OPTID_QUIC_SERVER_ID; } break; case 'e': - if (util::strieq_l("accesslog-fil", name, 13)) { + if (util::strieq("accesslog-fil"_sr, name, 13)) { return SHRPX_OPTID_ACCESSLOG_FILE; } break; case 'h': - if (util::strieq_l("no-server-pus", name, 13)) { + if (util::strieq("no-server-pus"_sr, name, 13)) { return SHRPX_OPTID_NO_SERVER_PUSH; } break; case 'k': - if (util::strieq_l("rlimit-memloc", name, 13)) { + if (util::strieq("rlimit-memloc"_sr, name, 13)) { return SHRPX_OPTID_RLIMIT_MEMLOCK; } break; case 'p': - if (util::strieq_l("no-verify-ocs", name, 13)) { + if (util::strieq("no-verify-ocs"_sr, name, 13)) { return SHRPX_OPTID_NO_VERIFY_OCSP; } break; case 's': - if (util::strieq_l("backend-no-tl", name, 13)) { + if (util::strieq("backend-no-tl"_sr, name, 13)) { return SHRPX_OPTID_BACKEND_NO_TLS; } - if (util::strieq_l("client-cipher", name, 13)) { + if (util::strieq("client-cipher"_sr, name, 13)) { return SHRPX_OPTID_CLIENT_CIPHERS; } - if (util::strieq_l("single-proces", name, 13)) { + if (util::strieq("single-proces"_sr, name, 13)) { return SHRPX_OPTID_SINGLE_PROCESS; } break; case 't': - if (util::strieq_l("tls-proto-lis", name, 13)) { + if (util::strieq("tls-proto-lis"_sr, name, 13)) { return SHRPX_OPTID_TLS_PROTO_LIST; } break; @@ -2102,22 +2110,22 @@ int option_lookup_token(const char *name, size_t namelen) { case 15: switch (name[14]) { case 'e': - if (util::strieq_l("no-host-rewrit", name, 14)) { + if (util::strieq("no-host-rewrit"_sr, name, 14)) { return SHRPX_OPTID_NO_HOST_REWRITE; } break; case 'g': - if (util::strieq_l("errorlog-syslo", name, 14)) { + if (util::strieq("errorlog-syslo"_sr, name, 14)) { return SHRPX_OPTID_ERRORLOG_SYSLOG; } break; case 's': - if (util::strieq_l("frontend-no-tl", name, 14)) { + if (util::strieq("frontend-no-tl"_sr, name, 14)) { return SHRPX_OPTID_FRONTEND_NO_TLS; } break; case 'y': - if (util::strieq_l("syslog-facilit", name, 14)) { + if (util::strieq("syslog-facilit"_sr, name, 14)) { return SHRPX_OPTID_SYSLOG_FACILITY; } break; @@ -2126,26 +2134,26 @@ int option_lookup_token(const char *name, size_t namelen) { case 16: switch (name[15]) { case 'e': - if (util::strieq_l("certificate-fil", name, 15)) { + if (util::strieq("certificate-fil"_sr, name, 15)) { return SHRPX_OPTID_CERTIFICATE_FILE; } - if (util::strieq_l("client-cert-fil", name, 15)) { + if (util::strieq("client-cert-fil"_sr, name, 15)) { return SHRPX_OPTID_CLIENT_CERT_FILE; } - if (util::strieq_l("private-key-fil", name, 15)) { + if (util::strieq("private-key-fil"_sr, name, 15)) { return SHRPX_OPTID_PRIVATE_KEY_FILE; } - if (util::strieq_l("worker-read-rat", name, 15)) { + if (util::strieq("worker-read-rat"_sr, name, 15)) { return SHRPX_OPTID_WORKER_READ_RATE; } break; case 'g': - if (util::strieq_l("accesslog-syslo", name, 15)) { + if (util::strieq("accesslog-syslo"_sr, name, 15)) { return SHRPX_OPTID_ACCESSLOG_SYSLOG; } break; case 't': - if (util::strieq_l("accesslog-forma", name, 15)) { + if (util::strieq("accesslog-forma"_sr, name, 15)) { return SHRPX_OPTID_ACCESSLOG_FORMAT; } break; @@ -2154,26 +2162,26 @@ int option_lookup_token(const char *name, size_t namelen) { case 17: switch (name[16]) { case 'e': - if (util::strieq_l("no-server-rewrit", name, 16)) { + if (util::strieq("no-server-rewrit"_sr, name, 16)) { return SHRPX_OPTID_NO_SERVER_REWRITE; } - if (util::strieq_l("worker-write-rat", name, 16)) { + if (util::strieq("worker-write-rat"_sr, name, 16)) { return SHRPX_OPTID_WORKER_WRITE_RATE; } break; case 's': - if (util::strieq_l("backend-http1-tl", name, 16)) { + if (util::strieq("backend-http1-tl"_sr, name, 16)) { return SHRPX_OPTID_BACKEND_HTTP1_TLS; } - if (util::strieq_l("max-header-field", name, 16)) { + if (util::strieq("max-header-field"_sr, name, 16)) { return SHRPX_OPTID_MAX_HEADER_FIELDS; } break; case 't': - if (util::strieq_l("dns-cache-timeou", name, 16)) { + if (util::strieq("dns-cache-timeou"_sr, name, 16)) { return SHRPX_OPTID_DNS_CACHE_TIMEOUT; } - if (util::strieq_l("worker-read-burs", name, 16)) { + if (util::strieq("worker-read-burs"_sr, name, 16)) { return SHRPX_OPTID_WORKER_READ_BURST; } break; @@ -2182,25 +2190,25 @@ int option_lookup_token(const char *name, size_t namelen) { case 18: switch (name[17]) { case 'a': - if (util::strieq_l("tls-max-early-dat", name, 17)) { + if (util::strieq("tls-max-early-dat"_sr, name, 17)) { return SHRPX_OPTID_TLS_MAX_EARLY_DATA; } break; case 'r': - if (util::strieq_l("add-request-heade", name, 17)) { + if (util::strieq("add-request-heade"_sr, name, 17)) { return SHRPX_OPTID_ADD_REQUEST_HEADER; } break; case 's': - if (util::strieq_l("client-psk-secret", name, 17)) { + if (util::strieq("client-psk-secret"_sr, name, 17)) { return SHRPX_OPTID_CLIENT_PSK_SECRETS; } break; case 't': - if (util::strieq_l("dns-lookup-timeou", name, 17)) { + if (util::strieq("dns-lookup-timeou"_sr, name, 17)) { return SHRPX_OPTID_DNS_LOOKUP_TIMEOUT; } - if (util::strieq_l("worker-write-burs", name, 17)) { + if (util::strieq("worker-write-burs"_sr, name, 17)) { return SHRPX_OPTID_WORKER_WRITE_BURST; } break; @@ -2209,37 +2217,37 @@ int option_lookup_token(const char *name, size_t namelen) { case 19: switch (name[18]) { case 'e': - if (util::strieq_l("no-location-rewrit", name, 18)) { + if (util::strieq("no-location-rewrit"_sr, name, 18)) { return SHRPX_OPTID_NO_LOCATION_REWRITE; } - if (util::strieq_l("require-http-schem", name, 18)) { + if (util::strieq("require-http-schem"_sr, name, 18)) { return SHRPX_OPTID_REQUIRE_HTTP_SCHEME; } - if (util::strieq_l("tls-ticket-key-fil", name, 18)) { + if (util::strieq("tls-ticket-key-fil"_sr, name, 18)) { return SHRPX_OPTID_TLS_TICKET_KEY_FILE; } break; case 'f': - if (util::strieq_l("backend-max-backof", name, 18)) { + if (util::strieq("backend-max-backof"_sr, name, 18)) { return SHRPX_OPTID_BACKEND_MAX_BACKOFF; } break; case 'r': - if (util::strieq_l("add-response-heade", name, 18)) { + if (util::strieq("add-response-heade"_sr, name, 18)) { return SHRPX_OPTID_ADD_RESPONSE_HEADER; } - if (util::strieq_l("add-x-forwarded-fo", name, 18)) { + if (util::strieq("add-x-forwarded-fo"_sr, name, 18)) { return SHRPX_OPTID_ADD_X_FORWARDED_FOR; } - if (util::strieq_l("header-field-buffe", name, 18)) { + if (util::strieq("header-field-buffe"_sr, name, 18)) { return SHRPX_OPTID_HEADER_FIELD_BUFFER; } break; case 't': - if (util::strieq_l("redirect-https-por", name, 18)) { + if (util::strieq("redirect-https-por"_sr, name, 18)) { return SHRPX_OPTID_REDIRECT_HTTPS_PORT; } - if (util::strieq_l("stream-read-timeou", name, 18)) { + if (util::strieq("stream-read-timeou"_sr, name, 18)) { return SHRPX_OPTID_STREAM_READ_TIMEOUT; } break; @@ -2248,36 +2256,36 @@ int option_lookup_token(const char *name, size_t namelen) { case 20: switch (name[19]) { case 'g': - if (util::strieq_l("frontend-frame-debu", name, 19)) { + if (util::strieq("frontend-frame-debu"_sr, name, 19)) { return SHRPX_OPTID_FRONTEND_FRAME_DEBUG; } break; case 'l': - if (util::strieq_l("ocsp-update-interva", name, 19)) { + if (util::strieq("ocsp-update-interva"_sr, name, 19)) { return SHRPX_OPTID_OCSP_UPDATE_INTERVAL; } break; case 's': - if (util::strieq_l("max-worker-processe", name, 19)) { + if (util::strieq("max-worker-processe"_sr, name, 19)) { return SHRPX_OPTID_MAX_WORKER_PROCESSES; } - if (util::strieq_l("tls13-client-cipher", name, 19)) { + if (util::strieq("tls13-client-cipher"_sr, name, 19)) { return SHRPX_OPTID_TLS13_CLIENT_CIPHERS; } break; case 't': - if (util::strieq_l("backend-read-timeou", name, 19)) { + if (util::strieq("backend-read-timeou"_sr, name, 19)) { return SHRPX_OPTID_BACKEND_READ_TIMEOUT; } - if (util::strieq_l("stream-write-timeou", name, 19)) { + if (util::strieq("stream-write-timeou"_sr, name, 19)) { return SHRPX_OPTID_STREAM_WRITE_TIMEOUT; } - if (util::strieq_l("verify-client-cacer", name, 19)) { + if (util::strieq("verify-client-cacer"_sr, name, 19)) { return SHRPX_OPTID_VERIFY_CLIENT_CACERT; } break; case 'y': - if (util::strieq_l("api-max-request-bod", name, 19)) { + if (util::strieq("api-max-request-bod"_sr, name, 19)) { return SHRPX_OPTID_API_MAX_REQUEST_BODY; } break; @@ -2286,48 +2294,48 @@ int option_lookup_token(const char *name, size_t namelen) { case 21: switch (name[20]) { case 'd': - if (util::strieq_l("backend-tls-sni-fiel", name, 20)) { + if (util::strieq("backend-tls-sni-fiel"_sr, name, 20)) { return SHRPX_OPTID_BACKEND_TLS_SNI_FIELD; } break; case 'e': - if (util::strieq_l("quic-bpf-program-fil", name, 20)) { + if (util::strieq("quic-bpf-program-fil"_sr, name, 20)) { return SHRPX_OPTID_QUIC_BPF_PROGRAM_FILE; } break; case 'l': - if (util::strieq_l("accept-proxy-protoco", name, 20)) { + if (util::strieq("accept-proxy-protoco"_sr, name, 20)) { return SHRPX_OPTID_ACCEPT_PROXY_PROTOCOL; } break; case 'n': - if (util::strieq_l("tls-max-proto-versio", name, 20)) { + if (util::strieq("tls-max-proto-versio"_sr, name, 20)) { return SHRPX_OPTID_TLS_MAX_PROTO_VERSION; } - if (util::strieq_l("tls-min-proto-versio", name, 20)) { + if (util::strieq("tls-min-proto-versio"_sr, name, 20)) { return SHRPX_OPTID_TLS_MIN_PROTO_VERSION; } break; case 'r': - if (util::strieq_l("tls-ticket-key-ciphe", name, 20)) { + if (util::strieq("tls-ticket-key-ciphe"_sr, name, 20)) { return SHRPX_OPTID_TLS_TICKET_KEY_CIPHER; } break; case 's': - if (util::strieq_l("frontend-max-request", name, 20)) { + if (util::strieq("frontend-max-request"_sr, name, 20)) { return SHRPX_OPTID_FRONTEND_MAX_REQUESTS; } break; case 't': - if (util::strieq_l("backend-write-timeou", name, 20)) { + if (util::strieq("backend-write-timeou"_sr, name, 20)) { return SHRPX_OPTID_BACKEND_WRITE_TIMEOUT; } - if (util::strieq_l("frontend-read-timeou", name, 20)) { + if (util::strieq("frontend-read-timeou"_sr, name, 20)) { return SHRPX_OPTID_FRONTEND_READ_TIMEOUT; } break; case 'y': - if (util::strieq_l("accesslog-write-earl", name, 20)) { + if (util::strieq("accesslog-write-earl"_sr, name, 20)) { return SHRPX_OPTID_ACCESSLOG_WRITE_EARLY; } break; @@ -2336,25 +2344,25 @@ int option_lookup_token(const char *name, size_t namelen) { case 22: switch (name[21]) { case 'i': - if (util::strieq_l("backend-http-proxy-ur", name, 21)) { + if (util::strieq("backend-http-proxy-ur"_sr, name, 21)) { return SHRPX_OPTID_BACKEND_HTTP_PROXY_URI; } break; case 'r': - if (util::strieq_l("backend-request-buffe", name, 21)) { + if (util::strieq("backend-request-buffe"_sr, name, 21)) { return SHRPX_OPTID_BACKEND_REQUEST_BUFFER; } - if (util::strieq_l("frontend-quic-qlog-di", name, 21)) { + if (util::strieq("frontend-quic-qlog-di"_sr, name, 21)) { return SHRPX_OPTID_FRONTEND_QUIC_QLOG_DIR; } break; case 't': - if (util::strieq_l("frontend-write-timeou", name, 21)) { + if (util::strieq("frontend-write-timeou"_sr, name, 21)) { return SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT; } break; case 'y': - if (util::strieq_l("backend-address-famil", name, 21)) { + if (util::strieq("backend-address-famil"_sr, name, 21)) { return SHRPX_OPTID_BACKEND_ADDRESS_FAMILY; } break; @@ -2363,60 +2371,63 @@ int option_lookup_token(const char *name, size_t namelen) { case 23: switch (name[22]) { case 'e': - if (util::strieq_l("client-private-key-fil", name, 22)) { + if (util::strieq("client-private-key-fil"_sr, name, 22)) { return SHRPX_OPTID_CLIENT_PRIVATE_KEY_FILE; } - if (util::strieq_l("private-key-passwd-fil", name, 22)) { + if (util::strieq("private-key-passwd-fil"_sr, name, 22)) { return SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE; } break; case 'g': - if (util::strieq_l("frontend-quic-debug-lo", name, 22)) { + if (util::strieq("frontend-quic-debug-lo"_sr, name, 22)) { return SHRPX_OPTID_FRONTEND_QUIC_DEBUG_LOG; } break; case 'r': - if (util::strieq_l("backend-response-buffe", name, 22)) { + if (util::strieq("backend-response-buffe"_sr, name, 22)) { return SHRPX_OPTID_BACKEND_RESPONSE_BUFFER; } break; case 't': - if (util::strieq_l("backend-connect-timeou", name, 22)) { + if (util::strieq("backend-connect-timeou"_sr, name, 22)) { return SHRPX_OPTID_BACKEND_CONNECT_TIMEOUT; } + if (util::strieq("frontend-header-timeou"_sr, name, 22)) { + return SHRPX_OPTID_FRONTEND_HEADER_TIMEOUT; + } break; } break; case 24: switch (name[23]) { case 'a': - if (util::strieq_l("frontend-quic-early-dat", name, 23)) { + if (util::strieq("frontend-quic-early-dat"_sr, name, 23)) { return SHRPX_OPTID_FRONTEND_QUIC_EARLY_DATA; } break; case 'd': - if (util::strieq_l("strip-incoming-forwarde", name, 23)) { + if (util::strieq("strip-incoming-forwarde"_sr, name, 23)) { return SHRPX_OPTID_STRIP_INCOMING_FORWARDED; } - if (util::strieq_l("tls-ticket-key-memcache", name, 23)) { + if (util::strieq("tls-ticket-key-memcache"_sr, name, 23)) { return SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED; } break; case 'e': - if (util::strieq_l("fetch-ocsp-response-fil", name, 23)) { + if (util::strieq("fetch-ocsp-response-fil"_sr, name, 23)) { return SHRPX_OPTID_FETCH_OCSP_RESPONSE_FILE; } break; case 'o': - if (util::strieq_l("no-add-x-forwarded-prot", name, 23)) { + if (util::strieq("no-add-x-forwarded-prot"_sr, name, 23)) { return SHRPX_OPTID_NO_ADD_X_FORWARDED_PROTO; } break; case 't': - if (util::strieq_l("listener-disable-timeou", name, 23)) { + if (util::strieq("listener-disable-timeou"_sr, name, 23)) { return SHRPX_OPTID_LISTENER_DISABLE_TIMEOUT; } - if (util::strieq_l("tls-dyn-rec-idle-timeou", name, 23)) { + if (util::strieq("tls-dyn-rec-idle-timeou"_sr, name, 23)) { return SHRPX_OPTID_TLS_DYN_REC_IDLE_TIMEOUT; } break; @@ -2425,28 +2436,28 @@ int option_lookup_token(const char *name, size_t namelen) { case 25: switch (name[24]) { case 'e': - if (util::strieq_l("backend-http2-window-siz", name, 24)) { + if (util::strieq("backend-http2-window-siz"_sr, name, 24)) { return SHRPX_OPTID_BACKEND_HTTP2_WINDOW_SIZE; } - if (util::strieq_l("frontend-quic-secret-fil", name, 24)) { + if (util::strieq("frontend-quic-secret-fil"_sr, name, 24)) { return SHRPX_OPTID_FRONTEND_QUIC_SECRET_FILE; } break; case 'g': - if (util::strieq_l("http2-no-cookie-crumblin", name, 24)) { + if (util::strieq("http2-no-cookie-crumblin"_sr, name, 24)) { return SHRPX_OPTID_HTTP2_NO_COOKIE_CRUMBLING; } break; case 's': - if (util::strieq_l("backend-http2-window-bit", name, 24)) { + if (util::strieq("backend-http2-window-bit"_sr, name, 24)) { return SHRPX_OPTID_BACKEND_HTTP2_WINDOW_BITS; } - if (util::strieq_l("max-request-header-field", name, 24)) { + if (util::strieq("max-request-header-field"_sr, name, 24)) { return SHRPX_OPTID_MAX_REQUEST_HEADER_FIELDS; } break; case 't': - if (util::strieq_l("frontend-quic-initial-rt", name, 24)) { + if (util::strieq("frontend-quic-initial-rt"_sr, name, 24)) { return SHRPX_OPTID_FRONTEND_QUIC_INITIAL_RTT; } break; @@ -2455,37 +2466,37 @@ int option_lookup_token(const char *name, size_t namelen) { case 26: switch (name[25]) { case 'a': - if (util::strieq_l("tls-no-postpone-early-dat", name, 25)) { + if (util::strieq("tls-no-postpone-early-dat"_sr, name, 25)) { return SHRPX_OPTID_TLS_NO_POSTPONE_EARLY_DATA; } break; case 'e': - if (util::strieq_l("frontend-http2-window-siz", name, 25)) { + if (util::strieq("frontend-http2-window-siz"_sr, name, 25)) { return SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_SIZE; } - if (util::strieq_l("frontend-http3-window-siz", name, 25)) { + if (util::strieq("frontend-http3-window-siz"_sr, name, 25)) { return SHRPX_OPTID_FRONTEND_HTTP3_WINDOW_SIZE; } break; case 's': - if (util::strieq_l("frontend-http2-window-bit", name, 25)) { + if (util::strieq("frontend-http2-window-bit"_sr, name, 25)) { return SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_BITS; } - if (util::strieq_l("max-response-header-field", name, 25)) { + if (util::strieq("max-response-header-field"_sr, name, 25)) { return SHRPX_OPTID_MAX_RESPONSE_HEADER_FIELDS; } break; case 't': - if (util::strieq_l("backend-keep-alive-timeou", name, 25)) { + if (util::strieq("backend-keep-alive-timeou"_sr, name, 25)) { return SHRPX_OPTID_BACKEND_KEEP_ALIVE_TIMEOUT; } - if (util::strieq_l("frontend-quic-idle-timeou", name, 25)) { + if (util::strieq("frontend-quic-idle-timeou"_sr, name, 25)) { return SHRPX_OPTID_FRONTEND_QUIC_IDLE_TIMEOUT; } - if (util::strieq_l("no-http2-cipher-black-lis", name, 25)) { + if (util::strieq("no-http2-cipher-black-lis"_sr, name, 25)) { return SHRPX_OPTID_NO_HTTP2_CIPHER_BLACK_LIST; } - if (util::strieq_l("no-http2-cipher-block-lis", name, 25)) { + if (util::strieq("no-http2-cipher-block-lis"_sr, name, 25)) { return SHRPX_OPTID_NO_HTTP2_CIPHER_BLOCK_LIST; } break; @@ -2494,33 +2505,39 @@ int option_lookup_token(const char *name, size_t namelen) { case 27: switch (name[26]) { case 'd': - if (util::strieq_l("tls-session-cache-memcache", name, 26)) { + if (util::strieq("tls-session-cache-memcache"_sr, name, 26)) { return SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED; } break; case 'n': - if (util::strieq_l("frontend-quic-require-toke", name, 26)) { + if (util::strieq("frontend-quic-require-toke"_sr, name, 26)) { return SHRPX_OPTID_FRONTEND_QUIC_REQUIRE_TOKEN; } break; case 'r': - if (util::strieq_l("request-header-field-buffe", name, 26)) { + if (util::strieq("request-header-field-buffe"_sr, name, 26)) { return SHRPX_OPTID_REQUEST_HEADER_FIELD_BUFFER; } break; case 's': - if (util::strieq_l("worker-frontend-connection", name, 26)) { + if (util::strieq("worker-frontend-connection"_sr, name, 26)) { return SHRPX_OPTID_WORKER_FRONTEND_CONNECTIONS; } break; case 't': - if (util::strieq_l("frontend-http2-read-timeou", name, 26)) { + if (util::strieq("frontend-http2-idle-timeou"_sr, name, 26)) { + return SHRPX_OPTID_FRONTEND_HTTP2_IDLE_TIMEOUT; + } + if (util::strieq("frontend-http2-read-timeou"_sr, name, 26)) { return SHRPX_OPTID_FRONTEND_HTTP2_READ_TIMEOUT; } - if (util::strieq_l("frontend-http3-read-timeou", name, 26)) { + if (util::strieq("frontend-http3-idle-timeou"_sr, name, 26)) { + return SHRPX_OPTID_FRONTEND_HTTP3_IDLE_TIMEOUT; + } + if (util::strieq("frontend-http3-read-timeou"_sr, name, 26)) { return SHRPX_OPTID_FRONTEND_HTTP3_READ_TIMEOUT; } - if (util::strieq_l("frontend-keep-alive-timeou", name, 26)) { + if (util::strieq("frontend-keep-alive-timeou"_sr, name, 26)) { return SHRPX_OPTID_FRONTEND_KEEP_ALIVE_TIMEOUT; } break; @@ -2529,30 +2546,30 @@ int option_lookup_token(const char *name, size_t namelen) { case 28: switch (name[27]) { case 'a': - if (util::strieq_l("no-strip-incoming-early-dat", name, 27)) { + if (util::strieq("no-strip-incoming-early-dat"_sr, name, 27)) { return SHRPX_OPTID_NO_STRIP_INCOMING_EARLY_DATA; } break; case 'd': - if (util::strieq_l("tls-dyn-rec-warmup-threshol", name, 27)) { + if (util::strieq("tls-dyn-rec-warmup-threshol"_sr, name, 27)) { return SHRPX_OPTID_TLS_DYN_REC_WARMUP_THRESHOLD; } break; case 'r': - if (util::strieq_l("response-header-field-buffe", name, 27)) { + if (util::strieq("response-header-field-buffe"_sr, name, 27)) { return SHRPX_OPTID_RESPONSE_HEADER_FIELD_BUFFER; } break; case 's': - if (util::strieq_l("http2-max-concurrent-stream", name, 27)) { + if (util::strieq("http2-max-concurrent-stream"_sr, name, 27)) { return SHRPX_OPTID_HTTP2_MAX_CONCURRENT_STREAMS; } - if (util::strieq_l("tls-ticket-key-memcached-tl", name, 27)) { + if (util::strieq("tls-ticket-key-memcached-tl"_sr, name, 27)) { return SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_TLS; } break; case 't': - if (util::strieq_l("backend-connections-per-hos", name, 27)) { + if (util::strieq("backend-connections-per-hos"_sr, name, 27)) { return SHRPX_OPTID_BACKEND_CONNECTIONS_PER_HOST; } break; @@ -2561,25 +2578,25 @@ int option_lookup_token(const char *name, size_t namelen) { case 30: switch (name[29]) { case 'd': - if (util::strieq_l("verify-client-tolerate-expire", name, 29)) { + if (util::strieq("verify-client-tolerate-expire"_sr, name, 29)) { return SHRPX_OPTID_VERIFY_CLIENT_TOLERATE_EXPIRED; } break; case 'e': - if (util::strieq_l("frontend-http3-max-window-siz", name, 29)) { + if (util::strieq("frontend-http3-max-window-siz"_sr, name, 29)) { return SHRPX_OPTID_FRONTEND_HTTP3_MAX_WINDOW_SIZE; } break; case 'r': - if (util::strieq_l("ignore-per-pattern-mruby-erro", name, 29)) { + if (util::strieq("ignore-per-pattern-mruby-erro"_sr, name, 29)) { return SHRPX_OPTID_IGNORE_PER_PATTERN_MRUBY_ERROR; } - if (util::strieq_l("strip-incoming-x-forwarded-fo", name, 29)) { + if (util::strieq("strip-incoming-x-forwarded-fo"_sr, name, 29)) { return SHRPX_OPTID_STRIP_INCOMING_X_FORWARDED_FOR; } break; case 't': - if (util::strieq_l("backend-http2-settings-timeou", name, 29)) { + if (util::strieq("backend-http2-settings-timeou"_sr, name, 29)) { return SHRPX_OPTID_BACKEND_HTTP2_SETTINGS_TIMEOUT; } break; @@ -2588,12 +2605,12 @@ int option_lookup_token(const char *name, size_t namelen) { case 31: switch (name[30]) { case 's': - if (util::strieq_l("tls-session-cache-memcached-tl", name, 30)) { + if (util::strieq("tls-session-cache-memcached-tl"_sr, name, 30)) { return SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_TLS; } break; case 't': - if (util::strieq_l("frontend-http2-settings-timeou", name, 30)) { + if (util::strieq("frontend-http2-settings-timeou"_sr, name, 30)) { return SHRPX_OPTID_FRONTEND_HTTP2_SETTINGS_TIMEOUT; } break; @@ -2602,7 +2619,7 @@ int option_lookup_token(const char *name, size_t namelen) { case 32: switch (name[31]) { case 'd': - if (util::strieq_l("backend-connections-per-fronten", name, 31)) { + if (util::strieq("backend-connections-per-fronten"_sr, name, 31)) { return SHRPX_OPTID_BACKEND_CONNECTIONS_PER_FRONTEND; } break; @@ -2611,18 +2628,18 @@ int option_lookup_token(const char *name, size_t namelen) { case 33: switch (name[32]) { case 'l': - if (util::strieq_l("tls-ticket-key-memcached-interva", name, 32)) { + if (util::strieq("tls-ticket-key-memcached-interva"_sr, name, 32)) { return SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_INTERVAL; } - if (util::strieq_l("tls-ticket-key-memcached-max-fai", name, 32)) { + if (util::strieq("tls-ticket-key-memcached-max-fai"_sr, name, 32)) { return SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_MAX_FAIL; } break; case 't': - if (util::strieq_l("client-no-http2-cipher-black-lis", name, 32)) { + if (util::strieq("client-no-http2-cipher-black-lis"_sr, name, 32)) { return SHRPX_OPTID_CLIENT_NO_HTTP2_CIPHER_BLACK_LIST; } - if (util::strieq_l("client-no-http2-cipher-block-lis", name, 32)) { + if (util::strieq("client-no-http2-cipher-block-lis"_sr, name, 32)) { return SHRPX_OPTID_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST; } break; @@ -2631,22 +2648,22 @@ int option_lookup_token(const char *name, size_t namelen) { case 34: switch (name[33]) { case 'e': - if (util::strieq_l("tls-ticket-key-memcached-cert-fil", name, 33)) { + if (util::strieq("tls-ticket-key-memcached-cert-fil"_sr, name, 33)) { return SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_CERT_FILE; } break; case 'r': - if (util::strieq_l("frontend-http2-dump-request-heade", name, 33)) { + if (util::strieq("frontend-http2-dump-request-heade"_sr, name, 33)) { return SHRPX_OPTID_FRONTEND_HTTP2_DUMP_REQUEST_HEADER; } break; case 't': - if (util::strieq_l("backend-http1-connections-per-hos", name, 33)) { + if (util::strieq("backend-http1-connections-per-hos"_sr, name, 33)) { return SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_HOST; } break; case 'y': - if (util::strieq_l("tls-ticket-key-memcached-max-retr", name, 33)) { + if (util::strieq("tls-ticket-key-memcached-max-retr"_sr, name, 33)) { return SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_MAX_RETRY; } break; @@ -2655,20 +2672,20 @@ int option_lookup_token(const char *name, size_t namelen) { case 35: switch (name[34]) { case 'e': - if (util::strieq_l("frontend-http2-optimize-window-siz", name, 34)) { + if (util::strieq("frontend-http2-optimize-window-siz"_sr, name, 34)) { return SHRPX_OPTID_FRONTEND_HTTP2_OPTIMIZE_WINDOW_SIZE; } break; case 'o': - if (util::strieq_l("no-strip-incoming-x-forwarded-prot", name, 34)) { + if (util::strieq("no-strip-incoming-x-forwarded-prot"_sr, name, 34)) { return SHRPX_OPTID_NO_STRIP_INCOMING_X_FORWARDED_PROTO; } break; case 'r': - if (util::strieq_l("frontend-http2-dump-response-heade", name, 34)) { + if (util::strieq("frontend-http2-dump-response-heade"_sr, name, 34)) { return SHRPX_OPTID_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER; } - if (util::strieq_l("frontend-quic-congestion-controlle", name, 34)) { + if (util::strieq("frontend-quic-congestion-controlle"_sr, name, 34)) { return SHRPX_OPTID_FRONTEND_QUIC_CONGESTION_CONTROLLER; } break; @@ -2677,25 +2694,25 @@ int option_lookup_token(const char *name, size_t namelen) { case 36: switch (name[35]) { case 'd': - if (util::strieq_l("worker-process-grace-shutdown-perio", name, 35)) { + if (util::strieq("worker-process-grace-shutdown-perio"_sr, name, 35)) { return SHRPX_OPTID_WORKER_PROCESS_GRACE_SHUTDOWN_PERIOD; } break; case 'e': - if (util::strieq_l("backend-http2-connection-window-siz", name, 35)) { + if (util::strieq("backend-http2-connection-window-siz"_sr, name, 35)) { return SHRPX_OPTID_BACKEND_HTTP2_CONNECTION_WINDOW_SIZE; } break; case 'r': - if (util::strieq_l("backend-http2-connections-per-worke", name, 35)) { + if (util::strieq("backend-http2-connections-per-worke"_sr, name, 35)) { return SHRPX_OPTID_BACKEND_HTTP2_CONNECTIONS_PER_WORKER; } break; case 's': - if (util::strieq_l("backend-http2-connection-window-bit", name, 35)) { + if (util::strieq("backend-http2-connection-window-bit"_sr, name, 35)) { return SHRPX_OPTID_BACKEND_HTTP2_CONNECTION_WINDOW_BITS; } - if (util::strieq_l("backend-http2-max-concurrent-stream", name, 35)) { + if (util::strieq("backend-http2-max-concurrent-stream"_sr, name, 35)) { return SHRPX_OPTID_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS; } break; @@ -2704,24 +2721,24 @@ int option_lookup_token(const char *name, size_t namelen) { case 37: switch (name[36]) { case 'e': - if (util::strieq_l("frontend-http2-connection-window-siz", name, 36)) { + if (util::strieq("frontend-http2-connection-window-siz"_sr, name, 36)) { return SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_SIZE; } - if (util::strieq_l("frontend-http3-connection-window-siz", name, 36)) { + if (util::strieq("frontend-http3-connection-window-siz"_sr, name, 36)) { return SHRPX_OPTID_FRONTEND_HTTP3_CONNECTION_WINDOW_SIZE; } - if (util::strieq_l("tls-session-cache-memcached-cert-fil", name, 36)) { + if (util::strieq("tls-session-cache-memcached-cert-fil"_sr, name, 36)) { return SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_CERT_FILE; } break; case 's': - if (util::strieq_l("frontend-http2-connection-window-bit", name, 36)) { + if (util::strieq("frontend-http2-connection-window-bit"_sr, name, 36)) { return SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS; } - if (util::strieq_l("frontend-http2-max-concurrent-stream", name, 36)) { + if (util::strieq("frontend-http2-max-concurrent-stream"_sr, name, 36)) { return SHRPX_OPTID_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS; } - if (util::strieq_l("frontend-http3-max-concurrent-stream", name, 36)) { + if (util::strieq("frontend-http3-max-concurrent-stream"_sr, name, 36)) { return SHRPX_OPTID_FRONTEND_HTTP3_MAX_CONCURRENT_STREAMS; } break; @@ -2730,7 +2747,7 @@ int option_lookup_token(const char *name, size_t namelen) { case 38: switch (name[37]) { case 'd': - if (util::strieq_l("backend-http1-connections-per-fronten", name, 37)) { + if (util::strieq("backend-http1-connections-per-fronten"_sr, name, 37)) { return SHRPX_OPTID_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND; } break; @@ -2739,7 +2756,7 @@ int option_lookup_token(const char *name, size_t namelen) { case 39: switch (name[38]) { case 'y': - if (util::strieq_l("tls-ticket-key-memcached-address-famil", name, 38)) { + if (util::strieq("tls-ticket-key-memcached-address-famil"_sr, name, 38)) { return SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY; } break; @@ -2748,10 +2765,12 @@ int option_lookup_token(const char *name, size_t namelen) { case 40: switch (name[39]) { case 'e': - if (util::strieq_l("backend-http2-decoder-dynamic-table-siz", name, 39)) { + if (util::strieq("backend-http2-decoder-dynamic-table-siz"_sr, name, + 39)) { return SHRPX_OPTID_BACKEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE; } - if (util::strieq_l("backend-http2-encoder-dynamic-table-siz", name, 39)) { + if (util::strieq("backend-http2-encoder-dynamic-table-siz"_sr, name, + 39)) { return SHRPX_OPTID_BACKEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE; } break; @@ -2760,24 +2779,24 @@ int option_lookup_token(const char *name, size_t namelen) { case 41: switch (name[40]) { case 'e': - if (util::strieq_l("frontend-http2-decoder-dynamic-table-siz", name, - 40)) { + if (util::strieq("frontend-http2-decoder-dynamic-table-siz"_sr, name, + 40)) { return SHRPX_OPTID_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE; } - if (util::strieq_l("frontend-http2-encoder-dynamic-table-siz", name, - 40)) { + if (util::strieq("frontend-http2-encoder-dynamic-table-siz"_sr, name, + 40)) { return SHRPX_OPTID_FRONTEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE; } - if (util::strieq_l("frontend-http2-optimize-write-buffer-siz", name, - 40)) { + if (util::strieq("frontend-http2-optimize-write-buffer-siz"_sr, name, + 40)) { return SHRPX_OPTID_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE; } - if (util::strieq_l("frontend-http3-max-connection-window-siz", name, - 40)) { + if (util::strieq("frontend-http3-max-connection-window-siz"_sr, name, + 40)) { return SHRPX_OPTID_FRONTEND_HTTP3_MAX_CONNECTION_WINDOW_SIZE; } - if (util::strieq_l("tls-ticket-key-memcached-private-key-fil", name, - 40)) { + if (util::strieq("tls-ticket-key-memcached-private-key-fil"_sr, name, + 40)) { return SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE; } break; @@ -2786,8 +2805,8 @@ int option_lookup_token(const char *name, size_t namelen) { case 42: switch (name[41]) { case 'y': - if (util::strieq_l("tls-session-cache-memcached-address-famil", name, - 41)) { + if (util::strieq("tls-session-cache-memcached-address-famil"_sr, name, + 41)) { return SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY; } break; @@ -2796,8 +2815,8 @@ int option_lookup_token(const char *name, size_t namelen) { case 44: switch (name[43]) { case 'e': - if (util::strieq_l("tls-session-cache-memcached-private-key-fil", name, - 43)) { + if (util::strieq("tls-session-cache-memcached-private-key-fil"_sr, name, + 43)) { return SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE; } break; @@ -2810,7 +2829,7 @@ int option_lookup_token(const char *name, size_t namelen) { int parse_config(Config *config, const StringRef &opt, const StringRef &optarg, std::set &included_set, std::map &pattern_addr_indexer) { - auto optid = option_lookup_token(opt.c_str(), opt.size()); + auto optid = option_lookup_token(opt); return parse_config(config, optid, opt, optarg, included_set, pattern_addr_indexer); } @@ -2831,7 +2850,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) { auto path = std::begin(optarg) + SHRPX_UNIX_PATH_PREFIX.size(); addr.host = - make_string_ref(downstreamconf.balloc, StringRef{path, addr_end}); + make_string_ref(downstreamconf.balloc, StringRef{path, addr_end}); addr.host_unix = true; } else { if (split_host_port(host, sizeof(host), &port, @@ -2847,7 +2866,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, auto mapping_end = std::find(mapping, std::end(optarg), ';'); auto params = - mapping_end == std::end(optarg) ? mapping_end : mapping_end + 1; + mapping_end == std::end(optarg) ? mapping_end : mapping_end + 1; if (parse_mapping(config, addr, pattern_addr_indexer, StringRef{mapping, mapping_end}, @@ -2954,13 +2973,28 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; } - case SHRPX_OPTID_WORKERS: + case SHRPX_OPTID_WORKERS: { #ifdef NOTHREADS LOG(WARN) << "Threading disabled at build time, no threads created."; return 0; #else // !NOTHREADS - return parse_uint(&config->num_worker, opt, optarg); + size_t n; + + if (parse_uint(&n, opt, optarg) != 0) { + return -1; + } + + if (n > 65530) { + LOG(ERROR) << opt << ": the number of workers must not exceed 65530"; + + return -1; + } + + config->num_worker = n; + + return 0; #endif // !NOTHREADS + } case SHRPX_OPTID_HTTP2_MAX_CONCURRENT_STREAMS: { LOG(WARN) << opt << ": deprecated. Use " << SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS << " and " @@ -2986,11 +3020,11 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; } case SHRPX_OPTID_DAEMON: - config->daemon = util::strieq_l("yes", optarg); + config->daemon = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_HTTP2_PROXY: - config->http2_proxy = util::strieq_l("yes", optarg); + config->http2_proxy = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_HTTP2_BRIDGE: @@ -2999,27 +3033,34 @@ int parse_config(Config *config, int optid, const StringRef &opt, return -1; case SHRPX_OPTID_CLIENT_PROXY: LOG(ERROR) - << opt - << ": deprecated. Use http2-proxy, frontend=,;no-tls " - "and backend=,;;proto=h2;tls"; + << opt + << ": deprecated. Use http2-proxy, frontend=,;no-tls " + "and backend=,;;proto=h2;tls"; return -1; case SHRPX_OPTID_ADD_X_FORWARDED_FOR: - config->http.xff.add = util::strieq_l("yes", optarg); + config->http.xff.add = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_STRIP_INCOMING_X_FORWARDED_FOR: - config->http.xff.strip_incoming = util::strieq_l("yes", optarg); + config->http.xff.strip_incoming = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_NO_VIA: - config->http.no_via = util::strieq_l("yes", optarg); + config->http.no_via = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_FRONTEND_HTTP2_READ_TIMEOUT: - return parse_duration(&config->conn.upstream.timeout.http2_read, opt, + LOG(WARN) << opt << ": deprecated. Use frontend-http2-idle-timeout"; + // fall through + case SHRPX_OPTID_FRONTEND_HTTP2_IDLE_TIMEOUT: + return parse_duration(&config->conn.upstream.timeout.http2_idle, opt, optarg); case SHRPX_OPTID_FRONTEND_READ_TIMEOUT: - return parse_duration(&config->conn.upstream.timeout.read, opt, optarg); + LOG(WARN) << opt << ": deprecated. Use frontend-header-timeout"; + + return 0; + case SHRPX_OPTID_FRONTEND_HEADER_TIMEOUT: + return parse_duration(&config->http.timeout.header, opt, optarg); case SHRPX_OPTID_FRONTEND_WRITE_TIMEOUT: return parse_duration(&config->conn.upstream.timeout.write, opt, optarg); case SHRPX_OPTID_BACKEND_READ_TIMEOUT: @@ -3038,7 +3079,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_ACCESSLOG_SYSLOG: - config->logging.access.syslog = util::strieq_l("yes", optarg); + config->logging.access.syslog = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_ACCESSLOG_FORMAT: @@ -3050,7 +3091,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_ERRORLOG_SYSLOG: - config->logging.error.syslog = util::strieq_l("yes", optarg); + config->logging.error.syslog = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_FASTOPEN: @@ -3062,8 +3103,8 @@ int parse_config(Config *config, int optid, const StringRef &opt, case SHRPX_OPTID_BACKEND_HTTP2_WINDOW_BITS: { LOG(WARN) << opt << ": deprecated. Use " << (optid == SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_BITS - ? SHRPX_OPT_FRONTEND_HTTP2_WINDOW_SIZE - : SHRPX_OPT_BACKEND_HTTP2_WINDOW_SIZE); + ? SHRPX_OPT_FRONTEND_HTTP2_WINDOW_SIZE + : SHRPX_OPT_BACKEND_HTTP2_WINDOW_SIZE); int32_t *resp; if (optid == SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_BITS) { @@ -3096,8 +3137,8 @@ int parse_config(Config *config, int optid, const StringRef &opt, case SHRPX_OPTID_BACKEND_HTTP2_CONNECTION_WINDOW_BITS: { LOG(WARN) << opt << ": deprecated. Use " << (optid == SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS - ? SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_SIZE - : SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_SIZE); + ? SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_SIZE + : SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_SIZE); int32_t *resp; if (optid == SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS) { @@ -3148,7 +3189,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_USER: { - auto pwd = getpwnam(optarg.c_str()); + auto pwd = getpwnam(optarg.data()); if (!pwd) { LOG(ERROR) << opt << ": failed to get uid from " << optarg << ": " << xsi_strerror(errno, errbuf.data(), errbuf.size()); @@ -3171,7 +3212,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return -1; } config->tls.private_key_passwd = - make_string_ref(config->balloc, StringRef{passwd}); + make_string_ref(config->balloc, StringRef{passwd}); return 0; } @@ -3197,7 +3238,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, if (!params.sct_dir.empty()) { // Make sure that dir_path is NULL terminated string. if (read_tls_sct_from_dir(sct_data, opt, - StringRef{params.sct_dir.str()}) != 0) { + StringRef{std::string{params.sct_dir}}) != 0) { return -1; } } @@ -3227,8 +3268,8 @@ int parse_config(Config *config, int optid, const StringRef &opt, } config->tls.subcerts.emplace_back( - make_string_ref(config->balloc, private_key_file), - make_string_ref(config->balloc, cert_file), std::move(sct_data)); + make_string_ref(config->balloc, private_key_file), + make_string_ref(config->balloc, cert_file), std::move(sct_data)); return 0; } @@ -3258,7 +3299,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, "backend=,;;proto=h2;tls"; return -1; case SHRPX_OPTID_INSECURE: - config->tls.insecure = util::strieq_l("yes", optarg); + config->tls.insecure = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_CACERT: @@ -3285,25 +3326,25 @@ int parse_config(Config *config, int optid, const StringRef &opt, // the results. proxy = {}; // parse URI and get hostname, port and optionally userinfo. - http_parser_url u{}; - int rv = http_parser_parse_url(optarg.c_str(), optarg.size(), 0, &u); + urlparse_url u; + int rv = urlparse_parse_url(optarg.data(), optarg.size(), 0, &u); if (rv == 0) { - if (u.field_set & UF_USERINFO) { - auto uf = util::get_uri_field(optarg.c_str(), u, UF_USERINFO); - // Surprisingly, u.field_set & UF_USERINFO is nonzero even if + if (u.field_set & URLPARSE_USERINFO) { + auto uf = util::get_uri_field(optarg.data(), u, URLPARSE_USERINFO); + // Surprisingly, u.field_set & URLPARSE_USERINFO is nonzero even if // userinfo component is empty string. if (!uf.empty()) { proxy.userinfo = util::percent_decode(config->balloc, uf); } } - if (u.field_set & UF_HOST) { + if (u.field_set & URLPARSE_HOST) { proxy.host = make_string_ref( - config->balloc, util::get_uri_field(optarg.c_str(), u, UF_HOST)); + config->balloc, util::get_uri_field(optarg.data(), u, URLPARSE_HOST)); } else { LOG(ERROR) << opt << ": no hostname specified"; return -1; } - if (u.field_set & UF_PORT) { + if (u.field_set & URLPARSE_PORT) { proxy.port = u.port; } else { LOG(ERROR) << opt << ": no port specified"; @@ -3340,15 +3381,6 @@ int parse_config(Config *config, int optid, const StringRef &opt, case SHRPX_OPTID_WORKER_WRITE_BURST: LOG(WARN) << opt << ": not implemented yet"; return 0; - case SHRPX_OPTID_NPN_LIST: { - auto list = util::split_str(optarg, ','); - config->tls.npn_list.resize(list.size()); - for (size_t i = 0; i < list.size(); ++i) { - config->tls.npn_list[i] = make_string_ref(config->balloc, list[i]); - } - - return 0; - } case SHRPX_OPTID_TLS_PROTO_LIST: { LOG(WARN) << opt << ": deprecated. Use tls-min-proto-version and " @@ -3362,7 +3394,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; } case SHRPX_OPTID_VERIFY_CLIENT: - config->tls.client_verify.enabled = util::strieq_l("yes", optarg); + config->tls.client_verify.enabled = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_VERIFY_CLIENT_CACERT: @@ -3371,7 +3403,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_CLIENT_PRIVATE_KEY_FILE: config->tls.client.private_key_file = - make_string_ref(config->balloc, optarg); + make_string_ref(config->balloc, optarg); return 0; case SHRPX_OPTID_CLIENT_CERT_FILE: @@ -3380,20 +3412,20 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_FRONTEND_HTTP2_DUMP_REQUEST_HEADER: config->http2.upstream.debug.dump.request_header_file = - make_string_ref(config->balloc, optarg); + make_string_ref(config->balloc, optarg); return 0; case SHRPX_OPTID_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER: config->http2.upstream.debug.dump.response_header_file = - make_string_ref(config->balloc, optarg); + make_string_ref(config->balloc, optarg); return 0; case SHRPX_OPTID_HTTP2_NO_COOKIE_CRUMBLING: - config->http2.no_cookie_crumbling = util::strieq_l("yes", optarg); + config->http2.no_cookie_crumbling = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_FRONTEND_FRAME_DEBUG: - config->http2.upstream.debug.frame_debug = util::strieq_l("yes", optarg); + config->http2.upstream.debug.frame_debug = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_PADDING: @@ -3426,7 +3458,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, case SHRPX_OPTID_WORKER_FRONTEND_CONNECTIONS: return parse_uint(&config->conn.upstream.worker_connections, opt, optarg); case SHRPX_OPTID_NO_LOCATION_REWRITE: - config->http.no_location_rewrite = util::strieq_l("yes", optarg); + config->http.no_location_rewrite = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_NO_HOST_REWRITE: @@ -3468,7 +3500,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return parse_duration(&config->conn.listener.timeout.sleep, opt, optarg); case SHRPX_OPTID_TLS_TICKET_KEY_FILE: config->tls.ticket.files.emplace_back( - make_string_ref(config->balloc, optarg)); + make_string_ref(config->balloc, optarg)); return 0; case SHRPX_OPTID_RLIMIT_NOFILE: { int n; @@ -3510,7 +3542,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, } case SHRPX_OPTID_NO_SERVER_PUSH: - config->http2.no_server_push = util::strieq_l("yes", optarg); + config->http2.no_server_push = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_BACKEND_HTTP2_CONNECTIONS_PER_WORKER: @@ -3518,13 +3550,13 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_FETCH_OCSP_RESPONSE_FILE: config->tls.ocsp.fetch_ocsp_response_file = - make_string_ref(config->balloc, optarg); + make_string_ref(config->balloc, optarg); return 0; case SHRPX_OPTID_OCSP_UPDATE_INTERVAL: return parse_duration(&config->tls.ocsp.update_interval, opt, optarg); case SHRPX_OPTID_NO_OCSP: - config->tls.ocsp.disabled = util::strieq_l("yes", optarg); + config->tls.ocsp.disabled = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_HEADER_FIELD_BUFFER: @@ -3552,7 +3584,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, included_set.insert(optarg); auto rv = - load_config(config, optarg.c_str(), included_set, pattern_addr_indexer); + load_config(config, optarg.data(), included_set, pattern_addr_indexer); included_set.erase(optarg); if (rv != 0) { @@ -3562,9 +3594,9 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; } case SHRPX_OPTID_TLS_TICKET_KEY_CIPHER: - if (util::strieq_l("aes-128-cbc", optarg)) { + if (util::strieq("aes-128-cbc"_sr, optarg)) { config->tls.ticket.cipher = EVP_aes_128_cbc(); - } else if (util::strieq_l("aes-256-cbc", optarg)) { + } else if (util::strieq("aes-256-cbc"_sr, optarg)) { config->tls.ticket.cipher = EVP_aes_256_cbc(); } else { LOG(ERROR) << opt @@ -3575,7 +3607,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_HOST_REWRITE: - config->http.no_host_rewrite = !util::strieq_l("yes", optarg); + config->http.no_host_rewrite = !util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED: @@ -3656,26 +3688,27 @@ int parse_config(Config *config, int optid, const StringRef &opt, case SHRPX_OPTID_ACCEPT_PROXY_PROTOCOL: LOG(WARN) << opt << ": deprecated. Use proxyproto keyword in " << SHRPX_OPT_FRONTEND << " instead."; - config->conn.upstream.accept_proxy_protocol = util::strieq_l("yes", optarg); + config->conn.upstream.accept_proxy_protocol = + util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_ADD_FORWARDED: { auto &fwdconf = config->http.forwarded; fwdconf.params = FORWARDED_NONE; for (const auto ¶m : util::split_str(optarg, ',')) { - if (util::strieq_l("by", param)) { + if (util::strieq("by"_sr, param)) { fwdconf.params |= FORWARDED_BY; continue; } - if (util::strieq_l("for", param)) { + if (util::strieq("for"_sr, param)) { fwdconf.params |= FORWARDED_FOR; continue; } - if (util::strieq_l("host", param)) { + if (util::strieq("host"_sr, param)) { fwdconf.params |= FORWARDED_HOST; continue; } - if (util::strieq_l("proto", param)) { + if (util::strieq("proto"_sr, param)) { fwdconf.params |= FORWARDED_PROTO; continue; } @@ -3688,7 +3721,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; } case SHRPX_OPTID_STRIP_INCOMING_FORWARDED: - config->http.forwarded.strip_incoming = util::strieq_l("yes", optarg); + config->http.forwarded.strip_incoming = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_FORWARDED_BY: @@ -3710,7 +3743,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, if (optarg[0] == '_') { fwdconf.by_obfuscated = make_string_ref(config->balloc, optarg); } else { - fwdconf.by_obfuscated = StringRef::from_lit(""); + fwdconf.by_obfuscated = ""_sr; } break; case SHRPX_OPTID_FORWARDED_FOR: @@ -3725,7 +3758,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, << SHRPX_OPT_NO_HTTP2_CIPHER_BLOCK_LIST << " instead."; // fall through case SHRPX_OPTID_NO_HTTP2_CIPHER_BLOCK_LIST: - config->tls.no_http2_cipher_block_list = util::strieq_l("yes", optarg); + config->tls.no_http2_cipher_block_list = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_BACKEND_HTTP1_TLS: case SHRPX_OPTID_BACKEND_TLS: @@ -3738,12 +3771,12 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_CERT_FILE: config->tls.session_cache.memcached.cert_file = - make_string_ref(config->balloc, optarg); + make_string_ref(config->balloc, optarg); return 0; case SHRPX_OPTID_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE: config->tls.session_cache.memcached.private_key_file = - make_string_ref(config->balloc, optarg); + make_string_ref(config->balloc, optarg); return 0; case SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_TLS: @@ -3752,12 +3785,12 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_CERT_FILE: config->tls.ticket.memcached.cert_file = - make_string_ref(config->balloc, optarg); + make_string_ref(config->balloc, optarg); return 0; case SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE: config->tls.ticket.memcached.private_key_file = - make_string_ref(config->balloc, optarg); + make_string_ref(config->balloc, optarg); return 0; case SHRPX_OPTID_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY: @@ -3801,16 +3834,17 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_NO_SERVER_REWRITE: - config->http.no_server_rewrite = util::strieq_l("yes", optarg); + config->http.no_server_rewrite = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE: config->http2.upstream.optimize_write_buffer_size = - util::strieq_l("yes", optarg); + util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_FRONTEND_HTTP2_OPTIMIZE_WINDOW_SIZE: - config->http2.upstream.optimize_window_size = util::strieq_l("yes", optarg); + config->http2.upstream.optimize_window_size = + util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_SIZE: @@ -3848,45 +3882,42 @@ int parse_config(Config *config, int optid, const StringRef &opt, } nghttp2_option_set_max_deflate_dynamic_table_size( - config->http2.upstream.option, - config->http2.upstream.encoder_dynamic_table_size); + config->http2.upstream.option, + config->http2.upstream.encoder_dynamic_table_size); nghttp2_option_set_max_deflate_dynamic_table_size( - config->http2.upstream.alt_mode_option, - config->http2.upstream.encoder_dynamic_table_size); + config->http2.upstream.alt_mode_option, + config->http2.upstream.encoder_dynamic_table_size); return 0; case SHRPX_OPTID_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE: return parse_uint_with_unit( - &config->http2.upstream.decoder_dynamic_table_size, opt, optarg); + &config->http2.upstream.decoder_dynamic_table_size, opt, optarg); case SHRPX_OPTID_BACKEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE: if (parse_uint_with_unit( - &config->http2.downstream.encoder_dynamic_table_size, opt, - optarg) != 0) { + &config->http2.downstream.encoder_dynamic_table_size, opt, optarg) != + 0) { return -1; } nghttp2_option_set_max_deflate_dynamic_table_size( - config->http2.downstream.option, - config->http2.downstream.encoder_dynamic_table_size); + config->http2.downstream.option, + config->http2.downstream.encoder_dynamic_table_size); return 0; case SHRPX_OPTID_BACKEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE: return parse_uint_with_unit( - &config->http2.downstream.decoder_dynamic_table_size, opt, optarg); + &config->http2.downstream.decoder_dynamic_table_size, opt, optarg); case SHRPX_OPTID_ECDH_CURVES: -#if !LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L config->tls.ecdh_curves = make_string_ref(config->balloc, optarg); -#else // !(!LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L) - LOG(WARN) << opt << ": This option requires OpenSSL >= 1.0.2"; -#endif // !(!LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L) return 0; case SHRPX_OPTID_TLS_SCT_DIR: -#if !LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L +#if defined(NGHTTP2_GENUINE_OPENSSL) || defined(NGHTTP2_OPENSSL_IS_BORINGSSL) return read_tls_sct_from_dir(config->tls.sct_data, opt, optarg); -#else // !(!LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L) - LOG(WARN) << opt << ": This option requires OpenSSL >= 1.0.2"; +#else // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_BORINGSSL + LOG(WARN) + << opt << ": ignored because underlying TLS library does not support SCT"; return 0; -#endif // !(!LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L) +#endif // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_BORINGSSL case SHRPX_OPTID_DNS_CACHE_TIMEOUT: return parse_duration(&config->dns.timeout.cache, opt, optarg); case SHRPX_OPTID_DNS_LOOKUP_TIMEOUT: @@ -3906,33 +3937,30 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; } case SHRPX_OPTID_FRONTEND_KEEP_ALIVE_TIMEOUT: - return parse_duration(&config->conn.upstream.timeout.idle_read, opt, - optarg); + return parse_duration(&config->conn.upstream.timeout.idle, opt, optarg); case SHRPX_OPTID_PSK_SECRETS: -#if !LIBRESSL_LEGACY_API +#ifndef OPENSSL_NO_PSK return parse_psk_secrets(config, optarg); -#else // LIBRESSL_LEGACY_API +#else // OPENSSL_NO_PSK LOG(WARN) - << opt - << ": ignored because underlying TLS library does not support PSK"; + << opt << ": ignored because underlying TLS library does not support PSK"; return 0; -#endif // LIBRESSL_LEGACY_API +#endif // OPENSSL_NO_PSK case SHRPX_OPTID_CLIENT_PSK_SECRETS: -#if !LIBRESSL_LEGACY_API +#ifndef OPENSSL_NO_PSK return parse_client_psk_secrets(config, optarg); -#else // LIBRESSL_LEGACY_API +#else // OPENSSL_NO_PSK LOG(WARN) - << opt - << ": ignored because underlying TLS library does not support PSK"; + << opt << ": ignored because underlying TLS library does not support PSK"; return 0; -#endif // LIBRESSL_LEGACY_API +#endif // OPENSSL_NO_PSK case SHRPX_OPTID_CLIENT_NO_HTTP2_CIPHER_BLACK_LIST: LOG(WARN) << opt << ": deprecated. Use " << SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST << " instead."; // fall through case SHRPX_OPTID_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST: config->tls.client.no_http2_cipher_block_list = - util::strieq_l("yes", optarg); + util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_CLIENT_CIPHERS: @@ -3944,7 +3972,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_ACCESSLOG_WRITE_EARLY: - config->logging.access.write_early = util::strieq_l("yes", optarg); + config->logging.access.write_early = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_TLS_MIN_PROTO_VERSION: @@ -3953,7 +3981,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return parse_tls_proto_version(config->tls.max_proto_version, opt, optarg); case SHRPX_OPTID_REDIRECT_HTTPS_PORT: { auto n = util::parse_uint(optarg); - if (n == -1 || n < 0 || n > 65535) { + if (!n || n < 0 || n > 65535) { LOG(ERROR) << opt << ": bad value. Specify an integer in the range [0, " "65535], inclusive"; @@ -3965,46 +3993,46 @@ int parse_config(Config *config, int optid, const StringRef &opt, case SHRPX_OPTID_FRONTEND_MAX_REQUESTS: return parse_uint(&config->http.max_requests, opt, optarg); case SHRPX_OPTID_SINGLE_THREAD: - config->single_thread = util::strieq_l("yes", optarg); + config->single_thread = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_SINGLE_PROCESS: - config->single_process = util::strieq_l("yes", optarg); + config->single_process = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_NO_ADD_X_FORWARDED_PROTO: - config->http.xfp.add = !util::strieq_l("yes", optarg); + config->http.xfp.add = !util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_NO_STRIP_INCOMING_X_FORWARDED_PROTO: - config->http.xfp.strip_incoming = !util::strieq_l("yes", optarg); + config->http.xfp.strip_incoming = !util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_OCSP_STARTUP: - config->tls.ocsp.startup = util::strieq_l("yes", optarg); + config->tls.ocsp.startup = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_NO_VERIFY_OCSP: - config->tls.ocsp.no_verify = util::strieq_l("yes", optarg); + config->tls.ocsp.no_verify = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_VERIFY_CLIENT_TOLERATE_EXPIRED: - config->tls.client_verify.tolerate_expired = util::strieq_l("yes", optarg); + config->tls.client_verify.tolerate_expired = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_IGNORE_PER_PATTERN_MRUBY_ERROR: - config->ignore_per_pattern_mruby_error = util::strieq_l("yes", optarg); + config->ignore_per_pattern_mruby_error = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_TLS_NO_POSTPONE_EARLY_DATA: - config->tls.no_postpone_early_data = util::strieq_l("yes", optarg); + config->tls.no_postpone_early_data = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_TLS_MAX_EARLY_DATA: { return parse_uint_with_unit(&config->tls.max_early_data, opt, optarg); } case SHRPX_OPTID_NO_STRIP_INCOMING_EARLY_DATA: - config->http.early_data.strip_incoming = !util::strieq_l("yes", optarg); + config->http.early_data.strip_incoming = !util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_QUIC_BPF_PROGRAM_FILE: @@ -4015,7 +4043,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_NO_QUIC_BPF: #ifdef ENABLE_HTTP3 - config->quic.bpf.disabled = util::strieq_l("yes", optarg); + config->quic.bpf.disabled = util::strieq("yes"_sr, optarg); #endif // ENABLE_HTTP3 return 0; @@ -4031,8 +4059,11 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; } case SHRPX_OPTID_FRONTEND_HTTP3_READ_TIMEOUT: + LOG(WARN) << opt << ": deprecated. Use frontend-http3-idle-timeout"; + // fall through + case SHRPX_OPTID_FRONTEND_HTTP3_IDLE_TIMEOUT: #ifdef ENABLE_HTTP3 - return parse_duration(&config->conn.upstream.timeout.http3_read, opt, + return parse_duration(&config->conn.upstream.timeout.http3_idle, opt, optarg); #else // !ENABLE_HTTP3 return 0; @@ -4045,7 +4076,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, #endif // !ENABLE_HTTP3 case SHRPX_OPTID_FRONTEND_QUIC_DEBUG_LOG: #ifdef ENABLE_HTTP3 - config->quic.upstream.debug.log = util::strieq_l("yes", optarg); + config->quic.upstream.debug.log = util::strieq("yes"_sr, optarg); #endif // ENABLE_HTTP3 return 0; @@ -4094,7 +4125,7 @@ int parse_config(Config *config, int optid, const StringRef &opt, #endif // !ENABLE_HTTP3 case SHRPX_OPTID_FRONTEND_QUIC_EARLY_DATA: #ifdef ENABLE_HTTP3 - config->quic.upstream.early_data = util::strieq_l("yes", optarg); + config->quic.upstream.early_data = util::strieq("yes"_sr, optarg); #endif // ENABLE_HTTP3 return 0; @@ -4106,15 +4137,15 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_FRONTEND_QUIC_REQUIRE_TOKEN: #ifdef ENABLE_HTTP3 - config->quic.upstream.require_token = util::strieq_l("yes", optarg); + config->quic.upstream.require_token = util::strieq("yes"_sr, optarg); #endif // ENABLE_HTTP3 return 0; case SHRPX_OPTID_FRONTEND_QUIC_CONGESTION_CONTROLLER: #ifdef ENABLE_HTTP3 - if (util::strieq_l("cubic", optarg)) { + if (util::strieq("cubic"_sr, optarg)) { config->quic.upstream.congestion_controller = NGTCP2_CC_ALGO_CUBIC; - } else if (util::strieq_l("bbr", optarg)) { + } else if (util::strieq("bbr"_sr, optarg)) { config->quic.upstream.congestion_controller = NGTCP2_CC_ALGO_BBR; } else { LOG(ERROR) << opt << ": must be either cubic or bbr"; @@ -4125,12 +4156,13 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; case SHRPX_OPTID_QUIC_SERVER_ID: #ifdef ENABLE_HTTP3 - if (optarg.size() != config->quic.server_id.size() * 2 || + if (optarg.size() != sizeof(config->quic.server_id) * 2 || !util::is_hex_string(optarg)) { LOG(ERROR) << opt << ": must be a hex-string"; return -1; } - util::decode_hex(std::begin(config->quic.server_id), optarg); + util::decode_hex(reinterpret_cast(&config->quic.server_id), + optarg); #endif // ENABLE_HTTP3 return 0; @@ -4170,11 +4202,23 @@ int parse_config(Config *config, int optid, const StringRef &opt, return 0; } case SHRPX_OPTID_REQUIRE_HTTP_SCHEME: - config->http.require_http_scheme = util::strieq_l("yes", optarg); + config->http.require_http_scheme = util::strieq("yes"_sr, optarg); return 0; case SHRPX_OPTID_TLS_KTLS: - config->tls.ktls = util::strieq_l("yes", optarg); + config->tls.ktls = util::strieq("yes"_sr, optarg); return 0; + case SHRPX_OPTID_NPN_LIST: + LOG(WARN) << opt << ": deprecated. Use alpn-list instead."; + // fall through + case SHRPX_OPTID_ALPN_LIST: { + auto list = util::split_str(optarg, ','); + config->tls.alpn_list.resize(list.size()); + for (size_t i = 0; i < list.size(); ++i) { + config->tls.alpn_list[i] = make_string_ref(config->balloc, list[i]); + } + + return 0; + } case SHRPX_OPTID_CONF: LOG(WARN) << "conf: ignored"; @@ -4221,134 +4265,134 @@ int load_config(Config *config, const char *filename, StringRef str_syslog_facility(int facility) { switch (facility) { case (LOG_AUTH): - return StringRef::from_lit("auth"); + return "auth"_sr; #ifdef LOG_AUTHPRIV case (LOG_AUTHPRIV): - return StringRef::from_lit("authpriv"); + return "authpriv"_sr; #endif // LOG_AUTHPRIV case (LOG_CRON): - return StringRef::from_lit("cron"); + return "cron"_sr; case (LOG_DAEMON): - return StringRef::from_lit("daemon"); + return "daemon"_sr; #ifdef LOG_FTP case (LOG_FTP): - return StringRef::from_lit("ftp"); + return "ftp"_sr; #endif // LOG_FTP case (LOG_KERN): - return StringRef::from_lit("kern"); + return "kern"_sr; case (LOG_LOCAL0): - return StringRef::from_lit("local0"); + return "local0"_sr; case (LOG_LOCAL1): - return StringRef::from_lit("local1"); + return "local1"_sr; case (LOG_LOCAL2): - return StringRef::from_lit("local2"); + return "local2"_sr; case (LOG_LOCAL3): - return StringRef::from_lit("local3"); + return "local3"_sr; case (LOG_LOCAL4): - return StringRef::from_lit("local4"); + return "local4"_sr; case (LOG_LOCAL5): - return StringRef::from_lit("local5"); + return "local5"_sr; case (LOG_LOCAL6): - return StringRef::from_lit("local6"); + return "local6"_sr; case (LOG_LOCAL7): - return StringRef::from_lit("local7"); + return "local7"_sr; case (LOG_LPR): - return StringRef::from_lit("lpr"); + return "lpr"_sr; case (LOG_MAIL): - return StringRef::from_lit("mail"); + return "mail"_sr; case (LOG_SYSLOG): - return StringRef::from_lit("syslog"); + return "syslog"_sr; case (LOG_USER): - return StringRef::from_lit("user"); + return "user"_sr; case (LOG_UUCP): - return StringRef::from_lit("uucp"); + return "uucp"_sr; default: - return StringRef::from_lit("(unknown)"); + return "(unknown)"_sr; } } int int_syslog_facility(const StringRef &strfacility) { - if (util::strieq_l("auth", strfacility)) { + if (util::strieq("auth"_sr, strfacility)) { return LOG_AUTH; } #ifdef LOG_AUTHPRIV - if (util::strieq_l("authpriv", strfacility)) { + if (util::strieq("authpriv"_sr, strfacility)) { return LOG_AUTHPRIV; } #endif // LOG_AUTHPRIV - if (util::strieq_l("cron", strfacility)) { + if (util::strieq("cron"_sr, strfacility)) { return LOG_CRON; } - if (util::strieq_l("daemon", strfacility)) { + if (util::strieq("daemon"_sr, strfacility)) { return LOG_DAEMON; } #ifdef LOG_FTP - if (util::strieq_l("ftp", strfacility)) { + if (util::strieq("ftp"_sr, strfacility)) { return LOG_FTP; } #endif // LOG_FTP - if (util::strieq_l("kern", strfacility)) { + if (util::strieq("kern"_sr, strfacility)) { return LOG_KERN; } - if (util::strieq_l("local0", strfacility)) { + if (util::strieq("local0"_sr, strfacility)) { return LOG_LOCAL0; } - if (util::strieq_l("local1", strfacility)) { + if (util::strieq("local1"_sr, strfacility)) { return LOG_LOCAL1; } - if (util::strieq_l("local2", strfacility)) { + if (util::strieq("local2"_sr, strfacility)) { return LOG_LOCAL2; } - if (util::strieq_l("local3", strfacility)) { + if (util::strieq("local3"_sr, strfacility)) { return LOG_LOCAL3; } - if (util::strieq_l("local4", strfacility)) { + if (util::strieq("local4"_sr, strfacility)) { return LOG_LOCAL4; } - if (util::strieq_l("local5", strfacility)) { + if (util::strieq("local5"_sr, strfacility)) { return LOG_LOCAL5; } - if (util::strieq_l("local6", strfacility)) { + if (util::strieq("local6"_sr, strfacility)) { return LOG_LOCAL6; } - if (util::strieq_l("local7", strfacility)) { + if (util::strieq("local7"_sr, strfacility)) { return LOG_LOCAL7; } - if (util::strieq_l("lpr", strfacility)) { + if (util::strieq("lpr"_sr, strfacility)) { return LOG_LPR; } - if (util::strieq_l("mail", strfacility)) { + if (util::strieq("mail"_sr, strfacility)) { return LOG_MAIL; } - if (util::strieq_l("news", strfacility)) { + if (util::strieq("news"_sr, strfacility)) { return LOG_NEWS; } - if (util::strieq_l("syslog", strfacility)) { + if (util::strieq("syslog"_sr, strfacility)) { return LOG_SYSLOG; } - if (util::strieq_l("user", strfacility)) { + if (util::strieq("user"_sr, strfacility)) { return LOG_USER; } - if (util::strieq_l("uucp", strfacility)) { + if (util::strieq("uucp"_sr, strfacility)) { return LOG_UUCP; } @@ -4358,15 +4402,15 @@ int int_syslog_facility(const StringRef &strfacility) { StringRef strproto(Proto proto) { switch (proto) { case Proto::NONE: - return StringRef::from_lit("none"); + return "none"_sr; case Proto::HTTP1: - return StringRef::from_lit("http/1.1"); + return "http/1.1"_sr; case Proto::HTTP2: - return StringRef::from_lit("h2"); + return "h2"_sr; case Proto::HTTP3: - return StringRef::from_lit("h3"); + return "h3"_sr; case Proto::MEMCACHED: - return StringRef::from_lit("memcached"); + return "memcached"_sr; } // gcc needs this. @@ -4389,7 +4433,7 @@ int compute_affinity_hash(std::vector &res, size_t idx, std::array buf; for (auto i = 0; i < 20; ++i) { - auto t = s.str(); + auto t = std::string{s}; t += i; rv = util::sha256(buf.data(), StringRef{t}); @@ -4426,13 +4470,13 @@ int configure_downstream_group(Config *config, bool http2_proxy, if (addr_groups.empty()) { DownstreamAddrConfig addr{}; - addr.host = StringRef::from_lit(DEFAULT_DOWNSTREAM_HOST); + addr.host = DEFAULT_DOWNSTREAM_HOST; addr.port = DEFAULT_DOWNSTREAM_PORT; addr.proto = Proto::HTTP1; addr.weight = 1; addr.group_weight = 1; - DownstreamAddrGroupConfig g(StringRef::from_lit("/")); + DownstreamAddrGroupConfig g("/"_sr); g.addrs.push_back(std::move(addr)); router.add_route(g.pattern, addr_groups.size()); addr_groups.push_back(std::move(g)); @@ -4456,14 +4500,14 @@ int configure_downstream_group(Config *config, bool http2_proxy, ssize_t catch_all_group = -1; for (size_t i = 0; i < addr_groups.size(); ++i) { auto &g = addr_groups[i]; - if (g.pattern == StringRef::from_lit("/")) { + if (g.pattern == "/"_sr) { catch_all_group = i; } if (LOG_ENABLED(INFO)) { LOG(INFO) << "Host-path pattern: group " << i << ": '" << g.pattern << "'"; for (auto &addr : g.addrs) { - LOG(INFO) << "group " << i << " -> " << addr.host.c_str() + LOG(INFO) << "group " << i << " -> " << addr.host.data() << (addr.host_unix ? "" : ":" + util::utos(addr.port)) << ", proto=" << strproto(addr.proto) << (addr.tls ? ", tls" : ""); @@ -4474,8 +4518,7 @@ int configure_downstream_group(Config *config, bool http2_proxy, if (!g.mruby_file.empty()) { if (mruby::create_mruby_context(g.mruby_file) == nullptr) { LOG(config->ignore_per_pattern_mruby_error ? ERROR : FATAL) - << "backend: Could not compile mruby file for pattern " - << g.pattern; + << "backend: Could not compile mruby file for pattern " << g.pattern; if (!config->ignore_per_pattern_mruby_error) { return -1; } @@ -4528,9 +4571,9 @@ int configure_downstream_group(Config *config, bool http2_proxy, // for AF_UNIX socket, we use "localhost" as host for backend // hostport. This is used as Host header field to backend and // not going to be passed to any syscalls. - addr.hostport = StringRef::from_lit("localhost"); + addr.hostport = "localhost"_sr; - auto path = addr.host.c_str(); + auto path = addr.host.data(); auto pathlen = addr.host.size(); if (pathlen + 1 > sizeof(addr.addr.su.un.sun_path)) { @@ -4553,13 +4596,13 @@ int configure_downstream_group(Config *config, bool http2_proxy, } addr.hostport = - util::make_http_hostport(downstreamconf.balloc, addr.host, addr.port); + util::make_http_hostport(downstreamconf.balloc, addr.host, addr.port); auto hostport = - util::make_hostport(std::begin(hostport_buf), addr.host, addr.port); + util::make_hostport(std::begin(hostport_buf), addr.host, addr.port); if (!addr.dns) { - if (resolve_hostname(&addr.addr, addr.host.c_str(), addr.port, + if (resolve_hostname(&addr.addr, addr.host.data(), addr.port, downstreamconf.family, resolve_flags) == -1) { LOG(FATAL) << "Resolving backend address failed: " << hostport; return -1; @@ -4684,4 +4727,38 @@ int resolve_hostname(Address *addr, const char *hostname, uint16_t port, return 0; } +#ifdef ENABLE_HTTP3 +QUICKeyingMaterial::QUICKeyingMaterial(QUICKeyingMaterial &&other) noexcept + : cid_encryption_ctx{std::exchange(other.cid_encryption_ctx, nullptr)}, + cid_decryption_ctx{std::exchange(other.cid_decryption_ctx, nullptr)}, + reserved{other.reserved}, + secret{other.secret}, + salt{other.salt}, + cid_encryption_key{other.cid_encryption_key}, + id{other.id} {} + +QUICKeyingMaterial::~QUICKeyingMaterial() noexcept { + if (cid_encryption_ctx) { + EVP_CIPHER_CTX_free(cid_encryption_ctx); + } + + if (cid_decryption_ctx) { + EVP_CIPHER_CTX_free(cid_decryption_ctx); + } +} + +QUICKeyingMaterial & +QUICKeyingMaterial::operator=(QUICKeyingMaterial &&other) noexcept { + cid_encryption_ctx = std::exchange(other.cid_encryption_ctx, nullptr); + cid_decryption_ctx = std::exchange(other.cid_decryption_ctx, nullptr); + reserved = other.reserved; + secret = other.secret; + salt = other.salt; + cid_encryption_key = other.cid_encryption_key; + id = other.id; + + return *this; +} +#endif // ENABLE_HTTP3 + } // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_config.h b/lib/nghttp2-1.65.0/src/shrpx_config.h similarity index 69% rename from lib/nghttp2/src/shrpx_config.h rename to lib/nghttp2-1.65.0/src/shrpx_config.h index 0c43a3c267d..8cc3e559358 100644 --- a/lib/nghttp2/src/shrpx_config.h +++ b/lib/nghttp2-1.65.0/src/shrpx_config.h @@ -45,12 +45,20 @@ #include #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include #include +#include "shrpx_log.h" #include "shrpx_router.h" #if ENABLE_HTTP3 # include "shrpx_quic.h" @@ -74,341 +82,289 @@ class CertLookupTree; } // namespace tls -constexpr auto SHRPX_OPT_PRIVATE_KEY_FILE = - StringRef::from_lit("private-key-file"); -constexpr auto SHRPX_OPT_PRIVATE_KEY_PASSWD_FILE = - StringRef::from_lit("private-key-passwd-file"); -constexpr auto SHRPX_OPT_CERTIFICATE_FILE = - StringRef::from_lit("certificate-file"); -constexpr auto SHRPX_OPT_DH_PARAM_FILE = StringRef::from_lit("dh-param-file"); -constexpr auto SHRPX_OPT_SUBCERT = StringRef::from_lit("subcert"); -constexpr auto SHRPX_OPT_BACKEND = StringRef::from_lit("backend"); -constexpr auto SHRPX_OPT_FRONTEND = StringRef::from_lit("frontend"); -constexpr auto SHRPX_OPT_WORKERS = StringRef::from_lit("workers"); +constexpr auto SHRPX_OPT_PRIVATE_KEY_FILE = "private-key-file"_sr; +constexpr auto SHRPX_OPT_PRIVATE_KEY_PASSWD_FILE = "private-key-passwd-file"_sr; +constexpr auto SHRPX_OPT_CERTIFICATE_FILE = "certificate-file"_sr; +constexpr auto SHRPX_OPT_DH_PARAM_FILE = "dh-param-file"_sr; +constexpr auto SHRPX_OPT_SUBCERT = "subcert"_sr; +constexpr auto SHRPX_OPT_BACKEND = "backend"_sr; +constexpr auto SHRPX_OPT_FRONTEND = "frontend"_sr; +constexpr auto SHRPX_OPT_WORKERS = "workers"_sr; constexpr auto SHRPX_OPT_HTTP2_MAX_CONCURRENT_STREAMS = - StringRef::from_lit("http2-max-concurrent-streams"); -constexpr auto SHRPX_OPT_LOG_LEVEL = StringRef::from_lit("log-level"); -constexpr auto SHRPX_OPT_DAEMON = StringRef::from_lit("daemon"); -constexpr auto SHRPX_OPT_HTTP2_PROXY = StringRef::from_lit("http2-proxy"); -constexpr auto SHRPX_OPT_HTTP2_BRIDGE = StringRef::from_lit("http2-bridge"); -constexpr auto SHRPX_OPT_CLIENT_PROXY = StringRef::from_lit("client-proxy"); -constexpr auto SHRPX_OPT_ADD_X_FORWARDED_FOR = - StringRef::from_lit("add-x-forwarded-for"); + "http2-max-concurrent-streams"_sr; +constexpr auto SHRPX_OPT_LOG_LEVEL = "log-level"_sr; +constexpr auto SHRPX_OPT_DAEMON = "daemon"_sr; +constexpr auto SHRPX_OPT_HTTP2_PROXY = "http2-proxy"_sr; +constexpr auto SHRPX_OPT_HTTP2_BRIDGE = "http2-bridge"_sr; +constexpr auto SHRPX_OPT_CLIENT_PROXY = "client-proxy"_sr; +constexpr auto SHRPX_OPT_ADD_X_FORWARDED_FOR = "add-x-forwarded-for"_sr; constexpr auto SHRPX_OPT_STRIP_INCOMING_X_FORWARDED_FOR = - StringRef::from_lit("strip-incoming-x-forwarded-for"); -constexpr auto SHRPX_OPT_NO_VIA = StringRef::from_lit("no-via"); + "strip-incoming-x-forwarded-for"_sr; +constexpr auto SHRPX_OPT_NO_VIA = "no-via"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_READ_TIMEOUT = - StringRef::from_lit("frontend-http2-read-timeout"); -constexpr auto SHRPX_OPT_FRONTEND_READ_TIMEOUT = - StringRef::from_lit("frontend-read-timeout"); -constexpr auto SHRPX_OPT_FRONTEND_WRITE_TIMEOUT = - StringRef::from_lit("frontend-write-timeout"); -constexpr auto SHRPX_OPT_BACKEND_READ_TIMEOUT = - StringRef::from_lit("backend-read-timeout"); -constexpr auto SHRPX_OPT_BACKEND_WRITE_TIMEOUT = - StringRef::from_lit("backend-write-timeout"); -constexpr auto SHRPX_OPT_STREAM_READ_TIMEOUT = - StringRef::from_lit("stream-read-timeout"); -constexpr auto SHRPX_OPT_STREAM_WRITE_TIMEOUT = - StringRef::from_lit("stream-write-timeout"); -constexpr auto SHRPX_OPT_ACCESSLOG_FILE = StringRef::from_lit("accesslog-file"); -constexpr auto SHRPX_OPT_ACCESSLOG_SYSLOG = - StringRef::from_lit("accesslog-syslog"); -constexpr auto SHRPX_OPT_ACCESSLOG_FORMAT = - StringRef::from_lit("accesslog-format"); -constexpr auto SHRPX_OPT_ERRORLOG_FILE = StringRef::from_lit("errorlog-file"); -constexpr auto SHRPX_OPT_ERRORLOG_SYSLOG = - StringRef::from_lit("errorlog-syslog"); + "frontend-http2-read-timeout"_sr; +constexpr auto SHRPX_OPT_FRONTEND_READ_TIMEOUT = "frontend-read-timeout"_sr; +constexpr auto SHRPX_OPT_FRONTEND_WRITE_TIMEOUT = "frontend-write-timeout"_sr; +constexpr auto SHRPX_OPT_BACKEND_READ_TIMEOUT = "backend-read-timeout"_sr; +constexpr auto SHRPX_OPT_BACKEND_WRITE_TIMEOUT = "backend-write-timeout"_sr; +constexpr auto SHRPX_OPT_STREAM_READ_TIMEOUT = "stream-read-timeout"_sr; +constexpr auto SHRPX_OPT_STREAM_WRITE_TIMEOUT = "stream-write-timeout"_sr; +constexpr auto SHRPX_OPT_ACCESSLOG_FILE = "accesslog-file"_sr; +constexpr auto SHRPX_OPT_ACCESSLOG_SYSLOG = "accesslog-syslog"_sr; +constexpr auto SHRPX_OPT_ACCESSLOG_FORMAT = "accesslog-format"_sr; +constexpr auto SHRPX_OPT_ERRORLOG_FILE = "errorlog-file"_sr; +constexpr auto SHRPX_OPT_ERRORLOG_SYSLOG = "errorlog-syslog"_sr; constexpr auto SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT = - StringRef::from_lit("backend-keep-alive-timeout"); + "backend-keep-alive-timeout"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS = - StringRef::from_lit("frontend-http2-window-bits"); + "frontend-http2-window-bits"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS = - StringRef::from_lit("backend-http2-window-bits"); + "backend-http2-window-bits"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS = - StringRef::from_lit("frontend-http2-connection-window-bits"); + "frontend-http2-connection-window-bits"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_BITS = - StringRef::from_lit("backend-http2-connection-window-bits"); -constexpr auto SHRPX_OPT_FRONTEND_NO_TLS = - StringRef::from_lit("frontend-no-tls"); -constexpr auto SHRPX_OPT_BACKEND_NO_TLS = StringRef::from_lit("backend-no-tls"); -constexpr auto SHRPX_OPT_BACKEND_TLS_SNI_FIELD = - StringRef::from_lit("backend-tls-sni-field"); -constexpr auto SHRPX_OPT_PID_FILE = StringRef::from_lit("pid-file"); -constexpr auto SHRPX_OPT_USER = StringRef::from_lit("user"); -constexpr auto SHRPX_OPT_SYSLOG_FACILITY = - StringRef::from_lit("syslog-facility"); -constexpr auto SHRPX_OPT_BACKLOG = StringRef::from_lit("backlog"); -constexpr auto SHRPX_OPT_CIPHERS = StringRef::from_lit("ciphers"); -constexpr auto SHRPX_OPT_CLIENT = StringRef::from_lit("client"); -constexpr auto SHRPX_OPT_INSECURE = StringRef::from_lit("insecure"); -constexpr auto SHRPX_OPT_CACERT = StringRef::from_lit("cacert"); -constexpr auto SHRPX_OPT_BACKEND_IPV4 = StringRef::from_lit("backend-ipv4"); -constexpr auto SHRPX_OPT_BACKEND_IPV6 = StringRef::from_lit("backend-ipv6"); -constexpr auto SHRPX_OPT_BACKEND_HTTP_PROXY_URI = - StringRef::from_lit("backend-http-proxy-uri"); -constexpr auto SHRPX_OPT_READ_RATE = StringRef::from_lit("read-rate"); -constexpr auto SHRPX_OPT_READ_BURST = StringRef::from_lit("read-burst"); -constexpr auto SHRPX_OPT_WRITE_RATE = StringRef::from_lit("write-rate"); -constexpr auto SHRPX_OPT_WRITE_BURST = StringRef::from_lit("write-burst"); -constexpr auto SHRPX_OPT_WORKER_READ_RATE = - StringRef::from_lit("worker-read-rate"); -constexpr auto SHRPX_OPT_WORKER_READ_BURST = - StringRef::from_lit("worker-read-burst"); -constexpr auto SHRPX_OPT_WORKER_WRITE_RATE = - StringRef::from_lit("worker-write-rate"); -constexpr auto SHRPX_OPT_WORKER_WRITE_BURST = - StringRef::from_lit("worker-write-burst"); -constexpr auto SHRPX_OPT_NPN_LIST = StringRef::from_lit("npn-list"); -constexpr auto SHRPX_OPT_TLS_PROTO_LIST = StringRef::from_lit("tls-proto-list"); -constexpr auto SHRPX_OPT_VERIFY_CLIENT = StringRef::from_lit("verify-client"); -constexpr auto SHRPX_OPT_VERIFY_CLIENT_CACERT = - StringRef::from_lit("verify-client-cacert"); -constexpr auto SHRPX_OPT_CLIENT_PRIVATE_KEY_FILE = - StringRef::from_lit("client-private-key-file"); -constexpr auto SHRPX_OPT_CLIENT_CERT_FILE = - StringRef::from_lit("client-cert-file"); + "backend-http2-connection-window-bits"_sr; +constexpr auto SHRPX_OPT_FRONTEND_NO_TLS = "frontend-no-tls"_sr; +constexpr auto SHRPX_OPT_BACKEND_NO_TLS = "backend-no-tls"_sr; +constexpr auto SHRPX_OPT_BACKEND_TLS_SNI_FIELD = "backend-tls-sni-field"_sr; +constexpr auto SHRPX_OPT_PID_FILE = "pid-file"_sr; +constexpr auto SHRPX_OPT_USER = "user"_sr; +constexpr auto SHRPX_OPT_SYSLOG_FACILITY = "syslog-facility"_sr; +constexpr auto SHRPX_OPT_BACKLOG = "backlog"_sr; +constexpr auto SHRPX_OPT_CIPHERS = "ciphers"_sr; +constexpr auto SHRPX_OPT_CLIENT = "client"_sr; +constexpr auto SHRPX_OPT_INSECURE = "insecure"_sr; +constexpr auto SHRPX_OPT_CACERT = "cacert"_sr; +constexpr auto SHRPX_OPT_BACKEND_IPV4 = "backend-ipv4"_sr; +constexpr auto SHRPX_OPT_BACKEND_IPV6 = "backend-ipv6"_sr; +constexpr auto SHRPX_OPT_BACKEND_HTTP_PROXY_URI = "backend-http-proxy-uri"_sr; +constexpr auto SHRPX_OPT_READ_RATE = "read-rate"_sr; +constexpr auto SHRPX_OPT_READ_BURST = "read-burst"_sr; +constexpr auto SHRPX_OPT_WRITE_RATE = "write-rate"_sr; +constexpr auto SHRPX_OPT_WRITE_BURST = "write-burst"_sr; +constexpr auto SHRPX_OPT_WORKER_READ_RATE = "worker-read-rate"_sr; +constexpr auto SHRPX_OPT_WORKER_READ_BURST = "worker-read-burst"_sr; +constexpr auto SHRPX_OPT_WORKER_WRITE_RATE = "worker-write-rate"_sr; +constexpr auto SHRPX_OPT_WORKER_WRITE_BURST = "worker-write-burst"_sr; +constexpr auto SHRPX_OPT_NPN_LIST = "npn-list"_sr; +constexpr auto SHRPX_OPT_TLS_PROTO_LIST = "tls-proto-list"_sr; +constexpr auto SHRPX_OPT_VERIFY_CLIENT = "verify-client"_sr; +constexpr auto SHRPX_OPT_VERIFY_CLIENT_CACERT = "verify-client-cacert"_sr; +constexpr auto SHRPX_OPT_CLIENT_PRIVATE_KEY_FILE = "client-private-key-file"_sr; +constexpr auto SHRPX_OPT_CLIENT_CERT_FILE = "client-cert-file"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_DUMP_REQUEST_HEADER = - StringRef::from_lit("frontend-http2-dump-request-header"); + "frontend-http2-dump-request-header"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER = - StringRef::from_lit("frontend-http2-dump-response-header"); + "frontend-http2-dump-response-header"_sr; constexpr auto SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING = - StringRef::from_lit("http2-no-cookie-crumbling"); -constexpr auto SHRPX_OPT_FRONTEND_FRAME_DEBUG = - StringRef::from_lit("frontend-frame-debug"); -constexpr auto SHRPX_OPT_PADDING = StringRef::from_lit("padding"); -constexpr auto SHRPX_OPT_ALTSVC = StringRef::from_lit("altsvc"); -constexpr auto SHRPX_OPT_ADD_REQUEST_HEADER = - StringRef::from_lit("add-request-header"); -constexpr auto SHRPX_OPT_ADD_RESPONSE_HEADER = - StringRef::from_lit("add-response-header"); + "http2-no-cookie-crumbling"_sr; +constexpr auto SHRPX_OPT_FRONTEND_FRAME_DEBUG = "frontend-frame-debug"_sr; +constexpr auto SHRPX_OPT_PADDING = "padding"_sr; +constexpr auto SHRPX_OPT_ALTSVC = "altsvc"_sr; +constexpr auto SHRPX_OPT_ADD_REQUEST_HEADER = "add-request-header"_sr; +constexpr auto SHRPX_OPT_ADD_RESPONSE_HEADER = "add-response-header"_sr; constexpr auto SHRPX_OPT_WORKER_FRONTEND_CONNECTIONS = - StringRef::from_lit("worker-frontend-connections"); -constexpr auto SHRPX_OPT_NO_LOCATION_REWRITE = - StringRef::from_lit("no-location-rewrite"); -constexpr auto SHRPX_OPT_NO_HOST_REWRITE = - StringRef::from_lit("no-host-rewrite"); + "worker-frontend-connections"_sr; +constexpr auto SHRPX_OPT_NO_LOCATION_REWRITE = "no-location-rewrite"_sr; +constexpr auto SHRPX_OPT_NO_HOST_REWRITE = "no-host-rewrite"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_HOST = - StringRef::from_lit("backend-http1-connections-per-host"); + "backend-http1-connections-per-host"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND = - StringRef::from_lit("backend-http1-connections-per-frontend"); + "backend-http1-connections-per-frontend"_sr; constexpr auto SHRPX_OPT_LISTENER_DISABLE_TIMEOUT = - StringRef::from_lit("listener-disable-timeout"); -constexpr auto SHRPX_OPT_TLS_TICKET_KEY_FILE = - StringRef::from_lit("tls-ticket-key-file"); -constexpr auto SHRPX_OPT_RLIMIT_NOFILE = StringRef::from_lit("rlimit-nofile"); -constexpr auto SHRPX_OPT_BACKEND_REQUEST_BUFFER = - StringRef::from_lit("backend-request-buffer"); -constexpr auto SHRPX_OPT_BACKEND_RESPONSE_BUFFER = - StringRef::from_lit("backend-response-buffer"); -constexpr auto SHRPX_OPT_NO_SERVER_PUSH = StringRef::from_lit("no-server-push"); + "listener-disable-timeout"_sr; +constexpr auto SHRPX_OPT_TLS_TICKET_KEY_FILE = "tls-ticket-key-file"_sr; +constexpr auto SHRPX_OPT_RLIMIT_NOFILE = "rlimit-nofile"_sr; +constexpr auto SHRPX_OPT_BACKEND_REQUEST_BUFFER = "backend-request-buffer"_sr; +constexpr auto SHRPX_OPT_BACKEND_RESPONSE_BUFFER = "backend-response-buffer"_sr; +constexpr auto SHRPX_OPT_NO_SERVER_PUSH = "no-server-push"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP2_CONNECTIONS_PER_WORKER = - StringRef::from_lit("backend-http2-connections-per-worker"); + "backend-http2-connections-per-worker"_sr; constexpr auto SHRPX_OPT_FETCH_OCSP_RESPONSE_FILE = - StringRef::from_lit("fetch-ocsp-response-file"); -constexpr auto SHRPX_OPT_OCSP_UPDATE_INTERVAL = - StringRef::from_lit("ocsp-update-interval"); -constexpr auto SHRPX_OPT_NO_OCSP = StringRef::from_lit("no-ocsp"); -constexpr auto SHRPX_OPT_HEADER_FIELD_BUFFER = - StringRef::from_lit("header-field-buffer"); -constexpr auto SHRPX_OPT_MAX_HEADER_FIELDS = - StringRef::from_lit("max-header-fields"); -constexpr auto SHRPX_OPT_INCLUDE = StringRef::from_lit("include"); -constexpr auto SHRPX_OPT_TLS_TICKET_KEY_CIPHER = - StringRef::from_lit("tls-ticket-key-cipher"); -constexpr auto SHRPX_OPT_HOST_REWRITE = StringRef::from_lit("host-rewrite"); + "fetch-ocsp-response-file"_sr; +constexpr auto SHRPX_OPT_OCSP_UPDATE_INTERVAL = "ocsp-update-interval"_sr; +constexpr auto SHRPX_OPT_NO_OCSP = "no-ocsp"_sr; +constexpr auto SHRPX_OPT_HEADER_FIELD_BUFFER = "header-field-buffer"_sr; +constexpr auto SHRPX_OPT_MAX_HEADER_FIELDS = "max-header-fields"_sr; +constexpr auto SHRPX_OPT_INCLUDE = "include"_sr; +constexpr auto SHRPX_OPT_TLS_TICKET_KEY_CIPHER = "tls-ticket-key-cipher"_sr; +constexpr auto SHRPX_OPT_HOST_REWRITE = "host-rewrite"_sr; constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED = - StringRef::from_lit("tls-session-cache-memcached"); + "tls-session-cache-memcached"_sr; constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED = - StringRef::from_lit("tls-ticket-key-memcached"); + "tls-ticket-key-memcached"_sr; constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_INTERVAL = - StringRef::from_lit("tls-ticket-key-memcached-interval"); + "tls-ticket-key-memcached-interval"_sr; constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_MAX_RETRY = - StringRef::from_lit("tls-ticket-key-memcached-max-retry"); + "tls-ticket-key-memcached-max-retry"_sr; constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_MAX_FAIL = - StringRef::from_lit("tls-ticket-key-memcached-max-fail"); -constexpr auto SHRPX_OPT_MRUBY_FILE = StringRef::from_lit("mruby-file"); -constexpr auto SHRPX_OPT_ACCEPT_PROXY_PROTOCOL = - StringRef::from_lit("accept-proxy-protocol"); -constexpr auto SHRPX_OPT_FASTOPEN = StringRef::from_lit("fastopen"); + "tls-ticket-key-memcached-max-fail"_sr; +constexpr auto SHRPX_OPT_MRUBY_FILE = "mruby-file"_sr; +constexpr auto SHRPX_OPT_ACCEPT_PROXY_PROTOCOL = "accept-proxy-protocol"_sr; +constexpr auto SHRPX_OPT_FASTOPEN = "fastopen"_sr; constexpr auto SHRPX_OPT_TLS_DYN_REC_WARMUP_THRESHOLD = - StringRef::from_lit("tls-dyn-rec-warmup-threshold"); + "tls-dyn-rec-warmup-threshold"_sr; constexpr auto SHRPX_OPT_TLS_DYN_REC_IDLE_TIMEOUT = - StringRef::from_lit("tls-dyn-rec-idle-timeout"); -constexpr auto SHRPX_OPT_ADD_FORWARDED = StringRef::from_lit("add-forwarded"); + "tls-dyn-rec-idle-timeout"_sr; +constexpr auto SHRPX_OPT_ADD_FORWARDED = "add-forwarded"_sr; constexpr auto SHRPX_OPT_STRIP_INCOMING_FORWARDED = - StringRef::from_lit("strip-incoming-forwarded"); -constexpr auto SHRPX_OPT_FORWARDED_BY = StringRef::from_lit("forwarded-by"); -constexpr auto SHRPX_OPT_FORWARDED_FOR = StringRef::from_lit("forwarded-for"); + "strip-incoming-forwarded"_sr; +constexpr auto SHRPX_OPT_FORWARDED_BY = "forwarded-by"_sr; +constexpr auto SHRPX_OPT_FORWARDED_FOR = "forwarded-for"_sr; constexpr auto SHRPX_OPT_REQUEST_HEADER_FIELD_BUFFER = - StringRef::from_lit("request-header-field-buffer"); + "request-header-field-buffer"_sr; constexpr auto SHRPX_OPT_MAX_REQUEST_HEADER_FIELDS = - StringRef::from_lit("max-request-header-fields"); + "max-request-header-fields"_sr; constexpr auto SHRPX_OPT_RESPONSE_HEADER_FIELD_BUFFER = - StringRef::from_lit("response-header-field-buffer"); + "response-header-field-buffer"_sr; constexpr auto SHRPX_OPT_MAX_RESPONSE_HEADER_FIELDS = - StringRef::from_lit("max-response-header-fields"); + "max-response-header-fields"_sr; constexpr auto SHRPX_OPT_NO_HTTP2_CIPHER_BLOCK_LIST = - StringRef::from_lit("no-http2-cipher-block-list"); + "no-http2-cipher-block-list"_sr; constexpr auto SHRPX_OPT_NO_HTTP2_CIPHER_BLACK_LIST = - StringRef::from_lit("no-http2-cipher-black-list"); -constexpr auto SHRPX_OPT_BACKEND_HTTP1_TLS = - StringRef::from_lit("backend-http1-tls"); + "no-http2-cipher-black-list"_sr; +constexpr auto SHRPX_OPT_BACKEND_HTTP1_TLS = "backend-http1-tls"_sr; constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_TLS = - StringRef::from_lit("tls-session-cache-memcached-tls"); + "tls-session-cache-memcached-tls"_sr; constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_CERT_FILE = - StringRef::from_lit("tls-session-cache-memcached-cert-file"); + "tls-session-cache-memcached-cert-file"_sr; constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_PRIVATE_KEY_FILE = - StringRef::from_lit("tls-session-cache-memcached-private-key-file"); + "tls-session-cache-memcached-private-key-file"_sr; constexpr auto SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY = - StringRef::from_lit("tls-session-cache-memcached-address-family"); + "tls-session-cache-memcached-address-family"_sr; constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_TLS = - StringRef::from_lit("tls-ticket-key-memcached-tls"); + "tls-ticket-key-memcached-tls"_sr; constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_CERT_FILE = - StringRef::from_lit("tls-ticket-key-memcached-cert-file"); + "tls-ticket-key-memcached-cert-file"_sr; constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE = - StringRef::from_lit("tls-ticket-key-memcached-private-key-file"); + "tls-ticket-key-memcached-private-key-file"_sr; constexpr auto SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY = - StringRef::from_lit("tls-ticket-key-memcached-address-family"); -constexpr auto SHRPX_OPT_BACKEND_ADDRESS_FAMILY = - StringRef::from_lit("backend-address-family"); + "tls-ticket-key-memcached-address-family"_sr; +constexpr auto SHRPX_OPT_BACKEND_ADDRESS_FAMILY = "backend-address-family"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS = - StringRef::from_lit("frontend-http2-max-concurrent-streams"); + "frontend-http2-max-concurrent-streams"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS = - StringRef::from_lit("backend-http2-max-concurrent-streams"); + "backend-http2-max-concurrent-streams"_sr; constexpr auto SHRPX_OPT_BACKEND_CONNECTIONS_PER_FRONTEND = - StringRef::from_lit("backend-connections-per-frontend"); -constexpr auto SHRPX_OPT_BACKEND_TLS = StringRef::from_lit("backend-tls"); + "backend-connections-per-frontend"_sr; +constexpr auto SHRPX_OPT_BACKEND_TLS = "backend-tls"_sr; constexpr auto SHRPX_OPT_BACKEND_CONNECTIONS_PER_HOST = - StringRef::from_lit("backend-connections-per-host"); -constexpr auto SHRPX_OPT_ERROR_PAGE = StringRef::from_lit("error-page"); -constexpr auto SHRPX_OPT_NO_KQUEUE = StringRef::from_lit("no-kqueue"); + "backend-connections-per-host"_sr; +constexpr auto SHRPX_OPT_ERROR_PAGE = "error-page"_sr; +constexpr auto SHRPX_OPT_NO_KQUEUE = "no-kqueue"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_SETTINGS_TIMEOUT = - StringRef::from_lit("frontend-http2-settings-timeout"); + "frontend-http2-settings-timeout"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP2_SETTINGS_TIMEOUT = - StringRef::from_lit("backend-http2-settings-timeout"); -constexpr auto SHRPX_OPT_API_MAX_REQUEST_BODY = - StringRef::from_lit("api-max-request-body"); -constexpr auto SHRPX_OPT_BACKEND_MAX_BACKOFF = - StringRef::from_lit("backend-max-backoff"); -constexpr auto SHRPX_OPT_SERVER_NAME = StringRef::from_lit("server-name"); -constexpr auto SHRPX_OPT_NO_SERVER_REWRITE = - StringRef::from_lit("no-server-rewrite"); + "backend-http2-settings-timeout"_sr; +constexpr auto SHRPX_OPT_API_MAX_REQUEST_BODY = "api-max-request-body"_sr; +constexpr auto SHRPX_OPT_BACKEND_MAX_BACKOFF = "backend-max-backoff"_sr; +constexpr auto SHRPX_OPT_SERVER_NAME = "server-name"_sr; +constexpr auto SHRPX_OPT_NO_SERVER_REWRITE = "no-server-rewrite"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE = - StringRef::from_lit("frontend-http2-optimize-write-buffer-size"); + "frontend-http2-optimize-write-buffer-size"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_OPTIMIZE_WINDOW_SIZE = - StringRef::from_lit("frontend-http2-optimize-window-size"); + "frontend-http2-optimize-window-size"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_WINDOW_SIZE = - StringRef::from_lit("frontend-http2-window-size"); + "frontend-http2-window-size"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_CONNECTION_WINDOW_SIZE = - StringRef::from_lit("frontend-http2-connection-window-size"); + "frontend-http2-connection-window-size"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP2_WINDOW_SIZE = - StringRef::from_lit("backend-http2-window-size"); + "backend-http2-window-size"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP2_CONNECTION_WINDOW_SIZE = - StringRef::from_lit("backend-http2-connection-window-size"); + "backend-http2-connection-window-size"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE = - StringRef::from_lit("frontend-http2-encoder-dynamic-table-size"); + "frontend-http2-encoder-dynamic-table-size"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE = - StringRef::from_lit("frontend-http2-decoder-dynamic-table-size"); + "frontend-http2-decoder-dynamic-table-size"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE = - StringRef::from_lit("backend-http2-encoder-dynamic-table-size"); + "backend-http2-encoder-dynamic-table-size"_sr; constexpr auto SHRPX_OPT_BACKEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE = - StringRef::from_lit("backend-http2-decoder-dynamic-table-size"); -constexpr auto SHRPX_OPT_ECDH_CURVES = StringRef::from_lit("ecdh-curves"); -constexpr auto SHRPX_OPT_TLS_SCT_DIR = StringRef::from_lit("tls-sct-dir"); -constexpr auto SHRPX_OPT_BACKEND_CONNECT_TIMEOUT = - StringRef::from_lit("backend-connect-timeout"); -constexpr auto SHRPX_OPT_DNS_CACHE_TIMEOUT = - StringRef::from_lit("dns-cache-timeout"); -constexpr auto SHRPX_OPT_DNS_LOOKUP_TIMEOUT = - StringRef::from_lit("dns-lookup-timeout"); -constexpr auto SHRPX_OPT_DNS_MAX_TRY = StringRef::from_lit("dns-max-try"); + "backend-http2-decoder-dynamic-table-size"_sr; +constexpr auto SHRPX_OPT_ECDH_CURVES = "ecdh-curves"_sr; +constexpr auto SHRPX_OPT_TLS_SCT_DIR = "tls-sct-dir"_sr; +constexpr auto SHRPX_OPT_BACKEND_CONNECT_TIMEOUT = "backend-connect-timeout"_sr; +constexpr auto SHRPX_OPT_DNS_CACHE_TIMEOUT = "dns-cache-timeout"_sr; +constexpr auto SHRPX_OPT_DNS_LOOKUP_TIMEOUT = "dns-lookup-timeout"_sr; +constexpr auto SHRPX_OPT_DNS_MAX_TRY = "dns-max-try"_sr; constexpr auto SHRPX_OPT_FRONTEND_KEEP_ALIVE_TIMEOUT = - StringRef::from_lit("frontend-keep-alive-timeout"); -constexpr auto SHRPX_OPT_PSK_SECRETS = StringRef::from_lit("psk-secrets"); -constexpr auto SHRPX_OPT_CLIENT_PSK_SECRETS = - StringRef::from_lit("client-psk-secrets"); + "frontend-keep-alive-timeout"_sr; +constexpr auto SHRPX_OPT_PSK_SECRETS = "psk-secrets"_sr; +constexpr auto SHRPX_OPT_CLIENT_PSK_SECRETS = "client-psk-secrets"_sr; constexpr auto SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLOCK_LIST = - StringRef::from_lit("client-no-http2-cipher-block-list"); + "client-no-http2-cipher-block-list"_sr; constexpr auto SHRPX_OPT_CLIENT_NO_HTTP2_CIPHER_BLACK_LIST = - StringRef::from_lit("client-no-http2-cipher-black-list"); -constexpr auto SHRPX_OPT_CLIENT_CIPHERS = StringRef::from_lit("client-ciphers"); -constexpr auto SHRPX_OPT_ACCESSLOG_WRITE_EARLY = - StringRef::from_lit("accesslog-write-early"); -constexpr auto SHRPX_OPT_TLS_MIN_PROTO_VERSION = - StringRef::from_lit("tls-min-proto-version"); -constexpr auto SHRPX_OPT_TLS_MAX_PROTO_VERSION = - StringRef::from_lit("tls-max-proto-version"); -constexpr auto SHRPX_OPT_REDIRECT_HTTPS_PORT = - StringRef::from_lit("redirect-https-port"); -constexpr auto SHRPX_OPT_FRONTEND_MAX_REQUESTS = - StringRef::from_lit("frontend-max-requests"); -constexpr auto SHRPX_OPT_SINGLE_THREAD = StringRef::from_lit("single-thread"); -constexpr auto SHRPX_OPT_SINGLE_PROCESS = StringRef::from_lit("single-process"); + "client-no-http2-cipher-black-list"_sr; +constexpr auto SHRPX_OPT_CLIENT_CIPHERS = "client-ciphers"_sr; +constexpr auto SHRPX_OPT_ACCESSLOG_WRITE_EARLY = "accesslog-write-early"_sr; +constexpr auto SHRPX_OPT_TLS_MIN_PROTO_VERSION = "tls-min-proto-version"_sr; +constexpr auto SHRPX_OPT_TLS_MAX_PROTO_VERSION = "tls-max-proto-version"_sr; +constexpr auto SHRPX_OPT_REDIRECT_HTTPS_PORT = "redirect-https-port"_sr; +constexpr auto SHRPX_OPT_FRONTEND_MAX_REQUESTS = "frontend-max-requests"_sr; +constexpr auto SHRPX_OPT_SINGLE_THREAD = "single-thread"_sr; +constexpr auto SHRPX_OPT_SINGLE_PROCESS = "single-process"_sr; constexpr auto SHRPX_OPT_NO_ADD_X_FORWARDED_PROTO = - StringRef::from_lit("no-add-x-forwarded-proto"); + "no-add-x-forwarded-proto"_sr; constexpr auto SHRPX_OPT_NO_STRIP_INCOMING_X_FORWARDED_PROTO = - StringRef::from_lit("no-strip-incoming-x-forwarded-proto"); -constexpr auto SHRPX_OPT_OCSP_STARTUP = StringRef::from_lit("ocsp-startup"); -constexpr auto SHRPX_OPT_NO_VERIFY_OCSP = StringRef::from_lit("no-verify-ocsp"); + "no-strip-incoming-x-forwarded-proto"_sr; +constexpr auto SHRPX_OPT_OCSP_STARTUP = "ocsp-startup"_sr; +constexpr auto SHRPX_OPT_NO_VERIFY_OCSP = "no-verify-ocsp"_sr; constexpr auto SHRPX_OPT_VERIFY_CLIENT_TOLERATE_EXPIRED = - StringRef::from_lit("verify-client-tolerate-expired"); + "verify-client-tolerate-expired"_sr; constexpr auto SHRPX_OPT_IGNORE_PER_PATTERN_MRUBY_ERROR = - StringRef::from_lit("ignore-per-pattern-mruby-error"); + "ignore-per-pattern-mruby-error"_sr; constexpr auto SHRPX_OPT_TLS_NO_POSTPONE_EARLY_DATA = - StringRef::from_lit("tls-no-postpone-early-data"); -constexpr auto SHRPX_OPT_TLS_MAX_EARLY_DATA = - StringRef::from_lit("tls-max-early-data"); -constexpr auto SHRPX_OPT_TLS13_CIPHERS = StringRef::from_lit("tls13-ciphers"); -constexpr auto SHRPX_OPT_TLS13_CLIENT_CIPHERS = - StringRef::from_lit("tls13-client-ciphers"); + "tls-no-postpone-early-data"_sr; +constexpr auto SHRPX_OPT_TLS_MAX_EARLY_DATA = "tls-max-early-data"_sr; +constexpr auto SHRPX_OPT_TLS13_CIPHERS = "tls13-ciphers"_sr; +constexpr auto SHRPX_OPT_TLS13_CLIENT_CIPHERS = "tls13-client-ciphers"_sr; constexpr auto SHRPX_OPT_NO_STRIP_INCOMING_EARLY_DATA = - StringRef::from_lit("no-strip-incoming-early-data"); -constexpr auto SHRPX_OPT_QUIC_BPF_PROGRAM_FILE = - StringRef::from_lit("quic-bpf-program-file"); -constexpr auto SHRPX_OPT_NO_QUIC_BPF = StringRef::from_lit("no-quic-bpf"); -constexpr auto SHRPX_OPT_HTTP2_ALTSVC = StringRef::from_lit("http2-altsvc"); + "no-strip-incoming-early-data"_sr; +constexpr auto SHRPX_OPT_QUIC_BPF_PROGRAM_FILE = "quic-bpf-program-file"_sr; +constexpr auto SHRPX_OPT_NO_QUIC_BPF = "no-quic-bpf"_sr; +constexpr auto SHRPX_OPT_HTTP2_ALTSVC = "http2-altsvc"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP3_READ_TIMEOUT = - StringRef::from_lit("frontend-http3-read-timeout"); + "frontend-http3-read-timeout"_sr; constexpr auto SHRPX_OPT_FRONTEND_QUIC_IDLE_TIMEOUT = - StringRef::from_lit("frontend-quic-idle-timeout"); -constexpr auto SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG = - StringRef::from_lit("frontend-quic-debug-log"); + "frontend-quic-idle-timeout"_sr; +constexpr auto SHRPX_OPT_FRONTEND_QUIC_DEBUG_LOG = "frontend-quic-debug-log"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP3_WINDOW_SIZE = - StringRef::from_lit("frontend-http3-window-size"); + "frontend-http3-window-size"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP3_CONNECTION_WINDOW_SIZE = - StringRef::from_lit("frontend-http3-connection-window-size"); + "frontend-http3-connection-window-size"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP3_MAX_WINDOW_SIZE = - StringRef::from_lit("frontend-http3-max-window-size"); + "frontend-http3-max-window-size"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP3_MAX_CONNECTION_WINDOW_SIZE = - StringRef::from_lit("frontend-http3-max-connection-window-size"); + "frontend-http3-max-connection-window-size"_sr; constexpr auto SHRPX_OPT_FRONTEND_HTTP3_MAX_CONCURRENT_STREAMS = - StringRef::from_lit("frontend-http3-max-concurrent-streams"); + "frontend-http3-max-concurrent-streams"_sr; constexpr auto SHRPX_OPT_FRONTEND_QUIC_EARLY_DATA = - StringRef::from_lit("frontend-quic-early-data"); -constexpr auto SHRPX_OPT_FRONTEND_QUIC_QLOG_DIR = - StringRef::from_lit("frontend-quic-qlog-dir"); + "frontend-quic-early-data"_sr; +constexpr auto SHRPX_OPT_FRONTEND_QUIC_QLOG_DIR = "frontend-quic-qlog-dir"_sr; constexpr auto SHRPX_OPT_FRONTEND_QUIC_REQUIRE_TOKEN = - StringRef::from_lit("frontend-quic-require-token"); + "frontend-quic-require-token"_sr; constexpr auto SHRPX_OPT_FRONTEND_QUIC_CONGESTION_CONTROLLER = - StringRef::from_lit("frontend-quic-congestion-controller"); -constexpr auto SHRPX_OPT_QUIC_SERVER_ID = StringRef::from_lit("quic-server-id"); + "frontend-quic-congestion-controller"_sr; +constexpr auto SHRPX_OPT_QUIC_SERVER_ID = "quic-server-id"_sr; constexpr auto SHRPX_OPT_FRONTEND_QUIC_SECRET_FILE = - StringRef::from_lit("frontend-quic-secret-file"); -constexpr auto SHRPX_OPT_RLIMIT_MEMLOCK = StringRef::from_lit("rlimit-memlock"); -constexpr auto SHRPX_OPT_MAX_WORKER_PROCESSES = - StringRef::from_lit("max-worker-processes"); + "frontend-quic-secret-file"_sr; +constexpr auto SHRPX_OPT_RLIMIT_MEMLOCK = "rlimit-memlock"_sr; +constexpr auto SHRPX_OPT_MAX_WORKER_PROCESSES = "max-worker-processes"_sr; constexpr auto SHRPX_OPT_WORKER_PROCESS_GRACE_SHUTDOWN_PERIOD = - StringRef::from_lit("worker-process-grace-shutdown-period"); + "worker-process-grace-shutdown-period"_sr; constexpr auto SHRPX_OPT_FRONTEND_QUIC_INITIAL_RTT = - StringRef::from_lit("frontend-quic-initial-rtt"); -constexpr auto SHRPX_OPT_REQUIRE_HTTP_SCHEME = - StringRef::from_lit("require-http-scheme"); -constexpr auto SHRPX_OPT_TLS_KTLS = StringRef::from_lit("tls-ktls"); + "frontend-quic-initial-rtt"_sr; +constexpr auto SHRPX_OPT_REQUIRE_HTTP_SCHEME = "require-http-scheme"_sr; +constexpr auto SHRPX_OPT_TLS_KTLS = "tls-ktls"_sr; +constexpr auto SHRPX_OPT_ALPN_LIST = "alpn-list"_sr; +constexpr auto SHRPX_OPT_FRONTEND_HEADER_TIMEOUT = "frontend-header-timeout"_sr; +constexpr auto SHRPX_OPT_FRONTEND_HTTP2_IDLE_TIMEOUT = + "frontend-http2-idle-timeout"_sr; +constexpr auto SHRPX_OPT_FRONTEND_HTTP3_IDLE_TIMEOUT = + "frontend-http3-idle-timeout"_sr; constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8; -constexpr char DEFAULT_DOWNSTREAM_HOST[] = "127.0.0.1"; +constexpr auto DEFAULT_DOWNSTREAM_HOST = "127.0.0.1"_sr; constexpr int16_t DEFAULT_DOWNSTREAM_PORT = 80; enum class Proto { @@ -573,11 +529,11 @@ struct AffinityHash { struct DownstreamAddrGroupConfig { DownstreamAddrGroupConfig(const StringRef &pattern) - : pattern(pattern), - affinity{SessionAffinity::NONE}, - redirect_if_not_tls(false), - dnf{false}, - timeout{} {} + : pattern(pattern), + affinity{SessionAffinity::NONE}, + redirect_if_not_tls(false), + dnf{false}, + timeout{} {} StringRef pattern; StringRef mruby_file; @@ -624,9 +580,9 @@ struct TicketKeys { struct TLSCertificate { TLSCertificate(StringRef private_key_file, StringRef cert_file, std::vector sct_data) - : private_key_file(std::move(private_key_file)), - cert_file(std::move(cert_file)), - sct_data(std::move(sct_data)) {} + : private_key_file(std::move(private_key_file)), + cert_file(std::move(cert_file)), + sct_data(std::move(sct_data)) {} StringRef private_key_file; StringRef cert_file; @@ -635,6 +591,12 @@ struct TLSCertificate { #ifdef ENABLE_HTTP3 struct QUICKeyingMaterial { + QUICKeyingMaterial() noexcept = default; + QUICKeyingMaterial(QUICKeyingMaterial &&other) noexcept; + ~QUICKeyingMaterial() noexcept; + QUICKeyingMaterial &operator=(QUICKeyingMaterial &&other) noexcept; + EVP_CIPHER_CTX *cid_encryption_ctx; + EVP_CIPHER_CTX *cid_decryption_ctx; std::array reserved; std::array secret; std::array salt; @@ -753,9 +715,9 @@ struct TLSConfig { // The list of additional TLS certificate pair std::vector subcerts; std::vector alpn_prefs; - // list of supported NPN/ALPN protocol strings in the order of + // list of supported ALPN protocol strings in the order of // preference. - std::vector npn_list; + std::vector alpn_list; // list of supported SSL/TLS protocol strings. std::vector tls_proto_list; std::vector sct_data; @@ -809,7 +771,7 @@ struct QUICConfig { StringRef prog_file; bool disabled; } bpf; - std::array server_id; + uint32_t server_id; }; struct Http3Config { @@ -858,6 +820,9 @@ struct HttpConfig { struct { bool strip_incoming; } early_data; + struct { + ev_tstamp header; + } timeout; std::vector altsvcs; // altsvcs serialized in a wire format. StringRef altsvc_header_value; @@ -978,14 +943,14 @@ struct RouterConfig { struct DownstreamConfig { DownstreamConfig() - : balloc(1024, 1024), - timeout{}, - addr_group_catch_all{0}, - connections_per_host{0}, - connections_per_frontend{0}, - request_buffer_size{0}, - response_buffer_size{0}, - family{0} {} + : balloc(1024, 1024), + timeout{}, + addr_group_catch_all{0}, + connections_per_host{0}, + connections_per_frontend{0}, + request_buffer_size{0}, + response_buffer_size{0}, + family{0} {} DownstreamConfig(const DownstreamConfig &) = delete; DownstreamConfig(DownstreamConfig &&) = delete; @@ -1042,11 +1007,10 @@ struct ConnectionConfig { struct { struct { - ev_tstamp http2_read; - ev_tstamp http3_read; - ev_tstamp read; + ev_tstamp http2_idle; + ev_tstamp http3_idle; ev_tstamp write; - ev_tstamp idle_read; + ev_tstamp idle; } timeout; struct { RateLimitConfig read; @@ -1079,35 +1043,35 @@ struct DNSConfig { struct Config { Config() - : balloc(4096, 4096), - downstream_http_proxy{}, - http{}, - http2{}, - tls{}, + : balloc(4096, 4096), + downstream_http_proxy{}, + http{}, + http2{}, + tls{}, #ifdef ENABLE_HTTP3 - quic{}, + quic{}, #endif // ENABLE_HTTP3 - logging{}, - conn{}, - api{}, - dns{}, - config_revision{0}, - num_worker{0}, - padding{0}, - rlimit_nofile{0}, - rlimit_memlock{0}, - uid{0}, - gid{0}, - pid{0}, - verbose{false}, - daemon{false}, - http2_proxy{false}, - single_process{false}, - single_thread{false}, - ignore_per_pattern_mruby_error{false}, - ev_loop_flags{0}, - max_worker_processes{0}, - worker_process_grace_shutdown_period{0.} { + logging{}, + conn{}, + api{}, + dns{}, + config_revision{0}, + num_worker{0}, + padding{0}, + rlimit_nofile{0}, + rlimit_memlock{0}, + uid{0}, + gid{0}, + pid{0}, + verbose{false}, + daemon{false}, + http2_proxy{false}, + single_process{false}, + single_thread{false}, + ignore_per_pattern_mruby_error{false}, + ev_loop_flags{0}, + max_worker_processes{0}, + worker_process_grace_shutdown_period{0.} { } ~Config(); @@ -1183,6 +1147,7 @@ enum { SHRPX_OPTID_ADD_REQUEST_HEADER, SHRPX_OPTID_ADD_RESPONSE_HEADER, SHRPX_OPTID_ADD_X_FORWARDED_FOR, + SHRPX_OPTID_ALPN_LIST, SHRPX_OPTID_ALTSVC, SHRPX_OPTID_API_MAX_REQUEST_BODY, SHRPX_OPTID_BACKEND, @@ -1242,12 +1207,14 @@ enum { SHRPX_OPTID_FORWARDED_FOR, SHRPX_OPTID_FRONTEND, SHRPX_OPTID_FRONTEND_FRAME_DEBUG, + SHRPX_OPTID_FRONTEND_HEADER_TIMEOUT, SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS, SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_SIZE, SHRPX_OPTID_FRONTEND_HTTP2_DECODER_DYNAMIC_TABLE_SIZE, SHRPX_OPTID_FRONTEND_HTTP2_DUMP_REQUEST_HEADER, SHRPX_OPTID_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER, SHRPX_OPTID_FRONTEND_HTTP2_ENCODER_DYNAMIC_TABLE_SIZE, + SHRPX_OPTID_FRONTEND_HTTP2_IDLE_TIMEOUT, SHRPX_OPTID_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS, SHRPX_OPTID_FRONTEND_HTTP2_OPTIMIZE_WINDOW_SIZE, SHRPX_OPTID_FRONTEND_HTTP2_OPTIMIZE_WRITE_BUFFER_SIZE, @@ -1256,6 +1223,7 @@ enum { SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_BITS, SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_SIZE, SHRPX_OPTID_FRONTEND_HTTP3_CONNECTION_WINDOW_SIZE, + SHRPX_OPTID_FRONTEND_HTTP3_IDLE_TIMEOUT, SHRPX_OPTID_FRONTEND_HTTP3_MAX_CONCURRENT_STREAMS, SHRPX_OPTID_FRONTEND_HTTP3_MAX_CONNECTION_WINDOW_SIZE, SHRPX_OPTID_FRONTEND_HTTP3_MAX_WINDOW_SIZE, @@ -1374,8 +1342,8 @@ enum { SHRPX_OPTID_MAXIDX, }; -// Looks up token for given option name |name| of length |namelen|. -int option_lookup_token(const char *name, size_t namelen); +// Looks up token for given option name |name|. +int option_lookup_token(const StringRef &name); // Parses option name |opt| and value |optarg|. The results are // stored into the object pointed by |config|. This function returns 0 diff --git a/lib/nghttp2-1.65.0/src/shrpx_config_test.cc b/lib/nghttp2-1.65.0/src/shrpx_config_test.cc new file mode 100644 index 00000000000..4cbac91423c --- /dev/null +++ b/lib/nghttp2-1.65.0/src/shrpx_config_test.cc @@ -0,0 +1,268 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "shrpx_config_test.h" + +#ifdef HAVE_UNISTD_H +# include +#endif // HAVE_UNISTD_H + +#include + +#include "munitxx.h" + +#include "shrpx_config.h" +#include "shrpx_log.h" + +using namespace std::literals; + +namespace shrpx { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_shrpx_config_parse_header), + munit_void_test(test_shrpx_config_parse_log_format), + munit_void_test(test_shrpx_config_read_tls_ticket_key_file), + munit_void_test(test_shrpx_config_read_tls_ticket_key_file_aes_256), + munit_test_end(), +}; +} // namespace + +const MunitSuite config_suite{ + "/config_suite", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +void test_shrpx_config_parse_header(void) { + BlockAllocator balloc(4096, 4096); + + auto p = parse_header(balloc, "a: b"_sr); + assert_stdsv_equal("a"sv, p.name); + assert_stdsv_equal("b"sv, p.value); + + p = parse_header(balloc, "a: b"_sr); + assert_stdsv_equal("a"sv, p.name); + assert_stdsv_equal("b"sv, p.value); + + p = parse_header(balloc, ":a: b"_sr); + assert_true(p.name.empty()); + + p = parse_header(balloc, "a: :b"_sr); + assert_stdsv_equal("a"sv, p.name); + assert_stdsv_equal(":b"sv, p.value); + + p = parse_header(balloc, ": b"_sr); + assert_true(p.name.empty()); + + p = parse_header(balloc, "alpha: bravo charlie"_sr); + assert_stdsv_equal("alpha", p.name); + assert_stdsv_equal("bravo charlie", p.value); + + p = parse_header(balloc, "a,: b"_sr); + assert_true(p.name.empty()); + + p = parse_header(balloc, "a: b\x0a"_sr); + assert_true(p.name.empty()); +} + +void test_shrpx_config_parse_log_format(void) { + BlockAllocator balloc(4096, 4096); + + auto res = parse_log_format( + balloc, R"($remote_addr - $remote_user [$time_local] )" + R"("$request" $status $body_bytes_sent )" + R"("${http_referer}" $http_host "$http_user_agent")"_sr); + assert_size(16, ==, res.size()); + + assert_enum_class(LogFragmentType::REMOTE_ADDR, ==, res[0].type); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[1].type); + assert_stdsv_equal(" - $remote_user ["sv, res[1].value); + + assert_enum_class(LogFragmentType::TIME_LOCAL, ==, res[2].type); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[3].type); + assert_stdsv_equal("] \""sv, res[3].value); + + assert_enum_class(LogFragmentType::REQUEST, ==, res[4].type); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[5].type); + assert_stdsv_equal("\" "sv, res[5].value); + + assert_enum_class(LogFragmentType::STATUS, ==, res[6].type); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[7].type); + assert_stdsv_equal(" "sv, res[7].value); + + assert_enum_class(LogFragmentType::BODY_BYTES_SENT, ==, res[8].type); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[9].type); + assert_stdsv_equal(" \""sv, res[9].value); + + assert_enum_class(LogFragmentType::HTTP, ==, res[10].type); + assert_stdsv_equal("referer"sv, res[10].value); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[11].type); + assert_stdsv_equal("\" "sv, res[11].value); + + assert_enum_class(LogFragmentType::AUTHORITY, ==, res[12].type); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[13].type); + assert_stdsv_equal(" \""sv, res[13].value); + + assert_enum_class(LogFragmentType::HTTP, ==, res[14].type); + assert_stdsv_equal("user-agent"sv, res[14].value); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[15].type); + assert_stdsv_equal("\""sv, res[15].value); + + res = parse_log_format(balloc, "$"_sr); + + assert_size(1, ==, res.size()); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[0].type); + assert_stdsv_equal("$"sv, res[0].value); + + res = parse_log_format(balloc, "${"_sr); + + assert_size(1, ==, res.size()); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[0].type); + assert_stdsv_equal("${"sv, res[0].value); + + res = parse_log_format(balloc, "${a"_sr); + + assert_size(1, ==, res.size()); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[0].type); + assert_stdsv_equal("${a"sv, res[0].value); + + res = parse_log_format(balloc, "${a "_sr); + + assert_size(1, ==, res.size()); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[0].type); + assert_stdsv_equal("${a "sv, res[0].value); + + res = parse_log_format(balloc, "$$remote_addr"_sr); + + assert_size(2, ==, res.size()); + + assert_enum_class(LogFragmentType::LITERAL, ==, res[0].type); + assert_stdsv_equal("$"sv, res[0].value); + + assert_enum_class(LogFragmentType::REMOTE_ADDR, ==, res[1].type); + assert_stdsv_equal(""sv, res[1].value); +} + +void test_shrpx_config_read_tls_ticket_key_file(void) { + char file1[] = "/tmp/nghttpx-unittest.XXXXXX"; + auto fd1 = mkstemp(file1); + assert_int(-1, !=, fd1); + assert_ssize( + 48, ==, write(fd1, "0..............12..............34..............5", 48)); + char file2[] = "/tmp/nghttpx-unittest.XXXXXX"; + auto fd2 = mkstemp(file2); + assert_int(-1, !=, fd2); + assert_ssize( + 48, ==, write(fd2, "6..............78..............9a..............b", 48)); + + close(fd1); + close(fd2); + auto ticket_keys = read_tls_ticket_key_file( + {StringRef{file1}, StringRef{file2}}, EVP_aes_128_cbc(), EVP_sha256()); + unlink(file1); + unlink(file2); + assert_not_null(ticket_keys.get()); + assert_size(2, ==, ticket_keys->keys.size()); + auto key = &ticket_keys->keys[0]; + assert_true(std::equal(std::begin(key->data.name), std::end(key->data.name), + "0..............1")); + assert_true(std::equal(std::begin(key->data.enc_key), + std::begin(key->data.enc_key) + 16, + "2..............3")); + assert_true(std::equal(std::begin(key->data.hmac_key), + std::begin(key->data.hmac_key) + 16, + "4..............5")); + assert_size(16, ==, key->hmac_keylen); + + key = &ticket_keys->keys[1]; + assert_true(std::equal(std::begin(key->data.name), std::end(key->data.name), + "6..............7")); + assert_true(std::equal(std::begin(key->data.enc_key), + std::begin(key->data.enc_key) + 16, + "8..............9")); + assert_true(std::equal(std::begin(key->data.hmac_key), + std::begin(key->data.hmac_key) + 16, + "a..............b")); + assert_size(16, ==, key->hmac_keylen); +} + +void test_shrpx_config_read_tls_ticket_key_file_aes_256(void) { + char file1[] = "/tmp/nghttpx-unittest.XXXXXX"; + auto fd1 = mkstemp(file1); + assert_int(-1, !=, fd1); + assert_ssize(80, ==, + write(fd1, + "0..............12..............................34..." + "...........................5", + 80)); + char file2[] = "/tmp/nghttpx-unittest.XXXXXX"; + auto fd2 = mkstemp(file2); + assert_int(-1, !=, fd2); + assert_ssize(80, ==, + write(fd2, + "6..............78..............................9a..." + "...........................b", + 80)); + + close(fd1); + close(fd2); + auto ticket_keys = read_tls_ticket_key_file( + {StringRef{file1}, StringRef{file2}}, EVP_aes_256_cbc(), EVP_sha256()); + unlink(file1); + unlink(file2); + assert_not_null(ticket_keys.get()); + assert_size(2, ==, ticket_keys->keys.size()); + auto key = &ticket_keys->keys[0]; + assert_true(std::equal(std::begin(key->data.name), std::end(key->data.name), + "0..............1")); + assert_true(std::equal(std::begin(key->data.enc_key), + std::end(key->data.enc_key), + "2..............................3")); + assert_true(std::equal(std::begin(key->data.hmac_key), + std::end(key->data.hmac_key), + "4..............................5")); + + key = &ticket_keys->keys[1]; + assert_true(std::equal(std::begin(key->data.name), std::end(key->data.name), + "6..............7")); + assert_true(std::equal(std::begin(key->data.enc_key), + std::end(key->data.enc_key), + "8..............................9")); + assert_true(std::equal(std::begin(key->data.hmac_key), + std::end(key->data.hmac_key), + "a..............................b")); +} + +} // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_config_test.h b/lib/nghttp2-1.65.0/src/shrpx_config_test.h similarity index 79% rename from lib/nghttp2/src/shrpx_config_test.h rename to lib/nghttp2-1.65.0/src/shrpx_config_test.h index a30de41aa5f..9e51222a558 100644 --- a/lib/nghttp2/src/shrpx_config_test.h +++ b/lib/nghttp2-1.65.0/src/shrpx_config_test.h @@ -29,13 +29,18 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace shrpx { -void test_shrpx_config_parse_header(void); -void test_shrpx_config_parse_log_format(void); -void test_shrpx_config_read_tls_ticket_key_file(void); -void test_shrpx_config_read_tls_ticket_key_file_aes_256(void); -void test_shrpx_config_match_downstream_addr_group(void); +extern const MunitSuite config_suite; + +munit_void_test_decl(test_shrpx_config_parse_header) +munit_void_test_decl(test_shrpx_config_parse_log_format) +munit_void_test_decl(test_shrpx_config_read_tls_ticket_key_file) +munit_void_test_decl(test_shrpx_config_read_tls_ticket_key_file_aes_256) } // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_connect_blocker.cc b/lib/nghttp2-1.65.0/src/shrpx_connect_blocker.cc similarity index 91% rename from lib/nghttp2/src/shrpx_connect_blocker.cc rename to lib/nghttp2-1.65.0/src/shrpx_connect_blocker.cc index ff767b078ea..c382ece8ab1 100644 --- a/lib/nghttp2/src/shrpx_connect_blocker.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_connect_blocker.cc @@ -42,12 +42,12 @@ void connect_blocker_cb(struct ev_loop *loop, ev_timer *w, int revents) { ConnectBlocker::ConnectBlocker(std::mt19937 &gen, struct ev_loop *loop, std::function block_func, std::function unblock_func) - : gen_(gen), - block_func_(std::move(block_func)), - unblock_func_(std::move(unblock_func)), - loop_(loop), - fail_count_(0), - offline_(false) { + : gen_(gen), + block_func_(std::move(block_func)), + unblock_func_(std::move(unblock_func)), + loop_(loop), + fail_count_(0), + offline_(false) { ev_timer_init(&timer_, connect_blocker_cb, 0., 0.); timer_.data = this; } @@ -82,14 +82,14 @@ void ConnectBlocker::on_failure() { ++fail_count_; auto base_backoff = - util::int_pow(MULTIPLIER, std::min(MAX_BACKOFF_EXP, fail_count_)); + util::int_pow(MULTIPLIER, std::min(MAX_BACKOFF_EXP, fail_count_)); auto dist = std::uniform_real_distribution<>(-JITTER * base_backoff, JITTER * base_backoff); auto &downstreamconf = *get_config()->conn.downstream; auto backoff = - std::min(downstreamconf.timeout.max_backoff, base_backoff + dist(gen_)); + std::min(downstreamconf.timeout.max_backoff, base_backoff + dist(gen_)); LOG(WARN) << "Could not connect " << fail_count_ << " times in a row; sleep for " << backoff << " seconds"; diff --git a/lib/nghttp2/src/shrpx_connect_blocker.h b/lib/nghttp2-1.65.0/src/shrpx_connect_blocker.h similarity index 100% rename from lib/nghttp2/src/shrpx_connect_blocker.h rename to lib/nghttp2-1.65.0/src/shrpx_connect_blocker.h diff --git a/lib/nghttp2/src/shrpx_connection.cc b/lib/nghttp2-1.65.0/src/shrpx_connection.cc similarity index 83% rename from lib/nghttp2/src/shrpx_connection.cc rename to lib/nghttp2-1.65.0/src/shrpx_connection.cc index 28c25b18218..98c16a19905 100644 --- a/lib/nghttp2/src/shrpx_connection.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_connection.cc @@ -31,28 +31,26 @@ #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include "shrpx_tls.h" #include "shrpx_memcached_request.h" #include "shrpx_log.h" #include "memchunk.h" #include "util.h" -#include "ssl_compat.h" using namespace nghttp2; using namespace std::chrono_literals; namespace shrpx { -#if !LIBRESSL_3_5_API && !LIBRESSL_2_7_API && !OPENSSL_1_1_API - -void *BIO_get_data(BIO *bio) { return bio->ptr; } -void BIO_set_data(BIO *bio, void *ptr) { bio->ptr = ptr; } -void BIO_set_init(BIO *bio, int init) { bio->init = init; } - -#endif // !LIBRESSL_3_5_API && !LIBRESSL_2_7_API && !OPENSSL_1_1_API - Connection::Connection(struct ev_loop *loop, int fd, SSL *ssl, MemchunkPool *mcpool, ev_tstamp write_timeout, ev_tstamp read_timeout, @@ -61,21 +59,21 @@ Connection::Connection(struct ev_loop *loop, int fd, SSL *ssl, IOCb readcb, TimerCb timeoutcb, void *data, size_t tls_dyn_rec_warmup_threshold, ev_tstamp tls_dyn_rec_idle_timeout, Proto proto) - : + : #ifdef ENABLE_HTTP3 - conn_ref{nullptr, this}, + conn_ref{nullptr, this}, #endif // ENABLE_HTTP3 - tls{DefaultMemchunks(mcpool), DefaultPeekMemchunks(mcpool), - DefaultMemchunks(mcpool)}, - wlimit(loop, &wev, write_limit.rate, write_limit.burst), - rlimit(loop, &rev, read_limit.rate, read_limit.burst, this), - loop(loop), - data(data), - fd(fd), - tls_dyn_rec_warmup_threshold(tls_dyn_rec_warmup_threshold), - tls_dyn_rec_idle_timeout(util::duration_from(tls_dyn_rec_idle_timeout)), - proto(proto), - read_timeout(read_timeout) { + tls{DefaultMemchunks(mcpool), DefaultPeekMemchunks(mcpool), + DefaultMemchunks(mcpool)}, + wlimit(loop, &wev, write_limit.rate, write_limit.burst), + rlimit(loop, &rev, read_limit.rate, read_limit.burst, this), + loop(loop), + data(data), + fd(fd), + tls_dyn_rec_warmup_threshold(tls_dyn_rec_warmup_threshold), + tls_dyn_rec_idle_timeout(util::duration_from(tls_dyn_rec_idle_timeout)), + proto(proto), + read_timeout(read_timeout) { ev_io_init(&wev, writecb, fd, EV_WRITE); ev_io_init(&rev, readcb, proto == Proto::HTTP3 ? 0 : fd, EV_READ); @@ -154,17 +152,25 @@ void Connection::prepare_client_handshake() { } void Connection::prepare_server_handshake() { +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_BORINGSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) auto &tlsconf = get_config()->tls; if (proto != Proto::HTTP3 && !tlsconf.session_cache.memcached.host.empty()) { auto bio = BIO_new(tlsconf.bio_method); BIO_set_data(bio, this); SSL_set_bio(tls.ssl, bio, bio); } +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_BORINGSSL || + // NGHTTP2_OPENSSL_IS_LIBRESSL SSL_set_accept_state(tls.ssl); tls.server_handshake = true; } +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_BORINGSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) // BIO implementation is inspired by openldap implementation: // http://www.openldap.org/devel/cvsweb.cgi/~checkout~/libraries/libldap/tls_o.c namespace { @@ -263,14 +269,8 @@ long shrpx_bio_ctrl(BIO *b, int cmd, long num, void *ptr) { namespace { int shrpx_bio_create(BIO *b) { -#if OPENSSL_1_1_API || LIBRESSL_3_5_API BIO_set_init(b, 1); -#else // !OPENSSL_1_1_API && !LIBRESSL_3_5_API - b->init = 1; - b->num = 0; - b->ptr = nullptr; - b->flags = 0; -#endif // !OPENSSL_1_1_API && !LIBRESSL_3_5_API + return 1; } } // namespace @@ -281,18 +281,10 @@ int shrpx_bio_destroy(BIO *b) { return 0; } -#if !OPENSSL_1_1_API && !LIBRESSL_3_5_API - b->ptr = nullptr; - b->init = 0; - b->flags = 0; -#endif // !OPENSSL_1_1_API && !LIBRESSL_3_5_API - return 1; } } // namespace -#if OPENSSL_1_1_API || LIBRESSL_3_5_API - BIO_METHOD *create_bio_method() { auto meth = BIO_meth_new(BIO_TYPE_FD, "nghttpx-bio"); BIO_meth_set_write(meth, shrpx_bio_write); @@ -305,20 +297,8 @@ BIO_METHOD *create_bio_method() { return meth; } - -#else // !OPENSSL_1_1_API && !LIBRESSL_3_5_API - -BIO_METHOD *create_bio_method() { - static auto meth = new BIO_METHOD{ - BIO_TYPE_FD, "nghttpx-bio", shrpx_bio_write, - shrpx_bio_read, shrpx_bio_puts, shrpx_bio_gets, - shrpx_bio_ctrl, shrpx_bio_create, shrpx_bio_destroy, - }; - - return meth; -} - -#endif // !OPENSSL_1_1_API && !LIBRESSL_3_5_API +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_BORINGSSL || + // NGHTTP2_OPENSSL_IS_LIBRESSL void Connection::set_ssl(SSL *ssl) { tls.ssl = ssl; @@ -340,6 +320,9 @@ int Connection::tls_handshake() { wlimit.stopw(); ev_timer_stop(loop, &wt); +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL + return tls_handshake_simple(); +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL auto &tlsconf = get_config()->tls; if (!tls.server_handshake || tlsconf.session_cache.memcached.host.empty()) { @@ -407,7 +390,7 @@ int Connection::tls_handshake() { ERR_clear_error(); -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +# ifdef NGHTTP2_GENUINE_OPENSSL if (!tls.server_handshake || tls.early_data_finish) { rv = SSL_do_handshake(tls.ssl); } else { @@ -458,9 +441,9 @@ int Connection::tls_handshake() { } } } -#else // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +# else // !NGHTTP2_GENUINE_OPENSSL rv = SSL_do_handshake(tls.ssl); -#endif // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +# endif // !NGHTTP2_GENUINE_OPENSSL if (rv <= 0) { auto err = SSL_get_error(tls.ssl, rv); @@ -509,10 +492,10 @@ int Connection::tls_handshake() { // routine. We have to check HTTP/2 requirement if HTTP/2 was // negotiated before sending finished message to the peer. if ((rv != 1 -#ifdef NGHTTP2_OPENSSL_IS_BORINGSSL +# ifdef NGHTTP2_OPENSSL_IS_BORINGSSL || SSL_in_init(tls.ssl) -#endif // NGHTTP2_OPENSSL_IS_BORINGSSL - ) && +# endif // NGHTTP2_OPENSSL_IS_BORINGSSL + ) && tls.wbuf.rleft()) { // First write indicates that resumption stuff has done. if (tls.handshake_state != TLSHandshakeState::WRITE_STARTED) { @@ -549,7 +532,7 @@ int Connection::tls_handshake() { return SHRPX_ERR_INPROGRESS; } -#ifdef NGHTTP2_OPENSSL_IS_BORINGSSL +# ifdef NGHTTP2_OPENSSL_IS_BORINGSSL if (!tlsconf.no_postpone_early_data && SSL_in_early_data(tls.ssl) && SSL_in_init(tls.ssl)) { auto nread = SSL_read(tls.ssl, buf.data(), buf.size()); @@ -581,7 +564,7 @@ int Connection::tls_handshake() { return SHRPX_ERR_INPROGRESS; } } -#endif // NGHTTP2_OPENSSL_IS_BORINGSSL +# endif // NGHTTP2_OPENSSL_IS_BORINGSSL // Handshake was done @@ -596,6 +579,7 @@ int Connection::tls_handshake() { tls.initial_handshake_done = true; return write_tls_pending_handshake(); +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL } int Connection::tls_handshake_simple() { @@ -611,14 +595,17 @@ int Connection::tls_handshake_simple() { } int rv; -#if OPENSSL_1_1_1_API || defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_BORINGSSL) || \ + (defined(NGHTTP2_OPENSSL_IS_WOLFSSL) && defined(WOLFSSL_EARLY_DATA)) auto &tlsconf = get_config()->tls; std::array buf; -#endif // OPENSSL_1_1_1_API || defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_BORINGSSL || + // (NGHTTP2_OPENSSL_IS_WOLFSSL && WOLFSSL_EARLY_DATA) ERR_clear_error(); -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#ifdef NGHTTP2_GENUINE_OPENSSL if (!tls.server_handshake || tls.early_data_finish) { rv = SSL_do_handshake(tls.ssl); } else { @@ -663,9 +650,60 @@ int Connection::tls_handshake_simple() { } } } -#else // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +#elif defined(NGHTTP2_OPENSSL_IS_WOLFSSL) && defined(WOLFSSL_EARLY_DATA) + if (!tls.server_handshake || tls.early_data_finish) { + rv = SSL_do_handshake(tls.ssl); + } else { + for (;;) { + size_t nread = 0; + + rv = SSL_read_early_data(tls.ssl, buf.data(), buf.size(), &nread); + if (rv < 0) { + if (SSL_get_error(tls.ssl, rv) == SSL_ERROR_WANT_READ) { + if (tlsconf.no_postpone_early_data && tls.earlybuf.rleft()) { + rv = 1; + } + + break; + } + + /* It looks like we are here if there is no early data. */ + tls.early_data_finish = true; + + ERR_clear_error(); + rv = SSL_do_handshake(tls.ssl); + + break; + } + + if (LOG_ENABLED(INFO)) { + LOG(INFO) << "tls: read early data " << nread << " bytes"; + } + + tls.earlybuf.append(buf.data(), nread); + + if (rv == 0) { + if (LOG_ENABLED(INFO)) { + LOG(INFO) << "tls: read all early data; total " + << tls.earlybuf.rleft() << " bytes"; + } + tls.early_data_finish = true; + // The same reason stated above. + if (tlsconf.no_postpone_early_data && tls.earlybuf.rleft()) { + rv = 1; + } else { + ERR_clear_error(); + rv = SSL_do_handshake(tls.ssl); + } + break; + } + } + } +#else // !NGHTTP2_GENUINE_OPENSSL && !(NGHTTP2_OPENSSL_IS_WOLFSSL && + // WOLFSSL_EARLY_DATA) rv = SSL_do_handshake(tls.ssl); -#endif // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +#endif // !NGHTTP2_GENUINE_OPENSSL && !(NGHTTP2_OPENSSL_IS_WOLFSSL && + // WOLFSSL_EARLY_DATA) if (rv <= 0) { auto err = SSL_get_error(tls.ssl, rv); @@ -818,8 +856,8 @@ int Connection::write_tls_pending_handshake() { << " protocol=" << tls_info.protocol << " resumption=" << (tls_info.session_reused ? "yes" : "no") << " session_id=" - << util::format_hex(tls_info.session_id, - tls_info.session_id_length); + << util::format_hex(std::span{tls_info.session_id, + tls_info.session_id_length}); } } @@ -830,14 +868,7 @@ int Connection::check_http2_requirement() { const unsigned char *next_proto = nullptr; unsigned int next_proto_len; -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_get0_next_proto_negotiated(tls.ssl, &next_proto, &next_proto_len); -#endif // !OPENSSL_NO_NEXTPROTONEG -#if OPENSSL_VERSION_NUMBER >= 0x10002000L - if (next_proto == nullptr) { - SSL_get0_alpn_selected(tls.ssl, &next_proto, &next_proto_len); - } -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L + SSL_get0_alpn_selected(tls.ssl, &next_proto, &next_proto_len); if (next_proto == nullptr || !util::check_h2_is_selected(StringRef{next_proto, next_proto_len})) { return 0; @@ -873,7 +904,6 @@ constexpr size_t SHRPX_SMALL_WRITE_LIMIT = 1300; } // namespace size_t Connection::get_tls_write_limit() { - if (tls_dyn_rec_warmup_threshold == 0) { return std::numeric_limits::max(); } @@ -906,7 +936,7 @@ void Connection::start_tls_write_idle() { } } -ssize_t Connection::write_tls(const void *data, size_t len) { +nghttp2_ssize Connection::write_tls(const void *data, size_t len) { // SSL_write requires the same arguments (buf pointer and its // length) on SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. // get_write_limit() may return smaller length than previously @@ -928,11 +958,11 @@ ssize_t Connection::write_tls(const void *data, size_t len) { auto &tlsconf = get_config()->tls; auto via_bio = - tls.server_handshake && !tlsconf.session_cache.memcached.host.empty(); + tls.server_handshake && !tlsconf.session_cache.memcached.host.empty(); ERR_clear_error(); -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#ifdef NGHTTP2_GENUINE_OPENSSL int rv; if (SSL_is_init_finished(tls.ssl)) { rv = SSL_write(tls.ssl, data, len); @@ -944,9 +974,9 @@ ssize_t Connection::write_tls(const void *data, size_t len) { rv = nwrite; } } -#else // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +#else // !NGHTTP2_GENUINE_OPENSSL auto rv = SSL_write(tls.ssl, data, len); -#endif // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +#endif // !NGHTTP2_GENUINE_OPENSSL if (rv <= 0) { auto err = SSL_get_error(tls.ssl, rv); @@ -993,14 +1023,16 @@ ssize_t Connection::write_tls(const void *data, size_t len) { return rv; } -ssize_t Connection::read_tls(void *data, size_t len) { +nghttp2_ssize Connection::read_tls(void *data, size_t len) { ERR_clear_error(); -#if OPENSSL_1_1_1_API +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_BORINGSSL) || defined(NGHTTP2_OPENSSL_IS_WOLFSSL) if (tls.earlybuf.rleft()) { return tls.earlybuf.remove(data, len); } -#endif // OPENSSL_1_1_1_API +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_BORINGSSL || + // defined(NGHTTP2_OPENSSL_IS_WOLFSSL) // SSL_read requires the same arguments (buf pointer and its // length) on SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. @@ -1021,9 +1053,9 @@ ssize_t Connection::read_tls(void *data, size_t len) { auto &tlsconf = get_config()->tls; auto via_bio = - tls.server_handshake && !tlsconf.session_cache.memcached.host.empty(); + tls.server_handshake && !tlsconf.session_cache.memcached.host.empty(); -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#ifdef NGHTTP2_GENUINE_OPENSSL if (!tls.early_data_finish) { // TLSv1.3 handshake is still going on. size_t nread; @@ -1067,7 +1099,53 @@ ssize_t Connection::read_tls(void *data, size_t len) { return nread; } -#endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#endif // NGHTTP2_GENUINE_OPENSSL + +#if defined(NGHTTP2_OPENSSL_IS_WOLFSSL) && defined(WOLFSSL_EARLY_DATA) + if (!tls.early_data_finish) { + // TLSv1.3 handshake is still going on. + size_t nread = 0; + auto rv = SSL_read_early_data(tls.ssl, data, len, &nread); + if (rv < 0) { + auto err = SSL_get_error(tls.ssl, rv); + switch (err) { + case SSL_ERROR_WANT_READ: + tls.last_readlen = len; + return 0; + case SSL_ERROR_SSL: + if (LOG_ENABLED(INFO)) { + LOG(INFO) << "SSL_read: " + << ERR_error_string(ERR_get_error(), nullptr); + } + return SHRPX_ERR_NETWORK; + default: + if (LOG_ENABLED(INFO)) { + LOG(INFO) << "SSL_read: SSL_get_error returned " << err; + } + return SHRPX_ERR_NETWORK; + } + } + + if (LOG_ENABLED(INFO)) { + LOG(INFO) << "tls: read early data " << nread << " bytes"; + } + + if (rv == 0) { + if (LOG_ENABLED(INFO)) { + LOG(INFO) << "tls: read all early data"; + } + tls.early_data_finish = true; + // We may have stopped write watcher in write_tls. + wlimit.startw(); + } + + if (!via_bio) { + rlimit.drain(nread); + } + + return nread; + } +#endif // NGHTTP2_OPENSSL_IS_WOLFSSL && WOLFSSL_EARLY_DATA auto rv = SSL_read(tls.ssl, data, len); @@ -1104,7 +1182,7 @@ ssize_t Connection::read_tls(void *data, size_t len) { return rv; } -ssize_t Connection::write_clear(const void *data, size_t len) { +nghttp2_ssize Connection::write_clear(const void *data, size_t len) { len = std::min(len, wlimit.avail()); if (len == 0) { return 0; @@ -1131,7 +1209,7 @@ ssize_t Connection::write_clear(const void *data, size_t len) { return nwrite; } -ssize_t Connection::writev_clear(struct iovec *iov, int iovcnt) { +nghttp2_ssize Connection::writev_clear(struct iovec *iov, int iovcnt) { iovcnt = limit_iovec(iov, iovcnt, wlimit.avail()); if (iovcnt == 0) { return 0; @@ -1158,7 +1236,7 @@ ssize_t Connection::writev_clear(struct iovec *iov, int iovcnt) { return nwrite; } -ssize_t Connection::read_clear(void *data, size_t len) { +nghttp2_ssize Connection::read_clear(void *data, size_t len) { len = std::min(len, rlimit.avail()); if (len == 0) { return 0; @@ -1183,7 +1261,7 @@ ssize_t Connection::read_clear(void *data, size_t len) { return nread; } -ssize_t Connection::read_nolim_clear(void *data, size_t len) { +nghttp2_ssize Connection::read_nolim_clear(void *data, size_t len) { ssize_t nread; while ((nread = read(fd, data, len)) == -1 && errno == EINTR) ; @@ -1201,7 +1279,7 @@ ssize_t Connection::read_nolim_clear(void *data, size_t len) { return nread; } -ssize_t Connection::peek_clear(void *data, size_t len) { +nghttp2_ssize Connection::peek_clear(void *data, size_t len) { ssize_t nread; while ((nread = recv(fd, data, len, MSG_PEEK)) == -1 && errno == EINTR) ; @@ -1239,8 +1317,8 @@ int Connection::get_tcp_hint(TCPHint *hint) const { } auto avail_packets = tcp_info.tcpi_snd_cwnd > tcp_info.tcpi_unacked - ? tcp_info.tcpi_snd_cwnd - tcp_info.tcpi_unacked - : 0; + ? tcp_info.tcpi_snd_cwnd - tcp_info.tcpi_unacked + : 0; // http://www.slideshare.net/kazuho/programming-tcp-for-responsiveness @@ -1261,7 +1339,7 @@ int Connection::get_tcp_hint(TCPHint *hint) const { } auto writable_size = - (avail_packets + 2) * (tcp_info.tcpi_snd_mss - tls_overhead); + (avail_packets + 2) * (tcp_info.tcpi_snd_mss - tls_overhead); if (writable_size > 16_k) { writable_size = writable_size & ~(16_k - 1); } else { @@ -1306,7 +1384,7 @@ void Connection::again_rt() { bool Connection::expired_rt() { auto delta = read_timeout - util::ev_tstamp_from( - std::chrono::steady_clock::now() - last_read); + std::chrono::steady_clock::now() - last_read); if (delta < 1e-9) { return true; } diff --git a/lib/nghttp2/src/shrpx_connection.h b/lib/nghttp2-1.65.0/src/shrpx_connection.h similarity index 89% rename from lib/nghttp2/src/shrpx_connection.h rename to lib/nghttp2-1.65.0/src/shrpx_connection.h index 3a458488bb5..bd4bc14ce37 100644 --- a/lib/nghttp2/src/shrpx_connection.h +++ b/lib/nghttp2-1.65.0/src/shrpx_connection.h @@ -31,7 +31,16 @@ #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL + +#include #ifdef ENABLE_HTTP3 # include @@ -128,8 +137,8 @@ struct Connection { // underlying connection blocks), return 0. SHRPX_ERR_EOF is // returned in case of EOF and no data was read. Otherwise // SHRPX_ERR_NETWORK is return in case of error. - ssize_t write_tls(const void *data, size_t len); - ssize_t read_tls(void *data, size_t len); + nghttp2_ssize write_tls(const void *data, size_t len); + nghttp2_ssize read_tls(void *data, size_t len); size_t get_tls_write_limit(); // Updates the number of bytes written in warm up period. @@ -138,13 +147,13 @@ struct Connection { // determine fallback to short record size mode. void start_tls_write_idle(); - ssize_t write_clear(const void *data, size_t len); - ssize_t writev_clear(struct iovec *iov, int iovcnt); - ssize_t read_clear(void *data, size_t len); + nghttp2_ssize write_clear(const void *data, size_t len); + nghttp2_ssize writev_clear(struct iovec *iov, int iovcnt); + nghttp2_ssize read_clear(void *data, size_t len); // Read at most |len| bytes of data from socket without rate limit. - ssize_t read_nolim_clear(void *data, size_t len); + nghttp2_ssize read_nolim_clear(void *data, size_t len); // Peek at most |len| bytes of data from socket without rate limit. - ssize_t peek_clear(void *data, size_t len); + nghttp2_ssize peek_clear(void *data, size_t len); void handle_tls_pending_read(); @@ -158,7 +167,7 @@ struct Connection { // Restarts read timer with timeout value |t|. void again_rt(ev_tstamp t); - // Restarts read timer without chainging timeout. + // Restarts read timer without changing timeout. void again_rt(); // Returns true if read timer expired. bool expired_rt(); @@ -192,7 +201,7 @@ struct Connection { #ifdef ENABLE_HTTP3 static_assert(std::is_standard_layout::value, - "Conneciton is not standard layout"); + "Connection is not standard layout"); #endif // ENABLE_HTTP3 // Creates BIO_method shared by all SSL objects. diff --git a/lib/nghttp2/src/shrpx_connection_handler.cc b/lib/nghttp2-1.65.0/src/shrpx_connection_handler.cc similarity index 81% rename from lib/nghttp2/src/shrpx_connection_handler.cc rename to lib/nghttp2-1.65.0/src/shrpx_connection_handler.cc index 9d78e80e9e1..dc82e310815 100644 --- a/lib/nghttp2/src/shrpx_connection_handler.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_connection_handler.cc @@ -114,21 +114,21 @@ void serial_event_async_cb(struct ev_loop *loop, ev_async *w, int revent) { } // namespace ConnectionHandler::ConnectionHandler(struct ev_loop *loop, std::mt19937 &gen) - : + : #ifdef ENABLE_HTTP3 - quic_ipc_fd_(-1), + quic_ipc_fd_(-1), #endif // ENABLE_HTTP3 - gen_(gen), - single_worker_(nullptr), - loop_(loop), + gen_(gen), + single_worker_(nullptr), + loop_(loop), #ifdef HAVE_NEVERBLEED - nb_(nullptr), + nb_(nullptr), #endif // HAVE_NEVERBLEED - tls_ticket_key_memcached_get_retry_count_(0), - tls_ticket_key_memcached_fail_count_(0), - worker_round_robin_cnt_(get_config()->api.enabled ? 1 : 0), - graceful_shutdown_(false), - enable_acceptor_on_ocsp_completion_(false) { + tls_ticket_key_memcached_get_retry_count_(0), + tls_ticket_key_memcached_fail_count_(0), + worker_round_robin_cnt_(get_config()->api.enabled ? 1 : 0), + graceful_shutdown_(false), + enable_acceptor_on_ocsp_completion_(false) { ev_timer_init(&disable_acceptor_timer_, acceptor_disable_cb, 0., 0.); disable_acceptor_timer_.data = this; @@ -169,7 +169,7 @@ ConnectionHandler::~ConnectionHandler() { } auto tls_ctx_data = - static_cast(SSL_CTX_get_app_data(ssl_ctx)); + static_cast(SSL_CTX_get_app_data(ssl_ctx)); delete tls_ctx_data; SSL_CTX_free(ssl_ctx); } @@ -177,7 +177,7 @@ ConnectionHandler::~ConnectionHandler() { for (auto ssl_ctx : all_ssl_ctx_) { auto tls_ctx_data = - static_cast(SSL_CTX_get_app_data(ssl_ctx)); + static_cast(SSL_CTX_get_app_data(ssl_ctx)); delete tls_ctx_data; SSL_CTX_free(ssl_ctx); } @@ -191,7 +191,7 @@ ConnectionHandler::~ConnectionHandler() { } void ConnectionHandler::set_ticket_keys_to_worker( - const std::shared_ptr &ticket_keys) { + const std::shared_ptr &ticket_keys) { for (auto &worker : workers_) { worker->set_ticket_keys(ticket_keys); } @@ -208,7 +208,7 @@ void ConnectionHandler::worker_reopen_log_files() { } void ConnectionHandler::worker_replace_downstream( - std::shared_ptr downstreamconf) { + std::shared_ptr downstreamconf) { for (auto &worker : workers_) { WorkerEvent wev{}; @@ -222,27 +222,27 @@ void ConnectionHandler::worker_replace_downstream( int ConnectionHandler::create_single_worker() { cert_tree_ = tls::create_cert_lookup_tree(); auto sv_ssl_ctx = tls::setup_server_ssl_context( - all_ssl_ctx_, indexed_ssl_ctx_, cert_tree_.get() + all_ssl_ctx_, indexed_ssl_ctx_, cert_tree_.get() #ifdef HAVE_NEVERBLEED - , - nb_ + , + nb_ #endif // HAVE_NEVERBLEED ); #ifdef ENABLE_HTTP3 quic_cert_tree_ = tls::create_cert_lookup_tree(); auto quic_sv_ssl_ctx = tls::setup_quic_server_ssl_context( - quic_all_ssl_ctx_, quic_indexed_ssl_ctx_, quic_cert_tree_.get() + quic_all_ssl_ctx_, quic_indexed_ssl_ctx_, quic_cert_tree_.get() # ifdef HAVE_NEVERBLEED - , - nb_ + , + nb_ # endif // HAVE_NEVERBLEED ); #endif // ENABLE_HTTP3 auto cl_ssl_ctx = tls::setup_downstream_client_ssl_context( #ifdef HAVE_NEVERBLEED - nb_ + nb_ #endif // HAVE_NEVERBLEED ); @@ -262,10 +262,10 @@ int ConnectionHandler::create_single_worker() { if (memcachedconf.tls) { session_cache_ssl_ctx = tls::create_ssl_client_context( #ifdef HAVE_NEVERBLEED - nb_, + nb_, #endif // HAVE_NEVERBLEED - tlsconf.cacert, memcachedconf.cert_file, - memcachedconf.private_key_file, nullptr); + tlsconf.cacert, memcachedconf.cert_file, + memcachedconf.private_key_file); all_ssl_ctx_.push_back(session_cache_ssl_ctx); #ifdef ENABLE_HTTP3 quic_all_ssl_ctx_.push_back(nullptr); @@ -278,20 +278,19 @@ int ConnectionHandler::create_single_worker() { #endif // ENABLE_HTTP3 && HAVE_LIBBPF #ifdef ENABLE_HTTP3 - assert(cid_prefixes_.size() == 1); - const auto &cid_prefix = cid_prefixes_[0]; + assert(worker_ids_.size() == 1); + const auto &wid = worker_ids_[0]; #endif // ENABLE_HTTP3 single_worker_ = std::make_unique( - loop_, sv_ssl_ctx, cl_ssl_ctx, session_cache_ssl_ctx, cert_tree_.get(), + loop_, sv_ssl_ctx, cl_ssl_ctx, session_cache_ssl_ctx, cert_tree_.get(), #ifdef ENABLE_HTTP3 - quic_sv_ssl_ctx, quic_cert_tree_.get(), cid_prefix.data(), - cid_prefix.size(), + quic_sv_ssl_ctx, quic_cert_tree_.get(), wid, # ifdef HAVE_LIBBPF - /* index = */ 0, + /* index = */ 0, # endif // HAVE_LIBBPF #endif // ENABLE_HTTP3 - ticket_keys_, this, config->conn.downstream); + ticket_keys_, this, config->conn.downstream); #ifdef HAVE_MRUBY if (single_worker_->create_mruby_context() != 0) { return -1; @@ -313,27 +312,27 @@ int ConnectionHandler::create_worker_thread(size_t num) { cert_tree_ = tls::create_cert_lookup_tree(); auto sv_ssl_ctx = tls::setup_server_ssl_context( - all_ssl_ctx_, indexed_ssl_ctx_, cert_tree_.get() + all_ssl_ctx_, indexed_ssl_ctx_, cert_tree_.get() # ifdef HAVE_NEVERBLEED - , - nb_ + , + nb_ # endif // HAVE_NEVERBLEED ); # ifdef ENABLE_HTTP3 quic_cert_tree_ = tls::create_cert_lookup_tree(); auto quic_sv_ssl_ctx = tls::setup_quic_server_ssl_context( - quic_all_ssl_ctx_, quic_indexed_ssl_ctx_, quic_cert_tree_.get() + quic_all_ssl_ctx_, quic_indexed_ssl_ctx_, quic_cert_tree_.get() # ifdef HAVE_NEVERBLEED - , - nb_ + , + nb_ # endif // HAVE_NEVERBLEED ); # endif // ENABLE_HTTP3 auto cl_ssl_ctx = tls::setup_downstream_client_ssl_context( # ifdef HAVE_NEVERBLEED - nb_ + nb_ # endif // HAVE_NEVERBLEED ); @@ -364,10 +363,10 @@ int ConnectionHandler::create_worker_thread(size_t num) { if (memcachedconf.tls) { session_cache_ssl_ctx = tls::create_ssl_client_context( # ifdef HAVE_NEVERBLEED - nb_, + nb_, # endif // HAVE_NEVERBLEED - tlsconf.cacert, memcachedconf.cert_file, - memcachedconf.private_key_file, nullptr); + tlsconf.cacert, memcachedconf.cert_file, + memcachedconf.private_key_file); all_ssl_ctx_.push_back(session_cache_ssl_ctx); # ifdef ENABLE_HTTP3 quic_all_ssl_ctx_.push_back(nullptr); @@ -376,26 +375,25 @@ int ConnectionHandler::create_worker_thread(size_t num) { } # ifdef ENABLE_HTTP3 - assert(cid_prefixes_.size() == num); + assert(worker_ids_.size() == num); # endif // ENABLE_HTTP3 for (size_t i = 0; i < num; ++i) { auto loop = ev_loop_new(config->ev_loop_flags); # ifdef ENABLE_HTTP3 - const auto &cid_prefix = cid_prefixes_[i]; + const auto &wid = worker_ids_[i]; # endif // ENABLE_HTTP3 auto worker = std::make_unique( - loop, sv_ssl_ctx, cl_ssl_ctx, session_cache_ssl_ctx, cert_tree_.get(), + loop, sv_ssl_ctx, cl_ssl_ctx, session_cache_ssl_ctx, cert_tree_.get(), # ifdef ENABLE_HTTP3 - quic_sv_ssl_ctx, quic_cert_tree_.get(), cid_prefix.data(), - cid_prefix.size(), + quic_sv_ssl_ctx, quic_cert_tree_.get(), wid, # ifdef HAVE_LIBBPF - i, + i, # endif // HAVE_LIBBPF # endif // ENABLE_HTTP3 - ticket_keys_, this, config->conn.downstream); + ticket_keys_, this, config->conn.downstream); # ifdef HAVE_MRUBY if (worker->create_mruby_context() != 0) { return -1; @@ -484,7 +482,6 @@ int ConnectionHandler::handle_connection(int fd, sockaddr *addr, int addrlen, auto &upstreamconf = config->conn.upstream; if (single_worker_->get_worker_stat()->num_connections >= upstreamconf.worker_connections) { - if (LOG_ENABLED(INFO)) { LLOG(INFO, this) << "Too many connections >=" << upstreamconf.worker_connections; @@ -495,7 +492,7 @@ int ConnectionHandler::handle_connection(int fd, sockaddr *addr, int addrlen, } auto client = - tls::accept_connection(single_worker_.get(), fd, addr, addrlen, faddr); + tls::accept_connection(single_worker_.get(), fd, addr, addrlen, faddr); if (!client) { LLOG(ERROR, this) << "ClientHandler creation failed"; @@ -586,7 +583,7 @@ void ConnectionHandler::accept_pending_connection() { } void ConnectionHandler::set_ticket_keys( - std::shared_ptr ticket_keys) { + std::shared_ptr ticket_keys) { ticket_keys_ = std::move(ticket_keys); if (single_worker_) { single_worker_->set_ticket_keys(ticket_keys_); @@ -648,9 +645,8 @@ int ConnectionHandler::start_ocsp_update(const char *cert_file) { assert(!ev_is_active(&ocsp_.chldev)); char *const argv[] = { - const_cast( - get_config()->tls.ocsp.fetch_ocsp_response_file.c_str()), - const_cast(cert_file), nullptr}; + const_cast(get_config()->tls.ocsp.fetch_ocsp_response_file.data()), + const_cast(cert_file), nullptr}; Process proc; rv = exec_read_command(proc, argv); @@ -709,7 +705,7 @@ void ConnectionHandler::handle_ocsp_complete() { auto ssl_ctx = all_ssl_ctx_[ocsp_.next]; auto tls_ctx_data = - static_cast(SSL_CTX_get_app_data(ssl_ctx)); + static_cast(SSL_CTX_get_app_data(ssl_ctx)); auto rstatus = ocsp_.chldev.rstatus; auto status = WEXITSTATUS(rstatus); @@ -739,40 +735,29 @@ void ConnectionHandler::handle_ocsp_complete() { // that case we get nullptr. auto quic_ssl_ctx = quic_all_ssl_ctx_[ocsp_.next]; if (quic_ssl_ctx) { -# ifndef NGHTTP2_OPENSSL_IS_BORINGSSL - auto quic_tls_ctx_data = static_cast( - SSL_CTX_get_app_data(quic_ssl_ctx)); -# ifdef HAVE_ATOMIC_STD_SHARED_PTR - std::atomic_store_explicit( - &quic_tls_ctx_data->ocsp_data, - std::make_shared>(ocsp_.resp), - std::memory_order_release); -# else // !HAVE_ATOMIC_STD_SHARED_PTR + auto quic_tls_ctx_data = + static_cast(SSL_CTX_get_app_data(quic_ssl_ctx)); +# ifdef HAVE_ATOMIC_STD_SHARED_PTR + quic_tls_ctx_data->ocsp_data.store( + std::make_shared>(ocsp_.resp), + std::memory_order_release); +# else // !HAVE_ATOMIC_STD_SHARED_PTR std::lock_guard g(quic_tls_ctx_data->mu); quic_tls_ctx_data->ocsp_data = - std::make_shared>(ocsp_.resp); -# endif // !HAVE_ATOMIC_STD_SHARED_PTR -# else // NGHTTP2_OPENSSL_IS_BORINGSSL - SSL_CTX_set_ocsp_response(quic_ssl_ctx, ocsp_.resp.data(), - ocsp_.resp.size()); -# endif // NGHTTP2_OPENSSL_IS_BORINGSSL + std::make_shared>(ocsp_.resp); +# endif // !HAVE_ATOMIC_STD_SHARED_PTR } #endif // ENABLE_HTTP3 -#ifndef NGHTTP2_OPENSSL_IS_BORINGSSL -# ifdef HAVE_ATOMIC_STD_SHARED_PTR - std::atomic_store_explicit( - &tls_ctx_data->ocsp_data, - std::make_shared>(std::move(ocsp_.resp)), - std::memory_order_release); -# else // !HAVE_ATOMIC_STD_SHARED_PTR +#ifdef HAVE_ATOMIC_STD_SHARED_PTR + tls_ctx_data->ocsp_data.store( + std::make_shared>(std::move(ocsp_.resp)), + std::memory_order_release); +#else // !HAVE_ATOMIC_STD_SHARED_PTR std::lock_guard g(tls_ctx_data->mu); tls_ctx_data->ocsp_data = - std::make_shared>(std::move(ocsp_.resp)); -# endif // !HAVE_ATOMIC_STD_SHARED_PTR -#else // NGHTTP2_OPENSSL_IS_BORINGSSL - SSL_CTX_set_ocsp_response(ssl_ctx, ocsp_.resp.data(), ocsp_.resp.size()); -#endif // NGHTTP2_OPENSSL_IS_BORINGSSL + std::make_shared>(std::move(ocsp_.resp)); +#endif // !HAVE_ATOMIC_STD_SHARED_PTR } ++ocsp_.next; @@ -809,7 +794,7 @@ void ConnectionHandler::proceed_next_cert_ocsp() { auto ssl_ctx = all_ssl_ctx_[ocsp_.next]; auto tls_ctx_data = - static_cast(SSL_CTX_get_app_data(ssl_ctx)); + static_cast(SSL_CTX_get_app_data(ssl_ctx)); // client SSL_CTX is also included in all_ssl_ctx_, but has no // tls_ctx_data. @@ -830,7 +815,7 @@ void ConnectionHandler::proceed_next_cert_ocsp() { } void ConnectionHandler::set_tls_ticket_key_memcached_dispatcher( - std::unique_ptr dispatcher) { + std::unique_ptr dispatcher) { tls_ticket_key_memcached_dispatcher_ = std::move(dispatcher); } @@ -858,16 +843,16 @@ void ConnectionHandler::on_tls_ticket_key_network_error(ev_timer *w) { } auto base_backoff = util::int_pow( - MULTIPLIER, - std::min(MAX_BACKOFF_EXP, tls_ticket_key_memcached_get_retry_count_)); + MULTIPLIER, + std::min(MAX_BACKOFF_EXP, tls_ticket_key_memcached_get_retry_count_)); auto dist = std::uniform_real_distribution<>(-JITTER * base_backoff, JITTER * base_backoff); auto backoff = base_backoff + dist(gen_); LOG(WARN) - << "Memcached: tls ticket get failed due to network error, retrying in " - << backoff << " seconds"; + << "Memcached: tls ticket get failed due to network error, retrying in " + << backoff << " seconds"; ev_timer_set(w, backoff, 0.); ev_timer_start(loop_, w); @@ -891,7 +876,7 @@ void ConnectionHandler::on_tls_ticket_key_not_found(ev_timer *w) { } void ConnectionHandler::on_tls_ticket_key_get_success( - const std::shared_ptr &ticket_keys, ev_timer *w) { + const std::shared_ptr &ticket_keys, ev_timer *w) { LOG(NOTICE) << "Memcached: tls ticket get success"; tls_ticket_key_memcached_get_retry_count_ = 0; @@ -921,7 +906,7 @@ void ConnectionHandler::on_tls_ticket_key_get_success( } void ConnectionHandler::schedule_next_tls_ticket_key_memcached_get( - ev_timer *w) { + ev_timer *w) { ev_timer_set(w, get_config()->tls.ticket.memcached.interval, 0.); ev_timer_start(loop_, w); } @@ -933,10 +918,9 @@ SSL_CTX *ConnectionHandler::create_tls_ticket_key_memcached_ssl_ctx() { auto ssl_ctx = tls::create_ssl_client_context( #ifdef HAVE_NEVERBLEED - nb_, + nb_, #endif // HAVE_NEVERBLEED - tlsconf.cacert, memcachedconf.cert_file, memcachedconf.private_key_file, - nullptr); + tlsconf.cacert, memcachedconf.cert_file, memcachedconf.private_key_file); all_ssl_ctx_.push_back(ssl_ctx); #ifdef ENABLE_HTTP3 @@ -980,9 +964,9 @@ void ConnectionHandler::handle_serial_event() { } void ConnectionHandler::send_replace_downstream( - const std::shared_ptr &downstreamconf) { + const std::shared_ptr &downstreamconf) { send_serial_event( - SerialEvent(SerialEventType::REPLACE_DOWNSTREAM, downstreamconf)); + SerialEvent(SerialEventType::REPLACE_DOWNSTREAM, downstreamconf)); } void ConnectionHandler::send_serial_event(SerialEvent ev) { @@ -1016,33 +1000,31 @@ void ConnectionHandler::set_enable_acceptor_on_ocsp_completion(bool f) { } #ifdef ENABLE_HTTP3 -int ConnectionHandler::forward_quic_packet( - const UpstreamAddr *faddr, const Address &remote_addr, - const Address &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *cid_prefix, const uint8_t *data, size_t datalen) { +int ConnectionHandler::forward_quic_packet(const UpstreamAddr *faddr, + const Address &remote_addr, + const Address &local_addr, + const ngtcp2_pkt_info &pi, + const WorkerID &wid, + std::span data) { assert(!get_config()->single_thread); - for (auto &worker : workers_) { - if (!std::equal(cid_prefix, cid_prefix + SHRPX_QUIC_CID_PREFIXLEN, - worker->get_cid_prefix())) { - continue; - } - - WorkerEvent wev{}; - wev.type = WorkerEventType::QUIC_PKT_FORWARD; - wev.quic_pkt = std::make_unique(faddr->index, remote_addr, - local_addr, pi, data, datalen); + auto worker = find_worker(wid); + if (worker == nullptr) { + return -1; + } - worker->send(std::move(wev)); + WorkerEvent wev{}; + wev.type = WorkerEventType::QUIC_PKT_FORWARD; + wev.quic_pkt = std::make_unique(faddr->index, remote_addr, + local_addr, pi, data); - return 0; - } + worker->send(std::move(wev)); - return -1; + return 0; } void ConnectionHandler::set_quic_keying_materials( - std::shared_ptr qkms) { + std::shared_ptr qkms) { quic_keying_materials_ = std::move(qkms); } @@ -1051,22 +1033,40 @@ ConnectionHandler::get_quic_keying_materials() const { return quic_keying_materials_; } -void ConnectionHandler::set_cid_prefixes( - const std::vector> - &cid_prefixes) { - cid_prefixes_ = cid_prefixes; +void ConnectionHandler::set_worker_ids(std::vector worker_ids) { + worker_ids_ = std::move(worker_ids); } -QUICLingeringWorkerProcess * -ConnectionHandler::match_quic_lingering_worker_process_cid_prefix( - const uint8_t *dcid, size_t dcidlen) { - assert(dcidlen >= SHRPX_QUIC_CID_PREFIXLEN); +namespace { +ssize_t find_worker_index(const std::vector &worker_ids, + const WorkerID &wid) { + assert(!worker_ids.empty()); + + if (wid.server != worker_ids[0].server || + wid.worker_process != worker_ids[0].worker_process || + wid.thread >= worker_ids.size()) { + return -1; + } + + return wid.thread; +} +} // namespace + +Worker *ConnectionHandler::find_worker(const WorkerID &wid) const { + auto idx = find_worker_index(worker_ids_, wid); + if (idx == -1) { + return nullptr; + } + + return workers_[idx].get(); +} +QUICLingeringWorkerProcess * +ConnectionHandler::match_quic_lingering_worker_process_worker_id( + const WorkerID &wid) { for (auto &lwps : quic_lingering_worker_processes_) { - for (auto &cid_prefix : lwps.cid_prefixes) { - if (std::equal(std::begin(cid_prefix), std::end(cid_prefix), dcid)) { - return &lwps; - } + if (find_worker_index(lwps.worker_ids, wid) != -1) { + return &lwps; } } @@ -1096,14 +1096,14 @@ void ConnectionHandler::unload_bpf_objects() { void ConnectionHandler::set_quic_ipc_fd(int fd) { quic_ipc_fd_ = fd; } void ConnectionHandler::set_quic_lingering_worker_processes( - const std::vector &quic_lwps) { + const std::vector &quic_lwps) { quic_lingering_worker_processes_ = quic_lwps; } int ConnectionHandler::forward_quic_packet_to_lingering_worker_process( - QUICLingeringWorkerProcess *quic_lwp, const Address &remote_addr, - const Address &local_addr, const ngtcp2_pkt_info &pi, const uint8_t *data, - size_t datalen) { + QUICLingeringWorkerProcess *quic_lwp, const Address &remote_addr, + const Address &local_addr, const ngtcp2_pkt_info &pi, + std::span data) { std::array header; assert(header.size() >= 1 + 1 + 1 + 1 + sizeof(sockaddr_storage) * 2); @@ -1122,14 +1122,14 @@ int ConnectionHandler::forward_quic_packet_to_lingering_worker_process( *p++ = pi.ecn; iovec msg_iov[] = { - { - .iov_base = header.data(), - .iov_len = static_cast(p - header.data()), - }, - { - .iov_base = const_cast(data), - .iov_len = datalen, - }, + { + .iov_base = header.data(), + .iov_len = static_cast(p - header.data()), + }, + { + .iov_base = const_cast(data.data()), + .iov_len = data.size(), + }, }; msghdr msg{}; @@ -1277,41 +1277,36 @@ int ConnectionHandler::quic_ipc_read() { // Ignore return value quic_conn_handler->handle_packet(faddr, pkt->remote_addr, pkt->local_addr, - pkt->pi, pkt->data.data(), - pkt->data.size()); + pkt->pi, pkt->data); return 0; } auto &qkm = quic_keying_materials_->keying_materials.front(); - std::array decrypted_dcid; + ConnectionID decrypted_dcid; - if (decrypt_quic_connection_id(decrypted_dcid.data(), - vc.dcid + SHRPX_QUIC_CID_PREFIX_OFFSET, - qkm.cid_encryption_key.data()) != 0) { + if (decrypt_quic_connection_id(decrypted_dcid, + vc.dcid + SHRPX_QUIC_CID_WORKER_ID_OFFSET, + qkm.cid_decryption_ctx) != 0) { return -1; } - for (auto &worker : workers_) { - if (!std::equal(std::begin(decrypted_dcid), - std::begin(decrypted_dcid) + SHRPX_QUIC_CID_PREFIXLEN, - worker->get_cid_prefix())) { - continue; + auto worker = find_worker(decrypted_dcid.worker); + if (worker == nullptr) { + if (LOG_ENABLED(INFO)) { + LOG(INFO) << "No worker to match Worker ID"; } - WorkerEvent wev{ - .type = WorkerEventType::QUIC_PKT_FORWARD, - .quic_pkt = std::move(pkt), - }; - worker->send(std::move(wev)); - return 0; } - if (LOG_ENABLED(INFO)) { - LOG(INFO) << "No worker to match CID prefix"; - } + WorkerEvent wev{ + .type = WorkerEventType::QUIC_PKT_FORWARD, + .quic_pkt = std::move(pkt), + }; + + worker->send(std::move(wev)); return 0; } diff --git a/lib/nghttp2/src/shrpx_connection_handler.h b/lib/nghttp2-1.65.0/src/shrpx_connection_handler.h similarity index 87% rename from lib/nghttp2/src/shrpx_connection_handler.h rename to lib/nghttp2-1.65.0/src/shrpx_connection_handler.h index f3748ab678e..dc0a5ef0ff2 100644 --- a/lib/nghttp2/src/shrpx_connection_handler.h +++ b/lib/nghttp2-1.65.0/src/shrpx_connection_handler.h @@ -44,7 +44,14 @@ # include #endif // HAVE_LIBBPF -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include @@ -97,7 +104,7 @@ struct SerialEvent { // ctor for event uses DownstreamConfig SerialEvent(SerialEventType type, const std::shared_ptr &downstreamconf) - : type(type), downstreamconf(downstreamconf) {} + : type(type), downstreamconf(downstreamconf) {} SerialEventType type; std::shared_ptr downstreamconf; @@ -108,7 +115,7 @@ struct SerialEvent { struct BPFRef { bpf_object *obj; bpf_map *reuseport_array; - bpf_map *cid_prefix_map; + bpf_map *worker_id_map; }; # endif // HAVE_LIBBPF @@ -121,12 +128,10 @@ enum class QUICIPCType { // WorkerProcesses which are in graceful shutdown period. struct QUICLingeringWorkerProcess { - QUICLingeringWorkerProcess( - std::vector> cid_prefixes, - int quic_ipc_fd) - : cid_prefixes{std::move(cid_prefixes)}, quic_ipc_fd{quic_ipc_fd} {} + QUICLingeringWorkerProcess(std::vector worker_ids, int quic_ipc_fd) + : worker_ids{std::move(worker_ids)}, quic_ipc_fd{quic_ipc_fd} {} - std::vector> cid_prefixes; + std::vector worker_ids; // Socket to send QUIC IPC message to this worker process. int quic_ipc_fd; }; @@ -177,7 +182,7 @@ class ConnectionHandler { void proceed_next_cert_ocsp(); void set_tls_ticket_key_memcached_dispatcher( - std::unique_ptr dispatcher); + std::unique_ptr dispatcher); MemcachedDispatcher *get_tls_ticket_key_memcached_dispatcher() const; void on_tls_ticket_key_network_error(ev_timer *w); @@ -197,30 +202,27 @@ class ConnectionHandler { int forward_quic_packet(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *cid_prefix, const uint8_t *data, - size_t datalen); + const WorkerID &wid, std::span data); void set_quic_keying_materials(std::shared_ptr qkms); const std::shared_ptr &get_quic_keying_materials() const; - void set_cid_prefixes( - const std::vector> - &cid_prefixes); + void set_worker_ids(std::vector worker_ids); + Worker *find_worker(const WorkerID &wid) const; void set_quic_lingering_worker_processes( - const std::vector &quic_lwps); + const std::vector &quic_lwps); - // Return matching QUICLingeringWorkerProcess which has a CID prefix + // Return matching QUICLingeringWorkerProcess which has a Worker ID // such that |dcid| starts with it. If no such // QUICLingeringWorkerProcess, it returns nullptr. QUICLingeringWorkerProcess * - match_quic_lingering_worker_process_cid_prefix(const uint8_t *dcid, - size_t dcidlen); + match_quic_lingering_worker_process_worker_id(const WorkerID &wid); int forward_quic_packet_to_lingering_worker_process( - QUICLingeringWorkerProcess *quic_lwp, const Address &remote_addr, - const Address &local_addr, const ngtcp2_pkt_info &pi, const uint8_t *data, - size_t datalen); + QUICLingeringWorkerProcess *quic_lwp, const Address &remote_addr, + const Address &local_addr, const ngtcp2_pkt_info &pi, + std::span data); void set_quic_ipc_fd(int fd); @@ -239,7 +241,7 @@ class ConnectionHandler { // Send SerialEvent SerialEventType::REPLACE_DOWNSTREAM to this // object. void send_replace_downstream( - const std::shared_ptr &downstreamconf); + const std::shared_ptr &downstreamconf); // Internal function to send |ev| to this object. void send_serial_event(SerialEvent ev); // Handles SerialEvents received. @@ -260,9 +262,8 @@ class ConnectionHandler { // and signature algorithm presented by client. std::vector> indexed_ssl_ctx_; #ifdef ENABLE_HTTP3 - std::vector> cid_prefixes_; - std::vector> - lingering_cid_prefixes_; + std::vector worker_ids_; + std::vector lingering_worker_ids_; int quic_ipc_fd_; std::vector quic_lingering_worker_processes_; # ifdef HAVE_LIBBPF diff --git a/lib/nghttp2/src/shrpx_dns_resolver.cc b/lib/nghttp2-1.65.0/src/shrpx_dns_resolver.cc similarity index 85% rename from lib/nghttp2/src/shrpx_dns_resolver.cc rename to lib/nghttp2-1.65.0/src/shrpx_dns_resolver.cc index f83ecb786a9..4028ff36fa2 100644 --- a/lib/nghttp2/src/shrpx_dns_resolver.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_dns_resolver.cc @@ -55,9 +55,11 @@ void sock_state_cb(void *data, int s, int read, int write) { } // namespace namespace { -void host_cb(void *arg, int status, int timeouts, hostent *hostent) { +void addrinfo_cb(void *arg, int status, int timeouts, ares_addrinfo *result) { auto resolv = static_cast(arg); - resolv->on_result(status, hostent); + resolv->on_result(status, result); + + ares_freeaddrinfo(result); } } // namespace @@ -115,11 +117,11 @@ void stop_ev(struct ev_loop *loop, } // namespace DNSResolver::DNSResolver(struct ev_loop *loop) - : result_{}, - loop_(loop), - channel_(nullptr), - family_(AF_UNSPEC), - status_(DNSResolverStatus::IDLE) { + : result_{}, + loop_(loop), + channel_(nullptr), + family_(AF_UNSPEC), + status_(DNSResolverStatus::IDLE) { ev_timer_init(&timer_, timeoutcb, 0., 0.); timer_.data = this; } @@ -173,7 +175,10 @@ int DNSResolver::resolve(const StringRef &name, int family) { channel_ = chan; status_ = DNSResolverStatus::RUNNING; - ares_gethostbyname(channel_, name_.c_str(), family_, host_cb, this); + ares_addrinfo_hints hints{}; + hints.ai_family = family_; + + ares_getaddrinfo(channel_, name_.data(), nullptr, &hints, addrinfo_cb, this); reset_timeout(); return 0; @@ -285,7 +290,7 @@ void DNSResolver::start_wev(int fd) { void DNSResolver::stop_wev(int fd) { stop_ev(wevs_, loop_, fd, EV_WRITE); } -void DNSResolver::on_result(int status, hostent *hostent) { +void DNSResolver::on_result(int status, ares_addrinfo *ai) { stop_ev(loop_, revs_); stop_ev(loop_, wevs_); ev_timer_stop(loop_, &timer_); @@ -299,40 +304,44 @@ void DNSResolver::on_result(int status, hostent *hostent) { return; } - auto ap = *hostent->h_addr_list; + auto ap = ai->nodes; + + for (; ap; ap = ap->ai_next) { + switch (ap->ai_family) { + case AF_INET: + status_ = DNSResolverStatus::OK; + result_.len = sizeof(result_.su.in); + + assert(sizeof(result_.su.in) == ap->ai_addrlen); + + memcpy(&result_.su.in, ap->ai_addr, sizeof(result_.su.in)); + + break; + case AF_INET6: + status_ = DNSResolverStatus::OK; + result_.len = sizeof(result_.su.in6); + + assert(sizeof(result_.su.in6) == ap->ai_addrlen); + + memcpy(&result_.su.in6, ap->ai_addr, sizeof(result_.su.in6)); + + break; + default: + continue; + } + + break; + } + if (!ap) { if (LOG_ENABLED(INFO)) { - LOG(INFO) << "Name lookup for " << name_ << "failed: no address returned"; + LOG(INFO) << "Name lookup for " << name_ + << " failed: no address returned"; } status_ = DNSResolverStatus::ERROR; return; } - switch (hostent->h_addrtype) { - case AF_INET: - status_ = DNSResolverStatus::OK; - result_.len = sizeof(result_.su.in); - result_.su.in = {}; - result_.su.in.sin_family = AF_INET; -#ifdef HAVE_SOCKADDR_IN_SIN_LEN - result_.su.in.sin_len = sizeof(result_.su.in); -#endif // HAVE_SOCKADDR_IN_SIN_LEN - memcpy(&result_.su.in.sin_addr, ap, sizeof(result_.su.in.sin_addr)); - break; - case AF_INET6: - status_ = DNSResolverStatus::OK; - result_.len = sizeof(result_.su.in6); - result_.su.in6 = {}; - result_.su.in6.sin6_family = AF_INET6; -#ifdef HAVE_SOCKADDR_IN6_SIN6_LEN - result_.su.in6.sin6_len = sizeof(result_.su.in6); -#endif // HAVE_SOCKADDR_IN6_SIN6_LEN - memcpy(&result_.su.in6.sin6_addr, ap, sizeof(result_.su.in6.sin6_addr)); - break; - default: - assert(0); - } - if (status_ == DNSResolverStatus::OK) { if (LOG_ENABLED(INFO)) { LOG(INFO) << "Name lookup succeeded: " << name_ << " -> " diff --git a/lib/nghttp2/src/shrpx_dns_resolver.h b/lib/nghttp2-1.65.0/src/shrpx_dns_resolver.h similarity index 96% rename from lib/nghttp2/src/shrpx_dns_resolver.h rename to lib/nghttp2-1.65.0/src/shrpx_dns_resolver.h index e622f99625a..c09c2820a0e 100644 --- a/lib/nghttp2/src/shrpx_dns_resolver.h +++ b/lib/nghttp2-1.65.0/src/shrpx_dns_resolver.h @@ -64,7 +64,7 @@ enum class DNSResolverStatus { // result. In other words, callback is called if get_status() returns // DNSResolverStatus::RUNNING. using CompleteCb = - std::function; + std::function; // DNSResolver is asynchronous name resolver, backed by c-ares // library. @@ -88,7 +88,7 @@ class DNSResolver { int on_write(int fd); int on_timeout(); // Calls this function when DNS query finished. - void on_result(int status, hostent *hostent); + void on_result(int status, ares_addrinfo *result); void reset_timeout(); void start_rev(int fd); diff --git a/lib/nghttp2/src/shrpx_dns_tracker.cc b/lib/nghttp2-1.65.0/src/shrpx_dns_tracker.cc similarity index 89% rename from lib/nghttp2/src/shrpx_dns_tracker.cc rename to lib/nghttp2-1.65.0/src/shrpx_dns_tracker.cc index 57387ce72b2..6211c101e71 100644 --- a/lib/nghttp2/src/shrpx_dns_tracker.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_dns_tracker.cc @@ -37,7 +37,7 @@ void gccb(struct ev_loop *loop, ev_timer *w, int revents) { } // namespace DNSTracker::DNSTracker(struct ev_loop *loop, int family) - : loop_(loop), family_(family) { + : loop_(loop), family_(family) { ev_timer_init(&gc_timer_, gccb, 0., 12_h); gc_timer_.data = this; } @@ -116,7 +116,7 @@ DNSResolverStatus DNSTracker::resolve(Address *result, DNSQuery *dnsq) { auto resolv = std::make_unique(loop_, family_); auto host_copy = - ImmutableString{std::begin(dnsq->host), std::end(dnsq->host)}; + ImmutableString{std::begin(dnsq->host), std::end(dnsq->host)}; auto host = StringRef{host_copy}; rv = resolv->resolve(host); @@ -158,9 +158,9 @@ DNSResolverStatus DNSTracker::resolve(Address *result, DNSQuery *dnsq) { return DNSResolverStatus::OK; case DNSResolverStatus::RUNNING: { - auto p = ents_.emplace(host, - make_entry(std::move(resolv), std::move(host_copy), - DNSResolverStatus::RUNNING, nullptr)); + auto p = + ents_.emplace(host, make_entry(std::move(resolv), std::move(host_copy), + DNSResolverStatus::RUNNING, nullptr)); start_gc_timer(); @@ -256,27 +256,27 @@ DNSResolverStatus DNSTracker::resolve(Address *result, DNSQuery *dnsq) { void DNSTracker::add_to_qlist(ResolverEntry &ent, DNSQuery *dnsq) { ent.resolv->set_complete_cb( - [&ent](DNSResolverStatus status, const Address *result) { - auto &qlist = ent.qlist; - while (!qlist.empty()) { - auto head = qlist.head; - qlist.remove(head); - head->status = status; - head->in_qlist = false; - auto cb = head->cb; - cb(status, result); - } - - auto &dnsconf = get_config()->dns; - - ent.resolv.reset(); - ent.status = status; - ent.expiry = std::chrono::steady_clock::now() + - util::duration_from(dnsconf.timeout.cache); - if (ent.status == DNSResolverStatus::OK) { - ent.result = *result; - } - }); + [&ent](DNSResolverStatus status, const Address *result) { + auto &qlist = ent.qlist; + while (!qlist.empty()) { + auto head = qlist.head; + qlist.remove(head); + head->status = status; + head->in_qlist = false; + auto cb = head->cb; + cb(status, result); + } + + auto &dnsconf = get_config()->dns; + + ent.resolv.reset(); + ent.status = status; + ent.expiry = std::chrono::steady_clock::now() + + util::duration_from(dnsconf.timeout.cache); + if (ent.status == DNSResolverStatus::OK) { + ent.result = *result; + } + }); ent.qlist.append(dnsq); dnsq->in_qlist = true; } diff --git a/lib/nghttp2/src/shrpx_dns_tracker.h b/lib/nghttp2-1.65.0/src/shrpx_dns_tracker.h similarity index 95% rename from lib/nghttp2/src/shrpx_dns_tracker.h rename to lib/nghttp2-1.65.0/src/shrpx_dns_tracker.h index c7caac0c2e1..5f4d1157199 100644 --- a/lib/nghttp2/src/shrpx_dns_tracker.h +++ b/lib/nghttp2-1.65.0/src/shrpx_dns_tracker.h @@ -38,12 +38,12 @@ namespace shrpx { struct DNSQuery { DNSQuery(StringRef host, CompleteCb cb) - : host(std::move(host)), - cb(std::move(cb)), - dlnext(nullptr), - dlprev(nullptr), - status(DNSResolverStatus::IDLE), - in_qlist(false) {} + : host(std::move(host)), + cb(std::move(cb)), + dlnext(nullptr), + dlprev(nullptr), + status(DNSResolverStatus::IDLE), + in_qlist(false) {} // Host name we lookup for. StringRef host; diff --git a/lib/nghttp2/src/shrpx_downstream.cc b/lib/nghttp2-1.65.0/src/shrpx_downstream.cc similarity index 89% rename from lib/nghttp2/src/shrpx_downstream.cc rename to lib/nghttp2-1.65.0/src/shrpx_downstream.cc index 9ea52b4ac05..646c9cd1e1a 100644 --- a/lib/nghttp2/src/shrpx_downstream.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_downstream.cc @@ -26,7 +26,7 @@ #include -#include "url-parser/url_parser.h" +#include "urlparse.h" #include "shrpx_upstream.h" #include "shrpx_client_handler.h" @@ -45,6 +45,23 @@ namespace shrpx { +namespace { +void header_timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) { + auto downstream = static_cast(w->data); + auto upstream = downstream->get_upstream(); + + if (LOG_ENABLED(INFO)) { + DLOG(INFO, downstream) << "request header timeout stream_id=" + << downstream->get_stream_id(); + } + + downstream->disable_upstream_rtimer(); + downstream->disable_upstream_wtimer(); + + upstream->on_timeout(downstream); +} +} // namespace + namespace { void upstream_timeoutcb(struct ev_loop *loop, ev_timer *w, int revents) { auto downstream = static_cast(w->data); @@ -114,41 +131,45 @@ void downstream_wtimeoutcb(struct ev_loop *loop, ev_timer *w, int revents) { // upstream could be nullptr for unittests Downstream::Downstream(Upstream *upstream, MemchunkPool *mcpool, int64_t stream_id) - : dlnext(nullptr), - dlprev(nullptr), - response_sent_body_length(0), - balloc_(1024, 1024), - req_(balloc_), - resp_(balloc_), - request_start_time_(std::chrono::high_resolution_clock::now()), - blocked_request_buf_(mcpool), - request_buf_(mcpool), - response_buf_(mcpool), - upstream_(upstream), - blocked_link_(nullptr), - addr_(nullptr), - num_retry_(0), - stream_id_(stream_id), - assoc_stream_id_(-1), - downstream_stream_id_(-1), - response_rst_stream_error_code_(NGHTTP2_NO_ERROR), - affinity_cookie_(0), - request_state_(DownstreamState::INITIAL), - response_state_(DownstreamState::INITIAL), - dispatch_state_(DispatchState::NONE), - upgraded_(false), - chunked_request_(false), - chunked_response_(false), - expect_final_response_(false), - request_pending_(false), - request_header_sent_(false), - accesslog_written_(false), - new_affinity_cookie_(false), - blocked_request_data_eof_(false), - expect_100_continue_(false), - stop_reading_(false) { - - auto &timeoutconf = get_config()->http2.timeout; + : dlnext(nullptr), + dlprev(nullptr), + response_sent_body_length(0), + balloc_(1024, 1024), + req_(balloc_), + resp_(balloc_), + request_start_time_(std::chrono::high_resolution_clock::now()), + blocked_request_buf_(mcpool), + request_buf_(mcpool), + response_buf_(mcpool), + upstream_(upstream), + blocked_link_(nullptr), + addr_(nullptr), + num_retry_(0), + stream_id_(stream_id), + assoc_stream_id_(-1), + downstream_stream_id_(-1), + response_rst_stream_error_code_(NGHTTP2_NO_ERROR), + affinity_cookie_(0), + request_state_(DownstreamState::INITIAL), + response_state_(DownstreamState::INITIAL), + dispatch_state_(DispatchState::NONE), + upgraded_(false), + chunked_request_(false), + chunked_response_(false), + expect_final_response_(false), + request_pending_(false), + request_header_sent_(false), + accesslog_written_(false), + new_affinity_cookie_(false), + blocked_request_data_eof_(false), + expect_100_continue_(false), + stop_reading_(false) { + auto config = get_config(); + auto &httpconf = config->http; + + ev_timer_init(&header_timer_, header_timeoutcb, 0., httpconf.timeout.header); + + auto &timeoutconf = config->http2.timeout; ev_timer_init(&upstream_rtimer_, &upstream_rtimeoutcb, 0., timeoutconf.stream_read); @@ -159,6 +180,7 @@ Downstream::Downstream(Upstream *upstream, MemchunkPool *mcpool, ev_timer_init(&downstream_wtimer_, &downstream_wtimeoutcb, 0., timeoutconf.stream_write); + header_timer_.data = this; upstream_rtimer_.data = this; upstream_wtimer_.data = this; downstream_rtimer_.data = this; @@ -183,6 +205,7 @@ Downstream::~Downstream() { ev_timer_stop(loop, &upstream_wtimer_); ev_timer_stop(loop, &downstream_rtimer_); ev_timer_stop(loop, &downstream_wtimer_); + ev_timer_stop(loop, &header_timer_); #ifdef HAVE_MRUBY auto handler = upstream_->get_client_handler(); @@ -223,7 +246,7 @@ Downstream::~Downstream() { } int Downstream::attach_downstream_connection( - std::unique_ptr dconn) { + std::unique_ptr dconn) { if (dconn->attach_downstream(this) != 0) { return -1; } @@ -251,7 +274,7 @@ void Downstream::detach_downstream_connection() { auto handler = dconn_->get_client_handler(); handler->pool_downstream_connection( - std::unique_ptr(dconn_.release())); + std::unique_ptr(dconn_.release())); } DownstreamConnection *Downstream::get_downstream_connection() { @@ -320,7 +343,7 @@ StringRef Downstream::assemble_request_cookie() { } auto iov = make_byte_ref(balloc_, len + 1); - auto p = iov.base; + auto p = std::begin(iov); for (auto &kv : req_.fs.headers()) { if (kv.token != http2::HD_COOKIE || kv.value.empty()) { @@ -343,11 +366,11 @@ StringRef Downstream::assemble_request_cookie() { } // cut trailing "; " - if (p - iov.base >= 2) { + if (p - std::begin(iov) >= 2) { p -= 2; } - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } uint32_t Downstream::find_affinity_cookie(const StringRef &name) { @@ -367,7 +390,7 @@ uint32_t Downstream::find_affinity_cookie(const StringRef &name) { return 0; } - if (!util::streq(name, StringRef{it, end})) { + if (name != StringRef{it, end}) { it = std::find(it, std::end(kv.value), ';'); continue; } @@ -450,12 +473,11 @@ void add_header(size_t &sum, HeaderRefs &headers, const StringRef &name, namespace { StringRef alloc_header_name(BlockAllocator &balloc, const StringRef &name) { auto iov = make_byte_ref(balloc, name.size() + 1); - auto p = iov.base; - p = std::copy(std::begin(name), std::end(name), p); - util::inp_strlower(iov.base, p); + auto p = std::copy(std::begin(name), std::end(name), std::begin(iov)); + util::inp_strlower(std::begin(iov), p); *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } } // namespace @@ -466,7 +488,7 @@ void append_last_header_key(BlockAllocator &balloc, bool &key_prev, size_t &sum, sum += len; auto &item = headers.back(); auto name = - realloc_concat_string_ref(balloc, item.name, StringRef{data, len}); + realloc_concat_string_ref(balloc, item.name, StringRef{data, len}); auto p = const_cast(name.byte()); util::inp_strlower(p + name.size() - len, p + name.size()); @@ -484,7 +506,7 @@ void append_last_header_value(BlockAllocator &balloc, bool &key_prev, sum += len; auto &item = headers.back(); item.value = - realloc_concat_string_ref(balloc, item.value, StringRef{data, len}); + realloc_concat_string_ref(balloc, item.value, StringRef{data, len}); } } // namespace @@ -497,13 +519,13 @@ int FieldStore::parse_content_length() { } auto len = util::parse_uint(kv.value); - if (len == -1) { + if (!len) { return -1; } if (content_length != -1) { return -1; } - content_length = len; + content_length = *len; } return 0; } @@ -597,7 +619,7 @@ void FieldStore::erase_content_length_and_transfer_encoding() { } void Downstream::set_request_start_time( - std::chrono::high_resolution_clock::time_point time) { + std::chrono::high_resolution_clock::time_point time) { request_start_time_ = std::move(time); } @@ -697,7 +719,7 @@ int Downstream::end_upload_data() { } void Downstream::rewrite_location_response_header( - const StringRef &upstream_scheme) { + const StringRef &upstream_scheme) { auto hd = resp_.fs.header(http2::HD_LOCATION); if (!hd) { return; @@ -707,15 +729,15 @@ void Downstream::rewrite_location_response_header( return; } - http_parser_url u{}; - auto rv = http_parser_parse_url(hd->value.c_str(), hd->value.size(), 0, &u); + urlparse_url u; + auto rv = urlparse_parse_url(hd->value.data(), hd->value.size(), 0, &u); if (rv != 0) { return; } - auto new_uri = http2::rewrite_location_uri(balloc_, hd->value, u, - request_downstream_host_, - req_.authority, upstream_scheme); + auto new_uri = + http2::rewrite_location_uri(balloc_, hd->value, u, request_downstream_host_, + req_.authority, upstream_scheme); if (new_uri.empty()) { return; @@ -815,9 +837,9 @@ void Downstream::check_upgrade_fulfilled_http1() { std::array accept_buf; auto expected = - http2::make_websocket_accept_token(accept_buf.data(), ws_key_); + http2::make_websocket_accept_token(accept_buf.data(), ws_key_); - upgraded_ = expected != "" && expected == accept->value; + upgraded_ = !expected.empty() && expected == accept->value; } else { upgraded_ = resp_.http_status / 100 == 2; } @@ -847,15 +869,14 @@ void Downstream::inspect_http1_request() { if (upgrade) { const auto &val = upgrade->value; // TODO Perform more strict checking for upgrade headers - if (util::streq_l(NGHTTP2_CLEARTEXT_PROTO_VERSION_ID, val.c_str(), - val.size())) { + if (NGHTTP2_CLEARTEXT_PROTO_VERSION_ID ""_sr == val) { req_.http2_upgrade_seen = true; } else { req_.upgrade_request = true; // TODO Should we check Sec-WebSocket-Key, and // Sec-WebSocket-Version as well? - if (util::strieq_l("websocket", val)) { + if (util::strieq("websocket"_sr, val)) { req_.connect_proto = ConnectProto::WEBSOCKET; } } @@ -868,8 +889,7 @@ void Downstream::inspect_http1_request() { auto expect = req_.fs.header(http2::HD_EXPECT); expect_100_continue_ = - expect && - util::strieq(expect->value, StringRef::from_lit("100-continue")); + expect && util::strieq(expect->value, "100-continue"_sr); } void Downstream::inspect_http1_response() { @@ -946,6 +966,18 @@ bool Downstream::expect_response_trailer() const { (resp_.http_major == 3 || resp_.http_major == 2); } +void Downstream::repeat_header_timer() { + auto loop = upstream_->get_client_handler()->get_loop(); + + ev_timer_again(loop, &header_timer_); +} + +void Downstream::stop_header_timer() { + auto loop = upstream_->get_client_handler()->get_loop(); + + ev_timer_stop(loop, &header_timer_); +} + namespace { void reset_timer(struct ev_loop *loop, ev_timer *w) { ev_timer_again(loop, w); } } // namespace @@ -1142,7 +1174,7 @@ void Downstream::add_rcbuf(nghttp3_rcbuf *rcbuf) { #endif // ENABLE_HTTP3 void Downstream::set_downstream_addr_group( - const std::shared_ptr &group) { + const std::shared_ptr &group) { group_ = group; } diff --git a/lib/nghttp2/src/shrpx_downstream.h b/lib/nghttp2-1.65.0/src/shrpx_downstream.h similarity index 96% rename from lib/nghttp2/src/shrpx_downstream.h rename to lib/nghttp2-1.65.0/src/shrpx_downstream.h index 146cae583b7..0564ca5a988 100644 --- a/lib/nghttp2/src/shrpx_downstream.h +++ b/lib/nghttp2-1.65.0/src/shrpx_downstream.h @@ -63,11 +63,11 @@ struct DownstreamAddr; class FieldStore { public: FieldStore(BlockAllocator &balloc, size_t headers_initial_capacity) - : content_length(-1), - balloc_(balloc), - buffer_size_(0), - header_key_prev_(false), - trailer_key_prev_(false) { + : content_length(-1), + balloc_(balloc), + buffer_size_(0), + header_key_prev_(false), + trailer_key_prev_(false) { headers_.reserve(headers_initial_capacity); } @@ -153,19 +153,19 @@ enum class ConnectProto { struct Request { Request(BlockAllocator &balloc) - : fs(balloc, 16), - recv_body_length(0), - unconsumed_body_length(0), - method(-1), - http_major(1), - http_minor(1), - connect_proto(ConnectProto::NONE), - upgrade_request(false), - http2_upgrade_seen(false), - connection_close(false), - http2_expect_body(false), - no_authority(false), - forwarded_once(false) {} + : fs(balloc, 16), + recv_body_length(0), + unconsumed_body_length(0), + method(-1), + http_major(1), + http_minor(1), + connect_proto(ConnectProto::NONE), + upgrade_request(false), + http2_upgrade_seen(false), + connection_close(false), + http2_expect_body(false), + no_authority(false), + forwarded_once(false) {} void consume(size_t len) { assert(unconsumed_body_length >= len); @@ -235,14 +235,14 @@ struct Request { struct Response { Response(BlockAllocator &balloc) - : fs(balloc, 32), - recv_body_length(0), - unconsumed_body_length(0), - http_status(0), - http_major(1), - http_minor(1), - connection_close(false), - headers_only(false) {} + : fs(balloc, 32), + recv_body_length(0), + unconsumed_body_length(0), + http_status(0), + http_major(1), + http_minor(1), + connection_close(false), + headers_only(false) {} void consume(size_t len) { assert(unconsumed_body_length >= len); @@ -267,7 +267,7 @@ struct Response { const StringRef &path) { if (!pushed_resources) { pushed_resources = std::make_unique< - std::vector>>(); + std::vector>>(); } pushed_resources->emplace_back(scheme, authority, path); } @@ -282,7 +282,7 @@ struct Response { // that we should use more complex data structure (e.g., std::set) // to find the resources faster. std::unique_ptr>> - pushed_resources; + pushed_resources; // the length of response body received so far int64_t recv_body_length; // The number of bytes not consumed by the application yet. This is @@ -448,6 +448,9 @@ class Downstream { // connection. int on_read(); + void repeat_header_timer(); + void stop_header_timer(); + // Resets upstream read timer. If it is active, timeout value is // reset. If it is not active, timer will be started. void reset_upstream_rtimer(); @@ -562,6 +565,8 @@ class Downstream { // if frontend uses RFC 8441 WebSocket bootstrapping via HTTP/2. StringRef ws_key_; + ev_timer header_timer_; + ev_timer upstream_rtimer_; ev_timer upstream_wtimer_; diff --git a/lib/nghttp2/src/shrpx_downstream_connection.cc b/lib/nghttp2-1.65.0/src/shrpx_downstream_connection.cc similarity index 96% rename from lib/nghttp2/src/shrpx_downstream_connection.cc rename to lib/nghttp2-1.65.0/src/shrpx_downstream_connection.cc index 16a2d6fd188..e91cbe22ae1 100644 --- a/lib/nghttp2/src/shrpx_downstream_connection.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_downstream_connection.cc @@ -31,7 +31,7 @@ namespace shrpx { DownstreamConnection::DownstreamConnection() - : client_handler_(nullptr), downstream_(nullptr) {} + : client_handler_(nullptr), downstream_(nullptr) {} DownstreamConnection::~DownstreamConnection() {} diff --git a/lib/nghttp2/src/shrpx_downstream_connection.h b/lib/nghttp2-1.65.0/src/shrpx_downstream_connection.h similarity index 100% rename from lib/nghttp2/src/shrpx_downstream_connection.h rename to lib/nghttp2-1.65.0/src/shrpx_downstream_connection.h diff --git a/lib/nghttp2/src/shrpx_downstream_connection_pool.cc b/lib/nghttp2-1.65.0/src/shrpx_downstream_connection_pool.cc similarity index 95% rename from lib/nghttp2/src/shrpx_downstream_connection_pool.cc rename to lib/nghttp2-1.65.0/src/shrpx_downstream_connection_pool.cc index 0ee66b60f1e..34ab2b395c2 100644 --- a/lib/nghttp2/src/shrpx_downstream_connection_pool.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_downstream_connection_pool.cc @@ -40,7 +40,7 @@ void DownstreamConnectionPool::remove_all() { } void DownstreamConnectionPool::add_downstream_connection( - std::unique_ptr dconn) { + std::unique_ptr dconn) { pool_.insert(dconn.release()); } @@ -58,7 +58,7 @@ DownstreamConnectionPool::pop_downstream_connection() { } void DownstreamConnectionPool::remove_downstream_connection( - DownstreamConnection *dconn) { + DownstreamConnection *dconn) { pool_.erase(dconn); delete dconn; } diff --git a/lib/nghttp2/src/shrpx_downstream_connection_pool.h b/lib/nghttp2-1.65.0/src/shrpx_downstream_connection_pool.h similarity index 100% rename from lib/nghttp2/src/shrpx_downstream_connection_pool.h rename to lib/nghttp2-1.65.0/src/shrpx_downstream_connection_pool.h diff --git a/lib/nghttp2/src/shrpx_downstream_queue.cc b/lib/nghttp2-1.65.0/src/shrpx_downstream_queue.cc similarity index 92% rename from lib/nghttp2/src/shrpx_downstream_queue.cc rename to lib/nghttp2-1.65.0/src/shrpx_downstream_queue.cc index f8906e8e2e5..1fe445565ee 100644 --- a/lib/nghttp2/src/shrpx_downstream_queue.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_downstream_queue.cc @@ -32,13 +32,13 @@ namespace shrpx { DownstreamQueue::HostEntry::HostEntry(ImmutableString &&key) - : key(std::move(key)), num_active(0) {} + : key(std::move(key)), num_active(0) {} DownstreamQueue::DownstreamQueue(size_t conn_max_per_host, bool unified_host) - : conn_max_per_host_(conn_max_per_host == 0 - ? std::numeric_limits::max() - : conn_max_per_host), - unified_host_(unified_host) {} + : conn_max_per_host_(conn_max_per_host == 0 + ? std::numeric_limits::max() + : conn_max_per_host), + unified_host_(unified_host) {} DownstreamQueue::~DownstreamQueue() { dlist_delete_all(downstreams_); @@ -65,11 +65,11 @@ DownstreamQueue::find_host_entry(const StringRef &host) { auto key_ref = StringRef{key}; #ifdef HAVE_STD_MAP_EMPLACE std::tie(itr, std::ignore) = - host_entries_.emplace(key_ref, HostEntry(std::move(key))); + host_entries_.emplace(key_ref, HostEntry(std::move(key))); #else // !HAVE_STD_MAP_EMPLACE // for g++-4.7 - std::tie(itr, std::ignore) = host_entries_.insert( - std::make_pair(key_ref, HostEntry(std::move(key)))); + std::tie(itr, std::ignore) = + host_entries_.insert(std::make_pair(key_ref, HostEntry(std::move(key)))); #endif // !HAVE_STD_MAP_EMPLACE } return (*itr).second; diff --git a/lib/nghttp2/src/shrpx_downstream_queue.h b/lib/nghttp2-1.65.0/src/shrpx_downstream_queue.h similarity index 100% rename from lib/nghttp2/src/shrpx_downstream_queue.h rename to lib/nghttp2-1.65.0/src/shrpx_downstream_queue.h diff --git a/lib/nghttp2-1.65.0/src/shrpx_downstream_test.cc b/lib/nghttp2-1.65.0/src/shrpx_downstream_test.cc new file mode 100644 index 00000000000..4d23d89fcab --- /dev/null +++ b/lib/nghttp2-1.65.0/src/shrpx_downstream_test.cc @@ -0,0 +1,222 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "shrpx_downstream_test.h" + +#include + +#include "munitxx.h" + +#include "shrpx_downstream.h" + +using namespace std::literals; + +namespace shrpx { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_downstream_field_store_append_last_header), + munit_void_test(test_downstream_field_store_header), + munit_void_test(test_downstream_crumble_request_cookie), + munit_void_test(test_downstream_assemble_request_cookie), + munit_void_test(test_downstream_rewrite_location_response_header), + munit_void_test(test_downstream_supports_non_final_response), + munit_void_test(test_downstream_find_affinity_cookie), + munit_test_end(), +}; +} // namespace + +const MunitSuite downstream_suite{ + "/downstream", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +void test_downstream_field_store_append_last_header(void) { + BlockAllocator balloc(16, 16); + FieldStore fs(balloc, 0); + fs.alloc_add_header_name("alpha"_sr); + auto bravo = "BRAVO"_sr; + fs.append_last_header_key(bravo.data(), bravo.size()); + // Add more characters so that relloc occurs + auto golf = "golF0123456789"_sr; + fs.append_last_header_key(golf.data(), golf.size()); + + auto charlie = "Charlie"_sr; + fs.append_last_header_value(charlie.data(), charlie.size()); + auto delta = "deltA"_sr; + fs.append_last_header_value(delta.data(), delta.size()); + // Add more characters so that relloc occurs + auto echo = "echo0123456789"_sr; + fs.append_last_header_value(echo.data(), echo.size()); + + fs.add_header_token("echo"_sr, "foxtrot"_sr, false, -1); + + auto ans = + HeaderRefs{{"alphabravogolf0123456789"_sr, "CharliedeltAecho0123456789"_sr}, + {"echo"_sr, "foxtrot"_sr}}; + assert_true(ans == fs.headers()); +} + +void test_downstream_field_store_header(void) { + BlockAllocator balloc(16, 16); + FieldStore fs(balloc, 0); + fs.add_header_token("alpha"_sr, "0"_sr, false, -1); + fs.add_header_token(":authority"_sr, "1"_sr, false, http2::HD__AUTHORITY); + fs.add_header_token("content-length"_sr, "2"_sr, false, + http2::HD_CONTENT_LENGTH); + + // By token + assert_true(HeaderRef(StringRef{":authority"}, StringRef{"1"}) == + *fs.header(http2::HD__AUTHORITY)); + assert_null(fs.header(http2::HD__METHOD)); + + // By name + assert_true(HeaderRef(StringRef{"alpha"}, StringRef{"0"}) == + *fs.header("alpha"_sr)); + assert_null(fs.header("bravo"_sr)); +} + +void test_downstream_crumble_request_cookie(void) { + Downstream d(nullptr, nullptr, 0); + auto &req = d.request(); + req.fs.add_header_token(":method"_sr, "get"_sr, false, -1); + req.fs.add_header_token(":path"_sr, "/"_sr, false, -1); + req.fs.add_header_token("cookie"_sr, "alpha; bravo; ; ;; charlie;;"_sr, true, + http2::HD_COOKIE); + req.fs.add_header_token("cookie"_sr, ";delta"_sr, false, http2::HD_COOKIE); + req.fs.add_header_token("cookie"_sr, "echo"_sr, false, http2::HD_COOKIE); + + std::vector nva; + d.crumble_request_cookie(nva); + + auto num_cookies = d.count_crumble_request_cookie(); + + assert_size(5, ==, nva.size()); + assert_size(5, ==, num_cookies); + + HeaderRefs cookies; + std::transform(std::begin(nva), std::end(nva), std::back_inserter(cookies), + [](const nghttp2_nv &nv) { + return HeaderRef(StringRef{nv.name, nv.namelen}, + StringRef{nv.value, nv.valuelen}, + nv.flags & NGHTTP2_NV_FLAG_NO_INDEX); + }); + + HeaderRefs ans = {{"cookie"_sr, "alpha"_sr}, + {"cookie"_sr, "bravo"_sr}, + {"cookie"_sr, "charlie"_sr}, + {"cookie"_sr, "delta"_sr}, + {"cookie"_sr, "echo"_sr}}; + + assert_true(ans == cookies); + assert_true(cookies[0].no_index); + assert_true(cookies[1].no_index); + assert_true(cookies[2].no_index); +} + +void test_downstream_assemble_request_cookie(void) { + Downstream d(nullptr, nullptr, 0); + auto &req = d.request(); + + req.fs.add_header_token(":method"_sr, "get"_sr, false, -1); + req.fs.add_header_token(":path"_sr, "/"_sr, false, -1); + req.fs.add_header_token("cookie"_sr, "alpha"_sr, false, http2::HD_COOKIE); + req.fs.add_header_token("cookie"_sr, "bravo;"_sr, false, http2::HD_COOKIE); + req.fs.add_header_token("cookie"_sr, "charlie; "_sr, false, http2::HD_COOKIE); + req.fs.add_header_token("cookie"_sr, "delta;;"_sr, false, http2::HD_COOKIE); + assert_stdsv_equal("alpha; bravo; charlie; delta"sv, + d.assemble_request_cookie()); +} + +void test_downstream_rewrite_location_response_header(void) { + Downstream d(nullptr, nullptr, 0); + auto &req = d.request(); + auto &resp = d.response(); + d.set_request_downstream_host("localhost2"_sr); + req.authority = "localhost:8443"_sr; + resp.fs.add_header_token("location"_sr, "http://localhost2:3000/"_sr, false, + http2::HD_LOCATION); + d.rewrite_location_response_header("https"_sr); + auto location = resp.fs.header(http2::HD_LOCATION); + assert_stdsv_equal("https://localhost:8443/"sv, (*location).value); +} + +void test_downstream_supports_non_final_response(void) { + Downstream d(nullptr, nullptr, 0); + auto &req = d.request(); + + req.http_major = 3; + req.http_minor = 0; + + assert_true(d.supports_non_final_response()); + + req.http_major = 2; + req.http_minor = 0; + + assert_true(d.supports_non_final_response()); + + req.http_major = 1; + req.http_minor = 1; + + assert_true(d.supports_non_final_response()); + + req.http_major = 1; + req.http_minor = 0; + + assert_false(d.supports_non_final_response()); + + req.http_major = 0; + req.http_minor = 9; + + assert_false(d.supports_non_final_response()); +} + +void test_downstream_find_affinity_cookie(void) { + Downstream d(nullptr, nullptr, 0); + + auto &req = d.request(); + req.fs.add_header_token("cookie"_sr, StringRef{}, false, http2::HD_COOKIE); + req.fs.add_header_token("cookie"_sr, "a=b;;c=d"_sr, false, http2::HD_COOKIE); + req.fs.add_header_token("content-length"_sr, "599"_sr, false, + http2::HD_CONTENT_LENGTH); + req.fs.add_header_token("cookie"_sr, "lb=deadbeef;LB=f1f2f3f4"_sr, false, + http2::HD_COOKIE); + req.fs.add_header_token("cookie"_sr, "short=e1e2e3e"_sr, false, + http2::HD_COOKIE); + + uint32_t aff; + + aff = d.find_affinity_cookie("lb"_sr); + + assert_uint32(0xdeadbeef, ==, aff); + + aff = d.find_affinity_cookie("LB"_sr); + + assert_uint32(0xf1f2f3f4, ==, aff); + + aff = d.find_affinity_cookie("short"_sr); + + assert_uint32(0, ==, aff); +} + +} // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_downstream_test.h b/lib/nghttp2-1.65.0/src/shrpx_downstream_test.h similarity index 71% rename from lib/nghttp2/src/shrpx_downstream_test.h rename to lib/nghttp2-1.65.0/src/shrpx_downstream_test.h index ef06ea301a9..c46368ce464 100644 --- a/lib/nghttp2/src/shrpx_downstream_test.h +++ b/lib/nghttp2-1.65.0/src/shrpx_downstream_test.h @@ -29,15 +29,21 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace shrpx { -void test_downstream_field_store_append_last_header(void); -void test_downstream_field_store_header(void); -void test_downstream_crumble_request_cookie(void); -void test_downstream_assemble_request_cookie(void); -void test_downstream_rewrite_location_response_header(void); -void test_downstream_supports_non_final_response(void); -void test_downstream_find_affinity_cookie(void); +extern const MunitSuite downstream_suite; + +munit_void_test_decl(test_downstream_field_store_append_last_header) +munit_void_test_decl(test_downstream_field_store_header) +munit_void_test_decl(test_downstream_crumble_request_cookie) +munit_void_test_decl(test_downstream_assemble_request_cookie) +munit_void_test_decl(test_downstream_rewrite_location_response_header) +munit_void_test_decl(test_downstream_supports_non_final_response) +munit_void_test_decl(test_downstream_find_affinity_cookie) } // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_dual_dns_resolver.cc b/lib/nghttp2-1.65.0/src/shrpx_dual_dns_resolver.cc similarity index 98% rename from lib/nghttp2/src/shrpx_dual_dns_resolver.cc rename to lib/nghttp2-1.65.0/src/shrpx_dual_dns_resolver.cc index 8c6c5c9b308..f736fa69b7d 100644 --- a/lib/nghttp2/src/shrpx_dual_dns_resolver.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_dual_dns_resolver.cc @@ -27,7 +27,7 @@ namespace shrpx { DualDNSResolver::DualDNSResolver(struct ev_loop *loop, int family) - : family_(family), resolv4_(loop), resolv6_(loop) { + : family_(family), resolv4_(loop), resolv6_(loop) { auto cb = [this](DNSResolverStatus, const Address *) { Address result; diff --git a/lib/nghttp2/src/shrpx_dual_dns_resolver.h b/lib/nghttp2-1.65.0/src/shrpx_dual_dns_resolver.h similarity index 100% rename from lib/nghttp2/src/shrpx_dual_dns_resolver.h rename to lib/nghttp2-1.65.0/src/shrpx_dual_dns_resolver.h diff --git a/lib/nghttp2/src/shrpx_error.h b/lib/nghttp2-1.65.0/src/shrpx_error.h similarity index 100% rename from lib/nghttp2/src/shrpx_error.h rename to lib/nghttp2-1.65.0/src/shrpx_error.h diff --git a/lib/nghttp2/src/shrpx_exec.cc b/lib/nghttp2-1.65.0/src/shrpx_exec.cc similarity index 96% rename from lib/nghttp2/src/shrpx_exec.cc rename to lib/nghttp2-1.65.0/src/shrpx_exec.cc index d5cd0916b2b..0e27e0fe232 100644 --- a/lib/nghttp2/src/shrpx_exec.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_exec.cc @@ -41,17 +41,17 @@ int exec_read_command(Process &proc, char *const argv[]) { int rv; int pfd[2]; -#ifdef O_CLOEXEC +#if defined(HAVE_PIPE2) && defined(O_CLOEXEC) if (pipe2(pfd, O_CLOEXEC) == -1) { return -1; } -#else // !O_CLOEXEC +#else // !HAVE_PIPE2 || !O_CLOEXEC if (pipe(pfd) == -1) { return -1; } util::make_socket_closeonexec(pfd[0]); util::make_socket_closeonexec(pfd[1]); -#endif // !O_CLOEXEC +#endif // !HAVE_PIPE2 || !O_CLOEXEC auto closer = defer([&pfd]() { if (pfd[0] != -1) { diff --git a/lib/nghttp2/src/shrpx_exec.h b/lib/nghttp2-1.65.0/src/shrpx_exec.h similarity index 100% rename from lib/nghttp2/src/shrpx_exec.h rename to lib/nghttp2-1.65.0/src/shrpx_exec.h diff --git a/lib/nghttp2/src/shrpx_health_monitor_downstream_connection.cc b/lib/nghttp2-1.65.0/src/shrpx_health_monitor_downstream_connection.cc similarity index 93% rename from lib/nghttp2/src/shrpx_health_monitor_downstream_connection.cc rename to lib/nghttp2-1.65.0/src/shrpx_health_monitor_downstream_connection.cc index 89e539630ad..89aa71e045e 100644 --- a/lib/nghttp2/src/shrpx_health_monitor_downstream_connection.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_health_monitor_downstream_connection.cc @@ -36,7 +36,7 @@ HealthMonitorDownstreamConnection::HealthMonitorDownstreamConnection() {} HealthMonitorDownstreamConnection::~HealthMonitorDownstreamConnection() {} int HealthMonitorDownstreamConnection::attach_downstream( - Downstream *downstream) { + Downstream *downstream) { if (LOG_ENABLED(INFO)) { DCLOG(INFO, this) << "Attaching to DOWNSTREAM:" << downstream; } @@ -47,7 +47,7 @@ int HealthMonitorDownstreamConnection::attach_downstream( } void HealthMonitorDownstreamConnection::detach_downstream( - Downstream *downstream) { + Downstream *downstream) { if (LOG_ENABLED(INFO)) { DCLOG(INFO, this) << "Detaching from DOWNSTREAM:" << downstream; } @@ -64,7 +64,7 @@ int HealthMonitorDownstreamConnection::push_request_headers() { } int HealthMonitorDownstreamConnection::push_upload_data_chunk( - const uint8_t *data, size_t datalen) { + const uint8_t *data, size_t datalen) { return 0; } @@ -74,8 +74,7 @@ int HealthMonitorDownstreamConnection::end_upload_data() { resp.http_status = 200; - resp.fs.add_header_token(StringRef::from_lit("content-length"), - StringRef::from_lit("0"), false, + resp.fs.add_header_token("content-length"_sr, "0"_sr, false, http2::HD_CONTENT_LENGTH); if (upstream->send_reply(downstream_, nullptr, 0) != 0) { diff --git a/lib/nghttp2/src/shrpx_health_monitor_downstream_connection.h b/lib/nghttp2-1.65.0/src/shrpx_health_monitor_downstream_connection.h similarity index 100% rename from lib/nghttp2/src/shrpx_health_monitor_downstream_connection.h rename to lib/nghttp2-1.65.0/src/shrpx_health_monitor_downstream_connection.h diff --git a/lib/nghttp2/src/shrpx_http.cc b/lib/nghttp2-1.65.0/src/shrpx_http.cc similarity index 83% rename from lib/nghttp2/src/shrpx_http.cc rename to lib/nghttp2-1.65.0/src/shrpx_http.cc index ad32dc9e191..09abf8ecdeb 100644 --- a/lib/nghttp2/src/shrpx_http.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_http.cc @@ -41,7 +41,7 @@ StringRef create_error_html(BlockAllocator &balloc, unsigned int http_status) { const auto &error_pages = httpconf.error_pages; for (const auto &page : error_pages) { if (page.http_status == 0 || page.http_status == http_status) { - return StringRef{std::begin(page.content), std::end(page.content)}; + return StringRef{std::span{page.content}}; } } @@ -49,12 +49,10 @@ StringRef create_error_html(BlockAllocator &balloc, unsigned int http_status) { auto reason_phrase = http2::get_reason_phrase(http_status); return concat_string_ref( - balloc, StringRef::from_lit(R"()"), - status_string, StringRef::from_lit(" "), reason_phrase, - StringRef::from_lit("

"), status_string, - StringRef::from_lit(" "), reason_phrase, - StringRef::from_lit("

"), httpconf.server_name, - StringRef::from_lit("
")); + balloc, R"()"_sr, status_string, + " "_sr, reason_phrase, "

"_sr, status_string, " "_sr, + reason_phrase, "

"_sr, httpconf.server_name, + "
"_sr); } StringRef create_forwarded(BlockAllocator &balloc, int params, @@ -75,7 +73,7 @@ StringRef create_forwarded(BlockAllocator &balloc, int params, } auto iov = make_byte_ref(balloc, len + 1); - auto p = iov.base; + auto p = std::begin(iov); if ((params & FORWARDED_BY) && !node_by.empty()) { // This must be quoted-string unless it is obfuscated version @@ -118,14 +116,14 @@ StringRef create_forwarded(BlockAllocator &balloc, int params, *p++ = ';'; } - if (iov.base == p) { + if (std::begin(iov) == p) { return StringRef{}; } --p; *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } std::string colorizeHeaders(const char *hdrs) { @@ -146,7 +144,7 @@ std::string colorizeHeaders(const char *hdrs) { nhdrs += TTY_HTTP_HD; nhdrs.append(p, np); nhdrs += TTY_RST; - auto redact = util::strieq_l("authorization", StringRef{p, np}); + auto redact = util::strieq("authorization"_sr, StringRef{p, np}); p = np; np = strchr(p, '\n'); if (!np) { @@ -167,17 +165,17 @@ std::string colorizeHeaders(const char *hdrs) { return nhdrs; } -ssize_t select_padding_callback(nghttp2_session *session, - const nghttp2_frame *frame, size_t max_payload, - void *user_data) { +nghttp2_ssize select_padding_callback(nghttp2_session *session, + const nghttp2_frame *frame, + size_t max_payload, void *user_data) { return std::min(max_payload, frame->hd.length + get_config()->padding); } StringRef create_affinity_cookie(BlockAllocator &balloc, const StringRef &name, uint32_t affinity_cookie, const StringRef &path, bool secure) { - static constexpr auto PATH_PREFIX = StringRef::from_lit("; Path="); - static constexpr auto SECURE = StringRef::from_lit("; Secure"); + static constexpr auto PATH_PREFIX = "; Path="_sr; + static constexpr auto SECURE = "; Secure"_sr; // =[; Path=][; Secure] size_t len = name.size() + 1 + 8; @@ -189,14 +187,10 @@ StringRef create_affinity_cookie(BlockAllocator &balloc, const StringRef &name, } auto iov = make_byte_ref(balloc, len + 1); - auto p = iov.base; - p = std::copy(std::begin(name), std::end(name), p); + auto p = std::copy(std::begin(name), std::end(name), std::begin(iov)); *p++ = '='; affinity_cookie = htonl(affinity_cookie); - p = util::format_hex(p, - StringRef{reinterpret_cast(&affinity_cookie), - reinterpret_cast(&affinity_cookie) + - sizeof(affinity_cookie)}); + p = util::format_hex(p, std::span{&affinity_cookie, 1}); if (!path.empty()) { p = std::copy(std::begin(PATH_PREFIX), std::end(PATH_PREFIX), p); p = std::copy(std::begin(path), std::end(path), p); @@ -205,14 +199,14 @@ StringRef create_affinity_cookie(BlockAllocator &balloc, const StringRef &name, p = std::copy(std::begin(SECURE), std::end(SECURE), p); } *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } bool require_cookie_secure_attribute(SessionAffinityCookieSecure secure, const StringRef &scheme) { switch (secure) { case SessionAffinityCookieSecure::AUTO: - return scheme == "https"; + return scheme == "https"_sr; case SessionAffinityCookieSecure::YES: return true; default: @@ -247,7 +241,7 @@ StringRef create_altsvc_header_value(BlockAllocator &balloc, // We will write additional ", " at the end, and cut it later. auto iov = make_byte_ref(balloc, len + 2); - auto p = iov.base; + auto p = std::begin(iov); for (auto &altsvc : altsvcs) { p = util::percent_encode_token(p, altsvc.protocol_id); @@ -266,13 +260,13 @@ StringRef create_altsvc_header_value(BlockAllocator &balloc, p -= 2; *p = '\0'; - assert(static_cast(p - iov.base) == len); + assert(static_cast(p - std::begin(iov)) == len); - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } bool check_http_scheme(const StringRef &scheme, bool encrypted) { - return encrypted ? scheme == "https" : scheme == "http"; + return encrypted ? scheme == "https"_sr : scheme == "http"_sr; } } // namespace http diff --git a/lib/nghttp2/src/shrpx_http.h b/lib/nghttp2-1.65.0/src/shrpx_http.h similarity index 94% rename from lib/nghttp2/src/shrpx_http.h rename to lib/nghttp2-1.65.0/src/shrpx_http.h index 18935d82796..774686c61de 100644 --- a/lib/nghttp2/src/shrpx_http.h +++ b/lib/nghttp2-1.65.0/src/shrpx_http.h @@ -63,9 +63,9 @@ StringRef create_forwarded(BlockAllocator &balloc, int params, // Adds ANSI color codes to HTTP headers |hdrs|. std::string colorizeHeaders(const char *hdrs); -ssize_t select_padding_callback(nghttp2_session *session, - const nghttp2_frame *frame, size_t max_payload, - void *user_data); +nghttp2_ssize select_padding_callback(nghttp2_session *session, + const nghttp2_frame *frame, + size_t max_payload, void *user_data); // Creates set-cookie-string for cookie based affinity. If |path| is // not empty, "; " is added. If |secure| is true, "; Secure" is diff --git a/lib/nghttp2/src/shrpx_http2_downstream_connection.cc b/lib/nghttp2-1.65.0/src/shrpx_http2_downstream_connection.cc similarity index 81% rename from lib/nghttp2/src/shrpx_http2_downstream_connection.cc rename to lib/nghttp2-1.65.0/src/shrpx_http2_downstream_connection.cc index d27dcc114d5..25f184f8d49 100644 --- a/lib/nghttp2/src/shrpx_http2_downstream_connection.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_http2_downstream_connection.cc @@ -48,10 +48,10 @@ using namespace nghttp2; namespace shrpx { Http2DownstreamConnection::Http2DownstreamConnection(Http2Session *http2session) - : dlnext(nullptr), - dlprev(nullptr), - http2session_(http2session), - sd_(nullptr) {} + : dlnext(nullptr), + dlprev(nullptr), + http2session_(http2session), + sd_(nullptr) {} Http2DownstreamConnection::~Http2DownstreamConnection() { if (LOG_ENABLED(INFO)) { @@ -155,20 +155,21 @@ int Http2DownstreamConnection::submit_rst_stream(Downstream *downstream, << ", error_code=" << error_code; } rv = http2session_->submit_rst_stream( - downstream->get_downstream_stream_id(), error_code); + downstream->get_downstream_stream_id(), error_code); } } return rv; } namespace { -ssize_t http2_data_read_callback(nghttp2_session *session, int32_t stream_id, - uint8_t *buf, size_t length, - uint32_t *data_flags, - nghttp2_data_source *source, void *user_data) { +nghttp2_ssize http2_data_read_callback(nghttp2_session *session, + int32_t stream_id, uint8_t *buf, + size_t length, uint32_t *data_flags, + nghttp2_data_source *source, + void *user_data) { int rv; auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, stream_id)); + nghttp2_session_get_stream_user_data(session, stream_id)); if (!sd || !sd->dconn) { return NGHTTP2_ERR_DEFERRED; } @@ -195,7 +196,6 @@ ssize_t http2_data_read_callback(nghttp2_session *session, int32_t stream_id, (!req.upgrade_request || (downstream->get_response_state() == DownstreamState::HEADER_COMPLETE && !downstream->get_upgraded()))) { - *data_flags |= NGHTTP2_DATA_FLAG_EOF; const auto &trailers = req.fs.trailers(); @@ -294,11 +294,11 @@ int Http2DownstreamConnection::push_request_headers() { httpconf.add_request_headers.size()); if (req.connect_proto == ConnectProto::WEBSOCKET) { - nva.push_back(http2::make_nv_ll(":method", "CONNECT")); - nva.push_back(http2::make_nv_ll(":protocol", "websocket")); + nva.push_back(http2::make_field(":method"_sr, "CONNECT"_sr)); + nva.push_back(http2::make_field(":protocol"_sr, "websocket"_sr)); } else { - nva.push_back(http2::make_nv_ls_nocopy( - ":method", http2::to_method_string(req.method))); + nva.push_back( + http2::make_field(":method"_sr, http2::to_method_string(req.method))); } if (!req.regular_connect_method()) { @@ -307,25 +307,25 @@ int Http2DownstreamConnection::push_request_headers() { auto addr = http2session_->get_addr(); assert(addr); // We will handle more protocol scheme upgrade in the future. - if (addr->tls && addr->upgrade_scheme && req.scheme == "http") { - nva.push_back(http2::make_nv_ll(":scheme", "https")); + if (addr->tls && addr->upgrade_scheme && req.scheme == "http"_sr) { + nva.push_back(http2::make_field(":scheme"_sr, "https"_sr)); } else { - nva.push_back(http2::make_nv_ls_nocopy(":scheme", req.scheme)); + nva.push_back(http2::make_field(":scheme"_sr, req.scheme)); } if (req.method == HTTP_OPTIONS && req.path.empty()) { - nva.push_back(http2::make_nv_ll(":path", "*")); + nva.push_back(http2::make_field(":path"_sr, "*"_sr)); } else { - nva.push_back(http2::make_nv_ls_nocopy(":path", req.path)); + nva.push_back(http2::make_field(":path"_sr, req.path)); } if (!req.no_authority || req.connect_proto != ConnectProto::NONE) { - nva.push_back(http2::make_nv_ls_nocopy(":authority", authority)); + nva.push_back(http2::make_field(":authority"_sr, authority)); } else { - nva.push_back(http2::make_nv_ls_nocopy("host", authority)); + nva.push_back(http2::make_field("host"_sr, authority)); } } else { - nva.push_back(http2::make_nv_ls_nocopy(":authority", authority)); + nva.push_back(http2::make_field(":authority"_sr, authority)); } auto &fwdconf = httpconf.forwarded; @@ -334,11 +334,11 @@ int Http2DownstreamConnection::push_request_headers() { auto &earlydataconf = httpconf.early_data; uint32_t build_flags = - (fwdconf.strip_incoming ? http2::HDOP_STRIP_FORWARDED : 0) | - (xffconf.strip_incoming ? http2::HDOP_STRIP_X_FORWARDED_FOR : 0) | - (xfpconf.strip_incoming ? http2::HDOP_STRIP_X_FORWARDED_PROTO : 0) | - (earlydataconf.strip_incoming ? http2::HDOP_STRIP_EARLY_DATA : 0) | - http2::HDOP_STRIP_SEC_WEBSOCKET_KEY; + (fwdconf.strip_incoming ? http2::HDOP_STRIP_FORWARDED : 0) | + (xffconf.strip_incoming ? http2::HDOP_STRIP_X_FORWARDED_FOR : 0) | + (xfpconf.strip_incoming ? http2::HDOP_STRIP_X_FORWARDED_PROTO : 0) | + (earlydataconf.strip_incoming ? http2::HDOP_STRIP_EARLY_DATA : 0) | + http2::HDOP_STRIP_SEC_WEBSOCKET_KEY; http2::copy_headers_to_nva_nocopy(nva, req.fs.headers(), build_flags); @@ -349,16 +349,18 @@ int Http2DownstreamConnection::push_request_headers() { auto upstream = downstream_->get_upstream(); auto handler = upstream->get_client_handler(); -#if OPENSSL_1_1_1_API +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_BORINGSSL) || defined(NGHTTP2_OPENSSL_IS_WOLFSSL) auto conn = handler->get_connection(); if (conn->tls.ssl && !SSL_is_init_finished(conn->tls.ssl)) { - nva.push_back(http2::make_nv_ll("early-data", "1")); + nva.push_back(http2::make_field("early-data"_sr, "1"_sr)); } -#endif // OPENSSL_1_1_1_API +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_BORINGSSL || + // NGHTTP2_OPENSSL_IS_WOLFSSL auto fwd = - fwdconf.strip_incoming ? nullptr : req.fs.header(http2::HD_FORWARDED); + fwdconf.strip_incoming ? nullptr : req.fs.header(http2::HD_FORWARDED); if (fwdconf.params) { auto params = fwdconf.params; @@ -368,66 +370,63 @@ int Http2DownstreamConnection::push_request_headers() { } auto value = http::create_forwarded( - balloc, params, handler->get_forwarded_by(), - handler->get_forwarded_for(), req.authority, req.scheme); + balloc, params, handler->get_forwarded_by(), handler->get_forwarded_for(), + req.authority, req.scheme); if (fwd || !value.empty()) { if (fwd) { if (value.empty()) { value = fwd->value; } else { - value = concat_string_ref(balloc, fwd->value, - StringRef::from_lit(", "), value); + value = concat_string_ref(balloc, fwd->value, ", "_sr, value); } } - nva.push_back(http2::make_nv_ls_nocopy("forwarded", value)); + nva.push_back(http2::make_field("forwarded"_sr, value)); } } else if (fwd) { - nva.push_back(http2::make_nv_ls_nocopy("forwarded", fwd->value)); + nva.push_back(http2::make_field("forwarded"_sr, fwd->value)); } - auto xff = xffconf.strip_incoming ? nullptr - : req.fs.header(http2::HD_X_FORWARDED_FOR); + auto xff = + xffconf.strip_incoming ? nullptr : req.fs.header(http2::HD_X_FORWARDED_FOR); if (xffconf.add) { StringRef xff_value; const auto &addr = upstream->get_client_handler()->get_ipaddr(); if (xff) { - xff_value = concat_string_ref(balloc, xff->value, - StringRef::from_lit(", "), addr); + xff_value = concat_string_ref(balloc, xff->value, ", "_sr, addr); } else { xff_value = addr; } - nva.push_back(http2::make_nv_ls_nocopy("x-forwarded-for", xff_value)); + nva.push_back(http2::make_field("x-forwarded-for"_sr, xff_value)); } else if (xff) { - nva.push_back(http2::make_nv_ls_nocopy("x-forwarded-for", xff->value)); + nva.push_back(http2::make_field("x-forwarded-for"_sr, xff->value)); } if (!config->http2_proxy && !req.regular_connect_method()) { auto xfp = xfpconf.strip_incoming - ? nullptr - : req.fs.header(http2::HD_X_FORWARDED_PROTO); + ? nullptr + : req.fs.header(http2::HD_X_FORWARDED_PROTO); if (xfpconf.add) { StringRef xfp_value; // We use same protocol with :scheme header field if (xfp) { - xfp_value = concat_string_ref(balloc, xfp->value, - StringRef::from_lit(", "), req.scheme); + xfp_value = concat_string_ref(balloc, xfp->value, ", "_sr, req.scheme); } else { xfp_value = req.scheme; } - nva.push_back(http2::make_nv_ls_nocopy("x-forwarded-proto", xfp_value)); + nva.push_back(http2::make_field("x-forwarded-proto"_sr, xfp_value)); } else if (xfp) { - nva.push_back(http2::make_nv_ls_nocopy("x-forwarded-proto", xfp->value)); + nva.push_back(http2::make_field("x-forwarded-proto"_sr, xfp->value)); } } auto via = req.fs.header(http2::HD_VIA); if (httpconf.no_via) { if (via) { - nva.push_back(http2::make_nv_ls_nocopy("via", (*via).value)); + nva.push_back(http2::make_field("via"_sr, (*via).value)); } } else { size_t vialen = 16; @@ -436,7 +435,7 @@ int Http2DownstreamConnection::push_request_headers() { } auto iov = make_byte_ref(balloc, vialen + 1); - auto p = iov.base; + auto p = std::begin(iov); if (via) { p = std::copy(std::begin(via->value), std::end(via->value), p); @@ -445,7 +444,8 @@ int Http2DownstreamConnection::push_request_headers() { p = http::create_via_header_value(p, req.http_major, req.http_minor); *p = '\0'; - nva.push_back(http2::make_nv_ls_nocopy("via", StringRef{iov.base, p})); + nva.push_back( + http2::make_field("via"_sr, StringRef{std::span{std::begin(iov), p}})); } auto te = req.fs.header(http2::HD_TE); @@ -453,22 +453,23 @@ int Http2DownstreamConnection::push_request_headers() { // "trailers". We just forward "trailers". // TODO more strict handling required here. if (te && http2::contains_trailers(te->value)) { - nva.push_back(http2::make_nv_ll("te", "trailers")); + nva.push_back(http2::make_field("te"_sr, "trailers"_sr)); } for (auto &p : httpconf.add_request_headers) { - nva.push_back(http2::make_nv_nocopy(p.name, p.value)); + nva.push_back(http2::make_field(p.name, p.value)); } if (LOG_ENABLED(INFO)) { std::stringstream ss; for (auto &nv : nva) { - if (util::streq_l("authorization", nv.name, nv.namelen)) { - ss << TTY_HTTP_HD << StringRef{nv.name, nv.namelen} << TTY_RST - << ": \n"; + auto name = StringRef{nv.name, nv.namelen}; + + if ("authorization"_sr == name) { + ss << TTY_HTTP_HD << name << TTY_RST << ": \n"; continue; } - ss << TTY_HTTP_HD << StringRef{nv.name, nv.namelen} << TTY_RST << ": " + ss << TTY_HTTP_HD << name << TTY_RST << ": " << StringRef{nv.value, nv.valuelen} << "\n"; } DCLOG(INFO, this) << "HTTP request headers\n" << ss.str(); @@ -476,8 +477,8 @@ int Http2DownstreamConnection::push_request_headers() { auto transfer_encoding = req.fs.header(http2::HD_TRANSFER_ENCODING); - nghttp2_data_provider *data_prdptr = nullptr; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 *data_prdptr = nullptr; + nghttp2_data_provider2 data_prd; // Add body as long as transfer-encoding is given even if // req.fs.content_length == 0 to forward trailer fields. @@ -561,8 +562,8 @@ int Http2DownstreamConnection::resume_read(IOCtrlReason reason, } if (consumed > 0) { - rv = http2session_->consume(downstream_->get_downstream_stream_id(), - consumed); + rv = + http2session_->consume(downstream_->get_downstream_stream_id(), consumed); if (rv != 0) { return -1; diff --git a/lib/nghttp2/src/shrpx_http2_downstream_connection.h b/lib/nghttp2-1.65.0/src/shrpx_http2_downstream_connection.h similarity index 92% rename from lib/nghttp2/src/shrpx_http2_downstream_connection.h rename to lib/nghttp2-1.65.0/src/shrpx_http2_downstream_connection.h index 0fc7d91cf24..203c307ea00 100644 --- a/lib/nghttp2/src/shrpx_http2_downstream_connection.h +++ b/lib/nghttp2-1.65.0/src/shrpx_http2_downstream_connection.h @@ -27,7 +27,14 @@ #include "shrpx.h" -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include diff --git a/lib/nghttp2/src/shrpx_http2_session.cc b/lib/nghttp2-1.65.0/src/shrpx_http2_session.cc similarity index 88% rename from lib/nghttp2/src/shrpx_http2_session.cc rename to lib/nghttp2-1.65.0/src/shrpx_http2_session.cc index 18c934bed41..b90c66aced1 100644 --- a/lib/nghttp2/src/shrpx_http2_session.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_http2_session.cc @@ -31,7 +31,14 @@ #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include "shrpx_upstream.h" #include "shrpx_downstream.h" @@ -182,25 +189,25 @@ Http2Session::Http2Session(struct ev_loop *loop, SSL_CTX *ssl_ctx, Worker *worker, const std::shared_ptr &group, DownstreamAddr *addr) - : dlnext(nullptr), - dlprev(nullptr), - conn_(loop, -1, nullptr, worker->get_mcpool(), - group->shared_addr->timeout.write, group->shared_addr->timeout.read, - {}, {}, writecb, readcb, timeoutcb, this, - get_config()->tls.dyn_rec.warmup_threshold, - get_config()->tls.dyn_rec.idle_timeout, Proto::HTTP2), - wb_(worker->get_mcpool()), - worker_(worker), - ssl_ctx_(ssl_ctx), - group_(group), - addr_(addr), - session_(nullptr), - raddr_(nullptr), - state_(Http2SessionState::DISCONNECTED), - connection_check_state_(ConnectionCheck::NONE), - freelist_zone_(FreelistZone::NONE), - settings_recved_(false), - allow_connect_proto_(false) { + : dlnext(nullptr), + dlprev(nullptr), + conn_(loop, -1, nullptr, worker->get_mcpool(), + group->shared_addr->timeout.write, group->shared_addr->timeout.read, + {}, {}, writecb, readcb, timeoutcb, this, + get_config()->tls.dyn_rec.warmup_threshold, + get_config()->tls.dyn_rec.idle_timeout, Proto::HTTP2), + wb_(worker->get_mcpool()), + worker_(worker), + ssl_ctx_(ssl_ctx), + group_(group), + addr_(addr), + session_(nullptr), + raddr_(nullptr), + state_(Http2SessionState::DISCONNECTED), + connection_check_state_(ConnectionCheck::NONE), + freelist_zone_(FreelistZone::NONE), + settings_recved_(false), + allow_connect_proto_(false) { read_ = write_ = &Http2Session::noop; on_read_ = &Http2Session::read_noop; @@ -305,19 +312,19 @@ int Http2Session::disconnect(bool hard) { int Http2Session::resolve_name() { auto dns_query = std::make_unique( - addr_->host, [this](DNSResolverStatus status, const Address *result) { - int rv; + addr_->host, [this](DNSResolverStatus status, const Address *result) { + int rv; - if (status == DNSResolverStatus::OK) { - *resolved_addr_ = *result; - util::set_port(*this->resolved_addr_, this->addr_->port); - } + if (status == DNSResolverStatus::OK) { + *resolved_addr_ = *result; + util::set_port(*this->resolved_addr_, this->addr_->port); + } - rv = this->initiate_connection(); - if (rv != 0) { - delete this; - } - }); + rv = this->initiate_connection(); + if (rv != 0) { + delete this; + } + }); resolved_addr_ = std::make_unique
(); auto dns_tracker = worker_->get_dns_tracker(); switch (dns_tracker->resolve(resolved_addr_.get(), dns_query.get())) { @@ -342,29 +349,29 @@ int htp_hdrs_completecb(llhttp_t *htp); namespace { constexpr llhttp_settings_t htp_hooks = { - nullptr, // llhttp_cb on_message_begin; - nullptr, // llhttp_data_cb on_url; - nullptr, // llhttp_data_cb on_status; - nullptr, // llhttp_data_cb on_method; - nullptr, // llhttp_data_cb on_version; - nullptr, // llhttp_data_cb on_header_field; - nullptr, // llhttp_data_cb on_header_value; - nullptr, // llhttp_data_cb on_chunk_extension_name; - nullptr, // llhttp_data_cb on_chunk_extension_value; - htp_hdrs_completecb, // llhttp_cb on_headers_complete; - nullptr, // llhttp_data_cb on_body; - nullptr, // llhttp_cb on_message_complete; - nullptr, // llhttp_cb on_url_complete; - nullptr, // llhttp_cb on_status_complete; - nullptr, // llhttp_cb on_method_complete; - nullptr, // llhttp_cb on_version_complete; - nullptr, // llhttp_cb on_header_field_complete; - nullptr, // llhttp_cb on_header_value_complete; - nullptr, // llhttp_cb on_chunk_extension_name_complete; - nullptr, // llhttp_cb on_chunk_extension_value_complete; - nullptr, // llhttp_cb on_chunk_header; - nullptr, // llhttp_cb on_chunk_complete; - nullptr, // llhttp_cb on_reset; + nullptr, // llhttp_cb on_message_begin; + nullptr, // llhttp_data_cb on_url; + nullptr, // llhttp_data_cb on_status; + nullptr, // llhttp_data_cb on_method; + nullptr, // llhttp_data_cb on_version; + nullptr, // llhttp_data_cb on_header_field; + nullptr, // llhttp_data_cb on_header_value; + nullptr, // llhttp_data_cb on_chunk_extension_name; + nullptr, // llhttp_data_cb on_chunk_extension_value; + htp_hdrs_completecb, // llhttp_cb on_headers_complete; + nullptr, // llhttp_data_cb on_body; + nullptr, // llhttp_cb on_message_complete; + nullptr, // llhttp_cb on_url_complete; + nullptr, // llhttp_cb on_status_complete; + nullptr, // llhttp_cb on_method_complete; + nullptr, // llhttp_cb on_version_complete; + nullptr, // llhttp_cb on_header_field_complete; + nullptr, // llhttp_cb on_header_value_complete; + nullptr, // llhttp_cb on_chunk_extension_name_complete; + nullptr, // llhttp_cb on_chunk_extension_value_complete; + nullptr, // llhttp_cb on_chunk_header; + nullptr, // llhttp_cb on_chunk_complete; + nullptr, // llhttp_cb on_reset; }; } // namespace @@ -378,7 +385,7 @@ int Http2Session::initiate_connection() { if (worker_blocker->blocked()) { if (LOG_ENABLED(INFO)) { SSLOG(INFO, this) - << "Worker wide backend connection was blocked temporarily"; + << "Worker wide backend connection was blocked temporarily"; } return -1; } @@ -466,13 +473,13 @@ int Http2Session::initiate_connection() { conn_.tls.client_session_cache = &addr_->tls_session_cache; auto sni_name = - addr_->sni.empty() ? StringRef{addr_->host} : StringRef{addr_->sni}; + addr_->sni.empty() ? StringRef{addr_->host} : StringRef{addr_->sni}; - if (!util::numeric_host(sni_name.c_str())) { + if (!util::numeric_host(sni_name.data())) { // TLS extensions: SNI. There is no documentation about the return // code for this function (actually this is macro wrapping SSL_ctrl // at the time of this writing). - SSL_set_tlsext_host_name(conn_.tls.ssl, sni_name.c_str()); + SSL_set_tlsext_host_name(conn_.tls.ssl, sni_name.data()); } auto tls_session = tls::reuse_tls_session(addr_->tls_session_cache); @@ -519,8 +526,8 @@ int Http2Session::initiate_connection() { if (conn_.fd == -1) { auto error = errno; SSLOG(WARN, this) - << "socket() failed; addr=" << util::to_numeric_addr(raddr_) - << ", errno=" << error; + << "socket() failed; addr=" << util::to_numeric_addr(raddr_) + << ", errno=" << error; worker_blocker->on_failure(); return -1; @@ -534,8 +541,8 @@ int Http2Session::initiate_connection() { if (rv != 0 && errno != EINPROGRESS) { auto error = errno; SSLOG(WARN, this) - << "connect() failed; addr=" << util::to_numeric_addr(raddr_) - << ", errno=" << error; + << "connect() failed; addr=" << util::to_numeric_addr(raddr_) + << ", errno=" << error; downstream_failure(addr_, raddr_); return -1; @@ -584,8 +591,8 @@ int Http2Session::initiate_connection() { if (conn_.fd == -1) { auto error = errno; SSLOG(WARN, this) - << "socket() failed; addr=" << util::to_numeric_addr(raddr_) - << ", errno=" << error; + << "socket() failed; addr=" << util::to_numeric_addr(raddr_) + << ", errno=" << error; worker_blocker->on_failure(); return -1; @@ -598,8 +605,8 @@ int Http2Session::initiate_connection() { if (rv != 0 && errno != EINPROGRESS) { auto error = errno; SSLOG(WARN, this) - << "connect() failed; addr=" << util::to_numeric_addr(raddr_) - << ", errno=" << error; + << "connect() failed; addr=" << util::to_numeric_addr(raddr_) + << ", errno=" << error; downstream_failure(addr_, raddr_); return -1; @@ -693,7 +700,7 @@ int Http2Session::downstream_connect_proxy() { } std::string req = "CONNECT "; - req.append(addr_->hostport.c_str(), addr_->hostport.size()); + req.append(addr_->hostport.data(), addr_->hostport.size()); if (addr_->port == 80 || addr_->port == 443) { req += ':'; req += util::utos(addr_->port); @@ -725,7 +732,7 @@ void Http2Session::add_downstream_connection(Http2DownstreamConnection *dconn) { } void Http2Session::remove_downstream_connection( - Http2DownstreamConnection *dconn) { + Http2DownstreamConnection *dconn) { --addr_->num_dconn; dconns_.remove(dconn); dconn->detach_stream_data(); @@ -755,15 +762,15 @@ void Http2Session::remove_stream_data(StreamData *sd) { int Http2Session::submit_request(Http2DownstreamConnection *dconn, const nghttp2_nv *nva, size_t nvlen, - const nghttp2_data_provider *data_prd) { + const nghttp2_data_provider2 *data_prd) { assert(state_ == Http2SessionState::CONNECTED); auto sd = std::make_unique(); sd->dlnext = sd->dlprev = nullptr; // TODO Specify nullptr to pri_spec for now auto stream_id = - nghttp2_submit_request(session_, nullptr, nva, nvlen, data_prd, sd.get()); + nghttp2_submit_request2(session_, nullptr, nva, nvlen, data_prd, sd.get()); if (stream_id < 0) { - SSLOG(FATAL, this) << "nghttp2_submit_request() failed: " + SSLOG(FATAL, this) << "nghttp2_submit_request2() failed: " << nghttp2_strerror(stream_id); return -1; } @@ -828,11 +835,11 @@ int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, auto http2session = static_cast(user_data); if (LOG_ENABLED(INFO)) { SSLOG(INFO, http2session) - << "Stream stream_id=" << stream_id - << " is being closed with error code " << error_code; + << "Stream stream_id=" << stream_id << " is being closed with error code " + << error_code; } auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, stream_id)); + nghttp2_session_get_stream_user_data(session, stream_id)); if (sd == 0) { // We might get this close callback when pushed streams are // closed. @@ -853,7 +860,7 @@ int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, upstream->cancel_premature_downstream(downstream); } else { if (downstream->get_upgraded() && downstream->get_response_state() == - DownstreamState::HEADER_COMPLETE) { + DownstreamState::HEADER_COMPLETE) { // For tunneled connection, we have to submit RST_STREAM to // upstream *after* whole response body is sent. We just set // MSG_COMPLETE here. Upstream will take care of that. @@ -873,7 +880,7 @@ int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, } if (downstream->get_response_state() == DownstreamState::MSG_RESET && downstream->get_response_rst_stream_error_code() == - NGHTTP2_NO_ERROR) { + NGHTTP2_NO_ERROR) { downstream->set_response_rst_stream_error_code(error_code); } call_downstream_readcb(http2session, downstream); @@ -903,7 +910,7 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, uint8_t flags, void *user_data) { auto http2session = static_cast(user_data); auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { return 0; } @@ -921,13 +928,13 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, !downstream->get_expect_final_response(); if (resp.fs.buffer_size() + namebuf.len + valuebuf.len > - httpconf.response_header_field_buffer || + httpconf.response_header_field_buffer || resp.fs.num_fields() >= httpconf.max_response_header_fields) { if (LOG_ENABLED(INFO)) { DLOG(INFO, downstream) - << "Too large or many header field size=" - << resp.fs.buffer_size() + namebuf.len + valuebuf.len - << ", num=" << resp.fs.num_fields() + 1; + << "Too large or many header field size=" + << resp.fs.buffer_size() + namebuf.len + valuebuf.len + << ", num=" << resp.fs.num_fields() + 1; } if (trailer) { @@ -939,7 +946,9 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } - auto token = http2::lookup_token(namebuf.base, namebuf.len); + auto nameref = StringRef{namebuf.base, namebuf.len}; + auto valueref = StringRef{valuebuf.base, valuebuf.len}; + auto token = http2::lookup_token(nameref); auto no_index = flags & NGHTTP2_NV_FLAG_NO_INDEX; downstream->add_rcbuf(name); @@ -947,21 +956,17 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, if (trailer) { // just store header fields for trailer part - resp.fs.add_trailer_token(StringRef{namebuf.base, namebuf.len}, - StringRef{valuebuf.base, valuebuf.len}, - no_index, token); + resp.fs.add_trailer_token(nameref, valueref, no_index, token); return 0; } - resp.fs.add_header_token(StringRef{namebuf.base, namebuf.len}, - StringRef{valuebuf.base, valuebuf.len}, no_index, - token); + resp.fs.add_header_token(nameref, valueref, no_index, token); return 0; } case NGHTTP2_PUSH_PROMISE: { auto promised_stream_id = frame->push_promise.promised_stream_id; auto promised_sd = static_cast( - nghttp2_session_get_stream_user_data(session, promised_stream_id)); + nghttp2_session_get_stream_user_data(session, promised_stream_id)); if (!promised_sd || !promised_sd->dconn) { http2session->submit_rst_stream(promised_stream_id, NGHTTP2_CANCEL); return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; @@ -978,13 +983,13 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, // We use request header limit for PUSH_PROMISE if (promised_req.fs.buffer_size() + namebuf.len + valuebuf.len > - httpconf.request_header_field_buffer || + httpconf.request_header_field_buffer || promised_req.fs.num_fields() >= httpconf.max_request_header_fields) { if (LOG_ENABLED(INFO)) { DLOG(INFO, downstream) - << "Too large or many header field size=" - << promised_req.fs.buffer_size() + namebuf.len + valuebuf.len - << ", num=" << promised_req.fs.num_fields() + 1; + << "Too large or many header field size=" + << promised_req.fs.buffer_size() + namebuf.len + valuebuf.len + << ", num=" << promised_req.fs.num_fields() + 1; } return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; @@ -993,9 +998,10 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, promised_downstream->add_rcbuf(name); promised_downstream->add_rcbuf(value); - auto token = http2::lookup_token(namebuf.base, namebuf.len); - promised_req.fs.add_header_token(StringRef{namebuf.base, namebuf.len}, - StringRef{valuebuf.base, valuebuf.len}, + auto nameref = StringRef{namebuf.base, namebuf.len}; + auto valueref = StringRef{valuebuf.base, valuebuf.len}; + auto token = http2::lookup_token(nameref); + promised_req.fs.add_header_token(nameref, valueref, flags & NGHTTP2_NV_FLAG_NO_INDEX, token); return 0; @@ -1013,7 +1019,7 @@ int on_invalid_header_callback2(nghttp2_session *session, void *user_data) { auto http2session = static_cast(user_data); auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { return 0; } @@ -1031,10 +1037,10 @@ int on_invalid_header_callback2(nghttp2_session *session, auto valuebuf = nghttp2_rcbuf_get_buf(value); SSLOG(INFO, http2session) - << "Invalid header field for stream_id=" << stream_id - << " in frame type=" << static_cast(frame->hd.type) - << ": name=[" << StringRef{namebuf.base, namebuf.len} << "], value=[" - << StringRef{valuebuf.base, valuebuf.len} << "]"; + << "Invalid header field for stream_id=" << stream_id + << " in frame type=" << static_cast(frame->hd.type) + << ": name=[" << StringRef{namebuf.base, namebuf.len} << "], value=[" + << StringRef{valuebuf.base, valuebuf.len} << "]"; } http2session->submit_rst_stream(stream_id, NGHTTP2_PROTOCOL_ERROR); @@ -1055,7 +1061,7 @@ int on_begin_headers_callback(nghttp2_session *session, return 0; } auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { http2session->submit_rst_stream(frame->hd.stream_id, NGHTTP2_INTERNAL_ERROR); @@ -1066,7 +1072,7 @@ int on_begin_headers_callback(nghttp2_session *session, case NGHTTP2_PUSH_PROMISE: { auto promised_stream_id = frame->push_promise.promised_stream_id; auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { http2session->submit_rst_stream(promised_stream_id, NGHTTP2_CANCEL); return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; @@ -1118,7 +1124,7 @@ int on_response_headers(Http2Session *http2session, Downstream *downstream, resp.http_minor = 0; downstream->set_downstream_addr_group( - http2session->get_downstream_addr_group()); + http2session->get_downstream_addr_group()); downstream->set_addr(http2session->get_addr()); if (LOG_ENABLED(INFO)) { @@ -1127,12 +1133,11 @@ int on_response_headers(Http2Session *http2session, Downstream *downstream, ss << TTY_HTTP_HD << nv.name << TTY_RST << ": " << nv.value << "\n"; } SSLOG(INFO, http2session) - << "HTTP response headers. stream_id=" << frame->hd.stream_id << "\n" - << ss.str(); + << "HTTP response headers. stream_id=" << frame->hd.stream_id << "\n" + << ss.str(); } if (downstream->get_non_final_response()) { - if (LOG_ENABLED(INFO)) { SSLOG(INFO, http2session) << "This is non-final response."; } @@ -1165,13 +1170,14 @@ int on_response_headers(Http2Session *http2session, Downstream *downstream, downstream->set_request_state(DownstreamState::HEADER_COMPLETE); if (LOG_ENABLED(INFO)) { SSLOG(INFO, http2session) - << "HTTP upgrade success. stream_id=" << frame->hd.stream_id; + << "HTTP upgrade success. stream_id=" << frame->hd.stream_id; } } else { auto content_length = resp.fs.header(http2::HD_CONTENT_LENGTH); if (content_length) { // libnghttp2 guarantees this can be parsed - resp.fs.content_length = util::parse_uint(content_length->value); + resp.fs.content_length = + util::parse_uint(content_length->value).value_or(-1); } if (resp.fs.content_length == -1 && downstream->expect_response_body()) { @@ -1184,8 +1190,7 @@ int on_response_headers(Http2Session *http2session, Downstream *downstream, // Otherwise, use chunked encoding to keep upstream connection // open. In HTTP2, we are supposed not to receive // transfer-encoding. - resp.fs.add_header_token(StringRef::from_lit("transfer-encoding"), - StringRef::from_lit("chunked"), false, + resp.fs.add_header_token("transfer-encoding"_sr, "chunked"_sr, false, http2::HD_TRANSFER_ENCODING); downstream->set_chunked_response(true); } @@ -1227,7 +1232,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, switch (frame->hd.type) { case NGHTTP2_DATA: { auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { return 0; } @@ -1240,12 +1245,10 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, downstream->set_response_state(DownstreamState::MSG_RESET); } else if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { - downstream->disable_downstream_rtimer(); if (downstream->get_response_state() == DownstreamState::HEADER_COMPLETE) { - downstream->set_response_state(DownstreamState::MSG_COMPLETE); rv = upstream->on_downstream_body_complete(downstream); @@ -1261,7 +1264,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, } case NGHTTP2_HEADERS: { auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { return 0; } @@ -1310,11 +1313,11 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, } case NGHTTP2_RST_STREAM: { auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (sd && sd->dconn) { auto downstream = sd->dconn->get_downstream(); downstream->set_response_rst_stream_error_code( - frame->rst_stream.error_code); + frame->rst_stream.error_code); call_downstream_readcb(http2session, downstream); } return 0; @@ -1347,13 +1350,12 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, if (LOG_ENABLED(INFO)) { SSLOG(INFO, http2session) - << "Received downstream PUSH_PROMISE stream_id=" - << frame->hd.stream_id - << ", promised_stream_id=" << promised_stream_id; + << "Received downstream PUSH_PROMISE stream_id=" << frame->hd.stream_id + << ", promised_stream_id=" << promised_stream_id; } auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { http2session->submit_rst_stream(promised_stream_id, NGHTTP2_CANCEL); return 0; @@ -1365,7 +1367,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, assert(downstream->get_downstream_stream_id() == frame->hd.stream_id); auto promised_sd = static_cast( - nghttp2_session_get_stream_user_data(session, promised_stream_id)); + nghttp2_session_get_stream_user_data(session, promised_stream_id)); if (!promised_sd || !promised_sd->dconn) { http2session->submit_rst_stream(promised_stream_id, NGHTTP2_CANCEL); return 0; @@ -1376,7 +1378,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, assert(promised_downstream); if (http2session->handle_downstream_push_promise_complete( - downstream, promised_downstream) != 0) { + downstream, promised_downstream) != 0) { http2session->submit_rst_stream(promised_stream_id, NGHTTP2_CANCEL); return 0; } @@ -1389,9 +1391,9 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, frame->goaway.opaque_data_len); SSLOG(INFO, http2session) - << "GOAWAY received: last-stream-id=" << frame->goaway.last_stream_id - << ", error_code=" << frame->goaway.error_code - << ", debug_data=" << debug_data; + << "GOAWAY received: last-stream-id=" << frame->goaway.last_stream_id + << ", error_code=" << frame->goaway.error_code + << ", debug_data=" << debug_data; } return 0; default: @@ -1407,7 +1409,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags, int rv; auto http2session = static_cast(user_data); auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, stream_id)); + nghttp2_session_get_stream_user_data(session, stream_id)); if (!sd || !sd->dconn) { http2session->submit_rst_stream(stream_id, NGHTTP2_INTERNAL_ERROR); @@ -1471,7 +1473,7 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, if (frame->hd.type == NGHTTP2_DATA || frame->hd.type == NGHTTP2_HEADERS) { auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { return 0; @@ -1528,7 +1530,7 @@ int on_frame_not_send_callback(nghttp2_session *session, } auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd) { return 0; } @@ -1568,7 +1570,7 @@ int send_data_callback(nghttp2_session *session, nghttp2_frame *frame, nghttp2_data_source *source, void *user_data) { auto http2session = static_cast(user_data); auto sd = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (sd == nullptr) { return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; @@ -1626,35 +1628,35 @@ nghttp2_session_callbacks *create_http2_downstream_callbacks() { } nghttp2_session_callbacks_set_on_stream_close_callback( - callbacks, on_stream_close_callback); + callbacks, on_stream_close_callback); nghttp2_session_callbacks_set_on_frame_recv_callback(callbacks, on_frame_recv_callback); nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - callbacks, on_data_chunk_recv_callback); + callbacks, on_data_chunk_recv_callback); nghttp2_session_callbacks_set_on_frame_send_callback(callbacks, on_frame_send_callback); nghttp2_session_callbacks_set_on_frame_not_send_callback( - callbacks, on_frame_not_send_callback); + callbacks, on_frame_not_send_callback); nghttp2_session_callbacks_set_on_header_callback2(callbacks, on_header_callback2); nghttp2_session_callbacks_set_on_invalid_header_callback2( - callbacks, on_invalid_header_callback2); + callbacks, on_invalid_header_callback2); nghttp2_session_callbacks_set_on_begin_headers_callback( - callbacks, on_begin_headers_callback); + callbacks, on_begin_headers_callback); nghttp2_session_callbacks_set_send_data_callback(callbacks, send_data_callback); if (get_config()->padding) { - nghttp2_session_callbacks_set_select_padding_callback( - callbacks, http::select_padding_callback); + nghttp2_session_callbacks_set_select_padding_callback2( + callbacks, http::select_padding_callback); } return callbacks; @@ -1672,14 +1674,7 @@ int Http2Session::connection_made() { const unsigned char *next_proto = nullptr; unsigned int next_proto_len = 0; -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_get0_next_proto_negotiated(conn_.tls.ssl, &next_proto, &next_proto_len); -#endif // !OPENSSL_NO_NEXTPROTONEG -#if OPENSSL_VERSION_NUMBER >= 0x10002000L - if (!next_proto) { - SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len); - } -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L + SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len); if (!next_proto) { downstream_failure(addr_, raddr_); @@ -1730,15 +1725,15 @@ int Http2Session::connection_made() { ++nentry; } - rv = nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, entry.data(), - nentry); + rv = + nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, entry.data(), nentry); if (rv != 0) { return -1; } rv = nghttp2_session_set_local_window_size( - session_, NGHTTP2_FLAG_NONE, 0, - http2conf.downstream.connection_window_size); + session_, NGHTTP2_FLAG_NONE, 0, + http2conf.downstream.connection_window_size); if (rv != 0) { return -1; } @@ -1761,11 +1756,9 @@ int Http2Session::on_read(const uint8_t *data, size_t datalen) { int Http2Session::on_write() { return on_write_(*this); } int Http2Session::downstream_read(const uint8_t *data, size_t datalen) { - ssize_t rv; - - rv = nghttp2_session_mem_recv(session_, data, datalen); + auto rv = nghttp2_session_mem_recv2(session_, data, datalen); if (rv < 0) { - SSLOG(ERROR, this) << "nghttp2_session_mem_recv() returned error: " + SSLOG(ERROR, this) << "nghttp2_session_mem_recv2() returned error: " << nghttp2_strerror(rv); return -1; } @@ -1785,9 +1778,9 @@ int Http2Session::downstream_read(const uint8_t *data, size_t datalen) { int Http2Session::downstream_write() { for (;;) { const uint8_t *data; - auto datalen = nghttp2_session_mem_send(session_, &data); + auto datalen = nghttp2_session_mem_send2(session_, &data); if (datalen < 0) { - SSLOG(ERROR, this) << "nghttp2_session_mem_send() returned error: " + SSLOG(ERROR, this) << "nghttp2_session_mem_send2() returned error: " << nghttp2_strerror(datalen); return -1; } @@ -2219,7 +2212,7 @@ int Http2Session::handle_downstream_push_promise(Downstream *downstream, } auto promised_downstream = - upstream->on_downstream_push_promise(downstream, promised_stream_id); + upstream->on_downstream_push_promise(downstream, promised_stream_id); if (!promised_downstream) { return -1; } @@ -2235,7 +2228,7 @@ int Http2Session::handle_downstream_push_promise(Downstream *downstream, auto ptr = promised_dconn.get(); if (promised_downstream->attach_downstream_connection( - std::move(promised_dconn)) != 0) { + std::move(promised_dconn)) != 0) { return -1; } @@ -2251,7 +2244,7 @@ int Http2Session::handle_downstream_push_promise(Downstream *downstream, } int Http2Session::handle_downstream_push_promise_complete( - Downstream *downstream, Downstream *promised_downstream) { + Downstream *downstream, Downstream *promised_downstream) { auto &promised_req = promised_downstream->request(); auto &promised_balloc = promised_downstream->get_block_allocator(); @@ -2288,7 +2281,7 @@ int Http2Session::handle_downstream_push_promise_complete( } // For server-wide OPTIONS request, path is empty. - if (method_token != HTTP_OPTIONS || path->value != "*") { + if (method_token != HTTP_OPTIONS || path->value != "*"_sr) { promised_req.path = http2::rewrite_clean_path(promised_balloc, path->value); } @@ -2318,8 +2311,8 @@ bool Http2Session::max_concurrency_reached(size_t extra) const { // that maximum concurrency is reached. return !nghttp2_session_check_request_allowed(session_) || dconns_.size() + extra >= - nghttp2_session_get_remote_settings( - session_, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS); + nghttp2_session_get_remote_settings( + session_, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS); } const std::shared_ptr & diff --git a/lib/nghttp2/src/shrpx_http2_session.h b/lib/nghttp2-1.65.0/src/shrpx_http2_session.h similarity index 96% rename from lib/nghttp2/src/shrpx_http2_session.h rename to lib/nghttp2-1.65.0/src/shrpx_http2_session.h index 31b25458bf2..e34026254cf 100644 --- a/lib/nghttp2/src/shrpx_http2_session.h +++ b/lib/nghttp2-1.65.0/src/shrpx_http2_session.h @@ -30,7 +30,14 @@ #include #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include @@ -116,7 +123,7 @@ class Http2Session { void remove_stream_data(StreamData *sd); int submit_request(Http2DownstreamConnection *dconn, const nghttp2_nv *nva, - size_t nvlen, const nghttp2_data_provider *data_prd); + size_t nvlen, const nghttp2_data_provider2 *data_prd); int submit_rst_stream(int32_t stream_id, uint32_t error_code); diff --git a/lib/nghttp2/src/shrpx_http2_upstream.cc b/lib/nghttp2-1.65.0/src/shrpx_http2_upstream.cc similarity index 87% rename from lib/nghttp2/src/shrpx_http2_upstream.cc rename to lib/nghttp2-1.65.0/src/shrpx_http2_upstream.cc index c9f8a8caca2..af2f161a987 100644 --- a/lib/nghttp2/src/shrpx_http2_upstream.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_http2_upstream.cc @@ -65,7 +65,7 @@ int on_stream_close_callback(nghttp2_session *session, int32_t stream_id, } auto downstream = static_cast( - nghttp2_session_get_stream_user_data(session, stream_id)); + nghttp2_session_get_stream_user_data(session, stream_id)); if (!downstream) { return 0; @@ -118,8 +118,8 @@ int Http2Upstream::upgrade_upstream(HttpsUpstream *http) { std::end(http2_settings)); rv = nghttp2_session_upgrade2( - session_, settings_payload.byte(), settings_payload.size(), - http->get_downstream()->request().method == HTTP_HEAD, nullptr); + session_, settings_payload.data(), settings_payload.size(), + http->get_downstream()->request().method == HTTP_HEAD, nullptr); if (rv != 0) { if (LOG_ENABLED(INFO)) { ULOG(INFO, this) << "nghttp2_session_upgrade() returned error: " @@ -175,7 +175,7 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, } auto upstream = static_cast(user_data); auto downstream = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!downstream) { return 0; } @@ -185,7 +185,7 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, auto &httpconf = config->http; if (req.fs.buffer_size() + namebuf.len + valuebuf.len > - httpconf.request_header_field_buffer || + httpconf.request_header_field_buffer || req.fs.num_fields() >= httpconf.max_request_header_fields) { if (downstream->get_response_state() == DownstreamState::MSG_COMPLETE) { return 0; @@ -209,7 +209,9 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, return 0; } - auto token = http2::lookup_token(namebuf.base, namebuf.len); + auto nameref = StringRef{namebuf.base, namebuf.len}; + auto valueref = StringRef{valuebuf.base, valuebuf.len}; + auto token = http2::lookup_token(nameref); auto no_index = flags & NGHTTP2_NV_FLAG_NO_INDEX; downstream->add_rcbuf(name); @@ -217,15 +219,11 @@ int on_header_callback2(nghttp2_session *session, const nghttp2_frame *frame, if (frame->headers.cat == NGHTTP2_HCAT_HEADERS) { // just store header fields for trailer part - req.fs.add_trailer_token(StringRef{namebuf.base, namebuf.len}, - StringRef{valuebuf.base, valuebuf.len}, no_index, - token); + req.fs.add_trailer_token(nameref, valueref, no_index, token); return 0; } - req.fs.add_header_token(StringRef{namebuf.base, namebuf.len}, - StringRef{valuebuf.base, valuebuf.len}, no_index, - token); + req.fs.add_header_token(nameref, valueref, no_index, token); return 0; } } // namespace @@ -237,7 +235,7 @@ int on_invalid_header_callback2(nghttp2_session *session, void *user_data) { auto upstream = static_cast(user_data); auto downstream = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!downstream) { return 0; } @@ -285,7 +283,10 @@ void Http2Upstream::on_start_request(const nghttp2_frame *frame) { downstream->reset_upstream_rtimer(); - handler_->repeat_read_timer(); + auto config = get_config(); + auto &httpconf = config->http; + + handler_->reset_upstream_read_timeout(httpconf.timeout.header); auto &req = downstream->request(); @@ -298,8 +299,6 @@ void Http2Upstream::on_start_request(const nghttp2_frame *frame) { ++num_requests_; - auto config = get_config(); - auto &httpconf = config->http; if (httpconf.max_requests <= num_requests_) { start_graceful_shutdown(); } @@ -321,7 +320,7 @@ int Http2Upstream::on_request_headers(Downstream *downstream, if (LOG_ENABLED(INFO)) { std::stringstream ss; for (auto &nv : nva) { - if (nv.name == "authorization") { + if (nv.name == "authorization"_sr) { ss << TTY_HTTP_HD << nv.name << TTY_RST << ": \n"; continue; } @@ -342,7 +341,8 @@ int Http2Upstream::on_request_headers(Downstream *downstream, auto content_length = req.fs.header(http2::HD_CONTENT_LENGTH); if (content_length) { // libnghttp2 guarantees this can be parsed - req.fs.content_length = util::parse_uint(content_length->value); + req.fs.content_length = + util::parse_uint(content_length->value).value_or(-1); } // presence of mandatory header fields are guaranteed by libnghttp2. @@ -384,8 +384,7 @@ int Http2Upstream::on_request_headers(Downstream *downstream, } if (path) { - if (method_token == HTTP_OPTIONS && - path->value == StringRef::from_lit("*")) { + if (method_token == HTTP_OPTIONS && path->value == "*"_sr) { // Server-wide OPTIONS request. Path is empty. } else if (config->http2_proxy && faddr->alt_mode == UpstreamAltMode::NONE) { @@ -398,7 +397,7 @@ int Http2Upstream::on_request_headers(Downstream *downstream, auto connect_proto = req.fs.header(http2::HD__PROTOCOL); if (connect_proto) { - if (connect_proto->value != "websocket") { + if (connect_proto->value != "websocket"_sr) { if (error_reply(downstream, 400) != 0) { return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } @@ -519,7 +518,6 @@ void Http2Upstream::initiate_downstream(Downstream *downstream) { rv = downstream->push_request_headers(); if (rv != 0) { - if (error_reply(downstream, 502) != 0) { rst_stream(downstream, NGHTTP2_INTERNAL_ERROR); } @@ -554,7 +552,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, switch (frame->hd.type) { case NGHTTP2_DATA: { auto downstream = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!downstream) { return 0; } @@ -575,7 +573,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, } case NGHTTP2_HEADERS: { auto downstream = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!downstream) { return 0; } @@ -631,7 +629,7 @@ int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags, size_t len, void *user_data) { auto upstream = static_cast(user_data); auto downstream = static_cast( - nghttp2_session_get_stream_user_data(session, stream_id)); + nghttp2_session_get_stream_user_data(session, stream_id)); if (!downstream) { if (upstream->consume(stream_id, len) != 0) { @@ -677,7 +675,7 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, // RST_STREAM if request is still incomplete. auto stream_id = frame->hd.stream_id; auto downstream = static_cast( - nghttp2_session_get_stream_user_data(session, stream_id)); + nghttp2_session_get_stream_user_data(session, stream_id)); if (!downstream) { return 0; @@ -688,10 +686,10 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, nghttp2_session_get_stream_remote_close(session, stream_id) == 0) { if (LOG_ENABLED(INFO)) { ULOG(INFO, upstream) - << "Send RST_STREAM to " - << (downstream->get_upgraded() ? "tunneled " : "") - << "stream stream_id=" << downstream->get_stream_id() - << " to finish off incomplete request"; + << "Send RST_STREAM to " + << (downstream->get_upgraded() ? "tunneled " : "") + << "stream stream_id=" << downstream->get_stream_id() + << " to finish off incomplete request"; } upstream->rst_stream(downstream, NGHTTP2_NO_ERROR); @@ -714,10 +712,10 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, } auto promised_downstream = std::make_unique( - upstream, handler->get_mcpool(), promised_stream_id); + upstream, handler->get_mcpool(), promised_stream_id); auto &req = promised_downstream->request(); - // As long as we use nghttp2_session_mem_send(), setting stream + // As long as we use nghttp2_session_mem_send2(), setting stream // user data here should not fail. This is because this callback // is called just after frame was serialized. So no worries about // hanging Downstream. @@ -739,11 +737,11 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, auto &nv = frame->push_promise.nva[i]; auto name = - make_string_ref(promised_balloc, StringRef{nv.name, nv.namelen}); + make_string_ref(promised_balloc, StringRef{nv.name, nv.namelen}); auto value = - make_string_ref(promised_balloc, StringRef{nv.value, nv.valuelen}); + make_string_ref(promised_balloc, StringRef{nv.value, nv.valuelen}); - auto token = http2::lookup_token(nv.name, nv.namelen); + auto token = http2::lookup_token(name); switch (token) { case http2::HD__METHOD: req.method = http2::lookup_method_token(value); @@ -821,7 +819,7 @@ int on_frame_not_send_callback(nghttp2_session *session, lib_error_code != NGHTTP2_ERR_STREAM_CLOSING) { // To avoid stream hanging around, issue RST_STREAM. auto downstream = static_cast( - nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); + nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (downstream) { upstream->rst_stream(downstream, NGHTTP2_INTERNAL_ERROR); } @@ -966,28 +964,28 @@ nghttp2_session_callbacks *create_http2_upstream_callbacks() { } nghttp2_session_callbacks_set_on_stream_close_callback( - callbacks, on_stream_close_callback); + callbacks, on_stream_close_callback); nghttp2_session_callbacks_set_on_frame_recv_callback(callbacks, on_frame_recv_callback); nghttp2_session_callbacks_set_on_data_chunk_recv_callback( - callbacks, on_data_chunk_recv_callback); + callbacks, on_data_chunk_recv_callback); nghttp2_session_callbacks_set_on_frame_send_callback(callbacks, on_frame_send_callback); nghttp2_session_callbacks_set_on_frame_not_send_callback( - callbacks, on_frame_not_send_callback); + callbacks, on_frame_not_send_callback); nghttp2_session_callbacks_set_on_header_callback2(callbacks, on_header_callback2); nghttp2_session_callbacks_set_on_invalid_header_callback2( - callbacks, on_invalid_header_callback2); + callbacks, on_invalid_header_callback2); nghttp2_session_callbacks_set_on_begin_headers_callback( - callbacks, on_begin_headers_callback); + callbacks, on_begin_headers_callback); nghttp2_session_callbacks_set_send_data_callback(callbacks, send_data_callback); @@ -995,8 +993,8 @@ nghttp2_session_callbacks *create_http2_upstream_callbacks() { auto config = get_config(); if (config->padding) { - nghttp2_session_callbacks_set_select_padding_callback( - callbacks, http::select_padding_callback); + nghttp2_session_callbacks_set_select_padding_callback2( + callbacks, http::select_padding_callback); } if (config->http2.upstream.debug.frame_debug) { @@ -1020,13 +1018,13 @@ size_t downstream_queue_size(Worker *worker) { } // namespace Http2Upstream::Http2Upstream(ClientHandler *handler) - : wb_(handler->get_worker()->get_mcpool()), - downstream_queue_(downstream_queue_size(handler->get_worker()), - !get_config()->http2_proxy), - handler_(handler), - session_(nullptr), - max_buffer_size_(MAX_BUFFER_SIZE), - num_requests_(0) { + : wb_(handler->get_worker()->get_mcpool()), + downstream_queue_(downstream_queue_size(handler->get_worker()), + !get_config()->http2_proxy), + handler_(handler), + session_(nullptr), + max_buffer_size_(MAX_BUFFER_SIZE), + num_requests_(0) { int rv; auto config = get_config(); @@ -1035,10 +1033,10 @@ Http2Upstream::Http2Upstream(ClientHandler *handler) auto faddr = handler_->get_upstream_addr(); rv = - nghttp2_session_server_new2(&session_, http2conf.upstream.callbacks, this, - faddr->alt_mode != UpstreamAltMode::NONE - ? http2conf.upstream.alt_mode_option - : http2conf.upstream.option); + nghttp2_session_server_new2(&session_, http2conf.upstream.callbacks, this, + faddr->alt_mode != UpstreamAltMode::NONE + ? http2conf.upstream.alt_mode_option + : http2conf.upstream.option); assert(rv == 0); @@ -1074,27 +1072,27 @@ Http2Upstream::Http2Upstream(ClientHandler *handler) ++nentry; } - rv = nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, entry.data(), - nentry); + rv = + nghttp2_submit_settings(session_, NGHTTP2_FLAG_NONE, entry.data(), nentry); if (rv != 0) { ULOG(ERROR, this) << "nghttp2_submit_settings() returned error: " << nghttp2_strerror(rv); } auto window_size = faddr->alt_mode != UpstreamAltMode::NONE - ? std::numeric_limits::max() + ? std::numeric_limits::max() : http2conf.upstream.optimize_window_size - ? std::min(http2conf.upstream.connection_window_size, - NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE) - : http2conf.upstream.connection_window_size; + ? std::min(http2conf.upstream.connection_window_size, + NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE) + : http2conf.upstream.connection_window_size; rv = nghttp2_session_set_local_window_size(session_, NGHTTP2_FLAG_NONE, 0, window_size); if (rv != 0) { ULOG(ERROR, this) - << "nghttp2_session_set_local_window_size() returned error: " - << nghttp2_strerror(rv); + << "nghttp2_session_set_local_window_size() returned error: " + << nghttp2_strerror(rv); } // We wait for SETTINGS ACK at least 10 seconds. @@ -1132,7 +1130,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler) #endif // defined(TCP_INFO) && defined(TCP_NOTSENT_LOWAT) handler_->reset_upstream_read_timeout( - config->conn.upstream.timeout.http2_read); + config->conn.upstream.timeout.http2_idle); handler_->signal_write(); } @@ -1145,21 +1143,20 @@ Http2Upstream::~Http2Upstream() { } int Http2Upstream::on_read() { - ssize_t rv = 0; auto rb = handler_->get_rb(); auto rlimit = handler_->get_rlimit(); if (rb->rleft()) { - rv = nghttp2_session_mem_recv(session_, rb->pos(), rb->rleft()); + auto rv = nghttp2_session_mem_recv2(session_, rb->pos(), rb->rleft()); if (rv < 0) { if (rv != NGHTTP2_ERR_BAD_CLIENT_MAGIC) { - ULOG(ERROR, this) << "nghttp2_session_mem_recv() returned error: " + ULOG(ERROR, this) << "nghttp2_session_mem_recv2() returned error: " << nghttp2_strerror(rv); } return -1; } - // nghttp2_session_mem_recv should consume all input bytes on + // nghttp2_session_mem_recv2 should consume all input bytes on // success. assert(static_cast(rv) == rb->rleft()); rb->reset(); @@ -1202,12 +1199,12 @@ int Http2Upstream::on_write() { static_cast(hint.rwin * 2)); rv = nghttp2_session_set_local_window_size( - session_, NGHTTP2_FLAG_NONE, 0, window_size); + session_, NGHTTP2_FLAG_NONE, 0, window_size); if (rv != 0) { if (LOG_ENABLED(INFO)) { ULOG(INFO, this) - << "nghttp2_session_set_local_window_size() with window_size=" - << window_size << " failed: " << nghttp2_strerror(rv); + << "nghttp2_session_set_local_window_size() with window_size=" + << window_size << " failed: " << nghttp2_strerror(rv); } } } @@ -1221,10 +1218,10 @@ int Http2Upstream::on_write() { } const uint8_t *data; - auto datalen = nghttp2_session_mem_send(session_, &data); + auto datalen = nghttp2_session_mem_send2(session_, &data); if (datalen < 0) { - ULOG(ERROR, this) << "nghttp2_session_mem_send() returned error: " + ULOG(ERROR, this) << "nghttp2_session_mem_send2() returned error: " << nghttp2_strerror(datalen); return -1; } @@ -1255,9 +1252,8 @@ int Http2Upstream::downstream_read(DownstreamConnection *dconn) { // RST_STREAM to the upstream and delete downstream connection // here. Deleting downstream will be taken place at // on_stream_close_callback. - rst_stream(downstream, - infer_upstream_rst_stream_error_code( - downstream->get_response_rst_stream_error_code())); + rst_stream(downstream, infer_upstream_rst_stream_error_code( + downstream->get_response_rst_stream_error_code())); downstream->pop_downstream_connection(); // dconn was deleted dconn = nullptr; @@ -1436,11 +1432,11 @@ int Http2Upstream::terminate_session(uint32_t error_code) { } namespace { -ssize_t downstream_data_read_callback(nghttp2_session *session, - int32_t stream_id, uint8_t *buf, - size_t length, uint32_t *data_flags, - nghttp2_data_source *source, - void *user_data) { +nghttp2_ssize downstream_data_read_callback(nghttp2_session *session, + int32_t stream_id, uint8_t *buf, + size_t length, uint32_t *data_flags, + nghttp2_data_source *source, + void *user_data) { int rv; auto downstream = static_cast(source->ptr); auto body = downstream->get_response_buf(); @@ -1471,7 +1467,6 @@ ssize_t downstream_data_read_callback(nghttp2_session *session, if (body_empty && downstream->get_response_state() == DownstreamState::MSG_COMPLETE) { - *data_flags |= NGHTTP2_DATA_FLAG_EOF; if (!downstream->get_upgraded()) { @@ -1481,8 +1476,8 @@ ssize_t downstream_data_read_callback(nghttp2_session *session, nva.reserve(trailers.size()); http2::copy_headers_to_nva_nocopy(nva, trailers, http2::HDOP_STRIP_ALL); if (!nva.empty()) { - rv = nghttp2_submit_trailer(session, stream_id, nva.data(), - nva.size()); + rv = + nghttp2_submit_trailer(session, stream_id, nva.data(), nva.size()); if (rv != 0) { if (nghttp2_is_fatal(rv)) { return NGHTTP2_ERR_CALLBACK_FAILURE; @@ -1508,12 +1503,18 @@ int Http2Upstream::send_reply(Downstream *downstream, const uint8_t *body, size_t bodylen) { int rv; - nghttp2_data_provider data_prd, *data_prd_ptr = nullptr; + nghttp2_data_provider2 data_prd, *data_prd_ptr = nullptr; + + const auto &req = downstream->request(); - if (bodylen) { + if (req.method != HTTP_HEAD && bodylen) { data_prd.source.ptr = downstream; data_prd.read_callback = downstream_data_read_callback; data_prd_ptr = &data_prd; + + auto buf = downstream->get_response_buf(); + + buf->append(body, bodylen); } const auto &resp = downstream->response(); @@ -1529,7 +1530,7 @@ int Http2Upstream::send_reply(Downstream *downstream, const uint8_t *body, auto response_status = http2::stringify_status(balloc, resp.http_status); - nva.push_back(http2::make_nv_ls_nocopy(":status", response_status)); + nva.push_back(http2::make_field(":status"_sr, response_status)); for (auto &kv : headers) { if (kv.name.empty() || kv.name[0] == ':') { @@ -1544,29 +1545,26 @@ int Http2Upstream::send_reply(Downstream *downstream, const uint8_t *body, case http2::HD_UPGRADE: continue; } - nva.push_back(http2::make_nv_nocopy(kv.name, kv.value, kv.no_index)); + nva.push_back( + http2::make_field(kv.name, kv.value, http2::no_index(kv.no_index))); } if (!resp.fs.header(http2::HD_SERVER)) { - nva.push_back(http2::make_nv_ls_nocopy("server", config->http.server_name)); + nva.push_back(http2::make_field("server"_sr, config->http.server_name)); } for (auto &p : httpconf.add_response_headers) { - nva.push_back(http2::make_nv_nocopy(p.name, p.value)); + nva.push_back(http2::make_field(p.name, p.value)); } - rv = nghttp2_submit_response(session_, downstream->get_stream_id(), - nva.data(), nva.size(), data_prd_ptr); + rv = nghttp2_submit_response2(session_, downstream->get_stream_id(), + nva.data(), nva.size(), data_prd_ptr); if (nghttp2_is_fatal(rv)) { - ULOG(FATAL, this) << "nghttp2_submit_response() failed: " + ULOG(FATAL, this) << "nghttp2_submit_response2() failed: " << nghttp2_strerror(rv); return -1; } - auto buf = downstream->get_response_buf(); - - buf->append(body, bodylen); - downstream->set_response_state(DownstreamState::MSG_COMPLETE); if (data_prd_ptr) { @@ -1585,13 +1583,22 @@ int Http2Upstream::error_reply(Downstream *downstream, auto html = http::create_error_html(balloc, status_code); resp.http_status = status_code; - auto body = downstream->get_response_buf(); - body->append(html); - downstream->set_response_state(DownstreamState::MSG_COMPLETE); - nghttp2_data_provider data_prd; - data_prd.source.ptr = downstream; - data_prd.read_callback = downstream_data_read_callback; + nghttp2_data_provider2 data_prd, *data_prd_ptr = nullptr; + + const auto &req = downstream->request(); + + if (req.method != HTTP_HEAD) { + data_prd.source.ptr = downstream; + data_prd.read_callback = downstream_data_read_callback; + data_prd_ptr = &data_prd; + + auto body = downstream->get_response_buf(); + + body->append(html); + } + + downstream->set_response_state(DownstreamState::MSG_COMPLETE); auto lgconf = log_config(); lgconf->update_tstamp(std::chrono::system_clock::now()); @@ -1600,17 +1607,17 @@ int Http2Upstream::error_reply(Downstream *downstream, auto content_length = util::make_string_ref_uint(balloc, html.size()); auto date = make_string_ref(balloc, lgconf->tstamp->time_http); - auto nva = std::array{ - {http2::make_nv_ls_nocopy(":status", response_status), - http2::make_nv_ll("content-type", "text/html; charset=UTF-8"), - http2::make_nv_ls_nocopy("server", get_config()->http.server_name), - http2::make_nv_ls_nocopy("content-length", content_length), - http2::make_nv_ls_nocopy("date", date)}}; + auto nva = std::to_array( + {http2::make_field(":status"_sr, response_status), + http2::make_field("content-type"_sr, "text/html; charset=UTF-8"_sr), + http2::make_field("server"_sr, get_config()->http.server_name), + http2::make_field("content-length"_sr, content_length), + http2::make_field("date"_sr, date)}); - rv = nghttp2_submit_response(session_, downstream->get_stream_id(), - nva.data(), nva.size(), &data_prd); + rv = nghttp2_submit_response2(session_, downstream->get_stream_id(), + nva.data(), nva.size(), data_prd_ptr); if (rv < NGHTTP2_ERR_FATAL) { - ULOG(FATAL, this) << "nghttp2_submit_response() failed: " + ULOG(FATAL, this) << "nghttp2_submit_response2() failed: " << nghttp2_strerror(rv); return -1; } @@ -1621,7 +1628,7 @@ int Http2Upstream::error_reply(Downstream *downstream, } void Http2Upstream::add_pending_downstream( - std::unique_ptr downstream) { + std::unique_ptr downstream) { downstream_queue_.add_pending(std::move(downstream)); } @@ -1641,7 +1648,10 @@ void Http2Upstream::remove_downstream(Downstream *downstream) { if (downstream_queue_.get_downstreams() == nullptr) { // There is no downstream at the moment. Start idle timer now. - handler_->repeat_read_timer(); + auto config = get_config(); + auto &upstreamconf = config->conn.upstream; + + handler_->reset_upstream_read_timeout(upstreamconf.timeout.http2_idle); } } @@ -1729,7 +1739,6 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { resp.fs.header(http2::HD_LINK) && (downstream->get_non_final_response() || resp.http_status == 200) && (req.method == HTTP_GET || req.method == HTTP_POST)) { - if (prepare_push_promise(downstream) != 0) { // Continue to send response even if push was failed. } @@ -1744,7 +1753,7 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { if (downstream->get_non_final_response()) { auto response_status = http2::stringify_status(balloc, resp.http_status); - nva.push_back(http2::make_nv_ls_nocopy(":status", response_status)); + nva.push_back(http2::make_field(":status"_sr, response_status)); http2::copy_headers_to_nva_nocopy(nva, resp.fs.headers(), http2::HDOP_STRIP_ALL); @@ -1777,16 +1786,16 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { response_status = http2::stringify_status(balloc, resp.http_status); } - nva.push_back(http2::make_nv_ls_nocopy(":status", response_status)); + nva.push_back(http2::make_field(":status"_sr, response_status)); http2::copy_headers_to_nva_nocopy(nva, resp.fs.headers(), striphd_flags); if (!config->http2_proxy && !httpconf.no_server_rewrite) { - nva.push_back(http2::make_nv_ls_nocopy("server", httpconf.server_name)); + nva.push_back(http2::make_field("server"_sr, httpconf.server_name)); } else { auto server = resp.fs.header(http2::HD_SERVER); if (server) { - nva.push_back(http2::make_nv_ls_nocopy("server", (*server).value)); + nva.push_back(http2::make_field("server"_sr, (*server).value)); } } @@ -1799,25 +1808,25 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { auto &shared_addr = group->shared_addr; auto &cookieconf = shared_addr->affinity.cookie; auto secure = - http::require_cookie_secure_attribute(cookieconf.secure, req.scheme); + http::require_cookie_secure_attribute(cookieconf.secure, req.scheme); auto cookie_str = http::create_affinity_cookie( - balloc, cookieconf.name, affinity_cookie, cookieconf.path, secure); - nva.push_back(http2::make_nv_ls_nocopy("set-cookie", cookie_str)); + balloc, cookieconf.name, affinity_cookie, cookieconf.path, secure); + nva.push_back(http2::make_field("set-cookie"_sr, cookie_str)); } } if (!resp.fs.header(http2::HD_ALT_SVC)) { // We won't change or alter alt-svc from backend for now if (!httpconf.http2_altsvc_header_value.empty()) { - nva.push_back(http2::make_nv_ls_nocopy( - "alt-svc", httpconf.http2_altsvc_header_value)); + nva.push_back( + http2::make_field("alt-svc"_sr, httpconf.http2_altsvc_header_value)); } } auto via = resp.fs.header(http2::HD_VIA); if (httpconf.no_via) { if (via) { - nva.push_back(http2::make_nv_ls_nocopy("via", (*via).value)); + nva.push_back(http2::make_field("via"_sr, (*via).value)); } } else { // we don't create more than 16 bytes in @@ -1828,7 +1837,7 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { } auto iov = make_byte_ref(balloc, len + 1); - auto p = iov.base; + auto p = std::begin(iov); if (via) { p = std::copy(std::begin(via->value), std::end(via->value), p); p = util::copy_lit(p, ", "); @@ -1836,17 +1845,18 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { p = http::create_via_header_value(p, resp.http_major, resp.http_minor); *p = '\0'; - nva.push_back(http2::make_nv_ls_nocopy("via", StringRef{iov.base, p})); + nva.push_back( + http2::make_field("via"_sr, StringRef{std::span{std::begin(iov), p}})); } for (auto &p : httpconf.add_response_headers) { - nva.push_back(http2::make_nv_nocopy(p.name, p.value)); + nva.push_back(http2::make_field(p.name, p.value)); } if (downstream->get_stream_id() % 2 == 0) { // This header field is basically for human on client side to // figure out that the resource is pushed. - nva.push_back(http2::make_nv_ll("x-http2-push", "1")); + nva.push_back(http2::make_field("x-http2-push"_sr, "1"_sr)); } if (LOG_ENABLED(INFO)) { @@ -1863,12 +1873,12 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { nghttp2_extpri extpri; if (nghttp2_session_get_extpri_stream_priority( - session_, &extpri, downstream->get_stream_id()) == 0 && + session_, &extpri, downstream->get_stream_id()) == 0 && nghttp2_extpri_parse_priority(&extpri, priority->value.byte(), priority->value.size()) == 0) { rv = nghttp2_session_change_extpri_stream_priority( - session_, downstream->get_stream_id(), &extpri, - /* ignore_client_signal = */ 1); + session_, downstream->get_stream_id(), &extpri, + /* ignore_client_signal = */ 1); if (rv != 0) { ULOG(ERROR, this) << "nghttp2_session_change_extpri_stream_priority: " << nghttp2_strerror(rv); @@ -1876,11 +1886,11 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { } } - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; data_prd.source.ptr = downstream; data_prd.read_callback = downstream_data_read_callback; - nghttp2_data_provider *data_prdptr; + nghttp2_data_provider2 *data_prdptr; if (downstream->expect_response_body() || downstream->expect_response_trailer()) { @@ -1889,10 +1899,10 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { data_prdptr = nullptr; } - rv = nghttp2_submit_response(session_, downstream->get_stream_id(), - nva.data(), nva.size(), data_prdptr); + rv = nghttp2_submit_response2(session_, downstream->get_stream_id(), + nva.data(), nva.size(), data_prdptr); if (rv != 0) { - ULOG(FATAL, this) << "nghttp2_submit_response() failed"; + ULOG(FATAL, this) << "nghttp2_submit_response2() failed"; return -1; } @@ -1976,7 +1986,7 @@ int Http2Upstream::on_downstream_abort_request(Downstream *downstream, } int Http2Upstream::on_downstream_abort_request_with_https_redirect( - Downstream *downstream) { + Downstream *downstream) { int rv; rv = redirect_to_https(downstream); @@ -1990,7 +2000,7 @@ int Http2Upstream::on_downstream_abort_request_with_https_redirect( int Http2Upstream::redirect_to_https(Downstream *downstream) { auto &req = downstream->request(); - if (req.regular_connect_method() || req.scheme != "http") { + if (req.regular_connect_method() || req.scheme != "http"_sr) { return error_reply(downstream, 400); } @@ -2004,19 +2014,16 @@ int Http2Upstream::redirect_to_https(Downstream *downstream) { auto &httpconf = config->http; StringRef loc; - if (httpconf.redirect_https_port == StringRef::from_lit("443")) { - loc = concat_string_ref(balloc, StringRef::from_lit("https://"), authority, - req.path); + if (httpconf.redirect_https_port == "443"_sr) { + loc = concat_string_ref(balloc, "https://"_sr, authority, req.path); } else { - loc = concat_string_ref(balloc, StringRef::from_lit("https://"), authority, - StringRef::from_lit(":"), + loc = concat_string_ref(balloc, "https://"_sr, authority, ":"_sr, httpconf.redirect_https_port, req.path); } auto &resp = downstream->response(); resp.http_status = 308; - resp.fs.add_header_token(StringRef::from_lit("location"), loc, false, - http2::HD_LOCATION); + resp.fs.add_header_token("location"_sr, loc, false, http2::HD_LOCATION); return send_reply(downstream, nullptr, 0); } @@ -2042,7 +2049,7 @@ int Http2Upstream::consume(int32_t stream_id, size_t len) { } void Http2Upstream::log_response_headers( - Downstream *downstream, const std::vector &nva) const { + Downstream *downstream, const std::vector &nva) const { std::stringstream ss; for (auto &nv : nva) { ss << TTY_HTTP_HD << StringRef{nv.name, nv.namelen} << TTY_RST << ": " @@ -2213,10 +2220,10 @@ int Http2Upstream::submit_push_promise(const StringRef &scheme, nva.reserve(4 + req.fs.headers().size()); // just use "GET" for now - nva.push_back(http2::make_nv_ll(":method", "GET")); - nva.push_back(http2::make_nv_ls_nocopy(":scheme", scheme)); - nva.push_back(http2::make_nv_ls_nocopy(":path", path)); - nva.push_back(http2::make_nv_ls_nocopy(":authority", authority)); + nva.push_back(http2::make_field(":method"_sr, "GET"_sr)); + nva.push_back(http2::make_field(":scheme"_sr, scheme)); + nva.push_back(http2::make_field(":path"_sr, path)); + nva.push_back(http2::make_field(":authority"_sr, authority)); for (auto &kv : req.fs.headers()) { switch (kv.token) { @@ -2231,14 +2238,15 @@ int Http2Upstream::submit_push_promise(const StringRef &scheme, case http2::HD_CACHE_CONTROL: case http2::HD_HOST: case http2::HD_USER_AGENT: - nva.push_back(http2::make_nv_nocopy(kv.name, kv.value, kv.no_index)); + nva.push_back( + http2::make_field(kv.name, kv.value, http2::no_index(kv.no_index))); break; } } auto promised_stream_id = nghttp2_submit_push_promise( - session_, NGHTTP2_FLAG_NONE, downstream->get_stream_id(), nva.data(), - nva.size(), nullptr); + session_, NGHTTP2_FLAG_NONE, downstream->get_stream_id(), nva.data(), + nva.size(), nullptr); if (promised_stream_id < 0) { if (LOG_ENABLED(INFO)) { @@ -2269,7 +2277,7 @@ bool Http2Upstream::push_enabled() const { auto config = get_config(); return !(config->http2.no_server_push || nghttp2_session_get_remote_settings( - session_, NGHTTP2_SETTINGS_ENABLE_PUSH) == 0 || + session_, NGHTTP2_SETTINGS_ENABLE_PUSH) == 0 || config->http2_proxy); } @@ -2292,8 +2300,8 @@ int Http2Upstream::initiate_push(Downstream *downstream, const StringRef &uri) { StringRef scheme, authority, path; - rv = http2::construct_push_component(balloc, scheme, authority, path, base, - uri); + rv = + http2::construct_push_component(balloc, scheme, authority, path, base, uri); if (rv != 0) { return -1; } @@ -2343,7 +2351,7 @@ Http2Upstream::on_downstream_push_promise(Downstream *downstream, // promised_stream_id is for backend HTTP/2 session, not for // frontend. auto promised_downstream = - std::make_unique(this, handler_->get_mcpool(), 0); + std::make_unique(this, handler_->get_mcpool(), 0); auto &promised_req = promised_downstream->request(); promised_downstream->set_downstream_stream_id(promised_stream_id); @@ -2366,7 +2374,7 @@ Http2Upstream::on_downstream_push_promise(Downstream *downstream, } int Http2Upstream::on_downstream_push_promise_complete( - Downstream *downstream, Downstream *promised_downstream) { + Downstream *downstream, Downstream *promised_downstream) { std::vector nva; const auto &promised_req = promised_downstream->request(); @@ -2375,12 +2383,13 @@ int Http2Upstream::on_downstream_push_promise_complete( nva.reserve(headers.size()); for (auto &kv : headers) { - nva.push_back(http2::make_nv(kv.name, kv.value, kv.no_index)); + nva.push_back( + http2::make_field_nv(kv.name, kv.value, http2::no_index(kv.no_index))); } auto promised_stream_id = nghttp2_submit_push_promise( - session_, NGHTTP2_FLAG_NONE, downstream->get_stream_id(), nva.data(), - nva.size(), promised_downstream); + session_, NGHTTP2_FLAG_NONE, downstream->get_stream_id(), nva.data(), + nva.size(), promised_downstream); if (promised_stream_id < 0) { return -1; } @@ -2391,7 +2400,7 @@ int Http2Upstream::on_downstream_push_promise_complete( } void Http2Upstream::cancel_premature_downstream( - Downstream *promised_downstream) { + Downstream *promised_downstream) { if (LOG_ENABLED(INFO)) { ULOG(INFO, this) << "Remove premature promised stream " << promised_downstream; diff --git a/lib/nghttp2/src/shrpx_http2_upstream.h b/lib/nghttp2-1.65.0/src/shrpx_http2_upstream.h similarity index 100% rename from lib/nghttp2/src/shrpx_http2_upstream.h rename to lib/nghttp2-1.65.0/src/shrpx_http2_upstream.h diff --git a/lib/nghttp2/src/shrpx_http3_upstream.cc b/lib/nghttp2-1.65.0/src/shrpx_http3_upstream.cc similarity index 83% rename from lib/nghttp2/src/shrpx_http3_upstream.cc rename to lib/nghttp2-1.65.0/src/shrpx_http3_upstream.cc index 46800de04f0..51caad01d4a 100644 --- a/lib/nghttp2/src/shrpx_http3_upstream.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_http3_upstream.cc @@ -111,17 +111,19 @@ ngtcp2_conn *get_conn(ngtcp2_crypto_conn_ref *conn_ref) { } // namespace Http3Upstream::Http3Upstream(ClientHandler *handler) - : handler_{handler}, - qlog_fd_{-1}, - hashed_scid_{}, - conn_{nullptr}, - httpconn_{nullptr}, - downstream_queue_{downstream_queue_size(handler->get_worker()), - !get_config()->http2_proxy}, - retry_close_{false}, - tx_{ - .data = std::unique_ptr(new uint8_t[64_k]), - } { + : handler_{handler}, + qlog_fd_{-1}, + hashed_scid_{}, + conn_{nullptr}, + httpconn_{nullptr}, + downstream_queue_{downstream_queue_size(handler->get_worker()), + !get_config()->http2_proxy}, + tx_{ + .data = std::unique_ptr(new uint8_t[64_k]), +#ifndef UDP_SEGMENT + .no_gso = true, +#endif // UDP_SEGMENT + } { auto conn = handler_->get_connection(); conn->conn_ref.get_conn = shrpx::get_conn; @@ -212,8 +214,10 @@ int get_new_connection_id(ngtcp2_conn *conn, ngtcp2_cid *cid, uint8_t *token, auto &qkms = conn_handler->get_quic_keying_materials(); auto &qkm = qkms->keying_materials.front(); - if (generate_quic_connection_id(*cid, cidlen, worker->get_cid_prefix(), - qkm.id, qkm.cid_encryption_key.data()) != 0) { + assert(SHRPX_QUIC_SCIDLEN == cidlen); + + if (generate_quic_connection_id(*cid, worker->get_worker_id(), qkm.id, + qkm.cid_encryption_ctx) != 0) { return NGTCP2_ERR_CALLBACK_FAILURE; } @@ -246,12 +250,13 @@ int remove_connection_id(ngtcp2_conn *conn, const ngtcp2_cid *cid, void Http3Upstream::http_begin_request_headers(int64_t stream_id) { auto downstream = - std::make_unique(this, handler_->get_mcpool(), stream_id); + std::make_unique(this, handler_->get_mcpool(), stream_id); nghttp3_conn_set_stream_user_data(httpconn_, stream_id, downstream.get()); downstream->reset_upstream_rtimer(); + downstream->repeat_header_timer(); - handler_->repeat_read_timer(); + handler_->stop_read_timer(); auto &req = downstream->request(); req.http_major = 3; @@ -261,7 +266,7 @@ void Http3Upstream::http_begin_request_headers(int64_t stream_id) { } void Http3Upstream::add_pending_downstream( - std::unique_ptr downstream) { + std::unique_ptr downstream) { downstream_queue_.add_pending(std::move(downstream)); } @@ -271,7 +276,7 @@ int recv_stream_data(ngtcp2_conn *conn, uint32_t flags, int64_t stream_id, void *user_data, void *stream_user_data) { auto upstream = static_cast(user_data); - if (upstream->recv_stream_data(flags, stream_id, data, datalen) != 0) { + if (upstream->recv_stream_data(flags, stream_id, {data, datalen}) != 0) { return NGTCP2_ERR_CALLBACK_FAILURE; } @@ -280,17 +285,18 @@ int recv_stream_data(ngtcp2_conn *conn, uint32_t flags, int64_t stream_id, } // namespace int Http3Upstream::recv_stream_data(uint32_t flags, int64_t stream_id, - const uint8_t *data, size_t datalen) { + std::span data) { assert(httpconn_); - auto nconsumed = nghttp3_conn_read_stream( - httpconn_, stream_id, data, datalen, flags & NGTCP2_STREAM_DATA_FLAG_FIN); + auto nconsumed = + nghttp3_conn_read_stream(httpconn_, stream_id, data.data(), data.size(), + flags & NGTCP2_STREAM_DATA_FLAG_FIN); if (nconsumed < 0) { ULOG(ERROR, this) << "nghttp3_conn_read_stream: " << nghttp3_strerror(nconsumed); ngtcp2_ccerr_set_application_error( - &last_error_, nghttp3_err_infer_quic_app_error_code(nconsumed), nullptr, - 0); + &last_error_, nghttp3_err_infer_quic_app_error_code(nconsumed), nullptr, + 0); return -1; } @@ -335,7 +341,7 @@ int Http3Upstream::stream_close(int64_t stream_id, uint64_t app_error_code) { default: ULOG(ERROR, this) << "nghttp3_conn_close_stream: " << nghttp3_strerror(rv); ngtcp2_ccerr_set_application_error( - &last_error_, nghttp3_err_infer_quic_app_error_code(rv), nullptr, 0); + &last_error_, nghttp3_err_infer_quic_app_error_code(rv), nullptr, 0); return -1; } @@ -422,7 +428,7 @@ int stream_reset(ngtcp2_conn *conn, int64_t stream_id, uint64_t final_size, void *stream_user_data) { auto upstream = static_cast(user_data); - if (upstream->stream_reset(stream_id) != 0) { + if (upstream->http_shutdown_stream_read(stream_id) != 0) { return NGTCP2_ERR_CALLBACK_FAILURE; } @@ -430,24 +436,6 @@ int stream_reset(ngtcp2_conn *conn, int64_t stream_id, uint64_t final_size, } } // namespace -int Http3Upstream::stream_reset(int64_t stream_id) { - if (http_shutdown_stream_read(stream_id) != 0) { - return -1; - } - - if (ngtcp2_is_bidi_stream(stream_id)) { - auto rv = ngtcp2_conn_shutdown_stream_write(conn_, 0, stream_id, - NGHTTP3_H3_NO_ERROR); - if (rv != 0) { - ULOG(ERROR, this) << "ngtcp2_conn_shutdown_stream_write: " - << ngtcp2_strerror(rv); - return -1; - } - } - - return 0; -} - int Http3Upstream::http_shutdown_stream_read(int64_t stream_id) { if (!httpconn_) { return 0; @@ -522,25 +510,22 @@ int path_validation(ngtcp2_conn *conn, uint32_t flags, const ngtcp2_path *path, } // namespace int Http3Upstream::send_new_token(const ngtcp2_addr *remote_addr) { - std::array token; - size_t tokenlen; - auto worker = handler_->get_worker(); auto conn_handler = worker->get_connection_handler(); auto &qkms = conn_handler->get_quic_keying_materials(); auto &qkm = qkms->keying_materials.front(); - if (generate_token(token.data(), tokenlen, remote_addr->addr, - remote_addr->addrlen, qkm.secret.data(), - qkm.secret.size()) != 0) { + std::array tokenbuf; + + auto token = generate_token(tokenbuf, remote_addr->addr, remote_addr->addrlen, + qkm.secret, qkm.id); + if (!token) { return -1; } - assert(tokenlen == NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN); - - token[tokenlen++] = qkm.id; + assert(token->size() == NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN + 1); - auto rv = ngtcp2_conn_submit_new_token(conn_, token.data(), tokenlen); + auto rv = ngtcp2_conn_submit_new_token(conn_, token->data(), token->size()); if (rv != 0) { ULOG(ERROR, this) << "ngtcp2_conn_submit_new_token: " << ngtcp2_strerror(rv); @@ -569,53 +554,53 @@ int recv_tx_key(ngtcp2_conn *conn, ngtcp2_encryption_level level, int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_hd &initial_hd, - const ngtcp2_cid *odcid, const uint8_t *token, - size_t tokenlen, ngtcp2_token_type token_type) { + const ngtcp2_cid *odcid, std::span token, + ngtcp2_token_type token_type) { int rv; auto worker = handler_->get_worker(); auto conn_handler = worker->get_connection_handler(); auto callbacks = ngtcp2_callbacks{ - nullptr, // client_initial - ngtcp2_crypto_recv_client_initial_cb, - ngtcp2_crypto_recv_crypto_data_cb, - shrpx::handshake_completed, - nullptr, // recv_version_negotiation - ngtcp2_crypto_encrypt_cb, - ngtcp2_crypto_decrypt_cb, - ngtcp2_crypto_hp_mask_cb, - shrpx::recv_stream_data, - shrpx::acked_stream_data_offset, - nullptr, // stream_open - shrpx::stream_close, - nullptr, // recv_stateless_reset - nullptr, // recv_retry - nullptr, // extend_max_local_streams_bidi - nullptr, // extend_max_local_streams_uni - rand, - get_new_connection_id, - remove_connection_id, - ngtcp2_crypto_update_key_cb, - shrpx::path_validation, - nullptr, // select_preferred_addr - shrpx::stream_reset, - shrpx::extend_max_remote_streams_bidi, - nullptr, // extend_max_remote_streams_uni - shrpx::extend_max_stream_data, - nullptr, // dcid_status - nullptr, // handshake_confirmed - nullptr, // recv_new_token - ngtcp2_crypto_delete_crypto_aead_ctx_cb, - ngtcp2_crypto_delete_crypto_cipher_ctx_cb, - nullptr, // recv_datagram - nullptr, // ack_datagram - nullptr, // lost_datagram - ngtcp2_crypto_get_path_challenge_data_cb, - shrpx::stream_stop_sending, - nullptr, // version_negotiation - nullptr, // recv_rx_key - shrpx::recv_tx_key, + nullptr, // client_initial + ngtcp2_crypto_recv_client_initial_cb, + ngtcp2_crypto_recv_crypto_data_cb, + shrpx::handshake_completed, + nullptr, // recv_version_negotiation + ngtcp2_crypto_encrypt_cb, + ngtcp2_crypto_decrypt_cb, + ngtcp2_crypto_hp_mask_cb, + shrpx::recv_stream_data, + shrpx::acked_stream_data_offset, + nullptr, // stream_open + shrpx::stream_close, + nullptr, // recv_stateless_reset + nullptr, // recv_retry + nullptr, // extend_max_local_streams_bidi + nullptr, // extend_max_local_streams_uni + rand, + get_new_connection_id, + remove_connection_id, + ngtcp2_crypto_update_key_cb, + shrpx::path_validation, + nullptr, // select_preferred_addr + shrpx::stream_reset, + shrpx::extend_max_remote_streams_bidi, + nullptr, // extend_max_remote_streams_uni + shrpx::extend_max_stream_data, + nullptr, // dcid_status + nullptr, // handshake_confirmed + nullptr, // recv_new_token + ngtcp2_crypto_delete_crypto_aead_ctx_cb, + ngtcp2_crypto_delete_crypto_cipher_ctx_cb, + nullptr, // recv_datagram + nullptr, // ack_datagram + nullptr, // lost_datagram + ngtcp2_crypto_get_path_challenge_data_cb, + shrpx::stream_stop_sending, + nullptr, // version_negotiation + nullptr, // recv_rx_key + shrpx::recv_tx_key, }; auto config = get_config(); @@ -627,9 +612,8 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, ngtcp2_cid scid; - if (generate_quic_connection_id(scid, SHRPX_QUIC_SCIDLEN, - worker->get_cid_prefix(), qkm.id, - qkm.cid_encryption_key.data()) != 0) { + if (generate_quic_connection_id(scid, worker->get_worker_id(), qkm.id, + qkm.cid_encryption_ctx) != 0) { return -1; } @@ -648,18 +632,17 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, } settings.initial_ts = quic_timestamp(); - settings.initial_rtt = static_cast( - quicconf.upstream.initial_rtt * NGTCP2_SECONDS); + settings.initial_rtt = + static_cast(quicconf.upstream.initial_rtt * NGTCP2_SECONDS); settings.cc_algo = quicconf.upstream.congestion_controller; settings.max_window = http3conf.upstream.max_connection_window_size; settings.max_stream_window = http3conf.upstream.max_window_size; - settings.max_tx_udp_payload_size = SHRPX_QUIC_MAX_UDP_PAYLOAD_SIZE; settings.rand_ctx.native_handle = &worker->get_randgen(); - settings.token = token; - settings.tokenlen = tokenlen; + settings.token = token.data(); + settings.tokenlen = token.size(); settings.token_type = token_type; settings.initial_pkt_num = std::uniform_int_distribution( - 0, std::numeric_limits::max())(worker->get_randgen()); + 0, std::numeric_limits::max())(worker->get_randgen()); ngtcp2_transport_params params; ngtcp2_transport_params_default(¶ms); @@ -669,8 +652,8 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, params.initial_max_data = http3conf.upstream.connection_window_size; params.initial_max_stream_data_bidi_remote = http3conf.upstream.window_size; params.initial_max_stream_data_uni = http3conf.upstream.window_size; - params.max_idle_timeout = static_cast( - quicconf.upstream.timeout.idle * NGTCP2_SECONDS); + params.max_idle_timeout = + static_cast(quicconf.upstream.timeout.idle * NGTCP2_SECONDS); #ifdef NGHTTP2_OPENSSL_IS_BORINGSSL if (quicconf.upstream.early_data) { @@ -679,14 +662,14 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, ngtcp2_transport_params_default(&early_data_params); early_data_params.initial_max_stream_data_bidi_local = - params.initial_max_stream_data_bidi_local; + params.initial_max_stream_data_bidi_local; early_data_params.initial_max_stream_data_bidi_remote = - params.initial_max_stream_data_bidi_remote; + params.initial_max_stream_data_bidi_remote; early_data_params.initial_max_stream_data_uni = - params.initial_max_stream_data_uni; + params.initial_max_stream_data_uni; early_data_params.initial_max_data = params.initial_max_data; early_data_params.initial_max_streams_bidi = - params.initial_max_streams_bidi; + params.initial_max_streams_bidi; early_data_params.initial_max_streams_uni = params.initial_max_streams_uni; // TODO include HTTP/3 SETTINGS @@ -694,8 +677,8 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, std::array quic_early_data_ctx; auto quic_early_data_ctxlen = ngtcp2_transport_params_encode( - quic_early_data_ctx.data(), quic_early_data_ctx.size(), - &early_data_params); + quic_early_data_ctx.data(), quic_early_data_ctx.size(), + &early_data_params); assert(quic_early_data_ctxlen > 0); assert(static_cast(quic_early_data_ctxlen) <= @@ -721,7 +704,7 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, params.original_dcid_present = 1; rv = generate_quic_stateless_reset_token( - params.stateless_reset_token, scid, qkm.secret.data(), qkm.secret.size()); + params.stateless_reset_token, scid, qkm.secret.data(), qkm.secret.size()); if (rv != 0) { ULOG(ERROR, this) << "generate_quic_stateless_reset_token failed"; return -1; @@ -729,15 +712,15 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr, params.stateless_reset_token_present = 1; auto path = ngtcp2_path{ - { - const_cast(&local_addr.su.sa), - static_cast(local_addr.len), - }, - { - const_cast(&remote_addr.su.sa), - static_cast(remote_addr.len), - }, - const_cast(faddr), + { + const_cast(&local_addr.su.sa), + static_cast(local_addr.len), + }, + { + const_cast(&remote_addr.su.sa), + static_cast(remote_addr.len), + }, + const_cast(faddr), }; rv = ngtcp2_conn_server_new(&conn_, &initial_hd.scid, &scid, &path, @@ -797,15 +780,14 @@ int Http3Upstream::on_write() { int Http3Upstream::write_streams() { std::array vec; auto max_udp_payload_size = ngtcp2_conn_get_max_tx_udp_payload_size(conn_); -#ifdef UDP_SEGMENT auto path_max_udp_payload_size = - ngtcp2_conn_get_path_max_tx_udp_payload_size(conn_); -#endif // UDP_SEGMENT - auto max_pktcnt = ngtcp2_conn_get_send_quantum(conn_) / max_udp_payload_size; + ngtcp2_conn_get_path_max_tx_udp_payload_size(conn_); ngtcp2_pkt_info pi, prev_pi; - uint8_t *bufpos = tx_.data.get(); + auto txbuf = + std::span{tx_.data.get(), std::max(ngtcp2_conn_get_send_quantum(conn_), + path_max_udp_payload_size)}; + auto buf = txbuf; ngtcp2_path_storage ps, prev_ps; - size_t pktcnt = 0; int rv; size_t gso_size = 0; auto ts = quic_timestamp(); @@ -825,8 +807,8 @@ int Http3Upstream::write_streams() { ULOG(ERROR, this) << "nghttp3_conn_writev_stream: " << nghttp3_strerror(sveccnt); ngtcp2_ccerr_set_application_error( - &last_error_, nghttp3_err_infer_quic_app_error_code(sveccnt), - nullptr, 0); + &last_error_, nghttp3_err_infer_quic_app_error_code(sveccnt), nullptr, + 0); return handle_error(); } } @@ -840,9 +822,12 @@ int Http3Upstream::write_streams() { flags |= NGTCP2_WRITE_STREAM_FLAG_FIN; } + auto buflen = buf.size() >= max_udp_payload_size + ? max_udp_payload_size + : path_max_udp_payload_size; auto nwrite = ngtcp2_conn_writev_stream( - conn_, &ps.path, &pi, bufpos, max_udp_payload_size, &ndatalen, flags, - stream_id, reinterpret_cast(v), vcnt, ts); + conn_, &ps.path, &pi, buf.data(), buflen, &ndatalen, flags, stream_id, + reinterpret_cast(v), vcnt, ts); if (nwrite < 0) { switch (nwrite) { case NGTCP2_ERR_STREAM_DATA_BLOCKED: @@ -858,10 +843,10 @@ int Http3Upstream::write_streams() { rv = nghttp3_conn_add_write_offset(httpconn_, stream_id, ndatalen); if (rv != 0) { ULOG(ERROR, this) - << "nghttp3_conn_add_write_offset: " << nghttp3_strerror(rv); + << "nghttp3_conn_add_write_offset: " << nghttp3_strerror(rv); ngtcp2_ccerr_set_application_error( - &last_error_, nghttp3_err_infer_quic_app_error_code(rv), nullptr, - 0); + &last_error_, nghttp3_err_infer_quic_app_error_code(rv), nullptr, + 0); return handle_error(); } continue; @@ -881,25 +866,23 @@ int Http3Upstream::write_streams() { ULOG(ERROR, this) << "nghttp3_conn_add_write_offset: " << nghttp3_strerror(rv); ngtcp2_ccerr_set_application_error( - &last_error_, nghttp3_err_infer_quic_app_error_code(rv), nullptr, - 0); + &last_error_, nghttp3_err_infer_quic_app_error_code(rv), nullptr, 0); return handle_error(); } } if (nwrite == 0) { - if (bufpos - tx_.data.get()) { + auto data = std::span{std::begin(txbuf), std::begin(buf)}; + if (!data.empty()) { auto faddr = static_cast(prev_ps.path.user_data); - auto data = tx_.data.get(); - auto datalen = bufpos - data; - rv = send_packet(faddr, prev_ps.path.remote.addr, - prev_ps.path.remote.addrlen, prev_ps.path.local.addr, - prev_ps.path.local.addrlen, prev_pi, data, datalen, - gso_size); + auto [rest, rv] = + send_packet(faddr, prev_ps.path.remote.addr, + prev_ps.path.remote.addrlen, prev_ps.path.local.addr, + prev_ps.path.local.addrlen, prev_pi, data, gso_size); if (rv == SHRPX_ERR_SEND_BLOCKED) { on_send_blocked(faddr, prev_ps.path.remote, prev_ps.path.local, - prev_pi, data, datalen, gso_size); + prev_pi, rest, gso_size); signal_write_upstream_addr(faddr); } @@ -910,10 +893,11 @@ int Http3Upstream::write_streams() { return 0; } - bufpos += nwrite; + auto last_pkt = std::begin(buf); + + buf = buf.subspan(nwrite); -#ifdef UDP_SEGMENT - if (pktcnt == 0) { + if (last_pkt == std::begin(txbuf)) { ngtcp2_path_copy(&prev_ps.path, &ps.path); prev_pi = pi; gso_size = nwrite; @@ -923,35 +907,36 @@ int Http3Upstream::write_streams() { (gso_size > path_max_udp_payload_size && static_cast(nwrite) != gso_size)) { auto faddr = static_cast(prev_ps.path.user_data); - auto data = tx_.data.get(); - auto datalen = bufpos - data - nwrite; + auto data = std::span{std::begin(txbuf), last_pkt}; - rv = send_packet(faddr, prev_ps.path.remote.addr, - prev_ps.path.remote.addrlen, prev_ps.path.local.addr, - prev_ps.path.local.addrlen, prev_pi, data, datalen, - gso_size); + auto [rest, rv] = + send_packet(faddr, prev_ps.path.remote.addr, + prev_ps.path.remote.addrlen, prev_ps.path.local.addr, + prev_ps.path.local.addrlen, prev_pi, data, gso_size); switch (rv) { case SHRPX_ERR_SEND_BLOCKED: on_send_blocked(faddr, prev_ps.path.remote, prev_ps.path.local, prev_pi, - data, datalen, gso_size); + rest, gso_size); + data = std::span{last_pkt, std::begin(buf)}; on_send_blocked(static_cast(ps.path.user_data), - ps.path.remote, ps.path.local, pi, bufpos - nwrite, - nwrite, 0); + ps.path.remote, ps.path.local, pi, data, data.size()); signal_write_upstream_addr(faddr); break; default: { auto faddr = static_cast(ps.path.user_data); - auto data = bufpos - nwrite; + auto data = std::span{last_pkt, std::begin(buf)}; - rv = send_packet(faddr, ps.path.remote.addr, ps.path.remote.addrlen, - ps.path.local.addr, ps.path.local.addrlen, pi, data, - nwrite, 0); + auto [rest, rv] = send_packet( + faddr, ps.path.remote.addr, ps.path.remote.addrlen, + ps.path.local.addr, ps.path.local.addrlen, pi, data, data.size()); if (rv == SHRPX_ERR_SEND_BLOCKED) { - on_send_blocked(faddr, ps.path.remote, ps.path.local, pi, data, - nwrite, 0); + assert(rest.size() == data.size()); + + on_send_blocked(faddr, ps.path.remote, ps.path.local, pi, rest, + rest.size()); signal_write_upstream_addr(faddr); } @@ -963,16 +948,16 @@ int Http3Upstream::write_streams() { return 0; } - if (++pktcnt == max_pktcnt || static_cast(nwrite) < gso_size) { + if (buf.size() < path_max_udp_payload_size || + static_cast(nwrite) < gso_size) { auto faddr = static_cast(ps.path.user_data); - auto data = tx_.data.get(); - auto datalen = bufpos - data; + auto data = std::span{std::begin(txbuf), std::begin(buf)}; - rv = send_packet(faddr, ps.path.remote.addr, ps.path.remote.addrlen, - ps.path.local.addr, ps.path.local.addrlen, pi, data, - datalen, gso_size); + auto [rest, rv] = send_packet(faddr, ps.path.remote.addr, + ps.path.remote.addrlen, ps.path.local.addr, + ps.path.local.addrlen, pi, data, gso_size); if (rv == SHRPX_ERR_SEND_BLOCKED) { - on_send_blocked(faddr, ps.path.remote, ps.path.local, pi, data, datalen, + on_send_blocked(faddr, ps.path.remote, ps.path.local, pi, rest, gso_size); signal_write_upstream_addr(faddr); @@ -982,40 +967,24 @@ int Http3Upstream::write_streams() { return 0; } -#else // !UDP_SEGMENT - auto faddr = static_cast(ps.path.user_data); - auto data = tx_.data.get(); - auto datalen = bufpos - data; - - rv = send_packet(faddr, ps.path.remote.addr, ps.path.remote.addrlen, - ps.path.local.addr, ps.path.local.addrlen, pi, data, - datalen, 0); - if (rv == SHRPX_ERR_SEND_BLOCKED) { - on_send_blocked(faddr, ps.path.remote, ps.path.local, pi, data, datalen, - 0); - - ngtcp2_conn_update_pkt_tx_time(conn_, ts); - - signal_write_upstream_addr(faddr); + } - return 0; - } + return 0; +} - if (++pktcnt == max_pktcnt) { - ngtcp2_conn_update_pkt_tx_time(conn_, ts); +int Http3Upstream::on_timeout(Downstream *downstream) { + if (LOG_ENABLED(INFO)) { + ULOG(INFO, this) << "Stream timeout stream_id=" + << downstream->get_stream_id(); + } - return 0; - } + shutdown_stream(downstream, NGHTTP3_H3_INTERNAL_ERROR); - bufpos = tx_.data.get(); -#endif // !UDP_SEGMENT - } + handler_->signal_write(); return 0; } -int Http3Upstream::on_timeout(Downstream *downstream) { return 0; } - int Http3Upstream::on_downstream_abort_request(Downstream *downstream, unsigned int status_code) { int rv; @@ -1032,7 +1001,7 @@ int Http3Upstream::on_downstream_abort_request(Downstream *downstream, } int Http3Upstream::on_downstream_abort_request_with_https_redirect( - Downstream *downstream) { + Downstream *downstream) { assert(0); abort(); } @@ -1063,7 +1032,7 @@ int Http3Upstream::downstream_read(DownstreamConnection *dconn) { // on_stream_close_callback. shutdown_stream(downstream, infer_upstream_shutdown_stream_error_code( - downstream->get_response_rst_stream_error_code())); + downstream->get_response_rst_stream_error_code())); downstream->pop_downstream_connection(); // dconn was deleted dconn = nullptr; @@ -1334,7 +1303,7 @@ int Http3Upstream::on_downstream_header_complete(Downstream *downstream) { if (downstream->get_non_final_response()) { auto response_status = http2::stringify_status(balloc, resp.http_status); - nva.push_back(http3::make_nv_ls_nocopy(":status", response_status)); + nva.push_back(http3::make_field(":status"_sr, response_status)); http3::copy_headers_to_nva_nocopy(nva, resp.fs.headers(), http2::HDOP_STRIP_ALL); @@ -1366,16 +1335,16 @@ int Http3Upstream::on_downstream_header_complete(Downstream *downstream) { response_status = http2::stringify_status(balloc, resp.http_status); } - nva.push_back(http3::make_nv_ls_nocopy(":status", response_status)); + nva.push_back(http3::make_field(":status"_sr, response_status)); http3::copy_headers_to_nva_nocopy(nva, resp.fs.headers(), striphd_flags); if (!config->http2_proxy && !httpconf.no_server_rewrite) { - nva.push_back(http3::make_nv_ls_nocopy("server", httpconf.server_name)); + nva.push_back(http3::make_field("server"_sr, httpconf.server_name)); } else { auto server = resp.fs.header(http2::HD_SERVER); if (server) { - nva.push_back(http3::make_nv_ls_nocopy("server", (*server).value)); + nva.push_back(http3::make_field("server"_sr, (*server).value)); } } @@ -1388,17 +1357,17 @@ int Http3Upstream::on_downstream_header_complete(Downstream *downstream) { auto &shared_addr = group->shared_addr; auto &cookieconf = shared_addr->affinity.cookie; auto secure = - http::require_cookie_secure_attribute(cookieconf.secure, req.scheme); + http::require_cookie_secure_attribute(cookieconf.secure, req.scheme); auto cookie_str = http::create_affinity_cookie( - balloc, cookieconf.name, affinity_cookie, cookieconf.path, secure); - nva.push_back(http3::make_nv_ls_nocopy("set-cookie", cookie_str)); + balloc, cookieconf.name, affinity_cookie, cookieconf.path, secure); + nva.push_back(http3::make_field("set-cookie"_sr, cookie_str)); } } auto via = resp.fs.header(http2::HD_VIA); if (httpconf.no_via) { if (via) { - nva.push_back(http3::make_nv_ls_nocopy("via", (*via).value)); + nva.push_back(http3::make_field("via"_sr, (*via).value)); } } else { // we don't create more than 16 bytes in @@ -1409,7 +1378,7 @@ int Http3Upstream::on_downstream_header_complete(Downstream *downstream) { } auto iov = make_byte_ref(balloc, len + 1); - auto p = iov.base; + auto p = std::begin(iov); if (via) { p = std::copy(std::begin(via->value), std::end(via->value), p); p = util::copy_lit(p, ", "); @@ -1417,11 +1386,12 @@ int Http3Upstream::on_downstream_header_complete(Downstream *downstream) { p = http::create_via_header_value(p, resp.http_major, resp.http_minor); *p = '\0'; - nva.push_back(http3::make_nv_ls_nocopy("via", StringRef{iov.base, p})); + nva.push_back( + http3::make_field("via"_sr, StringRef{std::span{std::begin(iov), p}})); } for (auto &p : httpconf.add_response_headers) { - nva.push_back(http3::make_nv_nocopy(p.name, p.value)); + nva.push_back(http3::make_field(p.name, p.value)); } if (LOG_ENABLED(INFO)) { @@ -1437,7 +1407,7 @@ int Http3Upstream::on_downstream_header_complete(Downstream *downstream) { nghttp3_pri_parse_priority(&pri, priority->value.byte(), priority->value.size()) == 0) { rv = nghttp3_conn_set_server_stream_priority( - httpconn_, downstream->get_stream_id(), &pri); + httpconn_, downstream->get_stream_id(), &pri); if (rv != 0) { ULOG(ERROR, this) << "nghttp3_conn_set_server_stream_priority: " << nghttp3_strerror(rv); @@ -1510,7 +1480,7 @@ int Http3Upstream::on_downstream_body_complete(Downstream *downstream) { http3::copy_headers_to_nva_nocopy(nva, trailers, http2::HDOP_STRIP_ALL); if (!nva.empty()) { auto rv = nghttp3_conn_submit_trailers( - httpconn_, downstream->get_stream_id(), nva.data(), nva.size()); + httpconn_, downstream->get_stream_id(), nva.data(), nva.size()); if (rv != 0) { ULOG(FATAL, this) << "nghttp3_conn_submit_trailers() failed: " << nghttp3_strerror(rv); @@ -1545,8 +1515,13 @@ void Http3Upstream::on_handler_delete() { quic_conn_handler->remove_connection_id(cid); } - if (retry_close_ || last_error_.type == NGTCP2_CCERR_TYPE_IDLE_CLOSE) { + switch (last_error_.type) { + case NGTCP2_CCERR_TYPE_IDLE_CLOSE: + case NGTCP2_CCERR_TYPE_DROP_CONN: + case NGTCP2_CCERR_TYPE_RETRY: return; + default: + break; } // If this is not idle close, send CONNECTION_CLOSE. @@ -1567,8 +1542,8 @@ void Http3Upstream::on_handler_delete() { } auto nwrite = ngtcp2_conn_write_connection_close( - conn_, &ps.path, &pi, conn_close_.data(), conn_close_.size(), &ccerr, - quic_timestamp()); + conn_, &ps.path, &pi, conn_close_.data(), conn_close_.size(), &ccerr, + quic_timestamp()); if (nwrite < 0) { if (nwrite != NGTCP2_ERR_INVALID_STATE) { ULOG(ERROR, this) << "ngtcp2_conn_write_connection_close: " @@ -1582,11 +1557,11 @@ void Http3Upstream::on_handler_delete() { send_packet(static_cast(ps.path.user_data), ps.path.remote.addr, ps.path.remote.addrlen, ps.path.local.addr, - ps.path.local.addrlen, pi, conn_close_.data(), nwrite, 0); + ps.path.local.addrlen, pi, conn_close_, conn_close_.size()); } auto d = - static_cast(ngtcp2_conn_get_pto(conn_) * 3) / NGTCP2_SECONDS; + static_cast(ngtcp2_conn_get_pto(conn_) * 3) / NGTCP2_SECONDS; if (LOG_ENABLED(INFO)) { ULOG(INFO, this) << "Enter close-wait period " << d << "s with " @@ -1700,9 +1675,15 @@ int Http3Upstream::send_reply(Downstream *downstream, const uint8_t *body, nghttp3_data_reader data_read, *data_read_ptr = nullptr; - if (bodylen) { + const auto &req = downstream->request(); + + if (req.method != HTTP_HEAD && bodylen) { data_read.read_data = downstream_read_data_callback; data_read_ptr = &data_read; + + auto buf = downstream->get_response_buf(); + + buf->append(body, bodylen); } const auto &resp = downstream->response(); @@ -1718,7 +1699,7 @@ int Http3Upstream::send_reply(Downstream *downstream, const uint8_t *body, auto response_status = http2::stringify_status(balloc, resp.http_status); - nva.push_back(http3::make_nv_ls_nocopy(":status", response_status)); + nva.push_back(http3::make_field(":status"_sr, response_status)); for (auto &kv : headers) { if (kv.name.empty() || kv.name[0] == ':') { @@ -1733,15 +1714,16 @@ int Http3Upstream::send_reply(Downstream *downstream, const uint8_t *body, case http2::HD_UPGRADE: continue; } - nva.push_back(http3::make_nv_nocopy(kv.name, kv.value, kv.no_index)); + nva.push_back( + http3::make_field(kv.name, kv.value, http3::never_index(kv.no_index))); } if (!resp.fs.header(http2::HD_SERVER)) { - nva.push_back(http3::make_nv_ls_nocopy("server", config->http.server_name)); + nva.push_back(http3::make_field("server"_sr, config->http.server_name)); } for (auto &p : httpconf.add_response_headers) { - nva.push_back(http3::make_nv_nocopy(p.name, p.value)); + nva.push_back(http3::make_field(p.name, p.value)); } rv = nghttp3_conn_submit_response(httpconn_, downstream->get_stream_id(), @@ -1752,10 +1734,6 @@ int Http3Upstream::send_reply(Downstream *downstream, const uint8_t *body, return -1; } - auto buf = downstream->get_response_buf(); - - buf->append(body, bodylen); - downstream->set_response_state(DownstreamState::MSG_COMPLETE); if (data_read_ptr) { @@ -1789,34 +1767,35 @@ Http3Upstream::on_downstream_push_promise(Downstream *downstream, } int Http3Upstream::on_downstream_push_promise_complete( - Downstream *downstream, Downstream *promised_downstream) { + Downstream *downstream, Downstream *promised_downstream) { return 0; } bool Http3Upstream::push_enabled() const { return false; } void Http3Upstream::cancel_premature_downstream( - Downstream *promised_downstream) {} + Downstream *promised_downstream) {} int Http3Upstream::on_read(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen) { + std::span data) { int rv; auto path = ngtcp2_path{ - { - const_cast(&local_addr.su.sa), - static_cast(local_addr.len), - }, - { - const_cast(&remote_addr.su.sa), - static_cast(remote_addr.len), - }, - const_cast(faddr), + { + const_cast(&local_addr.su.sa), + static_cast(local_addr.len), + }, + { + const_cast(&remote_addr.su.sa), + static_cast(remote_addr.len), + }, + const_cast(faddr), }; - rv = ngtcp2_conn_read_pkt(conn_, &path, &pi, data, datalen, quic_timestamp()); + rv = ngtcp2_conn_read_pkt(conn_, &path, &pi, data.data(), data.size(), + quic_timestamp()); if (rv != 0) { switch (rv) { case NGTCP2_ERR_DRAINING: @@ -1834,27 +1813,31 @@ int Http3Upstream::on_read(const UpstreamAddr *faddr, ngtcp2_version_cid vc; - rv = - ngtcp2_pkt_decode_version_cid(&vc, data, datalen, SHRPX_QUIC_SCIDLEN); + rv = ngtcp2_pkt_decode_version_cid(&vc, data.data(), data.size(), + SHRPX_QUIC_SCIDLEN); if (rv != 0) { return -1; } - retry_close_ = true; + // Overwrite error if any is set + ngtcp2_ccerr_set_liberr(&last_error_, rv, nullptr, 0); - quic_conn_handler->send_retry(handler_->get_upstream_addr(), vc.version, - vc.dcid, vc.dcidlen, vc.scid, vc.scidlen, - remote_addr, local_addr, datalen * 3); + quic_conn_handler->send_retry( + handler_->get_upstream_addr(), vc.version, {vc.dcid, vc.dcidlen}, + {vc.scid, vc.scidlen}, remote_addr, local_addr, data.size() * 3); return -1; } case NGTCP2_ERR_CRYPTO: if (!last_error_.error_code) { ngtcp2_ccerr_set_tls_alert( - &last_error_, ngtcp2_conn_get_tls_alert(conn_), nullptr, 0); + &last_error_, ngtcp2_conn_get_tls_alert(conn_), nullptr, 0); } break; case NGTCP2_ERR_DROP_CONN: + // Overwrite error if any is set + ngtcp2_ccerr_set_liberr(&last_error_, rv, nullptr, 0); + return -1; default: if (!last_error_.error_code) { @@ -1870,16 +1853,40 @@ int Http3Upstream::on_read(const UpstreamAddr *faddr, return 0; } -int Http3Upstream::send_packet(const UpstreamAddr *faddr, - const sockaddr *remote_sa, size_t remote_salen, - const sockaddr *local_sa, size_t local_salen, - const ngtcp2_pkt_info &pi, const uint8_t *data, - size_t datalen, size_t gso_size) { +std::pair, int> +Http3Upstream::send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, + size_t remote_salen, const sockaddr *local_sa, + size_t local_salen, const ngtcp2_pkt_info &pi, + std::span data, size_t gso_size) { + if (tx_.no_gso) { + for (; !data.empty();) { + auto len = std::min(gso_size, data.size()); + auto rv = + quic_send_packet(faddr, remote_sa, remote_salen, local_sa, local_salen, + pi, {std::begin(data), len}, gso_size); + if (rv != 0) { + switch (rv) { + case -EAGAIN: +#if EAGAIN != EWOULDBLOCK + case -EWOULDBLOCK: +#endif // EAGAIN != EWOULDBLOCK + return {data, SHRPX_ERR_SEND_BLOCKED}; + default: + return {data, -1}; + } + } + + data = data.subspan(len); + } + + return {{}, 0}; + } + auto rv = quic_send_packet(faddr, remote_sa, remote_salen, local_sa, - local_salen, pi, data, datalen, gso_size); + local_salen, pi, data, gso_size); switch (rv) { case 0: - return 0; + return {{}, 0}; // With GSO, sendmsg may fail with EINVAL if UDP payload is too // large. case -EINVAL: @@ -1890,22 +1897,32 @@ int Http3Upstream::send_packet(const UpstreamAddr *faddr, #if EAGAIN != EWOULDBLOCK case -EWOULDBLOCK: #endif // EAGAIN != EWOULDBLOCK - return SHRPX_ERR_SEND_BLOCKED; + return {data, SHRPX_ERR_SEND_BLOCKED}; + case -EIO: + if (tx_.no_gso) { + break; + } + + tx_.no_gso = true; + + return send_packet(faddr, remote_sa, remote_salen, local_sa, local_salen, + pi, data, gso_size); default: break; } - return -1; + return {{}, -1}; } void Http3Upstream::on_send_blocked(const UpstreamAddr *faddr, const ngtcp2_addr &remote_addr, const ngtcp2_addr &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen, + std::span data, size_t gso_size) { assert(tx_.num_blocked || !tx_.send_blocked); assert(tx_.num_blocked < 2); + assert(gso_size); tx_.send_blocked = true; @@ -1919,22 +1936,21 @@ void Http3Upstream::on_send_blocked(const UpstreamAddr *faddr, p.faddr = faddr; p.pi = pi; p.data = data; - p.datalen = datalen; p.gso_size = gso_size; } int Http3Upstream::send_blocked_packet() { - int rv; - assert(tx_.send_blocked); for (; tx_.num_blocked_sent < tx_.num_blocked; ++tx_.num_blocked_sent) { auto &p = tx_.blocked[tx_.num_blocked_sent]; - rv = send_packet(p.faddr, &p.remote_addr.su.sa, p.remote_addr.len, - &p.local_addr.su.sa, p.local_addr.len, p.pi, p.data, - p.datalen, p.gso_size); + auto [rest, rv] = send_packet(p.faddr, &p.remote_addr.su.sa, + p.remote_addr.len, &p.local_addr.su.sa, + p.local_addr.len, p.pi, p.data, p.gso_size); if (rv == SHRPX_ERR_SEND_BLOCKED) { + p.data = rest; + signal_write_upstream_addr(p.faddr); return 0; @@ -1977,9 +1993,9 @@ int Http3Upstream::handle_error() { conn_close_.resize(SHRPX_QUIC_CONN_CLOSE_PKTLEN); - auto nwrite = ngtcp2_conn_write_connection_close( - conn_, &ps.path, &pi, conn_close_.data(), conn_close_.size(), - &last_error_, ts); + auto nwrite = + ngtcp2_conn_write_connection_close(conn_, &ps.path, &pi, conn_close_.data(), + conn_close_.size(), &last_error_, ts); if (nwrite < 0) { ULOG(ERROR, this) << "ngtcp2_conn_write_connection_close: " << ngtcp2_strerror(nwrite); @@ -1994,7 +2010,7 @@ int Http3Upstream::handle_error() { send_packet(static_cast(ps.path.user_data), ps.path.remote.addr, ps.path.remote.addrlen, ps.path.local.addr, - ps.path.local.addrlen, pi, conn_close_.data(), nwrite, 0); + ps.path.local.addrlen, pi, conn_close_, conn_close_.size()); return -1; } @@ -2150,7 +2166,7 @@ int Http3Upstream::http_recv_request_header(Downstream *downstream, auto &httpconf = config->http; if (req.fs.buffer_size() + namebuf.len + valuebuf.len > - httpconf.request_header_field_buffer || + httpconf.request_header_field_buffer || req.fs.num_fields() >= httpconf.max_request_header_fields) { downstream->set_stop_reading(true); @@ -2166,6 +2182,11 @@ int Http3Upstream::http_recv_request_header(Downstream *downstream, // just ignore if this is a trailer part. if (trailer) { + if (shutdown_stream_read(downstream->get_stream_id(), + NGHTTP3_H3_NO_ERROR) != 0) { + return -1; + } + return 0; } @@ -2176,22 +2197,20 @@ int Http3Upstream::http_recv_request_header(Downstream *downstream, return 0; } - auto token = http2::lookup_token(namebuf.base, namebuf.len); + auto nameref = StringRef{namebuf.base, namebuf.len}; + auto valueref = StringRef{valuebuf.base, valuebuf.len}; + auto token = http2::lookup_token(nameref); auto no_index = flags & NGHTTP3_NV_FLAG_NEVER_INDEX; downstream->add_rcbuf(name); downstream->add_rcbuf(value); if (trailer) { - req.fs.add_trailer_token(StringRef{namebuf.base, namebuf.len}, - StringRef{valuebuf.base, valuebuf.len}, no_index, - token); + req.fs.add_trailer_token(nameref, valueref, no_index, token); return 0; } - req.fs.add_header_token(StringRef{namebuf.base, namebuf.len}, - StringRef{valuebuf.base, valuebuf.len}, no_index, - token); + req.fs.add_header_token(nameref, valueref, no_index, token); return 0; } @@ -2199,7 +2218,6 @@ namespace { int http_end_request_headers(nghttp3_conn *conn, int64_t stream_id, int fin, void *user_data, void *stream_user_data) { auto upstream = static_cast(user_data); - auto handler = upstream->get_client_handler(); auto downstream = static_cast(stream_user_data); if (!downstream || downstream->get_stop_reading()) { @@ -2211,7 +2229,7 @@ int http_end_request_headers(nghttp3_conn *conn, int64_t stream_id, int fin, } downstream->reset_upstream_rtimer(); - handler->stop_read_timer(); + downstream->stop_header_timer(); return 0; } @@ -2232,7 +2250,7 @@ int Http3Upstream::http_end_request_headers(Downstream *downstream, int fin) { if (LOG_ENABLED(INFO)) { std::stringstream ss; for (auto &nv : nva) { - if (nv.name == "authorization") { + if (nv.name == "authorization"_sr) { ss << TTY_HTTP_HD << nv.name << TTY_RST << ": \n"; continue; } @@ -2246,7 +2264,8 @@ int Http3Upstream::http_end_request_headers(Downstream *downstream, int fin) { auto content_length = req.fs.header(http2::HD_CONTENT_LENGTH); if (content_length) { // libnghttp3 guarantees this can be parsed - req.fs.content_length = util::parse_uint(content_length->value); + req.fs.content_length = + util::parse_uint(content_length->value).value_or(-1); } // presence of mandatory header fields are guaranteed by libnghttp3. @@ -2290,8 +2309,7 @@ int Http3Upstream::http_end_request_headers(Downstream *downstream, int fin) { } if (path) { - if (method_token == HTTP_OPTIONS && - path->value == StringRef::from_lit("*")) { + if (method_token == HTTP_OPTIONS && path->value == "*"_sr) { // Server-wide OPTIONS request. Path is empty. } else if (config->http2_proxy && faddr->alt_mode == UpstreamAltMode::NONE) { @@ -2304,7 +2322,7 @@ int Http3Upstream::http_end_request_headers(Downstream *downstream, int fin) { auto connect_proto = req.fs.header(http2::HD__PROTOCOL); if (connect_proto) { - if (connect_proto->value != "websocket") { + if (connect_proto->value != "websocket"_sr) { if (error_reply(downstream, 400) != 0) { return -1; } @@ -2417,7 +2435,6 @@ void Http3Upstream::initiate_downstream(Downstream *downstream) { rv = downstream->push_request_headers(); if (rv != 0) { - if (error_reply(downstream, 502) != 0) { shutdown_stream(downstream, NGHTTP3_H3_INTERNAL_ERROR); } @@ -2444,7 +2461,7 @@ int http_recv_data(nghttp3_conn *conn, int64_t stream_id, const uint8_t *data, auto upstream = static_cast(user_data); auto downstream = static_cast(stream_user_data); - if (upstream->http_recv_data(downstream, data, datalen) != 0) { + if (upstream->http_recv_data(downstream, {data, datalen}) != 0) { return NGHTTP3_ERR_CALLBACK_FAILURE; } @@ -2452,16 +2469,16 @@ int http_recv_data(nghttp3_conn *conn, int64_t stream_id, const uint8_t *data, } } // namespace -int Http3Upstream::http_recv_data(Downstream *downstream, const uint8_t *data, - size_t datalen) { +int Http3Upstream::http_recv_data(Downstream *downstream, + std::span data) { downstream->reset_upstream_rtimer(); - if (downstream->push_upload_data_chunk(data, datalen) != 0) { + if (downstream->push_upload_data_chunk(data.data(), data.size()) != 0) { if (downstream->get_response_state() != DownstreamState::MSG_COMPLETE) { shutdown_stream(downstream, NGHTTP3_H3_INTERNAL_ERROR); } - consume(downstream->get_stream_id(), datalen); + consume(downstream->get_stream_id(), data.size()); return 0; } @@ -2584,7 +2601,7 @@ int http_stop_sending(nghttp3_conn *conn, int64_t stream_id, int Http3Upstream::http_stop_sending(int64_t stream_id, uint64_t app_error_code) { auto rv = - ngtcp2_conn_shutdown_stream_read(conn_, 0, stream_id, app_error_code); + ngtcp2_conn_shutdown_stream_read(conn_, 0, stream_id, app_error_code); if (ngtcp2_err_is_fatal(rv)) { ULOG(ERROR, this) << "ngtcp2_conn_shutdown_stream_read: " << ngtcp2_strerror(rv); @@ -2611,7 +2628,7 @@ int http_reset_stream(nghttp3_conn *conn, int64_t stream_id, int Http3Upstream::http_reset_stream(int64_t stream_id, uint64_t app_error_code) { auto rv = - ngtcp2_conn_shutdown_stream_write(conn_, 0, stream_id, app_error_code); + ngtcp2_conn_shutdown_stream_write(conn_, 0, stream_id, app_error_code); if (ngtcp2_err_is_fatal(rv)) { ULOG(ERROR, this) << "ngtcp2_conn_shutdown_stream_write: " << ngtcp2_strerror(rv); @@ -2629,19 +2646,19 @@ int Http3Upstream::setup_httpconn() { } nghttp3_callbacks callbacks{ - shrpx::http_acked_stream_data, - shrpx::http_stream_close, - shrpx::http_recv_data, - http_deferred_consume, - shrpx::http_begin_request_headers, - shrpx::http_recv_request_header, - shrpx::http_end_request_headers, - nullptr, // begin_trailers - shrpx::http_recv_request_trailer, - nullptr, // end_trailers - shrpx::http_stop_sending, - shrpx::http_end_stream, - shrpx::http_reset_stream, + shrpx::http_acked_stream_data, + shrpx::http_stream_close, + shrpx::http_recv_data, + http_deferred_consume, + shrpx::http_begin_request_headers, + shrpx::http_recv_request_header, + shrpx::http_end_request_headers, + nullptr, // begin_trailers + shrpx::http_recv_request_trailer, + nullptr, // end_trailers + shrpx::http_stop_sending, + shrpx::http_end_stream, + shrpx::http_reset_stream, }; auto config = get_config(); @@ -2716,12 +2733,21 @@ int Http3Upstream::error_reply(Downstream *downstream, auto html = http::create_error_html(balloc, status_code); resp.http_status = status_code; - auto body = downstream->get_response_buf(); - body->append(html); - downstream->set_response_state(DownstreamState::MSG_COMPLETE); - nghttp3_data_reader data_read; - data_read.read_data = downstream_read_data_callback; + nghttp3_data_reader data_read, *data_read_ptr = nullptr; + + const auto &req = downstream->request(); + + if (req.method != HTTP_HEAD) { + data_read.read_data = downstream_read_data_callback; + data_read_ptr = &data_read; + + auto body = downstream->get_response_buf(); + + body->append(html); + } + + downstream->set_response_state(DownstreamState::MSG_COMPLETE); auto lgconf = log_config(); lgconf->update_tstamp(std::chrono::system_clock::now()); @@ -2730,15 +2756,15 @@ int Http3Upstream::error_reply(Downstream *downstream, auto content_length = util::make_string_ref_uint(balloc, html.size()); auto date = make_string_ref(balloc, lgconf->tstamp->time_http); - auto nva = std::array{ - {http3::make_nv_ls_nocopy(":status", response_status), - http3::make_nv_ll("content-type", "text/html; charset=UTF-8"), - http3::make_nv_ls_nocopy("server", get_config()->http.server_name), - http3::make_nv_ls_nocopy("content-length", content_length), - http3::make_nv_ls_nocopy("date", date)}}; + auto nva = std::to_array( + {http3::make_field(":status"_sr, response_status), + http3::make_field("content-type"_sr, "text/html; charset=UTF-8"_sr), + http3::make_field("server"_sr, get_config()->http.server_name), + http3::make_field("content-length"_sr, content_length), + http3::make_field("date"_sr, date)}); rv = nghttp3_conn_submit_response(httpconn_, downstream->get_stream_id(), - nva.data(), nva.size(), &data_read); + nva.data(), nva.size(), data_read_ptr); if (nghttp3_err_is_fatal(rv)) { ULOG(FATAL, this) << "nghttp3_conn_submit_response() failed: " << nghttp3_strerror(rv); @@ -2776,8 +2802,8 @@ int Http3Upstream::shutdown_stream(Downstream *downstream, int Http3Upstream::shutdown_stream_read(int64_t stream_id, uint64_t app_error_code) { - auto rv = ngtcp2_conn_shutdown_stream_read(conn_, 0, stream_id, - NGHTTP3_H3_NO_ERROR); + auto rv = + ngtcp2_conn_shutdown_stream_read(conn_, 0, stream_id, NGHTTP3_H3_NO_ERROR); if (ngtcp2_err_is_fatal(rv)) { ULOG(FATAL, this) << "ngtcp2_conn_shutdown_stream_read: " << ngtcp2_strerror(rv); @@ -2813,7 +2839,7 @@ void Http3Upstream::remove_downstream(Downstream *downstream) { } void Http3Upstream::log_response_headers( - Downstream *downstream, const std::vector &nva) const { + Downstream *downstream, const std::vector &nva) const { std::stringstream ss; for (auto &nv : nva) { ss << TTY_HTTP_HD << StringRef{nv.name, nv.namelen} << TTY_RST << ": " @@ -2883,12 +2909,12 @@ int Http3Upstream::open_qlog_file(const StringRef &dir, const ngtcp2_cid &scid) const { std::array buf; - auto path = dir.str(); + auto path = std::string{dir}; path += '/'; path += - util::format_iso8601_basic(buf.data(), std::chrono::system_clock::now()); + util::format_iso8601_basic(buf.data(), std::chrono::system_clock::now()); path += '-'; - path += util::format_hex(scid.data, scid.datalen); + path += util::format_hex(std::span{scid.data, scid.datalen}); path += ".sqlog"; int fd; diff --git a/lib/nghttp2/src/shrpx_http3_upstream.h b/lib/nghttp2-1.65.0/src/shrpx_http3_upstream.h similarity index 89% rename from lib/nghttp2/src/shrpx_http3_upstream.h rename to lib/nghttp2-1.65.0/src/shrpx_http3_upstream.h index 18076522ad0..ef0fcb4213a 100644 --- a/lib/nghttp2/src/shrpx_http3_upstream.h +++ b/lib/nghttp2-1.65.0/src/shrpx_http3_upstream.h @@ -89,12 +89,12 @@ class Http3Upstream : public Upstream { int init(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_hd &initial_hd, - const ngtcp2_cid *odcid, const uint8_t *token, size_t tokenlen, + const ngtcp2_cid *odcid, std::span token, ngtcp2_token_type token_type); int on_read(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen); + std::span data); int write_streams(); @@ -105,8 +105,8 @@ class Http3Upstream : public Upstream { int setup_httpconn(); void add_pending_downstream(std::unique_ptr downstream); - int recv_stream_data(uint32_t flags, int64_t stream_id, const uint8_t *data, - size_t datalen); + int recv_stream_data(uint32_t flags, int64_t stream_id, + std::span data); int acked_stream_data_offset(int64_t stream_id, uint64_t datalen); int extend_max_stream_data(int64_t stream_id); void extend_max_remote_streams_bidi(uint64_t max_streams); @@ -125,23 +125,22 @@ class Http3Upstream : public Upstream { void consume(int64_t stream_id, size_t nconsumed); void remove_downstream(Downstream *downstream); int stream_close(int64_t stream_id, uint64_t app_error_code); - int stream_reset(int64_t stream_id); void log_response_headers(Downstream *downstream, const std::vector &nva) const; int http_acked_stream_data(Downstream *downstream, uint64_t datalen); int http_shutdown_stream_read(int64_t stream_id); int http_reset_stream(int64_t stream_id, uint64_t app_error_code); int http_stop_sending(int64_t stream_id, uint64_t app_error_code); - int http_recv_data(Downstream *downstream, const uint8_t *data, - size_t datalen); + int http_recv_data(Downstream *downstream, std::span data); int handshake_completed(); int check_shutdown(); int start_graceful_shutdown(); int submit_goaway(); - int send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, - size_t remote_salen, const sockaddr *local_sa, - size_t local_salen, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen, size_t gso_size); + std::pair, int> + send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, + size_t remote_salen, const sockaddr *local_sa, size_t local_salen, + const ngtcp2_pkt_info &pi, std::span data, + size_t gso_size); void qlog_write(const void *data, size_t datalen, bool fin); int open_qlog_file(const StringRef &dir, const ngtcp2_cid &scid) const; @@ -149,7 +148,7 @@ class Http3Upstream : public Upstream { void on_send_blocked(const UpstreamAddr *faddr, const ngtcp2_addr &remote_addr, const ngtcp2_addr &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen, size_t gso_size); + std::span data, size_t gso_size); int send_blocked_packet(); void signal_write_upstream_addr(const UpstreamAddr *faddr); @@ -168,7 +167,6 @@ class Http3Upstream : public Upstream { ngtcp2_ccerr last_error_; nghttp3_conn *httpconn_; DownstreamQueue downstream_queue_; - bool retry_close_; std::vector conn_close_; struct { @@ -181,11 +179,11 @@ class Http3Upstream : public Upstream { Address local_addr; Address remote_addr; ngtcp2_pkt_info pi; - const uint8_t *data; - size_t datalen; + std::span data; size_t gso_size; } blocked[2]; std::unique_ptr data; + bool no_gso; } tx_; }; diff --git a/lib/nghttp2/src/shrpx_http_downstream_connection.cc b/lib/nghttp2-1.65.0/src/shrpx_http_downstream_connection.cc similarity index 88% rename from lib/nghttp2/src/shrpx_http_downstream_connection.cc rename to lib/nghttp2-1.65.0/src/shrpx_http_downstream_connection.cc index bdb42943e51..8cef8e329e2 100644 --- a/lib/nghttp2/src/shrpx_http_downstream_connection.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_http_downstream_connection.cc @@ -24,7 +24,14 @@ */ #include "shrpx_http_downstream_connection.h" -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include "shrpx_client_handler.h" #include "shrpx_upstream.h" @@ -41,7 +48,6 @@ #include "shrpx_log.h" #include "http2.h" #include "util.h" -#include "ssl_compat.h" using namespace nghttp2; @@ -202,26 +208,26 @@ void connectcb(struct ev_loop *loop, ev_io *w, int revents) { } // namespace HttpDownstreamConnection::HttpDownstreamConnection( - const std::shared_ptr &group, DownstreamAddr *addr, - struct ev_loop *loop, Worker *worker) - : conn_(loop, -1, nullptr, worker->get_mcpool(), - group->shared_addr->timeout.write, group->shared_addr->timeout.read, - {}, {}, connectcb, readcb, connect_timeoutcb, this, - get_config()->tls.dyn_rec.warmup_threshold, - get_config()->tls.dyn_rec.idle_timeout, Proto::HTTP1), - on_read_(&HttpDownstreamConnection::noop), - on_write_(&HttpDownstreamConnection::noop), - signal_write_(&HttpDownstreamConnection::noop), - worker_(worker), - ssl_ctx_(worker->get_cl_ssl_ctx()), - group_(group), - addr_(addr), - raddr_(nullptr), - ioctrl_(&conn_.rlimit), - response_htp_{0}, - first_write_done_(false), - reusable_(true), - request_header_written_(false) {} + const std::shared_ptr &group, DownstreamAddr *addr, + struct ev_loop *loop, Worker *worker) + : conn_(loop, -1, nullptr, worker->get_mcpool(), + group->shared_addr->timeout.write, group->shared_addr->timeout.read, + {}, {}, connectcb, readcb, connect_timeoutcb, this, + get_config()->tls.dyn_rec.warmup_threshold, + get_config()->tls.dyn_rec.idle_timeout, Proto::HTTP1), + on_read_(&HttpDownstreamConnection::noop), + on_write_(&HttpDownstreamConnection::noop), + signal_write_(&HttpDownstreamConnection::noop), + worker_(worker), + ssl_ctx_(worker->get_cl_ssl_ctx()), + group_(group), + addr_(addr), + raddr_(nullptr), + ioctrl_(&conn_.rlimit), + response_htp_{0}, + first_write_done_(false), + reusable_(true), + request_header_written_(false) {} HttpDownstreamConnection::~HttpDownstreamConnection() { if (LOG_ENABLED(INFO)) { @@ -263,29 +269,29 @@ int htp_msg_completecb(llhttp_t *htp); namespace { constexpr llhttp_settings_t htp_hooks = { - htp_msg_begincb, // llhttp_cb on_message_begin; - nullptr, // llhttp_data_cb on_url; - nullptr, // llhttp_data_cb on_status; - nullptr, // llhttp_data_cb on_method; - nullptr, // llhttp_data_cb on_version; - htp_hdr_keycb, // llhttp_data_cb on_header_field; - htp_hdr_valcb, // llhttp_data_cb on_header_value; - nullptr, // llhttp_data_cb on_chunk_extension_name; - nullptr, // llhttp_data_cb on_chunk_extension_value; - htp_hdrs_completecb, // llhttp_cb on_headers_complete; - htp_bodycb, // llhttp_data_cb on_body; - htp_msg_completecb, // llhttp_cb on_message_complete; - nullptr, // llhttp_cb on_url_complete; - nullptr, // llhttp_cb on_status_complete; - nullptr, // llhttp_cb on_method_complete; - nullptr, // llhttp_cb on_version_complete; - nullptr, // llhttp_cb on_header_field_complete; - nullptr, // llhttp_cb on_header_value_complete; - nullptr, // llhttp_cb on_chunk_extension_name_complete; - nullptr, // llhttp_cb on_chunk_extension_value_complete; - nullptr, // llhttp_cb on_chunk_header; - nullptr, // llhttp_cb on_chunk_complete; - nullptr, // llhttp_cb on_reset; + htp_msg_begincb, // llhttp_cb on_message_begin; + nullptr, // llhttp_data_cb on_url; + nullptr, // llhttp_data_cb on_status; + nullptr, // llhttp_data_cb on_method; + nullptr, // llhttp_data_cb on_version; + htp_hdr_keycb, // llhttp_data_cb on_header_field; + htp_hdr_valcb, // llhttp_data_cb on_header_value; + nullptr, // llhttp_data_cb on_chunk_extension_name; + nullptr, // llhttp_data_cb on_chunk_extension_value; + htp_hdrs_completecb, // llhttp_cb on_headers_complete; + htp_bodycb, // llhttp_data_cb on_body; + htp_msg_completecb, // llhttp_cb on_message_complete; + nullptr, // llhttp_cb on_url_complete; + nullptr, // llhttp_cb on_status_complete; + nullptr, // llhttp_cb on_method_complete; + nullptr, // llhttp_cb on_version_complete; + nullptr, // llhttp_cb on_header_field_complete; + nullptr, // llhttp_cb on_header_value_complete; + nullptr, // llhttp_cb on_chunk_extension_name_complete; + nullptr, // llhttp_cb on_chunk_extension_value_complete; + nullptr, // llhttp_cb on_chunk_header; + nullptr, // llhttp_cb on_chunk_complete; + nullptr, // llhttp_cb on_reset; }; } // namespace @@ -296,7 +302,7 @@ int HttpDownstreamConnection::initiate_connection() { if (worker_blocker->blocked()) { if (LOG_ENABLED(INFO)) { DCLOG(INFO, this) - << "Worker wide backend connection was blocked temporarily"; + << "Worker wide backend connection was blocked temporarily"; } return SHRPX_ERR_NETWORK; } @@ -326,21 +332,20 @@ int HttpDownstreamConnection::initiate_connection() { if (addr_->dns) { if (!check_dns_result) { auto dns_query = std::make_unique( - addr_->host, - [this](DNSResolverStatus status, const Address *result) { - int rv; - - if (status == DNSResolverStatus::OK) { - *this->resolved_addr_ = *result; - } - - rv = this->initiate_connection(); - if (rv != 0) { - // This callback destroys |this|. - auto downstream = this->downstream_; - backend_retry(downstream); - } - }); + addr_->host, [this](DNSResolverStatus status, const Address *result) { + int rv; + + if (status == DNSResolverStatus::OK) { + *this->resolved_addr_ = *result; + } + + rv = this->initiate_connection(); + if (rv != 0) { + // This callback destroys |this|. + auto downstream = this->downstream_; + backend_retry(downstream); + } + }); auto dns_tracker = worker_->get_dns_tracker(); @@ -424,9 +429,9 @@ int HttpDownstreamConnection::initiate_connection() { conn_.tls.client_session_cache = &addr_->tls_session_cache; auto sni_name = - addr_->sni.empty() ? StringRef{addr_->host} : StringRef{addr_->sni}; - if (!util::numeric_host(sni_name.c_str())) { - SSL_set_tlsext_host_name(conn_.tls.ssl, sni_name.c_str()); + addr_->sni.empty() ? StringRef{addr_->host} : StringRef{addr_->sni}; + if (!util::numeric_host(sni_name.data())) { + SSL_set_tlsext_host_name(conn_.tls.ssl, sni_name.data()); } auto session = tls::reuse_tls_session(addr_->tls_session_cache); @@ -490,7 +495,7 @@ int HttpDownstreamConnection::push_request_headers() { // case, we use backend server's host nonetheless. auto authority = StringRef(downstream_hostport); auto no_host_rewrite = - httpconf.no_host_rewrite || config->http2_proxy || connect_method; + httpconf.no_host_rewrite || config->http2_proxy || connect_method; if (no_host_rewrite && !req.authority.empty()) { authority = req.authority; @@ -502,7 +507,7 @@ int HttpDownstreamConnection::push_request_headers() { // Assume that method and request path do not contain \r\n. auto meth = http2::to_method_string( - req.connect_proto == ConnectProto::WEBSOCKET ? HTTP_GET : req.method); + req.connect_proto == ConnectProto::WEBSOCKET ? HTTP_GET : req.method); buf->append(meth); buf->append(' '); @@ -532,13 +537,13 @@ int HttpDownstreamConnection::push_request_headers() { auto &earlydataconf = httpconf.early_data; uint32_t build_flags = - (fwdconf.strip_incoming ? http2::HDOP_STRIP_FORWARDED : 0) | - (xffconf.strip_incoming ? http2::HDOP_STRIP_X_FORWARDED_FOR : 0) | - (xfpconf.strip_incoming ? http2::HDOP_STRIP_X_FORWARDED_PROTO : 0) | - (earlydataconf.strip_incoming ? http2::HDOP_STRIP_EARLY_DATA : 0) | - ((req.http_major == 3 || req.http_major == 2) - ? http2::HDOP_STRIP_SEC_WEBSOCKET_KEY - : 0); + (fwdconf.strip_incoming ? http2::HDOP_STRIP_FORWARDED : 0) | + (xffconf.strip_incoming ? http2::HDOP_STRIP_X_FORWARDED_FOR : 0) | + (xfpconf.strip_incoming ? http2::HDOP_STRIP_X_FORWARDED_PROTO : 0) | + (earlydataconf.strip_incoming ? http2::HDOP_STRIP_EARLY_DATA : 0) | + ((req.http_major == 3 || req.http_major == 2) + ? http2::HDOP_STRIP_SEC_WEBSOCKET_KEY + : 0); http2::build_http1_headers_from_headers(buf, req.fs.headers(), build_flags); @@ -564,9 +569,10 @@ int HttpDownstreamConnection::push_request_headers() { return -1; } auto iov = make_byte_ref(balloc, base64::encode_length(nonce.size()) + 1); - auto p = base64::encode(std::begin(nonce), std::end(nonce), iov.base); + auto p = + base64::encode(std::begin(nonce), std::end(nonce), std::begin(iov)); *p = '\0'; - auto key = StringRef{iov.base, p}; + auto key = StringRef{std::span{std::begin(iov), p}}; downstream_->set_ws_key(key); buf->append("Sec-Websocket-Key: "); @@ -596,16 +602,18 @@ int HttpDownstreamConnection::push_request_headers() { auto upstream = downstream_->get_upstream(); auto handler = upstream->get_client_handler(); -#if OPENSSL_1_1_1_API +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_BORINGSSL) || defined(NGHTTP2_OPENSSL_IS_WOLFSSL) auto conn = handler->get_connection(); if (conn->tls.ssl && !SSL_is_init_finished(conn->tls.ssl)) { buf->append("Early-Data: 1\r\n"); } -#endif // OPENSSL_1_1_1_API +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_BORINGSSL || + // NGHTTP2_OPENSSL_IS_WOLFSSL auto fwd = - fwdconf.strip_incoming ? nullptr : req.fs.header(http2::HD_FORWARDED); + fwdconf.strip_incoming ? nullptr : req.fs.header(http2::HD_FORWARDED); if (fwdconf.params) { auto params = fwdconf.params; @@ -615,8 +623,8 @@ int HttpDownstreamConnection::push_request_headers() { } auto value = http::create_forwarded( - balloc, params, handler->get_forwarded_by(), - handler->get_forwarded_for(), req.authority, req.scheme); + balloc, params, handler->get_forwarded_by(), handler->get_forwarded_for(), + req.authority, req.scheme); if (fwd || !value.empty()) { buf->append("Forwarded: "); @@ -636,8 +644,8 @@ int HttpDownstreamConnection::push_request_headers() { buf->append("\r\n"); } - auto xff = xffconf.strip_incoming ? nullptr - : req.fs.header(http2::HD_X_FORWARDED_FOR); + auto xff = + xffconf.strip_incoming ? nullptr : req.fs.header(http2::HD_X_FORWARDED_FOR); if (xffconf.add) { buf->append("X-Forwarded-For: "); @@ -654,8 +662,8 @@ int HttpDownstreamConnection::push_request_headers() { } if (!config->http2_proxy && !connect_method) { auto xfp = xfpconf.strip_incoming - ? nullptr - : req.fs.header(http2::HD_X_FORWARDED_PROTO); + ? nullptr + : req.fs.header(http2::HD_X_FORWARDED_PROTO); if (xfpconf.add) { buf->append("X-Forwarded-Proto: "); @@ -1074,8 +1082,8 @@ int ensure_header_field_buffer(const Downstream *downstream, if (resp.fs.buffer_size() + len > httpconf.response_header_field_buffer) { if (LOG_ENABLED(INFO)) { - DLOG(INFO, downstream) << "Too large header header field size=" - << resp.fs.buffer_size() + len; + DLOG(INFO, downstream) + << "Too large header header field size=" << resp.fs.buffer_size() + len; } return -1; } @@ -1092,7 +1100,7 @@ int ensure_max_header_fields(const Downstream *downstream, if (resp.fs.num_fields() >= httpconf.max_response_header_fields) { if (LOG_ENABLED(INFO)) { DLOG(INFO, downstream) - << "Too many header field num=" << resp.fs.num_fields() + 1; + << "Too many header field num=" << resp.fs.num_fields() + 1; } return -1; } @@ -1165,7 +1173,7 @@ int htp_bodycb(llhttp_t *htp, const char *data, size_t len) { resp.recv_body_length += len; return downstream->get_upstream()->on_downstream_body( - downstream, reinterpret_cast(data), len, true); + downstream, reinterpret_cast(data), len, true); } } // namespace @@ -1488,12 +1496,11 @@ int HttpDownstreamConnection::process_input(const uint8_t *data, auto htperr = llhttp_execute(&response_htp_, reinterpret_cast(data), datalen); - auto nproc = - htperr == HPE_OK - ? datalen - : static_cast(reinterpret_cast( - llhttp_get_error_pos(&response_htp_)) - - data); + auto nproc = htperr == HPE_OK + ? datalen + : static_cast(reinterpret_cast( + llhttp_get_error_pos(&response_htp_)) - + data); if (htperr != HPE_OK && (!downstream_->get_upgraded() || htperr != HPE_PAUSED_UPGRADE)) { @@ -1516,7 +1523,7 @@ int HttpDownstreamConnection::process_input(const uint8_t *data, if (nproc < datalen) { // Data from data + nproc are for upgraded protocol. rv = downstream_->get_upstream()->on_downstream_body( - downstream_, data + nproc, datalen - nproc, true); + downstream_, data + nproc, datalen - nproc, true); if (rv != 0) { return rv; } diff --git a/lib/nghttp2/src/shrpx_http_downstream_connection.h b/lib/nghttp2-1.65.0/src/shrpx_http_downstream_connection.h similarity index 99% rename from lib/nghttp2/src/shrpx_http_downstream_connection.h rename to lib/nghttp2-1.65.0/src/shrpx_http_downstream_connection.h index a453f0dc5cf..96c5e298375 100644 --- a/lib/nghttp2/src/shrpx_http_downstream_connection.h +++ b/lib/nghttp2-1.65.0/src/shrpx_http_downstream_connection.h @@ -95,7 +95,7 @@ class HttpDownstreamConnection : public DownstreamConnection { private: Connection conn_; std::function on_read_, on_write_, - signal_write_; + signal_write_; Worker *worker_; // nullptr if TLS is not used. SSL_CTX *ssl_ctx_; diff --git a/lib/nghttp2-1.65.0/src/shrpx_http_test.cc b/lib/nghttp2-1.65.0/src/shrpx_http_test.cc new file mode 100644 index 00000000000..4494ede6147 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/shrpx_http_test.cc @@ -0,0 +1,176 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2016 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "shrpx_http_test.h" + +#ifdef HAVE_UNISTD_H +# include +#endif // HAVE_UNISTD_H + +#include + +#include "munitxx.h" + +#include "shrpx_http.h" +#include "shrpx_config.h" +#include "shrpx_log.h" + +using namespace std::literals; + +namespace shrpx { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_shrpx_http_create_forwarded), + munit_void_test(test_shrpx_http_create_via_header_value), + munit_void_test(test_shrpx_http_create_affinity_cookie), + munit_void_test(test_shrpx_http_create_altsvc_header_value), + munit_void_test(test_shrpx_http_check_http_scheme), + munit_test_end(), +}; +} // namespace + +const MunitSuite http_suite{ + "/http", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +void test_shrpx_http_create_forwarded(void) { + BlockAllocator balloc(1024, 1024); + + assert_stdsv_equal( + "by=\"example.com:3000\";for=\"[::1]\";host=\"www.example.com\";" + "proto=https"sv, + http::create_forwarded( + balloc, FORWARDED_BY | FORWARDED_FOR | FORWARDED_HOST | FORWARDED_PROTO, + "example.com:3000"_sr, "[::1]"_sr, "www.example.com"_sr, "https"_sr)); + + assert_stdsv_equal("for=192.168.0.1"sv, + http::create_forwarded(balloc, FORWARDED_FOR, "alpha"_sr, + "192.168.0.1"_sr, "bravo"_sr, + "charlie"_sr)); + + assert_stdsv_equal( + "by=_hidden;for=\"[::1]\""sv, + http::create_forwarded(balloc, FORWARDED_BY | FORWARDED_FOR, "_hidden"_sr, + "[::1]"_sr, ""_sr, ""_sr)); + + assert_stdsv_equal( + "by=\"[::1]\";for=_hidden"sv, + http::create_forwarded(balloc, FORWARDED_BY | FORWARDED_FOR, "[::1]"_sr, + "_hidden"_sr, ""_sr, ""_sr)); + + assert_stdsv_equal(""sv, + http::create_forwarded(balloc, + FORWARDED_BY | FORWARDED_FOR | + FORWARDED_HOST | FORWARDED_PROTO, + ""_sr, ""_sr, ""_sr, ""_sr)); +} + +void test_shrpx_http_create_via_header_value(void) { + std::array buf; + + auto end = http::create_via_header_value(std::begin(buf), 1, 1); + + assert_stdstring_equal("1.1 nghttpx", (std::string{std::begin(buf), end})); + + std::fill(std::begin(buf), std::end(buf), '\0'); + + end = http::create_via_header_value(std::begin(buf), 2, 0); + + assert_stdstring_equal("2 nghttpx", (std::string{std::begin(buf), end})); +} + +void test_shrpx_http_create_affinity_cookie(void) { + BlockAllocator balloc(1024, 1024); + StringRef c; + + c = http::create_affinity_cookie(balloc, "cookie-val"_sr, 0xf1e2d3c4u, + StringRef{}, false); + + assert_stdsv_equal("cookie-val=f1e2d3c4"sv, c); + + c = http::create_affinity_cookie(balloc, "alpha"_sr, 0x00000000u, StringRef{}, + true); + + assert_stdsv_equal("alpha=00000000; Secure"sv, c); + + c = http::create_affinity_cookie(balloc, "bravo"_sr, 0x01111111u, "bar"_sr, + false); + + assert_stdsv_equal("bravo=01111111; Path=bar"sv, c); + + c = http::create_affinity_cookie(balloc, "charlie"_sr, 0x01111111u, "bar"_sr, + true); + + assert_stdsv_equal("charlie=01111111; Path=bar; Secure"sv, c); +} + +void test_shrpx_http_create_altsvc_header_value(void) { + { + BlockAllocator balloc(1024, 1024); + std::vector altsvcs{ + AltSvc{ + .protocol_id = "h3"_sr, + .host = "127.0.0.1"_sr, + .service = "443"_sr, + .params = "ma=3600"_sr, + }, + }; + + assert_stdsv_equal(R"(h3="127.0.0.1:443"; ma=3600)"sv, + http::create_altsvc_header_value(balloc, altsvcs)); + } + + { + BlockAllocator balloc(1024, 1024); + std::vector altsvcs{ + AltSvc{ + .protocol_id = "h3"_sr, + .service = "443"_sr, + .params = "ma=3600"_sr, + }, + AltSvc{ + .protocol_id = "h3%"_sr, + .host = "\"foo\""_sr, + .service = "4433"_sr, + }, + }; + + assert_stdsv_equal(R"(h3=":443"; ma=3600, h3%25="\"foo\":4433")"sv, + http::create_altsvc_header_value(balloc, altsvcs)); + } +} + +void test_shrpx_http_check_http_scheme(void) { + assert_true(http::check_http_scheme("https"_sr, true)); + assert_false(http::check_http_scheme("https"_sr, false)); + assert_false(http::check_http_scheme("http"_sr, true)); + assert_true(http::check_http_scheme("http"_sr, false)); + assert_false(http::check_http_scheme("foo"_sr, true)); + assert_false(http::check_http_scheme("foo"_sr, false)); + assert_false(http::check_http_scheme(StringRef{}, true)); + assert_false(http::check_http_scheme(StringRef{}, false)); +} + +} // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_http_test.h b/lib/nghttp2-1.65.0/src/shrpx_http_test.h similarity index 77% rename from lib/nghttp2/src/shrpx_http_test.h rename to lib/nghttp2-1.65.0/src/shrpx_http_test.h index d50ab533971..05f75938f30 100644 --- a/lib/nghttp2/src/shrpx_http_test.h +++ b/lib/nghttp2-1.65.0/src/shrpx_http_test.h @@ -29,13 +29,19 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace shrpx { -void test_shrpx_http_create_forwarded(void); -void test_shrpx_http_create_via_header_value(void); -void test_shrpx_http_create_affinity_cookie(void); -void test_shrpx_http_create_altsvc_header_value(void); -void test_shrpx_http_check_http_scheme(void); +extern const MunitSuite http_suite; + +munit_void_test_decl(test_shrpx_http_create_forwarded) +munit_void_test_decl(test_shrpx_http_create_via_header_value) +munit_void_test_decl(test_shrpx_http_create_affinity_cookie) +munit_void_test_decl(test_shrpx_http_create_altsvc_header_value) +munit_void_test_decl(test_shrpx_http_check_http_scheme) } // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_https_upstream.cc b/lib/nghttp2-1.65.0/src/shrpx_https_upstream.cc similarity index 87% rename from lib/nghttp2/src/shrpx_https_upstream.cc rename to lib/nghttp2-1.65.0/src/shrpx_https_upstream.cc index 49d20883430..bbed1da8108 100644 --- a/lib/nghttp2/src/shrpx_https_upstream.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_https_upstream.cc @@ -45,7 +45,7 @@ #include "util.h" #include "template.h" #include "base64.h" -#include "url-parser/url_parser.h" +#include "urlparse.h" using namespace nghttp2; @@ -63,37 +63,37 @@ int htp_msg_completecb(llhttp_t *htp); namespace { constexpr llhttp_settings_t htp_hooks = { - htp_msg_begin, // llhttp_cb on_message_begin; - htp_uricb, // llhttp_data_cb on_url; - nullptr, // llhttp_data_cb on_status; - nullptr, // llhttp_data_cb on_method; - nullptr, // llhttp_data_cb on_version; - htp_hdr_keycb, // llhttp_data_cb on_header_field; - htp_hdr_valcb, // llhttp_data_cb on_header_value; - nullptr, // llhttp_data_cb on_chunk_extension_name; - nullptr, // llhttp_data_cb on_chunk_extension_value; - htp_hdrs_completecb, // llhttp_cb on_headers_complete; - htp_bodycb, // llhttp_data_cb on_body; - htp_msg_completecb, // llhttp_cb on_message_complete; - nullptr, // llhttp_cb on_url_complete; - nullptr, // llhttp_cb on_status_complete; - nullptr, // llhttp_cb on_method_complete; - nullptr, // llhttp_cb on_version_complete; - nullptr, // llhttp_cb on_header_field_complete; - nullptr, // llhttp_cb on_header_value_complete; - nullptr, // llhttp_cb on_chunk_extension_name_complete; - nullptr, // llhttp_cb on_chunk_extension_value_complete; - nullptr, // llhttp_cb on_chunk_header; - nullptr, // llhttp_cb on_chunk_complete; - nullptr, // llhttp_cb on_reset; + htp_msg_begin, // llhttp_cb on_message_begin; + htp_uricb, // llhttp_data_cb on_url; + nullptr, // llhttp_data_cb on_status; + nullptr, // llhttp_data_cb on_method; + nullptr, // llhttp_data_cb on_version; + htp_hdr_keycb, // llhttp_data_cb on_header_field; + htp_hdr_valcb, // llhttp_data_cb on_header_value; + nullptr, // llhttp_data_cb on_chunk_extension_name; + nullptr, // llhttp_data_cb on_chunk_extension_value; + htp_hdrs_completecb, // llhttp_cb on_headers_complete; + htp_bodycb, // llhttp_data_cb on_body; + htp_msg_completecb, // llhttp_cb on_message_complete; + nullptr, // llhttp_cb on_url_complete; + nullptr, // llhttp_cb on_status_complete; + nullptr, // llhttp_cb on_method_complete; + nullptr, // llhttp_cb on_version_complete; + nullptr, // llhttp_cb on_header_field_complete; + nullptr, // llhttp_cb on_header_value_complete; + nullptr, // llhttp_cb on_chunk_extension_name_complete; + nullptr, // llhttp_cb on_chunk_extension_value_complete; + nullptr, // llhttp_cb on_chunk_header; + nullptr, // llhttp_cb on_chunk_complete; + nullptr, // llhttp_cb on_reset; }; } // namespace HttpsUpstream::HttpsUpstream(ClientHandler *handler) - : handler_(handler), - current_header_length_(0), - ioctrl_(handler->get_rlimit()), - num_requests_(0) { + : handler_(handler), + current_header_length_(0), + ioctrl_(handler->get_rlimit()), + num_requests_(0) { llhttp_init(&htp_, HTTP_REQUEST, &htp_hooks); htp_.data = this; } @@ -111,16 +111,13 @@ void HttpsUpstream::on_start_request() { reset_current_header_length(); auto downstream = - std::make_unique(this, handler_->get_mcpool(), 0); + std::make_unique(this, handler_->get_mcpool(), 0); attach_downstream(std::move(downstream)); - auto conn = handler_->get_connection(); - auto &upstreamconf = get_config()->conn.upstream; - - conn->rt.repeat = upstreamconf.timeout.read; + auto &httpconf = get_config()->http; - handler_->repeat_read_timer(); + handler_->reset_upstream_read_timeout(httpconf.timeout.header); ++num_requests_; } @@ -152,7 +149,7 @@ int htp_uricb(llhttp_t *htp, const char *data, size_t len) { } assert(downstream->get_request_state() == DownstreamState::INITIAL); downstream->set_request_state( - DownstreamState::HTTP1_REQUEST_HEADER_TOO_LARGE); + DownstreamState::HTTP1_REQUEST_HEADER_TOO_LARGE); llhttp_set_error_reason(htp, "too long request URI"); return HPE_USER; } @@ -161,7 +158,7 @@ int htp_uricb(llhttp_t *htp, const char *data, size_t len) { if (req.method == HTTP_CONNECT) { req.authority = - concat_string_ref(balloc, req.authority, StringRef{data, len}); + concat_string_ref(balloc, req.authority, StringRef{data, len}); } else { req.path = concat_string_ref(balloc, req.path, StringRef{data, len}); } @@ -184,7 +181,7 @@ int htp_hdr_keycb(llhttp_t *htp, const char *data, size_t len) { } if (downstream->get_request_state() == DownstreamState::INITIAL) { downstream->set_request_state( - DownstreamState::HTTP1_REQUEST_HEADER_TOO_LARGE); + DownstreamState::HTTP1_REQUEST_HEADER_TOO_LARGE); } llhttp_set_error_reason(htp, "too large header"); return HPE_USER; @@ -196,10 +193,10 @@ int htp_hdr_keycb(llhttp_t *htp, const char *data, size_t len) { if (req.fs.num_fields() >= httpconf.max_request_header_fields) { if (LOG_ENABLED(INFO)) { ULOG(INFO, upstream) - << "Too many header field num=" << req.fs.num_fields() + 1; + << "Too many header field num=" << req.fs.num_fields() + 1; } downstream->set_request_state( - DownstreamState::HTTP1_REQUEST_HEADER_TOO_LARGE); + DownstreamState::HTTP1_REQUEST_HEADER_TOO_LARGE); llhttp_set_error_reason(htp, "too many headers"); return HPE_USER; } @@ -213,7 +210,7 @@ int htp_hdr_keycb(llhttp_t *htp, const char *data, size_t len) { if (req.fs.num_fields() >= httpconf.max_request_header_fields) { if (LOG_ENABLED(INFO)) { ULOG(INFO, upstream) - << "Too many header field num=" << req.fs.num_fields() + 1; + << "Too many header field num=" << req.fs.num_fields() + 1; } llhttp_set_error_reason(htp, "too many headers"); return HPE_USER; @@ -239,7 +236,7 @@ int htp_hdr_valcb(llhttp_t *htp, const char *data, size_t len) { } if (downstream->get_request_state() == DownstreamState::INITIAL) { downstream->set_request_state( - DownstreamState::HTTP1_REQUEST_HEADER_TOO_LARGE); + DownstreamState::HTTP1_REQUEST_HEADER_TOO_LARGE); } llhttp_set_error_reason(htp, "too large header"); return HPE_USER; @@ -255,13 +252,12 @@ int htp_hdr_valcb(llhttp_t *htp, const char *data, size_t len) { namespace { void rewrite_request_host_path_from_uri(BlockAllocator &balloc, Request &req, - const StringRef &uri, - http_parser_url &u) { - assert(u.field_set & (1 << UF_HOST)); + const StringRef &uri, urlparse_url &u) { + assert(u.field_set & (1 << URLPARSE_HOST)); // As per https://tools.ietf.org/html/rfc7230#section-5.4, we // rewrite host header field with authority component. - auto authority = util::get_uri_field(uri.c_str(), u, UF_HOST); + auto authority = util::get_uri_field(uri.data(), u, URLPARSE_HOST); // TODO properly check IPv6 numeric address auto ipv6 = std::find(std::begin(authority), std::end(authority), ':') != std::end(authority); @@ -269,12 +265,12 @@ void rewrite_request_host_path_from_uri(BlockAllocator &balloc, Request &req, if (ipv6) { authoritylen += 2; } - if (u.field_set & (1 << UF_PORT)) { + if (u.field_set & (1 << URLPARSE_PORT)) { authoritylen += 1 + str_size("65535"); } if (authoritylen > authority.size()) { auto iovec = make_byte_ref(balloc, authoritylen + 1); - auto p = iovec.base; + auto p = std::begin(iovec); if (ipv6) { *p++ = '['; } @@ -283,22 +279,22 @@ void rewrite_request_host_path_from_uri(BlockAllocator &balloc, Request &req, *p++ = ']'; } - if (u.field_set & (1 << UF_PORT)) { + if (u.field_set & (1 << URLPARSE_PORT)) { *p++ = ':'; p = util::utos(p, u.port); } *p = '\0'; - req.authority = StringRef{iovec.base, p}; + req.authority = StringRef{std::span{std::begin(iovec), p}}; } else { req.authority = authority; } - req.scheme = util::get_uri_field(uri.c_str(), u, UF_SCHEMA); + req.scheme = util::get_uri_field(uri.data(), u, URLPARSE_SCHEMA); StringRef path; - if (u.field_set & (1 << UF_PATH)) { - path = util::get_uri_field(uri.c_str(), u, UF_PATH); + if (u.field_set & (1 << URLPARSE_PATH)) { + path = util::get_uri_field(uri.data(), u, URLPARSE_PATH); } else if (req.method == HTTP_OPTIONS) { // Server-wide OPTIONS takes following form in proxy request: // @@ -306,21 +302,21 @@ void rewrite_request_host_path_from_uri(BlockAllocator &balloc, Request &req, // // Notice that no slash after authority. See // http://tools.ietf.org/html/rfc7230#section-5.3.4 - req.path = StringRef::from_lit(""); + req.path = ""_sr; // we ignore query component here return; } else { - path = StringRef::from_lit("/"); + path = "/"_sr; } - if (u.field_set & (1 << UF_QUERY)) { - auto &fdata = u.field_data[UF_QUERY]; + if (u.field_set & (1 << URLPARSE_QUERY)) { + auto &fdata = u.field_data[URLPARSE_QUERY]; - if (u.field_set & (1 << UF_PATH)) { - auto q = util::get_uri_field(uri.c_str(), u, UF_QUERY); + if (u.field_set & (1 << URLPARSE_PATH)) { + auto q = util::get_uri_field(uri.data(), u, URLPARSE_QUERY); path = StringRef{std::begin(path), std::end(q)}; } else { - path = concat_string_ref(balloc, path, StringRef::from_lit("?"), + path = concat_string_ref(balloc, path, "?"_sr, StringRef{&uri[fdata.off], fdata.len}); } } @@ -372,7 +368,7 @@ int htp_hdrs_completecb(llhttp_t *htp) { << "HTTP/" << req.http_major << "." << req.http_minor << "\n"; for (const auto &kv : req.fs.headers()) { - if (kv.name == "authorization") { + if (kv.name == "authorization"_sr) { ss << TTY_HTTP_HD << kv.name << TTY_RST << ": \n"; continue; } @@ -433,17 +429,18 @@ int htp_hdrs_completecb(llhttp_t *htp) { auto config = get_config(); if (method != HTTP_CONNECT) { - http_parser_url u{}; - rv = http_parser_parse_url(req.path.c_str(), req.path.size(), 0, &u); + urlparse_url u; + rv = urlparse_parse_url(req.path.data(), req.path.size(), 0, &u); if (rv != 0) { // Expect to respond with 400 bad request return -1; } - // checking UF_HOST could be redundant, but just in case ... - if (!(u.field_set & (1 << UF_SCHEMA)) || !(u.field_set & (1 << UF_HOST))) { + // checking URLPARSE_HOST could be redundant, but just in case ... + if (!(u.field_set & (1 << URLPARSE_SCHEMA)) || + !(u.field_set & (1 << URLPARSE_HOST))) { req.no_authority = true; - if (method == HTTP_OPTIONS && req.path == StringRef::from_lit("*")) { + if (method == HTTP_OPTIONS && req.path == "*"_sr) { req.path = StringRef{}; } else { req.path = http2::rewrite_clean_path(balloc, req.path); @@ -454,9 +451,9 @@ int htp_hdrs_completecb(llhttp_t *htp) { } if (handler->get_ssl()) { - req.scheme = StringRef::from_lit("https"); + req.scheme = "https"_sr; } else { - req.scheme = StringRef::from_lit("http"); + req.scheme = "http"_sr; } } else { rewrite_request_host_path_from_uri(balloc, req, req.path, u); @@ -547,7 +544,7 @@ int htp_hdrs_completecb(llhttp_t *htp) { // Continue here to make the client happy. if (downstream->get_expect_100_continue()) { auto output = downstream->get_response_buf(); - constexpr auto res = StringRef::from_lit("HTTP/1.1 100 Continue\r\n\r\n"); + constexpr auto res = "HTTP/1.1 100 Continue\r\n\r\n"_sr; output->append(res); handler->signal_write(); } @@ -563,7 +560,7 @@ int htp_bodycb(llhttp_t *htp, const char *data, size_t len) { auto upstream = static_cast(htp->data); auto downstream = upstream->get_downstream(); rv = downstream->push_upload_data_chunk( - reinterpret_cast(data), len); + reinterpret_cast(data), len); if (rv != 0) { // Ignore error if response has been completed. We will end up in // htp_msg_completecb, and request will end gracefully. @@ -636,7 +633,6 @@ int HttpsUpstream::on_read() { // downstream can be nullptr here, because it is initialized in the // callback chain called by llhttp_execute() if (downstream && downstream->get_upgraded()) { - auto rv = downstream->push_upload_data_chunk(rb->pos(), rb->rleft()); if (rv != 0) { @@ -675,7 +671,7 @@ int HttpsUpstream::on_read() { if (htperr == HPE_PAUSED_UPGRADE && rb->pos() == - reinterpret_cast(llhttp_get_error_pos(&htp_))) { + reinterpret_cast(llhttp_get_error_pos(&htp_))) { llhttp_resume_after_upgrade(&htp_); htperr = llhttp_execute(&htp_, reinterpret_cast(rb->pos()), @@ -683,10 +679,10 @@ int HttpsUpstream::on_read() { } auto nread = - htperr == HPE_OK - ? rb->rleft() - : reinterpret_cast(llhttp_get_error_pos(&htp_)) - - rb->pos(); + htperr == HPE_OK + ? rb->rleft() + : reinterpret_cast(llhttp_get_error_pos(&htp_)) - + rb->pos(); rb->drain(nread); rlimit->startw(); @@ -795,12 +791,9 @@ int HttpsUpstream::on_write() { return 0; } - auto conn = handler_->get_connection(); auto &upstreamconf = get_config()->conn.upstream; - conn->rt.repeat = upstreamconf.timeout.idle_read; - - handler_->repeat_read_timer(); + handler_->reset_upstream_read_timeout(upstreamconf.timeout.idle); return resume_read(SHRPX_NO_BUFFER, nullptr, 0); } else { @@ -988,8 +981,7 @@ int HttpsUpstream::send_reply(Downstream *downstream, const uint8_t *body, if (httpconf.max_requests <= num_requests_ || worker->get_graceful_shutdown()) { - resp.fs.add_header_token(StringRef::from_lit("connection"), - StringRef::from_lit("close"), false, + resp.fs.add_header_token("connection"_sr, "close"_sr, false, http2::HD_CONNECTION); connection_close = true; } else if (req.http_major <= 0 || @@ -997,7 +989,7 @@ int HttpsUpstream::send_reply(Downstream *downstream, const uint8_t *body, connection_close = true; } else { auto c = resp.fs.header(http2::HD_CONNECTION); - if (c && util::strieq_l("close", c->value)) { + if (c && util::strieq("close"_sr, c->value)) { connection_close = true; } } @@ -1040,9 +1032,12 @@ int HttpsUpstream::send_reply(Downstream *downstream, const uint8_t *body, output->append("\r\n"); - output->append(body, bodylen); + if (req.method != HTTP_HEAD) { + output->append(body, bodylen); + + downstream->response_sent_body_length += bodylen; + } - downstream->response_sent_body_length += bodylen; downstream->set_response_state(DownstreamState::MSG_COMPLETE); return 0; @@ -1053,7 +1048,7 @@ void HttpsUpstream::error_reply(unsigned int status_code) { if (!downstream) { attach_downstream( - std::make_unique(this, handler_->get_mcpool(), 1)); + std::make_unique(this, handler_->get_mcpool(), 1)); downstream = get_downstream(); } @@ -1077,18 +1072,24 @@ void HttpsUpstream::error_reply(unsigned int status_code) { output->append("\r\nServer: "); output->append(get_config()->http.server_name); output->append("\r\nContent-Length: "); - std::array intbuf; - output->append(StringRef{std::begin(intbuf), - util::utos(std::begin(intbuf), html.size())}); + std::array intbuf; + output->append( + StringRef{std::begin(intbuf), util::utos(std::begin(intbuf), html.size())}); output->append("\r\nDate: "); auto lgconf = log_config(); lgconf->update_tstamp(std::chrono::system_clock::now()); output->append(lgconf->tstamp->time_http); output->append("\r\nContent-Type: text/html; " "charset=UTF-8\r\nConnection: close\r\n\r\n"); - output->append(html); - downstream->response_sent_body_length += html.size(); + const auto &req = downstream->request(); + + if (req.method != HTTP_HEAD) { + output->append(html); + + downstream->response_sent_body_length += html.size(); + } + downstream->set_response_state(DownstreamState::MSG_COMPLETE); } @@ -1187,7 +1188,7 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream) { if (!config->http2_proxy && !httpconf.no_location_rewrite) { downstream->rewrite_location_response_header( - get_client_handler()->get_upstream_scheme()); + get_client_handler()->get_upstream_scheme()); } if (downstream->get_non_final_response()) { @@ -1207,8 +1208,8 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream) { auto build_flags = (http2::HDOP_STRIP_ALL & ~http2::HDOP_STRIP_VIA) | (!http2::legacy_http1(req.http_major, req.http_minor) - ? 0 - : http2::HDOP_STRIP_TRANSFER_ENCODING); + ? 0 + : http2::HDOP_STRIP_TRANSFER_ENCODING); http2::build_http1_headers_from_headers(buf, resp.fs.headers(), build_flags); @@ -1294,9 +1295,9 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream) { auto &shared_addr = group->shared_addr; auto &cookieconf = shared_addr->affinity.cookie; auto secure = - http::require_cookie_secure_attribute(cookieconf.secure, req.scheme); + http::require_cookie_secure_attribute(cookieconf.secure, req.scheme); auto cookie_str = http::create_affinity_cookie( - balloc, cookieconf.name, affinity_cookie, cookieconf.path, secure); + balloc, cookieconf.name, affinity_cookie, cookieconf.path, secure); buf->append("Set-Cookie: "); buf->append(cookie_str); buf->append("\r\n"); @@ -1401,7 +1402,7 @@ int HttpsUpstream::on_downstream_abort_request(Downstream *downstream, } int HttpsUpstream::on_downstream_abort_request_with_https_redirect( - Downstream *downstream) { + Downstream *downstream) { redirect_to_https(downstream); handler_->signal_write(); return 0; @@ -1409,7 +1410,7 @@ int HttpsUpstream::on_downstream_abort_request_with_https_redirect( int HttpsUpstream::redirect_to_https(Downstream *downstream) { auto &req = downstream->request(); - if (req.method == HTTP_CONNECT || req.scheme != "http" || + if (req.method == HTTP_CONNECT || req.scheme != "http"_sr || req.authority.empty()) { error_reply(400); return 0; @@ -1426,21 +1427,17 @@ int HttpsUpstream::redirect_to_https(Downstream *downstream) { auto &httpconf = config->http; StringRef loc; - if (httpconf.redirect_https_port == StringRef::from_lit("443")) { - loc = concat_string_ref(balloc, StringRef::from_lit("https://"), authority, - req.path); + if (httpconf.redirect_https_port == "443"_sr) { + loc = concat_string_ref(balloc, "https://"_sr, authority, req.path); } else { - loc = concat_string_ref(balloc, StringRef::from_lit("https://"), authority, - StringRef::from_lit(":"), + loc = concat_string_ref(balloc, "https://"_sr, authority, ":"_sr, httpconf.redirect_https_port, req.path); } auto &resp = downstream->response(); resp.http_status = 308; - resp.fs.add_header_token(StringRef::from_lit("location"), loc, false, - http2::HD_LOCATION); - resp.fs.add_header_token(StringRef::from_lit("connection"), - StringRef::from_lit("close"), false, + resp.fs.add_header_token("location"_sr, loc, false, http2::HD_LOCATION); + resp.fs.add_header_token("connection"_sr, "close"_sr, false, http2::HD_CONNECTION); return send_reply(downstream, nullptr, 0); @@ -1570,13 +1567,13 @@ HttpsUpstream::on_downstream_push_promise(Downstream *downstream, } int HttpsUpstream::on_downstream_push_promise_complete( - Downstream *downstream, Downstream *promised_downstream) { + Downstream *downstream, Downstream *promised_downstream) { return -1; } bool HttpsUpstream::push_enabled() const { return false; } void HttpsUpstream::cancel_premature_downstream( - Downstream *promised_downstream) {} + Downstream *promised_downstream) {} } // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_https_upstream.h b/lib/nghttp2-1.65.0/src/shrpx_https_upstream.h similarity index 100% rename from lib/nghttp2/src/shrpx_https_upstream.h rename to lib/nghttp2-1.65.0/src/shrpx_https_upstream.h diff --git a/lib/nghttp2/src/shrpx_io_control.cc b/lib/nghttp2-1.65.0/src/shrpx_io_control.cc similarity index 100% rename from lib/nghttp2/src/shrpx_io_control.cc rename to lib/nghttp2-1.65.0/src/shrpx_io_control.cc diff --git a/lib/nghttp2/src/shrpx_io_control.h b/lib/nghttp2-1.65.0/src/shrpx_io_control.h similarity index 100% rename from lib/nghttp2/src/shrpx_io_control.h rename to lib/nghttp2-1.65.0/src/shrpx_io_control.h diff --git a/lib/nghttp2/src/shrpx_live_check.cc b/lib/nghttp2-1.65.0/src/shrpx_live_check.cc similarity index 87% rename from lib/nghttp2/src/shrpx_live_check.cc rename to lib/nghttp2-1.65.0/src/shrpx_live_check.cc index 5d1057c6e84..37326e77be9 100644 --- a/lib/nghttp2/src/shrpx_live_check.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_live_check.cc @@ -102,24 +102,24 @@ void settings_timeout_cb(struct ev_loop *loop, ev_timer *w, int revents) { LiveCheck::LiveCheck(struct ev_loop *loop, SSL_CTX *ssl_ctx, Worker *worker, DownstreamAddr *addr, std::mt19937 &gen) - : conn_(loop, -1, nullptr, worker->get_mcpool(), - worker->get_downstream_config()->timeout.write, - worker->get_downstream_config()->timeout.read, {}, {}, writecb, - readcb, timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold, - get_config()->tls.dyn_rec.idle_timeout, Proto::NONE), - wb_(worker->get_mcpool()), - gen_(gen), - read_(&LiveCheck::noop), - write_(&LiveCheck::noop), - worker_(worker), - ssl_ctx_(ssl_ctx), - addr_(addr), - session_(nullptr), - raddr_(nullptr), - success_count_(0), - fail_count_(0), - settings_ack_received_(false), - session_closing_(false) { + : conn_(loop, -1, nullptr, worker->get_mcpool(), + worker->get_downstream_config()->timeout.write, + worker->get_downstream_config()->timeout.read, {}, {}, writecb, + readcb, timeoutcb, this, get_config()->tls.dyn_rec.warmup_threshold, + get_config()->tls.dyn_rec.idle_timeout, Proto::NONE), + wb_(worker->get_mcpool()), + gen_(gen), + read_(&LiveCheck::noop), + write_(&LiveCheck::noop), + worker_(worker), + ssl_ctx_(ssl_ctx), + addr_(addr), + session_(nullptr), + raddr_(nullptr), + success_count_(0), + fail_count_(0), + settings_ack_received_(false), + session_closing_(false) { ev_timer_init(&backoff_timer_, backoff_timeoutcb, 0., 0.); backoff_timer_.data = this; @@ -174,14 +174,14 @@ constexpr auto JITTER = 0.2; void LiveCheck::schedule() { auto base_backoff = - util::int_pow(MULTIPLIER, std::min(fail_count_, MAX_BACKOFF_EXP)); + util::int_pow(MULTIPLIER, std::min(fail_count_, MAX_BACKOFF_EXP)); auto dist = std::uniform_real_distribution<>(-JITTER * base_backoff, JITTER * base_backoff); auto &downstreamconf = *get_config()->conn.downstream; auto backoff = - std::min(downstreamconf.timeout.max_backoff, base_backoff + dist(gen_)); + std::min(downstreamconf.timeout.max_backoff, base_backoff + dist(gen_)); ev_timer_set(&backoff_timer_, backoff, 0.); ev_timer_start(conn_.loop, &backoff_timer_); @@ -228,17 +228,17 @@ int LiveCheck::initiate_connection() { if (addr_->dns) { if (!dns_query_) { auto dns_query = std::make_unique( - addr_->host, [this](DNSResolverStatus status, const Address *result) { - int rv; - - if (status == DNSResolverStatus::OK) { - *this->resolved_addr_ = *result; - } - rv = this->initiate_connection(); - if (rv != 0) { - this->on_failure(); - } - }); + addr_->host, [this](DNSResolverStatus status, const Address *result) { + int rv; + + if (status == DNSResolverStatus::OK) { + *this->resolved_addr_ = *result; + } + rv = this->initiate_connection(); + if (rv != 0) { + this->on_failure(); + } + }); auto dns_tracker = worker_->get_dns_tracker(); if (!resolved_addr_) { @@ -298,9 +298,9 @@ int LiveCheck::initiate_connection() { if (addr_->tls) { auto sni_name = - addr_->sni.empty() ? StringRef{addr_->host} : StringRef{addr_->sni}; - if (!util::numeric_host(sni_name.c_str())) { - SSL_set_tlsext_host_name(conn_.tls.ssl, sni_name.c_str()); + addr_->sni.empty() ? StringRef{addr_->host} : StringRef{addr_->sni}; + if (!util::numeric_host(sni_name.data())) { + SSL_set_tlsext_host_name(conn_.tls.ssl, sni_name.data()); } auto session = tls::reuse_tls_session(addr_->tls_session_cache); @@ -405,20 +405,13 @@ int LiveCheck::tls_handshake() { const unsigned char *next_proto = nullptr; unsigned int next_proto_len = 0; -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_get0_next_proto_negotiated(conn_.tls.ssl, &next_proto, &next_proto_len); -#endif // !OPENSSL_NO_NEXTPROTONEG -#if OPENSSL_VERSION_NUMBER >= 0x10002000L - if (next_proto == nullptr) { - SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len); - } -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L + SSL_get0_alpn_selected(conn_.tls.ssl, &next_proto, &next_proto_len); auto proto = StringRef{next_proto, next_proto_len}; switch (addr_->proto) { case Proto::HTTP1: - if (proto.empty() || proto == StringRef::from_lit("http/1.1")) { + if (proto.empty() || proto == "http/1.1"_sr) { break; } return -1; @@ -587,18 +580,16 @@ int LiveCheck::write_clear() { } int LiveCheck::on_read(const uint8_t *data, size_t len) { - ssize_t rv; - - rv = nghttp2_session_mem_recv(session_, data, len); + auto rv = nghttp2_session_mem_recv2(session_, data, len); if (rv < 0) { - LOG(ERROR) << "nghttp2_session_mem_recv() returned error: " + LOG(ERROR) << "nghttp2_session_mem_recv2() returned error: " << nghttp2_strerror(rv); return -1; } if (settings_ack_received_ && !session_closing_) { session_closing_ = true; - rv = nghttp2_session_terminate_session(session_, NGHTTP2_NO_ERROR); + auto rv = nghttp2_session_terminate_session(session_, NGHTTP2_NO_ERROR); if (rv != 0) { return -1; } @@ -626,10 +617,10 @@ int LiveCheck::on_read(const uint8_t *data, size_t len) { int LiveCheck::on_write() { for (;;) { const uint8_t *data; - auto datalen = nghttp2_session_mem_send(session_, &data); + auto datalen = nghttp2_session_mem_send2(session_, &data); if (datalen < 0) { - LOG(ERROR) << "nghttp2_session_mem_send() returned error: " + LOG(ERROR) << "nghttp2_session_mem_send2() returned error: " << nghttp2_strerror(datalen); return -1; } @@ -775,15 +766,15 @@ int LiveCheck::connection_made() { } auto must_terminate = - addr_->tls && !nghttp2::tls::check_http2_requirement(conn_.tls.ssl); + addr_->tls && !nghttp2::tls::check_http2_requirement(conn_.tls.ssl); if (must_terminate) { if (LOG_ENABLED(INFO)) { LOG(INFO) << "TLSv1.2 was not negotiated. HTTP/2 must not be negotiated."; } - rv = nghttp2_session_terminate_session(session_, - NGHTTP2_INADEQUATE_SECURITY); + rv = + nghttp2_session_terminate_session(session_, NGHTTP2_INADEQUATE_SECURITY); if (rv != 0) { return -1; } diff --git a/lib/nghttp2/src/shrpx_live_check.h b/lib/nghttp2-1.65.0/src/shrpx_live_check.h similarity index 93% rename from lib/nghttp2/src/shrpx_live_check.h rename to lib/nghttp2-1.65.0/src/shrpx_live_check.h index b65ecdcda55..7950e88b742 100644 --- a/lib/nghttp2/src/shrpx_live_check.h +++ b/lib/nghttp2-1.65.0/src/shrpx_live_check.h @@ -30,7 +30,14 @@ #include #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include diff --git a/lib/nghttp2/src/shrpx_log.cc b/lib/nghttp2-1.65.0/src/shrpx_log.cc similarity index 77% rename from lib/nghttp2/src/shrpx_log.cc rename to lib/nghttp2-1.65.0/src/shrpx_log.cc index de5e09fa156..1f12ebb4a1b 100644 --- a/lib/nghttp2/src/shrpx_log.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_log.cc @@ -58,19 +58,17 @@ using namespace nghttp2; namespace shrpx { namespace { -constexpr StringRef SEVERITY_STR[] = { - StringRef::from_lit("INFO"), StringRef::from_lit("NOTICE"), - StringRef::from_lit("WARN"), StringRef::from_lit("ERROR"), - StringRef::from_lit("FATAL")}; +constexpr StringRef SEVERITY_STR[] = {"INFO"_sr, "NOTICE"_sr, "WARN"_sr, + "ERROR"_sr, "FATAL"_sr}; } // namespace namespace { constexpr const char *SEVERITY_COLOR[] = { - "\033[1;32m", // INFO - "\033[1;36m", // NOTICE - "\033[1;33m", // WARN - "\033[1;31m", // ERROR - "\033[1;35m", // FATAL + "\033[1;32m", // INFO + "\033[1;36m", // NOTICE + "\033[1;33m", // WARN + "\033[1;31m", // ERROR + "\033[1;35m", // FATAL }; } // namespace @@ -143,15 +141,15 @@ int severity_to_syslog_level(int severity) { } Log::Log(int severity, const char *filename, int linenum) - : buf_(*get_logbuf()), - begin_(buf_.data()), - end_(begin_ + buf_.size()), - last_(begin_), - filename_(filename), - flags_(0), - severity_(severity), - linenum_(linenum), - full_(false) {} + : buf_(*get_logbuf()), + begin_(buf_.data()), + end_(begin_ + buf_.size()), + last_(begin_), + filename_(filename), + flags_(0), + severity_(severity), + linenum_(linenum), + full_(false) {} Log::~Log() { int rv; @@ -173,11 +171,10 @@ Log::~Log() { if (errorconf.syslog) { if (severity_ == NOTICE) { syslog(severity_to_syslog_level(severity_), "[%s] %.*s", - SEVERITY_STR[severity_].c_str(), static_cast(rleft()), - begin_); + SEVERITY_STR[severity_].data(), static_cast(rleft()), begin_); } else { syslog(severity_to_syslog_level(severity_), "[%s] %.*s (%s:%d)", - SEVERITY_STR[severity_].c_str(), static_cast(rleft()), begin_, + SEVERITY_STR[severity_].data(), static_cast(rleft()), begin_, filename_, linenum_); } @@ -192,10 +189,10 @@ Log::~Log() { // Error log format: // (:) rv = snprintf(buf, sizeof(buf), "%s %d %d %s %s%s%s (%s:%d) %.*s\n", - lgconf->tstamp->time_iso8601.c_str(), config->pid, lgconf->pid, + lgconf->tstamp->time_iso8601.data(), config->pid, lgconf->pid, lgconf->thread_id.c_str(), tty ? SEVERITY_COLOR[severity_] : "", - SEVERITY_STR[severity_].c_str(), tty ? "\033[0m" : "", - filename_, linenum_, static_cast(rleft()), begin_); + SEVERITY_STR[severity_].data(), tty ? "\033[0m" : "", filename_, + linenum_, static_cast(rleft()), begin_); if (rv < 0) { return; @@ -352,9 +349,9 @@ Log &Log::operator<<(const void *p) { } namespace log { -void hex(Log &log) { log.set_flags(Log::fmt_hex); }; +void hex(Log &log) { log.set_flags(Log::fmt_hex); } -void dec(Log &log) { log.set_flags(Log::fmt_dec); }; +void dec(Log &log) { log.set_flags(Log::fmt_dec); } } // namespace log namespace { @@ -363,7 +360,7 @@ std::pair copy(const char *src, size_t srclen, OutputIterator d_first, OutputIterator d_last) { auto nwrite = - std::min(static_cast(std::distance(d_first, d_last)), srclen); + std::min(static_cast(std::distance(d_first, d_last)), srclen); return std::make_pair(std::copy_n(src, nwrite, d_first), d_last); } } // namespace @@ -380,7 +377,7 @@ namespace { template std::pair copy(const StringRef &src, OutputIterator d_first, OutputIterator d_last) { - return copy(src.c_str(), src.size(), d_first, d_last); + return copy(src.data(), src.size(), d_first, d_last); } } // namespace @@ -413,9 +410,9 @@ template std::pair copy_hex_low(const uint8_t *src, size_t srclen, OutputIterator d_first, OutputIterator d_last) { - auto nwrite = std::min(static_cast(std::distance(d_first, d_last)), - srclen * 2) / - 2; + auto nwrite = + std::min(static_cast(std::distance(d_first, d_last)), srclen * 2) / + 2; for (size_t i = 0; i < nwrite; ++i) { *d_first++ = LOWER_XDIGITS[src[i] >> 4]; *d_first++ = LOWER_XDIGITS[src[i] & 0xf]; @@ -440,58 +437,58 @@ namespace { // 1 means that character must be escaped as "\xNN", where NN is ascii // code of the character in hex notation. constexpr uint8_t ESCAPE_TBL[] = { - 1 /* NUL */, 1 /* SOH */, 1 /* STX */, 1 /* ETX */, 1 /* EOT */, - 1 /* ENQ */, 1 /* ACK */, 1 /* BEL */, 1 /* BS */, 1 /* HT */, - 1 /* LF */, 1 /* VT */, 1 /* FF */, 1 /* CR */, 1 /* SO */, - 1 /* SI */, 1 /* DLE */, 1 /* DC1 */, 1 /* DC2 */, 1 /* DC3 */, - 1 /* DC4 */, 1 /* NAK */, 1 /* SYN */, 1 /* ETB */, 1 /* CAN */, - 1 /* EM */, 1 /* SUB */, 1 /* ESC */, 1 /* FS */, 1 /* GS */, - 1 /* RS */, 1 /* US */, 0 /* SPC */, 0 /* ! */, 1 /* " */, - 0 /* # */, 0 /* $ */, 0 /* % */, 0 /* & */, 0 /* ' */, - 0 /* ( */, 0 /* ) */, 0 /* * */, 0 /* + */, 0 /* , */, - 0 /* - */, 0 /* . */, 0 /* / */, 0 /* 0 */, 0 /* 1 */, - 0 /* 2 */, 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, - 0 /* 7 */, 0 /* 8 */, 0 /* 9 */, 0 /* : */, 0 /* ; */, - 0 /* < */, 0 /* = */, 0 /* > */, 0 /* ? */, 0 /* @ */, - 0 /* A */, 0 /* B */, 0 /* C */, 0 /* D */, 0 /* E */, - 0 /* F */, 0 /* G */, 0 /* H */, 0 /* I */, 0 /* J */, - 0 /* K */, 0 /* L */, 0 /* M */, 0 /* N */, 0 /* O */, - 0 /* P */, 0 /* Q */, 0 /* R */, 0 /* S */, 0 /* T */, - 0 /* U */, 0 /* V */, 0 /* W */, 0 /* X */, 0 /* Y */, - 0 /* Z */, 0 /* [ */, 1 /* \ */, 0 /* ] */, 0 /* ^ */, - 0 /* _ */, 0 /* ` */, 0 /* a */, 0 /* b */, 0 /* c */, - 0 /* d */, 0 /* e */, 0 /* f */, 0 /* g */, 0 /* h */, - 0 /* i */, 0 /* j */, 0 /* k */, 0 /* l */, 0 /* m */, - 0 /* n */, 0 /* o */, 0 /* p */, 0 /* q */, 0 /* r */, - 0 /* s */, 0 /* t */, 0 /* u */, 0 /* v */, 0 /* w */, - 0 /* x */, 0 /* y */, 0 /* z */, 0 /* { */, 0 /* | */, - 0 /* } */, 0 /* ~ */, 1 /* DEL */, 1 /* 0x80 */, 1 /* 0x81 */, - 1 /* 0x82 */, 1 /* 0x83 */, 1 /* 0x84 */, 1 /* 0x85 */, 1 /* 0x86 */, - 1 /* 0x87 */, 1 /* 0x88 */, 1 /* 0x89 */, 1 /* 0x8a */, 1 /* 0x8b */, - 1 /* 0x8c */, 1 /* 0x8d */, 1 /* 0x8e */, 1 /* 0x8f */, 1 /* 0x90 */, - 1 /* 0x91 */, 1 /* 0x92 */, 1 /* 0x93 */, 1 /* 0x94 */, 1 /* 0x95 */, - 1 /* 0x96 */, 1 /* 0x97 */, 1 /* 0x98 */, 1 /* 0x99 */, 1 /* 0x9a */, - 1 /* 0x9b */, 1 /* 0x9c */, 1 /* 0x9d */, 1 /* 0x9e */, 1 /* 0x9f */, - 1 /* 0xa0 */, 1 /* 0xa1 */, 1 /* 0xa2 */, 1 /* 0xa3 */, 1 /* 0xa4 */, - 1 /* 0xa5 */, 1 /* 0xa6 */, 1 /* 0xa7 */, 1 /* 0xa8 */, 1 /* 0xa9 */, - 1 /* 0xaa */, 1 /* 0xab */, 1 /* 0xac */, 1 /* 0xad */, 1 /* 0xae */, - 1 /* 0xaf */, 1 /* 0xb0 */, 1 /* 0xb1 */, 1 /* 0xb2 */, 1 /* 0xb3 */, - 1 /* 0xb4 */, 1 /* 0xb5 */, 1 /* 0xb6 */, 1 /* 0xb7 */, 1 /* 0xb8 */, - 1 /* 0xb9 */, 1 /* 0xba */, 1 /* 0xbb */, 1 /* 0xbc */, 1 /* 0xbd */, - 1 /* 0xbe */, 1 /* 0xbf */, 1 /* 0xc0 */, 1 /* 0xc1 */, 1 /* 0xc2 */, - 1 /* 0xc3 */, 1 /* 0xc4 */, 1 /* 0xc5 */, 1 /* 0xc6 */, 1 /* 0xc7 */, - 1 /* 0xc8 */, 1 /* 0xc9 */, 1 /* 0xca */, 1 /* 0xcb */, 1 /* 0xcc */, - 1 /* 0xcd */, 1 /* 0xce */, 1 /* 0xcf */, 1 /* 0xd0 */, 1 /* 0xd1 */, - 1 /* 0xd2 */, 1 /* 0xd3 */, 1 /* 0xd4 */, 1 /* 0xd5 */, 1 /* 0xd6 */, - 1 /* 0xd7 */, 1 /* 0xd8 */, 1 /* 0xd9 */, 1 /* 0xda */, 1 /* 0xdb */, - 1 /* 0xdc */, 1 /* 0xdd */, 1 /* 0xde */, 1 /* 0xdf */, 1 /* 0xe0 */, - 1 /* 0xe1 */, 1 /* 0xe2 */, 1 /* 0xe3 */, 1 /* 0xe4 */, 1 /* 0xe5 */, - 1 /* 0xe6 */, 1 /* 0xe7 */, 1 /* 0xe8 */, 1 /* 0xe9 */, 1 /* 0xea */, - 1 /* 0xeb */, 1 /* 0xec */, 1 /* 0xed */, 1 /* 0xee */, 1 /* 0xef */, - 1 /* 0xf0 */, 1 /* 0xf1 */, 1 /* 0xf2 */, 1 /* 0xf3 */, 1 /* 0xf4 */, - 1 /* 0xf5 */, 1 /* 0xf6 */, 1 /* 0xf7 */, 1 /* 0xf8 */, 1 /* 0xf9 */, - 1 /* 0xfa */, 1 /* 0xfb */, 1 /* 0xfc */, 1 /* 0xfd */, 1 /* 0xfe */, - 1 /* 0xff */, + 1 /* NUL */, 1 /* SOH */, 1 /* STX */, 1 /* ETX */, 1 /* EOT */, + 1 /* ENQ */, 1 /* ACK */, 1 /* BEL */, 1 /* BS */, 1 /* HT */, + 1 /* LF */, 1 /* VT */, 1 /* FF */, 1 /* CR */, 1 /* SO */, + 1 /* SI */, 1 /* DLE */, 1 /* DC1 */, 1 /* DC2 */, 1 /* DC3 */, + 1 /* DC4 */, 1 /* NAK */, 1 /* SYN */, 1 /* ETB */, 1 /* CAN */, + 1 /* EM */, 1 /* SUB */, 1 /* ESC */, 1 /* FS */, 1 /* GS */, + 1 /* RS */, 1 /* US */, 0 /* SPC */, 0 /* ! */, 1 /* " */, + 0 /* # */, 0 /* $ */, 0 /* % */, 0 /* & */, 0 /* ' */, + 0 /* ( */, 0 /* ) */, 0 /* * */, 0 /* + */, 0 /* , */, + 0 /* - */, 0 /* . */, 0 /* / */, 0 /* 0 */, 0 /* 1 */, + 0 /* 2 */, 0 /* 3 */, 0 /* 4 */, 0 /* 5 */, 0 /* 6 */, + 0 /* 7 */, 0 /* 8 */, 0 /* 9 */, 0 /* : */, 0 /* ; */, + 0 /* < */, 0 /* = */, 0 /* > */, 0 /* ? */, 0 /* @ */, + 0 /* A */, 0 /* B */, 0 /* C */, 0 /* D */, 0 /* E */, + 0 /* F */, 0 /* G */, 0 /* H */, 0 /* I */, 0 /* J */, + 0 /* K */, 0 /* L */, 0 /* M */, 0 /* N */, 0 /* O */, + 0 /* P */, 0 /* Q */, 0 /* R */, 0 /* S */, 0 /* T */, + 0 /* U */, 0 /* V */, 0 /* W */, 0 /* X */, 0 /* Y */, + 0 /* Z */, 0 /* [ */, 1 /* \ */, 0 /* ] */, 0 /* ^ */, + 0 /* _ */, 0 /* ` */, 0 /* a */, 0 /* b */, 0 /* c */, + 0 /* d */, 0 /* e */, 0 /* f */, 0 /* g */, 0 /* h */, + 0 /* i */, 0 /* j */, 0 /* k */, 0 /* l */, 0 /* m */, + 0 /* n */, 0 /* o */, 0 /* p */, 0 /* q */, 0 /* r */, + 0 /* s */, 0 /* t */, 0 /* u */, 0 /* v */, 0 /* w */, + 0 /* x */, 0 /* y */, 0 /* z */, 0 /* { */, 0 /* | */, + 0 /* } */, 0 /* ~ */, 1 /* DEL */, 1 /* 0x80 */, 1 /* 0x81 */, + 1 /* 0x82 */, 1 /* 0x83 */, 1 /* 0x84 */, 1 /* 0x85 */, 1 /* 0x86 */, + 1 /* 0x87 */, 1 /* 0x88 */, 1 /* 0x89 */, 1 /* 0x8a */, 1 /* 0x8b */, + 1 /* 0x8c */, 1 /* 0x8d */, 1 /* 0x8e */, 1 /* 0x8f */, 1 /* 0x90 */, + 1 /* 0x91 */, 1 /* 0x92 */, 1 /* 0x93 */, 1 /* 0x94 */, 1 /* 0x95 */, + 1 /* 0x96 */, 1 /* 0x97 */, 1 /* 0x98 */, 1 /* 0x99 */, 1 /* 0x9a */, + 1 /* 0x9b */, 1 /* 0x9c */, 1 /* 0x9d */, 1 /* 0x9e */, 1 /* 0x9f */, + 1 /* 0xa0 */, 1 /* 0xa1 */, 1 /* 0xa2 */, 1 /* 0xa3 */, 1 /* 0xa4 */, + 1 /* 0xa5 */, 1 /* 0xa6 */, 1 /* 0xa7 */, 1 /* 0xa8 */, 1 /* 0xa9 */, + 1 /* 0xaa */, 1 /* 0xab */, 1 /* 0xac */, 1 /* 0xad */, 1 /* 0xae */, + 1 /* 0xaf */, 1 /* 0xb0 */, 1 /* 0xb1 */, 1 /* 0xb2 */, 1 /* 0xb3 */, + 1 /* 0xb4 */, 1 /* 0xb5 */, 1 /* 0xb6 */, 1 /* 0xb7 */, 1 /* 0xb8 */, + 1 /* 0xb9 */, 1 /* 0xba */, 1 /* 0xbb */, 1 /* 0xbc */, 1 /* 0xbd */, + 1 /* 0xbe */, 1 /* 0xbf */, 1 /* 0xc0 */, 1 /* 0xc1 */, 1 /* 0xc2 */, + 1 /* 0xc3 */, 1 /* 0xc4 */, 1 /* 0xc5 */, 1 /* 0xc6 */, 1 /* 0xc7 */, + 1 /* 0xc8 */, 1 /* 0xc9 */, 1 /* 0xca */, 1 /* 0xcb */, 1 /* 0xcc */, + 1 /* 0xcd */, 1 /* 0xce */, 1 /* 0xcf */, 1 /* 0xd0 */, 1 /* 0xd1 */, + 1 /* 0xd2 */, 1 /* 0xd3 */, 1 /* 0xd4 */, 1 /* 0xd5 */, 1 /* 0xd6 */, + 1 /* 0xd7 */, 1 /* 0xd8 */, 1 /* 0xd9 */, 1 /* 0xda */, 1 /* 0xdb */, + 1 /* 0xdc */, 1 /* 0xdd */, 1 /* 0xde */, 1 /* 0xdf */, 1 /* 0xe0 */, + 1 /* 0xe1 */, 1 /* 0xe2 */, 1 /* 0xe3 */, 1 /* 0xe4 */, 1 /* 0xe5 */, + 1 /* 0xe6 */, 1 /* 0xe7 */, 1 /* 0xe8 */, 1 /* 0xe9 */, 1 /* 0xea */, + 1 /* 0xeb */, 1 /* 0xec */, 1 /* 0xed */, 1 /* 0xee */, 1 /* 0xef */, + 1 /* 0xf0 */, 1 /* 0xf1 */, 1 /* 0xf2 */, 1 /* 0xf3 */, 1 /* 0xf4 */, + 1 /* 0xf5 */, 1 /* 0xf6 */, 1 /* 0xf7 */, 1 /* 0xf8 */, 1 /* 0xf9 */, + 1 /* 0xfa */, 1 /* 0xfb */, 1 /* 0xfc */, 1 /* 0xfd */, 1 /* 0xfe */, + 1 /* 0xff */, }; } // namespace @@ -508,7 +505,7 @@ copy_escape(const char *src, size_t srclen, OutputIterator d_first, } auto n = - std::min(std::distance(d_first, d_last), std::distance(safe_first, p)); + std::min(std::distance(d_first, d_last), std::distance(safe_first, p)); d_first = std::copy_n(safe_first, n, d_first); if (std::distance(d_first, d_last) < 4) { return std::make_pair(d_first, d_last); @@ -531,7 +528,7 @@ template std::pair copy_escape(const StringRef &src, OutputIterator d_first, OutputIterator d_last) { - return copy_escape(src.c_str(), src.size(), d_first, d_last); + return copy_escape(src.data(), src.size(), d_first, d_last); } } // namespace @@ -555,7 +552,7 @@ StringRef construct_absolute_request_uri(BlockAllocator &balloc, } auto iov = make_byte_ref(balloc, len + 1); - auto p = iov.base; + auto p = std::begin(iov); if (req.scheme.empty()) { // We may have to log the request which lacks scheme (e.g., @@ -569,7 +566,7 @@ StringRef construct_absolute_request_uri(BlockAllocator &balloc, p = std::copy(std::begin(req.path), std::end(req.path), p); *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } } // namespace @@ -593,19 +590,18 @@ void upstream_accesslog(const std::vector &lfv, auto &balloc = downstream->get_block_allocator(); auto downstream_addr = downstream->get_addr(); - auto method = req.method == -1 ? StringRef::from_lit("") - : http2::to_method_string(req.method); - auto path = - req.method == HTTP_CONNECT ? req.authority - : config->http2_proxy ? construct_absolute_request_uri(balloc, req) - : req.path.empty() ? req.method == HTTP_OPTIONS ? StringRef::from_lit("*") - : StringRef::from_lit("-") - : req.path; + auto method = + req.method == -1 ? ""_sr : http2::to_method_string(req.method); + auto path = req.method == HTTP_CONNECT ? req.authority + : config->http2_proxy + ? construct_absolute_request_uri(balloc, req) + : req.path.empty() ? req.method == HTTP_OPTIONS ? "*"_sr : "-"_sr + : req.path; auto path_without_query = - req.method == HTTP_CONNECT - ? path - : StringRef{std::begin(path), - std::find(std::begin(path), std::end(path), '?')}; + req.method == HTTP_CONNECT + ? path + : StringRef{std::begin(path), + std::find(std::begin(path), std::end(path), '?')}; auto p = std::begin(buf); auto last = std::end(buf) - 2; @@ -686,8 +682,8 @@ void upstream_accesslog(const std::vector &lfv, break; case LogFragmentType::REQUEST_TIME: { auto t = std::chrono::duration_cast( - lgsp.request_end_time - downstream->get_request_start_time()) - .count(); + lgsp.request_end_time - downstream->get_request_start_time()) + .count(); std::tie(p, last) = copy(t / 1000, p, last); std::tie(p, last) = copy('.', p, last); auto frac = t % 1000; @@ -717,7 +713,7 @@ void upstream_accesslog(const std::vector &lfv, break; } std::tie(p, last) = - copy(nghttp2::tls::get_tls_protocol(lgsp.ssl), p, last); + copy(nghttp2::tls::get_tls_protocol(lgsp.ssl), p, last); break; case LogFragmentType::TLS_SESSION_ID: { auto session = SSL_get_session(lgsp.ssl); @@ -740,7 +736,7 @@ void upstream_accesslog(const std::vector &lfv, break; } std::tie(p, last) = - copy(SSL_session_reused(lgsp.ssl) ? 'r' : '.', p, last); + copy(SSL_session_reused(lgsp.ssl) ? 'r' : '.', p, last); break; case LogFragmentType::TLS_SNI: if (lgsp.sni.empty()) { @@ -766,10 +762,9 @@ void upstream_accesslog(const std::vector &lfv, } std::array buf; auto len = tls::get_x509_fingerprint( - buf.data(), buf.size(), x, - lf.type == LogFragmentType::TLS_CLIENT_FINGERPRINT_SHA256 - ? EVP_sha256() - : EVP_sha1()); + buf.data(), buf.size(), x, + lf.type == LogFragmentType::TLS_CLIENT_FINGERPRINT_SHA256 ? EVP_sha256() + : EVP_sha1()); #if !OPENSSL_3_0_0_API X509_free(x); #endif // !OPENSSL_3_0_0_API @@ -796,8 +791,8 @@ void upstream_accesslog(const std::vector &lfv, break; } auto name = lf.type == LogFragmentType::TLS_CLIENT_ISSUER_NAME - ? tls::get_x509_issuer_name(balloc, x) - : tls::get_x509_subject_name(balloc, x); + ? tls::get_x509_issuer_name(balloc, x) + : tls::get_x509_subject_name(balloc, x); #if !OPENSSL_3_0_0_API X509_free(x); #endif // !OPENSSL_3_0_0_API @@ -880,7 +875,7 @@ int reopen_log_files(const LoggingConfig &loggingconf) { auto &errorconf = loggingconf.error; if (!accessconf.syslog && !accessconf.file.empty()) { - new_accesslog_fd = open_log_file(accessconf.file.c_str()); + new_accesslog_fd = open_log_file(accessconf.file.data()); if (new_accesslog_fd == -1) { LOG(ERROR) << "Failed to open accesslog file " << accessconf.file; @@ -889,7 +884,7 @@ int reopen_log_files(const LoggingConfig &loggingconf) { } if (!errorconf.syslog && !errorconf.file.empty()) { - new_errorlog_fd = open_log_file(errorconf.file.c_str()); + new_errorlog_fd = open_log_file(errorconf.file.data()); if (new_errorlog_fd == -1) { if (lgconf->errorlog_fd != -1) { @@ -909,7 +904,7 @@ int reopen_log_files(const LoggingConfig &loggingconf) { lgconf->accesslog_fd = new_accesslog_fd; lgconf->errorlog_fd = new_errorlog_fd; lgconf->errorlog_tty = - (new_errorlog_fd == -1) ? false : isatty(new_errorlog_fd); + (new_errorlog_fd == -1) ? false : isatty(new_errorlog_fd); return res; } @@ -972,7 +967,6 @@ void close_log_file(int &fd) { } int open_log_file(const char *path) { - if (strcmp(path, "/dev/stdout") == 0 || strcmp(path, "/proc/self/fd/1") == 0) { return STDOUT_COPY; @@ -989,7 +983,7 @@ int open_log_file(const char *path) { #else // !O_CLOEXEC auto fd = - open(path, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP); + open(path, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP); // We get race condition if execve is called at the same time. if (fd != -1) { diff --git a/lib/nghttp2/src/shrpx_log.h b/lib/nghttp2-1.65.0/src/shrpx_log.h similarity index 98% rename from lib/nghttp2/src/shrpx_log.h rename to lib/nghttp2-1.65.0/src/shrpx_log.h index bc30097c67c..b22906f57fc 100644 --- a/lib/nghttp2/src/shrpx_log.h +++ b/lib/nghttp2-1.65.0/src/shrpx_log.h @@ -33,7 +33,6 @@ #include #include -#include "shrpx_config.h" #include "shrpx_log_config.h" #include "tls.h" #include "template.h" @@ -97,6 +96,7 @@ namespace shrpx { class Downstream; struct DownstreamAddr; +struct LoggingConfig; enum SeverityLevel { INFO, NOTICE, WARN, ERROR, FATAL }; @@ -266,8 +266,8 @@ enum class LogFragmentType { }; struct LogFragment { - LogFragment(LogFragmentType type, StringRef value = StringRef::from_lit("")) - : type(type), value(std::move(value)) {} + LogFragment(LogFragmentType type, StringRef value = ""_sr) + : type(type), value(std::move(value)) {} LogFragmentType type; StringRef value; }; diff --git a/lib/nghttp2/src/shrpx_log_config.cc b/lib/nghttp2-1.65.0/src/shrpx_log_config.cc similarity index 80% rename from lib/nghttp2/src/shrpx_log_config.cc rename to lib/nghttp2-1.65.0/src/shrpx_log_config.cc index 92eb0559164..1e8685d8328 100644 --- a/lib/nghttp2/src/shrpx_log_config.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_log_config.cc @@ -42,18 +42,16 @@ Timestamp::Timestamp(const std::chrono::system_clock::time_point &tp) { } LogConfig::LogConfig() - : time_str_updated(std::chrono::system_clock::now()), - tstamp(std::make_shared(time_str_updated)), - pid(getpid()), - accesslog_fd(-1), - errorlog_fd(-1), - errorlog_tty(false) { + : time_str_updated(std::chrono::system_clock::now()), + tstamp(std::make_shared(time_str_updated)), + pid(getpid()), + accesslog_fd(-1), + errorlog_fd(-1), + errorlog_tty(false) { auto tid = std::this_thread::get_id(); auto tid_hash = - util::hash32(StringRef{reinterpret_cast(&tid), - reinterpret_cast(&tid) + sizeof(tid)}); - thread_id = util::format_hex(reinterpret_cast(&tid_hash), - sizeof(tid_hash)); + util::hash32(StringRef{reinterpret_cast(&tid), sizeof(tid)}); + thread_id = util::format_hex(std::span{&tid_hash, 1}); } #ifndef NOTHREADS @@ -97,11 +95,11 @@ void delete_log_config() {} #endif // NOTHREADS void LogConfig::update_tstamp_millis( - const std::chrono::system_clock::time_point &now) { + const std::chrono::system_clock::time_point &now) { if (std::chrono::duration_cast( - now.time_since_epoch()) == + now.time_since_epoch()) == std::chrono::duration_cast( - time_str_updated.time_since_epoch())) { + time_str_updated.time_since_epoch())) { return; } @@ -111,11 +109,11 @@ void LogConfig::update_tstamp_millis( } void LogConfig::update_tstamp( - const std::chrono::system_clock::time_point &now) { + const std::chrono::system_clock::time_point &now) { if (std::chrono::duration_cast( - now.time_since_epoch()) == + now.time_since_epoch()) == std::chrono::duration_cast( - time_str_updated.time_since_epoch())) { + time_str_updated.time_since_epoch())) { return; } diff --git a/lib/nghttp2/src/shrpx_log_config.h b/lib/nghttp2-1.65.0/src/shrpx_log_config.h similarity index 100% rename from lib/nghttp2/src/shrpx_log_config.h rename to lib/nghttp2-1.65.0/src/shrpx_log_config.h diff --git a/lib/nghttp2/src/shrpx_memcached_connection.cc b/lib/nghttp2-1.65.0/src/shrpx_memcached_connection.cc similarity index 94% rename from lib/nghttp2/src/shrpx_memcached_connection.cc rename to lib/nghttp2-1.65.0/src/shrpx_memcached_connection.cc index f72cb111c77..0b2001bf2bd 100644 --- a/lib/nghttp2/src/shrpx_memcached_connection.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_memcached_connection.cc @@ -101,19 +101,19 @@ MemcachedConnection::MemcachedConnection(const Address *addr, const StringRef &sni_name, MemchunkPool *mcpool, std::mt19937 &gen) - : conn_(loop, -1, nullptr, mcpool, write_timeout, read_timeout, {}, {}, - connectcb, readcb, timeoutcb, this, 0, 0., Proto::MEMCACHED), - do_read_(&MemcachedConnection::noop), - do_write_(&MemcachedConnection::noop), - sni_name_(sni_name), - connect_blocker_( - gen, loop, [] {}, [] {}), - parse_state_{}, - addr_(addr), - ssl_ctx_(ssl_ctx), - sendsum_(0), - try_count_(0), - connected_(false) {} + : conn_(loop, -1, nullptr, mcpool, write_timeout, read_timeout, {}, {}, + connectcb, readcb, timeoutcb, this, 0, 0., Proto::MEMCACHED), + do_read_(&MemcachedConnection::noop), + do_write_(&MemcachedConnection::noop), + sni_name_(sni_name), + connect_blocker_( + gen, loop, [] {}, [] {}), + parse_state_{}, + addr_(addr), + ssl_ctx_(ssl_ctx), + sendsum_(0), + try_count_(0), + connected_(false) {} MemcachedConnection::~MemcachedConnection() { conn_.disconnect(); } @@ -182,8 +182,8 @@ int MemcachedConnection::initiate_connection() { } if (ssl_ctx_) { - if (!util::numeric_host(sni_name_.c_str())) { - SSL_set_tlsext_host_name(conn_.tls.ssl, sni_name_.c_str()); + if (!util::numeric_host(sni_name_.data())) { + SSL_set_tlsext_host_name(conn_.tls.ssl, sni_name_.data()); } auto session = tls::reuse_tls_session(tls_session_cache_); @@ -434,7 +434,7 @@ int MemcachedConnection::parse_packet() { if (recvq_.empty()) { MCLOG(WARN, this) - << "Response received, but there is no in-flight request."; + << "Response received, but there is no in-flight request."; return -1; } @@ -454,7 +454,7 @@ int MemcachedConnection::parse_packet() { // skip 1 byte reserved data type ++in; parse_state_.status_code = - static_cast(util::get_uint16(in)); + static_cast(util::get_uint16(in)); in += 2; parse_state_.totalbody = util::get_uint32(in); in += 4; @@ -465,9 +465,9 @@ int MemcachedConnection::parse_packet() { if (req->op != parse_state_.op) { MCLOG(WARN, this) - << "opcode in response does not match to the request: want " - << static_cast(req->op) << ", got " - << static_cast(parse_state_.op); + << "opcode in response does not match to the request: want " + << static_cast(req->op) << ", got " + << static_cast(parse_state_.op); return -1; } @@ -503,8 +503,8 @@ int MemcachedConnection::parse_packet() { parse_state_.read_left = parse_state_.extralen; } else { parse_state_.state = MemcachedParseState::VALUE; - parse_state_.read_left = parse_state_.totalbody - parse_state_.keylen - - parse_state_.extralen; + parse_state_.read_left = + parse_state_.totalbody - parse_state_.keylen - parse_state_.extralen; } busy = true; break; @@ -524,7 +524,7 @@ int MemcachedConnection::parse_packet() { // since we require keylen == 0, totalbody - extralen == // valuelen parse_state_.read_left = - parse_state_.totalbody - parse_state_.keylen - parse_state_.extralen; + parse_state_.totalbody - parse_state_.keylen - parse_state_.extralen; busy = true; break; } @@ -622,7 +622,7 @@ size_t MemcachedConnection::fill_request_buffer(struct iovec *iov, } if (buf.send_value_left) { iov[iovcnt++] = {req->value.data() + req->value.size() - - buf.send_value_left, + buf.send_value_left, buf.send_value_left}; } } diff --git a/lib/nghttp2/src/shrpx_memcached_connection.h b/lib/nghttp2-1.65.0/src/shrpx_memcached_connection.h similarity index 100% rename from lib/nghttp2/src/shrpx_memcached_connection.h rename to lib/nghttp2-1.65.0/src/shrpx_memcached_connection.h diff --git a/lib/nghttp2/src/shrpx_memcached_dispatcher.cc b/lib/nghttp2-1.65.0/src/shrpx_memcached_dispatcher.cc similarity index 91% rename from lib/nghttp2/src/shrpx_memcached_dispatcher.cc rename to lib/nghttp2-1.65.0/src/shrpx_memcached_dispatcher.cc index 024bd5ad5ce..ead25da3451 100644 --- a/lib/nghttp2/src/shrpx_memcached_dispatcher.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_memcached_dispatcher.cc @@ -36,9 +36,9 @@ MemcachedDispatcher::MemcachedDispatcher(const Address *addr, const StringRef &sni_name, MemchunkPool *mcpool, std::mt19937 &gen) - : loop_(loop), - mconn_(std::make_unique(addr, loop_, ssl_ctx, - sni_name, mcpool, gen)) {} + : loop_(loop), + mconn_(std::make_unique(addr, loop_, ssl_ctx, sni_name, + mcpool, gen)) {} MemcachedDispatcher::~MemcachedDispatcher() {} diff --git a/lib/nghttp2/src/shrpx_memcached_dispatcher.h b/lib/nghttp2-1.65.0/src/shrpx_memcached_dispatcher.h similarity index 89% rename from lib/nghttp2/src/shrpx_memcached_dispatcher.h rename to lib/nghttp2-1.65.0/src/shrpx_memcached_dispatcher.h index de1af80ba04..bd4953bda84 100644 --- a/lib/nghttp2/src/shrpx_memcached_dispatcher.h +++ b/lib/nghttp2-1.65.0/src/shrpx_memcached_dispatcher.h @@ -32,7 +32,14 @@ #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include "memchunk.h" #include "network.h" diff --git a/lib/nghttp2/src/shrpx_memcached_request.h b/lib/nghttp2-1.65.0/src/shrpx_memcached_request.h similarity index 96% rename from lib/nghttp2/src/shrpx_memcached_request.h rename to lib/nghttp2-1.65.0/src/shrpx_memcached_request.h index 36969831943..144418221f2 100644 --- a/lib/nghttp2/src/shrpx_memcached_request.h +++ b/lib/nghttp2-1.65.0/src/shrpx_memcached_request.h @@ -43,7 +43,7 @@ enum class MemcachedOp : uint8_t { struct MemcachedRequest; using MemcachedResultCallback = - std::function; + std::function; struct MemcachedRequest { std::string key; diff --git a/lib/nghttp2/src/shrpx_memcached_result.h b/lib/nghttp2-1.65.0/src/shrpx_memcached_result.h similarity index 96% rename from lib/nghttp2/src/shrpx_memcached_result.h rename to lib/nghttp2-1.65.0/src/shrpx_memcached_result.h index 60a87afc698..5766e157a8d 100644 --- a/lib/nghttp2/src/shrpx_memcached_result.h +++ b/lib/nghttp2-1.65.0/src/shrpx_memcached_result.h @@ -39,7 +39,7 @@ enum class MemcachedStatusCode : uint16_t { struct MemcachedResult { MemcachedResult(MemcachedStatusCode status_code) : status_code(status_code) {} MemcachedResult(MemcachedStatusCode status_code, std::vector value) - : value(std::move(value)), status_code(status_code) {} + : value(std::move(value)), status_code(status_code) {} std::vector value; MemcachedStatusCode status_code; diff --git a/lib/nghttp2/src/shrpx_mruby.cc b/lib/nghttp2-1.65.0/src/shrpx_mruby.cc similarity index 96% rename from lib/nghttp2/src/shrpx_mruby.cc rename to lib/nghttp2-1.65.0/src/shrpx_mruby.cc index b5c6ed3c85a..e8c99fb7a1f 100644 --- a/lib/nghttp2/src/shrpx_mruby.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_mruby.cc @@ -38,7 +38,7 @@ namespace shrpx { namespace mruby { MRubyContext::MRubyContext(mrb_state *mrb, mrb_value app, mrb_value env) - : mrb_(mrb), app_(std::move(app)), env_(std::move(env)) {} + : mrb_(mrb), app_(std::move(app)), env_(std::move(env)) {} MRubyContext::~MRubyContext() { if (mrb_) { @@ -144,19 +144,19 @@ RProc *compile(mrb_state *mrb, const StringRef &filename) { return nullptr; } - auto infile = fopen(filename.c_str(), "rb"); + auto infile = fopen(filename.data(), "rb"); if (infile == nullptr) { LOG(ERROR) << "Could not open mruby file " << filename; return nullptr; } auto infile_d = defer(fclose, infile); - auto mrbc = mrbc_context_new(mrb); + auto mrbc = mrb_ccontext_new(mrb); if (mrbc == nullptr) { LOG(ERROR) << "mrb_context_new failed"; return nullptr; } - auto mrbc_d = defer(mrbc_context_free, mrb, mrbc); + auto mrbc_d = defer(mrb_ccontext_free, mrb, mrbc); auto parser = mrb_parse_file(mrb, infile, nullptr); if (parser == nullptr) { diff --git a/lib/nghttp2/src/shrpx_mruby.h b/lib/nghttp2-1.65.0/src/shrpx_mruby.h similarity index 100% rename from lib/nghttp2/src/shrpx_mruby.h rename to lib/nghttp2-1.65.0/src/shrpx_mruby.h diff --git a/lib/nghttp2/src/shrpx_mruby_module.cc b/lib/nghttp2-1.65.0/src/shrpx_mruby_module.cc similarity index 95% rename from lib/nghttp2/src/shrpx_mruby_module.cc rename to lib/nghttp2-1.65.0/src/shrpx_mruby_module.cc index 27b7769c6df..0159ba2f5fc 100644 --- a/lib/nghttp2/src/shrpx_mruby_module.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_mruby_module.cc @@ -94,13 +94,13 @@ mrb_value create_headers_hash(mrb_state *mrb, const HeaderRefs &headers) { } auto ai = mrb_gc_arena_save(mrb); - auto key = mrb_str_new(mrb, hd.name.c_str(), hd.name.size()); + auto key = mrb_str_new(mrb, hd.name.data(), hd.name.size()); auto ary = mrb_hash_get(mrb, hash, key); if (mrb_nil_p(ary)) { ary = mrb_ary_new(mrb); mrb_hash_set(mrb, hash, key, ary); } - mrb_ary_push(mrb, ary, mrb_str_new(mrb, hd.value.c_str(), hd.value.size())); + mrb_ary_push(mrb, ary, mrb_str_new(mrb, hd.value.data(), hd.value.size())); mrb_gc_arena_restore(mrb, ai); } diff --git a/lib/nghttp2/src/shrpx_mruby_module.h b/lib/nghttp2-1.65.0/src/shrpx_mruby_module.h similarity index 100% rename from lib/nghttp2/src/shrpx_mruby_module.h rename to lib/nghttp2-1.65.0/src/shrpx_mruby_module.h diff --git a/lib/nghttp2/src/shrpx_mruby_module_env.cc b/lib/nghttp2-1.65.0/src/shrpx_mruby_module_env.cc similarity index 94% rename from lib/nghttp2/src/shrpx_mruby_module_env.cc rename to lib/nghttp2-1.65.0/src/shrpx_mruby_module_env.cc index 5ebd9c053a0..89bbe904140 100644 --- a/lib/nghttp2/src/shrpx_mruby_module_env.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_mruby_module_env.cc @@ -90,7 +90,7 @@ mrb_value env_get_remote_addr(mrb_state *mrb, mrb_value self) { auto &ipaddr = handler->get_ipaddr(); - return mrb_str_new(mrb, ipaddr.c_str(), ipaddr.size()); + return mrb_str_new(mrb, ipaddr.data(), ipaddr.size()); } } // namespace @@ -114,7 +114,7 @@ mrb_value env_get_server_addr(mrb_state *mrb, mrb_value self) { auto handler = upstream->get_client_handler(); auto faddr = handler->get_upstream_addr(); - return mrb_str_new(mrb, faddr->host.c_str(), faddr->host.size()); + return mrb_str_new(mrb, faddr->host.data(), faddr->host.size()); } } // namespace @@ -137,7 +137,7 @@ mrb_value env_get_tls_sni(mrb_state *mrb, mrb_value self) { auto handler = upstream->get_client_handler(); auto sni = handler->get_tls_sni(); - return mrb_str_new(mrb, sni.c_str(), sni.size()); + return mrb_str_new(mrb, sni.data(), sni.size()); } } // namespace @@ -172,11 +172,10 @@ mrb_value env_get_tls_client_fingerprint_md(mrb_state *mrb, const EVP_MD *md) { mrb_raise(mrb, E_RUNTIME_ERROR, "could not compute client fingerprint"); } - // TODO Use template version of format_hex auto &balloc = downstream->get_block_allocator(); - auto f = util::format_hex(balloc, - StringRef{std::begin(buf), std::begin(buf) + slen}); - return mrb_str_new(mrb, f.c_str(), f.size()); + auto f = + util::format_hex(balloc, std::span{buf.data(), static_cast(slen)}); + return mrb_str_new(mrb, f.data(), f.size()); } } // namespace @@ -219,7 +218,7 @@ mrb_value env_get_tls_client_subject_name(mrb_state *mrb, mrb_value self) { #if !OPENSSL_3_0_0_API X509_free(x); #endif // !OPENSSL_3_0_0_API - return mrb_str_new(mrb, name.c_str(), name.size()); + return mrb_str_new(mrb, name.data(), name.size()); } } // namespace @@ -249,7 +248,7 @@ mrb_value env_get_tls_client_issuer_name(mrb_state *mrb, mrb_value self) { #if !OPENSSL_3_0_0_API X509_free(x); #endif // !OPENSSL_3_0_0_API - return mrb_str_new(mrb, name.c_str(), name.size()); + return mrb_str_new(mrb, name.data(), name.size()); } } // namespace @@ -279,7 +278,7 @@ mrb_value env_get_tls_client_serial(mrb_state *mrb, mrb_value self) { #if !OPENSSL_3_0_0_API X509_free(x); #endif // !OPENSSL_3_0_0_API - return mrb_str_new(mrb, sn.c_str(), sn.size()); + return mrb_str_new(mrb, sn.data(), sn.size()); } } // namespace @@ -403,10 +402,9 @@ mrb_value env_get_tls_session_id(mrb_state *mrb, mrb_value self) { unsigned int session_id_length = 0; auto session_id = SSL_SESSION_get_id(session, &session_id_length); - // TODO Use template version of util::format_hex. auto &balloc = downstream->get_block_allocator(); - auto id = util::format_hex(balloc, StringRef{session_id, session_id_length}); - return mrb_str_new(mrb, id.c_str(), id.size()); + auto id = util::format_hex(balloc, std::span{session_id, session_id_length}); + return mrb_str_new(mrb, id.data(), id.size()); } } // namespace @@ -433,7 +431,7 @@ mrb_value env_get_alpn(mrb_state *mrb, mrb_value self) { auto upstream = downstream->get_upstream(); auto handler = upstream->get_client_handler(); auto alpn = handler->get_alpn(); - return mrb_str_new(mrb, alpn.c_str(), alpn.size()); + return mrb_str_new(mrb, alpn.data(), alpn.size()); } } // namespace @@ -451,7 +449,7 @@ mrb_value env_get_tls_handshake_finished(mrb_state *mrb, mrb_value self) { void init_env_class(mrb_state *mrb, RClass *module) { auto env_class = - mrb_define_class_under(mrb, module, "Env", mrb->object_class); + mrb_define_class_under(mrb, module, "Env", mrb->object_class); mrb_define_method(mrb, env_class, "initialize", env_init, MRB_ARGS_NONE()); mrb_define_method(mrb, env_class, "req", env_get_req, MRB_ARGS_NONE()); diff --git a/lib/nghttp2/src/shrpx_mruby_module_env.h b/lib/nghttp2-1.65.0/src/shrpx_mruby_module_env.h similarity index 100% rename from lib/nghttp2/src/shrpx_mruby_module_env.h rename to lib/nghttp2-1.65.0/src/shrpx_mruby_module_env.h diff --git a/lib/nghttp2/src/shrpx_mruby_module_request.cc b/lib/nghttp2-1.65.0/src/shrpx_mruby_module_request.cc similarity index 89% rename from lib/nghttp2/src/shrpx_mruby_module_request.cc rename to lib/nghttp2-1.65.0/src/shrpx_mruby_module_request.cc index 1ed3aa90fa0..7f8fb02ea3a 100644 --- a/lib/nghttp2/src/shrpx_mruby_module_request.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_mruby_module_request.cc @@ -71,7 +71,7 @@ mrb_value request_get_method(mrb_state *mrb, mrb_value self) { const auto &req = downstream->request(); auto method = http2::to_method_string(req.method); - return mrb_str_new(mrb, method.c_str(), method.size()); + return mrb_str_new(mrb, method.data(), method.size()); } } // namespace @@ -90,7 +90,7 @@ mrb_value request_set_method(mrb_state *mrb, mrb_value self) { mrb_raise(mrb, E_RUNTIME_ERROR, "method must not be empty string"); } auto token = - http2::lookup_method_token(reinterpret_cast(method), n); + http2::lookup_method_token(StringRef{method, static_cast(n)}); if (token == -1) { mrb_raise(mrb, E_RUNTIME_ERROR, "method not supported"); } @@ -107,7 +107,7 @@ mrb_value request_get_authority(mrb_state *mrb, mrb_value self) { auto downstream = data->downstream; const auto &req = downstream->request(); - return mrb_str_new(mrb, req.authority.c_str(), req.authority.size()); + return mrb_str_new(mrb, req.authority.data(), req.authority.size()); } } // namespace @@ -129,7 +129,7 @@ mrb_value request_set_authority(mrb_state *mrb, mrb_value self) { } req.authority = - make_string_ref(balloc, StringRef{authority, static_cast(n)}); + make_string_ref(balloc, StringRef{authority, static_cast(n)}); return self; } @@ -141,7 +141,7 @@ mrb_value request_get_scheme(mrb_state *mrb, mrb_value self) { auto downstream = data->downstream; const auto &req = downstream->request(); - return mrb_str_new(mrb, req.scheme.c_str(), req.scheme.size()); + return mrb_str_new(mrb, req.scheme.data(), req.scheme.size()); } } // namespace @@ -163,7 +163,7 @@ mrb_value request_set_scheme(mrb_state *mrb, mrb_value self) { } req.scheme = - make_string_ref(balloc, StringRef{scheme, static_cast(n)}); + make_string_ref(balloc, StringRef{scheme, static_cast(n)}); return self; } @@ -175,7 +175,7 @@ mrb_value request_get_path(mrb_state *mrb, mrb_value self) { auto downstream = data->downstream; const auto &req = downstream->request(); - return mrb_str_new(mrb, req.path.c_str(), req.path.size()); + return mrb_str_new(mrb, req.path.data(), req.path.size()); } } // namespace @@ -194,7 +194,7 @@ mrb_value request_set_path(mrb_state *mrb, mrb_value self) { mrb_get_args(mrb, "s", &path, &pathlen); req.path = - make_string_ref(balloc, StringRef{path, static_cast(pathlen)}); + make_string_ref(balloc, StringRef{path, static_cast(pathlen)}); return self; } @@ -229,13 +229,12 @@ mrb_value request_mod_header(mrb_state *mrb, mrb_value self, bool repl) { key = mrb_funcall(mrb, key, "downcase", 0); - auto keyref = - make_string_ref(balloc, StringRef{RSTRING_PTR(key), - static_cast(RSTRING_LEN(key))}); + auto keyref = make_string_ref( + balloc, StringRef{RSTRING_PTR(key), static_cast(RSTRING_LEN(key))}); mrb_gc_arena_restore(mrb, ai); - auto token = http2::lookup_token(keyref.byte(), keyref.size()); + auto token = http2::lookup_token(keyref); if (repl) { size_t p = 0; @@ -262,19 +261,19 @@ mrb_value request_mod_header(mrb_state *mrb, mrb_value self, bool repl) { } req.fs.add_header_token( - keyref, - make_string_ref(balloc, - StringRef{RSTRING_PTR(value), - static_cast(RSTRING_LEN(value))}), - false, token); - } - } else if (mrb_string_p(values)) { - req.fs.add_header_token( keyref, make_string_ref(balloc, - StringRef{RSTRING_PTR(values), - static_cast(RSTRING_LEN(values))}), + StringRef{RSTRING_PTR(value), + static_cast(RSTRING_LEN(value))}), false, token); + } + } else if (mrb_string_p(values)) { + req.fs.add_header_token( + keyref, + make_string_ref(balloc, + StringRef{RSTRING_PTR(values), + static_cast(RSTRING_LEN(values))}), + false, token); } else { mrb_raise(mrb, E_RUNTIME_ERROR, "value must be string"); } @@ -327,7 +326,7 @@ mrb_value request_push(mrb_state *mrb, mrb_value self) { void init_request_class(mrb_state *mrb, RClass *module) { auto request_class = - mrb_define_class_under(mrb, module, "Request", mrb->object_class); + mrb_define_class_under(mrb, module, "Request", mrb->object_class); mrb_define_method(mrb, request_class, "initialize", request_init, MRB_ARGS_NONE()); diff --git a/lib/nghttp2/src/shrpx_mruby_module_request.h b/lib/nghttp2-1.65.0/src/shrpx_mruby_module_request.h similarity index 100% rename from lib/nghttp2/src/shrpx_mruby_module_request.h rename to lib/nghttp2-1.65.0/src/shrpx_mruby_module_request.h diff --git a/lib/nghttp2/src/shrpx_mruby_module_response.cc b/lib/nghttp2-1.65.0/src/shrpx_mruby_module_response.cc similarity index 91% rename from lib/nghttp2/src/shrpx_mruby_module_response.cc rename to lib/nghttp2-1.65.0/src/shrpx_mruby_module_response.cc index 1de1d5f07fd..bd010c82a15 100644 --- a/lib/nghttp2/src/shrpx_mruby_module_response.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_mruby_module_response.cc @@ -121,13 +121,12 @@ mrb_value response_mod_header(mrb_state *mrb, mrb_value self, bool repl) { key = mrb_funcall(mrb, key, "downcase", 0); - auto keyref = - make_string_ref(balloc, StringRef{RSTRING_PTR(key), - static_cast(RSTRING_LEN(key))}); + auto keyref = make_string_ref( + balloc, StringRef{RSTRING_PTR(key), static_cast(RSTRING_LEN(key))}); mrb_gc_arena_restore(mrb, ai); - auto token = http2::lookup_token(keyref.byte(), keyref.size()); + auto token = http2::lookup_token(keyref); if (repl) { size_t p = 0; @@ -154,19 +153,19 @@ mrb_value response_mod_header(mrb_state *mrb, mrb_value self, bool repl) { } resp.fs.add_header_token( - keyref, - make_string_ref(balloc, - StringRef{RSTRING_PTR(value), - static_cast(RSTRING_LEN(value))}), - false, token); - } - } else if (mrb_string_p(values)) { - resp.fs.add_header_token( keyref, make_string_ref(balloc, - StringRef{RSTRING_PTR(values), - static_cast(RSTRING_LEN(values))}), + StringRef{RSTRING_PTR(value), + static_cast(RSTRING_LEN(value))}), false, token); + } + } else if (mrb_string_p(values)) { + resp.fs.add_header_token( + keyref, + make_string_ref(balloc, + StringRef{RSTRING_PTR(values), + static_cast(RSTRING_LEN(values))}), + false, token); } else { mrb_raise(mrb, E_RUNTIME_ERROR, "value must be string"); } @@ -245,8 +244,8 @@ mrb_value response_return(mrb_state *mrb, mrb_value self) { if (cl) { cl->value = content_length; } else { - resp.fs.add_header_token(StringRef::from_lit("content-length"), - content_length, false, http2::HD_CONTENT_LENGTH); + resp.fs.add_header_token("content-length"_sr, content_length, false, + http2::HD_CONTENT_LENGTH); } resp.fs.content_length = vallen; @@ -256,7 +255,7 @@ mrb_value response_return(mrb_state *mrb, mrb_value self) { if (!date) { auto lgconf = log_config(); lgconf->update_tstamp(std::chrono::system_clock::now()); - resp.fs.add_header_token(StringRef::from_lit("date"), + resp.fs.add_header_token("date"_sr, make_string_ref(balloc, lgconf->tstamp->time_http), false, http2::HD_DATE); } @@ -313,13 +312,13 @@ mrb_value response_send_info(mrb_state *mrb, mrb_value self) { key = mrb_funcall(mrb, key, "downcase", 0); - auto keyref = make_string_ref( - balloc, - StringRef{RSTRING_PTR(key), static_cast(RSTRING_LEN(key))}); + auto keyref = + make_string_ref(balloc, StringRef{RSTRING_PTR(key), + static_cast(RSTRING_LEN(key))}); mrb_gc_arena_restore(mrb, ai); - auto token = http2::lookup_token(keyref.byte(), keyref.size()); + auto token = http2::lookup_token(keyref); if (mrb_array_p(values)) { auto n = RARRAY_LEN(values); @@ -330,19 +329,19 @@ mrb_value response_send_info(mrb_state *mrb, mrb_value self) { } resp.fs.add_header_token( - keyref, - make_string_ref(balloc, - StringRef{RSTRING_PTR(value), - static_cast(RSTRING_LEN(value))}), - false, token); - } - } else if (mrb_string_p(values)) { - resp.fs.add_header_token( keyref, make_string_ref(balloc, - StringRef{RSTRING_PTR(values), - static_cast(RSTRING_LEN(values))}), + StringRef{RSTRING_PTR(value), + static_cast(RSTRING_LEN(value))}), false, token); + } + } else if (mrb_string_p(values)) { + resp.fs.add_header_token( + keyref, + make_string_ref(balloc, + StringRef{RSTRING_PTR(values), + static_cast(RSTRING_LEN(values))}), + false, token); } else { mrb_raise(mrb, E_RUNTIME_ERROR, "value must be string"); } @@ -367,7 +366,7 @@ mrb_value response_send_info(mrb_state *mrb, mrb_value self) { void init_response_class(mrb_state *mrb, RClass *module) { auto response_class = - mrb_define_class_under(mrb, module, "Response", mrb->object_class); + mrb_define_class_under(mrb, module, "Response", mrb->object_class); mrb_define_method(mrb, response_class, "initialize", response_init, MRB_ARGS_NONE()); diff --git a/lib/nghttp2/src/shrpx_mruby_module_response.h b/lib/nghttp2-1.65.0/src/shrpx_mruby_module_response.h similarity index 100% rename from lib/nghttp2/src/shrpx_mruby_module_response.h rename to lib/nghttp2-1.65.0/src/shrpx_mruby_module_response.h diff --git a/lib/nghttp2/src/shrpx_null_downstream_connection.cc b/lib/nghttp2-1.65.0/src/shrpx_null_downstream_connection.cc similarity index 97% rename from lib/nghttp2/src/shrpx_null_downstream_connection.cc rename to lib/nghttp2-1.65.0/src/shrpx_null_downstream_connection.cc index cd81c8aa0e6..bf8d470801c 100644 --- a/lib/nghttp2/src/shrpx_null_downstream_connection.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_null_downstream_connection.cc @@ -30,8 +30,8 @@ namespace shrpx { NullDownstreamConnection::NullDownstreamConnection( - const std::shared_ptr &group) - : group_(group) {} + const std::shared_ptr &group) + : group_(group) {} NullDownstreamConnection::~NullDownstreamConnection() {} diff --git a/lib/nghttp2/src/shrpx_null_downstream_connection.h b/lib/nghttp2-1.65.0/src/shrpx_null_downstream_connection.h similarity index 100% rename from lib/nghttp2/src/shrpx_null_downstream_connection.h rename to lib/nghttp2-1.65.0/src/shrpx_null_downstream_connection.h diff --git a/lib/nghttp2/src/shrpx_process.h b/lib/nghttp2-1.65.0/src/shrpx_process.h similarity index 100% rename from lib/nghttp2/src/shrpx_process.h rename to lib/nghttp2-1.65.0/src/shrpx_process.h diff --git a/lib/nghttp2/src/shrpx_quic.cc b/lib/nghttp2-1.65.0/src/shrpx_quic.cc similarity index 60% rename from lib/nghttp2/src/shrpx_quic.cc rename to lib/nghttp2-1.65.0/src/shrpx_quic.cc index 2d4de593369..d08b0aaebf5 100644 --- a/lib/nghttp2/src/shrpx_quic.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_quic.cc @@ -36,7 +36,14 @@ #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include "shrpx_config.h" #include "shrpx_log.h" @@ -51,15 +58,17 @@ namespace shrpx { ngtcp2_tstamp quic_timestamp() { return std::chrono::duration_cast( - std::chrono::steady_clock::now().time_since_epoch()) - .count(); + std::chrono::steady_clock::now().time_since_epoch()) + .count(); } int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, size_t remote_salen, const sockaddr *local_sa, size_t local_salen, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen, size_t gso_size) { - iovec msg_iov = {const_cast(data), datalen}; + std::span data, size_t gso_size) { + assert(gso_size); + + iovec msg_iov = {const_cast(data.data()), data.size()}; msghdr msg{}; msg.msg_name = const_cast(remote_sa); msg.msg_namelen = remote_salen; @@ -89,7 +98,7 @@ int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, cm->cmsg_len = CMSG_LEN(sizeof(in_pktinfo)); in_pktinfo pktinfo{}; auto addrin = - reinterpret_cast(const_cast(local_sa)); + reinterpret_cast(const_cast(local_sa)); pktinfo.ipi_spec_dst = addrin->sin_addr; memcpy(CMSG_DATA(cm), &pktinfo, sizeof(pktinfo)); @@ -102,7 +111,7 @@ int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, cm->cmsg_len = CMSG_LEN(sizeof(in6_pktinfo)); in6_pktinfo pktinfo{}; auto addrin = - reinterpret_cast(const_cast(local_sa)); + reinterpret_cast(const_cast(local_sa)); pktinfo.ipi6_addr = addrin->sin6_addr; memcpy(CMSG_DATA(cm), &pktinfo, sizeof(pktinfo)); @@ -113,7 +122,7 @@ int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, } #ifdef UDP_SEGMENT - if (gso_size && datalen > gso_size) { + if (data.size() > gso_size) { controllen += CMSG_SPACE(sizeof(uint16_t)); cm = CMSG_NXTHDR(&msg, cm); cm->cmsg_level = SOL_UDP; @@ -170,60 +179,45 @@ int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, << " bytes"; } + assert(static_cast(nwrite) == data.size()); + return 0; } -int generate_quic_retry_connection_id(ngtcp2_cid &cid, size_t cidlen, - const uint8_t *server_id, uint8_t km_id, - const uint8_t *key) { - assert(cidlen == SHRPX_QUIC_SCIDLEN); - - if (RAND_bytes(cid.data, cidlen) != 1) { +int generate_quic_retry_connection_id(ngtcp2_cid &cid, uint32_t server_id, + uint8_t km_id, EVP_CIPHER_CTX *ctx) { + if (RAND_bytes(cid.data, SHRPX_QUIC_SCIDLEN) != 1) { return -1; } - cid.datalen = cidlen; + cid.datalen = SHRPX_QUIC_SCIDLEN; + cid.data[0] = (cid.data[0] & (~SHRPX_QUIC_DCID_KM_ID_MASK)) | km_id; - cid.data[0] = (cid.data[0] & 0x3f) | km_id; + auto p = cid.data + SHRPX_QUIC_CID_WORKER_ID_OFFSET; - auto p = cid.data + SHRPX_QUIC_CID_PREFIX_OFFSET; + std::copy_n(reinterpret_cast(&server_id), sizeof(server_id), p); - std::copy_n(server_id, SHRPX_QUIC_SERVER_IDLEN, p); - - return encrypt_quic_connection_id(p, p, key); + return encrypt_quic_connection_id(p, p, ctx); } -int generate_quic_connection_id(ngtcp2_cid &cid, size_t cidlen, - const uint8_t *cid_prefix, uint8_t km_id, - const uint8_t *key) { - assert(cidlen == SHRPX_QUIC_SCIDLEN); - - if (RAND_bytes(cid.data, cidlen) != 1) { +int generate_quic_connection_id(ngtcp2_cid &cid, const WorkerID &wid, + uint8_t km_id, EVP_CIPHER_CTX *ctx) { + if (RAND_bytes(cid.data, SHRPX_QUIC_SCIDLEN) != 1) { return -1; } - cid.datalen = cidlen; - - cid.data[0] = (cid.data[0] & 0x3f) | km_id; + cid.datalen = SHRPX_QUIC_SCIDLEN; + cid.data[0] = (cid.data[0] & (~SHRPX_QUIC_DCID_KM_ID_MASK)) | km_id; - auto p = cid.data + SHRPX_QUIC_CID_PREFIX_OFFSET; + auto p = cid.data + SHRPX_QUIC_CID_WORKER_ID_OFFSET; - std::copy_n(cid_prefix, SHRPX_QUIC_CID_PREFIXLEN, p); + std::copy_n(reinterpret_cast(&wid), sizeof(wid), p); - return encrypt_quic_connection_id(p, p, key); + return encrypt_quic_connection_id(p, p, ctx); } int encrypt_quic_connection_id(uint8_t *dest, const uint8_t *src, - const uint8_t *key) { - auto ctx = EVP_CIPHER_CTX_new(); - auto d = defer(EVP_CIPHER_CTX_free, ctx); - - if (!EVP_EncryptInit_ex(ctx, EVP_aes_128_ecb(), nullptr, key, nullptr)) { - return -1; - } - - EVP_CIPHER_CTX_set_padding(ctx, 0); - + EVP_CIPHER_CTX *ctx) { int len; if (!EVP_EncryptUpdate(ctx, dest, &len, src, SHRPX_QUIC_DECRYPTED_DCIDLEN) || @@ -234,21 +228,13 @@ int encrypt_quic_connection_id(uint8_t *dest, const uint8_t *src, return 0; } -int decrypt_quic_connection_id(uint8_t *dest, const uint8_t *src, - const uint8_t *key) { - auto ctx = EVP_CIPHER_CTX_new(); - auto d = defer(EVP_CIPHER_CTX_free, ctx); - - if (!EVP_DecryptInit_ex(ctx, EVP_aes_128_ecb(), nullptr, key, nullptr)) { - return -1; - } - - EVP_CIPHER_CTX_set_padding(ctx, 0); - +int decrypt_quic_connection_id(ConnectionID &dest, const uint8_t *src, + EVP_CIPHER_CTX *ctx) { int len; + auto p = reinterpret_cast(&dest); - if (!EVP_DecryptUpdate(ctx, dest, &len, src, SHRPX_QUIC_DECRYPTED_DCIDLEN) || - !EVP_DecryptFinal_ex(ctx, dest + len, &len)) { + if (!EVP_DecryptUpdate(ctx, p, &len, src, SHRPX_QUIC_DECRYPTED_DCIDLEN) || + !EVP_DecryptFinal_ex(ctx, p + len, &len)) { return -1; } @@ -292,87 +278,90 @@ int generate_quic_stateless_reset_token(uint8_t *token, const ngtcp2_cid &cid, return 0; } -int generate_retry_token(uint8_t *token, size_t &tokenlen, uint32_t version, - const sockaddr *sa, socklen_t salen, - const ngtcp2_cid &retry_scid, const ngtcp2_cid &odcid, - const uint8_t *secret, size_t secretlen) { +std::optional> +generate_retry_token(std::span token, uint32_t version, + const sockaddr *sa, socklen_t salen, + const ngtcp2_cid &retry_scid, const ngtcp2_cid &odcid, + std::span secret) { auto t = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count(); - - auto stokenlen = ngtcp2_crypto_generate_retry_token( - token, secret, secretlen, version, sa, salen, &retry_scid, &odcid, t); - if (stokenlen < 0) { - return -1; + std::chrono::system_clock::now().time_since_epoch()) + .count(); + + auto tokenlen = ngtcp2_crypto_generate_retry_token( + token.data(), secret.data(), secret.size(), version, sa, salen, &retry_scid, + &odcid, t); + if (tokenlen < 0) { + return {}; } - tokenlen = stokenlen; - - return 0; + return {{std::begin(token), static_cast(tokenlen)}}; } -int verify_retry_token(ngtcp2_cid &odcid, const uint8_t *token, size_t tokenlen, +int verify_retry_token(ngtcp2_cid &odcid, std::span token, uint32_t version, const ngtcp2_cid &dcid, const sockaddr *sa, socklen_t salen, - const uint8_t *secret, size_t secretlen) { - + std::span secret) { auto t = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count(); + std::chrono::system_clock::now().time_since_epoch()) + .count(); - if (ngtcp2_crypto_verify_retry_token(&odcid, token, tokenlen, secret, - secretlen, version, sa, salen, &dcid, - 10 * NGTCP2_SECONDS, t) != 0) { + if (ngtcp2_crypto_verify_retry_token( + &odcid, token.data(), token.size(), secret.data(), secret.size(), + version, sa, salen, &dcid, 10 * NGTCP2_SECONDS, t) != 0) { return -1; } return 0; } -int generate_token(uint8_t *token, size_t &tokenlen, const sockaddr *sa, - size_t salen, const uint8_t *secret, size_t secretlen) { +std::optional> +generate_token(std::span token, const sockaddr *sa, size_t salen, + std::span secret, uint8_t km_id) { auto t = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count(); + std::chrono::system_clock::now().time_since_epoch()) + .count(); - auto stokenlen = ngtcp2_crypto_generate_regular_token( - token, secret, secretlen, sa, salen, t); - if (stokenlen < 0) { - return -1; + auto tokenlen = ngtcp2_crypto_generate_regular_token( + token.data(), secret.data(), secret.size(), sa, salen, t); + if (tokenlen < 0) { + return {}; } - tokenlen = stokenlen; + token[tokenlen++] = km_id; - return 0; + return {{std::begin(token), static_cast(tokenlen)}}; } -int verify_token(const uint8_t *token, size_t tokenlen, const sockaddr *sa, - socklen_t salen, const uint8_t *secret, size_t secretlen) { +int verify_token(std::span token, const sockaddr *sa, + socklen_t salen, std::span secret) { + if (token.empty()) { + return -1; + } + auto t = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count(); + std::chrono::system_clock::now().time_since_epoch()) + .count(); - if (ngtcp2_crypto_verify_regular_token(token, tokenlen, secret, secretlen, sa, - salen, 3600 * NGTCP2_SECONDS, - t) != 0) { + if (ngtcp2_crypto_verify_regular_token( + token.data(), token.size() - 1, secret.data(), secret.size(), sa, salen, + 3600 * NGTCP2_SECONDS, t) != 0) { return -1; } return 0; } -int generate_quic_connection_id_encryption_key(uint8_t *key, size_t keylen, - const uint8_t *secret, - size_t secretlen, - const uint8_t *salt, - size_t saltlen) { +int generate_quic_connection_id_encryption_key(std::span key, + std::span secret, + std::span salt) { constexpr uint8_t info[] = "connection id encryption key"; ngtcp2_crypto_md sha256; ngtcp2_crypto_md_init( - &sha256, reinterpret_cast(const_cast(EVP_sha256()))); + &sha256, reinterpret_cast(const_cast(EVP_sha256()))); - if (ngtcp2_crypto_hkdf(key, keylen, &sha256, secret, secretlen, salt, saltlen, - info, str_size(info)) != 0) { + if (ngtcp2_crypto_hkdf(key.data(), key.size(), &sha256, secret.data(), + secret.size(), salt.data(), salt.size(), info, + str_size(info)) != 0) { return -1; } diff --git a/lib/nghttp2-1.65.0/src/shrpx_quic.h b/lib/nghttp2-1.65.0/src/shrpx_quic.h new file mode 100644 index 00000000000..aa3c80a0f76 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/shrpx_quic.h @@ -0,0 +1,178 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2021 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef SHRPX_QUIC_H +#define SHRPX_QUIC_H + +#include "shrpx.h" + +#include + +#include +#include +#include + +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL + +#include + +#include "siphash.h" +#include "template.h" +#include "network.h" + +using namespace nghttp2; + +namespace std { +template <> struct hash { + hash() { + auto s = as_writable_uint8_span(std::span{key}); + assert(RAND_bytes(s.data(), s.size()) == 1); + } + + std::size_t operator()(const ngtcp2_cid &cid) const noexcept { + return static_cast(siphash24(key, {cid.data, cid.datalen})); + } + + std::array key; +}; +} // namespace std + +bool operator==(const ngtcp2_cid &lhs, const ngtcp2_cid &rhs); + +namespace shrpx { + +struct UpstreamAddr; +struct QUICKeyingMaterials; +struct QUICKeyingMaterial; + +constexpr size_t SHRPX_QUIC_CID_WORKER_ID_OFFSET = 1; +constexpr size_t SHRPX_QUIC_SERVER_IDLEN = 4; +constexpr size_t SHRPX_QUIC_SOCK_IDLEN = 4; +constexpr size_t SHRPX_QUIC_WORKER_IDLEN = + SHRPX_QUIC_SERVER_IDLEN + SHRPX_QUIC_SOCK_IDLEN; +constexpr size_t SHRPX_QUIC_CLIENT_IDLEN = 8; +constexpr size_t SHRPX_QUIC_DECRYPTED_DCIDLEN = + SHRPX_QUIC_WORKER_IDLEN + SHRPX_QUIC_CLIENT_IDLEN; +constexpr size_t SHRPX_QUIC_SCIDLEN = + SHRPX_QUIC_CID_WORKER_ID_OFFSET + SHRPX_QUIC_DECRYPTED_DCIDLEN; +constexpr size_t SHRPX_QUIC_CID_ENCRYPTION_KEYLEN = 16; +constexpr size_t SHRPX_QUIC_CONN_CLOSE_PKTLEN = 256; +constexpr size_t SHRPX_QUIC_STATELESS_RESET_BURST = 100; +constexpr size_t SHRPX_QUIC_SECRET_RESERVEDLEN = 4; +constexpr size_t SHRPX_QUIC_SECRETLEN = 32; +constexpr size_t SHRPX_QUIC_SALTLEN = 32; +constexpr uint8_t SHRPX_QUIC_DCID_KM_ID_MASK = 0xe0; + +struct WorkerID { + union { + struct { + uint32_t server; + uint16_t worker_process; + uint16_t thread; + }; + uint64_t worker; + }; +}; + +static_assert(sizeof(WorkerID) == SHRPX_QUIC_WORKER_IDLEN, + "WorkerID length assertion failure"); + +inline bool operator==(const WorkerID &lhd, const WorkerID &rhd) { + return lhd.worker == rhd.worker; +} + +inline bool operator!=(const WorkerID &lhd, const WorkerID &rhd) { + return lhd.worker != rhd.worker; +} + +struct ConnectionID { + WorkerID worker; + uint64_t client; +}; + +ngtcp2_tstamp quic_timestamp(); + +int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa, + size_t remote_salen, const sockaddr *local_sa, + size_t local_salen, const ngtcp2_pkt_info &pi, + std::span data, size_t gso_size); + +int generate_quic_retry_connection_id(ngtcp2_cid &cid, uint32_t server_id, + uint8_t km_id, EVP_CIPHER_CTX *ctx); + +int generate_quic_connection_id(ngtcp2_cid &cid, const WorkerID &wid, + uint8_t km_id, EVP_CIPHER_CTX *ctx); + +int encrypt_quic_connection_id(uint8_t *dest, const uint8_t *src, + EVP_CIPHER_CTX *ctx); + +int decrypt_quic_connection_id(ConnectionID &dest, const uint8_t *src, + EVP_CIPHER_CTX *ctx); + +int generate_quic_hashed_connection_id(ngtcp2_cid &dest, + const Address &remote_addr, + const Address &local_addr, + const ngtcp2_cid &cid); + +int generate_quic_stateless_reset_token(uint8_t *token, const ngtcp2_cid &cid, + const uint8_t *secret, + size_t secretlen); + +std::optional> +generate_retry_token(std::span token, uint32_t version, + const sockaddr *sa, socklen_t salen, + const ngtcp2_cid &retry_scid, const ngtcp2_cid &odcid, + std::span secret); + +int verify_retry_token(ngtcp2_cid &odcid, std::span token, + uint32_t version, const ngtcp2_cid &dcid, + const sockaddr *sa, socklen_t salen, + std::span secret); + +std::optional> +generate_token(std::span token, const sockaddr *sa, size_t salen, + std::span secret, uint8_t km_id); + +int verify_token(std::span token, const sockaddr *sa, + socklen_t salen, std::span secret); + +int generate_quic_connection_id_encryption_key(std::span key, + std::span secret, + std::span salt); + +const QUICKeyingMaterial * +select_quic_keying_material(const QUICKeyingMaterials &qkms, uint8_t km_id); + +} // namespace shrpx + +#endif // SHRPX_QUIC_H diff --git a/lib/nghttp2/src/shrpx_quic_connection_handler.cc b/lib/nghttp2-1.65.0/src/shrpx_quic_connection_handler.cc similarity index 66% rename from lib/nghttp2/src/shrpx_quic_connection_handler.cc rename to lib/nghttp2-1.65.0/src/shrpx_quic_connection_handler.cc index 1a4e6a8bb32..8de8b2579d0 100644 --- a/lib/nghttp2/src/shrpx_quic_connection_handler.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_quic_connection_handler.cc @@ -24,7 +24,14 @@ */ #include "shrpx_quic_connection_handler.h" -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include #include @@ -34,7 +41,6 @@ #include "shrpx_log.h" #include "shrpx_http3_upstream.h" #include "shrpx_connection_handler.h" -#include "ssl_compat.h" namespace shrpx { @@ -48,8 +54,7 @@ void stateless_reset_bucket_regen_timercb(struct ev_loop *loop, ev_timer *w, } // namespace QUICConnectionHandler::QUICConnectionHandler(Worker *worker) - : worker_{worker}, - stateless_reset_bucket_{SHRPX_QUIC_STATELESS_RESET_BURST} { + : worker_{worker}, stateless_reset_bucket_{SHRPX_QUIC_STATELESS_RESET_BURST} { ev_timer_init(&stateless_reset_bucket_regen_timer_, stateless_reset_bucket_regen_timercb, 0., 1.); stateless_reset_bucket_regen_timer_.data = this; @@ -63,17 +68,18 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen) { + std::span data) { int rv; ngtcp2_version_cid vc; - rv = ngtcp2_pkt_decode_version_cid(&vc, data, datalen, SHRPX_QUIC_SCIDLEN); + rv = ngtcp2_pkt_decode_version_cid(&vc, data.data(), data.size(), + SHRPX_QUIC_SCIDLEN); switch (rv) { case 0: break; case NGTCP2_ERR_VERSION_NEGOTIATION: - send_version_negotiation(faddr, vc.version, vc.dcid, vc.dcidlen, vc.scid, - vc.scidlen, remote_addr, local_addr); + send_version_negotiation(faddr, vc.version, {vc.dcid, vc.dcidlen}, + {vc.scid, vc.scidlen}, remote_addr, local_addr); return 0; default: @@ -97,7 +103,7 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, if (cwit != std::end(close_waits_)) { auto cw = (*cwit).second; - cw->handle_packet(faddr, remote_addr, local_addr, pi, data, datalen); + cw->handle_packet(faddr, remote_addr, local_addr, pi, data); return 0; } @@ -114,7 +120,7 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, if (cwit != std::end(close_waits_)) { auto cw = (*cwit).second; - cw->handle_packet(faddr, remote_addr, local_addr, pi, data, datalen); + cw->handle_packet(faddr, remote_addr, local_addr, pi, data); return 0; } @@ -123,31 +129,29 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, } if (it == std::end(connections_)) { - std::array decrypted_dcid; + ConnectionID decrypted_dcid; auto &qkms = conn_handler->get_quic_keying_materials(); const QUICKeyingMaterial *qkm = nullptr; if (vc.dcidlen == SHRPX_QUIC_SCIDLEN) { qkm = select_quic_keying_material( - *qkms.get(), vc.dcid[0] & SHRPX_QUIC_DCID_KM_ID_MASK); + *qkms.get(), vc.dcid[0] & SHRPX_QUIC_DCID_KM_ID_MASK); - if (decrypt_quic_connection_id(decrypted_dcid.data(), - vc.dcid + SHRPX_QUIC_CID_PREFIX_OFFSET, - qkm->cid_encryption_key.data()) != 0) { + if (decrypt_quic_connection_id(decrypted_dcid, + vc.dcid + SHRPX_QUIC_CID_WORKER_ID_OFFSET, + qkm->cid_decryption_ctx) != 0) { return 0; } if (qkm != &qkms->keying_materials.front() || - !std::equal(std::begin(decrypted_dcid), - std::begin(decrypted_dcid) + SHRPX_QUIC_CID_PREFIXLEN, - worker_->get_cid_prefix())) { + decrypted_dcid.worker != worker_->get_worker_id()) { auto quic_lwp = - conn_handler->match_quic_lingering_worker_process_cid_prefix( - decrypted_dcid.data(), decrypted_dcid.size()); + conn_handler->match_quic_lingering_worker_process_worker_id( + decrypted_dcid.worker); if (quic_lwp) { if (conn_handler->forward_quic_packet_to_lingering_worker_process( - quic_lwp, remote_addr, local_addr, pi, data, datalen) == 0) { + quic_lwp, remote_addr, local_addr, pi, data) == 0) { return 0; } @@ -171,29 +175,26 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, ngtcp2_pkt_hd hd; ngtcp2_cid odcid, *podcid = nullptr; - const uint8_t *token = nullptr; - size_t tokenlen = 0; + std::span token; ngtcp2_token_type token_type = NGTCP2_TOKEN_TYPE_UNKNOWN; - switch (ngtcp2_accept(&hd, data, datalen)) { + switch (ngtcp2_accept(&hd, data.data(), data.size())) { case 0: { - // If we get Initial and it has the CID prefix of this worker, - // it is likely that client is intentionally use the prefix. - // Just drop it. + // If we get Initial and it has the Worker ID of this worker, it + // is likely that client is intentionally use the prefix. Just + // drop it. if (vc.dcidlen == SHRPX_QUIC_SCIDLEN) { if (qkm != &qkms->keying_materials.front()) { qkm = &qkms->keying_materials.front(); - if (decrypt_quic_connection_id(decrypted_dcid.data(), - vc.dcid + SHRPX_QUIC_CID_PREFIX_OFFSET, - qkm->cid_encryption_key.data()) != 0) { + if (decrypt_quic_connection_id( + decrypted_dcid, vc.dcid + SHRPX_QUIC_CID_WORKER_ID_OFFSET, + qkm->cid_decryption_ctx) != 0) { return 0; } } - if (std::equal(std::begin(decrypted_dcid), - std::begin(decrypted_dcid) + SHRPX_QUIC_CID_PREFIXLEN, - worker_->get_cid_prefix())) { + if (decrypted_dcid.worker == worker_->get_worker_id()) { return 0; } } @@ -201,14 +202,15 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, if (worker_->get_graceful_shutdown()) { send_connection_close(faddr, hd.version, hd.dcid, hd.scid, remote_addr, local_addr, NGTCP2_CONNECTION_REFUSED, - datalen * 3); + data.size() * 3); return 0; } if (hd.tokenlen == 0) { if (quicconf.upstream.require_token) { - send_retry(faddr, vc.version, vc.dcid, vc.dcidlen, vc.scid, - vc.scidlen, remote_addr, local_addr, datalen * 3); + send_retry(faddr, vc.version, {vc.dcid, vc.dcidlen}, + {vc.scid, vc.scidlen}, remote_addr, local_addr, + data.size() * 3); return 0; } @@ -225,11 +227,11 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, } auto qkm = select_quic_keying_material( - *qkms.get(), vc.dcid[0] & SHRPX_QUIC_DCID_KM_ID_MASK); + *qkms.get(), vc.dcid[0] & SHRPX_QUIC_DCID_KM_ID_MASK); - if (verify_retry_token(odcid, hd.token, hd.tokenlen, hd.version, + if (verify_retry_token(odcid, {hd.token, hd.tokenlen}, hd.version, hd.dcid, &remote_addr.su.sa, remote_addr.len, - qkm->secret.data(), qkm->secret.size()) != 0) { + qkm->secret) != 0) { if (LOG_ENABLED(INFO)) { LOG(INFO) << "Failed to validate Retry token from remote=" << util::to_numeric_addr(&remote_addr); @@ -239,7 +241,7 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, // with INVALID_TOKEN. send_connection_close(faddr, hd.version, hd.dcid, hd.scid, remote_addr, local_addr, NGTCP2_INVALID_TOKEN, - datalen * 3); + data.size() * 3); return 0; } @@ -249,8 +251,7 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, } podcid = &odcid; - token = hd.token; - tokenlen = hd.tokenlen; + token = {hd.token, hd.tokenlen}; token_type = NGTCP2_TOKEN_TYPE_RETRY; break; @@ -269,8 +270,9 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, } if (quicconf.upstream.require_token) { - send_retry(faddr, vc.version, vc.dcid, vc.dcidlen, vc.scid, - vc.scidlen, remote_addr, local_addr, datalen * 3); + send_retry(faddr, vc.version, {vc.dcid, vc.dcidlen}, + {vc.scid, vc.scidlen}, remote_addr, local_addr, + data.size() * 3); return 0; } @@ -279,19 +281,19 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, } auto qkm = select_quic_keying_material( - *qkms.get(), hd.token[NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN]); + *qkms.get(), hd.token[NGTCP2_CRYPTO_MAX_REGULAR_TOKENLEN]); - if (verify_token(hd.token, hd.tokenlen - 1, &remote_addr.su.sa, - remote_addr.len, qkm->secret.data(), - qkm->secret.size()) != 0) { + if (verify_token({hd.token, hd.tokenlen}, &remote_addr.su.sa, + remote_addr.len, qkm->secret) != 0) { if (LOG_ENABLED(INFO)) { LOG(INFO) << "Failed to validate token from remote=" << util::to_numeric_addr(&remote_addr); } if (quicconf.upstream.require_token) { - send_retry(faddr, vc.version, vc.dcid, vc.dcidlen, vc.scid, - vc.scidlen, remote_addr, local_addr, datalen * 3); + send_retry(faddr, vc.version, {vc.dcid, vc.dcidlen}, + {vc.scid, vc.scidlen}, remote_addr, local_addr, + data.size() * 3); return 0; } @@ -304,16 +306,16 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, << util::to_numeric_addr(&remote_addr); } - token = hd.token; - tokenlen = hd.tokenlen; + token = {hd.token, hd.tokenlen}; token_type = NGTCP2_TOKEN_TYPE_NEW_TOKEN; break; } default: if (quicconf.upstream.require_token) { - send_retry(faddr, vc.version, vc.dcid, vc.dcidlen, vc.scid, - vc.scidlen, remote_addr, local_addr, datalen * 3); + send_retry(faddr, vc.version, {vc.dcid, vc.dcidlen}, + {vc.scid, vc.scidlen}, remote_addr, local_addr, + data.size() * 3); return 0; } @@ -324,29 +326,25 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, break; } default: - if (!config->single_thread && !(data[0] & 0x80) && - vc.dcidlen == SHRPX_QUIC_SCIDLEN && - !std::equal(std::begin(decrypted_dcid), - std::begin(decrypted_dcid) + SHRPX_QUIC_CID_PREFIXLEN, - worker_->get_cid_prefix())) { - if (conn_handler->forward_quic_packet(faddr, remote_addr, local_addr, - pi, decrypted_dcid.data(), data, - datalen) == 0) { + if (!(data[0] & 0x80) && vc.dcidlen == SHRPX_QUIC_SCIDLEN && + decrypted_dcid.worker != worker_->get_worker_id()) { + if (!config->single_thread && conn_handler->forward_quic_packet( + faddr, remote_addr, local_addr, pi, + decrypted_dcid.worker, data) == 0) { return 0; } - } - if (!(data[0] & 0x80)) { - // TODO Must be rate limited - send_stateless_reset(faddr, vc.dcid, vc.dcidlen, remote_addr, - local_addr); + if (data.size() >= SHRPX_QUIC_SCIDLEN + 21) { + send_stateless_reset(faddr, data.size(), {vc.dcid, vc.dcidlen}, + remote_addr, local_addr); + } } return 0; } handler = handle_new_connection(faddr, remote_addr, local_addr, hd, podcid, - token, tokenlen, token_type); + token, token_type); if (handler == nullptr) { return 0; } @@ -354,8 +352,7 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, handler = (*it).second; } - if (handler->read_quic(faddr, remote_addr, local_addr, pi, data, datalen) != - 0) { + if (handler->read_quic(faddr, remote_addr, local_addr, pi, data) != 0) { delete handler; return 0; } @@ -366,9 +363,9 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr, } ClientHandler *QUICConnectionHandler::handle_new_connection( - const UpstreamAddr *faddr, const Address &remote_addr, - const Address &local_addr, const ngtcp2_pkt_hd &hd, const ngtcp2_cid *odcid, - const uint8_t *token, size_t tokenlen, ngtcp2_token_type token_type) { + const UpstreamAddr *faddr, const Address &remote_addr, + const Address &local_addr, const ngtcp2_pkt_hd &hd, const ngtcp2_cid *odcid, + std::span token, ngtcp2_token_type token_type) { std::array host; std::array service; int rv; @@ -391,9 +388,9 @@ ClientHandler *QUICConnectionHandler::handle_new_connection( return nullptr; } -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#if defined(NGHTTP2_GENUINE_OPENSSL) || defined(NGHTTP2_OPENSSL_IS_WOLFSSL) assert(SSL_is_quic(ssl)); -#endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_WOLFSSL SSL_set_accept_state(ssl); @@ -401,11 +398,12 @@ ClientHandler *QUICConnectionHandler::handle_new_connection( auto &quicconf = config->quic; if (quicconf.upstream.early_data) { -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + (defined(NGHTTP2_OPENSSL_IS_WOLFSSL) && defined(WOLFSSL_EARLY_DATA)) SSL_set_quic_early_data_enabled(ssl, 1); -#else // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +#elif defined(NGHTTP2_OPENSSL_IS_BORINGSSL) SSL_set_early_data_enabled(ssl, 1); -#endif // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL } // Disable TLS session ticket if we don't have working ticket @@ -415,11 +413,11 @@ ClientHandler *QUICConnectionHandler::handle_new_connection( } auto handler = std::make_unique( - worker_, faddr->fd, ssl, StringRef{host.data()}, - StringRef{service.data()}, remote_addr.su.sa.sa_family, faddr); + worker_, faddr->fd, ssl, StringRef{host.data()}, StringRef{service.data()}, + remote_addr.su.sa.sa_family, faddr); auto upstream = std::make_unique(handler.get()); - if (upstream->init(faddr, remote_addr, local_addr, hd, odcid, token, tokenlen, + if (upstream->init(faddr, remote_addr, local_addr, hd, odcid, token, token_type) != 0) { return nullptr; } @@ -457,9 +455,9 @@ uint32_t generate_reserved_version(const Address &addr, uint32_t version) { } // namespace int QUICConnectionHandler::send_retry( - const UpstreamAddr *faddr, uint32_t version, const uint8_t *ini_dcid, - size_t ini_dcidlen, const uint8_t *ini_scid, size_t ini_scidlen, - const Address &remote_addr, const Address &local_addr, size_t max_pktlen) { + const UpstreamAddr *faddr, uint32_t version, + std::span ini_dcid, std::span ini_scid, + const Address &remote_addr, const Address &local_addr, size_t max_pktlen) { std::array host; std::array port; @@ -478,31 +476,30 @@ int QUICConnectionHandler::send_retry( ngtcp2_cid retry_scid; - if (generate_quic_retry_connection_id(retry_scid, SHRPX_QUIC_SCIDLEN, - quicconf.server_id.data(), qkm.id, - qkm.cid_encryption_key.data()) != 0) { + if (generate_quic_retry_connection_id(retry_scid, quicconf.server_id, qkm.id, + qkm.cid_encryption_ctx) != 0) { return -1; } - std::array token; - size_t tokenlen; - ngtcp2_cid idcid, iscid; - ngtcp2_cid_init(&idcid, ini_dcid, ini_dcidlen); - ngtcp2_cid_init(&iscid, ini_scid, ini_scidlen); + ngtcp2_cid_init(&idcid, ini_dcid.data(), ini_dcid.size()); + ngtcp2_cid_init(&iscid, ini_scid.data(), ini_scid.size()); + + std::array tokenbuf; - if (generate_retry_token(token.data(), tokenlen, version, &remote_addr.su.sa, - remote_addr.len, retry_scid, idcid, - qkm.secret.data(), qkm.secret.size()) != 0) { + auto token = + generate_retry_token(tokenbuf, version, &remote_addr.su.sa, remote_addr.len, + retry_scid, idcid, qkm.secret); + if (!token) { return -1; } std::vector buf; buf.resize(std::min(max_pktlen, static_cast(256))); - auto nwrite = - ngtcp2_crypto_write_retry(buf.data(), buf.size(), version, &iscid, - &retry_scid, &idcid, token.data(), tokenlen); + auto nwrite = ngtcp2_crypto_write_retry(buf.data(), buf.size(), version, + &iscid, &retry_scid, &idcid, + token->data(), token->size()); if (nwrite < 0) { LOG(ERROR) << "ngtcp2_crypto_write_retry: " << ngtcp2_strerror(nwrite); return -1; @@ -511,8 +508,8 @@ int QUICConnectionHandler::send_retry( buf.resize(nwrite); quic_send_packet(faddr, &remote_addr.su.sa, remote_addr.len, - &local_addr.su.sa, local_addr.len, ngtcp2_pkt_info{}, - buf.data(), buf.size(), 0); + &local_addr.su.sa, local_addr.len, ngtcp2_pkt_info{}, buf, + buf.size()); if (generate_quic_hashed_connection_id(idcid, remote_addr, local_addr, idcid) != 0) { @@ -520,7 +517,7 @@ int QUICConnectionHandler::send_retry( } auto d = - static_cast(NGTCP2_DEFAULT_INITIAL_RTT * 3) / NGTCP2_SECONDS; + static_cast(NGTCP2_DEFAULT_INITIAL_RTT * 3) / NGTCP2_SECONDS; if (LOG_ENABLED(INFO)) { LOG(INFO) << "Enter close-wait period " << d << "s with " << buf.size() @@ -536,13 +533,13 @@ int QUICConnectionHandler::send_retry( } int QUICConnectionHandler::send_version_negotiation( - const UpstreamAddr *faddr, uint32_t version, const uint8_t *ini_dcid, - size_t ini_dcidlen, const uint8_t *ini_scid, size_t ini_scidlen, - const Address &remote_addr, const Address &local_addr) { - std::array sv{ - generate_reserved_version(remote_addr, version), - NGTCP2_PROTO_VER_V1, - }; + const UpstreamAddr *faddr, uint32_t version, + std::span ini_dcid, std::span ini_scid, + const Address &remote_addr, const Address &local_addr) { + auto sv = std::to_array({ + generate_reserved_version(remote_addr, version), + NGTCP2_PROTO_VER_V1, + }); std::array buf; @@ -550,22 +547,23 @@ int QUICConnectionHandler::send_version_negotiation( util::random_bytes(&rand_byte, &rand_byte + 1, worker_->get_randgen()); auto nwrite = ngtcp2_pkt_write_version_negotiation( - buf.data(), buf.size(), rand_byte, ini_scid, ini_scidlen, ini_dcid, - ini_dcidlen, sv.data(), sv.size()); + buf.data(), buf.size(), rand_byte, ini_scid.data(), ini_scid.size(), + ini_dcid.data(), ini_dcid.size(), sv.data(), sv.size()); if (nwrite < 0) { LOG(ERROR) << "ngtcp2_pkt_write_version_negotiation: " << ngtcp2_strerror(nwrite); return -1; } + auto pkt = std::span{std::begin(buf), static_cast(nwrite)}; return quic_send_packet(faddr, &remote_addr.su.sa, remote_addr.len, &local_addr.su.sa, local_addr.len, ngtcp2_pkt_info{}, - buf.data(), nwrite, 0); + pkt, pkt.size()); } int QUICConnectionHandler::send_stateless_reset(const UpstreamAddr *faddr, - const uint8_t *dcid, - size_t dcidlen, + size_t pktlen, + std::span dcid, const Address &remote_addr, const Address &local_addr) { if (stateless_reset_bucket_ == 0) { @@ -582,33 +580,45 @@ int QUICConnectionHandler::send_stateless_reset(const UpstreamAddr *faddr, ev_timer_again(worker_->get_loop(), &stateless_reset_bucket_regen_timer_); } - int rv; std::array token; ngtcp2_cid cid; - ngtcp2_cid_init(&cid, dcid, dcidlen); + ngtcp2_cid_init(&cid, dcid.data(), dcid.size()); auto conn_handler = worker_->get_connection_handler(); auto &qkms = conn_handler->get_quic_keying_materials(); auto &qkm = qkms->keying_materials.front(); - rv = generate_quic_stateless_reset_token(token.data(), cid, qkm.secret.data(), - qkm.secret.size()); - if (rv != 0) { + if (auto rv = generate_quic_stateless_reset_token( + token.data(), cid, qkm.secret.data(), qkm.secret.size()); + rv != 0) { return -1; } - std::array rand_bytes; + // SCID + minimum expansion - NGTCP2_STATELESS_RESET_TOKENLEN + constexpr size_t max_rand_byteslen = + NGTCP2_MAX_CIDLEN + 22 - NGTCP2_STATELESS_RESET_TOKENLEN; + + size_t rand_byteslen; + + if (pktlen <= 43) { + // As per + // https://datatracker.ietf.org/doc/html/rfc9000#section-10.3 + rand_byteslen = pktlen - NGTCP2_STATELESS_RESET_TOKENLEN - 1; + } else { + rand_byteslen = max_rand_byteslen; + } + + std::array rand_bytes; - if (RAND_bytes(rand_bytes.data(), rand_bytes.size()) != 1) { + if (RAND_bytes(rand_bytes.data(), rand_byteslen) != 1) { return -1; } std::array buf; - auto nwrite = - ngtcp2_pkt_write_stateless_reset(buf.data(), buf.size(), token.data(), - rand_bytes.data(), rand_bytes.size()); + auto nwrite = ngtcp2_pkt_write_stateless_reset( + buf.data(), buf.size(), token.data(), rand_bytes.data(), rand_byteslen); if (nwrite < 0) { LOG(ERROR) << "ngtcp2_pkt_write_stateless_reset: " << ngtcp2_strerror(nwrite); @@ -618,25 +628,26 @@ int QUICConnectionHandler::send_stateless_reset(const UpstreamAddr *faddr, if (LOG_ENABLED(INFO)) { LOG(INFO) << "Send stateless_reset to remote=" << util::to_numeric_addr(&remote_addr) - << " dcid=" << util::format_hex(dcid, dcidlen); + << " dcid=" << util::format_hex(dcid); } + auto pkt = std::span{std::begin(buf), static_cast(nwrite)}; return quic_send_packet(faddr, &remote_addr.su.sa, remote_addr.len, &local_addr.su.sa, local_addr.len, ngtcp2_pkt_info{}, - buf.data(), nwrite, 0); + pkt, pkt.size()); } int QUICConnectionHandler::send_connection_close( - const UpstreamAddr *faddr, uint32_t version, const ngtcp2_cid &ini_dcid, - const ngtcp2_cid &ini_scid, const Address &remote_addr, - const Address &local_addr, uint64_t error_code, size_t max_pktlen) { + const UpstreamAddr *faddr, uint32_t version, const ngtcp2_cid &ini_dcid, + const ngtcp2_cid &ini_scid, const Address &remote_addr, + const Address &local_addr, uint64_t error_code, size_t max_pktlen) { std::array buf; max_pktlen = std::min(max_pktlen, buf.size()); auto nwrite = ngtcp2_crypto_write_connection_close( - buf.data(), max_pktlen, version, &ini_scid, &ini_dcid, error_code, - nullptr, 0); + buf.data(), max_pktlen, version, &ini_scid, &ini_dcid, error_code, nullptr, + 0); if (nwrite < 0) { LOG(ERROR) << "ngtcp2_crypto_write_connection_close failed"; return -1; @@ -646,13 +657,16 @@ int QUICConnectionHandler::send_connection_close( LOG(INFO) << "Send Initial CONNECTION_CLOSE with error_code=" << log::hex << error_code << log::dec << " to remote=" << util::to_numeric_addr(&remote_addr) - << " dcid=" << util::format_hex(ini_scid.data, ini_scid.datalen) - << " scid=" << util::format_hex(ini_dcid.data, ini_dcid.datalen); + << " dcid=" + << util::format_hex(std::span{ini_scid.data, ini_scid.datalen}) + << " scid=" + << util::format_hex(std::span{ini_dcid.data, ini_dcid.datalen}); } + auto pkt = std::span{std::begin(buf), static_cast(nwrite)}; return quic_send_packet(faddr, &remote_addr.su.sa, remote_addr.len, &local_addr.su.sa, local_addr.len, ngtcp2_pkt_info{}, - buf.data(), nwrite, 0); + pkt, pkt.size()); } void QUICConnectionHandler::add_connection_id(const ngtcp2_cid &cid, @@ -700,13 +714,13 @@ static void close_wait_timeoutcb(struct ev_loop *loop, ev_timer *w, CloseWait::CloseWait(Worker *worker, std::vector scids, std::vector pkt, ev_tstamp period) - : worker{worker}, - scids{std::move(scids)}, - pkt{std::move(pkt)}, - bytes_recv{0}, - bytes_sent{0}, - num_pkts_recv{0}, - next_pkts_recv{1} { + : worker{worker}, + scids{std::move(scids)}, + pkt{std::move(pkt)}, + bytes_recv{0}, + bytes_sent{0}, + num_pkts_recv{0}, + next_pkts_recv{1} { ++worker->get_worker_stat()->num_close_waits; ev_timer_init(&timer, close_wait_timeoutcb, period, 0.); @@ -732,23 +746,24 @@ CloseWait::~CloseWait() { int CloseWait::handle_packet(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, - const ngtcp2_pkt_info &pi, const uint8_t *data, - size_t datalen) { + const ngtcp2_pkt_info &pi, + std::span data) { if (pkt.empty()) { return 0; } ++num_pkts_recv; - bytes_recv += datalen; + bytes_recv += data.size(); if (bytes_sent + pkt.size() > 3 * bytes_recv || next_pkts_recv > num_pkts_recv) { return 0; } - if (quic_send_packet(faddr, &remote_addr.su.sa, remote_addr.len, - &local_addr.su.sa, local_addr.len, ngtcp2_pkt_info{}, - pkt.data(), pkt.size(), 0) != 0) { + auto rv = quic_send_packet(faddr, &remote_addr.su.sa, remote_addr.len, + &local_addr.su.sa, local_addr.len, + ngtcp2_pkt_info{}, pkt, pkt.size()); + if (rv != 0) { return -1; } diff --git a/lib/nghttp2/src/shrpx_quic_connection_handler.h b/lib/nghttp2-1.65.0/src/shrpx_quic_connection_handler.h similarity index 79% rename from lib/nghttp2/src/shrpx_quic_connection_handler.h rename to lib/nghttp2-1.65.0/src/shrpx_quic_connection_handler.h index 29e73a41c1d..374d84bf0be 100644 --- a/lib/nghttp2/src/shrpx_quic_connection_handler.h +++ b/lib/nghttp2-1.65.0/src/shrpx_quic_connection_handler.h @@ -56,7 +56,7 @@ struct CloseWait { int handle_packet(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen); + std::span data); Worker *worker; // Source Connection IDs of the connection. @@ -83,28 +83,26 @@ class QUICConnectionHandler { ~QUICConnectionHandler(); int handle_packet(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen); + std::span data); // Send Retry packet. |ini_dcid| is the destination Connection ID - // which appeared in Client Initial packet and its length is - // |dcidlen|. |ini_scid| is the source Connection ID which appeared - // in Client Initial packet and its length is |scidlen|. + // which appeared in Client Initial packet. |ini_scid| is the + // source Connection ID which appeared in Client Initial packet. int send_retry(const UpstreamAddr *faddr, uint32_t version, - const uint8_t *ini_dcid, size_t ini_dcidlen, - const uint8_t *ini_scid, size_t ini_scidlen, - const Address &remote_addr, const Address &local_addr, - size_t max_pktlen); + std::span ini_dcid, + std::span ini_scid, const Address &remote_addr, + const Address &local_addr, size_t max_pktlen); // Send Version Negotiation packet. |ini_dcid| is the destination - // Connection ID which appeared in Client Initial packet and its - // length is |dcidlen|. |ini_scid| is the source Connection ID - // which appeared in Client Initial packet and its length is - // |scidlen|. + // Connection ID which appeared in Client Initial packet. + // |ini_scid| is the source Connection ID which appeared in Client + // Initial packet. int send_version_negotiation(const UpstreamAddr *faddr, uint32_t version, - const uint8_t *ini_dcid, size_t ini_dcidlen, - const uint8_t *ini_scid, size_t ini_scidlen, + std::span ini_dcid, + std::span ini_scid, const Address &remote_addr, const Address &local_addr); - int send_stateless_reset(const UpstreamAddr *faddr, const uint8_t *dcid, - size_t dcidlen, const Address &remote_addr, + int send_stateless_reset(const UpstreamAddr *faddr, size_t pktlen, + std::span dcid, + const Address &remote_addr, const Address &local_addr); // Send Initial CONNECTION_CLOSE. |ini_dcid| is the destination // Connection ID which appeared in Client Initial packet. @@ -119,8 +117,8 @@ class QUICConnectionHandler { ClientHandler * handle_new_connection(const UpstreamAddr *faddr, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_hd &hd, - const ngtcp2_cid *odcid, const uint8_t *token, - size_t tokenlen, ngtcp2_token_type token_type); + const ngtcp2_cid *odcid, std::span token, + ngtcp2_token_type token_type); void add_connection_id(const ngtcp2_cid &cid, ClientHandler *handler); void remove_connection_id(const ngtcp2_cid &cid); diff --git a/lib/nghttp2/src/shrpx_quic_listener.cc b/lib/nghttp2-1.65.0/src/shrpx_quic_listener.cc similarity index 82% rename from lib/nghttp2/src/shrpx_quic_listener.cc rename to lib/nghttp2-1.65.0/src/shrpx_quic_listener.cc index 9b9f1203aa7..80dfd51241a 100644 --- a/lib/nghttp2/src/shrpx_quic_listener.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_quic_listener.cc @@ -37,7 +37,7 @@ void readcb(struct ev_loop *loop, ev_io *w, int revent) { } // namespace QUICListener::QUICListener(const UpstreamAddr *faddr, Worker *worker) - : faddr_{faddr}, worker_{worker} { + : faddr_{faddr}, worker_{worker} { ev_io_init(&rev_, readcb, faddr_->fd, EV_READ); rev_.data = this; ev_io_start(worker_->get_loop(), &rev_); @@ -60,7 +60,7 @@ void QUICListener::on_read() { msg.msg_iovlen = 1; uint8_t msg_ctrl[CMSG_SPACE(sizeof(int)) + CMSG_SPACE(sizeof(in6_pktinfo)) + - CMSG_SPACE(sizeof(uint16_t))]; + CMSG_SPACE(sizeof(int))]; msg.msg_control = msg_ctrl; auto quic_conn_handler = worker_->get_quic_connection_handler(); @@ -74,6 +74,19 @@ void QUICListener::on_read() { return; } + // Packets less than 21 bytes never be a valid QUIC packet. + if (nread < 21) { + ++pktcnt; + + continue; + } + + if (util::quic_prohibited_port(util::get_port(&su))) { + ++pktcnt; + + continue; + } + Address local_addr{}; if (util::msghdr_get_local_addr(local_addr, &msg, su.storage.ss_family) != 0) { @@ -85,7 +98,7 @@ void QUICListener::on_read() { util::set_port(local_addr, faddr_->port); ngtcp2_pkt_info pi{ - .ecn = util::msghdr_get_ecn(&msg, su.storage.ss_family), + .ecn = util::msghdr_get_ecn(&msg, su.storage.ss_family), }; auto gso_size = util::msghdr_get_udp_gro(&msg); @@ -93,10 +106,10 @@ void QUICListener::on_read() { gso_size = static_cast(nread); } - auto data = buf.data(); + auto data = std::span{std::begin(buf), static_cast(nread)}; for (;;) { - auto datalen = std::min(static_cast(nread), gso_size); + auto datalen = std::min(data.size(), gso_size); ++pktcnt; @@ -108,7 +121,8 @@ void QUICListener::on_read() { << " bytes"; } - if (datalen == 0) { + // Packets less than 21 bytes never be a valid QUIC packet. + if (datalen < 21) { break; } @@ -117,14 +131,12 @@ void QUICListener::on_read() { remote_addr.len = msg.msg_namelen; quic_conn_handler->handle_packet(faddr_, remote_addr, local_addr, pi, - data, datalen); + {std::begin(data), datalen}); - nread -= datalen; - if (nread == 0) { + data = data.subspan(datalen); + if (data.empty()) { break; } - - data += datalen; } } } diff --git a/lib/nghttp2/src/shrpx_quic_listener.h b/lib/nghttp2-1.65.0/src/shrpx_quic_listener.h similarity index 100% rename from lib/nghttp2/src/shrpx_quic_listener.h rename to lib/nghttp2-1.65.0/src/shrpx_quic_listener.h diff --git a/lib/nghttp2/src/shrpx_rate_limit.cc b/lib/nghttp2-1.65.0/src/shrpx_rate_limit.cc similarity index 95% rename from lib/nghttp2/src/shrpx_rate_limit.cc rename to lib/nghttp2-1.65.0/src/shrpx_rate_limit.cc index 0d4f92126b7..5caaae9d994 100644 --- a/lib/nghttp2/src/shrpx_rate_limit.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_rate_limit.cc @@ -40,13 +40,13 @@ void regencb(struct ev_loop *loop, ev_timer *w, int revents) { RateLimit::RateLimit(struct ev_loop *loop, ev_io *w, size_t rate, size_t burst, Connection *conn) - : w_(w), - loop_(loop), - conn_(conn), - rate_(rate), - burst_(burst), - avail_(burst), - startw_req_(false) { + : w_(w), + loop_(loop), + conn_(conn), + rate_(rate), + burst_(burst), + avail_(burst), + startw_req_(false) { ev_timer_init(&t_, regencb, 0., 1.); t_.data = this; if (rate_ > 0) { diff --git a/lib/nghttp2/src/shrpx_rate_limit.h b/lib/nghttp2-1.65.0/src/shrpx_rate_limit.h similarity index 90% rename from lib/nghttp2/src/shrpx_rate_limit.h rename to lib/nghttp2-1.65.0/src/shrpx_rate_limit.h index 7502a27a2b1..a766ab44bde 100644 --- a/lib/nghttp2/src/shrpx_rate_limit.h +++ b/lib/nghttp2-1.65.0/src/shrpx_rate_limit.h @@ -29,7 +29,14 @@ #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL namespace shrpx { diff --git a/lib/nghttp2/src/shrpx_router.cc b/lib/nghttp2-1.65.0/src/shrpx_router.cc similarity index 95% rename from lib/nghttp2/src/shrpx_router.cc rename to lib/nghttp2-1.65.0/src/shrpx_router.cc index d3565db8913..c836bebbfc6 100644 --- a/lib/nghttp2/src/shrpx_router.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_router.cc @@ -34,7 +34,7 @@ namespace shrpx { RNode::RNode() : s(nullptr), len(0), index(-1), wildcard_index(-1) {} RNode::RNode(const char *s, size_t len, ssize_t index, ssize_t wildcard_index) - : s(s), len(len), index(index), wildcard_index(wildcard_index) {} + : s(s), len(len), index(index), wildcard_index(wildcard_index) {} Router::Router() : balloc_(1024, 1024), root_{} {} @@ -67,7 +67,7 @@ void Router::add_node(RNode *node, const char *pattern, size_t patlen, ssize_t index, ssize_t wildcard_index) { auto pat = make_string_ref(balloc_, StringRef{pattern, patlen}); auto new_node = - std::make_unique(pat.c_str(), pat.size(), index, wildcard_index); + std::make_unique(pat.data(), pat.size(), index, wildcard_index); add_next_node(node, std::move(new_node)); } @@ -85,7 +85,7 @@ size_t Router::add_route(const StringRef &pattern, size_t idx, bool wildcard) { for (;;) { auto next_node = find_next_node(node, pattern[i]); if (next_node == nullptr) { - add_node(node, pattern.c_str() + i, pattern.size() - i, index, + add_node(node, pattern.data() + i, pattern.size() - i, index, wildcard_index); return idx; } @@ -93,7 +93,7 @@ size_t Router::add_route(const StringRef &pattern, size_t idx, bool wildcard) { node = next_node; auto slen = pattern.size() - i; - auto s = pattern.c_str() + i; + auto s = pattern.data() + i; auto n = std::min(node->len, slen); size_t j; for (j = 0; j < n && node->s[j] == s[j]; ++j) @@ -132,7 +132,7 @@ size_t Router::add_route(const StringRef &pattern, size_t idx, bool wildcard) { // node must be split into 2 nodes. new_node is now the child // of node. auto new_node = std::make_unique( - &node->s[j], node->len - j, node->index, node->wildcard_index); + &node->s[j], node->len - j, node->index, node->wildcard_index); std::swap(node->next, new_node->next); node->len = j; @@ -151,7 +151,7 @@ size_t Router::add_route(const StringRef &pattern, size_t idx, bool wildcard) { i += j; assert(pattern.size() > i); - add_node(node, pattern.c_str() + i, pattern.size() - i, index, + add_node(node, pattern.data() + i, pattern.size() - i, index, wildcard_index); return idx; @@ -395,7 +395,7 @@ ssize_t Router::match_prefix(size_t *nread, const RNode **last_node, } auto node = - ::shrpx::match_prefix(nread, *last_node, std::begin(s), std::end(s)); + ::shrpx::match_prefix(nread, *last_node, std::begin(s), std::end(s)); if (node == nullptr) { return -1; } diff --git a/lib/nghttp2/src/shrpx_router.h b/lib/nghttp2-1.65.0/src/shrpx_router.h similarity index 100% rename from lib/nghttp2/src/shrpx_router.h rename to lib/nghttp2-1.65.0/src/shrpx_router.h diff --git a/lib/nghttp2-1.65.0/src/shrpx_router_test.cc b/lib/nghttp2-1.65.0/src/shrpx_router_test.cc new file mode 100644 index 00000000000..ddedc6b5d22 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/shrpx_router_test.cc @@ -0,0 +1,179 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2016 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "shrpx_router_test.h" + +#include "munitxx.h" + +#include "shrpx_router.h" + +namespace shrpx { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_shrpx_router_match), + munit_void_test(test_shrpx_router_match_wildcard), + munit_void_test(test_shrpx_router_match_prefix), + munit_test_end(), +}; +} // namespace + +const MunitSuite router_suite{ + "/router", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +struct Pattern { + StringRef pattern; + size_t idx; + bool wildcard; +}; + +void test_shrpx_router_match(void) { + auto patterns = std::vector{ + {"nghttp2.org/"_sr, 0}, + {"nghttp2.org/alpha"_sr, 1}, + {"nghttp2.org/alpha/"_sr, 2}, + {"nghttp2.org/alpha/bravo/"_sr, 3}, + {"www.nghttp2.org/alpha/"_sr, 4}, + {"/alpha"_sr, 5}, + {"example.com/alpha/"_sr, 6}, + {"nghttp2.org/alpha/bravo2/"_sr, 7}, + {"www2.nghttp2.org/alpha/"_sr, 8}, + {"www2.nghttp2.org/alpha2/"_sr, 9}, + }; + + Router router; + + for (auto &p : patterns) { + router.add_route(p.pattern, p.idx); + } + + ssize_t idx; + + idx = router.match("nghttp2.org"_sr, "/"_sr); + + assert_ssize(0, ==, idx); + + idx = router.match("nghttp2.org"_sr, "/alpha"_sr); + + assert_ssize(1, ==, idx); + + idx = router.match("nghttp2.org"_sr, "/alpha/"_sr); + + assert_ssize(2, ==, idx); + + idx = router.match("nghttp2.org"_sr, "/alpha/charlie"_sr); + + assert_ssize(2, ==, idx); + + idx = router.match("nghttp2.org"_sr, "/alpha/bravo/"_sr); + + assert_ssize(3, ==, idx); + + // matches pattern when last '/' is missing in path + idx = router.match("nghttp2.org"_sr, "/alpha/bravo"_sr); + + assert_ssize(3, ==, idx); + + idx = router.match("www2.nghttp2.org"_sr, "/alpha"_sr); + + assert_ssize(8, ==, idx); + + idx = router.match(StringRef{}, "/alpha"_sr); + + assert_ssize(5, ==, idx); +} + +void test_shrpx_router_match_wildcard(void) { + constexpr auto patterns = std::to_array({ + {"nghttp2.org/"_sr, 0}, + {"nghttp2.org/"_sr, 1, true}, + {"nghttp2.org/alpha/"_sr, 2}, + {"nghttp2.org/alpha/"_sr, 3, true}, + {"nghttp2.org/bravo"_sr, 4}, + {"nghttp2.org/bravo"_sr, 5, true}, + }); + + Router router; + + for (auto &p : patterns) { + router.add_route(p.pattern, p.idx, p.wildcard); + } + + assert_ssize(0, ==, router.match("nghttp2.org"_sr, "/"_sr)); + + assert_ssize(1, ==, router.match("nghttp2.org"_sr, "/a"_sr)); + + assert_ssize(1, ==, router.match("nghttp2.org"_sr, "/charlie"_sr)); + + assert_ssize(2, ==, router.match("nghttp2.org"_sr, "/alpha"_sr)); + + assert_ssize(2, ==, router.match("nghttp2.org"_sr, "/alpha/"_sr)); + + assert_ssize(3, ==, router.match("nghttp2.org"_sr, "/alpha/b"_sr)); + + assert_ssize(4, ==, router.match("nghttp2.org"_sr, "/bravo"_sr)); + + assert_ssize(5, ==, router.match("nghttp2.org"_sr, "/bravocharlie"_sr)); + + assert_ssize(5, ==, router.match("nghttp2.org"_sr, "/bravo/"_sr)); +} + +void test_shrpx_router_match_prefix(void) { + auto patterns = std::vector{ + {"gro.2ptthgn."_sr, 0}, + {"gro.2ptthgn.www."_sr, 1}, + {"gro.2ptthgn.gmi."_sr, 2}, + {"gro.2ptthgn.gmi.ahpla."_sr, 3}, + }; + + Router router; + + for (auto &p : patterns) { + router.add_route(p.pattern, p.idx); + } + + ssize_t idx; + const RNode *node; + size_t nread; + + node = nullptr; + + idx = router.match_prefix(&nread, &node, "gro.2ptthgn.gmi.ahpla.ovarb"_sr); + + assert_ssize(0, ==, idx); + assert_size(12, ==, nread); + + idx = router.match_prefix(&nread, &node, "gmi.ahpla.ovarb"_sr); + + assert_ssize(2, ==, idx); + assert_size(4, ==, nread); + + idx = router.match_prefix(&nread, &node, "ahpla.ovarb"_sr); + + assert_ssize(3, ==, idx); + assert_ssize(6, ==, nread); +} + +} // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_router_test.h b/lib/nghttp2-1.65.0/src/shrpx_router_test.h similarity index 84% rename from lib/nghttp2/src/shrpx_router_test.h rename to lib/nghttp2-1.65.0/src/shrpx_router_test.h index d39cb87b4a6..4d6e72b93d8 100644 --- a/lib/nghttp2/src/shrpx_router_test.h +++ b/lib/nghttp2-1.65.0/src/shrpx_router_test.h @@ -29,11 +29,17 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace shrpx { -void test_shrpx_router_match(void); -void test_shrpx_router_match_wildcard(void); -void test_shrpx_router_match_prefix(void); +extern const MunitSuite router_suite; + +munit_void_test_decl(test_shrpx_router_match) +munit_void_test_decl(test_shrpx_router_match_wildcard) +munit_void_test_decl(test_shrpx_router_match_prefix) } // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_signal.cc b/lib/nghttp2-1.65.0/src/shrpx_signal.cc similarity index 93% rename from lib/nghttp2/src/shrpx_signal.cc rename to lib/nghttp2-1.65.0/src/shrpx_signal.cc index 63fcc077600..528ac2faa05 100644 --- a/lib/nghttp2/src/shrpx_signal.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_signal.cc @@ -110,13 +110,13 @@ int signal_set_handler(void (*handler)(int), Signals &&sigs) { } // namespace namespace { -constexpr auto main_proc_ign_signals = std::array{SIGPIPE}; +constexpr auto main_proc_ign_signals = std::to_array({SIGPIPE}); } // namespace namespace { constexpr auto worker_proc_ign_signals = - std::array{REOPEN_LOG_SIGNAL, EXEC_BINARY_SIGNAL, - GRACEFUL_SHUTDOWN_SIGNAL, RELOAD_SIGNAL, SIGPIPE}; + std::to_array({REOPEN_LOG_SIGNAL, EXEC_BINARY_SIGNAL, + GRACEFUL_SHUTDOWN_SIGNAL, RELOAD_SIGNAL, SIGPIPE}); } // namespace int shrpx_signal_set_main_proc_ign_handler() { diff --git a/lib/nghttp2/src/shrpx_signal.h b/lib/nghttp2-1.65.0/src/shrpx_signal.h similarity index 100% rename from lib/nghttp2/src/shrpx_signal.h rename to lib/nghttp2-1.65.0/src/shrpx_signal.h diff --git a/lib/nghttp2/src/shrpx_tls.cc b/lib/nghttp2-1.65.0/src/shrpx_tls.cc similarity index 76% rename from lib/nghttp2/src/shrpx_tls.cc rename to lib/nghttp2-1.65.0/src/shrpx_tls.cc index 5dd2d150614..0f75fd9cab5 100644 --- a/lib/nghttp2/src/shrpx_tls.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_tls.cc @@ -42,19 +42,29 @@ #include "ssl_compat.h" -#include -#include -#include -#include -#include -#ifndef OPENSSL_NO_OCSP -# include -#endif // OPENSSL_NO_OCSP -#if OPENSSL_3_0_0_API -# include -# include -# include -#endif // OPENSSL_3_0_0_API +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +# include +# include +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +# include +# include +# ifndef OPENSSL_NO_OCSP +# include +# endif // OPENSSL_NO_OCSP +# if OPENSSL_3_0_0_API +# include +# include +# include +# endif // OPENSSL_3_0_0_API +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #ifdef NGHTTP2_OPENSSL_IS_BORINGSSL # include #endif // NGHTTP2_OPENSSL_IS_BORINGSSL @@ -70,8 +80,16 @@ # ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL # include # endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL +# ifdef HAVE_LIBNGTCP2_CRYPTO_WOLFSSL +# include +# endif // HAVE_LIBNGTCP2_CRYPTO_WOLFSSL #endif // ENABLE_HTTP3 +#ifdef HAVE_LIBBROTLI +# include +# include +#endif // HAVE_LIBBROTLI + #include "shrpx_log.h" #include "shrpx_client_handler.h" #include "shrpx_config.h" @@ -96,26 +114,6 @@ namespace shrpx { namespace tls { -#if !OPENSSL_1_1_API -namespace { -const unsigned char *ASN1_STRING_get0_data(ASN1_STRING *x) { - return ASN1_STRING_data(x); -} -} // namespace -#endif // !OPENSSL_1_1_API - -#ifndef OPENSSL_NO_NEXTPROTONEG -namespace { -int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len, - void *arg) { - auto &prefs = get_config()->tls.alpn_prefs; - *data = prefs.data(); - *len = prefs.size(); - return SSL_TLSEXT_ERR_OK; -} -} // namespace -#endif // !OPENSSL_NO_NEXTPROTONEG - namespace { int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) { if (!preverify_ok) { @@ -172,11 +170,39 @@ int ssl_pem_passwd_cb(char *buf, int size, int rwflag, void *user_data) { return 0; } // Copy string including last '\0'. - memcpy(buf, config->tls.private_key_passwd.c_str(), len + 1); + memcpy(buf, config->tls.private_key_passwd.data(), len + 1); return len; } } // namespace +namespace { +std::shared_ptr> +get_ocsp_data(TLSContextData *tls_ctx_data) { +#ifdef HAVE_ATOMIC_STD_SHARED_PTR + return tls_ctx_data->ocsp_data.load(std::memory_order_acquire); +#else // !HAVE_ATOMIC_STD_SHARED_PTR + std::lock_guard g(tls_ctx_data->mu); + return tls_ctx_data->ocsp_data; +#endif // !HAVE_ATOMIC_STD_SHARED_PTR +} +} // namespace + +namespace { +void set_ocsp_response(SSL *ssl) { +#ifdef NGHTTP2_OPENSSL_IS_BORINGSSL + auto tls_ctx_data = + static_cast(SSL_CTX_get_app_data(SSL_get_SSL_CTX(ssl))); + auto data = get_ocsp_data(tls_ctx_data); + + if (!data) { + return; + } + + SSL_set_ocsp_response(ssl, data->data(), data->size()); +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL +} +} // namespace + namespace { // *al is set to SSL_AD_UNRECOGNIZED_NAME by openssl, so we don't have // to set it explicitly. @@ -187,16 +213,20 @@ int servername_callback(SSL *ssl, int *al, void *arg) { auto rawhost = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name); if (rawhost == nullptr) { + set_ocsp_response(ssl); + return SSL_TLSEXT_ERR_NOACK; } auto len = strlen(rawhost); // NI_MAXHOST includes terminal NULL. if (len == 0 || len + 1 > NI_MAXHOST) { + set_ocsp_response(ssl); + return SSL_TLSEXT_ERR_NOACK; } - std::array buf; + std::array buf; auto end_buf = std::copy_n(rawhost, len, std::begin(buf)); @@ -206,14 +236,16 @@ int servername_callback(SSL *ssl, int *al, void *arg) { #ifdef ENABLE_HTTP3 auto cert_tree = conn->proto == Proto::HTTP3 - ? worker->get_quic_cert_lookup_tree() - : worker->get_cert_lookup_tree(); + ? worker->get_quic_cert_lookup_tree() + : worker->get_cert_lookup_tree(); #else // !ENABLE_HTTP3 auto cert_tree = worker->get_cert_lookup_tree(); #endif // !ENABLE_HTTP3 auto idx = cert_tree->lookup(hostname); if (idx == -1) { + set_ocsp_response(ssl); + return SSL_TLSEXT_ERR_NOACK; } @@ -223,18 +255,17 @@ int servername_callback(SSL *ssl, int *al, void *arg) { #ifdef ENABLE_HTTP3 const auto &ssl_ctx_list = conn->proto == Proto::HTTP3 - ? conn_handler->get_quic_indexed_ssl_ctx(idx) - : conn_handler->get_indexed_ssl_ctx(idx); + ? conn_handler->get_quic_indexed_ssl_ctx(idx) + : conn_handler->get_indexed_ssl_ctx(idx); #else // !ENABLE_HTTP3 const auto &ssl_ctx_list = conn_handler->get_indexed_ssl_ctx(idx); #endif // !ENABLE_HTTP3 assert(!ssl_ctx_list.empty()); -#if !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && !LIBRESSL_IN_USE && \ - OPENSSL_VERSION_NUMBER >= 0x10002000L +#ifdef NGHTTP2_GENUINE_OPENSSL auto num_sigalgs = - SSL_get_sigalgs(ssl, 0, nullptr, nullptr, nullptr, nullptr, nullptr); + SSL_get_sigalgs(ssl, 0, nullptr, nullptr, nullptr, nullptr, nullptr); for (idx = 0; idx < num_sigalgs; ++idx) { int signhash; @@ -274,12 +305,7 @@ int servername_callback(SSL *ssl, int *al, void *arg) { for (auto ssl_ctx : ssl_ctx_list) { auto cert = SSL_CTX_get0_certificate(ssl_ctx); - -# if OPENSSL_1_1_API auto pubkey = X509_get0_pubkey(cert); -# else // !OPENSSL_1_1_API - auto pubkey = X509_get_pubkey(cert); -# endif // !OPENSSL_1_1_API if (EVP_PKEY_base_id(pubkey) != EVP_PKEY_EC) { continue; @@ -296,13 +322,8 @@ int servername_callback(SSL *ssl, int *al, void *arg) { SSL_set_SSL_CTX(ssl, ssl_ctx); return SSL_TLSEXT_ERR_OK; } -# else // !OPENSSL_3_0_0_API -# if OPENSSL_1_1_API +# else // !OPENSSL_3_0_0_API auto eckey = EVP_PKEY_get0_EC_KEY(pubkey); -# else // !OPENSSL_1_1_API - auto eckey = EVP_PKEY_get1_EC_KEY(pubkey); -# endif // !OPENSSL_1_1_API - if (eckey == nullptr) { continue; } @@ -310,46 +331,29 @@ int servername_callback(SSL *ssl, int *al, void *arg) { auto ecgroup = EC_KEY_get0_group(eckey); auto cert_curve = EC_GROUP_get_curve_name(ecgroup); -# if !OPENSSL_1_1_API - EC_KEY_free(eckey); - EVP_PKEY_free(pubkey); -# endif // !OPENSSL_1_1_API - if (shared_curve == cert_curve) { SSL_set_SSL_CTX(ssl, ssl_ctx); return SSL_TLSEXT_ERR_OK; } -# endif // !OPENSSL_3_0_0_API +# endif // !OPENSSL_3_0_0_API } } -#endif // !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && !LIBRESSL_IN_USE && - // OPENSSL_VERSION_NUMBER >= 0x10002000L +#endif // NGHTTP2_GENUINE_OPENSSL SSL_set_SSL_CTX(ssl, ssl_ctx_list[0]); + set_ocsp_response(ssl); + return SSL_TLSEXT_ERR_OK; } } // namespace #ifndef NGHTTP2_OPENSSL_IS_BORINGSSL -namespace { -std::shared_ptr> -get_ocsp_data(TLSContextData *tls_ctx_data) { -# ifdef HAVE_ATOMIC_STD_SHARED_PTR - return std::atomic_load_explicit(&tls_ctx_data->ocsp_data, - std::memory_order_acquire); -# else // !HAVE_ATOMIC_STD_SHARED_PTR - std::lock_guard g(tls_ctx_data->mu); - return tls_ctx_data->ocsp_data; -# endif // !HAVE_ATOMIC_STD_SHARED_PTR -} -} // namespace - namespace { int ocsp_resp_cb(SSL *ssl, void *arg) { auto ssl_ctx = SSL_get_SSL_CTX(ssl); auto tls_ctx_data = - static_cast(SSL_CTX_get_app_data(ssl_ctx)); + static_cast(SSL_CTX_get_app_data(ssl_ctx)); auto data = get_ocsp_data(tls_ctx_data); @@ -358,7 +362,7 @@ int ocsp_resp_cb(SSL *ssl, void *arg) { } auto buf = static_cast( - CRYPTO_malloc(data->size(), NGHTTP2_FILE_NAME, __LINE__)); + CRYPTO_malloc(data->size(), NGHTTP2_FILE_NAME, __LINE__)); if (!buf) { return SSL_TLSEXT_ERR_OK; @@ -374,7 +378,7 @@ int ocsp_resp_cb(SSL *ssl, void *arg) { #endif // NGHTTP2_OPENSSL_IS_BORINGSSL constexpr auto MEMCACHED_SESSION_CACHE_KEY_PREFIX = - StringRef::from_lit("nghttpx:tls-session-cache:"); + "nghttpx:tls-session-cache:"_sr; namespace { int tls_session_client_new_cb(SSL *ssl, SSL_SESSION *session) { @@ -410,14 +414,15 @@ int tls_session_new_cb(SSL *ssl, SSL_SESSION *session) { id = SSL_SESSION_get_id(session, &idlen); if (LOG_ENABLED(INFO)) { - LOG(INFO) << "Memcached: cache session, id=" << util::format_hex(id, idlen); + LOG(INFO) << "Memcached: cache session, id=" + << util::format_hex(std::span{id, idlen}); } auto req = std::make_unique(); req->op = MemcachedOp::ADD; - req->key = MEMCACHED_SESSION_CACHE_KEY_PREFIX.str(); + req->key = MEMCACHED_SESSION_CACHE_KEY_PREFIX; req->key += - util::format_hex(balloc, StringRef{id, static_cast(idlen)}); + util::format_hex(balloc, std::span{id, static_cast(idlen)}); auto sessionlen = i2d_SSL_SESSION(session, nullptr); req->value.resize(sessionlen); @@ -447,13 +452,8 @@ int tls_session_new_cb(SSL *ssl, SSL_SESSION *session) { } // namespace namespace { -SSL_SESSION *tls_session_get_cb(SSL *ssl, -#if OPENSSL_1_1_API || LIBRESSL_2_7_API - const unsigned char *id, -#else // !(OPENSSL_1_1_API || LIBRESSL_2_7_API) - unsigned char *id, -#endif // !(OPENSSL_1_1_API || LIBRESSL_2_7_API) - int idlen, int *copy) { +SSL_SESSION *tls_session_get_cb(SSL *ssl, const unsigned char *id, int idlen, + int *copy) { auto conn = static_cast(SSL_get_app_data(ssl)); auto handler = static_cast(conn->data); auto worker = handler->get_worker(); @@ -467,7 +467,7 @@ SSL_SESSION *tls_session_get_cb(SSL *ssl, if (conn->tls.cached_session) { if (LOG_ENABLED(INFO)) { LOG(INFO) << "Memcached: found cached session, id=" - << util::format_hex(id, idlen); + << util::format_hex(std::span{id, static_cast(idlen)}); } // This is required, without this, memory leak occurs. @@ -480,14 +480,14 @@ SSL_SESSION *tls_session_get_cb(SSL *ssl, if (LOG_ENABLED(INFO)) { LOG(INFO) << "Memcached: get cached session, id=" - << util::format_hex(id, idlen); + << util::format_hex(std::span{id, static_cast(idlen)}); } auto req = std::make_unique(); req->op = MemcachedOp::GET; - req->key = MEMCACHED_SESSION_CACHE_KEY_PREFIX.str(); + req->key = MEMCACHED_SESSION_CACHE_KEY_PREFIX; req->key += - util::format_hex(balloc, StringRef{id, static_cast(idlen)}); + util::format_hex(balloc, std::span{id, static_cast(idlen)}); req->cb = [conn](MemcachedRequest *, MemcachedResult res) { if (LOG_ENABLED(INFO)) { LOG(INFO) << "Memcached: returned status code " @@ -573,14 +573,14 @@ int ticket_key_cb(SSL *ssl, unsigned char *key_name, unsigned char *iv, EVP_EncryptInit_ex(ctx, get_config()->tls.ticket.cipher, nullptr, key.data.enc_key.data(), iv); #if OPENSSL_3_0_0_API - std::array params{ - OSSL_PARAM_construct_octet_string( - OSSL_MAC_PARAM_KEY, key.data.hmac_key.data(), key.hmac_keylen), - OSSL_PARAM_construct_utf8_string( - OSSL_MAC_PARAM_DIGEST, - const_cast(EVP_MD_get0_name(key.hmac)), 0), - OSSL_PARAM_construct_end(), - }; + auto params = std::to_array({ + OSSL_PARAM_construct_octet_string( + OSSL_MAC_PARAM_KEY, key.data.hmac_key.data(), key.hmac_keylen), + OSSL_PARAM_construct_utf8_string( + OSSL_MAC_PARAM_DIGEST, const_cast(EVP_MD_get0_name(key.hmac)), + 0), + OSSL_PARAM_construct_end(), + }); if (!EVP_MAC_CTX_set_params(hctx, params.data())) { if (LOG_ENABLED(INFO)) { CLOG(INFO, handler) << "EVP_MAC_CTX_set_params failed"; @@ -606,26 +606,26 @@ int ticket_key_cb(SSL *ssl, unsigned char *key_name, unsigned char *iv, if (i == keys.size()) { if (LOG_ENABLED(INFO)) { CLOG(INFO, handler) << "session ticket key " - << util::format_hex(key_name, 16) << " not found"; + << util::format_hex(std::span{key_name, 16}) + << " not found"; } return 0; } if (LOG_ENABLED(INFO)) { CLOG(INFO, handler) << "decrypt session ticket key: " - << util::format_hex(key_name, 16); + << util::format_hex(std::span{key_name, 16}); } auto &key = keys[i]; #if OPENSSL_3_0_0_API - std::array params{ - OSSL_PARAM_construct_octet_string( - OSSL_MAC_PARAM_KEY, key.data.hmac_key.data(), key.hmac_keylen), - OSSL_PARAM_construct_utf8_string( - OSSL_MAC_PARAM_DIGEST, const_cast(EVP_MD_get0_name(key.hmac)), - 0), - OSSL_PARAM_construct_end(), - }; + auto params = std::to_array({ + OSSL_PARAM_construct_octet_string( + OSSL_MAC_PARAM_KEY, key.data.hmac_key.data(), key.hmac_keylen), + OSSL_PARAM_construct_utf8_string( + OSSL_MAC_PARAM_DIGEST, const_cast(EVP_MD_get0_name(key.hmac)), 0), + OSSL_PARAM_construct_end(), + }); if (!EVP_MAC_CTX_set_params(hctx, params.data())) { if (LOG_ENABLED(INFO)) { CLOG(INFO, handler) << "EVP_MAC_CTX_set_params failed"; @@ -676,22 +676,20 @@ void info_callback(const SSL *ssl, int where, int ret) { } } // namespace -#if OPENSSL_VERSION_NUMBER >= 0x10002000L namespace { int alpn_select_proto_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { - // We assume that get_config()->npn_list contains ALPN protocol + // We assume that get_config()->alpn_list contains ALPN protocol // identifier sorted by preference order. So we just break when we // found the first overlap. - for (const auto &target_proto_id : get_config()->tls.npn_list) { + for (const auto &target_proto_id : get_config()->tls.alpn_list) { for (auto p = in, end = in + inlen; p < end;) { auto proto_id = p + 1; auto proto_len = *p; if (proto_id + proto_len <= end && - util::streq(target_proto_id, StringRef{proto_id, proto_len})) { - + target_proto_id == StringRef{proto_id, proto_len}) { *out = reinterpret_cast(proto_id); *outlen = proto_len; @@ -705,17 +703,15 @@ int alpn_select_proto_cb(SSL *ssl, const unsigned char **out, return SSL_TLSEXT_ERR_NOACK; } } // namespace -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L #ifdef ENABLE_HTTP3 -# if OPENSSL_VERSION_NUMBER >= 0x10002000L namespace { int quic_alpn_select_proto_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { constexpr StringRef alpnlist[] = { - StringRef::from_lit("h3"), - StringRef::from_lit("h3-29"), + "h3"_sr, + "h3-29"_sr, }; for (auto &alpn : alpnlist) { @@ -738,16 +734,9 @@ int quic_alpn_select_proto_cb(SSL *ssl, const unsigned char **out, return SSL_TLSEXT_ERR_ALERT_FATAL; } } // namespace -# endif // OPENSSL_VERSION_NUMBER >= 0x10002000L -#endif // ENABLE_HTTP3 - -#if !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L && \ - !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - -# ifndef TLSEXT_TYPE_signed_certificate_timestamp -# define TLSEXT_TYPE_signed_certificate_timestamp 18 -# endif // !TLSEXT_TYPE_signed_certificate_timestamp +#endif // ENABLE_HTTP3 +#ifdef NGHTTP2_GENUINE_OPENSSL namespace { int sct_add_cb(SSL *ssl, unsigned int ext_type, unsigned int context, const unsigned char **out, size_t *outlen, X509 *x, @@ -771,7 +760,7 @@ int sct_add_cb(SSL *ssl, unsigned int ext_type, unsigned int context, auto ssl_ctx = SSL_get_SSL_CTX(ssl); auto tls_ctx_data = - static_cast(SSL_CTX_get_app_data(ssl_ctx)); + static_cast(SSL_CTX_get_app_data(ssl_ctx)); *out = tls_ctx_data->sct_data.data(); *outlen = tls_ctx_data->sct_data.size(); @@ -806,34 +795,7 @@ int sct_parse_cb(SSL *ssl, unsigned int ext_type, unsigned int context, } } // namespace -# if !OPENSSL_1_1_1_API - -namespace { -int legacy_sct_add_cb(SSL *ssl, unsigned int ext_type, - const unsigned char **out, size_t *outlen, int *al, - void *add_arg) { - return sct_add_cb(ssl, ext_type, 0, out, outlen, nullptr, 0, al, add_arg); -} -} // namespace - -namespace { -void legacy_sct_free_cb(SSL *ssl, unsigned int ext_type, - const unsigned char *out, void *add_arg) { - sct_free_cb(ssl, ext_type, 0, out, add_arg); -} -} // namespace - -namespace { -int legacy_sct_parse_cb(SSL *ssl, unsigned int ext_type, - const unsigned char *in, size_t inlen, int *al, - void *parse_arg) { - return sct_parse_cb(ssl, ext_type, 0, in, inlen, nullptr, 0, al, parse_arg); -} -} // namespace - -# endif // !OPENSSL_1_1_1_API -#endif // !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L && - // !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#endif // NGHTTP2_GENUINE_OPENSSL #ifndef OPENSSL_NO_PSK namespace { @@ -896,15 +858,92 @@ unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identity_out, } // namespace #endif // !OPENSSL_NO_PSK +#if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI) +namespace { +int cert_compress(SSL *ssl, CBB *out, const uint8_t *in, size_t in_len) { + uint8_t *dest; + + size_t compressed_size = BrotliEncoderMaxCompressedSize(in_len); + if (compressed_size == 0) { + LOG(ERROR) << "BrotliEncoderMaxCompressedSize failed"; + + return 0; + } + + if (LOG_ENABLED(INFO)) { + LOG(INFO) << "Maximum compressed size is " << compressed_size + << " bytes against input " << in_len << " bytes"; + } + + if (!CBB_reserve(out, &dest, compressed_size)) { + LOG(ERROR) << "CBB_reserve failed"; + + return 0; + } + + if (BrotliEncoderCompress(BROTLI_MAX_QUALITY, BROTLI_DEFAULT_WINDOW, + BROTLI_MODE_GENERIC, in_len, in, &compressed_size, + dest) != BROTLI_TRUE) { + LOG(ERROR) << "BrotliEncoderCompress failed"; + + return 0; + } + + if (LOG_ENABLED(INFO)) { + LOG(INFO) << "BrotliEncoderCompress succeeded, produced " << compressed_size + << " bytes, " << (in_len - compressed_size) * 100 / in_len + << "% reduction"; + } + + if (!CBB_did_write(out, compressed_size)) { + LOG(ERROR) << "CBB_did_write failed"; + + return 0; + } + + return 1; +} + +int cert_decompress(SSL *ssl, CRYPTO_BUFFER **out, size_t uncompressed_len, + const uint8_t *in, size_t in_len) { + uint8_t *dest; + auto buf = CRYPTO_BUFFER_alloc(&dest, uncompressed_len); + auto len = uncompressed_len; + + if (BrotliDecoderDecompress(in_len, in, &len, dest) != + BROTLI_DECODER_RESULT_SUCCESS) { + LOG(ERROR) << "BrotliDecoderDecompress failed"; + + CRYPTO_BUFFER_free(buf); + + return 0; + } + + if (uncompressed_len != len) { + LOG(ERROR) << "Unexpected uncompressed length: expected " + << uncompressed_len << " bytes, actual " << len << " bytes"; + + CRYPTO_BUFFER_free(buf); + + return 0; + } + + *out = buf; + + return 1; +} +} // namespace +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI + struct TLSProtocol { StringRef name; long int mask; }; constexpr TLSProtocol TLS_PROTOS[] = { - TLSProtocol{StringRef::from_lit("TLSv1.2"), SSL_OP_NO_TLSv1_2}, - TLSProtocol{StringRef::from_lit("TLSv1.1"), SSL_OP_NO_TLSv1_1}, - TLSProtocol{StringRef::from_lit("TLSv1.0"), SSL_OP_NO_TLSv1}}; + TLSProtocol{"TLSv1.2"_sr, SSL_OP_NO_TLSv1_2}, + TLSProtocol{"TLSv1.1"_sr, SSL_OP_NO_TLSv1_1}, + TLSProtocol{"TLSv1.0"_sr, SSL_OP_NO_TLSv1}}; long int create_tls_proto_mask(const std::vector &tls_proto_list) { long int res = 0; @@ -942,7 +981,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | SSL_OP_SINGLE_ECDH_USE | SSL_OP_SINGLE_DH_USE | SSL_OP_CIPHER_SERVER_PREFERENCE -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#ifdef NGHTTP2_GENUINE_OPENSSL // The reason for disabling built-in anti-replay in // OpenSSL is that it only works if client gets back // to the same server. The freshness check @@ -950,8 +989,8 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, // https://tools.ietf.org/html/rfc8446#section-8.3 // is still performed. | SSL_OP_NO_ANTI_REPLAY -#endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - ; +#endif // NGHTTP2_GENUINE_OPENSSL + ; auto config = mod_config(); auto &tlsconf = config->tls; @@ -965,7 +1004,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, SSL_CTX_set_options(ssl_ctx, ssl_opts | tlsconf.tls_proto_mask); if (nghttp2::tls::ssl_ctx_set_proto_versions( - ssl_ctx, tlsconf.min_proto_version, tlsconf.max_proto_version) != 0) { + ssl_ctx, tlsconf.min_proto_version, tlsconf.max_proto_version) != 0) { LOG(FATAL) << "Could not set TLS protocol version"; DIE(); } @@ -981,49 +1020,33 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, SSL_CTX_set_timeout(ssl_ctx, tlsconf.session_timeout.count()); - if (SSL_CTX_set_cipher_list(ssl_ctx, tlsconf.ciphers.c_str()) == 0) { + if (SSL_CTX_set_cipher_list(ssl_ctx, tlsconf.ciphers.data()) == 0) { LOG(FATAL) << "SSL_CTX_set_cipher_list " << tlsconf.ciphers << " failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - if (SSL_CTX_set_ciphersuites(ssl_ctx, tlsconf.tls13_ciphers.c_str()) == 0) { +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) || defined(NGHTTP2_OPENSSL_IS_WOLFSSL) + if (SSL_CTX_set_ciphersuites(ssl_ctx, tlsconf.tls13_ciphers.data()) == 0) { LOG(FATAL) << "SSL_CTX_set_ciphersuites " << tlsconf.tls13_ciphers << " failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -#endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_LIBRESSL || + // NGHTTP2_OPENSSL_IS_WOLFSSL #ifndef OPENSSL_NO_EC -# if !LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L - if (SSL_CTX_set1_curves_list(ssl_ctx, tlsconf.ecdh_curves.c_str()) != 1) { + if (SSL_CTX_set1_curves_list(ssl_ctx, tlsconf.ecdh_curves.data()) != 1) { LOG(FATAL) << "SSL_CTX_set1_curves_list " << tlsconf.ecdh_curves << " failed"; DIE(); } -# if !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API - // It looks like we need this function call for OpenSSL 1.0.2. This - // function was deprecated in OpenSSL 1.1.0 and BoringSSL. - SSL_CTX_set_ecdh_auto(ssl_ctx, 1); -# endif // !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API -# else // LIBRESSL_LEGACY_API || OPENSSL_VERSION_NUBMER < 0x10002000L - // Use P-256, which is sufficiently secure at the time of this - // writing. - auto ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); - if (ecdh == nullptr) { - LOG(FATAL) << "EC_KEY_new_by_curv_name failed: " - << ERR_error_string(ERR_get_error(), nullptr); - DIE(); - } - SSL_CTX_set_tmp_ecdh(ssl_ctx, ecdh); - EC_KEY_free(ecdh); -# endif // LIBRESSL_LEGACY_API || OPENSSL_VERSION_NUBMER < 0x10002000L -#endif // OPENSSL_NO_EC +#endif // OPENSSL_NO_EC if (!tlsconf.dh_param_file.empty()) { // Read DH parameters from file - auto bio = BIO_new_file(tlsconf.dh_param_file.c_str(), "rb"); + auto bio = BIO_new_file(tlsconf.dh_param_file.data(), "rb"); if (bio == nullptr) { LOG(FATAL) << "BIO_new_file() failed: " << ERR_error_string(ERR_get_error(), nullptr); @@ -1032,8 +1055,8 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, #if OPENSSL_3_0_0_API EVP_PKEY *dh = nullptr; auto dctx = OSSL_DECODER_CTX_new_for_pkey( - &dh, "PEM", nullptr, "DH", OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS, - nullptr, nullptr); + &dh, "PEM", nullptr, "DH", OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS, nullptr, + nullptr); if (!OSSL_DECODER_from_bio(dctx, bio)) { LOG(FATAL) << "OSSL_DECODER_from_bio() failed: " @@ -1067,7 +1090,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, } if (!tlsconf.cacert.empty()) { - if (SSL_CTX_load_verify_locations(ssl_ctx, tlsconf.cacert.c_str(), + if (SSL_CTX_load_verify_locations(ssl_ctx, tlsconf.cacert.data(), nullptr) != 1) { LOG(FATAL) << "Could not load trusted ca certificates from " << tlsconf.cacert << ": " @@ -1110,8 +1133,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, if (tlsconf.client_verify.enabled) { if (!tlsconf.client_verify.cacert.empty()) { if (SSL_CTX_load_verify_locations( - ssl_ctx, tlsconf.client_verify.cacert.c_str(), nullptr) != 1) { - + ssl_ctx, tlsconf.client_verify.cacert.data(), nullptr) != 1) { LOG(FATAL) << "Could not load trusted ca certificates from " << tlsconf.client_verify.cacert << ": " << ERR_error_string(ERR_get_error(), nullptr); @@ -1121,7 +1143,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, // error even though it returns success. See // http://forum.nginx.org/read.php?29,242540 ERR_clear_error(); - auto list = SSL_load_client_CA_file(tlsconf.client_verify.cacert.c_str()); + auto list = SSL_load_client_CA_file(tlsconf.client_verify.cacert.data()); if (!list) { LOG(FATAL) << "Could not load ca certificates from " << tlsconf.client_verify.cacert << ": " @@ -1132,7 +1154,7 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, } SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE | - SSL_VERIFY_FAIL_IF_NO_PEER_CERT, + SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_callback); } SSL_CTX_set_tlsext_servername_callback(ssl_ctx, servername_callback); @@ -1150,14 +1172,8 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, SSL_CTX_set_early_data_enabled(ssl_ctx, 1); #endif // NGHTTP2_OPENSSL_IS_BORINGSSL - // NPN advertisement -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, nullptr); -#endif // !OPENSSL_NO_NEXTPROTONEG -#if OPENSSL_VERSION_NUMBER >= 0x10002000L // ALPN selection callback SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, nullptr); -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L auto tls_ctx_data = new TLSContextData(); tls_ctx_data->cert_file = cert_file; @@ -1165,61 +1181,67 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, SSL_CTX_set_app_data(ssl_ctx, tls_ctx_data); -#if !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L && \ - !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#ifdef NGHTTP2_GENUINE_OPENSSL // SSL_extension_supported(TLSEXT_TYPE_signed_certificate_timestamp) // returns 1, which means OpenSSL internally handles it. But // OpenSSL handles signed_certificate_timestamp extension specially, // and it lets custom handler to process the extension. if (!sct_data.empty()) { -# if OPENSSL_1_1_1_API // It is not entirely clear to me that SSL_EXT_CLIENT_HELLO is // required here. sct_parse_cb is called without // SSL_EXT_CLIENT_HELLO being set. But the passed context value // is SSL_EXT_CLIENT_HELLO. if (SSL_CTX_add_custom_ext( - ssl_ctx, TLSEXT_TYPE_signed_certificate_timestamp, - SSL_EXT_CLIENT_HELLO | SSL_EXT_TLS1_2_SERVER_HELLO | - SSL_EXT_TLS1_3_CERTIFICATE | SSL_EXT_IGNORE_ON_RESUMPTION, - sct_add_cb, sct_free_cb, nullptr, sct_parse_cb, nullptr) != 1) { + ssl_ctx, TLSEXT_TYPE_signed_certificate_timestamp, + SSL_EXT_CLIENT_HELLO | SSL_EXT_TLS1_2_SERVER_HELLO | + SSL_EXT_TLS1_3_CERTIFICATE | SSL_EXT_IGNORE_ON_RESUMPTION, + sct_add_cb, sct_free_cb, nullptr, sct_parse_cb, nullptr) != 1) { LOG(FATAL) << "SSL_CTX_add_custom_ext failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -# else // !OPENSSL_1_1_1_API - if (SSL_CTX_add_server_custom_ext( - ssl_ctx, TLSEXT_TYPE_signed_certificate_timestamp, - legacy_sct_add_cb, legacy_sct_free_cb, nullptr, legacy_sct_parse_cb, - nullptr) != 1) { - LOG(FATAL) << "SSL_CTX_add_server_custom_ext failed: " - << ERR_error_string(ERR_get_error(), nullptr); - DIE(); - } -# endif // !OPENSSL_1_1_1_API } #elif defined(NGHTTP2_OPENSSL_IS_BORINGSSL) if (!tls_ctx_data->sct_data.empty() && SSL_CTX_set_signed_cert_timestamp_list( - ssl_ctx, tls_ctx_data->sct_data.data(), - tls_ctx_data->sct_data.size()) != 1) { + ssl_ctx, tls_ctx_data->sct_data.data(), + tls_ctx_data->sct_data.size()) != 1) { LOG(FATAL) << "SSL_CTX_set_signed_cert_timestamp_list failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -#endif // defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + (defined(NGHTTP2_OPENSSL_IS_WOLFSSL) && defined(WOLFSSL_EARLY_DATA)) if (SSL_CTX_set_max_early_data(ssl_ctx, tlsconf.max_early_data) != 1) { LOG(FATAL) << "SSL_CTX_set_max_early_data failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -#endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#endif // NGHTTP2_GENUINE_OPENSSL || (NGHTTP2_OPENSSL_IS_WOLFSSL && + // WOLFSSL_EARLY_DATA) +#ifdef NGHTTP2_GENUINE_OPENSSL + if (SSL_CTX_set_recv_max_early_data(ssl_ctx, tlsconf.max_early_data) != 1) { + LOG(FATAL) << "SSL_CTX_set_recv_max_early_data failed: " + << ERR_error_string(ERR_get_error(), nullptr); + DIE(); + } +#endif // NGHTTP2_GENUINE_OPENSSL #ifndef OPENSSL_NO_PSK SSL_CTX_set_psk_server_callback(ssl_ctx, psk_server_cb); #endif // !LIBRESSL_NO_PSK +#if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI) + if (!SSL_CTX_add_cert_compression_alg( + ssl_ctx, nghttp2::tls::CERTIFICATE_COMPRESSION_ALGO_BROTLI, + cert_compress, cert_decompress)) { + LOG(FATAL) << "SSL_CTX_add_cert_compression_alg failed"; + DIE(); + } +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI + return ssl_ctx; } @@ -1239,19 +1261,19 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, } constexpr auto ssl_opts = - (SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS) | - SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | SSL_OP_SINGLE_ECDH_USE | - SSL_OP_SINGLE_DH_USE | - SSL_OP_CIPHER_SERVER_PREFERENCE -# if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - // The reason for disabling built-in anti-replay in OpenSSL is - // that it only works if client gets back to the same server. - // The freshness check described in - // https://tools.ietf.org/html/rfc8446#section-8.3 is still - // performed. - | SSL_OP_NO_ANTI_REPLAY -# endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - ; + (SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS) | + SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | SSL_OP_SINGLE_ECDH_USE | + SSL_OP_SINGLE_DH_USE | + SSL_OP_CIPHER_SERVER_PREFERENCE +# ifdef NGHTTP2_GENUINE_OPENSSL + // The reason for disabling built-in anti-replay in OpenSSL is + // that it only works if client gets back to the same server. + // The freshness check described in + // https://tools.ietf.org/html/rfc8446#section-8.3 is still + // performed. + | SSL_OP_NO_ANTI_REPLAY +# endif // NGHTTP2_GENUINE_OPENSSL + ; auto config = mod_config(); auto &tlsconf = config->tls; @@ -1270,6 +1292,12 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, DIE(); } # endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL +# ifdef HAVE_LIBNGTCP2_CRYPTO_WOLFSSL + if (ngtcp2_crypto_wolfssl_configure_server_context(ssl_ctx) != 0) { + LOG(FATAL) << "ngtcp2_crypto_wolfssl_configure_server_context failed"; + DIE(); + } +# endif // HAVE_LIBNGTCP2_CRYPTO_WOLFSSL const unsigned char sid_ctx[] = "shrpx"; SSL_CTX_set_session_id_context(ssl_ctx, sid_ctx, sizeof(sid_ctx) - 1); @@ -1277,49 +1305,34 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, SSL_CTX_set_timeout(ssl_ctx, tlsconf.session_timeout.count()); - if (SSL_CTX_set_cipher_list(ssl_ctx, tlsconf.ciphers.c_str()) == 0) { + if (SSL_CTX_set_cipher_list(ssl_ctx, tlsconf.ciphers.data()) == 0) { LOG(FATAL) << "SSL_CTX_set_cipher_list " << tlsconf.ciphers << " failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -# if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - if (SSL_CTX_set_ciphersuites(ssl_ctx, tlsconf.tls13_ciphers.c_str()) == 0) { +# if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) || \ + defined(NGHTTP2_OPENSSL_IS_WOLFSSL) + if (SSL_CTX_set_ciphersuites(ssl_ctx, tlsconf.tls13_ciphers.data()) == 0) { LOG(FATAL) << "SSL_CTX_set_ciphersuites " << tlsconf.tls13_ciphers << " failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -# endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +# endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_LIBRESSL || + // NGHTTP2_OPENSSL_IS_WOLFSSL # ifndef OPENSSL_NO_EC -# if !LIBRESSL_LEGACY_API && OPENSSL_VERSION_NUMBER >= 0x10002000L - if (SSL_CTX_set1_curves_list(ssl_ctx, tlsconf.ecdh_curves.c_str()) != 1) { + if (SSL_CTX_set1_curves_list(ssl_ctx, tlsconf.ecdh_curves.data()) != 1) { LOG(FATAL) << "SSL_CTX_set1_curves_list " << tlsconf.ecdh_curves << " failed"; DIE(); } -# if !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API - // It looks like we need this function call for OpenSSL 1.0.2. This - // function was deprecated in OpenSSL 1.1.0 and BoringSSL. - SSL_CTX_set_ecdh_auto(ssl_ctx, 1); -# endif // !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && !OPENSSL_1_1_API -# else // LIBRESSL_LEGACY_API || OPENSSL_VERSION_NUBMER < 0x10002000L - // Use P-256, which is sufficiently secure at the time of this - // writing. - auto ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); - if (ecdh == nullptr) { - LOG(FATAL) << "EC_KEY_new_by_curv_name failed: " - << ERR_error_string(ERR_get_error(), nullptr); - DIE(); - } - SSL_CTX_set_tmp_ecdh(ssl_ctx, ecdh); - EC_KEY_free(ecdh); -# endif // LIBRESSL_LEGACY_API || OPENSSL_VERSION_NUBMER < 0x10002000L -# endif // OPENSSL_NO_EC +# endif // OPENSSL_NO_EC if (!tlsconf.dh_param_file.empty()) { // Read DH parameters from file - auto bio = BIO_new_file(tlsconf.dh_param_file.c_str(), "rb"); + auto bio = BIO_new_file(tlsconf.dh_param_file.data(), "rb"); if (bio == nullptr) { LOG(FATAL) << "BIO_new_file() failed: " << ERR_error_string(ERR_get_error(), nullptr); @@ -1328,8 +1341,8 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, # if OPENSSL_3_0_0_API EVP_PKEY *dh = nullptr; auto dctx = OSSL_DECODER_CTX_new_for_pkey( - &dh, "PEM", nullptr, "DH", OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS, - nullptr, nullptr); + &dh, "PEM", nullptr, "DH", OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS, nullptr, + nullptr); if (!OSSL_DECODER_from_bio(dctx, bio)) { LOG(FATAL) << "OSSL_DECODER_from_bio() failed: " @@ -1363,7 +1376,7 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, } if (!tlsconf.cacert.empty()) { - if (SSL_CTX_load_verify_locations(ssl_ctx, tlsconf.cacert.c_str(), + if (SSL_CTX_load_verify_locations(ssl_ctx, tlsconf.cacert.data(), nullptr) != 1) { LOG(FATAL) << "Could not load trusted ca certificates from " << tlsconf.cacert << ": " @@ -1406,8 +1419,7 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, if (tlsconf.client_verify.enabled) { if (!tlsconf.client_verify.cacert.empty()) { if (SSL_CTX_load_verify_locations( - ssl_ctx, tlsconf.client_verify.cacert.c_str(), nullptr) != 1) { - + ssl_ctx, tlsconf.client_verify.cacert.data(), nullptr) != 1) { LOG(FATAL) << "Could not load trusted ca certificates from " << tlsconf.client_verify.cacert << ": " << ERR_error_string(ERR_get_error(), nullptr); @@ -1417,7 +1429,7 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, // error even though it returns success. See // http://forum.nginx.org/read.php?29,242540 ERR_clear_error(); - auto list = SSL_load_client_CA_file(tlsconf.client_verify.cacert.c_str()); + auto list = SSL_load_client_CA_file(tlsconf.client_verify.cacert.data()); if (!list) { LOG(FATAL) << "Could not load ca certificates from " << tlsconf.client_verify.cacert << ": " @@ -1428,7 +1440,7 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, } SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE | - SSL_VERIFY_FAIL_IF_NO_PEER_CERT, + SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_callback); } SSL_CTX_set_tlsext_servername_callback(ssl_ctx, servername_callback); @@ -1441,10 +1453,8 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, SSL_CTX_set_tlsext_status_cb(ssl_ctx, ocsp_resp_cb); # endif // NGHTTP2_OPENSSL_IS_BORINGSSL -# if OPENSSL_VERSION_NUMBER >= 0x10002000L // ALPN selection callback SSL_CTX_set_alpn_select_cb(ssl_ctx, quic_alpn_select_proto_cb, nullptr); -# endif // OPENSSL_VERSION_NUMBER >= 0x10002000L auto tls_ctx_data = new TLSContextData(); tls_ctx_data->cert_file = cert_file; @@ -1452,50 +1462,39 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, SSL_CTX_set_app_data(ssl_ctx, tls_ctx_data); -# if !LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L && \ - !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +# ifdef NGHTTP2_GENUINE_OPENSSL // SSL_extension_supported(TLSEXT_TYPE_signed_certificate_timestamp) // returns 1, which means OpenSSL internally handles it. But // OpenSSL handles signed_certificate_timestamp extension specially, // and it lets custom handler to process the extension. if (!sct_data.empty()) { -# if OPENSSL_1_1_1_API // It is not entirely clear to me that SSL_EXT_CLIENT_HELLO is // required here. sct_parse_cb is called without // SSL_EXT_CLIENT_HELLO being set. But the passed context value // is SSL_EXT_CLIENT_HELLO. if (SSL_CTX_add_custom_ext( - ssl_ctx, TLSEXT_TYPE_signed_certificate_timestamp, - SSL_EXT_CLIENT_HELLO | SSL_EXT_TLS1_2_SERVER_HELLO | - SSL_EXT_TLS1_3_CERTIFICATE | SSL_EXT_IGNORE_ON_RESUMPTION, - sct_add_cb, sct_free_cb, nullptr, sct_parse_cb, nullptr) != 1) { + ssl_ctx, TLSEXT_TYPE_signed_certificate_timestamp, + SSL_EXT_CLIENT_HELLO | SSL_EXT_TLS1_2_SERVER_HELLO | + SSL_EXT_TLS1_3_CERTIFICATE | SSL_EXT_IGNORE_ON_RESUMPTION, + sct_add_cb, sct_free_cb, nullptr, sct_parse_cb, nullptr) != 1) { LOG(FATAL) << "SSL_CTX_add_custom_ext failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -# else // !OPENSSL_1_1_1_API - if (SSL_CTX_add_server_custom_ext( - ssl_ctx, TLSEXT_TYPE_signed_certificate_timestamp, - legacy_sct_add_cb, legacy_sct_free_cb, nullptr, legacy_sct_parse_cb, - nullptr) != 1) { - LOG(FATAL) << "SSL_CTX_add_server_custom_ext failed: " - << ERR_error_string(ERR_get_error(), nullptr); - DIE(); - } -# endif // !OPENSSL_1_1_1_API } # elif defined(NGHTTP2_OPENSSL_IS_BORINGSSL) if (!tls_ctx_data->sct_data.empty() && SSL_CTX_set_signed_cert_timestamp_list( - ssl_ctx, tls_ctx_data->sct_data.data(), - tls_ctx_data->sct_data.size()) != 1) { + ssl_ctx, tls_ctx_data->sct_data.data(), + tls_ctx_data->sct_data.size()) != 1) { LOG(FATAL) << "SSL_CTX_set_signed_cert_timestamp_list failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -# endif // defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +# endif // NGHTTP2_OPENSSL_IS_BORINGSSL -# if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +# if defined(NGHTTP2_GENUINE_OPENSSL) || \ + (defined(NGHTTP2_OPENSSL_IS_WOLFSSL) && defined(WOLFSSL_EARLY_DATA)) auto &quicconf = config->quic; if (quicconf.upstream.early_data && @@ -1505,72 +1504,32 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file, << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -# endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +# endif // NGHTTP2_GENUINE_OPENSSL || (NGHTTP2_OPENSSL_IS_WOLFSSL && + // WOLFSSL_EARLY_DATA) # ifndef OPENSSL_NO_PSK SSL_CTX_set_psk_server_callback(ssl_ctx, psk_server_cb); # endif // !LIBRESSL_NO_PSK - return ssl_ctx; -} -#endif // ENABLE_HTTP3 - -namespace { -int select_h2_next_proto_cb(SSL *ssl, unsigned char **out, - unsigned char *outlen, const unsigned char *in, - unsigned int inlen, void *arg) { - if (!util::select_h2(const_cast(out), outlen, in, - inlen)) { - return SSL_TLSEXT_ERR_NOACK; - } - - return SSL_TLSEXT_ERR_OK; -} -} // namespace - -namespace { -int select_h1_next_proto_cb(SSL *ssl, unsigned char **out, - unsigned char *outlen, const unsigned char *in, - unsigned int inlen, void *arg) { - auto end = in + inlen; - for (; in < end;) { - if (util::streq(NGHTTP2_H1_1_ALPN, StringRef{in, in + (in[0] + 1)})) { - *out = const_cast(in) + 1; - *outlen = in[0]; - return SSL_TLSEXT_ERR_OK; - } - in += in[0] + 1; +# if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI) + if (!SSL_CTX_add_cert_compression_alg( + ssl_ctx, nghttp2::tls::CERTIFICATE_COMPRESSION_ALGO_BROTLI, + cert_compress, cert_decompress)) { + LOG(FATAL) << "SSL_CTX_add_cert_compression_alg failed"; + DIE(); } +# endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI - return SSL_TLSEXT_ERR_NOACK; -} -} // namespace - -namespace { -int select_next_proto_cb(SSL *ssl, unsigned char **out, unsigned char *outlen, - const unsigned char *in, unsigned int inlen, - void *arg) { - auto conn = static_cast(SSL_get_app_data(ssl)); - switch (conn->proto) { - case Proto::HTTP1: - return select_h1_next_proto_cb(ssl, out, outlen, in, inlen, arg); - case Proto::HTTP2: - return select_h2_next_proto_cb(ssl, out, outlen, in, inlen, arg); - default: - return SSL_TLSEXT_ERR_NOACK; - } + return ssl_ctx; } -} // namespace +#endif // ENABLE_HTTP3 SSL_CTX *create_ssl_client_context( #ifdef HAVE_NEVERBLEED - neverbleed_t *nb, + neverbleed_t *nb, #endif // HAVE_NEVERBLEED - const StringRef &cacert, const StringRef &cert_file, - const StringRef &private_key_file, - int (*next_proto_select_cb)(SSL *s, unsigned char **out, - unsigned char *outlen, const unsigned char *in, - unsigned int inlen, void *arg)) { + const StringRef &cacert, const StringRef &cert_file, + const StringRef &private_key_file) { auto ssl_ctx = SSL_CTX_new(TLS_client_method()); if (!ssl_ctx) { LOG(FATAL) << ERR_error_string(ERR_get_error(), nullptr); @@ -1592,29 +1551,31 @@ SSL_CTX *create_ssl_client_context( SSL_CTX_set_options(ssl_ctx, ssl_opts | tlsconf.tls_proto_mask); SSL_CTX_set_session_cache_mode(ssl_ctx, SSL_SESS_CACHE_CLIENT | - SSL_SESS_CACHE_NO_INTERNAL_STORE); + SSL_SESS_CACHE_NO_INTERNAL_STORE); SSL_CTX_sess_set_new_cb(ssl_ctx, tls_session_client_new_cb); if (nghttp2::tls::ssl_ctx_set_proto_versions( - ssl_ctx, tlsconf.min_proto_version, tlsconf.max_proto_version) != 0) { + ssl_ctx, tlsconf.min_proto_version, tlsconf.max_proto_version) != 0) { LOG(FATAL) << "Could not set TLS protocol version"; DIE(); } - if (SSL_CTX_set_cipher_list(ssl_ctx, tlsconf.client.ciphers.c_str()) == 0) { + if (SSL_CTX_set_cipher_list(ssl_ctx, tlsconf.client.ciphers.data()) == 0) { LOG(FATAL) << "SSL_CTX_set_cipher_list " << tlsconf.client.ciphers << " failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - if (SSL_CTX_set_ciphersuites(ssl_ctx, tlsconf.client.tls13_ciphers.c_str()) == +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) || defined(NGHTTP2_OPENSSL_IS_WOLFSSL) + if (SSL_CTX_set_ciphersuites(ssl_ctx, tlsconf.client.tls13_ciphers.data()) == 0) { LOG(FATAL) << "SSL_CTX_set_ciphersuites " << tlsconf.client.tls13_ciphers << " failed: " << ERR_error_string(ERR_get_error(), nullptr); DIE(); } -#endif // OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#endif // NGHTTP2_GENUINE_OPENSSL || NGHTTP2_OPENSSL_IS_LIBRESSL || + // NGHTTP2_OPENSSL_IS_WOLFSSL SSL_CTX_set_mode(ssl_ctx, SSL_MODE_RELEASE_BUFFERS); @@ -1624,8 +1585,7 @@ SSL_CTX *create_ssl_client_context( } if (!cacert.empty()) { - if (SSL_CTX_load_verify_locations(ssl_ctx, cacert.c_str(), nullptr) != 1) { - + if (SSL_CTX_load_verify_locations(ssl_ctx, cacert.data(), nullptr) != 1) { LOG(FATAL) << "Could not load trusted ca certificates from " << cacert << ": " << ERR_error_string(ERR_get_error(), nullptr); DIE(); @@ -1637,8 +1597,7 @@ SSL_CTX *create_ssl_client_context( } if (!cert_file.empty()) { - if (SSL_CTX_use_certificate_chain_file(ssl_ctx, cert_file.c_str()) != 1) { - + if (SSL_CTX_use_certificate_chain_file(ssl_ctx, cert_file.data()) != 1) { LOG(FATAL) << "Could not load client certificate from " << cert_file << ": " << ERR_error_string(ERR_get_error(), nullptr); DIE(); @@ -1647,7 +1606,7 @@ SSL_CTX *create_ssl_client_context( if (!private_key_file.empty()) { #ifndef HAVE_NEVERBLEED - if (SSL_CTX_use_PrivateKey_file(ssl_ctx, private_key_file.c_str(), + if (SSL_CTX_use_PrivateKey_file(ssl_ctx, private_key_file.data(), SSL_FILETYPE_PEM) != 1) { LOG(FATAL) << "Could not load client private key from " << private_key_file << ": " @@ -1656,7 +1615,7 @@ SSL_CTX *create_ssl_client_context( } #else // HAVE_NEVERBLEED std::array errbuf; - if (neverbleed_load_private_key_file(nb, ssl_ctx, private_key_file.c_str(), + if (neverbleed_load_private_key_file(nb, ssl_ctx, private_key_file.data(), errbuf.data()) != 1) { LOG(FATAL) << "neverbleed_load_private_key_file: could not load client " "private key from " @@ -1670,11 +1629,14 @@ SSL_CTX *create_ssl_client_context( SSL_CTX_set_psk_client_callback(ssl_ctx, psk_client_cb); #endif // !OPENSSL_NO_PSK - // NPN selection callback. This is required to set SSL_CTX because - // OpenSSL does not offer SSL_set_next_proto_select_cb. -#ifndef OPENSSL_NO_NEXTPROTONEG - SSL_CTX_set_next_proto_select_cb(ssl_ctx, next_proto_select_cb, nullptr); -#endif // !OPENSSL_NO_NEXTPROTONEG +#if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI) + if (!SSL_CTX_add_cert_compression_alg( + ssl_ctx, nghttp2::tls::CERTIFICATE_COMPRESSION_ALGO_BROTLI, + cert_compress, cert_decompress)) { + LOG(FATAL) << "SSL_CTX_add_cert_compression_alg failed"; + DIE(); + } +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI return ssl_ctx; } @@ -1748,8 +1710,8 @@ bool tls_hostname_match(const StringRef &pattern, const StringRef &hostname) { // character is embedded within an A-label. if (ptLeftLabelEnd == std::end(pattern) || std::find(ptLeftLabelEnd + 1, std::end(pattern), '.') == - std::end(pattern) || - ptLeftLabelEnd < ptWildcard || util::istarts_with_l(pattern, "xn--")) { + std::end(pattern) || + ptLeftLabelEnd < ptWildcard || util::istarts_with(pattern, "xn--"_sr)) { wildcardEnabled = false; } @@ -1758,7 +1720,7 @@ bool tls_hostname_match(const StringRef &pattern, const StringRef &hostname) { } auto hnLeftLabelEnd = - std::find(std::begin(hostname), std::end(hostname), '.'); + std::find(std::begin(hostname), std::end(hostname), '.'); if (hnLeftLabelEnd == std::end(hostname) || !util::strieq(StringRef{ptLeftLabelEnd, std::end(pattern)}, StringRef{hnLeftLabelEnd, std::end(hostname)})) { @@ -1832,7 +1794,7 @@ int verify_numeric_hostname(X509 *cert, const StringRef &hostname, } auto altnames = static_cast( - X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr)); + X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr)); if (altnames) { auto altnames_deleter = defer(GENERAL_NAMES_free, altnames); size_t n = sk_GENERAL_NAME_num(altnames); @@ -1866,8 +1828,8 @@ int verify_numeric_hostname(X509 *cert, const StringRef &hostname, } // cn is not NULL terminated - auto rv = util::streq(hostname, cn); - OPENSSL_free(const_cast(cn.c_str())); + auto rv = hostname == cn; + OPENSSL_free(const_cast(cn.data())); if (rv) { return 0; @@ -1878,7 +1840,7 @@ int verify_numeric_hostname(X509 *cert, const StringRef &hostname, int verify_dns_hostname(X509 *cert, const StringRef &hostname) { auto altnames = static_cast( - X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr)); + X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr)); if (altnames) { auto dns_found = false; auto altnames_deleter = defer(GENERAL_NAMES_free, altnames); @@ -1932,15 +1894,15 @@ int verify_dns_hostname(X509 *cert, const StringRef &hostname) { if (cn[cn.size() - 1] == '.') { if (cn.size() == 1) { - OPENSSL_free(const_cast(cn.c_str())); + OPENSSL_free(const_cast(cn.data())); return -1; } - cn = StringRef{cn.c_str(), cn.size() - 1}; + cn = StringRef{cn.data(), cn.size() - 1}; } auto rv = tls_hostname_match(cn, hostname); - OPENSSL_free(const_cast(cn.c_str())); + OPENSSL_free(const_cast(cn.data())); return rv ? 0 : -1; } @@ -1948,7 +1910,7 @@ int verify_dns_hostname(X509 *cert, const StringRef &hostname) { namespace { int verify_hostname(X509 *cert, const StringRef &hostname, const Address *addr) { - if (util::numeric_host(hostname.c_str())) { + if (util::numeric_host(hostname.data())) { return verify_numeric_hostname(cert, hostname, addr); } @@ -1981,14 +1943,14 @@ int check_cert(SSL *ssl, const Address *addr, const StringRef &host) { int check_cert(SSL *ssl, const DownstreamAddr *addr, const Address *raddr) { auto hostname = - addr->sni.empty() ? StringRef{addr->host} : StringRef{addr->sni}; + addr->sni.empty() ? StringRef{addr->host} : StringRef{addr->sni}; return check_cert(ssl, raddr, hostname); } CertLookupTree::CertLookupTree() {} ssize_t CertLookupTree::add_cert(const StringRef &hostname, size_t idx) { - std::array buf; + std::array buf; // NI_MAXHOST includes terminal NULL byte if (hostname.empty() || hostname.size() + 1 > buf.size()) { @@ -2001,10 +1963,10 @@ ssize_t CertLookupTree::add_cert(const StringRef &hostname, size_t idx) { auto wildcard_prefix = StringRef{std::begin(hostname), wildcard_it}; auto wildcard_suffix = StringRef{wildcard_it + 1, std::end(hostname)}; - auto rev_suffix = StringRef{std::begin(buf), - std::reverse_copy(std::begin(wildcard_suffix), - std::end(wildcard_suffix), - std::begin(buf))}; + auto rev_suffix = + StringRef{std::begin(buf), + std::reverse_copy(std::begin(wildcard_suffix), + std::end(wildcard_suffix), std::begin(buf))}; WildcardPattern *wpat; @@ -2020,10 +1982,10 @@ ssize_t CertLookupTree::add_cert(const StringRef &hostname, size_t idx) { wpat = &wildcard_patterns_.back(); } - auto rev_prefix = StringRef{std::begin(buf), - std::reverse_copy(std::begin(wildcard_prefix), - std::end(wildcard_prefix), - std::begin(buf))}; + auto rev_prefix = + StringRef{std::begin(buf), + std::reverse_copy(std::begin(wildcard_prefix), + std::end(wildcard_prefix), std::begin(buf))}; for (auto &p : wpat->rev_prefix) { if (p.prefix == rev_prefix) { @@ -2040,7 +2002,7 @@ ssize_t CertLookupTree::add_cert(const StringRef &hostname, size_t idx) { } ssize_t CertLookupTree::lookup(const StringRef &hostname) { - std::array buf; + std::array buf; // NI_MAXHOST includes terminal NULL byte if (hostname.empty() || hostname.size() + 1 > buf.size()) { @@ -2062,14 +2024,14 @@ ssize_t CertLookupTree::lookup(const StringRef &hostname) { const RNode *last_node = nullptr; auto rev_host = StringRef{ - std::begin(buf), std::reverse_copy(std::begin(hostname), - std::end(hostname), std::begin(buf))}; + std::begin(buf), std::reverse_copy(std::begin(hostname), std::end(hostname), + std::begin(buf))}; for (;;) { size_t nread = 0; auto wcidx = - rev_wildcard_router_.match_prefix(&nread, &last_node, rev_host); + rev_wildcard_router_.match_prefix(&nread, &last_node, rev_host); if (wcidx == -1) { return best_idx; } @@ -2089,9 +2051,7 @@ ssize_t CertLookupTree::lookup(const StringRef &hostname) { continue; } - auto prefixlen = - wprefix.prefix.size() + - (reinterpret_cast(&rev_host[0]) - &buf[0]); + auto prefixlen = wprefix.prefix.size() + (&rev_host[0] - &buf[0]); // Breaking a tie with longer suffix if (prefixlen < best_prefixlen) { @@ -2112,22 +2072,13 @@ void CertLookupTree::dump() const { } int cert_lookup_tree_add_ssl_ctx( - CertLookupTree *lt, std::vector> &indexed_ssl_ctx, - SSL_CTX *ssl_ctx) { - std::array buf; + CertLookupTree *lt, std::vector> &indexed_ssl_ctx, + SSL_CTX *ssl_ctx) { + std::array buf; -#if LIBRESSL_2_7_API || \ - (!LIBRESSL_IN_USE && OPENSSL_VERSION_NUMBER >= 0x10002000L) auto cert = SSL_CTX_get0_certificate(ssl_ctx); -#else // !LIBRESSL_2_7_API && OPENSSL_VERSION_NUMBER < 0x10002000L - auto tls_ctx_data = - static_cast(SSL_CTX_get_app_data(ssl_ctx)); - auto cert = load_certificate(tls_ctx_data->cert_file); - auto cert_deleter = defer(X509_free, cert); -#endif // !LIBRESSL_2_7_API && OPENSSL_VERSION_NUMBER < 0x10002000L - auto altnames = static_cast( - X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr)); + X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr)); if (altnames) { auto altnames_deleter = defer(GENERAL_NAMES_free, altnames); size_t n = sk_GENERAL_NAME_num(altnames); @@ -2195,22 +2146,22 @@ int cert_lookup_tree_add_ssl_ctx( if (cn[cn.size() - 1] == '.') { if (cn.size() == 1) { - OPENSSL_free(const_cast(cn.c_str())); + OPENSSL_free(const_cast(cn.data())); return 0; } - cn = StringRef{cn.c_str(), cn.size() - 1}; + cn = StringRef{cn.data(), cn.size() - 1}; } auto end_buf = std::copy(std::begin(cn), std::end(cn), std::begin(buf)); - OPENSSL_free(const_cast(cn.c_str())); + OPENSSL_free(const_cast(cn.data())); util::inp_strlower(std::begin(buf), end_buf); auto idx = - lt->add_cert(StringRef{std::begin(buf), end_buf}, indexed_ssl_ctx.size()); + lt->add_cert(StringRef{std::begin(buf), end_buf}, indexed_ssl_ctx.size()); if (idx == -1) { return 0; } @@ -2228,7 +2179,7 @@ int cert_lookup_tree_add_ssl_ctx( bool in_proto_list(const std::vector &protos, const StringRef &needle) { for (auto &proto : protos) { - if (util::streq(proto, needle)) { + if (proto == needle) { return true; } } @@ -2284,8 +2235,8 @@ setup_server_ssl_context(std::vector &all_ssl_ctx, auto &tlsconf = config->tls; - auto ssl_ctx = create_ssl_context(tlsconf.private_key_file.c_str(), - tlsconf.cert_file.c_str(), tlsconf.sct_data + auto ssl_ctx = create_ssl_context(tlsconf.private_key_file.data(), + tlsconf.cert_file.data(), tlsconf.sct_data #ifdef HAVE_NEVERBLEED , nb @@ -2302,8 +2253,8 @@ setup_server_ssl_context(std::vector &all_ssl_ctx, } for (auto &c : tlsconf.subcerts) { - auto ssl_ctx = create_ssl_context(c.private_key_file.c_str(), - c.cert_file.c_str(), c.sct_data + auto ssl_ctx = create_ssl_context(c.private_key_file.data(), + c.cert_file.data(), c.sct_data #ifdef HAVE_NEVERBLEED , nb @@ -2323,12 +2274,12 @@ setup_server_ssl_context(std::vector &all_ssl_ctx, #ifdef ENABLE_HTTP3 SSL_CTX *setup_quic_server_ssl_context( - std::vector &all_ssl_ctx, - std::vector> &indexed_ssl_ctx, - CertLookupTree *cert_tree + std::vector &all_ssl_ctx, + std::vector> &indexed_ssl_ctx, + CertLookupTree *cert_tree # ifdef HAVE_NEVERBLEED - , - neverbleed_t *nb + , + neverbleed_t *nb # endif // HAVE_NEVERBLEED ) { auto config = get_config(); @@ -2339,14 +2290,13 @@ SSL_CTX *setup_quic_server_ssl_context( auto &tlsconf = config->tls; - auto ssl_ctx = - create_quic_ssl_context(tlsconf.private_key_file.c_str(), - tlsconf.cert_file.c_str(), tlsconf.sct_data + auto ssl_ctx = create_quic_ssl_context( + tlsconf.private_key_file.data(), tlsconf.cert_file.data(), tlsconf.sct_data # ifdef HAVE_NEVERBLEED - , - nb + , + nb # endif // HAVE_NEVERBLEED - ); + ); all_ssl_ctx.push_back(ssl_ctx); @@ -2358,8 +2308,8 @@ SSL_CTX *setup_quic_server_ssl_context( } for (auto &c : tlsconf.subcerts) { - auto ssl_ctx = create_quic_ssl_context(c.private_key_file.c_str(), - c.cert_file.c_str(), c.sct_data + auto ssl_ctx = create_quic_ssl_context(c.private_key_file.data(), + c.cert_file.data(), c.sct_data # ifdef HAVE_NEVERBLEED , nb @@ -2380,32 +2330,27 @@ SSL_CTX *setup_quic_server_ssl_context( SSL_CTX *setup_downstream_client_ssl_context( #ifdef HAVE_NEVERBLEED - neverbleed_t *nb + neverbleed_t *nb #endif // HAVE_NEVERBLEED ) { auto &tlsconf = get_config()->tls; return create_ssl_client_context( #ifdef HAVE_NEVERBLEED - nb, + nb, #endif // HAVE_NEVERBLEED - tlsconf.cacert, tlsconf.client.cert_file, tlsconf.client.private_key_file, - select_next_proto_cb); + tlsconf.cacert, tlsconf.client.cert_file, tlsconf.client.private_key_file); } void setup_downstream_http2_alpn(SSL *ssl) { -#if OPENSSL_VERSION_NUMBER >= 0x10002000L // ALPN advertisement auto alpn = util::get_default_alpn(); SSL_set_alpn_protos(ssl, alpn.data(), alpn.size()); -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L } void setup_downstream_http1_alpn(SSL *ssl) { -#if OPENSSL_VERSION_NUMBER >= 0x10002000L // ALPN advertisement SSL_set_alpn_protos(ssl, NGHTTP2_H1_1_ALPN.byte(), NGHTTP2_H1_1_ALPN.size()); -#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L } std::unique_ptr create_cert_lookup_tree() { @@ -2456,17 +2401,17 @@ SSL_SESSION *reuse_tls_session(const TLSSessionCache &cache) { int proto_version_from_string(const StringRef &v) { #ifdef TLS1_3_VERSION - if (util::strieq_l("TLSv1.3", v)) { + if (util::strieq("TLSv1.3"_sr, v)) { return TLS1_3_VERSION; } #endif // TLS1_3_VERSION - if (util::strieq_l("TLSv1.2", v)) { + if (util::strieq("TLSv1.2"_sr, v)) { return TLS1_2_VERSION; } - if (util::strieq_l("TLSv1.1", v)) { + if (util::strieq("TLSv1.1"_sr, v)) { return TLS1_1_VERSION; } - if (util::strieq_l("TLSv1.0", v)) { + if (util::strieq("TLSv1.0"_sr, v)) { return TLS1_VERSION; } return -1; @@ -2474,9 +2419,7 @@ int proto_version_from_string(const StringRef &v) { int verify_ocsp_response(SSL_CTX *ssl_ctx, const uint8_t *ocsp_resp, size_t ocsp_resplen) { - -#if !defined(OPENSSL_NO_OCSP) && !LIBRESSL_IN_USE && \ - OPENSSL_VERSION_NUMBER >= 0x10002000L +#ifndef OPENSSL_NO_OCSP int rv; STACK_OF(X509) * chain_certs; @@ -2522,11 +2465,7 @@ int verify_ocsp_response(SSL_CTX *ssl_ctx, const uint8_t *ocsp_resp, return -1; } -# if OPENSSL_1_1_API auto certid = OCSP_SINGLERESP_get0_id(sresp); -# else // !OPENSSL_1_1_API - auto certid = sresp->certId; -# endif // !OPENSSL_1_1_API assert(certid != nullptr); ASN1_INTEGER *serial; @@ -2553,8 +2492,7 @@ int verify_ocsp_response(SSL_CTX *ssl_ctx, const uint8_t *ocsp_resp, if (LOG_ENABLED(INFO)) { LOG(INFO) << "OCSP verification succeeded"; } -#endif // !defined(OPENSSL_NO_OCSP) && !LIBRESSL_IN_USE - // && OPENSSL_VERSION_NUMBER >= 0x10002000L +#endif // !OPENSSL_NO_OCSP return 0; } @@ -2585,9 +2523,9 @@ StringRef get_x509_name(BlockAllocator &balloc, X509_NAME *nm) { } auto iov = make_byte_ref(balloc, slen + 1); - BIO_read(b, iov.base, slen); - iov.base[slen] = '\0'; - return StringRef{iov.base, static_cast(slen)}; + BIO_read(b, iov.data(), slen); + iov[slen] = '\0'; + return StringRef{iov.data(), static_cast(slen)}; } } // namespace @@ -2611,7 +2549,7 @@ StringRef get_x509_serial(BlockAllocator &balloc, X509 *x) { auto n = BN_bn2bin(bn, b.data()); assert(n <= 20); - return util::format_hex(balloc, StringRef{b.data(), static_cast(n)}); + return util::format_hex(balloc, std::span{b.data(), static_cast(n)}); } namespace { @@ -2620,7 +2558,8 @@ namespace { int time_t_from_asn1_time(time_t &t, const ASN1_TIME *at) { int rv; -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) || defined(NGHTTP2_OPENSSL_IS_WOLFSSL) struct tm tm; rv = ASN1_TIME_to_tm(at, &tm); if (rv != 1) { @@ -2628,7 +2567,8 @@ int time_t_from_asn1_time(time_t &t, const ASN1_TIME *at) { } t = nghttp2_timegm(&tm); -#else // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +#else // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_LIBRESSL && + // !NGHTTP2_OPENSSL_IS_WOLFSSL auto b = BIO_new(BIO_s_mem()); if (!b) { return -1; @@ -2648,24 +2588,21 @@ int time_t_from_asn1_time(time_t &t, const ASN1_TIME *at) { # endif auto slen = BIO_get_mem_data(b, &s); auto tt = util::parse_openssl_asn1_time_print( - StringRef{s, static_cast(slen)}); + StringRef{s, static_cast(slen)}); if (tt == 0) { return -1; } t = tt; -#endif // !(OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL)) +#endif // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_LIBRESSL && + // !NGHTTP2_OPENSSL_IS_WOLFSSL return 0; } } // namespace int get_x509_not_before(time_t &t, X509 *x) { -#if OPENSSL_1_1_API auto at = X509_get0_notBefore(x); -#else // !OPENSSL_1_1_API - auto at = X509_get_notBefore(x); -#endif // !OPENSSL_1_1_API if (!at) { return -1; } @@ -2674,11 +2611,7 @@ int get_x509_not_before(time_t &t, X509 *x) { } int get_x509_not_after(time_t &t, X509 *x) { -#if OPENSSL_1_1_API auto at = X509_get0_notAfter(x); -#else // !OPENSSL_1_1_API - auto at = X509_get_notAfter(x); -#endif // !OPENSSL_1_1_API if (!at) { return -1; } diff --git a/lib/nghttp2/src/shrpx_tls.h b/lib/nghttp2-1.65.0/src/shrpx_tls.h similarity index 90% rename from lib/nghttp2/src/shrpx_tls.h rename to lib/nghttp2-1.65.0/src/shrpx_tls.h index 00265d55d7f..c7c87cd06a0 100644 --- a/lib/nghttp2/src/shrpx_tls.h +++ b/lib/nghttp2-1.65.0/src/shrpx_tls.h @@ -30,8 +30,16 @@ #include #include -#include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include @@ -72,7 +80,11 @@ struct TLSContextData { std::mutex mu; #endif // !HAVE_ATOMIC_STD_SHARED_PTR // OCSP response +#ifdef HAVE_ATOMIC_STD_SHARED_PTR + std::atomic>> ocsp_data; +#else // !HAVE_ATOMIC_STD_SHARED_PTR std::shared_ptr> ocsp_data; +#endif // !HAVE_ATOMIC_STD_SHARED_PTR // Path to certificate file const char *cert_file; @@ -89,28 +101,12 @@ SSL_CTX *create_ssl_context(const char *private_key_file, const char *cert_file, ); // Create client side SSL_CTX. This does not configure ALPN settings. -// |next_proto_select_cb| is for NPN. SSL_CTX *create_ssl_client_context( #ifdef HAVE_NEVERBLEED - neverbleed_t *nb, + neverbleed_t *nb, #endif // HAVE_NEVERBLEED - const StringRef &cacert, const StringRef &cert_file, - const StringRef &private_key_file, - int (*next_proto_select_cb)(SSL *s, unsigned char **out, - unsigned char *outlen, const unsigned char *in, - unsigned int inlen, void *arg)); - -#ifdef ENABLE_HTTP3 -SSL_CTX *create_quic_ssl_client_context( -# ifdef HAVE_NEVERBLEED - neverbleed_t *nb, -# endif // HAVE_NEVERBLEED - const StringRef &cacert, const StringRef &cert_file, - const StringRef &private_key_file, - int (*next_proto_select_cb)(SSL *s, unsigned char **out, - unsigned char *outlen, const unsigned char *in, - unsigned int inlen, void *arg)); -#endif // ENABLE_HTTP3 + const StringRef &cacert, const StringRef &cert_file, + const StringRef &private_key_file); ClientHandler *accept_connection(Worker *worker, int fd, sockaddr *addr, int addrlen, const UpstreamAddr *faddr); @@ -134,7 +130,7 @@ int verify_dns_hostname(X509 *cert, const StringRef &hostname); struct WildcardRevPrefix { WildcardRevPrefix(const StringRef &prefix, size_t idx) - : prefix(std::begin(prefix), std::end(prefix)), idx(idx) {} + : prefix(std::begin(prefix), std::end(prefix)), idx(idx) {} // "Prefix" of wildcard pattern. It is reversed from original form. // For example, if the original wildcard is "test*.nghttp2.org", @@ -202,8 +198,8 @@ class CertLookupTree { // commonName is not considered. |ssl_ctx| is also added to // |indexed_ssl_ctx|. This function returns 0 if it succeeds, or -1. int cert_lookup_tree_add_ssl_ctx( - CertLookupTree *lt, std::vector> &indexed_ssl_ctx, - SSL_CTX *ssl_ctx); + CertLookupTree *lt, std::vector> &indexed_ssl_ctx, + SSL_CTX *ssl_ctx); // Returns true if |proto| is included in the // protocol list |protos|. @@ -241,12 +237,12 @@ setup_server_ssl_context(std::vector &all_ssl_ctx, #ifdef ENABLE_HTTP3 SSL_CTX *setup_quic_server_ssl_context( - std::vector &all_ssl_ctx, - std::vector> &indexed_ssl_ctx, - CertLookupTree *cert_tree + std::vector &all_ssl_ctx, + std::vector> &indexed_ssl_ctx, + CertLookupTree *cert_tree # ifdef HAVE_NEVERBLEED - , - neverbleed_t *nb + , + neverbleed_t *nb # endif // HAVE_NEVERBLEED ); #endif // ENABLE_HTTP3 @@ -254,7 +250,7 @@ SSL_CTX *setup_quic_server_ssl_context( // Setups client side SSL_CTX. SSL_CTX *setup_downstream_client_ssl_context( #ifdef HAVE_NEVERBLEED - neverbleed_t *nb + neverbleed_t *nb #endif // HAVE_NEVERBLEED ); diff --git a/lib/nghttp2/src/shrpx_tls_test.cc b/lib/nghttp2-1.65.0/src/shrpx_tls_test.cc similarity index 54% rename from lib/nghttp2/src/shrpx_tls_test.cc rename to lib/nghttp2-1.65.0/src/shrpx_tls_test.cc index 02fb1681fa7..71e4fa5dc4c 100644 --- a/lib/nghttp2/src/shrpx_tls_test.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_tls_test.cc @@ -24,31 +24,47 @@ */ #include "shrpx_tls_test.h" -#include +#include "munitxx.h" #include "shrpx_tls.h" #include "shrpx_log.h" #include "util.h" #include "template.h" +#include "ssl_compat.h" using namespace nghttp2; namespace shrpx { +namespace { +const MunitTest tests[]{ + munit_void_test(test_shrpx_tls_create_lookup_tree), + munit_void_test(test_shrpx_tls_cert_lookup_tree_add_ssl_ctx), + munit_void_test(test_shrpx_tls_tls_hostname_match), + munit_void_test(test_shrpx_tls_verify_numeric_hostname), + munit_void_test(test_shrpx_tls_verify_dns_hostname), + munit_test_end(), +}; +} // namespace + +const MunitSuite tls_suite{ + "/tls", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + void test_shrpx_tls_create_lookup_tree(void) { auto tree = std::make_unique(); constexpr StringRef hostnames[] = { - StringRef::from_lit("example.com"), // 0 - StringRef::from_lit("www.example.org"), // 1 - StringRef::from_lit("*www.example.org"), // 2 - StringRef::from_lit("xy*.host.domain"), // 3 - StringRef::from_lit("*yy.host.domain"), // 4 - StringRef::from_lit("nghttp2.sourceforge.net"), // 5 - StringRef::from_lit("sourceforge.net"), // 6 - StringRef::from_lit("sourceforge.net"), // 7, duplicate - StringRef::from_lit("*.foo.bar"), // 8, oo.bar is suffix of *.foo.bar - StringRef::from_lit("oo.bar") // 9 + "example.com"_sr, // 0 + "www.example.org"_sr, // 1 + "*www.example.org"_sr, // 2 + "xy*.host.domain"_sr, // 3 + "*yy.host.domain"_sr, // 4 + "nghttp2.sourceforge.net"_sr, // 5 + "sourceforge.net"_sr, // 6 + "sourceforge.net"_sr, // 7, duplicate + "*.foo.bar"_sr, // 8, oo.bar is suffix of *.foo.bar + "oo.bar"_sr // 9 }; auto num = array_size(hostnames); @@ -58,30 +74,30 @@ void test_shrpx_tls_create_lookup_tree(void) { tree->dump(); - CU_ASSERT(0 == tree->lookup(hostnames[0])); - CU_ASSERT(1 == tree->lookup(hostnames[1])); - CU_ASSERT(2 == tree->lookup(StringRef::from_lit("2www.example.org"))); - CU_ASSERT(-1 == tree->lookup(StringRef::from_lit("www2.example.org"))); - CU_ASSERT(3 == tree->lookup(StringRef::from_lit("xy1.host.domain"))); + assert_ssize(0, ==, tree->lookup(hostnames[0])); + assert_ssize(1, ==, tree->lookup(hostnames[1])); + assert_ssize(2, ==, tree->lookup("2www.example.org"_sr)); + assert_ssize(-1, ==, tree->lookup("www2.example.org"_sr)); + assert_ssize(3, ==, tree->lookup("xy1.host.domain"_sr)); // Does not match *yy.host.domain, because * must match at least 1 // character. - CU_ASSERT(-1 == tree->lookup(StringRef::from_lit("yy.host.domain"))); - CU_ASSERT(4 == tree->lookup(StringRef::from_lit("xyy.host.domain"))); - CU_ASSERT(-1 == tree->lookup(StringRef{})); - CU_ASSERT(5 == tree->lookup(hostnames[5])); - CU_ASSERT(6 == tree->lookup(hostnames[6])); + assert_ssize(-1, ==, tree->lookup("yy.host.domain"_sr)); + assert_ssize(4, ==, tree->lookup("xyy.host.domain"_sr)); + assert_ssize(-1, ==, tree->lookup(StringRef{})); + assert_ssize(5, ==, tree->lookup(hostnames[5])); + assert_ssize(6, ==, tree->lookup(hostnames[6])); static constexpr char h6[] = "pdylay.sourceforge.net"; for (int i = 0; i < 7; ++i) { - CU_ASSERT(-1 == tree->lookup(StringRef{h6 + i, str_size(h6) - i})); + assert_ssize(-1, ==, tree->lookup(StringRef{h6 + i, str_size(h6) - i})); } - CU_ASSERT(8 == tree->lookup(StringRef::from_lit("x.foo.bar"))); - CU_ASSERT(9 == tree->lookup(hostnames[9])); + assert_ssize(8, ==, tree->lookup("x.foo.bar"_sr)); + assert_ssize(9, ==, tree->lookup(hostnames[9])); constexpr StringRef names[] = { - StringRef::from_lit("rab"), // 1 - StringRef::from_lit("zab"), // 2 - StringRef::from_lit("zzub"), // 3 - StringRef::from_lit("ab") // 4 + "rab"_sr, // 1 + "zab"_sr, // 2 + "zzub"_sr, // 3 + "ab"_sr // 4 }; num = array_size(names); @@ -90,7 +106,7 @@ void test_shrpx_tls_create_lookup_tree(void) { tree->add_cert(names[idx], idx); } for (size_t i = 0; i < num; ++i) { - CU_ASSERT((ssize_t)i == tree->lookup(names[i])); + assert_ssize((ssize_t)i, ==, tree->lookup(names[i])); } } @@ -120,7 +136,7 @@ void test_shrpx_tls_cert_lookup_tree_add_ssl_ctx(void) { int rv; static constexpr char nghttp2_certfile[] = - NGHTTP2_SRC_DIR "/test.nghttp2.org.pem"; + NGHTTP2_SRC_DIR "/test.nghttp2.org.pem"; auto nghttp2_ssl_ctx = SSL_CTX_new(TLS_server_method()); auto nghttp2_ssl_ctx_del = defer(SSL_CTX_free, nghttp2_ssl_ctx); auto nghttp2_tls_ctx_data = std::make_unique(); @@ -128,10 +144,10 @@ void test_shrpx_tls_cert_lookup_tree_add_ssl_ctx(void) { SSL_CTX_set_app_data(nghttp2_ssl_ctx, nghttp2_tls_ctx_data.get()); rv = SSL_CTX_use_certificate_chain_file(nghttp2_ssl_ctx, nghttp2_certfile); - CU_ASSERT(1 == rv); + assert_int(1, ==, rv); static constexpr char examples_certfile[] = - NGHTTP2_SRC_DIR "/test.example.com.pem"; + NGHTTP2_SRC_DIR "/test.example.com.pem"; auto examples_ssl_ctx = SSL_CTX_new(TLS_server_method()); auto examples_ssl_ctx_del = defer(SSL_CTX_free, examples_ssl_ctx); auto examples_tls_ctx_data = std::make_unique(); @@ -139,26 +155,32 @@ void test_shrpx_tls_cert_lookup_tree_add_ssl_ctx(void) { SSL_CTX_set_app_data(examples_ssl_ctx, examples_tls_ctx_data.get()); rv = SSL_CTX_use_certificate_chain_file(examples_ssl_ctx, examples_certfile); - CU_ASSERT(1 == rv); + assert_int(1, ==, rv); tls::CertLookupTree tree; std::vector> indexed_ssl_ctx; - rv = tls::cert_lookup_tree_add_ssl_ctx(&tree, indexed_ssl_ctx, - nghttp2_ssl_ctx); + rv = + tls::cert_lookup_tree_add_ssl_ctx(&tree, indexed_ssl_ctx, nghttp2_ssl_ctx); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - rv = tls::cert_lookup_tree_add_ssl_ctx(&tree, indexed_ssl_ctx, - examples_ssl_ctx); + rv = + tls::cert_lookup_tree_add_ssl_ctx(&tree, indexed_ssl_ctx, examples_ssl_ctx); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - CU_ASSERT(-1 == tree.lookup(StringRef::from_lit("not-used.nghttp2.org"))); - CU_ASSERT(0 == tree.lookup(StringRef::from_lit("test.nghttp2.org"))); - CU_ASSERT(1 == tree.lookup(StringRef::from_lit("w.test.nghttp2.org"))); - CU_ASSERT(2 == tree.lookup(StringRef::from_lit("www.test.nghttp2.org"))); - CU_ASSERT(3 == tree.lookup(StringRef::from_lit("test.example.com"))); + assert_ssize(-1, ==, tree.lookup("not-used.nghttp2.org"_sr)); +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL + assert_ssize(0, ==, tree.lookup("www.test.nghttp2.org"_sr)); + assert_ssize(1, ==, tree.lookup("w.test.nghttp2.org"_sr)); + assert_ssize(2, ==, tree.lookup("test.nghttp2.org"_sr)); +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL + assert_ssize(0, ==, tree.lookup("test.nghttp2.org"_sr)); + assert_ssize(1, ==, tree.lookup("w.test.nghttp2.org"_sr)); + assert_ssize(2, ==, tree.lookup("www.test.nghttp2.org"_sr)); +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL + assert_ssize(3, ==, tree.lookup("test.example.com"_sr)); } template @@ -168,30 +190,32 @@ bool tls_hostname_match_wrapper(const char (&pattern)[N], } void test_shrpx_tls_tls_hostname_match(void) { - CU_ASSERT(tls_hostname_match_wrapper("example.com", "example.com")); - CU_ASSERT(tls_hostname_match_wrapper("example.com", "EXAMPLE.com")); + assert_true(tls_hostname_match_wrapper("example.com", "example.com")); + assert_true(tls_hostname_match_wrapper("example.com", "EXAMPLE.com")); // check wildcard - CU_ASSERT(tls_hostname_match_wrapper("*.example.com", "www.example.com")); - CU_ASSERT(tls_hostname_match_wrapper("*w.example.com", "www.example.com")); - CU_ASSERT(tls_hostname_match_wrapper("www*.example.com", "www1.example.com")); - CU_ASSERT( - tls_hostname_match_wrapper("www*.example.com", "WWW12.EXAMPLE.com")); + assert_true(tls_hostname_match_wrapper("*.example.com", "www.example.com")); + assert_true(tls_hostname_match_wrapper("*w.example.com", "www.example.com")); + assert_true( + tls_hostname_match_wrapper("www*.example.com", "www1.example.com")); + assert_true( + tls_hostname_match_wrapper("www*.example.com", "WWW12.EXAMPLE.com")); // at least 2 dots are required after '*' - CU_ASSERT(!tls_hostname_match_wrapper("*.com", "example.com")); - CU_ASSERT(!tls_hostname_match_wrapper("*", "example.com")); + assert_false(tls_hostname_match_wrapper("*.com", "example.com")); + assert_false(tls_hostname_match_wrapper("*", "example.com")); // '*' must be in left most label - CU_ASSERT( - !tls_hostname_match_wrapper("blog.*.example.com", "blog.my.example.com")); + assert_false( + tls_hostname_match_wrapper("blog.*.example.com", "blog.my.example.com")); // prefix is wrong - CU_ASSERT( - !tls_hostname_match_wrapper("client*.example.com", "server.example.com")); + assert_false( + tls_hostname_match_wrapper("client*.example.com", "server.example.com")); // '*' must match at least one character - CU_ASSERT(!tls_hostname_match_wrapper("www*.example.com", "www.example.com")); + assert_false( + tls_hostname_match_wrapper("www*.example.com", "www.example.com")); - CU_ASSERT(!tls_hostname_match_wrapper("example.com", "nghttp2.org")); - CU_ASSERT(!tls_hostname_match_wrapper("www.example.com", "example.com")); - CU_ASSERT(!tls_hostname_match_wrapper("example.com", "www.example.com")); + assert_false(tls_hostname_match_wrapper("example.com", "nghttp2.org")); + assert_false(tls_hostname_match_wrapper("www.example.com", "example.com")); + assert_false(tls_hostname_match_wrapper("example.com", "www.example.com")); } static X509 *load_cert(const char *path) { @@ -207,14 +231,17 @@ static Address parse_addr(const char *ipaddr) { addrinfo hints{}; hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV; + hints.ai_flags = AI_NUMERICHOST; +#ifdef AI_NUMERICSERV + hints.ai_flags |= AI_NUMERICSERV; +#endif addrinfo *res = nullptr; auto rv = getaddrinfo(ipaddr, "443", &hints, &res); - CU_ASSERT(0 == rv); - CU_ASSERT(nullptr != res); + assert_int(0, ==, rv); + assert_not_null(res); Address addr; addr.len = res->ai_addrlen; @@ -228,65 +255,60 @@ static Address parse_addr(const char *ipaddr) { void test_shrpx_tls_verify_numeric_hostname(void) { { // Successful IPv4 address match in SAN - static constexpr char ipaddr[] = "127.0.0.1"; + static constexpr auto ipaddr = "127.0.0.1"_sr; auto cert = load_cert(NGHTTP2_SRC_DIR "/testdata/verify_hostname.crt"); - auto addr = parse_addr(ipaddr); - auto rv = - tls::verify_numeric_hostname(cert, StringRef::from_lit(ipaddr), &addr); + auto addr = parse_addr(ipaddr.data()); + auto rv = tls::verify_numeric_hostname(cert, ipaddr, &addr); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); X509_free(cert); } { // Successful IPv6 address match in SAN - static constexpr char ipaddr[] = "::1"; + static constexpr auto ipaddr = "::1"_sr; auto cert = load_cert(NGHTTP2_SRC_DIR "/testdata/verify_hostname.crt"); - auto addr = parse_addr(ipaddr); - auto rv = - tls::verify_numeric_hostname(cert, StringRef::from_lit(ipaddr), &addr); + auto addr = parse_addr(ipaddr.data()); + auto rv = tls::verify_numeric_hostname(cert, ipaddr, &addr); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); X509_free(cert); } { // Unsuccessful IPv4 address match in SAN - static constexpr char ipaddr[] = "192.168.0.127"; + static constexpr auto ipaddr = "192.168.0.127"_sr; auto cert = load_cert(NGHTTP2_SRC_DIR "/testdata/verify_hostname.crt"); - auto addr = parse_addr(ipaddr); - auto rv = - tls::verify_numeric_hostname(cert, StringRef::from_lit(ipaddr), &addr); + auto addr = parse_addr(ipaddr.data()); + auto rv = tls::verify_numeric_hostname(cert, ipaddr, &addr); - CU_ASSERT(-1 == rv); + assert_int(-1, ==, rv); X509_free(cert); } { // CommonName is not used if SAN is available - static constexpr char ipaddr[] = "192.168.0.1"; + static constexpr auto ipaddr = "192.168.0.1"_sr; auto cert = load_cert(NGHTTP2_SRC_DIR "/testdata/ipaddr.crt"); - auto addr = parse_addr(ipaddr); - auto rv = - tls::verify_numeric_hostname(cert, StringRef::from_lit(ipaddr), &addr); + auto addr = parse_addr(ipaddr.data()); + auto rv = tls::verify_numeric_hostname(cert, ipaddr, &addr); - CU_ASSERT(-1 == rv); + assert_int(-1, ==, rv); X509_free(cert); } { // Successful IPv4 address match in CommonName - static constexpr char ipaddr[] = "127.0.0.1"; + static constexpr auto ipaddr = "127.0.0.1"_sr; auto cert = load_cert(NGHTTP2_SRC_DIR "/testdata/nosan_ip.crt"); - auto addr = parse_addr(ipaddr); - auto rv = - tls::verify_numeric_hostname(cert, StringRef::from_lit(ipaddr), &addr); + auto addr = parse_addr(ipaddr.data()); + auto rv = tls::verify_numeric_hostname(cert, ipaddr, &addr); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); X509_free(cert); } @@ -296,10 +318,9 @@ void test_shrpx_tls_verify_dns_hostname(void) { { // Successful exact DNS name match in SAN auto cert = load_cert(NGHTTP2_SRC_DIR "/testdata/verify_hostname.crt"); - auto rv = tls::verify_dns_hostname( - cert, StringRef::from_lit("nghttp2.example.com")); + auto rv = tls::verify_dns_hostname(cert, "nghttp2.example.com"_sr); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); X509_free(cert); } @@ -307,10 +328,9 @@ void test_shrpx_tls_verify_dns_hostname(void) { { // Successful wildcard DNS name match in SAN auto cert = load_cert(NGHTTP2_SRC_DIR "/testdata/verify_hostname.crt"); - auto rv = tls::verify_dns_hostname( - cert, StringRef::from_lit("www.nghttp2.example.com")); + auto rv = tls::verify_dns_hostname(cert, "www.nghttp2.example.com"_sr); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); X509_free(cert); } @@ -318,9 +338,9 @@ void test_shrpx_tls_verify_dns_hostname(void) { { // CommonName is not used if SAN is available. auto cert = load_cert(NGHTTP2_SRC_DIR "/testdata/verify_hostname.crt"); - auto rv = tls::verify_dns_hostname(cert, StringRef::from_lit("localhost")); + auto rv = tls::verify_dns_hostname(cert, "localhost"_sr); - CU_ASSERT(-1 == rv); + assert_int(-1, ==, rv); X509_free(cert); } @@ -328,9 +348,9 @@ void test_shrpx_tls_verify_dns_hostname(void) { { // Successful DNS name match in CommonName auto cert = load_cert(NGHTTP2_SRC_DIR "/testdata/nosan.crt"); - auto rv = tls::verify_dns_hostname(cert, StringRef::from_lit("localhost")); + auto rv = tls::verify_dns_hostname(cert, "localhost"_sr); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); X509_free(cert); } diff --git a/lib/nghttp2/src/shrpx_tls_test.h b/lib/nghttp2-1.65.0/src/shrpx_tls_test.h similarity index 77% rename from lib/nghttp2/src/shrpx_tls_test.h rename to lib/nghttp2-1.65.0/src/shrpx_tls_test.h index 7edc742b7f2..8dea45fcd3c 100644 --- a/lib/nghttp2/src/shrpx_tls_test.h +++ b/lib/nghttp2-1.65.0/src/shrpx_tls_test.h @@ -29,13 +29,19 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace shrpx { -void test_shrpx_tls_create_lookup_tree(void); -void test_shrpx_tls_cert_lookup_tree_add_ssl_ctx(void); -void test_shrpx_tls_tls_hostname_match(void); -void test_shrpx_tls_verify_numeric_hostname(void); -void test_shrpx_tls_verify_dns_hostname(void); +extern const MunitSuite tls_suite; + +munit_void_test_decl(test_shrpx_tls_create_lookup_tree) +munit_void_test_decl(test_shrpx_tls_cert_lookup_tree_add_ssl_ctx) +munit_void_test_decl(test_shrpx_tls_tls_hostname_match) +munit_void_test_decl(test_shrpx_tls_verify_numeric_hostname) +munit_void_test_decl(test_shrpx_tls_verify_dns_hostname) } // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_upstream.h b/lib/nghttp2-1.65.0/src/shrpx_upstream.h similarity index 98% rename from lib/nghttp2/src/shrpx_upstream.h rename to lib/nghttp2-1.65.0/src/shrpx_upstream.h index 3da62c9e9dc..e80b079ae8e 100644 --- a/lib/nghttp2/src/shrpx_upstream.h +++ b/lib/nghttp2-1.65.0/src/shrpx_upstream.h @@ -42,7 +42,7 @@ class Upstream { virtual ~Upstream() {} virtual int on_read() = 0; virtual int on_write() = 0; - virtual int on_timeout(Downstream *downstream) { return 0; }; + virtual int on_timeout(Downstream *downstream) { return 0; } virtual int on_downstream_abort_request(Downstream *downstream, unsigned int status_code) = 0; // Called when the current request is aborted without forwarding it diff --git a/lib/nghttp2/src/shrpx_worker.cc b/lib/nghttp2-1.65.0/src/shrpx_worker.cc similarity index 77% rename from lib/nghttp2/src/shrpx_worker.cc rename to lib/nghttp2-1.65.0/src/shrpx_worker.cc index a2b19fbfa76..a53e8d98d66 100644 --- a/lib/nghttp2/src/shrpx_worker.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_worker.cc @@ -32,7 +32,14 @@ #include #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #ifdef HAVE_LIBBPF # include @@ -92,11 +99,10 @@ DownstreamAddrGroup::~DownstreamAddrGroup() {} // DownstreamKey is used to index SharedDownstreamAddr in order to // find the same configuration. using DownstreamKey = std::tuple< - std::vector< - std::tuple>, - bool, SessionAffinity, StringRef, StringRef, SessionAffinityCookieSecure, - SessionAffinityCookieStickiness, int64_t, int64_t, StringRef, bool>; + std::vector>, + bool, SessionAffinity, StringRef, StringRef, SessionAffinityCookieSecure, + SessionAffinityCookieStickiness, int64_t, int64_t, StringRef, bool>; namespace { DownstreamKey @@ -148,7 +154,7 @@ Worker::Worker(struct ev_loop *loop, SSL_CTX *sv_ssl_ctx, SSL_CTX *cl_ssl_ctx, tls::CertLookupTree *cert_tree, #ifdef ENABLE_HTTP3 SSL_CTX *quic_sv_ssl_ctx, tls::CertLookupTree *quic_cert_tree, - const uint8_t *cid_prefix, size_t cid_prefixlen, + WorkerID wid, # ifdef HAVE_LIBBPF size_t index, # endif // HAVE_LIBBPF @@ -156,34 +162,31 @@ Worker::Worker(struct ev_loop *loop, SSL_CTX *sv_ssl_ctx, SSL_CTX *cl_ssl_ctx, const std::shared_ptr &ticket_keys, ConnectionHandler *conn_handler, std::shared_ptr downstreamconf) - : + : #if defined(ENABLE_HTTP3) && defined(HAVE_LIBBPF) - index_{index}, + index_{index}, #endif // ENABLE_HTTP3 && HAVE_LIBBPF - randgen_(util::make_mt19937()), - worker_stat_{}, - dns_tracker_(loop, get_config()->conn.downstream->family), -#ifdef ENABLE_HTTP3 - quic_upstream_addrs_{get_config()->conn.quic_listener.addrs}, -#endif // ENABLE_HTTP3 - loop_(loop), - sv_ssl_ctx_(sv_ssl_ctx), - cl_ssl_ctx_(cl_ssl_ctx), - cert_tree_(cert_tree), - conn_handler_(conn_handler), + randgen_(util::make_mt19937()), + worker_stat_{}, + dns_tracker_(loop, get_config()->conn.downstream->family), #ifdef ENABLE_HTTP3 - quic_sv_ssl_ctx_{quic_sv_ssl_ctx}, - quic_cert_tree_{quic_cert_tree}, - quic_conn_handler_{this}, + worker_id_{std::move(wid)}, + quic_upstream_addrs_{get_config()->conn.quic_listener.addrs}, #endif // ENABLE_HTTP3 - ticket_keys_(ticket_keys), - connect_blocker_( - std::make_unique(randgen_, loop_, nullptr, nullptr)), - graceful_shutdown_(false) { + loop_(loop), + sv_ssl_ctx_(sv_ssl_ctx), + cl_ssl_ctx_(cl_ssl_ctx), + cert_tree_(cert_tree), + conn_handler_(conn_handler), #ifdef ENABLE_HTTP3 - std::copy_n(cid_prefix, cid_prefixlen, std::begin(cid_prefix_)); + quic_sv_ssl_ctx_{quic_sv_ssl_ctx}, + quic_cert_tree_{quic_cert_tree}, + quic_conn_handler_{this}, #endif // ENABLE_HTTP3 - + ticket_keys_(ticket_keys), + connect_blocker_( + std::make_unique(randgen_, loop_, nullptr, nullptr)), + graceful_shutdown_(false) { ev_async_init(&w_, eventcb); w_.data = this; ev_async_start(loop_, &w_); @@ -198,9 +201,9 @@ Worker::Worker(struct ev_loop *loop, SSL_CTX *sv_ssl_ctx, SSL_CTX *cl_ssl_ctx, if (!session_cacheconf.memcached.host.empty()) { session_cache_memcached_dispatcher_ = std::make_unique( - &session_cacheconf.memcached.addr, loop, - tls_session_cache_memcached_ssl_ctx, - StringRef{session_cacheconf.memcached.host}, &mcpool_, randgen_); + &session_cacheconf.memcached.addr, loop, + tls_session_cache_memcached_ssl_ctx, + StringRef{session_cacheconf.memcached.host}, &mcpool_, randgen_); } replace_downstream_config(std::move(downstreamconf)); @@ -208,9 +211,9 @@ Worker::Worker(struct ev_loop *loop, SSL_CTX *sv_ssl_ctx, SSL_CTX *cl_ssl_ctx, namespace { void ensure_enqueue_addr( - std::priority_queue, - WeightGroupEntryGreater> &wgpq, - WeightGroup *wg, DownstreamAddr *addr) { + std::priority_queue, + WeightGroupEntryGreater> &wgpq, + WeightGroup *wg, DownstreamAddr *addr) { uint32_t cycle; if (!wg->pq.empty()) { auto &top = wg->pq.top(); @@ -241,7 +244,7 @@ void ensure_enqueue_addr( } // namespace void Worker::replace_downstream_config( - std::shared_ptr downstreamconf) { + std::shared_ptr downstreamconf) { for (auto &g : downstream_addr_groups_) { g->retired = true; @@ -258,7 +261,7 @@ void Worker::replace_downstream_config( auto groups = downstreamconf->addr_groups; downstream_addr_groups_ = - std::vector>(groups.size()); + std::vector>(groups.size()); std::map addr_groups_indexer; #ifdef HAVE_MRUBY @@ -274,7 +277,7 @@ void Worker::replace_downstream_config( dst = std::make_shared(); dst->pattern = - ImmutableString{std::begin(src.pattern), std::end(src.pattern)}; + ImmutableString{std::begin(src.pattern), std::end(src.pattern)}; auto shared_addr = std::make_shared(); @@ -282,10 +285,10 @@ void Worker::replace_downstream_config( shared_addr->affinity.type = src.affinity.type; if (src.affinity.type == SessionAffinity::COOKIE) { shared_addr->affinity.cookie.name = - make_string_ref(shared_addr->balloc, src.affinity.cookie.name); + make_string_ref(shared_addr->balloc, src.affinity.cookie.name); if (!src.affinity.cookie.path.empty()) { shared_addr->affinity.cookie.path = - make_string_ref(shared_addr->balloc, src.affinity.cookie.path); + make_string_ref(shared_addr->balloc, src.affinity.cookie.path); } shared_addr->affinity.cookie.secure = src.affinity.cookie.secure; shared_addr->affinity.cookie.stickiness = src.affinity.cookie.stickiness; @@ -304,7 +307,7 @@ void Worker::replace_downstream_config( dst_addr.addr = src_addr.addr; dst_addr.host = make_string_ref(shared_addr->balloc, src_addr.host); dst_addr.hostport = - make_string_ref(shared_addr->balloc, src_addr.hostport); + make_string_ref(shared_addr->balloc, src_addr.hostport); dst_addr.port = src_addr.port; dst_addr.host_unix = src_addr.host_unix; dst_addr.weight = src_addr.weight; @@ -342,14 +345,14 @@ void Worker::replace_downstream_config( for (auto &addr : shared_addr->addrs) { addr.connect_blocker = std::make_unique( - randgen_, loop_, nullptr, [shared_addr_ptr, &addr]() { - if (!addr.queued) { - if (!addr.wg) { - return; - } - ensure_enqueue_addr(shared_addr_ptr->pq, addr.wg, &addr); + randgen_, loop_, nullptr, [shared_addr_ptr, &addr]() { + if (!addr.queued) { + if (!addr.wg) { + return; } - }); + ensure_enqueue_addr(shared_addr_ptr->pq, addr.wg, &addr); + } + }); addr.live_check = std::make_unique(loop_, cl_ssl_ctx_, this, &addr, randgen_); @@ -394,12 +397,12 @@ void Worker::replace_downstream_config( for (auto &kv : wgs) { shared_addr->pq.push( - WeightGroupEntry{kv.second, kv.second->seq, kv.second->cycle}); + WeightGroupEntry{kv.second, kv.second->seq, kv.second->cycle}); kv.second->queued = true; } } - dst->shared_addr = shared_addr; + dst->shared_addr = std::move(shared_addr); addr_groups_indexer.emplace(std::move(dkey), i); } else { @@ -438,6 +441,10 @@ void Worker::run_async() { (void)reopen_log_files(get_config()->logging); ev_run(loop_); delete_log_config(); + +# ifdef NGHTTP2_OPENSSL_IS_WOLFSSL + wc_ecc_fp_free(); +# endif // NGHTTP2_OPENSSL_IS_WOLFSSL }); #endif // !NOTHREADS } @@ -485,7 +492,6 @@ void Worker::process_events() { } if (worker_stat_.num_connections >= worker_connections) { - if (LOG_ENABLED(INFO)) { WLOG(INFO, this) << "Too many connections >= " << worker_connections; } @@ -495,9 +501,8 @@ void Worker::process_events() { break; } - auto client_handler = - tls::accept_connection(this, wev.client_fd, &wev.client_addr.sa, - wev.client_addrlen, wev.faddr); + auto client_handler = tls::accept_connection( + this, wev.client_fd, &wev.client_addr.sa, wev.client_addrlen, wev.faddr); if (!client_handler) { if (LOG_ENABLED(INFO)) { WLOG(ERROR, this) << "ClientHandler creation failed"; @@ -507,7 +512,7 @@ void Worker::process_events() { } if (LOG_ENABLED(INFO)) { - WLOG(INFO, this) << "CLIENT_HANDLER:" << client_handler << " created "; + WLOG(INFO, this) << "CLIENT_HANDLER:" << client_handler << " created"; } break; @@ -558,9 +563,9 @@ void Worker::process_events() { faddr = &quic_upstream_addrs_[wev.quic_pkt->upstream_addr_index]; } - quic_conn_handler_.handle_packet( - faddr, wev.quic_pkt->remote_addr, wev.quic_pkt->local_addr, - wev.quic_pkt->pi, wev.quic_pkt->data.data(), wev.quic_pkt->data.size()); + quic_conn_handler_.handle_packet(faddr, wev.quic_pkt->remote_addr, + wev.quic_pkt->local_addr, wev.quic_pkt->pi, + wev.quic_pkt->data); break; } @@ -582,7 +587,7 @@ tls::CertLookupTree *Worker::get_quic_cert_lookup_tree() const { std::shared_ptr Worker::get_ticket_keys() { #ifdef HAVE_ATOMIC_STD_SHARED_PTR - return std::atomic_load_explicit(&ticket_keys_, std::memory_order_acquire); + return ticket_keys_.load(std::memory_order_acquire); #else // !HAVE_ATOMIC_STD_SHARED_PTR std::lock_guard g(ticket_keys_m_); return ticket_keys_; @@ -592,8 +597,7 @@ std::shared_ptr Worker::get_ticket_keys() { void Worker::set_ticket_keys(std::shared_ptr ticket_keys) { #ifdef HAVE_ATOMIC_STD_SHARED_PTR // This is single writer - std::atomic_store_explicit(&ticket_keys_, std::move(ticket_keys), - std::memory_order_release); + ticket_keys_.store(std::move(ticket_keys), std::memory_order_release); #else // !HAVE_ATOMIC_STD_SHARED_PTR std::lock_guard g(ticket_keys_m_); ticket_keys_ = std::move(ticket_keys); @@ -716,8 +720,8 @@ int Worker::setup_quic_server_socket() { if (addr.hostport == a.hostport) { LOG(FATAL) - << "QUIC frontend endpoint must be unique: a duplicate found for " - << addr.hostport; + << "QUIC frontend endpoint must be unique: a duplicate found for " + << addr.hostport; return -1; } @@ -731,6 +735,117 @@ int Worker::setup_quic_server_socket() { return 0; } +# ifdef HAVE_LIBBPF +namespace { +// https://github.com/kokke/tiny-AES-c +// +// License is Public Domain. +// Commit hash: 12e7744b4919e9d55de75b7ab566326a1c8e7a67 + +// The number of columns comprising a state in AES. This is a constant +// in AES. Value=4 +# define Nb 4 + +# define Nk 4 // The number of 32 bit words in a key. +# define Nr 10 // The number of rounds in AES Cipher. + +// The lookup-tables are marked const so they can be placed in +// read-only storage instead of RAM The numbers below can be computed +// dynamically trading ROM for RAM - This can be useful in (embedded) +// bootloader applications, where ROM is often limited. +const uint8_t sbox[256] = { + // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, + 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, + 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, + 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, + 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, + 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, + 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, + 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, + 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, + 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, + 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, + 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, + 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, + 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, + 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, + 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, + 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, + 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, + 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16}; + +# define getSBoxValue(num) (sbox[(num)]) + +// The round constant word array, Rcon[i], contains the values given +// by x to the power (i-1) being powers of x (x is denoted as {02}) in +// the field GF(2^8) +const uint8_t Rcon[11] = {0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, + 0x20, 0x40, 0x80, 0x1b, 0x36}; + +// This function produces Nb(Nr+1) round keys. The round keys are used +// in each round to decrypt the states. +void KeyExpansion(uint8_t *RoundKey, const uint8_t *Key) { + unsigned i, j, k; + uint8_t tempa[4]; // Used for the column/row operations + + // The first round key is the key itself. + for (i = 0; i < Nk; ++i) { + RoundKey[(i * 4) + 0] = Key[(i * 4) + 0]; + RoundKey[(i * 4) + 1] = Key[(i * 4) + 1]; + RoundKey[(i * 4) + 2] = Key[(i * 4) + 2]; + RoundKey[(i * 4) + 3] = Key[(i * 4) + 3]; + } + + // All other round keys are found from the previous round keys. + for (i = Nk; i < Nb * (Nr + 1); ++i) { + { + k = (i - 1) * 4; + tempa[0] = RoundKey[k + 0]; + tempa[1] = RoundKey[k + 1]; + tempa[2] = RoundKey[k + 2]; + tempa[3] = RoundKey[k + 3]; + } + + if (i % Nk == 0) { + // This function shifts the 4 bytes in a word to the left once. + // [a0,a1,a2,a3] becomes [a1,a2,a3,a0] + + // Function RotWord() + { + const uint8_t u8tmp = tempa[0]; + tempa[0] = tempa[1]; + tempa[1] = tempa[2]; + tempa[2] = tempa[3]; + tempa[3] = u8tmp; + } + + // SubWord() is a function that takes a four-byte input word and + // applies the S-box to each of the four bytes to produce an + // output word. + + // Function Subword() + { + tempa[0] = getSBoxValue(tempa[0]); + tempa[1] = getSBoxValue(tempa[1]); + tempa[2] = getSBoxValue(tempa[2]); + tempa[3] = getSBoxValue(tempa[3]); + } + + tempa[0] = tempa[0] ^ Rcon[i / Nk]; + } + j = i * 4; + k = (i - Nk) * 4; + RoundKey[j + 0] = RoundKey[k + 0] ^ tempa[0]; + RoundKey[j + 1] = RoundKey[k + 1] ^ tempa[1]; + RoundKey[j + 2] = RoundKey[k + 2] ^ tempa[2]; + RoundKey[j + 3] = RoundKey[k + 3] ^ tempa[3]; + } +} +} // namespace +# endif // HAVE_LIBBPF + int Worker::create_quic_server_socket(UpstreamAddr &faddr) { std::array errbuf; int fd = -1; @@ -745,8 +860,7 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) { hints.ai_flags |= AI_ADDRCONFIG; # endif // AI_ADDRCONFIG - auto node = - faddr.host == StringRef::from_lit("*") ? nullptr : faddr.host.c_str(); + auto node = faddr.host == "*"_sr ? nullptr : faddr.host.data(); addrinfo *res, *rp; rv = getaddrinfo(node, service.c_str(), &hints, &res); @@ -832,8 +946,8 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) { static_cast(sizeof(val))) == -1) { auto error = errno; LOG(WARN) - << "Failed to set IPV6_RECVPKTINFO option to listener socket: " - << xsi_strerror(error, errbuf.data(), errbuf.size()); + << "Failed to set IPV6_RECVPKTINFO option to listener socket: " + << xsi_strerror(error, errbuf.data(), errbuf.size()); close(fd); continue; } @@ -853,8 +967,8 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) { static_cast(sizeof(mtu_disc))) == -1) { auto error = errno; LOG(WARN) - << "Failed to set IPV6_MTU_DISCOVER option to listener socket: " - << xsi_strerror(error, errbuf.data(), errbuf.size()); + << "Failed to set IPV6_MTU_DISCOVER option to listener socket: " + << xsi_strerror(error, errbuf.data(), errbuf.size()); close(fd); continue; } @@ -917,7 +1031,7 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) { if (should_attach_bpf()) { auto &bpfconf = config->quic.bpf; - auto obj = bpf_object__open_file(bpfconf.prog_file.c_str(), nullptr); + auto obj = bpf_object__open_file(bpfconf.prog_file.data(), nullptr); if (!obj) { auto error = errno; LOG(FATAL) << "Failed to open bpf object file: " @@ -949,7 +1063,7 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) { ref.obj = obj; ref.reuseport_array = - bpf_object__find_map_by_name(obj, "reuseport_array"); + bpf_object__find_map_by_name(obj, "reuseport_array"); if (!ref.reuseport_array) { auto error = errno; LOG(FATAL) << "Failed to get reuseport_array: " @@ -958,10 +1072,10 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) { return -1; } - ref.cid_prefix_map = bpf_object__find_map_by_name(obj, "cid_prefix_map"); - if (!ref.cid_prefix_map) { + ref.worker_id_map = bpf_object__find_map_by_name(obj, "worker_id_map"); + if (!ref.worker_id_map) { auto error = errno; - LOG(FATAL) << "Failed to get cid_prefix_map: " + LOG(FATAL) << "Failed to get worker_id_map: " << xsi_strerror(error, errbuf.data(), errbuf.size()); close(fd); return -1; @@ -989,30 +1103,29 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) { return -1; } - constexpr uint32_t key_high_idx = 1; - constexpr uint32_t key_low_idx = 2; - auto &qkms = conn_handler_->get_quic_keying_materials(); auto &qkm = qkms->keying_materials.front(); - rv = bpf_map__update_elem(sk_info, &key_high_idx, sizeof(key_high_idx), - qkm.cid_encryption_key.data(), - qkm.cid_encryption_key.size() / 2, BPF_ANY); - if (rv != 0) { + auto aes_key = bpf_object__find_map_by_name(obj, "aes_key"); + if (!aes_key) { auto error = errno; - LOG(FATAL) << "Failed to update key_high_idx sk_info: " + LOG(FATAL) << "Failed to get aes_key: " << xsi_strerror(error, errbuf.data(), errbuf.size()); close(fd); return -1; } - rv = bpf_map__update_elem(sk_info, &key_low_idx, sizeof(key_low_idx), - qkm.cid_encryption_key.data() + - qkm.cid_encryption_key.size() / 2, - qkm.cid_encryption_key.size() / 2, BPF_ANY); + constexpr size_t expanded_aes_keylen = 176; + std::array aes_exp_key; + + KeyExpansion(aes_exp_key.data(), qkm.cid_encryption_key.data()); + + rv = + bpf_map__update_elem(aes_key, &zero, sizeof(zero), aes_exp_key.data(), + aes_exp_key.size(), BPF_ANY); if (rv != 0) { auto error = errno; - LOG(FATAL) << "Failed to update key_low_idx sk_info: " + LOG(FATAL) << "Failed to update aes_key: " << xsi_strerror(error, errbuf.data(), errbuf.size()); close(fd); return -1; @@ -1043,12 +1156,12 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) { return -1; } - rv = bpf_map__update_elem(ref.cid_prefix_map, cid_prefix_.data(), - cid_prefix_.size(), &sk_index, sizeof(sk_index), - BPF_NOEXIST); + rv = + bpf_map__update_elem(ref.worker_id_map, &worker_id_, sizeof(worker_id_), + &sk_index, sizeof(sk_index), BPF_NOEXIST); if (rv != 0) { auto error = errno; - LOG(FATAL) << "Failed to update cid_prefix_map: " + LOG(FATAL) << "Failed to update worker_id_map: " << xsi_strerror(error, errbuf.data(), errbuf.size()); close(fd); return -1; @@ -1075,7 +1188,7 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) { return 0; } -const uint8_t *Worker::get_cid_prefix() const { return cid_prefix_.data(); } +const WorkerID &Worker::get_worker_id() const { return worker_id_; } const UpstreamAddr *Worker::find_quic_upstream_addr(const Address &local_addr) { std::array host; @@ -1122,13 +1235,13 @@ const UpstreamAddr *Worker::find_quic_upstream_addr(const Address &local_addr) { if (faddr.port == 443 || faddr.port == 80) { switch (faddr.family) { case AF_INET: - if (util::streq(faddr.hostport, StringRef::from_lit("0.0.0.0"))) { + if (faddr.hostport == "0.0.0.0"_sr) { fallback_faddr = &faddr; } break; case AF_INET6: - if (util::streq(faddr.hostport, StringRef::from_lit("[::]"))) { + if (faddr.hostport == "[::]"_sr) { fallback_faddr = &faddr; } @@ -1139,14 +1252,13 @@ const UpstreamAddr *Worker::find_quic_upstream_addr(const Address &local_addr) { } else { switch (faddr.family) { case AF_INET: - if (util::starts_with(faddr.hostport, - StringRef::from_lit("0.0.0.0:"))) { + if (util::starts_with(faddr.hostport, "0.0.0.0:"_sr)) { fallback_faddr = &faddr; } break; case AF_INET6: - if (util::starts_with(faddr.hostport, StringRef::from_lit("[::]:"))) { + if (util::starts_with(faddr.hostport, "[::]:"_sr)) { fallback_faddr = &faddr; } @@ -1163,11 +1275,9 @@ const UpstreamAddr *Worker::find_quic_upstream_addr(const Address &local_addr) { namespace { size_t match_downstream_addr_group_host( - const RouterConfig &routerconf, const StringRef &host, - const StringRef &path, - const std::vector> &groups, - size_t catch_all, BlockAllocator &balloc) { - + const RouterConfig &routerconf, const StringRef &host, const StringRef &path, + const std::vector> &groups, + size_t catch_all, BlockAllocator &balloc) { const auto &router = routerconf.router; const auto &rev_wildcard_router = routerconf.rev_wildcard_router; const auto &wildcard_patterns = routerconf.wildcard_patterns; @@ -1189,9 +1299,9 @@ size_t match_downstream_addr_group_host( if (!wildcard_patterns.empty() && !host.empty()) { auto rev_host_src = make_byte_ref(balloc, host.size() - 1); auto ep = - std::copy(std::begin(host) + 1, std::end(host), rev_host_src.base); - std::reverse(rev_host_src.base, ep); - auto rev_host = StringRef{rev_host_src.base, ep}; + std::copy(std::begin(host) + 1, std::end(host), std::begin(rev_host_src)); + std::reverse(std::begin(rev_host_src), ep); + auto rev_host = StringRef{std::span{std::begin(rev_host_src), ep}}; ssize_t best_group = -1; const RNode *last_node = nullptr; @@ -1199,7 +1309,7 @@ size_t match_downstream_addr_group_host( for (;;) { size_t nread = 0; auto wcidx = - rev_wildcard_router.match_prefix(&nread, &last_node, rev_host); + rev_wildcard_router.match_prefix(&nread, &last_node, rev_host); if (wcidx == -1) { break; } @@ -1225,7 +1335,7 @@ size_t match_downstream_addr_group_host( } } - group = router.match(StringRef::from_lit(""), path); + group = router.match(""_sr, path); if (group != -1) { if (LOG_ENABLED(INFO)) { LOG(INFO) << "Found pattern with query " << path @@ -1242,10 +1352,10 @@ size_t match_downstream_addr_group_host( } // namespace size_t match_downstream_addr_group( - const RouterConfig &routerconf, const StringRef &hostport, - const StringRef &raw_path, - const std::vector> &groups, - size_t catch_all, BlockAllocator &balloc) { + const RouterConfig &routerconf, const StringRef &hostport, + const StringRef &raw_path, + const std::vector> &groups, + size_t catch_all, BlockAllocator &balloc) { if (std::find(std::begin(hostport), std::end(hostport), '/') != std::end(hostport)) { // We use '/' specially, and if '/' is included in host, it breaks @@ -1258,7 +1368,7 @@ size_t match_downstream_addr_group( auto path = StringRef{std::begin(raw_path), query}; if (path.empty() || path[0] != '/') { - path = StringRef::from_lit("/"); + path = "/"_sr; } if (hostport.empty()) { @@ -1289,10 +1399,10 @@ size_t match_downstream_addr_group( return 'A' <= c || c <= 'Z'; }) != std::end(host)) { auto low_host = make_byte_ref(balloc, host.size() + 1); - auto ep = std::copy(std::begin(host), std::end(host), low_host.base); + auto ep = std::copy(std::begin(host), std::end(host), std::begin(low_host)); *ep = '\0'; - util::inp_strlower(low_host.base, ep); - host = StringRef{low_host.base, ep}; + util::inp_strlower(std::begin(low_host), ep); + host = StringRef{std::span{std::begin(low_host), ep}}; } return match_downstream_addr_group_host(routerconf, host, path, groups, catch_all, balloc); @@ -1332,16 +1442,4 @@ void downstream_failure(DownstreamAddr *addr, const Address *raddr) { } } -#ifdef ENABLE_HTTP3 -int create_cid_prefix(uint8_t *cid_prefix, const uint8_t *server_id) { - auto p = std::copy_n(server_id, SHRPX_QUIC_SERVER_IDLEN, cid_prefix); - - if (RAND_bytes(p, SHRPX_QUIC_CID_PREFIXLEN - SHRPX_QUIC_SERVER_IDLEN) != 1) { - return -1; - } - - return 0; -} -#endif // ENABLE_HTTP3 - } // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_worker.h b/lib/nghttp2-1.65.0/src/shrpx_worker.h similarity index 92% rename from lib/nghttp2/src/shrpx_worker.h rename to lib/nghttp2-1.65.0/src/shrpx_worker.h index 3cc7b576235..30e1929a003 100644 --- a/lib/nghttp2/src/shrpx_worker.h +++ b/lib/nghttp2-1.65.0/src/shrpx_worker.h @@ -38,8 +38,16 @@ # include #endif // NOTHREADS -#include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include @@ -170,7 +178,7 @@ struct DownstreamAddrEntryGreater { struct WeightGroup { std::priority_queue, DownstreamAddrEntryGreater> - pq; + pq; size_t seq; uint32_t weight; uint32_t cycle; @@ -198,11 +206,11 @@ struct WeightGroupEntryGreater { struct SharedDownstreamAddr { SharedDownstreamAddr() - : balloc(1024, 1024), - affinity{SessionAffinity::NONE}, - redirect_if_not_tls{false}, - dnf{false}, - timeout{} {} + : balloc(1024, 1024), + affinity{SessionAffinity::NONE}, + redirect_if_not_tls{false}, + dnf{false}, + timeout{} {} SharedDownstreamAddr(const SharedDownstreamAddr &) = delete; SharedDownstreamAddr(SharedDownstreamAddr &&) = delete; @@ -214,7 +222,7 @@ struct SharedDownstreamAddr { std::vector wgs; std::priority_queue, WeightGroupEntryGreater> - pq; + pq; // Bunch of session affinity hash. Only used if affinity == // SessionAffinity::IP. std::vector affinity_hash; @@ -265,12 +273,12 @@ struct WorkerStat { struct QUICPacket { QUICPacket(size_t upstream_addr_index, const Address &remote_addr, const Address &local_addr, const ngtcp2_pkt_info &pi, - const uint8_t *data, size_t datalen) - : upstream_addr_index{upstream_addr_index}, - remote_addr{remote_addr}, - local_addr{local_addr}, - pi{pi}, - data{data, data + datalen} {} + std::span data) + : upstream_addr_index{upstream_addr_index}, + remote_addr{remote_addr}, + local_addr{local_addr}, + pi{pi}, + data{std::begin(data), std::end(data)} {} QUICPacket() : upstream_addr_index{}, remote_addr{}, local_addr{}, pi{} {} size_t upstream_addr_index; Address remote_addr; @@ -312,7 +320,7 @@ class Worker { tls::CertLookupTree *cert_tree, #ifdef ENABLE_HTTP3 SSL_CTX *quic_sv_ssl_ctx, tls::CertLookupTree *quic_cert_tree, - const uint8_t *cid_prefix, size_t cid_prefixlen, + WorkerID wid, # ifdef HAVE_LIBBPF size_t index, # endif // HAVE_LIBBPF @@ -377,7 +385,7 @@ class Worker { int setup_quic_server_socket(); - const uint8_t *get_cid_prefix() const; + const WorkerID &get_worker_id() const; # ifdef HAVE_LIBBPF bool should_attach_bpf() const; @@ -414,7 +422,7 @@ class Worker { DNSTracker dns_tracker_; #ifdef ENABLE_HTTP3 - std::array cid_prefix_; + WorkerID worker_id_; std::vector quic_upstream_addrs_; std::vector> quic_listeners_; #endif // ENABLE_HTTP3 @@ -439,10 +447,12 @@ class Worker { QUICConnectionHandler quic_conn_handler_; #endif // ENABLE_HTTP3 -#ifndef HAVE_ATOMIC_STD_SHARED_PTR +#ifdef HAVE_ATOMIC_STD_SHARED_PTR + std::atomic> ticket_keys_; +#else // !HAVE_ATOMIC_STD_SHARED_PTR std::mutex ticket_keys_m_; -#endif // !HAVE_ATOMIC_STD_SHARED_PTR std::shared_ptr ticket_keys_; +#endif // !HAVE_ATOMIC_STD_SHARED_PTR std::vector> downstream_addr_groups_; // Worker level blocker for downstream connection. For example, // this is used when file descriptor is exhausted. @@ -458,23 +468,16 @@ class Worker { // group. The catch-all group index is given in |catch_all|. All // patterns are given in |groups|. size_t match_downstream_addr_group( - const RouterConfig &routerconfig, const StringRef &hostport, - const StringRef &path, - const std::vector> &groups, - size_t catch_all, BlockAllocator &balloc); + const RouterConfig &routerconfig, const StringRef &hostport, + const StringRef &path, + const std::vector> &groups, + size_t catch_all, BlockAllocator &balloc); // Calls this function if connecting to backend failed. |raddr| is // the actual address used to connect to backend, and it could be // nullptr. This function may schedule live check. void downstream_failure(DownstreamAddr *addr, const Address *raddr); -#ifdef ENABLE_HTTP3 -// Creates unpredictable SHRPX_QUIC_CID_PREFIXLEN bytes sequence which -// is used as a prefix of QUIC Connection ID. This function returns -// -1 on failure. |server_id| must be 2 bytes long. -int create_cid_prefix(uint8_t *cid_prefix, const uint8_t *server_id); -#endif // ENABLE_HTTP3 - } // namespace shrpx #endif // SHRPX_WORKER_H diff --git a/lib/nghttp2/src/shrpx_worker_process.cc b/lib/nghttp2-1.65.0/src/shrpx_worker_process.cc similarity index 89% rename from lib/nghttp2/src/shrpx_worker_process.cc rename to lib/nghttp2-1.65.0/src/shrpx_worker_process.cc index 33ef29c47ce..04fd369f094 100644 --- a/lib/nghttp2/src/shrpx_worker_process.cc +++ b/lib/nghttp2-1.65.0/src/shrpx_worker_process.cc @@ -35,7 +35,14 @@ #include #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include @@ -65,7 +72,7 @@ namespace shrpx { namespace { void drop_privileges( #ifdef HAVE_NEVERBLEED - neverbleed_t *nb + neverbleed_t *nb #endif // HAVE_NEVERBLEED ) { std::array errbuf; @@ -74,11 +81,11 @@ void drop_privileges( if (getuid() == 0 && config->uid != 0) { #ifdef HAVE_NEVERBLEED if (nb) { - neverbleed_setuidgid(nb, config->user.c_str(), 1); + neverbleed_setuidgid(nb, config->user.data(), 1); } #endif // HAVE_NEVERBLEED - if (initgroups(config->user.c_str(), config->gid) != 0) { + if (initgroups(config->user.data(), config->gid) != 0) { auto error = errno; LOG(FATAL) << "Could not change supplementary groups: " << xsi_strerror(error, errbuf.data(), errbuf.size()); @@ -242,9 +249,9 @@ void renew_ticket_key_cb(struct ev_loop *loop, ev_timer *w, int revents) { assert(!old_keys.empty()); auto max_tickets = - static_cast(std::chrono::duration_cast( - get_config()->tls.session_timeout) - .count()); + static_cast(std::chrono::duration_cast( + get_config()->tls.session_timeout) + .count()); new_keys.resize(std::min(max_tickets, old_keys.size() + 1)); std::copy_n(std::begin(old_keys), new_keys.size() - 1, @@ -398,7 +405,7 @@ void nb_child_cb(struct ev_loop *loop, ev_child *w, int revents) { ev_child_stop(loop, w); - LOG(FATAL) << "neverbleed process exitted; aborting now"; + LOG(FATAL) << "neverbleed process exited; aborting now"; nghttp2_Exit(EXIT_FAILURE); } @@ -476,12 +483,12 @@ int worker_process_event_loop(WorkerProcessConfig *wpconf) { #ifdef ENABLE_HTTP3 conn_handler->set_quic_ipc_fd(wpconf->quic_ipc_fd); conn_handler->set_quic_lingering_worker_processes( - wpconf->quic_lingering_worker_processes); + wpconf->quic_lingering_worker_processes); #endif // ENABLE_HTTP3 for (auto &addr : config->conn.listener.addrs) { conn_handler->add_acceptor( - std::make_unique(&addr, conn_handler.get())); + std::make_unique(&addr, conn_handler.get())); } MemchunkPool mcpool; @@ -499,9 +506,9 @@ int worker_process_event_loop(WorkerProcessConfig *wpconf) { } conn_handler->set_tls_ticket_key_memcached_dispatcher( - std::make_unique( - &ticketconf.memcached.addr, loop, ssl_ctx, - StringRef{memcachedconf.host}, &mcpool, gen)); + std::make_unique( + &ticketconf.memcached.addr, loop, ssl_ctx, + StringRef{memcachedconf.host}, &mcpool, gen)); ev_timer_init(&renew_ticket_key_timer, memcached_get_ticket_key_cb, 0., 0.); @@ -513,15 +520,15 @@ int worker_process_event_loop(WorkerProcessConfig *wpconf) { if (!ticketconf.files.empty()) { if (!ticketconf.cipher_given) { LOG(WARN) - << "It is strongly recommended to specify " - "--tls-ticket-key-cipher=aes-128-cbc (or " - "tls-ticket-key-cipher=aes-128-cbc in configuration file) " - "when --tls-ticket-key-file is used for the smooth " - "transition when the default value of --tls-ticket-key-cipher " - "becomes aes-256-cbc"; + << "It is strongly recommended to specify " + "--tls-ticket-key-cipher=aes-128-cbc (or " + "tls-ticket-key-cipher=aes-128-cbc in configuration file) " + "when --tls-ticket-key-file is used for the smooth " + "transition when the default value of --tls-ticket-key-cipher " + "becomes aes-256-cbc"; } auto ticket_keys = read_tls_ticket_key_file( - ticketconf.files, ticketconf.cipher, EVP_sha256()); + ticketconf.files, ticketconf.cipher, EVP_sha256()); if (!ticket_keys) { LOG(WARN) << "Use internal session ticket key generator"; } else { @@ -576,20 +583,38 @@ int worker_process_event_loop(WorkerProcessConfig *wpconf) { } for (auto &qkm : qkms->keying_materials) { - if (generate_quic_connection_id_encryption_key( - qkm.cid_encryption_key.data(), qkm.cid_encryption_key.size(), - qkm.secret.data(), qkm.secret.size(), qkm.salt.data(), - qkm.salt.size()) != 0) { + if (generate_quic_connection_id_encryption_key(qkm.cid_encryption_key, + qkm.secret, qkm.salt) != 0) { LOG(ERROR) << "Failed to generate QUIC Connection ID encryption key"; return -1; } + + qkm.cid_encryption_ctx = EVP_CIPHER_CTX_new(); + if (!EVP_EncryptInit_ex(qkm.cid_encryption_ctx, EVP_aes_128_ecb(), nullptr, + qkm.cid_encryption_key.data(), nullptr)) { + LOG(ERROR) + << "Failed to initialize QUIC Connection ID encryption context"; + return -1; + } + + EVP_CIPHER_CTX_set_padding(qkm.cid_encryption_ctx, 0); + + qkm.cid_decryption_ctx = EVP_CIPHER_CTX_new(); + if (!EVP_DecryptInit_ex(qkm.cid_decryption_ctx, EVP_aes_128_ecb(), nullptr, + qkm.cid_encryption_key.data(), nullptr)) { + LOG(ERROR) + << "Failed to initialize QUIC Connection ID decryption context"; + return -1; + } + + EVP_CIPHER_CTX_set_padding(qkm.cid_decryption_ctx, 0); } conn_handler->set_quic_keying_materials(std::move(qkms)); - conn_handler->set_cid_prefixes(wpconf->cid_prefixes); + conn_handler->set_worker_ids(wpconf->worker_ids); conn_handler->set_quic_lingering_worker_processes( - wpconf->quic_lingering_worker_processes); + wpconf->quic_lingering_worker_processes); #endif // ENABLE_HTTP3 if (config->single_thread) { @@ -632,7 +657,7 @@ int worker_process_event_loop(WorkerProcessConfig *wpconf) { drop_privileges( #ifdef HAVE_NEVERBLEED - nb.get() + nb.get() #endif // HAVE_NEVERBLEED ); diff --git a/lib/nghttp2/src/shrpx_worker_process.h b/lib/nghttp2-1.65.0/src/shrpx_worker_process.h similarity index 94% rename from lib/nghttp2/src/shrpx_worker_process.h rename to lib/nghttp2-1.65.0/src/shrpx_worker_process.h index f4325031b41..155b565e732 100644 --- a/lib/nghttp2/src/shrpx_worker_process.h +++ b/lib/nghttp2-1.65.0/src/shrpx_worker_process.h @@ -49,8 +49,8 @@ struct WorkerProcessConfig { // IPv6 socket, or -1 if not used int server_fd6; #ifdef ENABLE_HTTP3 - // CID prefixes for the new worker process. - std::vector> cid_prefixes; + // Worker IDs for the new worker process. + std::vector worker_ids; // IPC socket to read forwarded QUIC UDP datagram from the current // worker process. int quic_ipc_fd; diff --git a/lib/nghttp2-1.65.0/src/shrpx_worker_test.cc b/lib/nghttp2-1.65.0/src/shrpx_worker_test.cc new file mode 100644 index 00000000000..cdb9221f6c4 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/shrpx_worker_test.cc @@ -0,0 +1,262 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2016 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "shrpx_worker_test.h" + +#ifdef HAVE_UNISTD_H +# include +#endif // HAVE_UNISTD_H + +#include + +#include "munitxx.h" + +#include "shrpx_worker.h" +#include "shrpx_connect_blocker.h" +#include "shrpx_log.h" + +namespace shrpx { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_shrpx_worker_match_downstream_addr_group), + munit_test_end(), +}; +} // namespace + +const MunitSuite worker_suite{ + "/worker", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +void test_shrpx_worker_match_downstream_addr_group(void) { + auto groups = std::vector>(); + for (auto &s : {"nghttp2.org/", "nghttp2.org/alpha/bravo/", + "nghttp2.org/alpha/charlie", "nghttp2.org/delta%3A", + "www.nghttp2.org/", "[::1]/", "nghttp2.org/alpha/bravo/delta", + // Check that match is done in the single node + "example.com/alpha/bravo", "192.168.0.1/alpha/", "/golf/"}) { + auto g = std::make_shared(); + g->pattern = ImmutableString(s); + groups.push_back(std::move(g)); + } + + BlockAllocator balloc(1024, 1024); + RouterConfig routerconf; + + auto &router = routerconf.router; + auto &wcrouter = routerconf.rev_wildcard_router; + auto &wp = routerconf.wildcard_patterns; + + for (size_t i = 0; i < groups.size(); ++i) { + auto &g = groups[i]; + router.add_route(StringRef{g->pattern}, i); + } + + assert_size(0, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, "/"_sr, + groups, 255, balloc)); + + // port is removed + assert_size(0, ==, + match_downstream_addr_group(routerconf, "nghttp2.org:8080"_sr, + "/"_sr, groups, 255, balloc)); + + // host is case-insensitive + assert_size(4, ==, + match_downstream_addr_group(routerconf, "WWW.nghttp2.org"_sr, + "/alpha"_sr, groups, 255, balloc)); + + assert_size(1, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, + "/alpha/bravo/"_sr, groups, 255, + balloc)); + + // /alpha/bravo also matches /alpha/bravo/ + assert_size(1, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, + "/alpha/bravo"_sr, groups, 255, + balloc)); + + // path part is case-sensitive + assert_size(0, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, + "/Alpha/bravo"_sr, groups, 255, + balloc)); + + assert_size(1, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, + "/alpha/bravo/charlie"_sr, groups, + 255, balloc)); + + assert_size(2, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, + "/alpha/charlie"_sr, groups, 255, + balloc)); + + // pattern which does not end with '/' must match its entirely. So + // this matches to group 0, not group 2. + assert_size(0, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, + "/alpha/charlie/"_sr, groups, 255, + balloc)); + + assert_size(255, ==, + match_downstream_addr_group(routerconf, "example.org"_sr, "/"_sr, + groups, 255, balloc)); + + assert_size(255, ==, + match_downstream_addr_group(routerconf, ""_sr, "/"_sr, groups, + 255, balloc)); + + assert_size(255, ==, + match_downstream_addr_group(routerconf, ""_sr, "alpha"_sr, groups, + 255, balloc)); + + assert_size(255, ==, + match_downstream_addr_group(routerconf, "foo/bar"_sr, "/"_sr, + groups, 255, balloc)); + + // If path is "*", only match with host + "/"). + assert_size(0, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, "*"_sr, + groups, 255, balloc)); + + assert_size(5, ==, + match_downstream_addr_group(routerconf, "[::1]"_sr, "/"_sr, + groups, 255, balloc)); + assert_size(5, ==, + match_downstream_addr_group(routerconf, "[::1]:8080"_sr, "/"_sr, + groups, 255, balloc)); + assert_size(255, ==, + match_downstream_addr_group(routerconf, "[::1"_sr, "/"_sr, groups, + 255, balloc)); + assert_size(255, ==, + match_downstream_addr_group(routerconf, "[::1]8000"_sr, "/"_sr, + groups, 255, balloc)); + + // Check the case where adding route extends tree + assert_size(6, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, + "/alpha/bravo/delta"_sr, groups, 255, + balloc)); + + assert_size(1, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, + "/alpha/bravo/delta/"_sr, groups, 255, + balloc)); + + // Check the case where query is done in a single node + assert_size(7, ==, + match_downstream_addr_group(routerconf, "example.com"_sr, + "/alpha/bravo"_sr, groups, 255, + balloc)); + + assert_size(255, ==, + match_downstream_addr_group(routerconf, "example.com"_sr, + "/alpha/bravo/"_sr, groups, 255, + balloc)); + + assert_size(255, ==, + match_downstream_addr_group(routerconf, "example.com"_sr, + "/alpha"_sr, groups, 255, balloc)); + + // Check the case where quey is done in a single node + assert_size(8, ==, + match_downstream_addr_group(routerconf, "192.168.0.1"_sr, + "/alpha"_sr, groups, 255, balloc)); + + assert_size(8, ==, + match_downstream_addr_group(routerconf, "192.168.0.1"_sr, + "/alpha/"_sr, groups, 255, balloc)); + + assert_size(8, ==, + match_downstream_addr_group(routerconf, "192.168.0.1"_sr, + "/alpha/bravo"_sr, groups, 255, + balloc)); + + assert_size(255, ==, + match_downstream_addr_group(routerconf, "192.168.0.1"_sr, + "/alph"_sr, groups, 255, balloc)); + + assert_size(255, ==, + match_downstream_addr_group(routerconf, "192.168.0.1"_sr, "/"_sr, + groups, 255, balloc)); + + // Test for wildcard hosts + auto g1 = std::make_shared(); + g1->pattern = ImmutableString::from_lit("git.nghttp2.org"); + groups.push_back(std::move(g1)); + + auto g2 = std::make_shared(); + g2->pattern = ImmutableString::from_lit(".nghttp2.org"); + groups.push_back(std::move(g2)); + + auto g3 = std::make_shared(); + g3->pattern = ImmutableString::from_lit(".local"); + groups.push_back(std::move(g3)); + + wp.emplace_back("git.nghttp2.org"_sr); + wcrouter.add_route("gro.2ptthgn.tig"_sr, 0); + wp.back().router.add_route("/echo/"_sr, 10); + + wp.emplace_back(".nghttp2.org"_sr); + wcrouter.add_route("gro.2ptthgn."_sr, 1); + wp.back().router.add_route("/echo/"_sr, 11); + wp.back().router.add_route("/echo/foxtrot"_sr, 12); + + wp.emplace_back(".local"_sr); + wcrouter.add_route("lacol."_sr, 2); + wp.back().router.add_route("/"_sr, 13); + + assert_size(11, ==, + match_downstream_addr_group(routerconf, "git.nghttp2.org"_sr, + "/echo"_sr, groups, 255, balloc)); + + assert_size(10, ==, + match_downstream_addr_group(routerconf, "0git.nghttp2.org"_sr, + "/echo"_sr, groups, 255, balloc)); + + assert_size(11, ==, + match_downstream_addr_group(routerconf, "it.nghttp2.org"_sr, + "/echo"_sr, groups, 255, balloc)); + + assert_size(255, ==, + match_downstream_addr_group(routerconf, ".nghttp2.org"_sr, + "/echo/foxtrot"_sr, groups, 255, + balloc)); + + assert_size(9, ==, + match_downstream_addr_group(routerconf, "alpha.nghttp2.org"_sr, + "/golf"_sr, groups, 255, balloc)); + + assert_size(0, ==, + match_downstream_addr_group(routerconf, "nghttp2.org"_sr, + "/echo"_sr, groups, 255, balloc)); + + assert_size(13, ==, + match_downstream_addr_group(routerconf, "test.local"_sr, + StringRef{}, groups, 255, balloc)); +} + +} // namespace shrpx diff --git a/lib/nghttp2/src/shrpx_worker_test.h b/lib/nghttp2-1.65.0/src/shrpx_worker_test.h similarity index 89% rename from lib/nghttp2/src/shrpx_worker_test.h rename to lib/nghttp2-1.65.0/src/shrpx_worker_test.h index 8ffa2f12d03..ebe81e005fe 100644 --- a/lib/nghttp2/src/shrpx_worker_test.h +++ b/lib/nghttp2-1.65.0/src/shrpx_worker_test.h @@ -29,9 +29,15 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace shrpx { -void test_shrpx_worker_match_downstream_addr_group(void); +extern const MunitSuite worker_suite; + +munit_void_test_decl(test_shrpx_worker_match_downstream_addr_group) } // namespace shrpx diff --git a/lib/nghttp2-1.65.0/src/siphash.cc b/lib/nghttp2-1.65.0/src/siphash.cc new file mode 100644 index 00000000000..6ab58ad22b6 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/siphash.cc @@ -0,0 +1,114 @@ +/* Copyright 2019 The BoringSSL Authors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2025 nghttp2 contributors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include +#include + +#include "siphash.h" + +namespace { +auto CRYPTO_load_u64_le(std::span in) { + uint64_t v; + + memcpy(&v, in.data(), sizeof(v)); + + if constexpr (std::endian::native == std::endian::big) { + return byteswap(v); + } + + return v; +} +} // namespace + +namespace { +constexpr void siphash_round(uint64_t v[4]) { + v[0] += v[1]; + v[2] += v[3]; + v[1] = std::rotl(v[1], 13); + v[3] = std::rotl(v[3], 16); + v[1] ^= v[0]; + v[3] ^= v[2]; + v[0] = std::rotl(v[0], 32); + v[2] += v[1]; + v[0] += v[3]; + v[1] = std::rotl(v[1], 17); + v[3] = std::rotl(v[3], 21); + v[1] ^= v[2]; + v[3] ^= v[0]; + v[2] = std::rotl(v[2], 32); +} +} // namespace + +uint64_t siphash24(std::span key, + std::span input) { + const auto orig_input_len = input.size(); + uint64_t v[]{ + key[0] ^ UINT64_C(0x736f6d6570736575), + key[1] ^ UINT64_C(0x646f72616e646f6d), + key[0] ^ UINT64_C(0x6c7967656e657261), + key[1] ^ UINT64_C(0x7465646279746573), + }; + + while (input.size() >= sizeof(uint64_t)) { + auto m = CRYPTO_load_u64_le(input.first()); + v[3] ^= m; + siphash_round(v); + siphash_round(v); + v[0] ^= m; + + input = input.subspan(sizeof(uint64_t)); + } + + std::array last_block{}; + std::ranges::copy(input, std::begin(last_block)); + last_block.back() = orig_input_len & 0xff; + + auto last_block_word = CRYPTO_load_u64_le(last_block); + v[3] ^= last_block_word; + siphash_round(v); + siphash_round(v); + v[0] ^= last_block_word; + + v[2] ^= 0xff; + siphash_round(v); + siphash_round(v); + siphash_round(v); + siphash_round(v); + + return v[0] ^ v[1] ^ v[2] ^ v[3]; +} diff --git a/lib/nghttp2-1.65.0/src/siphash.h b/lib/nghttp2-1.65.0/src/siphash.h new file mode 100644 index 00000000000..07c538ef05d --- /dev/null +++ b/lib/nghttp2-1.65.0/src/siphash.h @@ -0,0 +1,61 @@ +/* Copyright 2019 The BoringSSL Authors + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2025 nghttp2 contributors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef SIPHASH_H +#define SIPHASH_H + +#include +#include +#include +#include + +// SipHash is a fast, secure PRF that is often used for hash tables. + +// siphash24 implements SipHash-2-4. See +// https://131002.net/siphash/siphash.pdf +uint64_t siphash24(std::span key, + std::span input); + +// Define here to be usable in tests. +template T byteswap(T v) { + auto c = std::bit_cast>(v); + std::ranges::reverse(c); + return std::bit_cast(c); +} + +#endif // SIPHASH_H diff --git a/lib/nghttp2-1.65.0/src/siphash_test.cc b/lib/nghttp2-1.65.0/src/siphash_test.cc new file mode 100644 index 00000000000..57d8b4395ec --- /dev/null +++ b/lib/nghttp2-1.65.0/src/siphash_test.cc @@ -0,0 +1,68 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2025 nghttp2 contributors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "siphash_test.h" + +#include +#include +#include + +#include "munitxx.h" + +#include + +#include "siphash.h" + +namespace nghttp2 { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_siphash), + munit_test_end(), +}; +} // namespace + +const MunitSuite siphash_suite{ + "/siphash", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +void test_siphash(void) { + std::array key_bytes; + std::iota(std::begin(key_bytes), std::end(key_bytes), 0); + + std::array key; + memcpy(key.data(), key_bytes.data(), key_bytes.size()); + + if constexpr (std::endian::native == std::endian::big) { + key[0] = byteswap(key[0]); + key[1] = byteswap(key[1]); + } + + std::array input; + std::iota(std::begin(input), std::end(input), 0); + + assert_uint64(0xa129ca6149be45e5ull, ==, siphash24(key, input)); +} + +} // namespace nghttp2 diff --git a/lib/nghttp2/src/memchunk_test.h b/lib/nghttp2-1.65.0/src/siphash_test.h similarity index 71% rename from lib/nghttp2/src/memchunk_test.h rename to lib/nghttp2-1.65.0/src/siphash_test.h index 7d677e787ee..4dd57e537cd 100644 --- a/lib/nghttp2/src/memchunk_test.h +++ b/lib/nghttp2-1.65.0/src/siphash_test.h @@ -1,7 +1,7 @@ /* * nghttp2 - HTTP/2 C Library * - * Copyright (c) 2015 Tatsuhiro Tsujikawa + * Copyright (c) 2025 nghttp2 contributors * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -22,26 +22,23 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef MEMCHUNK_TEST_H -#define MEMCHUNK_TEST_H +#ifndef SIPHASH_TEST_H +#define SIPHASH_TEST_H #ifdef HAVE_CONFIG_H # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace nghttp2 { -void test_pool_recycle(void); -void test_memchunks_append(void); -void test_memchunks_drain(void); -void test_memchunks_riovec(void); -void test_memchunks_recycle(void); -void test_memchunks_reset(void); -void test_peek_memchunks_append(void); -void test_peek_memchunks_disable_peek_drain(void); -void test_peek_memchunks_disable_peek_no_drain(void); -void test_peek_memchunks_reset(void); +extern const MunitSuite siphash_suite; + +munit_void_test_decl(test_siphash) } // namespace nghttp2 -#endif // MEMCHUNK_TEST_H +#endif // SIPHASH_TEST_H diff --git a/lib/nghttp2/src/ssl_compat.h b/lib/nghttp2-1.65.0/src/ssl_compat.h similarity index 72% rename from lib/nghttp2/src/ssl_compat.h rename to lib/nghttp2-1.65.0/src/ssl_compat.h index ed3071973b8..2b4e80c12a7 100644 --- a/lib/nghttp2/src/ssl_compat.h +++ b/lib/nghttp2-1.65.0/src/ssl_compat.h @@ -23,29 +23,33 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef OPENSSL_COMPAT_H +#define OPENSSL_COMPAT_H +#include "nghttp2_config.h" + +#ifdef HAVE_WOLFSSL +# define NGHTTP2_OPENSSL_IS_WOLFSSL +#else // !HAVE_WOLFSSL # include # ifdef LIBRESSL_VERSION_NUMBER -# define OPENSSL_1_1_API 0 -# define OPENSSL_1_1_1_API 0 -# define OPENSSL_3_0_0_API 0 -# define LIBRESSL_IN_USE 1 -# define LIBRESSL_LEGACY_API (LIBRESSL_VERSION_NUMBER < 0x20700000L) -# define LIBRESSL_2_7_API (LIBRESSL_VERSION_NUMBER >= 0x20700000L) -# define LIBRESSL_3_5_API (LIBRESSL_VERSION_NUMBER >= 0x30500000L) -# else // !LIBRESSL_VERSION_NUMBER -# define OPENSSL_1_1_API (OPENSSL_VERSION_NUMBER >= 0x1010000fL) -# define OPENSSL_1_1_1_API (OPENSSL_VERSION_NUMBER >= 0x10101000L) -# define OPENSSL_3_0_0_API (OPENSSL_VERSION_NUMBER >= 0x30000000L) -# define LIBRESSL_IN_USE 0 -# define LIBRESSL_LEGACY_API 0 -# define LIBRESSL_2_7_API 0 -# define LIBRESSL_3_5_API 0 +# define NGHTTP2_OPENSSL_IS_LIBRESSL # endif // !LIBRESSL_VERSION_NUMBER # if defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC) # define NGHTTP2_OPENSSL_IS_BORINGSSL # endif // OPENSSL_IS_BORINGSSL || OPENSSL_IS_AWSLC +# if !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && \ + !defined(NGHTTP2_OPENSSL_IS_LIBRESSL) +# define NGHTTP2_GENUINE_OPENSSL +# endif // !NGHTTP2_OPENSSL_IS_BORINGSSL && !NGHTTP2_OPENSSL_IS_LIBRESSL + +# ifdef NGHTTP2_GENUINE_OPENSSL +# define OPENSSL_3_0_0_API (OPENSSL_VERSION_NUMBER >= 0x30000000L) +# else // !NGHTTP2_GENUINE_OPENSSL +# define OPENSSL_3_0_0_API 0 +# endif // !NGHTTP2_GENUINE_OPENSSL +#endif // !HAVE_WOLFSSL + #endif // OPENSSL_COMPAT_H diff --git a/lib/nghttp2/src/template.h b/lib/nghttp2-1.65.0/src/template.h similarity index 59% rename from lib/nghttp2/src/template.h rename to lib/nghttp2-1.65.0/src/template.h index 530a1d13334..d3a2ca3a62f 100644 --- a/lib/nghttp2/src/template.h +++ b/lib/nghttp2-1.65.0/src/template.h @@ -37,20 +37,11 @@ #include #include #include +#include +#include namespace nghttp2 { -// std::forward is constexpr since C++14 -template -constexpr std::array< - typename std::decay::type>::type, - sizeof...(T)> -make_array(T &&...t) { - return std::array< - typename std::decay::type>::type, - sizeof...(T)>{{std::forward(t)...}}; -} - template constexpr size_t array_size(T (&)[N]) { return N; } @@ -63,12 +54,11 @@ template constexpr size_t str_size(T (&)[N]) { // template can take functions returning other than void. template struct Defer { Defer(F &&f, T &&...t) - : f(std::bind(std::forward(f), std::forward(t)...)) {} + : f(std::bind(std::forward(f), std::forward(t)...)) {} Defer(Defer &&o) noexcept : f(std::move(o.f)) {} ~Defer() { f(); } - using ResultType = typename std::result_of::type( - typename std::decay::type...)>::type; + using ResultType = std::invoke_result_t; std::function f; }; @@ -90,9 +80,9 @@ template struct DList { DList &operator=(const DList &) = delete; DList(DList &&other) noexcept - : head{std::exchange(other.head, nullptr)}, - tail{std::exchange(other.tail, nullptr)}, - len{std::exchange(other.len, 0)} {} + : head{std::exchange(other.head, nullptr)}, + tail{std::exchange(other.tail, nullptr)}, + len{std::exchange(other.len, 0)} {} DList &operator=(DList &&other) noexcept { if (this == &other) { @@ -228,33 +218,33 @@ class ImmutableString { using allocator_type = std::allocator; using size_type = std::allocator_traits::size_type; using difference_type = - std::allocator_traits::difference_type; + std::allocator_traits::difference_type; using const_reference = const value_type &; using const_pointer = const value_type *; using const_iterator = const_pointer; using const_reverse_iterator = std::reverse_iterator; - ImmutableString() : len(0), base("") {} - ImmutableString(const char *s, size_t slen) - : len(slen), base(copystr(s, s + len)) {} - explicit ImmutableString(const char *s) - : len(strlen(s)), base(copystr(s, s + len)) {} - explicit ImmutableString(const std::string &s) - : len(s.size()), base(copystr(std::begin(s), std::end(s))) {} + constexpr ImmutableString() : len(0), base("") {} + constexpr ImmutableString(const char *s, size_t slen) + : len(slen), base(copystr(s, s + len)) {} + constexpr explicit ImmutableString(const char *s) + : len(traits_type::length(s)), base(copystr(s, s + len)) {} + constexpr explicit ImmutableString(const std::string &s) + : len(s.size()), base(copystr(std::begin(s), std::end(s))) {} template - ImmutableString(InputIt first, InputIt last) - : len(std::distance(first, last)), base(copystr(first, last)) {} - ImmutableString(const ImmutableString &other) - : len(other.len), base(copystr(std::begin(other), std::end(other))) {} - ImmutableString(ImmutableString &&other) noexcept - : len{std::exchange(other.len, 0)}, base{std::exchange(other.base, "")} {} - ~ImmutableString() { + constexpr ImmutableString(InputIt first, InputIt last) + : len(std::distance(first, last)), base(copystr(first, last)) {} + constexpr ImmutableString(const ImmutableString &other) + : len(other.len), base(copystr(std::begin(other), std::end(other))) {} + constexpr ImmutableString(ImmutableString &&other) noexcept + : len{std::exchange(other.len, 0)}, base{std::exchange(other.base, "")} {} + constexpr ~ImmutableString() { if (len) { delete[] base; } } - ImmutableString &operator=(const ImmutableString &other) { + constexpr ImmutableString &operator=(const ImmutableString &other) { if (this == &other) { return *this; } @@ -265,7 +255,7 @@ class ImmutableString { base = copystr(std::begin(other), std::end(other)); return *this; } - ImmutableString &operator=(ImmutableString &&other) noexcept { + constexpr ImmutableString &operator=(ImmutableString &&other) noexcept { if (this == &other) { return *this; } @@ -277,33 +267,41 @@ class ImmutableString { return *this; } - template static ImmutableString from_lit(const char (&s)[N]) { + template + static constexpr ImmutableString from_lit(const char (&s)[N]) { return ImmutableString(s, N - 1); } - const_iterator begin() const { return base; }; - const_iterator cbegin() const { return base; }; + constexpr const_iterator begin() const noexcept { return base; } + constexpr const_iterator cbegin() const noexcept { return base; } - const_iterator end() const { return base + len; }; - const_iterator cend() const { return base + len; }; + constexpr const_iterator end() const noexcept { return base + len; } + constexpr const_iterator cend() const noexcept { return base + len; } - const_reverse_iterator rbegin() const { + constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator{base + len}; } - const_reverse_iterator crbegin() const { + constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator{base + len}; } - const_reverse_iterator rend() const { return const_reverse_iterator{base}; } - const_reverse_iterator crend() const { return const_reverse_iterator{base}; } + constexpr const_reverse_iterator rend() const noexcept { + return const_reverse_iterator{base}; + } + constexpr const_reverse_iterator crend() const noexcept { + return const_reverse_iterator{base}; + } - const char *c_str() const { return base; } - size_type size() const { return len; } - bool empty() const { return len == 0; } - const_reference operator[](size_type pos) const { return *(base + pos); } + constexpr const char *c_str() const noexcept { return base; } + constexpr size_type size() const noexcept { return len; } + constexpr bool empty() const noexcept { return len == 0; } + constexpr const_reference operator[](size_type pos) const noexcept { + return *(base + pos); + } private: - template const char *copystr(InputIt first, InputIt last) { + template + constexpr const char *copystr(InputIt first, InputIt last) { if (first == last) { return ""; } @@ -316,49 +314,23 @@ class ImmutableString { const char *base; }; -inline bool operator==(const ImmutableString &lhs, const ImmutableString &rhs) { +inline constexpr bool operator==(const ImmutableString &lhs, + const ImmutableString &rhs) { return lhs.size() == rhs.size() && std::equal(std::begin(lhs), std::end(lhs), std::begin(rhs)); } -inline bool operator==(const ImmutableString &lhs, const std::string &rhs) { +inline constexpr bool operator==(const ImmutableString &lhs, + const std::string &rhs) { return lhs.size() == rhs.size() && std::equal(std::begin(lhs), std::end(lhs), std::begin(rhs)); } -inline bool operator==(const std::string &lhs, const ImmutableString &rhs) { - return rhs == lhs; -} - -inline bool operator==(const ImmutableString &lhs, const char *rhs) { - return lhs.size() == strlen(rhs) && +inline constexpr bool operator==(const ImmutableString &lhs, const char *rhs) { + return lhs.size() == std::char_traits::length(rhs) && std::equal(std::begin(lhs), std::end(lhs), rhs); } -inline bool operator==(const char *lhs, const ImmutableString &rhs) { - return rhs == lhs; -} - -inline bool operator!=(const ImmutableString &lhs, const ImmutableString &rhs) { - return !(lhs == rhs); -} - -inline bool operator!=(const ImmutableString &lhs, const std::string &rhs) { - return !(lhs == rhs); -} - -inline bool operator!=(const std::string &lhs, const ImmutableString &rhs) { - return !(rhs == lhs); -} - -inline bool operator!=(const ImmutableString &lhs, const char *rhs) { - return !(lhs == rhs); -} - -inline bool operator!=(const char *lhs, const ImmutableString &rhs) { - return !(rhs == lhs); -} - inline std::ostream &operator<<(std::ostream &o, const ImmutableString &s) { return o.write(s.c_str(), s.size()); } @@ -371,8 +343,7 @@ inline std::string &operator+=(std::string &lhs, const ImmutableString &rhs) { // StringRef is a reference to a string owned by something else. So // it behaves like simple string, but it does not own pointer. When // it is default constructed, it has empty string. You can freely -// copy or move around this struct, but never free its pointer. str() -// function can be used to export the content as std::string. +// copy or move around this struct, but never free its pointer. class StringRef { public: using traits_type = std::char_traits; @@ -380,34 +351,34 @@ class StringRef { using allocator_type = std::allocator; using size_type = std::allocator_traits::size_type; using difference_type = - std::allocator_traits::difference_type; + std::allocator_traits::difference_type; using const_reference = const value_type &; using const_pointer = const value_type *; using const_iterator = const_pointer; using const_reverse_iterator = std::reverse_iterator; - constexpr StringRef() : base(""), len(0) {} - explicit StringRef(const std::string &s) : base(s.c_str()), len(s.size()) {} - explicit StringRef(const ImmutableString &s) - : base(s.c_str()), len(s.size()) {} - explicit StringRef(const char *s) : base(s), len(strlen(s)) {} + constexpr StringRef() noexcept : base(""), len(0) {} + constexpr StringRef(const StringRef &other) noexcept = default; + constexpr StringRef(std::nullptr_t) = delete; + constexpr StringRef(const std::string &s) : base(s.c_str()), len(s.size()) {} + constexpr explicit StringRef(const std::string_view &s) + : base(s.data()), len(s.size()) {} + constexpr explicit StringRef(const ImmutableString &s) + : base(s.c_str()), len(s.size()) {} + constexpr StringRef(const char *s) : base(s), len(traits_type::length(s)) {} constexpr StringRef(const char *s, size_t n) : base(s), len(n) {} - template - constexpr StringRef(const CharT *s, size_t n) - : base(reinterpret_cast(s)), len(n) {} - template - StringRef(InputIt first, InputIt last) - : base(reinterpret_cast(&*first)), - len(std::distance(first, last)) {} - template - StringRef(InputIt *first, InputIt *last) - : base(reinterpret_cast(first)), - len(std::distance(first, last)) {} - template - constexpr static StringRef from_lit(const CharT (&s)[N]) { - return StringRef{s, N - 1}; - } - static StringRef from_maybe_nullptr(const char *s) { + explicit StringRef(const uint8_t *s, size_t n) + : base(reinterpret_cast(s)), len(n) {} + template , char>>> + constexpr StringRef(InputIt first, InputIt last) + : base(std::to_address(first)), len(std::distance(first, last)) {} + constexpr StringRef(std::span s) + : base(s.data()), len(s.size_bytes()) {} + explicit StringRef(std::span s) + : base(reinterpret_cast(s.data())), len(s.size_bytes()) {} + static constexpr StringRef from_maybe_nullptr(const char *s) noexcept { if (s == nullptr) { return StringRef(); } @@ -415,103 +386,111 @@ class StringRef { return StringRef(s); } - constexpr const_iterator begin() const { return base; }; - constexpr const_iterator cbegin() const { return base; }; + constexpr StringRef &operator=(const StringRef &other) noexcept = default; + + constexpr const_iterator begin() const noexcept { return base; } + constexpr const_iterator cbegin() const noexcept { return base; } - constexpr const_iterator end() const { return base + len; }; - constexpr const_iterator cend() const { return base + len; }; + constexpr const_iterator end() const noexcept { return base + len; } + constexpr const_iterator cend() const noexcept { return base + len; } - const_reverse_iterator rbegin() const { + constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator{base + len}; } - const_reverse_iterator crbegin() const { + constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator{base + len}; } - const_reverse_iterator rend() const { return const_reverse_iterator{base}; } - const_reverse_iterator crend() const { return const_reverse_iterator{base}; } + constexpr const_reverse_iterator rend() const noexcept { + return const_reverse_iterator{base}; + } + constexpr const_reverse_iterator crend() const noexcept { + return const_reverse_iterator{base}; + } - constexpr const char *c_str() const { return base; } - constexpr size_type size() const { return len; } - constexpr bool empty() const { return len == 0; } + constexpr const_pointer data() const noexcept { return base; } + constexpr size_type size() const noexcept { return len; } + [[nodiscard]] constexpr bool empty() const noexcept { return len == 0; } constexpr const_reference operator[](size_type pos) const { return *(base + pos); } - std::string str() const { return std::string(base, len); } const uint8_t *byte() const { return reinterpret_cast(base); } + constexpr operator std::string_view() const noexcept { return {base, len}; } + + static constexpr size_type npos = size_type(-1); + + constexpr StringRef substr(size_type pos = 0, size_type count = npos) const { + return {base + pos, std::min(count, len - pos)}; + } + private: const char *base; size_type len; }; -inline bool operator==(const StringRef &lhs, const StringRef &rhs) { +inline constexpr bool operator==(const StringRef &lhs, + const StringRef &rhs) noexcept { return lhs.size() == rhs.size() && std::equal(std::begin(lhs), std::end(lhs), std::begin(rhs)); } -inline bool operator==(const StringRef &lhs, const std::string &rhs) { +inline constexpr bool operator==(const StringRef &lhs, + const ImmutableString &rhs) noexcept { return lhs.size() == rhs.size() && std::equal(std::begin(lhs), std::end(lhs), std::begin(rhs)); } -inline bool operator==(const std::string &lhs, const StringRef &rhs) { - return rhs == lhs; -} - -inline bool operator==(const StringRef &lhs, const char *rhs) { - return lhs.size() == strlen(rhs) && - std::equal(std::begin(lhs), std::end(lhs), rhs); -} - -inline bool operator==(const StringRef &lhs, const ImmutableString &rhs) { - return lhs.size() == rhs.size() && - std::equal(std::begin(lhs), std::end(lhs), std::begin(rhs)); +#if !defined(__APPLE__) && !defined(_LIBCPP_VERSION) +inline constexpr std::strong_ordering +operator<=>(const StringRef &lhs, const StringRef &rhs) noexcept { + return std::lexicographical_compare_three_way(std::begin(lhs), std::end(lhs), + std::begin(rhs), std::end(rhs)); } - -inline bool operator==(const ImmutableString &lhs, const StringRef &rhs) { - return rhs == lhs; -} - -inline bool operator==(const char *lhs, const StringRef &rhs) { - return rhs == lhs; -} - -inline bool operator!=(const StringRef &lhs, const StringRef &rhs) { - return !(lhs == rhs); -} - -inline bool operator!=(const StringRef &lhs, const std::string &rhs) { - return !(lhs == rhs); -} - -inline bool operator!=(const std::string &lhs, const StringRef &rhs) { - return !(rhs == lhs); +#else // __APPLE__ || _LIBCPP_VERSION +inline constexpr bool operator<(const StringRef &lhs, + const StringRef &rhs) noexcept { + return std::lexicographical_compare(std::begin(lhs), std::end(lhs), + std::begin(rhs), std::end(rhs)); } +#endif // __APPLE__ || _LIBCPP_VERSION -inline bool operator!=(const StringRef &lhs, const char *rhs) { - return !(lhs == rhs); +inline std::ostream &operator<<(std::ostream &o, const StringRef &s) { + return o.write(s.data(), s.size()); } -inline bool operator!=(const char *lhs, const StringRef &rhs) { - return !(rhs == lhs); +inline std::string &operator+=(std::string &lhs, const StringRef &rhs) { + lhs.append(rhs.data(), rhs.size()); + return lhs; } -inline bool operator<(const StringRef &lhs, const StringRef &rhs) { - return std::lexicographical_compare(std::begin(lhs), std::end(lhs), - std::begin(rhs), std::end(rhs)); +constexpr StringRef operator""_sr(const char *str, size_t len) noexcept { + return {str, len}; } -inline std::ostream &operator<<(std::ostream &o, const StringRef &s) { - return o.write(s.c_str(), s.size()); +template +[[nodiscard]] std::span< + const uint8_t, N == std::dynamic_extent ? std::dynamic_extent : N * sizeof(T)> +as_uint8_span(std::span s) noexcept { + return std::span < const uint8_t, + N == std::dynamic_extent + ? std::dynamic_extent + : N * sizeof(T) > + {reinterpret_cast(s.data()), s.size_bytes()}; } -inline std::string &operator+=(std::string &lhs, const StringRef &rhs) { - lhs.append(rhs.c_str(), rhs.size()); - return lhs; +template +[[nodiscard]] std::span +as_writable_uint8_span(std::span s) noexcept { + return std::span < uint8_t, + N == std::dynamic_extent + ? std::dynamic_extent + : N * sizeof(T) > + {reinterpret_cast(s.data()), s.size_bytes()}; } inline int run_app(std::function app, int argc, diff --git a/lib/nghttp2-1.65.0/src/template_test.cc b/lib/nghttp2-1.65.0/src/template_test.cc new file mode 100644 index 00000000000..4f6e840db78 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/template_test.cc @@ -0,0 +1,239 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2016 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "template_test.h" + +#include +#include +#include + +#include "munitxx.h" + +#include "template.h" + +using namespace std::literals; + +namespace nghttp2 { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_template_immutable_string), + munit_void_test(test_template_string_ref), + munit_void_test(test_template_as_uint8_span), + munit_test_end(), +}; +} // namespace + +const MunitSuite template_suite{ + "/template", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +void test_template_immutable_string(void) { + ImmutableString null; + + assert_string_equal("", null.c_str()); + assert_size(0, ==, null.size()); + assert_true(null.empty()); + + ImmutableString from_cstr("alpha"); + + assert_string_equal("alpha", from_cstr.c_str()); + assert_size(5, ==, from_cstr.size()); + assert_false(from_cstr.empty()); + assert_true("alpha" == from_cstr); + assert_true(from_cstr == "alpha"); + assert_true(std::string("alpha") == from_cstr); + assert_true(from_cstr == std::string("alpha")); + + // copy constructor + ImmutableString src("charlie"); + ImmutableString copy = src; + + assert_string_equal("charlie", copy.c_str()); + assert_size(7, ==, copy.size()); + + // copy assignment + ImmutableString copy2; + copy2 = src; + + assert_string_equal("charlie", copy2.c_str()); + assert_size(7, ==, copy2.size()); + + // move constructor + ImmutableString move = std::move(copy); + + assert_string_equal("charlie", move.c_str()); + assert_size(7, ==, move.size()); + assert_string_equal("", copy.c_str()); + assert_size(0, ==, copy.size()); + + // move assignment + move = std::move(from_cstr); + + assert_string_equal("alpha", move.c_str()); + assert_size(5, ==, move.size()); + assert_string_equal("", from_cstr.c_str()); + assert_size(0, ==, from_cstr.size()); + + // from string literal + auto from_lit = ImmutableString::from_lit("bravo"); + + assert_string_equal("bravo", from_lit.c_str()); + assert_size(5, ==, from_lit.size()); + + // equality + ImmutableString eq("delta"); + + assert_true("delta1" != eq); + assert_true("delt" != eq); + assert_true(eq != "delta1"); + assert_true(eq != "delt"); + + // operator[] + ImmutableString br_op("foxtrot"); + + assert_char('f', ==, br_op[0]); + assert_char('o', ==, br_op[1]); + assert_char('t', ==, br_op[6]); + assert_char('\0', ==, br_op[7]); + + // operator==(const ImmutableString &, const ImmutableString &) + { + ImmutableString a("foo"); + ImmutableString b("foo"); + ImmutableString c("fo"); + + assert_true(a == b); + assert_true(a != c); + assert_true(c != b); + } + + // operator<< + { + ImmutableString a("foo"); + std::stringstream ss; + ss << a; + + assert_stdstring_equal("foo", ss.str()); + } + + // operator +=(std::string &, const ImmutableString &) + { + std::string a = "alpha"; + a += ImmutableString("bravo"); + + assert_stdstring_equal("alphabravo", a); + } +} + +void test_template_string_ref(void) { + StringRef empty; + + assert_stdsv_equal(""sv, empty); + assert_size(0, ==, empty.size()); + + // from std::string + std::string alpha = "alpha"; + + StringRef ref(alpha); + + assert_true("alpha" == ref); + assert_true(ref == "alpha"); + assert_true(alpha == ref); + assert_true(ref == alpha); + assert_size(5, ==, ref.size()); + + // from string literal + auto from_lit = "alpha"_sr; + + assert_stdsv_equal("alpha"sv, from_lit); + assert_size(5, ==, from_lit.size()); + + // from ImmutableString + auto im = ImmutableString::from_lit("bravo"); + + StringRef imref(im); + + assert_stdsv_equal("bravo"sv, imref); + assert_size(5, ==, imref.size()); + + // from C-string + StringRef cstrref("charlie"); + + assert_stdsv_equal("charlie"sv, cstrref); + assert_size(7, ==, cstrref.size()); + + // from C-string and its length + StringRef cstrnref("delta", 5); + + assert_stdsv_equal("delta"sv, cstrnref); + assert_size(5, ==, cstrnref.size()); + + // operator[] + StringRef br_op("foxtrot"); + + assert_char('f', ==, br_op[0]); + assert_char('o', ==, br_op[1]); + assert_char('t', ==, br_op[6]); + assert_char('\0', ==, br_op[7]); + + // operator<< + { + StringRef a("foo"); + std::stringstream ss; + ss << a; + + assert_stdstring_equal("foo", ss.str()); + } + + // operator +=(std::string &, const StringRef &) + { + std::string a = "alpha"; + a += StringRef("bravo"); + + assert_stdstring_equal("alphabravo", a); + } +} + +void test_template_as_uint8_span(void) { + uint32_t a[2]; + + memcpy(&a, "\xc0\xc1\xc2\xc3\xf0\xf1\xf2\xf3", sizeof(a)); + + // dynamic extent + auto s = as_uint8_span(std::span{a, 2}); + + assert_size(sizeof(a), ==, s.size()); + assert_size(std::dynamic_extent, ==, s.extent); + assert_memory_equal(s.size(), &a, s.data()); + + // non-dynamic extent + auto t = as_uint8_span(std::span{a, 2}); + + assert_size(sizeof(a), ==, t.size()); + assert_size(sizeof(a), ==, t.extent); + assert_memory_equal(t.size(), &a, t.data()); +} + +} // namespace nghttp2 diff --git a/lib/nghttp2/src/template_test.h b/lib/nghttp2-1.65.0/src/template_test.h similarity index 84% rename from lib/nghttp2/src/template_test.h rename to lib/nghttp2-1.65.0/src/template_test.h index 2c1448f34df..db02f442039 100644 --- a/lib/nghttp2/src/template_test.h +++ b/lib/nghttp2-1.65.0/src/template_test.h @@ -29,10 +29,17 @@ # include #endif // HAVE_CONFIG_H +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + namespace nghttp2 { -void test_template_immutable_string(void); -void test_template_string_ref(void); +extern const MunitSuite template_suite; + +munit_void_test_decl(test_template_immutable_string) +munit_void_test_decl(test_template_string_ref) +munit_void_test_decl(test_template_as_uint8_span) } // namespace nghttp2 diff --git a/lib/nghttp2/src/test.example.com.pem b/lib/nghttp2-1.65.0/src/test.example.com.pem similarity index 100% rename from lib/nghttp2/src/test.example.com.pem rename to lib/nghttp2-1.65.0/src/test.example.com.pem diff --git a/lib/nghttp2/src/test.nghttp2.org.pem b/lib/nghttp2-1.65.0/src/test.nghttp2.org.pem similarity index 100% rename from lib/nghttp2/src/test.nghttp2.org.pem rename to lib/nghttp2-1.65.0/src/test.nghttp2.org.pem diff --git a/lib/nghttp2/src/testdata/Makefile.am b/lib/nghttp2-1.65.0/src/testdata/Makefile.am similarity index 100% rename from lib/nghttp2/src/testdata/Makefile.am rename to lib/nghttp2-1.65.0/src/testdata/Makefile.am diff --git a/lib/nghttp2-1.65.0/src/testdata/Makefile.in b/lib/nghttp2-1.65.0/src/testdata/Makefile.in new file mode 100644 index 00000000000..1b6c5bd9752 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/testdata/Makefile.in @@ -0,0 +1,546 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2023 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = src/testdata +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +EXTRA_DIST = \ + ipaddr.crt \ + nosan.crt \ + nosan_ip.crt \ + verify_hostname.crt + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/testdata/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/testdata/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/src/testdata/ipaddr.crt b/lib/nghttp2-1.65.0/src/testdata/ipaddr.crt similarity index 100% rename from lib/nghttp2/src/testdata/ipaddr.crt rename to lib/nghttp2-1.65.0/src/testdata/ipaddr.crt diff --git a/lib/nghttp2/src/testdata/nosan.crt b/lib/nghttp2-1.65.0/src/testdata/nosan.crt similarity index 100% rename from lib/nghttp2/src/testdata/nosan.crt rename to lib/nghttp2-1.65.0/src/testdata/nosan.crt diff --git a/lib/nghttp2/src/testdata/nosan_ip.crt b/lib/nghttp2-1.65.0/src/testdata/nosan_ip.crt similarity index 100% rename from lib/nghttp2/src/testdata/nosan_ip.crt rename to lib/nghttp2-1.65.0/src/testdata/nosan_ip.crt diff --git a/lib/nghttp2/src/testdata/verify_hostname.crt b/lib/nghttp2-1.65.0/src/testdata/verify_hostname.crt similarity index 100% rename from lib/nghttp2/src/testdata/verify_hostname.crt rename to lib/nghttp2-1.65.0/src/testdata/verify_hostname.crt diff --git a/lib/nghttp2/src/timegm.c b/lib/nghttp2-1.65.0/src/timegm.c similarity index 92% rename from lib/nghttp2/src/timegm.c rename to lib/nghttp2-1.65.0/src/timegm.c index fc6df82494a..3a671b184a6 100644 --- a/lib/nghttp2/src/timegm.c +++ b/lib/nghttp2-1.65.0/src/timegm.c @@ -45,11 +45,11 @@ time_t nghttp2_timegm(struct tm *tm) { days = (tm->tm_year - 70) * 365 + num_leap_year + tm->tm_yday; t = ((int64_t)days * 24 + tm->tm_hour) * 3600 + tm->tm_min * 60 + tm->tm_sec; -#if SIZEOF_TIME_T == 4 - if (t < INT32_MIN || t > INT32_MAX) { - return -1; + if (sizeof(time_t) == 4) { + if (t < INT32_MIN || t > INT32_MAX) { + return -1; + } } -#endif /* SIZEOF_TIME_T == 4 */ return (time_t)t; } @@ -78,11 +78,11 @@ time_t nghttp2_timegm_without_yday(struct tm *tm) { } t = ((int64_t)days * 24 + tm->tm_hour) * 3600 + tm->tm_min * 60 + tm->tm_sec; -#if SIZEOF_TIME_T == 4 - if (t < INT32_MIN || t > INT32_MAX) { - return -1; + if (sizeof(time_t) == 4) { + if (t < INT32_MIN || t > INT32_MAX) { + return -1; + } } -#endif /* SIZEOF_TIME_T == 4 */ return (time_t)t; } diff --git a/lib/nghttp2/src/timegm.h b/lib/nghttp2-1.65.0/src/timegm.h similarity index 96% rename from lib/nghttp2/src/timegm.h rename to lib/nghttp2-1.65.0/src/timegm.h index 56f9cc6c964..152917cfa91 100644 --- a/lib/nghttp2/src/timegm.h +++ b/lib/nghttp2-1.65.0/src/timegm.h @@ -29,14 +29,12 @@ # include #endif /* HAVE_CONFIG_H */ +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#ifdef HAVE_TIME_H -# include -#endif // HAVE_TIME_H - time_t nghttp2_timegm(struct tm *tm); /* Just like nghttp2_timegm, but without using tm->tm_yday. This is diff --git a/lib/nghttp2/src/tls.cc b/lib/nghttp2-1.65.0/src/tls.cc similarity index 56% rename from lib/nghttp2/src/tls.cc rename to lib/nghttp2-1.65.0/src/tls.cc index b0cadfd62f4..bc44ca911ed 100644 --- a/lib/nghttp2/src/tls.cc +++ b/lib/nghttp2-1.65.0/src/tls.cc @@ -25,55 +25,32 @@ #include "tls.h" #include +#include #include #include #include +#include -#include -#include +#ifdef HAVE_LIBBROTLI +# include +# include +#endif // HAVE_LIBBROTLI #include "ssl_compat.h" +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL + namespace nghttp2 { namespace tls { -#if OPENSSL_1_1_API - -// CRYPTO_LOCK is deprecated as of OpenSSL 1.1.0 -LibsslGlobalLock::LibsslGlobalLock() {} - -#else // !OPENSSL_1_1_API - -namespace { -std::mutex *ssl_global_locks; -} // namespace - -namespace { -void ssl_locking_cb(int mode, int type, const char *file, int line) { - if (mode & CRYPTO_LOCK) { - ssl_global_locks[type].lock(); - } else { - ssl_global_locks[type].unlock(); - } -} -} // namespace - -LibsslGlobalLock::LibsslGlobalLock() { - if (ssl_global_locks) { - std::cerr << "OpenSSL global lock has been already set" << std::endl; - assert(0); - } - ssl_global_locks = new std::mutex[CRYPTO_num_locks()]; - // CRYPTO_set_id_callback(ssl_thread_id); OpenSSL manual says that - // if threadid_func is not specified using - // CRYPTO_THREADID_set_callback(), then default implementation is - // used. We use this default one. - CRYPTO_set_locking_callback(ssl_locking_cb); -} - -#endif // !OPENSSL_1_1_API - const char *get_tls_protocol(SSL *ssl) { switch (SSL_version(ssl)) { case SSL2_VERSION: @@ -124,13 +101,13 @@ TLSSessionInfo *get_tls_session_info(TLSSessionInfo *tls_info, SSL *ssl) { ((0x0000 <= id && id <= 0x00FF && \ "\xFF\xFF\xFF\xCF\xFF\xFF\xFF\xFF\x7F\x00\x00\x00\x80\x3F\x00\x00" \ "\xF0\xFF\xFF\x3F\xF3\xF3\xFF\xFF\x3F\x00\x00\x00\x00\x00\x00\x80" \ - [(id & 0xFF) / 8] & \ - (1 << (id % 8))) || \ + [(id & 0xFF) / 8] & \ + (1 << (id % 8))) || \ (0xC000 <= id && id <= 0xC0FF && \ "\xFE\xFF\xFF\xFF\xFF\x67\xFE\xFF\xFF\xFF\x33\xCF\xFC\xCF\xFF\xCF" \ "\x3C\xF3\xFC\x3F\x33\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" \ - [(id & 0xFF) / 8] & \ - (1 << (id % 8)))) + [(id & 0xFF) / 8] & \ + (1 << (id % 8)))) bool check_http2_cipher_block_list(SSL *ssl) { int id = SSL_CIPHER_get_id(SSL_get_current_cipher(ssl)) & 0xFFFFFF; @@ -148,53 +125,101 @@ bool check_http2_requirement(SSL *ssl) { return check_http2_tls_version(ssl) && !check_http2_cipher_block_list(ssl); } -void libssl_init() { -#if OPENSSL_1_1_API -// No explicit initialization is required. -#elif defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - CRYPTO_library_init(); -#else // !OPENSSL_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - OPENSSL_config(nullptr); - SSL_load_error_strings(); - SSL_library_init(); - OpenSSL_add_all_algorithms(); -#endif // !OPENSSL_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) -} - int ssl_ctx_set_proto_versions(SSL_CTX *ssl_ctx, int min, int max) { -#if OPENSSL_1_1_API || defined(NGHTTP2_OPENSSL_IS_BORINGSSL) if (SSL_CTX_set_min_proto_version(ssl_ctx, min) != 1 || SSL_CTX_set_max_proto_version(ssl_ctx, max) != 1) { return -1; } return 0; -#else // !OPENSSL_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - long int opts = 0; +} + +#if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI) +int cert_compress(SSL *ssl, CBB *out, const uint8_t *in, size_t in_len) { + uint8_t *dest; - // TODO We depends on the ordering of protocol version macro in - // OpenSSL. - if (min > TLS1_VERSION) { - opts |= SSL_OP_NO_TLSv1; + auto compressed_size = BrotliEncoderMaxCompressedSize(in_len); + if (compressed_size == 0) { + return 0; } - if (min > TLS1_1_VERSION) { - opts |= SSL_OP_NO_TLSv1_1; + + if (!CBB_reserve(out, &dest, compressed_size)) { + return 0; } - if (min > TLS1_2_VERSION) { - opts |= SSL_OP_NO_TLSv1_2; + + if (BrotliEncoderCompress(BROTLI_MAX_QUALITY, BROTLI_DEFAULT_WINDOW, + BROTLI_MODE_GENERIC, in_len, in, &compressed_size, + dest) != BROTLI_TRUE) { + return 0; } - if (max < TLS1_2_VERSION) { - opts |= SSL_OP_NO_TLSv1_2; + if (!CBB_did_write(out, compressed_size)) { + return 0; } - if (max < TLS1_1_VERSION) { - opts |= SSL_OP_NO_TLSv1_1; + + return 1; +} + +int cert_decompress(SSL *ssl, CRYPTO_BUFFER **out, size_t uncompressed_len, + const uint8_t *in, size_t in_len) { + uint8_t *dest; + auto buf = CRYPTO_BUFFER_alloc(&dest, uncompressed_len); + auto len = uncompressed_len; + + if (BrotliDecoderDecompress(in_len, in, &len, dest) != + BROTLI_DECODER_RESULT_SUCCESS) { + CRYPTO_BUFFER_free(buf); + + return 0; + } + + if (uncompressed_len != len) { + CRYPTO_BUFFER_free(buf); + + return 0; + } + + *out = buf; + + return 1; +} +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI + +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_BORINGSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) || \ + (defined(NGHTTP2_OPENSSL_IS_WOLFSSL) && defined(HAVE_SECRET_CALLBACK)) +namespace { +std::ofstream keylog_file; + +void keylog_callback(const SSL *ssl, const char *line) { + keylog_file.write(line, strlen(line)); + keylog_file.put('\n'); + keylog_file.flush(); +} +} // namespace + +int setup_keylog_callback(SSL_CTX *ssl_ctx) { + auto keylog_filename = getenv("SSLKEYLOGFILE"); + if (!keylog_filename) { + return 0; + } + + keylog_file.open(keylog_filename, std::ios_base::app); + if (!keylog_file) { + return -1; } - SSL_CTX_set_options(ssl_ctx, opts); + SSL_CTX_set_keylog_callback(ssl_ctx, keylog_callback); return 0; -#endif // !OPENSSL_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) } +#else // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_BORINGSSL && + // !NGHTTP2_OPENSSL_IS_LIBRESSL && !(NGHTTP2_OPENSSL_IS_WOLFSSL && + // HAVE_SECRET_CALLBACK) +int setup_keylog_callback(SSL_CTX *ssl_ctx) { return 0; } +#endif // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_BORINGSSL && + // !NGHTTP2_OPENSSL_IS_LIBRESSL && !(NGHTTP2_OPENSSL_IS_WOLFSSL && + // HAVE_SECRET_CALLBACK) } // namespace tls diff --git a/lib/nghttp2/src/tls.h b/lib/nghttp2-1.65.0/src/tls.h similarity index 66% rename from lib/nghttp2/src/tls.h rename to lib/nghttp2-1.65.0/src/tls.h index 332ccb65310..160c8bc1ba4 100644 --- a/lib/nghttp2/src/tls.h +++ b/lib/nghttp2-1.65.0/src/tls.h @@ -28,45 +28,46 @@ #include "nghttp2_config.h" #include - -#include +#include #include "ssl_compat.h" +using namespace std::literals; + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL + namespace nghttp2 { namespace tls { -// Acquire OpenSSL global lock to share SSL_CTX across multiple -// threads. The constructor acquires lock and destructor unlocks. -class LibsslGlobalLock { -public: - LibsslGlobalLock(); - LibsslGlobalLock(const LibsslGlobalLock &) = delete; - LibsslGlobalLock &operator=(const LibsslGlobalLock &) = delete; -}; - // Recommended general purpose "Intermediate compatibility" cipher // suites for TLSv1.2 by mozilla. // // https://wiki.mozilla.org/Security/Server_Side_TLS -constexpr char DEFAULT_CIPHER_LIST[] = - "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-" - "AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-" - "POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-" - "AES256-GCM-SHA384"; +constexpr auto DEFAULT_CIPHER_LIST = + "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-" + "AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-" + "POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-" + "AES256-GCM-SHA384"sv; // Recommended general purpose "Modern compatibility" cipher suites // for TLSv1.3 by mozilla. // // https://wiki.mozilla.org/Security/Server_Side_TLS -constexpr char DEFAULT_TLS13_CIPHER_LIST[] = -#if OPENSSL_1_1_1_API && !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) - "TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256" -#else - "" -#endif - ; +constexpr auto DEFAULT_TLS13_CIPHER_LIST = +#if defined(NGHTTP2_GENUINE_OPENSSL) || \ + defined(NGHTTP2_OPENSSL_IS_LIBRESSL) || defined(NGHTTP2_OPENSSL_IS_WOLFSSL) + "TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:" + "TLS_CHACHA20_POLY1305_SHA256"sv +#else // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_LIBRESSL + "" +#endif // !NGHTTP2_GENUINE_OPENSSL && !NGHTTP2_OPENSSL_IS_LIBRESSL + ; constexpr auto NGHTTP2_TLS_MIN_VERSION = TLS1_VERSION; #ifdef TLS1_3_VERSION @@ -102,13 +103,22 @@ bool check_http2_cipher_block_list(SSL *ssl); // described in RFC 7540. bool check_http2_requirement(SSL *ssl); -// Initializes OpenSSL library -void libssl_init(); - // Sets TLS min and max versions to |ssl_ctx|. This function returns // 0 if it succeeds, or -1. int ssl_ctx_set_proto_versions(SSL_CTX *ssl_ctx, int min, int max); +constexpr uint16_t CERTIFICATE_COMPRESSION_ALGO_BROTLI = 2; + +#if defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && defined(HAVE_LIBBROTLI) +int cert_compress(SSL *ssl, CBB *out, const uint8_t *in, size_t in_len); + +int cert_decompress(SSL *ssl, CRYPTO_BUFFER **out, size_t uncompressed_len, + const uint8_t *in, size_t in_len); +#endif // NGHTTP2_OPENSSL_IS_BORINGSSL && HAVE_LIBBROTLI + +// Setup keylog callback. It returns 0 if it succeeds, or -1. +int setup_keylog_callback(SSL_CTX *ssl_ctx); + } // namespace tls } // namespace nghttp2 diff --git a/lib/nghttp2/src/util.cc b/lib/nghttp2-1.65.0/src/util.cc similarity index 80% rename from lib/nghttp2/src/util.cc rename to lib/nghttp2-1.65.0/src/util.cc index 9d0c1bd7bd8..d55c3836345 100644 --- a/lib/nghttp2/src/util.cc +++ b/lib/nghttp2-1.65.0/src/util.cc @@ -24,9 +24,6 @@ */ #include "util.h" -#ifdef HAVE_TIME_H -# include -#endif // HAVE_TIME_H #include #ifdef HAVE_SYS_SOCKET_H # include @@ -59,15 +56,22 @@ #include #include #include +#include #include #include #include -#include +#include "ssl_compat.h" + +#ifdef NGHTTP2_OPENSSL_IS_WOLFSSL +# include +# include +#else // !NGHTTP2_OPENSSL_IS_WOLFSSL +# include +#endif // !NGHTTP2_OPENSSL_IS_WOLFSSL #include -#include "ssl_compat.h" #include "timegm.h" namespace nghttp2 { @@ -193,11 +197,11 @@ bool in_attr_char(char c) { StringRef percent_encode_token(BlockAllocator &balloc, const StringRef &target) { auto iov = make_byte_ref(balloc, target.size() * 3 + 1); - auto p = percent_encode_token(iov.base, target); + auto p = percent_encode_token(std::begin(iov), target); *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } size_t percent_encode_tokenlen(const StringRef &target) { @@ -239,11 +243,11 @@ StringRef quote_string(BlockAllocator &balloc, const StringRef &target) { } auto iov = make_byte_ref(balloc, target.size() + cnt + 1); - auto p = quote_string(iov.base, target); + auto p = quote_string(std::begin(iov), target); *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } size_t quote_stringlen(const StringRef &target) { @@ -467,13 +471,13 @@ time_t parse_http_date(const StringRef &s) { tm tm{}; #ifdef _WIN32 // there is no strptime - use std::get_time - std::stringstream sstr(s.str()); + std::stringstream sstr(s.data()); sstr >> std::get_time(&tm, "%a, %d %b %Y %H:%M:%S GMT"); if (sstr.fail()) { return 0; } #else // !_WIN32 - char *r = strptime(s.c_str(), "%a, %d %b %Y %H:%M:%S GMT", &tm); + char *r = strptime(s.data(), "%a, %d %b %Y %H:%M:%S GMT", &tm); if (r == 0) { return 0; } @@ -483,7 +487,7 @@ time_t parse_http_date(const StringRef &s) { time_t parse_openssl_asn1_time_print(const StringRef &s) { tm tm{}; - auto r = strptime(s.c_str(), "%b %d %H:%M:%S %Y GMT", &tm); + auto r = strptime(s.data(), "%b %d %H:%M:%S %Y GMT", &tm); if (r == nullptr) { return 0; } @@ -498,32 +502,22 @@ char upcase(char c) { } } -std::string format_hex(const unsigned char *s, size_t len) { +std::string format_hex(std::span s) { std::string res; - res.resize(len * 2); + res.resize(s.size() * 2); - for (size_t i = 0; i < len; ++i) { - unsigned char c = s[i]; + format_hex(std::begin(res), s); - res[i * 2] = LOWER_XDIGITS[c >> 4]; - res[i * 2 + 1] = LOWER_XDIGITS[c & 0x0f]; - } return res; } -StringRef format_hex(BlockAllocator &balloc, const StringRef &s) { +StringRef format_hex(BlockAllocator &balloc, std::span s) { auto iov = make_byte_ref(balloc, s.size() * 2 + 1); - auto p = iov.base; - - for (auto cc : s) { - uint8_t c = cc; - *p++ = LOWER_XDIGITS[c >> 4]; - *p++ = LOWER_XDIGITS[c & 0xf]; - } + auto p = format_hex(std::begin(iov), s); *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } void to_token68(std::string &base64str) { @@ -546,19 +540,18 @@ StringRef to_base64(BlockAllocator &balloc, const StringRef &token68str) { // At most 3 padding '=' auto len = token68str.size() + 3; auto iov = make_byte_ref(balloc, len + 1); - auto p = iov.base; - - p = std::transform(std::begin(token68str), std::end(token68str), p, - [](char c) { - switch (c) { - case '-': - return '+'; - case '_': - return '/'; - default: - return c; - } - }); + + auto p = std::transform(std::begin(token68str), std::end(token68str), + std::begin(iov), [](char c) { + switch (c) { + case '-': + return '+'; + case '_': + return '/'; + default: + return c; + } + }); auto rem = token68str.size() & 0x3; if (rem) { @@ -567,7 +560,7 @@ StringRef to_base64(BlockAllocator &balloc, const StringRef &token68str) { *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } namespace { @@ -575,15 +568,15 @@ namespace { // with given costs. swapcost, subcost, addcost and delcost are cost // to swap 2 adjacent characters, substitute characters, add character // and delete character respectively. -int levenshtein(const char *a, int alen, const char *b, int blen, int swapcost, - int subcost, int addcost, int delcost) { +int levenshtein(const char *a, size_t alen, const char *b, size_t blen, + int swapcost, int subcost, int addcost, int delcost) { auto dp = std::vector>(3, std::vector(blen + 1)); - for (int i = 0; i <= blen; ++i) { - dp[1][i] = i; + for (size_t i = 0; i <= blen; ++i) { + dp[1][i] = i * addcost; } - for (int i = 1; i <= alen; ++i) { - dp[0][0] = i; - for (int j = 1; j <= blen; ++j) { + for (size_t i = 1; i <= alen; ++i) { + dp[0][0] = i * delcost; + for (size_t j = 1; j <= blen; ++j) { dp[0][j] = dp[1][j - 1] + (a[i - 1] == b[j - 1] ? 0 : subcost); if (i >= 2 && j >= 2 && a[i - 1] != b[j - 1] && a[i - 2] == b[j - 1] && a[i - 1] == b[j - 2]) { @@ -619,7 +612,7 @@ void show_candidates(const char *unkopt, const option *options) { if (istarts_with(options[i].name, options[i].name + optnamelen, unkopt, unkopt + unkoptlen)) { if (optnamelen == static_cast(unkoptlen)) { - // Exact match, then we don't show any condidates. + // Exact match, then we don't show any candidates. return; } ++prefix_match; @@ -635,7 +628,7 @@ void show_candidates(const char *unkopt, const option *options) { } // cost values are borrowed from git, help.c. int sim = - levenshtein(unkopt, unkoptlen, options[i].name, optnamelen, 0, 2, 1, 3); + levenshtein(unkopt, unkoptlen, options[i].name, optnamelen, 0, 2, 1, 3); cands.emplace_back(sim, options[i].name); } if (prefix_match == 1 || cands.empty()) { @@ -656,12 +649,12 @@ void show_candidates(const char *unkopt, const option *options) { } } -bool has_uri_field(const http_parser_url &u, http_parser_url_fields field) { +bool has_uri_field(const urlparse_url &u, urlparse_url_fields field) { return u.field_set & (1 << field); } -bool fieldeq(const char *uri1, const http_parser_url &u1, const char *uri2, - const http_parser_url &u2, http_parser_url_fields field) { +bool fieldeq(const char *uri1, const urlparse_url &u1, const char *uri2, + const urlparse_url &u2, urlparse_url_fields field) { if (!has_uri_field(u1, field)) { if (!has_uri_field(u2, field)) { return true; @@ -678,13 +671,13 @@ bool fieldeq(const char *uri1, const http_parser_url &u1, const char *uri2, uri2 + u2.field_data[field].off, u1.field_data[field].len) == 0; } -bool fieldeq(const char *uri, const http_parser_url &u, - http_parser_url_fields field, const char *t) { +bool fieldeq(const char *uri, const urlparse_url &u, urlparse_url_fields field, + const char *t) { return fieldeq(uri, u, field, StringRef{t}); } -bool fieldeq(const char *uri, const http_parser_url &u, - http_parser_url_fields field, const StringRef &t) { +bool fieldeq(const char *uri, const urlparse_url &u, urlparse_url_fields field, + const StringRef &t) { if (!has_uri_field(u, field)) { return t.empty(); } @@ -692,8 +685,8 @@ bool fieldeq(const char *uri, const http_parser_url &u, return StringRef{uri + f.off, f.len} == t; } -StringRef get_uri_field(const char *uri, const http_parser_url &u, - http_parser_url_fields field) { +StringRef get_uri_field(const char *uri, const urlparse_url &u, + urlparse_url_fields field) { if (!util::has_uri_field(u, field)) { return StringRef{}; } @@ -701,28 +694,28 @@ StringRef get_uri_field(const char *uri, const http_parser_url &u, return StringRef{uri + u.field_data[field].off, u.field_data[field].len}; } -uint16_t get_default_port(const char *uri, const http_parser_url &u) { - if (util::fieldeq(uri, u, UF_SCHEMA, "https")) { +uint16_t get_default_port(const char *uri, const urlparse_url &u) { + if (util::fieldeq(uri, u, URLPARSE_SCHEMA, "https")) { return 443; - } else if (util::fieldeq(uri, u, UF_SCHEMA, "http")) { + } else if (util::fieldeq(uri, u, URLPARSE_SCHEMA, "http")) { return 80; } else { return 443; } } -bool porteq(const char *uri1, const http_parser_url &u1, const char *uri2, - const http_parser_url &u2) { +bool porteq(const char *uri1, const urlparse_url &u1, const char *uri2, + const urlparse_url &u2) { uint16_t port1, port2; - port1 = - util::has_uri_field(u1, UF_PORT) ? u1.port : get_default_port(uri1, u1); - port2 = - util::has_uri_field(u2, UF_PORT) ? u2.port : get_default_port(uri2, u2); + port1 = util::has_uri_field(u1, URLPARSE_PORT) ? u1.port + : get_default_port(uri1, u1); + port2 = util::has_uri_field(u2, URLPARSE_PORT) ? u2.port + : get_default_port(uri2, u2); return port1 == port2; } -void write_uri_field(std::ostream &o, const char *uri, const http_parser_url &u, - http_parser_url_fields field) { +void write_uri_field(std::ostream &o, const char *uri, const urlparse_url &u, + urlparse_url_fields field) { if (util::has_uri_field(u, field)) { o.write(uri + u.field_data[field].off, u.field_data[field].len); } @@ -804,6 +797,30 @@ void set_port(Address &addr, uint16_t port) { } } +uint16_t get_port(const sockaddr_union *su) { + switch (su->storage.ss_family) { + case AF_INET: + return ntohs(su->in.sin_port); + case AF_INET6: + return ntohs(su->in6.sin6_port); + default: + return 0; + } +} + +bool quic_prohibited_port(uint16_t port) { + switch (port) { + case 1900: + case 5353: + case 11211: + case 20800: + case 27015: + return true; + default: + return port < 1024; + } +} + std::string ascii_dump(const uint8_t *data, size_t len) { std::string res; @@ -856,7 +873,7 @@ bool check_path(const std::string &path) { path.find('\\') == std::string::npos && path.find("/../") == std::string::npos && path.find("/./") == std::string::npos && - !util::ends_with_l(path, "/..") && !util::ends_with_l(path, "/."); + !util::ends_with(path, "/.."_sr) && !util::ends_with(path, "/."_sr); } int64_t to_time64(const timeval &tv) { @@ -864,8 +881,8 @@ int64_t to_time64(const timeval &tv) { } bool check_h2_is_selected(const StringRef &proto) { - return streq(NGHTTP2_H2, proto) || streq(NGHTTP2_H2_16, proto) || - streq(NGHTTP2_H2_14, proto); + return NGHTTP2_H2 == proto || NGHTTP2_H2_16 == proto || + NGHTTP2_H2_14 == proto; } namespace { @@ -1126,58 +1143,63 @@ bool ipv6_numeric_addr(const char *host) { } namespace { -std::pair parse_uint_digits(const void *ss, size_t len) { - const uint8_t *s = static_cast(ss); - int64_t n = 0; - size_t i; - if (len == 0) { - return {-1, 0}; +std::optional> +parse_uint_digits(const StringRef &s) { + if (s.empty()) { + return {}; } + constexpr int64_t max = std::numeric_limits::max(); - for (i = 0; i < len; ++i) { - if ('0' <= s[i] && s[i] <= '9') { - if (n > max / 10) { - return {-1, 0}; - } - n *= 10; - if (n > max - (s[i] - '0')) { - return {-1, 0}; - } - n += s[i] - '0'; - continue; + + int64_t n = 0; + size_t i = 0; + + for (auto c : s) { + if ('0' > c || c > '9') { + break; } - break; + + if (n > max / 10) { + return {}; + } + + n *= 10; + + if (n > max - (c - '0')) { + return {}; + } + + n += c - '0'; + + ++i; } + if (i == 0) { - return {-1, 0}; + return {}; } - return {n, i}; + + return std::pair{n, s.substr(i)}; } } // namespace -int64_t parse_uint_with_unit(const char *s) { - return parse_uint_with_unit(reinterpret_cast(s), strlen(s)); -} +std::optional parse_uint_with_unit(const StringRef &s) { + auto r = parse_uint_digits(s); + if (!r) { + return {}; + } -int64_t parse_uint_with_unit(const StringRef &s) { - return parse_uint_with_unit(s.byte(), s.size()); -} + auto [n, rest] = *r; -int64_t parse_uint_with_unit(const uint8_t *s, size_t len) { - int64_t n; - size_t i; - std::tie(n, i) = parse_uint_digits(s, len); - if (n == -1) { - return -1; - } - if (i == len) { + if (rest.empty()) { return n; } - if (i + 1 != len) { - return -1; + + if (rest.size() != 1) { + return {}; } + int mul = 1; - switch (s[i]) { + switch (rest[0]) { case 'K': case 'k': mul = 1 << 10; @@ -1191,94 +1213,81 @@ int64_t parse_uint_with_unit(const uint8_t *s, size_t len) { mul = 1 << 30; break; default: - return -1; + return {}; } + constexpr int64_t max = std::numeric_limits::max(); if (n > max / mul) { - return -1; + return {}; } - return n * mul; -} -int64_t parse_uint(const char *s) { - return parse_uint(reinterpret_cast(s), strlen(s)); -} - -int64_t parse_uint(const std::string &s) { - return parse_uint(reinterpret_cast(s.c_str()), s.size()); -} - -int64_t parse_uint(const StringRef &s) { - return parse_uint(s.byte(), s.size()); + return n * mul; } -int64_t parse_uint(const uint8_t *s, size_t len) { - int64_t n; - size_t i; - std::tie(n, i) = parse_uint_digits(s, len); - if (n == -1 || i != len) { - return -1; +std::optional parse_uint(const StringRef &s) { + auto r = parse_uint_digits(s); + if (!r || !(*r).second.empty()) { + return {}; } - return n; -} -double parse_duration_with_unit(const char *s) { - return parse_duration_with_unit(reinterpret_cast(s), - strlen(s)); + return (*r).first; } -double parse_duration_with_unit(const StringRef &s) { - return parse_duration_with_unit(s.byte(), s.size()); -} - -double parse_duration_with_unit(const uint8_t *s, size_t len) { +std::optional parse_duration_with_unit(const StringRef &s) { constexpr auto max = std::numeric_limits::max(); - int64_t n; - size_t i; - std::tie(n, i) = parse_uint_digits(s, len); - if (n == -1) { - goto fail; + auto r = parse_uint_digits(s); + if (!r) { + return {}; } - if (i == len) { + + auto [n, rest] = *r; + + if (rest.empty()) { return static_cast(n); } - switch (s[i]) { + + switch (rest[0]) { case 'S': case 's': // seconds - if (i + 1 != len) { - goto fail; + if (rest.size() != 1) { + return {}; } + return static_cast(n); case 'M': case 'm': - if (i + 1 == len) { + if (rest.size() == 1) { // minutes if (n > max / 60) { - goto fail; + return {}; } + return static_cast(n) * 60; } - if (i + 2 != len || (s[i + 1] != 's' && s[i + 1] != 'S')) { - goto fail; + if (rest.size() != 2 || (rest[1] != 's' && rest[1] != 'S')) { + return {}; } + // milliseconds return static_cast(n) / 1000.; case 'H': case 'h': // hours - if (i + 1 != len) { - goto fail; + if (rest.size() != 1) { + return {}; } + if (n > max / 3600) { - goto fail; + return {}; } + return static_cast(n) * 3600; + default: + return {}; } -fail: - return std::numeric_limits::infinity(); } std::string duration_str(double t) { @@ -1340,76 +1349,176 @@ std::string dtos(double n) { StringRef make_http_hostport(BlockAllocator &balloc, const StringRef &host, uint16_t port) { auto iov = make_byte_ref(balloc, host.size() + 2 + 1 + 5 + 1); - return make_http_hostport(iov.base, host, port); + return make_http_hostport(std::begin(iov), host, port); } StringRef make_hostport(BlockAllocator &balloc, const StringRef &host, uint16_t port) { auto iov = make_byte_ref(balloc, host.size() + 2 + 1 + 5 + 1); - return make_hostport(iov.base, host, port); + return make_hostport(std::begin(iov), host, port); } namespace { -void hexdump8(FILE *out, const uint8_t *first, const uint8_t *last) { - auto stop = std::min(first + 8, last); - for (auto k = first; k != stop; ++k) { - fprintf(out, "%02x ", *k); +uint8_t *hexdump_addr(uint8_t *dest, size_t addr) { + // Lower 32 bits are displayed. + for (size_t i = 0; i < 4; ++i) { + auto a = (addr >> (3 - i) * 8) & 0xff; + + *dest++ = LOWER_XDIGITS[a >> 4]; + *dest++ = LOWER_XDIGITS[a & 0xf]; } - // each byte needs 3 spaces (2 hex value and space) - for (; stop != first + 8; ++stop) { - fputs(" ", out); + + return dest; +} +} // namespace + +namespace { +uint8_t *hexdump_ascii(uint8_t *dest, const uint8_t *data, size_t datalen) { + *dest++ = '|'; + + for (size_t i = 0; i < datalen; ++i) { + if (0x20 <= data[i] && data[i] <= 0x7e) { + *dest++ = data[i]; + } else { + *dest++ = '.'; + } } - // we have extra space after 8 bytes - fputc(' ', out); + + *dest++ = '|'; + + return dest; } } // namespace -void hexdump(FILE *out, const uint8_t *src, size_t len) { - if (len == 0) { - return; +namespace { +uint8_t *hexdump8(uint8_t *dest, const uint8_t *data, size_t datalen) { + size_t i; + + for (i = 0; i < datalen; ++i) { + *dest++ = LOWER_XDIGITS[data[i] >> 4]; + *dest++ = LOWER_XDIGITS[data[i] & 0xf]; + *dest++ = ' '; + } + + for (; i < 8; ++i) { + *dest++ = ' '; + *dest++ = ' '; + *dest++ = ' '; + } + + return dest; +} +} // namespace + +namespace { +uint8_t *hexdump16(uint8_t *dest, const uint8_t *data, size_t datalen) { + if (datalen > 8) { + dest = hexdump8(dest, data, 8); + *dest++ = ' '; + dest = hexdump8(dest, data + 8, datalen - 8); + *dest++ = ' '; + } else { + dest = hexdump8(dest, data, datalen); + *dest++ = ' '; + dest = hexdump8(dest, nullptr, 0); + *dest++ = ' '; + } + + return dest; +} +} // namespace + +namespace { +uint8_t *hexdump_line(uint8_t *dest, const uint8_t *data, size_t datalen, + size_t addr) { + dest = hexdump_addr(dest, addr); + *dest++ = ' '; + *dest++ = ' '; + + dest = hexdump16(dest, data, datalen); + + return hexdump_ascii(dest, data, datalen); +} +} // namespace + +namespace { +int hexdump_write(int fd, const uint8_t *data, size_t datalen) { + ssize_t nwrite; + + for (; (nwrite = write(fd, data, datalen)) == -1 && errno == EINTR;) + ; + if (nwrite == -1) { + return -1; } - size_t buflen = 0; + + return 0; +} +} // namespace + +int hexdump(FILE *out, const void *data, size_t datalen) { + if (datalen == 0) { + return 0; + } + + // min_space is the additional minimum space that the buffer must + // accept, which is the size of a single full line output + one + // repeat line marker ("*\n"). If the remaining buffer size is less + // than that, flush the buffer and reset. + constexpr size_t min_space = 79 + 2; + + auto fd = fileno(out); + std::array buf; + auto last = buf.data(); + auto in = reinterpret_cast(data); auto repeated = false; - std::array buf{}; - auto end = src + len; - auto i = src; - for (;;) { - auto nextlen = - std::min(static_cast(16), static_cast(end - i)); - if (nextlen == buflen && - std::equal(std::begin(buf), std::begin(buf) + buflen, i)) { - // as long as adjacent 16 bytes block are the same, we just - // print single '*'. - if (!repeated) { - repeated = true; - fputs("*\n", out); + + for (size_t offset = 0; offset < datalen; offset += 16) { + auto n = datalen - offset; + auto s = in + offset; + + if (n >= 16) { + n = 16; + + if (offset > 0) { + if (std::equal(s - 16, s, s)) { + if (repeated) { + continue; + } + + repeated = true; + + *last++ = '*'; + *last++ = '\n'; + + continue; + } + + repeated = false; } - i += nextlen; - continue; } - repeated = false; - fprintf(out, "%08lx", static_cast(i - src)); - if (i == end) { - fputc('\n', out); - break; - } - fputs(" ", out); - hexdump8(out, i, end); - hexdump8(out, i + 8, std::max(i + 8, end)); - fputc('|', out); - auto stop = std::min(i + 16, end); - buflen = stop - i; - auto p = buf.data(); - for (; i != stop; ++i) { - *p++ = *i; - if (0x20 <= *i && *i <= 0x7e) { - fputc(*i, out); - } else { - fputc('.', out); + + last = hexdump_line(last, s, n, offset); + *last++ = '\n'; + + auto len = static_cast(last - buf.data()); + if (len + min_space > buf.size()) { + if (hexdump_write(fd, buf.data(), len) != 0) { + return -1; } + + last = buf.data(); } - fputs("|\n", out); } + + last = hexdump_addr(last, datalen); + *last++ = '\n'; + + auto len = static_cast(last - buf.data()); + if (len) { + return hexdump_write(fd, buf.data(), len); + } + + return 0; } void put_uint16be(uint8_t *buf, uint16_t n) { @@ -1489,7 +1598,7 @@ int read_mime_types(std::map &res, StringRef percent_decode(BlockAllocator &balloc, const StringRef &src) { auto iov = make_byte_ref(balloc, src.size() * 3 + 1); - auto p = iov.base; + auto p = std::begin(iov); for (auto first = std::begin(src); first != std::end(src); ++first) { if (*first != '%') { *p++ = *first; @@ -1506,7 +1615,7 @@ StringRef percent_decode(BlockAllocator &balloc, const StringRef &src) { *p++ = *first; } *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } // Returns x**y @@ -1531,16 +1640,6 @@ uint32_t hash32(const StringRef &s) { return h; } -#if !OPENSSL_1_1_API -namespace { -EVP_MD_CTX *EVP_MD_CTX_new(void) { return EVP_MD_CTX_create(); } -} // namespace - -namespace { -void EVP_MD_CTX_free(EVP_MD_CTX *ctx) { EVP_MD_CTX_destroy(ctx); } -} // namespace -#endif // !OPENSSL_1_1_API - namespace { int message_digest(uint8_t *res, const EVP_MD *meth, const StringRef &s) { int rv; @@ -1557,7 +1656,7 @@ int message_digest(uint8_t *res, const EVP_MD *meth, const StringRef &s) { return -1; } - rv = EVP_DigestUpdate(ctx, s.c_str(), s.size()); + rv = EVP_DigestUpdate(ctx, s.data(), s.size()); if (rv != 1) { return -1; } @@ -1595,11 +1694,12 @@ bool is_hex_string(const StringRef &s) { return true; } -StringRef decode_hex(BlockAllocator &balloc, const StringRef &s) { +std::span decode_hex(BlockAllocator &balloc, + const StringRef &s) { auto iov = make_byte_ref(balloc, s.size() + 1); - auto p = decode_hex(iov.base, s); + auto p = decode_hex(std::begin(iov), s); *p = '\0'; - return StringRef{iov.base, p}; + return {std::begin(iov), p}; } StringRef extract_host(const StringRef &hostport) { @@ -1712,7 +1812,7 @@ StringRef rstrip(BlockAllocator &balloc, const StringRef &s) { return s; } - return make_string_ref(balloc, StringRef{s.c_str(), s.size() - len}); + return make_string_ref(balloc, StringRef{s.data(), s.size() - len}); } #ifdef ENABLE_HTTP3 @@ -1787,7 +1887,7 @@ uint8_t msghdr_get_ecn(msghdr *msg, int family) { } size_t msghdr_get_udp_gro(msghdr *msg) { - uint16_t gso_size = 0; + int gso_size = 0; # ifdef UDP_GRO for (auto cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { @@ -1799,7 +1899,7 @@ size_t msghdr_get_udp_gro(msghdr *msg) { } # endif // UDP_GRO - return gso_size; + return static_cast(gso_size); } #endif // ENABLE_HTTP3 diff --git a/lib/nghttp2/src/util.h b/lib/nghttp2-1.65.0/src/util.h similarity index 74% rename from lib/nghttp2/src/util.h rename to lib/nghttp2-1.65.0/src/util.h index d818bf2fd3b..4f8c8e3411d 100644 --- a/lib/nghttp2/src/util.h +++ b/lib/nghttp2-1.65.0/src/util.h @@ -34,6 +34,9 @@ #ifdef HAVE_NETDB_H # include #endif // HAVE_NETDB_H +#ifdef __QNX__ +# include +#endif // __QNX__ #include #include @@ -46,12 +49,13 @@ #include #include #include +#include #ifdef HAVE_LIBEV # include #endif // HAVE_LIBEV -#include "url-parser/url_parser.h" +#include "urlparse.h" #include "template.h" #include "network.h" @@ -59,20 +63,20 @@ namespace nghttp2 { -constexpr auto NGHTTP2_H2_ALPN = StringRef::from_lit("\x2h2"); -constexpr auto NGHTTP2_H2 = StringRef::from_lit("h2"); +constexpr auto NGHTTP2_H2_ALPN = "\x2h2"_sr; +constexpr auto NGHTTP2_H2 = "h2"_sr; // The additional HTTP/2 protocol ALPN protocol identifier we also // supports for our applications to make smooth migration into final // h2 ALPN ID. -constexpr auto NGHTTP2_H2_16_ALPN = StringRef::from_lit("\x5h2-16"); -constexpr auto NGHTTP2_H2_16 = StringRef::from_lit("h2-16"); +constexpr auto NGHTTP2_H2_16_ALPN = "\x5h2-16"_sr; +constexpr auto NGHTTP2_H2_16 = "h2-16"_sr; -constexpr auto NGHTTP2_H2_14_ALPN = StringRef::from_lit("\x5h2-14"); -constexpr auto NGHTTP2_H2_14 = StringRef::from_lit("h2-14"); +constexpr auto NGHTTP2_H2_14_ALPN = "\x5h2-14"_sr; +constexpr auto NGHTTP2_H2_14 = "h2-14"_sr; -constexpr auto NGHTTP2_H1_1_ALPN = StringRef::from_lit("\x8http/1.1"); -constexpr auto NGHTTP2_H1_1 = StringRef::from_lit("http/1.1"); +constexpr auto NGHTTP2_H1_1_ALPN = "\x8http/1.1"_sr; +constexpr auto NGHTTP2_H1_1 = "http/1.1"_sr; constexpr size_t NGHTTP2_MAX_UINT64_DIGITS = str_size("18446744073709551615"); @@ -185,35 +189,42 @@ OutputIt quote_string(OutputIt it, const StringRef &target) { // NUL byte. size_t quote_stringlen(const StringRef &target); -std::string format_hex(const unsigned char *s, size_t len); +static constexpr char LOWER_XDIGITS[] = "0123456789abcdef"; + +template +OutputIt format_hex(OutputIt it, std::span s) { + for (auto c : s) { + *it++ = LOWER_XDIGITS[c >> 4]; + *it++ = LOWER_XDIGITS[c & 0xf]; + } -template std::string format_hex(const unsigned char (&s)[N]) { - return format_hex(s, N); + return it; } -template std::string format_hex(const std::array &s) { - return format_hex(s.data(), s.size()); +template +OutputIt format_hex(OutputIt it, std::span s) { + return format_hex(it, std::span{as_uint8_span(s)}); } -StringRef format_hex(BlockAllocator &balloc, const StringRef &s); +std::string format_hex(std::span s); -static constexpr char LOWER_XDIGITS[] = "0123456789abcdef"; +template +std::string format_hex(std::span s) { + return format_hex(std::span{as_uint8_span(s)}); +} -template -OutputIt format_hex(OutputIt it, const StringRef &s) { - for (auto cc : s) { - uint8_t c = cc; - *it++ = LOWER_XDIGITS[c >> 4]; - *it++ = LOWER_XDIGITS[c & 0xf]; - } +StringRef format_hex(BlockAllocator &balloc, std::span s); - return it; +template +StringRef format_hex(BlockAllocator &balloc, std::span s) { + return format_hex(balloc, std::span{as_uint8_span(s)}); } // decode_hex decodes hex string |s|, returns the decoded byte string. // This function assumes |s| is hex string, that is is_hex_string(s) // == true. -StringRef decode_hex(BlockAllocator &balloc, const StringRef &s); +std::span decode_hex(BlockAllocator &balloc, const StringRef &s); template OutputIt decode_hex(OutputIt d_first, const StringRef &s) { @@ -264,24 +275,24 @@ char upcase(char c); inline char lowcase(char c) { constexpr static unsigned char tbl[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', - 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', - 'z', 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', + 'z', 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, }; return tbl[static_cast(c)]; } @@ -289,14 +300,12 @@ inline char lowcase(char c) { template bool starts_with(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2) { - if (last1 - first1 < last2 - first2) { - return false; - } - return std::equal(first2, last2, first1); + return std::distance(first1, last1) >= std::distance(first2, last2) && + std::equal(first2, last2, first1); } template bool starts_with(const S &a, const T &b) { - return starts_with(a.begin(), a.end(), b.begin(), b.end()); + return starts_with(std::begin(a), std::end(a), std::begin(b), std::end(b)); } struct CaseCmp { @@ -308,107 +317,60 @@ struct CaseCmp { template bool istarts_with(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2) { - if (last1 - first1 < last2 - first2) { - return false; - } - return std::equal(first2, last2, first1, CaseCmp()); + return std::distance(first1, last1) >= std::distance(first2, last2) && + std::equal(first2, last2, first1, CaseCmp()); } template bool istarts_with(const S &a, const T &b) { - return istarts_with(a.begin(), a.end(), b.begin(), b.end()); -} - -template -bool istarts_with_l(const T &a, const CharT (&b)[N]) { - return istarts_with(a.begin(), a.end(), b, b + N - 1); + return istarts_with(std::begin(a), std::end(a), std::begin(b), std::end(b)); } template bool ends_with(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2) { - if (last1 - first1 < last2 - first2) { - return false; - } - return std::equal(first2, last2, last1 - (last2 - first2)); -} + auto len1 = std::distance(first1, last1); + auto len2 = std::distance(first2, last2); -template bool ends_with(const T &a, const S &b) { - return ends_with(a.begin(), a.end(), b.begin(), b.end()); + return len1 >= len2 && std::equal(first2, last2, first1 + (len1 - len2)); } -template -bool ends_with_l(const T &a, const CharT (&b)[N]) { - return ends_with(a.begin(), a.end(), b, b + N - 1); +template bool ends_with(const T &a, const S &b) { + return ends_with(std::begin(a), std::end(a), std::begin(b), std::end(b)); } template bool iends_with(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2) { - if (last1 - first1 < last2 - first2) { - return false; - } - return std::equal(first2, last2, last1 - (last2 - first2), CaseCmp()); -} + auto len1 = std::distance(first1, last1); + auto len2 = std::distance(first2, last2); -template bool iends_with(const T &a, const S &b) { - return iends_with(a.begin(), a.end(), b.begin(), b.end()); + return len1 >= len2 && + std::equal(first2, last2, first1 + (len1 - len2), CaseCmp()); } -template -bool iends_with_l(const T &a, const CharT (&b)[N]) { - return iends_with(a.begin(), a.end(), b, b + N - 1); +template bool iends_with(const T &a, const S &b) { + return iends_with(std::begin(a), std::end(a), std::begin(b), std::end(b)); } template bool strieq(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) { - if (std::distance(first1, last1) != std::distance(first2, last2)) { - return false; - } - - return std::equal(first1, last1, first2, CaseCmp()); + return std::equal(first1, last1, first2, last2, CaseCmp()); } template bool strieq(const T &a, const S &b) { - return strieq(a.begin(), a.end(), b.begin(), b.end()); -} - -template -bool strieq_l(const CharT (&a)[N], InputIt b, size_t blen) { - return strieq(a, a + (N - 1), b, b + blen); -} - -template -bool strieq_l(const CharT (&a)[N], const T &b) { - return strieq(a, a + (N - 1), b.begin(), b.end()); -} - -template -bool streq(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) { - if (std::distance(first1, last1) != std::distance(first2, last2)) { - return false; - } - return std::equal(first1, last1, first2); -} - -template bool streq(const T &a, const S &b) { - return streq(a.begin(), a.end(), b.begin(), b.end()); -} - -template -bool streq_l(const CharT (&a)[N], InputIt b, size_t blen) { - return streq(a, a + (N - 1), b, b + blen); + return strieq(std::begin(a), std::end(a), std::begin(b), std::end(b)); } -template -bool streq_l(const CharT (&a)[N], const T &b) { - return streq(a, a + (N - 1), b.begin(), b.end()); +template +bool strieq(const T &a, const S &b, size_t blen) { + return std::equal(std::begin(a), std::end(a), std::begin(b), + std::next(std::begin(b), blen), CaseCmp()); } -// Returns true if |a| contains |b|. If both |a| and |b| are empty, -// this function returns false. -template bool strifind(const S &a, const T &b) { - return std::search(a.begin(), a.end(), b.begin(), b.end(), CaseCmp()) != - a.end(); +template +bool streq(const T &a, const S &b, size_t blen) { + return std::equal(std::begin(a), std::end(a), std::begin(b), + std::next(std::begin(b), blen)); } template void inp_strlower(InputIt first, InputIt last) { @@ -458,10 +420,10 @@ template OutputIt utos(OutputIt dst, T n) { template StringRef make_string_ref_uint(BlockAllocator &balloc, T n) { auto iov = make_byte_ref(balloc, NGHTTP2_MAX_UINT64_DIGITS + 1); - auto p = iov.base; + auto p = std::begin(iov); p = util::utos(p, n); *p = '\0'; - return StringRef{iov.base, p}; + return StringRef{std::span{std::begin(iov), p}}; } template std::string utos_unit(T n) { @@ -526,27 +488,27 @@ StringRef to_base64(BlockAllocator &balloc, const StringRef &token68str); void show_candidates(const char *unkopt, const option *options); -bool has_uri_field(const http_parser_url &u, http_parser_url_fields field); +bool has_uri_field(const urlparse_url &u, urlparse_url_fields field); -bool fieldeq(const char *uri1, const http_parser_url &u1, const char *uri2, - const http_parser_url &u2, http_parser_url_fields field); +bool fieldeq(const char *uri1, const urlparse_url &u1, const char *uri2, + const urlparse_url &u2, urlparse_url_fields field); -bool fieldeq(const char *uri, const http_parser_url &u, - http_parser_url_fields field, const char *t); +bool fieldeq(const char *uri, const urlparse_url &u, urlparse_url_fields field, + const char *t); -bool fieldeq(const char *uri, const http_parser_url &u, - http_parser_url_fields field, const StringRef &t); +bool fieldeq(const char *uri, const urlparse_url &u, urlparse_url_fields field, + const StringRef &t); -StringRef get_uri_field(const char *uri, const http_parser_url &u, - http_parser_url_fields field); +StringRef get_uri_field(const char *uri, const urlparse_url &u, + urlparse_url_fields field); -uint16_t get_default_port(const char *uri, const http_parser_url &u); +uint16_t get_default_port(const char *uri, const urlparse_url &u); -bool porteq(const char *uri1, const http_parser_url &u1, const char *uri2, - const http_parser_url &u2); +bool porteq(const char *uri1, const urlparse_url &u1, const char *uri2, + const urlparse_url &u2); -void write_uri_field(std::ostream &o, const char *uri, const http_parser_url &u, - http_parser_url_fields field); +void write_uri_field(std::ostream &o, const char *uri, const urlparse_url &u, + urlparse_url_fields field); bool numeric_host(const char *hostname); @@ -567,6 +529,12 @@ std::string to_numeric_addr(const struct sockaddr *sa, socklen_t salen); // Sets |port| to |addr|. void set_port(Address &addr, uint16_t port); +// Get port from |su|. +uint16_t get_port(const sockaddr_union *su); + +// Returns true if |port| is prohibited as a QUIC client port. +bool quic_prohibited_port(uint16_t port); + // Returns ASCII dump of |data| of length |len|. Only ASCII printable // characters are preserved. Other characters are replaced with ".". std::string ascii_dump(const uint8_t *data, size_t len); @@ -634,7 +602,7 @@ std::vector split_str(const StringRef &s, char delim, size_t n); // terminated by NULL. template StringRef format_common_log(char *out, const T &tp) { auto t = - std::chrono::duration_cast(tp.time_since_epoch()); + std::chrono::duration_cast(tp.time_since_epoch()); auto p = common_log_date(out, t.count()); *p = '\0'; return StringRef{out, p}; @@ -645,7 +613,7 @@ template StringRef format_common_log(char *out, const T &tp) { // Expected type of |tp| is std::chrono::time_point template std::string format_iso8601(const T &tp) { auto t = std::chrono::duration_cast( - tp.time_since_epoch()); + tp.time_since_epoch()); return iso8601_date(t.count()); } @@ -657,7 +625,7 @@ template std::string format_iso8601(const T &tp) { // the buffer pointed by |out|, and this string is terminated by NULL. template StringRef format_iso8601(char *out, const T &tp) { auto t = std::chrono::duration_cast( - tp.time_since_epoch()); + tp.time_since_epoch()); auto p = iso8601_date(out, t.count()); *p = '\0'; return StringRef{out, p}; @@ -671,7 +639,7 @@ template StringRef format_iso8601(char *out, const T &tp) { // and this string is terminated by NULL. template StringRef format_iso8601_basic(char *out, const T &tp) { auto t = std::chrono::duration_cast( - tp.time_since_epoch()); + tp.time_since_epoch()); auto p = iso8601_basic_date(out, t.count()); *p = '\0'; return StringRef{out, p}; @@ -685,7 +653,7 @@ template StringRef format_iso8601_basic(char *out, const T &tp) { // by NULL. template StringRef format_http_date(char *out, const T &tp) { auto t = - std::chrono::duration_cast(tp.time_since_epoch()); + std::chrono::duration_cast(tp.time_since_epoch()); auto p = http_date(out, t.count()); *p = '\0'; return StringRef{out, p}; @@ -729,35 +697,22 @@ int get_socket_error(int fd); // Returns true if |host| is IPv6 numeric address (e.g., ::1) bool ipv6_numeric_addr(const char *host); -// Parses NULL terminated string |s| as unsigned integer and returns -// the parsed integer. Additionally, if |s| ends with 'k', 'm', 'g' -// and its upper case characters, multiply the integer by 1024, 1024 * -// 1024 and 1024 * 1024 respectively. If there is an error, returns -// -1. -int64_t parse_uint_with_unit(const char *s); -// The following overload does not require |s| is NULL terminated. -int64_t parse_uint_with_unit(const uint8_t *s, size_t len); -int64_t parse_uint_with_unit(const StringRef &s); - -// Parses NULL terminated string |s| as unsigned integer and returns -// the parsed integer. If there is an error, returns -1. -int64_t parse_uint(const char *s); -// The following overload does not require |s| is NULL terminated. -int64_t parse_uint(const uint8_t *s, size_t len); -int64_t parse_uint(const std::string &s); -int64_t parse_uint(const StringRef &s); - -// Parses NULL terminated string |s| as unsigned integer and returns -// the parsed integer casted to double. If |s| ends with "s", the -// parsed value's unit is a second. If |s| ends with "ms", the unit -// is millisecond. Similarly, it also supports 'm' and 'h' for -// minutes and hours respectively. If none of them are given, the -// unit is second. This function returns -// std::numeric_limits::infinity() if error occurs. -double parse_duration_with_unit(const char *s); -// The following overload does not require |s| is NULL terminated. -double parse_duration_with_unit(const uint8_t *s, size_t len); -double parse_duration_with_unit(const StringRef &s); +// Parses |s| as unsigned integer and returns the parsed integer. +// Additionally, if |s| ends with 'k', 'm', 'g' and its upper case +// characters, multiply the integer by 1024, 1024 * 1024 and 1024 * +// 1024 respectively. If there is an error, returns no value. +std::optional parse_uint_with_unit(const StringRef &s); + +// Parses |s| as unsigned integer and returns the parsed integer.. +std::optional parse_uint(const StringRef &s); + +// Parses |s| as unsigned integer and returns the parsed integer +// casted to double. If |s| ends with "s", the parsed value's unit is +// a second. If |s| ends with "ms", the unit is millisecond. +// Similarly, it also supports 'm' and 'h' for minutes and hours +// respectively. If none of them are given, the unit is second. This +// function returns no value if error occurs. +std::optional parse_duration_with_unit(const StringRef &s); // Returns string representation of time duration |t|. If t has // fractional part (at least more than or equal to 1e-3), |t| is @@ -786,7 +741,7 @@ StringRef make_hostport(BlockAllocator &balloc, const StringRef &host, template StringRef make_hostport(OutputIt first, const StringRef &host, uint16_t port) { - auto ipv6 = ipv6_numeric_addr(host.c_str()); + auto ipv6 = ipv6_numeric_addr(host.data()); auto serv = utos(port); auto p = first; @@ -806,7 +761,7 @@ StringRef make_hostport(OutputIt first, const StringRef &host, uint16_t port) { *p = '\0'; - return StringRef{first, p}; + return StringRef{std::span{first, p}}; } // Creates "host:port" string using given |host| and |port|. If @@ -822,7 +777,7 @@ StringRef make_http_hostport(OutputIt first, const StringRef &host, return make_hostport(first, host, port); } - auto ipv6 = ipv6_numeric_addr(host.c_str()); + auto ipv6 = ipv6_numeric_addr(host.data()); auto p = first; if (ipv6) { @@ -837,11 +792,13 @@ StringRef make_http_hostport(OutputIt first, const StringRef &host, *p = '\0'; - return StringRef{first, p}; + return StringRef{std::span{first, p}}; } -// Dumps |src| of length |len| in the format similar to `hexdump -C`. -void hexdump(FILE *out, const uint8_t *src, size_t len); +// hexdump dumps |data| of length |datalen| in the format similar to +// hexdump(1) with -C option. This function returns 0 if it succeeds, +// or -1. +int hexdump(FILE *out, const void *data, size_t datalen); // Copies 2 byte unsigned integer |n| in host byte order to |buf| in // network byte order. @@ -876,7 +833,7 @@ OutputIt random_alpha_digit(OutputIt first, OutputIt last, Generator &gen) { // If we use uint8_t instead char, gcc 6.2.0 complains by shouting // char-array initialized from wide string. static constexpr char s[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; std::uniform_int_distribution<> dis(0, 26 * 2 + 10 - 1); for (; first != last; ++first) { *first = s[dis(gen)]; @@ -901,13 +858,13 @@ void shuffle(RandomIt first, RandomIt last, Generator &&gen, SwapFun fun) { return; } - for (unsigned int i = 0; i < static_cast(len - 1); ++i) { - auto dis = std::uniform_int_distribution(i, len - 1); - auto j = dis(gen); - if (i == j) { - continue; - } - fun(first + i, first + j); + using dist_type = std::uniform_int_distribution; + using param_type = dist_type::param_type; + + dist_type d; + + for (decltype(len) i = 0; i < len - 1; ++i) { + fun(first + i, first + d(gen, param_type(i, len - 1))); } } diff --git a/lib/nghttp2-1.65.0/src/util_test.cc b/lib/nghttp2-1.65.0/src/util_test.cc new file mode 100644 index 00000000000..03ab2750924 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/util_test.cc @@ -0,0 +1,701 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "util_test.h" + +#include +#include +#include + +#include "munitxx.h" + +#include + +#include "util.h" +#include "template.h" + +using namespace nghttp2; +using namespace std::literals; + +namespace shrpx { + +namespace { +const MunitTest tests[]{ + munit_void_test(test_util_streq), + munit_void_test(test_util_strieq), + munit_void_test(test_util_inp_strlower), + munit_void_test(test_util_to_base64), + munit_void_test(test_util_to_token68), + munit_void_test(test_util_percent_encode_token), + munit_void_test(test_util_percent_decode), + munit_void_test(test_util_quote_string), + munit_void_test(test_util_utox), + munit_void_test(test_util_http_date), + munit_void_test(test_util_select_h2), + munit_void_test(test_util_ipv6_numeric_addr), + munit_void_test(test_util_utos), + munit_void_test(test_util_make_string_ref_uint), + munit_void_test(test_util_utos_unit), + munit_void_test(test_util_utos_funit), + munit_void_test(test_util_parse_uint_with_unit), + munit_void_test(test_util_parse_uint), + munit_void_test(test_util_parse_duration_with_unit), + munit_void_test(test_util_duration_str), + munit_void_test(test_util_format_duration), + munit_void_test(test_util_starts_with), + munit_void_test(test_util_ends_with), + munit_void_test(test_util_parse_http_date), + munit_void_test(test_util_localtime_date), + munit_void_test(test_util_get_uint64), + munit_void_test(test_util_parse_config_str_list), + munit_void_test(test_util_make_http_hostport), + munit_void_test(test_util_make_hostport), + munit_void_test(test_util_random_alpha_digit), + munit_void_test(test_util_format_hex), + munit_void_test(test_util_is_hex_string), + munit_void_test(test_util_decode_hex), + munit_void_test(test_util_extract_host), + munit_void_test(test_util_split_hostport), + munit_void_test(test_util_split_str), + munit_void_test(test_util_rstrip), + munit_test_end(), +}; +} // namespace + +const MunitSuite util_suite{ + "/util", tests, nullptr, 1, MUNIT_SUITE_OPTION_NONE, +}; + +void test_util_streq(void) { + assert_true(util::streq("alpha"_sr, "alpha"_sr, 5)); + assert_true(util::streq("alpha"_sr, "alphabravo"_sr, 5)); + assert_false(util::streq("alpha"_sr, "alphabravo"_sr, 6)); + assert_false(util::streq("alphabravo"_sr, "alpha"_sr, 5)); + assert_false(util::streq("alpha"_sr, "alphA"_sr, 5)); + assert_false(util::streq(""_sr, "a"_sr, 1)); + assert_true(util::streq(""_sr, ""_sr, 0)); + assert_false(util::streq("alpha"_sr, ""_sr, 0)); +} + +void test_util_strieq(void) { + assert_true(util::strieq(std::string("alpha"), std::string("alpha"))); + assert_true(util::strieq(std::string("alpha"), std::string("AlPhA"))); + assert_true(util::strieq(std::string(), std::string())); + assert_false(util::strieq(std::string("alpha"), std::string("AlPhA "))); + assert_false(util::strieq(std::string(), std::string("AlPhA "))); + + assert_true(util::strieq("alpha"_sr, "alpha"_sr)); + assert_true(util::strieq("alpha"_sr, "AlPhA"_sr)); + assert_true(util::strieq(StringRef{}, StringRef{})); + assert_false(util::strieq("alpha"_sr, "AlPhA "_sr)); + assert_false(util::strieq(""_sr, "AlPhA "_sr)); + + assert_true(util::strieq("alpha"_sr, "alpha"_sr, 5)); + assert_true(util::strieq("alpha"_sr, "AlPhA"_sr, 5)); + assert_false(util::strieq("alpha"_sr, "AlPhA "_sr, 6)); + assert_false(util::strieq(""_sr, "AlPhA "_sr, 6)); +} + +void test_util_inp_strlower(void) { + std::string a("alPha"); + util::inp_strlower(a); + assert_stdstring_equal("alpha", a); + + a = "ALPHA123BRAVO"; + util::inp_strlower(a); + assert_stdstring_equal("alpha123bravo", a); + + a = ""; + util::inp_strlower(a); + assert_stdstring_equal("", a); +} + +void test_util_to_base64(void) { + BlockAllocator balloc(4096, 4096); + + assert_stdsv_equal("AAA++B/="sv, util::to_base64(balloc, "AAA--B_"_sr)); + assert_stdsv_equal("AAA++B/B"sv, util::to_base64(balloc, "AAA--B_B"_sr)); +} + +void test_util_to_token68(void) { + std::string x = "AAA++B/="; + util::to_token68(x); + assert_stdstring_equal("AAA--B_", x); + + x = "AAA++B/B"; + util::to_token68(x); + assert_stdstring_equal("AAA--B_B", x); +} + +void test_util_percent_encode_token(void) { + BlockAllocator balloc(4096, 4096); + assert_stdsv_equal("h2"sv, util::percent_encode_token(balloc, "h2"_sr)); + assert_stdsv_equal("h3~"sv, util::percent_encode_token(balloc, "h3~"_sr)); + assert_stdsv_equal("100%25"sv, util::percent_encode_token(balloc, "100%"_sr)); + assert_stdsv_equal("http%202"sv, + util::percent_encode_token(balloc, "http 2"_sr)); +} + +void test_util_percent_decode(void) { + { + std::string s = "%66%6F%6f%62%61%72"; + assert_stdstring_equal("foobar", + util::percent_decode(std::begin(s), std::end(s))); + } + { + std::string s = "%66%6"; + assert_stdstring_equal("f%6", + util::percent_decode(std::begin(s), std::end(s))); + } + { + std::string s = "%66%"; + assert_stdstring_equal("f%", + util::percent_decode(std::begin(s), std::end(s))); + } + BlockAllocator balloc(1024, 1024); + + assert_stdsv_equal("foobar"sv, + util::percent_decode(balloc, "%66%6F%6f%62%61%72"_sr)); + + assert_stdsv_equal("f%6"sv, util::percent_decode(balloc, "%66%6"_sr)); + + assert_stdsv_equal("f%"sv, util::percent_decode(balloc, "%66%"_sr)); +} + +void test_util_quote_string(void) { + BlockAllocator balloc(4096, 4096); + assert_stdsv_equal("alpha"sv, util::quote_string(balloc, "alpha"_sr)); + assert_stdsv_equal(""sv, util::quote_string(balloc, ""_sr)); + assert_stdsv_equal("\\\"alpha\\\""sv, + util::quote_string(balloc, "\"alpha\""_sr)); +} + +void test_util_utox(void) { + assert_stdstring_equal("0", util::utox(0)); + assert_stdstring_equal("1", util::utox(1)); + assert_stdstring_equal("F", util::utox(15)); + assert_stdstring_equal("10", util::utox(16)); + assert_stdstring_equal("3B9ACA07", util::utox(1000000007)); + assert_stdstring_equal("100000000", util::utox(1LL << 32)); +} + +void test_util_http_date(void) { + assert_stdstring_equal("Thu, 01 Jan 1970 00:00:00 GMT", util::http_date(0)); + assert_stdstring_equal("Wed, 29 Feb 2012 09:15:16 GMT", + util::http_date(1330506916)); + + std::array http_buf; + + assert_stdsv_equal( + "Thu, 01 Jan 1970 00:00:00 GMT"sv, + util::format_http_date(http_buf.data(), + std::chrono::system_clock::time_point())); + assert_stdsv_equal("Wed, 29 Feb 2012 09:15:16 GMT"sv, + util::format_http_date( + http_buf.data(), std::chrono::system_clock::time_point( + std::chrono::seconds(1330506916)))); +} + +void test_util_select_h2(void) { + const unsigned char *out = nullptr; + unsigned char outlen = 0; + + // Check single entry and select it. + const unsigned char t1[] = "\x2h2"; + assert_true(util::select_h2(&out, &outlen, t1, sizeof(t1) - 1)); + assert_memory_equal(NGHTTP2_PROTO_VERSION_ID_LEN, NGHTTP2_PROTO_VERSION_ID, + out); + assert_uchar(NGHTTP2_PROTO_VERSION_ID_LEN, ==, outlen); + + out = nullptr; + outlen = 0; + + // Check the case where id is correct but length is invalid and too + // long. + const unsigned char t2[] = "\x6h2-14"; + assert_false(util::select_h2(&out, &outlen, t2, sizeof(t2) - 1)); + + // Check the case where h2 is located after bogus ID. + const unsigned char t3[] = "\x2h3\x2h2"; + assert_true(util::select_h2(&out, &outlen, t3, sizeof(t3) - 1)); + + assert_memory_equal(NGHTTP2_PROTO_VERSION_ID_LEN, NGHTTP2_PROTO_VERSION_ID, + out); + assert_uchar(NGHTTP2_PROTO_VERSION_ID_LEN, ==, outlen); + + out = nullptr; + outlen = 0; + + // Check the case that last entry's length is invalid and too long. + const unsigned char t4[] = "\x2h3\x6h2-14"; + assert_false(util::select_h2(&out, &outlen, t4, sizeof(t4) - 1)); + + // Check the case that all entries are not supported. + const unsigned char t5[] = "\x2h3\x2h4"; + assert_false(util::select_h2(&out, &outlen, t5, sizeof(t5) - 1)); + + // Check the case where 2 values are eligible, but last one is + // picked up because it has precedence over the other. + const unsigned char t6[] = "\x5h2-14\x5h2-16"; + assert_true(util::select_h2(&out, &outlen, t6, sizeof(t6) - 1)); + assert_stdsv_equal(NGHTTP2_H2_16, (StringRef{out, outlen})); +} + +void test_util_ipv6_numeric_addr(void) { + assert_true(util::ipv6_numeric_addr("::1")); + assert_true( + util::ipv6_numeric_addr("2001:0db8:85a3:0042:1000:8a2e:0370:7334")); + // IPv4 + assert_false(util::ipv6_numeric_addr("127.0.0.1")); + // not numeric address + assert_false(util::ipv6_numeric_addr("localhost")); +} + +void test_util_utos(void) { + uint8_t buf[32]; + + assert_stdstring_equal("0", (std::string{buf, util::utos(buf, 0)})); + assert_stdstring_equal("123", (std::string{buf, util::utos(buf, 123)})); + assert_stdstring_equal( + "18446744073709551615", + (std::string{buf, util::utos(buf, 18446744073709551615ULL)})); +} + +void test_util_make_string_ref_uint(void) { + BlockAllocator balloc(1024, 1024); + + assert_stdsv_equal("0"sv, util::make_string_ref_uint(balloc, 0)); + assert_stdsv_equal("123"sv, util::make_string_ref_uint(balloc, 123)); + assert_stdsv_equal( + "18446744073709551615"sv, + util::make_string_ref_uint(balloc, 18446744073709551615ULL)); +} + +void test_util_utos_unit(void) { + assert_stdstring_equal("0", util::utos_unit(0)); + assert_stdstring_equal("1023", util::utos_unit(1023)); + assert_stdstring_equal("1K", util::utos_unit(1024)); + assert_stdstring_equal("1K", util::utos_unit(1025)); + assert_stdstring_equal("1M", util::utos_unit(1 << 20)); + assert_stdstring_equal("1G", util::utos_unit(1 << 30)); + assert_stdstring_equal("1024G", util::utos_unit(1LL << 40)); +} + +void test_util_utos_funit(void) { + assert_stdstring_equal("0", util::utos_funit(0)); + assert_stdstring_equal("1023", util::utos_funit(1023)); + assert_stdstring_equal("1.00K", util::utos_funit(1024)); + assert_stdstring_equal("1.00K", util::utos_funit(1025)); + assert_stdstring_equal("1.09K", util::utos_funit(1119)); + assert_stdstring_equal("1.27K", util::utos_funit(1300)); + assert_stdstring_equal("1.00M", util::utos_funit(1 << 20)); + assert_stdstring_equal("1.18M", util::utos_funit(1234567)); + assert_stdstring_equal("1.00G", util::utos_funit(1 << 30)); + assert_stdstring_equal("4492450797.23G", + util::utos_funit(4823732313248234343LL)); + assert_stdstring_equal("1024.00G", util::utos_funit(1LL << 40)); +} + +void test_util_parse_uint_with_unit(void) { + assert_int64(0, ==, util::parse_uint_with_unit("0").value_or(-1)); + assert_int64(1023, ==, util::parse_uint_with_unit("1023").value_or(-1)); + assert_int64(1024, ==, util::parse_uint_with_unit("1k").value_or(-1)); + assert_int64(2048, ==, util::parse_uint_with_unit("2K").value_or(-1)); + assert_int64(1 << 20, ==, util::parse_uint_with_unit("1m").value_or(-1)); + assert_int64(1 << 21, ==, util::parse_uint_with_unit("2M").value_or(-1)); + assert_int64(1 << 30, ==, util::parse_uint_with_unit("1g").value_or(-1)); + assert_int64(1LL << 31, ==, util::parse_uint_with_unit("2G").value_or(-1)); + assert_int64(9223372036854775807LL, ==, + util::parse_uint_with_unit("9223372036854775807").value_or(-1)); + // check overflow case + assert_false(util::parse_uint_with_unit("9223372036854775808")); + assert_false(util::parse_uint_with_unit("10000000000000000000")); + assert_false(util::parse_uint_with_unit("9223372036854775807G")); + // bad characters + assert_false(util::parse_uint_with_unit("1.1")); + assert_false(util::parse_uint_with_unit("1a")); + assert_false(util::parse_uint_with_unit("a1")); + assert_false(util::parse_uint_with_unit("1T")); + assert_false(util::parse_uint_with_unit("")); +} + +void test_util_parse_uint(void) { + assert_int64(0, ==, util::parse_uint("0").value_or(-1)); + assert_int64(1023, ==, util::parse_uint("1023").value_or(-1)); + assert_false(util::parse_uint("1k")); + assert_int64(9223372036854775807LL, ==, + util::parse_uint("9223372036854775807").value_or(-1)); + // check overflow case + assert_false(util::parse_uint("9223372036854775808")); + assert_false(util::parse_uint("10000000000000000000")); + // bad characters + assert_false(util::parse_uint("1.1")); + assert_false(util::parse_uint("1a")); + assert_false(util::parse_uint("a1")); + assert_false(util::parse_uint("1T")); + assert_false(util::parse_uint("")); +} + +void test_util_parse_duration_with_unit(void) { + auto inf = std::numeric_limits::infinity(); + + assert_double(0., ==, util::parse_duration_with_unit("0").value_or(inf)); + assert_double(123., ==, util::parse_duration_with_unit("123").value_or(inf)); + assert_double(123., ==, util::parse_duration_with_unit("123s").value_or(inf)); + assert_double(0.500, ==, + util::parse_duration_with_unit("500ms").value_or(inf)); + assert_double(123., ==, util::parse_duration_with_unit("123S").value_or(inf)); + assert_double(0.500, ==, + util::parse_duration_with_unit("500MS").value_or(inf)); + assert_double(180, ==, util::parse_duration_with_unit("3m").value_or(inf)); + assert_double(3600 * 5, ==, + util::parse_duration_with_unit("5h").value_or(inf)); + + // check overflow case + assert_false(util::parse_duration_with_unit("9223372036854775808")); + // bad characters + assert_false(util::parse_duration_with_unit("0u")); + assert_false(util::parse_duration_with_unit("0xs")); + assert_false(util::parse_duration_with_unit("0mt")); + assert_false(util::parse_duration_with_unit("0mss")); + assert_false(util::parse_duration_with_unit("s")); + assert_false(util::parse_duration_with_unit("ms")); +} + +void test_util_duration_str(void) { + assert_stdstring_equal("0", util::duration_str(0.)); + assert_stdstring_equal("1s", util::duration_str(1.)); + assert_stdstring_equal("500ms", util::duration_str(0.5)); + assert_stdstring_equal("1500ms", util::duration_str(1.5)); + assert_stdstring_equal("2m", util::duration_str(120.)); + assert_stdstring_equal("121s", util::duration_str(121.)); + assert_stdstring_equal("1h", util::duration_str(3600.)); +} + +void test_util_format_duration(void) { + assert_stdstring_equal("0us", + util::format_duration(std::chrono::microseconds(0))); + assert_stdstring_equal("999us", + util::format_duration(std::chrono::microseconds(999))); + assert_stdstring_equal( + "1.00ms", util::format_duration(std::chrono::microseconds(1000))); + assert_stdstring_equal( + "1.09ms", util::format_duration(std::chrono::microseconds(1090))); + assert_stdstring_equal( + "1.01ms", util::format_duration(std::chrono::microseconds(1009))); + assert_stdstring_equal( + "999.99ms", util::format_duration(std::chrono::microseconds(999990))); + assert_stdstring_equal( + "1.00s", util::format_duration(std::chrono::microseconds(1000000))); + assert_stdstring_equal( + "1.05s", util::format_duration(std::chrono::microseconds(1050000))); + + assert_stdstring_equal("0us", util::format_duration(0.)); + assert_stdstring_equal("999us", util::format_duration(0.000999)); + assert_stdstring_equal("1.00ms", util::format_duration(0.001)); + assert_stdstring_equal("1.09ms", util::format_duration(0.00109)); + assert_stdstring_equal("1.01ms", util::format_duration(0.001009)); + assert_stdstring_equal("999.99ms", util::format_duration(0.99999)); + assert_stdstring_equal("1.00s", util::format_duration(1.)); + assert_stdstring_equal("1.05s", util::format_duration(1.05)); +} + +void test_util_starts_with(void) { + assert_true(util::starts_with("foo"_sr, "foo"_sr)); + assert_true(util::starts_with("fooo"_sr, "foo"_sr)); + assert_true(util::starts_with("ofoo"_sr, StringRef{})); + assert_false(util::starts_with("ofoo"_sr, "foo"_sr)); + + assert_true(util::istarts_with("FOO"_sr, "fOO"_sr)); + assert_true(util::istarts_with("ofoo"_sr, StringRef{})); + assert_true(util::istarts_with("fOOo"_sr, "Foo"_sr)); + assert_false(util::istarts_with("ofoo"_sr, "foo"_sr)); +} + +void test_util_ends_with(void) { + assert_true(util::ends_with("foo"_sr, "foo"_sr)); + assert_true(util::ends_with("foo"_sr, StringRef{})); + assert_true(util::ends_with("ofoo"_sr, "foo"_sr)); + assert_false(util::ends_with("ofoo"_sr, "fo"_sr)); + + assert_true(util::iends_with("fOo"_sr, "Foo"_sr)); + assert_true(util::iends_with("foo"_sr, StringRef{})); + assert_true(util::iends_with("oFoo"_sr, "fOO"_sr)); + assert_false(util::iends_with("ofoo"_sr, "fo"_sr)); +} + +void test_util_parse_http_date(void) { + assert_int64(1001939696, ==, + util::parse_http_date("Mon, 1 Oct 2001 12:34:56 GMT"_sr)); +} + +void test_util_localtime_date(void) { + auto tz = getenv("TZ"); + if (tz) { + tz = strdup(tz); + } +#ifdef __linux__ + setenv("TZ", "NZST-12:00:00:00", 1); +#else // !__linux__ + setenv("TZ", ":Pacific/Auckland", 1); +#endif // !__linux__ + tzset(); + + assert_stdstring_equal("02/Oct/2001:00:34:56 +1200", + util::common_log_date(1001939696)); + assert_stdstring_equal("2001-10-02T00:34:56.123+12:00", + util::iso8601_date(1001939696000LL + 123)); + + std::array common_buf; + + assert_stdsv_equal("02/Oct/2001:00:34:56 +1200"sv, + util::format_common_log( + common_buf.data(), std::chrono::system_clock::time_point( + std::chrono::seconds(1001939696)))); + + std::array iso8601_buf; + + assert_stdsv_equal( + "2001-10-02T00:34:56.123+12:00"sv, + util::format_iso8601(iso8601_buf.data(), + std::chrono::system_clock::time_point( + std::chrono::milliseconds(1001939696123LL)))); + + if (tz) { + setenv("TZ", tz, 1); + free(tz); + } else { + unsetenv("TZ"); + } + tzset(); +} + +void test_util_get_uint64(void) { + { + auto v = std::to_array( + {0x01, 0x12, 0x34, 0x56, 0xff, 0x9a, 0xab, 0xbc}); + + auto n = util::get_uint64(v.data()); + + assert_uint64(0x01123456ff9aabbcULL, ==, n); + } + { + auto v = std::to_array( + {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}); + + auto n = util::get_uint64(v.data()); + + assert_uint64(0xffffffffffffffffULL, ==, n); + } +} + +void test_util_parse_config_str_list(void) { + auto res = util::parse_config_str_list("a"_sr); + assert_size(1, ==, res.size()); + assert_stdstring_equal("a", res[0]); + + res = util::parse_config_str_list("a,"_sr); + assert_size(2, ==, res.size()); + assert_stdstring_equal("a", res[0]); + assert_stdstring_equal("", res[1]); + + res = util::parse_config_str_list(":a::"_sr, ':'); + assert_size(4, ==, res.size()); + assert_stdstring_equal("", res[0]); + assert_stdstring_equal("a", res[1]); + assert_stdstring_equal("", res[2]); + assert_stdstring_equal("", res[3]); + + res = util::parse_config_str_list(StringRef{}); + assert_size(1, ==, res.size()); + assert_stdstring_equal("", res[0]); + + res = util::parse_config_str_list("alpha,bravo,charlie"_sr); + assert_size(3, ==, res.size()); + assert_stdstring_equal("alpha", res[0]); + assert_stdstring_equal("bravo", res[1]); + assert_stdstring_equal("charlie", res[2]); +} + +void test_util_make_http_hostport(void) { + BlockAllocator balloc(4096, 4096); + + assert_stdsv_equal("localhost"sv, + util::make_http_hostport(balloc, "localhost"_sr, 80)); + assert_stdsv_equal("[::1]"sv, + util::make_http_hostport(balloc, "::1"_sr, 443)); + assert_stdsv_equal("localhost:3000"sv, + util::make_http_hostport(balloc, "localhost"_sr, 3000)); +} + +void test_util_make_hostport(void) { + std::array hostport_buf; + assert_stdsv_equal( + "localhost:80"sv, + util::make_hostport(std::begin(hostport_buf), "localhost"_sr, 80)); + assert_stdsv_equal("[::1]:443"sv, util::make_hostport( + std::begin(hostport_buf), "::1"_sr, 443)); + + BlockAllocator balloc(4096, 4096); + assert_stdsv_equal("localhost:80"sv, + util::make_hostport(balloc, "localhost"_sr, 80)); + assert_stdsv_equal("[::1]:443"sv, util::make_hostport(balloc, "::1"_sr, 443)); +} + +void test_util_random_alpha_digit(void) { + std::random_device rd; + std::mt19937 gen(rd()); + std::array data; + + auto p = util::random_alpha_digit(std::begin(data), std::end(data), gen); + + assert_true(std::end(data) == p); + + for (auto b : data) { + assert_true(('A' <= b && b <= 'Z') || ('a' <= b && b <= 'z') || + ('0' <= b && b <= '9')); + } +} + +void test_util_format_hex(void) { + BlockAllocator balloc(4096, 4096); + + assert_stdsv_equal("0ff0"sv, + util::format_hex(balloc, std::span{"\x0f\xf0"_sr})); + assert_stdsv_equal(""sv, + util::format_hex(balloc, std::span{})); + + union T { + uint16_t x; + uint8_t y[2]; + }; + + auto t = T{.y = {0xbe, 0xef}}; + + assert_stdstring_equal("beef", util::format_hex(std::span{&t.x, 1})); + + std::string o; + o.resize(4); + + assert_true(std::end(o) == + util::format_hex(std::begin(o), std::span{&t.x, 1})); + assert_stdstring_equal("beef", o); + + struct S { + uint8_t x[8]; + }; + + auto s = S{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0xf8}}; + + assert_stdstring_equal("01020304050607f8", util::format_hex(s.x)); +} + +void test_util_is_hex_string(void) { + assert_true(util::is_hex_string(StringRef{})); + assert_true(util::is_hex_string("0123456789abcdef"_sr)); + assert_true(util::is_hex_string("0123456789ABCDEF"_sr)); + assert_false(util::is_hex_string("000"_sr)); + assert_false(util::is_hex_string("XX"_sr)); +} + +void test_util_decode_hex(void) { + BlockAllocator balloc(4096, 4096); + + assert_stdsv_equal("\x0f\xf0"sv, + StringRef{util::decode_hex(balloc, "0ff0"_sr)}); + assert_stdsv_equal(""sv, StringRef{util::decode_hex(balloc, StringRef{})}); +} + +void test_util_extract_host(void) { + assert_stdsv_equal("foo"sv, util::extract_host("foo"_sr)); + assert_stdsv_equal("foo"sv, util::extract_host("foo:"_sr)); + assert_stdsv_equal("foo"sv, util::extract_host("foo:0"_sr)); + assert_stdsv_equal("[::1]"sv, util::extract_host("[::1]"_sr)); + assert_stdsv_equal("[::1]"sv, util::extract_host("[::1]:"_sr)); + + assert_true(util::extract_host(":foo"_sr).empty()); + assert_true(util::extract_host("[::1"_sr).empty()); + assert_true(util::extract_host("[::1]0"_sr).empty()); + assert_true(util::extract_host(StringRef{}).empty()); +} + +void test_util_split_hostport(void) { + assert_true(std::make_pair("foo"_sr, StringRef{}) == + util::split_hostport("foo"_sr)); + assert_true(std::make_pair("foo"_sr, "80"_sr) == + util::split_hostport("foo:80"_sr)); + assert_true(std::make_pair("::1"_sr, "80"_sr) == + util::split_hostport("[::1]:80"_sr)); + assert_true(std::make_pair("::1"_sr, StringRef{}) == + util::split_hostport("[::1]"_sr)); + + assert_true(std::make_pair(StringRef{}, StringRef{}) == + util::split_hostport(StringRef{})); + assert_true(std::make_pair(StringRef{}, StringRef{}) == + util::split_hostport("[::1]:"_sr)); + assert_true(std::make_pair(StringRef{}, StringRef{}) == + util::split_hostport("foo:"_sr)); + assert_true(std::make_pair(StringRef{}, StringRef{}) == + util::split_hostport("[::1:"_sr)); + assert_true(std::make_pair(StringRef{}, StringRef{}) == + util::split_hostport("[::1]80"_sr)); +} + +void test_util_split_str(void) { + assert_true(std::vector{""_sr} == util::split_str(""_sr, ',')); + assert_true(std::vector{"alpha"_sr} == + util::split_str("alpha"_sr, ',')); + assert_true((std::vector{"alpha"_sr, ""_sr}) == + util::split_str("alpha,"_sr, ',')); + assert_true((std::vector{"alpha"_sr, "bravo"_sr}) == + util::split_str("alpha,bravo"_sr, ',')); + assert_true((std::vector{"alpha"_sr, "bravo"_sr, "charlie"_sr}) == + util::split_str("alpha,bravo,charlie"_sr, ',')); + assert_true((std::vector{"alpha"_sr, "bravo"_sr, "charlie"_sr}) == + util::split_str("alpha,bravo,charlie"_sr, ',', 0)); + assert_true(std::vector{""_sr} == util::split_str(""_sr, ',', 1)); + assert_true(std::vector{""_sr} == util::split_str(""_sr, ',', 2)); + assert_true((std::vector{"alpha"_sr, "bravo,charlie"_sr}) == + util::split_str("alpha,bravo,charlie"_sr, ',', 2)); + assert_true(std::vector{"alpha"_sr} == + util::split_str("alpha"_sr, ',', 2)); + assert_true((std::vector{"alpha"_sr, ""_sr}) == + util::split_str("alpha,"_sr, ',', 2)); + assert_true(std::vector{"alpha"_sr} == + util::split_str("alpha"_sr, ',', 0)); + assert_true(std::vector{"alpha,bravo,charlie"_sr} == + util::split_str("alpha,bravo,charlie"_sr, ',', 1)); +} + +void test_util_rstrip(void) { + BlockAllocator balloc(4096, 4096); + + assert_stdsv_equal("alpha"sv, util::rstrip(balloc, "alpha"_sr)); + assert_stdsv_equal("alpha"sv, util::rstrip(balloc, "alpha "_sr)); + assert_stdsv_equal("alpha"sv, util::rstrip(balloc, "alpha \t"_sr)); + assert_stdsv_equal(""sv, util::rstrip(balloc, ""_sr)); + assert_stdsv_equal(""sv, util::rstrip(balloc, "\t\t\t "_sr)); +} + +} // namespace shrpx diff --git a/lib/nghttp2-1.65.0/src/util_test.h b/lib/nghttp2-1.65.0/src/util_test.h new file mode 100644 index 00000000000..99a591406b2 --- /dev/null +++ b/lib/nghttp2-1.65.0/src/util_test.h @@ -0,0 +1,80 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef UTIL_TEST_H +#define UTIL_TEST_H + +#ifdef HAVE_CONFIG_H +# include +#endif // HAVE_CONFIG_H + +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +namespace shrpx { + +extern const MunitSuite util_suite; + +munit_void_test_decl(test_util_streq) +munit_void_test_decl(test_util_strieq) +munit_void_test_decl(test_util_inp_strlower) +munit_void_test_decl(test_util_to_base64) +munit_void_test_decl(test_util_to_token68) +munit_void_test_decl(test_util_percent_encode_token) +munit_void_test_decl(test_util_percent_decode) +munit_void_test_decl(test_util_quote_string) +munit_void_test_decl(test_util_utox) +munit_void_test_decl(test_util_http_date) +munit_void_test_decl(test_util_select_h2) +munit_void_test_decl(test_util_ipv6_numeric_addr) +munit_void_test_decl(test_util_utos) +munit_void_test_decl(test_util_make_string_ref_uint) +munit_void_test_decl(test_util_utos_unit) +munit_void_test_decl(test_util_utos_funit) +munit_void_test_decl(test_util_parse_uint_with_unit) +munit_void_test_decl(test_util_parse_uint) +munit_void_test_decl(test_util_parse_duration_with_unit) +munit_void_test_decl(test_util_duration_str) +munit_void_test_decl(test_util_format_duration) +munit_void_test_decl(test_util_starts_with) +munit_void_test_decl(test_util_ends_with) +munit_void_test_decl(test_util_parse_http_date) +munit_void_test_decl(test_util_localtime_date) +munit_void_test_decl(test_util_get_uint64) +munit_void_test_decl(test_util_parse_config_str_list) +munit_void_test_decl(test_util_make_http_hostport) +munit_void_test_decl(test_util_make_hostport) +munit_void_test_decl(test_util_random_alpha_digit) +munit_void_test_decl(test_util_format_hex) +munit_void_test_decl(test_util_is_hex_string) +munit_void_test_decl(test_util_decode_hex) +munit_void_test_decl(test_util_extract_host) +munit_void_test_decl(test_util_split_hostport) +munit_void_test_decl(test_util_split_str) +munit_void_test_decl(test_util_rstrip) + +} // namespace shrpx + +#endif // UTIL_TEST_H diff --git a/lib/nghttp2/src/xsi_strerror.c b/lib/nghttp2-1.65.0/src/xsi_strerror.c similarity index 100% rename from lib/nghttp2/src/xsi_strerror.c rename to lib/nghttp2-1.65.0/src/xsi_strerror.c diff --git a/lib/nghttp2/src/xsi_strerror.h b/lib/nghttp2-1.65.0/src/xsi_strerror.h similarity index 100% rename from lib/nghttp2/src/xsi_strerror.h rename to lib/nghttp2-1.65.0/src/xsi_strerror.h diff --git a/lib/nghttp2-1.65.0/test-driver b/lib/nghttp2-1.65.0/test-driver new file mode 100755 index 00000000000..be73b80adf9 --- /dev/null +++ b/lib/nghttp2-1.65.0/test-driver @@ -0,0 +1,153 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 2011-2021 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <"$log_file" +"$@" >>"$log_file" 2>&1 +estatus=$? + +if test $enable_hard_errors = no && test $estatus -eq 99; then + tweaked_estatus=1 +else + tweaked_estatus=$estatus +fi + +case $tweaked_estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>"$log_file" + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/lib/nghttp2-1.65.0/tests/CMakeLists.txt b/lib/nghttp2-1.65.0/tests/CMakeLists.txt new file mode 100644 index 00000000000..852cb106e34 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/CMakeLists.txt @@ -0,0 +1,52 @@ +# XXX testdata/: EXTRA_DIST = cacert.pem index.html privkey.pem +string(REPLACE " " ";" c_flags "${WARNCFLAGS}") +add_compile_options(${c_flags}) + +include_directories( + "${CMAKE_SOURCE_DIR}/lib/includes" + "${CMAKE_SOURCE_DIR}/lib" + "${CMAKE_SOURCE_DIR}/tests/munit" + "${CMAKE_BINARY_DIR}/lib/includes" +) + +set(MAIN_SOURCES + main.c nghttp2_pq_test.c nghttp2_map_test.c nghttp2_queue_test.c + nghttp2_test_helper.c + nghttp2_frame_test.c + nghttp2_stream_test.c + nghttp2_session_test.c + nghttp2_hd_test.c + nghttp2_alpn_test.c + nghttp2_helper_test.c + nghttp2_buf_test.c + nghttp2_http_test.c + nghttp2_extpri_test.c + nghttp2_ratelim_test.c + munit/munit.c +) + +add_executable(main EXCLUDE_FROM_ALL + ${MAIN_SOURCES} +) +target_link_libraries(main + nghttp2_static +) +add_test(main main) +add_dependencies(check main) + +if(ENABLE_FAILMALLOC) + set(FAILMALLOC_SOURCES + failmalloc.c failmalloc_test.c + malloc_wrapper.c + nghttp2_test_helper.c + munit/munit.c + ) + add_executable(failmalloc EXCLUDE_FROM_ALL + ${FAILMALLOC_SOURCES} + ) + target_link_libraries(failmalloc + nghttp2_static + ) + add_test(failmalloc failmalloc) + add_dependencies(check failmalloc) +endif() diff --git a/lib/nghttp2/tests/Makefile.am b/lib/nghttp2-1.65.0/tests/Makefile.am similarity index 87% rename from lib/nghttp2/tests/Makefile.am rename to lib/nghttp2-1.65.0/tests/Makefile.am index e6cdde111cb..456f65f69a9 100644 --- a/lib/nghttp2/tests/Makefile.am +++ b/lib/nghttp2-1.65.0/tests/Makefile.am @@ -22,9 +22,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SUBDIRS = testdata -EXTRA_DIST = CMakeLists.txt - -if HAVE_CUNIT +EXTRA_DIST = CMakeLists.txt munit/COPYING check_PROGRAMS = main @@ -38,22 +36,25 @@ OBJECTS = main.c nghttp2_pq_test.c nghttp2_map_test.c nghttp2_queue_test.c \ nghttp2_stream_test.c \ nghttp2_session_test.c \ nghttp2_hd_test.c \ - nghttp2_npn_test.c \ + nghttp2_alpn_test.c \ nghttp2_helper_test.c \ nghttp2_buf_test.c \ nghttp2_http_test.c \ nghttp2_extpri_test.c \ - nghttp2_ratelim_test.c + nghttp2_ratelim_test.c \ + munit/munit.c HFILES = nghttp2_pq_test.h nghttp2_map_test.h nghttp2_queue_test.h \ nghttp2_session_test.h \ nghttp2_frame_test.h nghttp2_stream_test.h nghttp2_hd_test.h \ - nghttp2_npn_test.h nghttp2_helper_test.h \ + nghttp2_alpn_test.h nghttp2_helper_test.h \ + nghttp2_assertion.h \ nghttp2_test_helper.h \ nghttp2_buf_test.h \ nghttp2_http_test.h \ nghttp2_extpri_test.h \ - nghttp2_ratelim_test.h + nghttp2_ratelim_test.h \ + munit/munit.h main_SOURCES = $(HFILES) $(OBJECTS) @@ -65,13 +66,14 @@ else main_LDADD = ${top_builddir}/lib/.libs/*.o endif -main_LDADD += @CUNIT_LIBS@ @TESTLDADD@ +main_LDADD += @TESTLDADD@ main_LDFLAGS = -static if ENABLE_FAILMALLOC failmalloc_SOURCES = failmalloc.c failmalloc_test.c failmalloc_test.h \ malloc_wrapper.c malloc_wrapper.h \ - nghttp2_test_helper.c nghttp2_test_helper.h + nghttp2_test_helper.c nghttp2_test_helper.h \ + munit/munit.c munit/munit.h failmalloc_LDADD = $(main_LDADD) failmalloc_LDFLAGS = $(main_LDFLAGS) endif # ENABLE_FAILMALLOC @@ -79,22 +81,14 @@ endif # ENABLE_FAILMALLOC AM_CFLAGS = $(WARNCFLAGS) \ -I${top_srcdir}/lib \ -I${top_srcdir}/lib/includes \ + -I${top_srcdir}/tests/munit \ -I${top_builddir}/lib/includes \ -DBUILDING_NGHTTP2 \ -DNGHTTP2_STATICLIB \ - @CUNIT_CFLAGS@ @DEFS@ + @DEFS@ TESTS = main if ENABLE_FAILMALLOC TESTS += failmalloc endif # ENABLE_FAILMALLOC - -if ENABLE_APP - -# EXTRA_DIST = end_to_end.py -# TESTS += end_to_end.py - -endif # ENABLE_APP - -endif # HAVE_CUNIT diff --git a/lib/nghttp2-1.65.0/tests/Makefile.in b/lib/nghttp2-1.65.0/tests/Makefile.in new file mode 100644 index 00000000000..1aefa56f76d --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/Makefile.in @@ -0,0 +1,1362 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2012 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +check_PROGRAMS = main$(EXEEXT) $(am__EXEEXT_1) +@ENABLE_FAILMALLOC_TRUE@am__append_1 = failmalloc +TESTS = main$(EXEEXT) $(am__EXEEXT_1) +@ENABLE_FAILMALLOC_TRUE@am__append_2 = failmalloc +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@ENABLE_FAILMALLOC_TRUE@am__EXEEXT_1 = failmalloc$(EXEEXT) +am__failmalloc_SOURCES_DIST = failmalloc.c failmalloc_test.c \ + failmalloc_test.h malloc_wrapper.c malloc_wrapper.h \ + nghttp2_test_helper.c nghttp2_test_helper.h munit/munit.c \ + munit/munit.h +am__dirstamp = $(am__leading_dot)dirstamp +@ENABLE_FAILMALLOC_TRUE@am_failmalloc_OBJECTS = failmalloc.$(OBJEXT) \ +@ENABLE_FAILMALLOC_TRUE@ failmalloc_test.$(OBJEXT) \ +@ENABLE_FAILMALLOC_TRUE@ malloc_wrapper.$(OBJEXT) \ +@ENABLE_FAILMALLOC_TRUE@ nghttp2_test_helper.$(OBJEXT) \ +@ENABLE_FAILMALLOC_TRUE@ munit/munit.$(OBJEXT) +failmalloc_OBJECTS = $(am_failmalloc_OBJECTS) +@ENABLE_STATIC_FALSE@am__DEPENDENCIES_1 = \ +@ENABLE_STATIC_FALSE@ ${top_builddir}/lib/.libs/*.o +@ENABLE_STATIC_TRUE@am__DEPENDENCIES_1 = \ +@ENABLE_STATIC_TRUE@ ${top_builddir}/lib/libnghttp2.la +@ENABLE_FAILMALLOC_TRUE@failmalloc_DEPENDENCIES = \ +@ENABLE_FAILMALLOC_TRUE@ $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +failmalloc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(failmalloc_LDFLAGS) $(LDFLAGS) -o $@ +am__objects_1 = +am__objects_2 = main.$(OBJEXT) nghttp2_pq_test.$(OBJEXT) \ + nghttp2_map_test.$(OBJEXT) nghttp2_queue_test.$(OBJEXT) \ + nghttp2_test_helper.$(OBJEXT) nghttp2_frame_test.$(OBJEXT) \ + nghttp2_stream_test.$(OBJEXT) nghttp2_session_test.$(OBJEXT) \ + nghttp2_hd_test.$(OBJEXT) nghttp2_alpn_test.$(OBJEXT) \ + nghttp2_helper_test.$(OBJEXT) nghttp2_buf_test.$(OBJEXT) \ + nghttp2_http_test.$(OBJEXT) nghttp2_extpri_test.$(OBJEXT) \ + nghttp2_ratelim_test.$(OBJEXT) munit/munit.$(OBJEXT) +am_main_OBJECTS = $(am__objects_1) $(am__objects_2) +main_OBJECTS = $(am_main_OBJECTS) +@ENABLE_STATIC_FALSE@main_DEPENDENCIES = \ +@ENABLE_STATIC_FALSE@ ${top_builddir}/lib/.libs/*.o +@ENABLE_STATIC_TRUE@main_DEPENDENCIES = \ +@ENABLE_STATIC_TRUE@ ${top_builddir}/lib/libnghttp2.la +main_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(main_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/failmalloc.Po \ + ./$(DEPDIR)/failmalloc_test.Po ./$(DEPDIR)/main.Po \ + ./$(DEPDIR)/malloc_wrapper.Po ./$(DEPDIR)/nghttp2_alpn_test.Po \ + ./$(DEPDIR)/nghttp2_buf_test.Po \ + ./$(DEPDIR)/nghttp2_extpri_test.Po \ + ./$(DEPDIR)/nghttp2_frame_test.Po \ + ./$(DEPDIR)/nghttp2_hd_test.Po \ + ./$(DEPDIR)/nghttp2_helper_test.Po \ + ./$(DEPDIR)/nghttp2_http_test.Po \ + ./$(DEPDIR)/nghttp2_map_test.Po ./$(DEPDIR)/nghttp2_pq_test.Po \ + ./$(DEPDIR)/nghttp2_queue_test.Po \ + ./$(DEPDIR)/nghttp2_ratelim_test.Po \ + ./$(DEPDIR)/nghttp2_session_test.Po \ + ./$(DEPDIR)/nghttp2_stream_test.Po \ + ./$(DEPDIR)/nghttp2_test_helper.Po munit/$(DEPDIR)/munit.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(failmalloc_SOURCES) $(main_SOURCES) +DIST_SOURCES = $(am__failmalloc_SOURCES_DIST) $(main_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + check recheck distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' +RECHECK_LOGS = $(TEST_LOGS) +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +SUBDIRS = testdata +EXTRA_DIST = CMakeLists.txt munit/COPYING +OBJECTS = main.c nghttp2_pq_test.c nghttp2_map_test.c nghttp2_queue_test.c \ + nghttp2_test_helper.c \ + nghttp2_frame_test.c \ + nghttp2_stream_test.c \ + nghttp2_session_test.c \ + nghttp2_hd_test.c \ + nghttp2_alpn_test.c \ + nghttp2_helper_test.c \ + nghttp2_buf_test.c \ + nghttp2_http_test.c \ + nghttp2_extpri_test.c \ + nghttp2_ratelim_test.c \ + munit/munit.c + +HFILES = nghttp2_pq_test.h nghttp2_map_test.h nghttp2_queue_test.h \ + nghttp2_session_test.h \ + nghttp2_frame_test.h nghttp2_stream_test.h nghttp2_hd_test.h \ + nghttp2_alpn_test.h nghttp2_helper_test.h \ + nghttp2_assertion.h \ + nghttp2_test_helper.h \ + nghttp2_buf_test.h \ + nghttp2_http_test.h \ + nghttp2_extpri_test.h \ + nghttp2_ratelim_test.h \ + munit/munit.h + +main_SOURCES = $(HFILES) $(OBJECTS) +# With static lib disabled and symbol hiding enabled, we have to link object +# files directly because the tests use symbols not included in public API. +@ENABLE_STATIC_FALSE@main_LDADD = ${top_builddir}/lib/.libs/*.o \ +@ENABLE_STATIC_FALSE@ @TESTLDADD@ $(am__empty) +@ENABLE_STATIC_TRUE@main_LDADD = ${top_builddir}/lib/libnghttp2.la \ +@ENABLE_STATIC_TRUE@ @TESTLDADD@ $(am__empty) +main_LDFLAGS = -static +@ENABLE_FAILMALLOC_TRUE@failmalloc_SOURCES = failmalloc.c failmalloc_test.c failmalloc_test.h \ +@ENABLE_FAILMALLOC_TRUE@ malloc_wrapper.c malloc_wrapper.h \ +@ENABLE_FAILMALLOC_TRUE@ nghttp2_test_helper.c nghttp2_test_helper.h \ +@ENABLE_FAILMALLOC_TRUE@ munit/munit.c munit/munit.h + +@ENABLE_FAILMALLOC_TRUE@failmalloc_LDADD = $(main_LDADD) +@ENABLE_FAILMALLOC_TRUE@failmalloc_LDFLAGS = $(main_LDFLAGS) +AM_CFLAGS = $(WARNCFLAGS) \ + -I${top_srcdir}/lib \ + -I${top_srcdir}/lib/includes \ + -I${top_srcdir}/tests/munit \ + -I${top_builddir}/lib/includes \ + -DBUILDING_NGHTTP2 \ + -DNGHTTP2_STATICLIB \ + @DEFS@ + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +munit/$(am__dirstamp): + @$(MKDIR_P) munit + @: > munit/$(am__dirstamp) +munit/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) munit/$(DEPDIR) + @: > munit/$(DEPDIR)/$(am__dirstamp) +munit/munit.$(OBJEXT): munit/$(am__dirstamp) \ + munit/$(DEPDIR)/$(am__dirstamp) + +failmalloc$(EXEEXT): $(failmalloc_OBJECTS) $(failmalloc_DEPENDENCIES) $(EXTRA_failmalloc_DEPENDENCIES) + @rm -f failmalloc$(EXEEXT) + $(AM_V_CCLD)$(failmalloc_LINK) $(failmalloc_OBJECTS) $(failmalloc_LDADD) $(LIBS) + +main$(EXEEXT): $(main_OBJECTS) $(main_DEPENDENCIES) $(EXTRA_main_DEPENDENCIES) + @rm -f main$(EXEEXT) + $(AM_V_CCLD)$(main_LINK) $(main_OBJECTS) $(main_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f munit/*.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failmalloc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failmalloc_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc_wrapper.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_alpn_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_buf_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_extpri_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_frame_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_hd_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_helper_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_http_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_map_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_pq_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_queue_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_ratelim_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_session_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_stream_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nghttp2_test_helper.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@munit/$(DEPDIR)/munit.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: $(check_PROGRAMS) + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +main.log: main$(EXEEXT) + @p='main$(EXEEXT)'; \ + b='main'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +failmalloc.log: failmalloc$(EXEEXT) + @p='failmalloc$(EXEEXT)'; \ + b='failmalloc'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f munit/$(DEPDIR)/$(am__dirstamp) + -rm -f munit/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/failmalloc.Po + -rm -f ./$(DEPDIR)/failmalloc_test.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/malloc_wrapper.Po + -rm -f ./$(DEPDIR)/nghttp2_alpn_test.Po + -rm -f ./$(DEPDIR)/nghttp2_buf_test.Po + -rm -f ./$(DEPDIR)/nghttp2_extpri_test.Po + -rm -f ./$(DEPDIR)/nghttp2_frame_test.Po + -rm -f ./$(DEPDIR)/nghttp2_hd_test.Po + -rm -f ./$(DEPDIR)/nghttp2_helper_test.Po + -rm -f ./$(DEPDIR)/nghttp2_http_test.Po + -rm -f ./$(DEPDIR)/nghttp2_map_test.Po + -rm -f ./$(DEPDIR)/nghttp2_pq_test.Po + -rm -f ./$(DEPDIR)/nghttp2_queue_test.Po + -rm -f ./$(DEPDIR)/nghttp2_ratelim_test.Po + -rm -f ./$(DEPDIR)/nghttp2_session_test.Po + -rm -f ./$(DEPDIR)/nghttp2_stream_test.Po + -rm -f ./$(DEPDIR)/nghttp2_test_helper.Po + -rm -f munit/$(DEPDIR)/munit.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/failmalloc.Po + -rm -f ./$(DEPDIR)/failmalloc_test.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/malloc_wrapper.Po + -rm -f ./$(DEPDIR)/nghttp2_alpn_test.Po + -rm -f ./$(DEPDIR)/nghttp2_buf_test.Po + -rm -f ./$(DEPDIR)/nghttp2_extpri_test.Po + -rm -f ./$(DEPDIR)/nghttp2_frame_test.Po + -rm -f ./$(DEPDIR)/nghttp2_hd_test.Po + -rm -f ./$(DEPDIR)/nghttp2_helper_test.Po + -rm -f ./$(DEPDIR)/nghttp2_http_test.Po + -rm -f ./$(DEPDIR)/nghttp2_map_test.Po + -rm -f ./$(DEPDIR)/nghttp2_pq_test.Po + -rm -f ./$(DEPDIR)/nghttp2_queue_test.Po + -rm -f ./$(DEPDIR)/nghttp2_ratelim_test.Po + -rm -f ./$(DEPDIR)/nghttp2_session_test.Po + -rm -f ./$(DEPDIR)/nghttp2_stream_test.Po + -rm -f ./$(DEPDIR)/nghttp2_test_helper.Po + -rm -f munit/$(DEPDIR)/munit.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + recheck tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/tests/nghttp2_buf_test.h b/lib/nghttp2-1.65.0/tests/failmalloc.c similarity index 71% rename from lib/nghttp2/tests/nghttp2_buf_test.h rename to lib/nghttp2-1.65.0/tests/failmalloc.c index 714b89fde6f..ccdeb2e463d 100644 --- a/lib/nghttp2/tests/nghttp2_buf_test.h +++ b/lib/nghttp2-1.65.0/tests/failmalloc.c @@ -1,7 +1,7 @@ /* * nghttp2 - HTTP/2 C Library * - * Copyright (c) 2014 Tatsuhiro Tsujikawa + * Copyright (c) 2012 Tatsuhiro Tsujikawa * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -22,21 +22,24 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef NGHTTP2_BUF_TEST_H -#define NGHTTP2_BUF_TEST_H - #ifdef HAVE_CONFIG_H # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_bufs_add(void); -void test_nghttp2_bufs_add_stack_buffer_overflow_bug(void); -void test_nghttp2_bufs_addb(void); -void test_nghttp2_bufs_orb(void); -void test_nghttp2_bufs_remove(void); -void test_nghttp2_bufs_reset(void); -void test_nghttp2_bufs_advance(void); -void test_nghttp2_bufs_next_present(void); -void test_nghttp2_bufs_realloc(void); +#include "munit.h" + +/* include test cases' include files here */ + +#include "failmalloc_test.h" + +int main(int argc, char *argv[]) { + const MunitSuite suites[] = { + failmalloc_suite, + {NULL, NULL, NULL, 0, MUNIT_SUITE_OPTION_NONE}, + }; + const MunitSuite suite = { + "", NULL, suites, 1, MUNIT_SUITE_OPTION_NONE, + }; -#endif /* NGHTTP2_BUF_TEST_H */ + return munit_suite_main(&suite, NULL, argc, argv); +} diff --git a/lib/nghttp2/tests/failmalloc_test.c b/lib/nghttp2-1.65.0/tests/failmalloc_test.c similarity index 86% rename from lib/nghttp2/tests/failmalloc_test.c rename to lib/nghttp2-1.65.0/tests/failmalloc_test.c index 594bc727e3f..7013ab74c69 100644 --- a/lib/nghttp2/tests/failmalloc_test.c +++ b/lib/nghttp2-1.65.0/tests/failmalloc_test.c @@ -27,7 +27,7 @@ #include #include -#include +#include "munit.h" #include "nghttp2_session.h" #include "nghttp2_stream.h" @@ -36,6 +36,19 @@ #include "malloc_wrapper.h" #include "nghttp2_test_helper.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_session_send), + munit_void_test(test_nghttp2_session_send_server), + munit_void_test(test_nghttp2_session_recv), + munit_void_test(test_nghttp2_frame), + munit_void_test(test_nghttp2_hd), + munit_test_end(), +}; + +const MunitSuite failmalloc_suite = { + "/failmalloc", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + typedef struct { uint8_t data[8192]; uint8_t *datamark, *datalimit; @@ -59,32 +72,34 @@ static void data_feed_init(data_feed *df, nghttp2_bufs *bufs) { df->datalimit = df->data + data_length; } -static ssize_t null_send_callback(nghttp2_session *session, const uint8_t *data, - size_t len, int flags, void *user_data) { +static nghttp2_ssize null_send_callback(nghttp2_session *session, + const uint8_t *data, size_t len, + int flags, void *user_data) { (void)session; (void)data; (void)flags; (void)user_data; - return (ssize_t)len; + return (nghttp2_ssize)len; } -static ssize_t data_feed_recv_callback(nghttp2_session *session, uint8_t *data, - size_t len, int flags, void *user_data) { +static nghttp2_ssize data_feed_recv_callback(nghttp2_session *session, + uint8_t *data, size_t len, + int flags, void *user_data) { data_feed *df = ((my_user_data *)user_data)->df; size_t avail = (size_t)(df->datalimit - df->datamark); - size_t wlen = nghttp2_min(avail, len); + size_t wlen = nghttp2_min_size(avail, len); (void)session; (void)flags; memcpy(data, df->datamark, wlen); df->datamark += wlen; - return (ssize_t)wlen; + return (nghttp2_ssize)wlen; } -static ssize_t fixed_length_data_source_read_callback( - nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, - uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { +static nghttp2_ssize fixed_length_data_source_read_callback( + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { my_user_data *ud = (my_user_data *)user_data; size_t wlen; (void)session; @@ -101,7 +116,7 @@ static ssize_t fixed_length_data_source_read_callback( if (ud->data_source_length == 0) { *data_flags = NGHTTP2_DATA_FLAG_EOF; } - return (ssize_t)wlen; + return (nghttp2_ssize)wlen; } #define TEST_FAILMALLOC_RUN(FUN) \ @@ -129,12 +144,12 @@ static void run_nghttp2_session_send(void) { nghttp2_session_callbacks callbacks; nghttp2_nv nv[] = {MAKE_NV(":host", "example.org"), MAKE_NV(":scheme", "https")}; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; nghttp2_settings_entry iv[2]; my_user_data ud; int rv; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = 64 * 1024; @@ -149,7 +164,7 @@ static void run_nghttp2_session_send(void) { if (rv != 0) { goto client_new_fail; } - rv = nghttp2_submit_request(session, NULL, nv, ARRLEN(nv), &data_prd, NULL); + rv = nghttp2_submit_request2(session, NULL, nv, ARRLEN(nv), &data_prd, NULL); if (rv < 0) { goto fail; } @@ -169,7 +184,7 @@ static void run_nghttp2_session_send(void) { if (rv != 0) { goto fail; } - rv = nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, 3, &data_prd); + rv = nghttp2_submit_data2(session, NGHTTP2_FLAG_END_STREAM, 3, &data_prd); if (rv != 0) { goto fail; } @@ -221,13 +236,13 @@ static void run_nghttp2_session_send_server(void) { nghttp2_session_callbacks *callbacks; int rv; const uint8_t *txdata; - ssize_t txdatalen; + nghttp2_ssize txdatalen; const uint8_t origin[] = "nghttp2.org"; const uint8_t altsvc_field_value[] = "h2=\":443\""; static const uint8_t nghttp2[] = "https://nghttp2.org"; static const nghttp2_origin_entry ov = { - (uint8_t *)nghttp2, - sizeof(nghttp2) - 1, + (uint8_t *)nghttp2, + sizeof(nghttp2) - 1, }; rv = nghttp2_session_callbacks_new(&callbacks); @@ -256,7 +271,7 @@ static void run_nghttp2_session_send_server(void) { goto fail; } - txdatalen = nghttp2_session_mem_send(session, &txdata); + txdatalen = nghttp2_session_mem_send2(session, &txdata); if (txdatalen < 0) { goto fail; @@ -277,10 +292,10 @@ static void run_nghttp2_session_recv(void) { nghttp2_frame frame; nghttp2_bufs bufs; nghttp2_nv nv[] = { - MAKE_NV(":method", "GET"), - MAKE_NV(":scheme", "https"), - MAKE_NV(":authority", "example.org"), - MAKE_NV(":path", "/"), + MAKE_NV(":method", "GET"), + MAKE_NV(":scheme", "https"), + MAKE_NV(":authority", "example.org"), + MAKE_NV(":path", "/"), }; nghttp2_settings_entry iv[2]; my_user_data ud; @@ -296,7 +311,7 @@ static void run_nghttp2_session_recv(void) { } memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.recv_callback = data_feed_recv_callback; + callbacks.recv_callback2 = data_feed_recv_callback; ud.df = &df; nghttp2_failmalloc_pause(); @@ -478,8 +493,8 @@ static void run_nghttp2_frame_pack_settings(void) { buf = &bufs.head->buf; rv = nghttp2_frame_unpack_settings_payload2( - &oframe.settings.iv, &oframe.settings.niv, buf->pos + NGHTTP2_FRAME_HDLEN, - nghttp2_buf_len(buf) - NGHTTP2_FRAME_HDLEN, nghttp2_mem_fm()); + &oframe.settings.iv, &oframe.settings.niv, buf->pos + NGHTTP2_FRAME_HDLEN, + nghttp2_buf_len(buf) - NGHTTP2_FRAME_HDLEN, nghttp2_mem_fm()); if (rv != 0) { goto fail; @@ -525,13 +540,13 @@ static void run_nghttp2_hd(void) { nghttp2_bufs bufs; int rv; nghttp2_nv nva1[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"), - MAKE_NV(":path", "/slashdot"), - MAKE_NV("accept-encoding", "gzip, deflate"), MAKE_NV("foo", "bar")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"), + MAKE_NV(":path", "/slashdot"), MAKE_NV("accept-encoding", "gzip, deflate"), + MAKE_NV("foo", "bar")}; nghttp2_nv nva2[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"), - MAKE_NV(":path", "/style.css"), MAKE_NV("cookie", "nghttp2=FTW"), - MAKE_NV("foo", "bar2")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"), + MAKE_NV(":path", "/style.css"), MAKE_NV("cookie", "nghttp2=FTW"), + MAKE_NV("foo", "bar2")}; rv = frame_pack_bufs_init(&bufs); diff --git a/lib/nghttp2/tests/failmalloc_test.h b/lib/nghttp2-1.65.0/tests/failmalloc_test.h similarity index 79% rename from lib/nghttp2/tests/failmalloc_test.h rename to lib/nghttp2-1.65.0/tests/failmalloc_test.h index 576932a7a93..6d1394b606d 100644 --- a/lib/nghttp2/tests/failmalloc_test.h +++ b/lib/nghttp2-1.65.0/tests/failmalloc_test.h @@ -29,10 +29,16 @@ # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_session_send(void); -void test_nghttp2_session_send_server(void); -void test_nghttp2_session_recv(void); -void test_nghttp2_frame(void); -void test_nghttp2_hd(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite failmalloc_suite; + +munit_void_test_decl(test_nghttp2_session_send) +munit_void_test_decl(test_nghttp2_session_send_server) +munit_void_test_decl(test_nghttp2_session_recv) +munit_void_test_decl(test_nghttp2_frame) +munit_void_test_decl(test_nghttp2_hd) #endif /* FAILMALLOC_TEST_H */ diff --git a/lib/nghttp2-1.65.0/tests/main.c b/lib/nghttp2-1.65.0/tests/main.c new file mode 100644 index 00000000000..d9509b4ad60 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/main.c @@ -0,0 +1,71 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifdef HAVE_CONFIG_H +# include +#endif /* HAVE_CONFIG_H */ + +#include "munit.h" + +/* include test cases' include files here */ +#include "nghttp2_pq_test.h" +#include "nghttp2_map_test.h" +#include "nghttp2_queue_test.h" +#include "nghttp2_session_test.h" +#include "nghttp2_frame_test.h" +#include "nghttp2_stream_test.h" +#include "nghttp2_hd_test.h" +#include "nghttp2_alpn_test.h" +#include "nghttp2_helper_test.h" +#include "nghttp2_buf_test.h" +#include "nghttp2_http_test.h" +#include "nghttp2_extpri_test.h" +#include "nghttp2_ratelim_test.h" + +extern int nghttp2_enable_strict_preface; + +int main(int argc, char *argv[]) { + const MunitSuite suites[] = { + pq_suite, + map_suite, + queue_suite, + frame_suite, + session_suite, + hd_suite, + alpn_suite, + helper_suite, + buf_suite, + http_suite, + extpri_suite, + ratelim_suite, + {NULL, NULL, NULL, 0, MUNIT_SUITE_OPTION_NONE}, + }; + const MunitSuite suite = { + "", NULL, suites, 1, MUNIT_SUITE_OPTION_NONE, + }; + + nghttp2_enable_strict_preface = 0; + + return munit_suite_main(&suite, NULL, argc, argv); +} diff --git a/lib/nghttp2/tests/malloc_wrapper.c b/lib/nghttp2-1.65.0/tests/malloc_wrapper.c similarity index 100% rename from lib/nghttp2/tests/malloc_wrapper.c rename to lib/nghttp2-1.65.0/tests/malloc_wrapper.c diff --git a/lib/nghttp2/tests/malloc_wrapper.h b/lib/nghttp2-1.65.0/tests/malloc_wrapper.h similarity index 100% rename from lib/nghttp2/tests/malloc_wrapper.h rename to lib/nghttp2-1.65.0/tests/malloc_wrapper.h diff --git a/lib/nghttp2-1.65.0/tests/munit/COPYING b/lib/nghttp2-1.65.0/tests/munit/COPYING new file mode 100644 index 00000000000..2991ac706dd --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/munit/COPYING @@ -0,0 +1,21 @@ +µnit Testing Framework +Copyright (c) 2013-2016 Evan Nemerson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lib/nghttp2-1.65.0/tests/munit/munit.c b/lib/nghttp2-1.65.0/tests/munit/munit.c new file mode 100644 index 00000000000..c5faec09b11 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/munit/munit.c @@ -0,0 +1,2447 @@ +/* Copyright (c) 2013-2018 Evan Nemerson + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/*** Configuration ***/ + +/* This is just where the output from the test goes. It's really just + * meant to let you choose stdout or stderr, but if anyone really want + * to direct it to a file let me know, it would be fairly easy to + * support. */ +#if !defined(MUNIT_OUTPUT_FILE) +# define MUNIT_OUTPUT_FILE stdout +#endif + +/* This is a bit more useful; it tells µnit how to format the seconds in + * timed tests. If your tests run for longer you might want to reduce + * it, and if your computer is really fast and your tests are tiny you + * can increase it. */ +#if !defined(MUNIT_TEST_TIME_FORMAT) +# define MUNIT_TEST_TIME_FORMAT "0.8f" +#endif + +/* If you have long test names you might want to consider bumping + * this. The result information takes 43 characters. */ +#if !defined(MUNIT_TEST_NAME_LEN) +# define MUNIT_TEST_NAME_LEN 37 +#endif + +/* If you don't like the timing information, you can disable it by + * defining MUNIT_DISABLE_TIMING. */ +#if !defined(MUNIT_DISABLE_TIMING) +# define MUNIT_ENABLE_TIMING +#endif + +/*** End configuration ***/ + +#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE < 200809L) +# undef _POSIX_C_SOURCE +#endif +#if !defined(_POSIX_C_SOURCE) +# define _POSIX_C_SOURCE 200809L +#endif + +/* Solaris freaks out if you try to use a POSIX or SUS standard without + * the "right" C standard. */ +#if defined(_XOPEN_SOURCE) +# undef _XOPEN_SOURCE +#endif + +#if defined(__STDC_VERSION__) +# if __STDC_VERSION__ >= 201112L +# define _XOPEN_SOURCE 700 +# elif __STDC_VERSION__ >= 199901L +# define _XOPEN_SOURCE 600 +# endif +#endif + +/* Because, according to Microsoft, POSIX is deprecated. You've got + * to appreciate the chutzpah. */ +#if defined(_MSC_VER) && !defined(_CRT_NONSTDC_NO_DEPRECATE) +# define _CRT_NONSTDC_NO_DEPRECATE +#endif + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +# include +#elif defined(_WIN32) +/* https://msdn.microsoft.com/en-us/library/tf4dy80a.aspx */ +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(MUNIT_NO_NL_LANGINFO) && !defined(_WIN32) +# define MUNIT_NL_LANGINFO +# include +# include +# include +#endif + +#if !defined(_WIN32) +# include +# include +# include +#else +# include +# include +# include +# if !defined(STDERR_FILENO) +# define STDERR_FILENO _fileno(stderr) +# endif +#endif + +#include "munit.h" + +#define MUNIT_STRINGIFY(x) #x +#define MUNIT_XSTRINGIFY(x) MUNIT_STRINGIFY(x) + +#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__SUNPRO_CC) || \ + defined(__IBMCPP__) +# define MUNIT_THREAD_LOCAL __thread +#elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201102L)) || \ + defined(_Thread_local) +# define MUNIT_THREAD_LOCAL _Thread_local +#elif defined(_WIN32) +# define MUNIT_THREAD_LOCAL __declspec(thread) +#endif + +/* MSVC 12.0 will emit a warning at /W4 for code like 'do { ... } + * while (0)', or 'do { ... } while (1)'. I'm pretty sure nobody + * at Microsoft compiles with /W4. */ +#if defined(_MSC_VER) && (_MSC_VER <= 1800) +# pragma warning(disable : 4127) +#endif + +#if defined(_WIN32) || defined(__EMSCRIPTEN__) +# define MUNIT_NO_FORK +#endif + +#if defined(__EMSCRIPTEN__) +# define MUNIT_NO_BUFFER +#endif + +/*** Logging ***/ + +static MunitLogLevel munit_log_level_visible = MUNIT_LOG_INFO; +static MunitLogLevel munit_log_level_fatal = MUNIT_LOG_ERROR; + +#if defined(MUNIT_THREAD_LOCAL) +static MUNIT_THREAD_LOCAL munit_bool munit_error_jmp_buf_valid = 0; +static MUNIT_THREAD_LOCAL jmp_buf munit_error_jmp_buf; +#endif + +/* At certain warning levels, mingw will trigger warnings about + * suggesting the format attribute, which we've explicity *not* set + * because it will then choke on our attempts to use the MS-specific + * I64 modifier for size_t (which we have to use since MSVC doesn't + * support the C99 z modifier). */ + +#if defined(__MINGW32__) || defined(__MINGW64__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wsuggest-attribute=format" +#endif + +MUNIT_PRINTF(5, 0) +static void munit_logf_exv(MunitLogLevel level, FILE *fp, const char *filename, + int line, const char *format, va_list ap) { + if (level < munit_log_level_visible) + return; + + switch (level) { + case MUNIT_LOG_DEBUG: + fputs("Debug", fp); + break; + case MUNIT_LOG_INFO: + fputs("Info", fp); + break; + case MUNIT_LOG_WARNING: + fputs("Warning", fp); + break; + case MUNIT_LOG_ERROR: + fputs("Error", fp); + break; + default: + munit_logf_ex(MUNIT_LOG_ERROR, filename, line, "Invalid log level (%d)", + level); + return; + } + + fputs(": ", fp); + if (filename != NULL) + fprintf(fp, "%s:%d: ", filename, line); + vfprintf(fp, format, ap); + fputc('\n', fp); +} + +MUNIT_PRINTF(3, 4) +static void munit_logf_internal(MunitLogLevel level, FILE *fp, + const char *format, ...) { + va_list ap; + + va_start(ap, format); + munit_logf_exv(level, fp, NULL, 0, format, ap); + va_end(ap); +} + +static void munit_log_internal(MunitLogLevel level, FILE *fp, + const char *message) { + munit_logf_internal(level, fp, "%s", message); +} + +void munit_logf_ex(MunitLogLevel level, const char *filename, int line, + const char *format, ...) { + va_list ap; + + va_start(ap, format); + munit_logf_exv(level, stderr, filename, line, format, ap); + va_end(ap); + + if (level >= munit_log_level_fatal) { +#if defined(MUNIT_THREAD_LOCAL) + if (munit_error_jmp_buf_valid) + longjmp(munit_error_jmp_buf, 1); +#endif + abort(); + } +} + +void munit_errorf_ex(const char *filename, int line, const char *format, ...) { + va_list ap; + + va_start(ap, format); + munit_logf_exv(MUNIT_LOG_ERROR, stderr, filename, line, format, ap); + va_end(ap); + +#if defined(MUNIT_THREAD_LOCAL) + if (munit_error_jmp_buf_valid) + longjmp(munit_error_jmp_buf, 1); +#endif + abort(); +} + +#if defined(__MINGW32__) || defined(__MINGW64__) +# pragma GCC diagnostic pop +#endif + +#if !defined(MUNIT_STRERROR_LEN) +# define MUNIT_STRERROR_LEN 80 +#endif + +static void munit_log_errno(MunitLogLevel level, FILE *fp, const char *msg) { +#if defined(MUNIT_NO_STRERROR_R) || \ + (defined(__MINGW32__) && !defined(MINGW_HAS_SECURE_API)) + munit_logf_internal(level, fp, "%s: %s (%d)", msg, strerror(errno), errno); +#else + char munit_error_str[MUNIT_STRERROR_LEN]; + munit_error_str[0] = '\0'; + +# if !defined(_WIN32) + strerror_r(errno, munit_error_str, MUNIT_STRERROR_LEN); +# else + strerror_s(munit_error_str, MUNIT_STRERROR_LEN, errno); +# endif + + munit_logf_internal(level, fp, "%s: %s (%d)", msg, munit_error_str, errno); +#endif +} + +/*** Memory allocation ***/ + +void *munit_malloc_ex(const char *filename, int line, size_t size) { + void *ptr; + + if (size == 0) + return NULL; + + ptr = calloc(1, size); + if (MUNIT_UNLIKELY(ptr == NULL)) { + munit_logf_ex(MUNIT_LOG_ERROR, filename, line, + "Failed to allocate %" MUNIT_SIZE_MODIFIER "u bytes.", size); + } + + return ptr; +} + +/*** Timer code ***/ + +#if defined(MUNIT_ENABLE_TIMING) + +# define psnip_uint64_t munit_uint64_t +# define psnip_uint32_t munit_uint32_t + +/* Code copied from portable-snippets + * . If you need to + * change something, please do it there so we can keep the code in + * sync. */ + +/* Clocks (v1) + * Portable Snippets - https://gitub.com/nemequ/portable-snippets + * Created by Evan Nemerson + * + * To the extent possible under law, the authors have waived all + * copyright and related or neighboring rights to this code. For + * details, see the Creative Commons Zero 1.0 Universal license at + * https://creativecommons.org/publicdomain/zero/1.0/ + */ + +# if !defined(PSNIP_CLOCK_H) +# define PSNIP_CLOCK_H + +# if !defined(psnip_uint64_t) +# include "../exact-int/exact-int.h" +# endif + +# if !defined(PSNIP_CLOCK_STATIC_INLINE) +# if defined(__GNUC__) +# define PSNIP_CLOCK__COMPILER_ATTRIBUTES __attribute__((__unused__)) +# else +# define PSNIP_CLOCK__COMPILER_ATTRIBUTES +# endif + +# define PSNIP_CLOCK__FUNCTION PSNIP_CLOCK__COMPILER_ATTRIBUTES static +# endif + +enum PsnipClockType { + /* This clock provides the current time, in units since 1970-01-01 + * 00:00:00 UTC not including leap seconds. In other words, UNIX + * time. Keep in mind that this clock doesn't account for leap + * seconds, and can go backwards (think NTP adjustments). */ + PSNIP_CLOCK_TYPE_WALL = 1, + /* The CPU time is a clock which increases only when the current + * process is active (i.e., it doesn't increment while blocking on + * I/O). */ + PSNIP_CLOCK_TYPE_CPU = 2, + /* Monotonic time is always running (unlike CPU time), but it only + ever moves forward unless you reboot the system. Things like NTP + adjustments have no effect on this clock. */ + PSNIP_CLOCK_TYPE_MONOTONIC = 3 +}; + +struct PsnipClockTimespec { + psnip_uint64_t seconds; + psnip_uint64_t nanoseconds; +}; + +/* Methods we support: */ + +# define PSNIP_CLOCK_METHOD_CLOCK_GETTIME 1 +# define PSNIP_CLOCK_METHOD_TIME 2 +# define PSNIP_CLOCK_METHOD_GETTIMEOFDAY 3 +# define PSNIP_CLOCK_METHOD_QUERYPERFORMANCECOUNTER 4 +# define PSNIP_CLOCK_METHOD_MACH_ABSOLUTE_TIME 5 +# define PSNIP_CLOCK_METHOD_CLOCK 6 +# define PSNIP_CLOCK_METHOD_GETPROCESSTIMES 7 +# define PSNIP_CLOCK_METHOD_GETRUSAGE 8 +# define PSNIP_CLOCK_METHOD_GETSYSTEMTIMEPRECISEASFILETIME 9 +# define PSNIP_CLOCK_METHOD_GETTICKCOUNT64 10 + +# include + +# if defined(HEDLEY_UNREACHABLE) +# define PSNIP_CLOCK_UNREACHABLE() HEDLEY_UNREACHABLE() +# else +# define PSNIP_CLOCK_UNREACHABLE() assert(0) +# endif + +/* Choose an implementation */ + +/* #undef PSNIP_CLOCK_WALL_METHOD */ +/* #undef PSNIP_CLOCK_CPU_METHOD */ +/* #undef PSNIP_CLOCK_MONOTONIC_METHOD */ + +/* We want to be able to detect the libc implementation, so we include + ( isn't available everywhere). */ + +# if defined(__unix__) || defined(__unix) || defined(__linux__) +# include +# include +# endif + +# if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) +/* These are known to work without librt. If you know of others + * please let us know so we can add them. */ +# if (defined(__GLIBC__) && \ + (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17))) || \ + (defined(__FreeBSD__)) +# define PSNIP_CLOCK_HAVE_CLOCK_GETTIME +# elif !defined(PSNIP_CLOCK_NO_LIBRT) +# define PSNIP_CLOCK_HAVE_CLOCK_GETTIME +# endif +# endif + +# if defined(_WIN32) +# if !defined(PSNIP_CLOCK_CPU_METHOD) +# define PSNIP_CLOCK_CPU_METHOD PSNIP_CLOCK_METHOD_GETPROCESSTIMES +# endif +# if !defined(PSNIP_CLOCK_MONOTONIC_METHOD) +# define PSNIP_CLOCK_MONOTONIC_METHOD \ + PSNIP_CLOCK_METHOD_QUERYPERFORMANCECOUNTER +# endif +# endif + +# if defined(__MACH__) && !defined(__gnu_hurd__) +# if !defined(PSNIP_CLOCK_MONOTONIC_METHOD) +# define PSNIP_CLOCK_MONOTONIC_METHOD \ + PSNIP_CLOCK_METHOD_MACH_ABSOLUTE_TIME +# endif +# endif + +# if defined(PSNIP_CLOCK_HAVE_CLOCK_GETTIME) +# include +# if !defined(PSNIP_CLOCK_WALL_METHOD) +# if defined(CLOCK_REALTIME_PRECISE) +# define PSNIP_CLOCK_WALL_METHOD PSNIP_CLOCK_METHOD_CLOCK_GETTIME +# define PSNIP_CLOCK_CLOCK_GETTIME_WALL CLOCK_REALTIME_PRECISE +# elif !defined(__sun) +# define PSNIP_CLOCK_WALL_METHOD PSNIP_CLOCK_METHOD_CLOCK_GETTIME +# define PSNIP_CLOCK_CLOCK_GETTIME_WALL CLOCK_REALTIME +# endif +# endif +# if !defined(PSNIP_CLOCK_CPU_METHOD) +# if defined(_POSIX_CPUTIME) || defined(CLOCK_PROCESS_CPUTIME_ID) +# define PSNIP_CLOCK_CPU_METHOD PSNIP_CLOCK_METHOD_CLOCK_GETTIME +# define PSNIP_CLOCK_CLOCK_GETTIME_CPU CLOCK_PROCESS_CPUTIME_ID +# elif defined(CLOCK_VIRTUAL) +# define PSNIP_CLOCK_CPU_METHOD PSNIP_CLOCK_METHOD_CLOCK_GETTIME +# define PSNIP_CLOCK_CLOCK_GETTIME_CPU CLOCK_VIRTUAL +# endif +# endif +# if !defined(PSNIP_CLOCK_MONOTONIC_METHOD) +# if defined(CLOCK_MONOTONIC_RAW) +# define PSNIP_CLOCK_MONOTONIC_METHOD PSNIP_CLOCK_METHOD_CLOCK_GETTIME +# define PSNIP_CLOCK_CLOCK_GETTIME_MONOTONIC CLOCK_MONOTONIC +# elif defined(CLOCK_MONOTONIC_PRECISE) +# define PSNIP_CLOCK_MONOTONIC_METHOD PSNIP_CLOCK_METHOD_CLOCK_GETTIME +# define PSNIP_CLOCK_CLOCK_GETTIME_MONOTONIC CLOCK_MONOTONIC_PRECISE +# elif defined(_POSIX_MONOTONIC_CLOCK) || defined(CLOCK_MONOTONIC) +# define PSNIP_CLOCK_MONOTONIC_METHOD PSNIP_CLOCK_METHOD_CLOCK_GETTIME +# define PSNIP_CLOCK_CLOCK_GETTIME_MONOTONIC CLOCK_MONOTONIC +# endif +# endif +# endif + +# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200112L) +# if !defined(PSNIP_CLOCK_WALL_METHOD) +# define PSNIP_CLOCK_WALL_METHOD PSNIP_CLOCK_METHOD_GETTIMEOFDAY +# endif +# endif + +# if !defined(PSNIP_CLOCK_WALL_METHOD) +# define PSNIP_CLOCK_WALL_METHOD PSNIP_CLOCK_METHOD_TIME +# endif + +# if !defined(PSNIP_CLOCK_CPU_METHOD) +# define PSNIP_CLOCK_CPU_METHOD PSNIP_CLOCK_METHOD_CLOCK +# endif + +/* Primarily here for testing. */ +# if !defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + defined(PSNIP_CLOCK_REQUIRE_MONOTONIC) +# error No monotonic clock found. +# endif + +/* Implementations */ + +# if (defined(PSNIP_CLOCK_CPU_METHOD) && \ + (PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME)) || \ + (defined(PSNIP_CLOCK_WALL_METHOD) && \ + (PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME)) || \ + (defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + (PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME)) || \ + (defined(PSNIP_CLOCK_CPU_METHOD) && \ + (PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_CLOCK)) || \ + (defined(PSNIP_CLOCK_WALL_METHOD) && \ + (PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_CLOCK)) || \ + (defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + (PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_CLOCK)) || \ + (defined(PSNIP_CLOCK_CPU_METHOD) && \ + (PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_TIME)) || \ + (defined(PSNIP_CLOCK_WALL_METHOD) && \ + (PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_TIME)) || \ + (defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + (PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_TIME)) +# include +# endif + +# if (defined(PSNIP_CLOCK_CPU_METHOD) && \ + (PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_GETTIMEOFDAY)) || \ + (defined(PSNIP_CLOCK_WALL_METHOD) && \ + (PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_GETTIMEOFDAY)) || \ + (defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + (PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_GETTIMEOFDAY)) +# include +# endif + +# if (defined(PSNIP_CLOCK_CPU_METHOD) && \ + (PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_GETPROCESSTIMES)) || \ + (defined(PSNIP_CLOCK_WALL_METHOD) && \ + (PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_GETPROCESSTIMES)) || \ + (defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + (PSNIP_CLOCK_MONOTONIC_METHOD == \ + PSNIP_CLOCK_METHOD_GETPROCESSTIMES)) || \ + (defined(PSNIP_CLOCK_CPU_METHOD) && \ + (PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_GETTICKCOUNT64)) || \ + (defined(PSNIP_CLOCK_WALL_METHOD) && \ + (PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_GETTICKCOUNT64)) || \ + (defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + (PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_GETTICKCOUNT64)) +# include +# endif + +# if (defined(PSNIP_CLOCK_CPU_METHOD) && \ + (PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_GETRUSAGE)) || \ + (defined(PSNIP_CLOCK_WALL_METHOD) && \ + (PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_GETRUSAGE)) || \ + (defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + (PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_GETRUSAGE)) +# include +# include +# endif + +# if (defined(PSNIP_CLOCK_CPU_METHOD) && \ + (PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_MACH_ABSOLUTE_TIME)) || \ + (defined(PSNIP_CLOCK_WALL_METHOD) && \ + (PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_MACH_ABSOLUTE_TIME)) || \ + (defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + (PSNIP_CLOCK_MONOTONIC_METHOD == \ + PSNIP_CLOCK_METHOD_MACH_ABSOLUTE_TIME)) +# include +# include +# include +# endif + +/*** Implementations ***/ + +# define PSNIP_CLOCK_NSEC_PER_SEC ((psnip_uint32_t)(1000000000ULL)) + +# if (defined(PSNIP_CLOCK_CPU_METHOD) && \ + (PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME)) || \ + (defined(PSNIP_CLOCK_WALL_METHOD) && \ + (PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME)) || \ + (defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + (PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME)) +PSNIP_CLOCK__FUNCTION psnip_uint32_t +psnip_clock__clock_getres(clockid_t clk_id) { + struct timespec res; + int r; + + r = clock_getres(clk_id, &res); + if (r != 0) + return 0; + + return (psnip_uint32_t)(PSNIP_CLOCK_NSEC_PER_SEC / + (psnip_uint64_t)res.tv_nsec); +} + +PSNIP_CLOCK__FUNCTION int +psnip_clock__clock_gettime(clockid_t clk_id, struct PsnipClockTimespec *res) { + struct timespec ts; + + if (clock_gettime(clk_id, &ts) != 0) + return -10; + + res->seconds = (psnip_uint64_t)(ts.tv_sec); + res->nanoseconds = (psnip_uint64_t)(ts.tv_nsec); + + return 0; +} +# endif + +PSNIP_CLOCK__FUNCTION psnip_uint32_t psnip_clock_wall_get_precision(void) { +# if !defined(PSNIP_CLOCK_WALL_METHOD) + return 0; +# elif defined(PSNIP_CLOCK_WALL_METHOD) && \ + PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME + return psnip_clock__clock_getres(PSNIP_CLOCK_CLOCK_GETTIME_WALL); +# elif defined(PSNIP_CLOCK_WALL_METHOD) && \ + PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_GETTIMEOFDAY + return 1000000; +# elif defined(PSNIP_CLOCK_WALL_METHOD) && \ + PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_TIME + return 1; +# else + return 0; +# endif +} + +PSNIP_CLOCK__FUNCTION int +psnip_clock_wall_get_time(struct PsnipClockTimespec *res) { +# if !defined(PSNIP_CLOCK_WALL_METHOD) + (void)res; + + return -2; +# elif defined(PSNIP_CLOCK_WALL_METHOD) && \ + PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME + return psnip_clock__clock_gettime(PSNIP_CLOCK_CLOCK_GETTIME_WALL, res); +# elif defined(PSNIP_CLOCK_WALL_METHOD) && \ + PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_TIME + res->seconds = time(NULL); + res->nanoseconds = 0; +# elif defined(PSNIP_CLOCK_WALL_METHOD) && \ + PSNIP_CLOCK_WALL_METHOD == PSNIP_CLOCK_METHOD_GETTIMEOFDAY + struct timeval tv; + + if (gettimeofday(&tv, NULL) != 0) + return -6; + + res->seconds = (psnip_uint64_t)tv.tv_sec; + res->nanoseconds = (psnip_uint64_t)tv.tv_usec * 1000; +# else + (void)res; + + return -2; +# endif + + return 0; +} + +PSNIP_CLOCK__FUNCTION psnip_uint32_t psnip_clock_cpu_get_precision(void) { +# if !defined(PSNIP_CLOCK_CPU_METHOD) + return 0; +# elif defined(PSNIP_CLOCK_CPU_METHOD) && \ + PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME + return psnip_clock__clock_getres(PSNIP_CLOCK_CLOCK_GETTIME_CPU); +# elif defined(PSNIP_CLOCK_CPU_METHOD) && \ + PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_CLOCK + return CLOCKS_PER_SEC; +# elif defined(PSNIP_CLOCK_CPU_METHOD) && \ + PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_GETPROCESSTIMES + return PSNIP_CLOCK_NSEC_PER_SEC / 100; +# else + return 0; +# endif +} + +PSNIP_CLOCK__FUNCTION int +psnip_clock_cpu_get_time(struct PsnipClockTimespec *res) { +# if !defined(PSNIP_CLOCK_CPU_METHOD) + (void)res; + return -2; +# elif defined(PSNIP_CLOCK_CPU_METHOD) && \ + PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME + return psnip_clock__clock_gettime(PSNIP_CLOCK_CLOCK_GETTIME_CPU, res); +# elif defined(PSNIP_CLOCK_CPU_METHOD) && \ + PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_CLOCK + clock_t t = clock(); + if (t == ((clock_t)-1)) + return -5; + res->seconds = t / CLOCKS_PER_SEC; + res->nanoseconds = + (t % CLOCKS_PER_SEC) * (PSNIP_CLOCK_NSEC_PER_SEC / CLOCKS_PER_SEC); +# elif defined(PSNIP_CLOCK_CPU_METHOD) && \ + PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_GETPROCESSTIMES + FILETIME CreationTime, ExitTime, KernelTime, UserTime; + LARGE_INTEGER date, adjust; + + if (!GetProcessTimes(GetCurrentProcess(), &CreationTime, &ExitTime, + &KernelTime, &UserTime)) + return -7; + + /* http://www.frenk.com/2009/12/convert-filetime-to-unix-timestamp/ */ + date.HighPart = (LONG)UserTime.dwHighDateTime; + date.LowPart = UserTime.dwLowDateTime; + adjust.QuadPart = 11644473600000 * 10000; + date.QuadPart -= adjust.QuadPart; + + res->seconds = (psnip_uint64_t)(date.QuadPart / 10000000); + res->nanoseconds = (psnip_uint64_t)(date.QuadPart % 10000000) * + (PSNIP_CLOCK_NSEC_PER_SEC / 100); +# elif PSNIP_CLOCK_CPU_METHOD == PSNIP_CLOCK_METHOD_GETRUSAGE + struct rusage usage; + if (getrusage(RUSAGE_SELF, &usage) != 0) + return -8; + + res->seconds = usage.ru_utime.tv_sec; + res->nanoseconds = tv.tv_usec * 1000; +# else + (void)res; + return -2; +# endif + + return 0; +} + +PSNIP_CLOCK__FUNCTION psnip_uint32_t psnip_clock_monotonic_get_precision(void) { +# if !defined(PSNIP_CLOCK_MONOTONIC_METHOD) + return 0; +# elif defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME + return psnip_clock__clock_getres(PSNIP_CLOCK_CLOCK_GETTIME_MONOTONIC); +# elif defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_MACH_ABSOLUTE_TIME + static mach_timebase_info_data_t tbi = { + 0, + }; + if (tbi.denom == 0) + mach_timebase_info(&tbi); + return (psnip_uint32_t)(tbi.numer / tbi.denom); +# elif defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_GETTICKCOUNT64 + return 1000; +# elif defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + PSNIP_CLOCK_MONOTONIC_METHOD == \ + PSNIP_CLOCK_METHOD_QUERYPERFORMANCECOUNTER + LARGE_INTEGER Frequency; + QueryPerformanceFrequency(&Frequency); + return (psnip_uint32_t)((Frequency.QuadPart > PSNIP_CLOCK_NSEC_PER_SEC) + ? PSNIP_CLOCK_NSEC_PER_SEC + : Frequency.QuadPart); +# else + return 0; +# endif +} + +PSNIP_CLOCK__FUNCTION int +psnip_clock_monotonic_get_time(struct PsnipClockTimespec *res) { +# if !defined(PSNIP_CLOCK_MONOTONIC_METHOD) + (void)res; + return -2; +# elif defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_CLOCK_GETTIME + return psnip_clock__clock_gettime(PSNIP_CLOCK_CLOCK_GETTIME_MONOTONIC, res); +# elif defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_MACH_ABSOLUTE_TIME + psnip_uint64_t nsec = mach_absolute_time(); + static mach_timebase_info_data_t tbi = { + 0, + }; + if (tbi.denom == 0) + mach_timebase_info(&tbi); + nsec *= ((psnip_uint64_t)tbi.numer) / ((psnip_uint64_t)tbi.denom); + res->seconds = nsec / PSNIP_CLOCK_NSEC_PER_SEC; + res->nanoseconds = nsec % PSNIP_CLOCK_NSEC_PER_SEC; +# elif defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + PSNIP_CLOCK_MONOTONIC_METHOD == \ + PSNIP_CLOCK_METHOD_QUERYPERFORMANCECOUNTER + LARGE_INTEGER t, f; + if (QueryPerformanceCounter(&t) == 0) + return -12; + + QueryPerformanceFrequency(&f); + res->seconds = (psnip_uint64_t)(t.QuadPart / f.QuadPart); + res->nanoseconds = (psnip_uint64_t)(t.QuadPart % f.QuadPart); + if (f.QuadPart > PSNIP_CLOCK_NSEC_PER_SEC) + res->nanoseconds /= (psnip_uint64_t)f.QuadPart / PSNIP_CLOCK_NSEC_PER_SEC; + else + res->nanoseconds *= PSNIP_CLOCK_NSEC_PER_SEC / (psnip_uint64_t)f.QuadPart; +# elif defined(PSNIP_CLOCK_MONOTONIC_METHOD) && \ + PSNIP_CLOCK_MONOTONIC_METHOD == PSNIP_CLOCK_METHOD_GETTICKCOUNT64 + const ULONGLONG msec = GetTickCount64(); + res->seconds = msec / 1000; + res->nanoseconds = sec % 1000; +# else + return -2; +# endif + + return 0; +} + +/* Returns the number of ticks per second for the specified clock. + * For example, a clock with millisecond precision would return 1000, + * and a clock with 1 second (such as the time() function) would + * return 1. + * + * If the requested clock isn't available, it will return 0. + * Hopefully this will be rare, but if it happens to you please let us + * know so we can work on finding a way to support your system. + * + * Note that different clocks on the same system often have a + * different precisions. + */ +PSNIP_CLOCK__FUNCTION psnip_uint32_t +psnip_clock_get_precision(enum PsnipClockType clock_type) { + switch (clock_type) { + case PSNIP_CLOCK_TYPE_MONOTONIC: + return psnip_clock_monotonic_get_precision(); + case PSNIP_CLOCK_TYPE_CPU: + return psnip_clock_cpu_get_precision(); + case PSNIP_CLOCK_TYPE_WALL: + return psnip_clock_wall_get_precision(); + } + + PSNIP_CLOCK_UNREACHABLE(); + return 0; +} + +/* Set the provided timespec to the requested time. Returns 0 on + * success, or a negative value on failure. */ +PSNIP_CLOCK__FUNCTION int psnip_clock_get_time(enum PsnipClockType clock_type, + struct PsnipClockTimespec *res) { + assert(res != NULL); + + switch (clock_type) { + case PSNIP_CLOCK_TYPE_MONOTONIC: + return psnip_clock_monotonic_get_time(res); + case PSNIP_CLOCK_TYPE_CPU: + return psnip_clock_cpu_get_time(res); + case PSNIP_CLOCK_TYPE_WALL: + return psnip_clock_wall_get_time(res); + } + + return -1; +} + +# endif /* !defined(PSNIP_CLOCK_H) */ + +static psnip_uint64_t munit_clock_get_elapsed(struct PsnipClockTimespec *start, + struct PsnipClockTimespec *end) { + psnip_uint64_t r = (end->seconds - start->seconds) * PSNIP_CLOCK_NSEC_PER_SEC; + if (end->nanoseconds < start->nanoseconds) { + return r - (start->nanoseconds - end->nanoseconds); + } + + return r + (end->nanoseconds - start->nanoseconds); +} + +#else +# include +#endif /* defined(MUNIT_ENABLE_TIMING) */ + +/*** PRNG stuff ***/ + +/* This is (unless I screwed up, which is entirely possible) the + * version of PCG with 32-bit state. It was chosen because it has a + * small enough state that we should reliably be able to use CAS + * instead of requiring a lock for thread-safety. + * + * If I did screw up, I probably will not bother changing it unless + * there is a significant bias. It's really not important this be + * particularly strong, as long as it is fairly random it's much more + * important that it be reproducible, so bug reports have a better + * chance of being reproducible. */ + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(__STDC_NO_ATOMICS__) && !defined(__EMSCRIPTEN__) && \ + (!defined(__GNUC_MINOR__) || (__GNUC__ > 4) || \ + (__GNUC__ == 4 && __GNUC_MINOR__ > 8)) +# define HAVE_STDATOMIC +#elif defined(__clang__) +# if __has_extension(c_atomic) +# define HAVE_CLANG_ATOMICS +# endif +#endif + +/* Workaround for http://llvm.org/bugs/show_bug.cgi?id=26911 */ +#if defined(__clang__) && defined(_WIN32) +# undef HAVE_STDATOMIC +# if defined(__c2__) +# undef HAVE_CLANG_ATOMICS +# endif +#endif + +#if defined(_OPENMP) +# define ATOMIC_UINT32_T uint32_t +#elif defined(HAVE_STDATOMIC) +# include +# define ATOMIC_UINT32_T _Atomic uint32_t +#elif defined(HAVE_CLANG_ATOMICS) +# define ATOMIC_UINT32_T _Atomic uint32_t +#elif defined(_WIN32) +# define ATOMIC_UINT32_T volatile LONG +#else +# define ATOMIC_UINT32_T volatile uint32_t +#endif + +static ATOMIC_UINT32_T munit_rand_state = 42; + +#if defined(_OPENMP) +static inline void munit_atomic_store(ATOMIC_UINT32_T *dest, + ATOMIC_UINT32_T value) { +# pragma omp critical(munit_atomics) + *dest = value; +} + +static inline uint32_t munit_atomic_load(ATOMIC_UINT32_T *src) { + int ret; +# pragma omp critical(munit_atomics) + ret = *src; + return ret; +} + +static inline uint32_t munit_atomic_cas(ATOMIC_UINT32_T *dest, + ATOMIC_UINT32_T *expected, + ATOMIC_UINT32_T desired) { + munit_bool ret; + +# pragma omp critical(munit_atomics) + { + if (*dest == *expected) { + *dest = desired; + ret = 1; + } else { + ret = 0; + } + } + + return ret; +} +#elif defined(HAVE_STDATOMIC) +# define munit_atomic_store(dest, value) atomic_store(dest, value) +# define munit_atomic_load(src) atomic_load(src) +# define munit_atomic_cas(dest, expected, value) \ + atomic_compare_exchange_weak(dest, expected, value) +#elif defined(HAVE_CLANG_ATOMICS) +# define munit_atomic_store(dest, value) \ + __c11_atomic_store(dest, value, __ATOMIC_SEQ_CST) +# define munit_atomic_load(src) __c11_atomic_load(src, __ATOMIC_SEQ_CST) +# define munit_atomic_cas(dest, expected, value) \ + __c11_atomic_compare_exchange_weak(dest, expected, value, \ + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) +#elif defined(__GNUC__) && (__GNUC__ > 4) || \ + (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) +# define munit_atomic_store(dest, value) \ + __atomic_store_n(dest, value, __ATOMIC_SEQ_CST) +# define munit_atomic_load(src) __atomic_load_n(src, __ATOMIC_SEQ_CST) +# define munit_atomic_cas(dest, expected, value) \ + __atomic_compare_exchange_n(dest, expected, value, 1, __ATOMIC_SEQ_CST, \ + __ATOMIC_SEQ_CST) +#elif defined(__GNUC__) && (__GNUC__ >= 4) +# define munit_atomic_store(dest, value) \ + do { \ + *(dest) = (value); \ + } while (0) +# define munit_atomic_load(src) (*(src)) +# define munit_atomic_cas(dest, expected, value) \ + __sync_bool_compare_and_swap(dest, *expected, value) +#elif defined(_WIN32) /* Untested */ +# define munit_atomic_store(dest, value) \ + do { \ + *(dest) = (value); \ + } while (0) +# define munit_atomic_load(src) (*(src)) +# define munit_atomic_cas(dest, expected, value) \ + InterlockedCompareExchange((dest), (value), *(expected)) +#else +# warning No atomic implementation, PRNG will not be thread-safe +# define munit_atomic_store(dest, value) \ + do { \ + *(dest) = (value); \ + } while (0) +# define munit_atomic_load(src) (*(src)) +static inline munit_bool munit_atomic_cas(ATOMIC_UINT32_T *dest, + ATOMIC_UINT32_T *expected, + ATOMIC_UINT32_T desired) { + if (*dest == *expected) { + *dest = desired; + return 1; + } else { + return 0; + } +} +#endif + +#define MUNIT_PRNG_MULTIPLIER (747796405U) +#define MUNIT_PRNG_INCREMENT (1729U) + +static munit_uint32_t munit_rand_next_state(munit_uint32_t state) { + return state * MUNIT_PRNG_MULTIPLIER + MUNIT_PRNG_INCREMENT; +} + +static munit_uint32_t munit_rand_from_state(munit_uint32_t state) { + munit_uint32_t res = ((state >> ((state >> 28) + 4)) ^ state) * (277803737U); + res ^= res >> 22; + return res; +} + +void munit_rand_seed(munit_uint32_t seed) { + munit_uint32_t state = munit_rand_next_state(seed + MUNIT_PRNG_INCREMENT); + munit_atomic_store(&munit_rand_state, state); +} + +static munit_uint32_t munit_rand_generate_seed(void) { + munit_uint32_t seed, state; +#if defined(MUNIT_ENABLE_TIMING) + struct PsnipClockTimespec wc = { + 0, + }; + + psnip_clock_get_time(PSNIP_CLOCK_TYPE_WALL, &wc); + seed = (munit_uint32_t)wc.nanoseconds; +#else + seed = (munit_uint32_t)time(NULL); +#endif + + state = munit_rand_next_state(seed + MUNIT_PRNG_INCREMENT); + return munit_rand_from_state(state); +} + +static munit_uint32_t munit_rand_state_uint32(munit_uint32_t *state) { + const munit_uint32_t old = *state; + *state = munit_rand_next_state(old); + return munit_rand_from_state(old); +} + +munit_uint32_t munit_rand_uint32(void) { + munit_uint32_t old, state; + + do { + old = munit_atomic_load(&munit_rand_state); + state = munit_rand_next_state(old); + } while (!munit_atomic_cas(&munit_rand_state, &old, state)); + + return munit_rand_from_state(old); +} + +static void munit_rand_state_memory(munit_uint32_t *state, size_t size, + munit_uint8_t *data) { + size_t members_remaining = size / sizeof(munit_uint32_t); + size_t bytes_remaining = size % sizeof(munit_uint32_t); + munit_uint8_t *b = data; + munit_uint32_t rv; + while (members_remaining-- > 0) { + rv = munit_rand_state_uint32(state); + memcpy(b, &rv, sizeof(munit_uint32_t)); + b += sizeof(munit_uint32_t); + } + if (bytes_remaining != 0) { + rv = munit_rand_state_uint32(state); + memcpy(b, &rv, bytes_remaining); + } +} + +void munit_rand_memory(size_t size, munit_uint8_t *data) { + munit_uint32_t old, state; + + do { + state = old = munit_atomic_load(&munit_rand_state); + munit_rand_state_memory(&state, size, data); + } while (!munit_atomic_cas(&munit_rand_state, &old, state)); +} + +static munit_uint32_t munit_rand_state_at_most(munit_uint32_t *state, + munit_uint32_t salt, + munit_uint32_t max) { + /* We want (UINT32_MAX + 1) % max, which in unsigned arithmetic is the same + * as (UINT32_MAX + 1 - max) % max = -max % max. We compute -max using not + * to avoid compiler warnings. + */ + const munit_uint32_t min = (~max + 1U) % max; + munit_uint32_t x; + + if (max == (~((munit_uint32_t)0U))) + return munit_rand_state_uint32(state) ^ salt; + + max++; + + do { + x = munit_rand_state_uint32(state) ^ salt; + } while (x < min); + + return x % max; +} + +static munit_uint32_t munit_rand_at_most(munit_uint32_t salt, + munit_uint32_t max) { + munit_uint32_t old, state; + munit_uint32_t retval; + + do { + state = old = munit_atomic_load(&munit_rand_state); + retval = munit_rand_state_at_most(&state, salt, max); + } while (!munit_atomic_cas(&munit_rand_state, &old, state)); + + return retval; +} + +int munit_rand_int_range(int min, int max) { + munit_uint64_t range = (munit_uint64_t)max - (munit_uint64_t)min; + + if (min > max) + return munit_rand_int_range(max, min); + + if (range > (~((munit_uint32_t)0U))) + range = (~((munit_uint32_t)0U)); + + return min + (int)munit_rand_at_most(0, (munit_uint32_t)range); +} + +double munit_rand_double(void) { + munit_uint32_t old, state; + double retval = 0.0; + + do { + state = old = munit_atomic_load(&munit_rand_state); + + /* See http://mumble.net/~campbell/tmp/random_real.c for how to do + * this right. Patches welcome if you feel that this is too + * biased. */ + retval = munit_rand_state_uint32(&state) / ((~((munit_uint32_t)0U)) + 1.0); + } while (!munit_atomic_cas(&munit_rand_state, &old, state)); + + return retval; +} + +/*** Test suite handling ***/ + +typedef struct { + unsigned int successful; + unsigned int skipped; + unsigned int failed; + unsigned int errored; +#if defined(MUNIT_ENABLE_TIMING) + munit_uint64_t cpu_clock; + munit_uint64_t wall_clock; +#endif +} MunitReport; + +typedef struct { + const char *prefix; + const MunitSuite *suite; + const char **tests; + munit_uint32_t seed; + unsigned int iterations; + MunitParameter *parameters; + munit_bool single_parameter_mode; + void *user_data; + MunitReport report; + munit_bool colorize; + munit_bool fork; + munit_bool show_stderr; + munit_bool fatal_failures; +} MunitTestRunner; + +const char *munit_parameters_get(const MunitParameter params[], + const char *key) { + const MunitParameter *param; + + for (param = params; param != NULL && param->name != NULL; param++) + if (strcmp(param->name, key) == 0) + return param->value; + return NULL; +} + +#if defined(MUNIT_ENABLE_TIMING) +static void munit_print_time(FILE *fp, munit_uint64_t nanoseconds) { + fprintf(fp, "%" MUNIT_TEST_TIME_FORMAT, + ((double)nanoseconds) / ((double)PSNIP_CLOCK_NSEC_PER_SEC)); +} +#endif + +/* Add a paramter to an array of parameters. */ +static MunitResult munit_parameters_add(size_t *params_size, + MunitParameter **params, char *name, + char *value) { + *params = realloc(*params, sizeof(MunitParameter) * (*params_size + 2)); + if (*params == NULL) + return MUNIT_ERROR; + + (*params)[*params_size].name = name; + (*params)[*params_size].value = value; + (*params_size)++; + (*params)[*params_size].name = NULL; + (*params)[*params_size].value = NULL; + + return MUNIT_OK; +} + +/* Concatenate two strings, but just return one of the components + * unaltered if the other is NULL or "". */ +static char *munit_maybe_concat(size_t *len, char *prefix, char *suffix) { + char *res; + size_t res_l; + const size_t prefix_l = prefix != NULL ? strlen(prefix) : 0; + const size_t suffix_l = suffix != NULL ? strlen(suffix) : 0; + if (prefix_l == 0 && suffix_l == 0) { + res = NULL; + res_l = 0; + } else if (prefix_l == 0 && suffix_l != 0) { + res = suffix; + res_l = suffix_l; + } else if (prefix_l != 0 && suffix_l == 0) { + res = prefix; + res_l = prefix_l; + } else { + res_l = prefix_l + suffix_l; + res = malloc(res_l + 1); + memcpy(res, prefix, prefix_l); + memcpy(res + prefix_l, suffix, suffix_l); + res[res_l] = 0; + } + + if (len != NULL) + *len = res_l; + + return res; +} + +/* Possbily free a string returned by munit_maybe_concat. */ +static void munit_maybe_free_concat(char *s, const char *prefix, + const char *suffix) { + if (prefix != s && suffix != s) + free(s); +} + +/* Cheap string hash function, just used to salt the PRNG. */ +static munit_uint32_t munit_str_hash(const char *name) { + const char *p; + munit_uint32_t h = 5381U; + + for (p = name; *p != '\0'; p++) + h = (munit_uint32_t)(h << 5) + h + (munit_uint32_t)*p; + + return h; +} + +static void munit_splice(int from, int to) { + munit_uint8_t buf[1024]; +#if !defined(_WIN32) + ssize_t len; + ssize_t bytes_written; + ssize_t write_res; +#else + int len; + int bytes_written; + int write_res; +#endif + do { + len = read(from, buf, sizeof(buf)); + if (len > 0) { + bytes_written = 0; + do { + write_res = write(to, buf + bytes_written, +#if !defined(_WIN32) + (size_t) +#else + (unsigned int) +#endif + (len - bytes_written)); + if (write_res < 0) + break; + bytes_written += write_res; + } while (bytes_written < len); + } else + break; + } while (1); +} + +/* This is the part that should be handled in the child process */ +static MunitResult munit_test_runner_exec(MunitTestRunner *runner, + const MunitTest *test, + const MunitParameter params[], + MunitReport *report) { + unsigned int iterations = runner->iterations; + MunitResult result = MUNIT_FAIL; +#if defined(MUNIT_ENABLE_TIMING) + struct PsnipClockTimespec wall_clock_begin = + { + 0, + }, + wall_clock_end = { + 0, + }; + struct PsnipClockTimespec cpu_clock_begin = + { + 0, + }, + cpu_clock_end = { + 0, + }; +#endif + unsigned int i = 0; + + if ((test->options & MUNIT_TEST_OPTION_SINGLE_ITERATION) == + MUNIT_TEST_OPTION_SINGLE_ITERATION) + iterations = 1; + else if (iterations == 0) + iterations = runner->suite->iterations; + + munit_rand_seed(runner->seed); + + do { + void *data = (test->setup == NULL) ? runner->user_data + : test->setup(params, runner->user_data); + +#if defined(MUNIT_ENABLE_TIMING) + psnip_clock_get_time(PSNIP_CLOCK_TYPE_WALL, &wall_clock_begin); + psnip_clock_get_time(PSNIP_CLOCK_TYPE_CPU, &cpu_clock_begin); +#endif + + result = test->test(params, data); + +#if defined(MUNIT_ENABLE_TIMING) + psnip_clock_get_time(PSNIP_CLOCK_TYPE_WALL, &wall_clock_end); + psnip_clock_get_time(PSNIP_CLOCK_TYPE_CPU, &cpu_clock_end); +#endif + + if (test->tear_down != NULL) + test->tear_down(data); + + if (MUNIT_LIKELY(result == MUNIT_OK)) { + report->successful++; +#if defined(MUNIT_ENABLE_TIMING) + report->wall_clock += + munit_clock_get_elapsed(&wall_clock_begin, &wall_clock_end); + report->cpu_clock += + munit_clock_get_elapsed(&cpu_clock_begin, &cpu_clock_end); +#endif + } else { + switch ((int)result) { + case MUNIT_SKIP: + report->skipped++; + break; + case MUNIT_FAIL: + report->failed++; + break; + case MUNIT_ERROR: + report->errored++; + break; + default: + break; + } + break; + } + } while (++i < iterations); + + return result; +} + +#if defined(MUNIT_EMOTICON) +# define MUNIT_RESULT_STRING_OK ":)" +# define MUNIT_RESULT_STRING_SKIP ":|" +# define MUNIT_RESULT_STRING_FAIL ":(" +# define MUNIT_RESULT_STRING_ERROR ":o" +# define MUNIT_RESULT_STRING_TODO ":/" +#else +# define MUNIT_RESULT_STRING_OK "OK " +# define MUNIT_RESULT_STRING_SKIP "SKIP " +# define MUNIT_RESULT_STRING_FAIL "FAIL " +# define MUNIT_RESULT_STRING_ERROR "ERROR" +# define MUNIT_RESULT_STRING_TODO "TODO " +#endif + +static void munit_test_runner_print_color(const MunitTestRunner *runner, + const char *string, char color) { + if (runner->colorize) + fprintf(MUNIT_OUTPUT_FILE, "\x1b[3%cm%s\x1b[39m", color, string); + else + fputs(string, MUNIT_OUTPUT_FILE); +} + +#if !defined(MUNIT_NO_BUFFER) +static int munit_replace_stderr(FILE *stderr_buf) { + if (stderr_buf != NULL) { + const int orig_stderr = dup(STDERR_FILENO); + + int errfd = fileno(stderr_buf); + if (MUNIT_UNLIKELY(errfd == -1)) { + exit(EXIT_FAILURE); + } + + dup2(errfd, STDERR_FILENO); + + return orig_stderr; + } + + return -1; +} + +static void munit_restore_stderr(int orig_stderr) { + if (orig_stderr != -1) { + dup2(orig_stderr, STDERR_FILENO); + close(orig_stderr); + } +} +#endif /* !defined(MUNIT_NO_BUFFER) */ + +/* Run a test with the specified parameters. */ +static void +munit_test_runner_run_test_with_params(MunitTestRunner *runner, + const MunitTest *test, + const MunitParameter params[]) { + MunitResult result = MUNIT_OK; + MunitReport report = {0, 0, 0, 0, +#if defined(MUNIT_ENABLE_TIMING) + 0, 0 +#endif + }; + unsigned int output_l; + munit_bool first; + const MunitParameter *param; + FILE *stderr_buf; +#if !defined(MUNIT_NO_FORK) + int pipefd[2]; + pid_t fork_pid; + ssize_t bytes_written = 0; + ssize_t write_res; + ssize_t bytes_read = 0; + ssize_t read_res; + int status = 0; + pid_t changed_pid; +#endif + + if (params != NULL) { + output_l = 2; + fputs(" ", MUNIT_OUTPUT_FILE); + first = 1; + for (param = params; param != NULL && param->name != NULL; param++) { + if (!first) { + fputs(", ", MUNIT_OUTPUT_FILE); + output_l += 2; + } else { + first = 0; + } + + output_l += (unsigned int)fprintf(MUNIT_OUTPUT_FILE, "%s=%s", param->name, + param->value); + } + while (output_l++ < MUNIT_TEST_NAME_LEN) { + fputc(' ', MUNIT_OUTPUT_FILE); + } + } + + fflush(MUNIT_OUTPUT_FILE); + + stderr_buf = NULL; +#if !defined(_WIN32) || defined(__MINGW32__) + stderr_buf = tmpfile(); +#else + tmpfile_s(&stderr_buf); +#endif + if (stderr_buf == NULL) { + munit_log_errno(MUNIT_LOG_ERROR, stderr, + "unable to create buffer for stderr"); + result = MUNIT_ERROR; + goto print_result; + } + +#if !defined(MUNIT_NO_FORK) + if (runner->fork) { + pipefd[0] = -1; + pipefd[1] = -1; + if (pipe(pipefd) != 0) { + munit_log_errno(MUNIT_LOG_ERROR, stderr, "unable to create pipe"); + result = MUNIT_ERROR; + goto print_result; + } + + fork_pid = fork(); + if (fork_pid == 0) { + int orig_stderr; + + close(pipefd[0]); + + orig_stderr = munit_replace_stderr(stderr_buf); + munit_test_runner_exec(runner, test, params, &report); + + /* Note that we don't restore stderr. This is so we can buffer + * things written to stderr later on (such as by + * asan/tsan/ubsan, valgrind, etc.) */ + close(orig_stderr); + + do { + write_res = + write(pipefd[1], ((munit_uint8_t *)(&report)) + bytes_written, + sizeof(report) - (size_t)bytes_written); + if (write_res < 0) { + if (stderr_buf != NULL) { + munit_log_errno(MUNIT_LOG_ERROR, stderr, "unable to write to pipe"); + } + exit(EXIT_FAILURE); + } + bytes_written += write_res; + } while ((size_t)bytes_written < sizeof(report)); + + if (stderr_buf != NULL) + fclose(stderr_buf); + close(pipefd[1]); + + exit(EXIT_SUCCESS); + } else if (fork_pid == -1) { + close(pipefd[0]); + close(pipefd[1]); + if (stderr_buf != NULL) { + munit_log_errno(MUNIT_LOG_ERROR, stderr, "unable to fork"); + } + report.errored++; + result = MUNIT_ERROR; + } else { + close(pipefd[1]); + do { + read_res = read(pipefd[0], ((munit_uint8_t *)(&report)) + bytes_read, + sizeof(report) - (size_t)bytes_read); + if (read_res < 1) + break; + bytes_read += read_res; + } while (bytes_read < (ssize_t)sizeof(report)); + + changed_pid = waitpid(fork_pid, &status, 0); + + if (MUNIT_LIKELY(changed_pid == fork_pid) && + MUNIT_LIKELY(WIFEXITED(status))) { + if (bytes_read != sizeof(report)) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr_buf, + "child exited unexpectedly with status %d", + WEXITSTATUS(status)); + report.errored++; + } else if (WEXITSTATUS(status) != EXIT_SUCCESS) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr_buf, + "child exited with status %d", + WEXITSTATUS(status)); + report.errored++; + } + } else { + if (WIFSIGNALED(status)) { +# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 700) + munit_logf_internal(MUNIT_LOG_ERROR, stderr_buf, + "child killed by signal %d (%s)", + WTERMSIG(status), strsignal(WTERMSIG(status))); +# else + munit_logf_internal(MUNIT_LOG_ERROR, stderr_buf, + "child killed by signal %d", WTERMSIG(status)); +# endif + } else if (WIFSTOPPED(status)) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr_buf, + "child stopped by signal %d", WSTOPSIG(status)); + } + report.errored++; + } + + close(pipefd[0]); + waitpid(fork_pid, NULL, 0); + } + } else +#endif + { +#if !defined(MUNIT_NO_BUFFER) + const volatile int orig_stderr = munit_replace_stderr(stderr_buf); +#endif + +#if defined(MUNIT_THREAD_LOCAL) + if (MUNIT_UNLIKELY(setjmp(munit_error_jmp_buf) != 0)) { + result = MUNIT_FAIL; + report.failed++; + } else { + munit_error_jmp_buf_valid = 1; + result = munit_test_runner_exec(runner, test, params, &report); + } +#else + result = munit_test_runner_exec(runner, test, params, &report); +#endif + +#if !defined(MUNIT_NO_BUFFER) + munit_restore_stderr(orig_stderr); +#endif + + /* Here just so that the label is used on Windows and we don't get + * a warning */ + goto print_result; + } + +print_result: + + fputs("[ ", MUNIT_OUTPUT_FILE); + if ((test->options & MUNIT_TEST_OPTION_TODO) == MUNIT_TEST_OPTION_TODO) { + if (report.failed != 0 || report.errored != 0 || report.skipped != 0) { + munit_test_runner_print_color(runner, MUNIT_RESULT_STRING_TODO, '3'); + result = MUNIT_OK; + } else { + munit_test_runner_print_color(runner, MUNIT_RESULT_STRING_ERROR, '1'); + if (MUNIT_LIKELY(stderr_buf != NULL)) + munit_log_internal(MUNIT_LOG_ERROR, stderr_buf, + "Test marked TODO, but was successful."); + runner->report.failed++; + result = MUNIT_ERROR; + } + } else if (report.failed > 0) { + munit_test_runner_print_color(runner, MUNIT_RESULT_STRING_FAIL, '1'); + runner->report.failed++; + result = MUNIT_FAIL; + } else if (report.errored > 0) { + munit_test_runner_print_color(runner, MUNIT_RESULT_STRING_ERROR, '1'); + runner->report.errored++; + result = MUNIT_ERROR; + } else if (report.skipped > 0) { + munit_test_runner_print_color(runner, MUNIT_RESULT_STRING_SKIP, '3'); + runner->report.skipped++; + result = MUNIT_SKIP; + } else if (report.successful > 1) { + munit_test_runner_print_color(runner, MUNIT_RESULT_STRING_OK, '2'); +#if defined(MUNIT_ENABLE_TIMING) + fputs(" ] [ ", MUNIT_OUTPUT_FILE); + munit_print_time(MUNIT_OUTPUT_FILE, report.wall_clock / report.successful); + fputs(" / ", MUNIT_OUTPUT_FILE); + munit_print_time(MUNIT_OUTPUT_FILE, report.cpu_clock / report.successful); + fprintf(MUNIT_OUTPUT_FILE, + " CPU ]\n %-" MUNIT_XSTRINGIFY(MUNIT_TEST_NAME_LEN) "s Total: [ ", + ""); + munit_print_time(MUNIT_OUTPUT_FILE, report.wall_clock); + fputs(" / ", MUNIT_OUTPUT_FILE); + munit_print_time(MUNIT_OUTPUT_FILE, report.cpu_clock); + fputs(" CPU", MUNIT_OUTPUT_FILE); +#endif + runner->report.successful++; + result = MUNIT_OK; + } else if (report.successful > 0) { + munit_test_runner_print_color(runner, MUNIT_RESULT_STRING_OK, '2'); +#if defined(MUNIT_ENABLE_TIMING) + fputs(" ] [ ", MUNIT_OUTPUT_FILE); + munit_print_time(MUNIT_OUTPUT_FILE, report.wall_clock); + fputs(" / ", MUNIT_OUTPUT_FILE); + munit_print_time(MUNIT_OUTPUT_FILE, report.cpu_clock); + fputs(" CPU", MUNIT_OUTPUT_FILE); +#endif + runner->report.successful++; + result = MUNIT_OK; + } + fputs(" ]\n", MUNIT_OUTPUT_FILE); + + if (stderr_buf != NULL) { + if (result == MUNIT_FAIL || result == MUNIT_ERROR || runner->show_stderr) { + fflush(MUNIT_OUTPUT_FILE); + + rewind(stderr_buf); + munit_splice(fileno(stderr_buf), STDERR_FILENO); + + fflush(stderr); + } + + fclose(stderr_buf); + } +} + +static void munit_test_runner_run_test_wild(MunitTestRunner *runner, + const MunitTest *test, + const char *test_name, + MunitParameter *params, + MunitParameter *p) { + const MunitParameterEnum *pe; + char **values; + MunitParameter *next; + + for (pe = test->parameters; pe != NULL && pe->name != NULL; pe++) { + if (p->name == pe->name) + break; + } + + if (pe == NULL) + return; + + for (values = pe->values; *values != NULL; values++) { + next = p + 1; + p->value = *values; + if (next->name == NULL) { + munit_test_runner_run_test_with_params(runner, test, params); + } else { + munit_test_runner_run_test_wild(runner, test, test_name, params, next); + } + if (runner->fatal_failures && + (runner->report.failed != 0 || runner->report.errored != 0)) + break; + } +} + +/* Run a single test, with every combination of parameters + * requested. */ +static void munit_test_runner_run_test(MunitTestRunner *runner, + const MunitTest *test, + const char *prefix) { + char *test_name = + munit_maybe_concat(NULL, (char *)prefix, (char *)test->name); + /* The array of parameters to pass to + * munit_test_runner_run_test_with_params */ + MunitParameter *params = NULL; + size_t params_l = 0; + /* Wildcard parameters are parameters which have possible values + * specified in the test, but no specific value was passed to the + * CLI. That means we want to run the test once for every + * possible combination of parameter values or, if --single was + * passed to the CLI, a single time with a random set of + * parameters. */ + MunitParameter *wild_params = NULL; + size_t wild_params_l = 0; + const MunitParameterEnum *pe; + const MunitParameter *cli_p; + munit_bool filled; + unsigned int possible; + char **vals; + size_t first_wild; + const MunitParameter *wp; + int pidx; + + munit_rand_seed(runner->seed); + + fprintf(MUNIT_OUTPUT_FILE, "%-" MUNIT_XSTRINGIFY(MUNIT_TEST_NAME_LEN) "s", + test_name); + + if (test->parameters == NULL) { + /* No parameters. Simple, nice. */ + munit_test_runner_run_test_with_params(runner, test, NULL); + } else { + fputc('\n', MUNIT_OUTPUT_FILE); + + for (pe = test->parameters; pe != NULL && pe->name != NULL; pe++) { + /* Did we received a value for this parameter from the CLI? */ + filled = 0; + for (cli_p = runner->parameters; cli_p != NULL && cli_p->name != NULL; + cli_p++) { + if (strcmp(cli_p->name, pe->name) == 0) { + if (MUNIT_UNLIKELY(munit_parameters_add(¶ms_l, ¶ms, pe->name, + cli_p->value) != MUNIT_OK)) + goto cleanup; + filled = 1; + break; + } + } + if (filled) + continue; + + /* Nothing from CLI, is the enum NULL/empty? We're not a + * fuzzer… */ + if (pe->values == NULL || pe->values[0] == NULL) + continue; + + /* If --single was passed to the CLI, choose a value from the + * list of possibilities randomly. */ + if (runner->single_parameter_mode) { + possible = 0; + for (vals = pe->values; *vals != NULL; vals++) + possible++; + /* We want the tests to be reproducible, even if you're only + * running a single test, but we don't want every test with + * the same number of parameters to choose the same parameter + * number, so use the test name as a primitive salt. */ + pidx = (int)munit_rand_at_most(munit_str_hash(test_name), possible - 1); + if (MUNIT_UNLIKELY(munit_parameters_add(¶ms_l, ¶ms, pe->name, + pe->values[pidx]) != MUNIT_OK)) + goto cleanup; + } else { + /* We want to try every permutation. Put in a placeholder + * entry, we'll iterate through them later. */ + if (MUNIT_UNLIKELY(munit_parameters_add(&wild_params_l, &wild_params, + pe->name, NULL) != MUNIT_OK)) + goto cleanup; + } + } + + if (wild_params_l != 0) { + first_wild = params_l; + for (wp = wild_params; wp != NULL && wp->name != NULL; wp++) { + for (pe = test->parameters; + pe != NULL && pe->name != NULL && pe->values != NULL; pe++) { + if (strcmp(wp->name, pe->name) == 0) { + if (MUNIT_UNLIKELY(munit_parameters_add(¶ms_l, ¶ms, + pe->name, + pe->values[0]) != MUNIT_OK)) + goto cleanup; + } + } + } + + munit_test_runner_run_test_wild(runner, test, test_name, params, + params + first_wild); + } else { + munit_test_runner_run_test_with_params(runner, test, params); + } + + cleanup: + free(params); + free(wild_params); + } + + munit_maybe_free_concat(test_name, prefix, test->name); +} + +/* Recurse through the suite and run all the tests. If a list of + * tests to run was provied on the command line, run only those + * tests. */ +static void munit_test_runner_run_suite(MunitTestRunner *runner, + const MunitSuite *suite, + const char *prefix) { + size_t pre_l; + char *pre = munit_maybe_concat(&pre_l, (char *)prefix, (char *)suite->prefix); + const MunitTest *test; + const char **test_name; + const MunitSuite *child_suite; + + /* Run the tests. */ + for (test = suite->tests; test != NULL && test->test != NULL; test++) { + if (runner->tests != NULL) { /* Specific tests were requested on the CLI */ + for (test_name = runner->tests; test_name != NULL && *test_name != NULL; + test_name++) { + if ((pre_l == 0 || strncmp(pre, *test_name, pre_l) == 0) && + strncmp(test->name, *test_name + pre_l, + strlen(*test_name + pre_l)) == 0) { + munit_test_runner_run_test(runner, test, pre); + if (runner->fatal_failures && + (runner->report.failed != 0 || runner->report.errored != 0)) + goto cleanup; + } + } + } else { /* Run all tests */ + munit_test_runner_run_test(runner, test, pre); + } + } + + if (runner->fatal_failures && + (runner->report.failed != 0 || runner->report.errored != 0)) + goto cleanup; + + /* Run any child suites. */ + for (child_suite = suite->suites; + child_suite != NULL && child_suite->prefix != NULL; child_suite++) { + munit_test_runner_run_suite(runner, child_suite, pre); + } + +cleanup: + + munit_maybe_free_concat(pre, prefix, suite->prefix); +} + +static void munit_test_runner_run(MunitTestRunner *runner) { + munit_test_runner_run_suite(runner, runner->suite, NULL); +} + +static void munit_print_help(int argc, char *const *argv, void *user_data, + const MunitArgument arguments[]) { + const MunitArgument *arg; + (void)argc; + + printf("USAGE: %s [OPTIONS...] [TEST...]\n\n", argv[0]); + puts( + " --seed SEED\n" + " Value used to seed the PRNG. Must be a 32-bit integer in " + "decimal\n" + " notation with no separators (commas, decimals, spaces, " + "etc.), or\n" + " hexidecimal prefixed by \"0x\".\n" + " --iterations N\n" + " Run each test N times. 0 means the default number.\n" + " --param name value\n" + " A parameter key/value pair which will be passed to any test " + "with\n" + " takes a parameter of that name. If not provided, the test " + "will be\n" + " run once for each possible parameter value.\n" + " --list Write a list of all available tests.\n" + " --list-params\n" + " Write a list of all available tests and their possible " + "parameters.\n" + " --single Run each parameterized test in a single configuration " + "instead of\n" + " every possible combination\n" + " --log-visible debug|info|warning|error\n" + " --log-fatal debug|info|warning|error\n" + " Set the level at which messages of different severities are " + "visible,\n" + " or cause the test to terminate.\n" +#if !defined(MUNIT_NO_FORK) + " --no-fork Do not execute tests in a child process. If this option is " + "supplied\n" + " and a test crashes (including by failing an assertion), no " + "further\n" + " tests will be performed.\n" +#endif + " --fatal-failures\n" + " Stop executing tests as soon as a failure is found.\n" + " --show-stderr\n" + " Show data written to stderr by the tests, even if the test " + "succeeds.\n" + " --color auto|always|never\n" + " Colorize (or don't) the output.\n" + /* 12345678901234567890123456789012345678901234567890123456789012345678901234567890 + */ + " --help Print this help message and exit.\n"); +#if defined(MUNIT_NL_LANGINFO) + setlocale(LC_ALL, ""); + fputs((strcasecmp("UTF-8", nl_langinfo(CODESET)) == 0) ? "µnit" : "munit", + stdout); +#else + puts("munit"); +#endif + printf(" %d.%d.%d\n" + "Full documentation at: https://nemequ.github.io/munit/\n", + (MUNIT_CURRENT_VERSION >> 16) & 0xff, + (MUNIT_CURRENT_VERSION >> 8) & 0xff, + (MUNIT_CURRENT_VERSION >> 0) & 0xff); + for (arg = arguments; arg != NULL && arg->name != NULL; arg++) + arg->write_help(arg, user_data); +} + +static const MunitArgument * +munit_arguments_find(const MunitArgument arguments[], const char *name) { + const MunitArgument *arg; + + for (arg = arguments; arg != NULL && arg->name != NULL; arg++) + if (strcmp(arg->name, name) == 0) + return arg; + + return NULL; +} + +static void munit_suite_list_tests(const MunitSuite *suite, + munit_bool show_params, const char *prefix) { + size_t pre_l; + char *pre = munit_maybe_concat(&pre_l, (char *)prefix, (char *)suite->prefix); + const MunitTest *test; + const MunitParameterEnum *params; + munit_bool first; + char **val; + const MunitSuite *child_suite; + + for (test = suite->tests; test != NULL && test->name != NULL; test++) { + if (pre != NULL) + fputs(pre, stdout); + puts(test->name); + + if (show_params) { + for (params = test->parameters; params != NULL && params->name != NULL; + params++) { + fprintf(stdout, " - %s: ", params->name); + if (params->values == NULL) { + puts("Any"); + } else { + first = 1; + for (val = params->values; *val != NULL; val++) { + if (!first) { + fputs(", ", stdout); + } else { + first = 0; + } + fputs(*val, stdout); + } + putc('\n', stdout); + } + } + } + } + + for (child_suite = suite->suites; + child_suite != NULL && child_suite->prefix != NULL; child_suite++) { + munit_suite_list_tests(child_suite, show_params, pre); + } + + munit_maybe_free_concat(pre, prefix, suite->prefix); +} + +static munit_bool munit_stream_supports_ansi(FILE *stream) { +#if !defined(_WIN32) + return isatty(fileno(stream)); +#else + +# if !defined(__MINGW32__) + size_t ansicon_size = 0; +# endif + + if (isatty(fileno(stream))) { +# if !defined(__MINGW32__) + getenv_s(&ansicon_size, NULL, 0, "ANSICON"); + return ansicon_size != 0; +# else + return getenv("ANSICON") != NULL; +# endif + } + return 0; +#endif +} + +int munit_suite_main_custom(const MunitSuite *suite, void *user_data, int argc, + char *const *argv, + const MunitArgument arguments[]) { + int result = EXIT_FAILURE; + MunitTestRunner runner; + size_t parameters_size = 0; + size_t tests_size = 0; + int arg; + + char *envptr; + unsigned long ts; + char *endptr; + unsigned long long iterations; + MunitLogLevel level; + const MunitArgument *argument; + const char **runner_tests; + unsigned int tests_run; + unsigned int tests_total; + + runner.prefix = NULL; + runner.suite = NULL; + runner.tests = NULL; + runner.seed = 0; + runner.iterations = 0; + runner.parameters = NULL; + runner.single_parameter_mode = 0; + runner.user_data = NULL; + + runner.report.successful = 0; + runner.report.skipped = 0; + runner.report.failed = 0; + runner.report.errored = 0; +#if defined(MUNIT_ENABLE_TIMING) + runner.report.cpu_clock = 0; + runner.report.wall_clock = 0; +#endif + + runner.colorize = 0; +#if !defined(_WIN32) + runner.fork = 1; +#else + runner.fork = 0; +#endif + runner.show_stderr = 0; + runner.fatal_failures = 0; + runner.suite = suite; + runner.user_data = user_data; + runner.seed = munit_rand_generate_seed(); + runner.colorize = munit_stream_supports_ansi(MUNIT_OUTPUT_FILE); + + for (arg = 1; arg < argc; arg++) { + if (strncmp("--", argv[arg], 2) == 0) { + if (strcmp("seed", argv[arg] + 2) == 0) { + if (arg + 1 >= argc) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "%s requires an argument", argv[arg]); + goto cleanup; + } + + envptr = argv[arg + 1]; + ts = strtoul(argv[arg + 1], &envptr, 0); + if (*envptr != '\0' || ts > (~((munit_uint32_t)0U))) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "invalid value ('%s') passed to %s", + argv[arg + 1], argv[arg]); + goto cleanup; + } + runner.seed = (munit_uint32_t)ts; + + arg++; + } else if (strcmp("iterations", argv[arg] + 2) == 0) { + if (arg + 1 >= argc) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "%s requires an argument", argv[arg]); + goto cleanup; + } + + endptr = argv[arg + 1]; + iterations = strtoul(argv[arg + 1], &endptr, 0); + if (*endptr != '\0' || iterations > UINT_MAX) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "invalid value ('%s') passed to %s", + argv[arg + 1], argv[arg]); + goto cleanup; + } + + runner.iterations = (unsigned int)iterations; + + arg++; + } else if (strcmp("param", argv[arg] + 2) == 0) { + if (arg + 2 >= argc) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "%s requires two arguments", argv[arg]); + goto cleanup; + } + + runner.parameters = realloc(runner.parameters, sizeof(MunitParameter) * + (parameters_size + 2)); + if (runner.parameters == NULL) { + munit_log_internal(MUNIT_LOG_ERROR, stderr, + "failed to allocate memory"); + goto cleanup; + } + runner.parameters[parameters_size].name = (char *)argv[arg + 1]; + runner.parameters[parameters_size].value = (char *)argv[arg + 2]; + parameters_size++; + runner.parameters[parameters_size].name = NULL; + runner.parameters[parameters_size].value = NULL; + arg += 2; + } else if (strcmp("color", argv[arg] + 2) == 0) { + if (arg + 1 >= argc) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "%s requires an argument", argv[arg]); + goto cleanup; + } + + if (strcmp(argv[arg + 1], "always") == 0) + runner.colorize = 1; + else if (strcmp(argv[arg + 1], "never") == 0) + runner.colorize = 0; + else if (strcmp(argv[arg + 1], "auto") == 0) + runner.colorize = munit_stream_supports_ansi(MUNIT_OUTPUT_FILE); + else { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "invalid value ('%s') passed to %s", + argv[arg + 1], argv[arg]); + goto cleanup; + } + + arg++; + } else if (strcmp("help", argv[arg] + 2) == 0) { + munit_print_help(argc, argv, user_data, arguments); + result = EXIT_SUCCESS; + goto cleanup; + } else if (strcmp("single", argv[arg] + 2) == 0) { + runner.single_parameter_mode = 1; + } else if (strcmp("show-stderr", argv[arg] + 2) == 0) { + runner.show_stderr = 1; +#if !defined(_WIN32) + } else if (strcmp("no-fork", argv[arg] + 2) == 0) { + runner.fork = 0; +#endif + } else if (strcmp("fatal-failures", argv[arg] + 2) == 0) { + runner.fatal_failures = 1; + } else if (strcmp("log-visible", argv[arg] + 2) == 0 || + strcmp("log-fatal", argv[arg] + 2) == 0) { + if (arg + 1 >= argc) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "%s requires an argument", argv[arg]); + goto cleanup; + } + + if (strcmp(argv[arg + 1], "debug") == 0) + level = MUNIT_LOG_DEBUG; + else if (strcmp(argv[arg + 1], "info") == 0) + level = MUNIT_LOG_INFO; + else if (strcmp(argv[arg + 1], "warning") == 0) + level = MUNIT_LOG_WARNING; + else if (strcmp(argv[arg + 1], "error") == 0) + level = MUNIT_LOG_ERROR; + else { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "invalid value ('%s') passed to %s", + argv[arg + 1], argv[arg]); + goto cleanup; + } + + if (strcmp("log-visible", argv[arg] + 2) == 0) + munit_log_level_visible = level; + else + munit_log_level_fatal = level; + + arg++; + } else if (strcmp("list", argv[arg] + 2) == 0) { + munit_suite_list_tests(suite, 0, NULL); + result = EXIT_SUCCESS; + goto cleanup; + } else if (strcmp("list-params", argv[arg] + 2) == 0) { + munit_suite_list_tests(suite, 1, NULL); + result = EXIT_SUCCESS; + goto cleanup; + } else { + argument = munit_arguments_find(arguments, argv[arg] + 2); + if (argument == NULL) { + munit_logf_internal(MUNIT_LOG_ERROR, stderr, + "unknown argument ('%s')", argv[arg]); + goto cleanup; + } + + if (!argument->parse_argument(suite, user_data, &arg, argc, argv)) + goto cleanup; + } + } else { + runner_tests = + realloc((void *)runner.tests, sizeof(char *) * (tests_size + 2)); + if (runner_tests == NULL) { + munit_log_internal(MUNIT_LOG_ERROR, stderr, + "failed to allocate memory"); + goto cleanup; + } + runner.tests = runner_tests; + runner.tests[tests_size++] = argv[arg]; + runner.tests[tests_size] = NULL; + } + } + + fflush(stderr); + fprintf(MUNIT_OUTPUT_FILE, + "Running test suite with seed 0x%08" PRIx32 "...\n", runner.seed); + + munit_test_runner_run(&runner); + + tests_run = + runner.report.successful + runner.report.failed + runner.report.errored; + tests_total = tests_run + runner.report.skipped; + if (tests_run == 0) { + fprintf(stderr, "No tests run, %d (100%%) skipped.\n", + runner.report.skipped); + } else { + fprintf(MUNIT_OUTPUT_FILE, + "%d of %d (%0.0f%%) tests successful, %d (%0.0f%%) test skipped.\n", + runner.report.successful, tests_run, + (((double)runner.report.successful) / ((double)tests_run)) * 100.0, + runner.report.skipped, + (((double)runner.report.skipped) / ((double)tests_total)) * 100.0); + } + + if (runner.report.failed == 0 && runner.report.errored == 0) { + result = EXIT_SUCCESS; + } + +cleanup: + free(runner.parameters); + free((void *)runner.tests); + + return result; +} + +int munit_suite_main(const MunitSuite *suite, void *user_data, int argc, + char *const *argv) { + return munit_suite_main_custom(suite, user_data, argc, argv, NULL); +} + +static uint8_t hexchars[] = "0123456789abcdef"; + +static uint8_t *hexdump_addr(uint8_t *dest, size_t addr) { + size_t i; + uint8_t a; + + for (i = 0; i < 4; ++i) { + a = (addr >> (3 - i) * 8) & 0xff; + + *dest++ = hexchars[a >> 4]; + *dest++ = hexchars[a & 0xf]; + } + + return dest; +} + +static uint8_t *asciidump(uint8_t *dest, const uint8_t *data, size_t datalen) { + size_t i; + + *dest++ = '|'; + + for (i = 0; i < datalen; ++i) { + if (0x20 <= data[i] && data[i] <= 0x7e) { + *dest++ = data[i]; + } else { + *dest++ = '.'; + } + } + + *dest++ = '|'; + + return dest; +} + +static uint8_t *hexdump8(uint8_t *dest, const uint8_t *data, size_t datalen) { + size_t i; + + for (i = 0; i < datalen; ++i) { + *dest++ = hexchars[data[i] >> 4]; + *dest++ = hexchars[data[i] & 0xf]; + *dest++ = ' '; + } + + for (; i < 8; ++i) { + *dest++ = ' '; + *dest++ = ' '; + *dest++ = ' '; + } + + return dest; +} + +static uint8_t *hexdump16(uint8_t *dest, const uint8_t *data, size_t datalen) { + dest = hexdump8(dest, data, datalen < 8 ? datalen : 8); + *dest++ = ' '; + + if (datalen < 8) { + data = NULL; + datalen = 0; + } else { + data += 8; + datalen -= 8; + } + + dest = hexdump8(dest, data, datalen); + *dest++ = ' '; + + return dest; +} + +static uint8_t *hexdump_line(uint8_t *dest, const uint8_t *data, size_t datalen, + size_t addr) { + dest = hexdump_addr(dest, addr); + *dest++ = ' '; + *dest++ = ' '; + + dest = hexdump16(dest, data, datalen); + + dest = asciidump(dest, data, datalen); + + return dest; +} + +int munit_hexdump(FILE *fp, const void *data, size_t datalen) { + size_t offset = 0, n, len; + uint8_t buf[128], *p; + const uint8_t *s; + int repeated = 0; + + if (datalen == 0) { + return 0; + } + + for (; offset < datalen; offset += 16) { + n = datalen - offset; + s = (const uint8_t *)data + offset; + + if (n >= 16) { + n = 16; + + if (offset > 0) { + if (memcmp(s - 16, s, 16) == 0) { + if (repeated) { + continue; + } + + repeated = 1; + + if (fwrite("*\n", 1, 2, fp) < 2) { + return -1; + } + + continue; + } + + repeated = 0; + } + } + + p = hexdump_line(buf, s, n, offset); + *p++ = '\n'; + + len = (size_t)(p - buf); + + if (fwrite(buf, 1, len, fp) < len) { + return -1; + } + } + + p = hexdump_addr(buf, datalen); + *p++ = '\n'; + + len = (size_t)(p - buf); + + if (fwrite(buf, 1, len, fp) < len) { + return -1; + } + + return 0; +} + +int munit_hexdump_diff(FILE *fp, const void *a, size_t alen, const void *b, + size_t blen) { + size_t offset = 0, k, i, len, ncomp, maxlen, adoff = 0; + uint8_t buf[128], *p; + const uint8_t mk[2] = {'-', '+'}; + struct datasource { + const uint8_t *data; + size_t datalen; + const uint8_t *s; + size_t n; + } ds[] = {{a, alen, NULL, 0}, {b, blen, NULL, 0}}, *dp; + + maxlen = alen < blen ? blen : alen; + + for (; offset < maxlen; offset += 16) { + for (k = 0; k < 2; ++k) { + dp = &ds[k]; + + if (offset < dp->datalen) { + dp->s = (const uint8_t *)dp->data + offset; + dp->n = dp->datalen - offset; + + if (dp->n > 16) { + dp->n = 16; + } + } else { + dp->s = NULL; + dp->n = 0; + } + } + + if (ds[0].n == ds[1].n && memcmp(ds[0].s, ds[1].s, ds[0].n) == 0) { + continue; + } + + for (k = 0; k < 2; ++k) { + dp = &ds[k]; + + if (!dp->n) { + continue; + } + + p = buf; + *p++ = mk[k]; + *p++ = mk[k]; + *p++ = mk[k]; + *p++ = mk[k]; + + p = hexdump_line(p, dp->s, dp->n, offset); + *p++ = '\n'; + + len = (size_t)(p - buf); + + if (fwrite(buf, 1, len, fp) < len) { + return -1; + } + } + + if (!ds[0].n || !ds[1].n) { + continue; + } + + ncomp = ds[0].n < ds[1].n ? ds[0].n : ds[1].n; + + p = buf + 4 + 10; + + memset(buf, ' ', 4 + 78); + + for (i = 0; i < ncomp; ++i) { + if (ds[0].s[i] == ds[1].s[i]) { + *p++ = ' '; + *p++ = ' '; + } else { + adoff = 4 + 10 + 51 + i; + *(buf + adoff) = '^'; + + *p++ = '^'; + *p++ = '^'; + } + + *p++ = ' '; + + if (i == 7) { + *p++ = ' '; + } + } + + if (adoff) { + len = adoff + 1; + } else { + len = (size_t)(p - buf); + } + + buf[len++] = '\n'; + + if (fwrite(buf, 1, len, fp) < len) { + return -1; + } + } + + return 0; +} diff --git a/lib/nghttp2-1.65.0/tests/munit/munit.h b/lib/nghttp2-1.65.0/tests/munit/munit.h new file mode 100644 index 00000000000..a191758daf2 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/munit/munit.h @@ -0,0 +1,574 @@ +/* µnit Testing Framework + * Copyright (c) 2013-2017 Evan Nemerson + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef MUNIT_H +#define MUNIT_H + +#include +#include +#include +#include + +#define MUNIT_VERSION(major, minor, revision) \ + (((major) << 16) | ((minor) << 8) | (revision)) + +#define MUNIT_CURRENT_VERSION MUNIT_VERSION(0, 4, 1) + +#if defined(_MSC_VER) && (_MSC_VER < 1600) +# define munit_int8_t __int8 +# define munit_uint8_t unsigned __int8 +# define munit_int16_t __int16 +# define munit_uint16_t unsigned __int16 +# define munit_int32_t __int32 +# define munit_uint32_t unsigned __int32 +# define munit_int64_t __int64 +# define munit_uint64_t unsigned __int64 +#else +# include +# define munit_int8_t int8_t +# define munit_uint8_t uint8_t +# define munit_int16_t int16_t +# define munit_uint16_t uint16_t +# define munit_int32_t int32_t +# define munit_uint32_t uint32_t +# define munit_int64_t int64_t +# define munit_uint64_t uint64_t +#endif + +#if defined(_MSC_VER) && (_MSC_VER < 1800) +# if !defined(PRIi8) +# define PRIi8 "i" +# endif +# if !defined(PRIi16) +# define PRIi16 "i" +# endif +# if !defined(PRIi32) +# define PRIi32 "i" +# endif +# if !defined(PRIi64) +# define PRIi64 "I64i" +# endif +# if !defined(PRId8) +# define PRId8 "d" +# endif +# if !defined(PRId16) +# define PRId16 "d" +# endif +# if !defined(PRId32) +# define PRId32 "d" +# endif +# if !defined(PRId64) +# define PRId64 "I64d" +# endif +# if !defined(PRIx8) +# define PRIx8 "x" +# endif +# if !defined(PRIx16) +# define PRIx16 "x" +# endif +# if !defined(PRIx32) +# define PRIx32 "x" +# endif +# if !defined(PRIx64) +# define PRIx64 "I64x" +# endif +# if !defined(PRIu8) +# define PRIu8 "u" +# endif +# if !defined(PRIu16) +# define PRIu16 "u" +# endif +# if !defined(PRIu32) +# define PRIu32 "u" +# endif +# if !defined(PRIu64) +# define PRIu64 "I64u" +# endif +#else +# include +#endif + +#if !defined(munit_bool) +# if defined(bool) +# define munit_bool bool +# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +# define munit_bool _Bool +# else +# define munit_bool int +# endif +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__GNUC__) +# define MUNIT_LIKELY(expr) (__builtin_expect((expr), 1)) +# define MUNIT_UNLIKELY(expr) (__builtin_expect((expr), 0)) +# define MUNIT_UNUSED __attribute__((__unused__)) +#else +# define MUNIT_LIKELY(expr) (expr) +# define MUNIT_UNLIKELY(expr) (expr) +# define MUNIT_UNUSED +#endif + +#if !defined(_WIN32) +# define MUNIT_SIZE_MODIFIER "z" +# define MUNIT_CHAR_MODIFIER "hh" +# define MUNIT_SHORT_MODIFIER "h" +#else +# if defined(_M_X64) || defined(__amd64__) +# define MUNIT_SIZE_MODIFIER "I64" +# else +# define MUNIT_SIZE_MODIFIER "" +# endif +# define MUNIT_CHAR_MODIFIER "" +# define MUNIT_SHORT_MODIFIER "" +#endif + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define MUNIT_NO_RETURN _Noreturn +#elif defined(__GNUC__) +# define MUNIT_NO_RETURN __attribute__((__noreturn__)) +#elif defined(_MSC_VER) +# define MUNIT_NO_RETURN __declspec(noreturn) +#else +# define MUNIT_NO_RETURN +#endif + +#if defined(_MSC_VER) && (_MSC_VER >= 1500) +# define MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + __pragma(warning(push)) __pragma(warning(disable : 4127)) +# define MUNIT_POP_DISABLE_MSVC_C4127_ __pragma(warning(pop)) +#else +# define MUNIT_PUSH_DISABLE_MSVC_C4127_ +# define MUNIT_POP_DISABLE_MSVC_C4127_ +#endif + +typedef enum { + MUNIT_LOG_DEBUG, + MUNIT_LOG_INFO, + MUNIT_LOG_WARNING, + MUNIT_LOG_ERROR +} MunitLogLevel; + +#if defined(__GNUC__) && !defined(__MINGW32__) +# define MUNIT_PRINTF(string_index, first_to_check) \ + __attribute__((format(printf, string_index, first_to_check))) +#else +# define MUNIT_PRINTF(string_index, first_to_check) +#endif + +MUNIT_PRINTF(4, 5) +void munit_logf_ex(MunitLogLevel level, const char *filename, int line, + const char *format, ...); + +#define munit_logf(level, format, ...) \ + munit_logf_ex(level, __FILE__, __LINE__, format, __VA_ARGS__) + +#define munit_log(level, msg) munit_logf(level, "%s", msg) + +MUNIT_NO_RETURN +MUNIT_PRINTF(3, 4) +void munit_errorf_ex(const char *filename, int line, const char *format, ...); + +#define munit_errorf(format, ...) \ + munit_errorf_ex(__FILE__, __LINE__, format, __VA_ARGS__) + +#define munit_error(msg) munit_errorf("%s", msg) + +#define munit_assert(expr) \ + do { \ + if (!MUNIT_LIKELY(expr)) { \ + munit_error("assertion failed: " #expr); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#define munit_assert_true(expr) \ + do { \ + if (!MUNIT_LIKELY(expr)) { \ + munit_error("assertion failed: " #expr " is not true"); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#define munit_assert_false(expr) \ + do { \ + if (!MUNIT_LIKELY(!(expr))) { \ + munit_error("assertion failed: " #expr " is not false"); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#define munit_assert_type_full(prefix, suffix, T, fmt, a, op, b) \ + do { \ + T munit_tmp_a_ = (a); \ + T munit_tmp_b_ = (b); \ + if (!(munit_tmp_a_ op munit_tmp_b_)) { \ + munit_errorf("assertion failed: %s %s %s (" prefix "%" fmt suffix \ + " %s " prefix "%" fmt suffix ")", \ + #a, #op, #b, munit_tmp_a_, #op, munit_tmp_b_); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#define munit_assert_type(T, fmt, a, op, b) \ + munit_assert_type_full("", "", T, fmt, a, op, b) + +#define munit_assert_char(a, op, b) \ + munit_assert_type_full("'\\x", "'", char, "02" MUNIT_CHAR_MODIFIER "x", a, \ + op, b) +#define munit_assert_uchar(a, op, b) \ + munit_assert_type_full("'\\x", "'", unsigned char, \ + "02" MUNIT_CHAR_MODIFIER "x", a, op, b) +#define munit_assert_short(a, op, b) \ + munit_assert_type(short, MUNIT_SHORT_MODIFIER "d", a, op, b) +#define munit_assert_ushort(a, op, b) \ + munit_assert_type(unsigned short, MUNIT_SHORT_MODIFIER "u", a, op, b) +#define munit_assert_int(a, op, b) munit_assert_type(int, "d", a, op, b) +#define munit_assert_uint(a, op, b) \ + munit_assert_type(unsigned int, "u", a, op, b) +#define munit_assert_long(a, op, b) munit_assert_type(long int, "ld", a, op, b) +#define munit_assert_ulong(a, op, b) \ + munit_assert_type(unsigned long int, "lu", a, op, b) +#define munit_assert_llong(a, op, b) \ + munit_assert_type(long long int, "lld", a, op, b) +#define munit_assert_ullong(a, op, b) \ + munit_assert_type(unsigned long long int, "llu", a, op, b) + +#define munit_assert_size(a, op, b) \ + munit_assert_type(size_t, MUNIT_SIZE_MODIFIER "u", a, op, b) +#define munit_assert_ssize(a, op, b) \ + munit_assert_type(ssize_t, MUNIT_SIZE_MODIFIER "d", a, op, b) + +#define munit_assert_float(a, op, b) munit_assert_type(float, "f", a, op, b) +#define munit_assert_double(a, op, b) munit_assert_type(double, "g", a, op, b) +#define munit_assert_ptr(a, op, b) \ + munit_assert_type(const void *, "p", a, op, b) + +#define munit_assert_int8(a, op, b) \ + munit_assert_type(munit_int8_t, PRIi8, a, op, b) +#define munit_assert_uint8(a, op, b) \ + munit_assert_type(munit_uint8_t, PRIu8, a, op, b) +#define munit_assert_int16(a, op, b) \ + munit_assert_type(munit_int16_t, PRIi16, a, op, b) +#define munit_assert_uint16(a, op, b) \ + munit_assert_type(munit_uint16_t, PRIu16, a, op, b) +#define munit_assert_int32(a, op, b) \ + munit_assert_type(munit_int32_t, PRIi32, a, op, b) +#define munit_assert_uint32(a, op, b) \ + munit_assert_type(munit_uint32_t, PRIu32, a, op, b) +#define munit_assert_int64(a, op, b) \ + munit_assert_type(munit_int64_t, PRIi64, a, op, b) +#define munit_assert_uint64(a, op, b) \ + munit_assert_type(munit_uint64_t, PRIu64, a, op, b) + +#define munit_assert_ptrdiff(a, op, b) \ + munit_assert_type(ptrdiff_t, "td", a, op, b) + +#define munit_assert_enum(T, a, op, b) munit_assert_type(T, "d", a, op, b) + +#define munit_assert_double_equal(a, b, precision) \ + do { \ + const double munit_tmp_a_ = (a); \ + const double munit_tmp_b_ = (b); \ + const double munit_tmp_diff_ = ((munit_tmp_a_ - munit_tmp_b_) < 0) \ + ? -(munit_tmp_a_ - munit_tmp_b_) \ + : (munit_tmp_a_ - munit_tmp_b_); \ + if (MUNIT_UNLIKELY(munit_tmp_diff_ > 1e-##precision)) { \ + munit_errorf("assertion failed: %s == %s (%0." #precision \ + "g == %0." #precision "g)", \ + #a, #b, munit_tmp_a_, munit_tmp_b_); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#include +#define munit_assert_string_equal(a, b) \ + do { \ + const char *munit_tmp_a_ = a; \ + const char *munit_tmp_b_ = b; \ + if (MUNIT_UNLIKELY(strcmp(munit_tmp_a_, munit_tmp_b_) != 0)) { \ + munit_hexdump_diff(stderr, munit_tmp_a_, strlen(munit_tmp_a_), \ + munit_tmp_b_, strlen(munit_tmp_b_)); \ + munit_errorf("assertion failed: string %s == %s (\"%s\" == \"%s\")", #a, \ + #b, munit_tmp_a_, munit_tmp_b_); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#define munit_assert_string_not_equal(a, b) \ + do { \ + const char *munit_tmp_a_ = a; \ + const char *munit_tmp_b_ = b; \ + if (MUNIT_UNLIKELY(strcmp(munit_tmp_a_, munit_tmp_b_) == 0)) { \ + munit_errorf("assertion failed: string %s != %s (\"%s\" == \"%s\")", #a, \ + #b, munit_tmp_a_, munit_tmp_b_); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#define munit_assert_memory_equal(size, a, b) \ + do { \ + const unsigned char *munit_tmp_a_ = (const unsigned char *)(a); \ + const unsigned char *munit_tmp_b_ = (const unsigned char *)(b); \ + const size_t munit_tmp_size_ = (size); \ + if (MUNIT_UNLIKELY(memcmp(munit_tmp_a_, munit_tmp_b_, munit_tmp_size_)) != \ + 0) { \ + size_t munit_tmp_pos_; \ + for (munit_tmp_pos_ = 0; munit_tmp_pos_ < munit_tmp_size_; \ + munit_tmp_pos_++) { \ + if (munit_tmp_a_[munit_tmp_pos_] != munit_tmp_b_[munit_tmp_pos_]) { \ + munit_hexdump_diff(stderr, munit_tmp_a_, size, munit_tmp_b_, size); \ + munit_errorf("assertion failed: memory %s == %s, at offset " \ + "%" MUNIT_SIZE_MODIFIER "u", \ + #a, #b, munit_tmp_pos_); \ + break; \ + } \ + } \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#define munit_assert_memn_equal(a, a_size, b, b_size) \ + do { \ + const unsigned char *munit_tmp_a_ = (const unsigned char *)(a); \ + const unsigned char *munit_tmp_b_ = (const unsigned char *)(b); \ + const size_t munit_tmp_a_size_ = (a_size); \ + const size_t munit_tmp_b_size_ = (b_size); \ + if (MUNIT_UNLIKELY(munit_tmp_a_size_ != munit_tmp_b_size_) || \ + MUNIT_UNLIKELY(munit_tmp_a_size_ && memcmp(munit_tmp_a_, munit_tmp_b_, \ + munit_tmp_a_size_)) != 0) { \ + munit_hexdump_diff(stderr, munit_tmp_a_, munit_tmp_a_size_, \ + munit_tmp_b_, munit_tmp_b_size_); \ + munit_errorf("assertion failed: memory %s == %s", #a, #b); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#define munit_assert_memory_not_equal(size, a, b) \ + do { \ + const unsigned char *munit_tmp_a_ = (const unsigned char *)(a); \ + const unsigned char *munit_tmp_b_ = (const unsigned char *)(b); \ + const size_t munit_tmp_size_ = (size); \ + if (MUNIT_UNLIKELY(memcmp(munit_tmp_a_, munit_tmp_b_, munit_tmp_size_)) == \ + 0) { \ + munit_errorf("assertion failed: memory %s != %s (%zu bytes)", #a, #b, \ + munit_tmp_size_); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#define munit_assert_ptr_equal(a, b) munit_assert_ptr(a, ==, b) +#define munit_assert_ptr_not_equal(a, b) munit_assert_ptr(a, !=, b) +#define munit_assert_null(ptr) munit_assert_ptr(ptr, ==, NULL) +#define munit_assert_not_null(ptr) munit_assert_ptr(ptr, !=, NULL) +#define munit_assert_ptr_null(ptr) munit_assert_ptr(ptr, ==, NULL) +#define munit_assert_ptr_not_null(ptr) munit_assert_ptr(ptr, !=, NULL) + +/*** Memory allocation ***/ + +void *munit_malloc_ex(const char *filename, int line, size_t size); + +#define munit_malloc(size) munit_malloc_ex(__FILE__, __LINE__, (size)) + +#define munit_new(type) ((type *)munit_malloc(sizeof(type))) + +#define munit_calloc(nmemb, size) munit_malloc((nmemb) * (size)) + +#define munit_newa(type, nmemb) ((type *)munit_calloc((nmemb), sizeof(type))) + +/*** Random number generation ***/ + +void munit_rand_seed(munit_uint32_t seed); +munit_uint32_t munit_rand_uint32(void); +int munit_rand_int_range(int min, int max); +double munit_rand_double(void); +void munit_rand_memory(size_t size, munit_uint8_t *buffer); + +/*** Tests and Suites ***/ + +typedef enum { + /* Test successful */ + MUNIT_OK, + /* Test failed */ + MUNIT_FAIL, + /* Test was skipped */ + MUNIT_SKIP, + /* Test failed due to circumstances not intended to be tested + * (things like network errors, invalid parameter value, failure to + * allocate memory in the test harness, etc.). */ + MUNIT_ERROR +} MunitResult; + +typedef struct { + char *name; + char **values; +} MunitParameterEnum; + +typedef struct { + char *name; + char *value; +} MunitParameter; + +const char *munit_parameters_get(const MunitParameter params[], + const char *key); + +typedef enum { + MUNIT_TEST_OPTION_NONE = 0, + MUNIT_TEST_OPTION_SINGLE_ITERATION = 1 << 0, + MUNIT_TEST_OPTION_TODO = 1 << 1 +} MunitTestOptions; + +typedef MunitResult (*MunitTestFunc)(const MunitParameter params[], + void *user_data_or_fixture); +typedef void *(*MunitTestSetup)(const MunitParameter params[], void *user_data); +typedef void (*MunitTestTearDown)(void *fixture); + +typedef struct { + const char *name; + MunitTestFunc test; + MunitTestSetup setup; + MunitTestTearDown tear_down; + MunitTestOptions options; + MunitParameterEnum *parameters; +} MunitTest; + +typedef enum { MUNIT_SUITE_OPTION_NONE = 0 } MunitSuiteOptions; + +typedef struct MunitSuite_ MunitSuite; + +struct MunitSuite_ { + const char *prefix; + const MunitTest *tests; + const MunitSuite *suites; + unsigned int iterations; + MunitSuiteOptions options; +}; + +int munit_suite_main(const MunitSuite *suite, void *user_data, int argc, + char *const *argv); + +/* Note: I'm not very happy with this API; it's likely to change if I + * figure out something better. Suggestions welcome. */ + +typedef struct MunitArgument_ MunitArgument; + +struct MunitArgument_ { + char *name; + munit_bool (*parse_argument)(const MunitSuite *suite, void *user_data, + int *arg, int argc, char *const *argv); + void (*write_help)(const MunitArgument *argument, void *user_data); +}; + +int munit_suite_main_custom(const MunitSuite *suite, void *user_data, int argc, + char *const *argv, const MunitArgument arguments[]); + +#if defined(MUNIT_ENABLE_ASSERT_ALIASES) + +# define assert_true(expr) munit_assert_true(expr) +# define assert_false(expr) munit_assert_false(expr) +# define assert_char(a, op, b) munit_assert_char(a, op, b) +# define assert_uchar(a, op, b) munit_assert_uchar(a, op, b) +# define assert_short(a, op, b) munit_assert_short(a, op, b) +# define assert_ushort(a, op, b) munit_assert_ushort(a, op, b) +# define assert_int(a, op, b) munit_assert_int(a, op, b) +# define assert_uint(a, op, b) munit_assert_uint(a, op, b) +# define assert_long(a, op, b) munit_assert_long(a, op, b) +# define assert_ulong(a, op, b) munit_assert_ulong(a, op, b) +# define assert_llong(a, op, b) munit_assert_llong(a, op, b) +# define assert_ullong(a, op, b) munit_assert_ullong(a, op, b) +# define assert_size(a, op, b) munit_assert_size(a, op, b) +# define assert_ssize(a, op, b) munit_assert_ssize(a, op, b) +# define assert_float(a, op, b) munit_assert_float(a, op, b) +# define assert_double(a, op, b) munit_assert_double(a, op, b) +# define assert_ptr(a, op, b) munit_assert_ptr(a, op, b) + +# define assert_int8(a, op, b) munit_assert_int8(a, op, b) +# define assert_uint8(a, op, b) munit_assert_uint8(a, op, b) +# define assert_int16(a, op, b) munit_assert_int16(a, op, b) +# define assert_uint16(a, op, b) munit_assert_uint16(a, op, b) +# define assert_int32(a, op, b) munit_assert_int32(a, op, b) +# define assert_uint32(a, op, b) munit_assert_uint32(a, op, b) +# define assert_int64(a, op, b) munit_assert_int64(a, op, b) +# define assert_uint64(a, op, b) munit_assert_uint64(a, op, b) + +# define assert_ptrdiff(a, op, b) munit_assert_ptrdiff(a, op, b) + +# define assert_enum(T, a, op, b) munit_assert_enum(T, a, op, b) + +# define assert_double_equal(a, b, precision) \ + munit_assert_double_equal(a, b, precision) +# define assert_string_equal(a, b) munit_assert_string_equal(a, b) +# define assert_string_not_equal(a, b) munit_assert_string_not_equal(a, b) +# define assert_memory_equal(size, a, b) munit_assert_memory_equal(size, a, b) +# define assert_memn_equal(a, a_size, b, b_size) \ + munit_assert_memn_equal(a, a_size, b, b_size) +# define assert_memory_not_equal(size, a, b) \ + munit_assert_memory_not_equal(size, a, b) +# define assert_ptr_equal(a, b) munit_assert_ptr_equal(a, b) +# define assert_ptr_not_equal(a, b) munit_assert_ptr_not_equal(a, b) +# define assert_ptr_null(ptr) munit_assert_null_equal(ptr) +# define assert_ptr_not_null(ptr) munit_assert_not_null(ptr) + +# define assert_null(ptr) munit_assert_null(ptr) +# define assert_not_null(ptr) munit_assert_not_null(ptr) + +#endif /* defined(MUNIT_ENABLE_ASSERT_ALIASES) */ + +#define munit_void_test_decl(func) \ + void func(void); \ + \ + static inline MunitResult wrap_##func(const MunitParameter params[], \ + void *fixture) { \ + (void)params; \ + (void)fixture; \ + \ + func(); \ + return MUNIT_OK; \ + } + +#define munit_void_test(func) \ + {"/" #func, wrap_##func, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL} + +#define munit_test_end() {NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL} + +int munit_hexdump(FILE *fp, const void *data, size_t datalen); + +int munit_hexdump_diff(FILE *fp, const void *a, size_t alen, const void *b, + size_t blen); + +#if defined(__cplusplus) +} +#endif + +#endif /* !defined(MUNIT_H) */ + +#if defined(MUNIT_ENABLE_ASSERT_ALIASES) +#if defined(assert) +# undef assert +#endif +#define assert(expr) munit_assert(expr) +#endif diff --git a/lib/nghttp2-1.65.0/tests/munit/munitxx.h b/lib/nghttp2-1.65.0/tests/munit/munitxx.h new file mode 100644 index 00000000000..dd4478579b3 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/munit/munitxx.h @@ -0,0 +1,94 @@ +/* µnit Testing Framework + * Copyright (c) 2013-2017 Evan Nemerson + * Copyright (c) 2023 munit contributors + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef MUNITXX_H +#define MUNITXX_H + +#include + +#include +#include +#if __cplusplus >= 201703L +# include +#endif // __cplusplus >= 201703L + +#define munit_assert_stdstring_equal(a, b) \ + do { \ + const std::string munit_tmp_a_ = a; \ + const std::string munit_tmp_b_ = b; \ + if (MUNIT_UNLIKELY(munit_tmp_a_ != munit_tmp_b_)) { \ + munit_hexdump_diff(stderr, munit_tmp_a_.c_str(), munit_tmp_a_.size(), \ + munit_tmp_b_.c_str(), munit_tmp_b_.size()); \ + munit_errorf("assertion failed: string %s == %s (\"%s\" == \"%s\")", #a, \ + #b, munit_tmp_a_.c_str(), munit_tmp_b_.c_str()); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#if __cplusplus >= 201703L +# define munit_assert_stdsv_equal(a, b) \ + do { \ + const std::string_view munit_tmp_a_ = a; \ + const std::string_view munit_tmp_b_ = b; \ + if (MUNIT_UNLIKELY(munit_tmp_a_ != munit_tmp_b_)) { \ + munit_hexdump_diff(stderr, munit_tmp_a_.data(), munit_tmp_a_.size(), \ + munit_tmp_b_.data(), munit_tmp_b_.size()); \ + munit_errorf( \ + "assertion failed: string %s == %s (\"%.*s\" == \"%.*s\")", #a, #b, \ + (int)munit_tmp_a_.size(), munit_tmp_a_.data(), \ + (int)munit_tmp_b_.size(), munit_tmp_b_.data()); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ +#endif // __cplusplus >= 201703L + +#define munit_assert_enum_class(a, op, b) \ + do { \ + auto munit_tmp_a_ = (a); \ + auto munit_tmp_b_ = (b); \ + if (!(munit_tmp_a_ op munit_tmp_b_)) { \ + auto munit_tmp_a_str_ = std::to_string( \ + static_cast>( \ + munit_tmp_a_)); \ + auto munit_tmp_b_str_ = std::to_string( \ + static_cast>( \ + munit_tmp_b_)); \ + munit_errorf("assertion failed: %s %s %s (%s %s %s)", #a, #op, #b, \ + munit_tmp_a_str_.c_str(), #op, munit_tmp_b_str_.c_str()); \ + } \ + MUNIT_PUSH_DISABLE_MSVC_C4127_ \ + } while (0) MUNIT_POP_DISABLE_MSVC_C4127_ + +#if defined(MUNIT_ENABLE_ASSERT_ALIASES) + +# define assert_stdstring_equal(a, b) munit_assert_stdstring_equal(a, b) +# if __cplusplus >= 201703L +# define assert_stdsv_equal(a, b) munit_assert_stdsv_equal(a, b) +# endif // __cplusplus >= 201703L +# define assert_enum_class(a, op, b) munit_assert_enum_class(a, op, b) + +#endif /* defined(MUNIT_ENABLE_ASSERT_ALIASES) */ + +#endif // MUNITXX_H diff --git a/lib/nghttp2-1.65.0/tests/nghttp2_alpn_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_alpn_test.c new file mode 100644 index 00000000000..da4aa63d243 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/nghttp2_alpn_test.c @@ -0,0 +1,108 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Twist Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_alpn_test.h" + +#include +#include + +#include "munit.h" + +#include + +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_alpn), + munit_test_end(), +}; + +const MunitSuite alpn_suite = { + "/alpn", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + +static void http2(void) { + const unsigned char p[] = {8, 'h', 't', 't', 'p', '/', '1', '.', '1', 2, + 'h', '2', 6, 's', 'p', 'd', 'y', '/', '3'}; + unsigned char outlen; + const unsigned char *out; + assert_int(1, ==, + nghttp2_select_next_protocol((unsigned char **)&out, &outlen, p, + sizeof(p))); + assert_uchar(NGHTTP2_PROTO_VERSION_ID_LEN, ==, outlen); + assert_memory_equal(outlen, NGHTTP2_PROTO_VERSION_ID, out); + + outlen = 0; + out = NULL; + + assert_int(1, ==, nghttp2_select_alpn(&out, &outlen, p, sizeof(p))); + assert_uchar(NGHTTP2_PROTO_VERSION_ID_LEN, ==, outlen); + assert_memory_equal(outlen, NGHTTP2_PROTO_VERSION_ID, out); +} + +static void http11(void) { + const unsigned char spdy[] = { + 6, 's', 'p', 'd', 'y', '/', '4', 8, 's', 'p', 'd', 'y', '/', + '2', '.', '1', 8, 'h', 't', 't', 'p', '/', '1', '.', '1', + }; + unsigned char outlen; + const unsigned char *out; + assert_int(0, ==, + nghttp2_select_next_protocol((unsigned char **)&out, &outlen, spdy, + sizeof(spdy))); + assert_uchar(8, ==, outlen); + assert_memory_equal(outlen, "http/1.1", out); + + outlen = 0; + out = NULL; + + assert_int(0, ==, nghttp2_select_alpn(&out, &outlen, spdy, sizeof(spdy))); + assert_uchar(8, ==, outlen); + assert_memory_equal(outlen, "http/1.1", out); +} + +static void no_overlap(void) { + const unsigned char spdy[] = { + 6, 's', 'p', 'd', 'y', '/', '4', 8, 's', 'p', 'd', 'y', '/', + '2', '.', '1', 8, 'h', 't', 't', 'p', '/', '1', '.', '0', + }; + unsigned char outlen = 0; + const unsigned char *out = NULL; + assert_int(-1, ==, + nghttp2_select_next_protocol((unsigned char **)&out, &outlen, spdy, + sizeof(spdy))); + assert_uchar(0, ==, outlen); + assert_null(out); + + outlen = 0; + out = NULL; + + assert_int(-1, ==, nghttp2_select_alpn(&out, &outlen, spdy, sizeof(spdy))); + assert_uchar(0, ==, outlen); + assert_null(out); +} + +void test_nghttp2_alpn(void) { + http2(); + http11(); + no_overlap(); +} diff --git a/lib/nghttp2/tests/nghttp2_npn_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_alpn_test.h similarity index 84% rename from lib/nghttp2/tests/nghttp2_npn_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_alpn_test.h index f1c97631f1e..c594125cf7c 100644 --- a/lib/nghttp2/tests/nghttp2_npn_test.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_alpn_test.h @@ -22,13 +22,19 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef NGHTTP2_NPN_TEST_H -#define NGHTTP2_NPN_TEST_H +#ifndef NGHTTP2_ALPN_TEST_H +#define NGHTTP2_ALPN_TEST_H #ifdef HAVE_CONFIG_H # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_npn(void); +#define MUNIT_ENABLE_ASSERT_ALIASES -#endif /* NGHTTP2_NPN_TEST_H */ +#include "munit.h" + +extern const MunitSuite alpn_suite; + +munit_void_test_decl(test_nghttp2_alpn) + +#endif /* NGHTTP2_ALPN_TEST_H */ diff --git a/lib/nghttp2-1.65.0/tests/nghttp2_assertion.h b/lib/nghttp2-1.65.0/tests/nghttp2_assertion.h new file mode 100644 index 00000000000..28d69291405 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/nghttp2_assertion.h @@ -0,0 +1,56 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2024 nghttp2 contributors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_ASSERTION_H +#define NGHTTP2_ASSERTION_H + +#ifdef HAVE_CONFIG_H +# include +#endif /* HAVE_CONFIG_H */ + +#include "munit.h" + +#include "nghttp2_frame.h" + +#define assert_nv_equal(A, B, len, mem) \ + do { \ + size_t alloclen = sizeof(nghttp2_nv) * (len); \ + const nghttp2_nv *sa = (A), *sb = (B); \ + nghttp2_nv *a = (mem)->malloc(alloclen, NULL); \ + nghttp2_nv *b = (mem)->malloc(alloclen, NULL); \ + size_t i_; \ + memcpy(a, sa, alloclen); \ + memcpy(b, sb, alloclen); \ + nghttp2_nv_array_sort(a, (len)); \ + nghttp2_nv_array_sort(b, (len)); \ + for (i_ = 0; i_ < (size_t)(len); ++i_) { \ + assert_memn_equal(a[i_].name, a[i_].namelen, b[i_].name, b[i_].namelen); \ + assert_memn_equal(a[i_].value, a[i_].valuelen, b[i_].value, \ + b[i_].valuelen); \ + } \ + (mem)->free(b, NULL); \ + (mem)->free(a, NULL); \ + } while (0); + +#endif /* NGHTTP2_ASSERTION_H */ diff --git a/lib/nghttp2/tests/nghttp2_buf_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_buf_test.c similarity index 54% rename from lib/nghttp2/tests/nghttp2_buf_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_buf_test.c index e3e8a14a5b6..91649f7e8f1 100644 --- a/lib/nghttp2/tests/nghttp2_buf_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_buf_test.c @@ -26,11 +26,28 @@ #include -#include +#include "munit.h" #include "nghttp2_buf.h" #include "nghttp2_test_helper.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_bufs_add), + munit_void_test(test_nghttp2_bufs_add_stack_buffer_overflow_bug), + munit_void_test(test_nghttp2_bufs_addb), + munit_void_test(test_nghttp2_bufs_orb), + munit_void_test(test_nghttp2_bufs_remove), + munit_void_test(test_nghttp2_bufs_reset), + munit_void_test(test_nghttp2_bufs_advance), + munit_void_test(test_nghttp2_bufs_next_present), + munit_void_test(test_nghttp2_bufs_realloc), + munit_test_end(), +}; + +const MunitSuite buf_suite = { + "/buf", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + void test_nghttp2_bufs_add(void) { int rv; nghttp2_bufs bufs; @@ -40,27 +57,27 @@ void test_nghttp2_bufs_add(void) { mem = nghttp2_mem_default(); rv = nghttp2_bufs_init(&bufs, 1000, 3, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - CU_ASSERT(bufs.cur->buf.pos == bufs.cur->buf.last); + assert_ptr_equal(bufs.cur->buf.pos, bufs.cur->buf.last); rv = nghttp2_bufs_add(&bufs, data, 493); - CU_ASSERT(0 == rv); - CU_ASSERT(493 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(493 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(507 == nghttp2_bufs_cur_avail(&bufs)); + assert_int(0, ==, rv); + assert_size(493, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(493, ==, nghttp2_bufs_len(&bufs)); + assert_size(507, ==, nghttp2_bufs_cur_avail(&bufs)); rv = nghttp2_bufs_add(&bufs, data, 507); - CU_ASSERT(0 == rv); - CU_ASSERT(1000 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(1000 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(bufs.cur == bufs.head); + assert_int(0, ==, rv); + assert_size(1000, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(1000, ==, nghttp2_bufs_len(&bufs)); + assert_ptr_equal(bufs.cur, bufs.head); rv = nghttp2_bufs_add(&bufs, data, 1); - CU_ASSERT(0 == rv); - CU_ASSERT(1 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(1001 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(bufs.cur == bufs.head->next); + assert_int(0, ==, rv); + assert_size(1, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(1001, ==, nghttp2_bufs_len(&bufs)); + assert_ptr_equal(bufs.cur, bufs.head->next); nghttp2_bufs_free(&bufs); } @@ -75,12 +92,12 @@ void test_nghttp2_bufs_add_stack_buffer_overflow_bug(void) { mem = nghttp2_mem_default(); rv = nghttp2_bufs_init(&bufs, 100, 200, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); rv = nghttp2_bufs_add(&bufs, data, sizeof(data)); - CU_ASSERT(0 == rv); - CU_ASSERT(sizeof(data) == nghttp2_bufs_len(&bufs)); + assert_int(0, ==, rv); + assert_size(sizeof(data), ==, nghttp2_bufs_len(&bufs)); nghttp2_bufs_free(&bufs); } @@ -88,65 +105,65 @@ void test_nghttp2_bufs_add_stack_buffer_overflow_bug(void) { void test_nghttp2_bufs_addb(void) { int rv; nghttp2_bufs bufs; - ssize_t i; + size_t i; nghttp2_mem *mem; mem = nghttp2_mem_default(); rv = nghttp2_bufs_init(&bufs, 1000, 3, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); rv = nghttp2_bufs_addb(&bufs, 14); - CU_ASSERT(0 == rv); - CU_ASSERT(1 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(1 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(14 == *bufs.cur->buf.pos); + assert_int(0, ==, rv); + assert_size(1, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(1, ==, nghttp2_bufs_len(&bufs)); + assert_uint8(14, ==, *bufs.cur->buf.pos); for (i = 0; i < 999; ++i) { rv = nghttp2_bufs_addb(&bufs, 254); - CU_ASSERT(0 == rv); - CU_ASSERT((size_t)(i + 2) == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT((size_t)(i + 2) == nghttp2_bufs_len(&bufs)); - CU_ASSERT(254 == *(bufs.cur->buf.last - 1)); - CU_ASSERT(bufs.cur == bufs.head); + assert_int(0, ==, rv); + assert_size(i + 2, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(i + 2, ==, nghttp2_bufs_len(&bufs)); + assert_uint8(254, ==, *(bufs.cur->buf.last - 1)); + assert_ptr_equal(bufs.cur, bufs.head); } rv = nghttp2_bufs_addb(&bufs, 253); - CU_ASSERT(0 == rv); - CU_ASSERT(1 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(1001 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(253 == *(bufs.cur->buf.last - 1)); - CU_ASSERT(bufs.cur == bufs.head->next); + assert_int(0, ==, rv); + assert_size(1, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(1001, ==, nghttp2_bufs_len(&bufs)); + assert_uint8(253, ==, *(bufs.cur->buf.last - 1)); + assert_ptr_equal(bufs.cur, bufs.head->next); rv = nghttp2_bufs_addb_hold(&bufs, 15); - CU_ASSERT(0 == rv); - CU_ASSERT(1 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(1001 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(15 == *(bufs.cur->buf.last)); + assert_int(0, ==, rv); + assert_size(1, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(1001, ==, nghttp2_bufs_len(&bufs)); + assert_uint8(15, ==, *(bufs.cur->buf.last)); /* test fast version */ nghttp2_bufs_fast_addb(&bufs, 240); - CU_ASSERT(2 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(1002 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(240 == *(bufs.cur->buf.last - 1)); + assert_size(2, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(1002, ==, nghttp2_bufs_len(&bufs)); + assert_uint8(240, ==, *(bufs.cur->buf.last - 1)); nghttp2_bufs_fast_addb_hold(&bufs, 113); - CU_ASSERT(2 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(1002 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(113 == *(bufs.cur->buf.last)); + assert_size(2, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(1002, ==, nghttp2_bufs_len(&bufs)); + assert_uint8(113, ==, *(bufs.cur->buf.last)); /* addb_hold when last == end */ bufs.cur->buf.last = bufs.cur->buf.end; rv = nghttp2_bufs_addb_hold(&bufs, 19); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(2000 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(19 == *(bufs.cur->buf.last)); + assert_int(0, ==, rv); + assert_size(0, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(2000, ==, nghttp2_bufs_len(&bufs)); + assert_uint8(19, ==, *(bufs.cur->buf.last)); nghttp2_bufs_free(&bufs); } @@ -159,28 +176,28 @@ void test_nghttp2_bufs_orb(void) { mem = nghttp2_mem_default(); rv = nghttp2_bufs_init(&bufs, 1000, 3, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); *(bufs.cur->buf.last) = 0; rv = nghttp2_bufs_orb_hold(&bufs, 15); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(0 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(15 == *(bufs.cur->buf.last)); + assert_int(0, ==, rv); + assert_size(0, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(0, ==, nghttp2_bufs_len(&bufs)); + assert_uint8(15, ==, *(bufs.cur->buf.last)); rv = nghttp2_bufs_orb(&bufs, 240); - CU_ASSERT(0 == rv); - CU_ASSERT(1 == nghttp2_buf_len(&bufs.cur->buf)); - CU_ASSERT(1 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(255 == *(bufs.cur->buf.last - 1)); + assert_int(0, ==, rv); + assert_size(1, ==, nghttp2_buf_len(&bufs.cur->buf)); + assert_size(1, ==, nghttp2_bufs_len(&bufs)); + assert_uint8(255, ==, *(bufs.cur->buf.last - 1)); *(bufs.cur->buf.last) = 0; nghttp2_bufs_fast_orb_hold(&bufs, 240); - CU_ASSERT(240 == *(bufs.cur->buf.last)); + assert_uint8(240, ==, *(bufs.cur->buf.last)); nghttp2_bufs_fast_orb(&bufs, 15); - CU_ASSERT(255 == *(bufs.cur->buf.last - 1)); + assert_uint8(255, ==, *(bufs.cur->buf.last - 1)); nghttp2_bufs_free(&bufs); } @@ -191,36 +208,36 @@ void test_nghttp2_bufs_remove(void) { nghttp2_buf_chain *chain; int i; uint8_t *out; - ssize_t outlen; + nghttp2_ssize outlen; nghttp2_mem *mem; mem = nghttp2_mem_default(); rv = nghttp2_bufs_init(&bufs, 1000, 3, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); nghttp2_buf_shift_right(&bufs.cur->buf, 10); rv = nghttp2_bufs_add(&bufs, "hello ", 6); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); for (i = 0; i < 2; ++i) { chain = bufs.cur; rv = nghttp2_bufs_advance(&bufs); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - CU_ASSERT(chain->next == bufs.cur); + assert_ptr_equal(chain->next, bufs.cur); } rv = nghttp2_bufs_add(&bufs, "world", 5); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); outlen = nghttp2_bufs_remove(&bufs, &out); - CU_ASSERT(11 == outlen); + assert_ptrdiff(11, ==, outlen); - CU_ASSERT(0 == memcmp("hello world", out, (size_t)outlen)); - CU_ASSERT(11 == nghttp2_bufs_len(&bufs)); + assert_memory_equal((size_t)outlen, "hello world", out); + assert_size(11, ==, nghttp2_bufs_len(&bufs)); mem->free(out, NULL); nghttp2_bufs_free(&bufs); @@ -236,30 +253,30 @@ void test_nghttp2_bufs_reset(void) { mem = nghttp2_mem_default(); rv = nghttp2_bufs_init3(&bufs, 250, 3, 1, offset, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); rv = nghttp2_bufs_add(&bufs, "foo", 3); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); rv = nghttp2_bufs_advance(&bufs); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); rv = nghttp2_bufs_add(&bufs, "bar", 3); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - CU_ASSERT(6 == nghttp2_bufs_len(&bufs)); + assert_size(6, ==, nghttp2_bufs_len(&bufs)); nghttp2_bufs_reset(&bufs); - CU_ASSERT(0 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(bufs.cur == bufs.head); + assert_size(0, ==, nghttp2_bufs_len(&bufs)); + assert_ptr_equal(bufs.cur, bufs.head); for (ci = bufs.head; ci; ci = ci->next) { - CU_ASSERT((ssize_t)offset == ci->buf.pos - ci->buf.begin); - CU_ASSERT(ci->buf.pos == ci->buf.last); + assert_ptrdiff((ptrdiff_t)offset, ==, ci->buf.pos - ci->buf.begin); + assert_ptr_equal(ci->buf.pos, ci->buf.last); } - CU_ASSERT(bufs.head->next == NULL); + assert_null(bufs.head->next); nghttp2_bufs_free(&bufs); } @@ -273,15 +290,15 @@ void test_nghttp2_bufs_advance(void) { mem = nghttp2_mem_default(); rv = nghttp2_bufs_init(&bufs, 250, 3, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); for (i = 0; i < 2; ++i) { rv = nghttp2_bufs_advance(&bufs); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); } rv = nghttp2_bufs_advance(&bufs); - CU_ASSERT(NGHTTP2_ERR_BUFFER_ERROR == rv); + assert_int(NGHTTP2_ERR_BUFFER_ERROR, ==, rv); nghttp2_bufs_free(&bufs); } @@ -294,25 +311,25 @@ void test_nghttp2_bufs_next_present(void) { mem = nghttp2_mem_default(); rv = nghttp2_bufs_init(&bufs, 250, 3, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - CU_ASSERT(0 == nghttp2_bufs_next_present(&bufs)); + assert_false(nghttp2_bufs_next_present(&bufs)); rv = nghttp2_bufs_advance(&bufs); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); nghttp2_bufs_rewind(&bufs); - CU_ASSERT(0 == nghttp2_bufs_next_present(&bufs)); + assert_false(nghttp2_bufs_next_present(&bufs)); bufs.cur = bufs.head->next; rv = nghttp2_bufs_addb(&bufs, 1); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); nghttp2_bufs_rewind(&bufs); - CU_ASSERT(0 != nghttp2_bufs_next_present(&bufs)); + assert_true(nghttp2_bufs_next_present(&bufs)); nghttp2_bufs_free(&bufs); } @@ -325,20 +342,20 @@ void test_nghttp2_bufs_realloc(void) { mem = nghttp2_mem_default(); rv = nghttp2_bufs_init3(&bufs, 266, 3, 1, 10, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); /* Create new buffer to see that these buffers are deallocated on realloc */ rv = nghttp2_bufs_advance(&bufs); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); rv = nghttp2_bufs_realloc(&bufs, 522); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - CU_ASSERT(512 == nghttp2_bufs_cur_avail(&bufs)); + assert_size(512, ==, nghttp2_bufs_cur_avail(&bufs)); rv = nghttp2_bufs_realloc(&bufs, 9); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); nghttp2_bufs_free(&bufs); } diff --git a/lib/nghttp2-1.65.0/tests/nghttp2_buf_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_buf_test.h new file mode 100644 index 00000000000..71acf9670ef --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/nghttp2_buf_test.h @@ -0,0 +1,48 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2014 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_BUF_TEST_H +#define NGHTTP2_BUF_TEST_H + +#ifdef HAVE_CONFIG_H +# include +#endif /* HAVE_CONFIG_H */ + +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite buf_suite; + +munit_void_test_decl(test_nghttp2_bufs_add) +munit_void_test_decl(test_nghttp2_bufs_add_stack_buffer_overflow_bug) +munit_void_test_decl(test_nghttp2_bufs_addb) +munit_void_test_decl(test_nghttp2_bufs_orb) +munit_void_test_decl(test_nghttp2_bufs_remove) +munit_void_test_decl(test_nghttp2_bufs_reset) +munit_void_test_decl(test_nghttp2_bufs_advance) +munit_void_test_decl(test_nghttp2_bufs_next_present) +munit_void_test_decl(test_nghttp2_bufs_realloc) + +#endif /* NGHTTP2_BUF_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_extpri_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_extpri_test.c similarity index 76% rename from lib/nghttp2/tests/nghttp2_extpri_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_extpri_test.c index 0ef59b7428b..1eca0a9c689 100644 --- a/lib/nghttp2/tests/nghttp2_extpri_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_extpri_test.c @@ -27,26 +27,35 @@ #include -#include +#include "munit.h" #include "nghttp2_extpri.h" #include "nghttp2_test_helper.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_extpri_to_uint8), + munit_test_end(), +}; + +const MunitSuite extpri_suite = { + "/extpri", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + void test_nghttp2_extpri_to_uint8(void) { { nghttp2_extpri pri = {1, 0}; - CU_ASSERT(1 == nghttp2_extpri_to_uint8(&pri)); + assert_uint8(1, ==, nghttp2_extpri_to_uint8(&pri)); } { nghttp2_extpri pri = {1, 1}; - CU_ASSERT((0x80 | 1) == nghttp2_extpri_to_uint8(&pri)); + assert_uint8((0x80 | 1), ==, nghttp2_extpri_to_uint8(&pri)); } { nghttp2_extpri pri = {7, 1}; - CU_ASSERT((0x80 | 7) == nghttp2_extpri_to_uint8(&pri)); + assert_uint8((0x80 | 7), ==, nghttp2_extpri_to_uint8(&pri)); } { nghttp2_extpri pri = {7, 0}; - CU_ASSERT(7 == nghttp2_extpri_to_uint8(&pri)); + assert_uint8(7, ==, nghttp2_extpri_to_uint8(&pri)); } } diff --git a/lib/nghttp2/tests/nghttp2_extpri_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_extpri_test.h similarity index 90% rename from lib/nghttp2/tests/nghttp2_extpri_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_extpri_test.h index a8a93b92d98..73f9a995d79 100644 --- a/lib/nghttp2/tests/nghttp2_extpri_test.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_extpri_test.h @@ -30,6 +30,12 @@ # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_extpri_to_uint8(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite extpri_suite; + +munit_void_test_decl(test_nghttp2_extpri_to_uint8) #endif /* NGHTTP2_EXTPRI_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_frame_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_frame_test.c similarity index 67% rename from lib/nghttp2/tests/nghttp2_frame_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_frame_test.c index 7ce98dd045c..bda96b97b36 100644 --- a/lib/nghttp2/tests/nghttp2_frame_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_frame_test.c @@ -27,13 +27,35 @@ #include #include -#include +#include "munit.h" #include "nghttp2_frame.h" #include "nghttp2_helper.h" #include "nghttp2_test_helper.h" #include "nghttp2_priority_spec.h" +static MunitTest tests[] = { + munit_void_test(test_nghttp2_frame_pack_headers), + munit_void_test(test_nghttp2_frame_pack_headers_frame_too_large), + munit_void_test(test_nghttp2_frame_pack_priority), + munit_void_test(test_nghttp2_frame_pack_rst_stream), + munit_void_test(test_nghttp2_frame_pack_settings), + munit_void_test(test_nghttp2_frame_pack_push_promise), + munit_void_test(test_nghttp2_frame_pack_ping), + munit_void_test(test_nghttp2_frame_pack_goaway), + munit_void_test(test_nghttp2_frame_pack_window_update), + munit_void_test(test_nghttp2_frame_pack_altsvc), + munit_void_test(test_nghttp2_frame_pack_origin), + munit_void_test(test_nghttp2_frame_pack_priority_update), + munit_void_test(test_nghttp2_nv_array_copy), + munit_void_test(test_nghttp2_iv_check), + munit_test_end(), +}; + +const MunitSuite frame_suite = { + "/frame", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + static nghttp2_nv make_nv(const char *name, const char *value) { nghttp2_nv nv; nv.name = (uint8_t *)name; @@ -61,11 +83,11 @@ static nghttp2_nv *headers(nghttp2_mem *mem) { static void check_frame_header(size_t length, uint8_t type, uint8_t flags, int32_t stream_id, nghttp2_frame_hd *hd) { - CU_ASSERT(length == hd->length); - CU_ASSERT(type == hd->type); - CU_ASSERT(flags == hd->flags); - CU_ASSERT(stream_id == hd->stream_id); - CU_ASSERT(0 == hd->reserved); + assert_size(length, ==, hd->length); + assert_uint8(type, ==, hd->type); + assert_uint8(flags, ==, hd->flags); + assert_int32(stream_id, ==, hd->stream_id); + assert_uint8(0, ==, hd->reserved); } void test_nghttp2_frame_pack_headers(void) { @@ -94,30 +116,29 @@ void test_nghttp2_frame_pack_headers(void) { nghttp2_priority_spec_default_init(&pri_spec); nghttp2_frame_headers_init( - &frame, NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS, 1000000007, - NGHTTP2_HCAT_REQUEST, &pri_spec, nva, nvlen); + &frame, NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS, 1000000007, + NGHTTP2_HCAT_REQUEST, &pri_spec, nva, nvlen); rv = nghttp2_frame_pack_headers(&bufs, &frame, &deflater); nghttp2_bufs_rewind(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_int(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); - check_frame_header(nghttp2_bufs_len(&bufs) - NGHTTP2_FRAME_HDLEN, - NGHTTP2_HEADERS, - NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS, - 1000000007, &oframe.hd); + check_frame_header( + nghttp2_bufs_len(&bufs) - NGHTTP2_FRAME_HDLEN, NGHTTP2_HEADERS, + NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS, 1000000007, &oframe.hd); /* We did not include PRIORITY flag */ - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == oframe.pri_spec.weight); + assert_int32(NGHTTP2_DEFAULT_WEIGHT, ==, oframe.pri_spec.weight); hdblocklen = nghttp2_bufs_len(&bufs) - NGHTTP2_FRAME_HDLEN; - CU_ASSERT((ssize_t)hdblocklen == - inflate_hd(&inflater, &out, &bufs, NGHTTP2_FRAME_HDLEN, mem)); + assert_ptrdiff((nghttp2_ssize)hdblocklen, ==, + inflate_hd(&inflater, &out, &bufs, NGHTTP2_FRAME_HDLEN, mem)); - CU_ASSERT(7 == out.nvlen); - CU_ASSERT(nvnameeq("method", &out.nva[0])); - CU_ASSERT(nvvalueeq("GET", &out.nva[0])); + assert_size(7, ==, out.nvlen); + assert_true(nvnameeq("method", &out.nva[0])); + assert_true(nvvalueeq("GET", &out.nva[0])); nghttp2_frame_headers_free(&oframe, mem); nva_out_reset(&out, mem); @@ -130,30 +151,29 @@ void test_nghttp2_frame_pack_headers(void) { rv = nghttp2_frame_pack_headers(&bufs, &frame, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_int(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); - check_frame_header(nghttp2_bufs_len(&bufs) - NGHTTP2_FRAME_HDLEN, - NGHTTP2_HEADERS, - NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS | - NGHTTP2_FLAG_PRIORITY, - 1000000007, &oframe.hd); + check_frame_header( + nghttp2_bufs_len(&bufs) - NGHTTP2_FRAME_HDLEN, NGHTTP2_HEADERS, + NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, + 1000000007, &oframe.hd); - CU_ASSERT(1000000009 == oframe.pri_spec.stream_id); - CU_ASSERT(12 == oframe.pri_spec.weight); - CU_ASSERT(1 == oframe.pri_spec.exclusive); + assert_int32(1000000009, ==, oframe.pri_spec.stream_id); + assert_int32(12, ==, oframe.pri_spec.weight); + assert_true(oframe.pri_spec.exclusive); hdblocklen = nghttp2_bufs_len(&bufs) - NGHTTP2_FRAME_HDLEN - nghttp2_frame_priority_len(oframe.hd.flags); - CU_ASSERT((ssize_t)hdblocklen == - inflate_hd(&inflater, &out, &bufs, - NGHTTP2_FRAME_HDLEN + - nghttp2_frame_priority_len(oframe.hd.flags), - mem)); + assert_ptrdiff((nghttp2_ssize)hdblocklen, ==, + inflate_hd(&inflater, &out, &bufs, + NGHTTP2_FRAME_HDLEN + + nghttp2_frame_priority_len(oframe.hd.flags), + mem)); nghttp2_nv_array_sort(out.nva, out.nvlen); - CU_ASSERT(nvnameeq("method", &out.nva[0])); + assert_true(nvnameeq("method", &out.nva[0])); nghttp2_frame_headers_free(&oframe, mem); nva_out_reset(&out, mem); @@ -193,10 +213,10 @@ void test_nghttp2_frame_pack_headers_frame_too_large(void) { nghttp2_nv_array_copy(&nva, big_hds, big_hdslen, mem); nghttp2_hd_deflate_init(&deflater, mem); nghttp2_frame_headers_init( - &frame, NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS, 1000000007, - NGHTTP2_HCAT_REQUEST, NULL, nva, big_hdslen); + &frame, NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS, 1000000007, + NGHTTP2_HCAT_REQUEST, NULL, nva, big_hdslen); rv = nghttp2_frame_pack_headers(&bufs, &frame, &deflater); - CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == rv); + assert_int(NGHTTP2_ERR_HEADER_COMP, ==, rv); nghttp2_frame_headers_free(&frame, mem); nghttp2_bufs_free(&bufs); @@ -219,14 +239,14 @@ void test_nghttp2_frame_pack_priority(void) { nghttp2_frame_priority_init(&frame, 1000000007, &pri_spec); nghttp2_frame_pack_priority(&bufs, &frame); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 5 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_size(NGHTTP2_FRAME_HDLEN + 5, ==, nghttp2_bufs_len(&bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); check_frame_header(5, NGHTTP2_PRIORITY, NGHTTP2_FLAG_NONE, 1000000007, &oframe.hd); - CU_ASSERT(1000000009 == oframe.pri_spec.stream_id); - CU_ASSERT(12 == oframe.pri_spec.weight); - CU_ASSERT(1 == oframe.pri_spec.exclusive); + assert_int32(1000000009, ==, oframe.pri_spec.stream_id); + assert_int32(12, ==, oframe.pri_spec.weight); + assert_true(oframe.pri_spec.exclusive); nghttp2_frame_priority_free(&oframe); nghttp2_bufs_reset(&bufs); @@ -244,11 +264,11 @@ void test_nghttp2_frame_pack_rst_stream(void) { nghttp2_frame_rst_stream_init(&frame, 1000000007, NGHTTP2_PROTOCOL_ERROR); nghttp2_frame_pack_rst_stream(&bufs, &frame); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_size(NGHTTP2_FRAME_HDLEN + 4, ==, nghttp2_bufs_len(&bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); check_frame_header(4, NGHTTP2_RST_STREAM, NGHTTP2_FLAG_NONE, 1000000007, &oframe.hd); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == oframe.error_code); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, oframe.error_code); nghttp2_frame_rst_stream_free(&oframe); nghttp2_bufs_reset(&bufs); @@ -257,12 +277,12 @@ void test_nghttp2_frame_pack_rst_stream(void) { frame.error_code = 1000000009; nghttp2_frame_pack_rst_stream(&bufs, &frame); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); check_frame_header(4, NGHTTP2_RST_STREAM, NGHTTP2_FLAG_NONE, 1000000007, &oframe.hd); - CU_ASSERT(1000000009 == oframe.error_code); + assert_uint32(1000000009, ==, oframe.error_code); nghttp2_frame_rst_stream_free(&oframe); @@ -288,17 +308,17 @@ void test_nghttp2_frame_pack_settings(void) { nghttp2_frame_iv_copy(iv, 3, mem), 3); rv = nghttp2_frame_pack_settings(&bufs, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 3 * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH == - nghttp2_bufs_len(&bufs)); + assert_int(0, ==, rv); + assert_size(NGHTTP2_FRAME_HDLEN + 3 * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH, ==, + nghttp2_bufs_len(&bufs)); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); check_frame_header(3 * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH, NGHTTP2_SETTINGS, NGHTTP2_FLAG_NONE, 0, &oframe.hd); - CU_ASSERT(3 == oframe.niv); + assert_size(3, ==, oframe.niv); for (i = 0; i < 3; ++i) { - CU_ASSERT(iv[i].settings_id == oframe.iv[i].settings_id); - CU_ASSERT(iv[i].value == oframe.iv[i].value); + assert_int32(iv[i].settings_id, ==, oframe.iv[i].settings_id); + assert_uint32(iv[i].value, ==, oframe.iv[i].value); } nghttp2_bufs_free(&bufs); @@ -331,22 +351,23 @@ void test_nghttp2_frame_pack_push_promise(void) { (1U << 31) - 1, nva, nvlen); rv = nghttp2_frame_pack_push_promise(&bufs, &frame, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_int(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); check_frame_header(nghttp2_bufs_len(&bufs) - NGHTTP2_FRAME_HDLEN, NGHTTP2_PUSH_PROMISE, NGHTTP2_FLAG_END_HEADERS, 1000000007, &oframe.hd); - CU_ASSERT((1U << 31) - 1 == oframe.promised_stream_id); + assert_int32((1U << 31) - 1, ==, oframe.promised_stream_id); hdblocklen = nghttp2_bufs_len(&bufs) - NGHTTP2_FRAME_HDLEN - 4; - CU_ASSERT((ssize_t)hdblocklen == - inflate_hd(&inflater, &out, &bufs, NGHTTP2_FRAME_HDLEN + 4, mem)); + assert_ptrdiff( + (nghttp2_ssize)hdblocklen, ==, + inflate_hd(&inflater, &out, &bufs, NGHTTP2_FRAME_HDLEN + 4, mem)); - CU_ASSERT(7 == out.nvlen); - CU_ASSERT(nvnameeq("method", &out.nva[0])); - CU_ASSERT(nvvalueeq("GET", &out.nva[0])); + assert_size(7, ==, out.nvlen); + assert_true(nvnameeq("method", &out.nva[0])); + assert_true(nvvalueeq("GET", &out.nva[0])); nva_out_reset(&out, mem); nghttp2_bufs_free(&bufs); @@ -366,11 +387,10 @@ void test_nghttp2_frame_pack_ping(void) { nghttp2_frame_ping_init(&frame, NGHTTP2_FLAG_ACK, opaque_data); nghttp2_frame_pack_ping(&bufs, &frame); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 8 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_size(NGHTTP2_FRAME_HDLEN + 8, ==, nghttp2_bufs_len(&bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); check_frame_header(8, NGHTTP2_PING, NGHTTP2_FLAG_ACK, 0, &oframe.hd); - CU_ASSERT(memcmp(opaque_data, oframe.opaque_data, sizeof(opaque_data) - 1) == - 0); + assert_memory_equal(sizeof(opaque_data) - 1, opaque_data, oframe.opaque_data); nghttp2_bufs_free(&bufs); nghttp2_frame_ping_free(&oframe); @@ -394,16 +414,16 @@ void test_nghttp2_frame_pack_goaway(void) { opaque_data, opaque_data_len); rv = nghttp2_frame_pack_goaway(&bufs, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 8 + opaque_data_len == - nghttp2_bufs_len(&bufs)); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_int(0, ==, rv); + assert_size(NGHTTP2_FRAME_HDLEN + 8 + opaque_data_len, ==, + nghttp2_bufs_len(&bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); check_frame_header(24, NGHTTP2_GOAWAY, NGHTTP2_FLAG_NONE, 0, &oframe.hd); - CU_ASSERT(1000000007 == oframe.last_stream_id); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == oframe.error_code); + assert_int32(1000000007, ==, oframe.last_stream_id); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, oframe.error_code); - CU_ASSERT(opaque_data_len == oframe.opaque_data_len); - CU_ASSERT(memcmp(opaque_data, oframe.opaque_data, opaque_data_len) == 0); + assert_size(opaque_data_len, ==, oframe.opaque_data_len); + assert_memory_equal(opaque_data_len, opaque_data, oframe.opaque_data); nghttp2_frame_goaway_free(&oframe, mem); nghttp2_bufs_reset(&bufs); @@ -413,10 +433,10 @@ void test_nghttp2_frame_pack_goaway(void) { rv = nghttp2_frame_pack_goaway(&bufs, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_int(0, ==, rv); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); check_frame_header(24, NGHTTP2_GOAWAY, NGHTTP2_FLAG_NONE, 0, &oframe.hd); - CU_ASSERT(1000000009 == oframe.error_code); + assert_uint32(1000000009, ==, oframe.error_code); nghttp2_frame_goaway_free(&oframe, mem); @@ -434,11 +454,11 @@ void test_nghttp2_frame_pack_window_update(void) { nghttp2_frame_window_update_init(&frame, NGHTTP2_FLAG_NONE, 1000000007, 4096); nghttp2_frame_pack_window_update(&bufs, &frame); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4 == nghttp2_bufs_len(&bufs)); - CU_ASSERT(0 == unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); + assert_size(NGHTTP2_FRAME_HDLEN + 4, ==, nghttp2_bufs_len(&bufs)); + assert_int(0, ==, unpack_framebuf((nghttp2_frame *)&oframe, &bufs)); check_frame_header(4, NGHTTP2_WINDOW_UPDATE, NGHTTP2_FLAG_NONE, 1000000007, &oframe.hd); - CU_ASSERT(4096 == oframe.window_size_increment); + assert_int32(4096, ==, oframe.window_size_increment); nghttp2_bufs_free(&bufs); nghttp2_frame_window_update_free(&oframe); @@ -478,20 +498,20 @@ void test_nghttp2_frame_pack_altsvc(void) { nghttp2_frame_pack_altsvc(&bufs, &frame); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + payloadlen == nghttp2_bufs_len(&bufs)); + assert_size(NGHTTP2_FRAME_HDLEN + payloadlen, ==, nghttp2_bufs_len(&bufs)); rv = unpack_framebuf((nghttp2_frame *)&oframe, &bufs); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); check_frame_header(payloadlen, NGHTTP2_ALTSVC, NGHTTP2_FLAG_NONE, 1000000007, &oframe.hd); - CU_ASSERT(sizeof(origin) - 1 == oaltsvc.origin_len); - CU_ASSERT(0 == memcmp(origin, oaltsvc.origin, sizeof(origin) - 1)); - CU_ASSERT(sizeof(field_value) - 1 == oaltsvc.field_value_len); - CU_ASSERT(0 == - memcmp(field_value, oaltsvc.field_value, sizeof(field_value) - 1)); + assert_size(sizeof(origin) - 1, ==, oaltsvc.origin_len); + assert_memory_equal(sizeof(origin) - 1, origin, oaltsvc.origin); + assert_size(sizeof(field_value) - 1, ==, oaltsvc.field_value_len); + assert_memory_equal(sizeof(field_value) - 1, field_value, + oaltsvc.field_value); nghttp2_frame_altsvc_free(&oframe, mem); nghttp2_frame_altsvc_free(&frame, mem); @@ -508,18 +528,18 @@ void test_nghttp2_frame_pack_origin(void) { static const uint8_t example[] = "https://example.com"; static const uint8_t nghttp2[] = "https://nghttp2.org"; nghttp2_origin_entry ov[] = { - { - (uint8_t *)example, - sizeof(example) - 1, - }, - { - NULL, - 0, - }, - { - (uint8_t *)nghttp2, - sizeof(nghttp2) - 1, - }, + { + (uint8_t *)example, + sizeof(example) - 1, + }, + { + NULL, + 0, + }, + { + (uint8_t *)nghttp2, + sizeof(nghttp2) - 1, + }, }; nghttp2_mem *mem; @@ -536,21 +556,21 @@ void test_nghttp2_frame_pack_origin(void) { rv = nghttp2_frame_pack_origin(&bufs, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + payloadlen == nghttp2_bufs_len(&bufs)); + assert_int(0, ==, rv); + assert_size(NGHTTP2_FRAME_HDLEN + payloadlen, ==, nghttp2_bufs_len(&bufs)); rv = unpack_framebuf((nghttp2_frame *)&oframe, &bufs); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); check_frame_header(payloadlen, NGHTTP2_ORIGIN, NGHTTP2_FLAG_NONE, 0, &oframe.hd); - CU_ASSERT(2 == oorigin.nov); - CU_ASSERT(sizeof(example) - 1 == oorigin.ov[0].origin_len); - CU_ASSERT(0 == memcmp(example, oorigin.ov[0].origin, sizeof(example) - 1)); - CU_ASSERT(sizeof(nghttp2) - 1 == oorigin.ov[1].origin_len); - CU_ASSERT(0 == memcmp(nghttp2, oorigin.ov[1].origin, sizeof(nghttp2) - 1)); + assert_size(2, ==, oorigin.nov); + assert_size(sizeof(example) - 1, ==, oorigin.ov[0].origin_len); + assert_memory_equal(sizeof(example) - 1, example, oorigin.ov[0].origin); + assert_size(sizeof(nghttp2) - 1, ==, oorigin.ov[1].origin_len); + assert_memory_equal(sizeof(nghttp2) - 1, nghttp2, oorigin.ov[1].origin); nghttp2_frame_origin_free(&oframe, mem); @@ -561,7 +581,7 @@ void test_nghttp2_frame_pack_origin(void) { rv = unpack_framebuf((nghttp2_frame *)&oframe, &bufs); - CU_ASSERT(NGHTTP2_ERR_FRAME_SIZE_ERROR == rv); + assert_int(NGHTTP2_ERR_FRAME_SIZE_ERROR, ==, rv); nghttp2_bufs_reset(&bufs); memset(&oframe, 0, sizeof(oframe)); @@ -573,17 +593,17 @@ void test_nghttp2_frame_pack_origin(void) { rv = nghttp2_frame_pack_origin(&bufs, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(NGHTTP2_FRAME_HDLEN == nghttp2_bufs_len(&bufs)); + assert_int(0, ==, rv); + assert_size(NGHTTP2_FRAME_HDLEN, ==, nghttp2_bufs_len(&bufs)); rv = unpack_framebuf((nghttp2_frame *)&oframe, &bufs); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); check_frame_header(0, NGHTTP2_ORIGIN, NGHTTP2_FLAG_NONE, 0, &oframe.hd); - CU_ASSERT(0 == oorigin.nov); - CU_ASSERT(NULL == oorigin.ov); + assert_size(0, ==, oorigin.nov); + assert_null(oorigin.ov); nghttp2_frame_origin_free(&oframe, mem); @@ -610,25 +630,25 @@ void test_nghttp2_frame_pack_priority_update(void) { nghttp2_frame_pack_priority_update(&bufs, &frame); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + payloadlen == nghttp2_bufs_len(&bufs)); + assert_size(NGHTTP2_FRAME_HDLEN + payloadlen, ==, nghttp2_bufs_len(&bufs)); rv = unpack_framebuf((nghttp2_frame *)&oframe, &bufs); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); check_frame_header(payloadlen, NGHTTP2_PRIORITY_UPDATE, NGHTTP2_FLAG_NONE, 0, &oframe.hd); - CU_ASSERT(sizeof(field_value) - 1 == opriority_update.field_value_len); - CU_ASSERT(0 == memcmp(field_value, opriority_update.field_value, - sizeof(field_value) - 1)); + assert_size(sizeof(field_value) - 1, ==, opriority_update.field_value_len); + assert_memory_equal(sizeof(field_value) - 1, field_value, + opriority_update.field_value); nghttp2_bufs_free(&bufs); } void test_nghttp2_nv_array_copy(void) { nghttp2_nv *nva; - ssize_t rv; + int rv; nghttp2_nv emptynv[] = {MAKE_NV("", ""), MAKE_NV("", "")}; nghttp2_nv nv[] = {MAKE_NV("alpha", "bravo"), MAKE_NV("charlie", "delta")}; nghttp2_nv bignv; @@ -644,34 +664,34 @@ void test_nghttp2_nv_array_copy(void) { memset(bignv.value, '0', bignv.valuelen); rv = nghttp2_nv_array_copy(&nva, NULL, 0, mem); - CU_ASSERT(0 == rv); - CU_ASSERT(NULL == nva); + assert_int(0, ==, rv); + assert_null(nva); rv = nghttp2_nv_array_copy(&nva, emptynv, ARRLEN(emptynv), mem); - CU_ASSERT(0 == rv); - CU_ASSERT(nva[0].namelen == 0); - CU_ASSERT(nva[0].valuelen == 0); - CU_ASSERT(nva[1].namelen == 0); - CU_ASSERT(nva[1].valuelen == 0); + assert_int(0, ==, rv); + assert_size(0, ==, nva[0].namelen); + assert_size(0, ==, nva[0].valuelen); + assert_size(0, ==, nva[1].namelen); + assert_size(0, ==, nva[1].valuelen); nghttp2_nv_array_del(nva, mem); rv = nghttp2_nv_array_copy(&nva, nv, ARRLEN(nv), mem); - CU_ASSERT(0 == rv); - CU_ASSERT(nva[0].namelen == 5); - CU_ASSERT(0 == memcmp("alpha", nva[0].name, 5)); - CU_ASSERT(nva[0].valuelen == 5); - CU_ASSERT(0 == memcmp("bravo", nva[0].value, 5)); - CU_ASSERT(nva[1].namelen == 7); - CU_ASSERT(0 == memcmp("charlie", nva[1].name, 7)); - CU_ASSERT(nva[1].valuelen == 5); - CU_ASSERT(0 == memcmp("delta", nva[1].value, 5)); + assert_int(0, ==, rv); + assert_size(5, ==, nva[0].namelen); + assert_memory_equal(5, "alpha", nva[0].name); + assert_size(5, ==, nva[0].valuelen); + assert_memory_equal(5, "bravo", nva[0].value); + assert_size(7, ==, nva[1].namelen); + assert_memory_equal(7, "charlie", nva[1].name); + assert_size(5, ==, nva[1].valuelen); + assert_memory_equal(5, "delta", nva[1].value); nghttp2_nv_array_del(nva, mem); /* Large header field is acceptable */ rv = nghttp2_nv_array_copy(&nva, &bignv, 1, mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); nghttp2_nv_array_del(nva, mem); @@ -686,50 +706,50 @@ void test_nghttp2_iv_check(void) { iv[1].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; iv[1].value = 1024; - CU_ASSERT(nghttp2_iv_check(iv, 2)); + assert_true(nghttp2_iv_check(iv, 2)); iv[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; iv[1].value = NGHTTP2_MAX_WINDOW_SIZE; - CU_ASSERT(nghttp2_iv_check(iv, 2)); + assert_true(nghttp2_iv_check(iv, 2)); /* Too large window size */ iv[1].value = (uint32_t)NGHTTP2_MAX_WINDOW_SIZE + 1; - CU_ASSERT(0 == nghttp2_iv_check(iv, 2)); + assert_false(nghttp2_iv_check(iv, 2)); /* ENABLE_PUSH only allows 0 or 1 */ iv[1].settings_id = NGHTTP2_SETTINGS_ENABLE_PUSH; iv[1].value = 0; - CU_ASSERT(nghttp2_iv_check(iv, 2)); + assert_true(nghttp2_iv_check(iv, 2)); iv[1].value = 1; - CU_ASSERT(nghttp2_iv_check(iv, 2)); + assert_true(nghttp2_iv_check(iv, 2)); iv[1].value = 3; - CU_ASSERT(!nghttp2_iv_check(iv, 2)); + assert_false(nghttp2_iv_check(iv, 2)); /* Undefined SETTINGS ID is allowed */ iv[1].settings_id = 1000000009; iv[1].value = 0; - CU_ASSERT(nghttp2_iv_check(iv, 2)); + assert_true(nghttp2_iv_check(iv, 2)); /* Full size SETTINGS_HEADER_TABLE_SIZE (UINT32_MAX) must be accepted */ iv[1].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; iv[1].value = UINT32_MAX; - CU_ASSERT(nghttp2_iv_check(iv, 2)); + assert_true(nghttp2_iv_check(iv, 2)); /* Too small SETTINGS_MAX_FRAME_SIZE */ iv[0].settings_id = NGHTTP2_SETTINGS_MAX_FRAME_SIZE; iv[0].value = NGHTTP2_MAX_FRAME_SIZE_MIN - 1; - CU_ASSERT(!nghttp2_iv_check(iv, 1)); + assert_false(nghttp2_iv_check(iv, 1)); /* Too large SETTINGS_MAX_FRAME_SIZE */ iv[0].settings_id = NGHTTP2_SETTINGS_MAX_FRAME_SIZE; iv[0].value = NGHTTP2_MAX_FRAME_SIZE_MAX + 1; - CU_ASSERT(!nghttp2_iv_check(iv, 1)); + assert_false(nghttp2_iv_check(iv, 1)); /* Max and min SETTINGS_MAX_FRAME_SIZE */ iv[0].settings_id = NGHTTP2_SETTINGS_MAX_FRAME_SIZE; iv[0].value = NGHTTP2_MAX_FRAME_SIZE_MIN; iv[1].settings_id = NGHTTP2_SETTINGS_MAX_FRAME_SIZE; iv[1].value = NGHTTP2_MAX_FRAME_SIZE_MAX; - CU_ASSERT(nghttp2_iv_check(iv, 2)); + assert_true(nghttp2_iv_check(iv, 2)); } diff --git a/lib/nghttp2/tests/nghttp2_frame_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_frame_test.h similarity index 60% rename from lib/nghttp2/tests/nghttp2_frame_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_frame_test.h index dc0762573b2..af1650714a1 100644 --- a/lib/nghttp2/tests/nghttp2_frame_test.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_frame_test.h @@ -29,19 +29,25 @@ # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_frame_pack_headers(void); -void test_nghttp2_frame_pack_headers_frame_too_large(void); -void test_nghttp2_frame_pack_priority(void); -void test_nghttp2_frame_pack_rst_stream(void); -void test_nghttp2_frame_pack_settings(void); -void test_nghttp2_frame_pack_push_promise(void); -void test_nghttp2_frame_pack_ping(void); -void test_nghttp2_frame_pack_goaway(void); -void test_nghttp2_frame_pack_window_update(void); -void test_nghttp2_frame_pack_altsvc(void); -void test_nghttp2_frame_pack_origin(void); -void test_nghttp2_frame_pack_priority_update(void); -void test_nghttp2_nv_array_copy(void); -void test_nghttp2_iv_check(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite frame_suite; + +munit_void_test_decl(test_nghttp2_frame_pack_headers) +munit_void_test_decl(test_nghttp2_frame_pack_headers_frame_too_large) +munit_void_test_decl(test_nghttp2_frame_pack_priority) +munit_void_test_decl(test_nghttp2_frame_pack_rst_stream) +munit_void_test_decl(test_nghttp2_frame_pack_settings) +munit_void_test_decl(test_nghttp2_frame_pack_push_promise) +munit_void_test_decl(test_nghttp2_frame_pack_ping) +munit_void_test_decl(test_nghttp2_frame_pack_goaway) +munit_void_test_decl(test_nghttp2_frame_pack_window_update) +munit_void_test_decl(test_nghttp2_frame_pack_altsvc) +munit_void_test_decl(test_nghttp2_frame_pack_origin) +munit_void_test_decl(test_nghttp2_frame_pack_priority_update) +munit_void_test_decl(test_nghttp2_nv_array_copy) +munit_void_test_decl(test_nghttp2_iv_check) #endif /* NGHTTP2_FRAME_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_hd_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_hd_test.c similarity index 51% rename from lib/nghttp2/tests/nghttp2_hd_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_hd_test.c index 657d895faba..ca536a0390d 100644 --- a/lib/nghttp2/tests/nghttp2_hd_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_hd_test.c @@ -27,11 +27,42 @@ #include #include -#include +#include "munit.h" #include "nghttp2_hd.h" #include "nghttp2_frame.h" #include "nghttp2_test_helper.h" +#include "nghttp2_assertion.h" + +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_hd_deflate), + munit_void_test(test_nghttp2_hd_deflate_same_indexed_repr), + munit_void_test(test_nghttp2_hd_inflate_indexed), + munit_void_test(test_nghttp2_hd_inflate_indname_noinc), + munit_void_test(test_nghttp2_hd_inflate_indname_inc), + munit_void_test(test_nghttp2_hd_inflate_indname_inc_eviction), + munit_void_test(test_nghttp2_hd_inflate_newname_noinc), + munit_void_test(test_nghttp2_hd_inflate_newname_inc), + munit_void_test(test_nghttp2_hd_inflate_clearall_inc), + munit_void_test(test_nghttp2_hd_inflate_zero_length_huffman), + munit_void_test(test_nghttp2_hd_inflate_expect_table_size_update), + munit_void_test(test_nghttp2_hd_inflate_unexpected_table_size_update), + munit_void_test(test_nghttp2_hd_ringbuf_reserve), + munit_void_test(test_nghttp2_hd_change_table_size), + munit_void_test(test_nghttp2_hd_deflate_inflate), + munit_void_test(test_nghttp2_hd_no_index), + munit_void_test(test_nghttp2_hd_deflate_bound), + munit_void_test(test_nghttp2_hd_public_api), + munit_void_test(test_nghttp2_hd_deflate_hd_vec), + munit_void_test(test_nghttp2_hd_decode_length), + munit_void_test(test_nghttp2_hd_huff_encode), + munit_void_test(test_nghttp2_hd_huff_decode), + munit_test_end(), +}; + +const MunitSuite hd_suite = { + "/hd", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; void test_nghttp2_hd_deflate(void) { nghttp2_hd_deflater deflater; @@ -47,7 +78,7 @@ void test_nghttp2_hd_deflate(void) { nghttp2_nv nva5[] = {MAKE_NV(":path", "/style.css"), MAKE_NV("x-nghttp2", "")}; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nva_out out; int rv; nghttp2_mem *mem; @@ -56,17 +87,17 @@ void test_nghttp2_hd_deflate(void) { frame_pack_bufs_init(&bufs); nva_out_init(&out); - CU_ASSERT(0 == nghttp2_hd_deflate_init(&deflater, mem)); - CU_ASSERT(0 == nghttp2_hd_inflate_init(&inflater, mem)); + assert_int(0, ==, nghttp2_hd_deflate_init(&deflater, mem)); + assert_int(0, ==, nghttp2_hd_inflate_init(&inflater, mem)); rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva1, ARRLEN(nva1)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(3 == out.nvlen); + assert_size(3, ==, out.nvlen); assert_nv_equal(nva1, out.nva, 3, mem); nva_out_reset(&out, mem); @@ -74,13 +105,13 @@ void test_nghttp2_hd_deflate(void) { /* Second headers */ rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva2, ARRLEN(nva2)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(2 == out.nvlen); + assert_size(2, ==, out.nvlen); assert_nv_equal(nva2, out.nva, 2, mem); nva_out_reset(&out, mem); @@ -89,13 +120,13 @@ void test_nghttp2_hd_deflate(void) { /* Third headers, including same header field name, but value is not the same. */ rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva3, ARRLEN(nva3)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(3 == out.nvlen); + assert_size(3, ==, out.nvlen); assert_nv_equal(nva3, out.nva, 3, mem); nva_out_reset(&out, mem); @@ -103,13 +134,13 @@ void test_nghttp2_hd_deflate(void) { /* Fourth headers, including duplicate header fields. */ rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva4, ARRLEN(nva4)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(3 == out.nvlen); + assert_size(3, ==, out.nvlen); assert_nv_equal(nva4, out.nva, 3, mem); nva_out_reset(&out, mem); @@ -117,13 +148,13 @@ void test_nghttp2_hd_deflate(void) { /* Fifth headers includes empty value */ rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva5, ARRLEN(nva5)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(2 == out.nvlen); + assert_size(2, ==, out.nvlen); assert_nv_equal(nva5, out.nva, 2, mem); nva_out_reset(&out, mem); @@ -142,7 +173,7 @@ void test_nghttp2_hd_deflate_same_indexed_repr(void) { nghttp2_nv nva2[] = {MAKE_NV("host", "alpha"), MAKE_NV("host", "alpha"), MAKE_NV("host", "alpha")}; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nva_out out; int rv; nghttp2_mem *mem; @@ -151,18 +182,18 @@ void test_nghttp2_hd_deflate_same_indexed_repr(void) { frame_pack_bufs_init(&bufs); nva_out_init(&out); - CU_ASSERT(0 == nghttp2_hd_deflate_init(&deflater, mem)); - CU_ASSERT(0 == nghttp2_hd_inflate_init(&inflater, mem)); + assert_int(0, ==, nghttp2_hd_deflate_init(&deflater, mem)); + assert_int(0, ==, nghttp2_hd_inflate_init(&inflater, mem)); /* Encode 2 same headers. Emit 1 literal reprs and 1 index repr. */ rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva1, ARRLEN(nva1)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(2 == out.nvlen); + assert_size(2, ==, out.nvlen); assert_nv_equal(nva1, out.nva, 2, mem); nva_out_reset(&out, mem); @@ -170,13 +201,13 @@ void test_nghttp2_hd_deflate_same_indexed_repr(void) { /* Encode 3 same headers. This time, emits 3 index reprs. */ rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva2, ARRLEN(nva2)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen == 3); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_int(0, ==, rv); + assert_ptrdiff(3, ==, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(3 == out.nvlen); + assert_size(3, ==, out.nvlen); assert_nv_equal(nva2, out.nva, 3, mem); nva_out_reset(&out, mem); @@ -191,7 +222,7 @@ void test_nghttp2_hd_deflate_same_indexed_repr(void) { void test_nghttp2_hd_inflate_indexed(void) { nghttp2_hd_inflater inflater; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_nv nv = MAKE_NV(":path", "/"); nva_out out; nghttp2_mem *mem; @@ -204,12 +235,12 @@ void test_nghttp2_hd_inflate_indexed(void) { nghttp2_bufs_addb(&bufs, (1 << 7) | 4); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(1 == blocklen); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(1, ==, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); + assert_size(1, ==, out.nvlen); assert_nv_equal(&nv, out.nva, 1, mem); @@ -219,11 +250,11 @@ void test_nghttp2_hd_inflate_indexed(void) { /* index = 0 is error */ nghttp2_bufs_addb(&bufs, 1 << 7); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(1 == blocklen); - CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == - inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(1, ==, blocklen); + assert_ptrdiff(NGHTTP2_ERR_HEADER_COMP, ==, + inflate_hd(&inflater, &out, &bufs, 0, mem)); nghttp2_bufs_free(&bufs); nghttp2_hd_inflate_free(&inflater); @@ -232,7 +263,7 @@ void test_nghttp2_hd_inflate_indexed(void) { void test_nghttp2_hd_inflate_indname_noinc(void) { nghttp2_hd_inflater inflater; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_nv nv[] = {/* Huffman */ MAKE_NV("user-agent", "nghttp2"), /* Expecting no huffman */ @@ -248,18 +279,19 @@ void test_nghttp2_hd_inflate_indname_noinc(void) { nghttp2_hd_inflate_init(&inflater, mem); for (i = 0; i < ARRLEN(nv); ++i) { - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 57, &nv[i], - NGHTTP2_HD_WITHOUT_INDEXING)); + assert_int(0, ==, + nghttp2_hd_emit_indname_block(&bufs, 57, &nv[i], + NGHTTP2_HD_WITHOUT_INDEXING)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); + assert_size(1, ==, out.nvlen); assert_nv_equal(&nv[i], out.nva, 1, mem); - CU_ASSERT(0 == inflater.ctx.hd_table.len); - CU_ASSERT(61 == nghttp2_hd_inflate_get_num_table_entries(&inflater)); + assert_size(0, ==, inflater.ctx.hd_table.len); + assert_size(61, ==, nghttp2_hd_inflate_get_num_table_entries(&inflater)); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -272,7 +304,7 @@ void test_nghttp2_hd_inflate_indname_noinc(void) { void test_nghttp2_hd_inflate_indname_inc(void) { nghttp2_hd_inflater inflater; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_nv nv = MAKE_NV("user-agent", "nghttp2"); nva_out out; nghttp2_mem *mem; @@ -283,23 +315,24 @@ void test_nghttp2_hd_inflate_indname_inc(void) { nva_out_init(&out); nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 57, &nv, - NGHTTP2_HD_WITH_INDEXING)); + assert_int( + 0, ==, + nghttp2_hd_emit_indname_block(&bufs, 57, &nv, NGHTTP2_HD_WITH_INDEXING)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); + assert_size(1, ==, out.nvlen); assert_nv_equal(&nv, out.nva, 1, mem); - CU_ASSERT(1 == inflater.ctx.hd_table.len); - CU_ASSERT(62 == nghttp2_hd_inflate_get_num_table_entries(&inflater)); + assert_size(1, ==, inflater.ctx.hd_table.len); + assert_size(62, ==, nghttp2_hd_inflate_get_num_table_entries(&inflater)); assert_nv_equal( - &nv, - nghttp2_hd_inflate_get_table_entry( - &inflater, NGHTTP2_STATIC_TABLE_LENGTH + inflater.ctx.hd_table.len), - 1, mem); + &nv, + nghttp2_hd_inflate_get_table_entry(&inflater, NGHTTP2_STATIC_TABLE_LENGTH + + inflater.ctx.hd_table.len), + 1, mem); nva_out_reset(&out, mem); nghttp2_bufs_free(&bufs); @@ -309,7 +342,7 @@ void test_nghttp2_hd_inflate_indname_inc(void) { void test_nghttp2_hd_inflate_indname_inc_eviction(void) { nghttp2_hd_inflater inflater; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; uint8_t value[1025]; nva_out out; nghttp2_nv nv; @@ -328,31 +361,35 @@ void test_nghttp2_hd_inflate_indname_inc_eviction(void) { nv.flags = NGHTTP2_NV_FLAG_NONE; - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 14, &nv, - NGHTTP2_HD_WITH_INDEXING)); - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 15, &nv, - NGHTTP2_HD_WITH_INDEXING)); - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 16, &nv, - NGHTTP2_HD_WITH_INDEXING)); - CU_ASSERT(0 == nghttp2_hd_emit_indname_block(&bufs, 17, &nv, - NGHTTP2_HD_WITH_INDEXING)); + assert_int( + 0, ==, + nghttp2_hd_emit_indname_block(&bufs, 14, &nv, NGHTTP2_HD_WITH_INDEXING)); + assert_int( + 0, ==, + nghttp2_hd_emit_indname_block(&bufs, 15, &nv, NGHTTP2_HD_WITH_INDEXING)); + assert_int( + 0, ==, + nghttp2_hd_emit_indname_block(&bufs, 16, &nv, NGHTTP2_HD_WITH_INDEXING)); + assert_int( + 0, ==, + nghttp2_hd_emit_indname_block(&bufs, 17, &nv, NGHTTP2_HD_WITH_INDEXING)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(blocklen > 0); + assert_ptrdiff(0, <, blocklen); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(4 == out.nvlen); - CU_ASSERT(14 == out.nva[0].namelen); - CU_ASSERT(0 == memcmp("accept-charset", out.nva[0].name, out.nva[0].namelen)); - CU_ASSERT(sizeof(value) - 1 == out.nva[0].valuelen); + assert_size(4, ==, out.nvlen); + assert_size(14, ==, out.nva[0].namelen); + assert_memory_equal(out.nva[0].namelen, "accept-charset", out.nva[0].name); + assert_size(sizeof(value) - 1, ==, out.nva[0].valuelen); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); - CU_ASSERT(3 == inflater.ctx.hd_table.len); - CU_ASSERT(64 == nghttp2_hd_inflate_get_num_table_entries(&inflater)); + assert_size(3, ==, inflater.ctx.hd_table.len); + assert_size(64, ==, nghttp2_hd_inflate_get_num_table_entries(&inflater)); nghttp2_bufs_free(&bufs); nghttp2_hd_inflate_free(&inflater); @@ -361,7 +398,7 @@ void test_nghttp2_hd_inflate_indname_inc_eviction(void) { void test_nghttp2_hd_inflate_newname_noinc(void) { nghttp2_hd_inflater inflater; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_nv nv[] = {/* Expecting huffman for both */ MAKE_NV("my-long-content-length", "nghttp2"), /* Expecting no huffman for both */ @@ -380,17 +417,18 @@ void test_nghttp2_hd_inflate_newname_noinc(void) { nva_out_init(&out); nghttp2_hd_inflate_init(&inflater, mem); for (i = 0; i < ARRLEN(nv); ++i) { - CU_ASSERT(0 == nghttp2_hd_emit_newname_block(&bufs, &nv[i], - NGHTTP2_HD_WITHOUT_INDEXING)); + assert_int(0, ==, + nghttp2_hd_emit_newname_block(&bufs, &nv[i], + NGHTTP2_HD_WITHOUT_INDEXING)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); + assert_size(1, ==, out.nvlen); assert_nv_equal(&nv[i], out.nva, 1, mem); - CU_ASSERT(0 == inflater.ctx.hd_table.len); + assert_size(0, ==, inflater.ctx.hd_table.len); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -403,7 +441,7 @@ void test_nghttp2_hd_inflate_newname_noinc(void) { void test_nghttp2_hd_inflate_newname_inc(void) { nghttp2_hd_inflater inflater; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_nv nv = MAKE_NV("x-rel", "nghttp2"); nva_out out; nghttp2_mem *mem; @@ -414,22 +452,22 @@ void test_nghttp2_hd_inflate_newname_inc(void) { nva_out_init(&out); nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT( - 0 == nghttp2_hd_emit_newname_block(&bufs, &nv, NGHTTP2_HD_WITH_INDEXING)); + assert_int( + 0, ==, nghttp2_hd_emit_newname_block(&bufs, &nv, NGHTTP2_HD_WITH_INDEXING)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); + assert_size(1, ==, out.nvlen); assert_nv_equal(&nv, out.nva, 1, mem); - CU_ASSERT(1 == inflater.ctx.hd_table.len); + assert_size(1, ==, inflater.ctx.hd_table.len); assert_nv_equal( - &nv, - nghttp2_hd_inflate_get_table_entry( - &inflater, NGHTTP2_STATIC_TABLE_LENGTH + inflater.ctx.hd_table.len), - 1, mem); + &nv, + nghttp2_hd_inflate_get_table_entry(&inflater, NGHTTP2_STATIC_TABLE_LENGTH + + inflater.ctx.hd_table.len), + 1, mem); nva_out_reset(&out, mem); nghttp2_bufs_free(&bufs); @@ -439,7 +477,7 @@ void test_nghttp2_hd_inflate_newname_inc(void) { void test_nghttp2_hd_inflate_clearall_inc(void) { nghttp2_hd_inflater inflater; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_nv nv; uint8_t value[4061]; nva_out out; @@ -461,26 +499,26 @@ void test_nghttp2_hd_inflate_clearall_inc(void) { nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT( - 0 == nghttp2_hd_emit_newname_block(&bufs, &nv, NGHTTP2_HD_WITH_INDEXING)); + assert_int( + 0, ==, nghttp2_hd_emit_newname_block(&bufs, &nv, NGHTTP2_HD_WITH_INDEXING)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); + assert_size(1, ==, out.nvlen); assert_nv_equal(&nv, out.nva, 1, mem); - CU_ASSERT(0 == inflater.ctx.hd_table.len); + assert_size(0, ==, inflater.ctx.hd_table.len); nva_out_reset(&out, mem); /* Do it again */ - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); + assert_size(1, ==, out.nvlen); assert_nv_equal(&nv, out.nva, 1, mem); - CU_ASSERT(0 == inflater.ctx.hd_table.len); + assert_size(0, ==, inflater.ctx.hd_table.len); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -489,17 +527,17 @@ void test_nghttp2_hd_inflate_clearall_inc(void) { header table */ nv.valuelen = sizeof(value) - 2; - CU_ASSERT( - 0 == nghttp2_hd_emit_newname_block(&bufs, &nv, NGHTTP2_HD_WITH_INDEXING)); + assert_int( + 0, ==, nghttp2_hd_emit_newname_block(&bufs, &nv, NGHTTP2_HD_WITH_INDEXING)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); + assert_size(1, ==, out.nvlen); assert_nv_equal(&nv, out.nva, 1, mem); - CU_ASSERT(1 == inflater.ctx.hd_table.len); + assert_size(1, ==, inflater.ctx.hd_table.len); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -530,13 +568,13 @@ void test_nghttp2_hd_inflate_zero_length_huffman(void) { /* ptr[3] = 0x80; */ nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT(4 == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(4, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); - CU_ASSERT(1 == out.nva[0].namelen); - CU_ASSERT('x' == out.nva[0].name[0]); - CU_ASSERT(NULL == out.nva[0].value); - CU_ASSERT(0 == out.nva[0].valuelen); + assert_size(1, ==, out.nvlen); + assert_size(1, ==, out.nva[0].namelen); + assert_uint8('x', ==, out.nva[0].name[0]); + assert_null(out.nva[0].value); + assert_size(0, ==, out.nva[0].valuelen); nva_out_reset(&out, mem); nghttp2_bufs_free(&bufs); @@ -561,8 +599,8 @@ void test_nghttp2_hd_inflate_expect_table_size_update(void) { inflation. */ nghttp2_hd_inflate_change_table_size(&inflater, 4095); nghttp2_hd_inflate_change_table_size(&inflater, 4096); - CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == - inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(NGHTTP2_ERR_HEADER_COMP, ==, + inflate_hd(&inflater, &out, &bufs, 0, mem)); nva_out_reset(&out, mem); nghttp2_hd_inflate_free(&inflater); @@ -571,8 +609,8 @@ void test_nghttp2_hd_inflate_expect_table_size_update(void) { * size is not changed. */ nghttp2_hd_inflate_init(&inflater, mem); nghttp2_hd_inflate_change_table_size(&inflater, 4096); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == - inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, + inflate_hd(&inflater, &out, &bufs, 0, mem)); nva_out_reset(&out, mem); nghttp2_hd_inflate_free(&inflater); @@ -581,8 +619,8 @@ void test_nghttp2_hd_inflate_expect_table_size_update(void) { new size is larger than current size. */ nghttp2_hd_inflate_init(&inflater, mem); nghttp2_hd_inflate_change_table_size(&inflater, 4097); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == - inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, + inflate_hd(&inflater, &out, &bufs, 0, mem)); nva_out_reset(&out, mem); nghttp2_hd_inflate_free(&inflater); @@ -595,8 +633,8 @@ void test_nghttp2_hd_inflate_expect_table_size_update(void) { nghttp2_bufs_reset(&bufs); nghttp2_hd_emit_table_size(&bufs, 112); - CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == - inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(NGHTTP2_ERR_HEADER_COMP, ==, + inflate_hd(&inflater, &out, &bufs, 0, mem)); nva_out_reset(&out, mem); nghttp2_hd_inflate_free(&inflater); @@ -610,8 +648,8 @@ void test_nghttp2_hd_inflate_expect_table_size_update(void) { nghttp2_hd_emit_table_size(&bufs, 111); nghttp2_hd_emit_table_size(&bufs, 4096); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == - inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, + inflate_hd(&inflater, &out, &bufs, 0, mem)); nva_out_reset(&out, mem); nghttp2_hd_inflate_free(&inflater); @@ -625,8 +663,8 @@ void test_nghttp2_hd_inflate_expect_table_size_update(void) { nghttp2_hd_emit_table_size(&bufs, 111); nghttp2_hd_emit_table_size(&bufs, 4096); - CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == - inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(NGHTTP2_ERR_HEADER_COMP, ==, + inflate_hd(&inflater, &out, &bufs, 0, mem)); nva_out_reset(&out, mem); nghttp2_hd_inflate_free(&inflater); @@ -649,8 +687,8 @@ void test_nghttp2_hd_inflate_unexpected_table_size_update(void) { nghttp2_bufs_add(&bufs, data, sizeof(data)); nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == - inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(NGHTTP2_ERR_HEADER_COMP, ==, + inflate_hd(&inflater, &out, &bufs, 0, mem)); nva_out_reset(&out, mem); nghttp2_bufs_free(&bufs); @@ -664,8 +702,8 @@ void test_nghttp2_hd_ringbuf_reserve(void) { nghttp2_bufs bufs; nva_out out; int i; - ssize_t rv; - ssize_t blocklen; + nghttp2_ssize rv; + nghttp2_ssize blocklen; nghttp2_mem *mem; mem = nghttp2_mem_default(); @@ -688,14 +726,14 @@ void test_nghttp2_hd_ringbuf_reserve(void) { for (i = 0; i < 150; ++i) { memcpy(nv.value, &i, sizeof(i)); rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, &nv, 1); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); + assert_ptrdiff(0, ==, rv); + assert_ptrdiff(0, <, blocklen); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(1 == out.nvlen); + assert_size(1, ==, out.nvlen); assert_nv_equal(&nv, out.nva, 1, mem); nva_out_reset(&out, mem); @@ -715,9 +753,9 @@ void test_nghttp2_hd_change_table_size(void) { nghttp2_nv nva[] = {MAKE_NV("alpha", "bravo"), MAKE_NV("charlie", "delta")}; nghttp2_nv nva2[] = {MAKE_NV(":path", "/")}; nghttp2_bufs bufs; - ssize_t rv; + int rv; nva_out out; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_mem *mem; mem = nghttp2_mem_default(); @@ -729,87 +767,87 @@ void test_nghttp2_hd_change_table_size(void) { nghttp2_hd_inflate_init(&inflater, mem); /* inflater changes notifies 8000 max header table size */ - CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 8000)); - CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 8000)); + assert_int(0, ==, nghttp2_hd_inflate_change_table_size(&inflater, 8000)); + assert_int(0, ==, nghttp2_hd_deflate_change_table_size(&deflater, 8000)); - CU_ASSERT(4096 == deflater.ctx.hd_table_bufsize_max); + assert_size(4096, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(4096 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max); + assert_size(4096, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(8000, ==, inflater.settings_hd_table_bufsize_max); /* This will emit encoding context update with header table size 4096 */ rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(2 == deflater.ctx.hd_table.len); - CU_ASSERT(63 == nghttp2_hd_deflate_get_num_table_entries(&deflater)); - CU_ASSERT(4096 == deflater.ctx.hd_table_bufsize_max); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_size(2, ==, deflater.ctx.hd_table.len); + assert_size(63, ==, nghttp2_hd_deflate_get_num_table_entries(&deflater)); + assert_size(4096, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(2 == inflater.ctx.hd_table.len); - CU_ASSERT(63 == nghttp2_hd_inflate_get_num_table_entries(&inflater)); - CU_ASSERT(4096 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_size(2, ==, inflater.ctx.hd_table.len); + assert_size(63, ==, nghttp2_hd_inflate_get_num_table_entries(&inflater)); + assert_size(4096, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(8000, ==, inflater.settings_hd_table_bufsize_max); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); /* inflater changes header table size to 1024 */ - CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 1024)); - CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 1024)); + assert_int(0, ==, nghttp2_hd_inflate_change_table_size(&inflater, 1024)); + assert_int(0, ==, nghttp2_hd_deflate_change_table_size(&deflater, 1024)); - CU_ASSERT(1024 == deflater.ctx.hd_table_bufsize_max); + assert_size(1024, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(1024 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(1024 == inflater.settings_hd_table_bufsize_max); + assert_size(1024, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(1024, ==, inflater.settings_hd_table_bufsize_max); rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(2 == deflater.ctx.hd_table.len); - CU_ASSERT(63 == nghttp2_hd_deflate_get_num_table_entries(&deflater)); - CU_ASSERT(1024 == deflater.ctx.hd_table_bufsize_max); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_size(2, ==, deflater.ctx.hd_table.len); + assert_size(63, ==, nghttp2_hd_deflate_get_num_table_entries(&deflater)); + assert_size(1024, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(2 == inflater.ctx.hd_table.len); - CU_ASSERT(63 == nghttp2_hd_inflate_get_num_table_entries(&inflater)); - CU_ASSERT(1024 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(1024 == inflater.settings_hd_table_bufsize_max); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_size(2, ==, inflater.ctx.hd_table.len); + assert_size(63, ==, nghttp2_hd_inflate_get_num_table_entries(&inflater)); + assert_size(1024, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(1024, ==, inflater.settings_hd_table_bufsize_max); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); /* inflater changes header table size to 0 */ - CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 0)); - CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 0)); + assert_int(0, ==, nghttp2_hd_inflate_change_table_size(&inflater, 0)); + assert_int(0, ==, nghttp2_hd_deflate_change_table_size(&deflater, 0)); - CU_ASSERT(0 == deflater.ctx.hd_table.len); - CU_ASSERT(61 == nghttp2_hd_deflate_get_num_table_entries(&deflater)); - CU_ASSERT(0 == deflater.ctx.hd_table_bufsize_max); + assert_size(0, ==, deflater.ctx.hd_table.len); + assert_size(61, ==, nghttp2_hd_deflate_get_num_table_entries(&deflater)); + assert_size(0, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(0 == inflater.ctx.hd_table.len); - CU_ASSERT(61 == nghttp2_hd_inflate_get_num_table_entries(&inflater)); - CU_ASSERT(0 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(0 == inflater.settings_hd_table_bufsize_max); + assert_size(0, ==, inflater.ctx.hd_table.len); + assert_size(61, ==, nghttp2_hd_inflate_get_num_table_entries(&inflater)); + assert_size(0, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(0, ==, inflater.settings_hd_table_bufsize_max); rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(0 == deflater.ctx.hd_table.len); - CU_ASSERT(61 == nghttp2_hd_deflate_get_num_table_entries(&deflater)); - CU_ASSERT(0 == deflater.ctx.hd_table_bufsize_max); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_size(0, ==, deflater.ctx.hd_table.len); + assert_size(61, ==, nghttp2_hd_deflate_get_num_table_entries(&deflater)); + assert_size(0, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(0 == inflater.ctx.hd_table.len); - CU_ASSERT(61 == nghttp2_hd_inflate_get_num_table_entries(&inflater)); - CU_ASSERT(0 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(0 == inflater.settings_hd_table_bufsize_max); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_size(0, ==, inflater.ctx.hd_table.len); + assert_size(61, ==, nghttp2_hd_inflate_get_num_table_entries(&inflater)); + assert_size(0, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(0, ==, inflater.settings_hd_table_bufsize_max); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -825,53 +863,57 @@ void test_nghttp2_hd_change_table_size(void) { nghttp2_hd_inflate_init(&inflater, mem); /* First inflater changes header table size to 8000 */ - CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 8000)); - CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 8000)); + assert_int(0, ==, nghttp2_hd_inflate_change_table_size(&inflater, 8000)); + assert_int(0, ==, nghttp2_hd_deflate_change_table_size(&deflater, 8000)); - CU_ASSERT(8000 == deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(8000 == nghttp2_hd_deflate_get_max_dynamic_table_size(&deflater)); - CU_ASSERT(4096 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(4096 == nghttp2_hd_inflate_get_max_dynamic_table_size(&inflater)); - CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max); + assert_size(8000, ==, deflater.ctx.hd_table_bufsize_max); + assert_size(8000, ==, + nghttp2_hd_deflate_get_max_dynamic_table_size(&deflater)); + assert_size(4096, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(4096, ==, + nghttp2_hd_inflate_get_max_dynamic_table_size(&inflater)); + assert_size(8000, ==, inflater.settings_hd_table_bufsize_max); rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(2 == deflater.ctx.hd_table.len); - CU_ASSERT(8000 == deflater.ctx.hd_table_bufsize_max); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_size(2, ==, deflater.ctx.hd_table.len); + assert_size(8000, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(2 == inflater.ctx.hd_table.len); - CU_ASSERT(8000 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(8000 == inflater.settings_hd_table_bufsize_max); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_size(2, ==, inflater.ctx.hd_table.len); + assert_size(8000, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(8000, ==, inflater.settings_hd_table_bufsize_max); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); - CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 16383)); - CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 16383)); + assert_int(0, ==, nghttp2_hd_inflate_change_table_size(&inflater, 16383)); + assert_int(0, ==, nghttp2_hd_deflate_change_table_size(&deflater, 16383)); - CU_ASSERT(8192 == deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(8192 == nghttp2_hd_deflate_get_max_dynamic_table_size(&deflater)); + assert_size(8192, ==, deflater.ctx.hd_table_bufsize_max); + assert_size(8192, ==, + nghttp2_hd_deflate_get_max_dynamic_table_size(&deflater)); - CU_ASSERT(8000 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(8000 == nghttp2_hd_inflate_get_max_dynamic_table_size(&inflater)); - CU_ASSERT(16383 == inflater.settings_hd_table_bufsize_max); + assert_size(8000, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(8000, ==, + nghttp2_hd_inflate_get_max_dynamic_table_size(&inflater)); + assert_size(16383, ==, inflater.settings_hd_table_bufsize_max); rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(2 == deflater.ctx.hd_table.len); - CU_ASSERT(8192 == deflater.ctx.hd_table_bufsize_max); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_size(2, ==, deflater.ctx.hd_table.len); + assert_size(8192, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(2 == inflater.ctx.hd_table.len); - CU_ASSERT(8192 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(16383 == inflater.settings_hd_table_bufsize_max); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_size(2, ==, inflater.ctx.hd_table.len); + assert_size(8192, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(16383, ==, inflater.settings_hd_table_bufsize_max); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -879,9 +921,9 @@ void test_nghttp2_hd_change_table_size(void) { /* Lastly, check the error condition */ rv = nghttp2_hd_emit_table_size(&bufs, 25600); - CU_ASSERT(rv == 0); - CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == - inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_int(0, ==, rv); + assert_ptrdiff(NGHTTP2_ERR_HEADER_COMP, ==, + inflate_hd(&inflater, &out, &bufs, 0, mem)); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -894,21 +936,21 @@ void test_nghttp2_hd_change_table_size(void) { nghttp2_hd_deflate_init2(&deflater, 1024, mem); nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT(1024 == deflater.ctx.hd_table_bufsize_max); + assert_size(1024, ==, deflater.ctx.hd_table_bufsize_max); /* This emits context update with buffer size 1024 */ rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(2 == deflater.ctx.hd_table.len); - CU_ASSERT(1024 == deflater.ctx.hd_table_bufsize_max); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_size(2, ==, deflater.ctx.hd_table.len); + assert_size(1024, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(2 == inflater.ctx.hd_table.len); - CU_ASSERT(1024 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(4096 == inflater.settings_hd_table_bufsize_max); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_size(2, ==, inflater.ctx.hd_table.len); + assert_size(1024, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(4096, ==, inflater.settings_hd_table_bufsize_max); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -920,18 +962,20 @@ void test_nghttp2_hd_change_table_size(void) { nghttp2_hd_deflate_init2(&deflater, UINT32_MAX, mem); nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, UINT32_MAX)); - CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, UINT32_MAX)); + assert_int(0, ==, + nghttp2_hd_inflate_change_table_size(&inflater, UINT32_MAX)); + assert_int(0, ==, + nghttp2_hd_deflate_change_table_size(&deflater, UINT32_MAX)); rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, 2); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(UINT32_MAX == deflater.ctx.hd_table_bufsize_max); + assert_int(0, ==, rv); + assert_size(UINT32_MAX, ==, deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(UINT32_MAX == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(UINT32_MAX == inflater.settings_hd_table_bufsize_max); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_size(UINT32_MAX, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(UINT32_MAX, ==, inflater.settings_hd_table_bufsize_max); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -943,25 +987,25 @@ void test_nghttp2_hd_change_table_size(void) { nghttp2_hd_deflate_init2(&deflater, 4096, mem); nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 0)); - CU_ASSERT(0 == nghttp2_hd_inflate_change_table_size(&inflater, 3000)); - CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 0)); - CU_ASSERT(0 == nghttp2_hd_deflate_change_table_size(&deflater, 3000)); + assert_int(0, ==, nghttp2_hd_inflate_change_table_size(&inflater, 0)); + assert_int(0, ==, nghttp2_hd_inflate_change_table_size(&inflater, 3000)); + assert_int(0, ==, nghttp2_hd_deflate_change_table_size(&deflater, 0)); + assert_int(0, ==, nghttp2_hd_deflate_change_table_size(&deflater, 3000)); - CU_ASSERT(0 == deflater.min_hd_table_bufsize_max); - CU_ASSERT(3000 == deflater.ctx.hd_table_bufsize_max); + assert_size(0, ==, deflater.min_hd_table_bufsize_max); + assert_size(3000, ==, deflater.ctx.hd_table_bufsize_max); rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva2, 1); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(3 < blocklen); - CU_ASSERT(3000 == deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(UINT32_MAX == deflater.min_hd_table_bufsize_max); + assert_int(0, ==, rv); + assert_ptrdiff(3, <, blocklen); + assert_size(3000, ==, deflater.ctx.hd_table_bufsize_max); + assert_size(UINT32_MAX, ==, deflater.min_hd_table_bufsize_max); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(3000 == inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(3000 == inflater.settings_hd_table_bufsize_max); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_size(3000, ==, inflater.ctx.hd_table_bufsize_max); + assert_size(3000, ==, inflater.settings_hd_table_bufsize_max); nva_out_reset(&out, mem); nghttp2_bufs_reset(&bufs); @@ -977,7 +1021,7 @@ static void check_deflate_inflate(nghttp2_hd_deflater *deflater, nghttp2_nv *nva, size_t nvlen, nghttp2_mem *mem) { nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nva_out out; int rv; @@ -985,14 +1029,14 @@ static void check_deflate_inflate(nghttp2_hd_deflater *deflater, nva_out_init(&out); rv = nghttp2_hd_deflate_hd_bufs(deflater, &bufs, nva, nvlen); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen >= 0); + assert_int(0, ==, rv); + assert_ptrdiff(0, <=, blocklen); - CU_ASSERT(blocklen == inflate_hd(inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(blocklen, ==, inflate_hd(inflater, &out, &bufs, 0, mem)); - CU_ASSERT(nvlen == out.nvlen); + assert_size(nvlen, ==, out.nvlen); assert_nv_equal(nva, out.nva, nvlen, mem); nva_out_reset(&out, mem); @@ -1003,137 +1047,137 @@ void test_nghttp2_hd_deflate_inflate(void) { nghttp2_hd_deflater deflater; nghttp2_hd_inflater inflater; nghttp2_nv nv1[] = { - MAKE_NV(":status", "200 OK"), - MAKE_NV("access-control-allow-origin", "*"), - MAKE_NV("cache-control", "private, max-age=0, must-revalidate"), - MAKE_NV("content-length", "76073"), - MAKE_NV("content-type", "text/html"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("expires", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("server", "Apache"), - MAKE_NV("vary", "foobar"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "MISS from alphabravo"), - MAKE_NV("x-cache-action", "MISS"), - MAKE_NV("x-cache-age", "0"), - MAKE_NV("x-cache-lookup", "MISS from alphabravo:3128"), - MAKE_NV("x-lb-nocache", "true"), + MAKE_NV(":status", "200 OK"), + MAKE_NV("access-control-allow-origin", "*"), + MAKE_NV("cache-control", "private, max-age=0, must-revalidate"), + MAKE_NV("content-length", "76073"), + MAKE_NV("content-type", "text/html"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("expires", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("server", "Apache"), + MAKE_NV("vary", "foobar"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "MISS from alphabravo"), + MAKE_NV("x-cache-action", "MISS"), + MAKE_NV("x-cache-age", "0"), + MAKE_NV("x-cache-lookup", "MISS from alphabravo:3128"), + MAKE_NV("x-lb-nocache", "true"), }; nghttp2_nv nv2[] = { - MAKE_NV(":status", "304 Not Modified"), - MAKE_NV("age", "0"), - MAKE_NV("cache-control", "max-age=56682045"), - MAKE_NV("content-type", "text/css"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("expires", "Thu, 14 May 2015 07:22:57 GMT"), - MAKE_NV("last-modified", "Tue, 14 May 2013 07:22:15 GMT"), - MAKE_NV("vary", "Accept-Encoding"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "HIT from alphabravo"), - MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128")}; + MAKE_NV(":status", "304 Not Modified"), + MAKE_NV("age", "0"), + MAKE_NV("cache-control", "max-age=56682045"), + MAKE_NV("content-type", "text/css"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("expires", "Thu, 14 May 2015 07:22:57 GMT"), + MAKE_NV("last-modified", "Tue, 14 May 2013 07:22:15 GMT"), + MAKE_NV("vary", "Accept-Encoding"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "HIT from alphabravo"), + MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128")}; nghttp2_nv nv3[] = { - MAKE_NV(":status", "304 Not Modified"), - MAKE_NV("age", "0"), - MAKE_NV("cache-control", "max-age=56682072"), - MAKE_NV("content-type", "text/css"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("expires", "Thu, 14 May 2015 07:23:24 GMT"), - MAKE_NV("last-modified", "Tue, 14 May 2013 07:22:13 GMT"), - MAKE_NV("vary", "Accept-Encoding"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "HIT from alphabravo"), - MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), + MAKE_NV(":status", "304 Not Modified"), + MAKE_NV("age", "0"), + MAKE_NV("cache-control", "max-age=56682072"), + MAKE_NV("content-type", "text/css"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("expires", "Thu, 14 May 2015 07:23:24 GMT"), + MAKE_NV("last-modified", "Tue, 14 May 2013 07:22:13 GMT"), + MAKE_NV("vary", "Accept-Encoding"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "HIT from alphabravo"), + MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), }; nghttp2_nv nv4[] = { - MAKE_NV(":status", "304 Not Modified"), - MAKE_NV("age", "0"), - MAKE_NV("cache-control", "max-age=56682022"), - MAKE_NV("content-type", "text/css"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("expires", "Thu, 14 May 2015 07:22:34 GMT"), - MAKE_NV("last-modified", "Tue, 14 May 2013 07:22:14 GMT"), - MAKE_NV("vary", "Accept-Encoding"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "HIT from alphabravo"), - MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), + MAKE_NV(":status", "304 Not Modified"), + MAKE_NV("age", "0"), + MAKE_NV("cache-control", "max-age=56682022"), + MAKE_NV("content-type", "text/css"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("expires", "Thu, 14 May 2015 07:22:34 GMT"), + MAKE_NV("last-modified", "Tue, 14 May 2013 07:22:14 GMT"), + MAKE_NV("vary", "Accept-Encoding"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "HIT from alphabravo"), + MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), }; nghttp2_nv nv5[] = { - MAKE_NV(":status", "304 Not Modified"), - MAKE_NV("age", "0"), - MAKE_NV("cache-control", "max-age=4461139"), - MAKE_NV("content-type", "application/x-javascript"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("expires", "Mon, 16 Sep 2013 21:34:31 GMT"), - MAKE_NV("last-modified", "Thu, 05 May 2011 09:15:59 GMT"), - MAKE_NV("vary", "Accept-Encoding"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "HIT from alphabravo"), - MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), + MAKE_NV(":status", "304 Not Modified"), + MAKE_NV("age", "0"), + MAKE_NV("cache-control", "max-age=4461139"), + MAKE_NV("content-type", "application/x-javascript"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("expires", "Mon, 16 Sep 2013 21:34:31 GMT"), + MAKE_NV("last-modified", "Thu, 05 May 2011 09:15:59 GMT"), + MAKE_NV("vary", "Accept-Encoding"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "HIT from alphabravo"), + MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), }; nghttp2_nv nv6[] = { - MAKE_NV(":status", "304 Not Modified"), - MAKE_NV("age", "0"), - MAKE_NV("cache-control", "max-age=18645951"), - MAKE_NV("content-type", "application/x-javascript"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("expires", "Fri, 28 Feb 2014 01:48:03 GMT"), - MAKE_NV("last-modified", "Tue, 12 Jul 2011 16:02:59 GMT"), - MAKE_NV("vary", "Accept-Encoding"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "HIT from alphabravo"), - MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), + MAKE_NV(":status", "304 Not Modified"), + MAKE_NV("age", "0"), + MAKE_NV("cache-control", "max-age=18645951"), + MAKE_NV("content-type", "application/x-javascript"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("expires", "Fri, 28 Feb 2014 01:48:03 GMT"), + MAKE_NV("last-modified", "Tue, 12 Jul 2011 16:02:59 GMT"), + MAKE_NV("vary", "Accept-Encoding"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "HIT from alphabravo"), + MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), }; nghttp2_nv nv7[] = { - MAKE_NV(":status", "304 Not Modified"), - MAKE_NV("age", "0"), - MAKE_NV("cache-control", "max-age=31536000"), - MAKE_NV("content-type", "application/javascript"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("etag", "\"6807-4dc5b54e0dcc0\""), - MAKE_NV("expires", "Wed, 21 May 2014 08:32:17 GMT"), - MAKE_NV("last-modified", "Fri, 10 May 2013 11:18:51 GMT"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "HIT from alphabravo"), - MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), + MAKE_NV(":status", "304 Not Modified"), + MAKE_NV("age", "0"), + MAKE_NV("cache-control", "max-age=31536000"), + MAKE_NV("content-type", "application/javascript"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("etag", "\"6807-4dc5b54e0dcc0\""), + MAKE_NV("expires", "Wed, 21 May 2014 08:32:17 GMT"), + MAKE_NV("last-modified", "Fri, 10 May 2013 11:18:51 GMT"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "HIT from alphabravo"), + MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), }; nghttp2_nv nv8[] = { - MAKE_NV(":status", "304 Not Modified"), - MAKE_NV("age", "0"), - MAKE_NV("cache-control", "max-age=31536000"), - MAKE_NV("content-type", "application/javascript"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("etag", "\"41c6-4de7d28585b00\""), - MAKE_NV("expires", "Thu, 12 Jun 2014 10:00:58 GMT"), - MAKE_NV("last-modified", "Thu, 06 Jun 2013 14:30:36 GMT"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "HIT from alphabravo"), - MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), + MAKE_NV(":status", "304 Not Modified"), + MAKE_NV("age", "0"), + MAKE_NV("cache-control", "max-age=31536000"), + MAKE_NV("content-type", "application/javascript"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("etag", "\"41c6-4de7d28585b00\""), + MAKE_NV("expires", "Thu, 12 Jun 2014 10:00:58 GMT"), + MAKE_NV("last-modified", "Thu, 06 Jun 2013 14:30:36 GMT"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "HIT from alphabravo"), + MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), }; nghttp2_nv nv9[] = { - MAKE_NV(":status", "304 Not Modified"), - MAKE_NV("age", "0"), - MAKE_NV("cache-control", "max-age=31536000"), - MAKE_NV("content-type", "application/javascript"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("etag", "\"19d6e-4dc5b35a541c0\""), - MAKE_NV("expires", "Wed, 21 May 2014 08:32:18 GMT"), - MAKE_NV("last-modified", "Fri, 10 May 2013 11:10:07 GMT"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "HIT from alphabravo"), - MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), + MAKE_NV(":status", "304 Not Modified"), + MAKE_NV("age", "0"), + MAKE_NV("cache-control", "max-age=31536000"), + MAKE_NV("content-type", "application/javascript"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("etag", "\"19d6e-4dc5b35a541c0\""), + MAKE_NV("expires", "Wed, 21 May 2014 08:32:18 GMT"), + MAKE_NV("last-modified", "Fri, 10 May 2013 11:10:07 GMT"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "HIT from alphabravo"), + MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), }; nghttp2_nv nv10[] = { - MAKE_NV(":status", "304 Not Modified"), - MAKE_NV("age", "0"), - MAKE_NV("cache-control", "max-age=56682045"), - MAKE_NV("content-type", "text/css"), - MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), - MAKE_NV("expires", "Thu, 14 May 2015 07:22:57 GMT"), - MAKE_NV("last-modified", "Tue, 14 May 2013 07:21:53 GMT"), - MAKE_NV("vary", "Accept-Encoding"), - MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), - MAKE_NV("x-cache", "HIT from alphabravo"), - MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), + MAKE_NV(":status", "304 Not Modified"), + MAKE_NV("age", "0"), + MAKE_NV("cache-control", "max-age=56682045"), + MAKE_NV("content-type", "text/css"), + MAKE_NV("date", "Sat, 27 Jul 2013 06:22:12 GMT"), + MAKE_NV("expires", "Thu, 14 May 2015 07:22:57 GMT"), + MAKE_NV("last-modified", "Tue, 14 May 2013 07:21:53 GMT"), + MAKE_NV("vary", "Accept-Encoding"), + MAKE_NV("via", "1.1 alphabravo (squid/3.x.x), 1.1 nghttpx"), + MAKE_NV("x-cache", "HIT from alphabravo"), + MAKE_NV("x-cache-lookup", "HIT from alphabravo:3128"), }; nghttp2_mem *mem; @@ -1161,11 +1205,11 @@ void test_nghttp2_hd_no_index(void) { nghttp2_hd_deflater deflater; nghttp2_hd_inflater inflater; nghttp2_bufs bufs; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_nv nva[] = { - MAKE_NV(":method", "GET"), MAKE_NV(":method", "POST"), - MAKE_NV(":path", "/foo"), MAKE_NV("version", "HTTP/1.1"), - MAKE_NV(":method", "GET"), + MAKE_NV(":method", "GET"), MAKE_NV(":method", "POST"), + MAKE_NV(":path", "/foo"), MAKE_NV("version", "HTTP/1.1"), + MAKE_NV(":method", "GET"), }; size_t i; nva_out out; @@ -1187,18 +1231,18 @@ void test_nghttp2_hd_no_index(void) { nghttp2_hd_inflate_init(&inflater, mem); rv = nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, ARRLEN(nva)); - blocklen = (ssize_t)nghttp2_bufs_len(&bufs); + blocklen = (nghttp2_ssize)nghttp2_bufs_len(&bufs); - CU_ASSERT(0 == rv); - CU_ASSERT(blocklen > 0); - CU_ASSERT(blocklen == inflate_hd(&inflater, &out, &bufs, 0, mem)); + assert_int(0, ==, rv); + assert_ptrdiff(0, <, blocklen); + assert_ptrdiff(blocklen, ==, inflate_hd(&inflater, &out, &bufs, 0, mem)); - CU_ASSERT(ARRLEN(nva) == out.nvlen); + assert_size(ARRLEN(nva), ==, out.nvlen); assert_nv_equal(nva, out.nva, ARRLEN(nva), mem); - CU_ASSERT(out.nva[0].flags == NGHTTP2_NV_FLAG_NONE); + assert_uint8(NGHTTP2_NV_FLAG_NONE, ==, out.nva[0].flags); for (i = 1; i < ARRLEN(nva); ++i) { - CU_ASSERT(out.nva[i].flags == NGHTTP2_NV_FLAG_NO_INDEX); + assert_uint8(NGHTTP2_NV_FLAG_NO_INDEX, ==, out.nva[i].flags); } nva_out_reset(&out, mem); @@ -1222,17 +1266,17 @@ void test_nghttp2_hd_deflate_bound(void) { bound = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva)); - CU_ASSERT(12 + 6 * 2 * 2 + nva[0].namelen + nva[0].valuelen + nva[1].namelen + - nva[1].valuelen == - bound); + assert_size(12 + 6 * 2 * 2 + nva[0].namelen + nva[0].valuelen + + nva[1].namelen + nva[1].valuelen, + ==, bound); nghttp2_hd_deflate_hd_bufs(&deflater, &bufs, nva, ARRLEN(nva)); - CU_ASSERT(bound > (size_t)nghttp2_bufs_len(&bufs)); + assert_size((size_t)nghttp2_bufs_len(&bufs), <, bound); bound2 = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva)); - CU_ASSERT(bound == bound2); + assert_size(bound, ==, bound2); nghttp2_bufs_free(&bufs); nghttp2_hd_deflate_free(&deflater); @@ -1244,25 +1288,25 @@ void test_nghttp2_hd_public_api(void) { nghttp2_nv nva[] = {MAKE_NV("alpha", "bravo"), MAKE_NV("charlie", "delta")}; uint8_t buf[4096]; size_t buflen; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_bufs bufs; nghttp2_mem *mem; mem = nghttp2_mem_default(); - CU_ASSERT(0 == nghttp2_hd_deflate_new(&deflater, 4096)); - CU_ASSERT(0 == nghttp2_hd_inflate_new(&inflater)); + assert_int(0, ==, nghttp2_hd_deflate_new(&deflater, 4096)); + assert_int(0, ==, nghttp2_hd_inflate_new(&inflater)); buflen = nghttp2_hd_deflate_bound(deflater, nva, ARRLEN(nva)); - blocklen = nghttp2_hd_deflate_hd(deflater, buf, buflen, nva, ARRLEN(nva)); + blocklen = nghttp2_hd_deflate_hd2(deflater, buf, buflen, nva, ARRLEN(nva)); - CU_ASSERT(blocklen > 0); + assert_ptrdiff(0, <, blocklen); nghttp2_bufs_wrap_init(&bufs, buf, (size_t)blocklen, mem); bufs.head->buf.last += blocklen; - CU_ASSERT(blocklen == inflate_hd(inflater, NULL, &bufs, 0, mem)); + assert_ptrdiff(blocklen, ==, inflate_hd(inflater, NULL, &bufs, 0, mem)); nghttp2_bufs_wrap_free(&bufs); @@ -1270,12 +1314,12 @@ void test_nghttp2_hd_public_api(void) { nghttp2_hd_deflate_del(deflater); /* See NGHTTP2_ERR_INSUFF_BUFSIZE */ - CU_ASSERT(0 == nghttp2_hd_deflate_new(&deflater, 4096)); + assert_int(0, ==, nghttp2_hd_deflate_new(&deflater, 4096)); - blocklen = nghttp2_hd_deflate_hd(deflater, buf, (size_t)(blocklen - 1), nva, - ARRLEN(nva)); + blocklen = nghttp2_hd_deflate_hd2(deflater, buf, (size_t)(blocklen - 1), nva, + ARRLEN(nva)); - CU_ASSERT(NGHTTP2_ERR_INSUFF_BUFSIZE == blocklen); + assert_ptrdiff(NGHTTP2_ERR_INSUFF_BUFSIZE, ==, blocklen); nghttp2_hd_deflate_del(deflater); } @@ -1284,15 +1328,15 @@ void test_nghttp2_hd_deflate_hd_vec(void) { nghttp2_hd_deflater *deflater; nghttp2_hd_inflater *inflater; nghttp2_nv nva[] = { - MAKE_NV(":method", "PUT"), - MAKE_NV(":scheme", "https"), - MAKE_NV(":authority", "localhost:3000"), - MAKE_NV(":path", "/usr/foo/alpha/bravo"), - MAKE_NV("content-type", "image/png"), - MAKE_NV("content-length", "1000000007"), + MAKE_NV(":method", "PUT"), + MAKE_NV(":scheme", "https"), + MAKE_NV(":authority", "localhost:3000"), + MAKE_NV(":path", "/usr/foo/alpha/bravo"), + MAKE_NV("content-type", "image/png"), + MAKE_NV("content-length", "1000000007"), }; uint8_t buf[4096]; - ssize_t blocklen; + nghttp2_ssize blocklen; nghttp2_mem *mem; nghttp2_vec vec[256]; size_t buflen; @@ -1314,16 +1358,16 @@ void test_nghttp2_hd_deflate_hd_vec(void) { vec[1].base = &buf[buflen / 2]; vec[1].len = buflen / 2; - blocklen = nghttp2_hd_deflate_hd_vec(deflater, vec, 2, nva, ARRLEN(nva)); + blocklen = nghttp2_hd_deflate_hd_vec2(deflater, vec, 2, nva, ARRLEN(nva)); - CU_ASSERT(blocklen > 0); + assert_ptrdiff(0, <, blocklen); nghttp2_bufs_wrap_init(&bufs, buf, (size_t)blocklen, mem); bufs.head->buf.last += blocklen; - CU_ASSERT(blocklen == inflate_hd(inflater, &out, &bufs, 0, mem)); + assert_ptrdiff(blocklen, ==, inflate_hd(inflater, &out, &bufs, 0, mem)); - CU_ASSERT(ARRLEN(nva) == out.nvlen); + assert_size(ARRLEN(nva), ==, out.nvlen); assert_nv_equal(nva, out.nva, ARRLEN(nva), mem); nghttp2_bufs_wrap_free(&bufs); @@ -1336,9 +1380,9 @@ void test_nghttp2_hd_deflate_hd_vec(void) { nghttp2_hd_deflate_new(&deflater, 4096); nghttp2_hd_inflate_new(&inflater); - blocklen = nghttp2_hd_deflate_hd_vec(deflater, NULL, 0, nva, ARRLEN(nva)); + blocklen = nghttp2_hd_deflate_hd_vec2(deflater, NULL, 0, nva, ARRLEN(nva)); - CU_ASSERT(NGHTTP2_ERR_INSUFF_BUFSIZE == blocklen); + assert_ptrdiff(NGHTTP2_ERR_INSUFF_BUFSIZE, ==, blocklen); nghttp2_hd_inflate_del(inflater); nghttp2_hd_deflate_del(deflater); @@ -1352,9 +1396,9 @@ void test_nghttp2_hd_deflate_hd_vec(void) { nghttp2_hd_deflate_new(&deflater, 4096); nghttp2_hd_inflate_new(&inflater); - blocklen = nghttp2_hd_deflate_hd_vec(deflater, vec, 2, nva, ARRLEN(nva)); + blocklen = nghttp2_hd_deflate_hd_vec2(deflater, vec, 2, nva, ARRLEN(nva)); - CU_ASSERT(NGHTTP2_ERR_INSUFF_BUFSIZE == blocklen); + assert_ptrdiff(NGHTTP2_ERR_INSUFF_BUFSIZE, ==, blocklen); nghttp2_hd_inflate_del(inflater); nghttp2_hd_deflate_del(deflater); @@ -1370,15 +1414,15 @@ void test_nghttp2_hd_deflate_hd_vec(void) { vec[1].base = &buf[buflen / 2]; vec[1].len = (buflen / 2) + 1; - blocklen = nghttp2_hd_deflate_hd_vec(deflater, vec, 2, nva, ARRLEN(nva)); + blocklen = nghttp2_hd_deflate_hd_vec2(deflater, vec, 2, nva, ARRLEN(nva)); - CU_ASSERT(blocklen > 0); + assert_ptrdiff(0, <, blocklen); nghttp2_bufs_wrap_init(&bufs, buf, (size_t)blocklen, mem); bufs.head->buf.last += blocklen; - CU_ASSERT(blocklen == inflate_hd(inflater, &out, &bufs, 0, mem)); - CU_ASSERT(ARRLEN(nva) == out.nvlen); + assert_ptrdiff(blocklen, ==, inflate_hd(inflater, &out, &bufs, 0, mem)); + assert_size(ARRLEN(nva), ==, out.nvlen); assert_nv_equal(nva, out.nva, ARRLEN(nva), mem); nghttp2_bufs_wrap_free(&bufs); @@ -1400,15 +1444,16 @@ void test_nghttp2_hd_deflate_hd_vec(void) { vec[i].len = 1; } - blocklen = nghttp2_hd_deflate_hd_vec(deflater, vec, buflen, nva, ARRLEN(nva)); + blocklen = + nghttp2_hd_deflate_hd_vec2(deflater, vec, buflen, nva, ARRLEN(nva)); - CU_ASSERT(blocklen > 0); + assert_ptrdiff(0, <, blocklen); nghttp2_bufs_wrap_init(&bufs, buf, (size_t)blocklen, mem); bufs.head->buf.last += blocklen; - CU_ASSERT(blocklen == inflate_hd(inflater, &out, &bufs, 0, mem)); - CU_ASSERT(ARRLEN(nva) == out.nvlen); + assert_ptrdiff(blocklen, ==, inflate_hd(inflater, &out, &bufs, 0, mem)); + assert_size(ARRLEN(nva), ==, out.nvlen); assert_nv_equal(nva, out.nva, ARRLEN(nva), mem); nghttp2_bufs_wrap_free(&bufs); @@ -1453,7 +1498,7 @@ void test_nghttp2_hd_decode_length(void) { uint8_t buf[16]; uint8_t *bufp; size_t len; - ssize_t rv; + nghttp2_ssize rv; size_t i; memset(buf, 0, sizeof(buf)); @@ -1461,9 +1506,9 @@ void test_nghttp2_hd_decode_length(void) { rv = nghttp2_hd_decode_length(&out, &shift, &fin, 0, 0, buf, buf + len, 7); - CU_ASSERT((ssize_t)len == rv); - CU_ASSERT(0 != fin); - CU_ASSERT(UINT32_MAX == out); + assert_ptrdiff((nghttp2_ssize)len, ==, rv); + assert_true(fin); + assert_uint32(UINT32_MAX, ==, out); /* Make sure that we can decode integer if we feed 1 byte at a time */ @@ -1476,16 +1521,16 @@ void test_nghttp2_hd_decode_length(void) { rv = nghttp2_hd_decode_length(&out, &shift, &fin, out, shift, bufp, bufp + 1, 7); - CU_ASSERT(rv == 1); + assert_ptrdiff(1, ==, rv); if (fin) { break; } } - CU_ASSERT(i == len - 1); - CU_ASSERT(0 != fin); - CU_ASSERT(UINT32_MAX == out); + assert_size(len - 1, ==, i); + assert_true(fin); + assert_size(UINT32_MAX, ==, out); /* Check overflow case */ memset(buf, 0, sizeof(buf)); @@ -1493,7 +1538,7 @@ void test_nghttp2_hd_decode_length(void) { rv = nghttp2_hd_decode_length(&out, &shift, &fin, 0, 0, buf, buf + len, 7); - CU_ASSERT(-1 == rv); + assert_ptrdiff(-1, ==, rv); /* Check the case that shift goes beyond 32 bits */ buf[0] = 255; @@ -1506,12 +1551,12 @@ void test_nghttp2_hd_decode_length(void) { rv = nghttp2_hd_decode_length(&out, &shift, &fin, 0, 0, buf, buf + 7, 8); - CU_ASSERT(-1 == rv); + assert_ptrdiff(-1, ==, rv); } void test_nghttp2_hd_huff_encode(void) { int rv; - ssize_t len; + nghttp2_ssize len; nghttp2_buf outbuf; nghttp2_bufs bufs; nghttp2_hd_huff_decode_context ctx; @@ -1524,17 +1569,17 @@ void test_nghttp2_hd_huff_encode(void) { rv = nghttp2_hd_huff_encode(&bufs, t1, sizeof(t1)); - CU_ASSERT(rv == 0); + assert_int(0, ==, rv); nghttp2_hd_huff_decode_context_init(&ctx); len = nghttp2_hd_huff_decode(&ctx, &outbuf, bufs.cur->buf.pos, nghttp2_bufs_len(&bufs), 1); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == len); - CU_ASSERT((ssize_t)sizeof(t1) == nghttp2_buf_len(&outbuf)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, len); + assert_size(sizeof(t1), ==, nghttp2_buf_len(&outbuf)); - CU_ASSERT(0 == memcmp(t1, outbuf.pos, sizeof(t1))); + assert_memory_equal(sizeof(t1), t1, outbuf.pos); nghttp2_bufs_free(&bufs); } @@ -1544,34 +1589,34 @@ void test_nghttp2_hd_huff_decode(void) { nghttp2_hd_huff_decode_context ctx; nghttp2_buf outbuf; uint8_t b[256]; - ssize_t len; + nghttp2_ssize len; nghttp2_buf_wrap_init(&outbuf, b, sizeof(b)); nghttp2_hd_huff_decode_context_init(&ctx); len = nghttp2_hd_huff_decode(&ctx, &outbuf, e, 1, 1); - CU_ASSERT(1 == len); - CU_ASSERT(0 == memcmp("a", outbuf.pos, 1)); + assert_ptrdiff(1, ==, len); + assert_memory_equal(1, "a", outbuf.pos); /* Premature sequence must elicit decoding error */ nghttp2_buf_wrap_init(&outbuf, b, sizeof(b)); nghttp2_hd_huff_decode_context_init(&ctx); len = nghttp2_hd_huff_decode(&ctx, &outbuf, e, 2, 1); - CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == len); + assert_ptrdiff(NGHTTP2_ERR_HEADER_COMP, ==, len); /* Fully decoding EOS is error */ nghttp2_buf_wrap_init(&outbuf, b, sizeof(b)); nghttp2_hd_huff_decode_context_init(&ctx); len = nghttp2_hd_huff_decode(&ctx, &outbuf, e, 2, 6); - CU_ASSERT(NGHTTP2_ERR_HEADER_COMP == len); + assert_ptrdiff(NGHTTP2_ERR_HEADER_COMP, ==, len); /* Check failure state */ nghttp2_buf_wrap_init(&outbuf, b, sizeof(b)); nghttp2_hd_huff_decode_context_init(&ctx); len = nghttp2_hd_huff_decode(&ctx, &outbuf, e, 5, 0); - CU_ASSERT(5 == len); - CU_ASSERT(nghttp2_hd_huff_decode_failure_state(&ctx)); + assert_ptrdiff(5, ==, len); + assert_true(nghttp2_hd_huff_decode_failure_state(&ctx)); } diff --git a/lib/nghttp2-1.65.0/tests/nghttp2_hd_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_hd_test.h new file mode 100644 index 00000000000..3c170338bb0 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/nghttp2_hd_test.h @@ -0,0 +1,61 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_HD_TEST_H +#define NGHTTP2_HD_TEST_H + +#ifdef HAVE_CONFIG_H +# include +#endif /* HAVE_CONFIG_H */ + +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite hd_suite; + +munit_void_test_decl(test_nghttp2_hd_deflate) +munit_void_test_decl(test_nghttp2_hd_deflate_same_indexed_repr) +munit_void_test_decl(test_nghttp2_hd_inflate_indexed) +munit_void_test_decl(test_nghttp2_hd_inflate_indname_noinc) +munit_void_test_decl(test_nghttp2_hd_inflate_indname_inc) +munit_void_test_decl(test_nghttp2_hd_inflate_indname_inc_eviction) +munit_void_test_decl(test_nghttp2_hd_inflate_newname_noinc) +munit_void_test_decl(test_nghttp2_hd_inflate_newname_inc) +munit_void_test_decl(test_nghttp2_hd_inflate_clearall_inc) +munit_void_test_decl(test_nghttp2_hd_inflate_zero_length_huffman) +munit_void_test_decl(test_nghttp2_hd_inflate_expect_table_size_update) +munit_void_test_decl(test_nghttp2_hd_inflate_unexpected_table_size_update) +munit_void_test_decl(test_nghttp2_hd_ringbuf_reserve) +munit_void_test_decl(test_nghttp2_hd_change_table_size) +munit_void_test_decl(test_nghttp2_hd_deflate_inflate) +munit_void_test_decl(test_nghttp2_hd_no_index) +munit_void_test_decl(test_nghttp2_hd_deflate_bound) +munit_void_test_decl(test_nghttp2_hd_public_api) +munit_void_test_decl(test_nghttp2_hd_deflate_hd_vec) +munit_void_test_decl(test_nghttp2_hd_decode_length) +munit_void_test_decl(test_nghttp2_hd_huff_encode) +munit_void_test_decl(test_nghttp2_hd_huff_decode) + +#endif /* NGHTTP2_HD_TEST_H */ diff --git a/lib/nghttp2-1.65.0/tests/nghttp2_helper_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_helper_test.c new file mode 100644 index 00000000000..1a6056914f2 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/nghttp2_helper_test.c @@ -0,0 +1,205 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2013 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include "nghttp2_helper_test.h" + +#include + +#include "munit.h" + +#include "nghttp2_helper.h" + +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_adjust_local_window_size), + munit_void_test(test_nghttp2_check_header_name), + munit_void_test(test_nghttp2_check_header_value), + munit_void_test(test_nghttp2_check_header_value_rfc9113), + munit_test_end(), +}; + +const MunitSuite helper_suite = { + "/helper", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + +void test_nghttp2_adjust_local_window_size(void) { + int32_t local_window_size = 100; + int32_t recv_window_size = 50; + int32_t recv_reduction = 0; + int32_t delta; + + delta = 0; + assert_int(0, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(100, ==, local_window_size); + assert_int32(50, ==, recv_window_size); + assert_int32(0, ==, recv_reduction); + assert_int32(0, ==, delta); + + delta = 49; + assert_int(0, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(100, ==, local_window_size); + assert_int32(1, ==, recv_window_size); + assert_int32(0, ==, recv_reduction); + assert_int32(49, ==, delta); + + delta = 1; + assert_int(0, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(100, ==, local_window_size); + assert_int32(0, ==, recv_window_size); + assert_int32(0, ==, recv_reduction); + assert_int32(1, ==, delta); + + delta = 1; + assert_int(0, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(101, ==, local_window_size); + assert_int32(0, ==, recv_window_size); + assert_int32(0, ==, recv_reduction); + assert_int32(1, ==, delta); + + delta = -1; + assert_int(0, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(100, ==, local_window_size); + assert_int32(-1, ==, recv_window_size); + assert_int32(1, ==, recv_reduction); + assert_int32(0, ==, delta); + + delta = 1; + assert_int(0, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(101, ==, local_window_size); + assert_int32(0, ==, recv_window_size); + assert_int32(0, ==, recv_reduction); + assert_int32(0, ==, delta); + + delta = 100; + assert_int(0, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(201, ==, local_window_size); + assert_int32(0, ==, recv_window_size); + assert_int32(0, ==, recv_reduction); + assert_int32(100, ==, delta); + + delta = -3; + assert_int(0, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(198, ==, local_window_size); + assert_int32(-3, ==, recv_window_size); + assert_int32(3, ==, recv_reduction); + assert_int32(0, ==, delta); + + recv_window_size += 3; + + delta = 3; + assert_int(0, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(201, ==, local_window_size); + assert_int32(3, ==, recv_window_size); + assert_int32(0, ==, recv_reduction); + assert_int32(0, ==, delta); + + local_window_size = 100; + recv_window_size = 50; + recv_reduction = 0; + delta = INT32_MAX; + assert_int(NGHTTP2_ERR_FLOW_CONTROL, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(100, ==, local_window_size); + assert_int32(50, ==, recv_window_size); + assert_int32(0, ==, recv_reduction); + assert_int32(INT32_MAX, ==, delta); + + delta = INT32_MIN; + assert_int(NGHTTP2_ERR_FLOW_CONTROL, ==, + nghttp2_adjust_local_window_size( + &local_window_size, &recv_window_size, &recv_reduction, &delta)); + assert_int32(100, ==, local_window_size); + assert_int32(50, ==, recv_window_size); + assert_int32(0, ==, recv_reduction); + assert_int32(INT32_MIN, ==, delta); +} + +#define check_header_name(S) \ + nghttp2_check_header_name((const uint8_t *)S, sizeof(S) - 1) + +void test_nghttp2_check_header_name(void) { + assert_true(check_header_name(":path")); + assert_true(check_header_name("path")); + assert_true(check_header_name("!#$%&'*+-.^_`|~")); + assert_false(check_header_name(":PATH")); + assert_false(check_header_name("path:")); + assert_false(check_header_name("")); + assert_false(check_header_name(":")); +} + +#define check_header_value(S) \ + nghttp2_check_header_value((const uint8_t *)S, sizeof(S) - 1) + +void test_nghttp2_check_header_value(void) { + uint8_t goodval[] = {'a', 'b', 0x80u, 'c', 0xffu, 'd', '\t', ' '}; + uint8_t badval1[] = {'a', 0x1fu, 'b'}; + uint8_t badval2[] = {'a', 0x7fu, 'b'}; + + assert_true(check_header_value(" !|}~")); + assert_true(check_header_value(goodval)); + assert_false(check_header_value(badval1)); + assert_false(check_header_value(badval2)); + assert_true(check_header_value("")); + assert_true(check_header_value(" ")); + assert_true(check_header_value("\t")); +} + +#define check_header_value_rfc9113(S) \ + nghttp2_check_header_value_rfc9113((const uint8_t *)S, sizeof(S) - 1) + +void test_nghttp2_check_header_value_rfc9113(void) { + uint8_t goodval[] = {'a', 'b', 0x80u, 'c', 0xffu, 'd'}; + uint8_t badval1[] = {'a', 0x1fu, 'b'}; + uint8_t badval2[] = {'a', 0x7fu, 'b'}; + + assert_true(check_header_value_rfc9113("!|}~")); + assert_false(check_header_value_rfc9113(" !|}~")); + assert_false(check_header_value_rfc9113("!|}~ ")); + assert_false(check_header_value_rfc9113("\t!|}~")); + assert_false(check_header_value_rfc9113("!|}~\t")); + assert_true(check_header_value_rfc9113(goodval)); + assert_false(check_header_value_rfc9113(badval1)); + assert_false(check_header_value_rfc9113(badval2)); + assert_true(check_header_value_rfc9113("")); + assert_false(check_header_value_rfc9113(" ")); + assert_false(check_header_value_rfc9113("\t")); +} diff --git a/lib/nghttp2/tests/nghttp2_helper_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_helper_test.h similarity index 80% rename from lib/nghttp2/tests/nghttp2_helper_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_helper_test.h index 8790dcf6d5e..9196d9f2547 100644 --- a/lib/nghttp2/tests/nghttp2_helper_test.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_helper_test.h @@ -29,9 +29,15 @@ # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_adjust_local_window_size(void); -void test_nghttp2_check_header_name(void); -void test_nghttp2_check_header_value(void); -void test_nghttp2_check_header_value_rfc9113(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite helper_suite; + +munit_void_test_decl(test_nghttp2_adjust_local_window_size) +munit_void_test_decl(test_nghttp2_check_header_name) +munit_void_test_decl(test_nghttp2_check_header_value) +munit_void_test_decl(test_nghttp2_check_header_value_rfc9113) #endif /* NGHTTP2_HELPER_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_http_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_http_test.c similarity index 71% rename from lib/nghttp2/tests/nghttp2_http_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_http_test.c index 19f345bae79..01d6c75d376 100644 --- a/lib/nghttp2/tests/nghttp2_http_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_http_test.c @@ -28,11 +28,20 @@ #include #include -#include +#include "munit.h" #include "nghttp2_http.h" #include "nghttp2_test_helper.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_http_parse_priority), + munit_test_end(), +}; + +const MunitSuite http_suite = { + "/http", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + void test_nghttp2_http_parse_priority(void) { int rv; @@ -42,9 +51,9 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(0 == rv); - CU_ASSERT((uint32_t)-1 == pri.urgency); - CU_ASSERT(-1 == pri.inc); + assert_int(0, ==, rv); + assert_uint32((uint32_t)-1, ==, pri.urgency); + assert_int(-1, ==, pri.inc); } { @@ -53,9 +62,9 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(0 == rv); - CU_ASSERT((uint32_t)7 == pri.urgency); - CU_ASSERT(1 == pri.inc); + assert_int(0, ==, rv); + assert_uint32((uint32_t)7, ==, pri.urgency); + assert_int(1, ==, pri.inc); } { @@ -64,9 +73,9 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(0 == rv); - CU_ASSERT((uint32_t)0 == pri.urgency); - CU_ASSERT(0 == pri.inc); + assert_int(0, ==, rv); + assert_uint32((uint32_t)0, ==, pri.urgency); + assert_int(0, ==, pri.inc); } { @@ -75,9 +84,9 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(0 == rv); - CU_ASSERT((uint32_t)3 == pri.urgency); - CU_ASSERT(1 == pri.inc); + assert_int(0, ==, rv); + assert_uint32((uint32_t)3, ==, pri.urgency); + assert_int(1, ==, pri.inc); } { @@ -86,9 +95,9 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(0 == rv); - CU_ASSERT((uint32_t)6 == pri.urgency); - CU_ASSERT(0 == pri.inc); + assert_int(0, ==, rv); + assert_uint32((uint32_t)6, ==, pri.urgency); + assert_int(0, ==, pri.inc); } { @@ -97,7 +106,7 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } { @@ -106,7 +115,7 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } { @@ -115,7 +124,7 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } { @@ -124,7 +133,7 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } { @@ -133,9 +142,9 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(0 == rv); - CU_ASSERT((uint32_t)-1 == pri.urgency); - CU_ASSERT(1 == pri.inc); + assert_int(0, ==, rv); + assert_uint32((uint32_t)-1, ==, pri.urgency); + assert_int(1, ==, pri.inc); } { @@ -144,7 +153,7 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } { @@ -153,7 +162,7 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } { @@ -162,7 +171,7 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } { @@ -171,7 +180,7 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } { @@ -180,19 +189,19 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } { nghttp2_extpri pri = {(uint32_t)-1, -1}; const uint8_t v[] = - "i=?0, u=1, a=(x y z), u=2; i=?0;foo=\",,,\", i=?1;i=?0; u=6"; + "i=?0, u=1, a=(x y z), u=2; i=?0;foo=\",,,\", i=?1;i=?0; u=6"; rv = nghttp2_http_parse_priority(&pri, v, sizeof(v) - 1); - CU_ASSERT(0 == rv); - CU_ASSERT((uint32_t)2 == pri.urgency); - CU_ASSERT(1 == pri.inc); + assert_int(0, ==, rv); + assert_uint32((uint32_t)2, ==, pri.urgency); + assert_int(1, ==, pri.inc); } { @@ -201,6 +210,6 @@ void test_nghttp2_http_parse_priority(void) { rv = nghttp2_http_parse_priority(&pri, v, sizeof(v)); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); } } diff --git a/lib/nghttp2/tests/nghttp2_http_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_http_test.h similarity index 90% rename from lib/nghttp2/tests/nghttp2_http_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_http_test.h index e616cdcf492..9e577ae9314 100644 --- a/lib/nghttp2/tests/nghttp2_http_test.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_http_test.h @@ -30,6 +30,12 @@ # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_http_parse_priority(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite http_suite; + +munit_void_test_decl(test_nghttp2_http_parse_priority) #endif /* NGHTTP2_HTTP_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_map_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_map_test.c similarity index 65% rename from lib/nghttp2/tests/nghttp2_map_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_map_test.c index 7ba9bd6b669..4e41518fe1b 100644 --- a/lib/nghttp2/tests/nghttp2_map_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_map_test.c @@ -27,10 +27,22 @@ #include -#include +#include "munit.h" #include "nghttp2_map.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_map), + munit_void_test(test_nghttp2_map_functional), + munit_void_test(test_nghttp2_map_each), + munit_void_test(test_nghttp2_map_clear), + munit_test_end(), +}; + +const MunitSuite map_suite = { + "/map", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + typedef struct strentry { nghttp2_map_key_type key; const char *str; @@ -53,43 +65,43 @@ void test_nghttp2_map(void) { strentry_init(&baz, 3, "baz"); strentry_init(&shrubbery, 4, "shrubbery"); - CU_ASSERT(0 == nghttp2_map_insert(&map, foo.key, &foo)); - CU_ASSERT(strcmp("foo", ((strentry *)nghttp2_map_find(&map, 1))->str) == 0); - CU_ASSERT(1 == nghttp2_map_size(&map)); + assert_int(0, ==, nghttp2_map_insert(&map, foo.key, &foo)); + assert_string_equal("foo", ((strentry *)nghttp2_map_find(&map, 1))->str); + assert_size(1, ==, nghttp2_map_size(&map)); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_map_insert(&map, FOO.key, &FOO)); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_map_insert(&map, FOO.key, &FOO)); - CU_ASSERT(1 == nghttp2_map_size(&map)); - CU_ASSERT(strcmp("foo", ((strentry *)nghttp2_map_find(&map, 1))->str) == 0); + assert_size(1, ==, nghttp2_map_size(&map)); + assert_string_equal("foo", ((strentry *)nghttp2_map_find(&map, 1))->str); - CU_ASSERT(0 == nghttp2_map_insert(&map, bar.key, &bar)); - CU_ASSERT(2 == nghttp2_map_size(&map)); + assert_int(0, ==, nghttp2_map_insert(&map, bar.key, &bar)); + assert_size(2, ==, nghttp2_map_size(&map)); - CU_ASSERT(0 == nghttp2_map_insert(&map, baz.key, &baz)); - CU_ASSERT(3 == nghttp2_map_size(&map)); + assert_int(0, ==, nghttp2_map_insert(&map, baz.key, &baz)); + assert_size(3, ==, nghttp2_map_size(&map)); - CU_ASSERT(0 == nghttp2_map_insert(&map, shrubbery.key, &shrubbery)); - CU_ASSERT(4 == nghttp2_map_size(&map)); + assert_int(0, ==, nghttp2_map_insert(&map, shrubbery.key, &shrubbery)); + assert_size(4, ==, nghttp2_map_size(&map)); - CU_ASSERT(strcmp("baz", ((strentry *)nghttp2_map_find(&map, 3))->str) == 0); + assert_string_equal("baz", ((strentry *)nghttp2_map_find(&map, 3))->str); nghttp2_map_remove(&map, 3); - CU_ASSERT(3 == nghttp2_map_size(&map)); - CU_ASSERT(NULL == nghttp2_map_find(&map, 3)); + assert_size(3, ==, nghttp2_map_size(&map)); + assert_null(nghttp2_map_find(&map, 3)); nghttp2_map_remove(&map, 1); - CU_ASSERT(2 == nghttp2_map_size(&map)); - CU_ASSERT(NULL == nghttp2_map_find(&map, 1)); + assert_size(2, ==, nghttp2_map_size(&map)); + assert_null(nghttp2_map_find(&map, 1)); /* Erasing non-existent entry */ nghttp2_map_remove(&map, 1); - CU_ASSERT(2 == nghttp2_map_size(&map)); - CU_ASSERT(NULL == nghttp2_map_find(&map, 1)); + assert_size(2, ==, nghttp2_map_size(&map)); + assert_null(nghttp2_map_find(&map, 1)); - CU_ASSERT(strcmp("bar", ((strentry *)nghttp2_map_find(&map, 2))->str) == 0); - CU_ASSERT(strcmp("shrubbery", ((strentry *)nghttp2_map_find(&map, 4))->str) == - 0); + assert_string_equal("bar", ((strentry *)nghttp2_map_find(&map, 2))->str); + assert_string_equal("shrubbery", + ((strentry *)nghttp2_map_find(&map, 4))->str); nghttp2_map_free(&map); } @@ -129,33 +141,33 @@ void test_nghttp2_map_functional(void) { shuffle(order, NUM_ENT); for (i = 0; i < NUM_ENT; ++i) { ent = &arr[order[i] - 1]; - CU_ASSERT(0 == nghttp2_map_insert(&map, ent->key, ent)); + assert_int(0, ==, nghttp2_map_insert(&map, ent->key, ent)); } - CU_ASSERT(NUM_ENT == nghttp2_map_size(&map)); + assert_size(NUM_ENT, ==, nghttp2_map_size(&map)); /* traverse */ nghttp2_map_each(&map, eachfun, NULL); /* find */ shuffle(order, NUM_ENT); for (i = 0; i < NUM_ENT; ++i) { - CU_ASSERT(NULL != nghttp2_map_find(&map, (nghttp2_map_key_type)order[i])); + assert_not_null(nghttp2_map_find(&map, (nghttp2_map_key_type)order[i])); } /* remove */ for (i = 0; i < NUM_ENT; ++i) { - CU_ASSERT(0 == nghttp2_map_remove(&map, (nghttp2_map_key_type)order[i])); + assert_int(0, ==, nghttp2_map_remove(&map, (nghttp2_map_key_type)order[i])); } - /* each_free (but no op function for testing purpose) */ + /* each (but no op function for testing purpose) */ for (i = 0; i < NUM_ENT; ++i) { strentry_init(&arr[i], (nghttp2_map_key_type)(i + 1), "foo"); } /* insert once again */ for (i = 0; i < NUM_ENT; ++i) { ent = &arr[i]; - CU_ASSERT(0 == nghttp2_map_insert(&map, ent->key, ent)); + assert_int(0, ==, nghttp2_map_insert(&map, ent->key, ent)); } - nghttp2_map_each_free(&map, eachfun, NULL); + nghttp2_map_each(&map, eachfun, NULL); nghttp2_map_free(&map); } @@ -166,7 +178,7 @@ static int entry_free(void *data, void *ptr) { return 0; } -void test_nghttp2_map_each_free(void) { +void test_nghttp2_map_each(void) { const nghttp2_mem *mem = nghttp2_mem_default(); strentry *foo = mem->malloc(sizeof(strentry), NULL), *bar = mem->malloc(sizeof(strentry), NULL), @@ -185,7 +197,7 @@ void test_nghttp2_map_each_free(void) { nghttp2_map_insert(&map, baz->key, baz); nghttp2_map_insert(&map, shrubbery->key, shrubbery); - nghttp2_map_each_free(&map, entry_free, (void *)mem); + nghttp2_map_each(&map, entry_free, (void *)mem); nghttp2_map_free(&map); } @@ -198,11 +210,11 @@ void test_nghttp2_map_clear(void) { nghttp2_map_init(&map, mem); - CU_ASSERT(0 == nghttp2_map_insert(&map, foo.key, &foo)); + assert_int(0, ==, nghttp2_map_insert(&map, foo.key, &foo)); nghttp2_map_clear(&map); - CU_ASSERT(0 == nghttp2_map_size(&map)); + assert_size(0, ==, nghttp2_map_size(&map)); nghttp2_map_free(&map); } diff --git a/lib/nghttp2/tests/nghttp2_map_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_map_test.h similarity index 83% rename from lib/nghttp2/tests/nghttp2_map_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_map_test.h index 235624de182..d64f2489e6a 100644 --- a/lib/nghttp2/tests/nghttp2_map_test.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_map_test.h @@ -30,9 +30,15 @@ # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_map(void); -void test_nghttp2_map_functional(void); -void test_nghttp2_map_each_free(void); -void test_nghttp2_map_clear(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite map_suite; + +munit_void_test_decl(test_nghttp2_map) +munit_void_test_decl(test_nghttp2_map_functional) +munit_void_test_decl(test_nghttp2_map_each) +munit_void_test_decl(test_nghttp2_map_clear) #endif /* NGHTTP2_MAP_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_pq_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_pq_test.c similarity index 76% rename from lib/nghttp2/tests/nghttp2_pq_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_pq_test.c index 90db26de39d..08a356f376a 100644 --- a/lib/nghttp2/tests/nghttp2_pq_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_pq_test.c @@ -26,10 +26,19 @@ #include -#include - #include "nghttp2_pq.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_pq), + munit_void_test(test_nghttp2_pq_update), + munit_void_test(test_nghttp2_pq_remove), + munit_test_end(), +}; + +const MunitSuite pq_suite = { + "/pq", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + typedef struct { nghttp2_pq_entry ent; const char *s; @@ -59,59 +68,59 @@ void test_nghttp2_pq(void) { string_entry *top; nghttp2_pq_init(&pq, pq_less, nghttp2_mem_default()); - CU_ASSERT(nghttp2_pq_empty(&pq)); - CU_ASSERT(0 == nghttp2_pq_size(&pq)); - CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("foo")->ent)); - CU_ASSERT(0 == nghttp2_pq_empty(&pq)); - CU_ASSERT(1 == nghttp2_pq_size(&pq)); + assert_true(nghttp2_pq_empty(&pq)); + assert_size(0, ==, nghttp2_pq_size(&pq)); + assert_int(0, ==, nghttp2_pq_push(&pq, &string_entry_new("foo")->ent)); + assert_false(nghttp2_pq_empty(&pq)); + assert_size(1, ==, nghttp2_pq_size(&pq)); top = (string_entry *)nghttp2_pq_top(&pq); - CU_ASSERT(strcmp("foo", top->s) == 0); - CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("bar")->ent)); + assert_string_equal("foo", top->s); + assert_int(0, ==, nghttp2_pq_push(&pq, &string_entry_new("bar")->ent)); top = (string_entry *)nghttp2_pq_top(&pq); - CU_ASSERT(strcmp("bar", top->s) == 0); - CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("baz")->ent)); + assert_string_equal("bar", top->s); + assert_int(0, ==, nghttp2_pq_push(&pq, &string_entry_new("baz")->ent)); top = (string_entry *)nghttp2_pq_top(&pq); - CU_ASSERT(strcmp("bar", top->s) == 0); - CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("C")->ent)); - CU_ASSERT(4 == nghttp2_pq_size(&pq)); + assert_string_equal("bar", top->s); + assert_int(0, ==, nghttp2_pq_push(&pq, &string_entry_new("C")->ent)); + assert_size(4, ==, nghttp2_pq_size(&pq)); top = (string_entry *)nghttp2_pq_top(&pq); - CU_ASSERT(strcmp("C", top->s) == 0); + assert_string_equal("C", top->s); string_entry_del(top); nghttp2_pq_pop(&pq); - CU_ASSERT(3 == nghttp2_pq_size(&pq)); + assert_size(3, ==, nghttp2_pq_size(&pq)); top = (string_entry *)nghttp2_pq_top(&pq); - CU_ASSERT(strcmp("bar", top->s) == 0); + assert_string_equal("bar", top->s); nghttp2_pq_pop(&pq); string_entry_del(top); top = (string_entry *)nghttp2_pq_top(&pq); - CU_ASSERT(strcmp("baz", top->s) == 0); + assert_string_equal("baz", top->s); nghttp2_pq_pop(&pq); string_entry_del(top); top = (string_entry *)nghttp2_pq_top(&pq); - CU_ASSERT(strcmp("foo", top->s) == 0); + assert_string_equal("foo", top->s); nghttp2_pq_pop(&pq); string_entry_del(top); - CU_ASSERT(nghttp2_pq_empty(&pq)); - CU_ASSERT(0 == nghttp2_pq_size(&pq)); - CU_ASSERT(NULL == nghttp2_pq_top(&pq)); + assert_true(nghttp2_pq_empty(&pq)); + assert_size(0, ==, nghttp2_pq_size(&pq)); + assert_null(nghttp2_pq_top(&pq)); /* Add bunch of entry to see realloc works */ for (i = 0; i < 10000; ++i) { - CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("foo")->ent)); - CU_ASSERT((size_t)(i + 1) == nghttp2_pq_size(&pq)); + assert_int(0, ==, nghttp2_pq_push(&pq, &string_entry_new("foo")->ent)); + assert_size((size_t)(i + 1), ==, nghttp2_pq_size(&pq)); } for (i = 10000; i > 0; --i) { top = (string_entry *)nghttp2_pq_top(&pq); - CU_ASSERT(NULL != top); + assert_not_null(top); nghttp2_pq_pop(&pq); string_entry_del(top); - CU_ASSERT((size_t)(i - 1) == nghttp2_pq_size(&pq)); + assert_size((size_t)(i - 1), ==, nghttp2_pq_size(&pq)); } nghttp2_pq_free(&pq); @@ -160,7 +169,7 @@ void test_nghttp2_pq_update(void) { for (i = 0; i < (int)(sizeof(nodes) / sizeof(nodes[0])); ++i) { nd = (node *)nghttp2_pq_top(&pq); - CU_ASSERT(ans[i] == nd->key); + assert_int(ans[i], ==, nd->key); nghttp2_pq_pop(&pq); } @@ -180,8 +189,8 @@ static void check_nodes(nghttp2_pq *pq, size_t n, int *ans_key, int *ans_val) { size_t i; for (i = 0; i < n; ++i) { node *nd = (node *)nghttp2_pq_top(pq); - CU_ASSERT(ans_key[i] == nd->key); - CU_ASSERT(ans_val[i] == nd->val); + assert_int(ans_key[i], ==, nd->key); + assert_int(ans_val[i], ==, nd->val); nghttp2_pq_pop(pq); } } diff --git a/lib/nghttp2/tests/nghttp2_pq_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_pq_test.h similarity index 85% rename from lib/nghttp2/tests/nghttp2_pq_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_pq_test.h index 969662a954e..0917185ad99 100644 --- a/lib/nghttp2/tests/nghttp2_pq_test.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_pq_test.h @@ -29,8 +29,14 @@ # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_pq(void); -void test_nghttp2_pq_update(void); -void test_nghttp2_pq_remove(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite pq_suite; + +munit_void_test_decl(test_nghttp2_pq) +munit_void_test_decl(test_nghttp2_pq_update) +munit_void_test_decl(test_nghttp2_pq_remove) #endif /* NGHTTP2_PQ_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_queue_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_queue_test.c similarity index 76% rename from lib/nghttp2/tests/nghttp2_queue_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_queue_test.c index cb993a81b03..8989afa9dc8 100644 --- a/lib/nghttp2/tests/nghttp2_queue_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_queue_test.c @@ -26,25 +26,34 @@ #include -#include +#include "munit.h" #include "nghttp2_queue.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_queue), + munit_test_end(), +}; + +const MunitSuite queue_suite = { + "/queue", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + void test_nghttp2_queue(void) { int ints[] = {1, 2, 3, 4, 5}; int i; nghttp2_queue queue; nghttp2_queue_init(&queue); - CU_ASSERT(nghttp2_queue_empty(&queue)); + assert_true(nghttp2_queue_empty(&queue)); for (i = 0; i < 5; ++i) { nghttp2_queue_push(&queue, &ints[i]); - CU_ASSERT_EQUAL(ints[0], *(int *)(nghttp2_queue_front(&queue))); - CU_ASSERT(!nghttp2_queue_empty(&queue)); + assert_int(ints[0], ==, *(int *)(nghttp2_queue_front(&queue))); + assert_false(nghttp2_queue_empty(&queue)); } for (i = 0; i < 5; ++i) { - CU_ASSERT_EQUAL(ints[i], *(int *)(nghttp2_queue_front(&queue))); + assert_int(ints[i], ==, *(int *)(nghttp2_queue_front(&queue))); nghttp2_queue_pop(&queue); } - CU_ASSERT(nghttp2_queue_empty(&queue)); + assert_true(nghttp2_queue_empty(&queue)); nghttp2_queue_free(&queue); } diff --git a/lib/nghttp2/tests/nghttp2_queue_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_queue_test.h similarity index 90% rename from lib/nghttp2/tests/nghttp2_queue_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_queue_test.h index 64f8ce85a74..c7477a0cec7 100644 --- a/lib/nghttp2/tests/nghttp2_queue_test.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_queue_test.h @@ -29,6 +29,12 @@ # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_queue(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite queue_suite; + +munit_void_test_decl(test_nghttp2_queue) #endif /* NGHTTP2_QUEUE_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_ratelim_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_ratelim_test.c similarity index 66% rename from lib/nghttp2/tests/nghttp2_ratelim_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_ratelim_test.c index 6abece95291..bf0c792663f 100644 --- a/lib/nghttp2/tests/nghttp2_ratelim_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_ratelim_test.c @@ -26,67 +26,77 @@ #include -#include +#include "munit.h" #include "nghttp2_ratelim.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_ratelim_update), + munit_void_test(test_nghttp2_ratelim_drain), + munit_test_end(), +}; + +const MunitSuite ratelim_suite = { + "/ratelim", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + void test_nghttp2_ratelim_update(void) { nghttp2_ratelim rl; nghttp2_ratelim_init(&rl, 1000, 21); - CU_ASSERT(1000 == rl.val); - CU_ASSERT(1000 == rl.burst); - CU_ASSERT(21 == rl.rate); - CU_ASSERT(0 == rl.tstamp); + assert_uint64(1000, ==, rl.val); + assert_uint64(1000, ==, rl.burst); + assert_uint64(21, ==, rl.rate); + assert_uint64(0, ==, rl.tstamp); nghttp2_ratelim_update(&rl, 999); - CU_ASSERT(1000 == rl.val); - CU_ASSERT(999 == rl.tstamp); + assert_uint64(1000, ==, rl.val); + assert_uint64(999, ==, rl.tstamp); nghttp2_ratelim_drain(&rl, 100); - CU_ASSERT(900 == rl.val); + assert_uint64(900, ==, rl.val); nghttp2_ratelim_update(&rl, 1000); - CU_ASSERT(921 == rl.val); + assert_uint64(921, ==, rl.val); nghttp2_ratelim_update(&rl, 1002); - CU_ASSERT(963 == rl.val); + assert_uint64(963, ==, rl.val); nghttp2_ratelim_update(&rl, 1004); - CU_ASSERT(1000 == rl.val); - CU_ASSERT(1004 == rl.tstamp); + assert_uint64(1000, ==, rl.val); + assert_uint64(1004, ==, rl.tstamp); /* timer skew */ nghttp2_ratelim_init(&rl, 1000, 21); nghttp2_ratelim_update(&rl, 1); - CU_ASSERT(1000 == rl.val); + assert_uint64(1000, ==, rl.val); nghttp2_ratelim_update(&rl, 0); - CU_ASSERT(1000 == rl.val); + assert_uint64(1000, ==, rl.val); /* rate * duration overflow */ nghttp2_ratelim_init(&rl, 1000, 100); nghttp2_ratelim_drain(&rl, 999); - CU_ASSERT(1 == rl.val); + assert_uint64(1, ==, rl.val); nghttp2_ratelim_update(&rl, UINT64_MAX); - CU_ASSERT(1000 == rl.val); + assert_uint64(1000, ==, rl.val); /* val + rate * duration overflow */ nghttp2_ratelim_init(&rl, UINT64_MAX - 1, 2); nghttp2_ratelim_update(&rl, 1); - CU_ASSERT(UINT64_MAX - 1 == rl.val); + assert_uint64(UINT64_MAX - 1, ==, rl.val); } void test_nghttp2_ratelim_drain(void) { @@ -94,8 +104,8 @@ void test_nghttp2_ratelim_drain(void) { nghttp2_ratelim_init(&rl, 100, 7); - CU_ASSERT(-1 == nghttp2_ratelim_drain(&rl, 101)); - CU_ASSERT(0 == nghttp2_ratelim_drain(&rl, 51)); - CU_ASSERT(0 == nghttp2_ratelim_drain(&rl, 49)); - CU_ASSERT(-1 == nghttp2_ratelim_drain(&rl, 1)); + assert_int(-1, ==, nghttp2_ratelim_drain(&rl, 101)); + assert_int(0, ==, nghttp2_ratelim_drain(&rl, 51)); + assert_int(0, ==, nghttp2_ratelim_drain(&rl, 49)); + assert_int(-1, ==, nghttp2_ratelim_drain(&rl, 1)); } diff --git a/lib/nghttp2/tests/nghttp2_ratelim_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_ratelim_test.h similarity index 87% rename from lib/nghttp2/tests/nghttp2_ratelim_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_ratelim_test.h index 02b2f2b207c..0b087a8086e 100644 --- a/lib/nghttp2/tests/nghttp2_ratelim_test.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_ratelim_test.h @@ -29,7 +29,13 @@ # include #endif /* HAVE_CONFIG_H */ -void test_nghttp2_ratelim_update(void); -void test_nghttp2_ratelim_drain(void); +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite ratelim_suite; + +munit_void_test_decl(test_nghttp2_ratelim_update) +munit_void_test_decl(test_nghttp2_ratelim_drain) #endif /* NGHTTP2_RATELIM_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_session_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_session_test.c similarity index 53% rename from lib/nghttp2/tests/nghttp2_session_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_session_test.c index 9f6a6673474..528fe026ec0 100644 --- a/lib/nghttp2/tests/nghttp2_session_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_session_test.c @@ -27,16 +27,155 @@ #include #include -#include +#include "munit.h" #include "nghttp2_session.h" #include "nghttp2_stream.h" #include "nghttp2_net.h" #include "nghttp2_helper.h" #include "nghttp2_test_helper.h" +#include "nghttp2_assertion.h" #include "nghttp2_priority_spec.h" #include "nghttp2_extpri.h" +static const MunitTest tests[] = { + munit_void_test(test_nghttp2_session_recv), + munit_void_test(test_nghttp2_session_recv_invalid_stream_id), + munit_void_test(test_nghttp2_session_recv_invalid_frame), + munit_void_test(test_nghttp2_session_recv_eof), + munit_void_test(test_nghttp2_session_recv_data), + munit_void_test(test_nghttp2_session_recv_data_no_auto_flow_control), + munit_void_test(test_nghttp2_session_recv_continuation), + munit_void_test(test_nghttp2_session_recv_headers_with_priority), + munit_void_test(test_nghttp2_session_recv_headers_with_padding), + munit_void_test(test_nghttp2_session_recv_headers_early_response), + munit_void_test(test_nghttp2_session_recv_headers_for_closed_stream), + munit_void_test(test_nghttp2_session_recv_headers_with_extpri), + munit_void_test(test_nghttp2_session_server_recv_push_response), + munit_void_test(test_nghttp2_session_recv_premature_headers), + munit_void_test(test_nghttp2_session_recv_unknown_frame), + munit_void_test(test_nghttp2_session_recv_unexpected_continuation), + munit_void_test(test_nghttp2_session_recv_settings_header_table_size), + munit_void_test(test_nghttp2_session_recv_too_large_frame_length), + munit_void_test(test_nghttp2_session_recv_extension), + munit_void_test(test_nghttp2_session_recv_altsvc), + munit_void_test(test_nghttp2_session_recv_origin), + munit_void_test(test_nghttp2_session_recv_priority_update), + munit_void_test(test_nghttp2_session_continue), + munit_void_test(test_nghttp2_session_add_frame), + munit_void_test(test_nghttp2_session_on_request_headers_received), + munit_void_test(test_nghttp2_session_on_response_headers_received), + munit_void_test(test_nghttp2_session_on_headers_received), + munit_void_test(test_nghttp2_session_on_push_response_headers_received), + munit_void_test(test_nghttp2_session_on_rst_stream_received), + munit_void_test(test_nghttp2_session_on_settings_received), + munit_void_test(test_nghttp2_session_on_push_promise_received), + munit_void_test(test_nghttp2_session_on_ping_received), + munit_void_test(test_nghttp2_session_on_goaway_received), + munit_void_test(test_nghttp2_session_on_window_update_received), + munit_void_test(test_nghttp2_session_on_data_received), + munit_void_test(test_nghttp2_session_on_data_received_fail_fast), + munit_void_test(test_nghttp2_session_on_altsvc_received), + munit_void_test(test_nghttp2_session_send_headers_start_stream), + munit_void_test(test_nghttp2_session_send_headers_reply), + munit_void_test(test_nghttp2_session_send_headers_frame_size_error), + munit_void_test(test_nghttp2_session_send_headers_push_reply), + munit_void_test(test_nghttp2_session_send_rst_stream), + munit_void_test(test_nghttp2_session_send_push_promise), + munit_void_test(test_nghttp2_session_is_my_stream_id), + munit_void_test(test_nghttp2_session_upgrade2), + munit_void_test(test_nghttp2_submit_data), + munit_void_test(test_nghttp2_submit_data_read_length_too_large), + munit_void_test(test_nghttp2_submit_data_read_length_smallest), + munit_void_test(test_nghttp2_submit_data_twice), + munit_void_test(test_nghttp2_submit_request_with_data), + munit_void_test(test_nghttp2_submit_request_without_data), + munit_void_test(test_nghttp2_submit_response_with_data), + munit_void_test(test_nghttp2_submit_response_without_data), + munit_void_test(test_nghttp2_submit_response_push_response), + munit_void_test(test_nghttp2_submit_trailer), + munit_void_test(test_nghttp2_submit_headers_start_stream), + munit_void_test(test_nghttp2_submit_headers_reply), + munit_void_test(test_nghttp2_submit_headers_push_reply), + munit_void_test(test_nghttp2_submit_headers), + munit_void_test(test_nghttp2_submit_headers_continuation), + munit_void_test(test_nghttp2_submit_headers_continuation_extra_large), + munit_void_test(test_nghttp2_submit_settings), + munit_void_test(test_nghttp2_submit_settings_update_local_window_size), + munit_void_test(test_nghttp2_submit_settings_multiple_times), + munit_void_test(test_nghttp2_submit_push_promise), + munit_void_test(test_nghttp2_submit_window_update), + munit_void_test(test_nghttp2_submit_window_update_local_window_size), + munit_void_test(test_nghttp2_submit_shutdown_notice), + munit_void_test(test_nghttp2_submit_invalid_nv), + munit_void_test(test_nghttp2_submit_extension), + munit_void_test(test_nghttp2_submit_altsvc), + munit_void_test(test_nghttp2_submit_origin), + munit_void_test(test_nghttp2_submit_priority_update), + munit_void_test(test_nghttp2_submit_rst_stream), + munit_void_test(test_nghttp2_session_open_stream), + munit_void_test(test_nghttp2_session_get_next_ob_item), + munit_void_test(test_nghttp2_session_pop_next_ob_item), + munit_void_test(test_nghttp2_session_reply_fail), + munit_void_test(test_nghttp2_session_max_concurrent_streams), + munit_void_test(test_nghttp2_session_stop_data_with_rst_stream), + munit_void_test(test_nghttp2_session_defer_data), + munit_void_test(test_nghttp2_session_flow_control), + munit_void_test(test_nghttp2_session_flow_control_data_recv), + munit_void_test(test_nghttp2_session_flow_control_data_with_padding_recv), + munit_void_test(test_nghttp2_session_data_read_temporal_failure), + munit_void_test(test_nghttp2_session_on_stream_close), + munit_void_test(test_nghttp2_session_on_ctrl_not_send), + munit_void_test(test_nghttp2_session_get_outbound_queue_size), + munit_void_test(test_nghttp2_session_get_effective_local_window_size), + munit_void_test(test_nghttp2_session_set_option), + munit_void_test(test_nghttp2_session_data_backoff_by_high_pri_frame), + munit_void_test(test_nghttp2_session_pack_data_with_padding), + munit_void_test(test_nghttp2_session_pack_headers_with_padding), + munit_void_test(test_nghttp2_pack_settings_payload), + munit_void_test(test_nghttp2_session_stream_get_state), + munit_void_test(test_nghttp2_session_find_stream), + munit_void_test(test_nghttp2_session_graceful_shutdown), + munit_void_test(test_nghttp2_session_on_header_temporal_failure), + munit_void_test(test_nghttp2_session_recv_client_magic), + munit_void_test(test_nghttp2_session_delete_data_item), + munit_void_test(test_nghttp2_session_open_idle_stream), + munit_void_test(test_nghttp2_session_cancel_reserved_remote), + munit_void_test(test_nghttp2_session_reset_pending_headers), + munit_void_test(test_nghttp2_session_send_data_callback), + munit_void_test(test_nghttp2_session_on_begin_headers_temporal_failure), + munit_void_test(test_nghttp2_session_defer_then_close), + munit_void_test(test_nghttp2_session_detach_item_from_closed_stream), + munit_void_test(test_nghttp2_session_flooding), + munit_void_test(test_nghttp2_session_change_extpri_stream_priority), + munit_void_test(test_nghttp2_session_set_local_window_size), + munit_void_test(test_nghttp2_session_cancel_from_before_frame_send), + munit_void_test(test_nghttp2_session_too_many_settings), + munit_void_test(test_nghttp2_session_removed_closed_stream), + munit_void_test(test_nghttp2_session_pause_data), + munit_void_test(test_nghttp2_session_no_closed_streams), + munit_void_test(test_nghttp2_session_set_stream_user_data), + munit_void_test(test_nghttp2_session_no_rfc7540_priorities), + munit_void_test(test_nghttp2_session_stream_reset_ratelim), + munit_void_test(test_nghttp2_http_mandatory_headers), + munit_void_test(test_nghttp2_http_content_length), + munit_void_test(test_nghttp2_http_content_length_mismatch), + munit_void_test(test_nghttp2_http_non_final_response), + munit_void_test(test_nghttp2_http_trailer_headers), + munit_void_test(test_nghttp2_http_ignore_regular_header), + munit_void_test(test_nghttp2_http_ignore_content_length), + munit_void_test(test_nghttp2_http_record_request_method), + munit_void_test(test_nghttp2_http_push_promise), + munit_void_test(test_nghttp2_http_head_method_upgrade_workaround), + munit_void_test( + test_nghttp2_http_no_rfc9113_leading_and_trailing_ws_validation), + munit_test_end(), +}; + +const MunitSuite session_suite = { + "/session", tests, NULL, 1, MUNIT_SUITE_OPTION_NONE, +}; + typedef struct { uint8_t buf[65535]; size_t length; @@ -82,21 +221,21 @@ typedef struct { } my_user_data; static const nghttp2_nv reqnv[] = { - MAKE_NV(":method", "GET"), - MAKE_NV(":path", "/"), - MAKE_NV(":scheme", "https"), - MAKE_NV(":authority", "localhost"), + MAKE_NV(":method", "GET"), + MAKE_NV(":path", "/"), + MAKE_NV(":scheme", "https"), + MAKE_NV(":authority", "localhost"), }; static const nghttp2_nv resnv[] = { - MAKE_NV(":status", "200"), + MAKE_NV(":status", "200"), }; static const nghttp2_nv trailernv[] = { - // from http://tools.ietf.org/html/rfc6249#section-7 - MAKE_NV("digest", "SHA-256=" - "MWVkMWQxYTRiMzk5MDQ0MzI3NGU5NDEyZTk5OWY1ZGFmNzgyZTJlODYz" - "YjRjYzFhOTlmNTQwYzI2M2QwM2U2MQ=="), + // from http://tools.ietf.org/html/rfc6249#section-7 + MAKE_NV("digest", "SHA-256=" + "MWVkMWQxYTRiMzk5MDQ0MzI3NGU5NDEyZTk5OWY1ZGFmNzgyZTJlODYz" + "YjRjYzFhOTlmNTQwYzI2M2QwM2U2MQ=="), }; static void scripted_data_feed_init2(scripted_data_feed *df, @@ -121,18 +260,20 @@ static void scripted_data_feed_init2(scripted_data_feed *df, df->feedseq[0] = len; } -static ssize_t null_send_callback(nghttp2_session *session, const uint8_t *data, - size_t len, int flags, void *user_data) { +static nghttp2_ssize null_send_callback(nghttp2_session *session, + const uint8_t *data, size_t len, + int flags, void *user_data) { (void)session; (void)data; (void)flags; (void)user_data; - return (ssize_t)len; + return (nghttp2_ssize)len; } -static ssize_t fail_send_callback(nghttp2_session *session, const uint8_t *data, - size_t len, int flags, void *user_data) { +static nghttp2_ssize fail_send_callback(nghttp2_session *session, + const uint8_t *data, size_t len, + int flags, void *user_data) { (void)session; (void)data; (void)len; @@ -142,19 +283,20 @@ static ssize_t fail_send_callback(nghttp2_session *session, const uint8_t *data, return NGHTTP2_ERR_CALLBACK_FAILURE; } -static ssize_t fixed_bytes_send_callback(nghttp2_session *session, - const uint8_t *data, size_t len, - int flags, void *user_data) { +static nghttp2_ssize fixed_bytes_send_callback(nghttp2_session *session, + const uint8_t *data, size_t len, + int flags, void *user_data) { size_t fixed_sendlen = ((my_user_data *)user_data)->fixed_sendlen; (void)session; (void)data; (void)flags; - return (ssize_t)(fixed_sendlen < len ? fixed_sendlen : len); + return (nghttp2_ssize)(fixed_sendlen < len ? fixed_sendlen : len); } -static ssize_t scripted_recv_callback(nghttp2_session *session, uint8_t *data, - size_t len, int flags, void *user_data) { +static nghttp2_ssize scripted_recv_callback(nghttp2_session *session, + uint8_t *data, size_t len, + int flags, void *user_data) { scripted_data_feed *df = ((my_user_data *)user_data)->df; size_t wlen = df->feedseq[df->seqidx] > len ? len : df->feedseq[df->seqidx]; (void)session; @@ -166,11 +308,11 @@ static ssize_t scripted_recv_callback(nghttp2_session *session, uint8_t *data, if (df->feedseq[df->seqidx] == 0) { ++df->seqidx; } - return (ssize_t)wlen; + return (nghttp2_ssize)wlen; } -static ssize_t eof_recv_callback(nghttp2_session *session, uint8_t *data, - size_t len, int flags, void *user_data) { +static nghttp2_ssize eof_recv_callback(nghttp2_session *session, uint8_t *data, + size_t len, int flags, void *user_data) { (void)session; (void)data; (void)len; @@ -180,9 +322,9 @@ static ssize_t eof_recv_callback(nghttp2_session *session, uint8_t *data, return NGHTTP2_ERR_EOF; } -static ssize_t accumulator_send_callback(nghttp2_session *session, - const uint8_t *buf, size_t len, - int flags, void *user_data) { +static nghttp2_ssize accumulator_send_callback(nghttp2_session *session, + const uint8_t *buf, size_t len, + int flags, void *user_data) { accumulator *acc = ((my_user_data *)user_data)->acc; (void)session; (void)flags; @@ -190,7 +332,7 @@ static ssize_t accumulator_send_callback(nghttp2_session *session, assert(acc->length + len < sizeof(acc->buf)); memcpy(acc->buf + acc->length, buf, len); acc->length += len; - return (ssize_t)len; + return (nghttp2_ssize)len; } static int on_begin_frame_callback(nghttp2_session *session, @@ -290,19 +432,21 @@ static int pause_on_data_chunk_recv_callback(nghttp2_session *session, return NGHTTP2_ERR_PAUSE; } -static ssize_t select_padding_callback(nghttp2_session *session, - const nghttp2_frame *frame, - size_t max_payloadlen, void *user_data) { +static nghttp2_ssize select_padding_callback(nghttp2_session *session, + const nghttp2_frame *frame, + size_t max_payloadlen, + void *user_data) { my_user_data *ud = (my_user_data *)user_data; (void)session; - return (ssize_t)nghttp2_min(max_payloadlen, frame->hd.length + ud->padlen); + return (nghttp2_ssize)nghttp2_min_size(max_payloadlen, + frame->hd.length + ud->padlen); } -static ssize_t too_large_data_source_length_callback( - nghttp2_session *session, uint8_t frame_type, int32_t stream_id, - int32_t session_remote_window_size, int32_t stream_remote_window_size, - uint32_t remote_max_frame_size, void *user_data) { +static nghttp2_ssize too_large_data_source_length_callback( + nghttp2_session *session, uint8_t frame_type, int32_t stream_id, + int32_t session_remote_window_size, int32_t stream_remote_window_size, + uint32_t remote_max_frame_size, void *user_data) { (void)session; (void)frame_type; (void)stream_id; @@ -314,10 +458,10 @@ static ssize_t too_large_data_source_length_callback( return NGHTTP2_MAX_FRAME_SIZE_MAX + 1; } -static ssize_t smallest_length_data_source_length_callback( - nghttp2_session *session, uint8_t frame_type, int32_t stream_id, - int32_t session_remote_window_size, int32_t stream_remote_window_size, - uint32_t remote_max_frame_size, void *user_data) { +static nghttp2_ssize smallest_length_data_source_length_callback( + nghttp2_session *session, uint8_t frame_type, int32_t stream_id, + int32_t session_remote_window_size, int32_t stream_remote_window_size, + uint32_t remote_max_frame_size, void *user_data) { (void)session; (void)frame_type; (void)stream_id; @@ -329,9 +473,9 @@ static ssize_t smallest_length_data_source_length_callback( return 1; } -static ssize_t fixed_length_data_source_read_callback( - nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, - uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { +static nghttp2_ssize fixed_length_data_source_read_callback( + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { my_user_data *ud = (my_user_data *)user_data; size_t wlen; (void)session; @@ -348,12 +492,12 @@ static ssize_t fixed_length_data_source_read_callback( if (ud->data_source_length == 0) { *data_flags |= NGHTTP2_DATA_FLAG_EOF; } - return (ssize_t)wlen; + return (nghttp2_ssize)wlen; } -static ssize_t temporal_failure_data_source_read_callback( - nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, - uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { +static nghttp2_ssize temporal_failure_data_source_read_callback( + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { (void)session; (void)stream_id; (void)buf; @@ -365,11 +509,10 @@ static ssize_t temporal_failure_data_source_read_callback( return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } -static ssize_t fail_data_source_read_callback(nghttp2_session *session, - int32_t stream_id, uint8_t *buf, - size_t len, uint32_t *data_flags, - nghttp2_data_source *source, - void *user_data) { +static nghttp2_ssize +fail_data_source_read_callback(nghttp2_session *session, int32_t stream_id, + uint8_t *buf, size_t len, uint32_t *data_flags, + nghttp2_data_source *source, void *user_data) { (void)session; (void)stream_id; (void)buf; @@ -381,9 +524,9 @@ static ssize_t fail_data_source_read_callback(nghttp2_session *session, return NGHTTP2_ERR_CALLBACK_FAILURE; } -static ssize_t no_end_stream_data_source_read_callback( - nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, - uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { +static nghttp2_ssize no_end_stream_data_source_read_callback( + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { (void)session; (void)stream_id; (void)buf; @@ -395,9 +538,9 @@ static ssize_t no_end_stream_data_source_read_callback( return 0; } -static ssize_t no_copy_data_source_read_callback( - nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, - uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { +static nghttp2_ssize no_copy_data_source_read_callback( + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { my_user_data *ud = (my_user_data *)user_data; size_t wlen; (void)session; @@ -418,7 +561,7 @@ static ssize_t no_copy_data_source_read_callback( if (ud->data_source_length == 0) { *data_flags |= NGHTTP2_DATA_FLAG_EOF; } - return (ssize_t)wlen; + return (nghttp2_ssize)wlen; } static int send_data_callback(nghttp2_session *session, nghttp2_frame *frame, @@ -444,9 +587,9 @@ static int send_data_callback(nghttp2_session *session, nghttp2_frame *frame, return 0; } -static ssize_t block_count_send_callback(nghttp2_session *session, - const uint8_t *data, size_t len, - int flags, void *user_data) { +static nghttp2_ssize block_count_send_callback(nghttp2_session *session, + const uint8_t *data, size_t len, + int flags, void *user_data) { my_user_data *ud = (my_user_data *)user_data; (void)session; (void)data; @@ -457,7 +600,7 @@ static ssize_t block_count_send_callback(nghttp2_session *session, } --ud->block_count; - return (ssize_t)len; + return (nghttp2_ssize)len; } static int on_header_callback(nghttp2_session *session, @@ -489,9 +632,9 @@ static int pause_on_header_callback(nghttp2_session *session, } static int temporal_failure_on_header_callback( - nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, - size_t namelen, const uint8_t *value, size_t valuelen, uint8_t flags, - void *user_data) { + nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, + size_t namelen, const uint8_t *value, size_t valuelen, uint8_t flags, + void *user_data) { on_header_callback(session, frame, name, namelen, value, valuelen, flags, user_data); return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; @@ -550,16 +693,15 @@ static int on_begin_headers_callback(nghttp2_session *session, } static int temporal_failure_on_begin_headers_callback( - nghttp2_session *session, const nghttp2_frame *frame, void *user_data) { + nghttp2_session *session, const nghttp2_frame *frame, void *user_data) { on_begin_headers_callback(session, frame, user_data); return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; } -static ssize_t defer_data_source_read_callback(nghttp2_session *session, - int32_t stream_id, uint8_t *buf, - size_t len, uint32_t *data_flags, - nghttp2_data_source *source, - void *user_data) { +static nghttp2_ssize +defer_data_source_read_callback(nghttp2_session *session, int32_t stream_id, + uint8_t *buf, size_t len, uint32_t *data_flags, + nghttp2_data_source *source, void *user_data) { (void)session; (void)stream_id; (void)buf; @@ -593,9 +735,10 @@ static int fatal_error_on_stream_close_callback(nghttp2_session *session, return NGHTTP2_ERR_CALLBACK_FAILURE; } -static ssize_t pack_extension_callback(nghttp2_session *session, uint8_t *buf, - size_t len, const nghttp2_frame *frame, - void *user_data) { +static nghttp2_ssize pack_extension_callback(nghttp2_session *session, + uint8_t *buf, size_t len, + const nghttp2_frame *frame, + void *user_data) { nghttp2_buf *p = frame->ext.payload; (void)session; (void)len; @@ -603,7 +746,7 @@ static ssize_t pack_extension_callback(nghttp2_session *session, uint8_t *buf, memcpy(buf, p->pos, nghttp2_buf_len(p)); - return (ssize_t)nghttp2_buf_len(p); + return (nghttp2_ssize)nghttp2_buf_len(p); } static int on_extension_chunk_recv_callback(nghttp2_session *session, @@ -686,8 +829,8 @@ void test_nghttp2_session_recv(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; - callbacks.recv_callback = scripted_recv_callback; + callbacks.send_callback2 = null_send_callback; + callbacks.recv_callback2 = scripted_recv_callback; callbacks.on_frame_recv_callback = on_frame_recv_callback; callbacks.on_begin_frame_callback = on_begin_frame_callback; @@ -702,7 +845,7 @@ void test_nghttp2_session_recv(void) { NGHTTP2_HCAT_HEADERS, NULL, nva, nvlen); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); scripted_data_feed_init2(&df, &bufs); @@ -719,10 +862,10 @@ void test_nghttp2_session_recv(void) { user_data.begin_frame_cb_called = 0; while (df.seqidx < framelen) { - CU_ASSERT(0 == nghttp2_session_recv(session)); + assert_int(0, ==, nghttp2_session_recv(session)); } - CU_ASSERT(1 == user_data.frame_recv_cb_called); - CU_ASSERT(1 == user_data.begin_frame_cb_called); + assert_int(1, ==, user_data.frame_recv_cb_called); + assert_int(1, ==, user_data.begin_frame_cb_called); nghttp2_bufs_reset(&bufs); @@ -738,9 +881,9 @@ void test_nghttp2_session_recv(void) { user_data.frame_recv_cb_called = 0; user_data.begin_frame_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_recv(session)); - CU_ASSERT(1 == user_data.frame_recv_cb_called); - CU_ASSERT(1 == user_data.begin_frame_cb_called); + assert_int(0, ==, nghttp2_session_recv(session)); + assert_int(0, ==, user_data.frame_recv_cb_called); + assert_int(1, ==, user_data.begin_frame_cb_called); nghttp2_bufs_reset(&bufs); @@ -761,8 +904,8 @@ void test_nghttp2_session_recv(void) { bufs.cur->buf.last += 16; nghttp2_put_uint32be( - bufs.cur->buf.pos, - (uint32_t)(((frame.hd.length + 16) << 8) + bufs.cur->buf.pos[3])); + bufs.cur->buf.pos, + (uint32_t)(((frame.hd.length + 16) << 8) + bufs.cur->buf.pos[3])); nghttp2_frame_ping_free(&frame.ping); @@ -770,14 +913,14 @@ void test_nghttp2_session_recv(void) { user_data.frame_recv_cb_called = 0; user_data.begin_frame_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_recv(session)); - CU_ASSERT(0 == user_data.frame_recv_cb_called); - CU_ASSERT(0 == user_data.begin_frame_cb_called); + assert_int(0, ==, nghttp2_session_recv(session)); + assert_int(0, ==, user_data.frame_recv_cb_called); + assert_int(0, ==, user_data.begin_frame_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_FRAME_SIZE_ERROR == item->frame.goaway.error_code); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_FRAME_SIZE_ERROR, ==, item->frame.goaway.error_code); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_free(&bufs); nghttp2_session_del(session); @@ -800,7 +943,7 @@ void test_nghttp2_session_recv_invalid_stream_id(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.recv_callback = scripted_recv_callback; + callbacks.recv_callback2 = scripted_recv_callback; callbacks.on_invalid_frame_recv_callback = on_invalid_frame_recv_callback; user_data.df = &df; @@ -814,14 +957,14 @@ void test_nghttp2_session_recv_invalid_stream_id(void) { NGHTTP2_HCAT_HEADERS, NULL, nva, nvlen); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_int(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); scripted_data_feed_init2(&df, &bufs); nghttp2_frame_headers_free(&frame.headers, mem); - CU_ASSERT(0 == nghttp2_session_recv(session)); - CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); + assert_int(0, ==, nghttp2_session_recv(session)); + assert_int(1, ==, user_data.invalid_frame_recv_cb_called); nghttp2_bufs_free(&bufs); nghttp2_hd_deflate_free(&deflater); @@ -845,8 +988,8 @@ void test_nghttp2_session_recv_invalid_frame(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.recv_callback = scripted_recv_callback; - callbacks.send_callback = null_send_callback; + callbacks.recv_callback2 = scripted_recv_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; user_data.df = &df; @@ -859,23 +1002,23 @@ void test_nghttp2_session_recv_invalid_frame(void) { NGHTTP2_HCAT_HEADERS, NULL, nva, nvlen); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_int(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); scripted_data_feed_init2(&df, &bufs); - CU_ASSERT(0 == nghttp2_session_recv(session)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == user_data.frame_send_cb_called); + assert_int(0, ==, nghttp2_session_recv(session)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, user_data.frame_send_cb_called); /* Receive exactly same bytes of HEADERS is treated as error, because it has * pseudo headers and without END_STREAM flag set */ scripted_data_feed_init2(&df, &bufs); - CU_ASSERT(0 == nghttp2_session_recv(session)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == user_data.frame_send_cb_called); - CU_ASSERT(NGHTTP2_RST_STREAM == user_data.sent_frame_type); + assert_int(0, ==, nghttp2_session_recv(session)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, user_data.frame_send_cb_called); + assert_uint8(NGHTTP2_RST_STREAM, ==, user_data.sent_frame_type); nghttp2_bufs_free(&bufs); nghttp2_frame_headers_free(&frame.headers, mem); @@ -889,11 +1032,11 @@ void test_nghttp2_session_recv_eof(void) { nghttp2_session_callbacks callbacks; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; - callbacks.recv_callback = eof_recv_callback; + callbacks.send_callback2 = null_send_callback; + callbacks.recv_callback2 = eof_recv_callback; nghttp2_session_client_new(&session, &callbacks, NULL); - CU_ASSERT(NGHTTP2_ERR_EOF == nghttp2_session_recv(session)); + assert_int(NGHTTP2_ERR_EOF, ==, nghttp2_session_recv(session)); nghttp2_session_del(session); } @@ -903,14 +1046,14 @@ void test_nghttp2_session_recv_data(void) { nghttp2_session_callbacks callbacks; my_user_data ud; uint8_t data[8092]; - ssize_t rv; + nghttp2_ssize rv; nghttp2_outbound_item *item; nghttp2_stream *stream; nghttp2_frame_hd hd; int i; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_data_chunk_recv_callback = on_data_chunk_recv_callback; callbacks.on_frame_recv_callback = on_frame_recv_callback; callbacks.on_frame_send_callback = on_frame_send_callback; @@ -929,13 +1072,13 @@ void test_nghttp2_session_recv_data(void) { error. This is not mandated by the spec */ ud.data_chunk_recv_cb_called = 0; ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4096); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4096 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4096); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4096, ==, rv); - CU_ASSERT(0 == ud.data_chunk_recv_cb_called); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_int(0, ==, ud.data_chunk_recv_cb_called); + assert_int(0, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_session_del(session); @@ -950,40 +1093,40 @@ void test_nghttp2_session_recv_data(void) { ud.data_chunk_recv_cb_called = 0; ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4096); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4096 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4096); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4096, ==, rv); - CU_ASSERT(0 == ud.data_chunk_recv_cb_called); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_int(0, ==, ud.data_chunk_recv_cb_called); + assert_int(0, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL == item); + assert_null(item); /* This is normal case. DATA is acceptable. */ stream->state = NGHTTP2_STREAM_OPENED; ud.data_chunk_recv_cb_called = 0; ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4096); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4096 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4096); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4096, ==, rv); - CU_ASSERT(1 == ud.data_chunk_recv_cb_called); - CU_ASSERT(1 == ud.frame_recv_cb_called); + assert_int(1, ==, ud.data_chunk_recv_cb_called); + assert_int(1, ==, ud.frame_recv_cb_called); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); ud.data_chunk_recv_cb_called = 0; ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4096); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4096 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4096); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4096, ==, rv); /* Now we got data more than initial-window-size / 2, WINDOW_UPDATE must be queued */ - CU_ASSERT(1 == ud.data_chunk_recv_cb_called); - CU_ASSERT(1 == ud.frame_recv_cb_called); + assert_int(1, ==, ud.data_chunk_recv_cb_called); + assert_int(1, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(1 == item->frame.window_update.hd.stream_id); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(1, ==, item->frame.window_update.hd.stream_id); + assert_int(0, ==, nghttp2_session_send(session)); /* Set initial window size to 1MiB, so that we can check connection flow control individually */ @@ -993,13 +1136,13 @@ void test_nghttp2_session_recv_data(void) { DATA. Additional 4 DATA frames, connection flow control will kick in. */ for (i = 0; i < 5; ++i) { - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4096); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4096 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4096); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4096, ==, rv); } item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(0 == item->frame.window_update.hd.stream_id); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(0, ==, item->frame.window_update.hd.stream_id); + assert_int(0, ==, nghttp2_session_send(session)); /* Reception of DATA with stream ID = 0 causes connection error */ hd.length = 4096; @@ -1010,14 +1153,14 @@ void test_nghttp2_session_recv_data(void) { ud.data_chunk_recv_cb_called = 0; ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4096); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4096 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4096); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4096, ==, rv); - CU_ASSERT(0 == ud.data_chunk_recv_cb_called); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_int(0, ==, ud.data_chunk_recv_cb_called); + assert_int(0, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, item->frame.goaway.error_code); nghttp2_session_del(session); @@ -1036,20 +1179,20 @@ void test_nghttp2_session_recv_data(void) { it triggers first WINDOW_UPDATE of window_size_increment 32767. */ for (i = 0; i < 7; ++i) { - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4096); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4096 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4096); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4096, ==, rv); } hd.length = 4095; nghttp2_frame_pack_frame_hd(data, &hd); - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4095); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4095 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4095); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4095, ==, rv); /* Now 2 WINDOW_UPDATEs for session and stream should be queued. */ - CU_ASSERT(0 == stream->recv_window_size); - CU_ASSERT(0 == session->recv_window_size); - CU_ASSERT(1 == stream->window_update_queued); - CU_ASSERT(1 == session->window_update_queued); + assert_int32(0, ==, stream->recv_window_size); + assert_int32(0, ==, session->recv_window_size); + assert_true(stream->window_update_queued); + assert_true(session->window_update_queued); /* Then send 32768 bytes of DATA. Since we have not sent queued WINDOW_UDPATE frame, recv_window_size should not be decreased */ @@ -1057,29 +1200,29 @@ void test_nghttp2_session_recv_data(void) { nghttp2_frame_pack_frame_hd(data, &hd); for (i = 0; i < 8; ++i) { - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4096); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4096 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4096); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4096, ==, rv); } /* WINDOW_UPDATE is blocked for session and stream, so recv_window_size must not be decreased. */ - CU_ASSERT(32768 == stream->recv_window_size); - CU_ASSERT(32768 == session->recv_window_size); - CU_ASSERT(1 == stream->window_update_queued); - CU_ASSERT(1 == session->window_update_queued); + assert_int32(32768, ==, stream->recv_window_size); + assert_int32(32768, ==, session->recv_window_size); + assert_true(stream->window_update_queued); + assert_true(session->window_update_queued); ud.frame_send_cb_called = 0; /* This sends queued WINDOW_UPDATES. And then check recv_window_size, and queue WINDOW_UPDATEs for both session and stream, and send them at once. */ - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(4 == ud.frame_send_cb_called); - CU_ASSERT(0 == stream->recv_window_size); - CU_ASSERT(0 == session->recv_window_size); - CU_ASSERT(0 == stream->window_update_queued); - CU_ASSERT(0 == session->window_update_queued); + assert_int(4, ==, ud.frame_send_cb_called); + assert_int32(0, ==, stream->recv_window_size); + assert_int32(0, ==, session->recv_window_size); + assert_false(stream->window_update_queued); + assert_false(session->window_update_queued); nghttp2_session_del(session); } @@ -1092,13 +1235,13 @@ void test_nghttp2_session_recv_data_no_auto_flow_control(void) { nghttp2_frame_hd hd; size_t padlen; uint8_t data[8192]; - ssize_t rv; + nghttp2_ssize rv; size_t sendlen; nghttp2_stream *stream; size_t i; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; nghttp2_option_new(&option); @@ -1122,11 +1265,11 @@ void test_nghttp2_session_recv_data_no_auto_flow_control(void) { /* Receive first 100 bytes */ sendlen = 100; - rv = nghttp2_session_mem_recv(session, data, sendlen); - CU_ASSERT((ssize_t)sendlen == rv); + rv = nghttp2_session_mem_recv2(session, data, sendlen); + assert_ptrdiff((nghttp2_ssize)sendlen, ==, rv); /* We consumed pad length field (1 byte) */ - CU_ASSERT(1 == session->consumed_size); + assert_int32(1, ==, session->consumed_size); /* close stream here */ nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, NGHTTP2_NO_ERROR); @@ -1134,13 +1277,14 @@ void test_nghttp2_session_recv_data_no_auto_flow_control(void) { /* stream 1 has been closed, and we disabled auto flow-control, so data must be immediately consumed for connection. */ - rv = nghttp2_session_mem_recv(session, data + sendlen, - NGHTTP2_FRAME_HDLEN + hd.length - sendlen); - CU_ASSERT((ssize_t)(NGHTTP2_FRAME_HDLEN + hd.length - sendlen) == rv); + rv = nghttp2_session_mem_recv2(session, data + sendlen, + NGHTTP2_FRAME_HDLEN + hd.length - sendlen); + assert_ptrdiff((nghttp2_ssize)(NGHTTP2_FRAME_HDLEN + hd.length - sendlen), ==, + rv); /* We already consumed pad length field (1 byte), so do +1 here */ - CU_ASSERT((int32_t)(NGHTTP2_FRAME_HDLEN + hd.length - sendlen + 1) == - session->consumed_size); + assert_int32((int32_t)(NGHTTP2_FRAME_HDLEN + hd.length - sendlen + 1), ==, + session->consumed_size); nghttp2_session_del(session); @@ -1153,12 +1297,13 @@ void test_nghttp2_session_recv_data_no_auto_flow_control(void) { stream = open_recv_stream(session, 1); stream->http_flags |= NGHTTP2_HTTP_FLAG_EXPECT_FINAL_RESPONSE; - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + hd.length); - CU_ASSERT((ssize_t)(NGHTTP2_FRAME_HDLEN + hd.length) == rv); + rv = + nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + hd.length); + assert_ptrdiff((nghttp2_ssize)(NGHTTP2_FRAME_HDLEN + hd.length), ==, rv); /* Whole payload must be consumed now because HTTP messaging rule was not honored. */ - CU_ASSERT((int32_t)hd.length == session->consumed_size); + assert_int32((int32_t)hd.length, ==, session->consumed_size); nghttp2_session_del(session); @@ -1175,57 +1320,57 @@ void test_nghttp2_session_recv_data_no_auto_flow_control(void) { /* Receive up to 65535 bytes of DATA */ for (i = 0; i < 15; ++i) { - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4096); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4096 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4096); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4096, ==, rv); } hd.length = 4095; nghttp2_frame_pack_frame_hd(data, &hd); - rv = nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 4095); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 4095 == rv); + rv = nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 4095); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 4095, ==, rv); - CU_ASSERT(65535 == session->recv_window_size); - CU_ASSERT(65535 == stream->recv_window_size); + assert_int32(65535, ==, session->recv_window_size); + assert_int32(65535, ==, stream->recv_window_size); /* The first call of nghttp2_session_consume_connection() will queue WINDOW_UPDATE. Next call does not. */ nghttp2_session_consume_connection(session, 32767); nghttp2_session_consume_connection(session, 32768); - CU_ASSERT(32768 == session->recv_window_size); - CU_ASSERT(65535 == stream->recv_window_size); - CU_ASSERT(1 == session->window_update_queued); - CU_ASSERT(0 == stream->window_update_queued); + assert_int32(32768, ==, session->recv_window_size); + assert_int32(65535, ==, stream->recv_window_size); + assert_true(session->window_update_queued); + assert_false(stream->window_update_queued); ud.frame_send_cb_called = 0; /* This will send WINDOW_UPDATE, and check whether we should send WINDOW_UPDATE, and queue and send it at once. */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == session->recv_window_size); - CU_ASSERT(65535 == stream->recv_window_size); - CU_ASSERT(0 == session->window_update_queued); - CU_ASSERT(0 == stream->window_update_queued); - CU_ASSERT(2 == ud.frame_send_cb_called); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int32(0, ==, session->recv_window_size); + assert_int32(65535, ==, stream->recv_window_size); + assert_false(session->window_update_queued); + assert_false(stream->window_update_queued); + assert_int(2, ==, ud.frame_send_cb_called); /* Do the same for stream */ nghttp2_session_consume_stream(session, 1, 32767); nghttp2_session_consume_stream(session, 1, 32768); - CU_ASSERT(0 == session->recv_window_size); - CU_ASSERT(32768 == stream->recv_window_size); - CU_ASSERT(0 == session->window_update_queued); - CU_ASSERT(1 == stream->window_update_queued); + assert_int32(0, ==, session->recv_window_size); + assert_int32(32768, ==, stream->recv_window_size); + assert_false(session->window_update_queued); + assert_true(stream->window_update_queued); ud.frame_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == session->recv_window_size); - CU_ASSERT(0 == stream->recv_window_size); - CU_ASSERT(0 == session->window_update_queued); - CU_ASSERT(0 == stream->window_update_queued); - CU_ASSERT(2 == ud.frame_send_cb_called); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int32(0, ==, session->recv_window_size); + assert_int32(0, ==, stream->recv_window_size); + assert_false(session->window_update_queued); + assert_false(stream->window_update_queued); + assert_int(2, ==, ud.frame_send_cb_called); nghttp2_session_del(session); nghttp2_option_del(option); @@ -1239,7 +1384,7 @@ void test_nghttp2_session_recv_continuation(void) { nghttp2_frame frame; nghttp2_bufs bufs; nghttp2_buf *buf; - ssize_t rv; + nghttp2_ssize rv; my_user_data ud; nghttp2_hd_deflater deflater; uint8_t data[1024]; @@ -1267,8 +1412,8 @@ void test_nghttp2_session_recv_continuation(void) { NGHTTP2_HCAT_HEADERS, NULL, nva, nvlen); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); /* make sure that all data is in the first buf */ buf = &bufs.head->buf; @@ -1305,15 +1450,15 @@ void test_nghttp2_session_recv_continuation(void) { datalen += cont_hd.length; buf->pos += cont_hd.length; - CU_ASSERT(0 == nghttp2_buf_len(buf)); + assert_size(0, ==, nghttp2_buf_len(buf)); ud.header_cb_called = 0; ud.begin_frame_cb_called = 0; - rv = nghttp2_session_mem_recv(session, data, datalen); - CU_ASSERT((ssize_t)datalen == rv); - CU_ASSERT(4 == ud.header_cb_called); - CU_ASSERT(3 == ud.begin_frame_cb_called); + rv = nghttp2_session_mem_recv2(session, data, datalen); + assert_ptrdiff((nghttp2_ssize)datalen, ==, rv); + assert_int(4, ==, ud.header_cb_called); + assert_int(3, ==, ud.begin_frame_cb_called); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -1331,7 +1476,7 @@ void test_nghttp2_session_recv_continuation(void) { nghttp2_bufs_reset(&bufs); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_headers_free(&frame.headers, mem); @@ -1361,16 +1506,16 @@ void test_nghttp2_session_recv_continuation(void) { datalen += cont_hd.length; buf->pos += cont_hd.length; - CU_ASSERT(0 == nghttp2_buf_len(buf)); + assert_size(0, ==, nghttp2_buf_len(buf)); ud.header_cb_called = 0; ud.begin_frame_cb_called = 0; - rv = nghttp2_session_mem_recv(session, data, datalen); + rv = nghttp2_session_mem_recv2(session, data, datalen); - CU_ASSERT((ssize_t)datalen == rv); - CU_ASSERT(4 == ud.header_cb_called); - CU_ASSERT(2 == ud.begin_frame_cb_called); + assert_ptrdiff((nghttp2_ssize)datalen, ==, rv); + assert_int(4, ==, ud.header_cb_called); + assert_int(2, ==, ud.begin_frame_cb_called); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -1388,8 +1533,8 @@ void test_nghttp2_session_recv_continuation(void) { nghttp2_bufs_reset(&bufs); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -1408,18 +1553,18 @@ void test_nghttp2_session_recv_continuation(void) { nghttp2_frame_pack_priority(&bufs, &frame.priority); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_size(0, <, nghttp2_bufs_len(&bufs)); memcpy(data + datalen, buf->pos, nghttp2_buf_len(buf)); datalen += nghttp2_buf_len(buf); ud.begin_headers_cb_called = 0; - rv = nghttp2_session_mem_recv(session, data, datalen); - CU_ASSERT((ssize_t)datalen == rv); + rv = nghttp2_session_mem_recv2(session, data, datalen); + assert_ptrdiff((nghttp2_ssize)datalen, ==, rv); - CU_ASSERT(1 == ud.begin_headers_cb_called); - CU_ASSERT(NGHTTP2_GOAWAY == - nghttp2_session_get_next_ob_item(session)->frame.hd.type); + assert_int(1, ==, ud.begin_headers_cb_called); + assert_uint8(NGHTTP2_GOAWAY, ==, + nghttp2_session_get_next_ob_item(session)->frame.hd.type); nghttp2_bufs_free(&bufs); nghttp2_hd_deflate_free(&deflater); @@ -1434,7 +1579,7 @@ void test_nghttp2_session_recv_headers_with_priority(void) { nghttp2_frame frame; nghttp2_bufs bufs; nghttp2_buf *buf; - ssize_t rv; + nghttp2_ssize rv; my_user_data ud; nghttp2_hd_deflater deflater; nghttp2_outbound_item *item; @@ -1466,8 +1611,8 @@ void test_nghttp2_session_recv_headers_with_priority(void) { rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -1476,15 +1621,14 @@ void test_nghttp2_session_recv_headers_with_priority(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); stream = nghttp2_session_get_stream(session, 3); - CU_ASSERT(99 == stream->weight); - CU_ASSERT(1 == stream->dep_prev->stream_id); + assert_not_null(stream); nghttp2_bufs_reset(&bufs); @@ -1501,8 +1645,8 @@ void test_nghttp2_session_recv_headers_with_priority(void) { rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > NGHTTP2_FRAME_HDLEN + 5); + assert_ptrdiff(0, ==, rv); + assert_size(NGHTTP2_FRAME_HDLEN + 5, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -1513,19 +1657,19 @@ void test_nghttp2_session_recv_headers_with_priority(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); stream = nghttp2_session_get_stream(session, 5); - CU_ASSERT(NULL == stream); + assert_null(stream); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_FRAME_SIZE_ERROR == item->frame.goaway.error_code); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_FRAME_SIZE_ERROR, ==, item->frame.goaway.error_code); nghttp2_bufs_reset(&bufs); @@ -1548,8 +1692,8 @@ void test_nghttp2_session_recv_headers_with_priority(void) { rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -1558,19 +1702,19 @@ void test_nghttp2_session_recv_headers_with_priority(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(NULL == stream); + assert_null(stream); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, item->frame.goaway.error_code); nghttp2_bufs_reset(&bufs); @@ -1587,22 +1731,21 @@ void test_nghttp2_session_recv_headers_with_padding(void) { nghttp2_frame_hd hd; nghttp2_outbound_item *item; my_user_data ud; - ssize_t rv; + nghttp2_ssize rv; frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); callbacks.on_frame_recv_callback = on_frame_recv_callback; - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; /* HEADERS: Wrong padding length */ nghttp2_session_server_new(&session, &callbacks, &ud); nghttp2_session_send(session); - nghttp2_frame_hd_init(&hd, 10, NGHTTP2_HEADERS, - NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY | - NGHTTP2_FLAG_PADDED, - 1); + nghttp2_frame_hd_init( + &hd, 10, NGHTTP2_HEADERS, + NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY | NGHTTP2_FLAG_PADDED, 1); buf = &bufs.head->buf; nghttp2_frame_pack_frame_hd(buf->last, &hd); buf->last += NGHTTP2_FRAME_HDLEN; @@ -1618,15 +1761,15 @@ void test_nghttp2_session_recv_headers_with_padding(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_bufs_reset(&bufs); nghttp2_session_del(session); @@ -1653,15 +1796,15 @@ void test_nghttp2_session_recv_headers_with_padding(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_bufs_free(&bufs); nghttp2_session_del(session); @@ -1677,10 +1820,10 @@ static int response_on_begin_frame_callback(nghttp2_session *session, return 0; } - rv = nghttp2_submit_response(session, hd->stream_id, resnv, ARRLEN(resnv), - NULL); + rv = nghttp2_submit_response2(session, hd->stream_id, resnv, ARRLEN(resnv), + NULL); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); return 0; } @@ -1695,14 +1838,14 @@ void test_nghttp2_session_recv_headers_early_response(void) { nghttp2_nv *nva; size_t nvlen; nghttp2_frame frame; - ssize_t rv; + nghttp2_ssize rv; nghttp2_stream *stream; mem = nghttp2_mem_default(); frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_begin_frame_callback = response_on_begin_frame_callback; nghttp2_session_server_new(&session, &callbacks, NULL); @@ -1717,7 +1860,7 @@ void test_nghttp2_session_recv_headers_early_response(void) { rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_headers_free(&frame.headers, mem); @@ -1725,22 +1868,22 @@ void test_nghttp2_session_recv_headers_early_response(void) { /* Only receive 9 bytes headers, and invoke on_begin_frame_callback */ - rv = nghttp2_session_mem_recv(session, buf->pos, 9); + rv = nghttp2_session_mem_recv2(session, buf->pos, 9); - CU_ASSERT(9 == rv); + assert_ptrdiff(9, ==, rv); rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); rv = - nghttp2_session_mem_recv(session, buf->pos + 9, nghttp2_buf_len(buf) - 9); + nghttp2_session_mem_recv2(session, buf->pos + 9, nghttp2_buf_len(buf) - 9); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) - 9 == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf) - 9, ==, rv); stream = nghttp2_session_get_stream_raw(session, 1); - CU_ASSERT(stream->flags & NGHTTP2_STREAM_FLAG_CLOSED); + assert_null(stream); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -1755,7 +1898,7 @@ void test_nghttp2_session_recv_headers_for_closed_stream(void) { nghttp2_frame frame; nghttp2_bufs bufs; nghttp2_buf *buf; - ssize_t rv; + nghttp2_ssize rv; my_user_data ud; nghttp2_hd_deflater deflater; nghttp2_stream *stream; @@ -1783,8 +1926,8 @@ void test_nghttp2_session_recv_headers_for_closed_stream(void) { rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -1794,38 +1937,39 @@ void test_nghttp2_session_recv_headers_for_closed_stream(void) { ud.header_cb_called = 0; ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, NGHTTP2_FRAME_HDLEN); + rv = nghttp2_session_mem_recv2(session, buf->pos, NGHTTP2_FRAME_HDLEN); - CU_ASSERT(NGHTTP2_FRAME_HDLEN == rv); - CU_ASSERT(0 == ud.header_cb_called); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN, ==, rv); + assert_int(0, ==, ud.header_cb_called); + assert_int(0, ==, ud.frame_recv_cb_called); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(NULL != stream); + assert_not_null(stream); - rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, - NGHTTP2_NO_ERROR); + rv = + nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, NGHTTP2_NO_ERROR); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_send(session, &data); + rv = nghttp2_session_mem_send2(session, &data); - CU_ASSERT(rv > 0); + assert_ptrdiff(0, <, rv); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(NULL == stream); + assert_null(stream); ud.header_cb_called = 0; ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos + NGHTTP2_FRAME_HDLEN, - nghttp2_buf_len(buf) - NGHTTP2_FRAME_HDLEN); + rv = nghttp2_session_mem_recv2(session, buf->pos + NGHTTP2_FRAME_HDLEN, + nghttp2_buf_len(buf) - NGHTTP2_FRAME_HDLEN); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) - NGHTTP2_FRAME_HDLEN == rv); - CU_ASSERT(0 == ud.header_cb_called); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf) - NGHTTP2_FRAME_HDLEN, ==, + rv); + assert_int(0, ==, ud.header_cb_called); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_bufs_free(&bufs); nghttp2_hd_deflate_free(&deflater); @@ -1840,14 +1984,14 @@ void test_nghttp2_session_recv_headers_with_extpri(void) { nghttp2_frame frame; nghttp2_bufs bufs; nghttp2_buf *buf; - ssize_t rv; + nghttp2_ssize rv; nghttp2_hd_deflater deflater; nghttp2_stream *stream; nghttp2_mem *mem; const nghttp2_nv extpri_reqnv[] = { - MAKE_NV(":method", "GET"), MAKE_NV(":path", "/"), - MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "localhost"), - MAKE_NV("priority", "i,u=2"), + MAKE_NV(":method", "GET"), MAKE_NV(":path", "/"), + MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "localhost"), + MAKE_NV("priority", "i,u=2"), }; nghttp2_settings_entry iv; @@ -1873,20 +2017,20 @@ void test_nghttp2_session_recv_headers_with_extpri(void) { rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_headers_free(&frame.headers, mem); buf = &bufs.head->buf; assert(nghttp2_bufs_len(&bufs) == nghttp2_buf_len(buf)); - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(2 == nghttp2_extpri_uint8_urgency(stream->extpri)); - CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri)); + assert_uint32(2, ==, nghttp2_extpri_uint8_urgency(stream->extpri)); + assert_true(nghttp2_extpri_uint8_inc(stream->extpri)); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -1911,22 +2055,22 @@ void test_nghttp2_session_recv_headers_with_extpri(void) { rv = nghttp2_frame_pack_push_promise(&bufs, &frame.push_promise, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_push_promise_free(&frame.push_promise, mem); buf = &bufs.head->buf; assert(nghttp2_bufs_len(&bufs) == nghttp2_buf_len(buf)); - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); stream = nghttp2_session_get_stream(session, 2); - CU_ASSERT(NGHTTP2_EXTPRI_DEFAULT_URGENCY == - nghttp2_extpri_uint8_urgency(stream->http_extpri)); - CU_ASSERT(NGHTTP2_EXTPRI_DEFAULT_URGENCY == - nghttp2_extpri_uint8_urgency(stream->extpri)); + assert_uint32(NGHTTP2_EXTPRI_DEFAULT_URGENCY, ==, + nghttp2_extpri_uint8_urgency(stream->http_extpri)); + assert_uint32(NGHTTP2_EXTPRI_DEFAULT_URGENCY, ==, + nghttp2_extpri_uint8_urgency(stream->extpri)); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -1938,7 +2082,7 @@ void test_nghttp2_session_server_recv_push_response(void) { nghttp2_session_callbacks callbacks; nghttp2_bufs bufs; nghttp2_buf *buf; - ssize_t rv; + nghttp2_ssize rv; my_user_data ud; nghttp2_mem *mem; nghttp2_frame frame; @@ -1965,8 +2109,8 @@ void test_nghttp2_session_server_recv_push_response(void) { nvlen); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -1974,10 +2118,10 @@ void test_nghttp2_session_server_recv_push_response(void) { ud.invalid_frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(1 == ud.invalid_frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_int(1, ==, ud.invalid_frame_recv_cb_called); nghttp2_bufs_free(&bufs); nghttp2_hd_deflate_free(&deflater); @@ -1989,7 +2133,7 @@ void test_nghttp2_session_recv_premature_headers(void) { nghttp2_session_callbacks callbacks; nghttp2_bufs bufs; nghttp2_buf *buf; - ssize_t rv; + nghttp2_ssize rv; my_user_data ud; nghttp2_hd_deflater deflater; nghttp2_outbound_item *item; @@ -2000,7 +2144,7 @@ void test_nghttp2_session_recv_premature_headers(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_server_new(&session, &callbacks, &ud); @@ -2013,17 +2157,18 @@ void test_nghttp2_session_recv_premature_headers(void) { /* Intentionally feed payload cutting last 1 byte off */ payloadlen = nghttp2_get_uint32(buf->pos) >> 8; nghttp2_put_uint32be(buf->pos, ((payloadlen - 1) << 8) + buf->pos[3]); - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf) - 1); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf) - 1); - CU_ASSERT((ssize_t)(nghttp2_buf_len(buf) - 1) == rv); + assert_ptrdiff((nghttp2_ssize)(nghttp2_buf_len(buf) - 1), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(NGHTTP2_COMPRESSION_ERROR == item->frame.rst_stream.error_code); - CU_ASSERT(1 == item->frame.hd.stream_id); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_not_null(item); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_COMPRESSION_ERROR, ==, + item->frame.rst_stream.error_code); + assert_int32(1, ==, item->frame.hd.stream_id); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); nghttp2_hd_deflate_free(&deflater); @@ -2033,29 +2178,30 @@ void test_nghttp2_session_recv_premature_headers(void) { nghttp2_session_client_new(&session, &callbacks, &ud); nghttp2_hd_deflate_init(&deflater, mem); - open_sent_stream3(session, 1, NGHTTP2_STREAM_FLAG_NONE, &pri_spec_default, + open_sent_stream3(session, 1, NGHTTP2_STREAM_FLAG_NONE, NGHTTP2_STREAM_OPENING, NULL); rv = pack_push_promise(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, 2, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); buf = &bufs.head->buf; payloadlen = nghttp2_get_uint32(buf->pos) >> 8; /* Intentionally feed payload cutting last 1 byte off */ nghttp2_put_uint32be(buf->pos, ((payloadlen - 1) << 8) + buf->pos[3]); - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf) - 1); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf) - 1); - CU_ASSERT((ssize_t)(nghttp2_buf_len(buf) - 1) == rv); + assert_ptrdiff((nghttp2_ssize)(nghttp2_buf_len(buf) - 1), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(NGHTTP2_COMPRESSION_ERROR == item->frame.rst_stream.error_code); - CU_ASSERT(2 == item->frame.hd.stream_id); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_not_null(item); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_COMPRESSION_ERROR, ==, + item->frame.rst_stream.error_code); + assert_int32(2, ==, item->frame.hd.stream_id); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -2069,7 +2215,7 @@ void test_nghttp2_session_recv_unknown_frame(void) { uint8_t data[16384]; size_t datalen; nghttp2_frame_hd hd; - ssize_t rv; + nghttp2_ssize rv; nghttp2_frame_hd_init(&hd, 16000, 99, NGHTTP2_FLAG_NONE, 0); @@ -2084,11 +2230,11 @@ void test_nghttp2_session_recv_unknown_frame(void) { ud.frame_recv_cb_called = 0; /* Unknown frame must be ignored */ - rv = nghttp2_session_mem_recv(session, data, datalen); + rv = nghttp2_session_mem_recv2(session, data, datalen); - CU_ASSERT(rv == (ssize_t)datalen); - CU_ASSERT(0 == ud.frame_recv_cb_called); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_ptrdiff(rv, ==, (nghttp2_ssize)datalen); + assert_int(0, ==, ud.frame_recv_cb_called); + assert_null(nghttp2_session_get_next_ob_item(session)); nghttp2_session_del(session); } @@ -2100,7 +2246,7 @@ void test_nghttp2_session_recv_unexpected_continuation(void) { uint8_t data[16384]; size_t datalen; nghttp2_frame_hd hd; - ssize_t rv; + nghttp2_ssize rv; nghttp2_outbound_item *item; nghttp2_frame_hd_init(&hd, 16000, NGHTTP2_CONTINUATION, @@ -2119,14 +2265,14 @@ void test_nghttp2_session_recv_unexpected_continuation(void) { ud.frame_recv_cb_called = 0; /* unexpected CONTINUATION must be treated as connection error */ - rv = nghttp2_session_mem_recv(session, data, datalen); + rv = nghttp2_session_mem_recv2(session, data, datalen); - CU_ASSERT(rv == (ssize_t)datalen); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff(rv, ==, (nghttp2_ssize)datalen); + assert_int(0, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_session_del(session); } @@ -2137,7 +2283,7 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { nghttp2_frame frame; nghttp2_bufs bufs; nghttp2_buf *buf; - ssize_t rv; + nghttp2_ssize rv; my_user_data ud; nghttp2_settings_entry iv[3]; nghttp2_nv nv = MAKE_NV(":authority", "example.org"); @@ -2148,7 +2294,7 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); callbacks.on_frame_recv_callback = on_frame_recv_callback; - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, &ud); @@ -2163,8 +2309,8 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { rv = nghttp2_frame_pack_settings(&bufs, &frame.settings); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_settings_free(&frame.settings, mem); @@ -2173,13 +2319,13 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); - CU_ASSERT(3000 == session->remote_settings.header_table_size); - CU_ASSERT(16384 == session->remote_settings.initial_window_size); + assert_uint32(3000, ==, session->remote_settings.header_table_size); + assert_uint32(16384, ==, session->remote_settings.initial_window_size); nghttp2_bufs_reset(&bufs); @@ -2198,8 +2344,8 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { rv = nghttp2_frame_pack_settings(&bufs, &frame.settings); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_settings_free(&frame.settings, mem); @@ -2208,23 +2354,23 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)(nghttp2_buf_len(buf)) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)(nghttp2_buf_len(buf)), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); - CU_ASSERT(3001 == session->remote_settings.header_table_size); - CU_ASSERT(16383 == session->remote_settings.initial_window_size); + assert_uint32(3001, ==, session->remote_settings.header_table_size); + assert_uint32(16383, ==, session->remote_settings.initial_window_size); nghttp2_bufs_reset(&bufs); /* 2 SETTINGS_HEADER_TABLE_SIZE; first entry clears dynamic header table. */ - nghttp2_submit_request(session, NULL, &nv, 1, NULL, NULL); + nghttp2_submit_request2(session, NULL, &nv, 1, NULL, NULL); nghttp2_session_send(session); - CU_ASSERT(0 < session->hd_deflater.ctx.hd_table.len); + assert_size(0, <, session->hd_deflater.ctx.hd_table.len); iv[0].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; iv[0].value = 0; @@ -2240,8 +2386,8 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { rv = nghttp2_frame_pack_settings(&bufs, &frame.settings); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_settings_free(&frame.settings, mem); @@ -2250,24 +2396,24 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); - CU_ASSERT(4096 == session->remote_settings.header_table_size); - CU_ASSERT(16382 == session->remote_settings.initial_window_size); - CU_ASSERT(0 == session->hd_deflater.ctx.hd_table.len); + assert_uint32(4096, ==, session->remote_settings.header_table_size); + assert_uint32(16382, ==, session->remote_settings.initial_window_size); + assert_size(0, ==, session->hd_deflater.ctx.hd_table.len); nghttp2_bufs_reset(&bufs); /* 2 SETTINGS_HEADER_TABLE_SIZE; second entry clears dynamic header table. */ - nghttp2_submit_request(session, NULL, &nv, 1, NULL, NULL); + nghttp2_submit_request2(session, NULL, &nv, 1, NULL, NULL); nghttp2_session_send(session); - CU_ASSERT(0 < session->hd_deflater.ctx.hd_table.len); + assert_size(0, <, session->hd_deflater.ctx.hd_table.len); iv[0].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; iv[0].value = 3000; @@ -2283,8 +2429,8 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { rv = nghttp2_frame_pack_settings(&bufs, &frame.settings); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_settings_free(&frame.settings, mem); @@ -2293,14 +2439,14 @@ void test_nghttp2_session_recv_settings_header_table_size(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); - CU_ASSERT(0 == session->remote_settings.header_table_size); - CU_ASSERT(16381 == session->remote_settings.initial_window_size); - CU_ASSERT(0 == session->hd_deflater.ctx.hd_table.len); + assert_uint32(0, ==, session->remote_settings.header_table_size); + assert_uint32(16381, ==, session->remote_settings.initial_window_size); + assert_size(0, ==, session->hd_deflater.ctx.hd_table.len); nghttp2_bufs_reset(&bufs); @@ -2325,12 +2471,13 @@ void test_nghttp2_session_recv_too_large_frame_length(void) { nghttp2_frame_pack_frame_hd(buf, &hd); - CU_ASSERT(sizeof(buf) == nghttp2_session_mem_recv(session, buf, sizeof(buf))); + assert_ptrdiff(sizeof(buf), ==, + nghttp2_session_mem_recv2(session, buf, sizeof(buf))); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(item != NULL); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_session_del(session); } @@ -2343,7 +2490,7 @@ void test_nghttp2_session_recv_extension(void) { nghttp2_frame_hd hd; nghttp2_mem *mem; const char data[] = "Hello World!"; - ssize_t rv; + nghttp2_ssize rv; nghttp2_option *option; mem = nghttp2_mem_default(); @@ -2368,13 +2515,13 @@ void test_nghttp2_session_recv_extension(void) { nghttp2_session_client_new2(&session, &callbacks, &ud, option); nghttp2_frame_hd_init(&ud.recv_frame_hd, 0, 0, 0, 0); - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + hd.length == (size_t)rv); - CU_ASSERT(111 == ud.recv_frame_hd.type); - CU_ASSERT(0xab == ud.recv_frame_hd.flags); - CU_ASSERT(1000000007 == ud.recv_frame_hd.stream_id); - CU_ASSERT(0 == memcmp(data, ud.scratchbuf.pos, sizeof(data))); + assert_size(NGHTTP2_FRAME_HDLEN + hd.length, ==, (size_t)rv); + assert_uint8(111, ==, ud.recv_frame_hd.type); + assert_uint8(0xab, ==, ud.recv_frame_hd.flags); + assert_int32(1000000007, ==, ud.recv_frame_hd.stream_id); + assert_memory_equal(sizeof(data), data, ud.scratchbuf.pos); nghttp2_session_del(session); @@ -2382,15 +2529,15 @@ void test_nghttp2_session_recv_extension(void) { nghttp2_buf_reset(&ud.scratchbuf); callbacks.on_extension_chunk_recv_callback = - cancel_on_extension_chunk_recv_callback; + cancel_on_extension_chunk_recv_callback; nghttp2_session_server_new2(&session, &callbacks, &ud, option); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + hd.length == (size_t)rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_size(NGHTTP2_FRAME_HDLEN + hd.length, ==, (size_t)rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -2403,10 +2550,10 @@ void test_nghttp2_session_recv_extension(void) { nghttp2_session_server_new2(&session, &callbacks, &ud, option); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + hd.length == (size_t)rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_size(NGHTTP2_FRAME_HDLEN + hd.length, ==, (size_t)rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -2423,7 +2570,7 @@ void test_nghttp2_session_recv_altsvc(void) { nghttp2_buf buf; nghttp2_frame_hd hd; nghttp2_mem *mem; - ssize_t rv; + nghttp2_ssize rv; nghttp2_option *option; static const uint8_t origin[] = "nghttp2.org"; static const uint8_t field_value[] = "h2=\":443\""; @@ -2453,13 +2600,13 @@ void test_nghttp2_session_recv_altsvc(void) { buf.last = nghttp2_cpymem(buf.last, field_value, sizeof(field_value) - 1); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&buf) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_ALTSVC == ud.recv_frame_hd.type); - CU_ASSERT(NGHTTP2_FLAG_NONE == ud.recv_frame_hd.flags); - CU_ASSERT(0 == ud.recv_frame_hd.stream_id); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&buf), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_uint8(NGHTTP2_ALTSVC, ==, ud.recv_frame_hd.type); + assert_uint8(NGHTTP2_FLAG_NONE, ==, ud.recv_frame_hd.flags); + assert_int32(0, ==, ud.recv_frame_hd.stream_id); nghttp2_session_del(session); @@ -2477,10 +2624,10 @@ void test_nghttp2_session_recv_altsvc(void) { buf.last = nghttp2_cpymem(buf.last, origin, sizeof(origin) - 1 - 1); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&buf) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&buf), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -2498,10 +2645,10 @@ void test_nghttp2_session_recv_altsvc(void) { buf.last = nghttp2_cpymem(buf.last, origin, sizeof(origin) - 1); ud.invalid_frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&buf) == rv); - CU_ASSERT(1 == ud.invalid_frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&buf), ==, rv); + assert_int(1, ==, ud.invalid_frame_recv_cb_called); nghttp2_session_del(session); @@ -2522,10 +2669,10 @@ void test_nghttp2_session_recv_altsvc(void) { buf.last = nghttp2_cpymem(buf.last, field_value, sizeof(field_value) - 1); ud.invalid_frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&buf) == rv); - CU_ASSERT(1 == ud.invalid_frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&buf), ==, rv); + assert_int(1, ==, ud.invalid_frame_recv_cb_called); nghttp2_session_del(session); @@ -2543,10 +2690,10 @@ void test_nghttp2_session_recv_altsvc(void) { buf.last = nghttp2_cpymem(buf.last, field_value, sizeof(field_value) - 1); ud.invalid_frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&buf) == rv); - CU_ASSERT(1 == ud.invalid_frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&buf), ==, rv); + assert_int(1, ==, ud.invalid_frame_recv_cb_called); nghttp2_session_del(session); @@ -2566,12 +2713,12 @@ void test_nghttp2_session_recv_altsvc(void) { buf.last += nghttp2_buf_avail(&buf); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&buf) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_ALTSVC == ud.recv_frame_hd.type); - CU_ASSERT(NGHTTP2_MAX_FRAME_SIZE_MIN == ud.recv_frame_hd.length); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&buf), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_uint8(NGHTTP2_ALTSVC, ==, ud.recv_frame_hd.type); + assert_size(NGHTTP2_MAX_FRAME_SIZE_MIN, ==, ud.recv_frame_hd.length); nghttp2_session_del(session); @@ -2593,10 +2740,10 @@ void test_nghttp2_session_recv_altsvc(void) { buf.last += nghttp2_buf_avail(&buf); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&buf) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&buf), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -2615,10 +2762,10 @@ void test_nghttp2_session_recv_altsvc(void) { buf.last = nghttp2_cpymem(buf.last, field_value, sizeof(field_value) - 1); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf.pos, nghttp2_buf_len(&buf)); + rv = nghttp2_session_mem_recv2(session, buf.pos, nghttp2_buf_len(&buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&buf) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&buf), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -2631,7 +2778,7 @@ void test_nghttp2_session_recv_origin(void) { nghttp2_session_callbacks callbacks; my_user_data ud; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; nghttp2_option *option; nghttp2_extension frame; nghttp2_ext_origin origin; @@ -2658,17 +2805,17 @@ void test_nghttp2_session_recv_origin(void) { rv = nghttp2_frame_pack_origin(&bufs, &frame); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_ORIGIN == ud.recv_frame_hd.type); - CU_ASSERT(NGHTTP2_FLAG_NONE == ud.recv_frame_hd.flags); - CU_ASSERT(0 == ud.recv_frame_hd.stream_id); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_uint8(NGHTTP2_ORIGIN, ==, ud.recv_frame_hd.type); + assert_uint8(NGHTTP2_FLAG_NONE, ==, ud.recv_frame_hd.flags); + assert_int32(0, ==, ud.recv_frame_hd.stream_id); nghttp2_session_del(session); nghttp2_bufs_reset(&bufs); @@ -2679,17 +2826,17 @@ void test_nghttp2_session_recv_origin(void) { nghttp2_frame_origin_init(&frame, &ov, 1); rv = nghttp2_frame_pack_origin(&bufs, &frame); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_put_uint16be(bufs.head->buf.pos + NGHTTP2_FRAME_HDLEN, (uint16_t)sizeof(nghttp2)); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); nghttp2_bufs_reset(&bufs); @@ -2702,14 +2849,14 @@ void test_nghttp2_session_recv_origin(void) { frame.hd.stream_id = 1; rv = nghttp2_frame_pack_origin(&bufs, &frame); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); nghttp2_bufs_reset(&bufs); @@ -2721,14 +2868,14 @@ void test_nghttp2_session_recv_origin(void) { frame.hd.flags = 0xf0; rv = nghttp2_frame_pack_origin(&bufs, &frame); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); nghttp2_bufs_reset(&bufs); @@ -2739,14 +2886,14 @@ void test_nghttp2_session_recv_origin(void) { nghttp2_frame_origin_init(&frame, &ov, 1); rv = nghttp2_frame_pack_origin(&bufs, &frame); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); nghttp2_bufs_reset(&bufs); @@ -2757,15 +2904,15 @@ void test_nghttp2_session_recv_origin(void) { nghttp2_frame_origin_init(&frame, NULL, 0); rv = nghttp2_frame_pack_origin(&bufs, &frame); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_ORIGIN == ud.recv_frame_hd.type); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_uint8(NGHTTP2_ORIGIN, ==, ud.recv_frame_hd.type); nghttp2_session_del(session); @@ -2778,7 +2925,7 @@ void test_nghttp2_session_recv_priority_update(void) { nghttp2_session_callbacks callbacks; my_user_data ud; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; nghttp2_option *option; nghttp2_extension frame; nghttp2_ext_priority_update priority_update; @@ -2820,19 +2967,19 @@ void test_nghttp2_session_recv_priority_update(void) { open_recv_stream(session, 1); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_PRIORITY_UPDATE == ud.recv_frame_hd.type); - CU_ASSERT(NGHTTP2_FLAG_NONE == ud.recv_frame_hd.flags); - CU_ASSERT(0 == ud.recv_frame_hd.stream_id); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_uint8(NGHTTP2_PRIORITY_UPDATE, ==, ud.recv_frame_hd.type); + assert_uint8(NGHTTP2_FLAG_NONE, ==, ud.recv_frame_hd.flags); + assert_int32(0, ==, ud.recv_frame_hd.stream_id); stream = nghttp2_session_get_stream_raw(session, 1); - CU_ASSERT(2 == nghttp2_extpri_uint8_urgency(stream->extpri)); - CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri)); + assert_uint32(2, ==, nghttp2_extpri_uint8_urgency(stream->extpri)); + assert_true(nghttp2_extpri_uint8_inc(stream->extpri)); nghttp2_session_del(session); nghttp2_bufs_reset(&bufs); @@ -2849,38 +2996,38 @@ void test_nghttp2_session_recv_priority_update(void) { nghttp2_frame_pack_priority_update(&bufs, &frame); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_PRIORITY_UPDATE == ud.recv_frame_hd.type); - CU_ASSERT(NGHTTP2_FLAG_NONE == ud.recv_frame_hd.flags); - CU_ASSERT(0 == ud.recv_frame_hd.stream_id); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_uint8(NGHTTP2_PRIORITY_UPDATE, ==, ud.recv_frame_hd.type); + assert_uint8(NGHTTP2_FLAG_NONE, ==, ud.recv_frame_hd.flags); + assert_int32(0, ==, ud.recv_frame_hd.stream_id); stream = nghttp2_session_get_stream_raw(session, 1); - CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state); - CU_ASSERT(2 == nghttp2_extpri_uint8_urgency(stream->extpri)); - CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri)); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_IDLE, ==, stream->state); + assert_uint32(2, ==, nghttp2_extpri_uint8_urgency(stream->extpri)); + assert_true(nghttp2_extpri_uint8_inc(stream->extpri)); nghttp2_hd_deflate_init(&deflater, mem); nghttp2_bufs_reset(&bufs); rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == ud.recv_frame_hd.type); - CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state); - CU_ASSERT(2 == nghttp2_extpri_uint8_urgency(stream->extpri)); - CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, ud.recv_frame_hd.type); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENING, ==, stream->state); + assert_uint32(2, ==, nghttp2_extpri_uint8_urgency(stream->extpri)); + assert_true(nghttp2_extpri_uint8_inc(stream->extpri)); nghttp2_hd_deflate_free(&deflater); @@ -2900,15 +3047,15 @@ void test_nghttp2_session_recv_priority_update(void) { open_recv_stream(session, 1); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); stream = nghttp2_session_get_stream_raw(session, 1); - CU_ASSERT(NGHTTP2_EXTPRI_DEFAULT_URGENCY == stream->extpri); + assert_uint32(NGHTTP2_EXTPRI_DEFAULT_URGENCY, ==, stream->extpri); nghttp2_session_del(session); nghttp2_bufs_reset(&bufs); @@ -2926,15 +3073,15 @@ void test_nghttp2_session_recv_priority_update(void) { open_sent_stream(session, 1); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, item->frame.goaway.error_code); nghttp2_session_del(session); nghttp2_bufs_reset(&bufs); @@ -2948,28 +3095,28 @@ void test_nghttp2_session_recv_priority_update(void) { for (i = 0; i < 101; ++i) { stream_id = (int32_t)(i * 2 + 1); nghttp2_frame_priority_update_init( - &frame, stream_id, (uint8_t *)field_value, sizeof(field_value) - 1); + &frame, stream_id, (uint8_t *)field_value, sizeof(field_value) - 1); nghttp2_frame_pack_priority_update(&bufs, &frame); ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); if (i < 100) { - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_PRIORITY_UPDATE == ud.recv_frame_hd.type); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_uint8(NGHTTP2_PRIORITY_UPDATE, ==, ud.recv_frame_hd.type); } else { - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_int(0, ==, ud.frame_recv_cb_called); } nghttp2_bufs_reset(&bufs); } item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, item->frame.goaway.error_code); nghttp2_session_del(session); nghttp2_option_del(option); @@ -2986,7 +3133,7 @@ void test_nghttp2_session_continue(void) { nghttp2_bufs bufs; nghttp2_buf *buf; size_t framelen1, framelen2; - ssize_t rv; + nghttp2_ssize rv; uint8_t buffer[4096]; nghttp2_buf databuf; nghttp2_frame frame; @@ -3002,7 +3149,7 @@ void test_nghttp2_session_continue(void) { nghttp2_buf_wrap_init(&databuf, buffer, sizeof(buffer)); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_recv_callback = on_frame_recv_callback; callbacks.on_data_chunk_recv_callback = pause_on_data_chunk_recv_callback; callbacks.on_header_callback = pause_on_header_callback; @@ -3021,8 +3168,8 @@ void test_nghttp2_session_continue(void) { NGHTTP2_HCAT_HEADERS, NULL, nva, nvlen); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3039,8 +3186,8 @@ void test_nghttp2_session_continue(void) { nghttp2_bufs_reset(&bufs); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3053,79 +3200,79 @@ void test_nghttp2_session_continue(void) { user_data.begin_headers_cb_called = 0; user_data.header_cb_called = 0; rv = - nghttp2_session_mem_recv(session, databuf.pos, nghttp2_buf_len(&databuf)); + nghttp2_session_mem_recv2(session, databuf.pos, nghttp2_buf_len(&databuf)); - CU_ASSERT(rv >= 0); + assert_ptrdiff(0, <=, rv); databuf.pos += rv; recv_frame = user_data.frame; - CU_ASSERT(NGHTTP2_HEADERS == recv_frame->hd.type); - CU_ASSERT(framelen1 - NGHTTP2_FRAME_HDLEN == recv_frame->hd.length); + assert_uint8(NGHTTP2_HEADERS, ==, recv_frame->hd.type); + assert_size(framelen1 - NGHTTP2_FRAME_HDLEN, ==, recv_frame->hd.length); - CU_ASSERT(1 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == user_data.header_cb_called); + assert_int(1, ==, user_data.begin_headers_cb_called); + assert_int(1, ==, user_data.header_cb_called); - CU_ASSERT(nghttp2_nv_equal(&nv1[0], &user_data.nv)); + assert_true(nghttp2_nv_equal(&nv1[0], &user_data.nv)); /* get 2nd header field */ user_data.begin_headers_cb_called = 0; user_data.header_cb_called = 0; rv = - nghttp2_session_mem_recv(session, databuf.pos, nghttp2_buf_len(&databuf)); + nghttp2_session_mem_recv2(session, databuf.pos, nghttp2_buf_len(&databuf)); - CU_ASSERT(rv >= 0); + assert_ptrdiff(0, <=, rv); databuf.pos += rv; - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == user_data.header_cb_called); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_int(1, ==, user_data.header_cb_called); - CU_ASSERT(nghttp2_nv_equal(&nv1[1], &user_data.nv)); + assert_true(nghttp2_nv_equal(&nv1[1], &user_data.nv)); /* will call end_headers_callback and receive 2nd HEADERS and pause */ user_data.begin_headers_cb_called = 0; user_data.header_cb_called = 0; rv = - nghttp2_session_mem_recv(session, databuf.pos, nghttp2_buf_len(&databuf)); + nghttp2_session_mem_recv2(session, databuf.pos, nghttp2_buf_len(&databuf)); - CU_ASSERT(rv >= 0); + assert_ptrdiff(0, <=, rv); databuf.pos += rv; recv_frame = user_data.frame; - CU_ASSERT(NGHTTP2_HEADERS == recv_frame->hd.type); - CU_ASSERT(framelen2 - NGHTTP2_FRAME_HDLEN == recv_frame->hd.length); + assert_uint8(NGHTTP2_HEADERS, ==, recv_frame->hd.type); + assert_size(framelen2 - NGHTTP2_FRAME_HDLEN, ==, recv_frame->hd.length); - CU_ASSERT(1 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == user_data.header_cb_called); + assert_int(1, ==, user_data.begin_headers_cb_called); + assert_int(1, ==, user_data.header_cb_called); - CU_ASSERT(nghttp2_nv_equal(&nv2[0], &user_data.nv)); + assert_true(nghttp2_nv_equal(&nv2[0], &user_data.nv)); /* get 2nd header field */ user_data.begin_headers_cb_called = 0; user_data.header_cb_called = 0; rv = - nghttp2_session_mem_recv(session, databuf.pos, nghttp2_buf_len(&databuf)); + nghttp2_session_mem_recv2(session, databuf.pos, nghttp2_buf_len(&databuf)); - CU_ASSERT(rv >= 0); + assert_ptrdiff(0, <=, rv); databuf.pos += rv; - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == user_data.header_cb_called); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_int(1, ==, user_data.header_cb_called); - CU_ASSERT(nghttp2_nv_equal(&nv2[1], &user_data.nv)); + assert_true(nghttp2_nv_equal(&nv2[1], &user_data.nv)); /* No input data, frame_recv_callback is called */ user_data.begin_headers_cb_called = 0; user_data.header_cb_called = 0; user_data.frame_recv_cb_called = 0; rv = - nghttp2_session_mem_recv(session, databuf.pos, nghttp2_buf_len(&databuf)); + nghttp2_session_mem_recv2(session, databuf.pos, nghttp2_buf_len(&databuf)); - CU_ASSERT(rv >= 0); + assert_ptrdiff(0, <=, rv); databuf.pos += rv; - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(0 == user_data.header_cb_called); - CU_ASSERT(1 == user_data.frame_recv_cb_called); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_int(0, ==, user_data.header_cb_called); + assert_int(1, ==, user_data.frame_recv_cb_called); /* Receive DATA */ nghttp2_frame_hd_init(&data_hd, 16, NGHTTP2_DATA, NGHTTP2_FLAG_NONE, 1); @@ -3139,25 +3286,25 @@ void test_nghttp2_session_continue(void) { user_data.frame_recv_cb_called = 0; rv = - nghttp2_session_mem_recv(session, databuf.pos, nghttp2_buf_len(&databuf)); + nghttp2_session_mem_recv2(session, databuf.pos, nghttp2_buf_len(&databuf)); - CU_ASSERT(16 + NGHTTP2_FRAME_HDLEN == rv); - CU_ASSERT(0 == user_data.frame_recv_cb_called); + assert_ptrdiff(16 + NGHTTP2_FRAME_HDLEN, ==, rv); + assert_int(0, ==, user_data.frame_recv_cb_called); - /* Next nghttp2_session_mem_recv invokes on_frame_recv_callback and + /* Next nghttp2_session_mem_recv2 invokes on_frame_recv_callback and pause again in on_data_chunk_recv_callback since we pass same DATA frame. */ user_data.frame_recv_cb_called = 0; rv = - nghttp2_session_mem_recv(session, databuf.pos, nghttp2_buf_len(&databuf)); - CU_ASSERT(16 + NGHTTP2_FRAME_HDLEN == rv); - CU_ASSERT(1 == user_data.frame_recv_cb_called); + nghttp2_session_mem_recv2(session, databuf.pos, nghttp2_buf_len(&databuf)); + assert_ptrdiff(16 + NGHTTP2_FRAME_HDLEN, ==, rv); + assert_int(1, ==, user_data.frame_recv_cb_called); /* And finally call on_frame_recv_callback with 0 size input */ user_data.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, NULL, 0); - CU_ASSERT(0 == rv); - CU_ASSERT(1 == user_data.frame_recv_cb_called); + rv = nghttp2_session_mem_recv2(session, NULL, 0); + assert_ptrdiff(0, ==, rv); + assert_int(1, ==, user_data.frame_recv_cb_called); nghttp2_bufs_free(&bufs); nghttp2_hd_deflate_free(&deflater); @@ -3177,12 +3324,13 @@ void test_nghttp2_session_add_frame(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = accumulator_send_callback; + callbacks.send_callback2 = accumulator_send_callback; acc.length = 0; user_data.acc = &acc; - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &user_data)); + assert_int(0, ==, + nghttp2_session_client_new(&session, &callbacks, &user_data)); item = mem->malloc(sizeof(nghttp2_outbound_item), NULL); @@ -3194,18 +3342,19 @@ void test_nghttp2_session_add_frame(void) { nghttp2_nv_array_copy(&nva, reqnv, nvlen, mem); nghttp2_frame_headers_init( - &frame->headers, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, - (int32_t)session->next_stream_id, NGHTTP2_HCAT_REQUEST, NULL, nva, nvlen); + &frame->headers, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, + (int32_t)session->next_stream_id, NGHTTP2_HCAT_REQUEST, NULL, nva, nvlen); session->next_stream_id += 2; - CU_ASSERT(0 == nghttp2_session_add_item(session, item)); - CU_ASSERT(NULL != nghttp2_outbound_queue_top(&session->ob_syn)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(NGHTTP2_HEADERS == acc.buf[3]); - CU_ASSERT((NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY) == acc.buf[4]); + assert_int(0, ==, nghttp2_session_add_item(session, item)); + assert_not_null(nghttp2_outbound_queue_top(&session->ob_syn)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_uint8(NGHTTP2_HEADERS, ==, acc.buf[3]); + assert_uint8((NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY), ==, + acc.buf[4]); /* check stream id */ - CU_ASSERT(1 == nghttp2_get_uint32(&acc.buf[5])); + assert_uint32(1, ==, nghttp2_get_uint32(&acc.buf[5])); nghttp2_session_del(session); } @@ -3233,17 +3382,17 @@ void test_nghttp2_session_on_request_headers_received(void) { nghttp2_priority_spec_init(&pri_spec, 0, 255, 0); nghttp2_frame_headers_init( - &frame.headers, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, - stream_id, NGHTTP2_HCAT_REQUEST, &pri_spec, NULL, 0); + &frame.headers, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, stream_id, + NGHTTP2_HCAT_REQUEST, &pri_spec, NULL, 0); user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(1 == user_data.begin_headers_cb_called); + assert_int(0, ==, + nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(1, ==, user_data.begin_headers_cb_called); stream = nghttp2_session_get_stream(session, stream_id); - CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state); - CU_ASSERT(255 == stream->weight); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENING, ==, stream->state); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3253,14 +3402,14 @@ void test_nghttp2_session_on_request_headers_received(void) { NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, 3, NGHTTP2_HCAT_HEADERS, NULL, NULL, 0); user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(1, ==, user_data.invalid_frame_recv_cb_called); + assert_false(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers, mem); session->local_settings.max_concurrent_streams = - NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS; + NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS; /* Stream ID less than or equal to the previously received request HEADERS is just ignored due to race condition */ @@ -3268,10 +3417,10 @@ void test_nghttp2_session_on_request_headers_received(void) { NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, 3, NGHTTP2_HCAT_HEADERS, NULL, NULL, 0); user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(0 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(0, ==, user_data.invalid_frame_recv_cb_called); + assert_false(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3281,10 +3430,10 @@ void test_nghttp2_session_on_request_headers_received(void) { NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, 2, NGHTTP2_HCAT_HEADERS, NULL, NULL, 0); user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(1, ==, user_data.invalid_frame_recv_cb_called); + assert_true(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3300,9 +3449,10 @@ void test_nghttp2_session_on_request_headers_received(void) { 1, NGHTTP2_HCAT_HEADERS, NULL, nva, nvlen); user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(1 == user_data.begin_headers_cb_called); - CU_ASSERT(0 == user_data.invalid_frame_recv_cb_called); + assert_int(0, ==, + nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(1, ==, user_data.begin_headers_cb_called); + assert_int(0, ==, user_data.invalid_frame_recv_cb_called); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3316,10 +3466,10 @@ void test_nghttp2_session_on_request_headers_received(void) { NGHTTP2_HCAT_REQUEST, NULL, NULL, 0); user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(1, ==, user_data.invalid_frame_recv_cb_called); + assert_true(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3332,10 +3482,10 @@ void test_nghttp2_session_on_request_headers_received(void) { NGHTTP2_HCAT_REQUEST, NULL, NULL, 0); user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(1, ==, user_data.invalid_frame_recv_cb_called); + assert_true(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3352,10 +3502,10 @@ void test_nghttp2_session_on_request_headers_received(void) { NGHTTP2_HCAT_REQUEST, NULL, NULL, 0); user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(0 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(0, ==, user_data.invalid_frame_recv_cb_called); + assert_false(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3369,7 +3519,8 @@ void test_nghttp2_session_on_request_headers_received(void) { nghttp2_frame_headers_init(&frame.headers, NGHTTP2_FLAG_END_HEADERS, 3, NGHTTP2_HCAT_REQUEST, NULL, NULL, 0); - CU_ASSERT(0 == nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(0, ==, + nghttp2_session_on_request_headers_received(session, &frame)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3379,10 +3530,10 @@ void test_nghttp2_session_on_request_headers_received(void) { session->goaway_flags |= NGHTTP2_GOAWAY_SENT; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(0 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(0 == (session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(0, ==, user_data.invalid_frame_recv_cb_called); + assert_false(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3398,9 +3549,8 @@ void test_nghttp2_session_on_request_headers_received(void) { nghttp2_frame_headers_init(&frame.headers, NGHTTP2_FLAG_END_HEADERS, 1, NGHTTP2_HCAT_REQUEST, NULL, NULL, 0); - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); - CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3428,10 +3578,11 @@ void test_nghttp2_session_on_response_headers_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_on_response_headers_received(session, &frame, - stream)); - CU_ASSERT(1 == user_data.begin_headers_cb_called); - CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state); + assert_int( + 0, ==, + nghttp2_session_on_response_headers_received(session, &frame, stream)); + assert_int(1, ==, user_data.begin_headers_cb_called); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENED, ==, stream->state); nghttp2_frame_headers_free(&frame.headers, mem); nghttp2_session_del(session); @@ -3459,26 +3610,28 @@ void test_nghttp2_session_on_headers_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_on_headers_received(session, &frame, stream)); - CU_ASSERT(1 == user_data.begin_headers_cb_called); - CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state); + assert_int(0, ==, + nghttp2_session_on_headers_received(session, &frame, stream)); + assert_int(1, ==, user_data.begin_headers_cb_called); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENED, ==, stream->state); /* stream closed */ frame.hd.flags |= NGHTTP2_FLAG_END_STREAM; - CU_ASSERT(0 == nghttp2_session_on_headers_received(session, &frame, stream)); - CU_ASSERT(2 == user_data.begin_headers_cb_called); + assert_int(0, ==, + nghttp2_session_on_headers_received(session, &frame, stream)); + assert_int(2, ==, user_data.begin_headers_cb_called); /* Check to see when NGHTTP2_STREAM_CLOSING, incoming HEADERS is discarded. */ stream = open_sent_stream2(session, 3, NGHTTP2_STREAM_CLOSING); frame.hd.stream_id = 3; frame.hd.flags = NGHTTP2_FLAG_END_HEADERS; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_headers_received(session, &frame, stream)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_headers_received(session, &frame, stream)); /* See no counters are updated */ - CU_ASSERT(2 == user_data.begin_headers_cb_called); - CU_ASSERT(0 == user_data.invalid_frame_recv_cb_called); + assert_int(2, ==, user_data.begin_headers_cb_called); + assert_int(0, ==, user_data.invalid_frame_recv_cb_called); /* Server initiated stream */ stream = open_recv_stream(session, 2); @@ -3486,16 +3639,17 @@ void test_nghttp2_session_on_headers_received(void) { frame.hd.flags = NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM; frame.hd.stream_id = 2; - CU_ASSERT(0 == nghttp2_session_on_headers_received(session, &frame, stream)); - CU_ASSERT(3 == user_data.begin_headers_cb_called); - CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state); + assert_int(0, ==, + nghttp2_session_on_headers_received(session, &frame, stream)); + assert_int(3, ==, user_data.begin_headers_cb_called); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENED, ==, stream->state); nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); /* Further reception of HEADERS is subject to stream error */ - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_headers_received(session, &frame, stream)); - CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_headers_received(session, &frame, stream)); + assert_int(1, ==, user_data.invalid_frame_recv_cb_called); nghttp2_frame_headers_free(&frame.headers, mem); @@ -3513,7 +3667,7 @@ void test_nghttp2_session_on_push_response_headers_received(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_begin_headers_callback = on_begin_headers_callback; callbacks.on_invalid_frame_recv_callback = on_invalid_frame_recv_callback; @@ -3528,31 +3682,32 @@ void test_nghttp2_session_on_push_response_headers_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(1 == session->num_incoming_reserved_streams); - CU_ASSERT(0 == nghttp2_session_on_push_response_headers_received( - session, &frame, stream)); - CU_ASSERT(1 == user_data.begin_headers_cb_called); - CU_ASSERT(0 == session->num_incoming_reserved_streams); - CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state); - CU_ASSERT(1 == session->num_incoming_streams); - CU_ASSERT(0 == (stream->flags & NGHTTP2_STREAM_FLAG_PUSH)); + assert_size(1, ==, session->num_incoming_reserved_streams); + assert_int( + 0, ==, + nghttp2_session_on_push_response_headers_received(session, &frame, stream)); + assert_int(1, ==, user_data.begin_headers_cb_called); + assert_size(0, ==, session->num_incoming_reserved_streams); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENED, ==, stream->state); + assert_size(1, ==, session->num_incoming_streams); + assert_false(stream->flags & NGHTTP2_STREAM_FLAG_PUSH); /* If un-ACKed max concurrent streams limit is exceeded, RST_STREAMed */ session->pending_local_max_concurrent_stream = 1; stream = open_recv_stream2(session, 4, NGHTTP2_STREAM_RESERVED); frame.hd.stream_id = 4; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_response_headers_received(session, &frame, - stream)); + assert_int( + NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_response_headers_received(session, &frame, stream)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(NGHTTP2_REFUSED_STREAM == item->frame.rst_stream.error_code); - CU_ASSERT(1 == session->num_incoming_streams); - CU_ASSERT(1 == session->num_incoming_reserved_streams); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_REFUSED_STREAM, ==, item->frame.rst_stream.error_code); + assert_size(1, ==, session->num_incoming_streams); + assert_size(1, ==, session->num_incoming_reserved_streams); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == session->num_incoming_streams); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(1, ==, session->num_incoming_streams); /* If ACKed max concurrent streams limit is exceeded, GOAWAY is issued */ @@ -3561,103 +3716,19 @@ void test_nghttp2_session_on_push_response_headers_received(void) { stream = open_recv_stream2(session, 6, NGHTTP2_STREAM_RESERVED); frame.hd.stream_id = 6; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_response_headers_received(session, &frame, - stream)); + assert_int( + NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_response_headers_received(session, &frame, stream)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); - CU_ASSERT(1 == session->num_incoming_streams); - CU_ASSERT(1 == session->num_incoming_reserved_streams); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, item->frame.goaway.error_code); + assert_size(1, ==, session->num_incoming_streams); + assert_size(1, ==, session->num_incoming_reserved_streams); nghttp2_frame_headers_free(&frame.headers, mem); nghttp2_session_del(session); } -void test_nghttp2_session_on_priority_received(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - my_user_data user_data; - nghttp2_frame frame; - nghttp2_stream *stream, *dep_stream; - nghttp2_priority_spec pri_spec; - nghttp2_outbound_item *item; - - memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.on_frame_recv_callback = on_frame_recv_callback; - callbacks.on_invalid_frame_recv_callback = on_invalid_frame_recv_callback; - - nghttp2_session_server_new(&session, &callbacks, &user_data); - stream = open_recv_stream(session, 1); - - nghttp2_priority_spec_init(&pri_spec, 0, 2, 0); - - nghttp2_frame_priority_init(&frame.priority, 1, &pri_spec); - - /* depend on stream 0 */ - CU_ASSERT(0 == nghttp2_session_on_priority_received(session, &frame)); - - CU_ASSERT(2 == stream->weight); - - stream = open_sent_stream(session, 2); - dep_stream = open_recv_stream(session, 3); - - frame.hd.stream_id = 2; - - /* using dependency stream */ - nghttp2_priority_spec_init(&frame.priority.pri_spec, 3, 1, 0); - - CU_ASSERT(0 == nghttp2_session_on_priority_received(session, &frame)); - CU_ASSERT(dep_stream == stream->dep_prev); - - /* PRIORITY against idle stream */ - - frame.hd.stream_id = 100; - - CU_ASSERT(0 == nghttp2_session_on_priority_received(session, &frame)); - - stream = nghttp2_session_get_stream_raw(session, frame.hd.stream_id); - - CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state); - CU_ASSERT(dep_stream == stream->dep_prev); - - nghttp2_frame_priority_free(&frame.priority); - nghttp2_session_del(session); - - /* Check dep_stream_id == stream_id case */ - nghttp2_session_server_new(&session, &callbacks, &user_data); - open_recv_stream(session, 1); - - nghttp2_priority_spec_init(&pri_spec, 1, 0, 0); - - nghttp2_frame_priority_init(&frame.priority, 1, &pri_spec); - - CU_ASSERT(0 == nghttp2_session_on_priority_received(session, &frame)); - - item = nghttp2_session_get_next_ob_item(session); - - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - - nghttp2_frame_priority_free(&frame.priority); - nghttp2_session_del(session); - - /* Check again dep_stream_id == stream_id, and stream_id is idle */ - nghttp2_session_server_new(&session, &callbacks, &user_data); - - nghttp2_priority_spec_init(&pri_spec, 1, 16, 0); - - nghttp2_frame_priority_init(&frame.priority, 1, &pri_spec); - - CU_ASSERT(0 == nghttp2_session_on_priority_received(session, &frame)); - - item = nghttp2_session_get_next_ob_item(session); - - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - - nghttp2_frame_priority_free(&frame.priority); - nghttp2_session_del(session); -} - void test_nghttp2_session_on_rst_stream_received(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; @@ -3669,8 +3740,8 @@ void test_nghttp2_session_on_rst_stream_received(void) { nghttp2_frame_rst_stream_init(&frame.rst_stream, 1, NGHTTP2_PROTOCOL_ERROR); - CU_ASSERT(0 == nghttp2_session_on_rst_stream_received(session, &frame)); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 1)); + assert_int(0, ==, nghttp2_session_on_rst_stream_received(session, &frame)); + assert_null(nghttp2_session_get_stream(session, 1)); nghttp2_frame_rst_stream_free(&frame.rst_stream); nghttp2_session_del(session); @@ -3691,7 +3762,7 @@ void test_nghttp2_session_on_settings_received(void) { uint8_t data[2048]; nghttp2_frame_hd hd; int rv; - ssize_t nread; + nghttp2_ssize nread; nghttp2_stream *stream; mem = nghttp2_mem_default(); @@ -3712,7 +3783,7 @@ void test_nghttp2_session_on_settings_received(void) { iv[4].value = 0; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, &user_data); session->remote_settings.initial_window_size = 16 * 1024; @@ -3728,26 +3799,29 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, dup_iv(iv, niv), niv); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); - CU_ASSERT(1000000009 == session->remote_settings.max_concurrent_streams); - CU_ASSERT(64 * 1024 == session->remote_settings.initial_window_size); - CU_ASSERT(1024 == session->remote_settings.header_table_size); - CU_ASSERT(0 == session->remote_settings.enable_push); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); + assert_uint32(1000000009, ==, + session->remote_settings.max_concurrent_streams); + assert_uint32(64 * 1024, ==, session->remote_settings.initial_window_size); + assert_uint32(1024, ==, session->remote_settings.header_table_size); + assert_uint32(0, ==, session->remote_settings.enable_push); - CU_ASSERT(64 * 1024 == stream1->remote_window_size); - CU_ASSERT(0 == stream2->remote_window_size); + assert_int32(64 * 1024, ==, stream1->remote_window_size); + assert_int32(0, ==, stream2->remote_window_size); frame.settings.iv[2].value = 16 * 1024; - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); - CU_ASSERT(16 * 1024 == stream1->remote_window_size); - CU_ASSERT(-48 * 1024 == stream2->remote_window_size); + assert_int32(16 * 1024, ==, stream1->remote_window_size); + assert_int32(-48 * 1024, ==, stream2->remote_window_size); - CU_ASSERT(16 * 1024 == nghttp2_session_get_stream_remote_window_size( - session, stream1->stream_id)); - CU_ASSERT(0 == nghttp2_session_get_stream_remote_window_size( - session, stream2->stream_id)); + assert_int32( + 16 * 1024, ==, + nghttp2_session_get_stream_remote_window_size(session, stream1->stream_id)); + assert_int32( + 0, ==, + nghttp2_session_get_stream_remote_window_size(session, stream2->stream_id)); nghttp2_frame_settings_free(&frame.settings, mem); @@ -3757,10 +3831,10 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_session_server_new(&session, &callbacks, NULL); nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_ACK, dup_iv(iv, 1), 1); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(item != NULL); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_frame_settings_free(&frame.settings, mem); nghttp2_session_del(session); @@ -3769,10 +3843,10 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_session_server_new(&session, &callbacks, NULL); nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_ACK, NULL, 0); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(item != NULL); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_frame_settings_free(&frame.settings, mem); nghttp2_session_del(session); @@ -3781,11 +3855,11 @@ void test_nghttp2_session_on_settings_received(void) { and header table size is once cleared to 0. */ nghttp2_session_client_new(&session, &callbacks, NULL); - nghttp2_submit_request(session, NULL, &nv, 1, NULL, NULL); + nghttp2_submit_request2(session, NULL, &nv, 1, NULL, NULL); nghttp2_session_send(session); - CU_ASSERT(session->hd_deflater.ctx.hd_table.len > 0); + assert_size(0, <, session->hd_deflater.ctx.hd_table.len); iv[0].settings_id = NGHTTP2_SETTINGS_HEADER_TABLE_SIZE; iv[0].value = 0; @@ -3796,11 +3870,11 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, dup_iv(iv, 2), 2); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); - CU_ASSERT(0 == session->hd_deflater.ctx.hd_table.len); - CU_ASSERT(2048 == session->hd_deflater.ctx.hd_table_bufsize_max); - CU_ASSERT(2048 == session->remote_settings.header_table_size); + assert_size(0, ==, session->hd_deflater.ctx.hd_table.len); + assert_size(2048, ==, session->hd_deflater.ctx.hd_table_bufsize_max); + assert_uint32(2048, ==, session->remote_settings.header_table_size); nghttp2_frame_settings_free(&frame.settings, mem); nghttp2_session_del(session); @@ -3811,12 +3885,12 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_option_new(&option); nghttp2_option_set_peer_max_concurrent_streams(option, 1000); nghttp2_session_client_new2(&session, &callbacks, NULL, option); - CU_ASSERT(1000 == session->remote_settings.max_concurrent_streams); + assert_uint32(1000, ==, session->remote_settings.max_concurrent_streams); nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, NULL, 0); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); - CU_ASSERT(NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS == - session->remote_settings.max_concurrent_streams); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); + assert_uint32(NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS, ==, + session->remote_settings.max_concurrent_streams); nghttp2_frame_settings_free(&frame.settings, mem); nghttp2_session_del(session); @@ -3831,12 +3905,12 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, dup_iv(iv, 1), 1); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(item != NULL); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_frame_settings_free(&frame.settings, mem); nghttp2_session_del(session); @@ -3850,7 +3924,7 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_frame_window_update_init(&frame.window_update, NGHTTP2_FLAG_NONE, 1, 1); - CU_ASSERT(0 == nghttp2_session_on_window_update_received(session, &frame)); + assert_int(0, ==, nghttp2_session_on_window_update_received(session, &frame)); nghttp2_frame_window_update_free(&frame.window_update); @@ -3862,20 +3936,20 @@ void test_nghttp2_session_on_settings_received(void) { /* Now window size gets NGHTTP2_MAX_WINDOW_SIZE + 1, which is unacceptable situation in protocol spec. */ - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); nghttp2_frame_settings_free(&frame.settings, mem); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_SETTINGS == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_SETTINGS, ==, item->frame.hd.type); item = nghttp2_outbound_queue_top(&session->ob_reg); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(NGHTTP2_STREAM_CLOSING == stream1->state); + assert_not_null(item); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_CLOSING, ==, stream1->state); nghttp2_session_del(session); @@ -3891,14 +3965,14 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, dup_iv(iv, 1), 1); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); nghttp2_frame_settings_free(&frame.settings, mem); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_session_del(session); @@ -3915,11 +3989,11 @@ void test_nghttp2_session_on_settings_received(void) { rv = nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); stream = open_recv_stream(session, 1); @@ -3931,31 +4005,31 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_frame_pack_frame_hd(data, &hd); nread = - nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + hd.length); + nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + hd.length); - CU_ASSERT((ssize_t)(NGHTTP2_FRAME_HDLEN + hd.length) == nread); + assert_ptrdiff((nghttp2_ssize)(NGHTTP2_FRAME_HDLEN + hd.length), ==, nread); rv = nghttp2_session_consume(session, 1, hd.length); - CU_ASSERT(0 == rv); - CU_ASSERT((int32_t)hd.length == stream->recv_window_size); - CU_ASSERT((int32_t)hd.length == stream->consumed_size); + assert_int(0, ==, rv); + assert_int32((int32_t)hd.length, ==, stream->recv_window_size); + assert_int32((int32_t)hd.length, ==, stream->consumed_size); nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_ACK, NULL, 0); rv = nghttp2_session_on_settings_received(session, &frame, 0); - CU_ASSERT(0 == rv); - CU_ASSERT(1024 == stream->local_window_size); - CU_ASSERT(0 == stream->recv_window_size); - CU_ASSERT(0 == stream->consumed_size); + assert_int(0, ==, rv); + assert_int32(1024, ==, stream->local_window_size); + assert_int32(0, ==, stream->recv_window_size); + assert_int32(0, ==, stream->consumed_size); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT((int32_t)hd.length == - item->frame.window_update.window_size_increment); + assert_not_null(item); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32((int32_t)hd.length, ==, + item->frame.window_update.window_size_increment); nghttp2_session_del(session); nghttp2_option_del(option); @@ -3972,14 +4046,14 @@ void test_nghttp2_session_on_settings_received(void) { nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, dup_iv(iv, 1), 1); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); nghttp2_frame_settings_free(&frame.settings, mem); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_session_del(session); } @@ -3999,7 +4073,7 @@ void test_nghttp2_session_on_push_promise_received(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_begin_headers_callback = on_begin_headers_callback; callbacks.on_invalid_frame_recv_callback = on_invalid_frame_recv_callback; @@ -4013,13 +4087,14 @@ void test_nghttp2_session_on_push_promise_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(0, ==, nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(1 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == session->num_incoming_reserved_streams); + assert_int(1, ==, user_data.begin_headers_cb_called); + assert_size(1, ==, session->num_incoming_reserved_streams); promised_stream = nghttp2_session_get_stream(session, 2); - CU_ASSERT(NGHTTP2_STREAM_RESERVED == promised_stream->state); - CU_ASSERT(2 == session->last_recv_stream_id); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_RESERVED, ==, + promised_stream->state); + assert_int32(2, ==, session->last_recv_stream_id); /* Attempt to PUSH_PROMISE against half close (remote) */ nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); @@ -4027,18 +4102,18 @@ void test_nghttp2_session_on_push_promise_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(1 == session->num_incoming_reserved_streams); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 4)); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_int(1, ==, user_data.invalid_frame_recv_cb_called); + assert_size(1, ==, session->num_incoming_reserved_streams); + assert_null(nghttp2_session_get_stream(session, 4)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_STREAM_CLOSED == item->frame.goaway.error_code); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(4 == session->last_recv_stream_id); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_STREAM_CLOSED, ==, item->frame.goaway.error_code); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int32(4, ==, session->last_recv_stream_id); nghttp2_session_del(session); @@ -4052,17 +4127,17 @@ void test_nghttp2_session_on_push_promise_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(0 == session->num_incoming_reserved_streams); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 6)); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_size(0, ==, session->num_incoming_reserved_streams); + assert_null(nghttp2_session_get_stream(session, 6)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(6 == item->frame.hd.stream_id); - CU_ASSERT(NGHTTP2_CANCEL == item->frame.rst_stream.error_code); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int32(6, ==, item->frame.hd.stream_id); + assert_uint32(NGHTTP2_CANCEL, ==, item->frame.rst_stream.error_code); + assert_int(0, ==, nghttp2_session_send(session)); /* Attempt to PUSH_PROMISE against idle stream */ frame.hd.stream_id = 3; @@ -4070,17 +4145,17 @@ void test_nghttp2_session_on_push_promise_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(0 == session->num_incoming_reserved_streams); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 8)); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_size(0, ==, session->num_incoming_reserved_streams); + assert_null(nghttp2_session_get_stream(session, 8)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(0 == item->frame.hd.stream_id); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_int32(0, ==, item->frame.hd.stream_id); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, item->frame.goaway.error_code); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_session_del(session); @@ -4094,37 +4169,37 @@ void test_nghttp2_session_on_push_promise_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(0, ==, nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(1 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == session->num_incoming_reserved_streams); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 2)); + assert_int(1, ==, user_data.begin_headers_cb_called); + assert_size(1, ==, session->num_incoming_reserved_streams); + assert_not_null(nghttp2_session_get_stream(session, 2)); user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == session->num_incoming_reserved_streams); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 8)); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_size(1, ==, session->num_incoming_reserved_streams); + assert_null(nghttp2_session_get_stream(session, 8)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, item->frame.goaway.error_code); + assert_int(0, ==, nghttp2_session_send(session)); /* After GOAWAY, PUSH_PROMISE will be discarded */ frame.push_promise.promised_stream_id = 10; user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == session->num_incoming_reserved_streams); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 10)); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_size(1, ==, session->num_incoming_reserved_streams); + assert_null(nghttp2_session_get_stream(session, 10)); + assert_null(nghttp2_session_get_next_ob_item(session)); nghttp2_frame_push_promise_free(&frame.push_promise, mem); nghttp2_session_del(session); @@ -4139,12 +4214,12 @@ void test_nghttp2_session_on_push_promise_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(1 == session->num_incoming_reserved_streams); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_int(1, ==, user_data.invalid_frame_recv_cb_called); + assert_size(1, ==, session->num_incoming_reserved_streams); nghttp2_frame_push_promise_free(&frame.push_promise, mem); nghttp2_session_del(session); @@ -4161,12 +4236,12 @@ void test_nghttp2_session_on_push_promise_received(void) { user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(0 == user_data.begin_headers_cb_called); - CU_ASSERT(1 == user_data.invalid_frame_recv_cb_called); - CU_ASSERT(0 == session->num_incoming_reserved_streams); + assert_int(0, ==, user_data.begin_headers_cb_called); + assert_int(1, ==, user_data.invalid_frame_recv_cb_called); + assert_size(0, ==, session->num_incoming_reserved_streams); nghttp2_frame_push_promise_free(&frame.push_promise, mem); nghttp2_session_del(session); @@ -4182,10 +4257,10 @@ void test_nghttp2_session_on_push_promise_received(void) { 1, 2, nva, nvlen); user_data.begin_headers_cb_called = 0; user_data.invalid_frame_recv_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(0, ==, nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(1 == user_data.begin_headers_cb_called); - CU_ASSERT(0 == user_data.invalid_frame_recv_cb_called); + assert_int(1, ==, user_data.begin_headers_cb_called); + assert_int(0, ==, user_data.invalid_frame_recv_cb_called); nghttp2_frame_push_promise_free(&frame.push_promise, mem); nghttp2_session_del(session); @@ -4202,10 +4277,10 @@ void test_nghttp2_session_on_push_promise_received(void) { nghttp2_frame_push_promise_init(&frame.push_promise, NGHTTP2_FLAG_END_HEADERS, 1, 2, NULL, 0); - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(0 == session->num_incoming_reserved_streams); + assert_size(0, ==, session->num_incoming_reserved_streams); nghttp2_frame_push_promise_free(&frame.push_promise, mem); nghttp2_session_del(session); @@ -4217,20 +4292,20 @@ void test_nghttp2_session_on_push_promise_received(void) { open_sent_stream(session, 1); open_recv_stream2(session, 2, NGHTTP2_STREAM_RESERVED); - CU_ASSERT(1 == session->num_incoming_reserved_streams); + assert_size(1, ==, session->num_incoming_reserved_streams); nghttp2_frame_push_promise_init(&frame.push_promise, NGHTTP2_FLAG_END_HEADERS, 1, 4, NULL, 0); - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_push_promise_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_push_promise_received(session, &frame)); - CU_ASSERT(1 == session->num_incoming_reserved_streams); + assert_size(1, ==, session->num_incoming_reserved_streams); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(NGHTTP2_CANCEL == item->frame.rst_stream.error_code); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_CANCEL, ==, item->frame.rst_stream.error_code); nghttp2_frame_push_promise_free(&frame.push_promise, mem); nghttp2_session_del(session); @@ -4255,22 +4330,22 @@ void test_nghttp2_session_on_ping_received(void) { nghttp2_session_client_new(&session, &callbacks, &user_data); nghttp2_frame_ping_init(&frame.ping, NGHTTP2_FLAG_ACK, opaque_data); - CU_ASSERT(0 == nghttp2_session_on_ping_received(session, &frame)); - CU_ASSERT(1 == user_data.frame_recv_cb_called); + assert_int(0, ==, nghttp2_session_on_ping_received(session, &frame)); + assert_int(1, ==, user_data.frame_recv_cb_called); /* Since this ping frame has ACK flag set, no further action is performed. */ - CU_ASSERT(NULL == nghttp2_outbound_queue_top(&session->ob_urgent)); + assert_null(nghttp2_outbound_queue_top(&session->ob_urgent)); /* Clear the flag, and receive it again */ frame.hd.flags = NGHTTP2_FLAG_NONE; - CU_ASSERT(0 == nghttp2_session_on_ping_received(session, &frame)); - CU_ASSERT(2 == user_data.frame_recv_cb_called); + assert_int(0, ==, nghttp2_session_on_ping_received(session, &frame)); + assert_int(2, ==, user_data.frame_recv_cb_called); top = nghttp2_outbound_queue_top(&session->ob_urgent); - CU_ASSERT(NGHTTP2_PING == top->frame.hd.type); - CU_ASSERT(NGHTTP2_FLAG_ACK == top->frame.hd.flags); - CU_ASSERT(memcmp(opaque_data, top->frame.ping.opaque_data, 8) == 0); + assert_uint8(NGHTTP2_PING, ==, top->frame.hd.type); + assert_uint8(NGHTTP2_FLAG_ACK, ==, top->frame.hd.flags); + assert_memory_equal(8, opaque_data, top->frame.ping.opaque_data); nghttp2_frame_ping_free(&frame.ping); nghttp2_session_del(session); @@ -4284,9 +4359,9 @@ void test_nghttp2_session_on_ping_received(void) { user_data.frame_recv_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_on_ping_received(session, &frame)); - CU_ASSERT(1 == user_data.frame_recv_cb_called); - CU_ASSERT(NULL == nghttp2_outbound_queue_top(&session->ob_urgent)); + assert_int(0, ==, nghttp2_session_on_ping_received(session, &frame)); + assert_int(1, ==, user_data.frame_recv_cb_called); + assert_null(nghttp2_outbound_queue_top(&session->ob_urgent)); nghttp2_frame_ping_free(&frame.ping); nghttp2_session_del(session); @@ -4301,7 +4376,7 @@ void test_nghttp2_session_on_goaway_received(void) { int i; nghttp2_mem *mem; const uint8_t *data; - ssize_t datalen; + nghttp2_ssize datalen; mem = nghttp2_mem_default(); user_data.frame_recv_cb_called = 0; @@ -4326,20 +4401,20 @@ void test_nghttp2_session_on_goaway_received(void) { user_data.stream_close_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_on_goaway_received(session, &frame)); + assert_int(0, ==, nghttp2_session_on_goaway_received(session, &frame)); - CU_ASSERT(1 == user_data.frame_recv_cb_called); - CU_ASSERT(3 == session->remote_last_stream_id); + assert_int(1, ==, user_data.frame_recv_cb_called); + assert_int32(3, ==, session->remote_last_stream_id); /* on_stream_close should be callsed for 2 times (stream 5 and 7) */ - CU_ASSERT(2 == user_data.stream_close_cb_called); + assert_int(2, ==, user_data.stream_close_cb_called); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 1)); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 2)); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 3)); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 4)); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 5)); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 6)); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 7)); + assert_not_null(nghttp2_session_get_stream(session, 1)); + assert_not_null(nghttp2_session_get_stream(session, 2)); + assert_not_null(nghttp2_session_get_stream(session, 3)); + assert_not_null(nghttp2_session_get_stream(session, 4)); + assert_null(nghttp2_session_get_stream(session, 5)); + assert_not_null(nghttp2_session_get_stream(session, 6)); + assert_null(nghttp2_session_get_stream(session, 7)); nghttp2_frame_goaway_free(&frame.goaway, mem); nghttp2_session_del(session); @@ -4355,14 +4430,14 @@ void test_nghttp2_session_on_goaway_received(void) { nghttp2_frame_goaway_init(&frame.goaway, 0, NGHTTP2_NO_ERROR, NULL, 0); - CU_ASSERT(0 == nghttp2_session_on_goaway_received(session, &frame)); + assert_int(0, ==, nghttp2_session_on_goaway_received(session, &frame)); - nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); - datalen = nghttp2_session_mem_send(session, &data); + datalen = nghttp2_session_mem_send2(session, &data); - CU_ASSERT(NGHTTP2_ERR_CALLBACK_FAILURE == datalen); - CU_ASSERT(1 == user_data.stream_close_cb_called); + assert_ptrdiff(NGHTTP2_ERR_CALLBACK_FAILURE, ==, datalen); + assert_int(1, ==, user_data.stream_close_cb_called); nghttp2_frame_goaway_free(&frame.goaway, mem); nghttp2_session_del(session); @@ -4391,23 +4466,23 @@ void test_nghttp2_session_on_window_update_received(void) { data_item = create_data_ob_item(mem); - CU_ASSERT(0 == nghttp2_stream_attach_item(stream, data_item)); + nghttp2_stream_attach_item(stream, data_item); nghttp2_frame_window_update_init(&frame.window_update, NGHTTP2_FLAG_NONE, 1, 16 * 1024); - CU_ASSERT(0 == nghttp2_session_on_window_update_received(session, &frame)); - CU_ASSERT(1 == user_data.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 16 * 1024 == - stream->remote_window_size); + assert_int(0, ==, nghttp2_session_on_window_update_received(session, &frame)); + assert_int(1, ==, user_data.frame_recv_cb_called); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE + 16 * 1024, ==, + stream->remote_window_size); nghttp2_stream_defer_item(stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL); - CU_ASSERT(0 == nghttp2_session_on_window_update_received(session, &frame)); - CU_ASSERT(2 == user_data.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 16 * 1024 * 2 == - stream->remote_window_size); - CU_ASSERT(0 == (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL)); + assert_int(0, ==, nghttp2_session_on_window_update_received(session, &frame)); + assert_int(2, ==, user_data.frame_recv_cb_called); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE + 16 * 1024 * 2, ==, + stream->remote_window_size); + assert_false(stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL); nghttp2_frame_window_update_free(&frame.window_update); @@ -4418,9 +4493,9 @@ void test_nghttp2_session_on_window_update_received(void) { nghttp2_frame_window_update_init(&frame.window_update, NGHTTP2_FLAG_NONE, 2, 4096); - CU_ASSERT(!(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); - CU_ASSERT(0 == nghttp2_session_on_window_update_received(session, &frame)); - CU_ASSERT(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); + assert_false(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); + assert_int(0, ==, nghttp2_session_on_window_update_received(session, &frame)); + assert_true(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); nghttp2_frame_window_update_free(&frame.window_update); @@ -4434,10 +4509,11 @@ void test_nghttp2_session_on_window_update_received(void) { nghttp2_frame_window_update_init(&frame.window_update, NGHTTP2_FLAG_NONE, 2, 4096); - CU_ASSERT(0 == nghttp2_session_on_window_update_received(session, &frame)); - CU_ASSERT(!(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND)); + assert_int(0, ==, nghttp2_session_on_window_update_received(session, &frame)); + assert_false(session->goaway_flags & NGHTTP2_GOAWAY_TERM_ON_SEND); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 4096 == stream->remote_window_size); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE + 4096, ==, + stream->remote_window_size); nghttp2_frame_window_update_free(&frame.window_update); @@ -4459,13 +4535,13 @@ void test_nghttp2_session_on_data_received(void) { nghttp2_frame_hd_init(&frame.hd, 4096, NGHTTP2_DATA, NGHTTP2_FLAG_NONE, 2); - CU_ASSERT(0 == nghttp2_session_on_data_received(session, &frame)); - CU_ASSERT(0 == stream->shut_flags); + assert_int(0, ==, nghttp2_session_on_data_received(session, &frame)); + assert_uint8(0, ==, stream->shut_flags); frame.hd.flags = NGHTTP2_FLAG_END_STREAM; - CU_ASSERT(0 == nghttp2_session_on_data_received(session, &frame)); - CU_ASSERT(NGHTTP2_SHUT_RD == stream->shut_flags); + assert_int(0, ==, nghttp2_session_on_data_received(session, &frame)); + assert_uint8(NGHTTP2_SHUT_RD, ==, stream->shut_flags); /* If NGHTTP2_STREAM_CLOSING state, DATA frame is discarded. */ open_sent_stream2(session, 1, NGHTTP2_STREAM_CLOSING); @@ -4473,18 +4549,18 @@ void test_nghttp2_session_on_data_received(void) { frame.hd.flags = NGHTTP2_FLAG_NONE; frame.hd.stream_id = 1; - CU_ASSERT(0 == nghttp2_session_on_data_received(session, &frame)); - CU_ASSERT(NULL == nghttp2_outbound_queue_top(&session->ob_reg)); + assert_int(0, ==, nghttp2_session_on_data_received(session, &frame)); + assert_null(nghttp2_outbound_queue_top(&session->ob_reg)); /* Check INVALID_STREAM case: DATA frame with stream ID which does not exist. */ frame.hd.stream_id = 3; - CU_ASSERT(0 == nghttp2_session_on_data_received(session, &frame)); + assert_int(0, ==, nghttp2_session_on_data_received(session, &frame)); top = nghttp2_outbound_queue_top(&session->ob_reg); /* DATA against nonexistent stream is just ignored for now. */ - CU_ASSERT(top == NULL); + assert_null(top); nghttp2_session_del(session); } @@ -4508,13 +4584,13 @@ void test_nghttp2_session_on_data_received_fail_fast(void) { stream = open_recv_stream(session, 1); nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); - CU_ASSERT((ssize_t)sizeof(buf) == - nghttp2_session_mem_recv(session, buf, sizeof(buf))); + assert_ptrdiff((nghttp2_ssize)sizeof(buf), ==, + nghttp2_session_mem_recv2(session, buf, sizeof(buf))); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_not_null(item); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_session_del(session); @@ -4525,13 +4601,12 @@ void test_nghttp2_session_on_data_received_fail_fast(void) { nghttp2_stream_shutdown(stream, NGHTTP2_SHUT_RD); nghttp2_session_close_stream(session, 1, NGHTTP2_NO_ERROR); - CU_ASSERT((ssize_t)sizeof(buf) == - nghttp2_session_mem_recv(session, buf, sizeof(buf))); + assert_ptrdiff((nghttp2_ssize)sizeof(buf), ==, + nghttp2_session_mem_recv2(session, buf, sizeof(buf))); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_null(item); nghttp2_session_del(session); } @@ -4564,8 +4639,8 @@ void test_nghttp2_session_on_altsvc_received(void) { ud.frame_recv_cb_called = 0; rv = nghttp2_session_on_altsvc_received(session, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); + assert_int(0, ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -4580,8 +4655,8 @@ void test_nghttp2_session_on_altsvc_received(void) { ud.frame_recv_cb_called = 0; rv = nghttp2_session_on_altsvc_received(session, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_int(0, ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -4598,8 +4673,8 @@ void test_nghttp2_session_on_altsvc_received(void) { ud.frame_recv_cb_called = 0; rv = nghttp2_session_on_altsvc_received(session, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_int(0, ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -4616,8 +4691,8 @@ void test_nghttp2_session_on_altsvc_received(void) { ud.frame_recv_cb_called = 0; rv = nghttp2_session_on_altsvc_received(session, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(1 == ud.frame_recv_cb_called); + assert_int(0, ==, rv); + assert_int(1, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -4632,8 +4707,8 @@ void test_nghttp2_session_on_altsvc_received(void) { ud.frame_recv_cb_called = 0; rv = nghttp2_session_on_altsvc_received(session, &frame); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); + assert_int(0, ==, rv); + assert_int(0, ==, ud.frame_recv_cb_called); nghttp2_session_del(session); @@ -4651,7 +4726,7 @@ void test_nghttp2_session_send_headers_start_stream(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); @@ -4667,9 +4742,9 @@ void test_nghttp2_session_send_headers_start_stream(void) { session->next_stream_id += 2; nghttp2_session_add_item(session, item); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENING, ==, stream->state); nghttp2_session_del(session); } @@ -4685,9 +4760,9 @@ void test_nghttp2_session_send_headers_reply(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, NULL)); + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, NULL)); open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); item = mem->malloc(sizeof(nghttp2_outbound_item), NULL); @@ -4699,9 +4774,9 @@ void test_nghttp2_session_send_headers_reply(void) { nghttp2_frame_headers_init(&frame->headers, NGHTTP2_FLAG_END_HEADERS, 1, NGHTTP2_HCAT_HEADERS, NULL, NULL, 0); nghttp2_session_add_item(session, item); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENED, ==, stream->state); nghttp2_session_del(session); } @@ -4733,7 +4808,7 @@ void test_nghttp2_session_send_headers_frame_size_error(void) { } memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_not_send_callback = on_frame_not_send_callback; nghttp2_session_client_new(&session, &callbacks, &ud); @@ -4756,11 +4831,11 @@ void test_nghttp2_session_send_headers_frame_size_error(void) { ud.frame_not_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_not_send_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == ud.not_sent_frame_type); - CU_ASSERT(NGHTTP2_ERR_FRAME_SIZE_ERROR == ud.not_sent_error); + assert_int(1, ==, ud.frame_not_send_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, ud.not_sent_frame_type); + assert_int(NGHTTP2_ERR_FRAME_SIZE_ERROR, ==, ud.not_sent_error); for (i = 0; i < nnv; ++i) { mem->free(nv[i].value, NULL); @@ -4779,9 +4854,9 @@ void test_nghttp2_session_send_headers_push_reply(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, NULL)); + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, NULL)); open_sent_stream2(session, 2, NGHTTP2_STREAM_RESERVED); item = mem->malloc(sizeof(nghttp2_outbound_item), NULL); @@ -4793,12 +4868,12 @@ void test_nghttp2_session_send_headers_push_reply(void) { nghttp2_frame_headers_init(&frame->headers, NGHTTP2_FLAG_END_HEADERS, 2, NGHTTP2_HCAT_HEADERS, NULL, NULL, 0); nghttp2_session_add_item(session, item); - CU_ASSERT(0 == session->num_outgoing_streams); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == session->num_outgoing_streams); + assert_size(0, ==, session->num_outgoing_streams); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(1, ==, session->num_outgoing_streams); stream = nghttp2_session_get_stream(session, 2); - CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state); - CU_ASSERT(0 == (stream->flags & NGHTTP2_STREAM_FLAG_PUSH)); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENED, ==, stream->state); + assert_false(stream->flags & NGHTTP2_STREAM_FLAG_PUSH); nghttp2_session_del(session); } @@ -4813,7 +4888,7 @@ void test_nghttp2_session_send_rst_stream(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, &user_data); open_sent_stream(session, 1); @@ -4825,9 +4900,9 @@ void test_nghttp2_session_send_rst_stream(void) { nghttp2_frame_rst_stream_init(&frame->rst_stream, 1, NGHTTP2_PROTOCOL_ERROR); nghttp2_session_add_item(session, item); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 1)); + assert_null(nghttp2_session_get_stream(session, 1)); nghttp2_session_del(session); } @@ -4844,7 +4919,7 @@ void test_nghttp2_session_send_push_promise(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_not_send_callback = on_frame_not_send_callback; nghttp2_session_server_new(&session, &callbacks, &ud); @@ -4864,9 +4939,9 @@ void test_nghttp2_session_send_push_promise(void) { nghttp2_session_add_item(session, item); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); stream = nghttp2_session_get_stream(session, 2); - CU_ASSERT(NGHTTP2_STREAM_RESERVED == stream->state); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_RESERVED, ==, stream->state); /* Received ENABLE_PUSH = 0 */ iv.settings_id = NGHTTP2_SETTINGS_ENABLE_PUSH; @@ -4889,11 +4964,11 @@ void test_nghttp2_session_send_push_promise(void) { nghttp2_session_add_item(session, item); ud.frame_not_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_not_send_cb_called); - CU_ASSERT(NGHTTP2_PUSH_PROMISE == ud.not_sent_frame_type); - CU_ASSERT(NGHTTP2_ERR_PUSH_DISABLED == ud.not_sent_error); + assert_int(1, ==, ud.frame_not_send_cb_called); + assert_uint8(NGHTTP2_PUSH_PROMISE, ==, ud.not_sent_frame_type); + assert_int(NGHTTP2_ERR_PUSH_DISABLED, ==, ud.not_sent_error); nghttp2_session_del(session); @@ -4910,8 +4985,8 @@ void test_nghttp2_session_send_push_promise(void) { NGHTTP2_FLAG_END_HEADERS, 1, -1, NULL, 0); nghttp2_session_add_item(session, item); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 3)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_null(nghttp2_session_get_stream(session, 3)); nghttp2_session_del(session); } @@ -4922,17 +4997,17 @@ void test_nghttp2_session_is_my_stream_id(void) { memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); nghttp2_session_server_new(&session, &callbacks, NULL); - CU_ASSERT(0 == nghttp2_session_is_my_stream_id(session, 0)); - CU_ASSERT(0 == nghttp2_session_is_my_stream_id(session, 1)); - CU_ASSERT(1 == nghttp2_session_is_my_stream_id(session, 2)); + assert_false(nghttp2_session_is_my_stream_id(session, 0)); + assert_false(nghttp2_session_is_my_stream_id(session, 1)); + assert_true(nghttp2_session_is_my_stream_id(session, 2)); nghttp2_session_del(session); nghttp2_session_client_new(&session, &callbacks, NULL); - CU_ASSERT(0 == nghttp2_session_is_my_stream_id(session, 0)); - CU_ASSERT(1 == nghttp2_session_is_my_stream_id(session, 1)); - CU_ASSERT(0 == nghttp2_session_is_my_stream_id(session, 2)); + assert_false(nghttp2_session_is_my_stream_id(session, 0)); + assert_true(nghttp2_session_is_my_stream_id(session, 1)); + assert_false(nghttp2_session_is_my_stream_id(session, 2)); nghttp2_session_del(session); } @@ -4945,7 +5020,7 @@ void test_nghttp2_session_upgrade2(void) { nghttp2_settings_entry iv[16]; nghttp2_stream *stream; nghttp2_outbound_item *item; - ssize_t rv; + nghttp2_ssize rv; nghttp2_bufs bufs; nghttp2_buf *buf; nghttp2_hd_deflater deflater; @@ -4955,61 +5030,63 @@ void test_nghttp2_session_upgrade2(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; iv[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; iv[0].value = 1; iv[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; iv[1].value = 4095; - settings_payloadlen = (size_t)nghttp2_pack_settings_payload( - settings_payload, sizeof(settings_payload), iv, 2); + settings_payloadlen = (size_t)nghttp2_pack_settings_payload2( + settings_payload, sizeof(settings_payload), iv, 2); /* Check client side */ nghttp2_session_client_new(&session, &callbacks, NULL); - CU_ASSERT(0 == nghttp2_session_upgrade2(session, settings_payload, - settings_payloadlen, 0, &callbacks)); - CU_ASSERT(1 == session->last_sent_stream_id); + assert_int(0, ==, + nghttp2_session_upgrade2(session, settings_payload, + settings_payloadlen, 0, &callbacks)); + assert_int32(1, ==, session->last_sent_stream_id); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(stream != NULL); - CU_ASSERT(&callbacks == stream->stream_user_data); - CU_ASSERT(NGHTTP2_SHUT_WR == stream->shut_flags); + assert_not_null(stream); + assert_ptr_equal(&callbacks, stream->stream_user_data); + assert_uint8(NGHTTP2_SHUT_WR, ==, stream->shut_flags); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_SETTINGS == item->frame.hd.type); - CU_ASSERT(2 == item->frame.settings.niv); - CU_ASSERT(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS == - item->frame.settings.iv[0].settings_id); - CU_ASSERT(1 == item->frame.settings.iv[0].value); - CU_ASSERT(NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE == - item->frame.settings.iv[1].settings_id); - CU_ASSERT(4095 == item->frame.settings.iv[1].value); + assert_uint8(NGHTTP2_SETTINGS, ==, item->frame.hd.type); + assert_size(2, ==, item->frame.settings.niv); + assert_int32(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, ==, + item->frame.settings.iv[0].settings_id); + assert_uint32(1, ==, item->frame.settings.iv[0].value); + assert_int32(NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, ==, + item->frame.settings.iv[1].settings_id); + assert_uint32(4095, ==, item->frame.settings.iv[1].value); /* Call nghttp2_session_upgrade2() again is error */ - CU_ASSERT(NGHTTP2_ERR_PROTO == - nghttp2_session_upgrade2(session, settings_payload, - settings_payloadlen, 0, &callbacks)); + assert_int(NGHTTP2_ERR_PROTO, ==, + nghttp2_session_upgrade2(session, settings_payload, + settings_payloadlen, 0, &callbacks)); nghttp2_session_del(session); /* Make sure that response from server can be received */ nghttp2_session_client_new(&session, &callbacks, NULL); - CU_ASSERT(0 == nghttp2_session_upgrade2(session, settings_payload, - settings_payloadlen, 0, &callbacks)); + assert_int(0, ==, + nghttp2_session_upgrade2(session, settings_payload, + settings_payloadlen, 0, &callbacks)); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENING, ==, stream->state); nghttp2_hd_deflate_init(&deflater, mem); rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, resnv, ARRLEN(resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT(rv == (ssize_t)nghttp2_buf_len(buf)); - CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENED, ==, stream->state); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -5018,214 +5095,39 @@ void test_nghttp2_session_upgrade2(void) { /* Check server side */ nghttp2_session_server_new(&session, &callbacks, NULL); - CU_ASSERT(0 == nghttp2_session_upgrade2(session, settings_payload, - settings_payloadlen, 0, &callbacks)); - CU_ASSERT(1 == session->last_recv_stream_id); + assert_int(0, ==, + nghttp2_session_upgrade2(session, settings_payload, + settings_payloadlen, 0, &callbacks)); + assert_int32(1, ==, session->last_recv_stream_id); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(stream != NULL); - CU_ASSERT(NULL == stream->stream_user_data); - CU_ASSERT(NGHTTP2_SHUT_RD == stream->shut_flags); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); - CU_ASSERT(1 == session->remote_settings.max_concurrent_streams); - CU_ASSERT(4095 == session->remote_settings.initial_window_size); + assert_not_null(stream); + assert_null(stream->stream_user_data); + assert_uint8(NGHTTP2_SHUT_RD, ==, stream->shut_flags); + assert_null(nghttp2_session_get_next_ob_item(session)); + assert_uint32(1, ==, session->remote_settings.max_concurrent_streams); + assert_uint32(4095, ==, session->remote_settings.initial_window_size); /* Call nghttp2_session_upgrade2() again is error */ - CU_ASSERT(NGHTTP2_ERR_PROTO == - nghttp2_session_upgrade2(session, settings_payload, - settings_payloadlen, 0, &callbacks)); + assert_int(NGHTTP2_ERR_PROTO, ==, + nghttp2_session_upgrade2(session, settings_payload, + settings_payloadlen, 0, &callbacks)); nghttp2_session_del(session); /* Empty SETTINGS is OK */ - settings_payloadlen = (size_t)nghttp2_pack_settings_payload( - settings_payload, sizeof(settings_payload), NULL, 0); + settings_payloadlen = (size_t)nghttp2_pack_settings_payload2( + settings_payload, sizeof(settings_payload), NULL, 0); nghttp2_session_client_new(&session, &callbacks, NULL); - CU_ASSERT(0 == nghttp2_session_upgrade2(session, settings_payload, - settings_payloadlen, 0, NULL)); + assert_int(0, ==, + nghttp2_session_upgrade2(session, settings_payload, + settings_payloadlen, 0, NULL)); nghttp2_session_del(session); nghttp2_bufs_free(&bufs); } -void test_nghttp2_session_reprioritize_stream(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *stream; - nghttp2_stream *dep_stream; - nghttp2_priority_spec pri_spec; - int rv; - - memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = block_count_send_callback; - - nghttp2_session_server_new(&session, &callbacks, NULL); - - stream = open_recv_stream(session, 1); - - nghttp2_priority_spec_init(&pri_spec, 0, 10, 0); - - rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec); - - CU_ASSERT(0 == rv); - CU_ASSERT(10 == stream->weight); - CU_ASSERT(&session->root == stream->dep_prev); - - /* If dependency to idle stream which is not in dependency tree yet */ - - nghttp2_priority_spec_init(&pri_spec, 3, 99, 0); - - rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec); - - CU_ASSERT(0 == rv); - CU_ASSERT(99 == stream->weight); - CU_ASSERT(3 == stream->dep_prev->stream_id); - - dep_stream = nghttp2_session_get_stream_raw(session, 3); - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == dep_stream->weight); - - dep_stream = open_recv_stream(session, 3); - - /* Change weight */ - pri_spec.weight = 128; - - rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec); - - CU_ASSERT(0 == rv); - CU_ASSERT(128 == stream->weight); - CU_ASSERT(dep_stream == stream->dep_prev); - - /* Change weight again to test short-path case */ - pri_spec.weight = 100; - - rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec); - - CU_ASSERT(0 == rv); - CU_ASSERT(100 == stream->weight); - CU_ASSERT(dep_stream == stream->dep_prev); - CU_ASSERT(100 == dep_stream->sum_dep_weight); - - /* Test circular dependency; stream 1 is first removed and becomes - root. Then stream 3 depends on it. */ - nghttp2_priority_spec_init(&pri_spec, 1, 1, 0); - - rv = nghttp2_session_reprioritize_stream(session, dep_stream, &pri_spec); - - CU_ASSERT(0 == rv); - CU_ASSERT(1 == dep_stream->weight); - CU_ASSERT(stream == dep_stream->dep_prev); - - /* Making priority to closed stream will result in default - priority */ - session->last_recv_stream_id = 9; - - nghttp2_priority_spec_init(&pri_spec, 5, 5, 0); - - rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec); - - CU_ASSERT(0 == rv); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight); - - nghttp2_session_del(session); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - /* circular dependency; in case of stream which is not a direct - descendant of root. Use exclusive dependency. */ - stream = open_recv_stream(session, 1); - stream = open_recv_stream_with_dep(session, 3, stream); - stream = open_recv_stream_with_dep(session, 5, stream); - stream = open_recv_stream_with_dep(session, 7, stream); - open_recv_stream_with_dep(session, 9, stream); - - nghttp2_priority_spec_init(&pri_spec, 7, 1, 1); - - stream = nghttp2_session_get_stream(session, 3); - rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec); - - CU_ASSERT(0 == rv); - CU_ASSERT(7 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream(session, 7); - - CU_ASSERT(1 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream(session, 9); - - CU_ASSERT(3 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream(session, 5); - - CU_ASSERT(3 == stream->dep_prev->stream_id); - - nghttp2_session_del(session); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - /* circular dependency; in case of stream which is not a direct - descendant of root. Without exclusive dependency. */ - stream = open_recv_stream(session, 1); - stream = open_recv_stream_with_dep(session, 3, stream); - stream = open_recv_stream_with_dep(session, 5, stream); - stream = open_recv_stream_with_dep(session, 7, stream); - open_recv_stream_with_dep(session, 9, stream); - - nghttp2_priority_spec_init(&pri_spec, 7, 1, 0); - - stream = nghttp2_session_get_stream(session, 3); - rv = nghttp2_session_reprioritize_stream(session, stream, &pri_spec); - - CU_ASSERT(0 == rv); - CU_ASSERT(7 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream(session, 7); - - CU_ASSERT(1 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream(session, 9); - - CU_ASSERT(7 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream(session, 5); - - CU_ASSERT(3 == stream->dep_prev->stream_id); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_reprioritize_stream_with_idle_stream_dep(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *stream; - nghttp2_priority_spec pri_spec; - - memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = block_count_send_callback; - - nghttp2_session_server_new(&session, &callbacks, NULL); - - stream = open_recv_stream(session, 1); - - session->pending_local_max_concurrent_stream = 1; - - nghttp2_priority_spec_init(&pri_spec, 101, 10, 0); - - nghttp2_session_reprioritize_stream(session, stream, &pri_spec); - - /* idle stream is not counteed to max concurrent streams */ - - CU_ASSERT(10 == stream->weight); - CU_ASSERT(101 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream_raw(session, 101); - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight); - - nghttp2_session_del(session); -} - void test_nghttp2_submit_data(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; nghttp2_frame *frame; nghttp2_frame_hd hd; @@ -5234,30 +5136,31 @@ void test_nghttp2_submit_data(void) { nghttp2_buf *buf; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = block_count_send_callback; + callbacks.send_callback2 = block_count_send_callback; data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = NGHTTP2_DATA_PAYLOADLEN * 2; - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); aob = &session->aob; framebufs = &aob->framebufs; open_sent_stream(session, 1); - CU_ASSERT( - 0 == nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); + assert_int( + 0, ==, + nghttp2_submit_data2(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); ud.block_count = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); frame = &aob->item->frame; buf = &framebufs->head->buf; nghttp2_frame_unpack_frame_hd(&hd, buf->pos); - CU_ASSERT(NGHTTP2_FLAG_NONE == hd.flags); - CU_ASSERT(NGHTTP2_FLAG_NONE == frame->hd.flags); + assert_uint8(NGHTTP2_FLAG_NONE, ==, hd.flags); + assert_uint8(NGHTTP2_FLAG_NONE, ==, frame->hd.flags); /* aux_data.data.flags has these flags */ - CU_ASSERT(NGHTTP2_FLAG_END_STREAM == aob->item->aux_data.data.flags); + assert_uint8(NGHTTP2_FLAG_END_STREAM, ==, aob->item->aux_data.data.flags); nghttp2_session_del(session); } @@ -5265,7 +5168,7 @@ void test_nghttp2_submit_data(void) { void test_nghttp2_submit_data_read_length_too_large(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; nghttp2_frame *frame; nghttp2_frame_hd hd; @@ -5275,37 +5178,38 @@ void test_nghttp2_submit_data_read_length_too_large(void) { size_t payloadlen; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = block_count_send_callback; - callbacks.read_length_callback = too_large_data_source_length_callback; + callbacks.send_callback2 = block_count_send_callback; + callbacks.read_length_callback2 = too_large_data_source_length_callback; data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = NGHTTP2_DATA_PAYLOADLEN * 2; - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); aob = &session->aob; framebufs = &aob->framebufs; open_sent_stream(session, 1); - CU_ASSERT( - 0 == nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); + assert_int( + 0, ==, + nghttp2_submit_data2(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); ud.block_count = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); frame = &aob->item->frame; buf = &framebufs->head->buf; nghttp2_frame_unpack_frame_hd(&hd, buf->pos); - CU_ASSERT(NGHTTP2_FLAG_NONE == hd.flags); - CU_ASSERT(NGHTTP2_FLAG_NONE == frame->hd.flags); - CU_ASSERT(16384 == hd.length) + assert_uint8(NGHTTP2_FLAG_NONE, ==, hd.flags); + assert_uint8(NGHTTP2_FLAG_NONE, ==, frame->hd.flags); + assert_size(16384, ==, hd.length); /* aux_data.data.flags has these flags */ - CU_ASSERT(NGHTTP2_FLAG_END_STREAM == aob->item->aux_data.data.flags); + assert_uint8(NGHTTP2_FLAG_END_STREAM, ==, aob->item->aux_data.data.flags); nghttp2_session_del(session); /* Check that buffers are expanded */ - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); ud.data_source_length = NGHTTP2_MAX_FRAME_SIZE_MAX; @@ -5313,11 +5217,12 @@ void test_nghttp2_submit_data_read_length_too_large(void) { open_sent_stream(session, 1); - CU_ASSERT( - 0 == nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); + assert_int( + 0, ==, + nghttp2_submit_data2(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); ud.block_count = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); aob = &session->aob; @@ -5328,16 +5233,16 @@ void test_nghttp2_submit_data_read_length_too_large(void) { buf = &framebufs->head->buf; nghttp2_frame_unpack_frame_hd(&hd, buf->pos); - payloadlen = nghttp2_min(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE, - NGHTTP2_INITIAL_WINDOW_SIZE); + payloadlen = nghttp2_min_size(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE, + NGHTTP2_INITIAL_WINDOW_SIZE); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + 1 + payloadlen == - (size_t)nghttp2_buf_cap(buf)); - CU_ASSERT(NGHTTP2_FLAG_NONE == hd.flags); - CU_ASSERT(NGHTTP2_FLAG_NONE == frame->hd.flags); - CU_ASSERT(payloadlen == hd.length); + assert_size(NGHTTP2_FRAME_HDLEN + 1 + payloadlen, ==, + (size_t)nghttp2_buf_cap(buf)); + assert_uint8(NGHTTP2_FLAG_NONE, ==, hd.flags); + assert_uint8(NGHTTP2_FLAG_NONE, ==, frame->hd.flags); + assert_size(payloadlen, ==, hd.length); /* aux_data.data.flags has these flags */ - CU_ASSERT(NGHTTP2_FLAG_END_STREAM == aob->item->aux_data.data.flags); + assert_uint8(NGHTTP2_FLAG_END_STREAM, ==, aob->item->aux_data.data.flags); nghttp2_session_del(session); } @@ -5345,7 +5250,7 @@ void test_nghttp2_submit_data_read_length_too_large(void) { void test_nghttp2_submit_data_read_length_smallest(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; nghttp2_frame *frame; nghttp2_frame_hd hd; @@ -5354,39 +5259,40 @@ void test_nghttp2_submit_data_read_length_smallest(void) { nghttp2_buf *buf; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = block_count_send_callback; - callbacks.read_length_callback = smallest_length_data_source_length_callback; + callbacks.send_callback2 = block_count_send_callback; + callbacks.read_length_callback2 = smallest_length_data_source_length_callback; data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = NGHTTP2_DATA_PAYLOADLEN * 2; - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); aob = &session->aob; framebufs = &aob->framebufs; open_sent_stream(session, 1); - CU_ASSERT( - 0 == nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); + assert_int( + 0, ==, + nghttp2_submit_data2(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); ud.block_count = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); frame = &aob->item->frame; buf = &framebufs->head->buf; nghttp2_frame_unpack_frame_hd(&hd, buf->pos); - CU_ASSERT(NGHTTP2_FLAG_NONE == hd.flags); - CU_ASSERT(NGHTTP2_FLAG_NONE == frame->hd.flags); - CU_ASSERT(1 == hd.length) + assert_uint8(NGHTTP2_FLAG_NONE, ==, hd.flags); + assert_uint8(NGHTTP2_FLAG_NONE, ==, frame->hd.flags); + assert_size(1, ==, hd.length); /* aux_data.data.flags has these flags */ - CU_ASSERT(NGHTTP2_FLAG_END_STREAM == aob->item->aux_data.data.flags); + assert_uint8(NGHTTP2_FLAG_END_STREAM, ==, aob->item->aux_data.data.flags); nghttp2_session_del(session); } -static ssize_t submit_data_twice_data_source_read_callback( - nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, - uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { +static nghttp2_ssize submit_data_twice_data_source_read_callback( + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { (void)session; (void)stream_id; (void)buf; @@ -5394,7 +5300,7 @@ static ssize_t submit_data_twice_data_source_read_callback( (void)user_data; *data_flags |= NGHTTP2_DATA_FLAG_EOF; - return (ssize_t)nghttp2_min(len, 16); + return (nghttp2_ssize)nghttp2_min_size(len, 16); } static int submit_data_twice_on_frame_send_callback(nghttp2_session *session, @@ -5402,7 +5308,7 @@ static int submit_data_twice_on_frame_send_callback(nghttp2_session *session, void *user_data) { static int called = 0; int rv; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; (void)user_data; if (called == 0) { @@ -5410,9 +5316,9 @@ static int submit_data_twice_on_frame_send_callback(nghttp2_session *session, data_prd.read_callback = submit_data_twice_data_source_read_callback; - rv = nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, - frame->hd.stream_id, &data_prd); - CU_ASSERT(0 == rv); + rv = nghttp2_submit_data2(session, NGHTTP2_FLAG_END_STREAM, + frame->hd.stream_id, &data_prd); + assert_int(0, ==, rv); } return 0; @@ -5421,12 +5327,12 @@ static int submit_data_twice_on_frame_send_callback(nghttp2_session *session, void test_nghttp2_submit_data_twice(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; accumulator acc; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = accumulator_send_callback; + callbacks.send_callback2 = accumulator_send_callback; callbacks.on_frame_send_callback = submit_data_twice_on_frame_send_callback; data_prd.read_callback = submit_data_twice_data_source_read_callback; @@ -5434,15 +5340,16 @@ void test_nghttp2_submit_data_twice(void) { acc.length = 0; ud.acc = &acc; - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); open_sent_stream(session, 1); - CU_ASSERT(0 == nghttp2_submit_data(session, NGHTTP2_FLAG_NONE, 1, &data_prd)); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, + nghttp2_submit_data2(session, NGHTTP2_FLAG_NONE, 1, &data_prd)); + assert_int(0, ==, nghttp2_session_send(session)); /* We should have sent 2 DATA frame with 16 bytes payload each */ - CU_ASSERT(NGHTTP2_FRAME_HDLEN * 2 + 16 * 2 == acc.length); + assert_size(NGHTTP2_FRAME_HDLEN * 2 + 16 * 2, ==, acc.length); nghttp2_session_del(session); } @@ -5450,7 +5357,7 @@ void test_nghttp2_submit_data_twice(void) { void test_nghttp2_submit_request_with_data(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; nghttp2_outbound_item *item; nghttp2_mem *mem; @@ -5458,28 +5365,29 @@ void test_nghttp2_submit_request_with_data(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = 64 * 1024 - 1; - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); - CU_ASSERT(1 == nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), - &data_prd, NULL)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); + assert_int32(1, ==, + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), + &data_prd, NULL)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(ARRLEN(reqnv) == item->frame.headers.nvlen); + assert_size(ARRLEN(reqnv), ==, item->frame.headers.nvlen); assert_nv_equal(reqnv, item->frame.headers.nva, item->frame.headers.nvlen, mem); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(0, ==, ud.data_source_length); nghttp2_session_del(session); - /* nghttp2_submit_request() with server session is error */ + /* nghttp2_submit_request2() with server session is error */ nghttp2_session_server_new(&session, &callbacks, NULL); - CU_ASSERT(NGHTTP2_ERR_PROTO == nghttp2_submit_request(session, NULL, reqnv, - ARRLEN(reqnv), NULL, - NULL)); + assert_int32( + NGHTTP2_ERR_PROTO, ==, + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL)); nghttp2_session_del(session); } @@ -5488,7 +5396,7 @@ void test_nghttp2_submit_request_without_data(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; accumulator acc; - nghttp2_data_provider data_prd = {{-1}, NULL}; + nghttp2_data_provider2 data_prd = {{-1}, NULL}; nghttp2_outbound_item *item; my_user_data ud; nghttp2_frame frame; @@ -5496,7 +5404,6 @@ void test_nghttp2_submit_request_without_data(void) { nva_out out; nghttp2_bufs bufs; nghttp2_mem *mem; - nghttp2_priority_spec pri_spec; mem = nghttp2_mem_default(); frame_pack_bufs_init(&bufs); @@ -5505,25 +5412,26 @@ void test_nghttp2_submit_request_without_data(void) { acc.length = 0; ud.acc = &acc; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = accumulator_send_callback; - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); + callbacks.send_callback2 = accumulator_send_callback; + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT(1 == nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), - &data_prd, NULL)); + assert_int32(1, ==, + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), + &data_prd, NULL)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(ARRLEN(reqnv) == item->frame.headers.nvlen); + assert_size(ARRLEN(reqnv), ==, item->frame.headers.nvlen); assert_nv_equal(reqnv, item->frame.headers.nva, item->frame.headers.nvlen, mem); - CU_ASSERT(item->frame.hd.flags & NGHTTP2_FLAG_END_STREAM); + assert_true(item->frame.hd.flags & NGHTTP2_FLAG_END_STREAM); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == unpack_frame(&frame, acc.buf, acc.length)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, unpack_frame(&frame, acc.buf, acc.length)); nghttp2_bufs_add(&bufs, acc.buf, acc.length); inflate_hd(&inflater, &out, &bufs, NGHTTP2_FRAME_HDLEN, mem); - CU_ASSERT(ARRLEN(reqnv) == out.nvlen); + assert_size(ARRLEN(reqnv), ==, out.nvlen); assert_nv_equal(reqnv, out.nva, out.nvlen, mem); nghttp2_frame_headers_free(&frame.headers, mem); nva_out_reset(&out, mem); @@ -5531,21 +5439,13 @@ void test_nghttp2_submit_request_without_data(void) { nghttp2_bufs_free(&bufs); nghttp2_hd_inflate_free(&inflater); - /* Try to depend on itself is error */ - nghttp2_priority_spec_init(&pri_spec, (int32_t)session->next_stream_id, 16, - 0); - - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_request(session, &pri_spec, reqnv, ARRLEN(reqnv), - NULL, NULL)); - nghttp2_session_del(session); } void test_nghttp2_submit_response_with_data(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; nghttp2_outbound_item *item; nghttp2_mem *mem; @@ -5553,33 +5453,34 @@ void test_nghttp2_submit_response_with_data(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = 64 * 1024 - 1; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, &ud)); open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); - CU_ASSERT(0 == nghttp2_submit_response(session, 1, resnv, ARRLEN(resnv), - &data_prd)); + assert_int( + 0, ==, + nghttp2_submit_response2(session, 1, resnv, ARRLEN(resnv), &data_prd)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(ARRLEN(resnv) == item->frame.headers.nvlen); + assert_size(ARRLEN(resnv), ==, item->frame.headers.nvlen); assert_nv_equal(resnv, item->frame.headers.nva, item->frame.headers.nvlen, mem); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(0, ==, ud.data_source_length); nghttp2_session_del(session); /* Various error cases */ nghttp2_session_client_new(&session, &callbacks, NULL); - /* Calling nghttp2_submit_response() with client session is error */ - CU_ASSERT(NGHTTP2_ERR_PROTO == - nghttp2_submit_response(session, 1, resnv, ARRLEN(resnv), NULL)); + /* Calling nghttp2_submit_response2() with client session is error */ + assert_int(NGHTTP2_ERR_PROTO, ==, + nghttp2_submit_response2(session, 1, resnv, ARRLEN(resnv), NULL)); /* Stream ID <= 0 is error */ - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_response(session, 0, resnv, ARRLEN(resnv), NULL)); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_submit_response2(session, 0, resnv, ARRLEN(resnv), NULL)); nghttp2_session_del(session); } @@ -5588,7 +5489,7 @@ void test_nghttp2_submit_response_without_data(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; accumulator acc; - nghttp2_data_provider data_prd = {{-1}, NULL}; + nghttp2_data_provider2 data_prd = {{-1}, NULL}; nghttp2_outbound_item *item; my_user_data ud; nghttp2_frame frame; @@ -5604,26 +5505,27 @@ void test_nghttp2_submit_response_without_data(void) { acc.length = 0; ud.acc = &acc; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = accumulator_send_callback; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, &ud)); + callbacks.send_callback2 = accumulator_send_callback; + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, &ud)); nghttp2_hd_inflate_init(&inflater, mem); open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); - CU_ASSERT(0 == nghttp2_submit_response(session, 1, resnv, ARRLEN(resnv), - &data_prd)); + assert_int( + 0, ==, + nghttp2_submit_response2(session, 1, resnv, ARRLEN(resnv), &data_prd)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(ARRLEN(resnv) == item->frame.headers.nvlen); + assert_size(ARRLEN(resnv), ==, item->frame.headers.nvlen); assert_nv_equal(resnv, item->frame.headers.nva, item->frame.headers.nvlen, mem); - CU_ASSERT(item->frame.hd.flags & NGHTTP2_FLAG_END_STREAM); + assert_true(item->frame.hd.flags & NGHTTP2_FLAG_END_STREAM); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == unpack_frame(&frame, acc.buf, acc.length)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, unpack_frame(&frame, acc.buf, acc.length)); nghttp2_bufs_add(&bufs, acc.buf, acc.length); inflate_hd(&inflater, &out, &bufs, NGHTTP2_FRAME_HDLEN, mem); - CU_ASSERT(ARRLEN(resnv) == out.nvlen); + assert_size(ARRLEN(resnv), ==, out.nvlen); assert_nv_equal(resnv, out.nva, out.nvlen, mem); nva_out_reset(&out, mem); @@ -5639,7 +5541,7 @@ void test_nghttp2_submit_response_push_response(void) { my_user_data ud; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_not_send_callback = on_frame_not_send_callback; nghttp2_session_server_new(&session, &callbacks, &ud); @@ -5648,13 +5550,13 @@ void test_nghttp2_submit_response_push_response(void) { session->goaway_flags |= NGHTTP2_GOAWAY_RECV; - CU_ASSERT(0 == - nghttp2_submit_response(session, 2, resnv, ARRLEN(resnv), NULL)); + assert_int(0, ==, + nghttp2_submit_response2(session, 2, resnv, ARRLEN(resnv), NULL)); ud.frame_not_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_not_send_cb_called); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, ud.frame_not_send_cb_called); nghttp2_session_del(session); } @@ -5663,7 +5565,7 @@ void test_nghttp2_submit_trailer(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; accumulator acc; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; nghttp2_outbound_item *item; my_user_data ud; nghttp2_frame frame; @@ -5680,32 +5582,34 @@ void test_nghttp2_submit_trailer(void) { acc.length = 0; ud.acc = &acc; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, &ud)); + callbacks.send_callback2 = null_send_callback; + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, &ud)); nghttp2_hd_inflate_init(&inflater, mem); open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); - CU_ASSERT(0 == nghttp2_submit_response(session, 1, resnv, ARRLEN(resnv), - &data_prd)); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int( + 0, ==, + nghttp2_submit_response2(session, 1, resnv, ARRLEN(resnv), &data_prd)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(0 == - nghttp2_submit_trailer(session, 1, trailernv, ARRLEN(trailernv))); + assert_int(0, ==, + nghttp2_submit_trailer(session, 1, trailernv, ARRLEN(trailernv))); - session->callbacks.send_callback = accumulator_send_callback; + session->callbacks.send_callback2 = accumulator_send_callback; item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_HEADERS == item->frame.hd.type); - CU_ASSERT(NGHTTP2_HCAT_HEADERS == item->frame.headers.cat); - CU_ASSERT(item->frame.hd.flags & NGHTTP2_FLAG_END_STREAM); + assert_uint8(NGHTTP2_HEADERS, ==, item->frame.hd.type); + assert_enum(nghttp2_headers_category, NGHTTP2_HCAT_HEADERS, ==, + item->frame.headers.cat); + assert_true(item->frame.hd.flags & NGHTTP2_FLAG_END_STREAM); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == unpack_frame(&frame, acc.buf, acc.length)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, unpack_frame(&frame, acc.buf, acc.length)); nghttp2_bufs_add(&bufs, acc.buf, acc.length); inflate_hd(&inflater, &out, &bufs, NGHTTP2_FRAME_HDLEN, mem); - CU_ASSERT(ARRLEN(trailernv) == out.nvlen); + assert_size(ARRLEN(trailernv), ==, out.nvlen); assert_nv_equal(trailernv, out.nva, out.nvlen, mem); nva_out_reset(&out, mem); @@ -5718,11 +5622,11 @@ void test_nghttp2_submit_trailer(void) { nghttp2_session_server_new(&session, &callbacks, NULL); open_recv_stream(session, 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_trailer(session, 0, trailernv, ARRLEN(trailernv))); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_submit_trailer(session, 0, trailernv, ARRLEN(trailernv))); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_trailer(session, -1, trailernv, ARRLEN(trailernv))); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_submit_trailer(session, -1, trailernv, ARRLEN(trailernv))); nghttp2_session_del(session); } @@ -5736,16 +5640,17 @@ void test_nghttp2_submit_headers_start_stream(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, NULL)); - CU_ASSERT(1 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, - NULL, reqnv, ARRLEN(reqnv), NULL)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, NULL)); + assert_int32(1, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, + NULL, reqnv, ARRLEN(reqnv), NULL)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(ARRLEN(reqnv) == item->frame.headers.nvlen); + assert_size(ARRLEN(reqnv), ==, item->frame.headers.nvlen); assert_nv_equal(reqnv, item->frame.headers.nva, item->frame.headers.nvlen, mem); - CU_ASSERT((NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM) == - item->frame.hd.flags); - CU_ASSERT(0 == (item->frame.hd.flags & NGHTTP2_FLAG_PRIORITY)); + assert_uint8((NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM), ==, + item->frame.hd.flags); + assert_false(item->frame.hd.flags & NGHTTP2_FLAG_PRIORITY); nghttp2_session_del(session); } @@ -5761,34 +5666,36 @@ void test_nghttp2_submit_headers_reply(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, &ud)); - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, - NULL, resnv, ARRLEN(resnv), NULL)); + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, &ud)); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, NULL, + resnv, ARRLEN(resnv), NULL)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(ARRLEN(resnv) == item->frame.headers.nvlen); + assert_size(ARRLEN(resnv), ==, item->frame.headers.nvlen); assert_nv_equal(resnv, item->frame.headers.nva, item->frame.headers.nvlen, mem); - CU_ASSERT((NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS) == - item->frame.hd.flags); + assert_uint8((NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS), ==, + item->frame.hd.flags); ud.frame_send_cb_called = 0; ud.sent_frame_type = 0; /* The transimission will be canceled because the stream 1 is not open. */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == ud.frame_send_cb_called); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, ud.frame_send_cb_called); stream = open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, - NULL, resnv, ARRLEN(resnv), NULL)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == ud.sent_frame_type); - CU_ASSERT(stream->shut_flags & NGHTTP2_SHUT_WR); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, NULL, + resnv, ARRLEN(resnv), NULL)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, ud.frame_send_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, ud.sent_frame_type); + assert_true(stream->shut_flags & NGHTTP2_SHUT_WR); nghttp2_session_del(session); } @@ -5801,35 +5708,37 @@ void test_nghttp2_submit_headers_push_reply(void) { int foo; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, &ud)); stream = open_sent_stream2(session, 2, NGHTTP2_STREAM_RESERVED); - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, 2, NULL, - resnv, ARRLEN(resnv), &foo)); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, 2, NULL, + resnv, ARRLEN(resnv), &foo)); ud.frame_send_cb_called = 0; ud.sent_frame_type = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == ud.sent_frame_type); - CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state); - CU_ASSERT(&foo == stream->stream_user_data); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, ud.frame_send_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, ud.sent_frame_type); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENED, ==, stream->state); + assert_ptr_equal(&foo, stream->stream_user_data); nghttp2_session_del(session); /* Sending HEADERS from client against stream in reserved state is error */ - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); open_recv_stream2(session, 2, NGHTTP2_STREAM_RESERVED); - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, 2, NULL, - reqnv, ARRLEN(reqnv), NULL)); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, 2, NULL, + reqnv, ARRLEN(reqnv), NULL)); ud.frame_send_cb_called = 0; ud.sent_frame_type = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == ud.frame_send_cb_called); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, ud.frame_send_cb_called); nghttp2_session_del(session); } @@ -5846,7 +5755,6 @@ void test_nghttp2_submit_headers(void) { nva_out out; nghttp2_bufs bufs; nghttp2_mem *mem; - nghttp2_priority_spec pri_spec; mem = nghttp2_mem_default(); frame_pack_bufs_init(&bufs); @@ -5855,43 +5763,45 @@ void test_nghttp2_submit_headers(void) { acc.length = 0; ud.acc = &acc; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = accumulator_send_callback; + callbacks.send_callback2 = accumulator_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); nghttp2_hd_inflate_init(&inflater, mem); - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, - NULL, reqnv, ARRLEN(reqnv), NULL)); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, NULL, + reqnv, ARRLEN(reqnv), NULL)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(ARRLEN(reqnv) == item->frame.headers.nvlen); + assert_size(ARRLEN(reqnv), ==, item->frame.headers.nvlen); assert_nv_equal(reqnv, item->frame.headers.nva, item->frame.headers.nvlen, mem); - CU_ASSERT((NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS) == - item->frame.hd.flags); + assert_uint8((NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS), ==, + item->frame.hd.flags); ud.frame_send_cb_called = 0; ud.sent_frame_type = 0; /* The transimission will be canceled because the stream 1 is not open. */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == ud.frame_send_cb_called); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, ud.frame_send_cb_called); stream = open_sent_stream(session, 1); - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, - NULL, reqnv, ARRLEN(reqnv), NULL)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == ud.sent_frame_type); - CU_ASSERT(stream->shut_flags & NGHTTP2_SHUT_WR); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, NULL, + reqnv, ARRLEN(reqnv), NULL)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, ud.frame_send_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, ud.sent_frame_type); + assert_true(stream->shut_flags & NGHTTP2_SHUT_WR); - CU_ASSERT(0 == unpack_frame(&frame, acc.buf, acc.length)); + assert_int(0, ==, unpack_frame(&frame, acc.buf, acc.length)); nghttp2_bufs_add(&bufs, acc.buf, acc.length); inflate_hd(&inflater, &out, &bufs, NGHTTP2_FRAME_HDLEN, mem); - CU_ASSERT(ARRLEN(reqnv) == out.nvlen); + assert_size(ARRLEN(reqnv), ==, out.nvlen); assert_nv_equal(reqnv, out.nva, out.nvlen, mem); nva_out_reset(&out, mem); @@ -5900,20 +5810,6 @@ void test_nghttp2_submit_headers(void) { nghttp2_hd_inflate_free(&inflater); - /* Try to depend on itself */ - nghttp2_priority_spec_init(&pri_spec, 3, 16, 0); - - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, 3, &pri_spec, - reqnv, ARRLEN(reqnv), NULL)); - - session->next_stream_id = 5; - nghttp2_priority_spec_init(&pri_spec, 5, 16, 0); - - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, -1, &pri_spec, - reqnv, ARRLEN(reqnv), NULL)); - nghttp2_session_del(session); /* Error cases with invalid stream ID */ @@ -5921,14 +5817,14 @@ void test_nghttp2_submit_headers(void) { /* Sending nghttp2_submit_headers() with stream_id == 1 and server session is error */ - CU_ASSERT(NGHTTP2_ERR_PROTO == - nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, -1, NULL, reqnv, - ARRLEN(reqnv), NULL)); + assert_int32(NGHTTP2_ERR_PROTO, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, -1, NULL, + reqnv, ARRLEN(reqnv), NULL)); /* Sending stream ID <= 0 is error */ - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, 0, NULL, resnv, - ARRLEN(resnv), NULL)); + assert_int32(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, 0, NULL, + resnv, ARRLEN(resnv), NULL)); nghttp2_session_del(session); } @@ -5937,9 +5833,8 @@ void test_nghttp2_submit_headers_continuation(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; nghttp2_nv nv[] = { - MAKE_NV("h1", ""), MAKE_NV("h1", ""), MAKE_NV("h1", ""), - MAKE_NV("h1", ""), MAKE_NV("h1", ""), MAKE_NV("h1", ""), - MAKE_NV("h1", ""), + MAKE_NV("h1", ""), MAKE_NV("h1", ""), MAKE_NV("h1", ""), MAKE_NV("h1", ""), + MAKE_NV("h1", ""), MAKE_NV("h1", ""), MAKE_NV("h1", ""), }; nghttp2_outbound_item *item; uint8_t data[4096]; @@ -5953,21 +5848,22 @@ void test_nghttp2_submit_headers_continuation(void) { } memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, &ud)); - CU_ASSERT(1 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, - NULL, nv, ARRLEN(nv), NULL)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, &ud)); + assert_int32(1, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, + NULL, nv, ARRLEN(nv), NULL)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_HEADERS == item->frame.hd.type); - CU_ASSERT((NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS) == - item->frame.hd.flags); - CU_ASSERT(0 == (item->frame.hd.flags & NGHTTP2_FLAG_PRIORITY)); + assert_uint8(NGHTTP2_HEADERS, ==, item->frame.hd.type); + assert_uint8((NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS), ==, + item->frame.hd.flags); + assert_false(item->frame.hd.flags & NGHTTP2_FLAG_PRIORITY); ud.frame_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, ud.frame_send_cb_called); nghttp2_session_del(session); } @@ -5976,8 +5872,8 @@ void test_nghttp2_submit_headers_continuation_extra_large(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; nghttp2_nv nv[] = { - MAKE_NV("h1", ""), MAKE_NV("h1", ""), MAKE_NV("h1", ""), - MAKE_NV("h1", ""), MAKE_NV("h1", ""), MAKE_NV("h1", ""), + MAKE_NV("h1", ""), MAKE_NV("h1", ""), MAKE_NV("h1", ""), + MAKE_NV("h1", ""), MAKE_NV("h1", ""), MAKE_NV("h1", ""), }; nghttp2_outbound_item *item; uint8_t data[16384]; @@ -5992,7 +5888,7 @@ void test_nghttp2_submit_headers_continuation_extra_large(void) { } memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; /* The default size of max send header block length is too small to @@ -6000,56 +5896,25 @@ void test_nghttp2_submit_headers_continuation_extra_large(void) { nghttp2_option_new(&opt); nghttp2_option_set_max_send_header_block_length(opt, 102400); - CU_ASSERT(0 == nghttp2_session_client_new2(&session, &callbacks, &ud, opt)); - CU_ASSERT(1 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, - NULL, nv, ARRLEN(nv), NULL)); + assert_int(0, ==, + nghttp2_session_client_new2(&session, &callbacks, &ud, opt)); + assert_int32(1, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, + NULL, nv, ARRLEN(nv), NULL)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_HEADERS == item->frame.hd.type); - CU_ASSERT((NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS) == - item->frame.hd.flags); - CU_ASSERT(0 == (item->frame.hd.flags & NGHTTP2_FLAG_PRIORITY)); + assert_uint8(NGHTTP2_HEADERS, ==, item->frame.hd.type); + assert_uint8((NGHTTP2_FLAG_END_STREAM | NGHTTP2_FLAG_END_HEADERS), ==, + item->frame.hd.flags); + assert_false(item->frame.hd.flags & NGHTTP2_FLAG_PRIORITY); ud.frame_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, ud.frame_send_cb_called); nghttp2_session_del(session); nghttp2_option_del(opt); } -void test_nghttp2_submit_priority(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *stream; - my_user_data ud; - nghttp2_priority_spec pri_spec; - - memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; - callbacks.on_frame_send_callback = on_frame_send_callback; - - nghttp2_session_client_new(&session, &callbacks, &ud); - stream = open_sent_stream(session, 1); - - nghttp2_priority_spec_init(&pri_spec, 0, 3, 0); - - /* depends on stream 0 */ - CU_ASSERT(0 == - nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 1, &pri_spec)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(3 == stream->weight); - - /* submit against idle stream */ - CU_ASSERT(0 == - nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 3, &pri_spec)); - - ud.frame_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); - - nghttp2_session_del(session); -} - void test_nghttp2_submit_settings(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; @@ -6085,70 +5950,73 @@ void test_nghttp2_submit_settings(void) { iv[6].value = (uint32_t)NGHTTP2_MAX_WINDOW_SIZE + 1; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; nghttp2_session_server_new(&session, &callbacks, &ud); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 7)); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 7)); /* Make sure that local settings are not changed */ - CU_ASSERT(NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS == - session->local_settings.max_concurrent_streams); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE == - session->local_settings.initial_window_size); + assert_uint32(NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS, ==, + session->local_settings.max_concurrent_streams); + assert_uint32(NGHTTP2_INITIAL_WINDOW_SIZE, ==, + session->local_settings.initial_window_size); /* Now sends without 6th one */ - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 6)); + assert_int(0, ==, nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 6)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_SETTINGS == item->frame.hd.type); + assert_uint8(NGHTTP2_SETTINGS, ==, item->frame.hd.type); frame = &item->frame; - CU_ASSERT(6 == frame->settings.niv); - CU_ASSERT(5 == frame->settings.iv[0].value); - CU_ASSERT(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS == - frame->settings.iv[0].settings_id); + assert_size(6, ==, frame->settings.niv); + assert_uint32(5, ==, frame->settings.iv[0].value); + assert_int32(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, ==, + frame->settings.iv[0].settings_id); - CU_ASSERT(16 * 1024 == frame->settings.iv[1].value); - CU_ASSERT(NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE == - frame->settings.iv[1].settings_id); + assert_uint32(16 * 1024, ==, frame->settings.iv[1].value); + assert_int32(NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, ==, + frame->settings.iv[1].settings_id); - CU_ASSERT(UNKNOWN_ID == frame->settings.iv[4].settings_id); - CU_ASSERT(999 == frame->settings.iv[4].value); + assert_int32(UNKNOWN_ID, ==, frame->settings.iv[4].settings_id); + assert_uint32(999, ==, frame->settings.iv[4].value); ud.frame_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, ud.frame_send_cb_called); - CU_ASSERT(50 == session->pending_local_max_concurrent_stream); + assert_uint32(50, ==, session->pending_local_max_concurrent_stream); /* before receiving SETTINGS ACK, local settings have still default values */ - CU_ASSERT(NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS == - nghttp2_session_get_local_settings( - session, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE == - nghttp2_session_get_local_settings( - session, NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE)); + assert_uint32(NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS, ==, + nghttp2_session_get_local_settings( + session, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)); + assert_uint32(NGHTTP2_INITIAL_WINDOW_SIZE, ==, + nghttp2_session_get_local_settings( + session, NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE)); nghttp2_frame_settings_init(&ack_frame.settings, NGHTTP2_FLAG_ACK, NULL, 0); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &ack_frame, 0)); + assert_int(0, ==, + nghttp2_session_on_settings_received(session, &ack_frame, 0)); nghttp2_frame_settings_free(&ack_frame.settings, mem); - CU_ASSERT(16 * 1024 == session->local_settings.initial_window_size); - CU_ASSERT(111 == session->hd_inflater.ctx.hd_table_bufsize_max); - CU_ASSERT(111 == session->hd_inflater.min_hd_table_bufsize_max); - CU_ASSERT(50 == session->local_settings.max_concurrent_streams); + assert_uint32(16 * 1024, ==, session->local_settings.initial_window_size); + assert_size(111, ==, session->hd_inflater.ctx.hd_table_bufsize_max); + assert_size(111, ==, session->hd_inflater.min_hd_table_bufsize_max); + assert_uint32(50, ==, session->local_settings.max_concurrent_streams); - CU_ASSERT(50 == nghttp2_session_get_local_settings( - session, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)); - CU_ASSERT(16 * 1024 == nghttp2_session_get_local_settings( - session, NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE)); + assert_uint32(50, ==, + nghttp2_session_get_local_settings( + session, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)); + assert_uint32(16 * 1024, ==, + nghttp2_session_get_local_settings( + session, NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE)); /* We just keep the last seen value */ - CU_ASSERT(50 == session->pending_local_max_concurrent_stream); + assert_uint32(50, ==, session->pending_local_max_concurrent_stream); nghttp2_session_del(session); @@ -6161,8 +6029,8 @@ void test_nghttp2_submit_settings(void) { iv[1].settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; iv[1].value = 0; - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 2)); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 2)); nghttp2_session_del(session); @@ -6173,13 +6041,13 @@ void test_nghttp2_submit_settings(void) { iv[0].settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; iv[0].value = 1; - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); + assert_int(0, ==, nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); iv[0].settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; iv[0].value = 0; - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); nghttp2_session_del(session); } @@ -6201,7 +6069,7 @@ void test_nghttp2_submit_settings_update_local_window_size(void) { iv[0].value = 16 * 1024; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_server_new(&session, &callbacks, NULL); @@ -6211,20 +6079,21 @@ void test_nghttp2_submit_settings_update_local_window_size(void) { open_recv_stream(session, 3); - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &ack_frame, 0)); + assert_int(0, ==, nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, + nghttp2_session_on_settings_received(session, &ack_frame, 0)); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(0 == stream->recv_window_size); - CU_ASSERT(16 * 1024 + 100 == stream->local_window_size); + assert_int32(0, ==, stream->recv_window_size); + assert_int32(16 * 1024 + 100, ==, stream->local_window_size); stream = nghttp2_session_get_stream(session, 3); - CU_ASSERT(16 * 1024 == stream->local_window_size); + assert_int32(16 * 1024, ==, stream->local_window_size); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(32768 == item->frame.window_update.window_size_increment); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(32768, ==, item->frame.window_update.window_size_increment); nghttp2_session_del(session); @@ -6240,17 +6109,18 @@ void test_nghttp2_submit_settings_update_local_window_size(void) { stream->local_window_size = NGHTTP2_INITIAL_WINDOW_SIZE + 100; stream->recv_window_size = 32768; - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &ack_frame, 0)); + assert_int(0, ==, nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, + nghttp2_session_on_settings_received(session, &ack_frame, 0)); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(32768 == stream->recv_window_size); - CU_ASSERT(16 * 1024 + 100 == stream->local_window_size); + assert_int32(32768, ==, stream->recv_window_size); + assert_int32(16 * 1024 + 100, ==, stream->local_window_size); /* Check that we can handle the case where local_window_size < recv_window_size */ - CU_ASSERT(0 == nghttp2_session_get_stream_local_window_size(session, 1)); + assert_int32(0, ==, nghttp2_session_get_stream_local_window_size(session, 1)); nghttp2_session_del(session); @@ -6260,13 +6130,15 @@ void test_nghttp2_submit_settings_update_local_window_size(void) { stream = open_recv_stream(session, 1); stream->local_window_size = NGHTTP2_MAX_WINDOW_SIZE; - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &ack_frame, 0)); + assert_int(0, ==, nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, + nghttp2_session_on_settings_received(session, &ack_frame, 0)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(NGHTTP2_FLOW_CONTROL_ERROR == item->frame.rst_stream.error_code); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_FLOW_CONTROL_ERROR, ==, + item->frame.rst_stream.error_code); nghttp2_session_del(session); nghttp2_frame_settings_free(&ack_frame.settings, mem); @@ -6280,7 +6152,7 @@ void test_nghttp2_submit_settings_multiple_times(void) { nghttp2_inflight_settings *inflight_settings; memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); @@ -6291,60 +6163,60 @@ void test_nghttp2_submit_settings_multiple_times(void) { iv[1].settings_id = NGHTTP2_SETTINGS_ENABLE_PUSH; iv[1].value = 0; - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 2)); + assert_int(0, ==, nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 2)); inflight_settings = session->inflight_settings_head; - CU_ASSERT(NULL != inflight_settings); - CU_ASSERT(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS == - inflight_settings->iv[0].settings_id); - CU_ASSERT(100 == inflight_settings->iv[0].value); - CU_ASSERT(2 == inflight_settings->niv); - CU_ASSERT(NULL == inflight_settings->next); + assert_not_null(inflight_settings); + assert_int32(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, ==, + inflight_settings->iv[0].settings_id); + assert_uint32(100, ==, inflight_settings->iv[0].value); + assert_size(2, ==, inflight_settings->niv); + assert_null(inflight_settings->next); - CU_ASSERT(100 == session->pending_local_max_concurrent_stream); - CU_ASSERT(0 == session->pending_enable_push); + assert_uint32(100, ==, session->pending_local_max_concurrent_stream); + assert_uint8(0, ==, session->pending_enable_push); /* second SETTINGS */ iv[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; iv[0].value = 99; - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); + assert_int(0, ==, nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, iv, 1)); inflight_settings = session->inflight_settings_head->next; - CU_ASSERT(NULL != inflight_settings); - CU_ASSERT(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS == - inflight_settings->iv[0].settings_id); - CU_ASSERT(99 == inflight_settings->iv[0].value); - CU_ASSERT(1 == inflight_settings->niv); - CU_ASSERT(NULL == inflight_settings->next); + assert_not_null(inflight_settings); + assert_int32(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, ==, + inflight_settings->iv[0].settings_id); + assert_uint32(99, ==, inflight_settings->iv[0].value); + assert_size(1, ==, inflight_settings->niv); + assert_null(inflight_settings->next); - CU_ASSERT(99 == session->pending_local_max_concurrent_stream); - CU_ASSERT(0 == session->pending_enable_push); + assert_uint32(99, ==, session->pending_local_max_concurrent_stream); + assert_uint8(0, ==, session->pending_enable_push); nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_ACK, NULL, 0); /* receive SETTINGS ACK */ - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); inflight_settings = session->inflight_settings_head; /* first inflight SETTINGS was removed */ - CU_ASSERT(NULL != inflight_settings); - CU_ASSERT(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS == - inflight_settings->iv[0].settings_id); - CU_ASSERT(99 == inflight_settings->iv[0].value); - CU_ASSERT(1 == inflight_settings->niv); - CU_ASSERT(NULL == inflight_settings->next); + assert_not_null(inflight_settings); + assert_int32(NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, ==, + inflight_settings->iv[0].settings_id); + assert_uint32(99, ==, inflight_settings->iv[0].value); + assert_size(1, ==, inflight_settings->niv); + assert_null(inflight_settings->next); - CU_ASSERT(100 == session->local_settings.max_concurrent_streams); + assert_uint32(100, ==, session->local_settings.max_concurrent_streams); /* receive SETTINGS ACK again */ - CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &frame, 0)); + assert_int(0, ==, nghttp2_session_on_settings_received(session, &frame, 0)); - CU_ASSERT(NULL == session->inflight_settings_head); - CU_ASSERT(99 == session->local_settings.max_concurrent_streams); + assert_null(session->inflight_settings_head); + assert_uint32(99, ==, session->local_settings.max_concurrent_streams); nghttp2_session_del(session); } @@ -6356,42 +6228,43 @@ void test_nghttp2_submit_push_promise(void) { nghttp2_stream *stream; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; callbacks.on_frame_not_send_callback = on_frame_not_send_callback; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, &ud)); open_recv_stream(session, 1); - CU_ASSERT(2 == nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 1, - reqnv, ARRLEN(reqnv), &ud)); + assert_int32(2, ==, + nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 1, reqnv, + ARRLEN(reqnv), &ud)); stream = nghttp2_session_get_stream(session, 2); - CU_ASSERT(NULL != stream); - CU_ASSERT(NGHTTP2_STREAM_RESERVED == stream->state); - CU_ASSERT(&ud == nghttp2_session_get_stream_user_data(session, 2)); + assert_not_null(stream); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_RESERVED, ==, stream->state); + assert_ptr_equal(&ud, nghttp2_session_get_stream_user_data(session, 2)); ud.frame_send_cb_called = 0; ud.sent_frame_type = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(NGHTTP2_PUSH_PROMISE == ud.sent_frame_type); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, ud.frame_send_cb_called); + assert_uint8(NGHTTP2_PUSH_PROMISE, ==, ud.sent_frame_type); stream = nghttp2_session_get_stream(session, 2); - CU_ASSERT(NGHTTP2_STREAM_RESERVED == stream->state); - CU_ASSERT(&ud == nghttp2_session_get_stream_user_data(session, 2)); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_RESERVED, ==, stream->state); + assert_ptr_equal(&ud, nghttp2_session_get_stream_user_data(session, 2)); /* submit PUSH_PROMISE while associated stream is not opened */ - CU_ASSERT(NGHTTP2_ERR_STREAM_CLOSED == - nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 3, reqnv, - ARRLEN(reqnv), NULL)); + assert_int32(NGHTTP2_ERR_STREAM_CLOSED, ==, + nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 3, reqnv, + ARRLEN(reqnv), NULL)); /* Stream ID <= 0 is error */ - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 0, reqnv, - ARRLEN(reqnv), NULL)); + assert_int32(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 0, reqnv, + ARRLEN(reqnv), NULL)); nghttp2_session_del(session); } @@ -6404,42 +6277,42 @@ void test_nghttp2_submit_window_update(void) { nghttp2_stream *stream; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, &ud); stream = open_recv_stream(session, 2); stream->recv_window_size = 4096; - CU_ASSERT(0 == - nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 1024)); + assert_int(0, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 1024)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(1024 == item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(3072 == stream->recv_window_size); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(1024, ==, item->frame.window_update.window_size_increment); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int32(3072, ==, stream->recv_window_size); - CU_ASSERT(0 == - nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 4096)); + assert_int(0, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 4096)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(4096 == item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == stream->recv_window_size); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(4096, ==, item->frame.window_update.window_size_increment); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int32(0, ==, stream->recv_window_size); - CU_ASSERT(0 == - nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 4096)); + assert_int(0, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 4096)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(4096 == item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == stream->recv_window_size); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(4096, ==, item->frame.window_update.window_size_increment); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int32(0, ==, stream->recv_window_size); - CU_ASSERT(0 == - nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 0)); + assert_int(0, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 0)); /* It is ok if stream is closed or does not exist at the call time */ - CU_ASSERT(0 == - nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 4, 4096)); + assert_int(0, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 4, 4096)); nghttp2_session_del(session); } @@ -6451,81 +6324,85 @@ void test_nghttp2_submit_window_update_local_window_size(void) { nghttp2_stream *stream; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); stream = open_recv_stream(session, 2); stream->recv_window_size = 4096; - CU_ASSERT(0 == nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, - stream->recv_window_size + 1)); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 1 == stream->local_window_size); - CU_ASSERT(0 == stream->recv_window_size); + assert_int(0, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, + stream->recv_window_size + 1)); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE + 1, ==, stream->local_window_size); + assert_int32(0, ==, stream->recv_window_size); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(4097 == item->frame.window_update.window_size_increment); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(4097, ==, item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); /* Let's decrement local window size */ stream->recv_window_size = 4096; - CU_ASSERT(0 == nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, - -stream->local_window_size / 2)); - CU_ASSERT(32768 == stream->local_window_size); - CU_ASSERT(-28672 == stream->recv_window_size); - CU_ASSERT(32768 == stream->recv_reduction); + assert_int(0, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, + -stream->local_window_size / 2)); + assert_int32(32768, ==, stream->local_window_size); + assert_int32(-28672, ==, stream->recv_window_size); + assert_int32(32768, ==, stream->recv_reduction); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(item == NULL); + assert_null(item); /* Increase local window size */ - CU_ASSERT(0 == - nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 16384)); - CU_ASSERT(49152 == stream->local_window_size); - CU_ASSERT(-12288 == stream->recv_window_size); - CU_ASSERT(16384 == stream->recv_reduction); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_int( + 0, ==, nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, 16384)); + assert_int32(49152, ==, stream->local_window_size); + assert_int32(-12288, ==, stream->recv_window_size); + assert_int32(16384, ==, stream->recv_reduction); + assert_null(nghttp2_session_get_next_ob_item(session)); - CU_ASSERT(NGHTTP2_ERR_FLOW_CONTROL == - nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, - NGHTTP2_MAX_WINDOW_SIZE)); + assert_int(NGHTTP2_ERR_FLOW_CONTROL, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 2, + NGHTTP2_MAX_WINDOW_SIZE)); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); /* Check connection-level flow control */ session->recv_window_size = 4096; - CU_ASSERT(0 == nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, - session->recv_window_size + 1)); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1 == - session->local_window_size); - CU_ASSERT(0 == session->recv_window_size); + assert_int(0, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, + session->recv_window_size + 1)); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1, ==, + session->local_window_size); + assert_int32(0, ==, session->recv_window_size); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(4097 == item->frame.window_update.window_size_increment); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(4097, ==, item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); /* Go decrement part */ session->recv_window_size = 4096; - CU_ASSERT(0 == nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, - -session->local_window_size / 2)); - CU_ASSERT(32768 == session->local_window_size); - CU_ASSERT(-28672 == session->recv_window_size); - CU_ASSERT(32768 == session->recv_reduction); + assert_int(0, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, + -session->local_window_size / 2)); + assert_int32(32768, ==, session->local_window_size); + assert_int32(-28672, ==, session->recv_window_size); + assert_int32(32768, ==, session->recv_reduction); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(item == NULL); + assert_null(item); /* Increase local window size */ - CU_ASSERT(0 == - nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, 16384)); - CU_ASSERT(49152 == session->local_window_size); - CU_ASSERT(-12288 == session->recv_window_size); - CU_ASSERT(16384 == session->recv_reduction); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_int( + 0, ==, nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, 16384)); + assert_int32(49152, ==, session->local_window_size); + assert_int32(-12288, ==, session->recv_window_size); + assert_int32(16384, ==, session->recv_reduction); + assert_null(nghttp2_session_get_next_ob_item(session)); - CU_ASSERT(NGHTTP2_ERR_FLOW_CONTROL == - nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, - NGHTTP2_MAX_WINDOW_SIZE)); + assert_int(NGHTTP2_ERR_FLOW_CONTROL, ==, + nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, + NGHTTP2_MAX_WINDOW_SIZE)); nghttp2_session_del(session); } @@ -6536,43 +6413,44 @@ void test_nghttp2_submit_shutdown_notice(void) { my_user_data ud; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; callbacks.on_frame_not_send_callback = on_frame_not_send_callback; nghttp2_session_server_new(&session, &callbacks, &ud); - CU_ASSERT(0 == nghttp2_submit_shutdown_notice(session)); + assert_int(0, ==, nghttp2_submit_shutdown_notice(session)); ud.frame_send_cb_called = 0; nghttp2_session_send(session); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(NGHTTP2_GOAWAY == ud.sent_frame_type); - CU_ASSERT((1u << 31) - 1 == session->local_last_stream_id); + assert_int(1, ==, ud.frame_send_cb_called); + assert_uint8(NGHTTP2_GOAWAY, ==, ud.sent_frame_type); + assert_int32((1u << 31) - 1, ==, session->local_last_stream_id); /* After another GOAWAY, nghttp2_submit_shutdown_notice() is noop. */ - CU_ASSERT(0 == nghttp2_session_terminate_session(session, NGHTTP2_NO_ERROR)); + assert_int(0, ==, + nghttp2_session_terminate_session(session, NGHTTP2_NO_ERROR)); ud.frame_send_cb_called = 0; nghttp2_session_send(session); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(NGHTTP2_GOAWAY == ud.sent_frame_type); - CU_ASSERT(0 == session->local_last_stream_id); + assert_int(1, ==, ud.frame_send_cb_called); + assert_uint8(NGHTTP2_GOAWAY, ==, ud.sent_frame_type); + assert_int32(0, ==, session->local_last_stream_id); - CU_ASSERT(0 == nghttp2_submit_shutdown_notice(session)); + assert_int(0, ==, nghttp2_submit_shutdown_notice(session)); ud.frame_send_cb_called = 0; ud.frame_not_send_cb_called = 0; nghttp2_session_send(session); - CU_ASSERT(0 == ud.frame_send_cb_called); - CU_ASSERT(0 == ud.frame_not_send_cb_called); + assert_int(0, ==, ud.frame_send_cb_called); + assert_int(0, ==, ud.frame_not_send_cb_called); nghttp2_session_del(session); @@ -6580,8 +6458,8 @@ void test_nghttp2_submit_shutdown_notice(void) { is error */ nghttp2_session_client_new(&session, &callbacks, NULL); - CU_ASSERT(NGHTTP2_ERR_INVALID_STATE == - nghttp2_submit_shutdown_notice(session)); + assert_int(NGHTTP2_ERR_INVALID_STATE, ==, + nghttp2_submit_shutdown_notice(session)); nghttp2_session_del(session); } @@ -6597,31 +6475,35 @@ void test_nghttp2_submit_invalid_nv(void) { memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, NULL)); + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, NULL)); /* nghttp2_submit_response */ - CU_ASSERT(0 == nghttp2_submit_response(session, 2, empty_name_nv, - ARRLEN(empty_name_nv), NULL)); + assert_int(0, ==, + nghttp2_submit_response2(session, 2, empty_name_nv, + ARRLEN(empty_name_nv), NULL)); /* nghttp2_submit_push_promise */ open_recv_stream(session, 1); - CU_ASSERT(0 < nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 1, - empty_name_nv, - ARRLEN(empty_name_nv), NULL)); + assert_int32(0, <, + nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 1, + empty_name_nv, ARRLEN(empty_name_nv), + NULL)); nghttp2_session_del(session); - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, NULL)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, NULL)); /* nghttp2_submit_request */ - CU_ASSERT(0 < nghttp2_submit_request(session, NULL, empty_name_nv, + assert_int32(0, <, + nghttp2_submit_request2(session, NULL, empty_name_nv, ARRLEN(empty_name_nv), NULL, NULL)); /* nghttp2_submit_headers */ - CU_ASSERT(0 < nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, -1, NULL, - empty_name_nv, ARRLEN(empty_name_nv), - NULL)); + assert_int32(0, <, + nghttp2_submit_headers(session, NGHTTP2_FLAG_NONE, -1, NULL, + empty_name_nv, ARRLEN(empty_name_nv), + NULL)); nghttp2_session_del(session); } @@ -6641,8 +6523,8 @@ void test_nghttp2_submit_extension(void) { memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.pack_extension_callback = pack_extension_callback; - callbacks.send_callback = accumulator_send_callback; + callbacks.pack_extension_callback2 = pack_extension_callback; + callbacks.send_callback2 = accumulator_send_callback; nghttp2_buf_init2(&ud.scratchbuf, 4096, mem); @@ -6653,25 +6535,25 @@ void test_nghttp2_submit_extension(void) { rv = nghttp2_submit_extension(session, 211, 0x01, 3, &ud.scratchbuf); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); acc.length = 0; rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); - CU_ASSERT(NGHTTP2_FRAME_HDLEN + sizeof(data) == acc.length); + assert_int(0, ==, rv); + assert_size(NGHTTP2_FRAME_HDLEN + sizeof(data), ==, acc.length); len = nghttp2_get_uint32(acc.buf) >> 8; - CU_ASSERT(sizeof(data) == len); - CU_ASSERT(211 == acc.buf[3]); - CU_ASSERT(0x01 == acc.buf[4]); + assert_size(sizeof(data), ==, len); + assert_uint8(211, ==, acc.buf[3]); + assert_uint8(0x01, ==, acc.buf[4]); stream_id = (int32_t)nghttp2_get_uint32(acc.buf + 5); - CU_ASSERT(3 == stream_id); - CU_ASSERT(0 == memcmp(data, &acc.buf[NGHTTP2_FRAME_HDLEN], sizeof(data))); + assert_int32(3, ==, stream_id); + assert_memory_equal(sizeof(data), data, &acc.buf[NGHTTP2_FRAME_HDLEN]); nghttp2_session_del(session); @@ -6681,7 +6563,7 @@ void test_nghttp2_submit_extension(void) { rv = nghttp2_submit_extension(session, NGHTTP2_GOAWAY, NGHTTP2_FLAG_NONE, 0, NULL); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); nghttp2_session_del(session); nghttp2_buf_free(&ud.scratchbuf, mem); @@ -6692,7 +6574,7 @@ void test_nghttp2_submit_altsvc(void) { nghttp2_session_callbacks callbacks; my_user_data ud; int rv; - ssize_t len; + nghttp2_ssize len; const uint8_t *data; nghttp2_frame_hd hd; size_t origin_len; @@ -6707,42 +6589,42 @@ void test_nghttp2_submit_altsvc(void) { sizeof(origin) - 1, field_value, sizeof(field_value) - 1); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); ud.frame_send_cb_called = 0; - len = nghttp2_session_mem_send(session, &data); + len = nghttp2_session_mem_send2(session, &data); - CU_ASSERT(len == NGHTTP2_FRAME_HDLEN + 2 + sizeof(origin) - 1 + - sizeof(field_value) - 1); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN + 2 + sizeof(origin) - 1 + + sizeof(field_value) - 1, + ==, len); nghttp2_frame_unpack_frame_hd(&hd, data); - CU_ASSERT(2 + sizeof(origin) - 1 + sizeof(field_value) - 1 == hd.length); - CU_ASSERT(NGHTTP2_ALTSVC == hd.type); - CU_ASSERT(NGHTTP2_FLAG_NONE == hd.flags); + assert_size(2 + sizeof(origin) - 1 + sizeof(field_value) - 1, ==, hd.length); + assert_uint8(NGHTTP2_ALTSVC, ==, hd.type); + assert_uint8(NGHTTP2_FLAG_NONE, ==, hd.flags); origin_len = nghttp2_get_uint16(data + NGHTTP2_FRAME_HDLEN); - CU_ASSERT(sizeof(origin) - 1 == origin_len); - CU_ASSERT(0 == - memcmp(origin, data + NGHTTP2_FRAME_HDLEN + 2, sizeof(origin) - 1)); - CU_ASSERT(0 == memcmp(field_value, - data + NGHTTP2_FRAME_HDLEN + 2 + sizeof(origin) - 1, - hd.length - (sizeof(origin) - 1) - 2)); + assert_size(sizeof(origin) - 1, ==, origin_len); + assert_memory_equal(sizeof(origin) - 1, origin, + data + NGHTTP2_FRAME_HDLEN + 2); + assert_memory_equal(hd.length - (sizeof(origin) - 1) - 2, field_value, + data + NGHTTP2_FRAME_HDLEN + 2 + sizeof(origin) - 1); /* submitting empty origin with stream_id == 0 is error */ rv = nghttp2_submit_altsvc(session, NGHTTP2_FLAG_NONE, 0, NULL, 0, field_value, sizeof(field_value) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); /* submitting non-empty origin with stream_id != 0 is error */ rv = nghttp2_submit_altsvc(session, NGHTTP2_FLAG_NONE, 1, origin, sizeof(origin) - 1, field_value, sizeof(field_value) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, rv); nghttp2_session_del(session); @@ -6753,7 +6635,7 @@ void test_nghttp2_submit_altsvc(void) { sizeof(origin) - 1, field_value, sizeof(field_value) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_STATE == rv); + assert_int(NGHTTP2_ERR_INVALID_STATE, ==, rv); nghttp2_session_del(session); } @@ -6763,19 +6645,19 @@ void test_nghttp2_submit_origin(void) { nghttp2_session_callbacks callbacks; my_user_data ud; int rv; - ssize_t len; + nghttp2_ssize len; const uint8_t *data; static const uint8_t nghttp2[] = "https://nghttp2.org"; static const uint8_t examples[] = "https://examples.com"; static const nghttp2_origin_entry ov[] = { - { - (uint8_t *)nghttp2, - sizeof(nghttp2) - 1, - }, - { - (uint8_t *)examples, - sizeof(examples) - 1, - }, + { + (uint8_t *)nghttp2, + sizeof(nghttp2) - 1, + }, + { + (uint8_t *)examples, + sizeof(examples) - 1, + }, }; nghttp2_frame frame; nghttp2_ext_origin origin; @@ -6792,27 +6674,27 @@ void test_nghttp2_submit_origin(void) { rv = nghttp2_submit_origin(session, NGHTTP2_FLAG_NONE, ov, 2); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); ud.frame_send_cb_called = 0; - len = nghttp2_session_mem_send(session, &data); + len = nghttp2_session_mem_send2(session, &data); - CU_ASSERT(len > 0); - CU_ASSERT(1 == ud.frame_send_cb_called); + assert_ptrdiff(0, <, len); + assert_int(1, ==, ud.frame_send_cb_called); nghttp2_frame_unpack_frame_hd(&frame.hd, data); - rv = nghttp2_frame_unpack_origin_payload( - &frame.ext, data + NGHTTP2_FRAME_HDLEN, (size_t)len - NGHTTP2_FRAME_HDLEN, - mem); - - CU_ASSERT(0 == rv); - CU_ASSERT(0 == frame.hd.stream_id); - CU_ASSERT(NGHTTP2_ORIGIN == frame.hd.type); - CU_ASSERT(2 == origin.nov); - CU_ASSERT(0 == memcmp(nghttp2, origin.ov[0].origin, sizeof(nghttp2) - 1)); - CU_ASSERT(sizeof(nghttp2) - 1 == origin.ov[0].origin_len); - CU_ASSERT(0 == memcmp(examples, origin.ov[1].origin, sizeof(examples) - 1)); - CU_ASSERT(sizeof(examples) - 1 == origin.ov[1].origin_len); + rv = + nghttp2_frame_unpack_origin_payload(&frame.ext, data + NGHTTP2_FRAME_HDLEN, + (size_t)len - NGHTTP2_FRAME_HDLEN, mem); + + assert_int(0, ==, rv); + assert_int32(0, ==, frame.hd.stream_id); + assert_uint8(NGHTTP2_ORIGIN, ==, frame.hd.type); + assert_size(2, ==, origin.nov); + assert_memory_equal(sizeof(nghttp2) - 1, nghttp2, origin.ov[0].origin); + assert_size(sizeof(nghttp2) - 1, ==, origin.ov[0].origin_len); + assert_memory_equal(sizeof(examples) - 1, examples, origin.ov[1].origin); + assert_size(sizeof(examples) - 1, ==, origin.ov[1].origin_len); nghttp2_frame_origin_free(&frame.ext, mem); @@ -6823,7 +6705,7 @@ void test_nghttp2_submit_origin(void) { rv = nghttp2_submit_origin(session, NGHTTP2_FLAG_NONE, ov, 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_STATE == rv); + assert_int(NGHTTP2_ERR_INVALID_STATE, ==, rv); nghttp2_session_del(session); @@ -6832,17 +6714,17 @@ void test_nghttp2_submit_origin(void) { rv = nghttp2_submit_origin(session, NGHTTP2_FLAG_NONE, NULL, 0); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); ud.frame_send_cb_called = 0; - len = nghttp2_session_mem_send(session, &data); + len = nghttp2_session_mem_send2(session, &data); - CU_ASSERT(len == NGHTTP2_FRAME_HDLEN); - CU_ASSERT(1 == ud.frame_send_cb_called); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN, ==, len); + assert_int(1, ==, ud.frame_send_cb_called); nghttp2_frame_unpack_frame_hd(&frame.hd, data); - CU_ASSERT(NGHTTP2_ORIGIN == frame.hd.type); + assert_uint8(NGHTTP2_ORIGIN, ==, frame.hd.type); nghttp2_session_del(session); } @@ -6856,7 +6738,7 @@ void test_nghttp2_submit_priority_update(void) { int rv; nghttp2_frame frame; nghttp2_ext_priority_update priority_update; - ssize_t len; + nghttp2_ssize len; int32_t stream_id; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); @@ -6867,38 +6749,38 @@ void test_nghttp2_submit_priority_update(void) { session->pending_no_rfc7540_priorities = 1; stream_id = - nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); - CU_ASSERT(1 == stream_id); + assert_int32(1, ==, stream_id); - len = nghttp2_session_mem_send(session, &data); + len = nghttp2_session_mem_send2(session, &data); - CU_ASSERT(len > 0); + assert_ptrdiff(0, <, len); rv = nghttp2_submit_priority_update(session, NGHTTP2_FLAG_NONE, stream_id, field_value, sizeof(field_value) - 1); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); frame.ext.payload = &priority_update; ud.frame_send_cb_called = 0; - len = nghttp2_session_mem_send(session, &data); + len = nghttp2_session_mem_send2(session, &data); - CU_ASSERT(len > 0); - CU_ASSERT(1 == ud.frame_send_cb_called); + assert_ptrdiff(0, <, len); + assert_int(1, ==, ud.frame_send_cb_called); nghttp2_frame_unpack_frame_hd(&frame.hd, data); nghttp2_frame_unpack_priority_update_payload( - &frame.ext, (uint8_t *)(data + NGHTTP2_FRAME_HDLEN), - (size_t)len - NGHTTP2_FRAME_HDLEN); + &frame.ext, (uint8_t *)(data + NGHTTP2_FRAME_HDLEN), + (size_t)len - NGHTTP2_FRAME_HDLEN); - CU_ASSERT(0 == frame.hd.stream_id); - CU_ASSERT(NGHTTP2_PRIORITY_UPDATE == frame.hd.type); - CU_ASSERT(stream_id == priority_update.stream_id); - CU_ASSERT(sizeof(field_value) - 1 == priority_update.field_value_len); - CU_ASSERT(0 == memcmp(field_value, priority_update.field_value, - sizeof(field_value) - 1)); + assert_int32(0, ==, frame.hd.stream_id); + assert_uint8(NGHTTP2_PRIORITY_UPDATE, ==, frame.hd.type); + assert_int32(stream_id, ==, priority_update.stream_id); + assert_size(sizeof(field_value) - 1, ==, priority_update.field_value_len); + assert_memory_equal(sizeof(field_value) - 1, field_value, + priority_update.field_value); nghttp2_session_del(session); @@ -6910,7 +6792,7 @@ void test_nghttp2_submit_priority_update(void) { rv = nghttp2_submit_priority_update(session, NGHTTP2_FLAG_NONE, 1, field_value, sizeof(field_value) - 1); - CU_ASSERT(NGHTTP2_ERR_INVALID_STATE == rv); + assert_int(NGHTTP2_ERR_INVALID_STATE, ==, rv); nghttp2_session_del(session); @@ -6918,35 +6800,35 @@ void test_nghttp2_submit_priority_update(void) { nghttp2_session_client_new(&session, &callbacks, &ud); stream_id = - nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); - CU_ASSERT(1 == stream_id); + assert_int32(1, ==, stream_id); - len = nghttp2_session_mem_send(session, &data); + len = nghttp2_session_mem_send2(session, &data); - CU_ASSERT(len > 0); + assert_ptrdiff(0, <, len); rv = nghttp2_submit_priority_update(session, NGHTTP2_FLAG_NONE, stream_id, NULL, 0); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); frame.ext.payload = &priority_update; - len = nghttp2_session_mem_send(session, &data); + len = nghttp2_session_mem_send2(session, &data); - CU_ASSERT(len > 0); + assert_ptrdiff(0, <, len); nghttp2_frame_unpack_frame_hd(&frame.hd, data); nghttp2_frame_unpack_priority_update_payload( - &frame.ext, (uint8_t *)(data + NGHTTP2_FRAME_HDLEN), - (size_t)len - NGHTTP2_FRAME_HDLEN); + &frame.ext, (uint8_t *)(data + NGHTTP2_FRAME_HDLEN), + (size_t)len - NGHTTP2_FRAME_HDLEN); - CU_ASSERT(0 == frame.hd.stream_id); - CU_ASSERT(NGHTTP2_PRIORITY_UPDATE == frame.hd.type); - CU_ASSERT(stream_id == priority_update.stream_id); - CU_ASSERT(0 == priority_update.field_value_len); - CU_ASSERT(NULL == priority_update.field_value); + assert_int32(0, ==, frame.hd.stream_id); + assert_uint8(NGHTTP2_PRIORITY_UPDATE, ==, frame.hd.type); + assert_int32(stream_id, ==, priority_update.stream_id); + assert_size(0, ==, priority_update.field_value_len); + assert_null(priority_update.field_value); nghttp2_session_del(session); } @@ -6963,28 +6845,28 @@ void test_nghttp2_submit_rst_stream(void) { /* Sending RST_STREAM to idle stream (local) is ignored */ nghttp2_session_client_new(&session, &callbacks, NULL); - rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, - NGHTTP2_NO_ERROR); + rv = + nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, NGHTTP2_NO_ERROR); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); item = nghttp2_outbound_queue_top(&session->ob_reg); - CU_ASSERT(NULL == item); + assert_null(item); nghttp2_session_del(session); /* Sending RST_STREAM to idle stream (remote) is ignored */ nghttp2_session_client_new(&session, &callbacks, NULL); - rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 2, - NGHTTP2_NO_ERROR); + rv = + nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 2, NGHTTP2_NO_ERROR); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); item = nghttp2_outbound_queue_top(&session->ob_reg); - CU_ASSERT(NULL == item); + assert_null(item); nghttp2_session_del(session); @@ -6993,16 +6875,16 @@ void test_nghttp2_submit_rst_stream(void) { open_sent_stream(session, 1); - rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, - NGHTTP2_NO_ERROR); + rv = + nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, NGHTTP2_NO_ERROR); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); item = nghttp2_outbound_queue_top(&session->ob_reg); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(1 == item->frame.hd.stream_id); + assert_not_null(item); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int32(1, ==, item->frame.hd.stream_id); nghttp2_session_del(session); @@ -7011,16 +6893,16 @@ void test_nghttp2_submit_rst_stream(void) { open_recv_stream(session, 2); - rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 2, - NGHTTP2_NO_ERROR); + rv = + nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 2, NGHTTP2_NO_ERROR); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); item = nghttp2_outbound_queue_top(&session->ob_reg); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(2 == item->frame.hd.stream_id); + assert_not_null(item); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int32(2, ==, item->frame.hd.stream_id); nghttp2_session_del(session); @@ -7028,26 +6910,26 @@ void test_nghttp2_submit_rst_stream(void) { nghttp2_session_client_new(&session, &callbacks, NULL); stream_id = - nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); - CU_ASSERT(stream_id > 0); + assert_int32(0, <, stream_id); item = nghttp2_outbound_queue_top(&session->ob_syn); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_HEADERS == item->frame.hd.type); - CU_ASSERT(0 == item->aux_data.headers.canceled); + assert_not_null(item); + assert_uint8(NGHTTP2_HEADERS, ==, item->frame.hd.type); + assert_false(item->aux_data.headers.canceled); rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, stream_id, NGHTTP2_NO_ERROR); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); item = nghttp2_outbound_queue_top(&session->ob_syn); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_HEADERS == item->frame.hd.type); - CU_ASSERT(1 == item->aux_data.headers.canceled); + assert_not_null(item); + assert_uint8(NGHTTP2_HEADERS, ==, item->frame.hd.type); + assert_true(item->aux_data.headers.canceled); nghttp2_session_del(session); } @@ -7056,122 +6938,50 @@ void test_nghttp2_session_open_stream(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; nghttp2_stream *stream; - nghttp2_priority_spec pri_spec; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); nghttp2_session_server_new(&session, &callbacks, NULL); - nghttp2_priority_spec_init(&pri_spec, 0, 245, 0); - stream = nghttp2_session_open_stream(session, 1, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec, NGHTTP2_STREAM_OPENED, NULL); - CU_ASSERT(1 == session->num_incoming_streams); - CU_ASSERT(0 == session->num_outgoing_streams); - CU_ASSERT(NGHTTP2_STREAM_OPENED == stream->state); - CU_ASSERT(245 == stream->weight); - CU_ASSERT(&session->root == stream->dep_prev); - CU_ASSERT(NGHTTP2_SHUT_NONE == stream->shut_flags); + NGHTTP2_STREAM_OPENED, NULL); + assert_size(1, ==, session->num_incoming_streams); + assert_size(0, ==, session->num_outgoing_streams); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENED, ==, stream->state); + assert_uint8(NGHTTP2_SHUT_NONE, ==, stream->shut_flags); stream = nghttp2_session_open_stream(session, 2, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec_default, NGHTTP2_STREAM_OPENING, NULL); - CU_ASSERT(1 == session->num_incoming_streams); - CU_ASSERT(1 == session->num_outgoing_streams); - CU_ASSERT(&session->root == stream->dep_prev); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight); - CU_ASSERT(NGHTTP2_SHUT_NONE == stream->shut_flags); + assert_size(1, ==, session->num_incoming_streams); + assert_size(1, ==, session->num_outgoing_streams); + assert_uint8(NGHTTP2_SHUT_NONE, ==, stream->shut_flags); stream = nghttp2_session_open_stream(session, 4, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec_default, NGHTTP2_STREAM_RESERVED, NULL); - CU_ASSERT(1 == session->num_incoming_streams); - CU_ASSERT(1 == session->num_outgoing_streams); - CU_ASSERT(&session->root == stream->dep_prev); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight); - CU_ASSERT(NGHTTP2_SHUT_RD == stream->shut_flags); - - nghttp2_priority_spec_init(&pri_spec, 1, 17, 1); + assert_size(1, ==, session->num_incoming_streams); + assert_size(1, ==, session->num_outgoing_streams); + assert_uint8(NGHTTP2_SHUT_RD, ==, stream->shut_flags); stream = nghttp2_session_open_stream(session, 3, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec, NGHTTP2_STREAM_OPENED, NULL); - CU_ASSERT(17 == stream->weight); - CU_ASSERT(1 == stream->dep_prev->stream_id); + NGHTTP2_STREAM_OPENED, NULL); /* Dependency to idle stream */ - nghttp2_priority_spec_init(&pri_spec, 1000000007, 240, 1); - stream = nghttp2_session_open_stream(session, 5, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec, NGHTTP2_STREAM_OPENED, NULL); - CU_ASSERT(240 == stream->weight); - CU_ASSERT(1000000007 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream_raw(session, 1000000007); - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight); - CU_ASSERT(&session->root == stream->dep_prev); + NGHTTP2_STREAM_OPENED, NULL); /* Dependency to closed stream which is not in dependency tree */ session->last_recv_stream_id = 7; - nghttp2_priority_spec_init(&pri_spec, 7, 10, 0); - - stream = nghttp2_session_open_stream(session, 9, NGHTTP2_FLAG_NONE, &pri_spec, + stream = nghttp2_session_open_stream(session, 9, NGHTTP2_FLAG_NONE, NGHTTP2_STREAM_OPENED, NULL); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight); - CU_ASSERT(&session->root == stream->dep_prev); - nghttp2_session_del(session); nghttp2_session_client_new(&session, &callbacks, NULL); stream = nghttp2_session_open_stream(session, 4, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec_default, NGHTTP2_STREAM_RESERVED, NULL); - CU_ASSERT(0 == session->num_incoming_streams); - CU_ASSERT(0 == session->num_outgoing_streams); - CU_ASSERT(&session->root == stream->dep_prev); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight); - CU_ASSERT(NGHTTP2_SHUT_WR == stream->shut_flags); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_open_stream_with_idle_stream_dep(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *stream; - nghttp2_priority_spec pri_spec; - - memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - nghttp2_session_server_new(&session, &callbacks, NULL); - - /* Dependency to idle stream */ - nghttp2_priority_spec_init(&pri_spec, 101, 245, 0); - - stream = nghttp2_session_open_stream(session, 1, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec, NGHTTP2_STREAM_OPENED, NULL); - - CU_ASSERT(245 == stream->weight); - CU_ASSERT(101 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream_raw(session, 101); - - CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight); - - nghttp2_priority_spec_init(&pri_spec, 211, 1, 0); - - /* stream 101 was already created as idle. */ - stream = nghttp2_session_open_stream(session, 101, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec, NGHTTP2_STREAM_OPENED, NULL); - - CU_ASSERT(1 == stream->weight); - CU_ASSERT(211 == stream->dep_prev->stream_id); - - stream = nghttp2_session_get_stream_raw(session, 211); - - CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream->weight); + assert_size(0, ==, session->num_incoming_streams); + assert_size(0, ==, session->num_outgoing_streams); + assert_uint8(NGHTTP2_SHUT_WR, ==, stream->shut_flags); nghttp2_session_del(session); } @@ -7182,22 +6992,23 @@ void test_nghttp2_session_get_next_ob_item(void) { nghttp2_priority_spec pri_spec; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); session->remote_settings.max_concurrent_streams = 2; - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); nghttp2_submit_ping(session, NGHTTP2_FLAG_NONE, NULL); - CU_ASSERT(NGHTTP2_PING == - nghttp2_session_get_next_ob_item(session)->frame.hd.type); + assert_uint8(NGHTTP2_PING, ==, + nghttp2_session_get_next_ob_item(session)->frame.hd.type); - CU_ASSERT(1 == nghttp2_submit_request(session, NULL, NULL, 0, NULL, NULL)); - CU_ASSERT(NGHTTP2_PING == - nghttp2_session_get_next_ob_item(session)->frame.hd.type); + assert_int32(1, ==, + nghttp2_submit_request2(session, NULL, NULL, 0, NULL, NULL)); + assert_uint8(NGHTTP2_PING, ==, + nghttp2_session_get_next_ob_item(session)->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); /* Incoming stream does not affect the number of outgoing max concurrent streams. */ @@ -7205,20 +7016,20 @@ void test_nghttp2_session_get_next_ob_item(void) { nghttp2_priority_spec_init(&pri_spec, 0, NGHTTP2_MAX_WEIGHT, 0); - CU_ASSERT(3 == - nghttp2_submit_request(session, &pri_spec, NULL, 0, NULL, NULL)); - CU_ASSERT(NGHTTP2_HEADERS == - nghttp2_session_get_next_ob_item(session)->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(3, ==, + nghttp2_submit_request2(session, &pri_spec, NULL, 0, NULL, NULL)); + assert_uint8(NGHTTP2_HEADERS, ==, + nghttp2_session_get_next_ob_item(session)->frame.hd.type); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(5 == - nghttp2_submit_request(session, &pri_spec, NULL, 0, NULL, NULL)); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_int(5, ==, + nghttp2_submit_request2(session, &pri_spec, NULL, 0, NULL, NULL)); + assert_null(nghttp2_session_get_next_ob_item(session)); session->remote_settings.max_concurrent_streams = 3; - CU_ASSERT(NGHTTP2_HEADERS == - nghttp2_session_get_next_ob_item(session)->frame.hd.type); + assert_uint8(NGHTTP2_HEADERS, ==, + nghttp2_session_get_next_ob_item(session)->frame.hd.type); nghttp2_session_del(session); @@ -7226,10 +7037,11 @@ void test_nghttp2_session_get_next_ob_item(void) { nghttp2_session_server_new(&session, &callbacks, NULL); session->remote_settings.max_concurrent_streams = 0; open_sent_stream2(session, 2, NGHTTP2_STREAM_RESERVED); - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 2, - NULL, NULL, 0, NULL)); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); - CU_ASSERT(1 == nghttp2_outbound_queue_size(&session->ob_syn)); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 2, NULL, + NULL, 0, NULL)); + assert_null(nghttp2_session_get_next_ob_item(session)); + assert_size(1, ==, nghttp2_outbound_queue_size(&session->ob_syn)); nghttp2_session_del(session); } @@ -7242,30 +7054,30 @@ void test_nghttp2_session_pop_next_ob_item(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); session->remote_settings.max_concurrent_streams = 1; - CU_ASSERT(NULL == nghttp2_session_pop_next_ob_item(session)); + assert_null(nghttp2_session_pop_next_ob_item(session)); nghttp2_submit_ping(session, NGHTTP2_FLAG_NONE, NULL); nghttp2_priority_spec_init(&pri_spec, 0, 254, 0); - nghttp2_submit_request(session, &pri_spec, NULL, 0, NULL, NULL); + nghttp2_submit_request2(session, &pri_spec, NULL, 0, NULL, NULL); item = nghttp2_session_pop_next_ob_item(session); - CU_ASSERT(NGHTTP2_PING == item->frame.hd.type); + assert_uint8(NGHTTP2_PING, ==, item->frame.hd.type); nghttp2_outbound_item_free(item, mem); mem->free(item, NULL); item = nghttp2_session_pop_next_ob_item(session); - CU_ASSERT(NGHTTP2_HEADERS == item->frame.hd.type); + assert_uint8(NGHTTP2_HEADERS, ==, item->frame.hd.type); nghttp2_outbound_item_free(item, mem); mem->free(item, NULL); - CU_ASSERT(NULL == nghttp2_session_pop_next_ob_item(session)); + assert_null(nghttp2_session_pop_next_ob_item(session)); /* Incoming stream does not affect the number of outgoing max concurrent streams. */ @@ -7275,14 +7087,14 @@ void test_nghttp2_session_pop_next_ob_item(void) { nghttp2_priority_spec_init(&pri_spec, 0, NGHTTP2_MAX_WEIGHT, 0); - nghttp2_submit_request(session, &pri_spec, NULL, 0, NULL, NULL); + nghttp2_submit_request2(session, &pri_spec, NULL, 0, NULL, NULL); - CU_ASSERT(NULL == nghttp2_session_pop_next_ob_item(session)); + assert_null(nghttp2_session_pop_next_ob_item(session)); session->remote_settings.max_concurrent_streams = 2; item = nghttp2_session_pop_next_ob_item(session); - CU_ASSERT(NGHTTP2_HEADERS == item->frame.hd.type); + assert_uint8(NGHTTP2_HEADERS, ==, item->frame.hd.type); nghttp2_outbound_item_free(item, mem); mem->free(item, NULL); @@ -7292,28 +7104,29 @@ void test_nghttp2_session_pop_next_ob_item(void) { nghttp2_session_server_new(&session, &callbacks, NULL); session->remote_settings.max_concurrent_streams = 0; open_sent_stream2(session, 2, NGHTTP2_STREAM_RESERVED); - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 2, - NULL, NULL, 0, NULL)); - CU_ASSERT(NULL == nghttp2_session_pop_next_ob_item(session)); - CU_ASSERT(1 == nghttp2_outbound_queue_size(&session->ob_syn)); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 2, NULL, + NULL, 0, NULL)); + assert_null(nghttp2_session_pop_next_ob_item(session)); + assert_size(1, ==, nghttp2_outbound_queue_size(&session->ob_syn)); nghttp2_session_del(session); } void test_nghttp2_session_reply_fail(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = fail_send_callback; + callbacks.send_callback2 = fail_send_callback; data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = 4 * 1024; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, &ud)); open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); - CU_ASSERT(0 == nghttp2_submit_response(session, 1, NULL, 0, &data_prd)); - CU_ASSERT(NGHTTP2_ERR_CALLBACK_FAILURE == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_submit_response2(session, 1, NULL, 0, &data_prd)); + assert_int(NGHTTP2_ERR_CALLBACK_FAILURE, ==, nghttp2_session_send(session)); nghttp2_session_del(session); } @@ -7326,7 +7139,7 @@ void test_nghttp2_session_max_concurrent_streams(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_server_new(&session, &callbacks, NULL); open_recv_stream(session, 1); @@ -7336,25 +7149,25 @@ void test_nghttp2_session_max_concurrent_streams(void) { NGHTTP2_HCAT_HEADERS, NULL, NULL, 0); session->pending_local_max_concurrent_stream = 1; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); item = nghttp2_outbound_queue_top(&session->ob_reg); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(NGHTTP2_REFUSED_STREAM == item->frame.rst_stream.error_code); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_REFUSED_STREAM, ==, item->frame.rst_stream.error_code); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); /* Check ACKed SETTINGS_MAX_CONCURRENT_STREAMS */ session->local_settings.max_concurrent_streams = 1; frame.hd.stream_id = 5; - CU_ASSERT(NGHTTP2_ERR_IGN_HEADER_BLOCK == - nghttp2_session_on_request_headers_received(session, &frame)); + assert_int(NGHTTP2_ERR_IGN_HEADER_BLOCK, ==, + nghttp2_session_on_request_headers_received(session, &frame)); item = nghttp2_outbound_queue_top(&session->ob_reg); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == item->frame.goaway.error_code); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_uint32(NGHTTP2_PROTOCOL_ERROR, ==, item->frame.goaway.error_code); nghttp2_frame_headers_free(&frame.headers, mem); nghttp2_session_del(session); @@ -7364,12 +7177,12 @@ void test_nghttp2_session_stop_data_with_rst_stream(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; my_user_data ud; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; nghttp2_frame frame; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); callbacks.on_frame_send_callback = on_frame_send_callback; - callbacks.send_callback = block_count_send_callback; + callbacks.send_callback2 = block_count_send_callback; data_prd.read_callback = fixed_length_data_source_read_callback; ud.frame_send_cb_called = 0; @@ -7377,28 +7190,28 @@ void test_nghttp2_session_stop_data_with_rst_stream(void) { nghttp2_session_server_new(&session, &callbacks, &ud); open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); - nghttp2_submit_response(session, 1, NULL, 0, &data_prd); + nghttp2_submit_response2(session, 1, NULL, 0, &data_prd); ud.block_count = 2; /* Sends response HEADERS + DATA[0] */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(NGHTTP2_DATA == ud.sent_frame_type); + assert_int(0, ==, nghttp2_session_send(session)); + assert_uint8(NGHTTP2_DATA, ==, ud.sent_frame_type); /* data for DATA[1] is read from data_prd but it is not sent */ - CU_ASSERT(ud.data_source_length == NGHTTP2_DATA_PAYLOADLEN * 2); + assert_size(ud.data_source_length, ==, NGHTTP2_DATA_PAYLOADLEN * 2); nghttp2_frame_rst_stream_init(&frame.rst_stream, 1, NGHTTP2_CANCEL); - CU_ASSERT(0 == nghttp2_session_on_rst_stream_received(session, &frame)); + assert_int(0, ==, nghttp2_session_on_rst_stream_received(session, &frame)); nghttp2_frame_rst_stream_free(&frame.rst_stream); /* Big enough number to send all DATA frames potentially. */ ud.block_count = 100; /* Nothing will be sent in the following call. */ - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); /* With RST_STREAM, stream is canceled and further DATA on that stream are not sent. */ - CU_ASSERT(ud.data_source_length == NGHTTP2_DATA_PAYLOADLEN * 2); + assert_size(ud.data_source_length, ==, NGHTTP2_DATA_PAYLOADLEN * 2); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 1)); + assert_null(nghttp2_session_get_stream(session, 1)); nghttp2_session_del(session); } @@ -7407,13 +7220,13 @@ void test_nghttp2_session_defer_data(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; my_user_data ud; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; nghttp2_outbound_item *item; nghttp2_stream *stream; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); callbacks.on_frame_send_callback = on_frame_send_callback; - callbacks.send_callback = block_count_send_callback; + callbacks.send_callback2 = block_count_send_callback; data_prd.read_callback = defer_data_source_read_callback; ud.frame_send_cb_called = 0; @@ -7425,47 +7238,48 @@ void test_nghttp2_session_defer_data(void) { session->remote_window_size = 1 << 20; stream->remote_window_size = 1 << 20; - nghttp2_submit_response(session, 1, NULL, 0, &data_prd); + nghttp2_submit_response2(session, 1, NULL, 0, &data_prd); ud.block_count = 1; /* Sends HEADERS reply */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(NGHTTP2_HEADERS == ud.sent_frame_type); + assert_int(0, ==, nghttp2_session_send(session)); + assert_uint8(NGHTTP2_HEADERS, ==, ud.sent_frame_type); /* No data is read */ - CU_ASSERT(ud.data_source_length == NGHTTP2_DATA_PAYLOADLEN * 4); + assert_size(ud.data_source_length, ==, NGHTTP2_DATA_PAYLOADLEN * 4); ud.block_count = 1; nghttp2_submit_ping(session, NGHTTP2_FLAG_NONE, NULL); /* Sends PING */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(NGHTTP2_PING == ud.sent_frame_type); + assert_int(0, ==, nghttp2_session_send(session)); + assert_uint8(NGHTTP2_PING, ==, ud.sent_frame_type); /* Resume deferred DATA */ - CU_ASSERT(0 == nghttp2_session_resume_data(session, 1)); + assert_int(0, ==, nghttp2_session_resume_data(session, 1)); item = stream->item; - item->aux_data.data.data_prd.read_callback = - fixed_length_data_source_read_callback; + item->aux_data.data.dpw.data_prd.v1.read_callback = + fixed_length_data_source_read_callback; ud.block_count = 1; /* Reads 2 DATA chunks */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(ud.data_source_length == NGHTTP2_DATA_PAYLOADLEN * 2); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(ud.data_source_length, ==, NGHTTP2_DATA_PAYLOADLEN * 2); /* Deferred again */ - item->aux_data.data.data_prd.read_callback = defer_data_source_read_callback; + item->aux_data.data.dpw.data_prd.v1.read_callback = + defer_data_source_read_callback; /* This is needed since 16KiB block is already read and waiting to be sent. No read_callback invocation. */ ud.block_count = 1; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(ud.data_source_length == NGHTTP2_DATA_PAYLOADLEN * 2); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(ud.data_source_length, ==, NGHTTP2_DATA_PAYLOADLEN * 2); /* Resume deferred DATA */ - CU_ASSERT(0 == nghttp2_session_resume_data(session, 1)); - item->aux_data.data.data_prd.read_callback = - fixed_length_data_source_read_callback; + assert_int(0, ==, nghttp2_session_resume_data(session, 1)); + item->aux_data.data.dpw.data_prd.v1.read_callback = + fixed_length_data_source_read_callback; ud.block_count = 1; /* Reads 2 16KiB blocks */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(ud.data_source_length == 0); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(ud.data_source_length, ==, 0); nghttp2_session_del(session); } @@ -7474,7 +7288,7 @@ void test_nghttp2_session_flow_control(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; my_user_data ud; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; nghttp2_frame frame; nghttp2_stream *stream; int32_t new_initial_window_size; @@ -7484,7 +7298,7 @@ void test_nghttp2_session_flow_control(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = fixed_bytes_send_callback; + callbacks.send_callback2 = fixed_bytes_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; data_prd.read_callback = fixed_length_data_source_read_callback; @@ -7500,11 +7314,11 @@ void test_nghttp2_session_flow_control(void) { session->remote_window_size = 64 * 1024; session->remote_settings.initial_window_size = 64 * 1024; - nghttp2_submit_request(session, NULL, NULL, 0, &data_prd, NULL); + nghttp2_submit_request2(session, NULL, NULL, 0, &data_prd, NULL); /* Sends 64KiB - 1 data */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(64 * 1024 == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(64 * 1024, ==, ud.data_source_length); /* Back 32KiB in stream window */ nghttp2_frame_window_update_init(&frame.window_update, NGHTTP2_FLAG_NONE, 1, @@ -7512,28 +7326,28 @@ void test_nghttp2_session_flow_control(void) { nghttp2_session_on_window_update_received(session, &frame); /* Send nothing because of connection-level window */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(64 * 1024 == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(64 * 1024, ==, ud.data_source_length); /* Back 32KiB in connection-level window */ frame.hd.stream_id = 0; nghttp2_session_on_window_update_received(session, &frame); /* Sends another 32KiB data */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(32 * 1024 == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(32 * 1024, ==, ud.data_source_length); stream = nghttp2_session_get_stream(session, 1); /* Change initial window size to 16KiB. The window_size becomes negative. */ new_initial_window_size = 16 * 1024; stream->remote_window_size = - new_initial_window_size - - ((int32_t)session->remote_settings.initial_window_size - - stream->remote_window_size); + new_initial_window_size - + ((int32_t)session->remote_settings.initial_window_size - + stream->remote_window_size); session->remote_settings.initial_window_size = - (uint32_t)new_initial_window_size; - CU_ASSERT(-48 * 1024 == stream->remote_window_size); + (uint32_t)new_initial_window_size; + assert_int32(-48 * 1024, ==, stream->remote_window_size); /* Back 48KiB to stream window */ frame.hd.stream_id = 1; @@ -7541,8 +7355,8 @@ void test_nghttp2_session_flow_control(void) { nghttp2_session_on_window_update_received(session, &frame); /* Nothing is sent because window_size is 0 */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(32 * 1024 == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(32 * 1024, ==, ud.data_source_length); /* Back 16KiB in stream window */ frame.hd.stream_id = 1; @@ -7555,8 +7369,8 @@ void test_nghttp2_session_flow_control(void) { nghttp2_session_on_window_update_received(session, &frame); /* Sends another 16KiB data */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(16 * 1024 == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(16 * 1024, ==, ud.data_source_length); /* Increase initial window size to 32KiB */ iv[0].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; @@ -7568,8 +7382,8 @@ void test_nghttp2_session_flow_control(void) { nghttp2_frame_settings_free(&settings_frame.settings, mem); /* Sends another 8KiB data */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(8 * 1024 == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(8 * 1024, ==, ud.data_source_length); /* Back 8KiB in connection-level window */ frame.hd.stream_id = 0; @@ -7577,10 +7391,10 @@ void test_nghttp2_session_flow_control(void) { nghttp2_session_on_window_update_received(session, &frame); /* Sends last 8KiB data */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == ud.data_source_length); - CU_ASSERT(nghttp2_session_get_stream(session, 1)->shut_flags & - NGHTTP2_SHUT_WR); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(0, ==, ud.data_source_length); + assert_true(nghttp2_session_get_stream(session, 1)->shut_flags & + NGHTTP2_SHUT_WR); nghttp2_frame_window_update_free(&frame.window_update); nghttp2_session_del(session); @@ -7595,7 +7409,7 @@ void test_nghttp2_session_flow_control_data_recv(void) { nghttp2_stream *stream; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; /* Initial window size to 64KiB - 1*/ nghttp2_session_client_new(&session, &callbacks, NULL); @@ -7613,34 +7427,36 @@ void test_nghttp2_session_flow_control_data_recv(void) { NGHTTP2_FLAG_END_STREAM, 1); nghttp2_frame_pack_frame_hd(data, &hd); - CU_ASSERT(NGHTTP2_MAX_PAYLOADLEN + NGHTTP2_FRAME_HDLEN == - nghttp2_session_mem_recv( - session, data, NGHTTP2_MAX_PAYLOADLEN + NGHTTP2_FRAME_HDLEN)); + assert_ptrdiff( + NGHTTP2_MAX_PAYLOADLEN + NGHTTP2_FRAME_HDLEN, ==, + nghttp2_session_mem_recv2(session, data, + NGHTTP2_MAX_PAYLOADLEN + NGHTTP2_FRAME_HDLEN)); item = nghttp2_session_get_next_ob_item(session); /* Since this is the last frame, stream-level WINDOW_UPDATE is not issued, but connection-level is. */ - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(0 == item->frame.hd.stream_id); - CU_ASSERT(NGHTTP2_MAX_PAYLOADLEN == - item->frame.window_update.window_size_increment); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(0, ==, item->frame.hd.stream_id); + assert_int32(NGHTTP2_MAX_PAYLOADLEN, ==, + item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); /* Receive DATA for closed stream. They are still subject to under connection-level flow control, since this situation arises when RST_STREAM is issued by the remote, but the local side keeps sending DATA frames. Without calculating connection-level window, the subsequent flow control gets confused. */ - CU_ASSERT(NGHTTP2_MAX_PAYLOADLEN + NGHTTP2_FRAME_HDLEN == - nghttp2_session_mem_recv( - session, data, NGHTTP2_MAX_PAYLOADLEN + NGHTTP2_FRAME_HDLEN)); + assert_ptrdiff( + NGHTTP2_MAX_PAYLOADLEN + NGHTTP2_FRAME_HDLEN, ==, + nghttp2_session_mem_recv2(session, data, + NGHTTP2_MAX_PAYLOADLEN + NGHTTP2_FRAME_HDLEN)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(0 == item->frame.hd.stream_id); - CU_ASSERT(NGHTTP2_MAX_PAYLOADLEN == - item->frame.window_update.window_size_increment); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(0, ==, item->frame.hd.stream_id); + assert_int32(NGHTTP2_MAX_PAYLOADLEN, ==, + item->frame.window_update.window_size_increment); nghttp2_session_del(session); } @@ -7654,7 +7470,7 @@ void test_nghttp2_session_flow_control_data_with_padding_recv(void) { nghttp2_option *option; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_option_new(&option); /* Disable auto window update so that we can check padding is @@ -7676,66 +7492,69 @@ void test_nghttp2_session_flow_control_data_with_padding_recv(void) { /* Set Pad Length field, which itself is padding */ data[NGHTTP2_FRAME_HDLEN] = 255; - CU_ASSERT( - (ssize_t)(NGHTTP2_FRAME_HDLEN + hd.length) == - nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + hd.length)); + assert_ptrdiff( + (nghttp2_ssize)(NGHTTP2_FRAME_HDLEN + hd.length), ==, + nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + hd.length)); - CU_ASSERT((int32_t)hd.length == session->recv_window_size); - CU_ASSERT((int32_t)hd.length == stream->recv_window_size); - CU_ASSERT(256 == session->consumed_size); - CU_ASSERT(256 == stream->consumed_size); - CU_ASSERT(357 == session->recv_window_size); - CU_ASSERT(357 == stream->recv_window_size); + assert_int32((int32_t)hd.length, ==, session->recv_window_size); + assert_int32((int32_t)hd.length, ==, stream->recv_window_size); + assert_int32(256, ==, session->consumed_size); + assert_int32(256, ==, stream->consumed_size); + assert_int32(357, ==, session->recv_window_size); + assert_int32(357, ==, stream->recv_window_size); /* Receive the same DATA frame, but in 2 parts: first 9 + 1 + 102 bytes which includes 1st padding byte, and remainder */ - CU_ASSERT((ssize_t)(NGHTTP2_FRAME_HDLEN + 103) == - nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 103)); - CU_ASSERT(258 == session->consumed_size); - CU_ASSERT(258 == stream->consumed_size); - CU_ASSERT(460 == session->recv_window_size); - CU_ASSERT(460 == stream->recv_window_size); + assert_ptrdiff( + (nghttp2_ssize)(NGHTTP2_FRAME_HDLEN + 103), ==, + nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 103)); + assert_int32(258, ==, session->consumed_size); + assert_int32(258, ==, stream->consumed_size); + assert_int32(460, ==, session->recv_window_size); + assert_int32(460, ==, stream->recv_window_size); /* 357 - 103 = 254 bytes left */ - CU_ASSERT(254 == nghttp2_session_mem_recv(session, data, 254)); - CU_ASSERT(512 == session->consumed_size); - CU_ASSERT(512 == stream->consumed_size); - CU_ASSERT(714 == session->recv_window_size); - CU_ASSERT(714 == stream->recv_window_size); + assert_ptrdiff(254, ==, nghttp2_session_mem_recv2(session, data, 254)); + assert_int32(512, ==, session->consumed_size); + assert_int32(512, ==, stream->consumed_size); + assert_int32(714, ==, session->recv_window_size); + assert_int32(714, ==, stream->recv_window_size); /* Receive the same DATA frame, but in 2 parts: first 9 = 1 + 101 bytes which only includes data without padding, 2nd part is padding only */ - CU_ASSERT((ssize_t)(NGHTTP2_FRAME_HDLEN + 102) == - nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 102)); - CU_ASSERT(513 == session->consumed_size); - CU_ASSERT(513 == stream->consumed_size); - CU_ASSERT(816 == session->recv_window_size); - CU_ASSERT(816 == stream->recv_window_size); + assert_ptrdiff( + (nghttp2_ssize)(NGHTTP2_FRAME_HDLEN + 102), ==, + nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 102)); + assert_int32(513, ==, session->consumed_size); + assert_int32(513, ==, stream->consumed_size); + assert_int32(816, ==, session->recv_window_size); + assert_int32(816, ==, stream->recv_window_size); /* 357 - 102 = 255 bytes left */ - CU_ASSERT(255 == nghttp2_session_mem_recv(session, data, 255)); - CU_ASSERT(768 == session->consumed_size); - CU_ASSERT(768 == stream->consumed_size); - CU_ASSERT(1071 == session->recv_window_size); - CU_ASSERT(1071 == stream->recv_window_size); + assert_ptrdiff(255, ==, nghttp2_session_mem_recv2(session, data, 255)); + assert_int32(768, ==, session->consumed_size); + assert_int32(768, ==, stream->consumed_size); + assert_int32(1071, ==, session->recv_window_size); + assert_int32(1071, ==, stream->recv_window_size); /* Receive the same DATA frame, but in 2 parts: first 9 = 1 + 50 bytes which includes byte up to middle of data, 2nd part is the remainder */ - CU_ASSERT((ssize_t)(NGHTTP2_FRAME_HDLEN + 51) == - nghttp2_session_mem_recv(session, data, NGHTTP2_FRAME_HDLEN + 51)); - CU_ASSERT(769 == session->consumed_size); - CU_ASSERT(769 == stream->consumed_size); - CU_ASSERT(1122 == session->recv_window_size); - CU_ASSERT(1122 == stream->recv_window_size); + assert_ptrdiff( + (nghttp2_ssize)(NGHTTP2_FRAME_HDLEN + 51), ==, + nghttp2_session_mem_recv2(session, data, NGHTTP2_FRAME_HDLEN + 51)); + assert_int32(769, ==, session->consumed_size); + assert_int32(769, ==, stream->consumed_size); + assert_int32(1122, ==, session->recv_window_size); + assert_int32(1122, ==, stream->recv_window_size); /* 357 - 51 = 306 bytes left */ - CU_ASSERT(306 == nghttp2_session_mem_recv(session, data, 306)); - CU_ASSERT(1024 == session->consumed_size); - CU_ASSERT(1024 == stream->consumed_size); - CU_ASSERT(1428 == session->recv_window_size); - CU_ASSERT(1428 == stream->recv_window_size); + assert_ptrdiff(306, ==, nghttp2_session_mem_recv2(session, data, 306)); + assert_int32(1024, ==, session->consumed_size); + assert_int32(1024, ==, stream->consumed_size); + assert_int32(1428, ==, session->recv_window_size); + assert_int32(1428, ==, stream->recv_window_size); nghttp2_session_del(session); } @@ -7744,13 +7563,13 @@ void test_nghttp2_session_data_read_temporal_failure(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; my_user_data ud; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; nghttp2_frame frame; nghttp2_stream *stream; size_t data_size = 128 * 1024; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; data_prd.read_callback = fixed_length_data_source_read_callback; @@ -7758,18 +7577,19 @@ void test_nghttp2_session_data_read_temporal_failure(void) { /* Initial window size is 64KiB - 1 */ nghttp2_session_client_new(&session, &callbacks, &ud); - nghttp2_submit_request(session, NULL, NULL, 0, &data_prd, NULL); + nghttp2_submit_request2(session, NULL, NULL, 0, &data_prd, NULL); /* Sends NGHTTP2_INITIAL_WINDOW_SIZE data, assuming, it is equal to or smaller than NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(data_size - NGHTTP2_INITIAL_WINDOW_SIZE == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(data_size - NGHTTP2_INITIAL_WINDOW_SIZE, ==, + ud.data_source_length); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(NGHTTP2_DATA == stream->item->frame.hd.type); + assert_uint8(NGHTTP2_DATA, ==, stream->item->frame.hd.type); - stream->item->aux_data.data.data_prd.read_callback = - temporal_failure_data_source_read_callback; + stream->item->aux_data.data.dpw.data_prd.v1.read_callback = + temporal_failure_data_source_read_callback; /* Back NGHTTP2_INITIAL_WINDOW_SIZE to both connection-level and stream-wise window */ @@ -7782,16 +7602,17 @@ void test_nghttp2_session_data_read_temporal_failure(void) { /* Sending data will fail (soft fail) and treated as stream error */ ud.frame_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(data_size - NGHTTP2_INITIAL_WINDOW_SIZE == ud.data_source_length); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size(data_size - NGHTTP2_INITIAL_WINDOW_SIZE, ==, + ud.data_source_length); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(NGHTTP2_RST_STREAM == ud.sent_frame_type); + assert_int(1, ==, ud.frame_send_cb_called); + assert_uint8(NGHTTP2_RST_STREAM, ==, ud.sent_frame_type); data_prd.read_callback = fail_data_source_read_callback; - nghttp2_submit_request(session, NULL, NULL, 0, &data_prd, NULL); + nghttp2_submit_request2(session, NULL, NULL, 0, &data_prd, NULL); /* Sending data will fail (hard fail) and session tear down */ - CU_ASSERT(NGHTTP2_ERR_CALLBACK_FAILURE == nghttp2_session_send(session)); + assert_int(NGHTTP2_ERR_CALLBACK_FAILURE, ==, nghttp2_session_send(session)); nghttp2_session_del(session); } @@ -7807,12 +7628,11 @@ void test_nghttp2_session_on_stream_close(void) { user_data.stream_close_cb_called = 0; nghttp2_session_client_new(&session, &callbacks, &user_data); - stream = - open_sent_stream3(session, 1, NGHTTP2_STREAM_FLAG_NONE, &pri_spec_default, - NGHTTP2_STREAM_OPENED, &user_data); - CU_ASSERT(stream != NULL); - CU_ASSERT(nghttp2_session_close_stream(session, 1, NGHTTP2_NO_ERROR) == 0); - CU_ASSERT(user_data.stream_close_cb_called == 1); + stream = open_sent_stream3(session, 1, NGHTTP2_STREAM_FLAG_NONE, + NGHTTP2_STREAM_OPENED, &user_data); + assert_not_null(stream); + assert_int(0, ==, nghttp2_session_close_stream(session, 1, NGHTTP2_NO_ERROR)); + assert_int(1, ==, user_data.stream_close_cb_called); nghttp2_session_del(session); } @@ -7824,69 +7644,75 @@ void test_nghttp2_session_on_ctrl_not_send(void) { memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); callbacks.on_frame_not_send_callback = on_frame_not_send_callback; - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; user_data.frame_not_send_cb_called = 0; user_data.not_sent_frame_type = 0; user_data.not_sent_error = 0; nghttp2_session_server_new(&session, &callbacks, &user_data); - stream = - open_recv_stream3(session, 1, NGHTTP2_STREAM_FLAG_NONE, &pri_spec_default, - NGHTTP2_STREAM_OPENING, &user_data); + stream = open_recv_stream3(session, 1, NGHTTP2_STREAM_FLAG_NONE, + NGHTTP2_STREAM_OPENING, &user_data); /* Check response HEADERS */ /* Send bogus stream ID */ - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 3, - NULL, NULL, 0, NULL)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == user_data.frame_not_send_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == user_data.not_sent_frame_type); - CU_ASSERT(NGHTTP2_ERR_STREAM_CLOSED == user_data.not_sent_error); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 3, NULL, + NULL, 0, NULL)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, user_data.frame_not_send_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, user_data.not_sent_frame_type); + assert_int(NGHTTP2_ERR_STREAM_CLOSED, ==, user_data.not_sent_error); user_data.frame_not_send_cb_called = 0; /* Shutdown transmission */ stream->shut_flags |= NGHTTP2_SHUT_WR; - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, - NULL, NULL, 0, NULL)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == user_data.frame_not_send_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == user_data.not_sent_frame_type); - CU_ASSERT(NGHTTP2_ERR_STREAM_SHUT_WR == user_data.not_sent_error); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, NULL, + NULL, 0, NULL)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, user_data.frame_not_send_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, user_data.not_sent_frame_type); + assert_int(NGHTTP2_ERR_STREAM_SHUT_WR, ==, user_data.not_sent_error); stream->shut_flags = NGHTTP2_SHUT_NONE; user_data.frame_not_send_cb_called = 0; /* Queue RST_STREAM */ - CU_ASSERT(0 == nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, - NULL, NULL, 0, NULL)); - CU_ASSERT(0 == nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, - NGHTTP2_INTERNAL_ERROR)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == user_data.frame_not_send_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == user_data.not_sent_frame_type); - CU_ASSERT(NGHTTP2_ERR_STREAM_CLOSING == user_data.not_sent_error); + assert_int32(0, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, 1, NULL, + NULL, 0, NULL)); + assert_int(0, ==, + nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 1, + NGHTTP2_INTERNAL_ERROR)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, user_data.frame_not_send_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, user_data.not_sent_frame_type); + assert_int(NGHTTP2_ERR_STREAM_CLOSING, ==, user_data.not_sent_error); nghttp2_session_del(session); /* Check request HEADERS */ user_data.frame_not_send_cb_called = 0; - CU_ASSERT(nghttp2_session_client_new(&session, &callbacks, &user_data) == 0); + assert_int(0, ==, + nghttp2_session_client_new(&session, &callbacks, &user_data)); /* Maximum Stream ID is reached */ session->next_stream_id = (1u << 31) + 1; - CU_ASSERT(NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE == - nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, NULL, - NULL, 0, NULL)); + assert_int32(NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE, ==, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, + NULL, NULL, 0, NULL)); user_data.frame_not_send_cb_called = 0; /* GOAWAY received */ session->goaway_flags |= NGHTTP2_GOAWAY_RECV; session->next_stream_id = 9; - CU_ASSERT(0 < nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, - NULL, NULL, 0, NULL)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == user_data.frame_not_send_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == user_data.not_sent_frame_type); - CU_ASSERT(NGHTTP2_ERR_START_STREAM_NOT_ALLOWED == user_data.not_sent_error); + assert_int32(0, <, + nghttp2_submit_headers(session, NGHTTP2_FLAG_END_STREAM, -1, + NULL, NULL, 0, NULL)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, user_data.frame_not_send_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, user_data.not_sent_frame_type); + assert_int(NGHTTP2_ERR_START_STREAM_NOT_ALLOWED, ==, + user_data.not_sent_error); nghttp2_session_del(session); } @@ -7896,15 +7722,16 @@ void test_nghttp2_session_get_outbound_queue_size(void) { nghttp2_session_callbacks callbacks; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, NULL)); - CU_ASSERT(0 == nghttp2_session_get_outbound_queue_size(session)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, NULL)); + assert_size(0, ==, nghttp2_session_get_outbound_queue_size(session)); - CU_ASSERT(0 == nghttp2_submit_ping(session, NGHTTP2_FLAG_NONE, NULL)); - CU_ASSERT(1 == nghttp2_session_get_outbound_queue_size(session)); + assert_int(0, ==, nghttp2_submit_ping(session, NGHTTP2_FLAG_NONE, NULL)); + assert_size(1, ==, nghttp2_session_get_outbound_queue_size(session)); - CU_ASSERT(0 == nghttp2_submit_goaway(session, NGHTTP2_FLAG_NONE, 2, - NGHTTP2_NO_ERROR, NULL, 0)); - CU_ASSERT(2 == nghttp2_session_get_outbound_queue_size(session)); + assert_int(0, ==, + nghttp2_submit_goaway(session, NGHTTP2_FLAG_NONE, 2, + NGHTTP2_NO_ERROR, NULL, 0)); + assert_size(2, ==, nghttp2_session_get_outbound_queue_size(session)); nghttp2_session_del(session); } @@ -7915,84 +7742,88 @@ void test_nghttp2_session_get_effective_local_window_size(void) { nghttp2_stream *stream; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, NULL)); + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, NULL)); stream = open_sent_stream(session, 1); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE == - nghttp2_session_get_effective_local_window_size(session)); - CU_ASSERT(0 == nghttp2_session_get_effective_recv_data_length(session)); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE, ==, + nghttp2_session_get_effective_local_window_size(session)); + assert_int32(0, ==, nghttp2_session_get_effective_recv_data_length(session)); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE == - nghttp2_session_get_stream_effective_local_window_size(session, 1)); - CU_ASSERT(0 == - nghttp2_session_get_stream_effective_recv_data_length(session, 1)); + assert_int32( + NGHTTP2_INITIAL_WINDOW_SIZE, ==, + nghttp2_session_get_stream_effective_local_window_size(session, 1)); + assert_int32( + 0, ==, nghttp2_session_get_stream_effective_recv_data_length(session, 1)); /* Check connection flow control */ session->recv_window_size = 100; nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, 1100); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1000 == - nghttp2_session_get_effective_local_window_size(session)); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1000 == - nghttp2_session_get_local_window_size(session)); - CU_ASSERT(0 == nghttp2_session_get_effective_recv_data_length(session)); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1000, ==, + nghttp2_session_get_effective_local_window_size(session)); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1000, ==, + nghttp2_session_get_local_window_size(session)); + assert_int32(0, ==, nghttp2_session_get_effective_recv_data_length(session)); nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, -50); /* Now session->recv_window_size = -50 */ - CU_ASSERT(-50 == session->recv_window_size); - CU_ASSERT(50 == session->recv_reduction); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 950 == - nghttp2_session_get_effective_local_window_size(session)); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1000 == - nghttp2_session_get_local_window_size(session)); - CU_ASSERT(0 == nghttp2_session_get_effective_recv_data_length(session)); + assert_int32(-50, ==, session->recv_window_size); + assert_int32(50, ==, session->recv_reduction); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 950, ==, + nghttp2_session_get_effective_local_window_size(session)); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1000, ==, + nghttp2_session_get_local_window_size(session)); + assert_int32(0, ==, nghttp2_session_get_effective_recv_data_length(session)); session->recv_window_size += 50; /* Now session->recv_window_size = 0 */ - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 950 == - nghttp2_session_get_local_window_size(session)); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 950, ==, + nghttp2_session_get_local_window_size(session)); nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 0, 100); - CU_ASSERT(50 == session->recv_window_size); - CU_ASSERT(0 == session->recv_reduction); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1050 == - nghttp2_session_get_effective_local_window_size(session)); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1000 == - nghttp2_session_get_local_window_size(session)); - CU_ASSERT(50 == nghttp2_session_get_effective_recv_data_length(session)); + assert_int32(50, ==, session->recv_window_size); + assert_int32(0, ==, session->recv_reduction); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1050, ==, + nghttp2_session_get_effective_local_window_size(session)); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1000, ==, + nghttp2_session_get_local_window_size(session)); + assert_int32(50, ==, nghttp2_session_get_effective_recv_data_length(session)); /* Check stream flow control */ stream->recv_window_size = 100; nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 1, 1100); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 1000 == - nghttp2_session_get_stream_effective_local_window_size(session, 1)); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 1000 == - nghttp2_session_get_stream_local_window_size(session, 1)); - CU_ASSERT(0 == - nghttp2_session_get_stream_effective_recv_data_length(session, 1)); + assert_int32( + NGHTTP2_INITIAL_WINDOW_SIZE + 1000, ==, + nghttp2_session_get_stream_effective_local_window_size(session, 1)); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE + 1000, ==, + nghttp2_session_get_stream_local_window_size(session, 1)); + assert_int32( + 0, ==, nghttp2_session_get_stream_effective_recv_data_length(session, 1)); nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 1, -50); /* Now stream->recv_window_size = -50 */ - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 950 == - nghttp2_session_get_stream_effective_local_window_size(session, 1)); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 1000 == - nghttp2_session_get_stream_local_window_size(session, 1)); - CU_ASSERT(0 == - nghttp2_session_get_stream_effective_recv_data_length(session, 1)); + assert_int32( + NGHTTP2_INITIAL_WINDOW_SIZE + 950, ==, + nghttp2_session_get_stream_effective_local_window_size(session, 1)); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE + 1000, ==, + nghttp2_session_get_stream_local_window_size(session, 1)); + assert_int32( + 0, ==, nghttp2_session_get_stream_effective_recv_data_length(session, 1)); stream->recv_window_size += 50; /* Now stream->recv_window_size = 0 */ nghttp2_submit_window_update(session, NGHTTP2_FLAG_NONE, 1, 100); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 1050 == - nghttp2_session_get_stream_effective_local_window_size(session, 1)); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE + 1000 == - nghttp2_session_get_stream_local_window_size(session, 1)); - CU_ASSERT(50 == - nghttp2_session_get_stream_effective_recv_data_length(session, 1)); + assert_int32( + NGHTTP2_INITIAL_WINDOW_SIZE + 1050, ==, + nghttp2_session_get_stream_effective_local_window_size(session, 1)); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE + 1000, ==, + nghttp2_session_get_stream_local_window_size(session, 1)); + assert_int32( + 50, ==, nghttp2_session_get_stream_effective_recv_data_length(session, 1)); nghttp2_session_del(session); } @@ -8005,7 +7836,7 @@ void test_nghttp2_session_set_option(void) { int rv; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; /* Test for nghttp2_option_set_no_auto_window_update */ nghttp2_option_new(&option); @@ -8013,7 +7844,7 @@ void test_nghttp2_session_set_option(void) { nghttp2_session_client_new2(&session, &callbacks, NULL, option); - CU_ASSERT(session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE); + assert_true(session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE); nghttp2_session_del(session); nghttp2_option_del(option); @@ -8024,7 +7855,7 @@ void test_nghttp2_session_set_option(void) { nghttp2_session_client_new2(&session, &callbacks, NULL, option); - CU_ASSERT(100 == session->remote_settings.max_concurrent_streams); + assert_uint32(100, ==, session->remote_settings.max_concurrent_streams); nghttp2_session_del(session); nghttp2_option_del(option); @@ -8034,7 +7865,7 @@ void test_nghttp2_session_set_option(void) { nghttp2_session_client_new2(&session, &callbacks, NULL, option); - CU_ASSERT(99 == session->max_incoming_reserved_streams); + assert_size(99, ==, session->max_incoming_reserved_streams); nghttp2_session_del(session); nghttp2_option_del(option); @@ -8044,7 +7875,7 @@ void test_nghttp2_session_set_option(void) { nghttp2_session_client_new2(&session, &callbacks, NULL, option); - CU_ASSERT(session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_PING_ACK); + assert_true(session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_PING_ACK); nghttp2_session_del(session); nghttp2_option_del(option); @@ -8057,15 +7888,15 @@ void test_nghttp2_session_set_option(void) { deflater = &session->hd_deflater; - rv = nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); + rv = nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); - CU_ASSERT(1 == rv); + assert_int(1, ==, rv); rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == deflater->deflate_hd_table_bufsize_max); - CU_ASSERT(0 == deflater->ctx.hd_table_bufsize); + assert_int(0, ==, rv); + assert_size(0, ==, deflater->deflate_hd_table_bufsize_max); + assert_size(0, ==, deflater->ctx.hd_table_bufsize); nghttp2_session_del(session); nghttp2_option_del(option); @@ -8075,11 +7906,11 @@ void test_nghttp2_session_data_backoff_by_high_pri_frame(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; my_user_data ud; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; nghttp2_stream *stream; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = block_count_send_callback; + callbacks.send_callback2 = block_count_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; data_prd.read_callback = fixed_length_data_source_read_callback; @@ -8087,34 +7918,34 @@ void test_nghttp2_session_data_backoff_by_high_pri_frame(void) { ud.data_source_length = NGHTTP2_DATA_PAYLOADLEN * 4; nghttp2_session_client_new(&session, &callbacks, &ud); - nghttp2_submit_request(session, NULL, NULL, 0, &data_prd, NULL); + nghttp2_submit_request2(session, NULL, NULL, 0, &data_prd, NULL); session->remote_window_size = 1 << 20; ud.block_count = 2; /* Sends request HEADERS + DATA[0] */ - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); stream = nghttp2_session_get_stream(session, 1); stream->remote_window_size = 1 << 20; - CU_ASSERT(NGHTTP2_DATA == ud.sent_frame_type); + assert_uint8(NGHTTP2_DATA, ==, ud.sent_frame_type); /* data for DATA[1] is read from data_prd but it is not sent */ - CU_ASSERT(ud.data_source_length == NGHTTP2_DATA_PAYLOADLEN * 2); + assert_size(ud.data_source_length, ==, NGHTTP2_DATA_PAYLOADLEN * 2); nghttp2_submit_ping(session, NGHTTP2_FLAG_NONE, NULL); ud.block_count = 2; /* Sends DATA[1] + PING, PING is interleaved in DATA sequence */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(NGHTTP2_PING == ud.sent_frame_type); + assert_int(0, ==, nghttp2_session_send(session)); + assert_uint8(NGHTTP2_PING, ==, ud.sent_frame_type); /* data for DATA[2] is read from data_prd but it is not sent */ - CU_ASSERT(ud.data_source_length == NGHTTP2_DATA_PAYLOADLEN); + assert_size(ud.data_source_length, ==, NGHTTP2_DATA_PAYLOADLEN); ud.block_count = 2; /* Sends DATA[2..3] */ - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(stream->shut_flags & NGHTTP2_SHUT_WR); + assert_true(stream->shut_flags & NGHTTP2_SHUT_WR); nghttp2_session_del(session); } @@ -8140,10 +7971,11 @@ static void check_session_recv_data_with_padding(nghttp2_bufs *bufs, ud.frame_recv_cb_called = 0; ud.data_chunk_len = 0; - CU_ASSERT((ssize_t)inlen == nghttp2_session_mem_recv(session, in, inlen)); + assert_ptrdiff((nghttp2_ssize)inlen, ==, + nghttp2_session_mem_recv2(session, in, inlen)); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(datalen == ud.data_chunk_len); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_size(datalen, ==, ud.data_chunk_len); mem->free(in, NULL); nghttp2_session_del(session); @@ -8153,7 +7985,7 @@ void test_nghttp2_session_pack_data_with_padding(void) { nghttp2_session *session; my_user_data ud; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; nghttp2_frame *frame; size_t datalen = 55; nghttp2_mem *mem; @@ -8161,9 +7993,9 @@ void test_nghttp2_session_pack_data_with_padding(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = block_count_send_callback; + callbacks.send_callback2 = block_count_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; - callbacks.select_padding_callback = select_padding_callback; + callbacks.select_padding_callback2 = select_padding_callback; data_prd.read_callback = fixed_length_data_source_read_callback; @@ -8171,17 +8003,17 @@ void test_nghttp2_session_pack_data_with_padding(void) { ud.padlen = 63; - nghttp2_submit_request(session, NULL, NULL, 0, &data_prd, NULL); + nghttp2_submit_request2(session, NULL, NULL, 0, &data_prd, NULL); ud.block_count = 1; ud.data_source_length = datalen; /* Sends HEADERS */ - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(NGHTTP2_HEADERS == ud.sent_frame_type); + assert_int(0, ==, nghttp2_session_send(session)); + assert_uint8(NGHTTP2_HEADERS, ==, ud.sent_frame_type); frame = &session->aob.item->frame; - CU_ASSERT(ud.padlen == frame->data.padlen); - CU_ASSERT(frame->hd.flags & NGHTTP2_FLAG_PADDED); + assert_size(ud.padlen, ==, frame->data.padlen); + assert_true(frame->hd.flags & NGHTTP2_FLAG_PADDED); /* Check reception of this DATA frame */ check_session_recv_data_with_padding(&session->aob.framebufs, datalen, mem); @@ -8196,9 +8028,9 @@ void test_nghttp2_session_pack_headers_with_padding(void) { nghttp2_session_callbacks callbacks; memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = accumulator_send_callback; + callbacks.send_callback2 = accumulator_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; - callbacks.select_padding_callback = select_padding_callback; + callbacks.select_padding_callback2 = select_padding_callback; callbacks.on_frame_recv_callback = on_frame_recv_callback; acc.length = 0; @@ -8209,16 +8041,17 @@ void test_nghttp2_session_pack_headers_with_padding(void) { ud.padlen = 163; - CU_ASSERT(1 == nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), - NULL, NULL)); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int32( + 1, ==, + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(acc.length < NGHTTP2_MAX_PAYLOADLEN); + assert_size(NGHTTP2_MAX_PAYLOADLEN, >, acc.length); ud.frame_recv_cb_called = 0; - CU_ASSERT((ssize_t)acc.length == - nghttp2_session_mem_recv(sv_session, acc.buf, acc.length)); - CU_ASSERT(1 == ud.frame_recv_cb_called); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(sv_session)); + assert_ptrdiff((nghttp2_ssize)acc.length, ==, + nghttp2_session_mem_recv2(sv_session, acc.buf, acc.length)); + assert_int(1, ==, ud.frame_recv_cb_called); + assert_null(nghttp2_session_get_next_ob_item(sv_session)); nghttp2_session_del(sv_session); nghttp2_session_del(session); @@ -8227,7 +8060,7 @@ void test_nghttp2_session_pack_headers_with_padding(void) { void test_nghttp2_pack_settings_payload(void) { nghttp2_settings_entry iv[2]; uint8_t buf[64]; - ssize_t len; + nghttp2_ssize len; nghttp2_settings_entry *resiv; size_t resniv; nghttp2_mem *mem; @@ -8239,1318 +8072,63 @@ void test_nghttp2_pack_settings_payload(void) { iv[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; iv[1].value = 4095; - len = nghttp2_pack_settings_payload(buf, sizeof(buf), iv, 2); - CU_ASSERT(2 * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH == len); - CU_ASSERT(0 == nghttp2_frame_unpack_settings_payload2(&resiv, &resniv, buf, - (size_t)len, mem)); - CU_ASSERT(2 == resniv); - CU_ASSERT(NGHTTP2_SETTINGS_HEADER_TABLE_SIZE == resiv[0].settings_id); - CU_ASSERT(1023 == resiv[0].value); - CU_ASSERT(NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE == resiv[1].settings_id); - CU_ASSERT(4095 == resiv[1].value); + len = nghttp2_pack_settings_payload2(buf, sizeof(buf), iv, 2); + assert_ptrdiff(2 * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH, ==, len); + assert_int(0, ==, + nghttp2_frame_unpack_settings_payload2(&resiv, &resniv, buf, + (size_t)len, mem)); + assert_size(2, ==, resniv); + assert_int32(NGHTTP2_SETTINGS_HEADER_TABLE_SIZE, ==, resiv[0].settings_id); + assert_uint32(1023, ==, resiv[0].value); + assert_int32(NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, ==, resiv[1].settings_id); + assert_uint32(4095, ==, resiv[1].value); mem->free(resiv, NULL); - len = nghttp2_pack_settings_payload(buf, 9 /* too small */, iv, 2); - CU_ASSERT(NGHTTP2_ERR_INSUFF_BUFSIZE == len); + len = nghttp2_pack_settings_payload2(buf, 9 /* too small */, iv, 2); + assert_ptrdiff(NGHTTP2_ERR_INSUFF_BUFSIZE, ==, len); } -#define check_stream_dep_sib(STREAM, DEP_PREV, DEP_NEXT, SIB_PREV, SIB_NEXT) \ - do { \ - CU_ASSERT(DEP_PREV == STREAM->dep_prev); \ - CU_ASSERT(DEP_NEXT == STREAM->dep_next); \ - CU_ASSERT(SIB_PREV == STREAM->sib_prev); \ - CU_ASSERT(SIB_NEXT == STREAM->sib_next); \ - } while (0) - -/* nghttp2_stream_dep_add() and its families functions should be - tested in nghttp2_stream_test.c, but it is easier to use - nghttp2_session_open_stream(). Therefore, we test them here. */ -void test_nghttp2_session_stream_dep_add(void) { +void test_nghttp2_session_stream_get_state(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_stream *a, *b, *c, *d, *e, *root; + nghttp2_mem *mem; + nghttp2_hd_deflater deflater; + nghttp2_bufs bufs; + nghttp2_buf *buf; + nghttp2_stream *stream; + nghttp2_ssize rv; + nghttp2_data_provider2 data_prd; - memset(&callbacks, 0, sizeof(callbacks)); + mem = nghttp2_mem_default(); + frame_pack_bufs_init(&bufs); + memset(&data_prd, 0, sizeof(data_prd)); - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - - c = open_stream_with_dep(session, 5, a); - b = open_stream_with_dep(session, 3, a); - d = open_stream_with_dep(session, 7, c); - - /* a - * | - * b--c - * | - * d - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 2 == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - - check_stream_dep_sib(a, root, b, NULL, NULL); - check_stream_dep_sib(b, a, NULL, NULL, c); - check_stream_dep_sib(c, a, d, b, NULL); - check_stream_dep_sib(d, c, NULL, NULL, NULL); - - CU_ASSERT(a == session->root.dep_next); - - e = open_stream_with_dep_excl(session, 9, a); - - /* a - * | - * e - * | - * b--c - * | - * d - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == a->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 2 == e->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - - check_stream_dep_sib(a, root, e, NULL, NULL); - check_stream_dep_sib(e, a, b, NULL, NULL); - check_stream_dep_sib(b, e, NULL, NULL, c); - check_stream_dep_sib(c, e, d, b, NULL); - check_stream_dep_sib(d, c, NULL, NULL, NULL); - - CU_ASSERT(a == session->root.dep_next); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_stream_dep_remove(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *a, *b, *c, *d, *e, *f, *root; - - memset(&callbacks, 0, sizeof(callbacks)); - - /* Remove root */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - - /* a - * | - * c--b - * | - * d - */ - - nghttp2_stream_dep_remove(a); - - /* becomes: - * c b - * | - * d - */ - - CU_ASSERT(0 == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - - check_stream_dep_sib(a, NULL, NULL, NULL, NULL); - check_stream_dep_sib(b, root, NULL, c, NULL); - check_stream_dep_sib(c, root, d, NULL, b); - check_stream_dep_sib(d, c, NULL, NULL, NULL); - - CU_ASSERT(c == session->root.dep_next); - - nghttp2_session_del(session); - - /* Remove right most stream */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - - /* a - * | - * c--b - * | - * d - */ - - nghttp2_stream_dep_remove(b); - - /* becomes: - * a - * | - * c - * | - * d - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == a->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - - check_stream_dep_sib(a, root, c, NULL, NULL); - check_stream_dep_sib(b, NULL, NULL, NULL, NULL); - check_stream_dep_sib(c, a, d, NULL, NULL); - check_stream_dep_sib(d, c, NULL, NULL, NULL); - - CU_ASSERT(a == session->root.dep_next); - - nghttp2_session_del(session); - - /* Remove left most stream */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - e = open_stream_with_dep(session, 9, c); - - /* a - * | - * c--b - * | - * e--d - */ - - nghttp2_stream_dep_remove(c); - - /* becomes: - * a - * | - * e--d--b - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 2 == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - CU_ASSERT(0 == c->sum_dep_weight); - CU_ASSERT(0 == e->sum_dep_weight); - - check_stream_dep_sib(a, root, e, NULL, NULL); - check_stream_dep_sib(b, a, NULL, d, NULL); - check_stream_dep_sib(c, NULL, NULL, NULL, NULL); - check_stream_dep_sib(d, a, NULL, e, b); - check_stream_dep_sib(e, a, NULL, NULL, d); - - nghttp2_session_del(session); - - /* Remove middle stream */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, a); - e = open_stream_with_dep(session, 9, c); - f = open_stream_with_dep(session, 11, c); - - /* a - * | - * d--c--b - * | - * f--e - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 3 == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 2 == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - CU_ASSERT(0 == e->sum_dep_weight); - CU_ASSERT(0 == f->sum_dep_weight); - - nghttp2_stream_dep_remove(c); - - /* becomes: - * a - * | - * d--f--e--b - */ - - /* c's weight 16 is distributed evenly to e and f. Each weight of e - and f becomes 8. */ - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 2 + 8 * 2 == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(0 == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - CU_ASSERT(0 == e->sum_dep_weight); - CU_ASSERT(0 == f->sum_dep_weight); - - check_stream_dep_sib(a, root, d, NULL, NULL); - check_stream_dep_sib(b, a, NULL, e, NULL); - check_stream_dep_sib(c, NULL, NULL, NULL, NULL); - check_stream_dep_sib(e, a, NULL, f, b); - check_stream_dep_sib(f, a, NULL, d, e); - check_stream_dep_sib(d, a, NULL, NULL, f); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_stream_dep_add_subtree(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *a, *b, *c, *d, *e, *f, *root; - - memset(&callbacks, 0, sizeof(callbacks)); - - /* dep_stream has dep_next */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - - e = open_stream(session, 9); - f = open_stream_with_dep(session, 11, e); - - /* a e - * | | - * c--b f - * | - * d - */ - - nghttp2_stream_dep_remove_subtree(e); - nghttp2_stream_dep_add_subtree(a, e); - - /* becomes - * a - * | - * e--c--b - * | | - * f d - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 3 == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == e->sum_dep_weight); - CU_ASSERT(0 == f->sum_dep_weight); - - check_stream_dep_sib(a, root, e, NULL, NULL); - check_stream_dep_sib(b, a, NULL, c, NULL); - check_stream_dep_sib(c, a, d, e, b); - check_stream_dep_sib(d, c, NULL, NULL, NULL); - check_stream_dep_sib(e, a, f, NULL, c); - check_stream_dep_sib(f, e, NULL, NULL, NULL); - - nghttp2_session_del(session); - - /* dep_stream has dep_next and now we insert subtree */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - - e = open_stream(session, 9); - f = open_stream_with_dep(session, 11, e); - - /* a e - * | | - * c--b f - * | - * d - */ - - nghttp2_stream_dep_remove_subtree(e); - nghttp2_stream_dep_insert_subtree(a, e); - - /* becomes - * a - * | - * e - * | - * f--c--b - * | - * d - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 3 == e->sum_dep_weight); - CU_ASSERT(0 == f->sum_dep_weight); - - check_stream_dep_sib(a, root, e, NULL, NULL); - check_stream_dep_sib(e, a, f, NULL, NULL); - check_stream_dep_sib(f, e, NULL, NULL, c); - check_stream_dep_sib(b, e, NULL, c, NULL); - check_stream_dep_sib(c, e, d, f, b); - check_stream_dep_sib(d, c, NULL, NULL, NULL); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_stream_dep_remove_subtree(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *a, *b, *c, *d, *e, *root; - - memset(&callbacks, 0, sizeof(callbacks)); - - /* Remove left most stream */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - - /* a - * | - * c--b - * | - * d - */ - - nghttp2_stream_dep_remove_subtree(c); - - /* becomes - * a c - * | | - * b d - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - - check_stream_dep_sib(a, root, b, NULL, NULL); - check_stream_dep_sib(b, a, NULL, NULL, NULL); - check_stream_dep_sib(c, NULL, d, NULL, NULL); - check_stream_dep_sib(d, c, NULL, NULL, NULL); - - nghttp2_session_del(session); - - /* Remove right most stream */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - - /* a - * | - * c--b - * | - * d - */ - - nghttp2_stream_dep_remove_subtree(b); - - /* becomes - * a b - * | - * c - * | - * d - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - - check_stream_dep_sib(a, root, c, NULL, NULL); - check_stream_dep_sib(c, a, d, NULL, NULL); - check_stream_dep_sib(d, c, NULL, NULL, NULL); - check_stream_dep_sib(b, NULL, NULL, NULL, NULL); - - nghttp2_session_del(session); - - /* Remove middle stream */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - e = open_stream_with_dep(session, 9, a); - c = open_stream_with_dep(session, 5, a); - b = open_stream_with_dep(session, 3, a); - d = open_stream_with_dep(session, 7, c); - - /* a - * | - * b--c--e - * | - * d - */ - - nghttp2_stream_dep_remove_subtree(c); - - /* becomes - * a c - * | | - * b--e d - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 2 == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - CU_ASSERT(0 == e->sum_dep_weight); - - check_stream_dep_sib(a, root, b, NULL, NULL); - check_stream_dep_sib(b, a, NULL, NULL, e); - check_stream_dep_sib(e, a, NULL, b, NULL); - check_stream_dep_sib(c, NULL, d, NULL, NULL); - check_stream_dep_sib(d, c, NULL, NULL, NULL); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_stream_dep_all_your_stream_are_belong_to_us(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *a, *b, *c, *d, *root; - nghttp2_outbound_item *db, *dc; - nghttp2_mem *mem; - - mem = nghttp2_mem_default(); - - memset(&callbacks, 0, sizeof(callbacks)); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - - c = open_stream(session, 5); - - /* a c - * | - * b - */ - - nghttp2_stream_dep_remove_subtree(c); - CU_ASSERT(0 == nghttp2_stream_dep_insert_subtree(&session->root, c)); - - /* - * c - * | - * a - * | - * b - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == c->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - - CU_ASSERT(nghttp2_pq_empty(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - - check_stream_dep_sib(c, root, a, NULL, NULL); - check_stream_dep_sib(a, c, b, NULL, NULL); - check_stream_dep_sib(b, a, NULL, NULL, NULL); - - nghttp2_session_del(session); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream(session, 3); - c = open_stream(session, 5); - - /* - * a b c - */ - - nghttp2_stream_dep_remove_subtree(c); - CU_ASSERT(0 == nghttp2_stream_dep_insert_subtree(&session->root, c)); - - /* - * c - * | - * b--a - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 2 == c->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - CU_ASSERT(0 == a->sum_dep_weight); - - CU_ASSERT(nghttp2_pq_empty(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - - check_stream_dep_sib(c, root, b, NULL, NULL); - check_stream_dep_sib(b, c, NULL, NULL, a); - check_stream_dep_sib(a, c, NULL, b, NULL); - - nghttp2_session_del(session); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - - c = open_stream(session, 5); - d = open_stream_with_dep(session, 7, c); - - /* a c - * | | - * b d - */ - - nghttp2_stream_dep_remove_subtree(c); - CU_ASSERT(0 == nghttp2_stream_dep_insert_subtree(&session->root, c)); - - /* - * c - * | - * d--a - * | - * b - */ - - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT * 2 == c->sum_dep_weight); - CU_ASSERT(0 == d->sum_dep_weight); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == a->sum_dep_weight); - CU_ASSERT(0 == b->sum_dep_weight); - - CU_ASSERT(nghttp2_pq_empty(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - - check_stream_dep_sib(c, root, d, NULL, NULL); - check_stream_dep_sib(d, c, NULL, NULL, a); - check_stream_dep_sib(a, c, b, d, NULL); - check_stream_dep_sib(b, a, NULL, NULL, NULL); - - nghttp2_session_del(session); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - - c = open_stream(session, 5); - d = open_stream_with_dep(session, 7, c); - - /* a c - * | | - * b d - */ - - db = create_data_ob_item(mem); - - nghttp2_stream_attach_item(b, db); - - nghttp2_stream_dep_remove_subtree(c); - CU_ASSERT(0 == nghttp2_stream_dep_insert_subtree(&session->root, c)); - - /* - * c - * | - * d--a - * | - * b - */ - - CU_ASSERT(c->queued); - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(!d->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - - check_stream_dep_sib(c, root, d, NULL, NULL); - check_stream_dep_sib(d, c, NULL, NULL, a); - check_stream_dep_sib(a, c, b, d, NULL); - check_stream_dep_sib(b, a, NULL, NULL, NULL); - - nghttp2_session_del(session); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - root = &session->root; - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - - c = open_stream(session, 5); - d = open_stream_with_dep(session, 7, c); - - /* a c - * | | - * b d - */ - - db = create_data_ob_item(mem); - dc = create_data_ob_item(mem); - - nghttp2_stream_attach_item(b, db); - nghttp2_stream_attach_item(c, dc); - - nghttp2_stream_dep_remove_subtree(c); - CU_ASSERT(0 == nghttp2_stream_dep_insert_subtree(&session->root, c)); - - /* - * c - * | - * d--a - * | - * b - */ - - CU_ASSERT(c->queued); - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(!d->queued); - - check_stream_dep_sib(c, root, d, NULL, NULL); - check_stream_dep_sib(d, c, NULL, NULL, a); - check_stream_dep_sib(a, c, b, d, NULL); - check_stream_dep_sib(b, a, NULL, NULL, NULL); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_stream_attach_item(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *a, *b, *c, *d, *e; - nghttp2_outbound_item *da, *db, *dc, *dd; - nghttp2_mem *mem; - - mem = nghttp2_mem_default(); - - memset(&callbacks, 0, sizeof(callbacks)); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - - /* a - * | - * c--b - * | - * d - */ - - db = create_data_ob_item(mem); - - nghttp2_stream_attach_item(b, db); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(!c->queued); - CU_ASSERT(!d->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - - /* Attach item to c */ - dc = create_data_ob_item(mem); - - nghttp2_stream_attach_item(c, dc); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(!d->queued); - - CU_ASSERT(2 == nghttp2_pq_size(&a->obq)); - - /* Attach item to a */ - da = create_data_ob_item(mem); - - nghttp2_stream_attach_item(a, da); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(!d->queued); - - CU_ASSERT(2 == nghttp2_pq_size(&a->obq)); - - /* Detach item from a */ - nghttp2_stream_detach_item(a); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(!d->queued); - - CU_ASSERT(2 == nghttp2_pq_size(&a->obq)); - - /* Attach item to d */ - dd = create_data_ob_item(mem); - - nghttp2_stream_attach_item(d, dd); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - - CU_ASSERT(2 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - - /* Detach item from c */ - nghttp2_stream_detach_item(c); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - - CU_ASSERT(2 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - - /* Detach item from b */ - nghttp2_stream_detach_item(b); - - CU_ASSERT(a->queued); - CU_ASSERT(!b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - - /* exercises insertion */ - e = open_stream_with_dep_excl(session, 9, a); - - /* a - * | - * e - * | - * c--b - * | - * d - */ - - CU_ASSERT(a->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - - /* exercises deletion */ - nghttp2_stream_dep_remove(e); - - /* a - * | - * c--b - * | - * d - */ - - CU_ASSERT(a->queued); - CU_ASSERT(!b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - - /* e's weight 16 is distributed equally among c and b, both now have - weight 8 each. */ - CU_ASSERT(8 == b->weight); - CU_ASSERT(8 == c->weight); - - /* da, db, dc have been detached */ - nghttp2_outbound_item_free(da, mem); - nghttp2_outbound_item_free(db, mem); - nghttp2_outbound_item_free(dc, mem); - free(da); - free(db); - free(dc); - - nghttp2_session_del(session); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - - /* a - * | - * c--b - * | - * d - */ - - da = create_data_ob_item(mem); - db = create_data_ob_item(mem); - dc = create_data_ob_item(mem); - - nghttp2_stream_attach_item(a, da); - nghttp2_stream_attach_item(b, db); - nghttp2_stream_attach_item(c, dc); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(!d->queued); - - CU_ASSERT(2 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - - /* Detach item from a */ - nghttp2_stream_detach_item(a); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(!d->queued); - - CU_ASSERT(2 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - - /* da has been detached */ - nghttp2_outbound_item_free(da, mem); - free(da); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_stream_attach_item_subtree(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *a, *b, *c, *d, *e, *f; - nghttp2_outbound_item *da, *db, *dd, *de; - nghttp2_mem *mem; - - mem = nghttp2_mem_default(); - - memset(&callbacks, 0, sizeof(callbacks)); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - a = open_stream(session, 1); - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep(session, 5, a); - d = open_stream_with_dep(session, 7, c); - - e = open_stream_with_dep_weight(session, 9, 32, &session->root); - f = open_stream_with_dep(session, 11, e); - - /* - * a e - * | | - * c--b f - * | - * d - */ - - de = create_data_ob_item(mem); - - nghttp2_stream_attach_item(e, de); - - db = create_data_ob_item(mem); - - nghttp2_stream_attach_item(b, db); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(!c->queued); - CU_ASSERT(!d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(nghttp2_pq_empty(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - /* Insert subtree e under a */ - - nghttp2_stream_dep_remove_subtree(e); - nghttp2_stream_dep_insert_subtree(a, e); - - /* - * a - * | - * e - * | - * f--c--b - * | - * d - */ - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(!c->queued); - CU_ASSERT(!d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - /* Remove subtree b */ - - nghttp2_stream_dep_remove_subtree(b); - - CU_ASSERT(0 == nghttp2_stream_dep_add_subtree(&session->root, b)); - - /* - * a b - * | - * e - * | - * f--c - * | - * d - */ - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(!c->queued); - CU_ASSERT(!d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(nghttp2_pq_empty(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - /* Remove subtree a, and add it to root again */ - - nghttp2_stream_dep_remove_subtree(a); - - CU_ASSERT(0 == nghttp2_stream_dep_add_subtree(&session->root, a)); - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(!c->queued); - CU_ASSERT(!d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(nghttp2_pq_empty(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - /* Remove subtree c */ - - nghttp2_stream_dep_remove_subtree(c); - - CU_ASSERT(0 == nghttp2_stream_dep_add_subtree(&session->root, c)); - - /* - * a b c - * | | - * e d - * | - * f - */ - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(!c->queued); - CU_ASSERT(!d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(nghttp2_pq_empty(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(nghttp2_pq_empty(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - dd = create_data_ob_item(mem); - - nghttp2_stream_attach_item(d, dd); - - /* Add subtree c to a */ - - nghttp2_stream_dep_remove_subtree(c); - nghttp2_stream_dep_add_subtree(a, c); - - /* - * a b - * | - * c--e - * | | - * d f - */ - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(2 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(nghttp2_pq_empty(&b->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(nghttp2_pq_empty(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - /* Insert b under a */ - - nghttp2_stream_dep_remove_subtree(b); - nghttp2_stream_dep_insert_subtree(a, b); - - /* - * a - * | - * b - * | - * c--e - * | | - * d f - */ - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(1 == nghttp2_pq_size(&a->obq)); - CU_ASSERT(2 == nghttp2_pq_size(&b->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(nghttp2_pq_empty(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - /* Remove subtree b */ - - nghttp2_stream_dep_remove_subtree(b); - CU_ASSERT(0 == nghttp2_stream_dep_add_subtree(&session->root, b)); - - /* - * b a - * | - * e--c - * | | - * f d - */ - - CU_ASSERT(!a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(nghttp2_pq_empty(&a->obq)); - CU_ASSERT(2 == nghttp2_pq_size(&b->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(nghttp2_pq_empty(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - /* Remove subtree c, and detach item from b, and then re-add - subtree c under b */ - - nghttp2_stream_dep_remove_subtree(c); - nghttp2_stream_detach_item(b); - nghttp2_stream_dep_add_subtree(b, c); - - /* - * b a - * | - * e--c - * | | - * f d - */ - - CU_ASSERT(!a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(nghttp2_pq_empty(&a->obq)); - CU_ASSERT(2 == nghttp2_pq_size(&b->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(nghttp2_pq_empty(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - /* Attach data to a, and add subtree a under b */ - - da = create_data_ob_item(mem); - nghttp2_stream_attach_item(a, da); - nghttp2_stream_dep_remove_subtree(a); - nghttp2_stream_dep_add_subtree(b, a); - - /* - * b - * | - * a--e--c - * | | - * f d - */ - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(!f->queued); - - CU_ASSERT(nghttp2_pq_empty(&a->obq)); - CU_ASSERT(3 == nghttp2_pq_size(&b->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(nghttp2_pq_empty(&e->obq)); - CU_ASSERT(nghttp2_pq_empty(&f->obq)); - - /* Remove subtree c, and add under f */ - nghttp2_stream_dep_remove_subtree(c); - nghttp2_stream_dep_insert_subtree(f, c); - - /* - * b - * | - * a--e - * | - * f - * | - * c - * | - * d - */ - - CU_ASSERT(a->queued); - CU_ASSERT(b->queued); - CU_ASSERT(c->queued); - CU_ASSERT(d->queued); - CU_ASSERT(e->queued); - CU_ASSERT(f->queued); - - CU_ASSERT(nghttp2_pq_empty(&a->obq)); - CU_ASSERT(2 == nghttp2_pq_size(&b->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&c->obq)); - CU_ASSERT(nghttp2_pq_empty(&d->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&e->obq)); - CU_ASSERT(1 == nghttp2_pq_size(&f->obq)); - - /* db has been detached */ - nghttp2_outbound_item_free(db, mem); - free(db); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_stream_get_state(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_mem *mem; - nghttp2_hd_deflater deflater; - nghttp2_bufs bufs; - nghttp2_buf *buf; - nghttp2_stream *stream; - ssize_t rv; - nghttp2_data_provider data_prd; - nghttp2_frame frame; - - mem = nghttp2_mem_default(); - frame_pack_bufs_init(&bufs); - memset(&data_prd, 0, sizeof(data_prd)); - - memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); + callbacks.send_callback2 = null_send_callback; nghttp2_session_server_new(&session, &callbacks, NULL); nghttp2_hd_deflate_init(&deflater, mem); - CU_ASSERT(NGHTTP2_STREAM_STATE_IDLE == - nghttp2_stream_get_state(nghttp2_session_get_root_stream(session))); + assert_enum( + nghttp2_stream_proto_state, NGHTTP2_STREAM_STATE_IDLE, ==, + nghttp2_stream_get_state(nghttp2_session_get_root_stream(session))); /* stream 1 HEADERS; without END_STREAM flag set */ pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, reqnv, ARRLEN(reqnv), mem); buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); stream = nghttp2_session_find_stream(session, 1); - CU_ASSERT(NULL != stream); - CU_ASSERT(1 == stream->stream_id); - CU_ASSERT(NGHTTP2_STREAM_STATE_OPEN == nghttp2_stream_get_state(stream)); + assert_not_null(stream); + assert_int32(1, ==, stream->stream_id); + assert_enum(nghttp2_stream_proto_state, NGHTTP2_STREAM_STATE_OPEN, ==, + nghttp2_stream_get_state(stream)); nghttp2_bufs_reset(&bufs); @@ -9560,41 +8138,43 @@ void test_nghttp2_session_stream_get_state(void) { ARRLEN(reqnv), mem); buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); stream = nghttp2_session_find_stream(session, 3); - CU_ASSERT(NULL != stream); - CU_ASSERT(3 == stream->stream_id); - CU_ASSERT(NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE == - nghttp2_stream_get_state(stream)); + assert_not_null(stream); + assert_int32(3, ==, stream->stream_id); + assert_enum(nghttp2_stream_proto_state, + NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE, ==, + nghttp2_stream_get_state(stream)); nghttp2_bufs_reset(&bufs); /* Respond to stream 1 */ - nghttp2_submit_response(session, 1, resnv, ARRLEN(resnv), NULL); + nghttp2_submit_response2(session, 1, resnv, ARRLEN(resnv), NULL); rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); stream = nghttp2_session_find_stream(session, 1); - CU_ASSERT(NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL == - nghttp2_stream_get_state(stream)); + assert_enum(nghttp2_stream_proto_state, + NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL, ==, + nghttp2_stream_get_state(stream)); /* Respond to stream 3 */ - nghttp2_submit_response(session, 3, resnv, ARRLEN(resnv), NULL); + nghttp2_submit_response2(session, 3, resnv, ARRLEN(resnv), NULL); rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); stream = nghttp2_session_find_stream(session, 3); - CU_ASSERT(NGHTTP2_STREAM_STATE_CLOSED == nghttp2_stream_get_state(stream)); + assert_null(stream); /* stream 5 HEADERS; with END_STREAM flag set */ pack_headers(&bufs, &deflater, 5, @@ -9602,9 +8182,9 @@ void test_nghttp2_session_stream_get_state(void) { ARRLEN(reqnv), mem); buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); nghttp2_bufs_reset(&bufs); @@ -9612,415 +8192,136 @@ void test_nghttp2_session_stream_get_state(void) { rv = nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 5, reqnv, ARRLEN(reqnv), NULL); - CU_ASSERT(2 == rv); + assert_ptrdiff(2, ==, rv); rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); stream = nghttp2_session_find_stream(session, 2); - CU_ASSERT(NGHTTP2_STREAM_STATE_RESERVED_LOCAL == - nghttp2_stream_get_state(stream)); + assert_enum(nghttp2_stream_proto_state, NGHTTP2_STREAM_STATE_RESERVED_LOCAL, + ==, nghttp2_stream_get_state(stream)); /* Send response to push stream 2 with END_STREAM set */ - nghttp2_submit_response(session, 2, resnv, ARRLEN(resnv), NULL); - - rv = nghttp2_session_send(session); - - CU_ASSERT(0 == rv); - - stream = nghttp2_session_find_stream(session, 2); - - /* At server, pushed stream object is not retained after closed */ - CU_ASSERT(NULL == stream); - - /* Push stream 4 associated to stream 5 */ - rv = nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 5, reqnv, - ARRLEN(reqnv), NULL); - - CU_ASSERT(4 == rv); - - rv = nghttp2_session_send(session); - - CU_ASSERT(0 == rv); - - stream = nghttp2_session_find_stream(session, 4); - - CU_ASSERT(NGHTTP2_STREAM_STATE_RESERVED_LOCAL == - nghttp2_stream_get_state(stream)); - - /* Send response to push stream 4 without closing */ - data_prd.read_callback = defer_data_source_read_callback; - - nghttp2_submit_response(session, 4, resnv, ARRLEN(resnv), &data_prd); - - rv = nghttp2_session_send(session); - - CU_ASSERT(0 == rv); - - stream = nghttp2_session_find_stream(session, 4); - - CU_ASSERT(NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE == - nghttp2_stream_get_state(stream)); - - /* Create idle stream by PRIORITY frame */ - nghttp2_frame_priority_init(&frame.priority, 7, &pri_spec_default); - - nghttp2_frame_pack_priority(&bufs, &frame.priority); - - nghttp2_frame_priority_free(&frame.priority); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - - stream = nghttp2_session_find_stream(session, 7); - - CU_ASSERT(NGHTTP2_STREAM_STATE_IDLE == nghttp2_stream_get_state(stream)); - - nghttp2_bufs_reset(&bufs); - - nghttp2_hd_deflate_free(&deflater); - nghttp2_session_del(session); - - /* Test for client side */ - - nghttp2_session_client_new(&session, &callbacks, NULL); - nghttp2_hd_deflate_init(&deflater, mem); - - nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); + nghttp2_submit_response2(session, 2, resnv, ARRLEN(resnv), NULL); rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); - - /* Receive PUSH_PROMISE 2 associated to stream 1 */ - pack_push_promise(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, 2, reqnv, - ARRLEN(reqnv), mem); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - - stream = nghttp2_session_find_stream(session, 2); - - CU_ASSERT(NGHTTP2_STREAM_STATE_RESERVED_REMOTE == - nghttp2_stream_get_state(stream)); - - nghttp2_bufs_reset(&bufs); - - /* Receive push response for stream 2 without END_STREAM set */ - pack_headers(&bufs, &deflater, 2, NGHTTP2_FLAG_END_HEADERS, resnv, - ARRLEN(resnv), mem); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - - stream = nghttp2_session_find_stream(session, 2); - - CU_ASSERT(NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL == - nghttp2_stream_get_state(stream)); - - nghttp2_bufs_reset(&bufs); - - nghttp2_hd_deflate_free(&deflater); - nghttp2_session_del(session); - - nghttp2_bufs_free(&bufs); -} - -void test_nghttp2_session_stream_get_something(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *a, *b, *c; - - memset(&callbacks, 0, sizeof(callbacks)); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - a = open_stream(session, 1); - - CU_ASSERT(nghttp2_session_get_root_stream(session) == - nghttp2_stream_get_parent(a)); - CU_ASSERT(NULL == nghttp2_stream_get_previous_sibling(a)); - CU_ASSERT(NULL == nghttp2_stream_get_next_sibling(a)); - CU_ASSERT(NULL == nghttp2_stream_get_first_child(a)); - - b = open_stream_with_dep(session, 3, a); - c = open_stream_with_dep_weight(session, 5, 11, a); - - CU_ASSERT(a == nghttp2_stream_get_parent(c)); - CU_ASSERT(a == nghttp2_stream_get_parent(b)); - - CU_ASSERT(c == nghttp2_stream_get_first_child(a)); - - CU_ASSERT(b == nghttp2_stream_get_next_sibling(c)); - CU_ASSERT(c == nghttp2_stream_get_previous_sibling(b)); - - CU_ASSERT(27 == nghttp2_stream_get_sum_dependency_weight(a)); - - CU_ASSERT(11 == nghttp2_stream_get_weight(c)); - CU_ASSERT(5 == nghttp2_stream_get_stream_id(c)); - CU_ASSERT(0 == nghttp2_stream_get_stream_id(&session->root)); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_find_stream(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *stream; - - memset(&callbacks, 0, sizeof(callbacks)); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - open_recv_stream(session, 1); - - stream = nghttp2_session_find_stream(session, 1); - - CU_ASSERT(NULL != stream); - CU_ASSERT(1 == stream->stream_id); - - stream = nghttp2_session_find_stream(session, 0); - - CU_ASSERT(&session->root == stream); - CU_ASSERT(0 == stream->stream_id); + assert_ptrdiff(0, ==, rv); stream = nghttp2_session_find_stream(session, 2); - CU_ASSERT(NULL == stream); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_keep_closed_stream(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - const size_t max_concurrent_streams = 5; - nghttp2_settings_entry iv = {NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, - (uint32_t)max_concurrent_streams}; - size_t i; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = null_send_callback; - - nghttp2_session_server_new(&session, &callbacks, NULL); - - nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1); - - for (i = 0; i < max_concurrent_streams; ++i) { - open_recv_stream(session, (int32_t)i * 2 + 1); - } - - CU_ASSERT(0 == session->num_closed_streams); - - nghttp2_session_close_stream(session, 1, NGHTTP2_NO_ERROR); - - CU_ASSERT(1 == session->num_closed_streams); - CU_ASSERT(1 == session->closed_stream_tail->stream_id); - CU_ASSERT(session->closed_stream_tail == session->closed_stream_head); - - nghttp2_session_close_stream(session, 5, NGHTTP2_NO_ERROR); - - CU_ASSERT(2 == session->num_closed_streams); - CU_ASSERT(5 == session->closed_stream_tail->stream_id); - CU_ASSERT(1 == session->closed_stream_head->stream_id); - CU_ASSERT(session->closed_stream_head == - session->closed_stream_tail->closed_prev); - CU_ASSERT(NULL == session->closed_stream_tail->closed_next); - CU_ASSERT(session->closed_stream_tail == - session->closed_stream_head->closed_next); - CU_ASSERT(NULL == session->closed_stream_head->closed_prev); - - open_recv_stream(session, 11); - nghttp2_session_adjust_closed_stream(session); - - CU_ASSERT(1 == session->num_closed_streams); - CU_ASSERT(5 == session->closed_stream_tail->stream_id); - CU_ASSERT(session->closed_stream_tail == session->closed_stream_head); - CU_ASSERT(NULL == session->closed_stream_head->closed_prev); - CU_ASSERT(NULL == session->closed_stream_head->closed_next); - - open_recv_stream(session, 13); - nghttp2_session_adjust_closed_stream(session); - - CU_ASSERT(0 == session->num_closed_streams); - CU_ASSERT(NULL == session->closed_stream_tail); - CU_ASSERT(NULL == session->closed_stream_head); - - nghttp2_session_close_stream(session, 3, NGHTTP2_NO_ERROR); - - CU_ASSERT(1 == session->num_closed_streams); - CU_ASSERT(3 == session->closed_stream_head->stream_id); - - /* server initiated stream is not counted to max concurrent limit */ - open_sent_stream(session, 2); - nghttp2_session_adjust_closed_stream(session); - - CU_ASSERT(1 == session->num_closed_streams); - CU_ASSERT(3 == session->closed_stream_head->stream_id); - - nghttp2_session_close_stream(session, 2, NGHTTP2_NO_ERROR); - - CU_ASSERT(1 == session->num_closed_streams); - CU_ASSERT(3 == session->closed_stream_head->stream_id); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_keep_idle_stream(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - const size_t max_concurrent_streams = 1; - nghttp2_settings_entry iv = {NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, - (uint32_t)max_concurrent_streams}; - int i; - int32_t stream_id; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = null_send_callback; - - nghttp2_session_server_new(&session, &callbacks, NULL); - - nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1); - - /* We at least allow NGHTTP2_MIN_IDLE_STREAM idle streams even if - max concurrent streams is very low. */ - for (i = 0; i < NGHTTP2_MIN_IDLE_STREAMS; ++i) { - open_recv_stream2(session, i * 2 + 1, NGHTTP2_STREAM_IDLE); - nghttp2_session_adjust_idle_stream(session); - } - - CU_ASSERT(NGHTTP2_MIN_IDLE_STREAMS == session->num_idle_streams); - - stream_id = (NGHTTP2_MIN_IDLE_STREAMS - 1) * 2 + 1; - CU_ASSERT(1 == session->idle_stream_head->stream_id); - CU_ASSERT(stream_id == session->idle_stream_tail->stream_id); - - stream_id += 2; + /* At server, pushed stream object is not retained after closed */ + assert_null(stream); - open_recv_stream2(session, stream_id, NGHTTP2_STREAM_IDLE); - nghttp2_session_adjust_idle_stream(session); + /* Push stream 4 associated to stream 5 */ + rv = nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 5, reqnv, + ARRLEN(reqnv), NULL); - CU_ASSERT(NGHTTP2_MIN_IDLE_STREAMS == session->num_idle_streams); - CU_ASSERT(3 == session->idle_stream_head->stream_id); - CU_ASSERT(stream_id == session->idle_stream_tail->stream_id); + assert_ptrdiff(4, ==, rv); - nghttp2_session_del(session); -} + rv = nghttp2_session_send(session); -void test_nghttp2_session_detach_idle_stream(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - int i; - nghttp2_stream *stream; + assert_ptrdiff(0, ==, rv); - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = null_send_callback; + stream = nghttp2_session_find_stream(session, 4); - nghttp2_session_server_new(&session, &callbacks, NULL); + assert_enum(nghttp2_stream_proto_state, NGHTTP2_STREAM_STATE_RESERVED_LOCAL, + ==, nghttp2_stream_get_state(stream)); - for (i = 1; i <= 3; ++i) { - nghttp2_session_open_stream(session, i, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec_default, NGHTTP2_STREAM_IDLE, NULL); - } + /* Send response to push stream 4 without closing */ + data_prd.read_callback = defer_data_source_read_callback; - CU_ASSERT(3 == session->num_idle_streams); + nghttp2_submit_response2(session, 4, resnv, ARRLEN(resnv), &data_prd); - /* Detach middle stream */ - stream = nghttp2_session_get_stream_raw(session, 2); + rv = nghttp2_session_send(session); - CU_ASSERT(session->idle_stream_head == stream->closed_prev); - CU_ASSERT(session->idle_stream_tail == stream->closed_next); - CU_ASSERT(stream == session->idle_stream_head->closed_next); - CU_ASSERT(stream == session->idle_stream_tail->closed_prev); + assert_ptrdiff(0, ==, rv); - nghttp2_session_detach_idle_stream(session, stream); + stream = nghttp2_session_find_stream(session, 4); - CU_ASSERT(2 == session->num_idle_streams); + assert_enum(nghttp2_stream_proto_state, + NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE, ==, + nghttp2_stream_get_state(stream)); - CU_ASSERT(NULL == stream->closed_prev); - CU_ASSERT(NULL == stream->closed_next); + nghttp2_hd_deflate_free(&deflater); + nghttp2_session_del(session); - CU_ASSERT(session->idle_stream_head == - session->idle_stream_tail->closed_prev); - CU_ASSERT(session->idle_stream_tail == - session->idle_stream_head->closed_next); + /* Test for client side */ - /* Detach head stream */ - stream = session->idle_stream_head; + nghttp2_session_client_new(&session, &callbacks, NULL); + nghttp2_hd_deflate_init(&deflater, mem); - nghttp2_session_detach_idle_stream(session, stream); + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); - CU_ASSERT(1 == session->num_idle_streams); + rv = nghttp2_session_send(session); - CU_ASSERT(session->idle_stream_head == session->idle_stream_tail); - CU_ASSERT(NULL == session->idle_stream_head->closed_prev); - CU_ASSERT(NULL == session->idle_stream_head->closed_next); + assert_ptrdiff(0, ==, rv); - /* Detach last stream */ + /* Receive PUSH_PROMISE 2 associated to stream 1 */ + pack_push_promise(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, 2, reqnv, + ARRLEN(reqnv), mem); - stream = session->idle_stream_head; + buf = &bufs.head->buf; + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - nghttp2_session_detach_idle_stream(session, stream); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); - CU_ASSERT(0 == session->num_idle_streams); + stream = nghttp2_session_find_stream(session, 2); - CU_ASSERT(NULL == session->idle_stream_head); - CU_ASSERT(NULL == session->idle_stream_tail); + assert_enum(nghttp2_stream_proto_state, NGHTTP2_STREAM_STATE_RESERVED_REMOTE, + ==, nghttp2_stream_get_state(stream)); - for (i = 4; i <= 5; ++i) { - nghttp2_session_open_stream(session, i, NGHTTP2_STREAM_FLAG_NONE, - &pri_spec_default, NGHTTP2_STREAM_IDLE, NULL); - } + nghttp2_bufs_reset(&bufs); - CU_ASSERT(2 == session->num_idle_streams); + /* Receive push response for stream 2 without END_STREAM set */ + pack_headers(&bufs, &deflater, 2, NGHTTP2_FLAG_END_HEADERS, resnv, + ARRLEN(resnv), mem); - /* Detach tail stream */ + buf = &bufs.head->buf; + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - stream = session->idle_stream_tail; + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); - nghttp2_session_detach_idle_stream(session, stream); + stream = nghttp2_session_find_stream(session, 2); - CU_ASSERT(1 == session->num_idle_streams); + assert_enum(nghttp2_stream_proto_state, + NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL, ==, + nghttp2_stream_get_state(stream)); - CU_ASSERT(session->idle_stream_head == session->idle_stream_tail); - CU_ASSERT(NULL == session->idle_stream_head->closed_prev); - CU_ASSERT(NULL == session->idle_stream_head->closed_next); + nghttp2_bufs_reset(&bufs); + nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); + + nghttp2_bufs_free(&bufs); } -void test_nghttp2_session_large_dep_tree(void) { +void test_nghttp2_session_find_stream(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - size_t i; - nghttp2_stream *dep_stream = NULL; nghttp2_stream *stream; - int32_t stream_id; memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = null_send_callback; nghttp2_session_server_new(&session, &callbacks, NULL); - stream_id = 1; - for (i = 0; i < 250; ++i, stream_id += 2) { - dep_stream = open_stream_with_dep(session, stream_id, dep_stream); - } + open_recv_stream(session, 1); - stream_id = 1; - for (i = 0; i < 250; ++i, stream_id += 2) { - stream = nghttp2_session_get_stream(session, stream_id); - CU_ASSERT(nghttp2_stream_dep_find_ancestor(stream, &session->root)); - CU_ASSERT(nghttp2_stream_in_dep_tree(stream)); - } + stream = nghttp2_session_find_stream(session, 1); + + assert_not_null(stream); + assert_int32(1, ==, stream->stream_id); + + stream = nghttp2_session_find_stream(session, 0); + + assert_not_null(stream); + assert_int32(0, ==, stream->stream_id); + + stream = nghttp2_session_find_stream(session, 2); + + assert_null(stream); nghttp2_session_del(session); } @@ -10031,7 +8332,7 @@ void test_nghttp2_session_graceful_shutdown(void) { my_user_data ud; memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; callbacks.on_stream_close_callback = on_stream_close_callback; @@ -10043,44 +8344,45 @@ void test_nghttp2_session_graceful_shutdown(void) { open_recv_stream(session, 311); open_recv_stream(session, 319); - CU_ASSERT(0 == nghttp2_submit_shutdown_notice(session)); + assert_int(0, ==, nghttp2_submit_shutdown_notice(session)); ud.frame_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT((1u << 31) - 1 == session->local_last_stream_id); + assert_int(1, ==, ud.frame_send_cb_called); + assert_int32((1u << 31) - 1, ==, session->local_last_stream_id); - CU_ASSERT(0 == nghttp2_submit_goaway(session, NGHTTP2_FLAG_NONE, 311, - NGHTTP2_NO_ERROR, NULL, 0)); + assert_int(0, ==, + nghttp2_submit_goaway(session, NGHTTP2_FLAG_NONE, 311, + NGHTTP2_NO_ERROR, NULL, 0)); ud.frame_send_cb_called = 0; ud.stream_close_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(311 == session->local_last_stream_id); - CU_ASSERT(1 == ud.stream_close_cb_called); + assert_int(1, ==, ud.frame_send_cb_called); + assert_int32(311, ==, session->local_last_stream_id); + assert_int(1, ==, ud.stream_close_cb_called); - CU_ASSERT(0 == - nghttp2_session_terminate_session2(session, 301, NGHTTP2_NO_ERROR)); + assert_int( + 0, ==, nghttp2_session_terminate_session2(session, 301, NGHTTP2_NO_ERROR)); ud.frame_send_cb_called = 0; ud.stream_close_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(301 == session->local_last_stream_id); - CU_ASSERT(2 == ud.stream_close_cb_called); + assert_int(1, ==, ud.frame_send_cb_called); + assert_int32(301, ==, session->local_last_stream_id); + assert_int(2, ==, ud.stream_close_cb_called); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 301)); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 302)); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 309)); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 311)); - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 319)); + assert_not_null(nghttp2_session_get_stream(session, 301)); + assert_not_null(nghttp2_session_get_stream(session, 302)); + assert_null(nghttp2_session_get_stream(session, 309)); + assert_null(nghttp2_session_get_stream(session, 311)); + assert_null(nghttp2_session_get_stream(session, 319)); nghttp2_session_del(session); } @@ -10095,7 +8397,7 @@ void test_nghttp2_session_on_header_temporal_failure(void) { nghttp2_nv nv[] = {MAKE_NV("alpha", "bravo"), MAKE_NV("charlie", "delta")}; nghttp2_nv *nva; size_t hdpos; - ssize_t rv; + nghttp2_ssize rv; nghttp2_frame frame; nghttp2_frame_hd hd; nghttp2_outbound_item *item; @@ -10134,18 +8436,18 @@ void test_nghttp2_session_on_header_temporal_failure(void) { nghttp2_frame_pack_frame_hd(&buf->pos[hdpos], &hd); ud.header_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_bufs_len(&bufs)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(1 == ud.header_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(1, ==, ud.header_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(1 == item->frame.hd.stream_id); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int32(1, ==, item->frame.hd.stream_id); /* Make sure no header decompression error occurred */ - CU_ASSERT(NGHTTP2_GOAWAY_NONE == session->goaway_flags); + assert_uint8(NGHTTP2_GOAWAY_NONE, ==, session->goaway_flags); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -10160,18 +8462,18 @@ void test_nghttp2_session_on_header_temporal_failure(void) { rv = pack_push_promise(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, 2, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud.header_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(1 == ud.header_cb_called); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(1, ==, ud.header_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(2 == item->frame.hd.stream_id); - CU_ASSERT(NGHTTP2_INTERNAL_ERROR == item->frame.rst_stream.error_code); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int32(2, ==, item->frame.hd.stream_id); + assert_uint32(NGHTTP2_INTERNAL_ERROR, ==, item->frame.rst_stream.error_code); nghttp2_session_del(session); nghttp2_hd_deflate_free(&deflater); @@ -10181,7 +8483,7 @@ void test_nghttp2_session_on_header_temporal_failure(void) { void test_nghttp2_session_recv_client_magic(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - ssize_t rv; + nghttp2_ssize rv; nghttp2_frame ping_frame; uint8_t buf[16]; @@ -10193,21 +8495,23 @@ void test_nghttp2_session_recv_client_magic(void) { /* Check success case */ nghttp2_session_server_new(&session, &callbacks, NULL); - rv = nghttp2_session_mem_recv(session, (const uint8_t *)NGHTTP2_CLIENT_MAGIC, - NGHTTP2_CLIENT_MAGIC_LEN); + rv = nghttp2_session_mem_recv2(session, (const uint8_t *)NGHTTP2_CLIENT_MAGIC, + NGHTTP2_CLIENT_MAGIC_LEN); - CU_ASSERT(rv == NGHTTP2_CLIENT_MAGIC_LEN); - CU_ASSERT(NGHTTP2_IB_READ_FIRST_SETTINGS == session->iframe.state); + assert_ptrdiff(NGHTTP2_CLIENT_MAGIC_LEN, ==, rv); + assert_enum(nghttp2_inbound_state, NGHTTP2_IB_READ_FIRST_SETTINGS, ==, + session->iframe.state); /* Receiving PING is error because we want SETTINGS. */ nghttp2_frame_ping_init(&ping_frame.ping, NGHTTP2_FLAG_NONE, NULL); nghttp2_frame_pack_frame_hd(buf, &ping_frame.ping.hd); - rv = nghttp2_session_mem_recv(session, buf, NGHTTP2_FRAME_HDLEN); - CU_ASSERT(NGHTTP2_FRAME_HDLEN == rv); - CU_ASSERT(NGHTTP2_IB_IGN_ALL == session->iframe.state); - CU_ASSERT(0 == session->iframe.payloadleft); + rv = nghttp2_session_mem_recv2(session, buf, NGHTTP2_FRAME_HDLEN); + assert_ptrdiff(NGHTTP2_FRAME_HDLEN, ==, rv); + assert_enum(nghttp2_inbound_state, NGHTTP2_IB_IGN_ALL, ==, + session->iframe.state); + assert_size(0, ==, session->iframe.payloadleft); nghttp2_frame_ping_free(&ping_frame.ping); @@ -10217,16 +8521,17 @@ void test_nghttp2_session_recv_client_magic(void) { nghttp2_session_server_new(&session, &callbacks, NULL); /* Feed magic with one byte less */ - rv = nghttp2_session_mem_recv(session, (const uint8_t *)NGHTTP2_CLIENT_MAGIC, - NGHTTP2_CLIENT_MAGIC_LEN - 1); + rv = nghttp2_session_mem_recv2(session, (const uint8_t *)NGHTTP2_CLIENT_MAGIC, + NGHTTP2_CLIENT_MAGIC_LEN - 1); - CU_ASSERT(rv == NGHTTP2_CLIENT_MAGIC_LEN - 1); - CU_ASSERT(NGHTTP2_IB_READ_CLIENT_MAGIC == session->iframe.state); - CU_ASSERT(1 == session->iframe.payloadleft); + assert_ptrdiff(NGHTTP2_CLIENT_MAGIC_LEN - 1, ==, rv); + assert_enum(nghttp2_inbound_state, NGHTTP2_IB_READ_CLIENT_MAGIC, ==, + session->iframe.state); + assert_size(1, ==, session->iframe.payloadleft); - rv = nghttp2_session_mem_recv(session, (const uint8_t *)"\0", 1); + rv = nghttp2_session_mem_recv2(session, (const uint8_t *)"\0", 1); - CU_ASSERT(NGHTTP2_ERR_BAD_CLIENT_MAGIC == rv); + assert_ptrdiff(NGHTTP2_ERR_BAD_CLIENT_MAGIC, ==, rv); nghttp2_session_del(session); @@ -10237,22 +8542,21 @@ void test_nghttp2_session_recv_client_magic(void) { void test_nghttp2_session_delete_data_item(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_stream *a; - nghttp2_data_provider prd; + nghttp2_data_provider2 prd; memset(&callbacks, 0, sizeof(callbacks)); nghttp2_session_server_new(&session, &callbacks, NULL); - a = open_recv_stream(session, 1); - open_recv_stream_with_dep(session, 3, a); + open_recv_stream(session, 1); + open_recv_stream(session, 3); /* We don't care about these members, since we won't send data */ prd.source.ptr = NULL; prd.read_callback = fail_data_source_read_callback; - CU_ASSERT(0 == nghttp2_submit_data(session, NGHTTP2_FLAG_NONE, 1, &prd)); - CU_ASSERT(0 == nghttp2_submit_data(session, NGHTTP2_FLAG_NONE, 3, &prd)); + assert_int(0, ==, nghttp2_submit_data2(session, NGHTTP2_FLAG_NONE, 1, &prd)); + assert_int(0, ==, nghttp2_submit_data2(session, NGHTTP2_FLAG_NONE, 3, &prd)); nghttp2_session_del(session); } @@ -10262,35 +8566,61 @@ void test_nghttp2_session_open_idle_stream(void) { nghttp2_session_callbacks callbacks; nghttp2_stream *stream; nghttp2_stream *opened_stream; - nghttp2_priority_spec pri_spec; nghttp2_frame frame; + nghttp2_ext_priority_update priority_update; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); nghttp2_session_server_new(&session, &callbacks, NULL); - nghttp2_priority_spec_init(&pri_spec, 0, 3, 0); + frame.ext.payload = &priority_update; + + nghttp2_frame_priority_update_init(&frame.ext, 1, (uint8_t *)"u=3", + strlen("u=3")); - nghttp2_frame_priority_init(&frame.priority, 1, &pri_spec); + assert_int(0, ==, + nghttp2_session_on_priority_update_received(session, &frame)); + + stream = nghttp2_session_get_stream_raw(session, 1); - CU_ASSERT(0 == nghttp2_session_on_priority_received(session, &frame)); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_IDLE, ==, stream->state); + assert_null(stream->closed_next); + assert_size(1, ==, session->num_idle_streams); + + opened_stream = open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); + + assert_ptr_equal(stream, opened_stream); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENING, ==, stream->state); + assert_size(0, ==, session->num_idle_streams); + + nghttp2_frame_priority_free(&frame.priority); + + nghttp2_session_del(session); + + /* No RFC 7540 priorities */ + nghttp2_session_server_new(&session, &callbacks, NULL); + + session->pending_no_rfc7540_priorities = 1; + + frame.ext.payload = &priority_update; + + nghttp2_frame_priority_update_init(&frame.ext, 1, (uint8_t *)"u=3", + strlen("u=3")); + + assert_int(0, ==, + nghttp2_session_on_priority_update_received(session, &frame)); stream = nghttp2_session_get_stream_raw(session, 1); - CU_ASSERT(NGHTTP2_STREAM_IDLE == stream->state); - CU_ASSERT(NULL == stream->closed_prev); - CU_ASSERT(NULL == stream->closed_next); - CU_ASSERT(1 == session->num_idle_streams); - CU_ASSERT(session->idle_stream_head == stream); - CU_ASSERT(session->idle_stream_tail == stream); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_IDLE, ==, stream->state); + assert_null(stream->closed_next); + assert_size(1, ==, session->num_idle_streams); opened_stream = open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); - CU_ASSERT(stream == opened_stream); - CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state); - CU_ASSERT(0 == session->num_idle_streams); - CU_ASSERT(NULL == session->idle_stream_head); - CU_ASSERT(NULL == session->idle_stream_tail); + assert_ptr_equal(stream, opened_stream); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_OPENING, ==, stream->state); + assert_size(0, ==, session->num_idle_streams); nghttp2_frame_priority_free(&frame.priority); @@ -10307,13 +8637,13 @@ void test_nghttp2_session_cancel_reserved_remote(void) { nghttp2_hd_deflater deflater; nghttp2_mem *mem; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; mem = nghttp2_mem_default(); frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); @@ -10323,9 +8653,9 @@ void test_nghttp2_session_cancel_reserved_remote(void) { nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, 2, NGHTTP2_CANCEL); - CU_ASSERT(NGHTTP2_STREAM_CLOSING == stream->state); + assert_enum(nghttp2_stream_state, NGHTTP2_STREAM_CLOSING, ==, stream->state); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nvlen = ARRLEN(resnv); nghttp2_nv_array_copy(&nva, resnv, nvlen, mem); @@ -10334,19 +8664,19 @@ void test_nghttp2_session_cancel_reserved_remote(void) { NGHTTP2_HCAT_PUSH_RESPONSE, NULL, nva, nvlen); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); /* stream is not dangling, so assign NULL */ stream = NULL; /* No RST_STREAM or GOAWAY is generated since stream should be in NGHTTP2_STREAM_CLOSING and push response should be ignored. */ - CU_ASSERT(0 == nghttp2_outbound_queue_size(&session->ob_reg)); + assert_size(0, ==, nghttp2_outbound_queue_size(&session->ob_reg)); /* Check that we can receive push response HEADERS while RST_STREAM is just queued. */ @@ -10359,14 +8689,14 @@ void test_nghttp2_session_cancel_reserved_remote(void) { frame.hd.stream_id = 4; rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT(1 == nghttp2_outbound_queue_size(&session->ob_reg)); + assert_size(1, ==, nghttp2_outbound_queue_size(&session->ob_reg)); nghttp2_frame_headers_free(&frame.headers, mem); @@ -10385,15 +8715,15 @@ void test_nghttp2_session_reset_pending_headers(void) { my_user_data ud; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; callbacks.on_frame_not_send_callback = on_frame_not_send_callback; callbacks.on_stream_close_callback = on_stream_close_callback; nghttp2_session_client_new(&session, &callbacks, &ud); - stream_id = nghttp2_submit_request(session, NULL, NULL, 0, NULL, NULL); - CU_ASSERT(stream_id >= 1); + stream_id = nghttp2_submit_request2(session, NULL, NULL, 0, NULL, NULL); + assert_int32(1, <=, stream_id); nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, stream_id, NGHTTP2_CANCEL); @@ -10402,13 +8732,13 @@ void test_nghttp2_session_reset_pending_headers(void) { /* RST_STREAM cancels pending HEADERS and is not actually sent. */ ud.frame_send_cb_called = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(0 == ud.frame_send_cb_called); + assert_int(0, ==, ud.frame_send_cb_called); stream = nghttp2_session_get_stream(session, stream_id); - CU_ASSERT(NULL == stream); + assert_null(stream); /* See HEADERS is not sent. on_stream_close is called just like transmission failure. */ @@ -10416,15 +8746,15 @@ void test_nghttp2_session_reset_pending_headers(void) { ud.frame_not_send_cb_called = 0; ud.stream_close_error_code = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_not_send_cb_called); - CU_ASSERT(NGHTTP2_HEADERS == ud.not_sent_frame_type); - CU_ASSERT(NGHTTP2_CANCEL == ud.stream_close_error_code); + assert_int(1, ==, ud.frame_not_send_cb_called); + assert_uint8(NGHTTP2_HEADERS, ==, ud.not_sent_frame_type); + assert_uint32(NGHTTP2_CANCEL, ==, ud.stream_close_error_code); stream = nghttp2_session_get_stream(session, stream_id); - CU_ASSERT(NULL == stream); + assert_null(stream); nghttp2_session_del(session); } @@ -10432,13 +8762,13 @@ void test_nghttp2_session_reset_pending_headers(void) { void test_nghttp2_session_send_data_callback(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; accumulator acc; nghttp2_frame_hd hd; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = accumulator_send_callback; + callbacks.send_callback2 = accumulator_send_callback; callbacks.send_data_callback = send_data_callback; data_prd.read_callback = no_copy_data_source_read_callback; @@ -10452,23 +8782,24 @@ void test_nghttp2_session_send_data_callback(void) { open_sent_stream(session, 1); - nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd); + nghttp2_submit_data2(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); - CU_ASSERT((NGHTTP2_FRAME_HDLEN + NGHTTP2_DATA_PAYLOADLEN) * 2 == acc.length); + assert_size((NGHTTP2_FRAME_HDLEN + NGHTTP2_DATA_PAYLOADLEN) * 2, ==, + acc.length); nghttp2_frame_unpack_frame_hd(&hd, acc.buf); - CU_ASSERT(16384 == hd.length); - CU_ASSERT(NGHTTP2_DATA == hd.type); - CU_ASSERT(NGHTTP2_FLAG_NONE == hd.flags); + assert_size(16384, ==, hd.length); + assert_uint8(NGHTTP2_DATA, ==, hd.type); + assert_uint8(NGHTTP2_FLAG_NONE, ==, hd.flags); nghttp2_frame_unpack_frame_hd(&hd, acc.buf + NGHTTP2_FRAME_HDLEN + hd.length); - CU_ASSERT(16384 == hd.length); - CU_ASSERT(NGHTTP2_DATA == hd.type); - CU_ASSERT(NGHTTP2_FLAG_END_STREAM == hd.flags); + assert_size(16384, ==, hd.length); + assert_uint8(NGHTTP2_DATA, ==, hd.type); + assert_uint8(NGHTTP2_FLAG_END_STREAM, ==, hd.flags); nghttp2_session_del(session); } @@ -10479,7 +8810,7 @@ void test_nghttp2_session_on_begin_headers_temporal_failure(void) { my_user_data ud; nghttp2_bufs bufs; nghttp2_mem *mem; - ssize_t rv; + nghttp2_ssize rv; nghttp2_hd_deflater deflater; nghttp2_outbound_item *item; @@ -10489,28 +8820,28 @@ void test_nghttp2_session_on_begin_headers_temporal_failure(void) { memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); callbacks.on_begin_headers_callback = - temporal_failure_on_begin_headers_callback; + temporal_failure_on_begin_headers_callback; callbacks.on_header_callback = on_header_callback; callbacks.on_frame_recv_callback = on_frame_recv_callback; - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_server_new(&session, &callbacks, &ud); rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud.header_cb_called = 0; ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(0 == ud.header_cb_called); - CU_ASSERT(0 == ud.frame_recv_cb_called); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(0, ==, ud.header_cb_called); + assert_int(0, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(1 == item->frame.hd.stream_id); - CU_ASSERT(NGHTTP2_INTERNAL_ERROR == item->frame.rst_stream.error_code); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int32(1, ==, item->frame.hd.stream_id); + assert_uint32(NGHTTP2_INTERNAL_ERROR, ==, item->frame.rst_stream.error_code); nghttp2_session_del(session); nghttp2_hd_deflate_free(&deflater); @@ -10524,20 +8855,20 @@ void test_nghttp2_session_on_begin_headers_temporal_failure(void) { rv = pack_push_promise(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, 2, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud.header_cb_called = 0; ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == rv); - CU_ASSERT(0 == ud.header_cb_called); - CU_ASSERT(0 == ud.frame_recv_cb_called); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, rv); + assert_int(0, ==, ud.header_cb_called); + assert_int(0, ==, ud.frame_recv_cb_called); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(2 == item->frame.hd.stream_id); - CU_ASSERT(NGHTTP2_INTERNAL_ERROR == item->frame.rst_stream.error_code); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int32(2, ==, item->frame.hd.stream_id); + assert_uint32(NGHTTP2_INTERNAL_ERROR, ==, item->frame.rst_stream.error_code); nghttp2_session_del(session); nghttp2_hd_deflate_free(&deflater); @@ -10547,38 +8878,38 @@ void test_nghttp2_session_on_begin_headers_temporal_failure(void) { void test_nghttp2_session_defer_then_close(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider prd; + nghttp2_data_provider2 prd; int rv; const uint8_t *datap; - ssize_t datalen; + nghttp2_ssize datalen; nghttp2_frame frame; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); prd.read_callback = defer_data_source_read_callback; - rv = nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), &prd, NULL); - CU_ASSERT(rv > 0); + rv = nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), &prd, NULL); + assert_ptrdiff(0, <, rv); /* This sends HEADERS */ - datalen = nghttp2_session_mem_send(session, &datap); + datalen = nghttp2_session_mem_send2(session, &datap); - CU_ASSERT(datalen > 0); + assert_ptrdiff(0, <, datalen); /* This makes DATA item deferred */ - datalen = nghttp2_session_mem_send(session, &datap); + datalen = nghttp2_session_mem_send2(session, &datap); - CU_ASSERT(datalen == 0); + assert_ptrdiff(0, ==, datalen); nghttp2_frame_rst_stream_init(&frame.rst_stream, 1, NGHTTP2_CANCEL); /* Assertion failure; GH-264 */ rv = nghttp2_session_on_rst_stream_received(session, &frame); - CU_ASSERT(rv == 0); + assert_int(0, ==, rv); nghttp2_session_del(session); } @@ -10587,7 +8918,7 @@ static int submit_response_on_stream_close(nghttp2_session *session, int32_t stream_id, uint32_t error_code, void *user_data) { - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; (void)error_code; (void)user_data; @@ -10596,12 +8927,14 @@ static int submit_response_on_stream_close(nghttp2_session *session, // Attempt to submit response or data to the stream being closed switch (stream_id) { case 1: - CU_ASSERT(0 == nghttp2_submit_response(session, stream_id, resnv, - ARRLEN(resnv), &data_prd)); + assert_int(0, ==, + nghttp2_submit_response2(session, stream_id, resnv, + ARRLEN(resnv), &data_prd)); break; case 3: - CU_ASSERT(0 == nghttp2_submit_data(session, NGHTTP2_FLAG_NONE, stream_id, - &data_prd)); + assert_int( + 0, ==, + nghttp2_submit_data2(session, NGHTTP2_FLAG_NONE, stream_id, &data_prd)); break; } @@ -10614,7 +8947,7 @@ void test_nghttp2_session_detach_item_from_closed_stream(void) { memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_stream_close_callback = submit_response_on_stream_close; nghttp2_session_server_new(&session, &callbacks, NULL); @@ -10625,463 +8958,169 @@ void test_nghttp2_session_detach_item_from_closed_stream(void) { nghttp2_session_close_stream(session, 1, NGHTTP2_NO_ERROR); nghttp2_session_close_stream(session, 3, NGHTTP2_NO_ERROR); - CU_ASSERT(0 == nghttp2_session_send(session)); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_flooding(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_bufs bufs; - nghttp2_buf *buf; - nghttp2_frame frame; - nghttp2_mem *mem; - size_t i; - - mem = nghttp2_mem_default(); - - frame_pack_bufs_init(&bufs); - - memset(&callbacks, 0, sizeof(callbacks)); - - /* PING ACK */ - nghttp2_session_server_new(&session, &callbacks, NULL); - - nghttp2_frame_ping_init(&frame.ping, NGHTTP2_FLAG_NONE, NULL); - nghttp2_frame_pack_ping(&bufs, &frame.ping); - nghttp2_frame_ping_free(&frame.ping); - - buf = &bufs.head->buf; - - for (i = 0; i < NGHTTP2_DEFAULT_MAX_OBQ_FLOOD_ITEM; ++i) { - CU_ASSERT( - (ssize_t)nghttp2_buf_len(buf) == - nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf))); - } - - CU_ASSERT(NGHTTP2_ERR_FLOODED == - nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf))); - - nghttp2_session_del(session); - - /* SETTINGS ACK */ - nghttp2_bufs_reset(&bufs); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, NULL, 0); - nghttp2_frame_pack_settings(&bufs, &frame.settings); - nghttp2_frame_settings_free(&frame.settings, mem); - - buf = &bufs.head->buf; - - for (i = 0; i < NGHTTP2_DEFAULT_MAX_OBQ_FLOOD_ITEM; ++i) { - CU_ASSERT( - (ssize_t)nghttp2_buf_len(buf) == - nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf))); - } - - CU_ASSERT(NGHTTP2_ERR_FLOODED == - nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf))); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_session_del(session); - nghttp2_bufs_free(&bufs); -} - -void test_nghttp2_session_change_stream_priority(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *stream1, *stream2, *stream3, *stream5; - nghttp2_priority_spec pri_spec; - int rv; - - memset(&callbacks, 0, sizeof(callbacks)); + /* No RFC 7540 priorities */ nghttp2_session_server_new(&session, &callbacks, NULL); - stream1 = open_recv_stream(session, 1); - stream3 = open_recv_stream_with_dep_weight(session, 3, 199, stream1); - stream2 = open_sent_stream_with_dep_weight(session, 2, 101, stream3); - - nghttp2_priority_spec_init(&pri_spec, 1, 256, 0); - - rv = nghttp2_session_change_stream_priority(session, 2, &pri_spec); - - CU_ASSERT(0 == rv); - - CU_ASSERT(stream1 == stream2->dep_prev); - CU_ASSERT(256 == stream2->weight); - - /* Cannot change stream which does not exist */ - rv = nghttp2_session_change_stream_priority(session, 5, &pri_spec); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); - - /* It is an error to depend on itself */ - rv = nghttp2_session_change_stream_priority(session, 1, &pri_spec); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); - - /* It is an error to change priority of root stream (0) */ - rv = nghttp2_session_change_stream_priority(session, 0, &pri_spec); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); - - /* Depends on the non-existing idle stream. This creates that idle - stream. */ - nghttp2_priority_spec_init(&pri_spec, 5, 9, 1); - - rv = nghttp2_session_change_stream_priority(session, 2, &pri_spec); - - CU_ASSERT(0 == rv); - - stream5 = nghttp2_session_get_stream_raw(session, 5); - - CU_ASSERT(NULL != stream5); - CU_ASSERT(&session->root == stream5->dep_prev); - CU_ASSERT(stream5 == stream2->dep_prev); - CU_ASSERT(9 == stream2->weight); - - nghttp2_session_del(session); - - /* Check that this works in client session too */ - nghttp2_session_client_new(&session, &callbacks, NULL); - - stream1 = open_sent_stream(session, 1); - - nghttp2_priority_spec_init(&pri_spec, 5, 9, 1); - - rv = nghttp2_session_change_stream_priority(session, 1, &pri_spec); - - CU_ASSERT(0 == rv); - - stream5 = nghttp2_session_get_stream_raw(session, 5); - - CU_ASSERT(NULL != stream5); - CU_ASSERT(&session->root == stream5->dep_prev); - CU_ASSERT(stream5 == stream1->dep_prev); - CU_ASSERT(9 == stream1->weight); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_change_extpri_stream_priority(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_bufs bufs; - nghttp2_buf *buf; - ssize_t rv; - nghttp2_option *option; - nghttp2_extension frame; - nghttp2_ext_priority_update priority_update; - nghttp2_extpri extpri, nextpri; - nghttp2_stream *stream; - static const uint8_t field_value[] = "u=2"; - - memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - - frame_pack_bufs_init(&bufs); - - nghttp2_option_new(&option); - nghttp2_option_set_builtin_recv_extension_type(option, - NGHTTP2_PRIORITY_UPDATE); - - nghttp2_session_server_new2(&session, &callbacks, NULL, option); - session->pending_no_rfc7540_priorities = 1; open_recv_stream(session, 1); + open_recv_stream(session, 3); - extpri.urgency = NGHTTP2_EXTPRI_URGENCY_LOW + 1; - extpri.inc = 1; - - rv = nghttp2_session_change_extpri_stream_priority( - session, 1, &extpri, /* ignore_client_signal = */ 0); - - CU_ASSERT(0 == rv); - - stream = nghttp2_session_get_stream(session, 1); - - CU_ASSERT(NGHTTP2_EXTPRI_URGENCY_LOW == - nghttp2_extpri_uint8_urgency(stream->extpri)); - CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri)); - - rv = nghttp2_session_get_extpri_stream_priority(session, &nextpri, 1); - - CU_ASSERT(0 == rv); - CU_ASSERT(NGHTTP2_EXTPRI_URGENCY_LOW == nextpri.urgency); - CU_ASSERT(1 == nextpri.inc); - - /* Client can still update stream priority. */ - frame.payload = &priority_update; - nghttp2_frame_priority_update_init(&frame, 1, (uint8_t *)field_value, - sizeof(field_value) - 1); - nghttp2_frame_pack_priority_update(&bufs, &frame); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(2 == stream->extpri); - - /* Start to ignore client priority signal for this stream. */ - rv = nghttp2_session_change_extpri_stream_priority( - session, 1, &extpri, /* ignore_client_signal = */ 1); - - CU_ASSERT(0 == rv); - - stream = nghttp2_session_get_stream(session, 1); - - CU_ASSERT(NGHTTP2_EXTPRI_URGENCY_LOW == - nghttp2_extpri_uint8_urgency(stream->extpri)); - CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri)); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + nghttp2_session_close_stream(session, 1, NGHTTP2_NO_ERROR); + nghttp2_session_close_stream(session, 3, NGHTTP2_NO_ERROR); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(NGHTTP2_EXTPRI_URGENCY_LOW == - nghttp2_extpri_uint8_urgency(stream->extpri)); - CU_ASSERT(1 == nghttp2_extpri_uint8_inc(stream->extpri)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_session_del(session); - nghttp2_option_del(option); - nghttp2_bufs_free(&bufs); } -void test_nghttp2_session_create_idle_stream(void) { +void test_nghttp2_session_flooding(void) { nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_stream *stream2, *stream4, *stream8, *stream10; - nghttp2_priority_spec pri_spec; - int rv; - int i; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = null_send_callback; - - nghttp2_session_server_new(&session, &callbacks, NULL); - - stream2 = open_sent_stream(session, 2); - - nghttp2_priority_spec_init(&pri_spec, 2, 111, 1); - - rv = nghttp2_session_create_idle_stream(session, 4, &pri_spec); - - CU_ASSERT(0 == rv); - - stream4 = nghttp2_session_get_stream_raw(session, 4); - - CU_ASSERT(4 == stream4->stream_id); - CU_ASSERT(111 == stream4->weight); - CU_ASSERT(stream2 == stream4->dep_prev); - CU_ASSERT(stream4 == stream2->dep_next); - - /* If pri_spec->stream_id does not exist, and it is idle stream, it - is created too */ - nghttp2_priority_spec_init(&pri_spec, 10, 109, 0); - - rv = nghttp2_session_create_idle_stream(session, 8, &pri_spec); - - CU_ASSERT(0 == rv); - - stream8 = nghttp2_session_get_stream_raw(session, 8); - stream10 = nghttp2_session_get_stream_raw(session, 10); - - CU_ASSERT(8 == stream8->stream_id); - CU_ASSERT(109 == stream8->weight); - CU_ASSERT(10 == stream10->stream_id); - CU_ASSERT(16 == stream10->weight); - CU_ASSERT(stream10 == stream8->dep_prev); - CU_ASSERT(&session->root == stream10->dep_prev); - - /* It is an error to attempt to create already existing idle - stream */ - rv = nghttp2_session_create_idle_stream(session, 4, &pri_spec); - - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); - - /* It is an error to depend on itself */ - pri_spec.stream_id = 6; - - rv = nghttp2_session_create_idle_stream(session, 6, &pri_spec); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); - - /* It is an error to create root stream (0) as idle stream */ - rv = nghttp2_session_create_idle_stream(session, 0, &pri_spec); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); - - /* It is an error to create non-idle stream */ - session->last_sent_stream_id = 20; - pri_spec.stream_id = 2; - - rv = nghttp2_session_create_idle_stream(session, 18, &pri_spec); - - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == rv); - - nghttp2_session_del(session); - - /* Check that this works in client session too */ - nghttp2_session_client_new(&session, &callbacks, NULL); - - nghttp2_priority_spec_init(&pri_spec, 4, 99, 1); - - rv = nghttp2_session_create_idle_stream(session, 2, &pri_spec); - - CU_ASSERT(0 == rv); + nghttp2_session_callbacks callbacks; + nghttp2_bufs bufs; + nghttp2_buf *buf; + nghttp2_frame frame; + nghttp2_mem *mem; + size_t i; - stream4 = nghttp2_session_get_stream_raw(session, 4); - stream2 = nghttp2_session_get_stream_raw(session, 2); + mem = nghttp2_mem_default(); - CU_ASSERT(NULL != stream4); - CU_ASSERT(NULL != stream2); - CU_ASSERT(&session->root == stream4->dep_prev); - CU_ASSERT(NGHTTP2_DEFAULT_WEIGHT == stream4->weight); - CU_ASSERT(stream4 == stream2->dep_prev); - CU_ASSERT(99 == stream2->weight); + frame_pack_bufs_init(&bufs); - nghttp2_session_del(session); + memset(&callbacks, 0, sizeof(callbacks)); - /* Check that idle stream is reduced when nghttp2_session_send() is - called. */ + /* PING ACK */ nghttp2_session_server_new(&session, &callbacks, NULL); - session->local_settings.max_concurrent_streams = 30; - - nghttp2_priority_spec_init(&pri_spec, 0, 16, 0); - for (i = 0; i < 100; ++i) { - rv = nghttp2_session_create_idle_stream(session, i * 2 + 1, &pri_spec); + nghttp2_frame_ping_init(&frame.ping, NGHTTP2_FLAG_NONE, NULL); + nghttp2_frame_pack_ping(&bufs, &frame.ping); + nghttp2_frame_ping_free(&frame.ping); - CU_ASSERT(0 == rv); + buf = &bufs.head->buf; - nghttp2_priority_spec_init(&pri_spec, i * 2 + 1, 16, 0); + for (i = 0; i < NGHTTP2_DEFAULT_MAX_OBQ_FLOOD_ITEM; ++i) { + assert_ptrdiff( + (nghttp2_ssize)nghttp2_buf_len(buf), ==, + nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf))); } - CU_ASSERT(100 == session->num_idle_streams); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(30 == session->num_idle_streams); - CU_ASSERT(141 == session->idle_stream_head->stream_id); + assert_ptrdiff( + NGHTTP2_ERR_FLOODED, ==, + nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf))); nghttp2_session_del(session); - /* Check that idle stream is reduced when nghttp2_session_mem_recv() is - called. */ - nghttp2_session_client_new(&session, &callbacks, NULL); + /* SETTINGS ACK */ + nghttp2_bufs_reset(&bufs); - session->local_settings.max_concurrent_streams = 30; + nghttp2_session_server_new(&session, &callbacks, NULL); - nghttp2_priority_spec_init(&pri_spec, 0, 16, 0); - for (i = 0; i < 100; ++i) { - rv = nghttp2_session_create_idle_stream(session, i * 2 + 1, &pri_spec); + nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, NULL, 0); + nghttp2_frame_pack_settings(&bufs, &frame.settings); + nghttp2_frame_settings_free(&frame.settings, mem); - CU_ASSERT(0 == rv); + buf = &bufs.head->buf; - nghttp2_priority_spec_init(&pri_spec, i * 2 + 1, 16, 0); + for (i = 0; i < NGHTTP2_DEFAULT_MAX_OBQ_FLOOD_ITEM; ++i) { + assert_ptrdiff( + (nghttp2_ssize)nghttp2_buf_len(buf), ==, + nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf))); } - CU_ASSERT(100 == session->num_idle_streams); - CU_ASSERT(0 == nghttp2_session_mem_recv(session, NULL, 0)); - CU_ASSERT(30 == session->num_idle_streams); - CU_ASSERT(141 == session->idle_stream_head->stream_id); + assert_ptrdiff( + NGHTTP2_ERR_FLOODED, ==, + nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf))); nghttp2_session_del(session); + nghttp2_bufs_free(&bufs); } -void test_nghttp2_session_repeated_priority_change(void) { +void test_nghttp2_session_change_extpri_stream_priority(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_frame frame; - nghttp2_priority_spec pri_spec; - int32_t stream_id, last_stream_id; - int32_t max_streams = 20; - - memset(&callbacks, 0, sizeof(callbacks)); - - nghttp2_session_server_new(&session, &callbacks, NULL); - - session->local_settings.max_concurrent_streams = (uint32_t)max_streams; - - /* 1 -> 0 */ - nghttp2_priority_spec_init(&pri_spec, 0, 16, 0); - nghttp2_frame_priority_init(&frame.priority, 1, &pri_spec); - - CU_ASSERT(0 == nghttp2_session_on_priority_received(session, &frame)); - - nghttp2_frame_priority_free(&frame.priority); - - last_stream_id = max_streams * 2 + 1; - - for (stream_id = 3; stream_id < last_stream_id; stream_id += 2) { - /* 1 -> stream_id */ - nghttp2_priority_spec_init(&pri_spec, stream_id, 16, 0); - nghttp2_frame_priority_init(&frame.priority, 1, &pri_spec); + nghttp2_bufs bufs; + nghttp2_buf *buf; + nghttp2_ssize rv; + nghttp2_option *option; + nghttp2_extension frame; + nghttp2_ext_priority_update priority_update; + nghttp2_extpri extpri, nextpri; + nghttp2_stream *stream; + static const uint8_t field_value[] = "u=2"; - CU_ASSERT(0 == nghttp2_session_on_priority_received(session, &frame)); + memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - nghttp2_frame_priority_free(&frame.priority); - } + frame_pack_bufs_init(&bufs); - CU_ASSERT(20 == session->num_idle_streams); - CU_ASSERT(1 == session->idle_stream_head->stream_id); + nghttp2_option_new(&option); + nghttp2_option_set_builtin_recv_extension_type(option, + NGHTTP2_PRIORITY_UPDATE); - /* 1 -> last_stream_id */ - nghttp2_priority_spec_init(&pri_spec, last_stream_id, 16, 0); - nghttp2_frame_priority_init(&frame.priority, 1, &pri_spec); + nghttp2_session_server_new2(&session, &callbacks, NULL, option); - CU_ASSERT(0 == nghttp2_session_on_priority_received(session, &frame)); + session->pending_no_rfc7540_priorities = 1; - nghttp2_frame_priority_free(&frame.priority); + open_recv_stream(session, 1); - CU_ASSERT(20 == session->num_idle_streams); - CU_ASSERT(3 == session->idle_stream_head->stream_id); + extpri.urgency = NGHTTP2_EXTPRI_URGENCY_LOW + 1; + extpri.inc = 1; - nghttp2_session_del(session); -} + rv = nghttp2_session_change_extpri_stream_priority( + session, 1, &extpri, /* ignore_client_signal = */ 0); -void test_nghttp2_session_repeated_priority_submission(void) { - nghttp2_session *session; - nghttp2_session_callbacks callbacks; - nghttp2_priority_spec pri_spec; - int32_t stream_id, last_stream_id; - uint32_t max_streams = NGHTTP2_MIN_IDLE_STREAMS; + assert_ptrdiff(0, ==, rv); - memset(&callbacks, 0, sizeof(callbacks)); + stream = nghttp2_session_get_stream(session, 1); - callbacks.send_callback = null_send_callback; + assert_uint32(NGHTTP2_EXTPRI_URGENCY_LOW, ==, + nghttp2_extpri_uint8_urgency(stream->extpri)); + assert_true(nghttp2_extpri_uint8_inc(stream->extpri)); - nghttp2_session_client_new(&session, &callbacks, NULL); + rv = nghttp2_session_get_extpri_stream_priority(session, &nextpri, 1); - session->local_settings.max_concurrent_streams = max_streams; + assert_ptrdiff(0, ==, rv); + assert_uint32(NGHTTP2_EXTPRI_URGENCY_LOW, ==, nextpri.urgency); + assert_true(nextpri.inc); - /* 1 -> 0 */ - nghttp2_priority_spec_init(&pri_spec, 0, 16, 0); + /* Client can still update stream priority. */ + frame.payload = &priority_update; + nghttp2_frame_priority_update_init(&frame, 1, (uint8_t *)field_value, + sizeof(field_value) - 1); + nghttp2_frame_pack_priority_update(&bufs, &frame); - CU_ASSERT(0 == - nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 1, &pri_spec)); + buf = &bufs.head->buf; + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - last_stream_id = (int32_t)(max_streams * 2 + 1); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_uint8(2, ==, stream->extpri); - for (stream_id = 3; stream_id < last_stream_id; stream_id += 2) { - /* 1 -> stream_id */ - nghttp2_priority_spec_init(&pri_spec, stream_id, 16, 0); + /* Start to ignore client priority signal for this stream. */ + rv = nghttp2_session_change_extpri_stream_priority( + session, 1, &extpri, /* ignore_client_signal = */ 1); - CU_ASSERT( - 0 == nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 1, &pri_spec)); - } + assert_ptrdiff(0, ==, rv); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(max_streams == session->num_idle_streams); - CU_ASSERT(1 == session->idle_stream_head->stream_id); + stream = nghttp2_session_get_stream(session, 1); - /* 1 -> last_stream_id */ - nghttp2_priority_spec_init(&pri_spec, last_stream_id, 16, 0); + assert_uint32(NGHTTP2_EXTPRI_URGENCY_LOW, ==, + nghttp2_extpri_uint8_urgency(stream->extpri)); + assert_true(nghttp2_extpri_uint8_inc(stream->extpri)); - CU_ASSERT(0 == - nghttp2_submit_priority(session, NGHTTP2_FLAG_NONE, 1, &pri_spec)); + buf = &bufs.head->buf; + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(max_streams == session->num_idle_streams); - CU_ASSERT(3 == session->idle_stream_head->stream_id); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); + assert_uint32(NGHTTP2_EXTPRI_URGENCY_LOW, ==, + nghttp2_extpri_uint8_urgency(stream->extpri)); + assert_true(nghttp2_extpri_uint8_inc(stream->extpri)); nghttp2_session_del(session); + nghttp2_option_del(option); + nghttp2_bufs_free(&bufs); } void test_nghttp2_session_set_local_window_size(void) { @@ -11091,117 +9130,129 @@ void test_nghttp2_session_set_local_window_size(void) { nghttp2_stream *stream; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); stream = open_sent_stream(session, 1); stream->recv_window_size = 4096; - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 1, 65536)); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1 == - stream->local_window_size); - CU_ASSERT(4096 == stream->recv_window_size); - CU_ASSERT(65536 - 4096 == - nghttp2_session_get_stream_local_window_size(session, 1)); + assert_int(0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, + 1, 65536)); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1, ==, + stream->local_window_size); + assert_int32(4096, ==, stream->recv_window_size); + assert_int32(65536 - 4096, ==, + nghttp2_session_get_stream_local_window_size(session, 1)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(1 == item->frame.window_update.hd.stream_id); - CU_ASSERT(1 == item->frame.window_update.window_size_increment); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(1, ==, item->frame.window_update.hd.stream_id); + assert_int32(1, ==, item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); /* Go decrement part */ - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 1, 32768)); - CU_ASSERT(32768 == stream->local_window_size); - CU_ASSERT(-28672 == stream->recv_window_size); - CU_ASSERT(32768 == stream->recv_reduction); - CU_ASSERT(65536 - 4096 == - nghttp2_session_get_stream_local_window_size(session, 1)); + assert_int(0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, + 1, 32768)); + assert_int32(32768, ==, stream->local_window_size); + assert_int32(-28672, ==, stream->recv_window_size); + assert_int32(32768, ==, stream->recv_reduction); + assert_int32(65536 - 4096, ==, + nghttp2_session_get_stream_local_window_size(session, 1)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(item == NULL); + assert_null(item); /* Increase local window size */ - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 1, 49152)); - CU_ASSERT(49152 == stream->local_window_size); - CU_ASSERT(-12288 == stream->recv_window_size); - CU_ASSERT(16384 == stream->recv_reduction); - CU_ASSERT(65536 - 4096 == - nghttp2_session_get_stream_local_window_size(session, 1)); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_int(0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, + 1, 49152)); + assert_int32(49152, ==, stream->local_window_size); + assert_int32(-12288, ==, stream->recv_window_size); + assert_int32(16384, ==, stream->recv_reduction); + assert_int32(65536 - 4096, ==, + nghttp2_session_get_stream_local_window_size(session, 1)); + assert_null(nghttp2_session_get_next_ob_item(session)); /* Increase local window again */ - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 1, 65537)); - CU_ASSERT(65537 == stream->local_window_size); - CU_ASSERT(4096 == stream->recv_window_size); - CU_ASSERT(0 == stream->recv_reduction); - CU_ASSERT(65537 - 4096 == - nghttp2_session_get_stream_local_window_size(session, 1)); + assert_int(0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, + 1, 65537)); + assert_int32(65537, ==, stream->local_window_size); + assert_int32(4096, ==, stream->recv_window_size); + assert_int32(0, ==, stream->recv_reduction); + assert_int32(65537 - 4096, ==, + nghttp2_session_get_stream_local_window_size(session, 1)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(1 == item->frame.window_update.window_size_increment); + assert_int32(1, ==, item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); /* Check connection-level flow control */ session->recv_window_size = 4096; - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 0, 65536)); - CU_ASSERT(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1 == - session->local_window_size); - CU_ASSERT(4096 == session->recv_window_size); - CU_ASSERT(65536 - 4096 == nghttp2_session_get_local_window_size(session)); + assert_int(0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, + 0, 65536)); + assert_int32(NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE + 1, ==, + session->local_window_size); + assert_int32(4096, ==, session->recv_window_size); + assert_int32(65536 - 4096, ==, + nghttp2_session_get_local_window_size(session)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(0 == item->frame.window_update.hd.stream_id); - CU_ASSERT(1 == item->frame.window_update.window_size_increment); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(0, ==, item->frame.window_update.hd.stream_id); + assert_int32(1, ==, item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); /* Go decrement part */ - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 0, 32768)); - CU_ASSERT(32768 == session->local_window_size); - CU_ASSERT(-28672 == session->recv_window_size); - CU_ASSERT(32768 == session->recv_reduction); - CU_ASSERT(65536 - 4096 == nghttp2_session_get_local_window_size(session)); + assert_int(0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, + 0, 32768)); + assert_int32(32768, ==, session->local_window_size); + assert_int32(-28672, ==, session->recv_window_size); + assert_int32(32768, ==, session->recv_reduction); + assert_int32(65536 - 4096, ==, + nghttp2_session_get_local_window_size(session)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(item == NULL); + assert_null(item); /* Increase local window size */ - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 0, 49152)); - CU_ASSERT(49152 == session->local_window_size); - CU_ASSERT(-12288 == session->recv_window_size); - CU_ASSERT(16384 == session->recv_reduction); - CU_ASSERT(65536 - 4096 == nghttp2_session_get_local_window_size(session)); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_int(0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, + 0, 49152)); + assert_int32(49152, ==, session->local_window_size); + assert_int32(-12288, ==, session->recv_window_size); + assert_int32(16384, ==, session->recv_reduction); + assert_int32(65536 - 4096, ==, + nghttp2_session_get_local_window_size(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); /* Increase local window again */ - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 0, 65537)); - CU_ASSERT(65537 == session->local_window_size); - CU_ASSERT(4096 == session->recv_window_size); - CU_ASSERT(0 == session->recv_reduction); - CU_ASSERT(65537 - 4096 == nghttp2_session_get_local_window_size(session)); + assert_int(0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, + 0, 65537)); + assert_int32(65537, ==, session->local_window_size); + assert_int32(4096, ==, session->recv_window_size); + assert_int32(0, ==, session->recv_reduction); + assert_int32(65537 - 4096, ==, + nghttp2_session_get_local_window_size(session)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(1 == item->frame.window_update.window_size_increment); + assert_int32(1, ==, item->frame.window_update.window_size_increment); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_session_del(session); @@ -11211,25 +9262,26 @@ void test_nghttp2_session_set_local_window_size(void) { stream = open_sent_stream(session, 1); stream->recv_window_size = NGHTTP2_INITIAL_WINDOW_SIZE; - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 1, 0)); - CU_ASSERT(0 == stream->recv_window_size); - CU_ASSERT(0 == nghttp2_session_get_stream_local_window_size(session, 1)); + assert_int( + 0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, 1, 0)); + assert_int32(0, ==, stream->recv_window_size); + assert_int32(0, ==, nghttp2_session_get_stream_local_window_size(session, 1)); /* This should submit WINDOW_UPDATE frame because stream-level receiving window is now full. */ - CU_ASSERT(0 == - nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, 1, - NGHTTP2_INITIAL_WINDOW_SIZE)); - CU_ASSERT(0 == stream->recv_window_size); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE == - nghttp2_session_get_stream_local_window_size(session, 1)); + assert_int(0, ==, + nghttp2_session_set_local_window_size( + session, NGHTTP2_FLAG_NONE, 1, NGHTTP2_INITIAL_WINDOW_SIZE)); + assert_int32(0, ==, stream->recv_window_size); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE, ==, + nghttp2_session_get_stream_local_window_size(session, 1)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(1 == item->frame.hd.stream_id); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE == - item->frame.window_update.window_size_increment); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(1, ==, item->frame.hd.stream_id); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE, ==, + item->frame.window_update.window_size_increment); nghttp2_session_del(session); @@ -11239,25 +9291,26 @@ void test_nghttp2_session_set_local_window_size(void) { nghttp2_session_client_new(&session, &callbacks, NULL); session->recv_window_size = NGHTTP2_INITIAL_WINDOW_SIZE; - CU_ASSERT(0 == nghttp2_session_set_local_window_size( - session, NGHTTP2_FLAG_NONE, 0, 0)); - CU_ASSERT(0 == session->recv_window_size); - CU_ASSERT(0 == nghttp2_session_get_local_window_size(session)); + assert_int( + 0, ==, + nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, 0, 0)); + assert_int32(0, ==, session->recv_window_size); + assert_int32(0, ==, nghttp2_session_get_local_window_size(session)); /* This should submit WINDOW_UPDATE frame because connection-level receiving window is now full. */ - CU_ASSERT(0 == - nghttp2_session_set_local_window_size(session, NGHTTP2_FLAG_NONE, 0, - NGHTTP2_INITIAL_WINDOW_SIZE)); - CU_ASSERT(0 == session->recv_window_size); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE == - nghttp2_session_get_local_window_size(session)); + assert_int(0, ==, + nghttp2_session_set_local_window_size( + session, NGHTTP2_FLAG_NONE, 0, NGHTTP2_INITIAL_WINDOW_SIZE)); + assert_int32(0, ==, session->recv_window_size); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE, ==, + nghttp2_session_get_local_window_size(session)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_WINDOW_UPDATE == item->frame.hd.type); - CU_ASSERT(0 == item->frame.hd.stream_id); - CU_ASSERT(NGHTTP2_INITIAL_WINDOW_SIZE == - item->frame.window_update.window_size_increment); + assert_uint8(NGHTTP2_WINDOW_UPDATE, ==, item->frame.hd.type); + assert_int32(0, ==, item->frame.hd.stream_id); + assert_int32(NGHTTP2_INITIAL_WINDOW_SIZE, ==, + item->frame.window_update.window_size_increment); nghttp2_session_del(session); } @@ -11268,7 +9321,7 @@ void test_nghttp2_session_cancel_from_before_frame_send(void) { nghttp2_session_callbacks callbacks; my_user_data ud; nghttp2_settings_entry iv; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; int32_t stream_id; nghttp2_stream *stream; @@ -11276,7 +9329,7 @@ void test_nghttp2_session_cancel_from_before_frame_send(void) { callbacks.before_frame_send_callback = cancel_before_frame_send_callback; callbacks.on_frame_not_send_callback = on_frame_not_send_callback; - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, &ud); @@ -11285,7 +9338,7 @@ void test_nghttp2_session_cancel_from_before_frame_send(void) { rv = nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); ud.frame_send_cb_called = 0; ud.before_frame_send_cb_called = 0; @@ -11293,18 +9346,18 @@ void test_nghttp2_session_cancel_from_before_frame_send(void) { rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == ud.frame_send_cb_called); - CU_ASSERT(1 == ud.before_frame_send_cb_called); - CU_ASSERT(1 == ud.frame_not_send_cb_called); + assert_int(0, ==, rv); + assert_int(0, ==, ud.frame_send_cb_called); + assert_int(1, ==, ud.before_frame_send_cb_called); + assert_int(1, ==, ud.frame_not_send_cb_called); data_prd.source.ptr = NULL; data_prd.read_callback = temporal_failure_data_source_read_callback; - stream_id = nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), - &data_prd, NULL); + stream_id = nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), + &data_prd, NULL); - CU_ASSERT(stream_id > 0); + assert_int32(0, <, stream_id); ud.frame_send_cb_called = 0; ud.before_frame_send_cb_called = 0; @@ -11312,14 +9365,14 @@ void test_nghttp2_session_cancel_from_before_frame_send(void) { rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == ud.frame_send_cb_called); - CU_ASSERT(1 == ud.before_frame_send_cb_called); - CU_ASSERT(1 == ud.frame_not_send_cb_called); + assert_int(0, ==, rv); + assert_int(0, ==, ud.frame_send_cb_called); + assert_int(1, ==, ud.before_frame_send_cb_called); + assert_int(1, ==, ud.frame_not_send_cb_called); stream = nghttp2_session_get_stream_raw(session, stream_id); - CU_ASSERT(NULL == stream); + assert_null(stream); nghttp2_session_del(session); @@ -11330,7 +9383,7 @@ void test_nghttp2_session_cancel_from_before_frame_send(void) { stream_id = nghttp2_submit_push_promise(session, NGHTTP2_FLAG_NONE, 1, reqnv, ARRLEN(reqnv), NULL); - CU_ASSERT(stream_id > 0); + assert_int32(0, <, stream_id); ud.frame_send_cb_called = 0; ud.before_frame_send_cb_called = 0; @@ -11338,14 +9391,14 @@ void test_nghttp2_session_cancel_from_before_frame_send(void) { rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); - CU_ASSERT(0 == ud.frame_send_cb_called); - CU_ASSERT(1 == ud.before_frame_send_cb_called); - CU_ASSERT(1 == ud.frame_not_send_cb_called); + assert_int(0, ==, rv); + assert_int(0, ==, ud.frame_send_cb_called); + assert_int(1, ==, ud.before_frame_send_cb_called); + assert_int(1, ==, ud.frame_not_send_cb_called); stream = nghttp2_session_get_stream_raw(session, stream_id); - CU_ASSERT(NULL == stream); + assert_null(stream); nghttp2_session_del(session); } @@ -11357,7 +9410,7 @@ void test_nghttp2_session_too_many_settings(void) { nghttp2_frame frame; nghttp2_bufs bufs; nghttp2_buf *buf; - ssize_t rv; + nghttp2_ssize rv; my_user_data ud; nghttp2_settings_entry iv[3]; nghttp2_mem *mem; @@ -11368,14 +9421,14 @@ void test_nghttp2_session_too_many_settings(void) { memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); callbacks.on_frame_recv_callback = on_frame_recv_callback; - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_option_new(&option); nghttp2_option_set_max_settings(option, 1); nghttp2_session_client_new2(&session, &callbacks, &ud, option); - CU_ASSERT(1 == session->max_settings); + assert_size(1, ==, session->max_settings); nghttp2_option_del(option); @@ -11390,8 +9443,8 @@ void test_nghttp2_session_too_many_settings(void) { rv = nghttp2_frame_pack_settings(&bufs, &frame.settings); - CU_ASSERT(0 == rv); - CU_ASSERT(nghttp2_bufs_len(&bufs) > 0); + assert_ptrdiff(0, ==, rv); + assert_size(0, <, nghttp2_bufs_len(&bufs)); nghttp2_frame_settings_free(&frame.settings, mem); @@ -11400,11 +9453,11 @@ void test_nghttp2_session_too_many_settings(void) { ud.frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); nghttp2_bufs_reset(&bufs); nghttp2_bufs_free(&bufs); @@ -11418,7 +9471,7 @@ prepare_session_removed_closed_stream(nghttp2_session *session, nghttp2_settings_entry iv; nghttp2_bufs bufs; nghttp2_mem *mem; - ssize_t nread; + nghttp2_ssize nread; int i; nghttp2_stream *stream; nghttp2_frame_hd hd; @@ -11432,23 +9485,23 @@ prepare_session_removed_closed_stream(nghttp2_session *session, rv = nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); for (i = 1; i <= 3; i += 2) { rv = pack_headers(&bufs, deflater, i, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - nread = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + nread = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == nread); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, nread); nghttp2_bufs_reset(&bufs); } @@ -11459,17 +9512,17 @@ prepare_session_removed_closed_stream(nghttp2_session *session, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); /* Receiving stream 5 will erase stream 3 from closed stream list */ - nread = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + nread = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == nread); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, nread); stream = nghttp2_session_get_stream_raw(session, 3); - CU_ASSERT(NULL == stream); + assert_null(stream); /* Since the current max concurrent streams is NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS, receiving frame on stream @@ -11479,24 +9532,24 @@ prepare_session_removed_closed_stream(nghttp2_session *session, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, trailernv, ARRLEN(trailernv), mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - nread = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + nread = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == nread); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, nread); + assert_null(nghttp2_session_get_next_ob_item(session)); nghttp2_frame_hd_init(&hd, 0, NGHTTP2_DATA, NGHTTP2_FLAG_NONE, 3); nghttp2_bufs_reset(&bufs); nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN; - nread = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + nread = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == nread); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, nread); + assert_null(nghttp2_session_get_next_ob_item(session)); /* Now server receives SETTINGS ACK */ nghttp2_frame_hd_init(&hd, 0, NGHTTP2_SETTINGS, NGHTTP2_FLAG_ACK, 0); @@ -11504,10 +9557,10 @@ prepare_session_removed_closed_stream(nghttp2_session *session, nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN; - nread = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + nread = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == nread); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, nread); nghttp2_bufs_free(&bufs); } @@ -11519,7 +9572,7 @@ void test_nghttp2_session_removed_closed_stream(void) { nghttp2_hd_deflater deflater; nghttp2_bufs bufs; nghttp2_mem *mem; - ssize_t nread; + nghttp2_ssize nread; nghttp2_frame_hd hd; nghttp2_outbound_item *item; @@ -11529,7 +9582,7 @@ void test_nghttp2_session_removed_closed_stream(void) { memset(&callbacks, 0, sizeof(callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_server_new(&session, &callbacks, NULL); @@ -11548,16 +9601,16 @@ void test_nghttp2_session_removed_closed_stream(void) { NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, trailernv, ARRLEN(trailernv), mem); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - nread = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + nread = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == nread); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, nread); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL == item); + assert_null(item); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -11573,14 +9626,14 @@ void test_nghttp2_session_removed_closed_stream(void) { nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN; - nread = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_bufs_len(&bufs)); + nread = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_bufs_len(&bufs)); - CU_ASSERT((ssize_t)nghttp2_bufs_len(&bufs) == nread); + assert_ptrdiff((nghttp2_ssize)nghttp2_bufs_len(&bufs), ==, nread); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL == item); + assert_null(item); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -11588,9 +9641,9 @@ void test_nghttp2_session_removed_closed_stream(void) { nghttp2_bufs_free(&bufs); } -static ssize_t pause_once_data_source_read_callback( - nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, - uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { +static nghttp2_ssize pause_once_data_source_read_callback( + nghttp2_session *session, int32_t stream_id, uint8_t *buf, size_t len, + uint32_t *data_flags, nghttp2_data_source *source, void *user_data) { my_user_data *ud = user_data; if (ud->data_source_read_cb_paused == 0) { ++ud->data_source_read_cb_paused; @@ -11604,11 +9657,11 @@ static ssize_t pause_once_data_source_read_callback( void test_nghttp2_session_pause_data(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_send_callback = on_frame_send_callback; data_prd.read_callback = pause_once_data_source_read_callback; @@ -11618,19 +9671,20 @@ void test_nghttp2_session_pause_data(void) { open_recv_stream(session, 1); - CU_ASSERT( - 0 == nghttp2_submit_data(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); + assert_int( + 0, ==, + nghttp2_submit_data2(session, NGHTTP2_FLAG_END_STREAM, 1, &data_prd)); ud.frame_send_cb_called = 0; ud.data_source_read_cb_paused = 0; - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(0 == ud.frame_send_cb_called); - CU_ASSERT(NULL == session->aob.item); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == ud.frame_send_cb_called); - CU_ASSERT(NGHTTP2_DATA == ud.sent_frame_type); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(0, ==, ud.frame_send_cb_called); + assert_null(session->aob.item); + assert_int(0, ==, nghttp2_session_send(session)); + assert_int(1, ==, ud.frame_send_cb_called); + assert_uint8(NGHTTP2_DATA, ==, ud.sent_frame_type); + assert_null(nghttp2_session_get_next_ob_item(session)); nghttp2_session_del(session); } @@ -11651,7 +9705,7 @@ void test_nghttp2_session_no_closed_streams(void) { nghttp2_session_close_stream(session, 1, NGHTTP2_NO_ERROR); - CU_ASSERT(0 == session->num_closed_streams); + assert_size(0, ==, session->num_closed_streams); nghttp2_session_del(session); nghttp2_option_del(option); @@ -11664,28 +9718,28 @@ void test_nghttp2_session_set_stream_user_data(void) { int user_data1, user_data2; int rv; const uint8_t *datap; - ssize_t datalen; + nghttp2_ssize datalen; memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); nghttp2_session_client_new(&session, &callbacks, NULL); - stream_id = nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, - &user_data1); + stream_id = nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, + &user_data1); rv = nghttp2_session_set_stream_user_data(session, stream_id, &user_data2); - CU_ASSERT(0 == rv); + assert_int(0, ==, rv); - datalen = nghttp2_session_mem_send(session, &datap); + datalen = nghttp2_session_mem_send2(session, &datap); - CU_ASSERT(datalen > 0); + assert_ptrdiff(0, <, datalen); - CU_ASSERT(&user_data2 == - nghttp2_session_get_stream_user_data(session, stream_id)); + assert_ptr_equal(&user_data2, + nghttp2_session_get_stream_user_data(session, stream_id)); - CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT == - nghttp2_session_set_stream_user_data(session, 2, NULL)); + assert_int(NGHTTP2_ERR_INVALID_ARGUMENT, ==, + nghttp2_session_set_stream_user_data(session, 2, NULL)); nghttp2_session_del(session); } @@ -11693,7 +9747,7 @@ void test_nghttp2_session_set_stream_user_data(void) { void test_nghttp2_session_no_rfc7540_priorities(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; - nghttp2_data_provider data_prd; + nghttp2_data_provider2 data_prd; my_user_data ud; nghttp2_outbound_item *item; nghttp2_mem *mem; @@ -11703,70 +9757,46 @@ void test_nghttp2_session_no_rfc7540_priorities(void) { mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; /* Do not use a dependency tree if SETTINGS_NO_RFC7540_PRIORITIES = 1. */ data_prd.read_callback = fixed_length_data_source_read_callback; ud.data_source_length = 128 * 1024; - CU_ASSERT(0 == nghttp2_session_server_new(&session, &callbacks, &ud)); + assert_int(0, ==, nghttp2_session_server_new(&session, &callbacks, &ud)); iv.settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; iv.value = 1; - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1)); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, + nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1)); + assert_int(0, ==, nghttp2_session_send(session)); open_recv_stream2(session, 1, NGHTTP2_STREAM_OPENING); - CU_ASSERT(0 == nghttp2_submit_response(session, 1, resnv, ARRLEN(resnv), - &data_prd)); + assert_int( + 0, ==, + nghttp2_submit_response2(session, 1, resnv, ARRLEN(resnv), &data_prd)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(ARRLEN(resnv) == item->frame.headers.nvlen); + assert_size(ARRLEN(resnv), ==, item->frame.headers.nvlen); assert_nv_equal(resnv, item->frame.headers.nva, item->frame.headers.nvlen, mem); - CU_ASSERT(0 == nghttp2_session_send(session)); - CU_ASSERT(1 == nghttp2_pq_size( - &session->sched[NGHTTP2_EXTPRI_DEFAULT_URGENCY].ob_data)); - CU_ASSERT(nghttp2_pq_empty(&session->root.obq)); - - nghttp2_session_del(session); - - /* Priorities are sent as is before client receives - SETTINGS_NO_RFC7540_PRIORITIES = 1 from server. */ - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, NULL)); - - iv.settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; - iv.value = 1; - - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1)); - - pri_spec.stream_id = 5; - pri_spec.weight = 111; - pri_spec.exclusive = 1; - - CU_ASSERT(1 == nghttp2_submit_request(session, &pri_spec, reqnv, - ARRLEN(reqnv), NULL, NULL)); - - item = nghttp2_outbound_queue_top(&session->ob_syn); - - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_HEADERS == item->frame.hd.type); - CU_ASSERT(pri_spec.stream_id == item->frame.headers.pri_spec.stream_id); - CU_ASSERT(pri_spec.weight == item->frame.headers.pri_spec.weight); - CU_ASSERT(pri_spec.exclusive == item->frame.headers.pri_spec.exclusive); + assert_int(0, ==, nghttp2_session_send(session)); + assert_size( + 1, ==, + nghttp2_pq_size(&session->sched[NGHTTP2_EXTPRI_DEFAULT_URGENCY].ob_data)); nghttp2_session_del(session); - /* Priorities are defaulted if client received - SETTINGS_NO_RFC7540_PRIORITIES = 1 from server. */ - CU_ASSERT(0 == nghttp2_session_client_new(&session, &callbacks, NULL)); + /* Priorities are defaulted */ + assert_int(0, ==, nghttp2_session_client_new(&session, &callbacks, NULL)); iv.settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; iv.value = 1; - CU_ASSERT(0 == nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1)); + assert_int(0, ==, + nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1)); session->remote_settings.no_rfc7540_priorities = 1; @@ -11774,211 +9804,25 @@ void test_nghttp2_session_no_rfc7540_priorities(void) { pri_spec.weight = 111; pri_spec.exclusive = 1; - CU_ASSERT(1 == nghttp2_submit_request(session, &pri_spec, reqnv, - ARRLEN(reqnv), NULL, NULL)); + assert_int32(1, ==, + nghttp2_submit_request2(session, &pri_spec, reqnv, ARRLEN(reqnv), + NULL, NULL)); item = nghttp2_outbound_queue_top(&session->ob_syn); - CU_ASSERT(NULL != item); - CU_ASSERT(NGHTTP2_HEADERS == item->frame.hd.type); - CU_ASSERT(nghttp2_priority_spec_check_default(&item->frame.headers.pri_spec)); - - nghttp2_session_del(session); -} - -void test_nghttp2_session_server_fallback_rfc7540_priorities(void) { - nghttp2_session *session; - nghttp2_option *option; - nghttp2_session_callbacks callbacks; - nghttp2_frame frame; - nghttp2_bufs bufs; - nghttp2_buf *buf; - ssize_t rv; - nghttp2_settings_entry iv; - nghttp2_mem *mem; - nghttp2_hd_deflater deflater; - nghttp2_nv *nva; - size_t nvlen; - nghttp2_priority_spec pri_spec; - nghttp2_stream *anchor_stream, *stream; - my_user_data ud; - nghttp2_ext_priority_update priority_update; - static const uint8_t field_value[] = "u=0"; - - mem = nghttp2_mem_default(); - frame_pack_bufs_init(&bufs); - - memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; - callbacks.on_frame_recv_callback = on_frame_recv_callback; - - nghttp2_option_new(&option); - nghttp2_option_set_server_fallback_rfc7540_priorities(option, 1); - - iv.settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; - iv.value = 1; - - /* Server falls back to RFC 7540 priorities. */ - nghttp2_session_server_new2(&session, &callbacks, &ud, option); - - rv = nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1); - - CU_ASSERT(0 == rv); - - rv = nghttp2_session_send(session); - - CU_ASSERT(0 == rv); - - nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, NULL, 0); - rv = nghttp2_frame_pack_settings(&bufs, &frame.settings); - - CU_ASSERT(0 == rv); - - nghttp2_frame_settings_free(&frame.settings, mem); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(1 == session->fallback_rfc7540_priorities); - - nghttp2_hd_deflate_init(&deflater, mem); - - nvlen = ARRLEN(reqnv); - nghttp2_nv_array_copy(&nva, reqnv, nvlen, mem); - nghttp2_priority_spec_init(&pri_spec, 3, 111, 1); - nghttp2_frame_headers_init(&frame.headers, - NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, - 1, NGHTTP2_HCAT_HEADERS, &pri_spec, nva, nvlen); - nghttp2_bufs_reset(&bufs); - rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - - CU_ASSERT(0 == rv); - - nghttp2_frame_headers_free(&frame.headers, mem); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - - anchor_stream = nghttp2_session_get_stream_raw(session, 3); - - CU_ASSERT(NGHTTP2_STREAM_IDLE == anchor_stream->state); - CU_ASSERT( - !(anchor_stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES)); - CU_ASSERT(&session->root == anchor_stream->dep_prev); - - stream = nghttp2_session_get_stream(session, 1); - - CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state); - CU_ASSERT(!(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES)); - CU_ASSERT(anchor_stream == stream->dep_prev); - - /* Make sure that PRIORITY frame updates stream priority. */ - nghttp2_priority_spec_init(&pri_spec, 5, 1, 0); - nghttp2_frame_priority_init(&frame.priority, 1, &pri_spec); - nghttp2_bufs_reset(&bufs); - nghttp2_frame_pack_priority(&bufs, &frame.priority); - - nghttp2_frame_priority_free(&frame.priority); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - - anchor_stream = nghttp2_session_get_stream_raw(session, 5); - - CU_ASSERT(NGHTTP2_STREAM_IDLE == anchor_stream->state); - CU_ASSERT(&session->root == anchor_stream->dep_prev); - CU_ASSERT(anchor_stream == stream->dep_prev); - - /* Make sure that PRIORITY_UPDATE frame is ignored. */ - frame.ext.payload = &priority_update; - nghttp2_frame_priority_update_init(&frame.ext, 1, (uint8_t *)field_value, - sizeof(field_value) - 1); - nghttp2_bufs_reset(&bufs); - nghttp2_frame_pack_priority_update(&bufs, &frame.ext); - - ud.frame_recv_cb_called = 0; - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(0 == ud.frame_recv_cb_called); - CU_ASSERT(NGHTTP2_EXTPRI_DEFAULT_URGENCY == stream->extpri); - - nghttp2_hd_deflate_free(&deflater); - nghttp2_session_del(session); - - /* Server does not fallback to RFC 7540 priorities. */ - nghttp2_session_server_new2(&session, &callbacks, &ud, option); - - rv = nghttp2_submit_settings(session, NGHTTP2_FLAG_NONE, &iv, 1); - - CU_ASSERT(0 == rv); - - rv = nghttp2_session_send(session); - - CU_ASSERT(0 == rv); - - iv.settings_id = NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES; - iv.value = 0; - - nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, - dup_iv(&iv, 1), 1); - nghttp2_bufs_reset(&bufs); - rv = nghttp2_frame_pack_settings(&bufs, &frame.settings); - - CU_ASSERT(0 == rv); - - nghttp2_frame_settings_free(&frame.settings, mem); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(0 == session->fallback_rfc7540_priorities); - - nghttp2_hd_deflate_init(&deflater, mem); - - nvlen = ARRLEN(reqnv); - nghttp2_nv_array_copy(&nva, reqnv, nvlen, mem); - nghttp2_priority_spec_init(&pri_spec, 3, 111, 1); - nghttp2_frame_headers_init(&frame.headers, - NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_PRIORITY, - 1, NGHTTP2_HCAT_HEADERS, &pri_spec, nva, nvlen); - nghttp2_bufs_reset(&bufs); - rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - - CU_ASSERT(0 == rv); - - nghttp2_frame_headers_free(&frame.headers, mem); - - buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); - - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); - CU_ASSERT(NULL == nghttp2_session_get_stream_raw(session, 3)); - - stream = nghttp2_session_get_stream(session, 1); + assert_not_null(item); + assert_uint8(NGHTTP2_HEADERS, ==, item->frame.hd.type); + assert_true( + nghttp2_priority_spec_check_default(&item->frame.headers.pri_spec)); - CU_ASSERT(NGHTTP2_STREAM_OPENING == stream->state); - CU_ASSERT(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES); - - nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); - - nghttp2_option_del(option); - nghttp2_bufs_free(&bufs); } void test_nghttp2_session_stream_reset_ratelim(void) { nghttp2_session *session; nghttp2_session_callbacks callbacks; nghttp2_frame frame; - ssize_t rv; + nghttp2_ssize rv; nghttp2_bufs bufs; nghttp2_buf *buf; nghttp2_mem *mem; @@ -11994,30 +9838,30 @@ void test_nghttp2_session_stream_reset_ratelim(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_option_new(&option); nghttp2_option_set_stream_reset_rate_limit( - option, NGHTTP2_DEFAULT_STREAM_RESET_BURST, 0); + option, NGHTTP2_DEFAULT_STREAM_RESET_BURST, 0); nghttp2_session_server_new2(&session, &callbacks, NULL, option); nghttp2_frame_settings_init(&frame.settings, NGHTTP2_FLAG_NONE, NULL, 0); rv = nghttp2_frame_pack_settings(&bufs, &frame.settings); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_settings_free(&frame.settings, mem); buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); /* Send SETTINGS ACK */ rv = nghttp2_session_send(session); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_hd_deflate_init(&deflater, mem); @@ -12034,14 +9878,14 @@ void test_nghttp2_session_stream_reset_ratelim(void) { nvlen); rv = nghttp2_frame_pack_headers(&bufs, &frame.headers, &deflater); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_headers_free(&frame.headers, mem); buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); nghttp2_bufs_reset(&bufs); @@ -12052,23 +9896,23 @@ void test_nghttp2_session_stream_reset_ratelim(void) { nghttp2_frame_rst_stream_free(&frame.rst_stream); buf = &bufs.head->buf; - rv = nghttp2_session_mem_recv(session, buf->pos, nghttp2_buf_len(buf)); + rv = nghttp2_session_mem_recv2(session, buf->pos, nghttp2_buf_len(buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(buf), ==, rv); if (i < NGHTTP2_DEFAULT_STREAM_RESET_BURST) { - CU_ASSERT(0 == nghttp2_outbound_queue_size(&session->ob_reg)); + assert_size(0, ==, nghttp2_outbound_queue_size(&session->ob_reg)); continue; } - CU_ASSERT(1 == nghttp2_outbound_queue_size(&session->ob_reg)); + assert_size(1, ==, nghttp2_outbound_queue_size(&session->ob_reg)); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type); - CU_ASSERT(NGHTTP2_DEFAULT_STREAM_RESET_BURST * 2 + 1 == - item->frame.goaway.last_stream_id); + assert_uint8(NGHTTP2_GOAWAY, ==, item->frame.hd.type); + assert_int32(NGHTTP2_DEFAULT_STREAM_RESET_BURST * 2 + 1, ==, + item->frame.goaway.last_stream_id); } nghttp2_hd_deflate_free(&deflater); @@ -12078,10 +9922,10 @@ void test_nghttp2_session_stream_reset_ratelim(void) { } static void check_nghttp2_http_recv_headers_fail( - nghttp2_session *session, nghttp2_hd_deflater *deflater, int32_t stream_id, - int stream_state, const nghttp2_nv *nva, size_t nvlen) { + nghttp2_session *session, nghttp2_hd_deflater *deflater, int32_t stream_id, + int stream_state, const nghttp2_nv *nva, size_t nvlen) { nghttp2_mem *mem; - ssize_t rv; + nghttp2_ssize rv; nghttp2_outbound_item *item; nghttp2_bufs bufs; my_user_data *ud; @@ -12101,30 +9945,30 @@ static void check_nghttp2_http_recv_headers_fail( rv = pack_headers(&bufs, deflater, stream_id, NGHTTP2_FLAG_END_HEADERS, nva, nvlen, mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud->invalid_frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(1 == ud->invalid_frame_recv_cb_called); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_ptrdiff(1, ==, ud->invalid_frame_recv_cb_called); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_free(&bufs); } static void check_nghttp2_http_recv_headers_ok( - nghttp2_session *session, nghttp2_hd_deflater *deflater, int32_t stream_id, - int stream_state, const nghttp2_nv *nva, size_t nvlen) { + nghttp2_session *session, nghttp2_hd_deflater *deflater, int32_t stream_id, + int stream_state, const nghttp2_nv *nva, size_t nvlen) { nghttp2_mem *mem; - ssize_t rv; + nghttp2_ssize rv; nghttp2_bufs bufs; my_user_data *ud; @@ -12143,16 +9987,16 @@ static void check_nghttp2_http_recv_headers_ok( rv = pack_headers(&bufs, deflater, stream_id, NGHTTP2_FLAG_END_HEADERS, nva, nvlen, mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); ud->frame_recv_cb_called = 0; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); - CU_ASSERT(1 == ud->frame_recv_cb_called); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); + assert_null(nghttp2_session_get_next_ob_item(session)); + assert_int(1, ==, ud->frame_recv_cb_called); nghttp2_bufs_free(&bufs); } @@ -12194,68 +10038,68 @@ void test_nghttp2_http_mandatory_headers(void) { MAKE_NV(":method", "GET"), MAKE_NV(":authority", "localhost")}; const nghttp2_nv earlyconnect_reqnv[] = { - MAKE_NV(":method", "CONNECT"), MAKE_NV(":scheme", "https"), - MAKE_NV(":path", "/"), MAKE_NV(":authority", "localhost")}; + MAKE_NV(":method", "CONNECT"), MAKE_NV(":scheme", "https"), + MAKE_NV(":path", "/"), MAKE_NV(":authority", "localhost")}; const nghttp2_nv lateconnect_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":path", "/"), - MAKE_NV(":method", "CONNECT"), MAKE_NV(":authority", "localhost")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":path", "/"), + MAKE_NV(":method", "CONNECT"), MAKE_NV(":authority", "localhost")}; const nghttp2_nv duppath_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"), - MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), - MAKE_NV(":path", "/")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"), + MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), + MAKE_NV(":path", "/")}; const nghttp2_nv badcl_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":method", "POST"), - MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), - MAKE_NV("content-length", "-1")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":method", "POST"), + MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), + MAKE_NV("content-length", "-1")}; const nghttp2_nv dupcl_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":method", "POST"), - MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), - MAKE_NV("content-length", "0"), MAKE_NV("content-length", "0")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":method", "POST"), + MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), + MAKE_NV("content-length", "0"), MAKE_NV("content-length", "0")}; const nghttp2_nv badhd_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"), - MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), - MAKE_NV("connection", "close")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"), + MAKE_NV(":authority", "localhost"), MAKE_NV(":path", "/"), + MAKE_NV("connection", "close")}; const nghttp2_nv badauthority_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"), - MAKE_NV(":authority", "\x0d\x0alocalhost"), MAKE_NV(":path", "/")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"), + MAKE_NV(":authority", "\x0d\x0alocalhost"), MAKE_NV(":path", "/")}; const nghttp2_nv badhdbtw_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"), - MAKE_NV("foo", "\x0d\x0a"), MAKE_NV(":authority", "localhost"), - MAKE_NV(":path", "/")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":method", "GET"), + MAKE_NV("foo", "\x0d\x0a"), MAKE_NV(":authority", "localhost"), + MAKE_NV(":path", "/")}; const nghttp2_nv asteriskget1_reqnv[] = { - MAKE_NV(":path", "*"), MAKE_NV(":scheme", "https"), - MAKE_NV(":authority", "localhost"), MAKE_NV(":method", "GET")}; + MAKE_NV(":path", "*"), MAKE_NV(":scheme", "https"), + MAKE_NV(":authority", "localhost"), MAKE_NV(":method", "GET")}; const nghttp2_nv asteriskget2_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "localhost"), - MAKE_NV(":method", "GET"), MAKE_NV(":path", "*")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "localhost"), + MAKE_NV(":method", "GET"), MAKE_NV(":path", "*")}; const nghttp2_nv asteriskoptions1_reqnv[] = { - MAKE_NV(":path", "*"), MAKE_NV(":scheme", "https"), - MAKE_NV(":authority", "localhost"), MAKE_NV(":method", "OPTIONS")}; + MAKE_NV(":path", "*"), MAKE_NV(":scheme", "https"), + MAKE_NV(":authority", "localhost"), MAKE_NV(":method", "OPTIONS")}; const nghttp2_nv asteriskoptions2_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "localhost"), - MAKE_NV(":method", "OPTIONS"), MAKE_NV(":path", "*")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "localhost"), + MAKE_NV(":method", "OPTIONS"), MAKE_NV(":path", "*")}; const nghttp2_nv connectproto_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":path", "/"), - MAKE_NV(":method", "CONNECT"), MAKE_NV(":authority", "localhost"), - MAKE_NV(":protocol", "websocket")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":path", "/"), + MAKE_NV(":method", "CONNECT"), MAKE_NV(":authority", "localhost"), + MAKE_NV(":protocol", "websocket")}; const nghttp2_nv connectprotoget_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":path", "/"), - MAKE_NV(":method", "GET"), MAKE_NV(":authority", "localhost"), - MAKE_NV(":protocol", "websocket")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":path", "/"), + MAKE_NV(":method", "GET"), MAKE_NV(":authority", "localhost"), + MAKE_NV(":protocol", "websocket")}; const nghttp2_nv connectprotonopath_reqnv[] = { - MAKE_NV(":scheme", "https"), MAKE_NV(":method", "CONNECT"), - MAKE_NV(":authority", "localhost"), MAKE_NV(":protocol", "websocket")}; + MAKE_NV(":scheme", "https"), MAKE_NV(":method", "CONNECT"), + MAKE_NV(":authority", "localhost"), MAKE_NV(":protocol", "websocket")}; const nghttp2_nv connectprotonoauth_reqnv[] = { - MAKE_NV(":scheme", "http"), MAKE_NV(":path", "/"), - MAKE_NV(":method", "CONNECT"), MAKE_NV("host", "localhost"), - MAKE_NV(":protocol", "websocket")}; + MAKE_NV(":scheme", "http"), MAKE_NV(":path", "/"), + MAKE_NV(":method", "CONNECT"), MAKE_NV("host", "localhost"), + MAKE_NV(":protocol", "websocket")}; const nghttp2_nv regularconnect_reqnv[] = { - MAKE_NV(":method", "CONNECT"), MAKE_NV(":authority", "localhost")}; + MAKE_NV(":method", "CONNECT"), MAKE_NV(":authority", "localhost")}; mem = nghttp2_mem_default(); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_frame_recv_callback = on_frame_recv_callback; callbacks.on_invalid_frame_recv_callback = on_invalid_frame_recv_callback; @@ -12316,8 +10160,8 @@ void test_nghttp2_http_mandatory_headers(void) { /* response header has nonzero content-length with 204 status code */ check_nghttp2_http_recv_headers_fail( - session, &deflater, 21, NGHTTP2_STREAM_OPENING, clnonzero204_resnv, - ARRLEN(clnonzero204_resnv)); + session, &deflater, 21, NGHTTP2_STREAM_OPENING, clnonzero204_resnv, + ARRLEN(clnonzero204_resnv)); /* status code 101 should not be used in HTTP/2 because it is used for HTTP Upgrade which HTTP/2 removes. */ @@ -12328,8 +10172,8 @@ void test_nghttp2_http_mandatory_headers(void) { /* Specific characters check for host field in response header should not be done as its use is undefined. */ check_nghttp2_http_recv_headers_ok( - session, &deflater, 25, NGHTTP2_STREAM_OPENING, unexpectedhost_resnv, - ARRLEN(unexpectedhost_resnv)); + session, &deflater, 25, NGHTTP2_STREAM_OPENING, unexpectedhost_resnv, + ARRLEN(unexpectedhost_resnv)); nghttp2_hd_deflate_free(&deflater); @@ -12345,13 +10189,12 @@ void test_nghttp2_http_mandatory_headers(void) { ARRLEN(nopath_reqnv)); /* request header has CONNECT method, but followed by :path */ - check_nghttp2_http_recv_headers_fail(session, &deflater, 3, -1, - earlyconnect_reqnv, - ARRLEN(earlyconnect_reqnv)); + check_nghttp2_http_recv_headers_fail( + session, &deflater, 3, -1, earlyconnect_reqnv, ARRLEN(earlyconnect_reqnv)); /* request header has CONNECT method following :path */ check_nghttp2_http_recv_headers_fail( - session, &deflater, 5, -1, lateconnect_reqnv, ARRLEN(lateconnect_reqnv)); + session, &deflater, 5, -1, lateconnect_reqnv, ARRLEN(lateconnect_reqnv)); /* request header has multiple :path */ check_nghttp2_http_recv_headers_fail(session, &deflater, 7, -1, duppath_reqnv, @@ -12371,9 +10214,8 @@ void test_nghttp2_http_mandatory_headers(void) { /* request header has :authority header field containing illegal characters */ - check_nghttp2_http_recv_headers_fail(session, &deflater, 15, -1, - badauthority_reqnv, - ARRLEN(badauthority_reqnv)); + check_nghttp2_http_recv_headers_fail( + session, &deflater, 15, -1, badauthority_reqnv, ARRLEN(badauthority_reqnv)); /* request header has regular header field containing illegal character before all mandatory header fields are seen. */ @@ -12382,15 +10224,13 @@ void test_nghttp2_http_mandatory_headers(void) { /* request header has "*" in :path header field while method is GET. :path is received before :method */ - check_nghttp2_http_recv_headers_fail(session, &deflater, 19, -1, - asteriskget1_reqnv, - ARRLEN(asteriskget1_reqnv)); + check_nghttp2_http_recv_headers_fail( + session, &deflater, 19, -1, asteriskget1_reqnv, ARRLEN(asteriskget1_reqnv)); /* request header has "*" in :path header field while method is GET. :method is received before :path */ - check_nghttp2_http_recv_headers_fail(session, &deflater, 21, -1, - asteriskget2_reqnv, - ARRLEN(asteriskget2_reqnv)); + check_nghttp2_http_recv_headers_fail( + session, &deflater, 21, -1, asteriskget2_reqnv, ARRLEN(asteriskget2_reqnv)); /* OPTIONS method can include "*" in :path header field. :path is received before :method. */ @@ -12406,9 +10246,8 @@ void test_nghttp2_http_mandatory_headers(void) { /* :protocol is not allowed unless it is enabled by the local endpoint. */ - check_nghttp2_http_recv_headers_fail(session, &deflater, 27, -1, - connectproto_reqnv, - ARRLEN(connectproto_reqnv)); + check_nghttp2_http_recv_headers_fail( + session, &deflater, 27, -1, connectproto_reqnv, ARRLEN(connectproto_reqnv)); nghttp2_hd_deflate_free(&deflater); @@ -12423,9 +10262,8 @@ void test_nghttp2_http_mandatory_headers(void) { /* :protocol is allowed if SETTINGS_CONNECT_PROTOCOL is enabled by the local endpoint. */ - check_nghttp2_http_recv_headers_ok(session, &deflater, 1, -1, - connectproto_reqnv, - ARRLEN(connectproto_reqnv)); + check_nghttp2_http_recv_headers_ok( + session, &deflater, 1, -1, connectproto_reqnv, ARRLEN(connectproto_reqnv)); /* :protocol is only allowed with CONNECT method. */ check_nghttp2_http_recv_headers_fail(session, &deflater, 3, -1, @@ -12459,21 +10297,21 @@ void test_nghttp2_http_content_length(void) { nghttp2_hd_deflater deflater; nghttp2_mem *mem; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; nghttp2_stream *stream; const nghttp2_nv cl_resnv[] = {MAKE_NV(":status", "200"), MAKE_NV("te", "trailers"), MAKE_NV("content-length", "9000000000")}; const nghttp2_nv cl_reqnv[] = { - MAKE_NV(":path", "/"), MAKE_NV(":method", "PUT"), - MAKE_NV(":scheme", "https"), MAKE_NV("te", "trailers"), - MAKE_NV("host", "localhost"), MAKE_NV("content-length", "9000000000")}; + MAKE_NV(":path", "/"), MAKE_NV(":method", "PUT"), + MAKE_NV(":scheme", "https"), MAKE_NV("te", "trailers"), + MAKE_NV("host", "localhost"), MAKE_NV("content-length", "9000000000")}; mem = nghttp2_mem_default(); frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); @@ -12483,15 +10321,15 @@ void test_nghttp2_http_content_length(void) { rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, cl_resnv, ARRLEN(cl_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); - CU_ASSERT(9000000000LL == stream->content_length); - CU_ASSERT(200 == stream->status_code); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); + assert_null(nghttp2_session_get_next_ob_item(session)); + assert_int64(9000000000LL, ==, stream->content_length); + assert_int16(200, ==, stream->status_code); nghttp2_hd_deflate_free(&deflater); @@ -12506,17 +10344,17 @@ void test_nghttp2_http_content_length(void) { rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, cl_reqnv, ARRLEN(cl_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); - CU_ASSERT(9000000000LL == stream->content_length); + assert_null(nghttp2_session_get_next_ob_item(session)); + assert_int64(9000000000LL, ==, stream->content_length); nghttp2_hd_deflate_free(&deflater); @@ -12531,11 +10369,11 @@ void test_nghttp2_http_content_length_mismatch(void) { nghttp2_hd_deflater deflater; nghttp2_mem *mem; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; const nghttp2_nv cl_reqnv[] = { - MAKE_NV(":path", "/"), MAKE_NV(":method", "PUT"), - MAKE_NV(":authority", "localhost"), MAKE_NV(":scheme", "https"), - MAKE_NV("content-length", "20")}; + MAKE_NV(":path", "/"), MAKE_NV(":method", "PUT"), + MAKE_NV(":authority", "localhost"), MAKE_NV(":scheme", "https"), + MAKE_NV("content-length", "20")}; const nghttp2_nv cl_resnv[] = {MAKE_NV(":status", "200"), MAKE_NV("content-length", "20")}; nghttp2_outbound_item *item; @@ -12545,7 +10383,7 @@ void test_nghttp2_http_content_length_mismatch(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_server_new(&session, &callbacks, NULL); @@ -12555,59 +10393,59 @@ void test_nghttp2_http_content_length_mismatch(void) { rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, cl_reqnv, ARRLEN(cl_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); /* header says content-length: 20, but DATA has 0 byte */ rv = pack_headers(&bufs, &deflater, 3, NGHTTP2_FLAG_END_HEADERS, cl_reqnv, ARRLEN(cl_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_hd_init(&hd, 0, NGHTTP2_DATA, NGHTTP2_FLAG_END_STREAM, 3); nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); /* header says content-length: 20, but DATA has 21 bytes */ rv = pack_headers(&bufs, &deflater, 5, NGHTTP2_FLAG_END_HEADERS, cl_reqnv, ARRLEN(cl_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_hd_init(&hd, 21, NGHTTP2_DATA, NGHTTP2_FLAG_END_STREAM, 5); nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN + 21; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); @@ -12621,83 +10459,83 @@ void test_nghttp2_http_content_length_mismatch(void) { nghttp2_hd_deflate_init(&deflater, mem); /* header says content-length: 20, but HEADERS has END_STREAM flag set */ - nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, cl_resnv, ARRLEN(cl_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 1)); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_not_null(nghttp2_session_get_stream(session, 1)); + assert_int(0, ==, nghttp2_session_send(session)); /* After sending RST_STREAM, stream must be closed */ - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 1)); + assert_null(nghttp2_session_get_stream(session, 1)); nghttp2_bufs_reset(&bufs); /* header says content-length: 20, but DATA has 0 byte */ - nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); rv = pack_headers(&bufs, &deflater, 3, NGHTTP2_FLAG_END_HEADERS, cl_resnv, ARRLEN(cl_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_hd_init(&hd, 0, NGHTTP2_DATA, NGHTTP2_FLAG_END_STREAM, 3); nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 3)); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_not_null(nghttp2_session_get_stream(session, 3)); + assert_int(0, ==, nghttp2_session_send(session)); /* After sending RST_STREAM, stream must be closed */ - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 3)); + assert_null(nghttp2_session_get_stream(session, 3)); nghttp2_bufs_reset(&bufs); /* header says content-length: 20, but DATA has 21 bytes */ - nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); + nghttp2_submit_request2(session, NULL, reqnv, ARRLEN(reqnv), NULL, NULL); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); rv = pack_headers(&bufs, &deflater, 5, NGHTTP2_FLAG_END_HEADERS, cl_resnv, ARRLEN(cl_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_hd_init(&hd, 21, NGHTTP2_DATA, NGHTTP2_FLAG_END_STREAM, 5); nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN + 21; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(NULL != nghttp2_session_get_stream(session, 5)); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_not_null(nghttp2_session_get_stream(session, 5)); + assert_int(0, ==, nghttp2_session_send(session)); /* After sending RST_STREAM, stream must be closed */ - CU_ASSERT(NULL == nghttp2_session_get_stream(session, 5)); + assert_null(nghttp2_session_get_stream(session, 5)); nghttp2_bufs_reset(&bufs); @@ -12714,9 +10552,9 @@ void test_nghttp2_http_non_final_response(void) { nghttp2_hd_deflater deflater; nghttp2_mem *mem; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; const nghttp2_nv nonfinal_resnv[] = { - MAKE_NV(":status", "100"), + MAKE_NV(":status", "100"), }; nghttp2_outbound_item *item; nghttp2_frame_hd hd; @@ -12725,7 +10563,7 @@ void test_nghttp2_http_non_final_response(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); @@ -12737,17 +10575,17 @@ void test_nghttp2_http_non_final_response(void) { rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, nonfinal_resnv, ARRLEN(nonfinal_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); @@ -12756,21 +10594,21 @@ void test_nghttp2_http_non_final_response(void) { rv = pack_headers(&bufs, &deflater, 3, NGHTTP2_FLAG_END_HEADERS, nonfinal_resnv, ARRLEN(nonfinal_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_hd_init(&hd, 10, NGHTTP2_DATA, NGHTTP2_FLAG_END_STREAM, 3); nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN + 10; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); @@ -12780,18 +10618,18 @@ void test_nghttp2_http_non_final_response(void) { rv = pack_headers(&bufs, &deflater, 5, NGHTTP2_FLAG_END_HEADERS, nonfinal_resnv, ARRLEN(nonfinal_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_hd_init(&hd, 0, NGHTTP2_DATA, NGHTTP2_FLAG_NONE, 5); nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); nghttp2_bufs_reset(&bufs); @@ -12801,22 +10639,22 @@ void test_nghttp2_http_non_final_response(void) { rv = pack_headers(&bufs, &deflater, 7, NGHTTP2_FLAG_END_HEADERS, nonfinal_resnv, ARRLEN(nonfinal_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_frame_hd_init(&hd, 0, NGHTTP2_DATA, NGHTTP2_FLAG_END_STREAM, 7); nghttp2_frame_pack_frame_hd(bufs.head->buf.last, &hd); bufs.head->buf.last += NGHTTP2_FRAME_HDLEN; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); @@ -12825,25 +10663,25 @@ void test_nghttp2_http_non_final_response(void) { rv = pack_headers(&bufs, &deflater, 9, NGHTTP2_FLAG_END_HEADERS, nonfinal_resnv, ARRLEN(nonfinal_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); nghttp2_bufs_reset(&bufs); rv = pack_headers(&bufs, &deflater, 9, NGHTTP2_FLAG_END_HEADERS, resnv, ARRLEN(resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); nghttp2_bufs_reset(&bufs); @@ -12860,9 +10698,9 @@ void test_nghttp2_http_trailer_headers(void) { nghttp2_hd_deflater deflater; nghttp2_mem *mem; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; const nghttp2_nv trailer_reqnv[] = { - MAKE_NV("foo", "bar"), + MAKE_NV("foo", "bar"), }; nghttp2_outbound_item *item; @@ -12870,7 +10708,7 @@ void test_nghttp2_http_trailer_headers(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_server_new(&session, &callbacks, NULL); @@ -12879,84 +10717,84 @@ void test_nghttp2_http_trailer_headers(void) { /* good trailer header */ rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); nghttp2_bufs_reset(&bufs); rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, trailer_reqnv, ARRLEN(trailer_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); nghttp2_bufs_reset(&bufs); /* trailer header without END_STREAM is illegal */ rv = pack_headers(&bufs, &deflater, 3, NGHTTP2_FLAG_END_HEADERS, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); nghttp2_bufs_reset(&bufs); rv = pack_headers(&bufs, &deflater, 3, NGHTTP2_FLAG_END_HEADERS, trailer_reqnv, ARRLEN(trailer_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); /* trailer header including pseudo header field is illegal */ rv = pack_headers(&bufs, &deflater, 5, NGHTTP2_FLAG_END_HEADERS, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); nghttp2_bufs_reset(&bufs); rv = pack_headers(&bufs, &deflater, 5, NGHTTP2_FLAG_END_HEADERS, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); @@ -12973,19 +10811,19 @@ void test_nghttp2_http_ignore_regular_header(void) { nghttp2_hd_deflater deflater; nghttp2_mem *mem; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; my_user_data ud; const nghttp2_nv bad_reqnv[] = { - MAKE_NV(":authority", "localhost"), - MAKE_NV(":scheme", "https"), - MAKE_NV(":path", "/"), - MAKE_NV(":method", "GET"), - MAKE_NV("foo", "\x0zzz"), - MAKE_NV("bar", "buzz"), + MAKE_NV(":authority", "localhost"), + MAKE_NV(":scheme", "https"), + MAKE_NV(":path", "/"), + MAKE_NV(":method", "GET"), + MAKE_NV("foo", "\x0zzz"), + MAKE_NV("bar", "buzz"), }; const nghttp2_nv bad_ansnv[] = { - MAKE_NV(":authority", "localhost"), MAKE_NV(":scheme", "https"), - MAKE_NV(":path", "/"), MAKE_NV(":method", "GET"), MAKE_NV("bar", "buzz")}; + MAKE_NV(":authority", "localhost"), MAKE_NV(":scheme", "https"), + MAKE_NV(":path", "/"), MAKE_NV(":method", "GET"), MAKE_NV("bar", "buzz")}; size_t proclen; size_t i; nghttp2_outbound_item *item; @@ -12994,7 +10832,7 @@ void test_nghttp2_http_ignore_regular_header(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; callbacks.on_header_callback = pause_on_header_callback; nghttp2_session_server_new(&session, &callbacks, &ud); @@ -13004,32 +10842,32 @@ void test_nghttp2_http_ignore_regular_header(void) { NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, bad_reqnv, ARRLEN(bad_reqnv), mem); - CU_ASSERT_FATAL(0 == rv); + assert_ptrdiff(0, ==, rv); nghttp2_hd_deflate_free(&deflater); proclen = 0; for (i = 0; i < 4; ++i) { - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos + proclen, - nghttp2_buf_len(&bufs.head->buf) - proclen); - CU_ASSERT_FATAL(rv > 0); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos + proclen, + nghttp2_buf_len(&bufs.head->buf) - proclen); + assert_ptrdiff(0, <, rv); proclen += (size_t)rv; - CU_ASSERT(nghttp2_nv_equal(&bad_ansnv[i], &ud.nv)); + assert_true(nghttp2_nv_equal(&bad_ansnv[i], &ud.nv)); } - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos + proclen, - nghttp2_buf_len(&bufs.head->buf) - proclen); - CU_ASSERT_FATAL(rv > 0); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos + proclen, + nghttp2_buf_len(&bufs.head->buf) - proclen); + assert_ptrdiff(0, <, rv); /* Without on_invalid_frame_recv_callback, bad header causes stream reset */ item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); proclen += (size_t)rv; - CU_ASSERT(nghttp2_buf_len(&bufs.head->buf) == proclen); + assert_size(nghttp2_buf_len(&bufs.head->buf), ==, proclen); nghttp2_session_del(session); @@ -13043,29 +10881,29 @@ void test_nghttp2_http_ignore_regular_header(void) { ud.invalid_header_cb_called = 0; for (i = 0; i < 4; ++i) { - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos + proclen, - nghttp2_buf_len(&bufs.head->buf) - proclen); - CU_ASSERT_FATAL(rv > 0); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos + proclen, + nghttp2_buf_len(&bufs.head->buf) - proclen); + assert_ptrdiff(0, <, rv); proclen += (size_t)rv; - CU_ASSERT(nghttp2_nv_equal(&bad_ansnv[i], &ud.nv)); + assert_true(nghttp2_nv_equal(&bad_ansnv[i], &ud.nv)); } - CU_ASSERT(0 == ud.invalid_header_cb_called); + assert_int(0, ==, ud.invalid_header_cb_called); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos + proclen, - nghttp2_buf_len(&bufs.head->buf) - proclen); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos + proclen, + nghttp2_buf_len(&bufs.head->buf) - proclen); - CU_ASSERT_FATAL(rv > 0); - CU_ASSERT(1 == ud.invalid_header_cb_called); - CU_ASSERT(nghttp2_nv_equal(&bad_reqnv[4], &ud.nv)); + assert_ptrdiff(0, <, rv); + assert_int(1, ==, ud.invalid_header_cb_called); + assert_true(nghttp2_nv_equal(&bad_reqnv[4], &ud.nv)); proclen += (size_t)rv; - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos + proclen, - nghttp2_buf_len(&bufs.head->buf) - proclen); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos + proclen, + nghttp2_buf_len(&bufs.head->buf) - proclen); - CU_ASSERT(rv > 0); - CU_ASSERT(nghttp2_nv_equal(&bad_ansnv[4], &ud.nv)); + assert_ptrdiff(0, <, rv); + assert_true(nghttp2_nv_equal(&bad_ansnv[4], &ud.nv)); nghttp2_session_del(session); @@ -13076,15 +10914,15 @@ void test_nghttp2_http_ignore_regular_header(void) { nghttp2_session_server_new(&session, &callbacks, &ud); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT(rv == (ssize_t)nghttp2_buf_len(&bufs.head->buf)); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(1 == item->frame.hd.stream_id); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int32(1, ==, item->frame.hd.stream_id); nghttp2_session_del(session); nghttp2_bufs_free(&bufs); @@ -13096,7 +10934,7 @@ void test_nghttp2_http_ignore_content_length(void) { nghttp2_hd_deflater deflater; nghttp2_mem *mem; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; const nghttp2_nv cl_resnv[] = {MAKE_NV(":status", "304"), MAKE_NV("content-length", "20")}; const nghttp2_nv conn_reqnv[] = {MAKE_NV(":authority", "localhost"), @@ -13110,7 +10948,7 @@ void test_nghttp2_http_ignore_content_length(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); @@ -13122,14 +10960,14 @@ void test_nghttp2_http_ignore_content_length(void) { rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, cl_resnv, ARRLEN(cl_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); nghttp2_bufs_reset(&bufs); @@ -13139,15 +10977,15 @@ void test_nghttp2_http_ignore_content_length(void) { rv = pack_headers(&bufs, &deflater, 3, NGHTTP2_FLAG_END_HEADERS, conn_cl_resnv, ARRLEN(conn_cl_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); - CU_ASSERT(-1 == stream->content_length); + assert_null(nghttp2_session_get_next_ob_item(session)); + assert_int64(-1, ==, stream->content_length); nghttp2_bufs_reset(&bufs); @@ -13162,19 +11000,19 @@ void test_nghttp2_http_ignore_content_length(void) { rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, conn_reqnv, ARRLEN(conn_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(-1 == stream->content_length); - CU_ASSERT((stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) > 0); + assert_int64(-1, ==, stream->content_length); + assert_true(stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -13189,7 +11027,7 @@ void test_nghttp2_http_record_request_method(void) { const nghttp2_nv conn_resnv[] = {MAKE_NV(":status", "200"), MAKE_NV("content-length", "9999")}; nghttp2_stream *stream; - ssize_t rv; + nghttp2_ssize rv; nghttp2_bufs bufs; nghttp2_hd_deflater deflater; nghttp2_mem *mem; @@ -13199,37 +11037,38 @@ void test_nghttp2_http_record_request_method(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); nghttp2_hd_deflate_init(&deflater, mem); - CU_ASSERT(1 == nghttp2_submit_request(session, NULL, conn_reqnv, - ARRLEN(conn_reqnv), NULL, NULL)); + assert_int32(1, ==, + nghttp2_submit_request2(session, NULL, conn_reqnv, + ARRLEN(conn_reqnv), NULL, NULL)); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_int(0, ==, nghttp2_session_send(session)); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(NGHTTP2_HTTP_FLAG_METH_CONNECT == stream->http_flags); + assert_uint32(NGHTTP2_HTTP_FLAG_METH_CONNECT, ==, stream->http_flags); rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, conn_resnv, ARRLEN(conn_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT((NGHTTP2_HTTP_FLAG_METH_CONNECT & stream->http_flags) > 0); - CU_ASSERT(-1 == stream->content_length); + assert_true(NGHTTP2_HTTP_FLAG_METH_CONNECT & stream->http_flags); + assert_int64(-1, ==, stream->content_length); /* content-length is ignored in 200 response to a CONNECT request */ item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL == item); + assert_null(item); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -13242,7 +11081,7 @@ void test_nghttp2_http_push_promise(void) { nghttp2_hd_deflater deflater; nghttp2_mem *mem; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; nghttp2_stream *stream; const nghttp2_nv bad_reqnv[] = {MAKE_NV(":method", "GET")}; nghttp2_outbound_item *item; @@ -13251,7 +11090,7 @@ void test_nghttp2_http_push_promise(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; /* good PUSH_PROMISE case */ nghttp2_session_client_new(&session, &callbacks, NULL); @@ -13262,33 +11101,33 @@ void test_nghttp2_http_push_promise(void) { rv = pack_push_promise(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, 2, reqnv, ARRLEN(reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); stream = nghttp2_session_get_stream(session, 2); - CU_ASSERT(NULL != stream); + assert_not_null(stream); nghttp2_bufs_reset(&bufs); rv = pack_headers(&bufs, &deflater, 2, NGHTTP2_FLAG_END_HEADERS, resnv, ARRLEN(resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); - CU_ASSERT(NULL == nghttp2_session_get_next_ob_item(session)); + assert_null(nghttp2_session_get_next_ob_item(session)); - CU_ASSERT(200 == stream->status_code); + assert_int16(200, ==, stream->status_code); nghttp2_bufs_reset(&bufs); @@ -13296,17 +11135,17 @@ void test_nghttp2_http_push_promise(void) { rv = pack_push_promise(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, 4, bad_reqnv, ARRLEN(bad_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(4 == item->frame.hd.stream_id); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int32(4, ==, item->frame.hd.stream_id); nghttp2_bufs_reset(&bufs); @@ -13323,14 +11162,14 @@ void test_nghttp2_http_head_method_upgrade_workaround(void) { nghttp2_bufs bufs; nghttp2_hd_deflater deflater; nghttp2_mem *mem; - ssize_t rv; + nghttp2_ssize rv; nghttp2_stream *stream; mem = nghttp2_mem_default(); frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; nghttp2_session_client_new(&session, &callbacks, NULL); @@ -13341,16 +11180,16 @@ void test_nghttp2_http_head_method_upgrade_workaround(void) { rv = pack_headers(&bufs, &deflater, 1, NGHTTP2_FLAG_END_HEADERS, cl_resnv, ARRLEN(cl_resnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); stream = nghttp2_session_get_stream(session, 1); - CU_ASSERT(-1 == stream->content_length); + assert_int64(-1, ==, stream->content_length); nghttp2_hd_deflate_free(&deflater); nghttp2_session_del(session); @@ -13363,13 +11202,13 @@ void test_nghttp2_http_no_rfc9113_leading_and_trailing_ws_validation(void) { nghttp2_hd_deflater deflater; nghttp2_mem *mem; nghttp2_bufs bufs; - ssize_t rv; + nghttp2_ssize rv; const nghttp2_nv ws_reqnv[] = { - MAKE_NV(":path", "/"), - MAKE_NV(":method", "GET"), - MAKE_NV(":authority", "localhost"), - MAKE_NV(":scheme", "https"), - MAKE_NV("foo", "bar "), + MAKE_NV(":path", "/"), + MAKE_NV(":method", "GET"), + MAKE_NV(":authority", "localhost"), + MAKE_NV(":scheme", "https"), + MAKE_NV("foo", "bar "), }; nghttp2_outbound_item *item; nghttp2_option *option; @@ -13378,7 +11217,7 @@ void test_nghttp2_http_no_rfc9113_leading_and_trailing_ws_validation(void) { frame_pack_bufs_init(&bufs); memset(&callbacks, 0, sizeof(nghttp2_session_callbacks)); - callbacks.send_callback = null_send_callback; + callbacks.send_callback2 = null_send_callback; /* By default, the leading and trailing white spaces validation is enabled as per RFC 9113. */ @@ -13390,17 +11229,17 @@ void test_nghttp2_http_no_rfc9113_leading_and_trailing_ws_validation(void) { NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, ws_reqnv, ARRLEN(ws_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type); - CU_ASSERT(0 == nghttp2_session_send(session)); + assert_uint8(NGHTTP2_RST_STREAM, ==, item->frame.hd.type); + assert_int(0, ==, nghttp2_session_send(session)); nghttp2_bufs_reset(&bufs); nghttp2_hd_deflate_free(&deflater); @@ -13418,16 +11257,16 @@ void test_nghttp2_http_no_rfc9113_leading_and_trailing_ws_validation(void) { NGHTTP2_FLAG_END_HEADERS | NGHTTP2_FLAG_END_STREAM, ws_reqnv, ARRLEN(ws_reqnv), mem); - CU_ASSERT(0 == rv); + assert_ptrdiff(0, ==, rv); - rv = nghttp2_session_mem_recv(session, bufs.head->buf.pos, - nghttp2_buf_len(&bufs.head->buf)); + rv = nghttp2_session_mem_recv2(session, bufs.head->buf.pos, + nghttp2_buf_len(&bufs.head->buf)); - CU_ASSERT((ssize_t)nghttp2_buf_len(&bufs.head->buf) == rv); + assert_ptrdiff((nghttp2_ssize)nghttp2_buf_len(&bufs.head->buf), ==, rv); item = nghttp2_session_get_next_ob_item(session); - CU_ASSERT(NULL == item); + assert_null(item); nghttp2_bufs_reset(&bufs); nghttp2_hd_deflate_free(&deflater); diff --git a/lib/nghttp2-1.65.0/tests/nghttp2_session_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_session_test.h new file mode 100644 index 00000000000..50061978c01 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/nghttp2_session_test.h @@ -0,0 +1,169 @@ +/* + * nghttp2 - HTTP/2 C Library + * + * Copyright (c) 2012 Tatsuhiro Tsujikawa + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef NGHTTP2_SESSION_TEST_H +#define NGHTTP2_SESSION_TEST_H + +#ifdef HAVE_CONFIG_H +# include +#endif /* HAVE_CONFIG_H */ + +#define MUNIT_ENABLE_ASSERT_ALIASES + +#include "munit.h" + +extern const MunitSuite session_suite; + +munit_void_test_decl(test_nghttp2_session_recv) +munit_void_test_decl(test_nghttp2_session_recv_invalid_stream_id) +munit_void_test_decl(test_nghttp2_session_recv_invalid_frame) +munit_void_test_decl(test_nghttp2_session_recv_eof) +munit_void_test_decl(test_nghttp2_session_recv_data) +munit_void_test_decl(test_nghttp2_session_recv_data_no_auto_flow_control) +munit_void_test_decl(test_nghttp2_session_recv_continuation) +munit_void_test_decl(test_nghttp2_session_recv_headers_with_priority) +munit_void_test_decl(test_nghttp2_session_recv_headers_with_padding) +munit_void_test_decl(test_nghttp2_session_recv_headers_early_response) +munit_void_test_decl(test_nghttp2_session_recv_headers_for_closed_stream) +munit_void_test_decl(test_nghttp2_session_recv_headers_with_extpri) +munit_void_test_decl(test_nghttp2_session_server_recv_push_response) +munit_void_test_decl(test_nghttp2_session_recv_premature_headers) +munit_void_test_decl(test_nghttp2_session_recv_unknown_frame) +munit_void_test_decl(test_nghttp2_session_recv_unexpected_continuation) +munit_void_test_decl(test_nghttp2_session_recv_settings_header_table_size) +munit_void_test_decl(test_nghttp2_session_recv_too_large_frame_length) +munit_void_test_decl(test_nghttp2_session_recv_extension) +munit_void_test_decl(test_nghttp2_session_recv_altsvc) +munit_void_test_decl(test_nghttp2_session_recv_origin) +munit_void_test_decl(test_nghttp2_session_recv_priority_update) +munit_void_test_decl(test_nghttp2_session_continue) +munit_void_test_decl(test_nghttp2_session_add_frame) +munit_void_test_decl(test_nghttp2_session_on_request_headers_received) +munit_void_test_decl(test_nghttp2_session_on_response_headers_received) +munit_void_test_decl(test_nghttp2_session_on_headers_received) +munit_void_test_decl(test_nghttp2_session_on_push_response_headers_received) +munit_void_test_decl(test_nghttp2_session_on_rst_stream_received) +munit_void_test_decl(test_nghttp2_session_on_settings_received) +munit_void_test_decl(test_nghttp2_session_on_push_promise_received) +munit_void_test_decl(test_nghttp2_session_on_ping_received) +munit_void_test_decl(test_nghttp2_session_on_goaway_received) +munit_void_test_decl(test_nghttp2_session_on_window_update_received) +munit_void_test_decl(test_nghttp2_session_on_data_received) +munit_void_test_decl(test_nghttp2_session_on_data_received_fail_fast) +munit_void_test_decl(test_nghttp2_session_on_altsvc_received) +munit_void_test_decl(test_nghttp2_session_send_headers_start_stream) +munit_void_test_decl(test_nghttp2_session_send_headers_reply) +munit_void_test_decl(test_nghttp2_session_send_headers_frame_size_error) +munit_void_test_decl(test_nghttp2_session_send_headers_push_reply) +munit_void_test_decl(test_nghttp2_session_send_rst_stream) +munit_void_test_decl(test_nghttp2_session_send_push_promise) +munit_void_test_decl(test_nghttp2_session_is_my_stream_id) +munit_void_test_decl(test_nghttp2_session_upgrade2) +munit_void_test_decl(test_nghttp2_submit_data) +munit_void_test_decl(test_nghttp2_submit_data_read_length_too_large) +munit_void_test_decl(test_nghttp2_submit_data_read_length_smallest) +munit_void_test_decl(test_nghttp2_submit_data_twice) +munit_void_test_decl(test_nghttp2_submit_request_with_data) +munit_void_test_decl(test_nghttp2_submit_request_without_data) +munit_void_test_decl(test_nghttp2_submit_response_with_data) +munit_void_test_decl(test_nghttp2_submit_response_without_data) +munit_void_test_decl(test_nghttp2_submit_response_push_response) +munit_void_test_decl(test_nghttp2_submit_trailer) +munit_void_test_decl(test_nghttp2_submit_headers_start_stream) +munit_void_test_decl(test_nghttp2_submit_headers_reply) +munit_void_test_decl(test_nghttp2_submit_headers_push_reply) +munit_void_test_decl(test_nghttp2_submit_headers) +munit_void_test_decl(test_nghttp2_submit_headers_continuation) +munit_void_test_decl(test_nghttp2_submit_headers_continuation_extra_large) +munit_void_test_decl(test_nghttp2_submit_settings) +munit_void_test_decl(test_nghttp2_submit_settings_update_local_window_size) +munit_void_test_decl(test_nghttp2_submit_settings_multiple_times) +munit_void_test_decl(test_nghttp2_submit_push_promise) +munit_void_test_decl(test_nghttp2_submit_window_update) +munit_void_test_decl(test_nghttp2_submit_window_update_local_window_size) +munit_void_test_decl(test_nghttp2_submit_shutdown_notice) +munit_void_test_decl(test_nghttp2_submit_invalid_nv) +munit_void_test_decl(test_nghttp2_submit_extension) +munit_void_test_decl(test_nghttp2_submit_altsvc) +munit_void_test_decl(test_nghttp2_submit_origin) +munit_void_test_decl(test_nghttp2_submit_priority_update) +munit_void_test_decl(test_nghttp2_submit_rst_stream) +munit_void_test_decl(test_nghttp2_session_open_stream) +munit_void_test_decl(test_nghttp2_session_get_next_ob_item) +munit_void_test_decl(test_nghttp2_session_pop_next_ob_item) +munit_void_test_decl(test_nghttp2_session_reply_fail) +munit_void_test_decl(test_nghttp2_session_max_concurrent_streams) +munit_void_test_decl(test_nghttp2_session_stop_data_with_rst_stream) +munit_void_test_decl(test_nghttp2_session_defer_data) +munit_void_test_decl(test_nghttp2_session_flow_control) +munit_void_test_decl(test_nghttp2_session_flow_control_data_recv) +munit_void_test_decl(test_nghttp2_session_flow_control_data_with_padding_recv) +munit_void_test_decl(test_nghttp2_session_data_read_temporal_failure) +munit_void_test_decl(test_nghttp2_session_on_stream_close) +munit_void_test_decl(test_nghttp2_session_on_ctrl_not_send) +munit_void_test_decl(test_nghttp2_session_get_outbound_queue_size) +munit_void_test_decl(test_nghttp2_session_get_effective_local_window_size) +munit_void_test_decl(test_nghttp2_session_set_option) +munit_void_test_decl(test_nghttp2_session_data_backoff_by_high_pri_frame) +munit_void_test_decl(test_nghttp2_session_pack_data_with_padding) +munit_void_test_decl(test_nghttp2_session_pack_headers_with_padding) +munit_void_test_decl(test_nghttp2_pack_settings_payload) +munit_void_test_decl(test_nghttp2_session_stream_get_state) +munit_void_test_decl(test_nghttp2_session_find_stream) +munit_void_test_decl(test_nghttp2_session_graceful_shutdown) +munit_void_test_decl(test_nghttp2_session_on_header_temporal_failure) +munit_void_test_decl(test_nghttp2_session_recv_client_magic) +munit_void_test_decl(test_nghttp2_session_delete_data_item) +munit_void_test_decl(test_nghttp2_session_open_idle_stream) +munit_void_test_decl(test_nghttp2_session_cancel_reserved_remote) +munit_void_test_decl(test_nghttp2_session_reset_pending_headers) +munit_void_test_decl(test_nghttp2_session_send_data_callback) +munit_void_test_decl(test_nghttp2_session_on_begin_headers_temporal_failure) +munit_void_test_decl(test_nghttp2_session_defer_then_close) +munit_void_test_decl(test_nghttp2_session_detach_item_from_closed_stream) +munit_void_test_decl(test_nghttp2_session_flooding) +munit_void_test_decl(test_nghttp2_session_change_extpri_stream_priority) +munit_void_test_decl(test_nghttp2_session_set_local_window_size) +munit_void_test_decl(test_nghttp2_session_cancel_from_before_frame_send) +munit_void_test_decl(test_nghttp2_session_too_many_settings) +munit_void_test_decl(test_nghttp2_session_removed_closed_stream) +munit_void_test_decl(test_nghttp2_session_pause_data) +munit_void_test_decl(test_nghttp2_session_no_closed_streams) +munit_void_test_decl(test_nghttp2_session_set_stream_user_data) +munit_void_test_decl(test_nghttp2_session_no_rfc7540_priorities) +munit_void_test_decl(test_nghttp2_session_stream_reset_ratelim) +munit_void_test_decl(test_nghttp2_http_mandatory_headers) +munit_void_test_decl(test_nghttp2_http_content_length) +munit_void_test_decl(test_nghttp2_http_content_length_mismatch) +munit_void_test_decl(test_nghttp2_http_non_final_response) +munit_void_test_decl(test_nghttp2_http_trailer_headers) +munit_void_test_decl(test_nghttp2_http_ignore_regular_header) +munit_void_test_decl(test_nghttp2_http_ignore_content_length) +munit_void_test_decl(test_nghttp2_http_record_request_method) +munit_void_test_decl(test_nghttp2_http_push_promise) +munit_void_test_decl(test_nghttp2_http_head_method_upgrade_workaround) +munit_void_test_decl( + test_nghttp2_http_no_rfc9113_leading_and_trailing_ws_validation) + +#endif /* NGHTTP2_SESSION_TEST_H */ diff --git a/lib/nghttp2/tests/nghttp2_stream_test.c b/lib/nghttp2-1.65.0/tests/nghttp2_stream_test.c similarity index 97% rename from lib/nghttp2/tests/nghttp2_stream_test.c rename to lib/nghttp2-1.65.0/tests/nghttp2_stream_test.c index 75b4d68043f..91be376229b 100644 --- a/lib/nghttp2/tests/nghttp2_stream_test.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_stream_test.c @@ -26,6 +26,4 @@ #include -#include - #include "nghttp2_stream.h" diff --git a/lib/nghttp2/tests/nghttp2_stream_test.h b/lib/nghttp2-1.65.0/tests/nghttp2_stream_test.h similarity index 100% rename from lib/nghttp2/tests/nghttp2_stream_test.h rename to lib/nghttp2-1.65.0/tests/nghttp2_stream_test.h diff --git a/lib/nghttp2/tests/nghttp2_test_helper.c b/lib/nghttp2-1.65.0/tests/nghttp2_test_helper.c similarity index 64% rename from lib/nghttp2/tests/nghttp2_test_helper.c rename to lib/nghttp2-1.65.0/tests/nghttp2_test_helper.c index 1bd4a63fc8c..ed9861ad9bd 100644 --- a/lib/nghttp2/tests/nghttp2_test_helper.c +++ b/lib/nghttp2-1.65.0/tests/nghttp2_test_helper.c @@ -27,8 +27,6 @@ #include #include -#include - #include "nghttp2_helper.h" #include "nghttp2_priority_spec.h" @@ -64,7 +62,7 @@ int unpack_frame(nghttp2_frame *frame, const uint8_t *in, size_t len) { break; case NGHTTP2_SETTINGS: rv = nghttp2_frame_unpack_settings_payload2( - &frame->settings.iv, &frame->settings.niv, payload, payloadlen, mem); + &frame->settings.iv, &frame->settings.niv, payload, payloadlen, mem); break; case NGHTTP2_PUSH_PROMISE: nghttp2_frame_unpack_push_promise_payload(&frame->push_promise, payload); @@ -90,7 +88,7 @@ int unpack_frame(nghttp2_frame *frame, const uint8_t *in, size_t len) { case NGHTTP2_PRIORITY_UPDATE: assert(payloadlen >= 4); nghttp2_frame_unpack_priority_update_payload( - &frame->ext, (uint8_t *)payload, payloadlen); + &frame->ext, (uint8_t *)payload, payloadlen); break; default: /* Must not be reachable */ @@ -155,9 +153,9 @@ void add_out(nva_out *out, nghttp2_nv *nv, nghttp2_mem *mem) { ++out->nvlen; } -ssize_t inflate_hd(nghttp2_hd_inflater *inflater, nva_out *out, - nghttp2_bufs *bufs, size_t offset, nghttp2_mem *mem) { - ssize_t rv; +nghttp2_ssize inflate_hd(nghttp2_hd_inflater *inflater, nva_out *out, + nghttp2_bufs *bufs, size_t offset, nghttp2_mem *mem) { + nghttp2_ssize rv; nghttp2_nv nv; int inflate_flags; nghttp2_buf_chain *ci; @@ -176,14 +174,14 @@ ssize_t inflate_hd(nghttp2_hd_inflater *inflater, nva_out *out, if (offset) { size_t n; - n = nghttp2_min(offset, nghttp2_buf_len(&bp)); + n = nghttp2_min_size(offset, nghttp2_buf_len(&bp)); bp.pos += n; offset -= n; } for (;;) { inflate_flags = 0; - rv = nghttp2_hd_inflate_hd2(inflater, &nv, &inflate_flags, bp.pos, + rv = nghttp2_hd_inflate_hd3(inflater, &nv, &inflate_flags, bp.pos, nghttp2_buf_len(&bp), fin); if (rv < 0) { @@ -210,7 +208,7 @@ ssize_t inflate_hd(nghttp2_hd_inflater *inflater, nva_out *out, nghttp2_hd_inflate_end_headers(inflater); - return (ssize_t)processed; + return (nghttp2_ssize)processed; } int pack_headers(nghttp2_bufs *bufs, nghttp2_hd_deflater *deflater, @@ -262,49 +260,9 @@ void bufs_large_init(nghttp2_bufs *bufs, size_t chunk_size) { nghttp2_mem_default()); } -static nghttp2_stream *open_stream_with_all(nghttp2_session *session, - int32_t stream_id, int32_t weight, - uint8_t exclusive, - nghttp2_stream *dep_stream) { - nghttp2_priority_spec pri_spec; - int32_t dep_stream_id; - - if (dep_stream) { - dep_stream_id = dep_stream->stream_id; - } else { - dep_stream_id = 0; - } - - nghttp2_priority_spec_init(&pri_spec, dep_stream_id, weight, exclusive); - - return nghttp2_session_open_stream(session, stream_id, - NGHTTP2_STREAM_FLAG_NONE, &pri_spec, - NGHTTP2_STREAM_OPENED, NULL); -} - nghttp2_stream *open_stream(nghttp2_session *session, int32_t stream_id) { - return open_stream_with_all(session, stream_id, NGHTTP2_DEFAULT_WEIGHT, 0, - NULL); -} - -nghttp2_stream *open_stream_with_dep(nghttp2_session *session, - int32_t stream_id, - nghttp2_stream *dep_stream) { - return open_stream_with_all(session, stream_id, NGHTTP2_DEFAULT_WEIGHT, 0, - dep_stream); -} - -nghttp2_stream *open_stream_with_dep_weight(nghttp2_session *session, - int32_t stream_id, int32_t weight, - nghttp2_stream *dep_stream) { - return open_stream_with_all(session, stream_id, weight, 0, dep_stream); -} - -nghttp2_stream *open_stream_with_dep_excl(nghttp2_session *session, - int32_t stream_id, - nghttp2_stream *dep_stream) { - return open_stream_with_all(session, stream_id, NGHTTP2_DEFAULT_WEIGHT, 1, - dep_stream); + return nghttp2_session_open_stream( + session, stream_id, NGHTTP2_STREAM_FLAG_NONE, NGHTTP2_STREAM_OPENED, NULL); } nghttp2_outbound_item *create_data_ob_item(nghttp2_mem *mem) { @@ -317,119 +275,57 @@ nghttp2_outbound_item *create_data_ob_item(nghttp2_mem *mem) { } nghttp2_stream *open_sent_stream(nghttp2_session *session, int32_t stream_id) { - nghttp2_priority_spec pri_spec; - - nghttp2_priority_spec_init(&pri_spec, 0, NGHTTP2_DEFAULT_WEIGHT, 0); - return open_sent_stream3(session, stream_id, NGHTTP2_FLAG_NONE, &pri_spec, + return open_sent_stream3(session, stream_id, NGHTTP2_FLAG_NONE, NGHTTP2_STREAM_OPENED, NULL); } nghttp2_stream *open_sent_stream2(nghttp2_session *session, int32_t stream_id, nghttp2_stream_state initial_state) { - nghttp2_priority_spec pri_spec; - - nghttp2_priority_spec_init(&pri_spec, 0, NGHTTP2_DEFAULT_WEIGHT, 0); - return open_sent_stream3(session, stream_id, NGHTTP2_FLAG_NONE, &pri_spec, - initial_state, NULL); + return open_sent_stream3(session, stream_id, NGHTTP2_FLAG_NONE, initial_state, + NULL); } nghttp2_stream *open_sent_stream3(nghttp2_session *session, int32_t stream_id, uint8_t flags, - nghttp2_priority_spec *pri_spec_in, nghttp2_stream_state initial_state, void *stream_user_data) { nghttp2_stream *stream; assert(nghttp2_session_is_my_stream_id(session, stream_id)); - stream = nghttp2_session_open_stream(session, stream_id, flags, pri_spec_in, - initial_state, stream_user_data); + stream = nghttp2_session_open_stream(session, stream_id, flags, initial_state, + stream_user_data); session->last_sent_stream_id = - nghttp2_max(session->last_sent_stream_id, stream_id); + nghttp2_max_int32(session->last_sent_stream_id, stream_id); session->next_stream_id = - nghttp2_max(session->next_stream_id, (uint32_t)stream_id + 2); - - return stream; -} - -nghttp2_stream *open_sent_stream_with_dep(nghttp2_session *session, - int32_t stream_id, - nghttp2_stream *dep_stream) { - return open_sent_stream_with_dep_weight(session, stream_id, - NGHTTP2_DEFAULT_WEIGHT, dep_stream); -} - -nghttp2_stream *open_sent_stream_with_dep_weight(nghttp2_session *session, - int32_t stream_id, - int32_t weight, - nghttp2_stream *dep_stream) { - nghttp2_stream *stream; - - assert(nghttp2_session_is_my_stream_id(session, stream_id)); - - stream = open_stream_with_all(session, stream_id, weight, 0, dep_stream); - - session->last_sent_stream_id = - nghttp2_max(session->last_sent_stream_id, stream_id); - session->next_stream_id = - nghttp2_max(session->next_stream_id, (uint32_t)stream_id + 2); + nghttp2_max_uint32(session->next_stream_id, (uint32_t)stream_id + 2); return stream; } nghttp2_stream *open_recv_stream(nghttp2_session *session, int32_t stream_id) { - nghttp2_priority_spec pri_spec; - - nghttp2_priority_spec_init(&pri_spec, 0, NGHTTP2_DEFAULT_WEIGHT, 0); - return open_recv_stream3(session, stream_id, NGHTTP2_FLAG_NONE, &pri_spec, + return open_recv_stream3(session, stream_id, NGHTTP2_FLAG_NONE, NGHTTP2_STREAM_OPENED, NULL); } nghttp2_stream *open_recv_stream2(nghttp2_session *session, int32_t stream_id, nghttp2_stream_state initial_state) { - nghttp2_priority_spec pri_spec; - - nghttp2_priority_spec_init(&pri_spec, 0, NGHTTP2_DEFAULT_WEIGHT, 0); - return open_recv_stream3(session, stream_id, NGHTTP2_FLAG_NONE, &pri_spec, - initial_state, NULL); + return open_recv_stream3(session, stream_id, NGHTTP2_FLAG_NONE, initial_state, + NULL); } nghttp2_stream *open_recv_stream3(nghttp2_session *session, int32_t stream_id, uint8_t flags, - nghttp2_priority_spec *pri_spec_in, nghttp2_stream_state initial_state, void *stream_user_data) { nghttp2_stream *stream; assert(!nghttp2_session_is_my_stream_id(session, stream_id)); - stream = nghttp2_session_open_stream(session, stream_id, flags, pri_spec_in, - initial_state, stream_user_data); - session->last_recv_stream_id = - nghttp2_max(session->last_recv_stream_id, stream_id); - - return stream; -} - -nghttp2_stream *open_recv_stream_with_dep(nghttp2_session *session, - int32_t stream_id, - nghttp2_stream *dep_stream) { - return open_recv_stream_with_dep_weight(session, stream_id, - NGHTTP2_DEFAULT_WEIGHT, dep_stream); -} - -nghttp2_stream *open_recv_stream_with_dep_weight(nghttp2_session *session, - int32_t stream_id, - int32_t weight, - nghttp2_stream *dep_stream) { - nghttp2_stream *stream; - - assert(!nghttp2_session_is_my_stream_id(session, stream_id)); - - stream = open_stream_with_all(session, stream_id, weight, 0, dep_stream); - + stream = nghttp2_session_open_stream(session, stream_id, flags, initial_state, + stream_user_data); session->last_recv_stream_id = - nghttp2_max(session->last_recv_stream_id, stream_id); + nghttp2_max_int32(session->last_recv_stream_id, stream_id); return stream; } diff --git a/lib/nghttp2/tests/nghttp2_test_helper.h b/lib/nghttp2-1.65.0/tests/nghttp2_test_helper.h similarity index 55% rename from lib/nghttp2/tests/nghttp2_test_helper.h rename to lib/nghttp2-1.65.0/tests/nghttp2_test_helper.h index c66298a00aa..e5e87899fcd 100644 --- a/lib/nghttp2/tests/nghttp2_test_helper.h +++ b/lib/nghttp2-1.65.0/tests/nghttp2_test_helper.h @@ -35,29 +35,11 @@ #define MAKE_NV(NAME, VALUE) \ { \ - (uint8_t *)(NAME), (uint8_t *)(VALUE), sizeof((NAME)) - 1, \ - sizeof((VALUE)) - 1, NGHTTP2_NV_FLAG_NONE \ + (uint8_t *)(NAME), (uint8_t *)(VALUE), sizeof((NAME)) - 1, \ + sizeof((VALUE)) - 1, NGHTTP2_NV_FLAG_NONE, \ } #define ARRLEN(ARR) (sizeof(ARR) / sizeof(ARR[0])) -#define assert_nv_equal(A, B, len, mem) \ - do { \ - size_t alloclen = sizeof(nghttp2_nv) * len; \ - const nghttp2_nv *sa = A, *sb = B; \ - nghttp2_nv *a = mem->malloc(alloclen, NULL); \ - nghttp2_nv *b = mem->malloc(alloclen, NULL); \ - ssize_t i_; \ - memcpy(a, sa, alloclen); \ - memcpy(b, sb, alloclen); \ - nghttp2_nv_array_sort(a, len); \ - nghttp2_nv_array_sort(b, len); \ - for (i_ = 0; i_ < (ssize_t)len; ++i_) { \ - CU_ASSERT(nghttp2_nv_equal(&a[i_], &b[i_])); \ - } \ - mem->free(b, NULL); \ - mem->free(a, NULL); \ - } while (0); - int unpack_framebuf(nghttp2_frame *frame, nghttp2_bufs *bufs); int unpack_frame(nghttp2_frame *frame, const uint8_t *in, size_t len); @@ -78,8 +60,8 @@ void nva_out_reset(nva_out *out, nghttp2_mem *mem); void add_out(nva_out *out, nghttp2_nv *nv, nghttp2_mem *mem); -ssize_t inflate_hd(nghttp2_hd_inflater *inflater, nva_out *out, - nghttp2_bufs *bufs, size_t offset, nghttp2_mem *mem); +nghttp2_ssize inflate_hd(nghttp2_hd_inflater *inflater, nva_out *out, + nghttp2_bufs *bufs, size_t offset, nghttp2_mem *mem); int pack_headers(nghttp2_bufs *bufs, nghttp2_hd_deflater *deflater, int32_t stream_id, uint8_t flags, const nghttp2_nv *nva, @@ -96,18 +78,6 @@ void bufs_large_init(nghttp2_bufs *bufs, size_t chunk_size); nghttp2_stream *open_stream(nghttp2_session *session, int32_t stream_id); -nghttp2_stream *open_stream_with_dep(nghttp2_session *session, - int32_t stream_id, - nghttp2_stream *dep_stream); - -nghttp2_stream *open_stream_with_dep_weight(nghttp2_session *session, - int32_t stream_id, int32_t weight, - nghttp2_stream *dep_stream); - -nghttp2_stream *open_stream_with_dep_excl(nghttp2_session *session, - int32_t stream_id, - nghttp2_stream *dep_stream); - nghttp2_outbound_item *create_data_ob_item(nghttp2_mem *mem); /* Opens stream. This stream is assumed to be sent from |session|, @@ -120,19 +90,9 @@ nghttp2_stream *open_sent_stream2(nghttp2_session *session, int32_t stream_id, nghttp2_stream *open_sent_stream3(nghttp2_session *session, int32_t stream_id, uint8_t flags, - nghttp2_priority_spec *pri_spec_in, nghttp2_stream_state initial_state, void *stream_user_data); -nghttp2_stream *open_sent_stream_with_dep(nghttp2_session *session, - int32_t stream_id, - nghttp2_stream *dep_stream); - -nghttp2_stream *open_sent_stream_with_dep_weight(nghttp2_session *session, - int32_t stream_id, - int32_t weight, - nghttp2_stream *dep_stream); - /* Opens stream. This stream is assumed to be received by |session|, and session->last_recv_stream_id will be adjusted accordingly. */ nghttp2_stream *open_recv_stream(nghttp2_session *session, int32_t stream_id); @@ -142,17 +102,7 @@ nghttp2_stream *open_recv_stream2(nghttp2_session *session, int32_t stream_id, nghttp2_stream *open_recv_stream3(nghttp2_session *session, int32_t stream_id, uint8_t flags, - nghttp2_priority_spec *pri_spec_in, nghttp2_stream_state initial_state, void *stream_user_data); -nghttp2_stream *open_recv_stream_with_dep(nghttp2_session *session, - int32_t stream_id, - nghttp2_stream *dep_stream); - -nghttp2_stream *open_recv_stream_with_dep_weight(nghttp2_session *session, - int32_t stream_id, - int32_t weight, - nghttp2_stream *dep_stream); - #endif /* NGHTTP2_TEST_HELPER_H */ diff --git a/lib/nghttp2/tests/testdata/Makefile.am b/lib/nghttp2-1.65.0/tests/testdata/Makefile.am similarity index 100% rename from lib/nghttp2/tests/testdata/Makefile.am rename to lib/nghttp2-1.65.0/tests/testdata/Makefile.am diff --git a/lib/nghttp2-1.65.0/tests/testdata/Makefile.in b/lib/nghttp2-1.65.0/tests/testdata/Makefile.in new file mode 100644 index 00000000000..d128082aa15 --- /dev/null +++ b/lib/nghttp2-1.65.0/tests/testdata/Makefile.in @@ -0,0 +1,541 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2012 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = tests/testdata +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +EXTRA_DIST = cacert.pem index.html privkey.pem +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/testdata/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/testdata/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/tests/testdata/cacert.pem b/lib/nghttp2-1.65.0/tests/testdata/cacert.pem similarity index 100% rename from lib/nghttp2/tests/testdata/cacert.pem rename to lib/nghttp2-1.65.0/tests/testdata/cacert.pem diff --git a/lib/nghttp2/tests/testdata/index.html b/lib/nghttp2-1.65.0/tests/testdata/index.html similarity index 100% rename from lib/nghttp2/tests/testdata/index.html rename to lib/nghttp2-1.65.0/tests/testdata/index.html diff --git a/lib/nghttp2/tests/testdata/privkey.pem b/lib/nghttp2-1.65.0/tests/testdata/privkey.pem similarity index 100% rename from lib/nghttp2/tests/testdata/privkey.pem rename to lib/nghttp2-1.65.0/tests/testdata/privkey.pem diff --git a/lib/nghttp2/third-party/CMakeLists.txt b/lib/nghttp2-1.65.0/third-party/CMakeLists.txt similarity index 92% rename from lib/nghttp2/third-party/CMakeLists.txt rename to lib/nghttp2-1.65.0/third-party/CMakeLists.txt index b0ef0606279..f9f4f18512a 100644 --- a/lib/nghttp2/third-party/CMakeLists.txt +++ b/lib/nghttp2-1.65.0/third-party/CMakeLists.txt @@ -12,11 +12,11 @@ if(ENABLE_THIRD_PARTY) POSITION_INDEPENDENT_CODE ON ) - set(LIBURL_PARSER_SOURCES - url-parser/url_parser.c + set(LIBURLPARSE_SOURCES + urlparse/urlparse.c ) - add_library(url-parser OBJECT ${LIBURL_PARSER_SOURCES}) - set_target_properties(url-parser PROPERTIES + add_library(urlparse OBJECT ${LIBURLPARSE_SOURCES}) + set_target_properties(urlparse PROPERTIES POSITION_INDEPENDENT_CODE ON) if(HAVE_NEVERBLEED) @@ -29,6 +29,7 @@ if(ENABLE_THIRD_PARTY) "${CMAKE_SOURCE_DIR}/third-party/neverbleed" ) target_link_libraries(neverbleed ${OPENSSL_LIBRARIES}) + target_compile_definitions(neverbleed PUBLIC _GNU_SOURCE) endif() if(HAVE_MRUBY) diff --git a/lib/nghttp2/third-party/Makefile.am b/lib/nghttp2-1.65.0/third-party/Makefile.am similarity index 97% rename from lib/nghttp2/third-party/Makefile.am rename to lib/nghttp2-1.65.0/third-party/Makefile.am index 8b47532e2bd..8b297654629 100644 --- a/lib/nghttp2/third-party/Makefile.am +++ b/lib/nghttp2-1.65.0/third-party/Makefile.am @@ -29,11 +29,15 @@ EXTRA_DIST = CMakeLists.txt build_config.rb # find mruby -type f ! -ipath 'mruby/.*' | awk '{print "\t"$0" \\"}' EXTRA_DIST += \ mruby/AUTHORS \ + mruby/docker-compose.yml \ mruby/codespell.txt \ mruby/CONTRIBUTING.md \ mruby/NEWS \ mruby/CODEOWNERS \ + mruby/Gemfile.lock \ mruby/appveyor.yml \ + mruby/Dockerfile \ + mruby/Gemfile \ mruby/benchmark/plot.gpl \ mruby/benchmark/bm_ao_render.rb \ mruby/benchmark/bm_fib.rb \ @@ -52,6 +56,7 @@ EXTRA_DIST += \ mruby/tasks/benchmark.rake \ mruby/tasks/mrbgems.rake \ mruby/tasks/presym.rake \ + mruby/tasks/install.rake \ mruby/tasks/bin.rake \ mruby/tasks/test.rake \ mruby/tasks/mrblib.rake \ @@ -66,6 +71,8 @@ EXTRA_DIST += \ mruby/oss-fuzz/proto_to_ruby.h \ mruby/build_config/cross-mingw-winetest.rb \ mruby/build_config/host-f32.rb \ + mruby/build_config/nintendo_wii.rb \ + mruby/build_config/i586-pc-msdosdjgpp.rb \ mruby/build_config/chipKITMax32.rb \ mruby/build_config/gameboyadvance.rb \ mruby/build_config/minimal.rb \ @@ -90,7 +97,6 @@ EXTRA_DIST += \ mruby/build_config/clang-asan.rb \ mruby/build_config/RX630.rb \ mruby/build_config/host-nofloat.rb \ - mruby/build_config/android_armeabi.rb \ mruby/build_config/android_arm64_v8a.rb \ mruby/build_config/cross-32bit.rb \ mruby/build_config/cross-mingw.rb \ @@ -170,7 +176,6 @@ EXTRA_DIST += \ mruby/test/t/standarderror.rb \ mruby/test/t/superclass.rb \ mruby/test/assert.rb \ - mruby/super-linter.report/.keep \ mruby/TODO.md \ mruby/Doxyfile \ mruby/mrblib/00kernel.rb \ @@ -220,11 +225,12 @@ EXTRA_DIST += \ mruby/src/array.c \ mruby/src/dump.c \ mruby/src/class.c \ - mruby/src/compar.c \ mruby/src/value_array.h \ + mruby/src/allocf.c \ mruby/src/pool.c \ mruby/mruby-source.gemspec \ mruby/mrbgems/mruby-eval/mrbgem.rake \ + mruby/mrbgems/mruby-eval/test/binding.rb \ mruby/mrbgems/mruby-eval/test/eval.rb \ mruby/mrbgems/mruby-eval/src/eval.c \ mruby/mrbgems/stdlib.gembox \ @@ -244,7 +250,6 @@ EXTRA_DIST += \ mruby/mrbgems/mruby-method/mrbgem.rake \ mruby/mrbgems/mruby-method/README.md \ mruby/mrbgems/mruby-method/test/method.rb \ - mruby/mrbgems/mruby-method/mrblib/kernel.rb \ mruby/mrbgems/mruby-method/mrblib/method.rb \ mruby/mrbgems/mruby-method/src/method.c \ mruby/mrbgems/mruby-random/mrbgem.rake \ @@ -368,7 +373,6 @@ EXTRA_DIST += \ mruby/mrbgems/mruby-test-inline-struct/test/inline.rb \ mruby/mrbgems/mruby-time/mrbgem.rake \ mruby/mrbgems/mruby-time/test/time.rb \ - mruby/mrbgems/mruby-time/mrblib/time.rb \ mruby/mrbgems/mruby-time/src/time.c \ mruby/mrbgems/mruby-time/include/mruby/time.h \ mruby/mrbgems/mruby-proc-binding/mrbgem.rake \ @@ -408,10 +412,9 @@ EXTRA_DIST += \ mruby/mrbgems/mruby-numeric-ext/test/numeric.rb \ mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb \ mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c \ - mruby/mrbgems/mruby-binding-core/mrbgem.rake \ - mruby/mrbgems/mruby-binding-core/test/binding-core.rb \ - mruby/mrbgems/mruby-binding-core/src/binding-core.c \ mruby/mrbgems/mruby-fiber/mrbgem.rake \ + mruby/mrbgems/mruby-fiber/test/fiber2.rb \ + mruby/mrbgems/mruby-fiber/test/fibertest.c \ mruby/mrbgems/mruby-fiber/test/fiber.rb \ mruby/mrbgems/mruby-fiber/src/fiber.c \ mruby/mrbgems/mruby-complex/mrbgem.rake \ @@ -496,7 +499,9 @@ EXTRA_DIST += \ mruby/doc/internal/boxing.md \ mruby/doc/limitations.md \ mruby/doc/mruby3.2.md \ + mruby/doc/mruby3.3.md \ mruby/doc/guides/compile.md \ + mruby/doc/guides/memory.md \ mruby/doc/guides/mrbgems.md \ mruby/doc/guides/debugger.md \ mruby/doc/guides/link.md \ @@ -543,10 +548,10 @@ EXTRA_DIST += \ if ENABLE_THIRD_PARTY -noinst_LTLIBRARIES = liburl-parser.la -liburl_parser_la_SOURCES = \ - url-parser/url_parser.c \ - url-parser/url_parser.h +noinst_LTLIBRARIES = liburlparse.la +liburlparse_la_SOURCES = \ + urlparse/urlparse.c \ + urlparse/urlparse.h noinst_LTLIBRARIES += libllhttp.la libllhttp_la_SOURCES = \ @@ -558,7 +563,7 @@ libllhttp_la_CPPFLAGS = -I${srcdir}/llhttp/include if HAVE_NEVERBLEED noinst_LTLIBRARIES += libneverbleed.la -libneverbleed_la_CPPFLAGS = @OPENSSL_CFLAGS@ +libneverbleed_la_CPPFLAGS = @OPENSSL_CFLAGS@ -D_GNU_SOURCE libneverbleed_la_LIBADD = @OPENSSL_LIBS@ libneverbleed_la_SOURCES = neverbleed/neverbleed.c neverbleed/neverbleed.h endif # HAVE_NEVERBLEED diff --git a/lib/nghttp2-1.65.0/third-party/Makefile.in b/lib/nghttp2-1.65.0/third-party/Makefile.in new file mode 100644 index 00000000000..f39ff9079e5 --- /dev/null +++ b/lib/nghttp2-1.65.0/third-party/Makefile.in @@ -0,0 +1,1265 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# nghttp2 - HTTP/2 C Library + +# Copyright (c) 2014 Tatsuhiro Tsujikawa + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_NEVERBLEED_TRUE@am__append_1 = libneverbleed.la +subdir = third-party +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libllhttp_la_LIBADD = +am__libllhttp_la_SOURCES_DIST = llhttp/src/api.c llhttp/src/http.c \ + llhttp/src/llhttp.c llhttp/include/llhttp.h +am__dirstamp = $(am__leading_dot)dirstamp +@ENABLE_THIRD_PARTY_TRUE@am_libllhttp_la_OBJECTS = \ +@ENABLE_THIRD_PARTY_TRUE@ llhttp/src/libllhttp_la-api.lo \ +@ENABLE_THIRD_PARTY_TRUE@ llhttp/src/libllhttp_la-http.lo \ +@ENABLE_THIRD_PARTY_TRUE@ llhttp/src/libllhttp_la-llhttp.lo +libllhttp_la_OBJECTS = $(am_libllhttp_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +@ENABLE_THIRD_PARTY_TRUE@am_libllhttp_la_rpath = +libneverbleed_la_DEPENDENCIES = +am__libneverbleed_la_SOURCES_DIST = neverbleed/neverbleed.c \ + neverbleed/neverbleed.h +@ENABLE_THIRD_PARTY_TRUE@@HAVE_NEVERBLEED_TRUE@am_libneverbleed_la_OBJECTS = neverbleed/libneverbleed_la-neverbleed.lo +libneverbleed_la_OBJECTS = $(am_libneverbleed_la_OBJECTS) +@ENABLE_THIRD_PARTY_TRUE@@HAVE_NEVERBLEED_TRUE@am_libneverbleed_la_rpath = +liburlparse_la_LIBADD = +am__liburlparse_la_SOURCES_DIST = urlparse/urlparse.c \ + urlparse/urlparse.h +@ENABLE_THIRD_PARTY_TRUE@am_liburlparse_la_OBJECTS = \ +@ENABLE_THIRD_PARTY_TRUE@ urlparse/urlparse.lo +liburlparse_la_OBJECTS = $(am_liburlparse_la_OBJECTS) +@ENABLE_THIRD_PARTY_TRUE@am_liburlparse_la_rpath = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = llhttp/src/$(DEPDIR)/libllhttp_la-api.Plo \ + llhttp/src/$(DEPDIR)/libllhttp_la-http.Plo \ + llhttp/src/$(DEPDIR)/libllhttp_la-llhttp.Plo \ + neverbleed/$(DEPDIR)/libneverbleed_la-neverbleed.Plo \ + urlparse/$(DEPDIR)/urlparse.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libllhttp_la_SOURCES) $(libneverbleed_la_SOURCES) \ + $(liburlparse_la_SOURCES) +DIST_SOURCES = $(am__libllhttp_la_SOURCES_DIST) \ + $(am__libneverbleed_la_SOURCES_DIST) \ + $(am__liburlparse_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLDFLAGS = @APPLDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BPFCFLAGS = @BPFCFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXX1XCXXFLAGS = @CXX1XCXXFLAGS@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +EXTRABPFCFLAGS = @EXTRABPFCFLAGS@ +EXTRACFLAG = @EXTRACFLAG@ +EXTRA_DEFS = @EXTRA_DEFS@ +FGREP = @FGREP@ +FILECMD = @FILECMD@ +GREP = @GREP@ +HAVE_CXX20 = @HAVE_CXX20@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JANSSON_CFLAGS = @JANSSON_CFLAGS@ +JANSSON_LIBS = @JANSSON_LIBS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_LIBS = @JEMALLOC_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBBPF_CFLAGS = @LIBBPF_CFLAGS@ +LIBBPF_LIBS = @LIBBPF_LIBS@ +LIBBROTLIDEC_CFLAGS = @LIBBROTLIDEC_CFLAGS@ +LIBBROTLIDEC_LIBS = @LIBBROTLIDEC_LIBS@ +LIBBROTLIENC_CFLAGS = @LIBBROTLIENC_CFLAGS@ +LIBBROTLIENC_LIBS = @LIBBROTLIENC_LIBS@ +LIBCARES_CFLAGS = @LIBCARES_CFLAGS@ +LIBCARES_LIBS = @LIBCARES_LIBS@ +LIBEVENT_OPENSSL_CFLAGS = @LIBEVENT_OPENSSL_CFLAGS@ +LIBEVENT_OPENSSL_LIBS = @LIBEVENT_OPENSSL_LIBS@ +LIBEV_CFLAGS = @LIBEV_CFLAGS@ +LIBEV_LIBS = @LIBEV_LIBS@ +LIBMRUBY_CFLAGS = @LIBMRUBY_CFLAGS@ +LIBMRUBY_LIBS = @LIBMRUBY_LIBS@ +LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@ +LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@ +LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ +LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS = @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ +LIBNGTCP2_CRYPTO_QUICTLS_LIBS = @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ +LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS = @LIBNGTCP2_CRYPTO_WOLFSSL_CFLAGS@ +LIBNGTCP2_CRYPTO_WOLFSSL_LIBS = @LIBNGTCP2_CRYPTO_WOLFSSL_LIBS@ +LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_LDFLAGS = @LIBTOOL_LDFLAGS@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_NUM = @PACKAGE_VERSION_NUM@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS = @SYSTEMD_LIBS@ +TESTLDADD = @TESTLDADD@ +VERSION = @VERSION@ +WARNCFLAGS = @WARNCFLAGS@ +WARNCXXFLAGS = @WARNCXXFLAGS@ +WOLFSSL_CFLAGS = @WOLFSSL_CFLAGS@ +WOLFSSL_LIBS = @WOLFSSL_LIBS@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = @DEFS@ + +# Enumerate all mruby files with the following command: +# find mruby -type f ! -ipath 'mruby/.*' | awk '{print "\t"$0" \\"}' +EXTRA_DIST = CMakeLists.txt build_config.rb mruby/AUTHORS \ + mruby/docker-compose.yml mruby/codespell.txt \ + mruby/CONTRIBUTING.md mruby/NEWS mruby/CODEOWNERS \ + mruby/Gemfile.lock mruby/appveyor.yml mruby/Dockerfile \ + mruby/Gemfile mruby/benchmark/plot.gpl \ + mruby/benchmark/bm_ao_render.rb mruby/benchmark/bm_fib.rb \ + mruby/benchmark/bm_so_lists.rb \ + mruby/benchmark/bm_app_lc_fizzbuzz.rb mruby/Makefile \ + mruby/LEGAL mruby/tasks/libmruby.rake mruby/tasks/core.rake \ + mruby/tasks/toolchains/visualcpp.rake \ + mruby/tasks/toolchains/openwrt.rake \ + mruby/tasks/toolchains/android.rake \ + mruby/tasks/toolchains/gcc.rake \ + mruby/tasks/toolchains/clang.rake mruby/tasks/doc.rake \ + mruby/tasks/benchmark.rake mruby/tasks/mrbgems.rake \ + mruby/tasks/presym.rake mruby/tasks/install.rake \ + mruby/tasks/bin.rake mruby/tasks/test.rake \ + mruby/tasks/mrblib.rake mruby/README.md \ + mruby/oss-fuzz/ruby.proto mruby/oss-fuzz/proto_to_ruby.cpp \ + mruby/oss-fuzz/mruby_proto_fuzzer.cpp \ + mruby/oss-fuzz/config/mruby.dict \ + mruby/oss-fuzz/config/mruby_proto_fuzzer.options \ + mruby/oss-fuzz/config/mruby_fuzzer.options \ + mruby/oss-fuzz/mruby_fuzzer.c mruby/oss-fuzz/proto_to_ruby.h \ + mruby/build_config/cross-mingw-winetest.rb \ + mruby/build_config/host-f32.rb \ + mruby/build_config/nintendo_wii.rb \ + mruby/build_config/i586-pc-msdosdjgpp.rb \ + mruby/build_config/chipKITMax32.rb \ + mruby/build_config/gameboyadvance.rb \ + mruby/build_config/minimal.rb mruby/build_config/host-m32.rb \ + mruby/build_config/host-shared.rb \ + mruby/build_config/host-debug.rb mruby/build_config/bench.rb \ + mruby/build_config/host-cxx.rb mruby/build_config/mrbc.rb \ + mruby/build_config/ArduinoDue.rb \ + mruby/build_config/IntelEdison.rb mruby/build_config/boxing.rb \ + mruby/build_config/IntelGalileo.rb \ + mruby/build_config/ci/msvc.rb \ + mruby/build_config/ci/gcc-clang.rb \ + mruby/build_config/nintendo_switch.rb \ + mruby/build_config/serenity.rb \ + mruby/build_config/dreamcast_shelf.rb \ + mruby/build_config/default.rb \ + mruby/build_config/android_armeabi_v7a_neon_hard.rb \ + mruby/build_config/host-gprof.rb \ + mruby/build_config/clang-asan.rb mruby/build_config/RX630.rb \ + mruby/build_config/host-nofloat.rb \ + mruby/build_config/android_arm64_v8a.rb \ + mruby/build_config/cross-32bit.rb \ + mruby/build_config/cross-mingw.rb \ + mruby/build_config/helpers/wine_runner.rb \ + mruby/lib/mruby/build/command.rb \ + mruby/lib/mruby/build/load_gems.rb mruby/lib/mruby/lockfile.rb \ + mruby/lib/mruby/build.rb mruby/lib/mruby/core_ext.rb \ + mruby/lib/mruby/doc.rb mruby/lib/mruby/gem.rb \ + mruby/lib/mruby/presym.rb mruby/lib/mruby/source.rb \ + mruby/examples/mrbgems/ruby_extension_example/mrbgem.rake \ + mruby/examples/mrbgems/ruby_extension_example/README.md \ + mruby/examples/mrbgems/ruby_extension_example/test/example.rb \ + mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb \ + mruby/examples/mrbgems/cdata_extension_example/mrbgem.rake \ + mruby/examples/mrbgems/cdata_extension_example/README.md \ + mruby/examples/mrbgems/cdata_extension_example/test/example.c \ + mruby/examples/mrbgems/cdata_extension_example/src/example.c \ + mruby/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake \ + mruby/examples/mrbgems/c_and_ruby_extension_example/README.md \ + mruby/examples/mrbgems/c_and_ruby_extension_example/test/example.rb \ + mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb \ + mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c \ + mruby/examples/mrbgems/c_extension_example/mrbgem.rake \ + mruby/examples/mrbgems/c_extension_example/README.md \ + mruby/examples/mrbgems/c_extension_example/test/example.rb \ + mruby/examples/mrbgems/c_extension_example/test/example.c \ + mruby/examples/mrbgems/c_extension_example/src/example.c \ + mruby/examples/mrbgems/mruby-YOUR-bigint/TODO-HINT.md \ + mruby/examples/mrbgems/mruby-YOUR-bigint/core/bigint.c \ + mruby/examples/mrbgems/mruby-YOUR-bigint/mrbgem.rake \ + mruby/test/bintest.rb mruby/test/t/enumerable.rb \ + mruby/test/t/comparable.rb mruby/test/t/false.rb \ + mruby/test/t/exception.rb mruby/test/t/rangeerror.rb \ + mruby/test/t/bs_literal.rb mruby/test/t/regexperror.rb \ + mruby/test/t/class.rb mruby/test/t/iterations.rb \ + mruby/test/t/true.rb mruby/test/t/lang.rb \ + mruby/test/t/range.rb mruby/test/t/kernel.rb \ + mruby/test/t/unicode.rb mruby/test/t/localjumperror.rb \ + mruby/test/t/hash.rb mruby/test/t/syntax.rb \ + mruby/test/t/nameerror.rb mruby/test/t/module.rb \ + mruby/test/t/argumenterror.rb mruby/test/t/methods.rb \ + mruby/test/t/ensure.rb mruby/test/t/indexerror.rb \ + mruby/test/t/runtimeerror.rb mruby/test/t/gc.rb \ + mruby/test/t/array.rb mruby/test/t/string.rb \ + mruby/test/t/proc.rb mruby/test/t/basicobject.rb \ + mruby/test/t/integer.rb mruby/test/t/nomethoderror.rb \ + mruby/test/t/codegen.rb mruby/test/t/literals.rb \ + mruby/test/t/nil.rb mruby/test/t/typeerror.rb \ + mruby/test/t/symbol.rb mruby/test/t/object.rb \ + mruby/test/t/vformat.rb mruby/test/t/numeric.rb \ + mruby/test/t/bs_block.rb mruby/test/t/float.rb \ + mruby/test/t/standarderror.rb mruby/test/t/superclass.rb \ + mruby/test/assert.rb mruby/TODO.md mruby/Doxyfile \ + mruby/mrblib/00kernel.rb mruby/mrblib/range.rb \ + mruby/mrblib/kernel.rb mruby/mrblib/hash.rb \ + mruby/mrblib/00class.rb mruby/mrblib/10error.rb \ + mruby/mrblib/array.rb mruby/mrblib/string.rb \ + mruby/mrblib/compar.rb mruby/mrblib/symbol.rb \ + mruby/mrblib/enum.rb mruby/mrblib/numeric.rb \ + mruby/build_config.rb mruby/LICENSE mruby/src/etc.c \ + mruby/src/variable.c mruby/src/cdump.c mruby/src/init.c \ + mruby/src/opcode.h mruby/src/gc.c mruby/src/load.c \ + mruby/src/codedump.c mruby/src/error.c mruby/src/readfloat.c \ + mruby/src/state.c mruby/src/string.c mruby/src/numeric.c \ + mruby/src/readnum.c mruby/src/enum.c mruby/src/print.c \ + mruby/src/readint.c mruby/src/numops.c mruby/src/hash.c \ + mruby/src/version.c mruby/src/backtrace.c mruby/src/fmt_fp.c \ + mruby/src/range.c mruby/src/vm.c mruby/src/debug.c \ + mruby/src/symbol.c mruby/src/error.h mruby/src/kernel.c \ + mruby/src/object.c mruby/src/proc.c mruby/src/array.c \ + mruby/src/dump.c mruby/src/class.c mruby/src/value_array.h \ + mruby/src/allocf.c mruby/src/pool.c mruby/mruby-source.gemspec \ + mruby/mrbgems/mruby-eval/mrbgem.rake \ + mruby/mrbgems/mruby-eval/test/binding.rb \ + mruby/mrbgems/mruby-eval/test/eval.rb \ + mruby/mrbgems/mruby-eval/src/eval.c \ + mruby/mrbgems/stdlib.gembox \ + mruby/mrbgems/mruby-string-ext/mrbgem.rake \ + mruby/mrbgems/mruby-string-ext/test/range.rb \ + mruby/mrbgems/mruby-string-ext/test/string.rb \ + mruby/mrbgems/mruby-string-ext/test/numeric.rb \ + mruby/mrbgems/mruby-string-ext/mrblib/string.rb \ + mruby/mrbgems/mruby-string-ext/src/string.c \ + mruby/mrbgems/default-no-stdio.gembox \ + mruby/mrbgems/mruby-set/mrbgem.rake \ + mruby/mrbgems/mruby-set/README.md \ + mruby/mrbgems/mruby-set/test/set.rb \ + mruby/mrbgems/mruby-set/mrblib/set.rb \ + mruby/mrbgems/mruby-set/LICENSE \ + mruby/mrbgems/mruby-set/mruby-set.gem \ + mruby/mrbgems/mruby-method/mrbgem.rake \ + mruby/mrbgems/mruby-method/README.md \ + mruby/mrbgems/mruby-method/test/method.rb \ + mruby/mrbgems/mruby-method/mrblib/method.rb \ + mruby/mrbgems/mruby-method/src/method.c \ + mruby/mrbgems/mruby-random/mrbgem.rake \ + mruby/mrbgems/mruby-random/test/random.rb \ + mruby/mrbgems/mruby-random/src/random.c \ + mruby/mrbgems/mruby-catch/mrbgem.rake \ + mruby/mrbgems/mruby-catch/test/catch.rb \ + mruby/mrbgems/mruby-catch/mrblib/catch.rb \ + mruby/mrbgems/mruby-catch/src/catch.c \ + mruby/mrbgems/mruby-cmath/mrbgem.rake \ + mruby/mrbgems/mruby-cmath/test/cmath.rb \ + mruby/mrbgems/mruby-cmath/src/cmath.c \ + mruby/mrbgems/mruby-compar-ext/mrbgem.rake \ + mruby/mrbgems/mruby-compar-ext/mrblib/compar.rb \ + mruby/mrbgems/mruby-pack/mrbgem.rake \ + mruby/mrbgems/mruby-pack/README.md \ + mruby/mrbgems/mruby-pack/test/pack.rb \ + mruby/mrbgems/mruby-pack/src/pack.c \ + mruby/mrbgems/mruby-struct/mrbgem.rake \ + mruby/mrbgems/mruby-struct/test/struct.rb \ + mruby/mrbgems/mruby-struct/mrblib/struct.rb \ + mruby/mrbgems/mruby-struct/src/struct.c \ + mruby/mrbgems/mruby-bigint/core/bigint.c \ + mruby/mrbgems/mruby-bigint/core/bigint.h \ + mruby/mrbgems/mruby-bigint/mrbgem.rake \ + mruby/mrbgems/mruby-bigint/README.md \ + mruby/mrbgems/mruby-bigint/test/bigint.rb \ + mruby/mrbgems/mruby-bigint/README-fgmp.md \ + mruby/mrbgems/mruby-symbol-ext/mrbgem.rake \ + mruby/mrbgems/mruby-symbol-ext/test/symbol.rb \ + mruby/mrbgems/mruby-symbol-ext/mrblib/symbol.rb \ + mruby/mrbgems/mruby-symbol-ext/src/symbol.c \ + mruby/mrbgems/mruby-io/mrbgem.rake \ + mruby/mrbgems/mruby-io/README.md \ + mruby/mrbgems/mruby-io/test/mruby_io_test.c \ + mruby/mrbgems/mruby-io/test/io.rb \ + mruby/mrbgems/mruby-io/test/file.rb \ + mruby/mrbgems/mruby-io/test/file_test.rb \ + mruby/mrbgems/mruby-io/mrblib/io.rb \ + mruby/mrbgems/mruby-io/mrblib/file.rb \ + mruby/mrbgems/mruby-io/mrblib/file_constants.rb \ + mruby/mrbgems/mruby-io/mrblib/kernel.rb \ + mruby/mrbgems/mruby-io/src/mruby_io_gem.c \ + mruby/mrbgems/mruby-io/src/file_test.c \ + mruby/mrbgems/mruby-io/src/io.c \ + mruby/mrbgems/mruby-io/src/file.c \ + mruby/mrbgems/mruby-io/include/mruby/ext/io.h \ + mruby/mrbgems/mruby-compiler/core/parse.y \ + mruby/mrbgems/mruby-compiler/core/y.tab.c \ + mruby/mrbgems/mruby-compiler/core/node.h \ + mruby/mrbgems/mruby-compiler/core/keywords \ + mruby/mrbgems/mruby-compiler/core/codegen.c \ + mruby/mrbgems/mruby-compiler/core/lex.def \ + mruby/mrbgems/mruby-compiler/mrbgem.rake \ + mruby/mrbgems/mruby-bin-config/mrbgem.rake \ + mruby/mrbgems/mruby-bin-config/mruby-config \ + mruby/mrbgems/mruby-bin-config/mruby-config.bat \ + mruby/mrbgems/mruby-proc-ext/mrbgem.rake \ + mruby/mrbgems/mruby-proc-ext/test/proc.rb \ + mruby/mrbgems/mruby-proc-ext/test/proc.c \ + mruby/mrbgems/mruby-proc-ext/mrblib/proc.rb \ + mruby/mrbgems/mruby-proc-ext/src/proc.c \ + mruby/mrbgems/mruby-data/mrbgem.rake \ + mruby/mrbgems/mruby-data/test/data.rb \ + mruby/mrbgems/mruby-data/src/data.c \ + mruby/mrbgems/mruby-dir/mrbgem.rake \ + mruby/mrbgems/mruby-dir/README.md \ + mruby/mrbgems/mruby-dir/test/dir.rb \ + mruby/mrbgems/mruby-dir/test/dirtest.c \ + mruby/mrbgems/mruby-dir/mrblib/dir.rb \ + mruby/mrbgems/mruby-dir/src/Win/dirent.c \ + mruby/mrbgems/mruby-dir/src/dir.c \ + mruby/mrbgems/mruby-object-ext/mrbgem.rake \ + mruby/mrbgems/mruby-object-ext/test/nil.rb \ + mruby/mrbgems/mruby-object-ext/test/object.rb \ + mruby/mrbgems/mruby-object-ext/mrblib/object.rb \ + mruby/mrbgems/mruby-object-ext/src/object.c \ + mruby/mrbgems/mruby-kernel-ext/mrbgem.rake \ + mruby/mrbgems/mruby-kernel-ext/test/kernel.rb \ + mruby/mrbgems/mruby-kernel-ext/src/kernel.c \ + mruby/mrbgems/mruby-class-ext/mrbgem.rake \ + mruby/mrbgems/mruby-class-ext/test/class.rb \ + mruby/mrbgems/mruby-class-ext/test/module.rb \ + mruby/mrbgems/mruby-class-ext/mrblib/module.rb \ + mruby/mrbgems/mruby-class-ext/src/class.c \ + mruby/mrbgems/mruby-binding/mrbgem.rake \ + mruby/mrbgems/mruby-binding/test/binding.rb \ + mruby/mrbgems/mruby-binding/test/binding.c \ + mruby/mrbgems/mruby-binding/src/binding.c \ + mruby/mrbgems/mruby-print/mrbgem.rake \ + mruby/mrbgems/mruby-print/mrblib/print.rb \ + mruby/mrbgems/mruby-print/src/print.c \ + mruby/mrbgems/mruby-hash-ext/mrbgem.rake \ + mruby/mrbgems/mruby-hash-ext/test/hash.rb \ + mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb \ + mruby/mrbgems/mruby-hash-ext/src/hash-ext.c \ + mruby/mrbgems/mruby-sleep/example/sleep.rb \ + mruby/mrbgems/mruby-sleep/mrbgem.rake \ + mruby/mrbgems/mruby-sleep/README.md \ + mruby/mrbgems/mruby-sleep/test/sleep_test.rb \ + mruby/mrbgems/mruby-sleep/src/sleep.c \ + mruby/mrbgems/mruby-sprintf/mrbgem.rake \ + mruby/mrbgems/mruby-sprintf/test/sprintf.rb \ + mruby/mrbgems/mruby-sprintf/mrblib/string.rb \ + mruby/mrbgems/mruby-sprintf/src/sprintf.c \ + mruby/mrbgems/mruby-enum-chain/mrbgem.rake \ + mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb \ + mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb \ + mruby/mrbgems/mruby-range-ext/mrbgem.rake \ + mruby/mrbgems/mruby-range-ext/test/range.rb \ + mruby/mrbgems/mruby-range-ext/mrblib/range.rb \ + mruby/mrbgems/mruby-range-ext/src/range.c \ + mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c \ + mruby/mrbgems/mruby-bin-mirb/mrbgem.rake \ + mruby/mrbgems/mruby-bin-mirb/bintest/mirb.rb \ + mruby/mrbgems/mruby-metaprog/mrbgem.rake \ + mruby/mrbgems/mruby-metaprog/test/metaprog.rb \ + mruby/mrbgems/mruby-metaprog/src/metaprog.c \ + mruby/mrbgems/mruby-test-inline-struct/mrbgem.rake \ + mruby/mrbgems/mruby-test-inline-struct/test/inline.c \ + mruby/mrbgems/mruby-test-inline-struct/test/inline.rb \ + mruby/mrbgems/mruby-time/mrbgem.rake \ + mruby/mrbgems/mruby-time/test/time.rb \ + mruby/mrbgems/mruby-time/src/time.c \ + mruby/mrbgems/mruby-time/include/mruby/time.h \ + mruby/mrbgems/mruby-proc-binding/mrbgem.rake \ + mruby/mrbgems/mruby-proc-binding/test/proc-binding.c \ + mruby/mrbgems/mruby-proc-binding/test/proc-binding.rb \ + mruby/mrbgems/mruby-proc-binding/src/proc-binding.c \ + mruby/mrbgems/stdlib-ext.gembox mruby/mrbgems/metaprog.gembox \ + mruby/mrbgems/mruby-enumerator/mrbgem.rake \ + mruby/mrbgems/mruby-enumerator/test/enumerator.rb \ + mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb \ + mruby/mrbgems/math.gembox \ + mruby/mrbgems/mruby-socket/mrbgem.rake \ + mruby/mrbgems/mruby-socket/README.md \ + mruby/mrbgems/mruby-socket/test/socket.rb \ + mruby/mrbgems/mruby-socket/test/udpsocket.rb \ + mruby/mrbgems/mruby-socket/test/tcpsocket.rb \ + mruby/mrbgems/mruby-socket/test/sockettest.c \ + mruby/mrbgems/mruby-socket/test/basicsocket.rb \ + mruby/mrbgems/mruby-socket/test/addrinfo.rb \ + mruby/mrbgems/mruby-socket/test/unix.rb \ + mruby/mrbgems/mruby-socket/test/ipsocket.rb \ + mruby/mrbgems/mruby-socket/mrblib/socket.rb \ + mruby/mrbgems/mruby-socket/src/socket.c \ + mruby/mrbgems/mruby-socket/src/gen.rb \ + mruby/mrbgems/mruby-socket/src/const.cstub \ + mruby/mrbgems/mruby-socket/src/const.def \ + mruby/mrbgems/mruby-objectspace/mrbgem.rake \ + mruby/mrbgems/mruby-objectspace/test/objectspace.rb \ + mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c \ + mruby/mrbgems/full-core.gembox \ + mruby/mrbgems/mruby-rational/mrbgem.rake \ + mruby/mrbgems/mruby-rational/test/rational.rb \ + mruby/mrbgems/mruby-rational/mrblib/rational.rb \ + mruby/mrbgems/mruby-rational/src/rational.c \ + mruby/mrbgems/mruby-numeric-ext/mrbgem.rake \ + mruby/mrbgems/mruby-numeric-ext/test/numeric.rb \ + mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb \ + mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c \ + mruby/mrbgems/mruby-fiber/mrbgem.rake \ + mruby/mrbgems/mruby-fiber/test/fiber2.rb \ + mruby/mrbgems/mruby-fiber/test/fibertest.c \ + mruby/mrbgems/mruby-fiber/test/fiber.rb \ + mruby/mrbgems/mruby-fiber/src/fiber.c \ + mruby/mrbgems/mruby-complex/mrbgem.rake \ + mruby/mrbgems/mruby-complex/test/complex.rb \ + mruby/mrbgems/mruby-complex/mrblib/complex.rb \ + mruby/mrbgems/mruby-complex/src/complex.c \ + mruby/mrbgems/mruby-exit/mrbgem.rake \ + mruby/mrbgems/mruby-exit/src/mruby-exit.c \ + mruby/mrbgems/mruby-error/mrbgem.rake \ + mruby/mrbgems/mruby-error/test/exception.rb \ + mruby/mrbgems/mruby-error/test/exception.c \ + mruby/mrbgems/mruby-error/src/exception.c \ + mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c \ + mruby/mrbgems/mruby-bin-mruby/mrbgem.rake \ + mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb \ + mruby/mrbgems/mruby-test/mrbgem.rake \ + mruby/mrbgems/mruby-test/vformat.c \ + mruby/mrbgems/mruby-test/README.md \ + mruby/mrbgems/mruby-test/driver.c \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdbreak.c \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdrun.c \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apistring.h \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.h \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.h \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdberror.h \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apistring.c \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.h \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c \ + mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apilist.c \ + mruby/mrbgems/mruby-bin-debugger/mrbgem.rake \ + mruby/mrbgems/mruby-bin-debugger/bintest/mrdb.rb \ + mruby/mrbgems/mruby-bin-debugger/bintest/print.rb \ + mruby/mrbgems/mruby-array-ext/mrbgem.rake \ + mruby/mrbgems/mruby-array-ext/test/array.rb \ + mruby/mrbgems/mruby-array-ext/mrblib/array.rb \ + mruby/mrbgems/mruby-array-ext/src/array.c \ + mruby/mrbgems/mruby-enum-lazy/mrbgem.rake \ + mruby/mrbgems/mruby-enum-lazy/test/lazy.rb \ + mruby/mrbgems/mruby-enum-lazy/mrblib/lazy.rb \ + mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c \ + mruby/mrbgems/mruby-bin-strip/mrbgem.rake \ + mruby/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb \ + mruby/mrbgems/mruby-errno/mrbgem.rake \ + mruby/mrbgems/mruby-errno/README.md \ + mruby/mrbgems/mruby-errno/test/errno.rb \ + mruby/mrbgems/mruby-errno/mrblib/errno.rb \ + mruby/mrbgems/mruby-errno/src/gen.rb \ + mruby/mrbgems/mruby-errno/src/known_errors_def.cstub \ + mruby/mrbgems/mruby-errno/src/known_errors.def \ + mruby/mrbgems/mruby-errno/src/errno.c \ + mruby/mrbgems/mruby-toplevel-ext/mrbgem.rake \ + mruby/mrbgems/mruby-toplevel-ext/test/toplevel.rb \ + mruby/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb \ + mruby/mrbgems/mruby-math/mrbgem.rake \ + mruby/mrbgems/mruby-math/test/math.rb \ + mruby/mrbgems/mruby-math/src/math.c \ + mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/stub.c \ + mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c \ + mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake \ + mruby/mrbgems/mruby-bin-mrbc/bintest/mrbc.rb \ + mruby/mrbgems/stdlib-io.gembox mruby/mrbgems/default.gembox \ + mruby/mrbgems/mruby-os-memsize/mrbgem.rake \ + mruby/mrbgems/mruby-os-memsize/test/memsize.rb \ + mruby/mrbgems/mruby-os-memsize/src/memsize.c \ + mruby/mrbgems/default-no-fpu.gembox \ + mruby/mrbgems/mruby-enum-ext/mrbgem.rake \ + mruby/mrbgems/mruby-enum-ext/test/enum.rb \ + mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb mruby/Rakefile \ + mruby/SECURITY.md mruby/doc/mruby_logo_red_icon.png \ + mruby/doc/mruby3.0.md mruby/doc/mruby3.1.md \ + mruby/doc/internal/opcode.md mruby/doc/internal/boxing.md \ + mruby/doc/limitations.md mruby/doc/mruby3.2.md \ + mruby/doc/mruby3.3.md mruby/doc/guides/compile.md \ + mruby/doc/guides/memory.md mruby/doc/guides/mrbgems.md \ + mruby/doc/guides/debugger.md mruby/doc/guides/link.md \ + mruby/doc/guides/symbol.md mruby/doc/guides/gc-arena-howto.md \ + mruby/doc/guides/mrbconf.md mruby/minirake \ + mruby/include/mruby/opcode.h mruby/include/mruby/re.h \ + mruby/include/mruby/hash.h mruby/include/mruby/string.h \ + mruby/include/mruby/presym.h mruby/include/mruby/object.h \ + mruby/include/mruby/class.h mruby/include/mruby/ops.h \ + mruby/include/mruby/irep.h mruby/include/mruby/compile.h \ + mruby/include/mruby/array.h mruby/include/mruby/range.h \ + mruby/include/mruby/throw.h mruby/include/mruby/variable.h \ + mruby/include/mruby/boxing_word.h \ + mruby/include/mruby/istruct.h mruby/include/mruby/data.h \ + mruby/include/mruby/common.h mruby/include/mruby/error.h \ + mruby/include/mruby/debug.h mruby/include/mruby/boxing_no.h \ + mruby/include/mruby/numeric.h mruby/include/mruby/boxing_nan.h \ + mruby/include/mruby/value.h mruby/include/mruby/endian.h \ + mruby/include/mruby/internal.h mruby/include/mruby/dump.h \ + mruby/include/mruby/version.h mruby/include/mruby/khash.h \ + mruby/include/mruby/gc.h mruby/include/mruby/presym/enable.h \ + mruby/include/mruby/presym/disable.h \ + mruby/include/mruby/presym/scanning.h \ + mruby/include/mruby/proc.h mruby/include/mrbconf.h \ + mruby/include/mruby.h +@ENABLE_THIRD_PARTY_TRUE@noinst_LTLIBRARIES = liburlparse.la \ +@ENABLE_THIRD_PARTY_TRUE@ libllhttp.la $(am__append_1) +@ENABLE_THIRD_PARTY_TRUE@liburlparse_la_SOURCES = \ +@ENABLE_THIRD_PARTY_TRUE@ urlparse/urlparse.c \ +@ENABLE_THIRD_PARTY_TRUE@ urlparse/urlparse.h + +@ENABLE_THIRD_PARTY_TRUE@libllhttp_la_SOURCES = \ +@ENABLE_THIRD_PARTY_TRUE@ llhttp/src/api.c \ +@ENABLE_THIRD_PARTY_TRUE@ llhttp/src/http.c \ +@ENABLE_THIRD_PARTY_TRUE@ llhttp/src/llhttp.c \ +@ENABLE_THIRD_PARTY_TRUE@ llhttp/include/llhttp.h + +@ENABLE_THIRD_PARTY_TRUE@libllhttp_la_CPPFLAGS = -I${srcdir}/llhttp/include +@ENABLE_THIRD_PARTY_TRUE@@HAVE_NEVERBLEED_TRUE@libneverbleed_la_CPPFLAGS = @OPENSSL_CFLAGS@ -D_GNU_SOURCE +@ENABLE_THIRD_PARTY_TRUE@@HAVE_NEVERBLEED_TRUE@libneverbleed_la_LIBADD = @OPENSSL_LIBS@ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_NEVERBLEED_TRUE@libneverbleed_la_SOURCES = neverbleed/neverbleed.c neverbleed/neverbleed.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu third-party/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu third-party/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +llhttp/src/$(am__dirstamp): + @$(MKDIR_P) llhttp/src + @: > llhttp/src/$(am__dirstamp) +llhttp/src/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) llhttp/src/$(DEPDIR) + @: > llhttp/src/$(DEPDIR)/$(am__dirstamp) +llhttp/src/libllhttp_la-api.lo: llhttp/src/$(am__dirstamp) \ + llhttp/src/$(DEPDIR)/$(am__dirstamp) +llhttp/src/libllhttp_la-http.lo: llhttp/src/$(am__dirstamp) \ + llhttp/src/$(DEPDIR)/$(am__dirstamp) +llhttp/src/libllhttp_la-llhttp.lo: llhttp/src/$(am__dirstamp) \ + llhttp/src/$(DEPDIR)/$(am__dirstamp) + +libllhttp.la: $(libllhttp_la_OBJECTS) $(libllhttp_la_DEPENDENCIES) $(EXTRA_libllhttp_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libllhttp_la_rpath) $(libllhttp_la_OBJECTS) $(libllhttp_la_LIBADD) $(LIBS) +neverbleed/$(am__dirstamp): + @$(MKDIR_P) neverbleed + @: > neverbleed/$(am__dirstamp) +neverbleed/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) neverbleed/$(DEPDIR) + @: > neverbleed/$(DEPDIR)/$(am__dirstamp) +neverbleed/libneverbleed_la-neverbleed.lo: neverbleed/$(am__dirstamp) \ + neverbleed/$(DEPDIR)/$(am__dirstamp) + +libneverbleed.la: $(libneverbleed_la_OBJECTS) $(libneverbleed_la_DEPENDENCIES) $(EXTRA_libneverbleed_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libneverbleed_la_rpath) $(libneverbleed_la_OBJECTS) $(libneverbleed_la_LIBADD) $(LIBS) +urlparse/$(am__dirstamp): + @$(MKDIR_P) urlparse + @: > urlparse/$(am__dirstamp) +urlparse/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) urlparse/$(DEPDIR) + @: > urlparse/$(DEPDIR)/$(am__dirstamp) +urlparse/urlparse.lo: urlparse/$(am__dirstamp) \ + urlparse/$(DEPDIR)/$(am__dirstamp) + +liburlparse.la: $(liburlparse_la_OBJECTS) $(liburlparse_la_DEPENDENCIES) $(EXTRA_liburlparse_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_liburlparse_la_rpath) $(liburlparse_la_OBJECTS) $(liburlparse_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f llhttp/src/*.$(OBJEXT) + -rm -f llhttp/src/*.lo + -rm -f neverbleed/*.$(OBJEXT) + -rm -f neverbleed/*.lo + -rm -f urlparse/*.$(OBJEXT) + -rm -f urlparse/*.lo + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@llhttp/src/$(DEPDIR)/libllhttp_la-api.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@llhttp/src/$(DEPDIR)/libllhttp_la-http.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@llhttp/src/$(DEPDIR)/libllhttp_la-llhttp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@neverbleed/$(DEPDIR)/libneverbleed_la-neverbleed.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@urlparse/$(DEPDIR)/urlparse.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +llhttp/src/libllhttp_la-api.lo: llhttp/src/api.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libllhttp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT llhttp/src/libllhttp_la-api.lo -MD -MP -MF llhttp/src/$(DEPDIR)/libllhttp_la-api.Tpo -c -o llhttp/src/libllhttp_la-api.lo `test -f 'llhttp/src/api.c' || echo '$(srcdir)/'`llhttp/src/api.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) llhttp/src/$(DEPDIR)/libllhttp_la-api.Tpo llhttp/src/$(DEPDIR)/libllhttp_la-api.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='llhttp/src/api.c' object='llhttp/src/libllhttp_la-api.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libllhttp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o llhttp/src/libllhttp_la-api.lo `test -f 'llhttp/src/api.c' || echo '$(srcdir)/'`llhttp/src/api.c + +llhttp/src/libllhttp_la-http.lo: llhttp/src/http.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libllhttp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT llhttp/src/libllhttp_la-http.lo -MD -MP -MF llhttp/src/$(DEPDIR)/libllhttp_la-http.Tpo -c -o llhttp/src/libllhttp_la-http.lo `test -f 'llhttp/src/http.c' || echo '$(srcdir)/'`llhttp/src/http.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) llhttp/src/$(DEPDIR)/libllhttp_la-http.Tpo llhttp/src/$(DEPDIR)/libllhttp_la-http.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='llhttp/src/http.c' object='llhttp/src/libllhttp_la-http.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libllhttp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o llhttp/src/libllhttp_la-http.lo `test -f 'llhttp/src/http.c' || echo '$(srcdir)/'`llhttp/src/http.c + +llhttp/src/libllhttp_la-llhttp.lo: llhttp/src/llhttp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libllhttp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT llhttp/src/libllhttp_la-llhttp.lo -MD -MP -MF llhttp/src/$(DEPDIR)/libllhttp_la-llhttp.Tpo -c -o llhttp/src/libllhttp_la-llhttp.lo `test -f 'llhttp/src/llhttp.c' || echo '$(srcdir)/'`llhttp/src/llhttp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) llhttp/src/$(DEPDIR)/libllhttp_la-llhttp.Tpo llhttp/src/$(DEPDIR)/libllhttp_la-llhttp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='llhttp/src/llhttp.c' object='llhttp/src/libllhttp_la-llhttp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libllhttp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o llhttp/src/libllhttp_la-llhttp.lo `test -f 'llhttp/src/llhttp.c' || echo '$(srcdir)/'`llhttp/src/llhttp.c + +neverbleed/libneverbleed_la-neverbleed.lo: neverbleed/neverbleed.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libneverbleed_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT neverbleed/libneverbleed_la-neverbleed.lo -MD -MP -MF neverbleed/$(DEPDIR)/libneverbleed_la-neverbleed.Tpo -c -o neverbleed/libneverbleed_la-neverbleed.lo `test -f 'neverbleed/neverbleed.c' || echo '$(srcdir)/'`neverbleed/neverbleed.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) neverbleed/$(DEPDIR)/libneverbleed_la-neverbleed.Tpo neverbleed/$(DEPDIR)/libneverbleed_la-neverbleed.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='neverbleed/neverbleed.c' object='neverbleed/libneverbleed_la-neverbleed.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libneverbleed_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o neverbleed/libneverbleed_la-neverbleed.lo `test -f 'neverbleed/neverbleed.c' || echo '$(srcdir)/'`neverbleed/neverbleed.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf llhttp/src/.libs llhttp/src/_libs + -rm -rf neverbleed/.libs neverbleed/_libs + -rm -rf urlparse/.libs urlparse/_libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +@ENABLE_THIRD_PARTY_FALSE@all-local: +@HAVE_MRUBY_FALSE@all-local: +all-am: Makefile $(LTLIBRARIES) all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f llhttp/src/$(DEPDIR)/$(am__dirstamp) + -rm -f llhttp/src/$(am__dirstamp) + -rm -f neverbleed/$(DEPDIR)/$(am__dirstamp) + -rm -f neverbleed/$(am__dirstamp) + -rm -f urlparse/$(DEPDIR)/$(am__dirstamp) + -rm -f urlparse/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +@ENABLE_THIRD_PARTY_FALSE@clean-local: +@HAVE_MRUBY_FALSE@clean-local: +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f llhttp/src/$(DEPDIR)/libllhttp_la-api.Plo + -rm -f llhttp/src/$(DEPDIR)/libllhttp_la-http.Plo + -rm -f llhttp/src/$(DEPDIR)/libllhttp_la-llhttp.Plo + -rm -f neverbleed/$(DEPDIR)/libneverbleed_la-neverbleed.Plo + -rm -f urlparse/$(DEPDIR)/urlparse.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f llhttp/src/$(DEPDIR)/libllhttp_la-api.Plo + -rm -f llhttp/src/$(DEPDIR)/libllhttp_la-http.Plo + -rm -f llhttp/src/$(DEPDIR)/libllhttp_la-llhttp.Plo + -rm -f neverbleed/$(DEPDIR)/libneverbleed_la-neverbleed.Plo + -rm -f urlparse/$(DEPDIR)/urlparse.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am all-local am--depfiles check \ + check-am clean clean-generic clean-libtool clean-local \ + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@.PHONY: all-local clean mruby + +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@mruby: +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ mkdir -p "${abs_builddir}/mruby/build" +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ diff "${srcdir}/build_config.rb" "${abs_builddir}/mruby/build/build_config.rb" >& /dev/null || \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ cp "${srcdir}/build_config.rb" "${abs_builddir}/mruby/build" +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ BUILD_DIR="${abs_builddir}/mruby/build" \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ INSTALL_DIR="${abs_builddir}/mruby/build/install/bin" \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ MRUBY_CC="${CC}" MRUBY_CXX="$(firstword $(CXX))" MRUBY_LD="${LD}" \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ MRUBY_AR="${AR}" \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ HOST="${host}" BUILD="${build}" \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ "${srcdir}/mruby/minirake" -f "${srcdir}/mruby/Rakefile" + +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@all-local: mruby + +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@clean-local: +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ [ ! -f "${abs_builddir}/mruby/build/build_config.rb" ] || \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ BUILD_DIR="${abs_builddir}/mruby/build" \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ MRUBY_CC="${CC}" \ +@ENABLE_THIRD_PARTY_TRUE@@HAVE_MRUBY_TRUE@ "${srcdir}/mruby/minirake" -f "${srcdir}/mruby/Rakefile" clean + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/nghttp2/third-party/build_config.rb b/lib/nghttp2-1.65.0/third-party/build_config.rb similarity index 54% rename from lib/nghttp2/third-party/build_config.rb rename to lib/nghttp2-1.65.0/third-party/build_config.rb index e06a4ccca4e..5d003f21fac 100644 --- a/lib/nghttp2/third-party/build_config.rb +++ b/lib/nghttp2-1.65.0/third-party/build_config.rb @@ -18,8 +18,30 @@ def config(conf) conf.build_dir = ENV['BUILD_DIR'] - # include the default GEMs - conf.gembox 'default' + # Here is the mruby gems included in default.gembox minus + # mruby-bin-debugger which causes the application to crash. + conf.gembox "stdlib" + conf.gembox "stdlib-ext" + conf.gembox "stdlib-io" + conf.gembox "math" + conf.gembox "metaprog" + + # Generate mrbc command + conf.gem :core => "mruby-bin-mrbc" + + # Generate mirb command + conf.gem :core => "mruby-bin-mirb" + + # Generate mruby command + conf.gem :core => "mruby-bin-mruby" + + # Generate mruby-strip command + conf.gem :core => "mruby-bin-strip" + + # Generate mruby-config command + conf.gem :core => "mruby-bin-config" + + # Added by nghttp2 project conf.gem :core => 'mruby-eval' end diff --git a/lib/nghttp2/third-party/llhttp/include/llhttp.h b/lib/nghttp2-1.65.0/third-party/llhttp/include/llhttp.h similarity index 95% rename from lib/nghttp2/third-party/llhttp/include/llhttp.h rename to lib/nghttp2-1.65.0/third-party/llhttp/include/llhttp.h index 6588ae5e368..37b7934d2ee 100644 --- a/lib/nghttp2/third-party/llhttp/include/llhttp.h +++ b/lib/nghttp2-1.65.0/third-party/llhttp/include/llhttp.h @@ -3,7 +3,7 @@ #define INCLUDE_LLHTTP_H_ #define LLHTTP_VERSION_MAJOR 9 -#define LLHTTP_VERSION_MINOR 0 +#define LLHTTP_VERSION_MINOR 2 #define LLHTTP_VERSION_PATCH 1 #ifndef INCLUDE_LLHTTP_ITSELF_H_ @@ -30,7 +30,7 @@ struct llhttp__internal_s { uint8_t http_major; uint8_t http_minor; uint8_t header_state; - uint8_t lenient_flags; + uint16_t lenient_flags; uint8_t upgrade; uint8_t finish; uint16_t flags; @@ -115,7 +115,9 @@ enum llhttp_lenient_flags { LENIENT_VERSION = 0x10, LENIENT_DATA_AFTER_CLOSE = 0x20, LENIENT_OPTIONAL_LF_AFTER_CR = 0x40, - LENIENT_OPTIONAL_CRLF_AFTER_CHUNK = 0x80 + LENIENT_OPTIONAL_CRLF_AFTER_CHUNK = 0x80, + LENIENT_OPTIONAL_CR_BEFORE_LF = 0x100, + LENIENT_SPACES_AFTER_CHUNK_SIZE = 0x200 }; typedef enum llhttp_lenient_flags llhttp_lenient_flags_t; @@ -179,7 +181,8 @@ enum llhttp_method { HTTP_SET_PARAMETER = 42, HTTP_REDIRECT = 43, HTTP_RECORD = 44, - HTTP_FLUSH = 45 + HTTP_FLUSH = 45, + HTTP_QUERY = 46 }; typedef enum llhttp_method llhttp_method_t; @@ -360,6 +363,7 @@ typedef enum llhttp_status llhttp_status_t; XX(31, LINK, LINK) \ XX(32, UNLINK, UNLINK) \ XX(33, SOURCE, SOURCE) \ + XX(46, QUERY, QUERY) \ #define RTSP_METHOD_MAP(XX) \ @@ -426,6 +430,7 @@ typedef enum llhttp_status llhttp_status_t; XX(43, REDIRECT, REDIRECT) \ XX(44, RECORD, RECORD) \ XX(45, FLUSH, FLUSH) \ + XX(46, QUERY, QUERY) \ #define HTTP_STATUS_MAP(XX) \ @@ -545,6 +550,8 @@ extern "C" { #if defined(__wasm__) #define LLHTTP_EXPORT __attribute__((visibility("default"))) +#elif defined(_WIN32) +#define LLHTTP_EXPORT __declspec(dllexport) #else #define LLHTTP_EXPORT #endif @@ -807,7 +814,7 @@ void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled); * avoid request smuggling. * With this flag the extra value will be parsed normally. * - * **Enabling this flag can pose a security issue since you will be exposed to + * **Enabling this flag can pose a security issue since you will be exposed to * request smuggling attacks. USE WITH CAUTION!** */ LLHTTP_EXPORT @@ -850,6 +857,19 @@ void llhttp_set_lenient_data_after_close(llhttp_t* parser, int enabled); LLHTTP_EXPORT void llhttp_set_lenient_optional_lf_after_cr(llhttp_t* parser, int enabled); +/* + * Enables/disables lenient handling of line separators. + * + * Normally `llhttp` would error when a LF is not preceded by CR when terminating the + * request line, the status line, the headers, a chunk header or a chunk data. + * With this flag only a LF is required to terminate such sections. + * + * **Enabling this flag can pose a security issue since you will be exposed to + * request smuggling attacks. USE WITH CAUTION!** + */ +LLHTTP_EXPORT +void llhttp_set_lenient_optional_cr_before_lf(llhttp_t* parser, int enabled); + /* Enables/disables lenient handling of chunks not separated via CRLF. * * Normally `llhttp` would error when after a chunk data a CRLF is missing before @@ -862,6 +882,18 @@ void llhttp_set_lenient_optional_lf_after_cr(llhttp_t* parser, int enabled); LLHTTP_EXPORT void llhttp_set_lenient_optional_crlf_after_chunk(llhttp_t* parser, int enabled); +/* Enables/disables lenient handling of spaces after chunk size. + * + * Normally `llhttp` would error when after a chunk size is followed by one or more + * spaces are present instead of a CRLF or `;`. + * With this flag this check is disabled. + * + * **Enabling this flag can pose a security issue since you will be exposed to + * request smuggling attacks. USE WITH CAUTION!** + */ +LLHTTP_EXPORT +void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/lib/nghttp2/third-party/llhttp/src/api.c b/lib/nghttp2-1.65.0/third-party/llhttp/src/api.c similarity index 95% rename from lib/nghttp2/third-party/llhttp/src/api.c rename to lib/nghttp2-1.65.0/third-party/llhttp/src/api.c index e0d03850514..8c2ce3dc5c4 100644 --- a/lib/nghttp2/third-party/llhttp/src/api.c +++ b/lib/nghttp2-1.65.0/third-party/llhttp/src/api.c @@ -126,7 +126,7 @@ void llhttp_reset(llhttp_t* parser) { llhttp_type_t type = parser->type; const llhttp_settings_t* settings = parser->settings; void* data = parser->data; - uint8_t lenient_flags = parser->lenient_flags; + uint16_t lenient_flags = parser->lenient_flags; llhttp__internal_init(parser); @@ -315,6 +315,22 @@ void llhttp_set_lenient_optional_crlf_after_chunk(llhttp_t* parser, int enabled) } } +void llhttp_set_lenient_optional_cr_before_lf(llhttp_t* parser, int enabled) { + if (enabled) { + parser->lenient_flags |= LENIENT_OPTIONAL_CR_BEFORE_LF; + } else { + parser->lenient_flags &= ~LENIENT_OPTIONAL_CR_BEFORE_LF; + } +} + +void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled) { + if (enabled) { + parser->lenient_flags |= LENIENT_SPACES_AFTER_CHUNK_SIZE; + } else { + parser->lenient_flags &= ~LENIENT_SPACES_AFTER_CHUNK_SIZE; + } +} + /* Callbacks */ diff --git a/lib/nghttp2/third-party/llhttp/src/http.c b/lib/nghttp2-1.65.0/third-party/llhttp/src/http.c similarity index 85% rename from lib/nghttp2/third-party/llhttp/src/http.c rename to lib/nghttp2-1.65.0/third-party/llhttp/src/http.c index 3a66044f5fb..1ab91a55796 100644 --- a/lib/nghttp2/third-party/llhttp/src/http.c +++ b/lib/nghttp2-1.65.0/third-party/llhttp/src/http.c @@ -39,13 +39,33 @@ int llhttp__after_headers_complete(llhttp_t* parser, const char* p, int hasBody; hasBody = parser->flags & F_CHUNKED || parser->content_length > 0; - if (parser->upgrade && (parser->method == HTTP_CONNECT || - (parser->flags & F_SKIPBODY) || !hasBody)) { + if ( + (parser->upgrade && (parser->method == HTTP_CONNECT || + (parser->flags & F_SKIPBODY) || !hasBody)) || + /* See RFC 2616 section 4.4 - 1xx e.g. Continue */ + (parser->type == HTTP_RESPONSE && parser->status_code == 101) + ) { /* Exit, the rest of the message is in a different protocol. */ return 1; } - if (parser->flags & F_SKIPBODY) { + if (parser->type == HTTP_RESPONSE && parser->status_code == 100) { + /* No body, restart as the message is complete */ + return 0; + } + + /* See RFC 2616 section 4.4 */ + if ( + parser->flags & F_SKIPBODY || /* response to a HEAD request */ + ( + parser->type == HTTP_RESPONSE && ( + parser->status_code == 102 || /* Processing */ + parser->status_code == 103 || /* Early Hints */ + parser->status_code == 204 || /* No Content */ + parser->status_code == 304 /* Not Modified */ + ) + ) + ) { return 0; } else if (parser->flags & F_CHUNKED) { /* chunked encoding - ignore Content-Length header, prepare for a chunk */ diff --git a/lib/nghttp2/third-party/llhttp/src/llhttp.c b/lib/nghttp2-1.65.0/third-party/llhttp/src/llhttp.c similarity index 88% rename from lib/nghttp2/third-party/llhttp/src/llhttp.c rename to lib/nghttp2-1.65.0/third-party/llhttp/src/llhttp.c index 03f6d57c8cc..3ef3b817f3d 100644 --- a/lib/nghttp2/third-party/llhttp/src/llhttp.c +++ b/lib/nghttp2-1.65.0/third-party/llhttp/src/llhttp.c @@ -22,148 +22,148 @@ typedef int (*llhttp__internal__span_cb)( llhttp__internal_t*, const char*, const char*); static const unsigned char llparse_blob0[] = { - 0xd, 0xa -}; -static const unsigned char llparse_blob1[] = { 'o', 'n' }; -static const unsigned char llparse_blob2[] = { +static const unsigned char llparse_blob1[] = { 'e', 'c', 't', 'i', 'o', 'n' }; -static const unsigned char llparse_blob3[] = { +static const unsigned char llparse_blob2[] = { 'l', 'o', 's', 'e' }; -static const unsigned char llparse_blob4[] = { +static const unsigned char llparse_blob3[] = { 'e', 'e', 'p', '-', 'a', 'l', 'i', 'v', 'e' }; -static const unsigned char llparse_blob5[] = { +static const unsigned char llparse_blob4[] = { 'p', 'g', 'r', 'a', 'd', 'e' }; -static const unsigned char llparse_blob6[] = { +static const unsigned char llparse_blob5[] = { 'c', 'h', 'u', 'n', 'k', 'e', 'd' }; #ifdef __SSE4_2__ -static const unsigned char ALIGN(16) llparse_blob7[] = { +static const unsigned char ALIGN(16) llparse_blob6[] = { 0x9, 0x9, ' ', '~', 0x80, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; #endif /* __SSE4_2__ */ #ifdef __SSE4_2__ -static const unsigned char ALIGN(16) llparse_blob8[] = { +static const unsigned char ALIGN(16) llparse_blob7[] = { '!', '!', '#', '\'', '*', '+', '-', '.', '0', '9', 'A', 'Z', '^', 'z', '|', '|' }; #endif /* __SSE4_2__ */ #ifdef __SSE4_2__ -static const unsigned char ALIGN(16) llparse_blob9[] = { +static const unsigned char ALIGN(16) llparse_blob8[] = { '~', '~', 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; #endif /* __SSE4_2__ */ -static const unsigned char llparse_blob10[] = { +static const unsigned char llparse_blob9[] = { 'e', 'n', 't', '-', 'l', 'e', 'n', 'g', 't', 'h' }; -static const unsigned char llparse_blob11[] = { +static const unsigned char llparse_blob10[] = { 'r', 'o', 'x', 'y', '-', 'c', 'o', 'n', 'n', 'e', 'c', 't', 'i', 'o', 'n' }; -static const unsigned char llparse_blob12[] = { +static const unsigned char llparse_blob11[] = { 'r', 'a', 'n', 's', 'f', 'e', 'r', '-', 'e', 'n', 'c', 'o', 'd', 'i', 'n', 'g' }; -static const unsigned char llparse_blob13[] = { +static const unsigned char llparse_blob12[] = { 'p', 'g', 'r', 'a', 'd', 'e' }; -static const unsigned char llparse_blob14[] = { +static const unsigned char llparse_blob13[] = { 'T', 'T', 'P', '/' }; -static const unsigned char llparse_blob15[] = { +static const unsigned char llparse_blob14[] = { 0xd, 0xa, 0xd, 0xa, 'S', 'M', 0xd, 0xa, 0xd, 0xa }; -static const unsigned char llparse_blob16[] = { +static const unsigned char llparse_blob15[] = { 'C', 'E', '/' }; -static const unsigned char llparse_blob17[] = { +static const unsigned char llparse_blob16[] = { 'T', 'S', 'P', '/' }; -static const unsigned char llparse_blob18[] = { +static const unsigned char llparse_blob17[] = { 'N', 'O', 'U', 'N', 'C', 'E' }; -static const unsigned char llparse_blob19[] = { +static const unsigned char llparse_blob18[] = { 'I', 'N', 'D' }; -static const unsigned char llparse_blob20[] = { +static const unsigned char llparse_blob19[] = { 'E', 'C', 'K', 'O', 'U', 'T' }; -static const unsigned char llparse_blob21[] = { +static const unsigned char llparse_blob20[] = { 'N', 'E', 'C', 'T' }; -static const unsigned char llparse_blob22[] = { +static const unsigned char llparse_blob21[] = { 'E', 'T', 'E' }; -static const unsigned char llparse_blob23[] = { +static const unsigned char llparse_blob22[] = { 'C', 'R', 'I', 'B', 'E' }; -static const unsigned char llparse_blob24[] = { +static const unsigned char llparse_blob23[] = { 'L', 'U', 'S', 'H' }; -static const unsigned char llparse_blob25[] = { +static const unsigned char llparse_blob24[] = { 'E', 'T' }; -static const unsigned char llparse_blob26[] = { +static const unsigned char llparse_blob25[] = { 'P', 'A', 'R', 'A', 'M', 'E', 'T', 'E', 'R' }; -static const unsigned char llparse_blob27[] = { +static const unsigned char llparse_blob26[] = { 'E', 'A', 'D' }; -static const unsigned char llparse_blob28[] = { +static const unsigned char llparse_blob27[] = { 'N', 'K' }; -static const unsigned char llparse_blob29[] = { +static const unsigned char llparse_blob28[] = { 'C', 'K' }; -static const unsigned char llparse_blob30[] = { +static const unsigned char llparse_blob29[] = { 'S', 'E', 'A', 'R', 'C', 'H' }; -static const unsigned char llparse_blob31[] = { +static const unsigned char llparse_blob30[] = { 'R', 'G', 'E' }; -static const unsigned char llparse_blob32[] = { +static const unsigned char llparse_blob31[] = { 'C', 'T', 'I', 'V', 'I', 'T', 'Y' }; -static const unsigned char llparse_blob33[] = { +static const unsigned char llparse_blob32[] = { 'L', 'E', 'N', 'D', 'A', 'R' }; -static const unsigned char llparse_blob34[] = { +static const unsigned char llparse_blob33[] = { 'V', 'E' }; -static const unsigned char llparse_blob35[] = { +static const unsigned char llparse_blob34[] = { 'O', 'T', 'I', 'F', 'Y' }; -static const unsigned char llparse_blob36[] = { +static const unsigned char llparse_blob35[] = { 'P', 'T', 'I', 'O', 'N', 'S' }; -static const unsigned char llparse_blob37[] = { +static const unsigned char llparse_blob36[] = { 'C', 'H' }; -static const unsigned char llparse_blob38[] = { +static const unsigned char llparse_blob37[] = { 'S', 'E' }; -static const unsigned char llparse_blob39[] = { +static const unsigned char llparse_blob38[] = { 'A', 'Y' }; -static const unsigned char llparse_blob40[] = { +static const unsigned char llparse_blob39[] = { 'S', 'T' }; -static const unsigned char llparse_blob41[] = { +static const unsigned char llparse_blob40[] = { 'I', 'N', 'D' }; -static const unsigned char llparse_blob42[] = { +static const unsigned char llparse_blob41[] = { 'A', 'T', 'C', 'H' }; -static const unsigned char llparse_blob43[] = { +static const unsigned char llparse_blob42[] = { 'G', 'E' }; +static const unsigned char llparse_blob43[] = { + 'U', 'E', 'R', 'Y' +}; static const unsigned char llparse_blob44[] = { 'I', 'N', 'D' }; @@ -229,7 +229,7 @@ struct llparse_match_s { }; typedef struct llparse_match_s llparse_match_t; -static llparse_match_t llparse__match_sequence_id( +static llparse_match_t llparse__match_sequence_to_lower( llhttp__internal_t* s, const unsigned char* p, const unsigned char* endp, const unsigned char* seq, uint32_t seq_len) { @@ -240,7 +240,7 @@ static llparse_match_t llparse__match_sequence_id( for (; p != endp; p++) { unsigned char current; - current = *p; + current = ((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p)); if (current == seq[index]) { if (++index == seq_len) { res.status = kMatchComplete; @@ -261,7 +261,7 @@ static llparse_match_t llparse__match_sequence_id( return res; } -static llparse_match_t llparse__match_sequence_to_lower( +static llparse_match_t llparse__match_sequence_to_lower_unsafe( llhttp__internal_t* s, const unsigned char* p, const unsigned char* endp, const unsigned char* seq, uint32_t seq_len) { @@ -272,7 +272,7 @@ static llparse_match_t llparse__match_sequence_to_lower( for (; p != endp; p++) { unsigned char current; - current = ((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p)); + current = ((*p) | 0x20); if (current == seq[index]) { if (++index == seq_len) { res.status = kMatchComplete; @@ -293,7 +293,7 @@ static llparse_match_t llparse__match_sequence_to_lower( return res; } -static llparse_match_t llparse__match_sequence_to_lower_unsafe( +static llparse_match_t llparse__match_sequence_id( llhttp__internal_t* s, const unsigned char* p, const unsigned char* endp, const unsigned char* seq, uint32_t seq_len) { @@ -304,7 +304,7 @@ static llparse_match_t llparse__match_sequence_to_lower_unsafe( for (; p != endp; p++) { unsigned char current; - current = ((*p) | 0x20); + current = *p; if (current == seq[index]) { if (++index == seq_len) { res.status = kMatchComplete; @@ -330,23 +330,32 @@ enum llparse_state_e { s_n_llhttp__internal__n_closed, s_n_llhttp__internal__n_invoke_llhttp__after_message_complete, s_n_llhttp__internal__n_pause_1, + s_n_llhttp__internal__n_invoke_is_equal_upgrade, + s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2, + s_n_llhttp__internal__n_chunk_data_almost_done_1, s_n_llhttp__internal__n_chunk_data_almost_done, s_n_llhttp__internal__n_consume_content_length, s_n_llhttp__internal__n_span_start_llhttp__on_body, s_n_llhttp__internal__n_invoke_is_equal_content_length, s_n_llhttp__internal__n_chunk_size_almost_done, + s_n_llhttp__internal__n_invoke_test_lenient_flags_9, s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete, s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_1, + s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_2, + s_n_llhttp__internal__n_invoke_test_lenient_flags_10, s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete, - s_n_llhttp__internal__n_chunk_extension_quoted_value_done, s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_1, - s_n_llhttp__internal__n_error_21, - s_n_llhttp__internal__n_chunk_extension_quoted_value, + s_n_llhttp__internal__n_chunk_extension_quoted_value_done, s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_2, - s_n_llhttp__internal__n_error_23, + s_n_llhttp__internal__n_error_30, + s_n_llhttp__internal__n_chunk_extension_quoted_value_quoted_pair, + s_n_llhttp__internal__n_error_31, + s_n_llhttp__internal__n_chunk_extension_quoted_value, + s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_3, + s_n_llhttp__internal__n_error_33, s_n_llhttp__internal__n_chunk_extension_value, s_n_llhttp__internal__n_span_start_llhttp__on_chunk_extension_value, - s_n_llhttp__internal__n_error_24, + s_n_llhttp__internal__n_error_34, s_n_llhttp__internal__n_chunk_extension_name, s_n_llhttp__internal__n_span_start_llhttp__on_chunk_extension_name, s_n_llhttp__internal__n_chunk_extensions, @@ -354,8 +363,6 @@ enum llparse_state_e { s_n_llhttp__internal__n_chunk_size, s_n_llhttp__internal__n_chunk_size_digit, s_n_llhttp__internal__n_invoke_update_content_length_1, - s_n_llhttp__internal__n_invoke_is_equal_upgrade, - s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2, s_n_llhttp__internal__n_consume_content_length_1, s_n_llhttp__internal__n_span_start_llhttp__on_body_1, s_n_llhttp__internal__n_eof, @@ -370,8 +377,9 @@ enum llparse_state_e { s_n_llhttp__internal__n_header_value_discard_ws_almost_done, s_n_llhttp__internal__n_header_value_lws, s_n_llhttp__internal__n_header_value_almost_done, + s_n_llhttp__internal__n_invoke_test_lenient_flags_17, s_n_llhttp__internal__n_header_value_lenient, - s_n_llhttp__internal__n_error_41, + s_n_llhttp__internal__n_error_54, s_n_llhttp__internal__n_header_value_otherwise, s_n_llhttp__internal__n_header_value_connection_token, s_n_llhttp__internal__n_header_value_connection_ws, @@ -379,12 +387,12 @@ enum llparse_state_e { s_n_llhttp__internal__n_header_value_connection_2, s_n_llhttp__internal__n_header_value_connection_3, s_n_llhttp__internal__n_header_value_connection, - s_n_llhttp__internal__n_error_43, - s_n_llhttp__internal__n_error_44, + s_n_llhttp__internal__n_error_56, + s_n_llhttp__internal__n_error_57, s_n_llhttp__internal__n_header_value_content_length_ws, s_n_llhttp__internal__n_header_value_content_length, - s_n_llhttp__internal__n_error_46, - s_n_llhttp__internal__n_error_45, + s_n_llhttp__internal__n_error_59, + s_n_llhttp__internal__n_error_58, s_n_llhttp__internal__n_header_value_te_token_ows, s_n_llhttp__internal__n_header_value, s_n_llhttp__internal__n_header_value_te_token, @@ -392,6 +400,7 @@ enum llparse_state_e { s_n_llhttp__internal__n_header_value_te_chunked, s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1, s_n_llhttp__internal__n_header_value_discard_ws, + s_n_llhttp__internal__n_invoke_load_header_state, s_n_llhttp__internal__n_invoke_llhttp__on_header_field_complete, s_n_llhttp__internal__n_header_field_general_otherwise, s_n_llhttp__internal__n_header_field_general, @@ -416,12 +425,12 @@ enum llparse_state_e { s_n_llhttp__internal__n_req_http_complete, s_n_llhttp__internal__n_invoke_load_method_1, s_n_llhttp__internal__n_invoke_llhttp__on_version_complete, - s_n_llhttp__internal__n_error_51, - s_n_llhttp__internal__n_error_57, + s_n_llhttp__internal__n_error_66, + s_n_llhttp__internal__n_error_73, s_n_llhttp__internal__n_req_http_minor, - s_n_llhttp__internal__n_error_58, + s_n_llhttp__internal__n_error_74, s_n_llhttp__internal__n_req_http_dot, - s_n_llhttp__internal__n_error_59, + s_n_llhttp__internal__n_error_75, s_n_llhttp__internal__n_req_http_major, s_n_llhttp__internal__n_span_start_llhttp__on_version, s_n_llhttp__internal__n_req_http_start_1, @@ -497,48 +506,49 @@ enum llparse_state_e { s_n_llhttp__internal__n_after_start_req_45, s_n_llhttp__internal__n_after_start_req_44, s_n_llhttp__internal__n_after_start_req_33, - s_n_llhttp__internal__n_after_start_req_48, + s_n_llhttp__internal__n_after_start_req_46, s_n_llhttp__internal__n_after_start_req_49, s_n_llhttp__internal__n_after_start_req_50, s_n_llhttp__internal__n_after_start_req_51, + s_n_llhttp__internal__n_after_start_req_52, + s_n_llhttp__internal__n_after_start_req_48, s_n_llhttp__internal__n_after_start_req_47, - s_n_llhttp__internal__n_after_start_req_46, - s_n_llhttp__internal__n_after_start_req_54, - s_n_llhttp__internal__n_after_start_req_56, - s_n_llhttp__internal__n_after_start_req_57, s_n_llhttp__internal__n_after_start_req_55, - s_n_llhttp__internal__n_after_start_req_53, + s_n_llhttp__internal__n_after_start_req_57, s_n_llhttp__internal__n_after_start_req_58, + s_n_llhttp__internal__n_after_start_req_56, + s_n_llhttp__internal__n_after_start_req_54, s_n_llhttp__internal__n_after_start_req_59, - s_n_llhttp__internal__n_after_start_req_52, - s_n_llhttp__internal__n_after_start_req_61, - s_n_llhttp__internal__n_after_start_req_62, s_n_llhttp__internal__n_after_start_req_60, - s_n_llhttp__internal__n_after_start_req_65, - s_n_llhttp__internal__n_after_start_req_67, - s_n_llhttp__internal__n_after_start_req_68, + s_n_llhttp__internal__n_after_start_req_53, + s_n_llhttp__internal__n_after_start_req_62, + s_n_llhttp__internal__n_after_start_req_63, + s_n_llhttp__internal__n_after_start_req_61, s_n_llhttp__internal__n_after_start_req_66, + s_n_llhttp__internal__n_after_start_req_68, s_n_llhttp__internal__n_after_start_req_69, + s_n_llhttp__internal__n_after_start_req_67, + s_n_llhttp__internal__n_after_start_req_70, + s_n_llhttp__internal__n_after_start_req_65, s_n_llhttp__internal__n_after_start_req_64, - s_n_llhttp__internal__n_after_start_req_63, s_n_llhttp__internal__n_after_start_req, s_n_llhttp__internal__n_span_start_llhttp__on_method_1, s_n_llhttp__internal__n_res_line_almost_done, + s_n_llhttp__internal__n_invoke_test_lenient_flags_30, s_n_llhttp__internal__n_res_status, s_n_llhttp__internal__n_span_start_llhttp__on_status, - s_n_llhttp__internal__n_res_status_start, s_n_llhttp__internal__n_res_status_code_otherwise, s_n_llhttp__internal__n_res_status_code_digit_3, s_n_llhttp__internal__n_res_status_code_digit_2, s_n_llhttp__internal__n_res_status_code_digit_1, s_n_llhttp__internal__n_res_after_version, s_n_llhttp__internal__n_invoke_llhttp__on_version_complete_1, - s_n_llhttp__internal__n_error_73, - s_n_llhttp__internal__n_error_85, + s_n_llhttp__internal__n_error_89, + s_n_llhttp__internal__n_error_103, s_n_llhttp__internal__n_res_http_minor, - s_n_llhttp__internal__n_error_86, + s_n_llhttp__internal__n_error_104, s_n_llhttp__internal__n_res_http_dot, - s_n_llhttp__internal__n_error_87, + s_n_llhttp__internal__n_error_105, s_n_llhttp__internal__n_res_http_major, s_n_llhttp__internal__n_span_start_llhttp__on_version_1, s_n_llhttp__internal__n_start_res, @@ -669,7 +679,21 @@ int llhttp__internal__c_test_lenient_flags( return (state->lenient_flags & 1) == 1; } -int llhttp__after_headers_complete( +int llhttp__internal__c_test_lenient_flags_1( + llhttp__internal_t* state, + const unsigned char* p, + const unsigned char* endp) { + return (state->lenient_flags & 256) == 256; +} + +int llhttp__internal__c_test_flags( + llhttp__internal_t* state, + const unsigned char* p, + const unsigned char* endp) { + return (state->flags & 128) == 128; +} + +int llhttp__on_chunk_complete( llhttp__internal_t* s, const unsigned char* p, const unsigned char* endp); @@ -677,6 +701,13 @@ int llhttp__on_message_complete( llhttp__internal_t* s, const unsigned char* p, const unsigned char* endp); +int llhttp__internal__c_is_equal_upgrade( + llhttp__internal_t* state, + const unsigned char* p, + const unsigned char* endp) { + return state->upgrade == 1; +} + int llhttp__after_message_complete( llhttp__internal_t* s, const unsigned char* p, const unsigned char* endp); @@ -719,6 +750,18 @@ int llhttp__internal__c_test_lenient_flags_3( return (state->lenient_flags & 32) == 32; } +int llhttp__before_headers_complete( + llhttp__internal_t* s, const unsigned char* p, + const unsigned char* endp); + +int llhttp__on_headers_complete( + llhttp__internal_t* s, const unsigned char* p, + const unsigned char* endp); + +int llhttp__after_headers_complete( + llhttp__internal_t* s, const unsigned char* p, + const unsigned char* endp); + int llhttp__internal__c_mul_add_content_length( llhttp__internal_t* state, const unsigned char* p, @@ -745,6 +788,13 @@ int llhttp__internal__c_mul_add_content_length( return 0; } +int llhttp__internal__c_test_lenient_flags_4( + llhttp__internal_t* state, + const unsigned char* p, + const unsigned char* endp) { + return (state->lenient_flags & 512) == 512; +} + int llhttp__on_chunk_header( llhttp__internal_t* s, const unsigned char* p, const unsigned char* endp); @@ -756,11 +806,7 @@ int llhttp__internal__c_is_equal_content_length( return state->content_length == 0; } -int llhttp__on_chunk_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_test_lenient_flags_4( +int llhttp__internal__c_test_lenient_flags_7( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -775,7 +821,7 @@ int llhttp__internal__c_or_flags( return 0; } -int llhttp__internal__c_test_lenient_flags_5( +int llhttp__internal__c_test_lenient_flags_8( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -790,13 +836,6 @@ int llhttp__on_chunk_extension_value_complete( llhttp__internal_t* s, const unsigned char* p, const unsigned char* endp); -int llhttp__internal__c_is_equal_upgrade( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->upgrade == 1; -} - int llhttp__internal__c_update_finish_3( llhttp__internal_t* state, const unsigned char* p, @@ -805,35 +844,6 @@ int llhttp__internal__c_update_finish_3( return 0; } -int llhttp__internal__c_test_flags( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return (state->flags & 128) == 128; -} - -int llhttp__internal__c_test_flags_1( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return (state->flags & 544) == 544; -} - -int llhttp__internal__c_test_lenient_flags_6( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return (state->lenient_flags & 2) == 2; -} - -int llhttp__before_headers_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__on_headers_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - int llhttp__internal__c_or_flags_1( llhttp__internal_t* state, const unsigned char* p, @@ -870,7 +880,21 @@ int llhttp__internal__c_load_header_state( return state->header_state; } -int llhttp__internal__c_or_flags_3( +int llhttp__internal__c_test_flags_4( + llhttp__internal_t* state, + const unsigned char* p, + const unsigned char* endp) { + return (state->flags & 512) == 512; +} + +int llhttp__internal__c_test_lenient_flags_22( + llhttp__internal_t* state, + const unsigned char* p, + const unsigned char* endp) { + return (state->lenient_flags & 2) == 2; +} + +int llhttp__internal__c_or_flags_5( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -890,7 +914,7 @@ int llhttp__on_header_value_complete( llhttp__internal_t* s, const unsigned char* p, const unsigned char* endp); -int llhttp__internal__c_or_flags_4( +int llhttp__internal__c_or_flags_6( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -898,7 +922,7 @@ int llhttp__internal__c_or_flags_4( return 0; } -int llhttp__internal__c_or_flags_5( +int llhttp__internal__c_or_flags_7( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -906,7 +930,7 @@ int llhttp__internal__c_or_flags_5( return 0; } -int llhttp__internal__c_or_flags_6( +int llhttp__internal__c_or_flags_8( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -979,7 +1003,7 @@ int llhttp__internal__c_mul_add_content_length_1( return 0; } -int llhttp__internal__c_or_flags_15( +int llhttp__internal__c_or_flags_17( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -994,14 +1018,14 @@ int llhttp__internal__c_test_flags_3( return (state->flags & 8) == 8; } -int llhttp__internal__c_test_lenient_flags_13( +int llhttp__internal__c_test_lenient_flags_20( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { return (state->lenient_flags & 8) == 8; } -int llhttp__internal__c_or_flags_16( +int llhttp__internal__c_or_flags_18( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -1025,7 +1049,7 @@ int llhttp__internal__c_update_header_state_8( return 0; } -int llhttp__internal__c_or_flags_18( +int llhttp__internal__c_or_flags_20( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -1058,7 +1082,7 @@ int llhttp__internal__c_store_http_minor( return 0; } -int llhttp__internal__c_test_lenient_flags_15( +int llhttp__internal__c_test_lenient_flags_24( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { @@ -1192,26 +1216,64 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_chunk_data_almost_done: - s_n_llhttp__internal__n_chunk_data_almost_done: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_chunk_data_almost_done; + case s_n_llhttp__internal__n_invoke_is_equal_upgrade: + s_n_llhttp__internal__n_invoke_is_equal_upgrade: { + switch (llhttp__internal__c_is_equal_upgrade(state, p, endp)) { + case 0: + goto s_n_llhttp__internal__n_invoke_llhttp__after_message_complete; + default: + goto s_n_llhttp__internal__n_pause_1; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob0, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete; - } - case kMatchPause: { - return s_n_llhttp__internal__n_chunk_data_almost_done; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_4; - } + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2: + s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2: { + switch (llhttp__on_message_complete(state, p, endp)) { + case 0: + goto s_n_llhttp__internal__n_invoke_is_equal_upgrade; + case 21: + goto s_n_llhttp__internal__n_pause_13; + default: + goto s_n_llhttp__internal__n_error_38; + } + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_chunk_data_almost_done_1: + s_n_llhttp__internal__n_chunk_data_almost_done_1: { + if (p == endp) { + return s_n_llhttp__internal__n_chunk_data_almost_done_1; + } + switch (*p) { + case 10: { + p++; + goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete; + } + default: { + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_7; + } + } + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_chunk_data_almost_done: + s_n_llhttp__internal__n_chunk_data_almost_done: { + if (p == endp) { + return s_n_llhttp__internal__n_chunk_data_almost_done; + } + switch (*p) { + case 10: { + p++; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_6; + } + case 13: { + p++; + goto s_n_llhttp__internal__n_chunk_data_almost_done_1; + } + default: { + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_7; + } } /* UNREACHABLE */; abort(); @@ -1267,21 +1329,32 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_header; } default: { - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_5; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_8; } } /* UNREACHABLE */; abort(); } + case s_n_llhttp__internal__n_invoke_test_lenient_flags_9: + s_n_llhttp__internal__n_invoke_test_lenient_flags_9: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_chunk_size_almost_done; + default: + goto s_n_llhttp__internal__n_error_20; + } + /* UNREACHABLE */; + abort(); + } case s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete: s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete: { switch (llhttp__on_chunk_extension_name_complete(state, p, endp)) { case 0: - goto s_n_llhttp__internal__n_chunk_size_almost_done; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_9; case 21: goto s_n_llhttp__internal__n_pause_5; default: - goto s_n_llhttp__internal__n_error_15; + goto s_n_llhttp__internal__n_error_19; } /* UNREACHABLE */; abort(); @@ -1290,24 +1363,61 @@ static llparse_state_t llhttp__internal__run( s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_1: { switch (llhttp__on_chunk_extension_name_complete(state, p, endp)) { case 0: - goto s_n_llhttp__internal__n_chunk_extensions; + goto s_n_llhttp__internal__n_chunk_size_almost_done; case 21: goto s_n_llhttp__internal__n_pause_6; default: - goto s_n_llhttp__internal__n_error_16; + goto s_n_llhttp__internal__n_error_21; + } + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_2: + s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_2: { + switch (llhttp__on_chunk_extension_name_complete(state, p, endp)) { + case 0: + goto s_n_llhttp__internal__n_chunk_extensions; + case 21: + goto s_n_llhttp__internal__n_pause_7; + default: + goto s_n_llhttp__internal__n_error_22; + } + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_invoke_test_lenient_flags_10: + s_n_llhttp__internal__n_invoke_test_lenient_flags_10: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_chunk_size_almost_done; + default: + goto s_n_llhttp__internal__n_error_25; } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete: s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete: { + switch (llhttp__on_chunk_extension_value_complete(state, p, endp)) { + case 0: + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_10; + case 21: + goto s_n_llhttp__internal__n_pause_8; + default: + goto s_n_llhttp__internal__n_error_24; + } + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_1: + s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_1: { switch (llhttp__on_chunk_extension_value_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_chunk_size_almost_done; case 21: - goto s_n_llhttp__internal__n_pause_7; + goto s_n_llhttp__internal__n_pause_9; default: - goto s_n_llhttp__internal__n_error_18; + goto s_n_llhttp__internal__n_error_26; } /* UNREACHABLE */; abort(); @@ -1318,6 +1428,9 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_chunk_extension_quoted_value_done; } switch (*p) { + case 10: { + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_11; + } case 13: { p++; goto s_n_llhttp__internal__n_chunk_size_almost_done; @@ -1327,27 +1440,72 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_chunk_extensions; } default: { - goto s_n_llhttp__internal__n_error_20; + goto s_n_llhttp__internal__n_error_29; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_1: - s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_1: { + case s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_2: + s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_2: { switch (llhttp__on_chunk_extension_value_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_chunk_extension_quoted_value_done; case 21: - goto s_n_llhttp__internal__n_pause_8; + goto s_n_llhttp__internal__n_pause_10; default: - goto s_n_llhttp__internal__n_error_19; + goto s_n_llhttp__internal__n_error_27; + } + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_error_30: + s_n_llhttp__internal__n_error_30: { + state->error = 0x2; + state->reason = "Invalid quoted-pair in chunk extensions quoted value"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_chunk_extension_quoted_value_quoted_pair: + s_n_llhttp__internal__n_chunk_extension_quoted_value_quoted_pair: { + static uint8_t lookup_table[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + }; + if (p == endp) { + return s_n_llhttp__internal__n_chunk_extension_quoted_value_quoted_pair; + } + switch (lookup_table[(uint8_t) *p]) { + case 1: { + p++; + goto s_n_llhttp__internal__n_chunk_extension_quoted_value; + } + default: { + goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_3; + } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_21: - s_n_llhttp__internal__n_error_21: { + case s_n_llhttp__internal__n_error_31: + s_n_llhttp__internal__n_error_31: { state->error = 0x2; state->reason = "Invalid character in chunk extensions quoted value"; state->error_pos = (const char*) p; @@ -1364,7 +1522,7 @@ static llparse_state_t llhttp__internal__run( 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1386,30 +1544,34 @@ static llparse_state_t llhttp__internal__run( } case 2: { p++; - goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_1; + goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_2; + } + case 3: { + p++; + goto s_n_llhttp__internal__n_chunk_extension_quoted_value_quoted_pair; } default: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_2; + goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_4; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_2: - s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_2: { + case s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_3: + s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_3: { switch (llhttp__on_chunk_extension_value_complete(state, p, endp)) { case 0: - goto s_n_llhttp__internal__n_chunk_size_otherwise; + goto s_n_llhttp__internal__n_chunk_extensions; case 21: - goto s_n_llhttp__internal__n_pause_9; + goto s_n_llhttp__internal__n_pause_11; default: - goto s_n_llhttp__internal__n_error_22; + goto s_n_llhttp__internal__n_error_32; } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_23: - s_n_llhttp__internal__n_error_23: { + case s_n_llhttp__internal__n_error_33: + s_n_llhttp__internal__n_error_33: { state->error = 0x2; state->reason = "Invalid character in chunk extensions value"; state->error_pos = (const char*) p; @@ -1421,14 +1583,14 @@ static llparse_state_t llhttp__internal__run( case s_n_llhttp__internal__n_chunk_extension_value: s_n_llhttp__internal__n_chunk_extension_value: { static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 3, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 2, 2, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 4, 0, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 0, + 0, 3, 4, 3, 3, 3, 3, 3, 0, 0, 3, 3, 0, 3, 3, 0, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 5, 0, 0, 0, 0, + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1446,18 +1608,21 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value; } case 2: { + goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_1; + } + case 3: { p++; goto s_n_llhttp__internal__n_chunk_extension_value; } - case 3: { + case 4: { p++; goto s_n_llhttp__internal__n_chunk_extension_quoted_value; } - case 4: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_3; + case 5: { + goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_5; } default: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_4; + goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_6; } } /* UNREACHABLE */; @@ -1470,12 +1635,12 @@ static llparse_state_t llhttp__internal__run( } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_chunk_extension_value; - goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_2; + goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_3; /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_24: - s_n_llhttp__internal__n_error_24: { + case s_n_llhttp__internal__n_error_34: + s_n_llhttp__internal__n_error_34: { state->error = 0x2; state->reason = "Invalid character in chunk extensions name"; state->error_pos = (const char*) p; @@ -1487,14 +1652,14 @@ static llparse_state_t llhttp__internal__run( case s_n_llhttp__internal__n_chunk_extension_name: s_n_llhttp__internal__n_chunk_extension_name: { static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 0, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 2, 2, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 3, 0, 4, 0, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 2, 0, + 0, 3, 0, 3, 3, 3, 3, 3, 0, 0, 3, 3, 0, 3, 3, 0, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 4, 0, 5, 0, 0, + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1512,18 +1677,21 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name; } case 2: { - p++; - goto s_n_llhttp__internal__n_chunk_extension_name; + goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_1; } case 3: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_1; + p++; + goto s_n_llhttp__internal__n_chunk_extension_name; } case 4: { goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_2; } - default: { + case 5: { goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_3; } + default: { + goto s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_4; + } } /* UNREACHABLE */; abort(); @@ -1547,11 +1715,11 @@ static llparse_state_t llhttp__internal__run( switch (*p) { case 13: { p++; - goto s_n_llhttp__internal__n_error_13; + goto s_n_llhttp__internal__n_error_17; } case ' ': { p++; - goto s_n_llhttp__internal__n_error_14; + goto s_n_llhttp__internal__n_error_18; } default: { goto s_n_llhttp__internal__n_span_start_llhttp__on_chunk_extension_name; @@ -1566,16 +1734,28 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_chunk_size_otherwise; } switch (*p) { + case 9: { + p++; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_4; + } + case 10: { + p++; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_5; + } case 13: { p++; goto s_n_llhttp__internal__n_chunk_size_almost_done; } + case ' ': { + p++; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_4; + } case ';': { p++; goto s_n_llhttp__internal__n_chunk_extensions; } default: { - goto s_n_llhttp__internal__n_error_25; + goto s_n_llhttp__internal__n_error_35; } } /* UNREACHABLE */; @@ -1821,7 +2001,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } default: { - goto s_n_llhttp__internal__n_error_27; + goto s_n_llhttp__internal__n_error_37; } } /* UNREACHABLE */; @@ -1836,30 +2016,6 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_invoke_is_equal_upgrade: - s_n_llhttp__internal__n_invoke_is_equal_upgrade: { - switch (llhttp__internal__c_is_equal_upgrade(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_invoke_llhttp__after_message_complete; - default: - goto s_n_llhttp__internal__n_pause_1; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2: - s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2: { - switch (llhttp__on_message_complete(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_invoke_is_equal_upgrade; - case 21: - goto s_n_llhttp__internal__n_pause_11; - default: - goto s_n_llhttp__internal__n_error_28; - } - /* UNREACHABLE */; - abort(); - } case s_n_llhttp__internal__n_consume_content_length_1: s_n_llhttp__internal__n_consume_content_length_1: { size_t avail; @@ -1922,7 +2078,7 @@ static llparse_state_t llhttp__internal__run( case 4: goto s_n_llhttp__internal__n_invoke_update_finish_3; case 5: - goto s_n_llhttp__internal__n_error_29; + goto s_n_llhttp__internal__n_error_39; default: goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete; } @@ -1947,10 +2103,10 @@ static llparse_state_t llhttp__internal__run( switch (*p) { case 10: { p++; - goto s_n_llhttp__internal__n_invoke_test_flags; + goto s_n_llhttp__internal__n_invoke_test_flags_1; } default: { - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_7; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_12; } } /* UNREACHABLE */; @@ -1979,9 +2135,9 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_header_field_start; case 21: - goto s_n_llhttp__internal__n_pause_14; + goto s_n_llhttp__internal__n_pause_18; default: - goto s_n_llhttp__internal__n_error_37; + goto s_n_llhttp__internal__n_error_48; } /* UNREACHABLE */; abort(); @@ -2005,14 +2161,14 @@ static llparse_state_t llhttp__internal__run( switch (*p) { case 9: { p++; - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_10; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_15; } case ' ': { p++; - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_10; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_15; } default: { - goto s_n_llhttp__internal__n_invoke_load_header_state; + goto s_n_llhttp__internal__n_invoke_load_header_state_1; } } /* UNREACHABLE */; @@ -2029,7 +2185,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_header_value_discard_lws; } default: { - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_11; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_16; } } /* UNREACHABLE */; @@ -2042,13 +2198,13 @@ static llparse_state_t llhttp__internal__run( } switch (*p) { case 9: { - goto s_n_llhttp__internal__n_invoke_load_header_state_3; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_18; } case ' ': { - goto s_n_llhttp__internal__n_invoke_load_header_state_3; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_18; } default: { - goto s_n_llhttp__internal__n_invoke_load_header_state_4; + goto s_n_llhttp__internal__n_invoke_load_header_state_5; } } /* UNREACHABLE */; @@ -2065,12 +2221,23 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_header_value_lws; } default: { - goto s_n_llhttp__internal__n_error_40; + goto s_n_llhttp__internal__n_error_53; } } /* UNREACHABLE */; abort(); } + case s_n_llhttp__internal__n_invoke_test_lenient_flags_17: + s_n_llhttp__internal__n_invoke_test_lenient_flags_17: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_header_value_almost_done; + default: + goto s_n_llhttp__internal__n_error_51; + } + /* UNREACHABLE */; + abort(); + } case s_n_llhttp__internal__n_header_value_lenient: s_n_llhttp__internal__n_header_value_lenient: { if (p == endp) { @@ -2078,10 +2245,10 @@ static llparse_state_t llhttp__internal__run( } switch (*p) { case 10: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3; + goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4; } case 13: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4; + goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_5; } default: { p++; @@ -2091,8 +2258,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_41: - s_n_llhttp__internal__n_error_41: { + case s_n_llhttp__internal__n_error_54: + s_n_llhttp__internal__n_error_54: { state->error = 0xa; state->reason = "Invalid header value char"; state->error_pos = (const char*) p; @@ -2107,11 +2274,14 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_header_value_otherwise; } switch (*p) { - case 13: { + case 10: { goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_1; } + case 13: { + goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_2; + } default: { - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_12; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_19; } } /* UNREACHABLE */; @@ -2174,7 +2344,7 @@ static llparse_state_t llhttp__internal__run( } case ',': { p++; - goto s_n_llhttp__internal__n_invoke_load_header_state_5; + goto s_n_llhttp__internal__n_invoke_load_header_state_6; } default: { goto s_n_llhttp__internal__n_invoke_update_header_state_5; @@ -2190,7 +2360,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_value_connection_1; } - match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob3, 4); + match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob2, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2214,7 +2384,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_value_connection_2; } - match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob4, 9); + match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob3, 9); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2238,7 +2408,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_value_connection_3; } - match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob5, 6); + match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob4, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2288,8 +2458,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_43: - s_n_llhttp__internal__n_error_43: { + case s_n_llhttp__internal__n_error_56: + s_n_llhttp__internal__n_error_56: { state->error = 0xb; state->reason = "Content-Length overflow"; state->error_pos = (const char*) p; @@ -2298,8 +2468,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_44: - s_n_llhttp__internal__n_error_44: { + case s_n_llhttp__internal__n_error_57: + s_n_llhttp__internal__n_error_57: { state->error = 0xb; state->reason = "Invalid character in Content-Length"; state->error_pos = (const char*) p; @@ -2315,17 +2485,17 @@ static llparse_state_t llhttp__internal__run( } switch (*p) { case 10: { - goto s_n_llhttp__internal__n_invoke_or_flags_15; + goto s_n_llhttp__internal__n_invoke_or_flags_17; } case 13: { - goto s_n_llhttp__internal__n_invoke_or_flags_15; + goto s_n_llhttp__internal__n_invoke_or_flags_17; } case ' ': { p++; goto s_n_llhttp__internal__n_header_value_content_length_ws; } default: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_6; + goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_7; } } /* UNREACHABLE */; @@ -2394,8 +2564,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_46: - s_n_llhttp__internal__n_error_46: { + case s_n_llhttp__internal__n_error_59: + s_n_llhttp__internal__n_error_59: { state->error = 0xf; state->reason = "Invalid `Transfer-Encoding` header value"; state->error_pos = (const char*) p; @@ -2404,8 +2574,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_45: - s_n_llhttp__internal__n_error_45: { + case s_n_llhttp__internal__n_error_58: + s_n_llhttp__internal__n_error_58: { state->error = 0xf; state->reason = "Invalid `Transfer-Encoding` header value"; state->error_pos = (const char*) p; @@ -2467,7 +2637,7 @@ static llparse_state_t llhttp__internal__run( /* Load input */ input = _mm_loadu_si128((__m128i const*) p); - ranges = _mm_loadu_si128((__m128i const*) llparse_blob7); + ranges = _mm_loadu_si128((__m128i const*) llparse_blob6); /* Find first character that does not match `ranges` */ match_len = _mm_cmpestri(ranges, 6, @@ -2566,7 +2736,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_value_te_chunked; } - match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob6, 7); + match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob5, 7); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2590,7 +2760,7 @@ static llparse_state_t llhttp__internal__run( } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_header_value; - goto s_n_llhttp__internal__n_invoke_load_header_state_2; + goto s_n_llhttp__internal__n_invoke_load_header_state_3; /* UNREACHABLE */; abort(); } @@ -2606,7 +2776,7 @@ static llparse_state_t llhttp__internal__run( } case 10: { p++; - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_9; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_14; } case 13: { p++; @@ -2623,15 +2793,28 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_invoke_llhttp__on_header_field_complete: - s_n_llhttp__internal__n_invoke_llhttp__on_header_field_complete: { + case s_n_llhttp__internal__n_invoke_load_header_state: + s_n_llhttp__internal__n_invoke_load_header_state: { + switch (llhttp__internal__c_load_header_state(state, p, endp)) { + case 2: + goto s_n_llhttp__internal__n_invoke_test_flags_4; + case 3: + goto s_n_llhttp__internal__n_invoke_test_flags_5; + default: + goto s_n_llhttp__internal__n_header_value_discard_ws; + } + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_invoke_llhttp__on_header_field_complete: + s_n_llhttp__internal__n_invoke_llhttp__on_header_field_complete: { switch (llhttp__on_header_field_complete(state, p, endp)) { case 0: - goto s_n_llhttp__internal__n_header_value_discard_ws; + goto s_n_llhttp__internal__n_invoke_load_header_state; case 21: - goto s_n_llhttp__internal__n_pause_15; + goto s_n_llhttp__internal__n_pause_19; default: - goto s_n_llhttp__internal__n_error_34; + goto s_n_llhttp__internal__n_error_45; } /* UNREACHABLE */; abort(); @@ -2646,7 +2829,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field_2; } default: { - goto s_n_llhttp__internal__n_error_47; + goto s_n_llhttp__internal__n_error_62; } } /* UNREACHABLE */; @@ -2684,7 +2867,7 @@ static llparse_state_t llhttp__internal__run( /* Load input */ input = _mm_loadu_si128((__m128i const*) p); - ranges = _mm_loadu_si128((__m128i const*) llparse_blob8); + ranges = _mm_loadu_si128((__m128i const*) llparse_blob7); /* Find first character that does not match `ranges` */ match_len = _mm_cmpestri(ranges, 16, @@ -2696,7 +2879,7 @@ static llparse_state_t llhttp__internal__run( p += match_len; goto s_n_llhttp__internal__n_header_field_general; } - ranges = _mm_loadu_si128((__m128i const*) llparse_blob9); + ranges = _mm_loadu_si128((__m128i const*) llparse_blob8); /* Find first character that does not match `ranges` */ match_len = _mm_cmpestri(ranges, 2, @@ -2730,7 +2913,7 @@ static llparse_state_t llhttp__internal__run( } switch (*p) { case ' ': { - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_8; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_13; } case ':': { goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field_1; @@ -2749,7 +2932,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_field_3; } - match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob2, 6); + match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob1, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2774,7 +2957,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_field_4; } - match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob10, 10); + match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob9, 10); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2820,7 +3003,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_field_1; } - match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob1, 2); + match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob0, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2844,7 +3027,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_field_5; } - match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob11, 15); + match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob10, 15); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2869,7 +3052,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_field_6; } - match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob12, 16); + match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob11, 16); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2894,7 +3077,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_header_field_7; } - match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob13, 6); + match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob12, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -2966,6 +3149,9 @@ static llparse_state_t llhttp__internal__run( p++; goto s_n_llhttp__internal__n_headers_almost_done; } + case ':': { + goto s_n_llhttp__internal__n_error_44; + } default: { goto s_n_llhttp__internal__n_span_start_llhttp__on_header_field; } @@ -3044,7 +3230,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_url_to_http_09; } default: { - goto s_n_llhttp__internal__n_error_48; + goto s_n_llhttp__internal__n_error_63; } } /* UNREACHABLE */; @@ -3069,7 +3255,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_url_skip_lf_to_http09_1; } default: { - goto s_n_llhttp__internal__n_error_48; + goto s_n_llhttp__internal__n_error_63; } } /* UNREACHABLE */; @@ -3082,18 +3268,18 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_req_pri_upgrade; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob15, 10); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob14, 10); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; - goto s_n_llhttp__internal__n_error_55; + goto s_n_llhttp__internal__n_error_71; } case kMatchPause: { return s_n_llhttp__internal__n_req_pri_upgrade; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; + goto s_n_llhttp__internal__n_error_72; } } /* UNREACHABLE */; @@ -3110,7 +3296,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_headers_start; } default: { - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_16; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_26; } } /* UNREACHABLE */; @@ -3122,12 +3308,16 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_req_http_complete; } switch (*p) { + case 10: { + p++; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_25; + } case 13: { p++; goto s_n_llhttp__internal__n_req_http_complete_crlf; } default: { - goto s_n_llhttp__internal__n_error_54; + goto s_n_llhttp__internal__n_error_70; } } /* UNREACHABLE */; @@ -3150,15 +3340,15 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_invoke_load_method_1; case 21: - goto s_n_llhttp__internal__n_pause_17; + goto s_n_llhttp__internal__n_pause_21; default: - goto s_n_llhttp__internal__n_error_52; + goto s_n_llhttp__internal__n_error_67; } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_51: - s_n_llhttp__internal__n_error_51: { + case s_n_llhttp__internal__n_error_66: + s_n_llhttp__internal__n_error_66: { state->error = 0x9; state->reason = "Invalid HTTP version"; state->error_pos = (const char*) p; @@ -3167,8 +3357,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_57: - s_n_llhttp__internal__n_error_57: { + case s_n_llhttp__internal__n_error_73: + s_n_llhttp__internal__n_error_73: { state->error = 0x9; state->reason = "Invalid minor version"; state->error_pos = (const char*) p; @@ -3240,8 +3430,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_58: - s_n_llhttp__internal__n_error_58: { + case s_n_llhttp__internal__n_error_74: + s_n_llhttp__internal__n_error_74: { state->error = 0x9; state->reason = "Expected dot"; state->error_pos = (const char*) p; @@ -3267,8 +3457,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_59: - s_n_llhttp__internal__n_error_59: { + case s_n_llhttp__internal__n_error_75: + s_n_llhttp__internal__n_error_75: { state->error = 0x9; state->reason = "Invalid major version"; state->error_pos = (const char*) p; @@ -3358,7 +3548,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_req_http_start_1; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob14, 4); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob13, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -3369,7 +3559,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_req_http_start_1; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_62; + goto s_n_llhttp__internal__n_error_78; } } /* UNREACHABLE */; @@ -3382,7 +3572,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_req_http_start_2; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob16, 3); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob15, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -3393,7 +3583,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_req_http_start_2; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_62; + goto s_n_llhttp__internal__n_error_78; } } /* UNREACHABLE */; @@ -3406,7 +3596,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_req_http_start_3; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob17, 4); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob16, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -3417,7 +3607,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_req_http_start_3; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_62; + goto s_n_llhttp__internal__n_error_78; } } /* UNREACHABLE */; @@ -3446,7 +3636,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_req_http_start_3; } default: { - goto s_n_llhttp__internal__n_error_62; + goto s_n_llhttp__internal__n_error_78; } } /* UNREACHABLE */; @@ -3537,7 +3727,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_url_fragment; } default: { - goto s_n_llhttp__internal__n_error_63; + goto s_n_llhttp__internal__n_error_79; } } /* UNREACHABLE */; @@ -3598,7 +3788,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_span_end_stub_query_3; } default: { - goto s_n_llhttp__internal__n_error_64; + goto s_n_llhttp__internal__n_error_80; } } /* UNREACHABLE */; @@ -3636,7 +3826,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_url_query; } default: { - goto s_n_llhttp__internal__n_error_65; + goto s_n_llhttp__internal__n_error_81; } } /* UNREACHABLE */; @@ -3761,10 +3951,10 @@ static llparse_state_t llhttp__internal__run( } case 8: { p++; - goto s_n_llhttp__internal__n_error_66; + goto s_n_llhttp__internal__n_error_82; } default: { - goto s_n_llhttp__internal__n_error_67; + goto s_n_llhttp__internal__n_error_83; } } /* UNREACHABLE */; @@ -3823,7 +4013,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_url_server_with_at; } default: { - goto s_n_llhttp__internal__n_error_68; + goto s_n_llhttp__internal__n_error_84; } } /* UNREACHABLE */; @@ -3840,7 +4030,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_url_server; } default: { - goto s_n_llhttp__internal__n_error_69; + goto s_n_llhttp__internal__n_error_85; } } /* UNREACHABLE */; @@ -3877,7 +4067,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_url_schema_delim_1; } default: { - goto s_n_llhttp__internal__n_error_69; + goto s_n_llhttp__internal__n_error_85; } } /* UNREACHABLE */; @@ -3929,7 +4119,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_url_schema; } default: { - goto s_n_llhttp__internal__n_error_70; + goto s_n_llhttp__internal__n_error_86; } } /* UNREACHABLE */; @@ -3970,7 +4160,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_url_schema; } default: { - goto s_n_llhttp__internal__n_error_71; + goto s_n_llhttp__internal__n_error_87; } } /* UNREACHABLE */; @@ -4068,7 +4258,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_req_spaces_before_url; } default: { - goto s_n_llhttp__internal__n_error_72; + goto s_n_llhttp__internal__n_error_88; } } /* UNREACHABLE */; @@ -4080,9 +4270,9 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_req_first_space_before_url; case 21: - goto s_n_llhttp__internal__n_pause_22; + goto s_n_llhttp__internal__n_pause_26; default: - goto s_n_llhttp__internal__n_error_89; + goto s_n_llhttp__internal__n_error_107; } /* UNREACHABLE */; abort(); @@ -4099,7 +4289,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4112,7 +4302,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_3; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob18, 6); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob17, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4124,7 +4314,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_3; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4145,7 +4335,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_3; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4158,7 +4348,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_4; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob19, 3); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob18, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4170,7 +4360,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_4; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4183,7 +4373,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_6; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob20, 6); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob19, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4195,7 +4385,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_6; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4208,7 +4398,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_8; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob21, 4); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob20, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4220,7 +4410,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_8; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4238,7 +4428,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4259,7 +4449,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_9; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4280,7 +4470,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_7; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4293,7 +4483,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_12; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob22, 3); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob21, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4305,7 +4495,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_12; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4318,7 +4508,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_13; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob23, 5); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob22, 5); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4330,7 +4520,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_13; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4351,7 +4541,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_13; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4368,7 +4558,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_11; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4381,7 +4571,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_14; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob24, 4); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob23, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4393,7 +4583,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_14; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4406,7 +4596,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_17; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob26, 9); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob25, 9); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4418,7 +4608,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_17; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4449,7 +4639,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_15; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob25, 2); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob24, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4460,7 +4650,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_15; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4473,7 +4663,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_18; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob27, 3); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob26, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4485,7 +4675,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_18; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4498,7 +4688,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_20; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob28, 2); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob27, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4510,7 +4700,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_20; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4523,7 +4713,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_21; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob29, 2); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob28, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4535,7 +4725,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_21; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4556,7 +4746,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_21; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4569,7 +4759,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_23; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob30, 6); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob29, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4581,7 +4771,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_23; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4594,7 +4784,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_24; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob31, 3); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob30, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4606,7 +4796,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_24; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4619,7 +4809,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_26; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob32, 7); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob31, 7); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4631,7 +4821,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_26; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4644,7 +4834,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_28; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob33, 6); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob32, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4656,7 +4846,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_28; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4674,7 +4864,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4695,7 +4885,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_29; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4716,7 +4906,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_27; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4729,7 +4919,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_30; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob34, 2); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob33, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4741,7 +4931,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_30; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4770,7 +4960,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_30; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4783,7 +4973,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_31; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob35, 5); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob34, 5); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4795,7 +4985,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_31; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4808,7 +4998,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_32; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob36, 6); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob35, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4820,7 +5010,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_32; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4833,7 +5023,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_35; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob37, 2); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob36, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4845,7 +5035,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_35; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4858,7 +5048,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_36; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob38, 2); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob37, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4870,7 +5060,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_36; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4891,7 +5081,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_36; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4904,7 +5094,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_37; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob39, 2); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob38, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4916,7 +5106,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_37; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4929,7 +5119,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_38; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob40, 2); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob39, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4941,7 +5131,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_38; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4954,7 +5144,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_42; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob41, 3); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob40, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4966,7 +5156,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_42; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -4979,7 +5169,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_43; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob42, 4); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob41, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -4991,7 +5181,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_43; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5012,7 +5202,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_43; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5029,7 +5219,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_41; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5051,7 +5241,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_40; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5064,7 +5254,7 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_45; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob43, 2); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob42, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { @@ -5076,7 +5266,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_after_start_req_45; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5098,7 +5288,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5131,32 +5321,32 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_after_start_req_44; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_48: - s_n_llhttp__internal__n_after_start_req_48: { + case s_n_llhttp__internal__n_after_start_req_46: + s_n_llhttp__internal__n_after_start_req_46: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_48; + return s_n_llhttp__internal__n_after_start_req_46; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob44, 3); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob43, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; - match = 17; + match = 46; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_48; + return s_n_llhttp__internal__n_after_start_req_46; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5169,19 +5359,19 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_49; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob45, 3); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob44, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; - match = 44; + match = 17; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_after_start_req_49; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5194,19 +5384,19 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_50; } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob46, 5); + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob45, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; - match = 43; + match = 44; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_after_start_req_50; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5219,6 +5409,31 @@ static llparse_state_t llhttp__internal__run( if (p == endp) { return s_n_llhttp__internal__n_after_start_req_51; } + match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob46, 5); + p = match_seq.current; + switch (match_seq.status) { + case kMatchComplete: { + p++; + match = 43; + goto s_n_llhttp__internal__n_invoke_store_method_1; + } + case kMatchPause: { + return s_n_llhttp__internal__n_after_start_req_51; + } + case kMatchMismatch: { + goto s_n_llhttp__internal__n_error_108; + } + } + /* UNREACHABLE */; + abort(); + } + case s_n_llhttp__internal__n_after_start_req_52: + s_n_llhttp__internal__n_after_start_req_52: { + llparse_match_t match_seq; + + if (p == endp) { + return s_n_llhttp__internal__n_after_start_req_52; + } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob47, 3); p = match_seq.current; switch (match_seq.status) { @@ -5228,67 +5443,67 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_51; + return s_n_llhttp__internal__n_after_start_req_52; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_47: - s_n_llhttp__internal__n_after_start_req_47: { + case s_n_llhttp__internal__n_after_start_req_48: + s_n_llhttp__internal__n_after_start_req_48: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_47; + return s_n_llhttp__internal__n_after_start_req_48; } switch (*p) { case 'B': { p++; - goto s_n_llhttp__internal__n_after_start_req_48; + goto s_n_llhttp__internal__n_after_start_req_49; } case 'C': { p++; - goto s_n_llhttp__internal__n_after_start_req_49; + goto s_n_llhttp__internal__n_after_start_req_50; } case 'D': { p++; - goto s_n_llhttp__internal__n_after_start_req_50; + goto s_n_llhttp__internal__n_after_start_req_51; } case 'P': { p++; - goto s_n_llhttp__internal__n_after_start_req_51; + goto s_n_llhttp__internal__n_after_start_req_52; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_46: - s_n_llhttp__internal__n_after_start_req_46: { + case s_n_llhttp__internal__n_after_start_req_47: + s_n_llhttp__internal__n_after_start_req_47: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_46; + return s_n_llhttp__internal__n_after_start_req_47; } switch (*p) { case 'E': { p++; - goto s_n_llhttp__internal__n_after_start_req_47; + goto s_n_llhttp__internal__n_after_start_req_48; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_54: - s_n_llhttp__internal__n_after_start_req_54: { + case s_n_llhttp__internal__n_after_start_req_55: + s_n_llhttp__internal__n_after_start_req_55: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_54; + return s_n_llhttp__internal__n_after_start_req_55; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob48, 3); p = match_seq.current; @@ -5299,19 +5514,19 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_54; + return s_n_llhttp__internal__n_after_start_req_55; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_56: - s_n_llhttp__internal__n_after_start_req_56: { + case s_n_llhttp__internal__n_after_start_req_57: + s_n_llhttp__internal__n_after_start_req_57: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_56; + return s_n_llhttp__internal__n_after_start_req_57; } switch (*p) { case 'P': { @@ -5320,18 +5535,18 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_57: - s_n_llhttp__internal__n_after_start_req_57: { + case s_n_llhttp__internal__n_after_start_req_58: + s_n_llhttp__internal__n_after_start_req_58: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_57; + return s_n_llhttp__internal__n_after_start_req_58; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob49, 9); p = match_seq.current; @@ -5342,63 +5557,63 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_57; + return s_n_llhttp__internal__n_after_start_req_58; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_55: - s_n_llhttp__internal__n_after_start_req_55: { + case s_n_llhttp__internal__n_after_start_req_56: + s_n_llhttp__internal__n_after_start_req_56: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_55; + return s_n_llhttp__internal__n_after_start_req_56; } switch (*p) { case 'U': { p++; - goto s_n_llhttp__internal__n_after_start_req_56; + goto s_n_llhttp__internal__n_after_start_req_57; } case '_': { p++; - goto s_n_llhttp__internal__n_after_start_req_57; + goto s_n_llhttp__internal__n_after_start_req_58; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_53: - s_n_llhttp__internal__n_after_start_req_53: { + case s_n_llhttp__internal__n_after_start_req_54: + s_n_llhttp__internal__n_after_start_req_54: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_53; + return s_n_llhttp__internal__n_after_start_req_54; } switch (*p) { case 'A': { p++; - goto s_n_llhttp__internal__n_after_start_req_54; + goto s_n_llhttp__internal__n_after_start_req_55; } case 'T': { p++; - goto s_n_llhttp__internal__n_after_start_req_55; + goto s_n_llhttp__internal__n_after_start_req_56; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_58: - s_n_llhttp__internal__n_after_start_req_58: { + case s_n_llhttp__internal__n_after_start_req_59: + s_n_llhttp__internal__n_after_start_req_59: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_58; + return s_n_llhttp__internal__n_after_start_req_59; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob50, 4); p = match_seq.current; @@ -5409,21 +5624,21 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_58; + return s_n_llhttp__internal__n_after_start_req_59; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_59: - s_n_llhttp__internal__n_after_start_req_59: { + case s_n_llhttp__internal__n_after_start_req_60: + s_n_llhttp__internal__n_after_start_req_60: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_59; + return s_n_llhttp__internal__n_after_start_req_60; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob51, 7); p = match_seq.current; @@ -5434,46 +5649,46 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_59; + return s_n_llhttp__internal__n_after_start_req_60; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_52: - s_n_llhttp__internal__n_after_start_req_52: { + case s_n_llhttp__internal__n_after_start_req_53: + s_n_llhttp__internal__n_after_start_req_53: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_52; + return s_n_llhttp__internal__n_after_start_req_53; } switch (*p) { case 'E': { p++; - goto s_n_llhttp__internal__n_after_start_req_53; + goto s_n_llhttp__internal__n_after_start_req_54; } case 'O': { p++; - goto s_n_llhttp__internal__n_after_start_req_58; + goto s_n_llhttp__internal__n_after_start_req_59; } case 'U': { p++; - goto s_n_llhttp__internal__n_after_start_req_59; + goto s_n_llhttp__internal__n_after_start_req_60; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_61: - s_n_llhttp__internal__n_after_start_req_61: { + case s_n_llhttp__internal__n_after_start_req_62: + s_n_llhttp__internal__n_after_start_req_62: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_61; + return s_n_llhttp__internal__n_after_start_req_62; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob52, 6); p = match_seq.current; @@ -5484,21 +5699,21 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_61; + return s_n_llhttp__internal__n_after_start_req_62; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_62: - s_n_llhttp__internal__n_after_start_req_62: { + case s_n_llhttp__internal__n_after_start_req_63: + s_n_llhttp__internal__n_after_start_req_63: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_62; + return s_n_llhttp__internal__n_after_start_req_63; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob53, 3); p = match_seq.current; @@ -5509,42 +5724,42 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_62; + return s_n_llhttp__internal__n_after_start_req_63; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_60: - s_n_llhttp__internal__n_after_start_req_60: { + case s_n_llhttp__internal__n_after_start_req_61: + s_n_llhttp__internal__n_after_start_req_61: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_60; + return s_n_llhttp__internal__n_after_start_req_61; } switch (*p) { case 'E': { p++; - goto s_n_llhttp__internal__n_after_start_req_61; + goto s_n_llhttp__internal__n_after_start_req_62; } case 'R': { p++; - goto s_n_llhttp__internal__n_after_start_req_62; + goto s_n_llhttp__internal__n_after_start_req_63; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_65: - s_n_llhttp__internal__n_after_start_req_65: { + case s_n_llhttp__internal__n_after_start_req_66: + s_n_llhttp__internal__n_after_start_req_66: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_65; + return s_n_llhttp__internal__n_after_start_req_66; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob54, 3); p = match_seq.current; @@ -5555,21 +5770,21 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_65; + return s_n_llhttp__internal__n_after_start_req_66; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_67: - s_n_llhttp__internal__n_after_start_req_67: { + case s_n_llhttp__internal__n_after_start_req_68: + s_n_llhttp__internal__n_after_start_req_68: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_67; + return s_n_llhttp__internal__n_after_start_req_68; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob55, 2); p = match_seq.current; @@ -5580,21 +5795,21 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_67; + return s_n_llhttp__internal__n_after_start_req_68; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_68: - s_n_llhttp__internal__n_after_start_req_68: { + case s_n_llhttp__internal__n_after_start_req_69: + s_n_llhttp__internal__n_after_start_req_69: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_68; + return s_n_llhttp__internal__n_after_start_req_69; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob56, 2); p = match_seq.current; @@ -5605,42 +5820,42 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_68; + return s_n_llhttp__internal__n_after_start_req_69; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_66: - s_n_llhttp__internal__n_after_start_req_66: { + case s_n_llhttp__internal__n_after_start_req_67: + s_n_llhttp__internal__n_after_start_req_67: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_66; + return s_n_llhttp__internal__n_after_start_req_67; } switch (*p) { case 'I': { p++; - goto s_n_llhttp__internal__n_after_start_req_67; + goto s_n_llhttp__internal__n_after_start_req_68; } case 'O': { p++; - goto s_n_llhttp__internal__n_after_start_req_68; + goto s_n_llhttp__internal__n_after_start_req_69; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_69: - s_n_llhttp__internal__n_after_start_req_69: { + case s_n_llhttp__internal__n_after_start_req_70: + s_n_llhttp__internal__n_after_start_req_70: { llparse_match_t match_seq; if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_69; + return s_n_llhttp__internal__n_after_start_req_70; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob57, 8); p = match_seq.current; @@ -5651,52 +5866,52 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { - return s_n_llhttp__internal__n_after_start_req_69; + return s_n_llhttp__internal__n_after_start_req_70; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_64: - s_n_llhttp__internal__n_after_start_req_64: { + case s_n_llhttp__internal__n_after_start_req_65: + s_n_llhttp__internal__n_after_start_req_65: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_64; + return s_n_llhttp__internal__n_after_start_req_65; } switch (*p) { case 'B': { p++; - goto s_n_llhttp__internal__n_after_start_req_65; + goto s_n_llhttp__internal__n_after_start_req_66; } case 'L': { p++; - goto s_n_llhttp__internal__n_after_start_req_66; + goto s_n_llhttp__internal__n_after_start_req_67; } case 'S': { p++; - goto s_n_llhttp__internal__n_after_start_req_69; + goto s_n_llhttp__internal__n_after_start_req_70; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_after_start_req_63: - s_n_llhttp__internal__n_after_start_req_63: { + case s_n_llhttp__internal__n_after_start_req_64: + s_n_llhttp__internal__n_after_start_req_64: { if (p == endp) { - return s_n_llhttp__internal__n_after_start_req_63; + return s_n_llhttp__internal__n_after_start_req_64; } switch (*p) { case 'N': { p++; - goto s_n_llhttp__internal__n_after_start_req_64; + goto s_n_llhttp__internal__n_after_start_req_65; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5756,24 +5971,28 @@ static llparse_state_t llhttp__internal__run( p++; goto s_n_llhttp__internal__n_after_start_req_33; } - case 'R': { + case 'Q': { p++; goto s_n_llhttp__internal__n_after_start_req_46; } + case 'R': { + p++; + goto s_n_llhttp__internal__n_after_start_req_47; + } case 'S': { p++; - goto s_n_llhttp__internal__n_after_start_req_52; + goto s_n_llhttp__internal__n_after_start_req_53; } case 'T': { p++; - goto s_n_llhttp__internal__n_after_start_req_60; + goto s_n_llhttp__internal__n_after_start_req_61; } case 'U': { p++; - goto s_n_llhttp__internal__n_after_start_req_63; + goto s_n_llhttp__internal__n_after_start_req_64; } default: { - goto s_n_llhttp__internal__n_error_90; + goto s_n_llhttp__internal__n_error_108; } } /* UNREACHABLE */; @@ -5805,12 +6024,23 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_llhttp__on_status_complete; } default: { - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_18; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_29; } } /* UNREACHABLE */; abort(); } + case s_n_llhttp__internal__n_invoke_test_lenient_flags_30: + s_n_llhttp__internal__n_invoke_test_lenient_flags_30: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_invoke_llhttp__on_status_complete; + default: + goto s_n_llhttp__internal__n_error_94; + } + /* UNREACHABLE */; + abort(); + } case s_n_llhttp__internal__n_res_status: s_n_llhttp__internal__n_res_status: { if (p == endp) { @@ -5842,27 +6072,6 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_res_status_start: - s_n_llhttp__internal__n_res_status_start: { - if (p == endp) { - return s_n_llhttp__internal__n_res_status_start; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_status_complete; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_res_line_almost_done; - } - default: { - goto s_n_llhttp__internal__n_span_start_llhttp__on_status; - } - } - /* UNREACHABLE */; - abort(); - } case s_n_llhttp__internal__n_res_status_code_otherwise: s_n_llhttp__internal__n_res_status_code_otherwise: { if (p == endp) { @@ -5870,17 +6079,19 @@ static llparse_state_t llhttp__internal__run( } switch (*p) { case 10: { - goto s_n_llhttp__internal__n_res_status_start; + p++; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_28; } case 13: { - goto s_n_llhttp__internal__n_res_status_start; + p++; + goto s_n_llhttp__internal__n_res_line_almost_done; } case ' ': { p++; - goto s_n_llhttp__internal__n_res_status_start; + goto s_n_llhttp__internal__n_span_start_llhttp__on_status; } default: { - goto s_n_llhttp__internal__n_error_77; + goto s_n_llhttp__internal__n_error_95; } } /* UNREACHABLE */; @@ -5943,7 +6154,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_mul_add_status_code_2; } default: { - goto s_n_llhttp__internal__n_error_79; + goto s_n_llhttp__internal__n_error_97; } } /* UNREACHABLE */; @@ -6006,7 +6217,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_mul_add_status_code_1; } default: { - goto s_n_llhttp__internal__n_error_81; + goto s_n_llhttp__internal__n_error_99; } } /* UNREACHABLE */; @@ -6069,7 +6280,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } default: { - goto s_n_llhttp__internal__n_error_83; + goto s_n_llhttp__internal__n_error_101; } } /* UNREACHABLE */; @@ -6086,7 +6297,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_update_status_code; } default: { - goto s_n_llhttp__internal__n_error_84; + goto s_n_llhttp__internal__n_error_102; } } /* UNREACHABLE */; @@ -6098,15 +6309,15 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_res_after_version; case 21: - goto s_n_llhttp__internal__n_pause_21; + goto s_n_llhttp__internal__n_pause_25; default: - goto s_n_llhttp__internal__n_error_74; + goto s_n_llhttp__internal__n_error_90; } /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_73: - s_n_llhttp__internal__n_error_73: { + case s_n_llhttp__internal__n_error_89: + s_n_llhttp__internal__n_error_89: { state->error = 0x9; state->reason = "Invalid HTTP version"; state->error_pos = (const char*) p; @@ -6115,8 +6326,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_85: - s_n_llhttp__internal__n_error_85: { + case s_n_llhttp__internal__n_error_103: + s_n_llhttp__internal__n_error_103: { state->error = 0x9; state->reason = "Invalid minor version"; state->error_pos = (const char*) p; @@ -6188,8 +6399,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_86: - s_n_llhttp__internal__n_error_86: { + case s_n_llhttp__internal__n_error_104: + s_n_llhttp__internal__n_error_104: { state->error = 0x9; state->reason = "Expected dot"; state->error_pos = (const char*) p; @@ -6215,8 +6426,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - case s_n_llhttp__internal__n_error_87: - s_n_llhttp__internal__n_error_87: { + case s_n_llhttp__internal__n_error_105: + s_n_llhttp__internal__n_error_105: { state->error = 0x9; state->reason = "Invalid major version"; state->error_pos = (const char*) p; @@ -6317,7 +6528,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_start_res; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_91; + goto s_n_llhttp__internal__n_error_109; } } /* UNREACHABLE */; @@ -6329,7 +6540,7 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_req_first_space_before_url; case 21: - goto s_n_llhttp__internal__n_pause_19; + goto s_n_llhttp__internal__n_pause_23; default: goto s_n_llhttp__internal__n_error_1; } @@ -6355,7 +6566,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_req_or_res_method_2; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_88; + goto s_n_llhttp__internal__n_error_106; } } /* UNREACHABLE */; @@ -6388,7 +6599,7 @@ static llparse_state_t llhttp__internal__run( return s_n_llhttp__internal__n_req_or_res_method_3; } case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_88; + goto s_n_llhttp__internal__n_error_106; } } /* UNREACHABLE */; @@ -6409,7 +6620,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_req_or_res_method_3; } default: { - goto s_n_llhttp__internal__n_error_88; + goto s_n_llhttp__internal__n_error_106; } } /* UNREACHABLE */; @@ -6426,7 +6637,7 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_req_or_res_method_1; } default: { - goto s_n_llhttp__internal__n_error_88; + goto s_n_llhttp__internal__n_error_106; } } /* UNREACHABLE */; @@ -6539,7 +6750,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_7: { + s_n_llhttp__internal__n_error_8: { state->error = 0x5; state->reason = "Data after `Connection: close`"; state->error_pos = (const char*) p; @@ -6553,7 +6764,7 @@ static llparse_state_t llhttp__internal__run( case 1: goto s_n_llhttp__internal__n_closed; default: - goto s_n_llhttp__internal__n_error_7; + goto s_n_llhttp__internal__n_error_8; } /* UNREACHABLE */; abort(); @@ -6576,6 +6787,54 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } + s_n_llhttp__internal__n_pause_13: { + state->error = 0x15; + state->reason = "on_message_complete pause"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_is_equal_upgrade; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_38: { + state->error = 0x12; + state->reason = "`on_message_complete` callback error"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_pause_15: { + state->error = 0x15; + state->reason = "on_chunk_complete pause"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_40: { + state->error = 0x14; + state->reason = "`on_chunk_complete` callback error"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_1: { + switch (llhttp__on_chunk_complete(state, p, endp)) { + case 0: + goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2; + case 21: + goto s_n_llhttp__internal__n_pause_15; + default: + goto s_n_llhttp__internal__n_error_40; + } + /* UNREACHABLE */; + abort(); + } s_n_llhttp__internal__n_pause_2: { state->error = 0x15; state->reason = "on_message_complete pause"; @@ -6585,7 +6844,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_8: { + s_n_llhttp__internal__n_error_9: { state->error = 0x12; state->reason = "`on_message_complete` callback error"; state->error_pos = (const char*) p; @@ -6601,12 +6860,12 @@ static llparse_state_t llhttp__internal__run( case 21: goto s_n_llhttp__internal__n_pause_2; default: - goto s_n_llhttp__internal__n_error_8; + goto s_n_llhttp__internal__n_error_9; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_26: { + s_n_llhttp__internal__n_error_36: { state->error = 0xc; state->reason = "Chunk size overflow"; state->error_pos = (const char*) p; @@ -6615,6 +6874,25 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } + s_n_llhttp__internal__n_error_10: { + state->error = 0xc; + state->reason = "Invalid character in chunk size"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_test_lenient_flags_4: { + switch (llhttp__internal__c_test_lenient_flags_4(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_chunk_size_otherwise; + default: + goto s_n_llhttp__internal__n_error_10; + } + /* UNREACHABLE */; + abort(); + } s_n_llhttp__internal__n_pause_3: { state->error = 0x15; state->reason = "on_chunk_complete pause"; @@ -6624,7 +6902,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_10: { + s_n_llhttp__internal__n_error_14: { state->error = 0x14; state->reason = "`on_chunk_complete` callback error"; state->error_pos = (const char*) p; @@ -6640,12 +6918,31 @@ static llparse_state_t llhttp__internal__run( case 21: goto s_n_llhttp__internal__n_pause_3; default: - goto s_n_llhttp__internal__n_error_10; + goto s_n_llhttp__internal__n_error_14; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_11: { + s_n_llhttp__internal__n_error_13: { + state->error = 0x19; + state->reason = "Missing expected CR after chunk data"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_test_lenient_flags_6: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete; + default: + goto s_n_llhttp__internal__n_error_13; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_15: { state->error = 0x2; state->reason = "Expected LF after chunk data"; state->error_pos = (const char*) p; @@ -6654,12 +6951,12 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_4: { - switch (llhttp__internal__c_test_lenient_flags_4(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_7: { + switch (llhttp__internal__c_test_lenient_flags_7(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete; default: - goto s_n_llhttp__internal__n_error_11; + goto s_n_llhttp__internal__n_error_15; } /* UNREACHABLE */; abort(); @@ -6698,7 +6995,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_9: { + s_n_llhttp__internal__n_error_12: { state->error = 0x13; state->reason = "`on_chunk_header` callback error"; state->error_pos = (const char*) p; @@ -6714,12 +7011,12 @@ static llparse_state_t llhttp__internal__run( case 21: goto s_n_llhttp__internal__n_pause_4; default: - goto s_n_llhttp__internal__n_error_9; + goto s_n_llhttp__internal__n_error_12; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_12: { + s_n_llhttp__internal__n_error_16: { state->error = 0x2; state->reason = "Expected LF after chunk size"; state->error_pos = (const char*) p; @@ -6728,44 +7025,72 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_5: { - switch (llhttp__internal__c_test_lenient_flags_5(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_8: { + switch (llhttp__internal__c_test_lenient_flags_8(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_header; default: - goto s_n_llhttp__internal__n_error_12; + goto s_n_llhttp__internal__n_error_16; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_13: { - state->error = 0x2; - state->reason = "Invalid character in chunk extensions"; + s_n_llhttp__internal__n_error_11: { + state->error = 0x19; + state->reason = "Missing expected CR after chunk size"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_14: { - state->error = 0x2; - state->reason = "Invalid character in chunk extensions"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); + s_n_llhttp__internal__n_invoke_test_lenient_flags_5: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_chunk_size_almost_done; + default: + goto s_n_llhttp__internal__n_error_11; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_17: { + state->error = 0x2; + state->reason = "Invalid character in chunk extensions"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_18: { + state->error = 0x2; + state->reason = "Invalid character in chunk extensions"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_20: { + state->error = 0x19; + state->reason = "Missing expected CR after chunk extension name"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); } s_n_llhttp__internal__n_pause_5: { state->error = 0x15; state->reason = "on_chunk_extension_name pause"; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_size_almost_done; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_test_lenient_flags_9; return s_error; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_15: { + s_n_llhttp__internal__n_error_19: { state->error = 0x22; state->reason = "`on_chunk_extension_name` callback error"; state->error_pos = (const char*) p; @@ -6783,11 +7108,10 @@ static llparse_state_t llhttp__internal__run( err = llhttp__on_chunk_extension_name(state, start, p); if (err != 0) { state->error = err; - state->error_pos = (const char*) (p + 1); + state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete; return s_error; } - p++; goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete; /* UNREACHABLE */; abort(); @@ -6796,12 +7120,12 @@ static llparse_state_t llhttp__internal__run( state->error = 0x15; state->reason = "on_chunk_extension_name pause"; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_extensions; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_size_almost_done; return s_error; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_16: { + s_n_llhttp__internal__n_error_21: { state->error = 0x22; state->reason = "`on_chunk_extension_name` callback error"; state->error_pos = (const char*) p; @@ -6829,15 +7153,60 @@ static llparse_state_t llhttp__internal__run( abort(); } s_n_llhttp__internal__n_pause_7: { + state->error = 0x15; + state->reason = "on_chunk_extension_name pause"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_extensions; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_22: { + state->error = 0x22; + state->reason = "`on_chunk_extension_name` callback error"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_2: { + const unsigned char* start; + int err; + + start = state->_span_pos0; + state->_span_pos0 = NULL; + err = llhttp__on_chunk_extension_name(state, start, p); + if (err != 0) { + state->error = err; + state->error_pos = (const char*) (p + 1); + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_2; + return s_error; + } + p++; + goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_2; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_25: { + state->error = 0x19; + state->reason = "Missing expected CR after chunk extension value"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_pause_8: { state->error = 0x15; state->reason = "on_chunk_extension_value pause"; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_size_almost_done; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_test_lenient_flags_10; return s_error; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_18: { + s_n_llhttp__internal__n_error_24: { state->error = 0x23; state->reason = "`on_chunk_extension_value` callback error"; state->error_pos = (const char*) p; @@ -6855,16 +7224,70 @@ static llparse_state_t llhttp__internal__run( err = llhttp__on_chunk_extension_value(state, start, p); if (err != 0) { state->error = err; - state->error_pos = (const char*) (p + 1); + state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete; return s_error; } - p++; goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_20: { + s_n_llhttp__internal__n_pause_9: { + state->error = 0x15; + state->reason = "on_chunk_extension_value pause"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_size_almost_done; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_26: { + state->error = 0x23; + state->reason = "`on_chunk_extension_value` callback error"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_1: { + const unsigned char* start; + int err; + + start = state->_span_pos0; + state->_span_pos0 = NULL; + err = llhttp__on_chunk_extension_value(state, start, p); + if (err != 0) { + state->error = err; + state->error_pos = (const char*) (p + 1); + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_1; + return s_error; + } + p++; + goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_1; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_28: { + state->error = 0x19; + state->reason = "Missing expected CR after chunk extension value"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_test_lenient_flags_11: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_chunk_size_almost_done; + default: + goto s_n_llhttp__internal__n_error_28; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_29: { state->error = 0x2; state->reason = "Invalid character in chunk extensions quote value"; state->error_pos = (const char*) p; @@ -6873,7 +7296,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_8: { + s_n_llhttp__internal__n_pause_10: { state->error = 0x15; state->reason = "on_chunk_extension_value pause"; state->error_pos = (const char*) p; @@ -6882,7 +7305,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_19: { + s_n_llhttp__internal__n_error_27: { state->error = 0x23; state->reason = "`on_chunk_extension_value` callback error"; state->error_pos = (const char*) p; @@ -6891,7 +7314,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_1: { + s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_2: { const unsigned char* start; int err; @@ -6901,14 +7324,14 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_1; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_2; return s_error; } - goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_1; + goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_2; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_2: { + s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_3: { const unsigned char* start; int err; @@ -6918,24 +7341,42 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_21; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_30; return s_error; } p++; - goto s_n_llhttp__internal__n_error_21; + goto s_n_llhttp__internal__n_error_30; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_9: { + s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_4: { + const unsigned char* start; + int err; + + start = state->_span_pos0; + state->_span_pos0 = NULL; + err = llhttp__on_chunk_extension_value(state, start, p); + if (err != 0) { + state->error = err; + state->error_pos = (const char*) (p + 1); + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_31; + return s_error; + } + p++; + goto s_n_llhttp__internal__n_error_31; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_pause_11: { state->error = 0x15; state->reason = "on_chunk_extension_value pause"; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_size_otherwise; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_extensions; return s_error; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_22: { + s_n_llhttp__internal__n_error_32: { state->error = 0x23; state->reason = "`on_chunk_extension_value` callback error"; state->error_pos = (const char*) p; @@ -6944,7 +7385,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_3: { + s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_5: { const unsigned char* start; int err; @@ -6954,15 +7395,15 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_2; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_3; return s_error; } p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_2; + goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_value_complete_3; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_4: { + s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_value_6: { const unsigned char* start; int err; @@ -6972,15 +7413,15 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_23; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_33; return s_error; } p++; - goto s_n_llhttp__internal__n_error_23; + goto s_n_llhttp__internal__n_error_33; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_10: { + s_n_llhttp__internal__n_pause_12: { state->error = 0x15; state->reason = "on_chunk_extension_name pause"; state->error_pos = (const char*) p; @@ -6989,7 +7430,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_17: { + s_n_llhttp__internal__n_error_23: { state->error = 0x22; state->reason = "`on_chunk_extension_name` callback error"; state->error_pos = (const char*) p; @@ -6998,19 +7439,19 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_2: { + s_n_llhttp__internal__n_invoke_llhttp__on_chunk_extension_name_complete_3: { switch (llhttp__on_chunk_extension_name_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_chunk_extension_value; case 21: - goto s_n_llhttp__internal__n_pause_10; + goto s_n_llhttp__internal__n_pause_12; default: - goto s_n_llhttp__internal__n_error_17; + goto s_n_llhttp__internal__n_error_23; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_2: { + s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_3: { const unsigned char* start; int err; @@ -7028,7 +7469,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_3: { + s_n_llhttp__internal__n_span_end_llhttp__on_chunk_extension_name_4: { const unsigned char* start; int err; @@ -7038,15 +7479,15 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_24; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_34; return s_error; } p++; - goto s_n_llhttp__internal__n_error_24; + goto s_n_llhttp__internal__n_error_34; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_25: { + s_n_llhttp__internal__n_error_35: { state->error = 0xc; state->reason = "Invalid character in chunk size"; state->error_pos = (const char*) p; @@ -7058,14 +7499,14 @@ static llparse_state_t llhttp__internal__run( s_n_llhttp__internal__n_invoke_mul_add_content_length: { switch (llhttp__internal__c_mul_add_content_length(state, p, endp, match)) { case 1: - goto s_n_llhttp__internal__n_error_26; + goto s_n_llhttp__internal__n_error_36; default: goto s_n_llhttp__internal__n_chunk_size; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_27: { + s_n_llhttp__internal__n_error_37: { state->error = 0xc; state->reason = "Invalid character in chunk size"; state->error_pos = (const char*) p; @@ -7074,24 +7515,6 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_11: { - state->error = 0x15; - state->reason = "on_message_complete pause"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_is_equal_upgrade; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_28: { - state->error = 0x12; - state->reason = "`on_message_complete` callback error"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } s_n_llhttp__internal__n_span_end_llhttp__on_body_1: { const unsigned char* start; int err; @@ -7117,7 +7540,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_29: { + s_n_llhttp__internal__n_error_39: { state->error = 0xf; state->reason = "Request has invalid `Transfer-Encoding`"; state->error_pos = (const char*) p; @@ -7135,7 +7558,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_6: { + s_n_llhttp__internal__n_error_7: { state->error = 0x12; state->reason = "`on_message_complete` callback error"; state->error_pos = (const char*) p; @@ -7150,23 +7573,99 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_invoke_llhttp__after_message_complete; case 21: goto s_n_llhttp__internal__n_pause; + default: + goto s_n_llhttp__internal__n_error_7; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_or_flags_1: { + switch (llhttp__internal__c_or_flags_1(state, p, endp)) { + default: + goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_or_flags_2: { + switch (llhttp__internal__c_or_flags_1(state, p, endp)) { + default: + goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_update_upgrade: { + switch (llhttp__internal__c_update_upgrade(state, p, endp)) { + default: + goto s_n_llhttp__internal__n_invoke_or_flags_2; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_pause_14: { + state->error = 0x15; + state->reason = "Paused by on_headers_complete"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_6: { + state->error = 0x11; + state->reason = "User callback error"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete: { + switch (llhttp__on_headers_complete(state, p, endp)) { + case 0: + goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; + case 1: + goto s_n_llhttp__internal__n_invoke_or_flags_1; + case 2: + goto s_n_llhttp__internal__n_invoke_update_upgrade; + case 21: + goto s_n_llhttp__internal__n_pause_14; default: goto s_n_llhttp__internal__n_error_6; } /* UNREACHABLE */; abort(); } + s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete: { + switch (llhttp__before_headers_complete(state, p, endp)) { + default: + goto s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_test_flags: { + switch (llhttp__internal__c_test_flags(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_1; + default: + goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete; + } + /* UNREACHABLE */; + abort(); + } s_n_llhttp__internal__n_invoke_test_lenient_flags_1: { - switch (llhttp__internal__c_test_lenient_flags(state, p, endp)) { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { case 1: - goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; + goto s_n_llhttp__internal__n_invoke_test_flags; default: goto s_n_llhttp__internal__n_error_5; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_13: { + s_n_llhttp__internal__n_pause_17: { state->error = 0x15; state->reason = "on_chunk_complete pause"; state->error_pos = (const char*) p; @@ -7175,7 +7674,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_32: { + s_n_llhttp__internal__n_error_42: { state->error = 0x14; state->reason = "`on_chunk_complete` callback error"; state->error_pos = (const char*) p; @@ -7184,28 +7683,19 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_1: { + s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_2: { switch (llhttp__on_chunk_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2; case 21: - goto s_n_llhttp__internal__n_pause_13; + goto s_n_llhttp__internal__n_pause_17; default: - goto s_n_llhttp__internal__n_error_32; + goto s_n_llhttp__internal__n_error_42; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_31: { - state->error = 0x4; - state->reason = "Content-Length can't be present with Transfer-Encoding"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_1: { + s_n_llhttp__internal__n_invoke_or_flags_3: { switch (llhttp__internal__c_or_flags_1(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; @@ -7213,7 +7703,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_2: { + s_n_llhttp__internal__n_invoke_or_flags_4: { switch (llhttp__internal__c_or_flags_1(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; @@ -7221,15 +7711,15 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_update_upgrade: { + s_n_llhttp__internal__n_invoke_update_upgrade_1: { switch (llhttp__internal__c_update_upgrade(state, p, endp)) { default: - goto s_n_llhttp__internal__n_invoke_or_flags_2; + goto s_n_llhttp__internal__n_invoke_or_flags_4; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_12: { + s_n_llhttp__internal__n_pause_16: { state->error = 0x15; state->reason = "Paused by on_headers_complete"; state->error_pos = (const char*) p; @@ -7238,7 +7728,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_30: { + s_n_llhttp__internal__n_error_41: { state->error = 0x11; state->reason = "User callback error"; state->error_pos = (const char*) p; @@ -7247,61 +7737,41 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete: { + s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete_1: { switch (llhttp__on_headers_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; case 1: - goto s_n_llhttp__internal__n_invoke_or_flags_1; + goto s_n_llhttp__internal__n_invoke_or_flags_3; case 2: - goto s_n_llhttp__internal__n_invoke_update_upgrade; + goto s_n_llhttp__internal__n_invoke_update_upgrade_1; case 21: - goto s_n_llhttp__internal__n_pause_12; + goto s_n_llhttp__internal__n_pause_16; default: - goto s_n_llhttp__internal__n_error_30; + goto s_n_llhttp__internal__n_error_41; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete: { + s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete_1: { switch (llhttp__before_headers_complete(state, p, endp)) { default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_test_lenient_flags_6: { - switch (llhttp__internal__c_test_lenient_flags_6(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_error_31; - default: - goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete; + goto s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete_1; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_test_flags_1: { - switch (llhttp__internal__c_test_flags_1(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_6; - default: - goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_test_flags: { switch (llhttp__internal__c_test_flags(state, p, endp)) { case 1: - goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_1; + goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_2; default: - goto s_n_llhttp__internal__n_invoke_test_flags_1; + goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete_1; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_33: { + s_n_llhttp__internal__n_error_43: { state->error = 0x2; state->reason = "Expected LF after headers"; state->error_pos = (const char*) p; @@ -7310,16 +7780,25 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_7: { - switch (llhttp__internal__c_test_lenient_flags_5(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_12: { + switch (llhttp__internal__c_test_lenient_flags_8(state, p, endp)) { case 1: - goto s_n_llhttp__internal__n_invoke_test_flags; + goto s_n_llhttp__internal__n_invoke_test_flags_1; default: - goto s_n_llhttp__internal__n_error_33; + goto s_n_llhttp__internal__n_error_43; } /* UNREACHABLE */; abort(); } + s_n_llhttp__internal__n_error_44: { + state->error = 0xa; + state->reason = "Invalid header token"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } s_n_llhttp__internal__n_span_end_llhttp__on_header_field: { const unsigned char* start; int err; @@ -7338,7 +7817,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_8: { + s_n_llhttp__internal__n_invoke_test_lenient_flags_13: { switch (llhttp__internal__c_test_lenient_flags(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_header_field_colon_discard_ws; @@ -7348,7 +7827,16 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_36: { + s_n_llhttp__internal__n_error_60: { + state->error = 0xb; + state->reason = "Content-Length can't be present with Transfer-Encoding"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_47: { state->error = 0xa; state->reason = "Invalid header value char"; state->error_pos = (const char*) p; @@ -7357,17 +7845,17 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_10: { + s_n_llhttp__internal__n_invoke_test_lenient_flags_15: { switch (llhttp__internal__c_test_lenient_flags(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_header_value_discard_ws; default: - goto s_n_llhttp__internal__n_error_36; + goto s_n_llhttp__internal__n_error_47; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_38: { + s_n_llhttp__internal__n_error_49: { state->error = 0xb; state->reason = "Empty Content-Length"; state->error_pos = (const char*) p; @@ -7376,7 +7864,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_14: { + s_n_llhttp__internal__n_pause_18: { state->error = 0x15; state->reason = "on_header_value_complete pause"; state->error_pos = (const char*) p; @@ -7385,7 +7873,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_37: { + s_n_llhttp__internal__n_error_48: { state->error = 0x1d; state->reason = "`on_header_value_complete` callback error"; state->error_pos = (const char*) p; @@ -7419,65 +7907,65 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_3: { - switch (llhttp__internal__c_or_flags_3(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_5: { + switch (llhttp__internal__c_or_flags_5(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_4: { - switch (llhttp__internal__c_or_flags_4(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_6: { + switch (llhttp__internal__c_or_flags_6(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_5: { - switch (llhttp__internal__c_or_flags_5(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_7: { + switch (llhttp__internal__c_or_flags_7(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_6: { - switch (llhttp__internal__c_or_flags_6(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_8: { + switch (llhttp__internal__c_or_flags_8(state, p, endp)) { default: goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_load_header_state_1: { + s_n_llhttp__internal__n_invoke_load_header_state_2: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 5: - goto s_n_llhttp__internal__n_invoke_or_flags_3; + goto s_n_llhttp__internal__n_invoke_or_flags_5; case 6: - goto s_n_llhttp__internal__n_invoke_or_flags_4; + goto s_n_llhttp__internal__n_invoke_or_flags_6; case 7: - goto s_n_llhttp__internal__n_invoke_or_flags_5; + goto s_n_llhttp__internal__n_invoke_or_flags_7; case 8: - goto s_n_llhttp__internal__n_invoke_or_flags_6; + goto s_n_llhttp__internal__n_invoke_or_flags_8; default: goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_load_header_state: { + s_n_llhttp__internal__n_invoke_load_header_state_1: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 2: - goto s_n_llhttp__internal__n_error_38; + goto s_n_llhttp__internal__n_error_49; default: - goto s_n_llhttp__internal__n_invoke_load_header_state_1; + goto s_n_llhttp__internal__n_invoke_load_header_state_2; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_35: { + s_n_llhttp__internal__n_error_46: { state->error = 0xa; state->reason = "Invalid header value char"; state->error_pos = (const char*) p; @@ -7486,17 +7974,17 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_9: { - switch (llhttp__internal__c_test_lenient_flags(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_14: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_header_value_discard_lws; default: - goto s_n_llhttp__internal__n_error_35; + goto s_n_llhttp__internal__n_error_46; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_39: { + s_n_llhttp__internal__n_error_50: { state->error = 0x2; state->reason = "Expected LF after CR"; state->error_pos = (const char*) p; @@ -7505,12 +7993,12 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_11: { + s_n_llhttp__internal__n_invoke_test_lenient_flags_16: { switch (llhttp__internal__c_test_lenient_flags(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_header_value_discard_lws; default: - goto s_n_llhttp__internal__n_error_39; + goto s_n_llhttp__internal__n_error_50; } /* UNREACHABLE */; abort(); @@ -7523,7 +8011,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_load_header_state_3: { + s_n_llhttp__internal__n_invoke_load_header_state_4: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 8: goto s_n_llhttp__internal__n_invoke_update_header_state_1; @@ -7533,6 +8021,25 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } + s_n_llhttp__internal__n_error_52: { + state->error = 0xa; + state->reason = "Unexpected whitespace after header value"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_test_lenient_flags_18: { + switch (llhttp__internal__c_test_lenient_flags(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_invoke_load_header_state_4; + default: + goto s_n_llhttp__internal__n_error_52; + } + /* UNREACHABLE */; + abort(); + } s_n_llhttp__internal__n_invoke_update_header_state_2: { switch (llhttp__internal__c_update_header_state(state, p, endp)) { default: @@ -7541,57 +8048,66 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_7: { - switch (llhttp__internal__c_or_flags_3(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_9: { + switch (llhttp__internal__c_or_flags_5(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_2; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_8: { - switch (llhttp__internal__c_or_flags_4(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_10: { + switch (llhttp__internal__c_or_flags_6(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_2; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_9: { - switch (llhttp__internal__c_or_flags_5(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_11: { + switch (llhttp__internal__c_or_flags_7(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_2; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_10: { - switch (llhttp__internal__c_or_flags_6(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_12: { + switch (llhttp__internal__c_or_flags_8(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_load_header_state_4: { + s_n_llhttp__internal__n_invoke_load_header_state_5: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 5: - goto s_n_llhttp__internal__n_invoke_or_flags_7; + goto s_n_llhttp__internal__n_invoke_or_flags_9; case 6: - goto s_n_llhttp__internal__n_invoke_or_flags_8; + goto s_n_llhttp__internal__n_invoke_or_flags_10; case 7: - goto s_n_llhttp__internal__n_invoke_or_flags_9; + goto s_n_llhttp__internal__n_invoke_or_flags_11; case 8: - goto s_n_llhttp__internal__n_invoke_or_flags_10; + goto s_n_llhttp__internal__n_invoke_or_flags_12; default: goto s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_40: { - state->error = 0x3; - state->reason = "Missing expected LF after header value"; + s_n_llhttp__internal__n_error_53: { + state->error = 0x3; + state->reason = "Missing expected LF after header value"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_51: { + state->error = 0x19; + state->reason = "Missing expected CR after header value"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; @@ -7602,6 +8118,23 @@ static llparse_state_t llhttp__internal__run( const unsigned char* start; int err; + start = state->_span_pos0; + state->_span_pos0 = NULL; + err = llhttp__on_header_value(state, start, p); + if (err != 0) { + state->error = err; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_test_lenient_flags_17; + return s_error; + } + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_17; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_span_end_llhttp__on_header_value_2: { + const unsigned char* start; + int err; + start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_value(state, start, p); @@ -7616,7 +8149,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3: { + s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4: { const unsigned char* start; int err; @@ -7633,7 +8166,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4: { + s_n_llhttp__internal__n_span_end_llhttp__on_header_value_5: { const unsigned char* start; int err; @@ -7651,7 +8184,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_2: { + s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3: { const unsigned char* start; int err; @@ -7661,19 +8194,19 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_41; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_54; return s_error; } - goto s_n_llhttp__internal__n_error_41; + goto s_n_llhttp__internal__n_error_54; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_12: { + s_n_llhttp__internal__n_invoke_test_lenient_flags_19: { switch (llhttp__internal__c_test_lenient_flags(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_header_value_lenient; default: - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_2; + goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3; } /* UNREACHABLE */; abort(); @@ -7686,48 +8219,48 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_11: { - switch (llhttp__internal__c_or_flags_3(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_13: { + switch (llhttp__internal__c_or_flags_5(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_4; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_12: { - switch (llhttp__internal__c_or_flags_4(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_14: { + switch (llhttp__internal__c_or_flags_6(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_4; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_13: { - switch (llhttp__internal__c_or_flags_5(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_15: { + switch (llhttp__internal__c_or_flags_7(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_4; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_14: { - switch (llhttp__internal__c_or_flags_6(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_16: { + switch (llhttp__internal__c_or_flags_8(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_connection; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_load_header_state_5: { + s_n_llhttp__internal__n_invoke_load_header_state_6: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 5: - goto s_n_llhttp__internal__n_invoke_or_flags_11; + goto s_n_llhttp__internal__n_invoke_or_flags_13; case 6: - goto s_n_llhttp__internal__n_invoke_or_flags_12; + goto s_n_llhttp__internal__n_invoke_or_flags_14; case 7: - goto s_n_llhttp__internal__n_invoke_or_flags_13; + goto s_n_llhttp__internal__n_invoke_or_flags_15; case 8: - goto s_n_llhttp__internal__n_invoke_or_flags_14; + goto s_n_llhttp__internal__n_invoke_or_flags_16; default: goto s_n_llhttp__internal__n_header_value_connection; } @@ -7766,7 +8299,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_5: { + s_n_llhttp__internal__n_span_end_llhttp__on_header_value_6: { const unsigned char* start; int err; @@ -7776,32 +8309,32 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_43; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_56; return s_error; } - goto s_n_llhttp__internal__n_error_43; + goto s_n_llhttp__internal__n_error_56; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_mul_add_content_length_1: { switch (llhttp__internal__c_mul_add_content_length_1(state, p, endp, match)) { case 1: - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_5; + goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_6; default: goto s_n_llhttp__internal__n_header_value_content_length; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_15: { - switch (llhttp__internal__c_or_flags_15(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_17: { + switch (llhttp__internal__c_or_flags_17(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_otherwise; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_6: { + s_n_llhttp__internal__n_span_end_llhttp__on_header_value_7: { const unsigned char* start; int err; @@ -7811,14 +8344,14 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_44; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_57; return s_error; } - goto s_n_llhttp__internal__n_error_44; + goto s_n_llhttp__internal__n_error_57; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_42: { + s_n_llhttp__internal__n_error_55: { state->error = 0x4; state->reason = "Duplicate Content-Length"; state->error_pos = (const char*) p; @@ -7832,12 +8365,12 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_header_value_content_length; default: - goto s_n_llhttp__internal__n_error_42; + goto s_n_llhttp__internal__n_error_55; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_8: { + s_n_llhttp__internal__n_span_end_llhttp__on_header_value_9: { const unsigned char* start; int err; @@ -7847,11 +8380,11 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_46; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_59; return s_error; } p++; - goto s_n_llhttp__internal__n_error_46; + goto s_n_llhttp__internal__n_error_59; /* UNREACHABLE */; abort(); } @@ -7863,7 +8396,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_7: { + s_n_llhttp__internal__n_span_end_llhttp__on_header_value_8: { const unsigned char* start; int err; @@ -7873,18 +8406,18 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_45; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_58; return s_error; } p++; - goto s_n_llhttp__internal__n_error_45; + goto s_n_llhttp__internal__n_error_58; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_13: { - switch (llhttp__internal__c_test_lenient_flags_13(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_20: { + switch (llhttp__internal__c_test_lenient_flags_20(state, p, endp)) { case 0: - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_7; + goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_8; default: goto s_n_llhttp__internal__n_header_value_te_chunked; } @@ -7894,7 +8427,7 @@ static llparse_state_t llhttp__internal__run( s_n_llhttp__internal__n_invoke_load_type_1: { switch (llhttp__internal__c_load_type(state, p, endp)) { case 1: - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_13; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_20; default: goto s_n_llhttp__internal__n_header_value_te_chunked; } @@ -7917,20 +8450,20 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_17: { - switch (llhttp__internal__c_or_flags_16(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_19: { + switch (llhttp__internal__c_or_flags_18(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_and_flags; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_14: { - switch (llhttp__internal__c_test_lenient_flags_13(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_21: { + switch (llhttp__internal__c_test_lenient_flags_20(state, p, endp)) { case 0: - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_8; + goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_9; default: - goto s_n_llhttp__internal__n_invoke_or_flags_17; + goto s_n_llhttp__internal__n_invoke_or_flags_19; } /* UNREACHABLE */; abort(); @@ -7938,15 +8471,15 @@ static llparse_state_t llhttp__internal__run( s_n_llhttp__internal__n_invoke_load_type_2: { switch (llhttp__internal__c_load_type(state, p, endp)) { case 1: - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_14; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_21; default: - goto s_n_llhttp__internal__n_invoke_or_flags_17; + goto s_n_llhttp__internal__n_invoke_or_flags_19; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_16: { - switch (llhttp__internal__c_or_flags_16(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_18: { + switch (llhttp__internal__c_or_flags_18(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_and_flags; } @@ -7958,20 +8491,20 @@ static llparse_state_t llhttp__internal__run( case 1: goto s_n_llhttp__internal__n_invoke_load_type_2; default: - goto s_n_llhttp__internal__n_invoke_or_flags_16; + goto s_n_llhttp__internal__n_invoke_or_flags_18; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_or_flags_18: { - switch (llhttp__internal__c_or_flags_18(state, p, endp)) { + s_n_llhttp__internal__n_invoke_or_flags_20: { + switch (llhttp__internal__c_or_flags_20(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_9; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_load_header_state_2: { + s_n_llhttp__internal__n_invoke_load_header_state_3: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_header_value_connection; @@ -7980,23 +8513,72 @@ static llparse_state_t llhttp__internal__run( case 3: goto s_n_llhttp__internal__n_invoke_test_flags_3; case 4: - goto s_n_llhttp__internal__n_invoke_or_flags_18; + goto s_n_llhttp__internal__n_invoke_or_flags_20; default: goto s_n_llhttp__internal__n_header_value; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_15: { + s_n_llhttp__internal__n_invoke_test_lenient_flags_22: { + switch (llhttp__internal__c_test_lenient_flags_22(state, p, endp)) { + case 0: + goto s_n_llhttp__internal__n_error_60; + default: + goto s_n_llhttp__internal__n_header_value_discard_ws; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_test_flags_4: { + switch (llhttp__internal__c_test_flags_4(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_22; + default: + goto s_n_llhttp__internal__n_header_value_discard_ws; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_61: { + state->error = 0xf; + state->reason = "Transfer-Encoding can't be present with Content-Length"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_test_lenient_flags_23: { + switch (llhttp__internal__c_test_lenient_flags_22(state, p, endp)) { + case 0: + goto s_n_llhttp__internal__n_error_61; + default: + goto s_n_llhttp__internal__n_header_value_discard_ws; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_test_flags_5: { + switch (llhttp__internal__c_test_flags_2(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_23; + default: + goto s_n_llhttp__internal__n_header_value_discard_ws; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_pause_19: { state->error = 0x15; state->reason = "on_header_field_complete pause"; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_discard_ws; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_load_header_state; return s_error; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_34: { + s_n_llhttp__internal__n_error_45: { state->error = 0x1c; state->reason = "`on_header_field_complete` callback error"; state->error_pos = (const char*) p; @@ -8041,7 +8623,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_47: { + s_n_llhttp__internal__n_error_62: { state->error = 0xa; state->reason = "Invalid header token"; state->error_pos = (const char*) p; @@ -8093,7 +8675,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_16: { + s_n_llhttp__internal__n_pause_20: { state->error = 0x15; state->reason = "on_url_complete pause"; state->error_pos = (const char*) p; @@ -8116,7 +8698,7 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_headers_start; case 21: - goto s_n_llhttp__internal__n_pause_16; + goto s_n_llhttp__internal__n_pause_20; default: goto s_n_llhttp__internal__n_error_3; } @@ -8156,7 +8738,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_48: { + s_n_llhttp__internal__n_error_63: { state->error = 0x7; state->reason = "Expected CRLF"; state->error_pos = (const char*) p; @@ -8182,7 +8764,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_55: { + s_n_llhttp__internal__n_error_71: { state->error = 0x17; state->reason = "Pause on PRI/Upgrade"; state->error_pos = (const char*) p; @@ -8191,7 +8773,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_56: { + s_n_llhttp__internal__n_error_72: { state->error = 0x9; state->reason = "Expected HTTP/2 Connection Preface"; state->error_pos = (const char*) p; @@ -8200,7 +8782,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_53: { + s_n_llhttp__internal__n_error_69: { state->error = 0x2; state->reason = "Expected CRLF after version"; state->error_pos = (const char*) p; @@ -8209,17 +8791,17 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_16: { - switch (llhttp__internal__c_test_lenient_flags_5(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_26: { + switch (llhttp__internal__c_test_lenient_flags_8(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_headers_start; default: - goto s_n_llhttp__internal__n_error_53; + goto s_n_llhttp__internal__n_error_69; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_54: { + s_n_llhttp__internal__n_error_68: { state->error = 0x9; state->reason = "Expected CRLF after version"; state->error_pos = (const char*) p; @@ -8228,7 +8810,26 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_17: { + s_n_llhttp__internal__n_invoke_test_lenient_flags_25: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_req_http_complete_crlf; + default: + goto s_n_llhttp__internal__n_error_68; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_70: { + state->error = 0x9; + state->reason = "Expected CRLF after version"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_pause_21: { state->error = 0x15; state->reason = "on_version_complete pause"; state->error_pos = (const char*) p; @@ -8237,7 +8838,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_52: { + s_n_llhttp__internal__n_error_67: { state->error = 0x21; state->reason = "`on_version_complete` callback error"; state->error_pos = (const char*) p; @@ -8273,10 +8874,10 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_51; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_66; return s_error; } - goto s_n_llhttp__internal__n_error_51; + goto s_n_llhttp__internal__n_error_66; /* UNREACHABLE */; abort(); } @@ -8326,8 +8927,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_15: { - switch (llhttp__internal__c_test_lenient_flags_15(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_24: { + switch (llhttp__internal__c_test_lenient_flags_24(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_span_end_llhttp__on_version_1; default: @@ -8339,7 +8940,7 @@ static llparse_state_t llhttp__internal__run( s_n_llhttp__internal__n_invoke_store_http_minor: { switch (llhttp__internal__c_store_http_minor(state, p, endp, match)) { default: - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_15; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_24; } /* UNREACHABLE */; abort(); @@ -8354,10 +8955,10 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_57; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_73; return s_error; } - goto s_n_llhttp__internal__n_error_57; + goto s_n_llhttp__internal__n_error_73; /* UNREACHABLE */; abort(); } @@ -8371,10 +8972,10 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_58; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_74; return s_error; } - goto s_n_llhttp__internal__n_error_58; + goto s_n_llhttp__internal__n_error_74; /* UNREACHABLE */; abort(); } @@ -8396,14 +8997,14 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_59; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_75; return s_error; } - goto s_n_llhttp__internal__n_error_59; + goto s_n_llhttp__internal__n_error_75; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_50: { + s_n_llhttp__internal__n_error_65: { state->error = 0x8; state->reason = "Invalid method for HTTP/x.x request"; state->error_pos = (const char*) p; @@ -8484,13 +9085,15 @@ static llparse_state_t llhttp__internal__run( goto s_n_llhttp__internal__n_span_start_llhttp__on_version; case 34: goto s_n_llhttp__internal__n_span_start_llhttp__on_version; + case 46: + goto s_n_llhttp__internal__n_span_start_llhttp__on_version; default: - goto s_n_llhttp__internal__n_error_50; + goto s_n_llhttp__internal__n_error_65; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_62: { + s_n_llhttp__internal__n_error_78: { state->error = 0x8; state->reason = "Expected HTTP/"; state->error_pos = (const char*) p; @@ -8499,7 +9102,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_60: { + s_n_llhttp__internal__n_error_76: { state->error = 0x8; state->reason = "Expected SOURCE method for ICE/x.x request"; state->error_pos = (const char*) p; @@ -8513,12 +9116,12 @@ static llparse_state_t llhttp__internal__run( case 33: goto s_n_llhttp__internal__n_span_start_llhttp__on_version; default: - goto s_n_llhttp__internal__n_error_60; + goto s_n_llhttp__internal__n_error_76; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_61: { + s_n_llhttp__internal__n_error_77: { state->error = 0x8; state->reason = "Invalid method for RTSP/x.x request"; state->error_pos = (const char*) p; @@ -8558,12 +9161,12 @@ static llparse_state_t llhttp__internal__run( case 45: goto s_n_llhttp__internal__n_span_start_llhttp__on_version; default: - goto s_n_llhttp__internal__n_error_61; + goto s_n_llhttp__internal__n_error_77; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_18: { + s_n_llhttp__internal__n_pause_22: { state->error = 0x15; state->reason = "on_url_complete pause"; state->error_pos = (const char*) p; @@ -8572,7 +9175,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_49: { + s_n_llhttp__internal__n_error_64: { state->error = 0x1a; state->reason = "`on_url_complete` callback error"; state->error_pos = (const char*) p; @@ -8586,9 +9189,9 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_req_http_start; case 21: - goto s_n_llhttp__internal__n_pause_18; + goto s_n_llhttp__internal__n_pause_22; default: - goto s_n_llhttp__internal__n_error_49; + goto s_n_llhttp__internal__n_error_64; } /* UNREACHABLE */; abort(); @@ -8661,7 +9264,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_63: { + s_n_llhttp__internal__n_error_79: { state->error = 0x7; state->reason = "Invalid char in url fragment start"; state->error_pos = (const char*) p; @@ -8721,7 +9324,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_64: { + s_n_llhttp__internal__n_error_80: { state->error = 0x7; state->reason = "Invalid char in url query"; state->error_pos = (const char*) p; @@ -8730,7 +9333,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_65: { + s_n_llhttp__internal__n_error_81: { state->error = 0x7; state->reason = "Invalid char in url path"; state->error_pos = (const char*) p; @@ -8841,7 +9444,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_66: { + s_n_llhttp__internal__n_error_82: { state->error = 0x7; state->reason = "Double @ in url"; state->error_pos = (const char*) p; @@ -8850,7 +9453,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_67: { + s_n_llhttp__internal__n_error_83: { state->error = 0x7; state->reason = "Unexpected char in url server"; state->error_pos = (const char*) p; @@ -8859,7 +9462,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_68: { + s_n_llhttp__internal__n_error_84: { state->error = 0x7; state->reason = "Unexpected char in url server"; state->error_pos = (const char*) p; @@ -8868,7 +9471,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_69: { + s_n_llhttp__internal__n_error_85: { state->error = 0x7; state->reason = "Unexpected char in url schema"; state->error_pos = (const char*) p; @@ -8877,7 +9480,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_70: { + s_n_llhttp__internal__n_error_86: { state->error = 0x7; state->reason = "Unexpected char in url schema"; state->error_pos = (const char*) p; @@ -8886,7 +9489,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_71: { + s_n_llhttp__internal__n_error_87: { state->error = 0x7; state->reason = "Unexpected start char in url"; state->error_pos = (const char*) p; @@ -8905,7 +9508,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_72: { + s_n_llhttp__internal__n_error_88: { state->error = 0x6; state->reason = "Expected space after method"; state->error_pos = (const char*) p; @@ -8914,7 +9517,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_22: { + s_n_llhttp__internal__n_pause_26: { state->error = 0x15; state->reason = "on_method_complete pause"; state->error_pos = (const char*) p; @@ -8923,7 +9526,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_89: { + s_n_llhttp__internal__n_error_107: { state->error = 0x20; state->reason = "`on_method_complete` callback error"; state->error_pos = (const char*) p; @@ -8957,7 +9560,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_90: { + s_n_llhttp__internal__n_error_108: { state->error = 0x6; state->reason = "Invalid method encountered"; state->error_pos = (const char*) p; @@ -8966,7 +9569,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_82: { + s_n_llhttp__internal__n_error_100: { state->error = 0xd; state->reason = "Invalid status code"; state->error_pos = (const char*) p; @@ -8975,7 +9578,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_80: { + s_n_llhttp__internal__n_error_98: { state->error = 0xd; state->reason = "Invalid status code"; state->error_pos = (const char*) p; @@ -8984,7 +9587,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_78: { + s_n_llhttp__internal__n_error_96: { state->error = 0xd; state->reason = "Invalid status code"; state->error_pos = (const char*) p; @@ -8993,7 +9596,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_20: { + s_n_llhttp__internal__n_pause_24: { state->error = 0x15; state->reason = "on_status_complete pause"; state->error_pos = (const char*) p; @@ -9002,7 +9605,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_75: { + s_n_llhttp__internal__n_error_92: { state->error = 0x1b; state->reason = "`on_status_complete` callback error"; state->error_pos = (const char*) p; @@ -9016,14 +9619,33 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_headers_start; case 21: - goto s_n_llhttp__internal__n_pause_20; + goto s_n_llhttp__internal__n_pause_24; default: - goto s_n_llhttp__internal__n_error_75; + goto s_n_llhttp__internal__n_error_92; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_76: { + s_n_llhttp__internal__n_error_91: { + state->error = 0xd; + state->reason = "Invalid response status"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_invoke_test_lenient_flags_28: { + switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { + case 1: + goto s_n_llhttp__internal__n_invoke_llhttp__on_status_complete; + default: + goto s_n_llhttp__internal__n_error_91; + } + /* UNREACHABLE */; + abort(); + } + s_n_llhttp__internal__n_error_93: { state->error = 0x2; state->reason = "Expected LF after CR"; state->error_pos = (const char*) p; @@ -9032,16 +9654,25 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_18: { - switch (llhttp__internal__c_test_lenient_flags_5(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_29: { + switch (llhttp__internal__c_test_lenient_flags_8(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_invoke_llhttp__on_status_complete; default: - goto s_n_llhttp__internal__n_error_76; + goto s_n_llhttp__internal__n_error_93; } /* UNREACHABLE */; abort(); } + s_n_llhttp__internal__n_error_94: { + state->error = 0x19; + state->reason = "Missing expected CR after response line"; + state->error_pos = (const char*) p; + state->_current = (void*) (intptr_t) s_error; + return s_error; + /* UNREACHABLE */; + abort(); + } s_n_llhttp__internal__n_span_end_llhttp__on_status: { const unsigned char* start; int err; @@ -9052,11 +9683,11 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_res_line_almost_done; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_test_lenient_flags_30; return s_error; } p++; - goto s_n_llhttp__internal__n_res_line_almost_done; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_30; /* UNREACHABLE */; abort(); } @@ -9078,7 +9709,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_77: { + s_n_llhttp__internal__n_error_95: { state->error = 0xd; state->reason = "Invalid response status"; state->error_pos = (const char*) p; @@ -9090,14 +9721,14 @@ static llparse_state_t llhttp__internal__run( s_n_llhttp__internal__n_invoke_mul_add_status_code_2: { switch (llhttp__internal__c_mul_add_status_code(state, p, endp, match)) { case 1: - goto s_n_llhttp__internal__n_error_78; + goto s_n_llhttp__internal__n_error_96; default: goto s_n_llhttp__internal__n_res_status_code_otherwise; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_79: { + s_n_llhttp__internal__n_error_97: { state->error = 0xd; state->reason = "Invalid status code"; state->error_pos = (const char*) p; @@ -9109,14 +9740,14 @@ static llparse_state_t llhttp__internal__run( s_n_llhttp__internal__n_invoke_mul_add_status_code_1: { switch (llhttp__internal__c_mul_add_status_code(state, p, endp, match)) { case 1: - goto s_n_llhttp__internal__n_error_80; + goto s_n_llhttp__internal__n_error_98; default: goto s_n_llhttp__internal__n_res_status_code_digit_3; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_81: { + s_n_llhttp__internal__n_error_99: { state->error = 0xd; state->reason = "Invalid status code"; state->error_pos = (const char*) p; @@ -9128,14 +9759,14 @@ static llparse_state_t llhttp__internal__run( s_n_llhttp__internal__n_invoke_mul_add_status_code: { switch (llhttp__internal__c_mul_add_status_code(state, p, endp, match)) { case 1: - goto s_n_llhttp__internal__n_error_82; + goto s_n_llhttp__internal__n_error_100; default: goto s_n_llhttp__internal__n_res_status_code_digit_2; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_83: { + s_n_llhttp__internal__n_error_101: { state->error = 0xd; state->reason = "Invalid status code"; state->error_pos = (const char*) p; @@ -9152,7 +9783,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_84: { + s_n_llhttp__internal__n_error_102: { state->error = 0x9; state->reason = "Expected space after version"; state->error_pos = (const char*) p; @@ -9161,7 +9792,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_21: { + s_n_llhttp__internal__n_pause_25: { state->error = 0x15; state->reason = "on_version_complete pause"; state->error_pos = (const char*) p; @@ -9170,7 +9801,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_74: { + s_n_llhttp__internal__n_error_90: { state->error = 0x21; state->reason = "`on_version_complete` callback error"; state->error_pos = (const char*) p; @@ -9206,10 +9837,10 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_73; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_89; return s_error; } - goto s_n_llhttp__internal__n_error_73; + goto s_n_llhttp__internal__n_error_89; /* UNREACHABLE */; abort(); } @@ -9259,8 +9890,8 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_invoke_test_lenient_flags_17: { - switch (llhttp__internal__c_test_lenient_flags_15(state, p, endp)) { + s_n_llhttp__internal__n_invoke_test_lenient_flags_27: { + switch (llhttp__internal__c_test_lenient_flags_24(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_span_end_llhttp__on_version_6; default: @@ -9272,7 +9903,7 @@ static llparse_state_t llhttp__internal__run( s_n_llhttp__internal__n_invoke_store_http_minor_1: { switch (llhttp__internal__c_store_http_minor(state, p, endp, match)) { default: - goto s_n_llhttp__internal__n_invoke_test_lenient_flags_17; + goto s_n_llhttp__internal__n_invoke_test_lenient_flags_27; } /* UNREACHABLE */; abort(); @@ -9287,10 +9918,10 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_85; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_103; return s_error; } - goto s_n_llhttp__internal__n_error_85; + goto s_n_llhttp__internal__n_error_103; /* UNREACHABLE */; abort(); } @@ -9304,10 +9935,10 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_86; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_104; return s_error; } - goto s_n_llhttp__internal__n_error_86; + goto s_n_llhttp__internal__n_error_104; /* UNREACHABLE */; abort(); } @@ -9329,14 +9960,14 @@ static llparse_state_t llhttp__internal__run( if (err != 0) { state->error = err; state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_87; + state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_105; return s_error; } - goto s_n_llhttp__internal__n_error_87; + goto s_n_llhttp__internal__n_error_105; /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_91: { + s_n_llhttp__internal__n_error_109: { state->error = 0x8; state->reason = "Expected HTTP/"; state->error_pos = (const char*) p; @@ -9345,7 +9976,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_19: { + s_n_llhttp__internal__n_pause_23: { state->error = 0x15; state->reason = "on_method_complete pause"; state->error_pos = (const char*) p; @@ -9396,7 +10027,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_88: { + s_n_llhttp__internal__n_error_106: { state->error = 0x8; state->reason = "Invalid word encountered"; state->error_pos = (const char*) p; @@ -9430,7 +10061,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_23: { + s_n_llhttp__internal__n_pause_27: { state->error = 0x15; state->reason = "on_message_begin pause"; state->error_pos = (const char*) p; @@ -9453,14 +10084,14 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_invoke_load_type; case 21: - goto s_n_llhttp__internal__n_pause_23; + goto s_n_llhttp__internal__n_pause_27; default: goto s_n_llhttp__internal__n_error; } /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_pause_24: { + s_n_llhttp__internal__n_pause_28: { state->error = 0x15; state->reason = "on_reset pause"; state->error_pos = (const char*) p; @@ -9469,7 +10100,7 @@ static llparse_state_t llhttp__internal__run( /* UNREACHABLE */; abort(); } - s_n_llhttp__internal__n_error_92: { + s_n_llhttp__internal__n_error_110: { state->error = 0x1f; state->reason = "`on_reset` callback error"; state->error_pos = (const char*) p; @@ -9483,9 +10114,9 @@ static llparse_state_t llhttp__internal__run( case 0: goto s_n_llhttp__internal__n_invoke_update_finish; case 21: - goto s_n_llhttp__internal__n_pause_24; + goto s_n_llhttp__internal__n_pause_28; default: - goto s_n_llhttp__internal__n_error_92; + goto s_n_llhttp__internal__n_error_110; } /* UNREACHABLE */; abort(); diff --git a/lib/nghttp2-1.65.0/third-party/mruby/AUTHORS b/lib/nghttp2-1.65.0/third-party/mruby/AUTHORS new file mode 100644 index 00000000000..d21c88a0cc3 --- /dev/null +++ b/lib/nghttp2-1.65.0/third-party/mruby/AUTHORS @@ -0,0 +1,325 @@ +# Authors of mruby (mruby developers) + +## The List of Contributors sorted by number of commits (as of 2023-12-28 67cb987) + + 9477 Yukihiro "Matz" Matsumoto (@matz)* + 586 KOBAYASHI Shuji (@shuujii) + 533 dearblue (@dearblue)* + 378 Daniel Bovensiepen (@bovi)* + 346 Takeshi Watanabe (@take-cheeze)* + 334 Masaki Muranaka (@monaka) + 328 Tomoyuki Sahara (@tsahara)* + 234 Jun Hiroe (@suzukaze) + 220 Cremno (@cremno)* + 209 Yuki Kurihara (@ksss)+ + 166 John Bampton (@jbampton) + 151 Yasuhiro Matsumoto (@mattn)* + 113 Carson McDonald (@carsonmcdonald) + 103 Tomasz Dąbrowski (@dabroz)* + 84 Akira Yumiyama (@akiray03)* + 84 skandhas (@skandhas) + 81 Hiroshi Mimaki (@mimaki)* + 80 Masamitsu MURASE (@masamitsu-murase) + 74 Yuichiro MASUI (@masuidrive) + 71 Tatsuhiko Kubo (@cubicdaiya)* + 65 Yuichiro Kaneko (@yui-knk)+ + 64 Paolo Bosetti (@pbosetti)* + 59 Kurebayashi, Takahiro (@crimsonwoods)* + 56 h2so5 (@h2so5) + 52 Ralph Desir (@Mav7)* + 45 Rory O'Connell (@RoryO)* + 42 fleuria (@flaneur2020) + 40 Christopher Aue (@christopheraue) + 40 Seba Gamboa (@sagmor) + 38 Koji Yoshioka (@kyab)*+ + 38 Kouhei Sutou (@kou)* + 32 Masayoshi Takahashi (@takahashim)+ + 31 MATSUMOTO Ryosuke (@matsumotory)* + 30 Nobuyoshi Nakada (@nobu) + 26 Julian Aron Prenner (@furunkel)* + 24 Ryan Scott (@ryan-scott-dev)* + 22 Clayton Smith (@clayton-shopify) + 22 Uchio Kondo (@udzura)* + 22 Zachary Scott (@zzak)* + 22 mirichi (@mirichi) + 21 Jared Breeden (@jbreeden)* + 21 Ryan Lopopolo (@lopopolo) + 19 Bouke van der Bijl (@bouk) + 19 Felix Jones (@felixjones)* + 19 Hidetaka Takano (@TJ-Hidetaka-Takano) + 19 go kikuta (@gkta)* + 18 Corey Powell (@IceDragon200) + 18 Jon Maken (@jonforums)+ + 18 Mitchell Blank Jr (@mitchblank)* + 16 bggd (@bggd) + 16 kano4 (@kano4) + 14 Blaž Hrastnik (@archseer)* + 14 Jose Narvaez (@goyox86) + 14 Kazuki Tsujimoto (@k-tsj) + 14 Tadashi FUKUZAWA (@FUKUZAWA-Tadashi)+ + 14 fn ⌠⌥ (@FnControlOption) + 13 Patrick Hogan (@pbhogan) + 12 Akira Kuroda (@akuroda) + 12 Kouki Ooyatsu (kaishuu0123)* + 12 NAKAMURA Usaku (@unak)* + 12 RIZAL Reckordp (@Reckordp)+ + 12 Ray Chason (@chasonr)* + 12 Takashi Sawanaka (@sdottaka)* + 12 Ukrainskiy Sergey (@ukrainskiysergey) + 12 Xuejie "Rafael" Xiao (@xxuejie)* + 11 Julien Ammous (@schmurfy) + 11 Kazuho Oku (@kazuho) + 11 Seeker (@SeekingMeaning) + 11 YAMAMOTO Masaya (pandax381) + 11 takkaw (@takkaw) + 10 Miura Hideki (@miura1729) + 10 Narihiro Nakamura (@authorNari) + 10 Yuichi Nishiwaki (@nyuichi) + 9 Akira Mitsui (@murasesyuka)* + 9 Frank Celler (@fceller) + 9 Tatsuya Matsumoto (@tmash06)* + 8 Takashi Sogabe (@sogabe) + 7 Bhargava Shastry (@bshastry)* + 7 Kouichi Nakanishi (@keizo042) + 7 Rubyist (@expeditiousRubyist) + 7 SiZiOUS (@sizious) + 7 Simon Génier (@simon-shopify) + 7 Terence Lee (@hone) + 7 Wataru Ashihara (@wataash)* + 7 roco (@rystyle)* + 6 Akito Mochizuki (@ak-mochi) + 6 Beoran (@beoran) + 6 David Siaw (@davidsiaw)* + 6 Frederick John Milens III (@fjmilens3) + 6 Hiro Asari (@BanzaiMan) + 6 INOUE Yasuyuki (@yasuyuki) + 6 Junji Sawada (@junjis0203) + 6 Kenji Okimoto (@okkez)+ + 6 Selman ULUG (@selman) + 6 Yusuke Endoh (@mame)* + 6 masahino (@masahino) + 5 Chris Reuter (@suetanvil) + 5 Davide D'Agostino (@DAddYE) + 5 Eric Hodel (@drbrain) + 5 Hendrik (@Asmod4n) + 5 Ichito Nagata (@i110) + 5 Keita Obo (@ktaobo)* + 5 Max Anselm (@silverhammermba) + 5 Rodrigo Malizia (@rmalizia44)+ + 5 Syohei YOSHIDA (@syohex) + 5 TOMITA Masahiro (@tmtm) + 5 Yurie Yamane (@yurie)+ + 5 dreamedge (@dreamedge) + 5 nkshigeru (@nkshigeru) + 5 xuejianqing (@joans321) + 4 Dante Catalfamo (@dantecatalfamo) + 4 Goro Kikuchi (@gorogit) + 4 Herwin Weststrate (@herwinw) + 4 Horimoto Yasuhiro (@komainu8) + 4 Jon Moss (@maclover7) + 4 Ken Muramatsu (@ken-mu)+ + 4 Kohei Suzuki (@eagletmt) + 4 Lanza (@LanzaSchneider) + 4 Li Yazhou (@flaneur2020) + 4 Marcus Stollsteimer (@stomar) + 4 NARUSE, Yui (@nurse) + 4 Ravil Bayramgalin (@brainopia)*+ + 4 Satoshi Odawara (@SatoshiOdawara) + 4 Yuhei Okazaki (@Yuuhei-Okazaki)* + 4 Yuji Yamano (@yyamano) + 4 kurodash (@kurodash)* + 4 wanabe (@wanabe)* + 3 Anton Davydov (@davydovanton) + 3 Carlo Prelz (@asfluido)* + 3 David Turnbull (@AE9RB) + 3 Franck Verrot (@franckverrot) + 3 HASUMI Hitoshi (@hasumikin) + 3 J. Mutua (@katmutua)+ + 3 Jan Berdajs (@mrbrdo) + 3 Jonas Minnberg (@sasq64) + 3 Joseph McCullough (@joequery) + 3 Mark McCurry (@fundamental) + 3 Nobuhiro Iwamatsu (@iwamatsu) + 3 Per Lundberg (@perlun)* + 3 Rob Fors (@robfors)* + 3 Robert Rowe (@CaptainJet) + 3 Sebastián Katzer (@katzer)* + 3 Shouji Kuboyama (@Shokuji)* + 3 Shuta Kimura (@kimushu)+ + 3 TERAJIMA, Motoyuki (@trmmy) + 3 Taichi AOKI (@aoki1980taichi) + 3 Takashi Kokubun (@k0kubun) + 3 Tatsuhiro Tsujikawa (@tatsuhiro-t) + 3 Thiago Scalone (@scalone) + 3 Vladimir Dementyev (@palkan)* + 3 William Light (@wrl) + 3 bamchoh (@bamchoh) + 3 sasaki takeru (@takeru) + 3 windwiny (@windwiny) + 2 Akira Moroo (@retrage) + 2 Artur K (@nemerle) + 2 Christian Mauceri (@mauceri) + 2 Craig Lehmann (@craiglrock)* + 2 Dominic Sisneros (@dsisnero)* + 2 Dusan D. Majkic (@dmajkic) + 2 Emiliano Lesende (@3miliano) + 2 Francois Chagnon (@EiNSTeiN-)* + 2 Gilad Zohari (@gzohari) + 2 Go Saito (@govm) + 2 Hirohito Higashi (@HirohitoHigashi) + 2 Hiroyuki Iwatsuki (@iwadon) + 2 Huei-Horng Yo (@hiroshiyui) + 2 Jonas Kulla (@Ancurio) + 2 Jun Takeda (@takjn) + 2 Kazuaki Tanaka (@kaz0505) + 2 Kazuhiko Yamashita (@pyama86)+ + 2 Kazuhiro Sera (@seratch) + 2 Kuroda Daisuke (@dycoon)+ + 2 Lothar Scholz (@llothar) + 2 Lukas Joeressen (@kext) + 2 Masahiro Wakame (@vvkame)+ + 2 Minao Yamamoto (@tarosay)+ + 2 Nihad Abbasov (@NARKOZ) + 2 Robert Mosolgo (@rmosolgo) + 2 Russel Hunter Yukawa (@rhykw)+ + 2 Ryunosuke SATO (@tricknotes) + 2 Santa Zhang (@santazhang) + 2 Satoru Naba (@snaba)+ + 2 Serg Podtynnyi (@shtirlic) + 2 Shannen Saez (@shancat) + 2 SouthWolf (@southwolf) + 2 TJ Singleton (@tjsingleton) + 2 Taiyo Mizuhashi (@taiyoslime)+ + 2 Tomás Pollak (@tomas)* + 2 Yutaka HARA (@yhara)*+ + 2 Zhang Xiaohui (@hifoolno) + 2 icm7216 (@icm7216) + 1 A-Sat (@asatou)+ + 1 Abinoam Praxedes Marques Junior (@abinoam) + 1 Alex Wang (@nanamiwang)+ + 1 AlexDenisov (@AlexDenisov) + 1 Andrew Nordman (@cadwallion) + 1 Ashish Kurmi (@boahc077) + 1 Atsushi Morimoto (@mynz) + 1 Ben A Morgan (@BenMorganIO) + 1 Benoit Daloze (@eregon) + 1 Colin MacKenzie IV (@sinisterchipmunk) + 1 Daehyub Kim (@lateau) + 1 Daniel Varga (@vargad) + 1 Edgar Boda-Majer (@eboda) + 1 Fangrui Song (@MaskRay) + 1 Flavio Medeiros (@flaviommedeiros) + 1 Francis Bogsanyi (@fbogsany) + 1 Guo Xiao (@guoxiao) + 1 Gwen Boatrite (@boatrit) + 1 Gwendolyn Boatrite (@boatrite) + 1 HARADA Makoto (@haramako) + 1 HAYASHI Kentaro (@kenhys) + 1 Hiroki Mori (@yamori813)+ + 1 Hiromasa Ishii (@Hir0)+ + 1 Hiroyuki Matsuzaki (@Hiroyuki-Matsuzaki) + 1 Hugo Logmans (@hlogmans) + 1 Jack Danger Canty (@JackDanger) + 1 Jeff Federman (@jefffederman) + 1 Jeffrey Crowell (@crowell) + 1 Jeremy Ong (@jeremyong) + 1 Jiro Nishiguchi (@spiritloose) + 1 Joachim Baran (@indiedotkim) + 1 Joe Kutner (@jkutner) + 1 Jun Aruga (@junaruga) + 1 Junichi Kajiwara (@kjunichi) + 1 Jurriaan Pruis (@jurriaan) + 1 Katsuhiko Kageyama (@kishima)+ + 1 Katsuyoshi Ito (@katsuyoshi) + 1 Kazuhiro NISHIYAMA (@znz) + 1 Kei Sawada (@remore) + 1 Kim H Madsen (@kimhmadsen) + 1 Koichi ITO (@koic) + 1 Konstantin Haase (@rkh) + 1 Leo Neat (@Leo-Neat) + 1 Lian Cheng (@liancheng) + 1 Luis Lavena (@luislavena) + 1 Lukas Elmer (@lukaselmer) + 1 Lukas Stabe (@Ahti) + 1 M.Naruoka (@fenrir-naru) + 1 Mark Delk (@jethrodaniel) + 1 Martin Bosslet (@emboss)+ + 1 Masahiko Sawada (@MasahikoSawada) + 1 Matt Aimonetti (@mattetti) + 1 Maxim Abramchuk (@MaximAbramchuck) + 1 Megumi Tomita (@tomykaira)+ + 1 Mitchell Hashimoto (@mitchellh) + 1 Mitsutaka Mimura (@takkanm) + 1 Nathan Ladd (@ntl) + 1 Nicholas (@knf) + 1 Nozomi SATO (@nozomiS) + 1 Okumura Takahiro (@hfm) + 1 Patrick Ellis (@pje) + 1 Patrick Pokatilo (@SHyx0rmZ) + 1 Pavel Evstigneev (@Paxa)+ + 1 Prayag Verma (@pra85) + 1 Ranmocy (@ranmocy) + 1 Robert McNally (@wolfmcnally) + 1 Ryan Scott Lewis (@RyanScottLewis) + 1 Ryo Okubo (@syucream) + 1 SAkira a.k.a. Akira Suzuki (@sakisakira) + 1 Santiago Rodriguez (@sanrodari) + 1 Satoh, Hiroh (@cho45)+ + 1 Sayed Abdelhaleem (@visualsayed) + 1 Sergey Ukrainskiy (@ukrainskiysergey) + 1 Shugo Maeda (@shugo) + 1 Sorah Fukumori (@sorah) + 1 Stephen Jothen (@sjothen) + 1 Stuart Hinson (@stuarth) + 1 Takuma Kume (@takumakume)+ + 1 Takuya ASADA (@syuu1228) + 1 Thomas Schmidt (@digitaltom) + 1 Timo Schilling (@timoschilling) + 1 Tom Black (@blacktm) + 1 Utkarsh Kukreti (@utkarshkukreti) + 1 W (@graywolf) + 1 Wuffers Lightwolf (@w-x-l) + 1 YAMAMOTO Yuji (@igrep) + 1 Yevhen Viktorov (@yevgenko) + 1 Yoji SHIDARA (@darashi) + 1 Yoshiori SHOJI (@yoshiori) + 1 Yuji Yokoo (@yujiyokoo) + 1 Yukang (@chenyukang) + 1 Yurii Nakonechnyi (@inobelar) + 1 Yusuke Suzuki (@Constellation)+ + 1 Yusuke Tanaka (@csouls) + 1 alpha.netzilla (@alpha-netzilla) + 1 arton (@arton) + 1 duangsuse (@duangsuse) + 1 fl0l0u (@fl0l0u) + 1 hhc0null (@hhc0null) + 1 iTitou (@titouanc) + 1 javier ramírez (@javier) + 1 liyuray (@liyuray) + 1 lucas dicioccio (@lucasdicioccio) + 1 n4o847 (@n4o847) + 1 robert (@R-obert) + 1 sbsoftware (@sbsoftware) + 1 ssmallkirby (@smallkirby) + 1 taku toyama (@tsuichu) + +`*` - Entries unified according to names and addresses +`+` - Entries with names different from commits + +## Contributors without named commits + + Yuichi Osawa (Mitsubishi Electric Micro-Computer Application Software) + Shota Nakano (Manycolors) + Bjorn De Meyer + +## Corporate contributors + + Ministry of Economy, Trade and Industry, Japan + Kyushu Bureau of Economy, Trade and Industry + SCSK KYUSHU CORPORATION + Kyushu Institute of Technology + Network Applied Communication Laboratory, Inc. + Internet Initiative Japan Inc. + Specified non-profit organization mruby Forum + Mitsubishi Electric Micro-Computer Application Software Co.,Ltd. + Manycolors, Inc. diff --git a/lib/nghttp2-1.65.0/third-party/mruby/CODEOWNERS b/lib/nghttp2-1.65.0/third-party/mruby/CODEOWNERS new file mode 100644 index 00000000000..9f91caaf8bb --- /dev/null +++ b/lib/nghttp2-1.65.0/third-party/mruby/CODEOWNERS @@ -0,0 +1 @@ +* @matz diff --git a/lib/nghttp2-1.65.0/third-party/mruby/CONTRIBUTING.md b/lib/nghttp2-1.65.0/third-party/mruby/CONTRIBUTING.md new file mode 100644 index 00000000000..a797b137085 --- /dev/null +++ b/lib/nghttp2-1.65.0/third-party/mruby/CONTRIBUTING.md @@ -0,0 +1,185 @@ +# How to contribute + +mruby is an open-source project which is looking forward to each contribution. +Contributors agree to license their contribution(s) under MIT license. + +## Your Pull Request + +To make it easy to review and understand your change please keep the following +things in mind before submitting your pull request: + +- Work on the latest possible state of **mruby/master** +- Create a branch which is dedicated to your change +- Test your changes before creating a pull request (`rake test`) +- If possible write a test case which confirms your change +- Don't mix several features or bug-fixes in one pull request +- Create a meaningful commit message +- Explain your change (i.e. with a link to the issue you are fixing) +- Use mrbgem to provide non ISO features (classes, modules and methods) unless + you have a special reason to implement them in the core + +## pre-commit + +A framework for managing and maintaining multi-language `pre-commit` hooks. +`pre-commit` can be [installed](https://pre-commit.com/#installation) with `pip`, `curl`, `brew` or `conda`. + +You need to first install `pre-commit` and then install the `pre-commit` hooks with `pre-commit install`. +Now `pre-commit` will run automatically on git commit! + +It's usually a good idea to run the hooks against all the files when adding new hooks (usually `pre-commit` +will only run on the changed files during git hooks). Use `pre-commit run --all-files` to check all files. + +To run a single hook use `pre-commit run --all-files ` + +To update use `pre-commit autoupdate` + +Sometimes you might need to skip one or more hooks which can be done with the `SKIP` environment variable. + +`$ SKIP=yamllint git commit -m "foo"` + +For convenience, we have added `pre-commit run --all-files`, `pre-commit install` and `pre-commit autoupdate` +to both the Makefile and the Rakefile. Run them with: + +- `make check` or `rake check` +- `make checkinstall` or `rake checkinstall` +- `make checkupdate` or `rake checkupdate` + +To configure `pre-commit` you can modify the config file [.pre-commit-config.yaml](.pre-commit-config.yaml). +We use [GitHub Actions](.github/workflows/lint.yml) to run `pre-commit` on every pull request. + +### pre-commit quick links + +- [Quick start](https://pre-commit.com/#quick-start) +- [Usage](https://pre-commit.com/#usage) +- [pre-commit autoupdate](https://pre-commit.com/#pre-commit-autoupdate) +- [Temporarily disabling hooks](https://pre-commit.com/#temporarily-disabling-hooks) + +## Docker + +We have both a `Dockerfile` and `docker-compose.yml` files in the repository root. +You can run these with the command line or use +[Docker Desktop](https://www.docker.com/products/docker-desktop/). + +The Docker image is running Debian bullseye with Ruby and Python installed. +You can build the Docker image with: + +`$ docker-compose build test` + +So far we just have one service: `test`. Running the default `docker-compose` +command will create the Docker image, spin up a container and then build and +run all mruby tests. + +The default `docker-compose` command is: + +`$ docker-compose -p mruby run test` + +You can also use Make or Rake to run the default `docker-compose` +command from above: + +- `make composetest` +- `rake composetest` + +List your Docker images with: + +```console +$ docker images +REPOSITORY TAG IMAGE ID CREATED SIZE +mruby-test latest ec60f9536948 29 seconds ago 1.29GB +``` + +You can also run any custom `docker-compose` command which will override +the default. For example to run `pre-commit run --all-files` type: + +`$ docker-compose -p mruby run test pre-commit run --all-files` + +For convenience, you can also run `pre-commit` with: + +- `make composecheck` +- `rake composecheck` + +The bonus of running `pre-commit` with `docker-compose` is that you won't need +to install `pre-commit` and the hooks on your local machine. And that also +means you won't need to install `brew`, `conda` or `pip`. + +Note limitation: currently running `pre-commit` with `docker-compose` we +skip the `check-executables-have-shebangs` hook. + +Two more examples of custom `docker-compose` commands are: + +- `$ docker-compose -p mruby run test ls` +- `$ docker-compose -p mruby run test rake doc:api` + +If you want to test using a different `docker-compose` YAML config file you +can use the `-f` flag: + +`$ docker-compose -p mruby -f docker-compose.test.yml run test` + +- +- + +## Spell Checking + +We are using `pre-commit` to run [codespell](https://github.com/codespell-project/codespell) +to check code for common misspellings. We have a small custom dictionary file [codespell.txt](codespell.txt). + +## Coding conventions + +How to style your C and Ruby code which you want to submit. + +### C code + +The core part (parser, bytecode-interpreter, core-lib, etc.) of mruby is +written in the C programming language. Please note the following hints for your +C code: + +#### Comply with C99 (ISO/IEC 9899:1999) + +mruby should be highly portable to other systems and compilers. For this it is +recommended to keep your code as close as possible to the C99 standard +(). + +Visual C++ is also an important target for mruby (supported version is 2013 or +later). For this reason features that are not supported by Visual C++ may not +be used (e.g. `%z` of `strftime()`). + +NOTE: Old GCC requires `-std=gnu99` option to enable C99 support. + +#### Reduce library dependencies to a minimum + +The dependencies to libraries should be kept to an absolute minimum. This +increases the portability but makes it also easier to cut away parts of mruby +on-demand. + +#### Insert a break after the function return value: + +```c +int +main(void) +{ + ... +} +``` + +### Ruby code + +Parts of the standard library of mruby are written in the Ruby programming +language itself. Please note the following hints for your Ruby code: + +#### Comply with the Ruby standard (ISO/IEC 30170:2012) + +mruby is currently targeting to execute Ruby code which complies to ISO/IEC +30170:2012 (), +unless there's a clear reason, e.g. the latest Ruby has changed behavior from ISO. + +## Building documentation + +### mruby API + +- [YARD](https://yardoc.org/) - YARD is a documentation generation tool for the Ruby programming language +- [yard-mruby](https://rubygems.org/gems/yard-mruby) - Document mruby sources with YARD +- [yard-coderay](https://rubygems.org/gems/yard-coderay) - Adds coderay syntax highlighting to YARD docs + +### C API + +- [Doxygen](https://www.doxygen.nl/) - Generate documentation from source code +- [Graphviz](https://graphviz.org/) - Graphviz is open source graph visualization software diff --git a/lib/nghttp2-1.65.0/third-party/mruby/Dockerfile b/lib/nghttp2-1.65.0/third-party/mruby/Dockerfile new file mode 100644 index 00000000000..c4419b4f6dc --- /dev/null +++ b/lib/nghttp2-1.65.0/third-party/mruby/Dockerfile @@ -0,0 +1,13 @@ +FROM ruby:3.2.2-bullseye + +RUN apt-get update && apt-get install --no-install-recommends -y python3-pip shellcheck \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY Gemfile Gemfile.lock .pre-commit-config.yaml ./ + +RUN bundle install && pip3 install pre-commit && git init . && pre-commit install-hooks + +COPY . . diff --git a/lib/nghttp2-1.65.0/third-party/mruby/Doxyfile b/lib/nghttp2-1.65.0/third-party/mruby/Doxyfile new file mode 100644 index 00000000000..2df76d8c3c6 --- /dev/null +++ b/lib/nghttp2-1.65.0/third-party/mruby/Doxyfile @@ -0,0 +1,2748 @@ +# Doxyfile 1.9.6 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = mruby + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = 3.3.0 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "mruby is the lightweight implementation of the Ruby language" + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = doc/mruby_logo_red_icon.png + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc/capi + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = YES + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:^^" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. + +EXTENSION_MAPPING = no_extension=md + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the +# documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = NO + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = CONTRIBUTING.md \ + README.md \ + SECURITY.md \ + TODO.md \ + src \ + include \ + include/mruby \ + mrblib \ + doc \ + doc/guides \ + doc/internal \ + LEGAL \ + LICENSE \ + NEWS + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, +# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C +# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# ANamespace::AClass, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = README.md + +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 359 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use gray-scales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /