diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 3939921..bab28b2 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -1,10 +1,6 @@ name: C/C++ CI -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request] jobs: build-ubuntu: @@ -22,7 +18,7 @@ jobs: run: | sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt update - sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev ${{ matrix.config.c }} ${{ matrix.config.cpp }} + sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev ${{ matrix.config.c }} ${{ matrix.config.cpp }} - name: Checkout repository uses: actions/checkout@v2 @@ -34,7 +30,7 @@ jobs: mkdir build cd build cmake .. -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} - make -j2 + make -j$(nproc) - name: Build tests run: | @@ -42,7 +38,7 @@ jobs: mkdir build cd build cmake .. -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cpp }} - make -j2 + make -j$(nproc) - name: Run tests run: cd tests/build && ./p2pool_tests @@ -53,6 +49,68 @@ jobs: name: p2pool-${{ matrix.config.os }} path: build/p2pool + build-ubuntu-static-libs: + + runs-on: ubuntu-latest + + steps: + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y git build-essential cmake autoconf libgss-dev + + - name: Checkout repository + uses: actions/checkout@v2 + with: + submodules: true + + - name: Build libcurl + run: | + cd external/src/curl + autoreconf -fi + ./configure --without-ssl --without-hyper --without-zlib --without-brotli --without-zstd --without-default-ssl-backend --without-ca-bundle --without-ca-path --without-ca-fallback --without-libpsl --without-libgsasl --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 --without-ngtcp2 --without-nghttp3 --without-quiche --without-msh3 --without-zsh-functions-dir --without-fish-functions-dir --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-ntlm --disable-ntlm-wb --disable-tls-srp --disable-unix-sockets --disable-cookies --disable-socketpair --disable-doh --disable-dateparse --disable-netrc --disable-progress-meter --disable-dnsshuffle --disable-hsts + make -j$(nproc) + + - name: Build libuv + run: | + cd external/src/libuv + mkdir build + cd build + cmake .. -DBUILD_TESTING=OFF + make -j$(nproc) + + - name: Build libzmq + run: | + cd external/src/libzmq + mkdir build + cd build + cmake .. -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF + make -j$(nproc) + + - name: Build p2pool + run: | + mkdir build + cd build + cmake .. -DSTATIC_LIBS=ON + make -j$(nproc) + + - name: Build tests + run: | + cd tests + mkdir build + cd build + cmake .. -DSTATIC_LIBS=ON + make -j$(nproc) + + - name: Run tests + run: cd tests/build && ./p2pool_tests + + - name: Archive binary + uses: actions/upload-artifact@v2 + with: + name: p2pool-ubuntu-static-libs + path: build/p2pool + build-ubuntu-aarch64: runs-on: ubuntu-latest @@ -61,19 +119,26 @@ jobs: - name: Install dependencies run: | sudo apt update - sudo apt install -y git build-essential cmake gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu + sudo apt install -y git build-essential cmake autoconf gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu - name: Checkout repository uses: actions/checkout@v2 with: submodules: true + - name: Build libcurl + run: | + cd external/src/curl + autoreconf -fi + ./configure --host=aarch64-linux-gnu --without-ssl --without-hyper --without-zlib --without-brotli --without-zstd --without-default-ssl-backend --without-ca-bundle --without-ca-path --without-ca-fallback --without-libpsl --without-libgsasl --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 --without-ngtcp2 --without-nghttp3 --without-quiche --without-msh3 --without-zsh-functions-dir --without-fish-functions-dir --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-ntlm --disable-ntlm-wb --disable-tls-srp --disable-unix-sockets --disable-cookies --disable-socketpair --disable-doh --disable-dateparse --disable-netrc --disable-progress-meter --disable-dnsshuffle --disable-hsts + make -j$(nproc) + - name: Build libuv run: | cd external/src/libuv mkdir build cd build - cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ + cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DBUILD_TESTING=OFF make -j$(nproc) - name: Build libzmq @@ -115,22 +180,45 @@ jobs: uses: eine/setup-msys2@v2 with: update: true - install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-libuv + install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake make autoconf libtool automake + + - name: Build libcurl + run: | + cd external/src/curl + autoreconf -fi + ./configure --without-ssl --without-hyper --without-zlib --without-brotli --without-zstd --without-default-ssl-backend --without-ca-bundle --without-ca-path --without-ca-fallback --without-libpsl --without-libgsasl --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 --without-ngtcp2 --without-nghttp3 --without-quiche --without-msh3 --without-zsh-functions-dir --without-fish-functions-dir --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-ntlm --disable-ntlm-wb --disable-tls-srp --disable-unix-sockets --disable-cookies --disable-socketpair --disable-doh --disable-dateparse --disable-netrc --disable-progress-meter --disable-dnsshuffle --disable-hsts + make -j$(nproc) + + - name: Build libuv + run: | + cd external/src/libuv + mkdir build + cd build + cmake .. -G "Unix Makefiles" -DBUILD_TESTING=OFF + make -j$(nproc) + + - name: Build libzmq + run: | + cd external/src/libzmq + mkdir build + cd build + cmake .. -G "Unix Makefiles" -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DZMQ_HAVE_IPC=OFF + make -j$(nproc) - name: Build p2pool run: | mkdir build cd build - cmake .. -G "Unix Makefiles" - make -j2 + cmake .. -G "Unix Makefiles" -DSTATIC_LIBS=ON + make -j$(nproc) - name: Build tests run: | cd tests mkdir build cd build - cmake .. -G "Unix Makefiles" - make -j2 + cmake .. -G "Unix Makefiles" -DSTATIC_LIBS=ON + make -j$(nproc) - name: Run tests run: | @@ -204,14 +292,21 @@ jobs: submodules: recursive - name: Install dependencies - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake + run: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake autoconf libtool automake + + - name: Build libcurl + run: | + cd external/src/curl + autoreconf -fi + ./configure --without-ssl --without-hyper --without-zlib --without-brotli --without-zstd --without-default-ssl-backend --without-ca-bundle --without-ca-path --without-ca-fallback --without-libpsl --without-libgsasl --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 --without-ngtcp2 --without-nghttp3 --without-quiche --without-msh3 --without-zsh-functions-dir --without-fish-functions-dir --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-ntlm --disable-ntlm-wb --disable-tls-srp --disable-unix-sockets --disable-cookies --disable-socketpair --disable-doh --disable-dateparse --disable-netrc --disable-progress-meter --disable-dnsshuffle --disable-hsts + make -j3 - name: Build libuv run: | cd external/src/libuv mkdir build cd build - cmake .. + cmake .. -DBUILD_TESTING=OFF make -j3 - name: Build libzmq @@ -219,7 +314,7 @@ jobs: cd external/src/libzmq mkdir build cd build - cmake .. -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF + cmake .. -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF make -j3 - name: Build p2pool diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c36baff..2601661 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,7 @@ name: "CodeQL" on: push: - branches: [ master ] pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] schedule: - cron: '44 11 * * 0' @@ -40,7 +37,7 @@ jobs: steps: - name: Install dependencies run: | - sudo apt update && sudo apt install git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev + sudo apt update && sudo apt install git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev - name: Checkout repository uses: actions/checkout@v2 diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 686b810..aac9848 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -1,10 +1,6 @@ name: cppcheck -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request] jobs: cppcheck-ubuntu: diff --git a/.github/workflows/msvc-analysis.yml b/.github/workflows/msvc-analysis.yml index ab9c133..2b0e3a4 100644 --- a/.github/workflows/msvc-analysis.yml +++ b/.github/workflows/msvc-analysis.yml @@ -10,9 +10,7 @@ name: Microsoft C++ Code Analysis on: push: - branches: [ master ] pull_request: - branches: [ master ] schedule: - cron: '40 10 * * 0' diff --git a/.gitmodules b/.gitmodules index cd09725..05c61e0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "external/src/robin-hood-hashing"] path = external/src/robin-hood-hashing url = https://github.com/SChernykh/robin-hood-hashing +[submodule "external/src/curl"] + path = external/src/curl + url = https://github.com/SChernykh/curl diff --git a/CMakeLists.txt b/CMakeLists.txt index ddacf07..0e157dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.12) project(p2pool) option(STATIC_BINARY "Build static binary" OFF) @@ -7,9 +7,7 @@ option(WITH_RANDOMX "Include the RandomX library in the build. If this is turned set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") -if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.6.0") - set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT p2pool) -endif() +set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT p2pool) if (WITH_RANDOMX) add_definitions(-DWITH_RANDOMX) @@ -21,7 +19,6 @@ include(cmake/flags.cmake) set(HEADERS external/src/cryptonote/crypto-ops.h - external/src/llhttp/llhttp.h src/block_cache.h src/block_template.h src/common.h @@ -52,9 +49,6 @@ set(HEADERS set(SOURCES external/src/cryptonote/crypto-ops-data.c external/src/cryptonote/crypto-ops.c - external/src/llhttp/api.c - external/src/llhttp/http.c - external/src/llhttp/llhttp.c src/block_cache.cpp src/block_template.cpp src/console_commands.cpp @@ -86,10 +80,10 @@ endif() include_directories(src) include_directories(external/src) include_directories(external/src/cryptonote) +include_directories(external/src/curl/include) include_directories(external/src/libuv/include) include_directories(external/src/cppzmq) include_directories(external/src/libzmq/include) -include_directories(external/src/llhttp) if (WITH_RANDOMX) include_directories(external/src/RandomX/src) endif() @@ -98,6 +92,7 @@ include_directories(external/src/robin-hood-hashing/src/include) if (WIN32) set(LIBS ${LIBS} ws2_32 iphlpapi userenv psapi) + add_definitions(-DCURL_STATICLIB) elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) set(LIBS ${LIBS} pthread) elseif (NOT APPLE) @@ -109,11 +104,20 @@ if (CMAKE_CXX_COMPILER_ID MATCHES MSVC) find_library(ZMQ_LIBRARY NAMES libzmq-v142-mt-s-4_3_5 PATHS "external/lib/libzmq/Release") find_library(UV_LIBRARY_DEBUG NAMES uv_a PATHS "external/lib/libuv/Debug") find_library(UV_LIBRARY NAMES uv_a PATHS "external/lib/libuv/Release") + find_library(CURL_LIBRARY_DEBUG NAMES libcurld PATHS "external/lib/libcurl/Debug") + find_library(CURL_LIBRARY NAMES libcurl PATHS "external/lib/libcurl/Release") elseif (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang) find_library(ZMQ_LIBRARY_DEBUG NAMES zmq libzmq.a) find_library(ZMQ_LIBRARY NAMES zmq libzmq.a) find_library(UV_LIBRARY_DEBUG NAMES uv libuv.a) find_library(UV_LIBRARY NAMES uv libuv.a) + if (WIN32) + find_library(CURL_LIBRARY_DEBUG NAMES libcurl.a PATHS "external/src/curl/lib/.libs" NO_DEFAULT_PATH) + find_library(CURL_LIBRARY NAMES libcurl.a PATHS "external/src/curl/lib/.libs" NO_DEFAULT_PATH) + else() + find_library(CURL_LIBRARY_DEBUG NAMES curl) + find_library(CURL_LIBRARY NAMES curl) + endif() find_library(SODIUM_LIBRARY sodium) endif() @@ -132,6 +136,13 @@ if (SODIUM_LIBRARY) set(LIBS ${LIBS} ${SODIUM_LIBRARY}) endif() +if(APPLE) + find_library(FOUNDATION_LIB Foundation) + find_library(CORE_FOUNDATION_LIB CoreFoundation) + find_library(SYSTEM_CONFIGURATION_LIB SystemConfiguration) + set(LIBS ${LIBS} ${FOUNDATION_LIB} ${CORE_FOUNDATION_LIB} ${SYSTEM_CONFIGURATION_LIB}) +endif() + add_definitions(/DZMQ_STATIC) include(CheckSymbolExists) @@ -159,23 +170,35 @@ endif() add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES}) if (STATIC_BINARY OR STATIC_LIBS) - add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} ${CMAKE_PROJECT_NAME}) + if (WIN32) + add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} "${CMAKE_PROJECT_NAME}.exe") + else() + add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} ${CMAKE_PROJECT_NAME}) + endif() if (WITH_RANDOMX) set(STATIC_LIBS randomx) endif() - if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) + if (WIN32) + set(STATIC_LIBS ${STATIC_LIBS} ws2_32 iphlpapi userenv psapi wldap32) + elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) set(STATIC_LIBS ${STATIC_LIBS} pthread) - elseif (NOT APPLE) + elseif (APPLE) + find_library(FOUNDATION_LIB Foundation) + find_library(CORE_FOUNDATION_LIB CoreFoundation) + find_library(SYSTEM_CONFIGURATION_LIB SystemConfiguration) + set(STATIC_LIBS ${STATIC_LIBS} ${FOUNDATION_LIB} ${CORE_FOUNDATION_LIB} ${SYSTEM_CONFIGURATION_LIB}) + else() set(STATIC_LIBS ${STATIC_LIBS} pthread dl) endif() target_link_libraries(${CMAKE_PROJECT_NAME} "${CMAKE_SOURCE_DIR}/external/src/libzmq/build/lib/libzmq.a" "${CMAKE_SOURCE_DIR}/external/src/libuv/build/libuv_a.a" + "${CMAKE_SOURCE_DIR}/external/src/curl/lib/.libs/libcurl.a" ${STATIC_LIBS} ) else() - target_link_libraries(${CMAKE_PROJECT_NAME} debug ${ZMQ_LIBRARY_DEBUG} debug ${UV_LIBRARY_DEBUG} optimized ${ZMQ_LIBRARY} optimized ${UV_LIBRARY} ${LIBS}) + target_link_libraries(${CMAKE_PROJECT_NAME} debug ${ZMQ_LIBRARY_DEBUG} debug ${UV_LIBRARY_DEBUG} debug ${CURL_LIBRARY_DEBUG} optimized ${ZMQ_LIBRARY} optimized ${UV_LIBRARY} optimized ${CURL_LIBRARY} ${LIBS}) endif() diff --git a/README.md b/README.md index 839854b..3cde091 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ Please see the relevant instructions for your platform: Run the following commands to install the necessary prerequisites, clone this repo, and build P2Pool locally on Ubuntu 20.04: ``` -sudo apt update && sudo apt install git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev +sudo apt update && sudo apt install git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev git clone --recursive https://github.com/SChernykh/p2pool cd p2pool mkdir build && cd build diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 882cecd..3a2e8c5 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -39,7 +39,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC) set(CMAKE_C_FLAGS_RELWITHDEBINFO "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Ob1 /Ot /Zi /MT") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Ob1 /Ot /Zi /MT") - elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) set(GENERAL_FLAGS "-pthread") set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror") diff --git a/cppcheck/includes.txt b/cppcheck/includes.txt index 87aed99..037d9ac 100644 --- a/cppcheck/includes.txt +++ b/cppcheck/includes.txt @@ -4,7 +4,7 @@ ../external/src/libuv/include/ ../external/src/cppzmq/ ../external/src/libzmq/include/ -../external/src/llhttp/ +../external/src/curl/include ../external/src/RandomX/src/ ../external/src/rapidjson/include ../external/src/robin-hood-hashing/src/include diff --git a/external/lib/libcurl/Debug/libcurld.lib b/external/lib/libcurl/Debug/libcurld.lib new file mode 100644 index 0000000..5bda5d4 Binary files /dev/null and b/external/lib/libcurl/Debug/libcurld.lib differ diff --git a/external/lib/libcurl/Debug/libcurld.pdb b/external/lib/libcurl/Debug/libcurld.pdb new file mode 100644 index 0000000..54594c8 Binary files /dev/null and b/external/lib/libcurl/Debug/libcurld.pdb differ diff --git a/external/lib/libcurl/Release/libcurl.lib b/external/lib/libcurl/Release/libcurl.lib new file mode 100644 index 0000000..1412319 Binary files /dev/null and b/external/lib/libcurl/Release/libcurl.lib differ diff --git a/external/src/curl b/external/src/curl new file mode 160000 index 0000000..2bd75e5 --- /dev/null +++ b/external/src/curl @@ -0,0 +1 @@ +Subproject commit 2bd75e5686b2e6ff3824c4dfb2b6ec86b60f454c diff --git a/external/src/llhttp/LICENSE-MIT b/external/src/llhttp/LICENSE-MIT deleted file mode 100644 index 6c1512d..0000000 --- a/external/src/llhttp/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -This software is licensed under the MIT License. - -Copyright Fedor Indutny, 2018. - -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/external/src/llhttp/api.c b/external/src/llhttp/api.c deleted file mode 100644 index d3f2425..0000000 --- a/external/src/llhttp/api.c +++ /dev/null @@ -1,379 +0,0 @@ -#ifdef _MSC_VER -#pragma warning(disable : 4100 4668 4710 4711 4820) -#elif defined __clang__ -#pragma clang diagnostic ignored "-Wunused-parameter" -#pragma clang diagnostic ignored "-Wmissing-prototypes" -#elif defined __GNUC__ -#pragma GCC diagnostic ignored "-Wunused-parameter" -#pragma GCC diagnostic ignored "-Wcast-qual" -#endif - -#include -#include -#include - -#include "llhttp.h" - -#define CALLBACK_MAYBE(PARSER, NAME) \ - do { \ - const llhttp_settings_t* settings; \ - settings = (const llhttp_settings_t*) (PARSER)->settings; \ - if (settings == NULL || settings->NAME == NULL) { \ - err = 0; \ - break; \ - } \ - err = settings->NAME((PARSER)); \ - } while (0) - -#define SPAN_CALLBACK_MAYBE(PARSER, NAME, START, LEN) \ - do { \ - const llhttp_settings_t* settings; \ - settings = (const llhttp_settings_t*) (PARSER)->settings; \ - if (settings == NULL || settings->NAME == NULL) { \ - err = 0; \ - break; \ - } \ - err = settings->NAME((PARSER), (START), (LEN)); \ - if (err == -1) { \ - err = HPE_USER; \ - llhttp_set_error_reason((PARSER), "Span callback error in " #NAME); \ - } \ - } while (0) - -void llhttp_init(llhttp_t* parser, llhttp_type_t type, - const llhttp_settings_t* settings) { - llhttp__internal_init(parser); - - parser->type = type; - parser->settings = (void*) settings; -} - - -#if defined(__wasm__) - -extern int wasm_on_message_begin(llhttp_t * p); -extern int wasm_on_url(llhttp_t* p, const char* at, size_t length); -extern int wasm_on_status(llhttp_t* p, const char* at, size_t length); -extern int wasm_on_header_field(llhttp_t* p, const char* at, size_t length); -extern int wasm_on_header_value(llhttp_t* p, const char* at, size_t length); -extern int wasm_on_headers_complete(llhttp_t * p, int status_code, - uint8_t upgrade, int should_keep_alive); -extern int wasm_on_body(llhttp_t* p, const char* at, size_t length); -extern int wasm_on_message_complete(llhttp_t * p); - -static int wasm_on_headers_complete_wrap(llhttp_t* p) { - return wasm_on_headers_complete(p, p->status_code, p->upgrade, - llhttp_should_keep_alive(p)); -} - -const llhttp_settings_t wasm_settings = { - wasm_on_message_begin, - wasm_on_url, - wasm_on_status, - wasm_on_header_field, - wasm_on_header_value, - wasm_on_headers_complete_wrap, - wasm_on_body, - wasm_on_message_complete, - NULL, - NULL, -}; - - -llhttp_t* llhttp_alloc(llhttp_type_t type) { - llhttp_t* parser = malloc(sizeof(llhttp_t)); - llhttp_init(parser, type, &wasm_settings); - return parser; -} - -void llhttp_free(llhttp_t* parser) { - free(parser); -} - -/* Some getters required to get stuff from the parser */ - -uint8_t llhttp_get_type(llhttp_t* parser) { - return parser->type; -} - -uint8_t llhttp_get_http_major(llhttp_t* parser) { - return parser->http_major; -} - -uint8_t llhttp_get_http_minor(llhttp_t* parser) { - return parser->http_minor; -} - -uint8_t llhttp_get_method(llhttp_t* parser) { - return parser->method; -} - -int llhttp_get_status_code(llhttp_t* parser) { - return parser->status_code; -} - -uint8_t llhttp_get_upgrade(llhttp_t* parser) { - return parser->upgrade; -} - -#endif // defined(__wasm__) - - -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; - - llhttp__internal_init(parser); - - parser->type = type; - parser->settings = (void*) settings; - parser->data = data; - parser->lenient_flags = lenient_flags; -} - - -llhttp_errno_t llhttp_execute(llhttp_t* parser, const char* data, size_t len) { - return llhttp__internal_execute(parser, data, data + len); -} - - -void llhttp_settings_init(llhttp_settings_t* settings) { - memset(settings, 0, sizeof(*settings)); -} - - -llhttp_errno_t llhttp_finish(llhttp_t* parser) { - int err; - - /* We're in an error state. Don't bother doing anything. */ - if (parser->error != 0) { - return 0; - } - - switch (parser->finish) { - case HTTP_FINISH_SAFE_WITH_CB: - CALLBACK_MAYBE(parser, on_message_complete); - if (err != HPE_OK) return err; - - /* FALLTHROUGH */ - case HTTP_FINISH_SAFE: - return HPE_OK; - case HTTP_FINISH_UNSAFE: - parser->reason = "Invalid EOF state"; - return HPE_INVALID_EOF_STATE; - default: - abort(); - } -} - - -void llhttp_pause(llhttp_t* parser) { - if (parser->error != HPE_OK) { - return; - } - - parser->error = HPE_PAUSED; - parser->reason = "Paused"; -} - - -void llhttp_resume(llhttp_t* parser) { - if (parser->error != HPE_PAUSED) { - return; - } - - parser->error = 0; -} - - -void llhttp_resume_after_upgrade(llhttp_t* parser) { - if (parser->error != HPE_PAUSED_UPGRADE) { - return; - } - - parser->error = 0; -} - - -llhttp_errno_t llhttp_get_errno(const llhttp_t* parser) { - return parser->error; -} - - -const char* llhttp_get_error_reason(const llhttp_t* parser) { - return parser->reason; -} - - -void llhttp_set_error_reason(llhttp_t* parser, const char* reason) { - parser->reason = reason; -} - - -const char* llhttp_get_error_pos(const llhttp_t* parser) { - return parser->error_pos; -} - - -const char* llhttp_errno_name(llhttp_errno_t err) { -#define HTTP_ERRNO_GEN(CODE, NAME, _) case HPE_##NAME: return "HPE_" #NAME; - switch (err) { - HTTP_ERRNO_MAP(HTTP_ERRNO_GEN) - default: abort(); - } -#undef HTTP_ERRNO_GEN -} - - -const char* llhttp_method_name(llhttp_method_t method) { -#define HTTP_METHOD_GEN(NUM, NAME, STRING) case HTTP_##NAME: return #STRING; - switch (method) { - HTTP_ALL_METHOD_MAP(HTTP_METHOD_GEN) - default: abort(); - } -#undef HTTP_METHOD_GEN -} - - -void llhttp_set_lenient_headers(llhttp_t* parser, int enabled) { - if (enabled) { - parser->lenient_flags |= LENIENT_HEADERS; - } else { - parser->lenient_flags &= ~LENIENT_HEADERS; - } -} - - -void llhttp_set_lenient_chunked_length(llhttp_t* parser, int enabled) { - if (enabled) { - parser->lenient_flags |= LENIENT_CHUNKED_LENGTH; - } else { - parser->lenient_flags &= ~LENIENT_CHUNKED_LENGTH; - } -} - - -void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled) { - if (enabled) { - parser->lenient_flags |= LENIENT_KEEP_ALIVE; - } else { - parser->lenient_flags &= ~LENIENT_KEEP_ALIVE; - } -} - -/* Callbacks */ - - -int llhttp__on_message_begin(llhttp_t* s, const char* p, const char* endp) { - int err; - CALLBACK_MAYBE(s, on_message_begin); - return err; -} - - -int llhttp__on_url(llhttp_t* s, const char* p, const char* endp) { - int err; - SPAN_CALLBACK_MAYBE(s, on_url, p, endp - p); - return err; -} - - -int llhttp__on_url_complete(llhttp_t* s, const char* p, const char* endp) { - int err; - CALLBACK_MAYBE(s, on_url_complete); - return err; -} - - -int llhttp__on_status(llhttp_t* s, const char* p, const char* endp) { - int err; - SPAN_CALLBACK_MAYBE(s, on_status, p, endp - p); - return err; -} - - -int llhttp__on_status_complete(llhttp_t* s, const char* p, const char* endp) { - int err; - CALLBACK_MAYBE(s, on_status_complete); - return err; -} - - -int llhttp__on_header_field(llhttp_t* s, const char* p, const char* endp) { - int err; - SPAN_CALLBACK_MAYBE(s, on_header_field, p, endp - p); - return err; -} - - -int llhttp__on_header_field_complete(llhttp_t* s, const char* p, const char* endp) { - int err; - CALLBACK_MAYBE(s, on_header_field_complete); - return err; -} - - -int llhttp__on_header_value(llhttp_t* s, const char* p, const char* endp) { - int err; - SPAN_CALLBACK_MAYBE(s, on_header_value, p, endp - p); - return err; -} - - -int llhttp__on_header_value_complete(llhttp_t* s, const char* p, const char* endp) { - int err; - CALLBACK_MAYBE(s, on_header_value_complete); - return err; -} - - -int llhttp__on_headers_complete(llhttp_t* s, const char* p, const char* endp) { - int err; - CALLBACK_MAYBE(s, on_headers_complete); - return err; -} - - -int llhttp__on_message_complete(llhttp_t* s, const char* p, const char* endp) { - int err; - CALLBACK_MAYBE(s, on_message_complete); - return err; -} - - -int llhttp__on_body(llhttp_t* s, const char* p, const char* endp) { - int err; - SPAN_CALLBACK_MAYBE(s, on_body, p, endp - p); - return err; -} - - -int llhttp__on_chunk_header(llhttp_t* s, const char* p, const char* endp) { - int err; - CALLBACK_MAYBE(s, on_chunk_header); - return err; -} - - -int llhttp__on_chunk_complete(llhttp_t* s, const char* p, const char* endp) { - int err; - CALLBACK_MAYBE(s, on_chunk_complete); - return err; -} - - -/* Private */ - - -void llhttp__debug(llhttp_t* s, const char* p, const char* endp, - const char* msg) { - if (p == endp) { - fprintf(stderr, "p=%p type=%d flags=%02x next=null debug=%s\n", s, s->type, - s->flags, msg); - } else { - fprintf(stderr, "p=%p type=%d flags=%02x next=%02x debug=%s\n", s, - s->type, s->flags, *p, msg); - } -} diff --git a/external/src/llhttp/http.c b/external/src/llhttp/http.c deleted file mode 100644 index bfc0203..0000000 --- a/external/src/llhttp/http.c +++ /dev/null @@ -1,158 +0,0 @@ -#ifdef _MSC_VER -#pragma warning(disable : 4100 4668 4710 4711 4820) -#elif defined __clang__ -#pragma clang diagnostic ignored "-Wunused-parameter" -#pragma clang diagnostic ignored "-Wmissing-prototypes" -#elif defined __GNUC__ -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -#include -#ifndef LLHTTP__TEST -# include "llhttp.h" -#else -# define llhttp_t llparse_t -#endif /* */ - -int llhttp_message_needs_eof(const llhttp_t* parser); -int llhttp_should_keep_alive(const llhttp_t* parser); - -int llhttp__before_headers_complete(llhttp_t* parser, const char* p, - const char* endp) { - /* Set this here so that on_headers_complete() callbacks can see it */ - if ((parser->flags & F_UPGRADE) && - (parser->flags & F_CONNECTION_UPGRADE)) { - /* For responses, "Upgrade: foo" and "Connection: upgrade" are - * mandatory only when it is a 101 Switching Protocols response, - * otherwise it is purely informational, to announce support. - */ - parser->upgrade = - (parser->type == HTTP_REQUEST || parser->status_code == 101); - } else { - parser->upgrade = (parser->method == HTTP_CONNECT); - } - return 0; -} - - -/* Return values: - * 0 - No body, `restart`, message_complete - * 1 - CONNECT request, `restart`, message_complete, and pause - * 2 - chunk_size_start - * 3 - body_identity - * 4 - body_identity_eof - * 5 - invalid transfer-encoding for request - */ -int llhttp__after_headers_complete(llhttp_t* parser, const char* p, - const char* endp) { - int hasBody; - - hasBody = parser->flags & F_CHUNKED || parser->content_length > 0; - if (parser->upgrade && (parser->method == HTTP_CONNECT || - (parser->flags & F_SKIPBODY) || !hasBody)) { - /* Exit, the rest of the message is in a different protocol. */ - return 1; - } - - if (parser->flags & F_SKIPBODY) { - return 0; - } else if (parser->flags & F_CHUNKED) { - /* chunked encoding - ignore Content-Length header, prepare for a chunk */ - return 2; - } else if (parser->flags & F_TRANSFER_ENCODING) { - if (parser->type == HTTP_REQUEST && - (parser->lenient_flags & LENIENT_CHUNKED_LENGTH) == 0) { - /* RFC 7230 3.3.3 */ - - /* If a Transfer-Encoding header field - * is present in a request and the chunked transfer coding is not - * the final encoding, the message body length cannot be determined - * reliably; the server MUST respond with the 400 (Bad Request) - * status code and then close the connection. - */ - return 5; - } else { - /* RFC 7230 3.3.3 */ - - /* If a Transfer-Encoding header field is present in a response and - * the chunked transfer coding is not the final encoding, the - * message body length is determined by reading the connection until - * it is closed by the server. - */ - return 4; - } - } else { - if (!(parser->flags & F_CONTENT_LENGTH)) { - if (!llhttp_message_needs_eof(parser)) { - /* Assume content-length 0 - read the next */ - return 0; - } else { - /* Read body until EOF */ - return 4; - } - } else if (parser->content_length == 0) { - /* Content-Length header given but zero: Content-Length: 0\r\n */ - return 0; - } else { - /* Content-Length header given and non-zero */ - return 3; - } - } -} - - -int llhttp__after_message_complete(llhttp_t* parser, const char* p, - const char* endp) { - int should_keep_alive; - - should_keep_alive = llhttp_should_keep_alive(parser); - parser->finish = HTTP_FINISH_SAFE; - parser->flags = 0; - - /* NOTE: this is ignored in loose parsing mode */ - return should_keep_alive; -} - - -int llhttp_message_needs_eof(const llhttp_t* parser) { - if (parser->type == HTTP_REQUEST) { - return 0; - } - - /* See RFC 2616 section 4.4 */ - if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */ - parser->status_code == 204 || /* No Content */ - parser->status_code == 304 || /* Not Modified */ - (parser->flags & F_SKIPBODY)) { /* response to a HEAD request */ - return 0; - } - - /* RFC 7230 3.3.3, see `llhttp__after_headers_complete` */ - if ((parser->flags & F_TRANSFER_ENCODING) && - (parser->flags & F_CHUNKED) == 0) { - return 1; - } - - if (parser->flags & (F_CHUNKED | F_CONTENT_LENGTH)) { - return 0; - } - - return 1; -} - - -int llhttp_should_keep_alive(const llhttp_t* parser) { - if (parser->http_major > 0 && parser->http_minor > 0) { - /* HTTP/1.1 */ - if (parser->flags & F_CONNECTION_CLOSE) { - return 0; - } - } else { - /* HTTP/1.0 or earlier */ - if (!(parser->flags & F_CONNECTION_KEEP_ALIVE)) { - return 0; - } - } - - return !llhttp_message_needs_eof(parser); -} diff --git a/external/src/llhttp/llhttp.c b/external/src/llhttp/llhttp.c deleted file mode 100644 index 95a2c5a..0000000 --- a/external/src/llhttp/llhttp.c +++ /dev/null @@ -1,14943 +0,0 @@ -#ifdef _MSC_VER -#pragma warning(disable : 4061 4065 4100 4152 4242 4244 4668 4702 4710 4711 4820 5045) -#elif defined __clang__ -#pragma clang diagnostic ignored "-Wunused-parameter" -#pragma clang diagnostic ignored "-Wunused-variable" -#pragma clang diagnostic ignored "-Wmissing-prototypes" -#pragma clang diagnostic ignored "-Wunreachable-code" -#elif defined __GNUC__ -#pragma GCC diagnostic ignored "-Wunused-parameter" -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wcast-qual" -#endif - -#ifndef LLHTTP_STRICT_MODE -#define LLHTTP_STRICT_MODE 0 -#endif - -#if LLHTTP_STRICT_MODE - -#include -#include -#include - -#ifdef __SSE4_2__ - #ifdef _MSC_VER - #include - #else /* !_MSC_VER */ - #include - #endif /* _MSC_VER */ -#endif /* __SSE4_2__ */ - -#ifdef _MSC_VER - #define ALIGN(n) _declspec(align(n)) -#else /* !_MSC_VER */ - #define ALIGN(n) __attribute__((aligned(n))) -#endif /* _MSC_VER */ - -#include "llhttp.h" - -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[] = { - 'e', 'c', 't', 'i', 'o', 'n' -}; -static const unsigned char llparse_blob3[] = { - 'l', 'o', 's', 'e' -}; -static const unsigned char llparse_blob4[] = { - 'e', 'e', 'p', '-', 'a', 'l', 'i', 'v', 'e' -}; -static const unsigned char llparse_blob5[] = { - 'p', 'g', 'r', 'a', 'd', 'e' -}; -static const unsigned char llparse_blob6[] = { - 'c', 'h', 'u', 'n', 'k', 'e', 'd' -}; -#ifdef __SSE4_2__ -static const unsigned char ALIGN(16) llparse_blob7[] = { - 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[] = { - '!', '!', '#', '\'', '*', '+', '-', '.', '0', '9', 'A', - 'Z', '^', 'z', '|', '|' -}; -#endif /* __SSE4_2__ */ -#ifdef __SSE4_2__ -static const unsigned char ALIGN(16) llparse_blob9[] = { - '~', '~', 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0 -}; -#endif /* __SSE4_2__ */ -static const unsigned char llparse_blob10[] = { - 'e', 'n', 't', '-', 'l', 'e', 'n', 'g', 't', 'h' -}; -static const unsigned char llparse_blob11[] = { - 'r', 'o', 'x', 'y', '-', 'c', 'o', 'n', 'n', 'e', 'c', - 't', 'i', 'o', 'n' -}; -static const unsigned char llparse_blob12[] = { - 'r', 'a', 'n', 's', 'f', 'e', 'r', '-', 'e', 'n', 'c', - 'o', 'd', 'i', 'n', 'g' -}; -static const unsigned char llparse_blob13[] = { - 'p', 'g', 'r', 'a', 'd', 'e' -}; -static const unsigned char llparse_blob14[] = { - 'T', 'T', 'P', '/' -}; -static const unsigned char llparse_blob15[] = { - 0xd, 0xa, 0xd, 0xa, 'S', 'M', 0xd, 0xa, 0xd, 0xa -}; -static const unsigned char llparse_blob16[] = { - 'C', 'E', '/' -}; -static const unsigned char llparse_blob17[] = { - 'T', 'S', 'P', '/' -}; -static const unsigned char llparse_blob18[] = { - 'N', 'O', 'U', 'N', 'C', 'E' -}; -static const unsigned char llparse_blob19[] = { - 'I', 'N', 'D' -}; -static const unsigned char llparse_blob20[] = { - 'E', 'C', 'K', 'O', 'U', 'T' -}; -static const unsigned char llparse_blob21[] = { - 'N', 'E', 'C', 'T' -}; -static const unsigned char llparse_blob22[] = { - 'E', 'T', 'E' -}; -static const unsigned char llparse_blob23[] = { - 'C', 'R', 'I', 'B', 'E' -}; -static const unsigned char llparse_blob24[] = { - 'L', 'U', 'S', 'H' -}; -static const unsigned char llparse_blob25[] = { - 'E', 'T' -}; -static const unsigned char llparse_blob26[] = { - 'P', 'A', 'R', 'A', 'M', 'E', 'T', 'E', 'R' -}; -static const unsigned char llparse_blob27[] = { - 'E', 'A', 'D' -}; -static const unsigned char llparse_blob28[] = { - 'N', 'K' -}; -static const unsigned char llparse_blob29[] = { - 'C', 'K' -}; -static const unsigned char llparse_blob30[] = { - 'S', 'E', 'A', 'R', 'C', 'H' -}; -static const unsigned char llparse_blob31[] = { - 'R', 'G', 'E' -}; -static const unsigned char llparse_blob32[] = { - 'C', 'T', 'I', 'V', 'I', 'T', 'Y' -}; -static const unsigned char llparse_blob33[] = { - 'L', 'E', 'N', 'D', 'A', 'R' -}; -static const unsigned char llparse_blob34[] = { - 'V', 'E' -}; -static const unsigned char llparse_blob35[] = { - 'O', 'T', 'I', 'F', 'Y' -}; -static const unsigned char llparse_blob36[] = { - 'P', 'T', 'I', 'O', 'N', 'S' -}; -static const unsigned char llparse_blob37[] = { - 'C', 'H' -}; -static const unsigned char llparse_blob38[] = { - 'S', 'E' -}; -static const unsigned char llparse_blob39[] = { - 'A', 'Y' -}; -static const unsigned char llparse_blob40[] = { - 'S', 'T' -}; -static const unsigned char llparse_blob41[] = { - 'I', 'N', 'D' -}; -static const unsigned char llparse_blob42[] = { - 'A', 'T', 'C', 'H' -}; -static const unsigned char llparse_blob43[] = { - 'G', 'E' -}; -static const unsigned char llparse_blob44[] = { - 'I', 'N', 'D' -}; -static const unsigned char llparse_blob45[] = { - 'O', 'R', 'D' -}; -static const unsigned char llparse_blob46[] = { - 'I', 'R', 'E', 'C', 'T' -}; -static const unsigned char llparse_blob47[] = { - 'O', 'R', 'T' -}; -static const unsigned char llparse_blob48[] = { - 'R', 'C', 'H' -}; -static const unsigned char llparse_blob49[] = { - 'P', 'A', 'R', 'A', 'M', 'E', 'T', 'E', 'R' -}; -static const unsigned char llparse_blob50[] = { - 'U', 'R', 'C', 'E' -}; -static const unsigned char llparse_blob51[] = { - 'B', 'S', 'C', 'R', 'I', 'B', 'E' -}; -static const unsigned char llparse_blob52[] = { - 'A', 'R', 'D', 'O', 'W', 'N' -}; -static const unsigned char llparse_blob53[] = { - 'A', 'C', 'E' -}; -static const unsigned char llparse_blob54[] = { - 'I', 'N', 'D' -}; -static const unsigned char llparse_blob55[] = { - 'N', 'K' -}; -static const unsigned char llparse_blob56[] = { - 'C', 'K' -}; -static const unsigned char llparse_blob57[] = { - 'U', 'B', 'S', 'C', 'R', 'I', 'B', 'E' -}; -static const unsigned char llparse_blob58[] = { - 'H', 'T', 'T', 'P', '/' -}; -static const unsigned char llparse_blob59[] = { - 'A', 'D' -}; -static const unsigned char llparse_blob60[] = { - 'T', 'P', '/' -}; - -enum llparse_match_status_e { - kMatchComplete, - kMatchPause, - kMatchMismatch -}; -typedef enum llparse_match_status_e llparse_match_status_t; - -struct llparse_match_s { - llparse_match_status_t status; - const unsigned char* current; -}; -typedef struct llparse_match_s llparse_match_t; - -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) { - uint32_t index; - llparse_match_t res; - - index = s->_index; - for (; p != endp; p++) { - unsigned char current; - - current = *p; - if (current == seq[index]) { - if (++index == seq_len) { - res.status = kMatchComplete; - goto reset; - } - } else { - res.status = kMatchMismatch; - goto reset; - } - } - s->_index = index; - res.status = kMatchPause; - res.current = p; - return res; -reset: - s->_index = 0; - res.current = p; - return res; -} - -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) { - uint32_t index; - llparse_match_t res; - - index = s->_index; - for (; p != endp; p++) { - unsigned char current; - - current = ((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p)); - if (current == seq[index]) { - if (++index == seq_len) { - res.status = kMatchComplete; - goto reset; - } - } else { - res.status = kMatchMismatch; - goto reset; - } - } - s->_index = index; - res.status = kMatchPause; - res.current = p; - return res; -reset: - s->_index = 0; - res.current = p; - return res; -} - -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) { - uint32_t index; - llparse_match_t res; - - index = s->_index; - for (; p != endp; p++) { - unsigned char current; - - current = ((*p) | 0x20); - if (current == seq[index]) { - if (++index == seq_len) { - res.status = kMatchComplete; - goto reset; - } - } else { - res.status = kMatchMismatch; - goto reset; - } - } - s->_index = index; - res.status = kMatchPause; - res.current = p; - return res; -reset: - s->_index = 0; - res.current = p; - return res; -} - -enum llparse_state_e { - s_error, - 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, - 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_chunk_parameters, - s_n_llhttp__internal__n_chunk_size_otherwise, - s_n_llhttp__internal__n_chunk_size, - s_n_llhttp__internal__n_chunk_size_digit, - s_n_llhttp__internal__n_invoke_update_content_length, - 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, - s_n_llhttp__internal__n_span_start_llhttp__on_body_2, - s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete, - s_n_llhttp__internal__n_headers_almost_done, - s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete, - s_n_llhttp__internal__n_span_start_llhttp__on_header_value, - s_n_llhttp__internal__n_header_value_discard_lws, - 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_header_value_lenient, - 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, - s_n_llhttp__internal__n_header_value_connection_1, - 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_23, - s_n_llhttp__internal__n_error_24, - s_n_llhttp__internal__n_header_value_content_length_ws, - s_n_llhttp__internal__n_header_value_content_length, - s_n_llhttp__internal__n_header_value_te_chunked_last, - 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, - 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_llhttp__on_header_field_complete, - s_n_llhttp__internal__n_header_field_general_otherwise, - s_n_llhttp__internal__n_header_field_general, - s_n_llhttp__internal__n_header_field_colon, - s_n_llhttp__internal__n_header_field_3, - s_n_llhttp__internal__n_header_field_4, - s_n_llhttp__internal__n_header_field_2, - s_n_llhttp__internal__n_header_field_1, - s_n_llhttp__internal__n_header_field_5, - s_n_llhttp__internal__n_header_field_6, - s_n_llhttp__internal__n_header_field_7, - s_n_llhttp__internal__n_header_field, - s_n_llhttp__internal__n_span_start_llhttp__on_header_field, - s_n_llhttp__internal__n_header_field_start, - s_n_llhttp__internal__n_url_to_http_09, - s_n_llhttp__internal__n_url_skip_to_http09, - s_n_llhttp__internal__n_url_skip_lf_to_http09_1, - s_n_llhttp__internal__n_url_skip_lf_to_http09, - s_n_llhttp__internal__n_req_pri_upgrade, - s_n_llhttp__internal__n_req_http_complete_1, - s_n_llhttp__internal__n_req_http_complete, - s_n_llhttp__internal__n_req_http_minor, - s_n_llhttp__internal__n_req_http_dot, - s_n_llhttp__internal__n_req_http_major, - s_n_llhttp__internal__n_req_http_start_1, - s_n_llhttp__internal__n_req_http_start_2, - s_n_llhttp__internal__n_req_http_start_3, - s_n_llhttp__internal__n_req_http_start, - s_n_llhttp__internal__n_url_to_http, - s_n_llhttp__internal__n_url_skip_to_http, - s_n_llhttp__internal__n_url_fragment, - s_n_llhttp__internal__n_span_end_stub_query_3, - s_n_llhttp__internal__n_url_query, - s_n_llhttp__internal__n_url_query_or_fragment, - s_n_llhttp__internal__n_url_path, - s_n_llhttp__internal__n_span_start_stub_path_2, - s_n_llhttp__internal__n_span_start_stub_path, - s_n_llhttp__internal__n_span_start_stub_path_1, - s_n_llhttp__internal__n_url_server_with_at, - s_n_llhttp__internal__n_url_server, - s_n_llhttp__internal__n_url_schema_delim_1, - s_n_llhttp__internal__n_url_schema_delim, - s_n_llhttp__internal__n_span_end_stub_schema, - s_n_llhttp__internal__n_url_schema, - s_n_llhttp__internal__n_url_start, - s_n_llhttp__internal__n_span_start_llhttp__on_url_1, - s_n_llhttp__internal__n_url_entry_normal, - s_n_llhttp__internal__n_span_start_llhttp__on_url, - s_n_llhttp__internal__n_url_entry_connect, - s_n_llhttp__internal__n_req_spaces_before_url, - s_n_llhttp__internal__n_req_first_space_before_url, - s_n_llhttp__internal__n_start_req_2, - s_n_llhttp__internal__n_start_req_3, - s_n_llhttp__internal__n_start_req_1, - s_n_llhttp__internal__n_start_req_4, - s_n_llhttp__internal__n_start_req_6, - s_n_llhttp__internal__n_start_req_8, - s_n_llhttp__internal__n_start_req_9, - s_n_llhttp__internal__n_start_req_7, - s_n_llhttp__internal__n_start_req_5, - s_n_llhttp__internal__n_start_req_12, - s_n_llhttp__internal__n_start_req_13, - s_n_llhttp__internal__n_start_req_11, - s_n_llhttp__internal__n_start_req_10, - s_n_llhttp__internal__n_start_req_14, - s_n_llhttp__internal__n_start_req_17, - s_n_llhttp__internal__n_start_req_16, - s_n_llhttp__internal__n_start_req_15, - s_n_llhttp__internal__n_start_req_18, - s_n_llhttp__internal__n_start_req_20, - s_n_llhttp__internal__n_start_req_21, - s_n_llhttp__internal__n_start_req_19, - s_n_llhttp__internal__n_start_req_23, - s_n_llhttp__internal__n_start_req_24, - s_n_llhttp__internal__n_start_req_26, - s_n_llhttp__internal__n_start_req_28, - s_n_llhttp__internal__n_start_req_29, - s_n_llhttp__internal__n_start_req_27, - s_n_llhttp__internal__n_start_req_25, - s_n_llhttp__internal__n_start_req_30, - s_n_llhttp__internal__n_start_req_22, - s_n_llhttp__internal__n_start_req_31, - s_n_llhttp__internal__n_start_req_32, - s_n_llhttp__internal__n_start_req_35, - s_n_llhttp__internal__n_start_req_36, - s_n_llhttp__internal__n_start_req_34, - s_n_llhttp__internal__n_start_req_37, - s_n_llhttp__internal__n_start_req_38, - s_n_llhttp__internal__n_start_req_42, - s_n_llhttp__internal__n_start_req_43, - s_n_llhttp__internal__n_start_req_41, - s_n_llhttp__internal__n_start_req_40, - s_n_llhttp__internal__n_start_req_39, - s_n_llhttp__internal__n_start_req_45, - s_n_llhttp__internal__n_start_req_44, - s_n_llhttp__internal__n_start_req_33, - s_n_llhttp__internal__n_start_req_48, - s_n_llhttp__internal__n_start_req_49, - s_n_llhttp__internal__n_start_req_50, - s_n_llhttp__internal__n_start_req_51, - s_n_llhttp__internal__n_start_req_47, - s_n_llhttp__internal__n_start_req_46, - s_n_llhttp__internal__n_start_req_54, - s_n_llhttp__internal__n_start_req_56, - s_n_llhttp__internal__n_start_req_57, - s_n_llhttp__internal__n_start_req_55, - s_n_llhttp__internal__n_start_req_53, - s_n_llhttp__internal__n_start_req_58, - s_n_llhttp__internal__n_start_req_59, - s_n_llhttp__internal__n_start_req_52, - s_n_llhttp__internal__n_start_req_61, - s_n_llhttp__internal__n_start_req_62, - s_n_llhttp__internal__n_start_req_60, - s_n_llhttp__internal__n_start_req_65, - s_n_llhttp__internal__n_start_req_67, - s_n_llhttp__internal__n_start_req_68, - s_n_llhttp__internal__n_start_req_66, - s_n_llhttp__internal__n_start_req_69, - s_n_llhttp__internal__n_start_req_64, - s_n_llhttp__internal__n_start_req_63, - s_n_llhttp__internal__n_start_req, - s_n_llhttp__internal__n_invoke_llhttp__on_status_complete, - s_n_llhttp__internal__n_res_line_almost_done, - 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, - s_n_llhttp__internal__n_res_http_end, - s_n_llhttp__internal__n_res_http_minor, - s_n_llhttp__internal__n_res_http_dot, - s_n_llhttp__internal__n_res_http_major, - s_n_llhttp__internal__n_start_res, - s_n_llhttp__internal__n_req_or_res_method_2, - s_n_llhttp__internal__n_req_or_res_method_3, - s_n_llhttp__internal__n_req_or_res_method_1, - s_n_llhttp__internal__n_req_or_res_method, - s_n_llhttp__internal__n_start_req_or_res, - s_n_llhttp__internal__n_invoke_load_type, - s_n_llhttp__internal__n_start, -}; -typedef enum llparse_state_e llparse_state_t; - -int llhttp__on_url( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__on_header_field( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__on_header_value( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__on_body( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__on_status( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_update_finish( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->finish = 2; - return 0; -} - -int llhttp__on_message_begin( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_load_type( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->type; -} - -int llhttp__internal__c_store_method( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - state->method = match; - return 0; -} - -int llhttp__internal__c_is_equal_method( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->method == 5; -} - -int llhttp__internal__c_update_http_major( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->http_major = 0; - return 0; -} - -int llhttp__internal__c_update_http_minor( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->http_minor = 9; - return 0; -} - -int llhttp__on_url_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -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); - -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); - -int llhttp__internal__c_update_finish_1( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->finish = 0; - return 0; -} - -int llhttp__internal__c_test_lenient_flags( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return (state->lenient_flags & 4) == 4; -} - -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_1( - 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__after_headers_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_update_content_length( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->content_length = 0; - return 0; -} - -int llhttp__internal__c_mul_add_content_length( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - /* Multiplication overflow */ - if (state->content_length > 0xffffffffffffffffULL / 16) { - return 1; - } - - state->content_length *= 16; - - /* Addition overflow */ - if (match >= 0) { - if (state->content_length > 0xffffffffffffffffULL - match) { - return 1; - } - } else { - if (state->content_length < 0ULL - match) { - return 1; - } - } - state->content_length += match; - return 0; -} - -int llhttp__on_chunk_header( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_is_equal_content_length( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->content_length == 0; -} - -int llhttp__internal__c_or_flags( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 128; - return 0; -} - -int llhttp__internal__c_update_finish_3( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->finish = 1; - return 0; -} - -int llhttp__internal__c_or_flags_1( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 64; - return 0; -} - -int llhttp__internal__c_update_upgrade( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->upgrade = 1; - return 0; -} - -int llhttp__internal__c_store_header_state( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - state->header_state = match; - return 0; -} - -int llhttp__on_header_field_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_load_header_state( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->header_state; -} - -int llhttp__internal__c_or_flags_3( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 1; - return 0; -} - -int llhttp__internal__c_update_header_state( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 1; - return 0; -} - -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( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 2; - return 0; -} - -int llhttp__internal__c_or_flags_5( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 4; - return 0; -} - -int llhttp__internal__c_or_flags_6( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 8; - return 0; -} - -int llhttp__internal__c_update_header_state_2( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 6; - return 0; -} - -int llhttp__internal__c_test_lenient_flags_2( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return (state->lenient_flags & 1) == 1; -} - -int llhttp__internal__c_update_header_state_4( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 0; - return 0; -} - -int llhttp__internal__c_update_header_state_5( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 5; - return 0; -} - -int llhttp__internal__c_update_header_state_6( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 7; - return 0; -} - -int llhttp__internal__c_test_flags_2( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return (state->flags & 32) == 32; -} - -int llhttp__internal__c_mul_add_content_length_1( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - /* Multiplication overflow */ - if (state->content_length > 0xffffffffffffffffULL / 10) { - return 1; - } - - state->content_length *= 10; - - /* Addition overflow */ - if (match >= 0) { - if (state->content_length > 0xffffffffffffffffULL - match) { - return 1; - } - } else { - if (state->content_length < 0ULL - match) { - return 1; - } - } - state->content_length += match; - return 0; -} - -int llhttp__internal__c_or_flags_15( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 32; - return 0; -} - -int llhttp__internal__c_or_flags_16( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 512; - return 0; -} - -int llhttp__internal__c_and_flags( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags &= -9; - return 0; -} - -int llhttp__internal__c_update_header_state_7( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 8; - return 0; -} - -int llhttp__internal__c_or_flags_17( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 16; - return 0; -} - -int llhttp__internal__c_load_method( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->method; -} - -int llhttp__internal__c_store_http_major( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - state->http_major = match; - return 0; -} - -int llhttp__internal__c_store_http_minor( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - state->http_minor = match; - return 0; -} - -int llhttp__internal__c_update_status_code( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->status_code = 0; - return 0; -} - -int llhttp__internal__c_mul_add_status_code( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - /* Multiplication overflow */ - if (state->status_code > 0xffff / 10) { - return 1; - } - - state->status_code *= 10; - - /* Addition overflow */ - if (match >= 0) { - if (state->status_code > 0xffff - match) { - return 1; - } - } else { - if (state->status_code < 0 - match) { - return 1; - } - } - state->status_code += match; - - /* Enforce maximum */ - if (state->status_code > 999) { - return 1; - } - return 0; -} - -int llhttp__on_status_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_update_type( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->type = 1; - return 0; -} - -int llhttp__internal__c_update_type_1( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->type = 2; - return 0; -} - -int llhttp__internal_init(llhttp__internal_t* state) { - memset(state, 0, sizeof(*state)); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_start; - return 0; -} - -static llparse_state_t llhttp__internal__run( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - int match; - switch ((llparse_state_t) (intptr_t) state->_current) { - case s_n_llhttp__internal__n_closed: - s_n_llhttp__internal__n_closed: { - if (p == endp) { - return s_n_llhttp__internal__n_closed; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_closed; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_closed; - } - default: { - p++; - goto s_n_llhttp__internal__n_error_4; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_llhttp__after_message_complete: - s_n_llhttp__internal__n_invoke_llhttp__after_message_complete: { - switch (llhttp__after_message_complete(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_invoke_update_finish_2; - default: - goto s_n_llhttp__internal__n_invoke_update_finish_1; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_pause_1: - s_n_llhttp__internal__n_pause_1: { - state->error = 0x16; - state->reason = "Pause on CONNECT/Upgrade"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__after_message_complete; - return s_error; - /* 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_5; - default: - goto s_n_llhttp__internal__n_error_13; - } - /* 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; - } - 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_error_8; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_consume_content_length: - s_n_llhttp__internal__n_consume_content_length: { - size_t avail; - uint64_t need; - - avail = endp - p; - need = state->content_length; - if (avail >= need) { - p += need; - state->content_length = 0; - goto s_n_llhttp__internal__n_span_end_llhttp__on_body; - } - - state->content_length -= avail; - return s_n_llhttp__internal__n_consume_content_length; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_body: - s_n_llhttp__internal__n_span_start_llhttp__on_body: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_body; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_body; - goto s_n_llhttp__internal__n_consume_content_length; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_is_equal_content_length: - s_n_llhttp__internal__n_invoke_is_equal_content_length: { - switch (llhttp__internal__c_is_equal_content_length(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_span_start_llhttp__on_body; - default: - goto s_n_llhttp__internal__n_invoke_or_flags; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_size_almost_done: - s_n_llhttp__internal__n_chunk_size_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_size_almost_done; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_header; - } - default: { - goto s_n_llhttp__internal__n_error_9; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_parameters: - s_n_llhttp__internal__n_chunk_parameters: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_parameters; - } - switch (*p) { - case 13: { - p++; - goto s_n_llhttp__internal__n_chunk_size_almost_done; - } - default: { - p++; - goto s_n_llhttp__internal__n_chunk_parameters; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_size_otherwise: - s_n_llhttp__internal__n_chunk_size_otherwise: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_size_otherwise; - } - switch (*p) { - case 13: { - p++; - goto s_n_llhttp__internal__n_chunk_size_almost_done; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_chunk_parameters; - } - case ';': { - p++; - goto s_n_llhttp__internal__n_chunk_parameters; - } - default: { - goto s_n_llhttp__internal__n_error_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_size: - s_n_llhttp__internal__n_chunk_size: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_size; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'A': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'B': { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'C': { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'D': { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'E': { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'F': { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'a': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'b': { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'c': { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'd': { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'e': { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'f': { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - default: { - goto s_n_llhttp__internal__n_chunk_size_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_size_digit: - s_n_llhttp__internal__n_chunk_size_digit: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_size_digit; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'A': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'B': { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'C': { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'D': { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'E': { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'F': { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'a': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'b': { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'c': { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'd': { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'e': { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'f': { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - default: { - goto s_n_llhttp__internal__n_error_12; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_update_content_length: - s_n_llhttp__internal__n_invoke_update_content_length: { - switch (llhttp__internal__c_update_content_length(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_chunk_size_digit; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_consume_content_length_1: - s_n_llhttp__internal__n_consume_content_length_1: { - size_t avail; - uint64_t need; - - avail = endp - p; - need = state->content_length; - if (avail >= need) { - p += need; - state->content_length = 0; - goto s_n_llhttp__internal__n_span_end_llhttp__on_body_1; - } - - state->content_length -= avail; - return s_n_llhttp__internal__n_consume_content_length_1; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_body_1: - s_n_llhttp__internal__n_span_start_llhttp__on_body_1: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_body_1; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_body; - goto s_n_llhttp__internal__n_consume_content_length_1; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_eof: - s_n_llhttp__internal__n_eof: { - if (p == endp) { - return s_n_llhttp__internal__n_eof; - } - p++; - goto s_n_llhttp__internal__n_eof; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_body_2: - s_n_llhttp__internal__n_span_start_llhttp__on_body_2: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_body_2; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_body; - goto s_n_llhttp__internal__n_eof; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete: - s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete: { - switch (llhttp__after_headers_complete(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_1; - case 2: - goto s_n_llhttp__internal__n_invoke_update_content_length; - case 3: - goto s_n_llhttp__internal__n_span_start_llhttp__on_body_1; - case 4: - goto s_n_llhttp__internal__n_invoke_update_finish_3; - case 5: - goto s_n_llhttp__internal__n_error_14; - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_headers_almost_done: - s_n_llhttp__internal__n_headers_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_headers_almost_done; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_invoke_test_flags; - } - default: { - goto s_n_llhttp__internal__n_error_17; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete: - s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete: { - switch (llhttp__on_header_value_complete(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_start; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_header_value: - s_n_llhttp__internal__n_span_start_llhttp__on_header_value: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_header_value; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_header_value; - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_discard_lws: - s_n_llhttp__internal__n_header_value_discard_lws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_discard_lws; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - default: { - goto s_n_llhttp__internal__n_invoke_load_header_state; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_discard_ws_almost_done: - s_n_llhttp__internal__n_header_value_discard_ws_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_discard_ws_almost_done; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_header_value_discard_lws; - } - default: { - goto s_n_llhttp__internal__n_error_19; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_lws: - s_n_llhttp__internal__n_header_value_lws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_lws; - } - switch (*p) { - case 9: { - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; - } - case ' ': { - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; - } - default: { - goto s_n_llhttp__internal__n_invoke_load_header_state_3; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_almost_done: - s_n_llhttp__internal__n_header_value_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_almost_done; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_header_value_lws; - } - default: { - goto s_n_llhttp__internal__n_error_20; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_lenient: - s_n_llhttp__internal__n_header_value_lenient: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_lenient; - } - switch (*p) { - 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_3; - } - default: { - p++; - goto s_n_llhttp__internal__n_header_value_lenient; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_otherwise: - s_n_llhttp__internal__n_header_value_otherwise: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_otherwise; - } - switch (*p) { - 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_2; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_token: - s_n_llhttp__internal__n_header_value_connection_token: { - 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, 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, 1, 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_header_value_connection_token; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_header_value_connection_token; - } - case 2: { - p++; - goto s_n_llhttp__internal__n_header_value_connection; - } - default: { - goto s_n_llhttp__internal__n_header_value_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_ws: - s_n_llhttp__internal__n_header_value_connection_ws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_connection_ws; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_header_value_otherwise; - } - case 13: { - goto s_n_llhttp__internal__n_header_value_otherwise; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_connection_ws; - } - case ',': { - p++; - goto s_n_llhttp__internal__n_invoke_load_header_state_4; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_4; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_1: - s_n_llhttp__internal__n_header_value_connection_1: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_update_header_state_2; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_value_connection_1; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_header_value_connection_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_2: - s_n_llhttp__internal__n_header_value_connection_2: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_update_header_state_5; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_value_connection_2; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_header_value_connection_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_3: - s_n_llhttp__internal__n_header_value_connection_3: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_update_header_state_6; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_value_connection_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_header_value_connection_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection: - s_n_llhttp__internal__n_header_value_connection: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_connection; - } - switch (((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p))) { - case 9: { - p++; - goto s_n_llhttp__internal__n_header_value_connection; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_connection; - } - case 'c': { - p++; - goto s_n_llhttp__internal__n_header_value_connection_1; - } - case 'k': { - p++; - goto s_n_llhttp__internal__n_header_value_connection_2; - } - case 'u': { - p++; - goto s_n_llhttp__internal__n_header_value_connection_3; - } - default: { - goto s_n_llhttp__internal__n_header_value_connection_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_error_23: - s_n_llhttp__internal__n_error_23: { - state->error = 0xb; - state->reason = "Content-Length overflow"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_error_24: - s_n_llhttp__internal__n_error_24: { - state->error = 0xb; - state->reason = "Invalid character in Content-Length"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_content_length_ws: - s_n_llhttp__internal__n_header_value_content_length_ws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_content_length_ws; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_invoke_or_flags_15; - } - case 13: { - goto s_n_llhttp__internal__n_invoke_or_flags_15; - } - 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_5; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_content_length: - s_n_llhttp__internal__n_header_value_content_length: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_content_length; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - default: { - goto s_n_llhttp__internal__n_header_value_content_length_ws; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_te_chunked_last: - s_n_llhttp__internal__n_header_value_te_chunked_last: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_te_chunked_last; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_invoke_update_header_state_7; - } - case 13: { - goto s_n_llhttp__internal__n_invoke_update_header_state_7; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_te_chunked_last; - } - default: { - goto s_n_llhttp__internal__n_header_value_te_chunked; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_te_token_ows: - s_n_llhttp__internal__n_header_value_te_token_ows: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_te_token_ows; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_header_value_te_token_ows; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_te_token_ows; - } - default: { - goto s_n_llhttp__internal__n_header_value_te_chunked; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value: - s_n_llhttp__internal__n_header_value: { - 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_header_value; - } - #ifdef __SSE4_2__ - if (endp - p >= 16) { - __m128i ranges; - __m128i input; - int avail; - int match_len; - - /* Load input */ - input = _mm_loadu_si128((__m128i const*) p); - ranges = _mm_loadu_si128((__m128i const*) llparse_blob7); - - /* Find first character that does not match `ranges` */ - match_len = _mm_cmpestri(ranges, 6, - input, 16, - _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | - _SIDD_NEGATIVE_POLARITY); - - if (match_len != 0) { - p += match_len; - goto s_n_llhttp__internal__n_header_value; - } - goto s_n_llhttp__internal__n_header_value_otherwise; - } - #endif /* __SSE4_2__ */ - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_header_value; - } - default: { - goto s_n_llhttp__internal__n_header_value_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_te_token: - s_n_llhttp__internal__n_header_value_te_token: { - 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, 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, 1, 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_header_value_te_token; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_header_value_te_token; - } - case 2: { - p++; - goto s_n_llhttp__internal__n_header_value_te_token_ows; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_8; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_te_chunked: - s_n_llhttp__internal__n_header_value_te_chunked: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_header_value_te_chunked_last; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_value_te_chunked; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_header_value_te_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1: - s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_header_value; - goto s_n_llhttp__internal__n_invoke_load_header_state_2; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_discard_ws: - s_n_llhttp__internal__n_header_value_discard_ws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_discard_ws; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - case 10: { - p++; - goto s_n_llhttp__internal__n_header_value_discard_lws; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws_almost_done; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - default: { - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; - } - } - /* 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)) { - default: - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_general_otherwise: - s_n_llhttp__internal__n_header_field_general_otherwise: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field_general_otherwise; - } - switch (*p) { - case ':': { - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field_1; - } - default: { - goto s_n_llhttp__internal__n_error_25; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_general: - s_n_llhttp__internal__n_header_field_general: { - static uint8_t lookup_table[] = { - 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, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 0, 1, 0, 1, 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, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_header_field_general; - } - #ifdef __SSE4_2__ - if (endp - p >= 16) { - __m128i ranges; - __m128i input; - int avail; - int match_len; - - /* Load input */ - input = _mm_loadu_si128((__m128i const*) p); - ranges = _mm_loadu_si128((__m128i const*) llparse_blob8); - - /* Find first character that does not match `ranges` */ - match_len = _mm_cmpestri(ranges, 16, - input, 16, - _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | - _SIDD_NEGATIVE_POLARITY); - - if (match_len != 0) { - p += match_len; - goto s_n_llhttp__internal__n_header_field_general; - } - ranges = _mm_loadu_si128((__m128i const*) llparse_blob9); - - /* Find first character that does not match `ranges` */ - match_len = _mm_cmpestri(ranges, 2, - input, 16, - _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | - _SIDD_NEGATIVE_POLARITY); - - if (match_len != 0) { - p += match_len; - goto s_n_llhttp__internal__n_header_field_general; - } - goto s_n_llhttp__internal__n_header_field_general_otherwise; - } - #endif /* __SSE4_2__ */ - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_header_field_general; - } - default: { - goto s_n_llhttp__internal__n_header_field_general_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_colon: - s_n_llhttp__internal__n_header_field_colon: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field_colon; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_field_colon; - } - case ':': { - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_9; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_3: - s_n_llhttp__internal__n_header_field_3: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_4: - s_n_llhttp__internal__n_header_field_4: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_4; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_2: - s_n_llhttp__internal__n_header_field_2: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field_2; - } - switch (((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p))) { - case 'n': { - p++; - goto s_n_llhttp__internal__n_header_field_3; - } - case 't': { - p++; - goto s_n_llhttp__internal__n_header_field_4; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_1: - s_n_llhttp__internal__n_header_field_1: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_header_field_2; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_1; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_5: - s_n_llhttp__internal__n_header_field_5: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_5; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_6: - s_n_llhttp__internal__n_header_field_6: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_6; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_7: - s_n_llhttp__internal__n_header_field_7: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_7; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field: - s_n_llhttp__internal__n_header_field: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field; - } - switch (((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p))) { - case 'c': { - p++; - goto s_n_llhttp__internal__n_header_field_1; - } - case 'p': { - p++; - goto s_n_llhttp__internal__n_header_field_5; - } - case 't': { - p++; - goto s_n_llhttp__internal__n_header_field_6; - } - case 'u': { - p++; - goto s_n_llhttp__internal__n_header_field_7; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_header_field: - s_n_llhttp__internal__n_span_start_llhttp__on_header_field: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_header_field; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_header_field; - goto s_n_llhttp__internal__n_header_field; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_start: - s_n_llhttp__internal__n_header_field_start: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field_start; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_headers_almost_done; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_headers_almost_done; - } - default: { - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_field; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_to_http_09: - s_n_llhttp__internal__n_url_to_http_09: { - if (p == endp) { - return s_n_llhttp__internal__n_url_to_http_09; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 12: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_http_major; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_skip_to_http09: - s_n_llhttp__internal__n_url_skip_to_http09: { - if (p == endp) { - return s_n_llhttp__internal__n_url_skip_to_http09; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 12: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - default: { - p++; - goto s_n_llhttp__internal__n_url_to_http_09; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_skip_lf_to_http09_1: - s_n_llhttp__internal__n_url_skip_lf_to_http09_1: { - if (p == endp) { - return s_n_llhttp__internal__n_url_skip_lf_to_http09_1; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_url_to_http_09; - } - default: { - goto s_n_llhttp__internal__n_error_26; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_skip_lf_to_http09: - s_n_llhttp__internal__n_url_skip_lf_to_http09: { - if (p == endp) { - return s_n_llhttp__internal__n_url_skip_lf_to_http09; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 12: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_url_skip_lf_to_http09_1; - } - default: { - goto s_n_llhttp__internal__n_error_26; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_pri_upgrade: - s_n_llhttp__internal__n_req_pri_upgrade: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_req_pri_upgrade; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob15, 10); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_error_29; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_pri_upgrade; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_30; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_complete_1: - s_n_llhttp__internal__n_req_http_complete_1: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_complete_1; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_header_field_start; - } - default: { - goto s_n_llhttp__internal__n_error_28; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_complete: - s_n_llhttp__internal__n_req_http_complete: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_complete; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_header_field_start; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_req_http_complete_1; - } - default: { - goto s_n_llhttp__internal__n_error_28; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_minor: - s_n_llhttp__internal__n_req_http_minor: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_minor; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - default: { - goto s_n_llhttp__internal__n_error_31; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_dot: - s_n_llhttp__internal__n_req_http_dot: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_dot; - } - switch (*p) { - case '.': { - p++; - goto s_n_llhttp__internal__n_req_http_minor; - } - default: { - goto s_n_llhttp__internal__n_error_32; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_major: - s_n_llhttp__internal__n_req_http_major: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_major; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - default: { - goto s_n_llhttp__internal__n_error_33; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_start_1: - s_n_llhttp__internal__n_req_http_start_1: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_load_method; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_http_start_1; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_36; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_start_2: - s_n_llhttp__internal__n_req_http_start_2: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_load_method_2; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_http_start_2; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_36; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_start_3: - s_n_llhttp__internal__n_req_http_start_3: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_load_method_3; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_http_start_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_36; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_start: - s_n_llhttp__internal__n_req_http_start: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_start; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_req_http_start; - } - case 'H': { - p++; - goto s_n_llhttp__internal__n_req_http_start_1; - } - case 'I': { - p++; - goto s_n_llhttp__internal__n_req_http_start_2; - } - case 'R': { - p++; - goto s_n_llhttp__internal__n_req_http_start_3; - } - default: { - goto s_n_llhttp__internal__n_error_36; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_to_http: - s_n_llhttp__internal__n_url_to_http: { - if (p == endp) { - return s_n_llhttp__internal__n_url_to_http; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 12: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - default: { - goto s_n_llhttp__internal__n_invoke_llhttp__on_url_complete_1; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_skip_to_http: - s_n_llhttp__internal__n_url_skip_to_http: { - if (p == endp) { - return s_n_llhttp__internal__n_url_skip_to_http; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 12: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - default: { - p++; - goto s_n_llhttp__internal__n_url_to_http; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_fragment: - s_n_llhttp__internal__n_url_fragment: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 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, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_fragment; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 2: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_6; - } - case 3: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_7; - } - case 4: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_8; - } - case 5: { - p++; - goto s_n_llhttp__internal__n_url_fragment; - } - default: { - goto s_n_llhttp__internal__n_error_37; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_end_stub_query_3: - s_n_llhttp__internal__n_span_end_stub_query_3: { - if (p == endp) { - return s_n_llhttp__internal__n_span_end_stub_query_3; - } - p++; - goto s_n_llhttp__internal__n_url_fragment; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_query: - s_n_llhttp__internal__n_url_query: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 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, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_query; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 2: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_9; - } - case 3: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_10; - } - case 4: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_11; - } - case 5: { - p++; - goto s_n_llhttp__internal__n_url_query; - } - case 6: { - goto s_n_llhttp__internal__n_span_end_stub_query_3; - } - default: { - goto s_n_llhttp__internal__n_error_38; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_query_or_fragment: - s_n_llhttp__internal__n_url_query_or_fragment: { - if (p == endp) { - return s_n_llhttp__internal__n_url_query_or_fragment; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 10: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_3; - } - case 12: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 13: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_4; - } - case ' ': { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_5; - } - case '#': { - p++; - goto s_n_llhttp__internal__n_url_fragment; - } - case '?': { - p++; - goto s_n_llhttp__internal__n_url_query; - } - default: { - goto s_n_llhttp__internal__n_error_39; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_path: - s_n_llhttp__internal__n_url_path: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 2, 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, 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, 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, 2, 2, 2, 2, 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, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_path; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 2: { - p++; - goto s_n_llhttp__internal__n_url_path; - } - default: { - goto s_n_llhttp__internal__n_url_query_or_fragment; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_stub_path_2: - s_n_llhttp__internal__n_span_start_stub_path_2: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_stub_path_2; - } - p++; - goto s_n_llhttp__internal__n_url_path; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_stub_path: - s_n_llhttp__internal__n_span_start_stub_path: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_stub_path; - } - p++; - goto s_n_llhttp__internal__n_url_path; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_stub_path_1: - s_n_llhttp__internal__n_span_start_stub_path_1: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_stub_path_1; - } - p++; - goto s_n_llhttp__internal__n_url_path; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_server_with_at: - s_n_llhttp__internal__n_url_server_with_at: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 5, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 0, 7, - 8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 0, 5, - 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 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, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_server_with_at; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 2: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_12; - } - case 3: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_13; - } - case 4: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_14; - } - case 5: { - p++; - goto s_n_llhttp__internal__n_url_server; - } - case 6: { - goto s_n_llhttp__internal__n_span_start_stub_path_1; - } - case 7: { - p++; - goto s_n_llhttp__internal__n_url_query; - } - case 8: { - p++; - goto s_n_llhttp__internal__n_error_40; - } - default: { - goto s_n_llhttp__internal__n_error_41; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_server: - s_n_llhttp__internal__n_url_server: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 5, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 0, 7, - 8, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 0, 5, - 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 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, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_server; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 2: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url; - } - case 3: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_1; - } - case 4: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_2; - } - case 5: { - p++; - goto s_n_llhttp__internal__n_url_server; - } - case 6: { - goto s_n_llhttp__internal__n_span_start_stub_path; - } - case 7: { - p++; - goto s_n_llhttp__internal__n_url_query; - } - case 8: { - p++; - goto s_n_llhttp__internal__n_url_server_with_at; - } - default: { - goto s_n_llhttp__internal__n_error_42; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_schema_delim_1: - s_n_llhttp__internal__n_url_schema_delim_1: { - if (p == endp) { - return s_n_llhttp__internal__n_url_schema_delim_1; - } - switch (*p) { - case '/': { - p++; - goto s_n_llhttp__internal__n_url_server; - } - default: { - goto s_n_llhttp__internal__n_error_44; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_schema_delim: - s_n_llhttp__internal__n_url_schema_delim: { - if (p == endp) { - return s_n_llhttp__internal__n_url_schema_delim; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 10: { - p++; - goto s_n_llhttp__internal__n_error_43; - } - case 12: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_error_43; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_error_43; - } - case '/': { - p++; - goto s_n_llhttp__internal__n_url_schema_delim_1; - } - default: { - goto s_n_llhttp__internal__n_error_44; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_end_stub_schema: - s_n_llhttp__internal__n_span_end_stub_schema: { - if (p == endp) { - return s_n_llhttp__internal__n_span_end_stub_schema; - } - p++; - goto s_n_llhttp__internal__n_url_schema_delim; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_schema: - s_n_llhttp__internal__n_url_schema: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 2, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 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, 3, 0, 0, 0, 0, 0, - 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, - 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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, 0, 0, 0, 0, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_schema; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 2: { - p++; - goto s_n_llhttp__internal__n_error_43; - } - case 3: { - goto s_n_llhttp__internal__n_span_end_stub_schema; - } - case 4: { - p++; - goto s_n_llhttp__internal__n_url_schema; - } - default: { - goto s_n_llhttp__internal__n_error_45; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_start: - s_n_llhttp__internal__n_url_start: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 2, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, - 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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, 0, 0, 0, 0, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_start; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 2: { - p++; - goto s_n_llhttp__internal__n_error_43; - } - case 3: { - goto s_n_llhttp__internal__n_span_start_stub_path_2; - } - case 4: { - goto s_n_llhttp__internal__n_url_schema; - } - default: { - goto s_n_llhttp__internal__n_error_46; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_url_1: - s_n_llhttp__internal__n_span_start_llhttp__on_url_1: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_url_1; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_url; - goto s_n_llhttp__internal__n_url_start; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_entry_normal: - s_n_llhttp__internal__n_url_entry_normal: { - if (p == endp) { - return s_n_llhttp__internal__n_url_entry_normal; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 12: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - default: { - goto s_n_llhttp__internal__n_span_start_llhttp__on_url_1; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_url: - s_n_llhttp__internal__n_span_start_llhttp__on_url: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_url; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_url; - goto s_n_llhttp__internal__n_url_server; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_entry_connect: - s_n_llhttp__internal__n_url_entry_connect: { - if (p == endp) { - return s_n_llhttp__internal__n_url_entry_connect; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - case 12: { - p++; - goto s_n_llhttp__internal__n_error_1; - } - default: { - goto s_n_llhttp__internal__n_span_start_llhttp__on_url; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_spaces_before_url: - s_n_llhttp__internal__n_req_spaces_before_url: { - if (p == endp) { - return s_n_llhttp__internal__n_req_spaces_before_url; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_req_spaces_before_url; - } - default: { - goto s_n_llhttp__internal__n_invoke_is_equal_method; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_first_space_before_url: - s_n_llhttp__internal__n_req_first_space_before_url: { - if (p == endp) { - return s_n_llhttp__internal__n_req_first_space_before_url; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_req_spaces_before_url; - } - default: { - goto s_n_llhttp__internal__n_error_47; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_2: - s_n_llhttp__internal__n_start_req_2: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_2; - } - switch (*p) { - case 'L': { - p++; - match = 19; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_3: - s_n_llhttp__internal__n_start_req_3: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_3; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob18, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 36; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_1: - s_n_llhttp__internal__n_start_req_1: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_1; - } - switch (*p) { - case 'C': { - p++; - goto s_n_llhttp__internal__n_start_req_2; - } - case 'N': { - p++; - goto s_n_llhttp__internal__n_start_req_3; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_4: - s_n_llhttp__internal__n_start_req_4: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_4; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob19, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 16; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_4; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_6: - s_n_llhttp__internal__n_start_req_6: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_6; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob20, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 22; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_6; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_8: - s_n_llhttp__internal__n_start_req_8: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_8; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob21, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_8; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_9: - s_n_llhttp__internal__n_start_req_9: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_9; - } - switch (*p) { - case 'Y': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_7: - s_n_llhttp__internal__n_start_req_7: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_7; - } - switch (*p) { - case 'N': { - p++; - goto s_n_llhttp__internal__n_start_req_8; - } - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_9; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_5: - s_n_llhttp__internal__n_start_req_5: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_5; - } - switch (*p) { - case 'H': { - p++; - goto s_n_llhttp__internal__n_start_req_6; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_7; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_12: - s_n_llhttp__internal__n_start_req_12: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_12; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob22, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_12; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_13: - s_n_llhttp__internal__n_start_req_13: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_13; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob23, 5); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 35; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_13; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_11: - s_n_llhttp__internal__n_start_req_11: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_11; - } - switch (*p) { - case 'L': { - p++; - goto s_n_llhttp__internal__n_start_req_12; - } - case 'S': { - p++; - goto s_n_llhttp__internal__n_start_req_13; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_10: - s_n_llhttp__internal__n_start_req_10: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_10; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_11; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_14: - s_n_llhttp__internal__n_start_req_14: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_14; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob24, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 45; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_14; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_17: - s_n_llhttp__internal__n_start_req_17: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_17; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob26, 9); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 41; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_17; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_16: - s_n_llhttp__internal__n_start_req_16: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_16; - } - switch (*p) { - case '_': { - p++; - goto s_n_llhttp__internal__n_start_req_17; - } - default: { - match = 1; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_15: - s_n_llhttp__internal__n_start_req_15: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_15; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob25, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_start_req_16; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_15; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_18: - s_n_llhttp__internal__n_start_req_18: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_18; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob27, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_18; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_20: - s_n_llhttp__internal__n_start_req_20: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_20; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob28, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 31; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_20; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_21: - s_n_llhttp__internal__n_start_req_21: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_21; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob29, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_21; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_19: - s_n_llhttp__internal__n_start_req_19: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_19; - } - switch (*p) { - case 'I': { - p++; - goto s_n_llhttp__internal__n_start_req_20; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_21; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_23: - s_n_llhttp__internal__n_start_req_23: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_23; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob30, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 24; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_23; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_24: - s_n_llhttp__internal__n_start_req_24: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_24; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob31, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 23; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_24; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_26: - s_n_llhttp__internal__n_start_req_26: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_26; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob32, 7); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 21; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_26; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_28: - s_n_llhttp__internal__n_start_req_28: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_28; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob33, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 30; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_28; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_29: - s_n_llhttp__internal__n_start_req_29: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_29; - } - switch (*p) { - case 'L': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_27: - s_n_llhttp__internal__n_start_req_27: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_27; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_28; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_29; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_25: - s_n_llhttp__internal__n_start_req_25: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_25; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_26; - } - case 'C': { - p++; - goto s_n_llhttp__internal__n_start_req_27; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_30: - s_n_llhttp__internal__n_start_req_30: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_30; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob34, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_30; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_22: - s_n_llhttp__internal__n_start_req_22: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_22; - } - switch (*p) { - case '-': { - p++; - goto s_n_llhttp__internal__n_start_req_23; - } - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_24; - } - case 'K': { - p++; - goto s_n_llhttp__internal__n_start_req_25; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_30; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_31: - s_n_llhttp__internal__n_start_req_31: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_31; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob35, 5); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 25; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_31; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_32: - s_n_llhttp__internal__n_start_req_32: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_32; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob36, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_32; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_35: - s_n_llhttp__internal__n_start_req_35: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_35; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob37, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 28; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_35; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_36: - s_n_llhttp__internal__n_start_req_36: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_36; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob38, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 39; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_36; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_34: - s_n_llhttp__internal__n_start_req_34: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_34; - } - switch (*p) { - case 'T': { - p++; - goto s_n_llhttp__internal__n_start_req_35; - } - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_36; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_37: - s_n_llhttp__internal__n_start_req_37: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_37; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob39, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 38; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_37; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_38: - s_n_llhttp__internal__n_start_req_38: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_38; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob40, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_38; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_42: - s_n_llhttp__internal__n_start_req_42: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_42; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob41, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_42; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_43: - s_n_llhttp__internal__n_start_req_43: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_43; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob42, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_43; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_41: - s_n_llhttp__internal__n_start_req_41: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_41; - } - switch (*p) { - case 'F': { - p++; - goto s_n_llhttp__internal__n_start_req_42; - } - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_43; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_40: - s_n_llhttp__internal__n_start_req_40: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_40; - } - switch (*p) { - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_41; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_39: - s_n_llhttp__internal__n_start_req_39: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_39; - } - switch (*p) { - case 'I': { - p++; - match = 34; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_40; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_45: - s_n_llhttp__internal__n_start_req_45: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_45; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob43, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 29; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_45; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_44: - s_n_llhttp__internal__n_start_req_44: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_44; - } - switch (*p) { - case 'R': { - p++; - goto s_n_llhttp__internal__n_start_req_45; - } - case 'T': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_33: - s_n_llhttp__internal__n_start_req_33: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_33; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_34; - } - case 'L': { - p++; - goto s_n_llhttp__internal__n_start_req_37; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_38; - } - case 'R': { - p++; - goto s_n_llhttp__internal__n_start_req_39; - } - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_44; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_48: - s_n_llhttp__internal__n_start_req_48: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_48; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob44, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 17; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_48; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_49: - s_n_llhttp__internal__n_start_req_49: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_49; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob45, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 44; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_49; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_50: - s_n_llhttp__internal__n_start_req_50: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_50; - } - 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_start_req_50; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_51: - s_n_llhttp__internal__n_start_req_51: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_51; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob47, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 20; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_51; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_47: - s_n_llhttp__internal__n_start_req_47: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_47; - } - switch (*p) { - case 'B': { - p++; - goto s_n_llhttp__internal__n_start_req_48; - } - case 'C': { - p++; - goto s_n_llhttp__internal__n_start_req_49; - } - case 'D': { - p++; - goto s_n_llhttp__internal__n_start_req_50; - } - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_51; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_46: - s_n_llhttp__internal__n_start_req_46: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_46; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_47; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_54: - s_n_llhttp__internal__n_start_req_54: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_54; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob48, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_54; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_56: - s_n_llhttp__internal__n_start_req_56: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_56; - } - switch (*p) { - case 'P': { - p++; - match = 37; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_57: - s_n_llhttp__internal__n_start_req_57: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_57; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob49, 9); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 42; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_57; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_55: - s_n_llhttp__internal__n_start_req_55: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_55; - } - switch (*p) { - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_56; - } - case '_': { - p++; - goto s_n_llhttp__internal__n_start_req_57; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_53: - s_n_llhttp__internal__n_start_req_53: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_53; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_54; - } - case 'T': { - p++; - goto s_n_llhttp__internal__n_start_req_55; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_58: - s_n_llhttp__internal__n_start_req_58: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_58; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob50, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 33; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_58; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_59: - s_n_llhttp__internal__n_start_req_59: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_59; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob51, 7); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 26; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_59; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_52: - s_n_llhttp__internal__n_start_req_52: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_52; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_53; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_58; - } - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_59; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_61: - s_n_llhttp__internal__n_start_req_61: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_61; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob52, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 40; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_61; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_62: - s_n_llhttp__internal__n_start_req_62: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_62; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob53, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_62; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_60: - s_n_llhttp__internal__n_start_req_60: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_60; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_61; - } - case 'R': { - p++; - goto s_n_llhttp__internal__n_start_req_62; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_65: - s_n_llhttp__internal__n_start_req_65: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_65; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob54, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 18; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_65; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_67: - s_n_llhttp__internal__n_start_req_67: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_67; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob55, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 32; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_67; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_68: - s_n_llhttp__internal__n_start_req_68: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_68; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob56, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_68; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_66: - s_n_llhttp__internal__n_start_req_66: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_66; - } - switch (*p) { - case 'I': { - p++; - goto s_n_llhttp__internal__n_start_req_67; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_68; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_69: - s_n_llhttp__internal__n_start_req_69: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_69; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob57, 8); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 27; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_69; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_64: - s_n_llhttp__internal__n_start_req_64: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_64; - } - switch (*p) { - case 'B': { - p++; - goto s_n_llhttp__internal__n_start_req_65; - } - case 'L': { - p++; - goto s_n_llhttp__internal__n_start_req_66; - } - case 'S': { - p++; - goto s_n_llhttp__internal__n_start_req_69; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_63: - s_n_llhttp__internal__n_start_req_63: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_63; - } - switch (*p) { - case 'N': { - p++; - goto s_n_llhttp__internal__n_start_req_64; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req: - s_n_llhttp__internal__n_start_req: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_1; - } - case 'B': { - p++; - goto s_n_llhttp__internal__n_start_req_4; - } - case 'C': { - p++; - goto s_n_llhttp__internal__n_start_req_5; - } - case 'D': { - p++; - goto s_n_llhttp__internal__n_start_req_10; - } - case 'F': { - p++; - goto s_n_llhttp__internal__n_start_req_14; - } - case 'G': { - p++; - goto s_n_llhttp__internal__n_start_req_15; - } - case 'H': { - p++; - goto s_n_llhttp__internal__n_start_req_18; - } - case 'L': { - p++; - goto s_n_llhttp__internal__n_start_req_19; - } - case 'M': { - p++; - goto s_n_llhttp__internal__n_start_req_22; - } - case 'N': { - p++; - goto s_n_llhttp__internal__n_start_req_31; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_32; - } - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_33; - } - case 'R': { - p++; - goto s_n_llhttp__internal__n_start_req_46; - } - case 'S': { - p++; - goto s_n_llhttp__internal__n_start_req_52; - } - case 'T': { - p++; - goto s_n_llhttp__internal__n_start_req_60; - } - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_63; - } - default: { - goto s_n_llhttp__internal__n_error_56; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_llhttp__on_status_complete: - s_n_llhttp__internal__n_invoke_llhttp__on_status_complete: { - switch (llhttp__on_status_complete(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_start; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_line_almost_done: - s_n_llhttp__internal__n_res_line_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_res_line_almost_done; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_status_complete; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_status: - s_n_llhttp__internal__n_res_status: { - if (p == endp) { - return s_n_llhttp__internal__n_res_status; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_status; - } - case 13: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_status_1; - } - default: { - p++; - goto s_n_llhttp__internal__n_res_status; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_status: - s_n_llhttp__internal__n_span_start_llhttp__on_status: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_status; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_status; - goto s_n_llhttp__internal__n_res_status; - /* 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) { - return s_n_llhttp__internal__n_res_status_code_otherwise; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_res_status_start; - } - case 13: { - goto s_n_llhttp__internal__n_res_status_start; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_res_status_start; - } - default: { - goto s_n_llhttp__internal__n_error_50; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_status_code: - s_n_llhttp__internal__n_res_status_code: { - if (p == endp) { - return s_n_llhttp__internal__n_res_status_code; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - default: { - goto s_n_llhttp__internal__n_res_status_code_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_http_end: - s_n_llhttp__internal__n_res_http_end: { - if (p == endp) { - return s_n_llhttp__internal__n_res_http_end; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_invoke_update_status_code; - } - default: { - goto s_n_llhttp__internal__n_error_51; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_http_minor: - s_n_llhttp__internal__n_res_http_minor: { - if (p == endp) { - return s_n_llhttp__internal__n_res_http_minor; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - default: { - goto s_n_llhttp__internal__n_error_52; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_http_dot: - s_n_llhttp__internal__n_res_http_dot: { - if (p == endp) { - return s_n_llhttp__internal__n_res_http_dot; - } - switch (*p) { - case '.': { - p++; - goto s_n_llhttp__internal__n_res_http_minor; - } - default: { - goto s_n_llhttp__internal__n_error_53; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_http_major: - s_n_llhttp__internal__n_res_http_major: { - if (p == endp) { - return s_n_llhttp__internal__n_res_http_major; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - default: { - goto s_n_llhttp__internal__n_error_54; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_res: - s_n_llhttp__internal__n_start_res: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_res; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob58, 5); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_res_http_major; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_res; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_57; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_or_res_method_2: - s_n_llhttp__internal__n_req_or_res_method_2: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_req_or_res_method_2; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob59, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_method; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_or_res_method_2; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_55; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_or_res_method_3: - s_n_llhttp__internal__n_req_or_res_method_3: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_req_or_res_method_3; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob60, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_update_type_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_or_res_method_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_55; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_or_res_method_1: - s_n_llhttp__internal__n_req_or_res_method_1: { - if (p == endp) { - return s_n_llhttp__internal__n_req_or_res_method_1; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_req_or_res_method_2; - } - case 'T': { - p++; - goto s_n_llhttp__internal__n_req_or_res_method_3; - } - default: { - goto s_n_llhttp__internal__n_error_55; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_or_res_method: - s_n_llhttp__internal__n_req_or_res_method: { - if (p == endp) { - return s_n_llhttp__internal__n_req_or_res_method; - } - switch (*p) { - case 'H': { - p++; - goto s_n_llhttp__internal__n_req_or_res_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_55; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_or_res: - s_n_llhttp__internal__n_start_req_or_res: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_or_res; - } - switch (*p) { - case 'H': { - goto s_n_llhttp__internal__n_req_or_res_method; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_type_2; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_load_type: - s_n_llhttp__internal__n_invoke_load_type: { - switch (llhttp__internal__c_load_type(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_start_req; - case 2: - goto s_n_llhttp__internal__n_start_res; - default: - goto s_n_llhttp__internal__n_start_req_or_res; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start: - s_n_llhttp__internal__n_start: { - if (p == endp) { - return s_n_llhttp__internal__n_start; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_start; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_start; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_finish; - } - } - /* UNREACHABLE */; - abort(); - } - default: - /* UNREACHABLE */ - abort(); - } - s_n_llhttp__internal__n_error_1: { - state->error = 0x7; - state->reason = "Invalid characters in url (strict mode)"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_43: { - state->error = 0x7; - state->reason = "Invalid characters in url"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_finish_2: { - switch (llhttp__internal__c_update_finish_1(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_start; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_4: { - state->error = 0x5; - state->reason = "Data after `Connection: close`"; - 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: { - switch (llhttp__internal__c_test_lenient_flags(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_invoke_update_finish_2; - default: - goto s_n_llhttp__internal__n_closed; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_finish_1: { - switch (llhttp__internal__c_update_finish_1(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_test_lenient_flags; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_pause_5: { - 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_13: { - 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_7: { - 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_16: { - 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_7; - default: - goto s_n_llhttp__internal__n_error_16; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_15: { - 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_pause_2: { - 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_pause_1; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_5: { - 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_invoke_llhttp__on_message_complete_1: { - switch (llhttp__on_message_complete(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_pause_1; - case 21: - goto s_n_llhttp__internal__n_pause_2; - default: - goto s_n_llhttp__internal__n_error_5; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_11: { - state->error = 0xc; - state->reason = "Chunk size overflow"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_pause_3: { - 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_update_content_length; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_7: { - 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: { - switch (llhttp__on_chunk_complete(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_invoke_update_content_length; - case 21: - goto s_n_llhttp__internal__n_pause_3; - default: - goto s_n_llhttp__internal__n_error_7; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_8: { - state->error = 0x2; - state->reason = "Expected CRLF after chunk"; - 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: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_body(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_chunk_data_almost_done; - return s_error; - } - goto s_n_llhttp__internal__n_chunk_data_almost_done; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags: { - switch (llhttp__internal__c_or_flags(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_start; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_pause_4: { - state->error = 0x15; - state->reason = "on_chunk_header pause"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_is_equal_content_length; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_6: { - state->error = 0x13; - state->reason = "`on_chunk_header` 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_header: { - switch (llhttp__on_chunk_header(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_invoke_is_equal_content_length; - case 21: - goto s_n_llhttp__internal__n_pause_4; - default: - goto s_n_llhttp__internal__n_error_6; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_9: { - state->error = 0x2; - state->reason = "Expected LF 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_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_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_11; - default: - goto s_n_llhttp__internal__n_chunk_size; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_12: { - 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_span_end_llhttp__on_body_1: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_body(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_llhttp__on_message_complete_2; - return s_error; - } - goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_finish_3: { - switch (llhttp__internal__c_update_finish_3(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_span_start_llhttp__on_body_2; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_14: { - state->error = 0xf; - state->reason = "Request has invalid `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_pause: { - 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_llhttp__after_message_complete; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_3: { - 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_invoke_llhttp__on_message_complete: { - switch (llhttp__on_message_complete(state, p, endp)) { - case 0: - 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_3; - } - /* 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_6: { - 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_2: { - 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_6; - default: - goto s_n_llhttp__internal__n_error_2; - } - /* 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_lenient_flags_1: { - switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_error_15; - default: - goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete; - } - /* 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_1; - 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; - default: - goto s_n_llhttp__internal__n_invoke_test_flags_1; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_17: { - state->error = 0x2; - state->reason = "Expected LF after headers"; - 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 = 0xb; - state->reason = "Empty 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_span_end_llhttp__on_header_value: { - 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_llhttp__on_header_value_complete; - return s_error; - } - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state: { - switch (llhttp__internal__c_update_header_state(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_3: { - switch (llhttp__internal__c_or_flags_3(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)) { - 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)) { - 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)) { - 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: { - switch (llhttp__internal__c_load_header_state(state, p, endp)) { - case 5: - goto s_n_llhttp__internal__n_invoke_or_flags_3; - case 6: - goto s_n_llhttp__internal__n_invoke_or_flags_4; - case 7: - goto s_n_llhttp__internal__n_invoke_or_flags_5; - case 8: - goto s_n_llhttp__internal__n_invoke_or_flags_6; - default: - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value; - } - /* UNREACHABLE */; - abort(); - } - 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_error_18; - default: - goto s_n_llhttp__internal__n_invoke_load_header_state_1; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_19: { - state->error = 0x2; - state->reason = "Expected LF after CR"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_1: { - switch (llhttp__internal__c_update_header_state(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_7: { - switch (llhttp__internal__c_or_flags_3(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_header_state_1; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_8: { - switch (llhttp__internal__c_or_flags_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_header_state_1; - } - /* UNREACHABLE */; - abort(); - } - 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_1; - } - /* UNREACHABLE */; - abort(); - } - 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_llhttp__on_header_value_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_header_state_3: { - switch (llhttp__internal__c_load_header_state(state, p, endp)) { - case 5: - goto s_n_llhttp__internal__n_invoke_or_flags_7; - case 6: - goto s_n_llhttp__internal__n_invoke_or_flags_8; - case 7: - goto s_n_llhttp__internal__n_invoke_or_flags_9; - case 8: - goto s_n_llhttp__internal__n_invoke_or_flags_10; - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_20: { - 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_span_end_llhttp__on_header_value_1: { - 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_header_value_almost_done; - return s_error; - } - goto s_n_llhttp__internal__n_header_value_almost_done; - /* 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); - if (err != 0) { - state->error = err; - state->error_pos = (const char*) (p + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_almost_done; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_header_value_almost_done; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3: { - 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 + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_almost_done; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_header_value_almost_done; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_21: { - state->error = 0xa; - state->reason = "Invalid header value char"; - 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_2: { - switch (llhttp__internal__c_test_lenient_flags_2(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_header_value_lenient; - default: - goto s_n_llhttp__internal__n_error_21; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_3: { - switch (llhttp__internal__c_update_header_state(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_11: { - switch (llhttp__internal__c_or_flags_3(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_header_state_3; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_12: { - switch (llhttp__internal__c_or_flags_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_header_state_3; - } - /* UNREACHABLE */; - abort(); - } - 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_3; - } - /* UNREACHABLE */; - abort(); - } - 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_header_value_connection; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_header_state_4: { - switch (llhttp__internal__c_load_header_state(state, p, endp)) { - case 5: - goto s_n_llhttp__internal__n_invoke_or_flags_11; - case 6: - goto s_n_llhttp__internal__n_invoke_or_flags_12; - case 7: - goto s_n_llhttp__internal__n_invoke_or_flags_13; - case 8: - goto s_n_llhttp__internal__n_invoke_or_flags_14; - default: - goto s_n_llhttp__internal__n_header_value_connection; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_4: { - switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection_token; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_2: { - switch (llhttp__internal__c_update_header_state_2(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection_ws; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_5: { - switch (llhttp__internal__c_update_header_state_5(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection_ws; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_6: { - switch (llhttp__internal__c_update_header_state_6(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection_ws; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4: { - 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_error_23; - return s_error; - } - goto s_n_llhttp__internal__n_error_23; - /* 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_4; - 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)) { - default: - goto s_n_llhttp__internal__n_header_value_otherwise; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_5: { - 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_error_24; - return s_error; - } - goto s_n_llhttp__internal__n_error_24; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_22: { - state->error = 0x4; - state->reason = "Duplicate 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_flags_2: { - switch (llhttp__internal__c_test_flags_2(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_header_value_content_length; - default: - goto s_n_llhttp__internal__n_error_22; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_7: { - switch (llhttp__internal__c_update_header_state_7(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_otherwise; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_8: { - switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_and_flags: { - switch (llhttp__internal__c_and_flags(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_te_chunked; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_16: { - switch (llhttp__internal__c_or_flags_16(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_and_flags; - } - /* UNREACHABLE */; - abort(); - } - 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_invoke_update_header_state_8; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_header_state_2: { - switch (llhttp__internal__c_load_header_state(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_header_value_connection; - case 2: - goto s_n_llhttp__internal__n_invoke_test_flags_2; - case 3: - goto s_n_llhttp__internal__n_invoke_or_flags_16; - case 4: - goto s_n_llhttp__internal__n_invoke_or_flags_17; - default: - goto s_n_llhttp__internal__n_header_value; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_field: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_header_field(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_header_field_complete; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_field_complete; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_field_1: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_header_field(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_header_field_complete; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_field_complete; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_25: { - 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_invoke_update_header_state_9: { - switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_general; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_header_state: { - switch (llhttp__internal__c_store_header_state(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_header_field_colon; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_10: { - switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_general; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_llhttp__on_url_complete: { - switch (llhttp__on_url_complete(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_start; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_http_minor: { - switch (llhttp__internal__c_update_http_minor(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_url_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_http_major: { - switch (llhttp__internal__c_update_http_major(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_http_minor; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_3: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_26: { - state->error = 0x7; - state->reason = "Expected CRLF"; - 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_url_4: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_29: { - state->error = 0x17; - state->reason = "Pause on PRI/Upgrade"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_30: { - state->error = 0x9; - state->reason = "Expected HTTP/2 Connection Preface"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_28: { - 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_invoke_load_method_1: { - switch (llhttp__internal__c_load_method(state, p, endp)) { - case 34: - goto s_n_llhttp__internal__n_req_pri_upgrade; - default: - goto s_n_llhttp__internal__n_req_http_complete; - } - /* UNREACHABLE */; - abort(); - } - 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_load_method_1; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_31: { - state->error = 0x9; - state->reason = "Invalid minor version"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_32: { - state->error = 0x9; - state->reason = "Expected dot"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_http_major: { - switch (llhttp__internal__c_store_http_major(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_req_http_dot; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_33: { - state->error = 0x9; - state->reason = "Invalid major version"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_27: { - state->error = 0x8; - state->reason = "Invalid method for HTTP/x.x request"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_method: { - switch (llhttp__internal__c_load_method(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_req_http_major; - case 1: - goto s_n_llhttp__internal__n_req_http_major; - case 2: - goto s_n_llhttp__internal__n_req_http_major; - case 3: - goto s_n_llhttp__internal__n_req_http_major; - case 4: - goto s_n_llhttp__internal__n_req_http_major; - case 5: - goto s_n_llhttp__internal__n_req_http_major; - case 6: - goto s_n_llhttp__internal__n_req_http_major; - case 7: - goto s_n_llhttp__internal__n_req_http_major; - case 8: - goto s_n_llhttp__internal__n_req_http_major; - case 9: - goto s_n_llhttp__internal__n_req_http_major; - case 10: - goto s_n_llhttp__internal__n_req_http_major; - case 11: - goto s_n_llhttp__internal__n_req_http_major; - case 12: - goto s_n_llhttp__internal__n_req_http_major; - case 13: - goto s_n_llhttp__internal__n_req_http_major; - case 14: - goto s_n_llhttp__internal__n_req_http_major; - case 15: - goto s_n_llhttp__internal__n_req_http_major; - case 16: - goto s_n_llhttp__internal__n_req_http_major; - case 17: - goto s_n_llhttp__internal__n_req_http_major; - case 18: - goto s_n_llhttp__internal__n_req_http_major; - case 19: - goto s_n_llhttp__internal__n_req_http_major; - case 20: - goto s_n_llhttp__internal__n_req_http_major; - case 21: - goto s_n_llhttp__internal__n_req_http_major; - case 22: - goto s_n_llhttp__internal__n_req_http_major; - case 23: - goto s_n_llhttp__internal__n_req_http_major; - case 24: - goto s_n_llhttp__internal__n_req_http_major; - case 25: - goto s_n_llhttp__internal__n_req_http_major; - case 26: - goto s_n_llhttp__internal__n_req_http_major; - case 27: - goto s_n_llhttp__internal__n_req_http_major; - case 28: - goto s_n_llhttp__internal__n_req_http_major; - case 29: - goto s_n_llhttp__internal__n_req_http_major; - case 30: - goto s_n_llhttp__internal__n_req_http_major; - case 31: - goto s_n_llhttp__internal__n_req_http_major; - case 32: - goto s_n_llhttp__internal__n_req_http_major; - case 33: - goto s_n_llhttp__internal__n_req_http_major; - case 34: - goto s_n_llhttp__internal__n_req_http_major; - default: - goto s_n_llhttp__internal__n_error_27; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_36: { - state->error = 0x8; - state->reason = "Expected HTTP/"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_34: { - state->error = 0x8; - state->reason = "Expected SOURCE method for ICE/x.x request"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_method_2: { - switch (llhttp__internal__c_load_method(state, p, endp)) { - case 33: - goto s_n_llhttp__internal__n_req_http_major; - default: - goto s_n_llhttp__internal__n_error_34; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_35: { - state->error = 0x8; - state->reason = "Invalid method for RTSP/x.x request"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_method_3: { - switch (llhttp__internal__c_load_method(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_req_http_major; - case 3: - goto s_n_llhttp__internal__n_req_http_major; - case 6: - goto s_n_llhttp__internal__n_req_http_major; - case 35: - goto s_n_llhttp__internal__n_req_http_major; - case 36: - goto s_n_llhttp__internal__n_req_http_major; - case 37: - goto s_n_llhttp__internal__n_req_http_major; - case 38: - goto s_n_llhttp__internal__n_req_http_major; - case 39: - goto s_n_llhttp__internal__n_req_http_major; - case 40: - goto s_n_llhttp__internal__n_req_http_major; - case 41: - goto s_n_llhttp__internal__n_req_http_major; - case 42: - goto s_n_llhttp__internal__n_req_http_major; - case 43: - goto s_n_llhttp__internal__n_req_http_major; - case 44: - goto s_n_llhttp__internal__n_req_http_major; - case 45: - goto s_n_llhttp__internal__n_req_http_major; - default: - goto s_n_llhttp__internal__n_error_35; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_llhttp__on_url_complete_1: { - switch (llhttp__on_url_complete(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_req_http_start; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_5: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_6: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_7: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_8: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_37: { - state->error = 0x7; - state->reason = "Invalid char in url fragment start"; - 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_url_9: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_10: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_11: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_38: { - state->error = 0x7; - state->reason = "Invalid char in url query"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_39: { - state->error = 0x7; - state->reason = "Invalid char in url path"; - 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_url: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_1: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_2: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_12: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_13: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_14: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_40: { - state->error = 0x7; - state->reason = "Double @ in url"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_41: { - state->error = 0x7; - state->reason = "Unexpected char in url server"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_42: { - state->error = 0x7; - state->reason = "Unexpected char in url server"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_44: { - state->error = 0x7; - state->reason = "Unexpected char in url schema"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_45: { - state->error = 0x7; - state->reason = "Unexpected char in url schema"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_46: { - state->error = 0x7; - state->reason = "Unexpected start char in url"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_is_equal_method: { - switch (llhttp__internal__c_is_equal_method(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_url_entry_normal; - default: - goto s_n_llhttp__internal__n_url_entry_connect; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_47: { - state->error = 0x6; - state->reason = "Expected space after method"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_method_1: { - switch (llhttp__internal__c_store_method(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_req_first_space_before_url; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_56: { - state->error = 0x6; - state->reason = "Invalid method encountered"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_48: { - state->error = 0xd; - state->reason = "Response overflow"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - 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_48; - default: - goto s_n_llhttp__internal__n_res_status_code; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_49: { - state->error = 0x2; - state->reason = "Expected LF after CR"; - 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; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_status(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_status_complete; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_status_complete; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_status_1: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_status(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_res_line_almost_done; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_res_line_almost_done; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_50: { - 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_update_status_code: { - switch (llhttp__internal__c_update_status_code(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_res_status_code; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_51: { - state->error = 0x9; - state->reason = "Expected space 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_invoke_store_http_minor_1: { - switch (llhttp__internal__c_store_http_minor(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_res_http_end; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_52: { - state->error = 0x9; - state->reason = "Invalid minor version"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_53: { - state->error = 0x9; - state->reason = "Expected dot"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_http_major_1: { - switch (llhttp__internal__c_store_http_major(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_res_http_dot; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_54: { - state->error = 0x9; - state->reason = "Invalid major version"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_57: { - state->error = 0x8; - state->reason = "Expected HTTP/"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_type: { - switch (llhttp__internal__c_update_type(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_req_first_space_before_url; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_method: { - switch (llhttp__internal__c_store_method(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_invoke_update_type; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_55: { - state->error = 0x8; - state->reason = "Invalid word encountered"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_type_1: { - switch (llhttp__internal__c_update_type_1(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_res_http_major; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_type_2: { - switch (llhttp__internal__c_update_type(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_start_req; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_pause_8: { - state->error = 0x15; - state->reason = "on_message_begin pause"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_load_type; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error: { - state->error = 0x10; - state->reason = "`on_message_begin` 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_message_begin: { - switch (llhttp__on_message_begin(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_invoke_load_type; - case 21: - goto s_n_llhttp__internal__n_pause_8; - default: - goto s_n_llhttp__internal__n_error; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_finish: { - switch (llhttp__internal__c_update_finish(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_message_begin; - } - /* UNREACHABLE */; - abort(); - } -} - -int llhttp__internal_execute(llhttp__internal_t* state, const char* p, const char* endp) { - llparse_state_t next; - - /* check lingering errors */ - if (state->error != 0) { - return state->error; - } - - /* restart spans */ - if (state->_span_pos0 != NULL) { - state->_span_pos0 = (void*) p; - } - - next = llhttp__internal__run(state, (const unsigned char*) p, (const unsigned char*) endp); - if (next == s_error) { - return state->error; - } - state->_current = (void*) (intptr_t) next; - - /* execute spans */ - if (state->_span_pos0 != NULL) { - int error; - - error = ((llhttp__internal__span_cb) state->_span_cb0)(state, state->_span_pos0, (const char*) endp); - if (error != 0) { - state->error = error; - state->error_pos = endp; - return error; - } - } - - return 0; -} - -#else /* !LLHTTP_STRICT_MODE */ - -#include -#include -#include - -#ifdef __SSE4_2__ - #ifdef _MSC_VER - #include - #else /* !_MSC_VER */ - #include - #endif /* _MSC_VER */ -#endif /* __SSE4_2__ */ - -#ifdef _MSC_VER - #define ALIGN(n) _declspec(align(n)) -#else /* !_MSC_VER */ - #define ALIGN(n) __attribute__((aligned(n))) -#endif /* _MSC_VER */ - -#include "llhttp.h" - -typedef int (*llhttp__internal__span_cb)( - llhttp__internal_t*, const char*, const char*); - -#ifdef __SSE4_2__ -static const unsigned char ALIGN(16) llparse_blob0[] = { - 0x9, 0x9, 0xc, 0xc, '!', '"', '$', '>', '@', '~', 0x80, - 0xff, 0x0, 0x0, 0x0, 0x0 -}; -#endif /* __SSE4_2__ */ -static const unsigned char llparse_blob1[] = { - 'o', 'n' -}; -static const unsigned char llparse_blob2[] = { - 'e', 'c', 't', 'i', 'o', 'n' -}; -static const unsigned char llparse_blob3[] = { - 'l', 'o', 's', 'e' -}; -static const unsigned char llparse_blob4[] = { - 'e', 'e', 'p', '-', 'a', 'l', 'i', 'v', 'e' -}; -static const unsigned char llparse_blob5[] = { - 'p', 'g', 'r', 'a', 'd', 'e' -}; -static const unsigned char llparse_blob6[] = { - 'c', 'h', 'u', 'n', 'k', 'e', 'd' -}; -#ifdef __SSE4_2__ -static const unsigned char ALIGN(16) llparse_blob7[] = { - 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[] = { - ' ', '!', '#', '\'', '*', '+', '-', '.', '0', '9', 'A', - 'Z', '^', 'z', '|', '|' -}; -#endif /* __SSE4_2__ */ -#ifdef __SSE4_2__ -static const unsigned char ALIGN(16) llparse_blob9[] = { - '~', '~', 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0 -}; -#endif /* __SSE4_2__ */ -static const unsigned char llparse_blob10[] = { - 'e', 'n', 't', '-', 'l', 'e', 'n', 'g', 't', 'h' -}; -static const unsigned char llparse_blob11[] = { - 'r', 'o', 'x', 'y', '-', 'c', 'o', 'n', 'n', 'e', 'c', - 't', 'i', 'o', 'n' -}; -static const unsigned char llparse_blob12[] = { - 'r', 'a', 'n', 's', 'f', 'e', 'r', '-', 'e', 'n', 'c', - 'o', 'd', 'i', 'n', 'g' -}; -static const unsigned char llparse_blob13[] = { - 'p', 'g', 'r', 'a', 'd', 'e' -}; -static const unsigned char llparse_blob14[] = { - 0xd, 0xa -}; -static const unsigned char llparse_blob15[] = { - 'T', 'T', 'P', '/' -}; -static const unsigned char llparse_blob16[] = { - 0xd, 0xa, 0xd, 0xa, 'S', 'M', 0xd, 0xa, 0xd, 0xa -}; -static const unsigned char llparse_blob17[] = { - 'C', 'E', '/' -}; -static const unsigned char llparse_blob18[] = { - 'T', 'S', 'P', '/' -}; -static const unsigned char llparse_blob19[] = { - 'N', 'O', 'U', 'N', 'C', 'E' -}; -static const unsigned char llparse_blob20[] = { - 'I', 'N', 'D' -}; -static const unsigned char llparse_blob21[] = { - 'E', 'C', 'K', 'O', 'U', 'T' -}; -static const unsigned char llparse_blob22[] = { - 'N', 'E', 'C', 'T' -}; -static const unsigned char llparse_blob23[] = { - 'E', 'T', 'E' -}; -static const unsigned char llparse_blob24[] = { - 'C', 'R', 'I', 'B', 'E' -}; -static const unsigned char llparse_blob25[] = { - 'L', 'U', 'S', 'H' -}; -static const unsigned char llparse_blob26[] = { - 'E', 'T' -}; -static const unsigned char llparse_blob27[] = { - 'P', 'A', 'R', 'A', 'M', 'E', 'T', 'E', 'R' -}; -static const unsigned char llparse_blob28[] = { - 'E', 'A', 'D' -}; -static const unsigned char llparse_blob29[] = { - 'N', 'K' -}; -static const unsigned char llparse_blob30[] = { - 'C', 'K' -}; -static const unsigned char llparse_blob31[] = { - 'S', 'E', 'A', 'R', 'C', 'H' -}; -static const unsigned char llparse_blob32[] = { - 'R', 'G', 'E' -}; -static const unsigned char llparse_blob33[] = { - 'C', 'T', 'I', 'V', 'I', 'T', 'Y' -}; -static const unsigned char llparse_blob34[] = { - 'L', 'E', 'N', 'D', 'A', 'R' -}; -static const unsigned char llparse_blob35[] = { - 'V', 'E' -}; -static const unsigned char llparse_blob36[] = { - 'O', 'T', 'I', 'F', 'Y' -}; -static const unsigned char llparse_blob37[] = { - 'P', 'T', 'I', 'O', 'N', 'S' -}; -static const unsigned char llparse_blob38[] = { - 'C', 'H' -}; -static const unsigned char llparse_blob39[] = { - 'S', 'E' -}; -static const unsigned char llparse_blob40[] = { - 'A', 'Y' -}; -static const unsigned char llparse_blob41[] = { - 'S', 'T' -}; -static const unsigned char llparse_blob42[] = { - 'I', 'N', 'D' -}; -static const unsigned char llparse_blob43[] = { - 'A', 'T', 'C', 'H' -}; -static const unsigned char llparse_blob44[] = { - 'G', 'E' -}; -static const unsigned char llparse_blob45[] = { - 'I', 'N', 'D' -}; -static const unsigned char llparse_blob46[] = { - 'O', 'R', 'D' -}; -static const unsigned char llparse_blob47[] = { - 'I', 'R', 'E', 'C', 'T' -}; -static const unsigned char llparse_blob48[] = { - 'O', 'R', 'T' -}; -static const unsigned char llparse_blob49[] = { - 'R', 'C', 'H' -}; -static const unsigned char llparse_blob50[] = { - 'P', 'A', 'R', 'A', 'M', 'E', 'T', 'E', 'R' -}; -static const unsigned char llparse_blob51[] = { - 'U', 'R', 'C', 'E' -}; -static const unsigned char llparse_blob52[] = { - 'B', 'S', 'C', 'R', 'I', 'B', 'E' -}; -static const unsigned char llparse_blob53[] = { - 'A', 'R', 'D', 'O', 'W', 'N' -}; -static const unsigned char llparse_blob54[] = { - 'A', 'C', 'E' -}; -static const unsigned char llparse_blob55[] = { - 'I', 'N', 'D' -}; -static const unsigned char llparse_blob56[] = { - 'N', 'K' -}; -static const unsigned char llparse_blob57[] = { - 'C', 'K' -}; -static const unsigned char llparse_blob58[] = { - 'U', 'B', 'S', 'C', 'R', 'I', 'B', 'E' -}; -static const unsigned char llparse_blob59[] = { - 'H', 'T', 'T', 'P', '/' -}; -static const unsigned char llparse_blob60[] = { - 'A', 'D' -}; -static const unsigned char llparse_blob61[] = { - 'T', 'P', '/' -}; - -enum llparse_match_status_e { - kMatchComplete, - kMatchPause, - kMatchMismatch -}; -typedef enum llparse_match_status_e llparse_match_status_t; - -struct llparse_match_s { - llparse_match_status_t status; - const unsigned char* current; -}; -typedef struct llparse_match_s llparse_match_t; - -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) { - uint32_t index; - llparse_match_t res; - - index = s->_index; - for (; p != endp; p++) { - unsigned char current; - - current = ((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p)); - if (current == seq[index]) { - if (++index == seq_len) { - res.status = kMatchComplete; - goto reset; - } - } else { - res.status = kMatchMismatch; - goto reset; - } - } - s->_index = index; - res.status = kMatchPause; - res.current = p; - return res; -reset: - s->_index = 0; - res.current = p; - return res; -} - -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) { - uint32_t index; - llparse_match_t res; - - index = s->_index; - for (; p != endp; p++) { - unsigned char current; - - current = ((*p) | 0x20); - if (current == seq[index]) { - if (++index == seq_len) { - res.status = kMatchComplete; - goto reset; - } - } else { - res.status = kMatchMismatch; - goto reset; - } - } - s->_index = index; - res.status = kMatchPause; - res.current = p; - return res; -reset: - s->_index = 0; - res.current = p; - return res; -} - -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) { - uint32_t index; - llparse_match_t res; - - index = s->_index; - for (; p != endp; p++) { - unsigned char current; - - current = *p; - if (current == seq[index]) { - if (++index == seq_len) { - res.status = kMatchComplete; - goto reset; - } - } else { - res.status = kMatchMismatch; - goto reset; - } - } - s->_index = index; - res.status = kMatchPause; - res.current = p; - return res; -reset: - s->_index = 0; - res.current = p; - return res; -} - -enum llparse_state_e { - s_error, - 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_skip, - 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_chunk_parameters, - s_n_llhttp__internal__n_chunk_size_otherwise, - s_n_llhttp__internal__n_chunk_size, - s_n_llhttp__internal__n_chunk_size_digit, - s_n_llhttp__internal__n_invoke_update_content_length, - 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, - s_n_llhttp__internal__n_span_start_llhttp__on_body_2, - s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete, - s_n_llhttp__internal__n_headers_almost_done, - s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete, - s_n_llhttp__internal__n_span_start_llhttp__on_header_value, - s_n_llhttp__internal__n_header_value_discard_lws, - 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_header_value_lenient, - 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, - s_n_llhttp__internal__n_header_value_connection_1, - 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_17, - s_n_llhttp__internal__n_error_18, - s_n_llhttp__internal__n_header_value_content_length_ws, - s_n_llhttp__internal__n_header_value_content_length, - s_n_llhttp__internal__n_header_value_te_chunked_last, - 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, - 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_llhttp__on_header_field_complete, - s_n_llhttp__internal__n_header_field_general_otherwise, - s_n_llhttp__internal__n_header_field_general, - s_n_llhttp__internal__n_header_field_colon, - s_n_llhttp__internal__n_header_field_3, - s_n_llhttp__internal__n_header_field_4, - s_n_llhttp__internal__n_header_field_2, - s_n_llhttp__internal__n_header_field_1, - s_n_llhttp__internal__n_header_field_5, - s_n_llhttp__internal__n_header_field_6, - s_n_llhttp__internal__n_header_field_7, - s_n_llhttp__internal__n_header_field, - s_n_llhttp__internal__n_span_start_llhttp__on_header_field, - s_n_llhttp__internal__n_header_field_start, - s_n_llhttp__internal__n_url_skip_to_http09, - s_n_llhttp__internal__n_url_skip_lf_to_http09, - s_n_llhttp__internal__n_req_pri_upgrade, - s_n_llhttp__internal__n_req_http_complete_1, - s_n_llhttp__internal__n_req_http_complete, - s_n_llhttp__internal__n_req_http_minor, - s_n_llhttp__internal__n_req_http_dot, - s_n_llhttp__internal__n_req_http_major, - s_n_llhttp__internal__n_req_http_start_1, - s_n_llhttp__internal__n_req_http_start_2, - s_n_llhttp__internal__n_req_http_start_3, - s_n_llhttp__internal__n_req_http_start, - s_n_llhttp__internal__n_url_skip_to_http, - s_n_llhttp__internal__n_url_fragment, - s_n_llhttp__internal__n_span_end_stub_query_3, - s_n_llhttp__internal__n_url_query, - s_n_llhttp__internal__n_url_query_or_fragment, - s_n_llhttp__internal__n_url_path, - s_n_llhttp__internal__n_span_start_stub_path_2, - s_n_llhttp__internal__n_span_start_stub_path, - s_n_llhttp__internal__n_span_start_stub_path_1, - s_n_llhttp__internal__n_url_server_with_at, - s_n_llhttp__internal__n_url_server, - s_n_llhttp__internal__n_url_schema_delim_1, - s_n_llhttp__internal__n_url_schema_delim, - s_n_llhttp__internal__n_span_end_stub_schema, - s_n_llhttp__internal__n_url_schema, - s_n_llhttp__internal__n_url_start, - s_n_llhttp__internal__n_span_start_llhttp__on_url_1, - s_n_llhttp__internal__n_span_start_llhttp__on_url, - s_n_llhttp__internal__n_req_spaces_before_url, - s_n_llhttp__internal__n_req_first_space_before_url, - s_n_llhttp__internal__n_start_req_2, - s_n_llhttp__internal__n_start_req_3, - s_n_llhttp__internal__n_start_req_1, - s_n_llhttp__internal__n_start_req_4, - s_n_llhttp__internal__n_start_req_6, - s_n_llhttp__internal__n_start_req_8, - s_n_llhttp__internal__n_start_req_9, - s_n_llhttp__internal__n_start_req_7, - s_n_llhttp__internal__n_start_req_5, - s_n_llhttp__internal__n_start_req_12, - s_n_llhttp__internal__n_start_req_13, - s_n_llhttp__internal__n_start_req_11, - s_n_llhttp__internal__n_start_req_10, - s_n_llhttp__internal__n_start_req_14, - s_n_llhttp__internal__n_start_req_17, - s_n_llhttp__internal__n_start_req_16, - s_n_llhttp__internal__n_start_req_15, - s_n_llhttp__internal__n_start_req_18, - s_n_llhttp__internal__n_start_req_20, - s_n_llhttp__internal__n_start_req_21, - s_n_llhttp__internal__n_start_req_19, - s_n_llhttp__internal__n_start_req_23, - s_n_llhttp__internal__n_start_req_24, - s_n_llhttp__internal__n_start_req_26, - s_n_llhttp__internal__n_start_req_28, - s_n_llhttp__internal__n_start_req_29, - s_n_llhttp__internal__n_start_req_27, - s_n_llhttp__internal__n_start_req_25, - s_n_llhttp__internal__n_start_req_30, - s_n_llhttp__internal__n_start_req_22, - s_n_llhttp__internal__n_start_req_31, - s_n_llhttp__internal__n_start_req_32, - s_n_llhttp__internal__n_start_req_35, - s_n_llhttp__internal__n_start_req_36, - s_n_llhttp__internal__n_start_req_34, - s_n_llhttp__internal__n_start_req_37, - s_n_llhttp__internal__n_start_req_38, - s_n_llhttp__internal__n_start_req_42, - s_n_llhttp__internal__n_start_req_43, - s_n_llhttp__internal__n_start_req_41, - s_n_llhttp__internal__n_start_req_40, - s_n_llhttp__internal__n_start_req_39, - s_n_llhttp__internal__n_start_req_45, - s_n_llhttp__internal__n_start_req_44, - s_n_llhttp__internal__n_start_req_33, - s_n_llhttp__internal__n_start_req_48, - s_n_llhttp__internal__n_start_req_49, - s_n_llhttp__internal__n_start_req_50, - s_n_llhttp__internal__n_start_req_51, - s_n_llhttp__internal__n_start_req_47, - s_n_llhttp__internal__n_start_req_46, - s_n_llhttp__internal__n_start_req_54, - s_n_llhttp__internal__n_start_req_56, - s_n_llhttp__internal__n_start_req_57, - s_n_llhttp__internal__n_start_req_55, - s_n_llhttp__internal__n_start_req_53, - s_n_llhttp__internal__n_start_req_58, - s_n_llhttp__internal__n_start_req_59, - s_n_llhttp__internal__n_start_req_52, - s_n_llhttp__internal__n_start_req_61, - s_n_llhttp__internal__n_start_req_62, - s_n_llhttp__internal__n_start_req_60, - s_n_llhttp__internal__n_start_req_65, - s_n_llhttp__internal__n_start_req_67, - s_n_llhttp__internal__n_start_req_68, - s_n_llhttp__internal__n_start_req_66, - s_n_llhttp__internal__n_start_req_69, - s_n_llhttp__internal__n_start_req_64, - s_n_llhttp__internal__n_start_req_63, - s_n_llhttp__internal__n_start_req, - s_n_llhttp__internal__n_invoke_llhttp__on_status_complete, - s_n_llhttp__internal__n_res_line_almost_done, - 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, - s_n_llhttp__internal__n_res_http_end, - s_n_llhttp__internal__n_res_http_minor, - s_n_llhttp__internal__n_res_http_dot, - s_n_llhttp__internal__n_res_http_major, - s_n_llhttp__internal__n_start_res, - s_n_llhttp__internal__n_req_or_res_method_2, - s_n_llhttp__internal__n_req_or_res_method_3, - s_n_llhttp__internal__n_req_or_res_method_1, - s_n_llhttp__internal__n_req_or_res_method, - s_n_llhttp__internal__n_start_req_or_res, - s_n_llhttp__internal__n_invoke_load_type, - s_n_llhttp__internal__n_start, -}; -typedef enum llparse_state_e llparse_state_t; - -int llhttp__on_url( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__on_header_field( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__on_header_value( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__on_body( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__on_status( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_update_finish( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->finish = 2; - return 0; -} - -int llhttp__on_message_begin( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_load_type( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->type; -} - -int llhttp__internal__c_store_method( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - state->method = match; - return 0; -} - -int llhttp__internal__c_is_equal_method( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->method == 5; -} - -int llhttp__internal__c_update_http_major( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->http_major = 0; - return 0; -} - -int llhttp__internal__c_update_http_minor( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->http_minor = 9; - return 0; -} - -int llhttp__on_url_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -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); - -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); - -int llhttp__internal__c_update_finish_1( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->finish = 0; - return 0; -} - -int llhttp__internal__c_test_lenient_flags( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return (state->lenient_flags & 4) == 4; -} - -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_1( - 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__after_headers_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_update_content_length( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->content_length = 0; - return 0; -} - -int llhttp__internal__c_mul_add_content_length( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - /* Multiplication overflow */ - if (state->content_length > 0xffffffffffffffffULL / 16) { - return 1; - } - - state->content_length *= 16; - - /* Addition overflow */ - if (match >= 0) { - if (state->content_length > 0xffffffffffffffffULL - match) { - return 1; - } - } else { - if (state->content_length < 0ULL - match) { - return 1; - } - } - state->content_length += match; - return 0; -} - -int llhttp__on_chunk_header( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_is_equal_content_length( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->content_length == 0; -} - -int llhttp__internal__c_or_flags( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 128; - return 0; -} - -int llhttp__internal__c_update_finish_3( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->finish = 1; - return 0; -} - -int llhttp__internal__c_or_flags_1( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 64; - return 0; -} - -int llhttp__internal__c_update_upgrade( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->upgrade = 1; - return 0; -} - -int llhttp__internal__c_store_header_state( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - state->header_state = match; - return 0; -} - -int llhttp__on_header_field_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_load_header_state( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->header_state; -} - -int llhttp__internal__c_or_flags_3( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 1; - return 0; -} - -int llhttp__internal__c_update_header_state( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 1; - return 0; -} - -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( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 2; - return 0; -} - -int llhttp__internal__c_or_flags_5( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 4; - return 0; -} - -int llhttp__internal__c_or_flags_6( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 8; - return 0; -} - -int llhttp__internal__c_update_header_state_2( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 6; - return 0; -} - -int llhttp__internal__c_test_lenient_flags_2( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return (state->lenient_flags & 1) == 1; -} - -int llhttp__internal__c_update_header_state_4( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 0; - return 0; -} - -int llhttp__internal__c_update_header_state_5( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 5; - return 0; -} - -int llhttp__internal__c_update_header_state_6( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 7; - return 0; -} - -int llhttp__internal__c_test_flags_2( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return (state->flags & 32) == 32; -} - -int llhttp__internal__c_mul_add_content_length_1( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - /* Multiplication overflow */ - if (state->content_length > 0xffffffffffffffffULL / 10) { - return 1; - } - - state->content_length *= 10; - - /* Addition overflow */ - if (match >= 0) { - if (state->content_length > 0xffffffffffffffffULL - match) { - return 1; - } - } else { - if (state->content_length < 0ULL - match) { - return 1; - } - } - state->content_length += match; - return 0; -} - -int llhttp__internal__c_or_flags_15( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 32; - return 0; -} - -int llhttp__internal__c_or_flags_16( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 512; - return 0; -} - -int llhttp__internal__c_and_flags( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags &= -9; - return 0; -} - -int llhttp__internal__c_update_header_state_7( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->header_state = 8; - return 0; -} - -int llhttp__internal__c_or_flags_17( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->flags |= 16; - return 0; -} - -int llhttp__internal__c_load_method( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - return state->method; -} - -int llhttp__internal__c_store_http_major( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - state->http_major = match; - return 0; -} - -int llhttp__internal__c_store_http_minor( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - state->http_minor = match; - return 0; -} - -int llhttp__internal__c_update_status_code( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->status_code = 0; - return 0; -} - -int llhttp__internal__c_mul_add_status_code( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp, - int match) { - /* Multiplication overflow */ - if (state->status_code > 0xffff / 10) { - return 1; - } - - state->status_code *= 10; - - /* Addition overflow */ - if (match >= 0) { - if (state->status_code > 0xffff - match) { - return 1; - } - } else { - if (state->status_code < 0 - match) { - return 1; - } - } - state->status_code += match; - - /* Enforce maximum */ - if (state->status_code > 999) { - return 1; - } - return 0; -} - -int llhttp__on_status_complete( - llhttp__internal_t* s, const unsigned char* p, - const unsigned char* endp); - -int llhttp__internal__c_update_type( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->type = 1; - return 0; -} - -int llhttp__internal__c_update_type_1( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - state->type = 2; - return 0; -} - -int llhttp__internal_init(llhttp__internal_t* state) { - memset(state, 0, sizeof(*state)); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_start; - return 0; -} - -static llparse_state_t llhttp__internal__run( - llhttp__internal_t* state, - const unsigned char* p, - const unsigned char* endp) { - int match; - switch ((llparse_state_t) (intptr_t) state->_current) { - case s_n_llhttp__internal__n_closed: - s_n_llhttp__internal__n_closed: { - if (p == endp) { - return s_n_llhttp__internal__n_closed; - } - p++; - goto s_n_llhttp__internal__n_closed; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_llhttp__after_message_complete: - s_n_llhttp__internal__n_invoke_llhttp__after_message_complete: { - switch (llhttp__after_message_complete(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_invoke_update_finish_2; - default: - goto s_n_llhttp__internal__n_invoke_update_finish_1; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_pause_1: - s_n_llhttp__internal__n_pause_1: { - state->error = 0x16; - state->reason = "Pause on CONNECT/Upgrade"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__after_message_complete; - return s_error; - /* 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_5; - default: - goto s_n_llhttp__internal__n_error_9; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_data_almost_done_skip: - s_n_llhttp__internal__n_chunk_data_almost_done_skip: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_data_almost_done_skip; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete; - /* 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; - } - p++; - goto s_n_llhttp__internal__n_chunk_data_almost_done_skip; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_consume_content_length: - s_n_llhttp__internal__n_consume_content_length: { - size_t avail; - uint64_t need; - - avail = endp - p; - need = state->content_length; - if (avail >= need) { - p += need; - state->content_length = 0; - goto s_n_llhttp__internal__n_span_end_llhttp__on_body; - } - - state->content_length -= avail; - return s_n_llhttp__internal__n_consume_content_length; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_body: - s_n_llhttp__internal__n_span_start_llhttp__on_body: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_body; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_body; - goto s_n_llhttp__internal__n_consume_content_length; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_is_equal_content_length: - s_n_llhttp__internal__n_invoke_is_equal_content_length: { - switch (llhttp__internal__c_is_equal_content_length(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_span_start_llhttp__on_body; - default: - goto s_n_llhttp__internal__n_invoke_or_flags; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_size_almost_done: - s_n_llhttp__internal__n_chunk_size_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_size_almost_done; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_header; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_parameters: - s_n_llhttp__internal__n_chunk_parameters: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_parameters; - } - switch (*p) { - case 13: { - p++; - goto s_n_llhttp__internal__n_chunk_size_almost_done; - } - default: { - p++; - goto s_n_llhttp__internal__n_chunk_parameters; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_size_otherwise: - s_n_llhttp__internal__n_chunk_size_otherwise: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_size_otherwise; - } - switch (*p) { - case 13: { - p++; - goto s_n_llhttp__internal__n_chunk_size_almost_done; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_chunk_parameters; - } - case ';': { - p++; - goto s_n_llhttp__internal__n_chunk_parameters; - } - default: { - goto s_n_llhttp__internal__n_error_6; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_size: - s_n_llhttp__internal__n_chunk_size: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_size; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'A': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'B': { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'C': { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'D': { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'E': { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'F': { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'a': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'b': { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'c': { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'd': { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'e': { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'f': { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - default: { - goto s_n_llhttp__internal__n_chunk_size_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_chunk_size_digit: - s_n_llhttp__internal__n_chunk_size_digit: { - if (p == endp) { - return s_n_llhttp__internal__n_chunk_size_digit; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'A': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'B': { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'C': { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'D': { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'E': { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'F': { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'a': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'b': { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'c': { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'd': { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'e': { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - case 'f': { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length; - } - default: { - goto s_n_llhttp__internal__n_error_8; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_update_content_length: - s_n_llhttp__internal__n_invoke_update_content_length: { - switch (llhttp__internal__c_update_content_length(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_chunk_size_digit; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_consume_content_length_1: - s_n_llhttp__internal__n_consume_content_length_1: { - size_t avail; - uint64_t need; - - avail = endp - p; - need = state->content_length; - if (avail >= need) { - p += need; - state->content_length = 0; - goto s_n_llhttp__internal__n_span_end_llhttp__on_body_1; - } - - state->content_length -= avail; - return s_n_llhttp__internal__n_consume_content_length_1; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_body_1: - s_n_llhttp__internal__n_span_start_llhttp__on_body_1: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_body_1; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_body; - goto s_n_llhttp__internal__n_consume_content_length_1; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_eof: - s_n_llhttp__internal__n_eof: { - if (p == endp) { - return s_n_llhttp__internal__n_eof; - } - p++; - goto s_n_llhttp__internal__n_eof; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_body_2: - s_n_llhttp__internal__n_span_start_llhttp__on_body_2: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_body_2; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_body; - goto s_n_llhttp__internal__n_eof; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete: - s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete: { - switch (llhttp__after_headers_complete(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_1; - case 2: - goto s_n_llhttp__internal__n_invoke_update_content_length; - case 3: - goto s_n_llhttp__internal__n_span_start_llhttp__on_body_1; - case 4: - goto s_n_llhttp__internal__n_invoke_update_finish_3; - case 5: - goto s_n_llhttp__internal__n_error_10; - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_headers_almost_done: - s_n_llhttp__internal__n_headers_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_headers_almost_done; - } - p++; - goto s_n_llhttp__internal__n_invoke_test_flags; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete: - s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete: { - switch (llhttp__on_header_value_complete(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_start; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_header_value: - s_n_llhttp__internal__n_span_start_llhttp__on_header_value: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_header_value; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_header_value; - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_discard_lws: - s_n_llhttp__internal__n_header_value_discard_lws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_discard_lws; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - default: { - goto s_n_llhttp__internal__n_invoke_load_header_state; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_discard_ws_almost_done: - s_n_llhttp__internal__n_header_value_discard_ws_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_discard_ws_almost_done; - } - p++; - goto s_n_llhttp__internal__n_header_value_discard_lws; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_lws: - s_n_llhttp__internal__n_header_value_lws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_lws; - } - switch (*p) { - case 9: { - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; - } - case ' ': { - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; - } - default: { - goto s_n_llhttp__internal__n_invoke_load_header_state_3; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_almost_done: - s_n_llhttp__internal__n_header_value_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_almost_done; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_header_value_lws; - } - default: { - goto s_n_llhttp__internal__n_error_14; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_lenient: - s_n_llhttp__internal__n_header_value_lenient: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_lenient; - } - switch (*p) { - 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_3; - } - default: { - p++; - goto s_n_llhttp__internal__n_header_value_lenient; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_otherwise: - s_n_llhttp__internal__n_header_value_otherwise: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_otherwise; - } - switch (*p) { - 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_2; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_token: - s_n_llhttp__internal__n_header_value_connection_token: { - 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, 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, 1, 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_header_value_connection_token; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_header_value_connection_token; - } - case 2: { - p++; - goto s_n_llhttp__internal__n_header_value_connection; - } - default: { - goto s_n_llhttp__internal__n_header_value_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_ws: - s_n_llhttp__internal__n_header_value_connection_ws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_connection_ws; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_header_value_otherwise; - } - case 13: { - goto s_n_llhttp__internal__n_header_value_otherwise; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_connection_ws; - } - case ',': { - p++; - goto s_n_llhttp__internal__n_invoke_load_header_state_4; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_4; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_1: - s_n_llhttp__internal__n_header_value_connection_1: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_update_header_state_2; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_value_connection_1; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_header_value_connection_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_2: - s_n_llhttp__internal__n_header_value_connection_2: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_update_header_state_5; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_value_connection_2; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_header_value_connection_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection_3: - s_n_llhttp__internal__n_header_value_connection_3: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_update_header_state_6; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_value_connection_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_header_value_connection_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_connection: - s_n_llhttp__internal__n_header_value_connection: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_connection; - } - switch (((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p))) { - case 9: { - p++; - goto s_n_llhttp__internal__n_header_value_connection; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_connection; - } - case 'c': { - p++; - goto s_n_llhttp__internal__n_header_value_connection_1; - } - case 'k': { - p++; - goto s_n_llhttp__internal__n_header_value_connection_2; - } - case 'u': { - p++; - goto s_n_llhttp__internal__n_header_value_connection_3; - } - default: { - goto s_n_llhttp__internal__n_header_value_connection_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_error_17: - s_n_llhttp__internal__n_error_17: { - state->error = 0xb; - state->reason = "Content-Length overflow"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_error_18: - s_n_llhttp__internal__n_error_18: { - state->error = 0xb; - state->reason = "Invalid character in Content-Length"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_content_length_ws: - s_n_llhttp__internal__n_header_value_content_length_ws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_content_length_ws; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_invoke_or_flags_15; - } - case 13: { - goto s_n_llhttp__internal__n_invoke_or_flags_15; - } - 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_5; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_content_length: - s_n_llhttp__internal__n_header_value_content_length: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_content_length; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; - } - default: { - goto s_n_llhttp__internal__n_header_value_content_length_ws; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_te_chunked_last: - s_n_llhttp__internal__n_header_value_te_chunked_last: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_te_chunked_last; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_invoke_update_header_state_7; - } - case 13: { - goto s_n_llhttp__internal__n_invoke_update_header_state_7; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_te_chunked_last; - } - default: { - goto s_n_llhttp__internal__n_header_value_te_chunked; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_te_token_ows: - s_n_llhttp__internal__n_header_value_te_token_ows: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_te_token_ows; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_header_value_te_token_ows; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_te_token_ows; - } - default: { - goto s_n_llhttp__internal__n_header_value_te_chunked; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value: - s_n_llhttp__internal__n_header_value: { - 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_header_value; - } - #ifdef __SSE4_2__ - if (endp - p >= 16) { - __m128i ranges; - __m128i input; - int avail; - int match_len; - - /* Load input */ - input = _mm_loadu_si128((__m128i const*) p); - ranges = _mm_loadu_si128((__m128i const*) llparse_blob7); - - /* Find first character that does not match `ranges` */ - match_len = _mm_cmpestri(ranges, 6, - input, 16, - _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | - _SIDD_NEGATIVE_POLARITY); - - if (match_len != 0) { - p += match_len; - goto s_n_llhttp__internal__n_header_value; - } - goto s_n_llhttp__internal__n_header_value_otherwise; - } - #endif /* __SSE4_2__ */ - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_header_value; - } - default: { - goto s_n_llhttp__internal__n_header_value_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_te_token: - s_n_llhttp__internal__n_header_value_te_token: { - 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, 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, 1, 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_header_value_te_token; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_header_value_te_token; - } - case 2: { - p++; - goto s_n_llhttp__internal__n_header_value_te_token_ows; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_8; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_te_chunked: - s_n_llhttp__internal__n_header_value_te_chunked: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_header_value_te_chunked_last; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_value_te_chunked; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_header_value_te_token; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1: - s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_header_value; - goto s_n_llhttp__internal__n_invoke_load_header_state_2; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_value_discard_ws: - s_n_llhttp__internal__n_header_value_discard_ws: { - if (p == endp) { - return s_n_llhttp__internal__n_header_value_discard_ws; - } - switch (*p) { - case 9: { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - case 10: { - p++; - goto s_n_llhttp__internal__n_header_value_discard_lws; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws_almost_done; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - default: { - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; - } - } - /* 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)) { - default: - goto s_n_llhttp__internal__n_header_value_discard_ws; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_general_otherwise: - s_n_llhttp__internal__n_header_field_general_otherwise: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field_general_otherwise; - } - switch (*p) { - case ':': { - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field_1; - } - default: { - goto s_n_llhttp__internal__n_error_19; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_general: - s_n_llhttp__internal__n_header_field_general: { - static uint8_t lookup_table[] = { - 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, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 0, 1, 0, 1, 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, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_header_field_general; - } - #ifdef __SSE4_2__ - if (endp - p >= 16) { - __m128i ranges; - __m128i input; - int avail; - int match_len; - - /* Load input */ - input = _mm_loadu_si128((__m128i const*) p); - ranges = _mm_loadu_si128((__m128i const*) llparse_blob8); - - /* Find first character that does not match `ranges` */ - match_len = _mm_cmpestri(ranges, 16, - input, 16, - _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | - _SIDD_NEGATIVE_POLARITY); - - if (match_len != 0) { - p += match_len; - goto s_n_llhttp__internal__n_header_field_general; - } - ranges = _mm_loadu_si128((__m128i const*) llparse_blob9); - - /* Find first character that does not match `ranges` */ - match_len = _mm_cmpestri(ranges, 2, - input, 16, - _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | - _SIDD_NEGATIVE_POLARITY); - - if (match_len != 0) { - p += match_len; - goto s_n_llhttp__internal__n_header_field_general; - } - goto s_n_llhttp__internal__n_header_field_general_otherwise; - } - #endif /* __SSE4_2__ */ - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_header_field_general; - } - default: { - goto s_n_llhttp__internal__n_header_field_general_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_colon: - s_n_llhttp__internal__n_header_field_colon: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field_colon; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_header_field_colon; - } - case ':': { - goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_9; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_3: - s_n_llhttp__internal__n_header_field_3: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_4: - s_n_llhttp__internal__n_header_field_4: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_4; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_2: - s_n_llhttp__internal__n_header_field_2: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field_2; - } - switch (((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p))) { - case 'n': { - p++; - goto s_n_llhttp__internal__n_header_field_3; - } - case 't': { - p++; - goto s_n_llhttp__internal__n_header_field_4; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_1: - s_n_llhttp__internal__n_header_field_1: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_header_field_2; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_1; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_5: - s_n_llhttp__internal__n_header_field_5: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_5; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_6: - s_n_llhttp__internal__n_header_field_6: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_6; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_7: - s_n_llhttp__internal__n_header_field_7: { - llparse_match_t match_seq; - - 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); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_header_state; - } - case kMatchPause: { - return s_n_llhttp__internal__n_header_field_7; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field: - s_n_llhttp__internal__n_header_field: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field; - } - switch (((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p))) { - case 'c': { - p++; - goto s_n_llhttp__internal__n_header_field_1; - } - case 'p': { - p++; - goto s_n_llhttp__internal__n_header_field_5; - } - case 't': { - p++; - goto s_n_llhttp__internal__n_header_field_6; - } - case 'u': { - p++; - goto s_n_llhttp__internal__n_header_field_7; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_header_state_10; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_header_field: - s_n_llhttp__internal__n_span_start_llhttp__on_header_field: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_header_field; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_header_field; - goto s_n_llhttp__internal__n_header_field; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_header_field_start: - s_n_llhttp__internal__n_header_field_start: { - if (p == endp) { - return s_n_llhttp__internal__n_header_field_start; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_headers_almost_done; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_headers_almost_done; - } - default: { - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_field; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_skip_to_http09: - s_n_llhttp__internal__n_url_skip_to_http09: { - if (p == endp) { - return s_n_llhttp__internal__n_url_skip_to_http09; - } - p++; - goto s_n_llhttp__internal__n_invoke_update_http_major; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_skip_lf_to_http09: - s_n_llhttp__internal__n_url_skip_lf_to_http09: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_url_skip_lf_to_http09; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob14, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_update_http_major; - } - case kMatchPause: { - return s_n_llhttp__internal__n_url_skip_lf_to_http09; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_20; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_pri_upgrade: - s_n_llhttp__internal__n_req_pri_upgrade: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_req_pri_upgrade; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob16, 10); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_error_23; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_pri_upgrade; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_24; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_complete_1: - s_n_llhttp__internal__n_req_http_complete_1: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_complete_1; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_header_field_start; - } - default: { - goto s_n_llhttp__internal__n_error_22; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_complete: - s_n_llhttp__internal__n_req_http_complete: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_complete; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_header_field_start; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_req_http_complete_1; - } - default: { - goto s_n_llhttp__internal__n_error_22; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_minor: - s_n_llhttp__internal__n_req_http_minor: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_minor; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_http_minor; - } - default: { - goto s_n_llhttp__internal__n_error_25; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_dot: - s_n_llhttp__internal__n_req_http_dot: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_dot; - } - switch (*p) { - case '.': { - p++; - goto s_n_llhttp__internal__n_req_http_minor; - } - default: { - goto s_n_llhttp__internal__n_error_26; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_major: - s_n_llhttp__internal__n_req_http_major: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_major; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_http_major; - } - default: { - goto s_n_llhttp__internal__n_error_27; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_start_1: - s_n_llhttp__internal__n_req_http_start_1: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_req_http_start_1; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob15, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_load_method; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_http_start_1; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_30; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_start_2: - s_n_llhttp__internal__n_req_http_start_2: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_req_http_start_2; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob17, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_load_method_2; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_http_start_2; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_30; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_start_3: - s_n_llhttp__internal__n_req_http_start_3: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_req_http_start_3; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob18, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_load_method_3; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_http_start_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_30; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_http_start: - s_n_llhttp__internal__n_req_http_start: { - if (p == endp) { - return s_n_llhttp__internal__n_req_http_start; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_req_http_start; - } - case 'H': { - p++; - goto s_n_llhttp__internal__n_req_http_start_1; - } - case 'I': { - p++; - goto s_n_llhttp__internal__n_req_http_start_2; - } - case 'R': { - p++; - goto s_n_llhttp__internal__n_req_http_start_3; - } - default: { - goto s_n_llhttp__internal__n_error_30; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_skip_to_http: - s_n_llhttp__internal__n_url_skip_to_http: { - if (p == endp) { - return s_n_llhttp__internal__n_url_skip_to_http; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_url_complete_1; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_fragment: - s_n_llhttp__internal__n_url_fragment: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 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_url_fragment; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_url_fragment; - } - case 2: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_6; - } - case 3: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_7; - } - case 4: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_8; - } - default: { - goto s_n_llhttp__internal__n_error_31; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_end_stub_query_3: - s_n_llhttp__internal__n_span_end_stub_query_3: { - if (p == endp) { - return s_n_llhttp__internal__n_span_end_stub_query_3; - } - p++; - goto s_n_llhttp__internal__n_url_fragment; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_query: - s_n_llhttp__internal__n_url_query: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 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_url_query; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_url_query; - } - case 2: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_9; - } - case 3: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_10; - } - case 4: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_11; - } - case 5: { - goto s_n_llhttp__internal__n_span_end_stub_query_3; - } - default: { - goto s_n_llhttp__internal__n_error_32; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_query_or_fragment: - s_n_llhttp__internal__n_url_query_or_fragment: { - if (p == endp) { - return s_n_llhttp__internal__n_url_query_or_fragment; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_3; - } - case 13: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_4; - } - case ' ': { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_5; - } - case '#': { - p++; - goto s_n_llhttp__internal__n_url_fragment; - } - case '?': { - p++; - goto s_n_llhttp__internal__n_url_query; - } - default: { - goto s_n_llhttp__internal__n_error_33; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_path: - s_n_llhttp__internal__n_url_path: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 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, 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, 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_url_path; - } - #ifdef __SSE4_2__ - if (endp - p >= 16) { - __m128i ranges; - __m128i input; - int avail; - int match_len; - - /* Load input */ - input = _mm_loadu_si128((__m128i const*) p); - ranges = _mm_loadu_si128((__m128i const*) llparse_blob0); - - /* Find first character that does not match `ranges` */ - match_len = _mm_cmpestri(ranges, 12, - input, 16, - _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | - _SIDD_NEGATIVE_POLARITY); - - if (match_len != 0) { - p += match_len; - goto s_n_llhttp__internal__n_url_path; - } - goto s_n_llhttp__internal__n_url_query_or_fragment; - } - #endif /* __SSE4_2__ */ - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_url_path; - } - default: { - goto s_n_llhttp__internal__n_url_query_or_fragment; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_stub_path_2: - s_n_llhttp__internal__n_span_start_stub_path_2: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_stub_path_2; - } - p++; - goto s_n_llhttp__internal__n_url_path; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_stub_path: - s_n_llhttp__internal__n_span_start_stub_path: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_stub_path; - } - p++; - goto s_n_llhttp__internal__n_url_path; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_stub_path_1: - s_n_llhttp__internal__n_span_start_stub_path_1: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_stub_path_1; - } - p++; - goto s_n_llhttp__internal__n_url_path; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_server_with_at: - s_n_llhttp__internal__n_url_server_with_at: { - static uint8_t lookup_table[] = { - 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, - 3, 4, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 6, - 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 4, - 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 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, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_server_with_at; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_12; - } - case 2: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_13; - } - case 3: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_14; - } - case 4: { - p++; - goto s_n_llhttp__internal__n_url_server; - } - case 5: { - goto s_n_llhttp__internal__n_span_start_stub_path_1; - } - case 6: { - p++; - goto s_n_llhttp__internal__n_url_query; - } - case 7: { - p++; - goto s_n_llhttp__internal__n_error_34; - } - default: { - goto s_n_llhttp__internal__n_error_35; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_server: - s_n_llhttp__internal__n_url_server: { - static uint8_t lookup_table[] = { - 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, - 3, 4, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 6, - 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 4, - 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 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, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_server; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url; - } - case 2: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_1; - } - case 3: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_url_2; - } - case 4: { - p++; - goto s_n_llhttp__internal__n_url_server; - } - case 5: { - goto s_n_llhttp__internal__n_span_start_stub_path; - } - case 6: { - p++; - goto s_n_llhttp__internal__n_url_query; - } - case 7: { - p++; - goto s_n_llhttp__internal__n_url_server_with_at; - } - default: { - goto s_n_llhttp__internal__n_error_36; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_schema_delim_1: - s_n_llhttp__internal__n_url_schema_delim_1: { - if (p == endp) { - return s_n_llhttp__internal__n_url_schema_delim_1; - } - switch (*p) { - case '/': { - p++; - goto s_n_llhttp__internal__n_url_server; - } - default: { - goto s_n_llhttp__internal__n_error_38; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_schema_delim: - s_n_llhttp__internal__n_url_schema_delim: { - if (p == endp) { - return s_n_llhttp__internal__n_url_schema_delim; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_error_37; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_error_37; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_error_37; - } - case '/': { - p++; - goto s_n_llhttp__internal__n_url_schema_delim_1; - } - default: { - goto s_n_llhttp__internal__n_error_38; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_end_stub_schema: - s_n_llhttp__internal__n_span_end_stub_schema: { - if (p == endp) { - return s_n_llhttp__internal__n_span_end_stub_schema; - } - p++; - goto s_n_llhttp__internal__n_url_schema_delim; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_schema: - s_n_llhttp__internal__n_url_schema: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, - 0, 0, 0, 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, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 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, 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, 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, 0, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_schema; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_error_37; - } - case 2: { - goto s_n_llhttp__internal__n_span_end_stub_schema; - } - case 3: { - p++; - goto s_n_llhttp__internal__n_url_schema; - } - default: { - goto s_n_llhttp__internal__n_error_39; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_url_start: - s_n_llhttp__internal__n_url_start: { - static uint8_t lookup_table[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 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, 0, 0 - }; - if (p == endp) { - return s_n_llhttp__internal__n_url_start; - } - switch (lookup_table[(uint8_t) *p]) { - case 1: { - p++; - goto s_n_llhttp__internal__n_error_37; - } - case 2: { - goto s_n_llhttp__internal__n_span_start_stub_path_2; - } - case 3: { - goto s_n_llhttp__internal__n_url_schema; - } - default: { - goto s_n_llhttp__internal__n_error_40; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_url_1: - s_n_llhttp__internal__n_span_start_llhttp__on_url_1: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_url_1; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_url; - goto s_n_llhttp__internal__n_url_start; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_url: - s_n_llhttp__internal__n_span_start_llhttp__on_url: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_url; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_url; - goto s_n_llhttp__internal__n_url_server; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_spaces_before_url: - s_n_llhttp__internal__n_req_spaces_before_url: { - if (p == endp) { - return s_n_llhttp__internal__n_req_spaces_before_url; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_req_spaces_before_url; - } - default: { - goto s_n_llhttp__internal__n_invoke_is_equal_method; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_first_space_before_url: - s_n_llhttp__internal__n_req_first_space_before_url: { - if (p == endp) { - return s_n_llhttp__internal__n_req_first_space_before_url; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_req_spaces_before_url; - } - default: { - goto s_n_llhttp__internal__n_error_41; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_2: - s_n_llhttp__internal__n_start_req_2: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_2; - } - switch (*p) { - case 'L': { - p++; - match = 19; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_3: - s_n_llhttp__internal__n_start_req_3: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_3; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob19, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 36; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_1: - s_n_llhttp__internal__n_start_req_1: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_1; - } - switch (*p) { - case 'C': { - p++; - goto s_n_llhttp__internal__n_start_req_2; - } - case 'N': { - p++; - goto s_n_llhttp__internal__n_start_req_3; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_4: - s_n_llhttp__internal__n_start_req_4: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_4; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob20, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 16; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_4; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_6: - s_n_llhttp__internal__n_start_req_6: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_6; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob21, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 22; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_6; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_8: - s_n_llhttp__internal__n_start_req_8: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_8; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob22, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_8; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_9: - s_n_llhttp__internal__n_start_req_9: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_9; - } - switch (*p) { - case 'Y': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_7: - s_n_llhttp__internal__n_start_req_7: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_7; - } - switch (*p) { - case 'N': { - p++; - goto s_n_llhttp__internal__n_start_req_8; - } - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_9; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_5: - s_n_llhttp__internal__n_start_req_5: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_5; - } - switch (*p) { - case 'H': { - p++; - goto s_n_llhttp__internal__n_start_req_6; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_7; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_12: - s_n_llhttp__internal__n_start_req_12: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_12; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob23, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_12; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_13: - s_n_llhttp__internal__n_start_req_13: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_13; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob24, 5); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 35; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_13; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_11: - s_n_llhttp__internal__n_start_req_11: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_11; - } - switch (*p) { - case 'L': { - p++; - goto s_n_llhttp__internal__n_start_req_12; - } - case 'S': { - p++; - goto s_n_llhttp__internal__n_start_req_13; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_10: - s_n_llhttp__internal__n_start_req_10: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_10; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_11; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_14: - s_n_llhttp__internal__n_start_req_14: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_14; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob25, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 45; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_14; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_17: - s_n_llhttp__internal__n_start_req_17: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_17; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob27, 9); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 41; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_17; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_16: - s_n_llhttp__internal__n_start_req_16: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_16; - } - switch (*p) { - case '_': { - p++; - goto s_n_llhttp__internal__n_start_req_17; - } - default: { - match = 1; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_15: - s_n_llhttp__internal__n_start_req_15: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_15; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob26, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_start_req_16; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_15; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_18: - s_n_llhttp__internal__n_start_req_18: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_18; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob28, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_18; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_20: - s_n_llhttp__internal__n_start_req_20: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_20; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob29, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 31; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_20; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_21: - s_n_llhttp__internal__n_start_req_21: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_21; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob30, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_21; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_19: - s_n_llhttp__internal__n_start_req_19: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_19; - } - switch (*p) { - case 'I': { - p++; - goto s_n_llhttp__internal__n_start_req_20; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_21; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_23: - s_n_llhttp__internal__n_start_req_23: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_23; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob31, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 24; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_23; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_24: - s_n_llhttp__internal__n_start_req_24: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_24; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob32, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 23; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_24; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_26: - s_n_llhttp__internal__n_start_req_26: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_26; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob33, 7); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 21; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_26; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_28: - s_n_llhttp__internal__n_start_req_28: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_28; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob34, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 30; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_28; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_29: - s_n_llhttp__internal__n_start_req_29: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_29; - } - switch (*p) { - case 'L': { - p++; - match = 10; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_27: - s_n_llhttp__internal__n_start_req_27: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_27; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_28; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_29; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_25: - s_n_llhttp__internal__n_start_req_25: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_25; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_26; - } - case 'C': { - p++; - goto s_n_llhttp__internal__n_start_req_27; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_30: - s_n_llhttp__internal__n_start_req_30: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_30; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob35, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 11; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_30; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_22: - s_n_llhttp__internal__n_start_req_22: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_22; - } - switch (*p) { - case '-': { - p++; - goto s_n_llhttp__internal__n_start_req_23; - } - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_24; - } - case 'K': { - p++; - goto s_n_llhttp__internal__n_start_req_25; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_30; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_31: - s_n_llhttp__internal__n_start_req_31: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_31; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob36, 5); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 25; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_31; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_32: - s_n_llhttp__internal__n_start_req_32: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_32; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob37, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_32; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_35: - s_n_llhttp__internal__n_start_req_35: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_35; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob38, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 28; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_35; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_36: - s_n_llhttp__internal__n_start_req_36: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_36; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob39, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 39; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_36; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_34: - s_n_llhttp__internal__n_start_req_34: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_34; - } - switch (*p) { - case 'T': { - p++; - goto s_n_llhttp__internal__n_start_req_35; - } - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_36; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_37: - s_n_llhttp__internal__n_start_req_37: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_37; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob40, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 38; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_37; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_38: - s_n_llhttp__internal__n_start_req_38: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_38; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob41, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_38; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_42: - s_n_llhttp__internal__n_start_req_42: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_42; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob42, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 12; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_42; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_43: - s_n_llhttp__internal__n_start_req_43: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_43; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob43, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 13; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_43; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_41: - s_n_llhttp__internal__n_start_req_41: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_41; - } - switch (*p) { - case 'F': { - p++; - goto s_n_llhttp__internal__n_start_req_42; - } - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_43; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_40: - s_n_llhttp__internal__n_start_req_40: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_40; - } - switch (*p) { - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_41; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_39: - s_n_llhttp__internal__n_start_req_39: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_39; - } - switch (*p) { - case 'I': { - p++; - match = 34; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_40; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_45: - s_n_llhttp__internal__n_start_req_45: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_45; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob44, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 29; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_45; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_44: - s_n_llhttp__internal__n_start_req_44: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_44; - } - switch (*p) { - case 'R': { - p++; - goto s_n_llhttp__internal__n_start_req_45; - } - case 'T': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_33: - s_n_llhttp__internal__n_start_req_33: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_33; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_34; - } - case 'L': { - p++; - goto s_n_llhttp__internal__n_start_req_37; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_38; - } - case 'R': { - p++; - goto s_n_llhttp__internal__n_start_req_39; - } - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_44; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_48: - s_n_llhttp__internal__n_start_req_48: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_48; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob45, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 17; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_48; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_49: - s_n_llhttp__internal__n_start_req_49: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_49; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob46, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 44; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_49; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_50: - s_n_llhttp__internal__n_start_req_50: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_50; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob47, 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_start_req_50; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_51: - s_n_llhttp__internal__n_start_req_51: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_51; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob48, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 20; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_51; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_47: - s_n_llhttp__internal__n_start_req_47: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_47; - } - switch (*p) { - case 'B': { - p++; - goto s_n_llhttp__internal__n_start_req_48; - } - case 'C': { - p++; - goto s_n_llhttp__internal__n_start_req_49; - } - case 'D': { - p++; - goto s_n_llhttp__internal__n_start_req_50; - } - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_51; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_46: - s_n_llhttp__internal__n_start_req_46: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_46; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_47; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_54: - s_n_llhttp__internal__n_start_req_54: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_54; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob49, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 14; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_54; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_56: - s_n_llhttp__internal__n_start_req_56: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_56; - } - switch (*p) { - case 'P': { - p++; - match = 37; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_57: - s_n_llhttp__internal__n_start_req_57: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_57; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob50, 9); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 42; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_57; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_55: - s_n_llhttp__internal__n_start_req_55: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_55; - } - switch (*p) { - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_56; - } - case '_': { - p++; - goto s_n_llhttp__internal__n_start_req_57; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_53: - s_n_llhttp__internal__n_start_req_53: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_53; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_54; - } - case 'T': { - p++; - goto s_n_llhttp__internal__n_start_req_55; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_58: - s_n_llhttp__internal__n_start_req_58: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_58; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob51, 4); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 33; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_58; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_59: - s_n_llhttp__internal__n_start_req_59: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_59; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob52, 7); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 26; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_59; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_52: - s_n_llhttp__internal__n_start_req_52: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_52; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_53; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_58; - } - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_59; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_61: - s_n_llhttp__internal__n_start_req_61: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_61; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob53, 6); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 40; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_61; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_62: - s_n_llhttp__internal__n_start_req_62: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_62; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob54, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_62; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_60: - s_n_llhttp__internal__n_start_req_60: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_60; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_start_req_61; - } - case 'R': { - p++; - goto s_n_llhttp__internal__n_start_req_62; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_65: - s_n_llhttp__internal__n_start_req_65: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_65; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob55, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 18; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_65; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_67: - s_n_llhttp__internal__n_start_req_67: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_67; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob56, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 32; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_67; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_68: - s_n_llhttp__internal__n_start_req_68: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_68; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob57, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 15; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_68; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_66: - s_n_llhttp__internal__n_start_req_66: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_66; - } - switch (*p) { - case 'I': { - p++; - goto s_n_llhttp__internal__n_start_req_67; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_68; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_69: - s_n_llhttp__internal__n_start_req_69: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_req_69; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob58, 8); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 27; - goto s_n_llhttp__internal__n_invoke_store_method_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_req_69; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_64: - s_n_llhttp__internal__n_start_req_64: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_64; - } - switch (*p) { - case 'B': { - p++; - goto s_n_llhttp__internal__n_start_req_65; - } - case 'L': { - p++; - goto s_n_llhttp__internal__n_start_req_66; - } - case 'S': { - p++; - goto s_n_llhttp__internal__n_start_req_69; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_63: - s_n_llhttp__internal__n_start_req_63: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_63; - } - switch (*p) { - case 'N': { - p++; - goto s_n_llhttp__internal__n_start_req_64; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req: - s_n_llhttp__internal__n_start_req: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req; - } - switch (*p) { - case 'A': { - p++; - goto s_n_llhttp__internal__n_start_req_1; - } - case 'B': { - p++; - goto s_n_llhttp__internal__n_start_req_4; - } - case 'C': { - p++; - goto s_n_llhttp__internal__n_start_req_5; - } - case 'D': { - p++; - goto s_n_llhttp__internal__n_start_req_10; - } - case 'F': { - p++; - goto s_n_llhttp__internal__n_start_req_14; - } - case 'G': { - p++; - goto s_n_llhttp__internal__n_start_req_15; - } - case 'H': { - p++; - goto s_n_llhttp__internal__n_start_req_18; - } - case 'L': { - p++; - goto s_n_llhttp__internal__n_start_req_19; - } - case 'M': { - p++; - goto s_n_llhttp__internal__n_start_req_22; - } - case 'N': { - p++; - goto s_n_llhttp__internal__n_start_req_31; - } - case 'O': { - p++; - goto s_n_llhttp__internal__n_start_req_32; - } - case 'P': { - p++; - goto s_n_llhttp__internal__n_start_req_33; - } - case 'R': { - p++; - goto s_n_llhttp__internal__n_start_req_46; - } - case 'S': { - p++; - goto s_n_llhttp__internal__n_start_req_52; - } - case 'T': { - p++; - goto s_n_llhttp__internal__n_start_req_60; - } - case 'U': { - p++; - goto s_n_llhttp__internal__n_start_req_63; - } - default: { - goto s_n_llhttp__internal__n_error_49; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_llhttp__on_status_complete: - s_n_llhttp__internal__n_invoke_llhttp__on_status_complete: { - switch (llhttp__on_status_complete(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_start; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_line_almost_done: - s_n_llhttp__internal__n_res_line_almost_done: { - if (p == endp) { - return s_n_llhttp__internal__n_res_line_almost_done; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_status_complete; - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_status: - s_n_llhttp__internal__n_res_status: { - if (p == endp) { - return s_n_llhttp__internal__n_res_status; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_status; - } - case 13: { - goto s_n_llhttp__internal__n_span_end_llhttp__on_status_1; - } - default: { - p++; - goto s_n_llhttp__internal__n_res_status; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_span_start_llhttp__on_status: - s_n_llhttp__internal__n_span_start_llhttp__on_status: { - if (p == endp) { - return s_n_llhttp__internal__n_span_start_llhttp__on_status; - } - state->_span_pos0 = (void*) p; - state->_span_cb0 = llhttp__on_status; - goto s_n_llhttp__internal__n_res_status; - /* 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) { - return s_n_llhttp__internal__n_res_status_code_otherwise; - } - switch (*p) { - case 10: { - goto s_n_llhttp__internal__n_res_status_start; - } - case 13: { - goto s_n_llhttp__internal__n_res_status_start; - } - case ' ': { - p++; - goto s_n_llhttp__internal__n_res_status_start; - } - default: { - goto s_n_llhttp__internal__n_error_43; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_status_code: - s_n_llhttp__internal__n_res_status_code: { - if (p == endp) { - return s_n_llhttp__internal__n_res_status_code; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_mul_add_status_code; - } - default: { - goto s_n_llhttp__internal__n_res_status_code_otherwise; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_http_end: - s_n_llhttp__internal__n_res_http_end: { - if (p == endp) { - return s_n_llhttp__internal__n_res_http_end; - } - switch (*p) { - case ' ': { - p++; - goto s_n_llhttp__internal__n_invoke_update_status_code; - } - default: { - goto s_n_llhttp__internal__n_error_44; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_http_minor: - s_n_llhttp__internal__n_res_http_minor: { - if (p == endp) { - return s_n_llhttp__internal__n_res_http_minor; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_http_minor_1; - } - default: { - goto s_n_llhttp__internal__n_error_45; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_http_dot: - s_n_llhttp__internal__n_res_http_dot: { - if (p == endp) { - return s_n_llhttp__internal__n_res_http_dot; - } - switch (*p) { - case '.': { - p++; - goto s_n_llhttp__internal__n_res_http_minor; - } - default: { - goto s_n_llhttp__internal__n_error_46; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_res_http_major: - s_n_llhttp__internal__n_res_http_major: { - if (p == endp) { - return s_n_llhttp__internal__n_res_http_major; - } - switch (*p) { - case '0': { - p++; - match = 0; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '1': { - p++; - match = 1; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '2': { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '3': { - p++; - match = 3; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '4': { - p++; - match = 4; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '5': { - p++; - match = 5; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '6': { - p++; - match = 6; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '7': { - p++; - match = 7; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '8': { - p++; - match = 8; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - case '9': { - p++; - match = 9; - goto s_n_llhttp__internal__n_invoke_store_http_major_1; - } - default: { - goto s_n_llhttp__internal__n_error_47; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_res: - s_n_llhttp__internal__n_start_res: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_start_res; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob59, 5); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_res_http_major; - } - case kMatchPause: { - return s_n_llhttp__internal__n_start_res; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_50; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_or_res_method_2: - s_n_llhttp__internal__n_req_or_res_method_2: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_req_or_res_method_2; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob60, 2); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - match = 2; - goto s_n_llhttp__internal__n_invoke_store_method; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_or_res_method_2; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_48; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_or_res_method_3: - s_n_llhttp__internal__n_req_or_res_method_3: { - llparse_match_t match_seq; - - if (p == endp) { - return s_n_llhttp__internal__n_req_or_res_method_3; - } - match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob61, 3); - p = match_seq.current; - switch (match_seq.status) { - case kMatchComplete: { - p++; - goto s_n_llhttp__internal__n_invoke_update_type_1; - } - case kMatchPause: { - return s_n_llhttp__internal__n_req_or_res_method_3; - } - case kMatchMismatch: { - goto s_n_llhttp__internal__n_error_48; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_or_res_method_1: - s_n_llhttp__internal__n_req_or_res_method_1: { - if (p == endp) { - return s_n_llhttp__internal__n_req_or_res_method_1; - } - switch (*p) { - case 'E': { - p++; - goto s_n_llhttp__internal__n_req_or_res_method_2; - } - case 'T': { - p++; - goto s_n_llhttp__internal__n_req_or_res_method_3; - } - default: { - goto s_n_llhttp__internal__n_error_48; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_req_or_res_method: - s_n_llhttp__internal__n_req_or_res_method: { - if (p == endp) { - return s_n_llhttp__internal__n_req_or_res_method; - } - switch (*p) { - case 'H': { - p++; - goto s_n_llhttp__internal__n_req_or_res_method_1; - } - default: { - goto s_n_llhttp__internal__n_error_48; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start_req_or_res: - s_n_llhttp__internal__n_start_req_or_res: { - if (p == endp) { - return s_n_llhttp__internal__n_start_req_or_res; - } - switch (*p) { - case 'H': { - goto s_n_llhttp__internal__n_req_or_res_method; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_type_2; - } - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_invoke_load_type: - s_n_llhttp__internal__n_invoke_load_type: { - switch (llhttp__internal__c_load_type(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_start_req; - case 2: - goto s_n_llhttp__internal__n_start_res; - default: - goto s_n_llhttp__internal__n_start_req_or_res; - } - /* UNREACHABLE */; - abort(); - } - case s_n_llhttp__internal__n_start: - s_n_llhttp__internal__n_start: { - if (p == endp) { - return s_n_llhttp__internal__n_start; - } - switch (*p) { - case 10: { - p++; - goto s_n_llhttp__internal__n_start; - } - case 13: { - p++; - goto s_n_llhttp__internal__n_start; - } - default: { - goto s_n_llhttp__internal__n_invoke_update_finish; - } - } - /* UNREACHABLE */; - abort(); - } - default: - /* UNREACHABLE */ - abort(); - } - s_n_llhttp__internal__n_error_37: { - state->error = 0x7; - state->reason = "Invalid characters in url"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_finish_2: { - switch (llhttp__internal__c_update_finish_1(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_start; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_test_lenient_flags: { - switch (llhttp__internal__c_test_lenient_flags(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_invoke_update_finish_2; - default: - goto s_n_llhttp__internal__n_closed; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_finish_1: { - switch (llhttp__internal__c_update_finish_1(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_test_lenient_flags; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_pause_5: { - 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_9: { - 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_7: { - 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_12: { - 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_7; - default: - goto s_n_llhttp__internal__n_error_12; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_11: { - 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_pause_2: { - 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_pause_1; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_3: { - 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_invoke_llhttp__on_message_complete_1: { - switch (llhttp__on_message_complete(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_pause_1; - case 21: - goto s_n_llhttp__internal__n_pause_2; - default: - goto s_n_llhttp__internal__n_error_3; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_7: { - state->error = 0xc; - state->reason = "Chunk size overflow"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_pause_3: { - 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_update_content_length; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_5: { - 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: { - switch (llhttp__on_chunk_complete(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_invoke_update_content_length; - case 21: - goto s_n_llhttp__internal__n_pause_3; - default: - goto s_n_llhttp__internal__n_error_5; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_body: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_body(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_chunk_data_almost_done; - return s_error; - } - goto s_n_llhttp__internal__n_chunk_data_almost_done; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags: { - switch (llhttp__internal__c_or_flags(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_start; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_pause_4: { - state->error = 0x15; - state->reason = "on_chunk_header pause"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_is_equal_content_length; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_4: { - state->error = 0x13; - state->reason = "`on_chunk_header` 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_header: { - switch (llhttp__on_chunk_header(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_invoke_is_equal_content_length; - case 21: - goto s_n_llhttp__internal__n_pause_4; - default: - goto s_n_llhttp__internal__n_error_4; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_6: { - 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_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_7; - default: - goto s_n_llhttp__internal__n_chunk_size; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_8: { - 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_span_end_llhttp__on_body_1: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_body(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_llhttp__on_message_complete_2; - return s_error; - } - goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_finish_3: { - switch (llhttp__internal__c_update_finish_3(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_span_start_llhttp__on_body_2; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_10: { - state->error = 0xf; - state->reason = "Request has invalid `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_pause: { - 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_llhttp__after_message_complete; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_2: { - 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_invoke_llhttp__on_message_complete: { - switch (llhttp__on_message_complete(state, p, endp)) { - case 0: - 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_2; - } - /* 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_6: { - 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_1: { - 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_6; - default: - goto s_n_llhttp__internal__n_error_1; - } - /* 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_lenient_flags_1: { - switch (llhttp__internal__c_test_lenient_flags_1(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_error_11; - default: - goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete; - } - /* 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_1; - 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; - default: - goto s_n_llhttp__internal__n_invoke_test_flags_1; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_13: { - state->error = 0xb; - state->reason = "Empty 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_span_end_llhttp__on_header_value: { - 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_llhttp__on_header_value_complete; - return s_error; - } - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state: { - switch (llhttp__internal__c_update_header_state(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_3: { - switch (llhttp__internal__c_or_flags_3(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)) { - 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)) { - 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)) { - 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: { - switch (llhttp__internal__c_load_header_state(state, p, endp)) { - case 5: - goto s_n_llhttp__internal__n_invoke_or_flags_3; - case 6: - goto s_n_llhttp__internal__n_invoke_or_flags_4; - case 7: - goto s_n_llhttp__internal__n_invoke_or_flags_5; - case 8: - goto s_n_llhttp__internal__n_invoke_or_flags_6; - default: - goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value; - } - /* UNREACHABLE */; - abort(); - } - 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_error_13; - default: - goto s_n_llhttp__internal__n_invoke_load_header_state_1; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_1: { - switch (llhttp__internal__c_update_header_state(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_7: { - switch (llhttp__internal__c_or_flags_3(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_header_state_1; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_8: { - switch (llhttp__internal__c_or_flags_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_header_state_1; - } - /* UNREACHABLE */; - abort(); - } - 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_1; - } - /* UNREACHABLE */; - abort(); - } - 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_llhttp__on_header_value_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_header_state_3: { - switch (llhttp__internal__c_load_header_state(state, p, endp)) { - case 5: - goto s_n_llhttp__internal__n_invoke_or_flags_7; - case 6: - goto s_n_llhttp__internal__n_invoke_or_flags_8; - case 7: - goto s_n_llhttp__internal__n_invoke_or_flags_9; - case 8: - goto s_n_llhttp__internal__n_invoke_or_flags_10; - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_value_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_14: { - 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_span_end_llhttp__on_header_value_1: { - 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_header_value_almost_done; - return s_error; - } - goto s_n_llhttp__internal__n_header_value_almost_done; - /* 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); - if (err != 0) { - state->error = err; - state->error_pos = (const char*) (p + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_almost_done; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_header_value_almost_done; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3: { - 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 + 1); - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_almost_done; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_header_value_almost_done; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_15: { - state->error = 0xa; - state->reason = "Invalid header value char"; - 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_2: { - switch (llhttp__internal__c_test_lenient_flags_2(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_header_value_lenient; - default: - goto s_n_llhttp__internal__n_error_15; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_3: { - switch (llhttp__internal__c_update_header_state(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_11: { - switch (llhttp__internal__c_or_flags_3(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_header_state_3; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_12: { - switch (llhttp__internal__c_or_flags_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_header_state_3; - } - /* UNREACHABLE */; - abort(); - } - 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_3; - } - /* UNREACHABLE */; - abort(); - } - 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_header_value_connection; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_header_state_4: { - switch (llhttp__internal__c_load_header_state(state, p, endp)) { - case 5: - goto s_n_llhttp__internal__n_invoke_or_flags_11; - case 6: - goto s_n_llhttp__internal__n_invoke_or_flags_12; - case 7: - goto s_n_llhttp__internal__n_invoke_or_flags_13; - case 8: - goto s_n_llhttp__internal__n_invoke_or_flags_14; - default: - goto s_n_llhttp__internal__n_header_value_connection; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_4: { - switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection_token; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_2: { - switch (llhttp__internal__c_update_header_state_2(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection_ws; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_5: { - switch (llhttp__internal__c_update_header_state_5(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection_ws; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_6: { - switch (llhttp__internal__c_update_header_state_6(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_connection_ws; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4: { - 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_error_17; - return s_error; - } - goto s_n_llhttp__internal__n_error_17; - /* 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_4; - 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)) { - default: - goto s_n_llhttp__internal__n_header_value_otherwise; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_value_5: { - 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_error_18; - return s_error; - } - goto s_n_llhttp__internal__n_error_18; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_16: { - state->error = 0x4; - state->reason = "Duplicate 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_flags_2: { - switch (llhttp__internal__c_test_flags_2(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_header_value_content_length; - default: - goto s_n_llhttp__internal__n_error_16; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_7: { - switch (llhttp__internal__c_update_header_state_7(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_otherwise; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_8: { - switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_and_flags: { - switch (llhttp__internal__c_and_flags(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_value_te_chunked; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_or_flags_16: { - switch (llhttp__internal__c_or_flags_16(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_and_flags; - } - /* UNREACHABLE */; - abort(); - } - 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_invoke_update_header_state_8; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_header_state_2: { - switch (llhttp__internal__c_load_header_state(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_header_value_connection; - case 2: - goto s_n_llhttp__internal__n_invoke_test_flags_2; - case 3: - goto s_n_llhttp__internal__n_invoke_or_flags_16; - case 4: - goto s_n_llhttp__internal__n_invoke_or_flags_17; - default: - goto s_n_llhttp__internal__n_header_value; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_field: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_header_field(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_header_field_complete; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_field_complete; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_header_field_1: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_header_field(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_header_field_complete; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_header_field_complete; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_19: { - 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_invoke_update_header_state_9: { - switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_general; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_header_state: { - switch (llhttp__internal__c_store_header_state(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_header_field_colon; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_header_state_10: { - switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_general; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_llhttp__on_url_complete: { - switch (llhttp__on_url_complete(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_header_field_start; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_http_minor: { - switch (llhttp__internal__c_update_http_minor(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_url_complete; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_http_major: { - switch (llhttp__internal__c_update_http_major(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_update_http_minor; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_3: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_20: { - state->error = 0x7; - state->reason = "Expected CRLF"; - 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_url_4: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_23: { - state->error = 0x17; - state->reason = "Pause on PRI/Upgrade"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_24: { - state->error = 0x9; - state->reason = "Expected HTTP/2 Connection Preface"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_22: { - 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_invoke_load_method_1: { - switch (llhttp__internal__c_load_method(state, p, endp)) { - case 34: - goto s_n_llhttp__internal__n_req_pri_upgrade; - default: - goto s_n_llhttp__internal__n_req_http_complete; - } - /* UNREACHABLE */; - abort(); - } - 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_load_method_1; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_25: { - state->error = 0x9; - state->reason = "Invalid minor version"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_26: { - state->error = 0x9; - state->reason = "Expected dot"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_http_major: { - switch (llhttp__internal__c_store_http_major(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_req_http_dot; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_27: { - state->error = 0x9; - state->reason = "Invalid major version"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_21: { - state->error = 0x8; - state->reason = "Invalid method for HTTP/x.x request"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_method: { - switch (llhttp__internal__c_load_method(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_req_http_major; - case 1: - goto s_n_llhttp__internal__n_req_http_major; - case 2: - goto s_n_llhttp__internal__n_req_http_major; - case 3: - goto s_n_llhttp__internal__n_req_http_major; - case 4: - goto s_n_llhttp__internal__n_req_http_major; - case 5: - goto s_n_llhttp__internal__n_req_http_major; - case 6: - goto s_n_llhttp__internal__n_req_http_major; - case 7: - goto s_n_llhttp__internal__n_req_http_major; - case 8: - goto s_n_llhttp__internal__n_req_http_major; - case 9: - goto s_n_llhttp__internal__n_req_http_major; - case 10: - goto s_n_llhttp__internal__n_req_http_major; - case 11: - goto s_n_llhttp__internal__n_req_http_major; - case 12: - goto s_n_llhttp__internal__n_req_http_major; - case 13: - goto s_n_llhttp__internal__n_req_http_major; - case 14: - goto s_n_llhttp__internal__n_req_http_major; - case 15: - goto s_n_llhttp__internal__n_req_http_major; - case 16: - goto s_n_llhttp__internal__n_req_http_major; - case 17: - goto s_n_llhttp__internal__n_req_http_major; - case 18: - goto s_n_llhttp__internal__n_req_http_major; - case 19: - goto s_n_llhttp__internal__n_req_http_major; - case 20: - goto s_n_llhttp__internal__n_req_http_major; - case 21: - goto s_n_llhttp__internal__n_req_http_major; - case 22: - goto s_n_llhttp__internal__n_req_http_major; - case 23: - goto s_n_llhttp__internal__n_req_http_major; - case 24: - goto s_n_llhttp__internal__n_req_http_major; - case 25: - goto s_n_llhttp__internal__n_req_http_major; - case 26: - goto s_n_llhttp__internal__n_req_http_major; - case 27: - goto s_n_llhttp__internal__n_req_http_major; - case 28: - goto s_n_llhttp__internal__n_req_http_major; - case 29: - goto s_n_llhttp__internal__n_req_http_major; - case 30: - goto s_n_llhttp__internal__n_req_http_major; - case 31: - goto s_n_llhttp__internal__n_req_http_major; - case 32: - goto s_n_llhttp__internal__n_req_http_major; - case 33: - goto s_n_llhttp__internal__n_req_http_major; - case 34: - goto s_n_llhttp__internal__n_req_http_major; - default: - goto s_n_llhttp__internal__n_error_21; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_30: { - state->error = 0x8; - state->reason = "Expected HTTP/"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_28: { - state->error = 0x8; - state->reason = "Expected SOURCE method for ICE/x.x request"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_method_2: { - switch (llhttp__internal__c_load_method(state, p, endp)) { - case 33: - goto s_n_llhttp__internal__n_req_http_major; - default: - goto s_n_llhttp__internal__n_error_28; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_29: { - state->error = 0x8; - state->reason = "Invalid method for RTSP/x.x request"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_load_method_3: { - switch (llhttp__internal__c_load_method(state, p, endp)) { - case 1: - goto s_n_llhttp__internal__n_req_http_major; - case 3: - goto s_n_llhttp__internal__n_req_http_major; - case 6: - goto s_n_llhttp__internal__n_req_http_major; - case 35: - goto s_n_llhttp__internal__n_req_http_major; - case 36: - goto s_n_llhttp__internal__n_req_http_major; - case 37: - goto s_n_llhttp__internal__n_req_http_major; - case 38: - goto s_n_llhttp__internal__n_req_http_major; - case 39: - goto s_n_llhttp__internal__n_req_http_major; - case 40: - goto s_n_llhttp__internal__n_req_http_major; - case 41: - goto s_n_llhttp__internal__n_req_http_major; - case 42: - goto s_n_llhttp__internal__n_req_http_major; - case 43: - goto s_n_llhttp__internal__n_req_http_major; - case 44: - goto s_n_llhttp__internal__n_req_http_major; - case 45: - goto s_n_llhttp__internal__n_req_http_major; - default: - goto s_n_llhttp__internal__n_error_29; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_llhttp__on_url_complete_1: { - switch (llhttp__on_url_complete(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_req_http_start; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_5: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_6: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_7: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_8: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_31: { - state->error = 0x7; - state->reason = "Invalid char in url fragment start"; - 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_url_9: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_10: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_11: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_32: { - state->error = 0x7; - state->reason = "Invalid char in url query"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_33: { - state->error = 0x7; - state->reason = "Invalid char in url path"; - 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_url: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_1: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_2: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_12: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_13: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_lf_to_http09; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_lf_to_http09; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_url_14: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_url(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_url_skip_to_http; - return s_error; - } - goto s_n_llhttp__internal__n_url_skip_to_http; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_34: { - state->error = 0x7; - state->reason = "Double @ in url"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_35: { - state->error = 0x7; - state->reason = "Unexpected char in url server"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_36: { - state->error = 0x7; - state->reason = "Unexpected char in url server"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_38: { - state->error = 0x7; - state->reason = "Unexpected char in url schema"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_39: { - state->error = 0x7; - state->reason = "Unexpected char in url schema"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_40: { - state->error = 0x7; - state->reason = "Unexpected start char in url"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_is_equal_method: { - switch (llhttp__internal__c_is_equal_method(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_span_start_llhttp__on_url_1; - default: - goto s_n_llhttp__internal__n_span_start_llhttp__on_url; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_41: { - state->error = 0x6; - state->reason = "Expected space after method"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_method_1: { - switch (llhttp__internal__c_store_method(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_req_first_space_before_url; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_49: { - state->error = 0x6; - state->reason = "Invalid method encountered"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_42: { - state->error = 0xd; - state->reason = "Response overflow"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - 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_42; - default: - goto s_n_llhttp__internal__n_res_status_code; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_status: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_status(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_status_complete; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_invoke_llhttp__on_status_complete; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_span_end_llhttp__on_status_1: { - const unsigned char* start; - int err; - - start = state->_span_pos0; - state->_span_pos0 = NULL; - err = llhttp__on_status(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_res_line_almost_done; - return s_error; - } - p++; - goto s_n_llhttp__internal__n_res_line_almost_done; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_43: { - 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_update_status_code: { - switch (llhttp__internal__c_update_status_code(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_res_status_code; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_44: { - state->error = 0x9; - state->reason = "Expected space 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_invoke_store_http_minor_1: { - switch (llhttp__internal__c_store_http_minor(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_res_http_end; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_45: { - state->error = 0x9; - state->reason = "Invalid minor version"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_46: { - state->error = 0x9; - state->reason = "Expected dot"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_http_major_1: { - switch (llhttp__internal__c_store_http_major(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_res_http_dot; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_47: { - state->error = 0x9; - state->reason = "Invalid major version"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_50: { - state->error = 0x8; - state->reason = "Expected HTTP/"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_type: { - switch (llhttp__internal__c_update_type(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_req_first_space_before_url; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_store_method: { - switch (llhttp__internal__c_store_method(state, p, endp, match)) { - default: - goto s_n_llhttp__internal__n_invoke_update_type; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error_48: { - state->error = 0x8; - state->reason = "Invalid word encountered"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_error; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_type_1: { - switch (llhttp__internal__c_update_type_1(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_res_http_major; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_type_2: { - switch (llhttp__internal__c_update_type(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_start_req; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_pause_8: { - state->error = 0x15; - state->reason = "on_message_begin pause"; - state->error_pos = (const char*) p; - state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_load_type; - return s_error; - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_error: { - state->error = 0x10; - state->reason = "`on_message_begin` 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_message_begin: { - switch (llhttp__on_message_begin(state, p, endp)) { - case 0: - goto s_n_llhttp__internal__n_invoke_load_type; - case 21: - goto s_n_llhttp__internal__n_pause_8; - default: - goto s_n_llhttp__internal__n_error; - } - /* UNREACHABLE */; - abort(); - } - s_n_llhttp__internal__n_invoke_update_finish: { - switch (llhttp__internal__c_update_finish(state, p, endp)) { - default: - goto s_n_llhttp__internal__n_invoke_llhttp__on_message_begin; - } - /* UNREACHABLE */; - abort(); - } -} - -int llhttp__internal_execute(llhttp__internal_t* state, const char* p, const char* endp) { - llparse_state_t next; - - /* check lingering errors */ - if (state->error != 0) { - return state->error; - } - - /* restart spans */ - if (state->_span_pos0 != NULL) { - state->_span_pos0 = (void*) p; - } - - next = llhttp__internal__run(state, (const unsigned char*) p, (const unsigned char*) endp); - if (next == s_error) { - return state->error; - } - state->_current = (void*) (intptr_t) next; - - /* execute spans */ - if (state->_span_pos0 != NULL) { - int error; - - error = ((llhttp__internal__span_cb) state->_span_cb0)(state, state->_span_pos0, (const char*) endp); - if (error != 0) { - state->error = error; - state->error_pos = endp; - return error; - } - } - - return 0; -} - -#endif /* LLHTTP_STRICT_MODE */ diff --git a/external/src/llhttp/llhttp.h b/external/src/llhttp/llhttp.h deleted file mode 100644 index 336234c..0000000 --- a/external/src/llhttp/llhttp.h +++ /dev/null @@ -1,564 +0,0 @@ -#ifndef INCLUDE_LLHTTP_H_ -#define INCLUDE_LLHTTP_H_ - -#define LLHTTP_VERSION_MAJOR 6 -#define LLHTTP_VERSION_MINOR 0 -#define LLHTTP_VERSION_PATCH 4 - -#ifndef LLHTTP_STRICT_MODE -# define LLHTTP_STRICT_MODE 0 -#endif - -#ifndef INCLUDE_LLHTTP_ITSELF_H_ -#define INCLUDE_LLHTTP_ITSELF_H_ -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef struct llhttp__internal_s llhttp__internal_t; -struct llhttp__internal_s { - int32_t _index; - void* _span_pos0; - void* _span_cb0; - int32_t error; - const char* reason; - const char* error_pos; - void* data; - void* _current; - uint64_t content_length; - uint8_t type; - uint8_t method; - uint8_t http_major; - uint8_t http_minor; - uint8_t header_state; - uint8_t lenient_flags; - uint8_t upgrade; - uint8_t finish; - uint16_t flags; - uint16_t status_code; - void* settings; -}; - -int llhttp__internal_init(llhttp__internal_t* s); -int llhttp__internal_execute(llhttp__internal_t* s, const char* p, const char* endp); - -#ifdef __cplusplus -} /* extern "C" */ -#endif -#endif /* INCLUDE_LLHTTP_ITSELF_H_ */ - -#ifndef LLLLHTTP_C_HEADERS_ -#define LLLLHTTP_C_HEADERS_ -#ifdef __cplusplus -extern "C" { -#endif - -enum llhttp_errno { - HPE_OK = 0, - HPE_INTERNAL = 1, - HPE_STRICT = 2, - HPE_LF_EXPECTED = 3, - HPE_UNEXPECTED_CONTENT_LENGTH = 4, - HPE_CLOSED_CONNECTION = 5, - HPE_INVALID_METHOD = 6, - HPE_INVALID_URL = 7, - HPE_INVALID_CONSTANT = 8, - HPE_INVALID_VERSION = 9, - HPE_INVALID_HEADER_TOKEN = 10, - HPE_INVALID_CONTENT_LENGTH = 11, - HPE_INVALID_CHUNK_SIZE = 12, - HPE_INVALID_STATUS = 13, - HPE_INVALID_EOF_STATE = 14, - HPE_INVALID_TRANSFER_ENCODING = 15, - HPE_CB_MESSAGE_BEGIN = 16, - HPE_CB_HEADERS_COMPLETE = 17, - HPE_CB_MESSAGE_COMPLETE = 18, - HPE_CB_CHUNK_HEADER = 19, - HPE_CB_CHUNK_COMPLETE = 20, - HPE_PAUSED = 21, - HPE_PAUSED_UPGRADE = 22, - HPE_PAUSED_H2_UPGRADE = 23, - HPE_USER = 24 -}; -typedef enum llhttp_errno llhttp_errno_t; - -enum llhttp_flags { - F_CONNECTION_KEEP_ALIVE = 0x1, - F_CONNECTION_CLOSE = 0x2, - F_CONNECTION_UPGRADE = 0x4, - F_CHUNKED = 0x8, - F_UPGRADE = 0x10, - F_CONTENT_LENGTH = 0x20, - F_SKIPBODY = 0x40, - F_TRAILING = 0x80, - F_TRANSFER_ENCODING = 0x200 -}; -typedef enum llhttp_flags llhttp_flags_t; - -enum llhttp_lenient_flags { - LENIENT_HEADERS = 0x1, - LENIENT_CHUNKED_LENGTH = 0x2, - LENIENT_KEEP_ALIVE = 0x4 -}; -typedef enum llhttp_lenient_flags llhttp_lenient_flags_t; - -enum llhttp_type { - HTTP_BOTH = 0, - HTTP_REQUEST = 1, - HTTP_RESPONSE = 2 -}; -typedef enum llhttp_type llhttp_type_t; - -enum llhttp_finish { - HTTP_FINISH_SAFE = 0, - HTTP_FINISH_SAFE_WITH_CB = 1, - HTTP_FINISH_UNSAFE = 2 -}; -typedef enum llhttp_finish llhttp_finish_t; - -enum llhttp_method { - HTTP_DELETE = 0, - HTTP_GET = 1, - HTTP_HEAD = 2, - HTTP_POST = 3, - HTTP_PUT = 4, - HTTP_CONNECT = 5, - HTTP_OPTIONS = 6, - HTTP_TRACE = 7, - HTTP_COPY = 8, - HTTP_LOCK = 9, - HTTP_MKCOL = 10, - HTTP_MOVE = 11, - HTTP_PROPFIND = 12, - HTTP_PROPPATCH = 13, - HTTP_SEARCH = 14, - HTTP_UNLOCK = 15, - HTTP_BIND = 16, - HTTP_REBIND = 17, - HTTP_UNBIND = 18, - HTTP_ACL = 19, - HTTP_REPORT = 20, - HTTP_MKACTIVITY = 21, - HTTP_CHECKOUT = 22, - HTTP_MERGE = 23, - HTTP_MSEARCH = 24, - HTTP_NOTIFY = 25, - HTTP_SUBSCRIBE = 26, - HTTP_UNSUBSCRIBE = 27, - HTTP_PATCH = 28, - HTTP_PURGE = 29, - HTTP_MKCALENDAR = 30, - HTTP_LINK = 31, - HTTP_UNLINK = 32, - HTTP_SOURCE = 33, - HTTP_PRI = 34, - HTTP_DESCRIBE = 35, - HTTP_ANNOUNCE = 36, - HTTP_SETUP = 37, - HTTP_PLAY = 38, - HTTP_PAUSE = 39, - HTTP_TEARDOWN = 40, - HTTP_GET_PARAMETER = 41, - HTTP_SET_PARAMETER = 42, - HTTP_REDIRECT = 43, - HTTP_RECORD = 44, - HTTP_FLUSH = 45 -}; -typedef enum llhttp_method llhttp_method_t; - -#define HTTP_ERRNO_MAP(XX) \ - XX(0, OK, OK) \ - XX(1, INTERNAL, INTERNAL) \ - XX(2, STRICT, STRICT) \ - XX(3, LF_EXPECTED, LF_EXPECTED) \ - XX(4, UNEXPECTED_CONTENT_LENGTH, UNEXPECTED_CONTENT_LENGTH) \ - XX(5, CLOSED_CONNECTION, CLOSED_CONNECTION) \ - XX(6, INVALID_METHOD, INVALID_METHOD) \ - XX(7, INVALID_URL, INVALID_URL) \ - XX(8, INVALID_CONSTANT, INVALID_CONSTANT) \ - XX(9, INVALID_VERSION, INVALID_VERSION) \ - XX(10, INVALID_HEADER_TOKEN, INVALID_HEADER_TOKEN) \ - XX(11, INVALID_CONTENT_LENGTH, INVALID_CONTENT_LENGTH) \ - XX(12, INVALID_CHUNK_SIZE, INVALID_CHUNK_SIZE) \ - XX(13, INVALID_STATUS, INVALID_STATUS) \ - XX(14, INVALID_EOF_STATE, INVALID_EOF_STATE) \ - XX(15, INVALID_TRANSFER_ENCODING, INVALID_TRANSFER_ENCODING) \ - XX(16, CB_MESSAGE_BEGIN, CB_MESSAGE_BEGIN) \ - XX(17, CB_HEADERS_COMPLETE, CB_HEADERS_COMPLETE) \ - XX(18, CB_MESSAGE_COMPLETE, CB_MESSAGE_COMPLETE) \ - XX(19, CB_CHUNK_HEADER, CB_CHUNK_HEADER) \ - XX(20, CB_CHUNK_COMPLETE, CB_CHUNK_COMPLETE) \ - XX(21, PAUSED, PAUSED) \ - XX(22, PAUSED_UPGRADE, PAUSED_UPGRADE) \ - XX(23, PAUSED_H2_UPGRADE, PAUSED_H2_UPGRADE) \ - XX(24, USER, USER) \ - - -#define HTTP_METHOD_MAP(XX) \ - XX(0, DELETE, DELETE) \ - XX(1, GET, GET) \ - XX(2, HEAD, HEAD) \ - XX(3, POST, POST) \ - XX(4, PUT, PUT) \ - XX(5, CONNECT, CONNECT) \ - XX(6, OPTIONS, OPTIONS) \ - XX(7, TRACE, TRACE) \ - XX(8, COPY, COPY) \ - XX(9, LOCK, LOCK) \ - XX(10, MKCOL, MKCOL) \ - XX(11, MOVE, MOVE) \ - XX(12, PROPFIND, PROPFIND) \ - XX(13, PROPPATCH, PROPPATCH) \ - XX(14, SEARCH, SEARCH) \ - XX(15, UNLOCK, UNLOCK) \ - XX(16, BIND, BIND) \ - XX(17, REBIND, REBIND) \ - XX(18, UNBIND, UNBIND) \ - XX(19, ACL, ACL) \ - XX(20, REPORT, REPORT) \ - XX(21, MKACTIVITY, MKACTIVITY) \ - XX(22, CHECKOUT, CHECKOUT) \ - XX(23, MERGE, MERGE) \ - XX(24, MSEARCH, M-SEARCH) \ - XX(25, NOTIFY, NOTIFY) \ - XX(26, SUBSCRIBE, SUBSCRIBE) \ - XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \ - XX(28, PATCH, PATCH) \ - XX(29, PURGE, PURGE) \ - XX(30, MKCALENDAR, MKCALENDAR) \ - XX(31, LINK, LINK) \ - XX(32, UNLINK, UNLINK) \ - XX(33, SOURCE, SOURCE) \ - - -#define RTSP_METHOD_MAP(XX) \ - XX(1, GET, GET) \ - XX(3, POST, POST) \ - XX(6, OPTIONS, OPTIONS) \ - XX(35, DESCRIBE, DESCRIBE) \ - XX(36, ANNOUNCE, ANNOUNCE) \ - XX(37, SETUP, SETUP) \ - XX(38, PLAY, PLAY) \ - XX(39, PAUSE, PAUSE) \ - XX(40, TEARDOWN, TEARDOWN) \ - XX(41, GET_PARAMETER, GET_PARAMETER) \ - XX(42, SET_PARAMETER, SET_PARAMETER) \ - XX(43, REDIRECT, REDIRECT) \ - XX(44, RECORD, RECORD) \ - XX(45, FLUSH, FLUSH) \ - - -#define HTTP_ALL_METHOD_MAP(XX) \ - XX(0, DELETE, DELETE) \ - XX(1, GET, GET) \ - XX(2, HEAD, HEAD) \ - XX(3, POST, POST) \ - XX(4, PUT, PUT) \ - XX(5, CONNECT, CONNECT) \ - XX(6, OPTIONS, OPTIONS) \ - XX(7, TRACE, TRACE) \ - XX(8, COPY, COPY) \ - XX(9, LOCK, LOCK) \ - XX(10, MKCOL, MKCOL) \ - XX(11, MOVE, MOVE) \ - XX(12, PROPFIND, PROPFIND) \ - XX(13, PROPPATCH, PROPPATCH) \ - XX(14, SEARCH, SEARCH) \ - XX(15, UNLOCK, UNLOCK) \ - XX(16, BIND, BIND) \ - XX(17, REBIND, REBIND) \ - XX(18, UNBIND, UNBIND) \ - XX(19, ACL, ACL) \ - XX(20, REPORT, REPORT) \ - XX(21, MKACTIVITY, MKACTIVITY) \ - XX(22, CHECKOUT, CHECKOUT) \ - XX(23, MERGE, MERGE) \ - XX(24, MSEARCH, M-SEARCH) \ - XX(25, NOTIFY, NOTIFY) \ - XX(26, SUBSCRIBE, SUBSCRIBE) \ - XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \ - XX(28, PATCH, PATCH) \ - XX(29, PURGE, PURGE) \ - XX(30, MKCALENDAR, MKCALENDAR) \ - XX(31, LINK, LINK) \ - XX(32, UNLINK, UNLINK) \ - XX(33, SOURCE, SOURCE) \ - XX(34, PRI, PRI) \ - XX(35, DESCRIBE, DESCRIBE) \ - XX(36, ANNOUNCE, ANNOUNCE) \ - XX(37, SETUP, SETUP) \ - XX(38, PLAY, PLAY) \ - XX(39, PAUSE, PAUSE) \ - XX(40, TEARDOWN, TEARDOWN) \ - XX(41, GET_PARAMETER, GET_PARAMETER) \ - XX(42, SET_PARAMETER, SET_PARAMETER) \ - XX(43, REDIRECT, REDIRECT) \ - XX(44, RECORD, RECORD) \ - XX(45, FLUSH, FLUSH) \ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif -#endif /* LLLLHTTP_C_HEADERS_ */ - -#ifndef INCLUDE_LLHTTP_API_H_ -#define INCLUDE_LLHTTP_API_H_ -#ifdef __cplusplus -extern "C" { -#endif -#include - -#if defined(__wasm__) -#define LLHTTP_EXPORT __attribute__((visibility("default"))) -#else -#define LLHTTP_EXPORT -#endif - -typedef llhttp__internal_t llhttp_t; -typedef struct llhttp_settings_s llhttp_settings_t; - -typedef int (*llhttp_data_cb)(llhttp_t*, const char *at, size_t length); -typedef int (*llhttp_cb)(llhttp_t*); - -struct llhttp_settings_s { - /* Possible return values 0, -1, `HPE_PAUSED` */ - llhttp_cb on_message_begin; - - /* Possible return values 0, -1, HPE_USER */ - llhttp_data_cb on_url; - llhttp_data_cb on_status; - llhttp_data_cb on_header_field; - llhttp_data_cb on_header_value; - - /* Possible return values: - * 0 - Proceed normally - * 1 - Assume that request/response has no body, and proceed to parsing the - * next message - * 2 - Assume absence of body (as above) and make `llhttp_execute()` return - * `HPE_PAUSED_UPGRADE` - * -1 - Error - * `HPE_PAUSED` - */ - llhttp_cb on_headers_complete; - - /* Possible return values 0, -1, HPE_USER */ - llhttp_data_cb on_body; - - /* Possible return values 0, -1, `HPE_PAUSED` */ - llhttp_cb on_message_complete; - - /* When on_chunk_header is called, the current chunk length is stored - * in parser->content_length. - * Possible return values 0, -1, `HPE_PAUSED` - */ - llhttp_cb on_chunk_header; - llhttp_cb on_chunk_complete; - - /* Information-only callbacks, return value is ignored */ - llhttp_cb on_url_complete; - llhttp_cb on_status_complete; - llhttp_cb on_header_field_complete; - llhttp_cb on_header_value_complete; -}; - -/* Initialize the parser with specific type and user settings. - * - * NOTE: lifetime of `settings` has to be at least the same as the lifetime of - * the `parser` here. In practice, `settings` has to be either a static - * variable or be allocated with `malloc`, `new`, etc. - */ -LLHTTP_EXPORT -void llhttp_init(llhttp_t* parser, llhttp_type_t type, - const llhttp_settings_t* settings); - -#if defined(__wasm__) - -LLHTTP_EXPORT -llhttp_t* llhttp_alloc(llhttp_type_t type); - -LLHTTP_EXPORT -void llhttp_free(llhttp_t* parser); - -LLHTTP_EXPORT -uint8_t llhttp_get_type(llhttp_t* parser); - -LLHTTP_EXPORT -uint8_t llhttp_get_http_major(llhttp_t* parser); - -LLHTTP_EXPORT -uint8_t llhttp_get_http_minor(llhttp_t* parser); - -LLHTTP_EXPORT -uint8_t llhttp_get_method(llhttp_t* parser); - -LLHTTP_EXPORT -int llhttp_get_status_code(llhttp_t* parser); - -LLHTTP_EXPORT -uint8_t llhttp_get_upgrade(llhttp_t* parser); - -#endif // defined(__wasm__) - -/* Reset an already initialized parser back to the start state, preserving the - * existing parser type, callback settings, user data, and lenient flags. - */ -LLHTTP_EXPORT -void llhttp_reset(llhttp_t* parser); - -/* Initialize the settings object */ -LLHTTP_EXPORT -void llhttp_settings_init(llhttp_settings_t* settings); - -/* Parse full or partial request/response, invoking user callbacks along the - * way. - * - * If any of `llhttp_data_cb` returns errno not equal to `HPE_OK` - the parsing - * interrupts, and such errno is returned from `llhttp_execute()`. If - * `HPE_PAUSED` was used as a errno, the execution can be resumed with - * `llhttp_resume()` call. - * - * In a special case of CONNECT/Upgrade request/response `HPE_PAUSED_UPGRADE` - * is returned after fully parsing the request/response. If the user wishes to - * continue parsing, they need to invoke `llhttp_resume_after_upgrade()`. - * - * NOTE: if this function ever returns a non-pause type error, it will continue - * to return the same error upon each successive call up until `llhttp_init()` - * is called. - */ -LLHTTP_EXPORT -llhttp_errno_t llhttp_execute(llhttp_t* parser, const char* data, size_t len); - -/* This method should be called when the other side has no further bytes to - * send (e.g. shutdown of readable side of the TCP connection.) - * - * Requests without `Content-Length` and other messages might require treating - * all incoming bytes as the part of the body, up to the last byte of the - * connection. This method will invoke `on_message_complete()` callback if the - * request was terminated safely. Otherwise a error code would be returned. - */ -LLHTTP_EXPORT -llhttp_errno_t llhttp_finish(llhttp_t* parser); - -/* Returns `1` if the incoming message is parsed until the last byte, and has - * to be completed by calling `llhttp_finish()` on EOF - */ -LLHTTP_EXPORT -int llhttp_message_needs_eof(const llhttp_t* parser); - -/* Returns `1` if there might be any other messages following the last that was - * successfully parsed. - */ -LLHTTP_EXPORT -int llhttp_should_keep_alive(const llhttp_t* parser); - -/* Make further calls of `llhttp_execute()` return `HPE_PAUSED` and set - * appropriate error reason. - * - * Important: do not call this from user callbacks! User callbacks must return - * `HPE_PAUSED` if pausing is required. - */ -LLHTTP_EXPORT -void llhttp_pause(llhttp_t* parser); - -/* Might be called to resume the execution after the pause in user's callback. - * See `llhttp_execute()` above for details. - * - * Call this only if `llhttp_execute()` returns `HPE_PAUSED`. - */ -LLHTTP_EXPORT -void llhttp_resume(llhttp_t* parser); - -/* Might be called to resume the execution after the pause in user's callback. - * See `llhttp_execute()` above for details. - * - * Call this only if `llhttp_execute()` returns `HPE_PAUSED_UPGRADE` - */ -LLHTTP_EXPORT -void llhttp_resume_after_upgrade(llhttp_t* parser); - -/* Returns the latest return error */ -LLHTTP_EXPORT -llhttp_errno_t llhttp_get_errno(const llhttp_t* parser); - -/* Returns the verbal explanation of the latest returned error. - * - * Note: User callback should set error reason when returning the error. See - * `llhttp_set_error_reason()` for details. - */ -LLHTTP_EXPORT -const char* llhttp_get_error_reason(const llhttp_t* parser); - -/* Assign verbal description to the returned error. Must be called in user - * callbacks right before returning the errno. - * - * Note: `HPE_USER` error code might be useful in user callbacks. - */ -LLHTTP_EXPORT -void llhttp_set_error_reason(llhttp_t* parser, const char* reason); - -/* Returns the pointer to the last parsed byte before the returned error. The - * pointer is relative to the `data` argument of `llhttp_execute()`. - * - * Note: this method might be useful for counting the number of parsed bytes. - */ -LLHTTP_EXPORT -const char* llhttp_get_error_pos(const llhttp_t* parser); - -/* Returns textual name of error code */ -LLHTTP_EXPORT -const char* llhttp_errno_name(llhttp_errno_t err); - -/* Returns textual name of HTTP method */ -LLHTTP_EXPORT -const char* llhttp_method_name(llhttp_method_t method); - - -/* Enables/disables lenient header value parsing (disabled by default). - * - * Lenient parsing disables header value token checks, extending llhttp's - * protocol support to highly non-compliant clients/server. No - * `HPE_INVALID_HEADER_TOKEN` will be raised for incorrect header values when - * lenient parsing is "on". - * - * **(USE AT YOUR OWN RISK)** - */ -LLHTTP_EXPORT -void llhttp_set_lenient_headers(llhttp_t* parser, int enabled); - - -/* Enables/disables lenient handling of conflicting `Transfer-Encoding` and - * `Content-Length` headers (disabled by default). - * - * Normally `llhttp` would error when `Transfer-Encoding` is present in - * conjunction with `Content-Length`. This error is important to prevent HTTP - * request smuggling, but may be less desirable for small number of cases - * involving legacy servers. - * - * **(USE AT YOUR OWN RISK)** - */ -LLHTTP_EXPORT -void llhttp_set_lenient_chunked_length(llhttp_t* parser, int enabled); - - -/* Enables/disables lenient handling of `Connection: close` and HTTP/1.0 - * requests responses. - * - * Normally `llhttp` would error on (in strict mode) or discard (in loose mode) - * the HTTP request/response after the request/response with `Connection: close` - * and `Content-Length`. This is important to prevent cache poisoning attacks, - * but might interact badly with outdated and insecure clients. With this flag - * the extra request/response will be parsed normally. - * - * **(USE AT YOUR OWN RISK)** - */ -void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled); - -#ifdef __cplusplus -} /* extern "C" */ -#endif -#endif /* INCLUDE_LLHTTP_API_H_ */ - -#endif /* INCLUDE_LLHTTP_H_ */ diff --git a/src/console_commands.cpp b/src/console_commands.cpp index b50f378..1cf694d 100644 --- a/src/console_commands.cpp +++ b/src/console_commands.cpp @@ -232,6 +232,7 @@ void ConsoleCommands::run() if (std::cin.eof()) { LOGINFO(1, "EOF, stopping"); + do_exit(m_pool, nullptr); return; } diff --git a/src/json_rpc_request.cpp b/src/json_rpc_request.cpp index ebdd2c5..5c53c56 100644 --- a/src/json_rpc_request.cpp +++ b/src/json_rpc_request.cpp @@ -18,235 +18,318 @@ #include "common.h" #include "uv_util.h" #include "json_rpc_request.h" -#include "llhttp.h" -#include +#include static constexpr char log_category_prefix[] = "JSONRPCRequest "; namespace p2pool { +namespace JSONRPCRequest { -JSONRPCRequest::JSONRPCRequest(const char* address, int port, const char* req, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop) - : m_socket{} - , m_connect{} - , m_write{} +struct CurlContext +{ + CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop); + ~CurlContext(); + + static int socket_func(CURL* easy, curl_socket_t s, int action, void* userp, void* socketp) + { + CurlContext* ctx = reinterpret_cast(socketp ? socketp : userp); + return ctx->on_socket(easy, s, action); + } + + static int timer_func(CURLM* multi, long timeout_ms, void* ctx) + { + return reinterpret_cast(ctx)->on_timer(multi, timeout_ms); + } + + static size_t write_func(const void* buffer, size_t size, size_t count, void* ctx) + { + return reinterpret_cast(ctx)->on_write(buffer, size, count); + } + + int on_socket(CURL* easy, curl_socket_t s, int action); + int on_timer(CURLM* multi, long timeout_ms); + + static void on_timeout(uv_handle_t* req); + + size_t on_write(const void* buffer, size_t size, size_t count); + + static void curl_perform(uv_poll_t* req, int status, int events); + void check_multi_info(); + + static void on_close(uv_handle_t* h); + + uv_poll_t m_pollHandle; + curl_socket_t m_socket; + + CallbackBase* m_callback; + CallbackBase* m_closeCallback; + + uv_loop_t* m_loop; + uv_timer_t m_timer; + uv_async_t m_async; + CURLM* m_multiHandle; + CURL* m_handle; + + std::string m_url; + std::string m_req; + std::string m_auth; + + std::vector m_response; + std::string m_error; +}; + +CurlContext::CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop) + : m_pollHandle{} + , m_socket{} , m_callback(cb) , m_closeCallback(close_cb) - , m_contentLength(0) - , m_contentLengthHeader(false) - , m_readBufInUse(false) - , m_valid(true) + , m_loop(loop) + , m_timer{} + , m_async{} + , m_multiHandle(nullptr) + , m_handle(nullptr) + , m_req(req) + , m_auth(auth) { - m_readBuf[0] = '\0'; + { + char buf[log::Stream::BUF_SIZE + 1]; + buf[0] = '\0'; - uv_tcp_init(loop ? loop : uv_default_loop_checked(), &m_socket); - uv_tcp_nodelay(&m_socket, 1); + log::Stream s(buf); + s << "http://" << address << ':' << port; - sockaddr_storage addr; - if (uv_ip4_addr(address, port, reinterpret_cast(&addr)) != 0) { - const int err = uv_ip6_addr(address, port, reinterpret_cast(&addr)); - if (err) { - LOGERR(1, "invalid IP address " << address << " or port " << port); - m_valid = false; - return; + if (!m_req.empty() && (m_req.front() == '/')) { + s << m_req.c_str() << '\0'; + m_req.clear(); + } + else { + s << "/json_rpc\0"; } - } - - m_socket.data = this; - m_connect.data = this; - m_write.data = this; - const char* uri = "/json_rpc"; + m_url = buf; + } - size_t len = req ? strlen(req) : 0; - if (!len) { - LOGERR(1, "Empty JSONRPCRequest, fix the code!"); - m_valid = false; - return; + int err = uv_timer_init(m_loop, &m_timer); + if (err) { + LOGERR(1, "uv_timer_init failed, error " << uv_err_name(err)); + throw std::runtime_error("uv_timer_init failed"); } + m_timer.data = this; - if (req[0] == '/') { - uri = req; - len = 0; + err = uv_async_init(m_loop, &m_async, reinterpret_cast(on_timeout)); + if (err) { + LOGERR(1, "uv_async_init failed, error " << uv_err_name(err)); + uv_close(reinterpret_cast(&m_timer), nullptr); + throw std::runtime_error("uv_async_init failed"); + } + m_async.data = this; + + m_multiHandle = curl_multi_init(); + if (!m_multiHandle) { + constexpr char msg[] = "curl_multi_init() failed"; + LOGERR(1, msg); + uv_close(reinterpret_cast(&m_async), nullptr); + uv_close(reinterpret_cast(&m_timer), nullptr); + throw std::runtime_error(msg); } - m_request.reserve(std::max(len + 128, log::Stream::BUF_SIZE + 1)); - m_request.resize(log::Stream::BUF_SIZE + 1); + curl_multi_setopt(m_multiHandle, CURLMOPT_SOCKETFUNCTION, socket_func); + curl_multi_setopt(m_multiHandle, CURLMOPT_SOCKETDATA, this); + + curl_multi_setopt(m_multiHandle, CURLMOPT_TIMERFUNCTION, timer_func); + curl_multi_setopt(m_multiHandle, CURLMOPT_TIMERDATA, this); + + m_handle = curl_easy_init(); + if (!m_handle) { + constexpr char msg[] = "curl_easy_init() failed"; + LOGERR(1, msg); + curl_multi_cleanup(m_multiHandle); + uv_close(reinterpret_cast(&m_async), nullptr); + uv_close(reinterpret_cast(&m_timer), nullptr); + throw std::runtime_error(msg); + } - log::Stream s(m_request.data(), m_request.size()); - s << "POST " << uri << " HTTP/1.1\nContent-Type: application/json\nContent-Length: " << len << "\n\n"; + curl_easy_setopt(m_handle, CURLOPT_WRITEFUNCTION, write_func); + curl_easy_setopt(m_handle, CURLOPT_WRITEDATA, this); - m_request.resize(s.m_pos); - m_request.insert(m_request.end(), req, req + len); + curl_easy_setopt(m_handle, CURLOPT_URL, m_url.c_str()); + curl_easy_setopt(m_handle, CURLOPT_POSTFIELDS, m_req.c_str()); + curl_easy_setopt(m_handle, CURLOPT_CONNECTTIMEOUT, 1); + curl_easy_setopt(m_handle, CURLOPT_TIMEOUT, 10); - m_response.reserve(sizeof(m_readBuf)); + if (!m_auth.empty()) { + curl_easy_setopt(m_handle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST | CURLAUTH_ONLY); + curl_easy_setopt(m_handle, CURLOPT_USERPWD, m_auth.c_str()); + } - const int err = uv_tcp_connect(&m_connect, &m_socket, reinterpret_cast(&addr), on_connect); - if (err) { - LOGERR(1, "failed to initiate tcp connection to " << address << ", error " << uv_err_name(err)); - m_valid = false; + CURLMcode curl_err = curl_multi_add_handle(m_multiHandle, m_handle); + if (curl_err != CURLM_OK) { + LOGERR(1, "curl_multi_add_handle failed, error " << curl_multi_strerror(curl_err)); + curl_easy_cleanup(m_handle); + curl_multi_cleanup(m_multiHandle); + uv_close(reinterpret_cast(&m_async), nullptr); + uv_close(reinterpret_cast(&m_timer), nullptr); + throw std::runtime_error("curl_multi_add_handle failed"); } } -void JSONRPCRequest::on_connect(uv_connect_t* req, int status) +CurlContext::~CurlContext() { - JSONRPCRequest* pThis = static_cast(req->data); - - if (status != 0) { - pThis->m_error = uv_err_name(status); - LOGERR(1, "failed to connect, error " << pThis->m_error); - pThis->close(); - return; + if (m_error.empty() && !m_response.empty()) { + (*m_callback)(m_response.data(), m_response.size()); } + delete m_callback; - uv_buf_t buf[1]; - buf[0].base = pThis->m_request.data(); - buf[0].len = static_cast(pThis->m_request.size()); - - uv_write(&pThis->m_write, reinterpret_cast(&pThis->m_socket), buf, 1, on_write); + (*m_closeCallback)(m_error.c_str(), m_error.length()); + delete m_closeCallback; } -void JSONRPCRequest::on_write(uv_write_t* handle, int status) +int CurlContext::on_socket(CURL* /*easy*/, curl_socket_t s, int action) { - JSONRPCRequest* pThis = static_cast(handle->data); + switch (action) { + case CURL_POLL_IN: + case CURL_POLL_OUT: + case CURL_POLL_INOUT: + { + if (!m_socket) { + m_socket = s; + curl_multi_assign(m_multiHandle, s, this); + } + else if (m_socket != s) { + LOGERR(1, "This code can't work with multiple parallel requests. Fix the code!"); + } - if (status != 0) { - pThis->m_error = uv_err_name(status); - LOGERR(1, "failed to send request, error " << pThis->m_error); - pThis->close(); - return; + int events = 0; + if (action != CURL_POLL_IN) events |= UV_WRITABLE; + if (action != CURL_POLL_OUT) events |= UV_READABLE; + + if (!m_pollHandle.data) { + uv_poll_init_socket(m_loop, &m_pollHandle, s); + m_pollHandle.data = this; + } + + uv_poll_start(&m_pollHandle, events, curl_perform); + } + break; + + case CURL_POLL_REMOVE: + default: + curl_multi_assign(m_multiHandle, s, nullptr); + uv_poll_stop(&m_pollHandle); + uv_close(reinterpret_cast(&m_async), on_close); + uv_close(reinterpret_cast(&m_timer), on_close); + uv_close(reinterpret_cast(&m_pollHandle), on_close); + break; } - uv_read_start(reinterpret_cast(&pThis->m_socket), on_alloc, on_read); + return 0; } -void JSONRPCRequest::on_alloc(uv_handle_t* handle, size_t /*suggested_size*/, uv_buf_t* buf) +int CurlContext::on_timer(CURLM* /*multi*/, long timeout_ms) { - JSONRPCRequest* pThis = static_cast(handle->data); + if (timeout_ms < 0) { + uv_timer_stop(&m_timer); + return 0; + } - if (pThis->m_readBufInUse) { - LOGERR(1, "read buffer is already in use"); + if (timeout_ms == 0) { + // 0 ms timeout, but we can't just call on_timeout() here - we have to kick the UV loop + uv_async_send(&m_async); + return 0; } - buf->len = sizeof(pThis->m_readBuf); - buf->base = pThis->m_readBuf; - pThis->m_readBufInUse = true; + uv_timer_start(&m_timer, reinterpret_cast(on_timeout), timeout_ms, 0); + return 0; } -void JSONRPCRequest::on_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) +void CurlContext::on_timeout(uv_handle_t* req) { - JSONRPCRequest* pThis = static_cast(stream->data); - pThis->m_readBufInUse = false; + CurlContext* ctx = reinterpret_cast(req->data); - if (nread > 0) { - pThis->on_read(buf->base, nread); - } - else if (nread < 0) { - if (nread != UV_EOF){ - pThis->m_error = uv_err_name(static_cast(nread)); - LOGERR(1, "failed to read response, error " << pThis->m_error); - } - pThis->close(); - } + int running_handles; + curl_multi_socket_action(ctx->m_multiHandle, CURL_SOCKET_TIMEOUT, 0, &running_handles); + ctx->check_multi_info(); } -void JSONRPCRequest::on_read(const char* data, size_t size) +size_t CurlContext::on_write(const void* buffer, size_t size, size_t count) { - m_response.append(data, size); + const char* p = reinterpret_cast(buffer); + m_response.insert(m_response.end(), p, p + size * count); + return count; +} - static constexpr char headers_end[] = "\r\n\r\n"; - if (m_response.find(headers_end) == std::string::npos) { - return; +void CurlContext::curl_perform(uv_poll_t* req, int status, int events) +{ + int flags = 0; + if (status < 0) { + flags |= CURL_CSELECT_ERR; + LOGERR(1, "uv_poll_start returned error " << uv_err_name(status)); + } + else { + if (events & UV_READABLE) flags |= CURL_CSELECT_IN; + if (events & UV_WRITABLE) flags |= CURL_CSELECT_OUT; } - llhttp_settings_t settings{}; - - settings.on_status = [](llhttp_t*, const char* at, size_t length) - { - if ((length == 2) && (!memcmp(at, "Ok", 2) || !memcmp(at, "OK", 2))) { - return 0; - } - return -1; - }; + CurlContext* ctx = reinterpret_cast(req->data); - settings.on_header_field = [](llhttp_t* parser, const char* at, size_t length) - { - JSONRPCRequest* pThis = static_cast(parser->data); - static const char header[] = "Content-Length"; - pThis->m_contentLengthHeader = ((length == sizeof(header) - 1) && (memcmp(at, header, length) == 0)); - return 0; - }; + int running_handles; + curl_multi_socket_action(ctx->m_multiHandle, ctx->m_socket, flags, &running_handles); + ctx->check_multi_info(); +} - settings.on_header_value = [](llhttp_t* parser, const char* at, size_t length) - { - JSONRPCRequest* pThis = static_cast(parser->data); - if (pThis->m_contentLengthHeader) { - uint32_t k = 0; - for (const char* p = at; p < at + length; ++p) { - if ('0' <= *p && *p <= '9') { - k = k * 10 + (*p - '0'); - } - else { - return -1; - } - } - if (!k) { - return -1; +void CurlContext::check_multi_info() +{ + int pending; + while (CURLMsg* message = curl_multi_info_read(m_multiHandle, &pending)) { + if (message->msg == CURLMSG_DONE) { + if ((message->data.result != CURLE_OK) || m_response.empty()) { + m_error = m_response.empty() ? "empty response" : curl_easy_strerror(message->data.result); } - pThis->m_contentLength = k; - } - return 0; - }; - - settings.on_body = [](llhttp_t* parser, const char* at, size_t length) - { - JSONRPCRequest* pThis = static_cast(parser->data); - if (pThis->m_contentLength && (length >= pThis->m_contentLength) && pThis->m_callback) { - (*pThis->m_callback)(at, length); - delete pThis->m_callback; - pThis->m_callback = nullptr; - } - return 0; - }; - llhttp_t parser; - llhttp_init(&parser, HTTP_RESPONSE, &settings); + long http_code = 0; + curl_easy_getinfo(message->easy_handle, CURLINFO_RESPONSE_CODE, &http_code); - parser.data = this; - - const llhttp_errno result = llhttp_execute(&parser, m_response.c_str(), m_response.length()); - if (result != HPE_OK) { - m_error = "failed to parse response"; - LOGERR(1, m_error << ", result = " << static_cast(result)); - close(); - return; - } + if (http_code != 200) { + char buf[32] = {}; + log::Stream s(buf); + s << "HTTP error " << static_cast(http_code) << '\0'; + m_error = buf; + } - if (!m_callback) { - close(); + curl_multi_remove_handle(m_multiHandle, m_handle); + curl_easy_cleanup(m_handle); + curl_multi_cleanup(m_multiHandle); + return; + } } } -void JSONRPCRequest::close() +void CurlContext::on_close(uv_handle_t* h) { - uv_handle_t* h = reinterpret_cast(&m_socket); - if (!uv_is_closing(h)) { - uv_close(h, on_close); - } -} + CurlContext* ctx = reinterpret_cast(h->data); + h->data = nullptr; -void JSONRPCRequest::on_close(uv_handle_t* handle) -{ - JSONRPCRequest* req = static_cast(handle->data); - if (req->m_closeCallback) { - (*req->m_closeCallback)(req->m_error.c_str(), req->m_error.length()); + if (ctx->m_timer.data || ctx->m_async.data || ctx->m_pollHandle.data) { + return; } - delete req; + + delete ctx; } -JSONRPCRequest::~JSONRPCRequest() +void Call(const std::string& address, int port, const std::string& req, const std::string& auth, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop) { - delete m_callback; - delete m_closeCallback; + CallOnLoop(loop, + [=]() + { + try { + new CurlContext(address, port, req, auth, cb, close_cb, loop); + } + catch (const std::exception& e) { + const char* msg = e.what(); + (*close_cb)(msg, strlen(msg)); + } + }); } +} // namespace JSONRPCRequest } // namespace p2pool diff --git a/src/json_rpc_request.h b/src/json_rpc_request.h index 1061ce9..3c4fd55 100644 --- a/src/json_rpc_request.h +++ b/src/json_rpc_request.h @@ -18,78 +18,32 @@ #pragma once namespace p2pool { +namespace JSONRPCRequest { -class JSONRPCRequest +struct CallbackBase { -public: - template - static FORCEINLINE void call(const char* address, int port, const char* req, T&& cb) - { - // It will be deleted in one of the tcp callbacks eventually - JSONRPCRequest* r = new JSONRPCRequest(address, port, req, new Callback(std::move(cb)), nullptr, nullptr); - if (!r->m_valid) { - delete r; - } - } + virtual ~CallbackBase() {} + virtual void operator()(const char* data, size_t size) = 0; +}; - template - static FORCEINLINE void call(const char* address, int port, const char* req, T&& cb, U&& close_cb, uv_loop_t* loop = nullptr) - { - // It will be deleted in one of the tcp callbacks eventually - CallbackBase* close_callback = new Callback(std::move(close_cb)); - JSONRPCRequest* r = new JSONRPCRequest(address, port, req, new Callback(std::move(cb)), close_callback, loop); - if (!r->m_valid) { - constexpr char err[] = "internal error"; - (*close_callback)(err, sizeof(err) - 1); - delete r; - } - } +template +struct Callback : public CallbackBase +{ + explicit FORCEINLINE Callback(T&& cb) : m_cb(std::move(cb)) {} + void operator()(const char* data, size_t size) override { m_cb(data, size); } private: - struct CallbackBase - { - virtual ~CallbackBase() {} - virtual void operator()(const char* data, size_t size) = 0; - }; - - template - struct Callback : public CallbackBase - { - explicit FORCEINLINE Callback(T&& cb) : m_cb(std::move(cb)) {} - void operator()(const char* data, size_t size) override { m_cb(data, size); } - - private: - Callback& operator=(Callback&&) = delete; - T m_cb; - }; - - JSONRPCRequest(const char* address, int port, const char* req, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop); - ~JSONRPCRequest(); - - static void on_connect(uv_connect_t* req, int status); - static void on_write(uv_write_t* handle, int status); - static void on_alloc(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf); - static void on_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); - void on_read(const char* data, size_t size); - // cppcheck-suppress functionConst - void close(); - static void on_close(uv_handle_t* handle); - - uv_tcp_t m_socket; - uv_connect_t m_connect; - uv_write_t m_write; + Callback& operator=(Callback&&) = delete; + T m_cb; +}; - CallbackBase* m_callback; - CallbackBase* m_closeCallback; - uint32_t m_contentLength; - bool m_contentLengthHeader; +void Call(const std::string& address, int port, const std::string& req, const std::string& auth, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop); - std::vector m_request; - std::string m_response; - char m_readBuf[65536]; - bool m_readBufInUse; - bool m_valid; - std::string m_error; -}; +template +FORCEINLINE void call(const std::string& address, int port, const std::string& req, const std::string& auth, T&& cb, U&& close_cb, uv_loop_t* loop = uv_default_loop_checked()) +{ + Call(address, port, req, auth, new Callback(std::move(cb)), new Callback(std::move(close_cb)), loop); +} +} // namespace JSONRPCRequest } // namespace p2pool diff --git a/src/main.cpp b/src/main.cpp index 866663e..3d0f7f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,6 +46,7 @@ void p2pool_usage() "--start-mining N Start built-in miner using N threads (any value between 1 and 64)\n" "--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from %d to %d\n" "--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum\n" + "--rpc-login Specify username[:password] required for Monero RPC server\n" "--help Show this help message\n\n" "Example command line:\n\n" "%s --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:%d --p2p 0.0.0.0:%d\n\n", diff --git a/src/p2p_server.cpp b/src/p2p_server.cpp index 2a88c16..a06c20f 100644 --- a/src/p2p_server.cpp +++ b/src/p2p_server.cpp @@ -555,7 +555,7 @@ void P2PServer::load_monerod_peer_list() { const Params& params = m_pool->params(); - JSONRPCRequest::call(params.m_host.c_str(), params.m_rpcPort, "/get_peer_list", + JSONRPCRequest::call(params.m_host, params.m_rpcPort, "/get_peer_list", params.m_rpcLogin, [this](const char* data, size_t size) { #define ERR_STR "/get_peer_list RPC request returned invalid JSON " diff --git a/src/p2pool.cpp b/src/p2pool.cpp index 33cdc33..39b046f 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -38,6 +38,7 @@ #include "keccak.h" #include #include +#include constexpr char log_category_prefix[] = "P2Pool "; constexpr int BLOCK_HEADERS_REQUIRED = 720; @@ -88,7 +89,13 @@ p2pool::p2pool(int argc, char* argv[]) LOGWARN(1, "Mining to a stagenet wallet address"); } - int err = uv_async_init(uv_default_loop_checked(), &m_submitBlockAsync, on_submit_block); + int err = static_cast(curl_global_init(CURL_GLOBAL_ALL)); + if (err != CURLE_OK) { + LOGERR(1, "Failed to initialize curl, error " << err); + throw std::exception(); + } + + err = uv_async_init(uv_default_loop_checked(), &m_submitBlockAsync, on_submit_block); if (err) { LOGERR(1, "uv_async_init failed, error " << uv_err_name(err)); throw std::exception(); @@ -176,6 +183,8 @@ p2pool::~p2pool() delete m_mempool; delete m_params; delete m_consoleCommands; + + curl_global_cleanup(); } bool p2pool::calculate_hash(const void* data, size_t size, uint64_t height, const hash& seed, hash& result) @@ -311,11 +320,11 @@ void p2pool::handle_miner_data(MinerData& data) } for (uint64_t h : missing_heights) { - char buf[log::Stream::BUF_SIZE + 1]; + char buf[log::Stream::BUF_SIZE + 1] = {}; log::Stream s(buf); s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << h << "}}\0"; - JSONRPCRequest::call(m_params->m_host.c_str(), m_params->m_rpcPort, buf, + JSONRPCRequest::call(m_params->m_host, m_params->m_rpcPort, buf, m_params->m_rpcLogin, [this, h](const char* data, size_t size) { ChainMain block; @@ -462,7 +471,10 @@ void p2pool::on_stop(uv_async_t* async) uv_close(reinterpret_cast(&pool->m_blockTemplateAsync), nullptr); uv_close(reinterpret_cast(&pool->m_stopAsync), nullptr); uv_close(reinterpret_cast(&pool->m_restartZMQAsync), nullptr); - uv_stop(uv_default_loop()); + + uv_loop_t* loop = uv_default_loop_checked(); + delete GetLoopUserData(loop, false); + uv_stop(loop); } void p2pool::submit_block() const @@ -522,7 +534,7 @@ void p2pool::submit_block() const } request.append("\"]}"); - JSONRPCRequest::call(m_params->m_host.c_str(), m_params->m_rpcPort, request.c_str(), + JSONRPCRequest::call(m_params->m_host, m_params->m_rpcPort, request, m_params->m_rpcLogin, [height, diff, template_id, nonce, extra_nonce, is_external](const char* data, size_t size) { rapidjson::Document doc; @@ -617,7 +629,7 @@ void p2pool::download_block_headers(uint64_t current_height) const uint64_t seed_height = get_seed_height(current_height); const uint64_t prev_seed_height = (seed_height > SEEDHASH_EPOCH_BLOCKS) ? (seed_height - SEEDHASH_EPOCH_BLOCKS) : 0; - char buf[log::Stream::BUF_SIZE + 1]; + char buf[log::Stream::BUF_SIZE + 1] = {}; log::Stream s(buf); // First download 2 RandomX seeds @@ -626,7 +638,7 @@ void p2pool::download_block_headers(uint64_t current_height) s.m_pos = 0; s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << height << "}}\0"; - JSONRPCRequest::call(m_params->m_host.c_str(), m_params->m_rpcPort, buf, + JSONRPCRequest::call(m_params->m_host, m_params->m_rpcPort, buf, m_params->m_rpcLogin, [this, prev_seed_height, height](const char* data, size_t size) { ChainMain block; @@ -655,7 +667,7 @@ void p2pool::download_block_headers(uint64_t current_height) s.m_pos = 0; s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_headers_range\",\"params\":{\"start_height\":" << start_height << ",\"end_height\":" << current_height - 1 << "}}\0"; - JSONRPCRequest::call(m_params->m_host.c_str(), m_params->m_rpcPort, buf, + JSONRPCRequest::call(m_params->m_host, m_params->m_rpcPort, buf, m_params->m_rpcLogin, [this, start_height, current_height](const char* data, size_t size) { if (parse_block_headers_range(data, size) == current_height - start_height) { @@ -763,7 +775,7 @@ void p2pool::stratum_on_block() void p2pool::get_info() { - JSONRPCRequest::call(m_params->m_host.c_str(), m_params->m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_info\"}", + JSONRPCRequest::call(m_params->m_host, m_params->m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_info\"}", m_params->m_rpcLogin, [this](const char* data, size_t size) { parse_get_info_rpc(data, size); @@ -869,7 +881,7 @@ void p2pool::parse_get_info_rpc(const char* data, size_t size) void p2pool::get_version() { - JSONRPCRequest::call(m_params->m_host.c_str(), m_params->m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", + JSONRPCRequest::call(m_params->m_host, m_params->m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", m_params->m_rpcLogin, [this](const char* data, size_t size) { parse_get_version_rpc(data, size); @@ -933,7 +945,7 @@ void p2pool::get_miner_data() { m_getMinerDataPending = true; - JSONRPCRequest::call(m_params->m_host.c_str(), m_params->m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_miner_data\"}", + JSONRPCRequest::call(m_params->m_host, m_params->m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_miner_data\"}", m_params->m_rpcLogin, [this](const char* data, size_t size) { parse_get_miner_data_rpc(data, size); @@ -1473,6 +1485,11 @@ int p2pool::run() return 1; } + // Init default loop user data before running it + uv_loop_t* loop = uv_default_loop_checked(); + loop->data = nullptr; + GetLoopUserData(loop); + try { get_info(); load_found_blocks(); diff --git a/src/params.cpp b/src/params.cpp index cd58d42..aa34ab4 100644 --- a/src/params.cpp +++ b/src/params.cpp @@ -130,6 +130,11 @@ Params::Params(int argc, char* argv[]) ok = true; } + if ((strcmp(argv[i], "--rpc-login") == 0) && (i + 1 < argc)) { + m_rpcLogin = argv[++i]; + ok = true; + } + if (!ok) { fprintf(stderr, "Unknown command line parameter %s\n\n", argv[i]); p2pool_usage(); diff --git a/src/params.h b/src/params.h index 78a2eb2..158b53d 100644 --- a/src/params.h +++ b/src/params.h @@ -49,6 +49,7 @@ struct Params uint32_t m_minerThreads = 0; bool m_mini = false; bool m_autoDiff = true; + std::string m_rpcLogin; }; } // namespace p2pool diff --git a/src/pow_hash.cpp b/src/pow_hash.cpp index 314d5a3..e9ba231 100644 --- a/src/pow_hash.cpp +++ b/src/pow_hash.cpp @@ -370,6 +370,7 @@ bool RandomX_Hasher::calculate(const void* data, size_t size, uint64_t /*height* RandomX_Hasher_RPC::RandomX_Hasher_RPC(p2pool* pool) : m_pool(pool) + , m_loop{} , m_loopThread{} { int err = uv_loop_init(&m_loop); @@ -378,6 +379,9 @@ RandomX_Hasher_RPC::RandomX_Hasher_RPC(p2pool* pool) panic(); } + // Init loop user data before running it + GetLoopUserData(&m_loop); + uv_async_init(&m_loop, &m_shutdownAsync, on_shutdown); uv_async_init(&m_loop, &m_kickTheLoopAsync, nullptr); m_shutdownAsync.data = this; @@ -426,17 +430,17 @@ bool RandomX_Hasher_RPC::calculate(const void* data_ptr, size_t size, uint64_t h const uint8_t* data = reinterpret_cast(data_ptr); const uint8_t major_version = data[0]; - char buf[log::Stream::BUF_SIZE + 1]; + char buf[log::Stream::BUF_SIZE + 1] = {}; log::Stream s(buf); s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"calc_pow\",\"params\":{\"major_version\":" << major_version << ",\"height\":" << height << ",\"block_blob\":\"" << log::hex_buf(data, size) << '"' << - ",\"seed_hash\":\"\"}}"; + ",\"seed_hash\":\"\"}}\0"; volatile int result = 0; volatile bool done = false; - JSONRPCRequest::call(m_pool->params().m_host.c_str(), m_pool->params().m_rpcPort, buf, + JSONRPCRequest::call(m_pool->params().m_host, m_pool->params().m_rpcPort, buf, m_pool->params().m_rpcLogin, [&result, &h](const char* data, size_t size) { rapidjson::Document doc; diff --git a/src/pow_hash.h b/src/pow_hash.h index 414d00a..eb2bb66 100644 --- a/src/pow_hash.h +++ b/src/pow_hash.h @@ -122,6 +122,8 @@ private: RandomX_Hasher_RPC* server = reinterpret_cast(async->data); uv_close(reinterpret_cast(&server->m_shutdownAsync), nullptr); uv_close(reinterpret_cast(&server->m_kickTheLoopAsync), nullptr); + + delete GetLoopUserData(&server->m_loop, false); } }; diff --git a/src/tcp_server.h b/src/tcp_server.h index 314a7cd..fa50657 100644 --- a/src/tcp_server.h +++ b/src/tcp_server.h @@ -177,6 +177,8 @@ protected: uv_close(reinterpret_cast(&server->m_dropConnectionsAsync), nullptr); uv_close(reinterpret_cast(&server->m_shutdownAsync), nullptr); + + delete GetLoopUserData(&server->m_loop, false); } }; diff --git a/src/tcp_server.inl b/src/tcp_server.inl index 7901fa0..738e9f9 100644 --- a/src/tcp_server.inl +++ b/src/tcp_server.inl @@ -27,6 +27,7 @@ TCPServer::TCPServer(allocate_client_callback all , m_loopThread{} , m_finished(0) , m_listenPort(-1) + , m_loop{} , m_loopStopped{false} , m_numConnections{ 0 } , m_numIncomingConnections{ 0 } @@ -37,6 +38,9 @@ TCPServer::TCPServer(allocate_client_callback all panic(); } + // Init loop user data before running it + GetLoopUserData(&m_loop); + err = uv_async_init(&m_loop, &m_dropConnectionsAsync, on_drop_connections); if (err) { LOGERR(1, "uv_async_init failed, error " << uv_err_name(err)); diff --git a/src/util.cpp b/src/util.cpp index 191746d..e6dcebb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -423,4 +423,16 @@ NOINLINE uint64_t bsr_reference(uint64_t x) return bsr8_table.data[y >> 24] - n0 - n1 - n2; } +UV_LoopUserData* GetLoopUserData(uv_loop_t* loop, bool create) +{ + UV_LoopUserData* data = reinterpret_cast(loop->data); + + if (!data && create) { + data = new UV_LoopUserData(loop); + loop->data = data; + } + + return data; +} + } // namespace p2pool diff --git a/src/uv_util.h b/src/uv_util.h index 9c0a60c..0d0e780 100644 --- a/src/uv_util.h +++ b/src/uv_util.h @@ -61,4 +61,93 @@ void uv_mutex_init_checked(uv_mutex_t* mutex); void uv_rwlock_init_checked(uv_rwlock_t* lock); uv_loop_t* uv_default_loop_checked(); +struct UV_LoopCallbackBase +{ + virtual ~UV_LoopCallbackBase() {} + virtual void operator()() = 0; +}; + +template +struct UV_LoopCallback : public UV_LoopCallbackBase +{ + explicit FORCEINLINE UV_LoopCallback(T&& cb) : m_cb(std::move(cb)) {} + void operator()() override { m_cb(); } + +private: + UV_LoopCallback& operator=(UV_LoopCallback&&) = delete; + T m_cb; +}; + +struct UV_LoopUserData +{ + uv_loop_t* m_loop; + uv_async_t* m_async; + + uv_mutex_t m_callbacksLock; + std::vector m_callbacks; + + std::vector m_callbacksToRun; + + explicit UV_LoopUserData(uv_loop_t* loop) + : m_loop(loop) + , m_async(new uv_async_t{}) + , m_callbacksLock{} + , m_callbacks{} + , m_callbacksToRun{} + { + uv_async_init(m_loop, m_async, async_cb); + m_async->data = this; + + uv_mutex_init_checked(&m_callbacksLock); + + m_callbacks.reserve(2); + m_callbacksToRun.reserve(2); + } + + ~UV_LoopUserData() + { + m_loop->data = nullptr; + uv_mutex_destroy(&m_callbacksLock); + uv_close(reinterpret_cast(m_async), [](uv_handle_t* h) { delete reinterpret_cast(h); }); + for (const UV_LoopCallbackBase* cb : m_callbacks) { + delete cb; + } + } + + static void async_cb(uv_async_t* h) + { + UV_LoopUserData* data = reinterpret_cast(h->data); + + data->m_callbacksToRun.clear(); + { + MutexLock lock(data->m_callbacksLock); + std::swap(data->m_callbacks, data->m_callbacksToRun); + } + + for (UV_LoopCallbackBase* cb : data->m_callbacksToRun) { + (*cb)(); + delete cb; + } + } + + UV_LoopUserData(const UV_LoopUserData&) = delete; + UV_LoopUserData& operator=(const UV_LoopUserData&) = delete; +}; + +UV_LoopUserData* GetLoopUserData(uv_loop_t* loop, bool create = true); + +template +void CallOnLoop(uv_loop_t* loop, T&& callback) +{ + UV_LoopUserData* data = GetLoopUserData(loop); + + UV_LoopCallbackBase* cb = new UV_LoopCallback(std::move(callback)); + { + MutexLock lock(data->m_callbacksLock); + data->m_callbacks.push_back(cb); + } + + uv_async_send(data->m_async); +} + } // namespace p2pool diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a98252e..bdda42d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -32,9 +32,6 @@ set(SOURCES src/wallet_tests.cpp ../external/src/cryptonote/crypto-ops-data.c ../external/src/cryptonote/crypto-ops.c - ../external/src/llhttp/api.c - ../external/src/llhttp/http.c - ../external/src/llhttp/llhttp.c ../src/block_cache.cpp ../src/block_template.cpp ../src/console_commands.cpp @@ -61,10 +58,10 @@ set(SOURCES include_directories(../src) include_directories(../external/src) include_directories(../external/src/cryptonote) +include_directories(../external/src/curl/include) include_directories(../external/src/libuv/include) include_directories(../external/src/cppzmq) include_directories(../external/src/libzmq/include) -include_directories(../external/src/llhttp) include_directories(../external/src/RandomX/src) include_directories(../external/src/rapidjson/include) include_directories(../external/src/robin-hood-hashing/src/include) @@ -72,7 +69,8 @@ include_directories(src) include_directories(googletest/googletest/include) if (WIN32) - set(LIBS ${LIBS} ws2_32 iphlpapi userenv psapi) + set(LIBS ${LIBS} ws2_32 iphlpapi userenv psapi wldap32) + add_definitions(-DCURL_STATICLIB) elseif (NOT APPLE) set(LIBS ${LIBS} pthread gss dl) endif() @@ -82,17 +80,28 @@ if (STATIC_LIBS) set(ZMQ_LIBRARY_DEBUG "${CMAKE_SOURCE_DIR}/../external/src/libzmq/build/lib/libzmq.a") set(UV_LIBRARY_DEBUG "${CMAKE_SOURCE_DIR}/../external/src/libuv/build/libuv_a.a") set(UV_LIBRARY "${CMAKE_SOURCE_DIR}/../external/src/libuv/build/libuv_a.a") + set(CURL_LIBRARY_DEBUG "${CMAKE_SOURCE_DIR}/../external/src/curl/lib/.libs/libcurl.a") + set(CURL_LIBRARY "${CMAKE_SOURCE_DIR}/../external/src/curl/lib/.libs/libcurl.a") else() if (CMAKE_CXX_COMPILER_ID MATCHES MSVC) find_library(ZMQ_LIBRARY_DEBUG NAMES libzmq-v142-mt-sgd-4_3_5 PATHS "../external/lib/libzmq/Debug") find_library(ZMQ_LIBRARY NAMES libzmq-v142-mt-s-4_3_5 PATHS "../external/lib/libzmq/Release") find_library(UV_LIBRARY_DEBUG NAMES uv_a PATHS "../external/lib/libuv/Debug") find_library(UV_LIBRARY NAMES uv_a PATHS "../external/lib/libuv/Release") + find_library(CURL_LIBRARY_DEBUG NAMES libcurld PATHS "../external/lib/libcurl/Debug") + find_library(CURL_LIBRARY NAMES libcurl PATHS "../external/lib/libcurl/Release") elseif (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang) find_library(ZMQ_LIBRARY_DEBUG NAMES zmq libzmq.a) find_library(ZMQ_LIBRARY NAMES zmq libzmq.a) find_library(UV_LIBRARY_DEBUG NAMES uv libuv.a) find_library(UV_LIBRARY NAMES uv libuv.a) + if (WIN32) + find_library(CURL_LIBRARY_DEBUG NAMES libcurl.a PATHS "../external/src/curl/lib/.libs" NO_DEFAULT_PATH) + find_library(CURL_LIBRARY NAMES libcurl.a PATHS "../external/src/curl/lib/.libs" NO_DEFAULT_PATH) + else() + find_library(CURL_LIBRARY_DEBUG NAMES curl) + find_library(CURL_LIBRARY NAMES curl) + endif() find_library(SODIUM_LIBRARY sodium) endif() @@ -112,6 +121,13 @@ if (NORM_LIBRARY) set(LIBS ${LIBS} ${NORM_LIBRARY}) endif() +if(APPLE) + find_library(FOUNDATION_LIB Foundation) + find_library(CORE_FOUNDATION_LIB CoreFoundation) + find_library(SYSTEM_CONFIGURATION_LIB SystemConfiguration) + set(LIBS ${LIBS} ${FOUNDATION_LIB} ${CORE_FOUNDATION_LIB} ${SYSTEM_CONFIGURATION_LIB}) +endif() + add_definitions(/DZMQ_STATIC /DP2POOL_LOG_DISABLE) include(CheckCXXSourceCompiles) @@ -128,7 +144,7 @@ if (HAVE_BITSCANREVERSE64) endif() add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES}) -target_link_libraries(${CMAKE_PROJECT_NAME} debug ${ZMQ_LIBRARY_DEBUG} debug ${UV_LIBRARY_DEBUG} optimized ${ZMQ_LIBRARY} optimized ${UV_LIBRARY} ${LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} debug ${ZMQ_LIBRARY_DEBUG} debug ${UV_LIBRARY_DEBUG} debug ${CURL_LIBRARY_DEBUG} optimized ${ZMQ_LIBRARY} optimized ${UV_LIBRARY} optimized ${CURL_LIBRARY} ${LIBS}) add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/crypto_tests.txt" $) add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/mainnet_test2_block.dat" $) add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/sidechain_dump.dat" $)