diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index 26eedfee..3bd16597 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -9,7 +9,7 @@ jobs: Fuzzing: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: { fetch-depth: 2 } - run: if ./test/match_changed_files.sh '^src/' ; then echo GO=1 >> $GITHUB_ENV ; fi - name: Build Fuzzers diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 8adbcc1f..9ea5f7ef 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -25,8 +25,8 @@ jobs: with: languages: cpp - run: | - make test CC=gcc ASAN= ASAN_OPTIONS= - ./test/setup_ga_network.sh && make mip_test CC=gcc ASAN= ASAN_OPTIONS= + make -C test test CC=gcc ASAN= ASAN_OPTIONS= + ./test/setup_ga_network.sh && make -C test mip_test CC=gcc ASAN= ASAN_OPTIONS= - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 393d3f88..7f19412f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -33,7 +33,7 @@ jobs: steps: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - - run: ./test/setup_ga_network.sh && sudo apt -y update ; sudo apt -y install libmbedtls-dev && make ${{ matrix.target }} + - run: ./test/setup_ga_network.sh && sudo apt -y update ; sudo apt -y install libmbedtls-dev && make -C test ${{ matrix.target }} s390: runs-on: ubuntu-latest strategy: @@ -44,7 +44,7 @@ jobs: steps: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - - run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make s390 SSL=${{ matrix.ssl }} + - run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test s390 SSL=${{ matrix.ssl }} armhf: runs-on: ubuntu-latest strategy: @@ -55,7 +55,7 @@ jobs: steps: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - - run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make armhf SSL=${{ matrix.ssl }} + - run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test armhf SSL=${{ matrix.ssl }} unamalgamated-mg_prefix: runs-on: ubuntu-latest strategy: @@ -67,7 +67,7 @@ jobs: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - run: sudo apt -y update ; sudo apt -y install libmbedtls-dev - - run: make unamalgamated && make mg_prefix + - run: make -C test unamalgamated && make -C test mg_prefix valgrind: runs-on: ubuntu-latest strategy: @@ -79,7 +79,7 @@ jobs: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - run: sudo apt -y update ; sudo apt -y install libmbedtls-dev valgrind - - run: make valgrind SSL=${{ matrix.ssl }} + - run: make -C test valgrind SSL=${{ matrix.ssl }} macos: runs-on: macos-latest strategy: @@ -101,7 +101,7 @@ jobs: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - run: brew install jq mbedtls openssl - - run: make test ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*` OPENSSL=`echo /usr/local/Cellar/openssl*/*` + - run: make -C test test ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*` OPENSSL=`echo /usr/local/Cellar/openssl*/*` windows: runs-on: ubuntu-latest strategy: @@ -121,7 +121,7 @@ jobs: steps: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - - run: make ${{ matrix.target }} + - run: make -C test ${{ matrix.target }} arm: runs-on: ubuntu-latest strategy: @@ -131,7 +131,7 @@ jobs: name: Arm SSL=${{ matrix.ssl }} steps: - uses: actions/checkout@v4 - - run: make arm SSL=${{ matrix.ssl }} + - run: make -C test arm SSL=${{ matrix.ssl }} riscv: runs-on: ubuntu-latest strategy: @@ -141,7 +141,7 @@ jobs: name: RISC-V SSL=${{ matrix.ssl }} steps: - uses: actions/checkout@v4 - - run: make riscv SSL=${{ matrix.ssl }} + - run: make -C test riscv SSL=${{ matrix.ssl }} examples: runs-on: ubuntu-latest @@ -153,8 +153,8 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo apt -y install libmbedtls-dev libpcap-dev - - run: make examples CFLAGS_EXTRA="${{ matrix.ssl }}" - - run: make clean_examples + - run: make -C test examples CFLAGS_EXTRA="${{ matrix.ssl }}" + - run: make -C test clean_examples examples_win: runs-on: windows-latest strategy: @@ -168,10 +168,10 @@ jobs: # with: # platform: x64 - name: test they build - run: make examples_win CFLAGS_EXTRA="${{ matrix.ssl }}" + run: make -C test examples_win CFLAGS_EXTRA="${{ matrix.ssl }}" shell: cmd - name: test they clean - run: make clean_examples_win + run: make -C test clean_examples_win shell: cmd examples_mac: runs-on: macos-latest @@ -183,8 +183,8 @@ jobs: name: examples_mac ${{ matrix.ssl }} steps: - uses: actions/checkout@v4 - - run: make examples_mac CFLAGS_EXTRA="${{ matrix.ssl }}" - - run: make clean_examples_mac + - run: make -C test examples_mac CFLAGS_EXTRA="${{ matrix.ssl }}" + - run: make -C test clean_examples_mac arduino: diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index afc36bc5..9938752f 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -25,7 +25,7 @@ jobs: with: { fetch-depth: 2 } - run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} - run: ./test/setup_ga_network.sh && make ${{ matrix.target }} + run: ./test/setup_ga_network.sh && make -C test ${{ matrix.target }} s390: runs-on: ubuntu-latest steps: @@ -33,7 +33,7 @@ jobs: with: { fetch-depth: 2 } - run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} - run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make s390 + run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test s390 armhf: runs-on: ubuntu-latest steps: @@ -41,7 +41,7 @@ jobs: with: { fetch-depth: 2 } - run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} - run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make armhf + run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test armhf unamalgamated-mg_prefix: runs-on: ubuntu-latest steps: @@ -49,7 +49,7 @@ jobs: with: { fetch-depth: 2 } - run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} - run: make unamalgamated && make mg_prefix + run: make -C test unamalgamated && make -C test mg_prefix macos: runs-on: macos-latest strategy: @@ -66,7 +66,7 @@ jobs: with: { fetch-depth: 2 } - run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} - run: make test ASAN_OPTIONS= + run: make -C test test ASAN_OPTIONS= windows: runs-on: ubuntu-latest strategy: @@ -79,24 +79,24 @@ jobs: with: { fetch-depth: 2 } - run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} - run: make ${{ matrix.target }} + run: make -C test ${{ matrix.target }} arm: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: make arm + - run: make -C test arm riscv: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: make riscv + - run: make -C test riscv examples: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: make examples_essential - - run: make clean_examples_essential + - run: make -C test examples_essential + - run: make -C test clean_examples_essential examples_win: runs-on: windows-latest steps: @@ -105,18 +105,18 @@ jobs: # with: # platform: x64 - name: test they build - run: make examples_win + run: make -C test examples_win shell: cmd - name: test they clean - run: make clean_examples_win + run: make -C test clean_examples_win shell: cmd examples_mac: runs-on: macos-latest env: { HOMEBREW_NO_AUTO_UPDATE: 1 } steps: - uses: actions/checkout@v4 - - run: make examples_mac - - run: make clean_examples_mac + - run: make -C test examples_mac + - run: make -C test clean_examples_mac generic_examples: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62c907a6..d7d97496 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: original workflow, updated +name: original workflow, outdated # *** YES, OUTDATED *** kept for hystorical/reference purposes, attachment, etc. on: workflow_dispatch: env: diff --git a/examples/embedded-filesystem/packed_fs.c b/examples/embedded-filesystem/packed_fs.c index 5af52123..f2dbd6e7 100644 --- a/examples/embedded-filesystem/packed_fs.c +++ b/examples/embedded-filesystem/packed_fs.c @@ -12,51 +12,552 @@ const char *mg_unpack(const char *, size_t *, time_t *); #endif static const unsigned char v1[] = { - 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 104, 116, // .. < - 104, 101, 97, 100, 62, 10, 32, 32, 32, 32, 60, 109, // head>. . - 32, 32, 32, 32, 60, 109, 101, 116, 97, 32, 104, 116, // . - 32, 32, 32, 32, 60, 109, 101, 116, 97, 32, 104, 116, // . - 32, 32, 60, 109, 101, 116, 97, 32, 110, 97, 109, 101, // . - 32, 32, 32, 32, 32, 32, 32, 60, 116, 105, 116, 108, // Mongoose E - 109, 98, 101, 100, 100, 101, 100, 32, 70, 105, 108, 101, // mbedded File - 115, 121, 116, 101, 109, 32, 101, 120, 97, 109, 112, 108, // sytem exampl - 101, 60, 47, 116, 105, 116, 108, 101, 62, 10, 32, 32, // e. - 32, 32, 60, 108, 105, 110, 107, 32, 114, 101, 108, 61, // . < - 47, 104, 101, 97, 100, 62, 10, 32, 32, 60, 98, 111, // /head>. . - 32, 60, 115, 99, 114, 105, 112, 116, 32, 116, 121, 112, // .< - 47, 104, 116, 109, 108, 62, 10, 0 // /html>. + 31, 139, 8, 8, 219, 27, 244, 98, 0, 3, 112, 114, // .......b..pr + 101, 97, 99, 116, 46, 109, 105, 110, 46, 106, 115, 0, // eact.min.js. + 157, 91, 123, 119, 219, 182, 146, 255, 127, 63, 69, 164, // .[{w.....?E. + 211, 163, 18, 43, 68, 177, 147, 182, 187, 75, 5, 213, // ...+D....K.. + 105, 29, 183, 238, 109, 234, 230, 38, 105, 123, 123, 85, // i...m..&i{{U + 93, 30, 138, 132, 44, 214, 20, 169, 242, 97, 91, 53, // ]...,....a[5 + 245, 221, 247, 55, 3, 128, 164, 108, 185, 247, 236, 158, // ...7...l.... + 36, 34, 30, 131, 1, 48, 47, 204, 12, 144, 155, 176, // $"...0/..... + 120, 166, 101, 38, 3, 89, 201, 92, 22, 178, 150, 169, // x.e&.Y...... + 186, 223, 203, 68, 205, 23, 50, 82, 47, 194, 40, 169, // ...D..2R/.(. + 26, 125, 231, 205, 252, 178, 185, 106, 178, 102, 219, 124, // .}.....j.f.| + 34, 154, 98, 187, 110, 174, 138, 36, 110, 242, 219, 178, // ".b.n..$n... + 217, 100, 81, 147, 85, 183, 77, 146, 233, 121, 180, 94, // .dQ.U.M..y.^ + 52, 127, 230, 121, 243, 175, 188, 136, 155, 164, 210, 69, // 4..y.......E + 248, 34, 153, 174, 234, 44, 170, 146, 60, 123, 86, 122, // ."...,..<{Vz + 152, 72, 220, 175, 242, 194, 187, 193, 172, 193, 179, 36, // .H.........$ + 123, 150, 9, 61, 15, 22, 42, 195, 207, 180, 208, 85, // {..=..*....U + 93, 100, 207, 244, 190, 29, 177, 242, 180, 184, 39, 216, // ]d........'. + 76, 233, 201, 54, 44, 116, 86, 93, 230, 177, 158, 102, // L..6,tV]...f + 163, 81, 54, 41, 244, 38, 191, 209, 103, 235, 36, 141, // .Q6).&..g.$. + 1, 214, 13, 10, 61, 222, 141, 25, 216, 109, 105, 74, // ....=....miJ + 243, 214, 52, 103, 32, 134, 215, 122, 55, 84, 170, 158, // ..4g ..z7T.. + 229, 42, 152, 215, 11, 127, 88, 232, 21, 215, 11, 83, // .*....X....S + 79, 241, 195, 165, 105, 178, 242, 194, 226, 170, 222, 96, // O...i......` + 230, 114, 146, 234, 236, 170, 90, 127, 249, 114, 52, 242, // .r....Z..r4. + 210, 73, 68, 19, 99, 69, 234, 81, 255, 171, 153, 158, // .ID.cE.Q.... + 68, 97, 154, 118, 35, 229, 75, 225, 87, 66, 14, 221, // Da.v#.K.WB.. + 26, 49, 87, 181, 219, 234, 124, 245, 140, 118, 82, 167, // .1W...|..vR. + 233, 64, 101, 147, 88, 175, 194, 58, 173, 222, 21, 249, // .@e.X..:.... + 182, 20, 237, 98, 31, 180, 223, 228, 73, 252, 236, 68, // ...b....I..D + 41, 69, 75, 164, 117, 208, 74, 15, 97, 208, 34, 28, // )EK.u.J.a.". + 45, 183, 160, 69, 202, 124, 165, 89, 122, 68, 218, 130, // -..E.|.YzD.. + 23, 150, 225, 134, 80, 32, 17, 45, 201, 215, 114, 75, // ....P .-..rK + 72, 252, 74, 130, 70, 62, 0, 244, 202, 47, 100, 16, // H.J.F>.../d. + 92, 251, 132, 1, 5, 247, 93, 250, 39, 248, 213, 174, // ......].'... + 26, 251, 102, 105, 40, 70, 174, 109, 109, 10, 81, 158, // ..fi(F.mm.Q. + 149, 85, 81, 71, 85, 94, 116, 64, 55, 220, 71, 52, // .UQGU^t@7.G4 + 31, 143, 3, 191, 222, 187, 21, 59, 106, 220, 100, 96, // .......;j.d` + 52, 177, 153, 11, 94, 42, 100, 218, 173, 126, 77, 114, // 4...^*d..~Mr + 225, 196, 165, 229, 68, 215, 31, 27, 73, 171, 214, 73, // ....D...I..I + 57, 225, 237, 40, 236, 150, 42, 88, 74, 165, 239, 42, // 9..(..*XJ..* + 213, 131, 189, 49, 176, 96, 180, 89, 80, 38, 90, 196, // ...1.`.YP&Z. + 65, 48, 67, 47, 62, 146, 126, 240, 247, 122, 146, 100, // A0C/>.~..z.d + 177, 190, 251, 145, 228, 114, 124, 42, 120, 11, 211, 86, // .....r|*x..V + 158, 167, 217, 107, 205, 64, 70, 14, 166, 217, 120, 44, // ...k.@F...x, + 44, 218, 129, 242, 2, 197, 157, 243, 108, 33, 28, 207, // ,.......l!.. + 9, 165, 118, 211, 113, 197, 82, 225, 136, 160, 232, 9, // ..v.q.R..... + 21, 104, 61, 102, 218, 110, 3, 187, 86, 73, 100, 48, // .h=f.n..VId0 + 237, 230, 211, 60, 95, 59, 23, 85, 34, 163, 124, 84, // ...<_;.U".|T + 52, 189, 209, 100, 25, 150, 90, 49, 151, 50, 117, 242, // 4..d..Z1.2u. + 255, 220, 192, 253, 35, 132, 102, 47, 203, 66, 135, 215, // ....#.f/.B.. + 123, 187, 61, 90, 229, 190, 91, 244, 134, 22, 237, 13, // {.=Z..[..... + 104, 76, 12, 49, 230, 175, 26, 156, 0, 115, 53, 217, // hL.1.....s5. + 214, 37, 49, 120, 52, 26, 92, 161, 185, 24, 143, 155, // .%1x4....... + 166, 24, 40, 150, 242, 101, 14, 4, 250, 189, 6, 23, // ..(..e...... + 138, 36, 187, 2, 140, 231, 21, 71, 123, 154, 38, 23, // .$.....G{.&. + 222, 85, 79, 226, 175, 188, 206, 244, 232, 41, 99, 86, // .UO......)cV + 149, 219, 169, 208, 40, 151, 121, 81, 121, 14, 222, 72, // ....(.yQy..H + 69, 79, 20, 110, 240, 111, 249, 60, 115, 165, 189, 144, // EO.n.o...D....J. + 208, 20, 246, 246, 155, 230, 206, 193, 99, 113, 128, 35, // ........cq.# + 225, 8, 58, 208, 64, 0, 99, 64, 59, 199, 20, 248, // ..:.@.c@;... + 28, 194, 83, 135, 216, 59, 57, 25, 230, 142, 124, 163, // ..S..;9...|. + 209, 48, 51, 229, 211, 133, 128, 11, 2, 250, 227, 104, // .03........h + 167, 168, 100, 155, 134, 145, 246, 94, 156, 133, 91, 176, // ..d....^..[. + 71, 127, 242, 130, 166, 132, 61, 67, 95, 149, 191, 205, // G.....=C_... + 111, 117, 113, 6, 23, 201, 19, 152, 89, 207, 30, 180, // ouq.....Y... + 77, 202, 52, 193, 88, 68, 11, 89, 91, 132, 22, 164, // M.4.XD.Y[... + 176, 163, 248, 69, 16, 195, 181, 121, 54, 46, 16, 158, // ...E...y6... + 200, 96, 86, 53, 13, 4, 47, 142, 207, 111, 32, 139, // .`V5../..o . + 111, 147, 178, 210, 240, 5, 192, 202, 98, 246, 193, 63, // o.......b..? + 135, 152, 192, 54, 153, 40, 233, 41, 128, 86, 1, 134, // ...6.(.).V.. + 113, 152, 93, 233, 34, 175, 203, 116, 247, 65, 87, 223, // q.]."..t.AW. + 101, 128, 187, 248, 248, 195, 91, 50, 134, 198, 59, 206, // e.....[2..;. + 197, 193, 246, 238, 32, 96, 215, 243, 11, 127, 189, 192, // .... `...... + 6, 215, 67, 209, 245, 148, 151, 225, 134, 183, 93, 14, // ..C.......]. + 123, 248, 215, 20, 98, 17, 50, 16, 46, 197, 66, 92, // {...b.2...B. + 25, 108, 216, 184, 114, 21, 46, 191, 35, 255, 218, 213, // .l..r...#... + 99, 248, 54, 105, 30, 198, 182, 206, 220, 210, 162, 42, // c.6i.......* + 118, 247, 15, 5, 53, 152, 90, 101, 217, 71, 97, 21, // v...5.Ze.Ga. + 113, 120, 176, 63, 102, 66, 65, 72, 235, 185, 66, 136, // qx.?fBAH..B. + 6, 167, 3, 214, 249, 97, 216, 99, 106, 209, 50, 213, // .....a.cj.2. + 40, 200, 87, 21, 196, 111, 89, 87, 218, 106, 136, 37, // (.W..oYW.j.% + 104, 175, 89, 244, 253, 218, 115, 154, 154, 67, 141, 116, // h.Y...s..C.t + 110, 92, 246, 241, 224, 116, 225, 101, 19, 77, 28, 152, // n....t.e.M.. + 217, 47, 57, 241, 253, 144, 245, 195, 145, 81, 39, 255, // ./9......Q'. + 118, 20, 29, 203, 189, 176, 93, 38, 50, 50, 90, 183, // v.....]&22Z. + 146, 161, 220, 202, 27, 235, 155, 45, 229, 25, 121, 103, // .......-..yg + 240, 200, 204, 9, 114, 96, 27, 131, 73, 47, 58, 19, // ....r`..I/:. + 189, 24, 108, 106, 232, 68, 254, 220, 26, 180, 138, 76, // ..lj.D.....L + 9, 38, 204, 156, 91, 21, 27, 101, 42, 175, 77, 248, // .&..[..e*.M. + 80, 171, 121, 130, 131, 222, 91, 177, 153, 93, 194, 172, // P.y...[..].. + 145, 146, 77, 153, 89, 108, 2, 30, 115, 227, 156, 229, // ..M.Yl..s... + 138, 252, 31, 227, 45, 157, 41, 140, 62, 119, 49, 218, // ....-.).>w1. + 71, 242, 73, 70, 163, 124, 190, 34, 183, 0, 135, 145, // G.IF.|.".... + 90, 205, 206, 102, 103, 6, 214, 28, 185, 62, 117, 33, // Z..fg....>u! + 70, 165, 197, 68, 179, 43, 133, 19, 141, 86, 100, 214, // F..D.+...Vd. + 26, 145, 255, 172, 66, 252, 156, 251, 222, 16, 163, 170, // ....B....... + 156, 230, 29, 66, 134, 206, 71, 163, 243, 73, 219, 2, // ...B..G..I.. + 142, 82, 208, 48, 51, 67, 67, 149, 233, 91, 176, 113, // .R.03CC..[.q + 41, 239, 132, 239, 245, 219, 98, 110, 147, 97, 159, 98, // ).....bn.a.b + 234, 28, 117, 51, 94, 125, 37, 228, 217, 104, 116, 54, // ..u3^}%..ht6 + 41, 235, 165, 23, 18, 156, 137, 60, 151, 40, 149, 85, // )......<.(.U + 88, 105, 200, 158, 45, 177, 34, 135, 109, 48, 122, 39, // Xi..-.".m0z' + 105, 149, 153, 202, 229, 150, 215, 75, 129, 16, 55, 173, // i......K..7. + 217, 119, 50, 98, 78, 117, 248, 20, 30, 127, 149, 69, // .w2bNu.....E + 228, 220, 164, 243, 201, 149, 174, 222, 32, 240, 185, 209, // ........ ... + 241, 7, 234, 248, 166, 200, 55, 156, 12, 104, 71, 184, // ......7..hG. + 33, 109, 3, 71, 25, 92, 132, 117, 42, 77, 163, 124, // !m.G...u*M.| + 26, 145, 183, 116, 192, 66, 222, 40, 187, 57, 248, 132, // ...t.B.(.9.. + 22, 173, 220, 10, 179, 206, 191, 90, 138, 89, 44, 109, // .......Z.Y,m + 124, 179, 205, 51, 72, 244, 47, 73, 154, 254, 128, 192, // |..3H./I.... + 13, 6, 248, 88, 171, 231, 246, 215, 235, 124, 147, 196, // ...X.....|.. + 237, 8, 80, 200, 248, 142, 71, 250, 69, 123, 128, 252, // ..P...G.E{.. + 251, 117, 45, 161, 8, 55, 79, 44, 239, 189, 142, 52, // .u-..7O,...4 + 198, 88, 200, 191, 232, 52, 210, 49, 8, 141, 83, 230, // .X...4.1..S. + 112, 149, 235, 188, 78, 227, 51, 55, 232, 167, 109, 204, // p...N.37..m. + 60, 24, 156, 42, 245, 84, 175, 163, 52, 208, 53, 77, // <..*.T..4.5M + 192, 65, 160, 98, 137, 190, 17, 247, 143, 132, 202, 200, // .A.b........ + 5, 43, 226, 205, 192, 130, 89, 22, 67, 140, 78, 5, // .+....Y.C.N. + 163, 186, 161, 195, 226, 129, 218, 94, 115, 249, 218, 148, // .......^s... + 39, 176, 194, 231, 33, 236, 102, 63, 140, 213, 54, 46, // '...!.f?..6. + 87, 129, 216, 27, 60, 107, 235, 166, 140, 70, 169, 165, // W...i........ + 117, 155, 249, 75, 196, 194, 174, 156, 164, 71, 155, 51, // u..K.....G.3 + 184, 239, 2, 188, 161, 38, 113, 79, 189, 17, 37, 48, // .....&qO..%0 + 241, 65, 60, 163, 197, 163, 84, 17, 128, 248, 120, 100, // .A<...T...xd + 2, 174, 237, 116, 199, 83, 74, 54, 161, 76, 154, 216, // ...t.SJ6.L.. + 237, 160, 157, 159, 109, 195, 190, 159, 180, 185, 245, 250, // ....m....... + 41, 155, 214, 49, 40, 217, 49, 88, 131, 118, 70, 140, // )..1(.1X.vF. + 227, 246, 236, 221, 89, 231, 64, 110, 16, 163, 176, 215, // ....Y.@n.... + 125, 67, 46, 183, 218, 113, 222, 106, 112, 226, 84, 180, // }C...q.jp.T. + 102, 191, 121, 186, 121, 93, 187, 144, 101, 99, 50, 56, // f.y.y]..ec28 + 136, 109, 235, 249, 134, 67, 189, 146, 60, 40, 136, 232, // .m...C..<(.. + 110, 6, 127, 38, 199, 194, 201, 33, 4, 42, 255, 21, // n..&...!.*.. + 194, 226, 9, 165, 115, 249, 108, 23, 216, 129, 42, 37, // ....s.l...*% + 141, 50, 177, 146, 201, 57, 244, 18, 177, 157, 245, 86, // .2...9.....V + 59, 231, 155, 196, 121, 196, 57, 245, 73, 4, 232, 74, // ;...y.9.I..J + 147, 247, 79, 65, 152, 23, 139, 105, 166, 138, 217, 131, // ..OA...i.... + 110, 155, 20, 187, 252, 0, 7, 180, 170, 182, 254, 139, // n........... + 23, 183, 183, 183, 147, 219, 87, 147, 188, 184, 122, 241, // ......W...z. + 242, 228, 228, 228, 5, 237, 19, 234, 226, 31, 31, 232, // ............ + 237, 100, 12, 69, 24, 141, 98, 23, 209, 201, 136, 100, // .d.E..b....d + 181, 191, 176, 53, 126, 99, 196, 69, 196, 107, 168, 95, // ...5~c.E.k._ + 104, 170, 158, 173, 196, 221, 65, 84, 147, 92, 91, 78, // h.....AT..[N + 102, 70, 231, 104, 233, 37, 116, 64, 121, 45, 83, 154, // fF.h.%t@y-S. + 38, 21, 147, 39, 188, 113, 56, 8, 241, 147, 125, 131, // &..'.q8...}. + 168, 37, 152, 227, 211, 154, 174, 114, 136, 163, 155, 215, // .%.....r.... + 217, 36, 116, 46, 107, 217, 103, 221, 122, 222, 239, 1, // .$t.k.g.z... + 47, 38, 25, 184, 69, 119, 10, 135, 173, 236, 112, 77, // /&..Ew....pM + 61, 216, 166, 144, 120, 188, 37, 85, 30, 141, 182, 36, // =...x.%U...$ + 179, 213, 198, 250, 39, 84, 106, 154, 174, 13, 72, 18, // ....'Tj...H. + 183, 60, 193, 36, 105, 171, 106, 219, 13, 134, 7, 142, // .<.$i.j..... + 8, 137, 104, 218, 79, 190, 30, 134, 145, 180, 155, 194, // ..h.O....... + 94, 222, 56, 107, 69, 242, 137, 88, 220, 94, 230, 112, // ^.8kE..X.^.p + 88, 206, 55, 38, 77, 67, 113, 168, 185, 242, 64, 252, // X.7&MCq...@. + 86, 44, 160, 159, 29, 130, 76, 228, 20, 118, 56, 111, // V,....L..v8o + 180, 13, 109, 51, 0, 2, 217, 211, 200, 135, 76, 2, // ..m3......L. + 87, 137, 214, 58, 186, 214, 177, 173, 210, 44, 28, 55, // W..:.....,.7 + 16, 14, 59, 59, 77, 108, 103, 223, 67, 29, 99, 185, // ..;;Mlg.C.c. + 70, 43, 172, 230, 86, 184, 100, 104, 27, 29, 109, 156, // F+..V.dh..m. + 30, 182, 150, 24, 118, 56, 147, 143, 50, 145, 27, 31, // ....v8..2... + 172, 112, 138, 109, 130, 39, 157, 92, 101, 63, 46, 127, // .p.m.'..e?.. + 215, 17, 71, 84, 59, 214, 246, 122, 86, 35, 152, 241, // ..GT;..zV#.. + 43, 147, 9, 163, 60, 16, 244, 55, 58, 84, 225, 141, // +...<..7:T.. + 234, 52, 184, 203, 62, 145, 50, 146, 161, 100, 85, 158, // .4..>.2..dU. + 194, 44, 122, 118, 215, 32, 92, 12, 84, 46, 108, 192, // .,zv. ..T.l. + 240, 216, 136, 4, 9, 195, 134, 147, 44, 92, 5, 101, // ........,..e + 176, 145, 171, 66, 151, 165, 53, 31, 131, 13, 64, 46, // ...B..5...@. + 176, 27, 139, 9, 49, 201, 218, 192, 74, 242, 79, 90, // ....1...J.OZ + 66, 30, 155, 193, 246, 81, 234, 146, 167, 176, 117, 139, // B....Q....u. + 207, 141, 100, 140, 182, 66, 56, 197, 254, 113, 162, 232, // ..d..B8..q.. + 163, 181, 211, 108, 113, 143, 93, 175, 204, 180, 199, 225, // ...lq.]..... + 93, 84, 23, 148, 216, 81, 193, 99, 59, 123, 96, 229, // ]T...Q.c;{`. + 127, 114, 8, 237, 45, 35, 223, 188, 76, 234, 108, 99, // .r..-#..L.lc + 156, 211, 182, 8, 4, 146, 83, 97, 38, 59, 234, 229, // ......Sa&;.. + 110, 6, 132, 54, 174, 72, 25, 36, 154, 163, 105, 62, // n..6.H.$..i> + 82, 10, 140, 197, 182, 77, 129, 218, 60, 90, 100, 18, // R....M.......| + 163, 48, 87, 7, 57, 241, 128, 239, 43, 140, 99, 193, // .0W.9...+.c. + 151, 222, 239, 160, 46, 129, 242, 6, 208, 175, 28, 29, // ............ + 130, 117, 53, 244, 214, 134, 47, 243, 0, 17, 89, 77, // .u5.../...YM + 121, 240, 180, 187, 132, 169, 30, 93, 194, 240, 232, 217, // y......].... + 60, 95, 248, 181, 153, 170, 154, 172, 146, 162, 52, 190, // <_........4. + 158, 187, 30, 174, 250, 103, 128, 185, 167, 73, 236, 200, // .....g...I.. + 28, 227, 106, 162, 213, 193, 64, 74, 252, 189, 241, 146, // ..j...@J.... + 3, 50, 124, 99, 46, 170, 248, 2, 82, 221, 243, 229, // .2|c....R... + 171, 26, 226, 115, 54, 28, 215, 227, 49, 221, 215, 106, // ...s6...1..j + 9, 231, 178, 196, 225, 86, 248, 79, 92, 110, 57, 163, // .....V.O.n9. + 227, 101, 98, 47, 17, 204, 220, 36, 241, 1, 176, 69, // .eb/...$...E + 47, 171, 105, 159, 53, 15, 92, 87, 216, 10, 119, 129, // /.i.5..W..w. + 133, 240, 150, 242, 51, 4, 37, 143, 129, 170, 158, 31, // ....3.%..... + 239, 48, 238, 13, 228, 209, 136, 72, 245, 151, 210, 93, // .0.....H...] + 234, 26, 43, 194, 202, 195, 37, 114, 26, 217, 115, 66, // ..+...%r..sB + 8, 96, 177, 213, 203, 131, 177, 129, 187, 91, 156, 186, // .`.......[.. + 71, 5, 199, 84, 102, 122, 188, 185, 191, 106, 76, 180, // G..Tfz...jL. + 229, 252, 92, 208, 187, 17, 150, 48, 103, 252, 50, 129, // .......0g.2. + 185, 75, 215, 157, 36, 240, 237, 237, 116, 123, 197, 29, // .K..$...t{.. + 76, 28, 141, 57, 186, 154, 56, 246, 244, 51, 31, 176, // L..9..8..3.. + 63, 112, 65, 77, 18, 80, 102, 196, 88, 253, 128, 123, // ?pAM.Pf.X..{ + 237, 181, 51, 105, 193, 52, 227, 88, 102, 202, 158, 88, // ..3i.4.Xf..X + 192, 229, 136, 46, 80, 233, 164, 97, 227, 64, 237, 213, // ....P..a.@.. + 131, 108, 143, 139, 82, 171, 99, 161, 241, 121, 81, 228, // .l..R.c..yQ. + 5, 59, 195, 37, 162, 12, 106, 245, 158, 134, 195, 102, // .;.%..j....f + 133, 204, 205, 253, 131, 179, 91, 193, 65, 128, 118, 70, // ......[.A.vF + 54, 136, 209, 61, 106, 37, 202, 181, 99, 243, 254, 117, // 6..=j%..c..u + 248, 121, 107, 133, 177, 95, 173, 178, 125, 181, 46, 242, // .yk.._..}... + 91, 4, 155, 123, 104, 232, 9, 60, 179, 46, 135, 227, // [..{h..<.... + 22, 169, 14, 137, 100, 238, 229, 3, 27, 9, 177, 76, // ....d......L + 112, 26, 197, 149, 72, 121, 89, 80, 104, 236, 204, 181, // p...HyYPh... + 250, 174, 96, 146, 36, 29, 196, 209, 235, 39, 142, 147, // ..`.$....'.. + 149, 54, 65, 29, 226, 200, 78, 64, 65, 20, 116, 150, // .6A...N@A.t. + 198, 251, 183, 215, 240, 237, 220, 20, 166, 103, 109, 205, // .........gm. + 6, 184, 153, 144, 27, 143, 154, 112, 136, 29, 236, 15, // .......p.... + 220, 142, 244, 83, 218, 96, 144, 217, 162, 166, 236, 145, // ...S.`...... + 126, 136, 88, 63, 133, 216, 38, 175, 214, 230, 54, 59, // ~.X?..&...6; + 63, 102, 46, 33, 173, 155, 164, 212, 51, 251, 237, 13, // ?f.!....3... + 174, 214, 58, 155, 44, 161, 1, 158, 235, 195, 193, 159, // ..:.,....... + 167, 55, 26, 113, 172, 15, 150, 124, 76, 54, 58, 175, // .7.q...|L6:. + 43, 105, 110, 219, 79, 96, 144, 79, 88, 243, 222, 202, // +in.O`.OX... + 75, 249, 139, 124, 143, 150, 239, 104, 214, 31, 77, 206, // K..|...h..M. + 80, 254, 108, 2, 114, 249, 71, 27, 181, 201, 175, 141, // P.l.r.G..... + 44, 203, 79, 84, 123, 162, 118, 15, 138, 126, 239, 34, // ,.OT{.v..~." + 173, 181, 177, 251, 107, 239, 82, 106, 249, 30, 14, 153, // ....k.Rj.... + 32, 244, 60, 89, 165, 46, 209, 115, 1, 251, 196, 95, // ..!.....m. + 15, 231, 22, 225, 143, 241, 161, 219, 51, 136, 146, 154, // ........3... + 237, 176, 146, 195, 16, 134, 160, 231, 74, 18, 93, 88, // ........J.]X + 167, 169, 242, 88, 109, 146, 160, 4, 68, 65, 93, 127, // ...Xm...DA]. + 14, 199, 25, 230, 26, 220, 73, 56, 226, 67, 89, 208, // ......I8.CY. + 79, 173, 232, 72, 74, 15, 160, 233, 246, 144, 159, 193, // O..HJ....... + 0, 95, 174, 242, 238, 237, 197, 191, 126, 43, 255, 243, // ._......~+.. + 183, 12, 63, 141, 43, 124, 242, 226, 138, 31, 160, 136, // ..?.+|...... + 89, 109, 54, 141, 224, 0, 81, 22, 229, 226, 29, 138, // Ym6...Q..... + 92, 204, 60, 219, 249, 138, 59, 177, 130, 151, 194, 127, // ..<...;..... + 105, 32, 134, 147, 201, 132, 82, 121, 57, 84, 196, 225, // i ....Ry9T.. + 248, 12, 96, 39, 45, 4, 122, 6, 109, 215, 231, 242, // ..`'-.z.m... + 68, 194, 71, 192, 12, 213, 151, 234, 115, 122, 159, 155, // D.G.....sz.. + 55, 205, 0, 166, 145, 88, 95, 145, 163, 99, 1, 43, // 7....X_..c.+ + 0, 230, 28, 47, 169, 47, 56, 78, 234, 58, 128, 220, // ..././8N.:.. + 117, 8, 166, 196, 158, 159, 78, 37, 175, 117, 247, 78, // u.....N%.u.N + 138, 222, 54, 210, 97, 97, 150, 144, 66, 33, 83, 47, // ..6.aa..B!S/ + 17, 162, 21, 241, 8, 3, 162, 215, 122, 158, 44, 220, // ........z.,. + 152, 8, 99, 16, 242, 163, 101, 14, 167, 135, 7, 206, // ..c...e..... + 134, 175, 249, 185, 199, 204, 35, 4, 160, 116, 13, 215, // ......#..t.. + 88, 189, 18, 126, 62, 86, 25, 75, 52, 64, 158, 63, // X..~>V.K4@.? + 183, 219, 31, 126, 105, 129, 29, 131, 0, 167, 178, 113, // ...~i......q + 78, 185, 214, 98, 150, 81, 38, 120, 70, 44, 51, 163, // N..b.Q&xF,3. + 63, 29, 126, 106, 238, 65, 134, 159, 154, 97, 5, 26, // ?.~j.A...a.. + 91, 20, 52, 31, 208, 128, 74, 244, 216, 79, 181, 136, // [.4...J..O.. + 63, 135, 205, 205, 45, 242, 225, 11, 110, 38, 167, 248, // ?...-...n&.. + 245, 231, 192, 195, 99, 205, 250, 199, 244, 62, 133, 145, // ....c....>.. + 56, 62, 214, 138, 114, 190, 132, 180, 150, 174, 98, 232, // 8>..r.....b. + 249, 18, 212, 172, 168, 3, 28, 27, 62, 27, 218, 69, // ........>..E + 253, 86, 181, 165, 172, 45, 21, 7, 171, 123, 105, 232, // .V...-...{i. + 208, 206, 49, 28, 180, 164, 192, 74, 63, 147, 118, 22, // ..1....J?.v. + 167, 67, 76, 194, 61, 167, 2, 48, 166, 251, 191, 15, // .CL.=..0.... + 56, 74, 132, 251, 175, 17, 167, 179, 204, 39, 189, 220, // 8J.......'.. + 155, 168, 49, 20, 83, 125, 183, 205, 139, 234, 62, 124, // ..1.S}....>| + 22, 150, 207, 214, 208, 60, 254, 86, 155, 84, 254, 64, // .....<.V.T.@ + 37, 19, 157, 202, 152, 202, 109, 82, 72, 126, 67, 85, // %.....mRH~CU + 115, 79, 99, 51, 74, 242, 91, 106, 130, 91, 201, 81, // sOc3J.[j.[.Q + 142, 252, 211, 214, 222, 235, 184, 142, 48, 254, 111, 182, // ........0.o. + 126, 14, 239, 36, 170, 228, 247, 182, 250, 54, 220, 225, // ~..$.....6.. + 252, 182, 141, 127, 111, 199, 172, 228, 63, 108, 249, 187, // ....o...?l.. + 205, 86, 23, 56, 84, 110, 244, 69, 152, 197, 169, 150, // .V.8Tn.E.... + 191, 218, 142, 31, 244, 38, 151, 255, 180, 149, 179, 48, // .....&.....0 + 77, 151, 97, 116, 45, 181, 118, 45, 118, 85, 153, 107, // M.at-.v-vU.k + 232, 188, 93, 25, 184, 54, 206, 156, 124, 141, 179, 51, // ..]..6..|..3 + 14, 139, 221, 126, 250, 31, 255, 11, 22, 19, 178, 116, // ...~.......t + 138, 51, 0, 0, 0 // .3.. }; static const unsigned char v2[] = { + 31, 139, 8, 8, 219, 27, 244, 98, 0, 3, 109, 97, // .......b..ma + 105, 110, 46, 106, 115, 0, 165, 86, 237, 110, 219, 54, // in.js..V.n.6 + 20, 253, 239, 167, 184, 8, 6, 52, 65, 109, 41, 77, // .......4Am)M + 246, 1, 52, 138, 1, 55, 93, 129, 20, 93, 61, 204, // ..4..7]..]=. + 233, 218, 254, 43, 37, 210, 22, 91, 138, 84, 249, 97, // ...+%..[.T.a + 205, 11, 242, 46, 125, 150, 62, 217, 14, 37, 217, 177, // ....}.>..%.. + 19, 103, 195, 218, 95, 166, 36, 222, 123, 15, 207, 185, // .g.._.$.{... + 247, 208, 143, 130, 19, 228, 188, 149, 133, 127, 116, 54, // ..........t6 + 144, 85, 109, 172, 167, 107, 42, 135, 84, 250, 74, 13, // .Um..k*.T.J. + 201, 10, 205, 133, 165, 27, 154, 91, 83, 209, 163, 36, // .......[S..$ + 173, 173, 96, 133, 79, 42, 169, 147, 143, 14, 33, 131, // ..`.O*....!. + 65, 97, 180, 243, 244, 142, 206, 105, 30, 116, 225, 165, // Aa.....i.t.. + 209, 116, 120, 68, 215, 131, 1, 33, 218, 7, 171, 219, // .txD...!.... + 84, 31, 240, 152, 113, 185, 164, 66, 49, 231, 206, 15, // T...q..B1... + 16, 229, 153, 212, 194, 30, 140, 241, 5, 223, 202, 147, // ............ + 245, 39, 39, 218, 44, 7, 227, 201, 179, 233, 155, 43, // .''.,......+ + 122, 51, 203, 210, 242, 164, 223, 181, 149, 193, 154, 166, // z3.......... + 143, 189, 155, 89, 141, 126, 217, 124, 193, 183, 122, 220, // ...Y.~.|..z. + 45, 54, 111, 136, 46, 132, 99, 168, 79, 51, 51, 247, // -6o...c.O33. + 13, 179, 130, 94, 121, 158, 144, 116, 84, 10, 198, 63, // ...^y..tT..? + 7, 102, 189, 176, 130, 127, 253, 34, 53, 61, 15, 185, // .f....."5=.. + 146, 122, 72, 127, 136, 58, 174, 10, 50, 115, 186, 180, // .zH..:..2s.. + 66, 49, 205, 147, 219, 26, 105, 189, 83, 112, 231, 121, // B1....i.Sp.y + 26, 44, 40, 54, 118, 69, 214, 24, 239, 40, 103, 197, // .,(6vE...(g. + 39, 242, 134, 78, 142, 143, 127, 28, 82, 83, 10, 77, // '..N....RS.M + 191, 25, 189, 48, 6, 82, 188, 21, 57, 205, 132, 93, // ...0.R..9..] + 130, 243, 87, 50, 183, 204, 174, 190, 126, 225, 98, 41, // ..W2....~.b) + 148, 169, 43, 161, 61, 242, 68, 108, 192, 154, 229, 118, // ..+.=.Dl...v + 60, 216, 148, 152, 184, 189, 41, 22, 86, 52, 132, 51, // <.....).V4.3 + 212, 166, 14, 138, 89, 233, 87, 4, 216, 84, 49, 200, // ....Y.W..T1. + 34, 56, 153, 184, 199, 151, 130, 230, 70, 41, 211, 72, // "8......F).H + 189, 160, 149, 96, 214, 13, 99, 204, 201, 241, 147, 211, // ...`..c..... + 13, 79, 13, 115, 36, 80, 27, 4, 184, 18, 145, 64, // .O.s$P.....@ + 31, 5, 148, 58, 8, 146, 56, 210, 54, 196, 88, 97, // ...:..8.6.Xa + 3, 172, 182, 102, 41, 57, 90, 44, 212, 109, 107, 33, // ...f)9Z,.mk! + 208, 128, 142, 37, 83, 1, 105, 138, 0, 94, 42, 97, // ...%S.i..^*a + 221, 195, 76, 190, 21, 20, 245, 65, 158, 208, 150, 45, // ..L....A...- + 217, 18, 111, 42, 28, 182, 77, 180, 201, 128, 67, 233, // ..o*..M...C. + 21, 101, 114, 252, 2, 101, 130, 22, 244, 211, 241, 113, // .er..e.....q + 150, 202, 49, 112, 86, 53, 211, 82, 56, 194, 25, 26, // ..1pV5.R8... + 161, 84, 252, 173, 4, 151, 161, 106, 161, 186, 138, 225, // .T.....j.... + 157, 147, 127, 11, 202, 131, 67, 71, 58, 39, 182, 240, // ......CG:'.. + 16, 184, 44, 194, 134, 58, 244, 134, 138, 107, 52, 65, // ..,..:...k4A + 44, 239, 140, 10, 177, 87, 93, 236, 29, 70, 53, 179, // ,....W]..F5. + 128, 22, 64, 194, 220, 88, 10, 174, 13, 105, 9, 198, // ..@..X...i.. + 204, 96, 193, 252, 94, 153, 16, 139, 49, 228, 148, 175, // .`..^...1... + 232, 245, 100, 54, 33, 150, 27, 102, 187, 192, 75, 141, // ..d6!..f..K. + 78, 212, 44, 214, 96, 138, 102, 53, 43, 4, 205, 124, // N.,.`.f5+..| + 251, 28, 195, 182, 96, 198, 221, 57, 52, 138, 194, 204, // ....`..94... + 165, 173, 186, 61, 96, 76, 250, 100, 135, 212, 150, 214, // ...=`L.d.... + 153, 212, 200, 20, 53, 30, 110, 68, 46, 163, 200, 127, // ....5.nD.... + 129, 44, 14, 44, 81, 85, 144, 206, 3, 128, 71, 229, // .,.,QU....G. + 208, 34, 210, 36, 64, 189, 214, 186, 61, 27, 151, 209, // .".$@...=... + 59, 242, 224, 5, 137, 42, 23, 60, 70, 186, 245, 76, // ;....*.4..`.z + 17, 96, 1, 163, 198, 148, 99, 119, 95, 227, 150, 170, // .`....cw_... + 238, 196, 194, 71, 138, 175, 74, 244, 164, 235, 224, 175, // ...G..J..... + 39, 61, 197, 168, 247, 102, 176, 94, 246, 139, 15, 103, // '=...f.^...g + 131, 155, 179, 181, 31, 189, 255, 110, 63, 58, 189, 239, // .......n?:.. + 71, 155, 182, 187, 69, 109, 197, 83, 216, 211, 233, 55, // G...Em.S...7 + 219, 83, 22, 212, 150, 52, 153, 146, 219, 66, 81, 6, // .S...4...BQ. + 85, 172, 152, 159, 31, 148, 222, 215, 238, 105, 154, 86, // U........i.V + 125, 251, 36, 141, 75, 15, 198, 123, 154, 41, 75, 217, // }.$.K..{.)K. + 78, 134, 17, 136, 189, 213, 166, 193, 62, 215, 53, 93, // N.......>.5] + 228, 27, 52, 55, 198, 126, 138, 131, 175, 58, 183, 217, // ..47.~...:.. + 130, 146, 238, 96, 249, 79, 100, 75, 48, 152, 72, 3, // ...`.OdK0.H. + 84, 127, 94, 76, 95, 99, 117, 31, 201, 196, 242, 32, // T.^L_cu.... + 181, 25, 181, 35, 233, 101, 174, 208, 177, 177, 211, 93, // ...#.e.....] + 215, 29, 121, 144, 202, 143, 96, 61, 177, 125, 219, 166, // ..y...`=.}.. + 153, 94, 77, 40, 212, 156, 121, 225, 182, 51, 117, 30, // .^M(..y..3u. + 166, 217, 66, 180, 134, 195, 153, 43, 219, 60, 223, 14, // ..B....+.<.. + 190, 138, 57, 18, 208, 1, 248, 213, 243, 126, 189, 151, // ..9......~.. + 74, 152, 5, 32, 142, 12, 28, 230, 210, 92, 209, 239, // J.. ........ + 138, 97, 52, 108, 245, 29, 165, 123, 13, 71, 198, 37, // .a4l...{.G.% + 32, 102, 75, 212, 233, 108, 47, 2, 83, 11, 11, 246, // fK..l/.S... + 160, 153, 91, 57, 47, 170, 214, 107, 96, 223, 163, 218, // ..[9/..k`... + 52, 208, 181, 146, 133, 53, 177, 155, 45, 76, 29, 198, // 4....5..-L.. + 120, 23, 217, 255, 128, 182, 128, 42, 33, 143, 168, 210, // x......*!... + 162, 243, 136, 180, 250, 232, 192, 208, 203, 253, 200, 54, // ...........6 + 109, 246, 146, 45, 217, 172, 176, 178, 246, 36, 244, 2, // m..-.....$.. + 83, 213, 98, 188, 72, 47, 30, 63, 126, 128, 168, 44, // S.b.H/.?~.., + 189, 157, 131, 173, 17, 191, 63, 58, 63, 239, 222, 236, // ......?:?... + 89, 62, 158, 238, 248, 112, 55, 144, 249, 238, 13, 188, // Y>...p7..... + 59, 100, 237, 193, 37, 108, 102, 1, 30, 163, 213, 105, // ;d..%lf....i + 184, 164, 47, 77, 192, 17, 209, 139, 240, 29, 156, 24, // ../M........ + 119, 74, 33, 97, 185, 235, 73, 191, 35, 107, 155, 131, // wJ!a..I.#k.. + 139, 90, 153, 85, 119, 29, 150, 65, 115, 220, 169, 109, // .Z.Uw..As..m + 120, 37, 149, 106, 193, 192, 42, 37, 152, 107, 175, 224, // x%.j..*%.k.. + 46, 79, 116, 35, 161, 151, 210, 26, 29, 123, 247, 78, // .Ot#.....{.N + 218, 7, 88, 248, 87, 163, 155, 212, 245, 142, 213, 161, // ..X.W....... + 80, 237, 246, 249, 93, 86, 62, 25, 63, 99, 14, 255, // P...]V>.?c.. + 96, 126, 93, 235, 244, 66, 42, 209, 55, 17, 23, 21, // `~]..B*.7... + 38, 22, 91, 6, 89, 95, 236, 135, 235, 242, 240, 221, // &.[.Y_...... + 209, 205, 160, 47, 186, 253, 250, 253, 230, 117, 15, 5, // .../.....u.. + 255, 29, 184, 105, 18, 163, 149, 97, 28, 112, 96, 184, // ...i...a.p`. + 231, 227, 254, 207, 227, 97, 121, 8, 140, 71, 67, 226, // .....ay..GC. + 112, 255, 120, 232, 36, 55, 124, 117, 116, 54, 248, 7, // p.x.$7|ut6.. + 71, 33, 75, 134, 124, 10, 0, 0, 0 // G!K.|... +}; +static const unsigned char v3[] = { 39, 117, 115, 101, 32, 115, 116, 114, 105, 99, 116, 39, // 'use strict' 59, 10, 105, 109, 112, 111, 114, 116, 32, 123, 32, 104, // ;.import { h 44, 32, 104, 116, 109, 108, 44, 32, 114, 101, 110, 100, // , html, rend @@ -282,7 +783,7 @@ static const unsigned char v2[] = { 112, 41, 44, 32, 100, 111, 99, 117, 109, 101, 110, 116, // p), document 46, 98, 111, 100, 121, 41, 59, 10, 0 // .body);. }; -static const unsigned char v3[] = { +static const unsigned char v4[] = { 118, 97, 114, 32, 101, 44, 110, 44, 95, 44, 116, 44, // var e,n,_,t, 111, 44, 114, 44, 117, 44, 108, 61, 123, 125, 44, 105, // o,r,u,l={},i 61, 91, 93, 44, 99, 61, 47, 97, 99, 105, 116, 124, // =[],c=/acit| @@ -1384,7 +1885,147 @@ static const unsigned char v3[] = { 115, 101, 69, 114, 114, 111, 114, 66, 111, 117, 110, 100, // seErrorBound 97, 114, 121, 125, 59, 10, 0 // ary};. }; -static const unsigned char v4[] = { +static const unsigned char v5[] = { + 60, 33, 68, 79, 67, 84, 89, 80, 69, 32, 104, 116, // .. < + 104, 101, 97, 100, 62, 10, 32, 32, 32, 32, 60, 109, // head>. . + 32, 32, 32, 32, 60, 109, 101, 116, 97, 32, 104, 116, // . + 32, 32, 32, 32, 60, 109, 101, 116, 97, 32, 104, 116, // . + 32, 32, 60, 109, 101, 116, 97, 32, 110, 97, 109, 101, // . + 32, 32, 32, 32, 32, 32, 32, 60, 116, 105, 116, 108, // Mongoose E + 109, 98, 101, 100, 100, 101, 100, 32, 70, 105, 108, 101, // mbedded File + 115, 121, 116, 101, 109, 32, 101, 120, 97, 109, 112, 108, // sytem exampl + 101, 60, 47, 116, 105, 116, 108, 101, 62, 10, 32, 32, // e. + 32, 32, 60, 108, 105, 110, 107, 32, 114, 101, 108, 61, // . < + 47, 104, 101, 97, 100, 62, 10, 32, 32, 60, 98, 111, // /head>. . + 32, 60, 115, 99, 114, 105, 112, 116, 32, 116, 121, 112, // .< + 47, 104, 116, 109, 108, 62, 10, 0 // /html>. +}; +static const unsigned char v6[] = { + 31, 139, 8, 8, 219, 27, 244, 98, 0, 3, 105, 110, // .......b..in + 100, 101, 120, 46, 104, 116, 109, 108, 0, 141, 145, 77, // dex.html...M + 75, 3, 49, 16, 134, 239, 253, 21, 99, 206, 166, 139, // K.1.....c... + 55, 193, 205, 130, 212, 22, 60, 136, 30, 90, 208, 99, // 7.....<..Z.c + 154, 140, 205, 104, 62, 214, 205, 244, 99, 255, 189, 217, // ...h>...c... + 110, 133, 5, 17, 60, 205, 7, 47, 15, 51, 239, 91, // n...<../.3.[ + 95, 61, 60, 47, 214, 111, 47, 75, 112, 28, 124, 51, // _= + 82, 102, 53, 76, 247, 11, 203, 208, 90, 0, 251, 237, // Rf5L....Z... + 44, 132, 66, 114, 251, 230, 89, 9, 61, 233, 201, 42, // ,.Br..Y.=..* + 183, 139, 233, 148, 178, 71, 132, 89, 141, 14, 229, 150, // .....G.Y.... + 43, 52, 53, 74, 74, 210, 220, 120, 102, 26, 108, 67, // +45JJ..xf.lC + 113, 20, 29, 155, 158, 228, 107, 39, 196, 72, 139, 175, // q.....k'.H.. + 229, 176, 44, 105, 5, 92, 16, 56, 175, 225, 222, 199, // ..,i...8.... + 148, 55, 108, 148, 26, 28, 237, 6, 246, 244, 248, 163, // .7l......... + 119, 163, 171, 55, 18, 98, 60, 203, 192, 102, 80, 68, // w..7.b<..fPD + 241, 40, 117, 42, 213, 89, 211, 30, 17, 231, 35, 202, // .(u*.Y....#. + 157, 120, 255, 186, 46, 46, 234, 1, 157, 57, 188, 87, // .x.......9.W + 152, 65, 59, 139, 38, 160, 69, 34, 203, 208, 187, 220, // .A;.&.E".... + 177, 91, 79, 69, 102, 220, 185, 35, 62, 81, 226, 29, // .[OEf..#>Q.. + 238, 219, 24, 60, 217, 220, 155, 41, 208, 149, 141, 51, // ...<...)...3 + 90, 213, 243, 6, 173, 205, 168, 69, 107, 166, 127, 148, // Z......Ek... + 65, 88, 220, 35, 247, 7, 165, 252, 240, 160, 60, 185, // AX.#......<. + 232, 80, 51, 209, 131, 236, 35, 212, 149, 30, 106, 45, // .P3...#...j- + 253, 219, 210, 208, 245, 125, 178, 133, 33, 233, 70, 121, // .....}..!.Fy + 159, 163, 224, 79, 197, 234, 241, 158, 252, 212, 72, 197, // ...O......H. + 253, 163, 83, 224, 124, 43, 172, 251, 77, 28, 193, 21, // ..S.|+..M... + 153, 105, 70, 139, 127, 126, 63, 170, 87, 208, 173, 192, // .iF..~?.W... + 235, 43, 152, 6, 241, 73, 150, 59, 221, 6, 55, 13, // .+...I.;..7. + 87, 231, 148, 200, 66, 98, 151, 165, 155, 77, 148, 90, // W...Bb...M.Z + 135, 212, 115, 145, 22, 69, 72, 237, 66, 102, 91, 134, // ..s..EH.Bf[. + 240, 115, 8, 111, 54, 139, 90, 219, 144, 41, 159, 23, // .s.o6.Z..).. + 165, 54, 81, 38, 154, 171, 12, 225, 167, 229, 88, 79, // .6Q&......XO + 33, 83, 44, 167, 42, 66, 38, 143, 166, 138, 87, 95, // !S,.*B&...W_ + 78, 21, 237, 62, 15, 245, 163, 3, 198, 41, 249, 22, // N..>.....).. + 221, 74, 89, 145, 225, 105, 252, 142, 224, 15, 15, 235, // .JY..i...... + 64, 244, 132, 205, 183, 254, 228, 94, 227, 82, 244, 50, // @......^.R.2 + 95, 112, 249, 84, 201, 201, 61, 74, 185, 212, 5, 63, // _p.T..=J...? + 252, 15, 225, 232, 67, 124, 39, 7, 0, 0, 0 // ....C|'... +}; +static const unsigned char v8[] = { 42, 32, 123, 32, 98, 111, 120, 45, 115, 105, 122, 105, // * { box-sizi 110, 103, 58, 32, 98, 111, 114, 100, 101, 114, 45, 98, // ng: border-b 111, 120, 59, 32, 125, 10, 104, 116, 109, 108, 44, 32, // ox; }.html, @@ -1546,10 +2187,14 @@ static const struct packed_file { size_t size; time_t mtime; } packed_files[] = { - {"/web_root/index.html", v1, sizeof(v1), 1692212839}, - {"/web_root/main.js", v2, sizeof(v2), 1692212839}, - {"/web_root/preact.min.js", v3, sizeof(v3), 1692212839}, - {"/web_root/style.css", v4, sizeof(v4), 1692212839}, + {"/web_root/preact.min.js.gz", v1, sizeof(v1), 1660165083}, + {"/web_root/main.js.gz", v2, sizeof(v2), 1660165083}, + {"/web_root/main.js", v3, sizeof(v3), 1660586478}, + {"/web_root/preact.min.js", v4, sizeof(v4), 1660586478}, + {"/web_root/index.html", v5, sizeof(v5), 1660586478}, + {"/web_root/index.html.gz", v6, sizeof(v6), 1660165083}, + {"/web_root/style.css.gz", v7, sizeof(v7), 1660165083}, + {"/web_root/style.css", v8, sizeof(v8), 1660586478}, {NULL, NULL, 0, 0} }; diff --git a/Makefile b/test/Makefile similarity index 70% rename from Makefile rename to test/Makefile index c977955d..17b25b7e 100644 --- a/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ -SRCS = mongoose.c test/unit_test.c test/packed_fs.c -HDRS = $(wildcard src/*.h) $(wildcard src/drivers/*.h) +SRCS = mongoose.c unit_test.c packed_fs.c +HDRS = $(wildcard ../src/*.h) $(wildcard ../src/drivers/*.h) DEFS ?= -DMG_MAX_HTTP_HEADERS=7 -DMG_ENABLE_LINES -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_SSI=1 -DMG_ENABLE_ASSERT=1 WARN ?= -pedantic -W -Wall -Werror -Wshadow -Wdouble-promotion -fno-common -Wconversion -Wundef OPTS ?= -O3 -g3 @@ -8,20 +8,20 @@ SSL ?= CWD ?= $(realpath $(CURDIR)) ENV ?= -e Tmp=. -e WINEDEBUG=-all DOCKER_BIN ?= docker -DOCKER ?= $(DOCKER_BIN) run --platform linux/amd64 --rm $(ENV) -v $(CWD):$(CWD) -w $(CWD) +DOCKER ?= $(DOCKER_BIN) run --platform linux/amd64 --rm $(ENV) -v $(CWD)/..:$(CWD)/.. -w $(CWD) VCFLAGS = /nologo /W3 /O2 /MD /I. $(DEFS) $(TFLAGS) IPV6 ?= 1 ASAN ?= -fsanitize=address,undefined,alignment -fno-sanitize-recover=all -fno-omit-frame-pointer -fno-common ASAN_OPTIONS ?= detect_leaks=1 -EXAMPLES := $(dir $(wildcard examples/*/Makefile)) -EXAMPLES_QUICK := $(filter-out examples/mip-pcap/ examples/micropython/, $(EXAMPLES)) -EXAMPLES_MAC := $(filter-out examples/mip-pcap/ examples/mip-tap/ examples/micropython/, $(EXAMPLES)) -EXAMPLES_WIN := $(dir $(wildcard examples/device-dashboard/Makefile) $(wildcard examples/file-*/Makefile) $(wildcard examples/http-*/Makefile) $(wildcard examples/mqtt-*/Makefile) $(wildcard examples/websocket-*/Makefile) $(wildcard examples/webui-*/Makefile)) -EXAMPLES_EMBEDDED := $(filter-out $(wildcard examples/zephyr/*/), $(dir $(wildcard examples/*/*/Makefile))) +EXAMPLES := $(dir $(wildcard ../examples/*/Makefile)) +EXAMPLES_QUICK := $(filter-out ../examples/mip-pcap/ ../examples/micropython/, $(EXAMPLES)) +EXAMPLES_MAC := $(filter-out ../examples/mip-pcap/ ../examples/mip-tap/ ../examples/micropython/, $(EXAMPLES)) +EXAMPLES_WIN := $(dir $(wildcard ../examples/device-dashboard/Makefile) $(wildcard ../examples/file-*/Makefile) $(wildcard ../examples/http-*/Makefile) $(wildcard ../examples/mqtt-*/Makefile) $(wildcard ../examples/websocket-*/Makefile) $(wildcard ../examples/webui-*/Makefile)) +EXAMPLES_EMBEDDED := $(filter-out $(wildcard ../examples/zephyr/*/), $(dir $(wildcard ../examples/*/*/Makefile))) PREFIX ?= /usr/local LIBDIR ?= $(PREFIX)/lib INCLUDEDIR ?= $(PREFIX)/include -VERSION ?= $(shell cut -d'"' -f2 src/version.h) +VERSION ?= $(shell cut -d'"' -f2 ../src/version.h) COMMON_CFLAGS ?= $(C_WARN) $(WARN) $(INCS) $(DEFS) -DMG_ENABLE_IPV6=$(IPV6) $(TFLAGS) -pthread CFLAGS ?= $(OPTS) $(ASAN) $(COMMON_CFLAGS) VALGRIND_CFLAGS ?= $(OPTS) $(COMMON_CFLAGS) @@ -53,16 +53,16 @@ CFLAGS += -DMG_TLS=MG_TLS_BUILTIN endif all: - $(MAKE) -C examples/http-server + $(MAKE) -C ../examples/http-server tall: mg_prefix unamalgamated test mip_test arm examples vc98 vc17 vc22 mingw mingw++ fuzz -mip_test: test/mip_test.c mongoose.c mongoose.h Makefile mip_tap_test - $(CC) test/mip_test.c $(INCS) $(WARN) $(OPTS) $(C_WARN) $(ASAN) -o $@ +mip_test: mip_test.c mongoose.c mongoose.h Makefile mip_tap_test + $(CC) mip_test.c $(INCS) $(WARN) $(OPTS) $(C_WARN) $(ASAN) -o $@ ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./$@ -mip_tap_test: test/mip_tap_test.c mongoose.c mongoose.h Makefile - $(CC) test/mip_tap_test.c $(INCS) $(WARN) $(OPTS) $(C_WARN) $(ASAN) -o $@ +mip_tap_test: mip_tap_test.c mongoose.c mongoose.h Makefile + $(CC) mip_tap_test.c $(INCS) $(WARN) $(OPTS) $(C_WARN) $(ASAN) -o $@ ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./$@ examples: @@ -85,9 +85,9 @@ examples_win: clean_examples_win: $(foreach X, $(EXAMPLES_WIN), $(MAKE) -C $(X) clean &) -test/packed_fs.c: Makefile src/ssi.h test/fuzz.c test/data/a.txt test/data/ca.pem test/certs/ca.crt test/certs/server.crt test/certs/server.key - $(CC) $(CFLAGS) test/pack.c -o pack - $(RUN) ./pack Makefile src/ssi.h test/fuzz.c test/data/a.txt test/data/range.txt test/data/ca.pem test/certs/ca.crt test/certs/server.crt test/certs/server.key test/certs/client.key test/certs/client.crt > $@ +packed_fs.c: Makefile data/ssi.h fuzz.c data/a.txt data/ca.pem certs/ca.crt certs/server.crt certs/server.key + $(CC) $(CFLAGS) pack.c -o pack + $(RUN) ./pack Makefile data/ssi.h fuzz.c data/a.txt data/range.txt data/ca.pem certs/ca.crt certs/server.crt certs/server.key certs/client.key certs/client.crt > $@ # Check that all external (exported) symbols have "mg_" prefix mg_prefix: mongoose.c mongoose.h @@ -101,17 +101,17 @@ musl: RUN = $(DOCKER) mdashnet/cc1 # Make sure we can build from unamalgamated sources. unamalgamated: CFLAGS += -DMG_ENABLE_MD5=1 -unamalgamated: $(HDRS) Makefile test/packed_fs.c - $(CC) src/*.c test/packed_fs.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -g -o unit_test +unamalgamated: $(HDRS) Makefile packed_fs.c + $(CC) ../src/*.c packed_fs.c unit_test.c $(CFLAGS) $(LDFLAGS) -g -o unit_test fuzz: ASAN = -fsanitize=fuzzer,signed-integer-overflow,address,undefined -fuzz: mongoose.c mongoose.h Makefile test/fuzz.c - $(CC) test/fuzz.c $(OPTS) $(WARN) $(INCS) $(TFLAGS) $(ASAN) -o fuzzer +fuzz: mongoose.c mongoose.h Makefile fuzz.c + $(CC) fuzz.c $(OPTS) $(WARN) $(INCS) $(TFLAGS) $(ASAN) -o fuzzer $(RUN) ./fuzzer FUZZDATA ?= /tmp/fuzzdata -fuzz2: mongoose.c mongoose.h Makefile test/fuzz.c - $(CC) test/fuzz.c -DMAIN $(OPTS) $(WARN) $(ASAN) $(INCS) -o fuzzer +fuzz2: mongoose.c mongoose.h Makefile fuzz.c + $(CC) fuzz.c -DMAIN $(OPTS) $(WARN) $(ASAN) $(INCS) -o fuzzer $(RUN) ./fuzzer $(FUZZDATA) test: Makefile mongoose.h $(SRCS) @@ -191,14 +191,14 @@ uninstall: rm -rf $(DESTDIR)$(LIBDIR)/libmongoose.a $(DESTDIR)$(LIBDIR)/libmongoose.so.$(VERSION) $(DESTDIR)$(INCLUDEDIR)/mongoose.h $(DESTDIR)$(LIBDIR)/libmongoose.so mongoose.c: Makefile $(wildcard src/*.c) $(wildcard src/drivers/*.c) - (export LC_ALL=C ; cat src/license.h; echo; echo '#include "mongoose.h"' ; (for F in src/*.c src/drivers/*.c ; do echo; echo '#ifdef MG_ENABLE_LINES'; echo "#line 1 \"$$F\""; echo '#endif'; cat $$F | sed -e 's,#include ".*,,'; done))> $@ + cd .. && (export LC_ALL=C ; cat src/license.h; echo; echo '#include "mongoose.h"' ; (for F in src/*.c src/drivers/*.c ; do echo; echo '#ifdef MG_ENABLE_LINES'; echo "#line 1 \"$$F\""; echo '#endif'; cat $$F | sed -e 's,#include ".*,,'; done))> $@ mongoose.h: $(HDRS) Makefile - (cat src/license.h; echo; echo '#ifndef MONGOOSE_H'; echo '#define MONGOOSE_H'; echo; cat src/version.h ; echo; echo '#ifdef __cplusplus'; echo 'extern "C" {'; echo '#endif'; cat src/arch.h src/arch_*.h src/net_ft.h src/net_lwip.h src/net_rl.h src/config.h src/str.h src/queue.h src/fmt.h src/printf.h src/log.h src/timer.h src/fs.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/sha256.h src/tls_x25519.h src/tls_aes128.h src/tls_uecc.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/tls_mbed.h src/tls_openssl.h src/ws.h src/sntp.h src/mqtt.h src/dns.h src/json.h src/rpc.h src/ota.h src/device.h src/net_builtin.h src/profile.h src/drivers/*.h | sed -e '/keep/! s,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@ + cd .. && (cat src/license.h; echo; echo '#ifndef MONGOOSE_H'; echo '#define MONGOOSE_H'; echo; cat src/version.h ; echo; echo '#ifdef __cplusplus'; echo 'extern "C" {'; echo '#endif'; cat src/arch.h src/arch_*.h src/net_ft.h src/net_lwip.h src/net_rl.h src/config.h src/str.h src/queue.h src/fmt.h src/printf.h src/log.h src/timer.h src/fs.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/sha256.h src/tls_x25519.h src/tls_aes128.h src/tls_uecc.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/tls_mbed.h src/tls_openssl.h src/ws.h src/sntp.h src/mqtt.h src/dns.h src/json.h src/rpc.h src/ota.h src/device.h src/net_builtin.h src/profile.h src/drivers/*.h | sed -e '/keep/! s,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@ clean: clean_examples clean_examples_embedded - rm -rf $(PROG) *.exe *.o *.dSYM *_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out data.txt crash-* test/packed_fs.c pack + rm -rf $(PROG) *.exe *.o *.dSYM *_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out data.txt crash-* packed_fs.c pack #find examples -maxdepth 3 -name zephyr -prune -o -name Makefile -print | xargs dirname | xargs -n1 make clean -C examples_embedded: diff --git a/test/data/ssi.h b/test/data/ssi.h new file mode 120000 index 00000000..2c93cfcb --- /dev/null +++ b/test/data/ssi.h @@ -0,0 +1 @@ +../../src/ssi.h \ No newline at end of file diff --git a/test/dirtest/fuzz.c b/test/dirtest/fuzz.c new file mode 120000 index 00000000..8fee20a0 --- /dev/null +++ b/test/dirtest/fuzz.c @@ -0,0 +1 @@ +../fuzz.c \ No newline at end of file diff --git a/test/dirtest/version.h b/test/dirtest/version.h new file mode 120000 index 00000000..9e568cea --- /dev/null +++ b/test/dirtest/version.h @@ -0,0 +1 @@ +../../src/version.h \ No newline at end of file diff --git a/test/fuzz.c b/test/fuzz.c index 87b154e4..7fb1b773 100644 --- a/test/fuzz.c +++ b/test/fuzz.c @@ -123,13 +123,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int main(int argc, char *argv[]) { int res = EXIT_FAILURE; if (argc > 1) { - size_t len = 0; - char *buf = mg_file_read(&mg_fs_posix, argv[1], &len); - if (buf != NULL) { - LLVMFuzzerTestOneInput((uint8_t *) buf, len); + struct mg_str data = mg_file_read(&mg_fs_posix, argv[1]); + if (data.buf != NULL) { + LLVMFuzzerTestOneInput((uint8_t *) data.buf, data.len); res = EXIT_SUCCESS; } - free(buf); + free(data.buf); } return res; } diff --git a/test/mongoose.c b/test/mongoose.c new file mode 120000 index 00000000..a7dab2ce --- /dev/null +++ b/test/mongoose.c @@ -0,0 +1 @@ +../mongoose.c \ No newline at end of file diff --git a/test/mongoose.h b/test/mongoose.h new file mode 120000 index 00000000..2802d985 --- /dev/null +++ b/test/mongoose.h @@ -0,0 +1 @@ +../mongoose.h \ No newline at end of file diff --git a/test/unit_test.c b/test/unit_test.c index 982c5bfe..b6daf9b3 100644 --- a/test/unit_test.c +++ b/test/unit_test.c @@ -652,21 +652,21 @@ static void eh1(struct mg_connection *c, int ev, void *ev_data) { } else if (mg_match(hm->uri, mg_str("/upload"), NULL)) { mg_http_upload(c, hm, &mg_fs_posix, ".", 99999); c->is_hexdumping = 1; - } else if (mg_match(hm->uri, mg_str("/test/"), NULL)) { + } else if (mg_match(hm->uri, mg_str("/dirtest/"), NULL)) { struct mg_http_serve_opts sopts; memset(&sopts, 0, sizeof(sopts)); sopts.root_dir = "."; - sopts.extra_headers = "A: B\r\nC: D\r\n"; + sopts.extra_headers = "A: B\r\nE: F\r\n"; mg_http_serve_dir(c, hm, &sopts); } else if (mg_match(hm->uri, mg_str("/servefile"), NULL)) { struct mg_http_serve_opts sopts; memset(&sopts, 0, sizeof(sopts)); sopts.mime_types = "foo=a/b,txt=c/d"; - mg_http_serve_file(c, hm, "test/data/a.txt", &sopts); + mg_http_serve_file(c, hm, "data/a.txt", &sopts); } else { struct mg_http_serve_opts sopts; memset(&sopts, 0, sizeof(sopts)); - sopts.root_dir = "./test/data"; + sopts.root_dir = "./data"; sopts.ssi_pattern = "#.shtml"; sopts.extra_headers = "C: D\r\n"; mg_http_serve_dir(c, hm, &sopts); @@ -713,10 +713,10 @@ static int fetch(struct mg_mgr *mgr, char *buf, const char *url, struct mg_tls_opts opts; memset(&opts, 0, sizeof(opts)); // read CA from packed_fs opts.name = mg_url_host(url); - opts.ca = mg_unpacked("/test/data/ca.pem"); + opts.ca = mg_unpacked("/data/ca.pem"); if (strstr(url, "localhost") != NULL) { // Local connection, use self-signed certificates - opts.ca = mg_unpacked("/test/certs/ca.crt"); + opts.ca = mg_unpacked("/certs/ca.crt"); // opts.cert = mg_str(s_tls_cert); // opts.key = mg_str(s_tls_key); } @@ -843,6 +843,7 @@ static void test_http_server(void) { ASSERT(fetch(&mgr, buf, url, "GET /a.txt HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "hello\n") == 0); + ASSERT(cmpheader(buf, "C", "D")); // Invalid header: failure ASSERT(fetch(&mgr, buf, url, "GET /a.txt HTTP/1.0\nA B\n\n") == 0); @@ -914,7 +915,7 @@ static void test_http_server(void) { char etag[100]; size_t size = 0; time_t mtime = 0; - ASSERT(mg_fs_posix.st("./test/data/a.txt", &size, &mtime) != 0); + ASSERT(mg_fs_posix.st("./data/a.txt", &size, &mtime) != 0); ASSERT(mg_http_etag(etag, sizeof(etag), size, mtime) == etag); ASSERT(fetch(&mgr, buf, url, "GET /a.txt HTTP/1.0\nIf-None-Match: %s\n\n", etag) == 304); @@ -968,7 +969,7 @@ static void test_http_server(void) { // ASSERT(cmpbody(buf, "Invalid web root [/BAAADDD!]\n") == 0); { - struct mg_str data = mg_file_read(&mg_fs_posix, "./test/data/ca.pem"); + struct mg_str data = mg_file_read(&mg_fs_posix, "./data/ca.pem"); ASSERT(fetch(&mgr, buf, url, "GET /ca.pem HTTP/1.0\r\n\n") == 200); ASSERT(cmpbody(buf, data.buf) == 0); free((void *) data.buf); @@ -995,10 +996,13 @@ static void test_http_server(void) { } // Directory listing - fetch(&mgr, buf, url, "GET /test/ HTTP/1.0\n\n"); - ASSERT(fetch(&mgr, buf, url, "GET /test/ HTTP/1.0\n\n") == 200); - ASSERT(mg_strstr(mg_str(buf), mg_str(">Index of /test/<")) != NULL); + fetch(&mgr, buf, url, "GET /dirtest/ HTTP/1.0\n\n"); + ASSERT(fetch(&mgr, buf, url, "GET /dirtest/ HTTP/1.0\n\n") == 200); + ASSERT(mg_strstr(mg_str(buf), mg_str(">Index of /dirtest/<")) != NULL); ASSERT(mg_strstr(mg_str(buf), mg_str(">fuzz.c<")) != NULL); + ASSERT(cmpheader(buf, "A", "B")); + ASSERT(!cmpheader(buf, "C", "D")); + ASSERT(cmpheader(buf, "E", "F")); { // Credentials @@ -1119,19 +1123,19 @@ static void h4(struct mg_connection *c, int ev, void *ev_data) { if (mg_match(hm->uri, mg_str("/a/#"), NULL)) { struct mg_http_serve_opts opts; memset(&opts, 0, sizeof(opts)); - opts.root_dir = "/a=./test/data"; - opts.page404 = "./test/data/404.html"; // existing 404 page + opts.root_dir = "/a=./data"; + opts.page404 = "./data/404.html"; // existing 404 page mg_http_serve_dir(c, hm, &opts); } else if (mg_match(hm->uri, mg_str("/b/#"), NULL)) { struct mg_http_serve_opts opts; memset(&opts, 0, sizeof(opts)); - opts.root_dir = "/b=./test/data"; - opts.page404 = "./test/data/nooooo.html"; // non-existing 404 page + opts.root_dir = "/b=./data"; + opts.page404 = "./data/nooooo.html"; // non-existing 404 page mg_http_serve_dir(c, hm, &opts); } else { // null 404 page struct mg_http_serve_opts opts; memset(&opts, 0, sizeof(opts)); - opts.root_dir = "./test/data"; + opts.root_dir = "./data"; mg_http_serve_dir(c, hm, &opts); } } @@ -1183,8 +1187,8 @@ static void test_tls(void) { struct mg_str data = mg_unpacked("/Makefile"); memset(&opts, 0, sizeof(opts)); // opts.ca = mg_str(s_tls_ca); - opts.cert = mg_unpacked("/test/certs/server.crt"); - opts.key = mg_unpacked("/test/certs/server.key"); + opts.cert = mg_unpacked("/certs/server.crt"); + opts.key = mg_unpacked("/certs/server.key"); mg_mgr_init(&mgr); c = mg_http_listen(&mgr, url, eh1, &opts); ASSERT(c != NULL); @@ -1231,7 +1235,7 @@ static void test_http_client(void) { int i, ok = 0; struct mg_tls_opts opts; memset(&opts, 0, sizeof(opts)); - opts.ca = mg_unpacked("/test/data/ca.pem"); + opts.ca = mg_unpacked("/data/ca.pem"); opts.name = mg_url_host(url); ASSERT(opts.ca.len > 0); ASSERT(opts.name.len > 0); @@ -1303,7 +1307,7 @@ static void test_host_validation(void) { ok = 0; c = mg_http_connect(&mgr, url, f3, &ok); ASSERT(c != NULL); - opts.ca = mg_unpacked("/test/data/ca.pem"); + opts.ca = mg_unpacked("/data/ca.pem"); opts.name = mg_url_host(url); mg_tls_init(c, &opts); for (i = 0; i < 1500 && ok <= 0; i++) mg_mgr_poll(&mgr, 10); @@ -1617,7 +1621,7 @@ static void ehr(struct mg_connection *c, int ev, void *ev_data) { struct mg_http_message *hm = (struct mg_http_message *) ev_data; struct mg_http_serve_opts opts; memset(&opts, 0, sizeof(opts)); - opts.root_dir = "./test/data"; + opts.root_dir = "./data"; mg_http_serve_dir(c, hm, &opts); } } @@ -2635,8 +2639,8 @@ static void test_packed(void) { free((void *) data.buf); // Load file deeper in the FS tree directly - data = mg_file_read(&mg_fs_posix, "src/ssi.h"); - ASSERT(fetch(&mgr, buf, url, "GET /src/ssi.h HTTP/1.0\n\n") == 200); + data = mg_file_read(&mg_fs_posix, "data/ssi.h"); + ASSERT(fetch(&mgr, buf, url, "GET /data/ssi.h HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, data.buf) == 0); free((void *) data.buf); @@ -2645,8 +2649,8 @@ static void test_packed(void) { // printf("--------\n%s\n", buf); // List nested dir - ASSERT(fetch(&mgr, buf, url, "GET /test HTTP/1.0\n\n") == 301); - ASSERT(fetch(&mgr, buf, url, "GET /test/ HTTP/1.0\n\n") == 200); + ASSERT(fetch(&mgr, buf, url, "GET /data HTTP/1.0\n\n") == 301); + ASSERT(fetch(&mgr, buf, url, "GET /data/ HTTP/1.0\n\n") == 200); // printf("--------\n%s\n", buf); mg_mgr_free(&mgr); @@ -2782,7 +2786,7 @@ static void h7(struct mg_connection *c, int ev, void *ev_data) { struct mg_http_message *hm = (struct mg_http_message *) ev_data; struct mg_http_serve_opts opts; memset(&opts, 0, sizeof(opts)); - opts.root_dir = "./test/data,/foo=./src"; + opts.root_dir = "./data,/foo=./dirtest"; mg_http_serve_dir(c, hm, &opts); } }