aws-crt 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/aws-crt-ffi/CMakeLists.txt +49 -41
- data/aws-crt-ffi/crt/aws-c-auth/CMakeLists.txt +0 -10
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/credentials.h +3 -2
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/private/credentials_utils.h +4 -4
- data/aws-crt-ffi/crt/aws-c-auth/source/auth.c +1 -14
- data/aws-crt-ffi/crt/aws-c-auth/source/aws_imds_client.c +206 -68
- data/aws-crt-ffi/crt/aws-c-auth/source/aws_signing.c +5 -0
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_cached.c +6 -6
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_default_chain.c +16 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_ecs.c +0 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_process.c +0 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_sts_web_identity.c +0 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_x509.c +10 -7
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_utils.c +35 -26
- data/aws-crt-ffi/crt/aws-c-auth/source/signable_chunk.c +3 -2
- data/aws-crt-ffi/crt/aws-c-auth/tests/CMakeLists.txt +3 -2
- data/aws-crt-ffi/crt/aws-c-auth/tests/aws_imds_client_test.c +1 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_ecs_tests.c +3 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_process_tests.c +65 -16
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_tests.c +125 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/sigv4_signing_tests.c +68 -46
- data/aws-crt-ffi/crt/aws-c-cal/CMakeLists.txt +8 -3
- data/aws-crt-ffi/crt/aws-c-cal/bin/run_x_platform_fuzz_corpus/main.c +9 -0
- data/aws-crt-ffi/crt/aws-c-cal/builder.json +11 -3
- data/aws-crt-ffi/crt/aws-c-cal/cmake/aws-c-cal-config.cmake +14 -5
- data/aws-crt-ffi/crt/aws-c-cal/source/darwin/securityframework_ecc.c +6 -6
- data/aws-crt-ffi/crt/aws-c-cal/source/windows/bcrypt_ecc.c +12 -12
- data/aws-crt-ffi/crt/aws-c-cal/tests/test_case_helper.h +14 -14
- data/aws-crt-ffi/crt/aws-c-common/CMakeLists.txt +21 -1
- data/aws-crt-ffi/crt/aws-c-common/README.md +8 -0
- data/aws-crt-ffi/crt/aws-c-common/cmake/AwsCFlags.cmake +20 -5
- data/aws-crt-ffi/crt/aws-c-common/cmake/AwsFeatureTests.cmake +7 -1
- data/aws-crt-ffi/crt/aws-c-common/format-check.sh +1 -1
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_buf.h +14 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/config.h.in +1 -0
- data/aws-crt-ffi/crt/{aws-c-auth/include/aws/auth → aws-c-common/include/aws/common}/external/cJSON.h +82 -74
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/json.h +335 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/logging.h +1 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/math.inl +2 -2
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/private/json_impl.h +22 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/testing/aws_test_harness.h +2 -0
- data/aws-crt-ffi/crt/aws-c-common/source/byte_buf.c +36 -0
- data/aws-crt-ffi/crt/aws-c-common/source/common.c +5 -2
- data/aws-crt-ffi/crt/aws-c-common/source/external/cJSON.c +3113 -0
- data/aws-crt-ffi/crt/aws-c-common/source/file.c +9 -0
- data/aws-crt-ffi/crt/aws-c-common/source/json.c +348 -0
- data/aws-crt-ffi/crt/aws-c-common/source/logging.c +7 -2
- data/aws-crt-ffi/crt/aws-c-common/source/posix/system_info.c +8 -0
- data/aws-crt-ffi/crt/aws-c-common/source/ref_count.c +3 -1
- data/aws-crt-ffi/crt/aws-c-common/source/windows/file.c +47 -0
- data/aws-crt-ffi/crt/aws-c-common/source/windows/system_info.c +2 -1
- data/aws-crt-ffi/crt/aws-c-common/tests/CMakeLists.txt +5 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/byte_buf_test.c +69 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/json_test.c +134 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/memtrace_test.c +6 -2
- data/aws-crt-ffi/crt/aws-c-event-stream/README.md +18 -35
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream.h +21 -2
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_client.h +14 -2
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_server.h +13 -0
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/private/event_stream_rpc_priv.h +7 -7
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream.c +257 -141
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_channel_handler.c +1 -1
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_client.c +31 -8
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_server.c +63 -10
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/CMakeLists.txt +2 -0
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_client_connection_test.c +157 -106
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_server_connection_test.c +168 -1
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/message_deserializer_test.c +4 -2
- data/aws-crt-ffi/crt/aws-c-http/CMakeLists.txt +1 -0
- data/aws-crt-ffi/crt/aws-c-http/README.md +8 -0
- data/aws-crt-ffi/crt/aws-c-http/bin/elasticurl/main.c +1 -1
- data/aws-crt-ffi/crt/aws-c-http/builder.json +4 -3
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection.h +8 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection_manager.h +45 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/http2_stream_manager.h +63 -12
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/connection_impl.h +2 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_connection.h +20 -2
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_frames.h +1 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_stream.h +42 -13
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http2_stream_manager_impl.h +17 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http_impl.h +3 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/random_access_set.h +10 -3
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/request_response_impl.h +3 -17
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/request_response.h +108 -4
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/statistics.h +22 -0
- data/aws-crt-ffi/crt/aws-c-http/source/connection.c +8 -3
- data/aws-crt-ffi/crt/aws-c-http/source/connection_manager.c +22 -3
- data/aws-crt-ffi/crt/aws-c-http/source/connection_monitor.c +32 -14
- data/aws-crt-ffi/crt/aws-c-http/source/h1_connection.c +14 -0
- data/aws-crt-ffi/crt/aws-c-http/source/h1_encoder.c +7 -4
- data/aws-crt-ffi/crt/aws-c-http/source/h2_connection.c +161 -45
- data/aws-crt-ffi/crt/aws-c-http/source/h2_decoder.c +37 -8
- data/aws-crt-ffi/crt/aws-c-http/source/h2_frames.c +13 -1
- data/aws-crt-ffi/crt/aws-c-http/source/h2_stream.c +345 -87
- data/aws-crt-ffi/crt/aws-c-http/source/hpack.c +3 -0
- data/aws-crt-ffi/crt/aws-c-http/source/http.c +3 -0
- data/aws-crt-ffi/crt/aws-c-http/source/http2_stream_manager.c +266 -39
- data/aws-crt-ffi/crt/aws-c-http/source/random_access_set.c +9 -3
- data/aws-crt-ffi/crt/aws-c-http/source/request_response.c +80 -20
- data/aws-crt-ffi/crt/aws-c-http/source/statistics.c +11 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/CMakeLists.txt +28 -1
- data/aws-crt-ffi/crt/aws-c-http/tests/fuzz/fuzz_h2_decoder_correct.c +5 -3
- data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.c +133 -29
- data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.h +6 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/README.md +40 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/non_tls_server.py +56 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/server.py +329 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_manager.c +1 -1
- data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_monitor.c +2 -2
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_client.c +47 -34
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_encoder.c +4 -4
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_server.c +15 -12
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_client.c +582 -25
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_encoder.c +3 -3
- data/aws-crt-ffi/crt/aws-c-http/tests/test_localhost_integ.c +530 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/test_stream_manager.c +459 -67
- data/aws-crt-ffi/crt/aws-c-io/CMakeLists.txt +4 -0
- data/aws-crt-ffi/crt/aws-c-io/builder.json +3 -2
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/channel.h +21 -0
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/io.h +3 -0
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/socket.h +6 -0
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/stream.h +35 -5
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/tls_channel_handler.h +211 -15
- data/aws-crt-ffi/crt/aws-c-io/source/channel.c +56 -30
- data/aws-crt-ffi/crt/aws-c-io/source/darwin/secure_transport_tls_channel_handler.c +0 -24
- data/aws-crt-ffi/crt/aws-c-io/source/io.c +9 -0
- data/aws-crt-ffi/crt/aws-c-io/source/{pkcs11.c → pkcs11_lib.c} +162 -22
- data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_private.h +18 -20
- data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_tls_op_handler.c +221 -0
- data/aws-crt-ffi/crt/aws-c-io/source/posix/socket.c +135 -81
- data/aws-crt-ffi/crt/aws-c-io/source/retry_strategy.c +12 -8
- data/aws-crt-ffi/crt/aws-c-io/source/s2n/s2n_tls_channel_handler.c +252 -215
- data/aws-crt-ffi/crt/aws-c-io/source/stream.c +65 -82
- data/aws-crt-ffi/crt/aws-c-io/source/tls_channel_handler.c +188 -57
- data/aws-crt-ffi/crt/aws-c-io/source/windows/iocp/socket.c +271 -256
- data/aws-crt-ffi/crt/aws-c-io/tests/CMakeLists.txt +21 -12
- data/aws-crt-ffi/crt/aws-c-io/tests/channel_test.c +32 -4
- data/aws-crt-ffi/crt/aws-c-io/tests/io_lib_test.c +37 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/pkcs11_test.c +412 -93
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.crt +15 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.key +5 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p12 +0 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p8 +5 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/generateCerts.sh +24 -15
- data/aws-crt-ffi/crt/aws-c-io/tests/socket_test.c +72 -1
- data/aws-crt-ffi/crt/s2n/CMakeLists.txt +6 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/Cargo.toml +1 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/generate/src/main.rs +105 -82
- data/aws-crt-ffi/crt/s2n/bindings/rust/generate.sh +1 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/Cargo.toml +2 -2
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/src/raw/config.rs +1 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/Cargo.toml +1 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/build.rs +84 -30
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/src/lib.rs +4 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/Cargo.toml +21 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/cert.pem +14 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/key.pem +8 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/client.rs +45 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/server.rs +60 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/src/lib.rs +150 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/tests/handshake.rs +51 -0
- data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.c +98 -77
- data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.h +10 -7
- data/aws-crt-ffi/crt/s2n/crypto/s2n_openssl.h +2 -0
- data/aws-crt-ffi/crt/s2n/error/s2n_errno.c +1 -1
- data/aws-crt-ffi/crt/s2n/error/s2n_errno.h +1 -0
- data/aws-crt-ffi/crt/s2n/s2n.mk +7 -0
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/repository.py +233 -0
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup-proof.py +8 -7
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup.py +17 -18
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/util.py +41 -23
- data/aws-crt-ffi/crt/s2n/tests/fuzz/LD_PRELOAD/global_overrides.c +3 -3
- data/aws-crt-ffi/crt/s2n/tests/integration/s2n_client_endpoint_handshake_test.py +2 -2
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/Makefile +13 -42
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/README.md +6 -1
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/common.py +118 -53
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/configuration.py +108 -88
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/conftest.py +6 -3
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/constants.py +6 -4
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/fixtures.py +21 -12
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/global_flags.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/processes.py +62 -19
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/providers.py +304 -48
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_client_authentication.py +20 -11
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_cross_compatibility.py +41 -17
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_dynamic_record_sizes.py +6 -3
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_early_data.py +105 -48
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_external_psk.py +160 -76
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_fragmentation.py +59 -26
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_happy_path.py +42 -28
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_hello_retry_requests.py +33 -13
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_key_update.py +29 -11
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_ocsp.py +138 -0
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_pq_handshake.py +103 -36
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_session_resumption.py +52 -25
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_signature_algorithms.py +47 -21
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sni_match.py +13 -9
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sslyze.py +88 -17
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_version_negotiation.py +71 -22
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_well_known_endpoints.py +4 -3
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/tox.ini +1 -0
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/utils.py +50 -15
- data/aws-crt-ffi/crt/s2n/tests/litani/CHANGELOG +131 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/CONTRIBUTING.md +16 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/README.md +36 -14
- data/aws-crt-ffi/crt/s2n/tests/litani/THIRD-PARTY +205 -41
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/bin/build-html-doc +7 -7
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/configure +27 -23
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-add-job.scdoc +7 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-dump-run.scdoc +7 -5
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-transform-jobs.scdoc +248 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani.scdoc +2 -2
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/templates/index.jinja.html +4 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/README +12 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/original-run.sh +52 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/run-all.py +71 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/README +13 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-1.sh +34 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-2.sh +35 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-3.sh +34 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-all.py +60 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/README.md +10 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/assumptions.html +42 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/file.dat +7 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/histogram.dat +7 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-1.sh +41 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-2.sh +47 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-3.sh +41 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-all.py +34 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib-table.py +40 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.plt +5 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.py +32 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin-output.py +40 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.plt +5 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.py +30 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/fib-table.jinja.html +45 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/sin-output.jinja.html +30 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/add_job.py +55 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/graph.py +2 -2
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani.py +6 -1
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani_report.py +18 -21
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/ninja.py +2 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/run_printer.py +26 -7
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/transform_jobs.py +84 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/litani +28 -33
- data/aws-crt-ffi/crt/s2n/tests/litani/script/release +220 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/templates/dashboard.jinja.html +78 -15
- data/aws-crt-ffi/crt/s2n/tests/litani/templates/pipeline.jinja.html +21 -5
- data/aws-crt-ffi/crt/s2n/tests/litani/test/README +15 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/run +56 -33
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/custom_stages.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/cwd.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/dump_run.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/graph_line_break.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/html_node.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/job_id_env.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/multiproc_dump_run.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize_graph.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ignored.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ok.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pipeline_order.py +53 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize_graph.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/single_pool.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_multi_shell.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_shell.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ignored.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ok.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_delete_job.py +54 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_modify_job.py +46 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_no_change_job.py +44 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/zero_pool.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/run +82 -12
- data/aws-crt-ffi/crt/s2n/tests/s2n_test.h +58 -33
- data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_key_schedule_testlib.c +18 -6
- data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_pq_kat_test_utils.c +4 -4
- data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_testlib.h +2 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_hello_retry_test.c +66 -2
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_connection_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_drbg_test.c +34 -14
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_fork_generation_number_test.c +28 -5
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_mem_usage_test.c +6 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_override_openssl_random_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_random_test.c +60 -41
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_self_talk_broken_pipe_test.c +2 -2
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_handshake_early_data_test.c +3 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_hybrid_shared_secret_test.c +9 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_rfc8448_test.c +31 -130
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_test.c +2 -4
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_pq_handshake_test.c +11 -6
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_rfc8448_test.c +19 -21
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_test.c +109 -60
- data/aws-crt-ffi/crt/s2n/tls/s2n_config.c +1 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_config.h +1 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_connection.c +29 -24
- data/aws-crt-ffi/crt/s2n/tls/s2n_connection.h +5 -5
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_hashes.h +1 -7
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_io.c +2 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_transcript.c +0 -44
- data/aws-crt-ffi/crt/s2n/tls/s2n_internal.h +0 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_quic_support.h +1 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_key_schedule.c +1 -2
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.c +84 -44
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.h +3 -9
- data/aws-crt-ffi/crt/s2n/utils/s2n_blob.h +15 -8
- data/aws-crt-ffi/crt/s2n/utils/s2n_fork_detection.c +2 -6
- data/aws-crt-ffi/crt/s2n/utils/s2n_random.c +9 -9
- data/aws-crt-ffi/src/input_stream.c +32 -15
- data/ext/compile.rb +13 -5
- data/lib/aws-crt/platforms.rb +14 -5
- data/lib/aws-crt/string_blob.rb +3 -3
- metadata +61 -7
- data/aws-crt-ffi/crt/aws-c-auth/source/external/cJSON.c +0 -2987
- data/aws-crt-ffi/crt/aws-c-auth/tests/external/cJSON.c +0 -2986
- data/aws-crt-ffi/crt/aws-c-io/tests/error_test.c +0 -20
@@ -552,7 +552,7 @@ struct aws_http_message *aws_http_message_release(struct aws_http_message *messa
|
|
552
552
|
}
|
553
553
|
|
554
554
|
aws_http_headers_release(message->headers);
|
555
|
-
|
555
|
+
aws_input_stream_release(message->body_stream);
|
556
556
|
aws_mem_release(message->allocator, message);
|
557
557
|
} else {
|
558
558
|
AWS_ASSERT(prev_refcount != 0);
|
@@ -727,7 +727,13 @@ int aws_http_message_set_response_status(struct aws_http_message *response_messa
|
|
727
727
|
|
728
728
|
void aws_http_message_set_body_stream(struct aws_http_message *message, struct aws_input_stream *body_stream) {
|
729
729
|
AWS_PRECONDITION(message);
|
730
|
+
/* release previous stream, if any */
|
731
|
+
aws_input_stream_release(message->body_stream);
|
732
|
+
|
730
733
|
message->body_stream = body_stream;
|
734
|
+
if (message->body_stream) {
|
735
|
+
aws_input_stream_acquire(message->body_stream);
|
736
|
+
}
|
731
737
|
}
|
732
738
|
|
733
739
|
int aws_http1_stream_write_chunk(struct aws_http_stream *http1_stream, const struct aws_http1_chunk_options *options) {
|
@@ -745,6 +751,17 @@ int aws_http1_stream_write_chunk(struct aws_http_stream *http1_stream, const str
|
|
745
751
|
return http1_stream->vtable->http1_write_chunk(http1_stream, options);
|
746
752
|
}
|
747
753
|
|
754
|
+
int aws_http2_stream_write_data(
|
755
|
+
struct aws_http_stream *http2_stream,
|
756
|
+
const struct aws_http2_stream_write_data_options *options) {
|
757
|
+
AWS_PRECONDITION(http2_stream);
|
758
|
+
AWS_PRECONDITION(http2_stream->vtable);
|
759
|
+
AWS_PRECONDITION(http2_stream->vtable->http2_write_data);
|
760
|
+
AWS_PRECONDITION(options);
|
761
|
+
|
762
|
+
return http2_stream->vtable->http2_write_data(http2_stream, options);
|
763
|
+
}
|
764
|
+
|
748
765
|
int aws_http1_stream_add_chunked_trailer(
|
749
766
|
struct aws_http_stream *http1_stream,
|
750
767
|
const struct aws_http_headers *trailing_headers) {
|
@@ -767,7 +784,7 @@ struct aws_input_stream *aws_http_message_get_body_stream(const struct aws_http_
|
|
767
784
|
return message->body_stream;
|
768
785
|
}
|
769
786
|
|
770
|
-
struct aws_http_headers *aws_http_message_get_headers(struct aws_http_message *message) {
|
787
|
+
struct aws_http_headers *aws_http_message_get_headers(const struct aws_http_message *message) {
|
771
788
|
AWS_PRECONDITION(message);
|
772
789
|
return message->headers;
|
773
790
|
}
|
@@ -835,8 +852,8 @@ struct aws_http_stream *aws_http_connection_make_request(
|
|
835
852
|
}
|
836
853
|
|
837
854
|
struct aws_http_message *aws_http2_message_new_from_http1(
|
838
|
-
struct
|
839
|
-
struct
|
855
|
+
struct aws_allocator *alloc,
|
856
|
+
const struct aws_http_message *http1_msg) {
|
840
857
|
|
841
858
|
struct aws_http_headers *old_headers = aws_http_message_get_headers(http1_msg);
|
842
859
|
struct aws_http_header header_iter;
|
@@ -844,11 +861,12 @@ struct aws_http_message *aws_http2_message_new_from_http1(
|
|
844
861
|
AWS_ZERO_STRUCT(lower_name_buf);
|
845
862
|
struct aws_http_message *message = aws_http_message_is_request(http1_msg) ? aws_http2_message_new_request(alloc)
|
846
863
|
: aws_http2_message_new_response(alloc);
|
847
|
-
struct aws_http_headers *copied_headers = message->headers;
|
848
864
|
if (!message) {
|
849
865
|
return NULL;
|
850
866
|
}
|
851
|
-
|
867
|
+
struct aws_http_headers *copied_headers = message->headers;
|
868
|
+
AWS_LOGF_TRACE(AWS_LS_HTTP_GENERAL, "Creating HTTP/2 message from HTTP/1 message id: %p", (void *)http1_msg);
|
869
|
+
|
852
870
|
/* Set pseudo headers from HTTP/1.1 message */
|
853
871
|
if (aws_http_message_is_request(http1_msg)) {
|
854
872
|
struct aws_byte_cursor method;
|
@@ -861,7 +879,7 @@ struct aws_http_message *aws_http2_message_new_from_http1(
|
|
861
879
|
aws_raise_error(AWS_ERROR_HTTP_INVALID_METHOD);
|
862
880
|
goto error;
|
863
881
|
}
|
864
|
-
/* Use add
|
882
|
+
/* Use add instead of set method to avoid push front to the array list */
|
865
883
|
if (aws_http_headers_add(copied_headers, aws_http_header_method, method)) {
|
866
884
|
goto error;
|
867
885
|
}
|
@@ -887,7 +905,28 @@ struct aws_http_message *aws_http2_message_new_from_http1(
|
|
887
905
|
aws_http_header_scheme.ptr,
|
888
906
|
(int)scheme_cursor.len,
|
889
907
|
scheme_cursor.ptr);
|
890
|
-
|
908
|
+
|
909
|
+
/**
|
910
|
+
* An intermediary that forwards a request over HTTP/2 MUST construct an ":authority" pseudo-header field using
|
911
|
+
* the authority information from the control data of the original request. (RFC=9113 8.3.1)
|
912
|
+
*/
|
913
|
+
struct aws_byte_cursor host_value;
|
914
|
+
AWS_ZERO_STRUCT(host_value);
|
915
|
+
if (aws_http_headers_get(http1_msg->headers, aws_byte_cursor_from_c_str("host"), &host_value) ==
|
916
|
+
AWS_OP_SUCCESS) {
|
917
|
+
if (aws_http_headers_add(copied_headers, aws_http_header_authority, host_value)) {
|
918
|
+
goto error;
|
919
|
+
}
|
920
|
+
AWS_LOGF_TRACE(
|
921
|
+
AWS_LS_HTTP_GENERAL,
|
922
|
+
"Added header to new HTTP/2 header - \"%.*s\": \"%.*s\" ",
|
923
|
+
(int)aws_http_header_authority.len,
|
924
|
+
aws_http_header_authority.ptr,
|
925
|
+
(int)host_value.len,
|
926
|
+
host_value.ptr);
|
927
|
+
}
|
928
|
+
/* TODO: If the host headers is missing, the target URI could be the other source of the authority information
|
929
|
+
*/
|
891
930
|
|
892
931
|
struct aws_byte_cursor path_cursor;
|
893
932
|
if (aws_http_message_get_request_path(http1_msg, &path_cursor)) {
|
@@ -935,6 +974,8 @@ struct aws_http_message *aws_http2_message_new_from_http1(
|
|
935
974
|
goto error;
|
936
975
|
}
|
937
976
|
for (size_t iter = 0; iter < aws_http_headers_count(old_headers); iter++) {
|
977
|
+
aws_byte_buf_reset(&lower_name_buf, false);
|
978
|
+
bool copy_header = true;
|
938
979
|
/* name should be converted to lower case */
|
939
980
|
if (aws_http_headers_get_index(old_headers, iter, &header_iter)) {
|
940
981
|
goto error;
|
@@ -942,23 +983,42 @@ struct aws_http_message *aws_http2_message_new_from_http1(
|
|
942
983
|
/* append lower case name to the buffer */
|
943
984
|
aws_byte_buf_append_with_lookup(&lower_name_buf, &header_iter.name, aws_lookup_table_to_lower_get());
|
944
985
|
struct aws_byte_cursor lower_name_cursor = aws_byte_cursor_from_buf(&lower_name_buf);
|
986
|
+
enum aws_http_header_name name_enum = aws_http_lowercase_str_to_header_name(lower_name_cursor);
|
987
|
+
switch (name_enum) {
|
988
|
+
case AWS_HTTP_HEADER_TRANSFER_ENCODING:
|
989
|
+
case AWS_HTTP_HEADER_UPGRADE:
|
990
|
+
case AWS_HTTP_HEADER_KEEP_ALIVE:
|
991
|
+
case AWS_HTTP_HEADER_PROXY_CONNECTION:
|
992
|
+
/**
|
993
|
+
* An intermediary transforming an HTTP/1.x message to HTTP/2 MUST remove connection-specific header
|
994
|
+
* fields as discussed in Section 7.6.1 of [HTTP]. (RFC=9113 8.2.2)
|
995
|
+
*/
|
996
|
+
AWS_LOGF_TRACE(
|
997
|
+
AWS_LS_HTTP_GENERAL,
|
998
|
+
"Skip connection-specific headers - \"%.*s\" ",
|
999
|
+
(int)lower_name_cursor.len,
|
1000
|
+
lower_name_cursor.ptr);
|
1001
|
+
copy_header = false;
|
1002
|
+
break;
|
945
1003
|
|
946
|
-
|
947
|
-
|
948
|
-
|
1004
|
+
default:
|
1005
|
+
break;
|
1006
|
+
}
|
1007
|
+
if (copy_header) {
|
1008
|
+
if (aws_http_headers_add(copied_headers, lower_name_cursor, header_iter.value)) {
|
1009
|
+
goto error;
|
1010
|
+
}
|
1011
|
+
AWS_LOGF_TRACE(
|
1012
|
+
AWS_LS_HTTP_GENERAL,
|
1013
|
+
"Added header to new HTTP/2 header - \"%.*s\": \"%.*s\" ",
|
1014
|
+
(int)lower_name_cursor.len,
|
1015
|
+
lower_name_cursor.ptr,
|
1016
|
+
(int)header_iter.value.len,
|
1017
|
+
header_iter.value.ptr);
|
949
1018
|
}
|
950
|
-
AWS_LOGF_TRACE(
|
951
|
-
AWS_LS_HTTP_GENERAL,
|
952
|
-
"Added header to new HTTP/2 header - \"%.*s\": \"%.*s\" ",
|
953
|
-
(int)lower_name_cursor.len,
|
954
|
-
lower_name_cursor.ptr,
|
955
|
-
(int)header_iter.value.len,
|
956
|
-
header_iter.value.ptr);
|
957
|
-
aws_byte_buf_reset(&lower_name_buf, false);
|
958
1019
|
}
|
959
1020
|
aws_byte_buf_clean_up(&lower_name_buf);
|
960
1021
|
aws_http_message_set_body_stream(message, aws_http_message_get_body_stream(http1_msg));
|
961
|
-
/* TODO: Refcount the input stream of old message */
|
962
1022
|
|
963
1023
|
return message;
|
964
1024
|
error:
|
@@ -22,3 +22,14 @@ void aws_crt_statistics_http1_channel_reset(struct aws_crt_statistics_http1_chan
|
|
22
22
|
stats->current_outgoing_stream_id = 0;
|
23
23
|
stats->current_incoming_stream_id = 0;
|
24
24
|
}
|
25
|
+
|
26
|
+
void aws_crt_statistics_http2_channel_init(struct aws_crt_statistics_http2_channel *stats) {
|
27
|
+
AWS_ZERO_STRUCT(*stats);
|
28
|
+
stats->category = AWSCRT_STAT_CAT_HTTP2_CHANNEL;
|
29
|
+
}
|
30
|
+
|
31
|
+
void aws_crt_statistics_http2_channel_reset(struct aws_crt_statistics_http2_channel *stats) {
|
32
|
+
stats->pending_outgoing_stream_ms = 0;
|
33
|
+
stats->pending_incoming_stream_ms = 0;
|
34
|
+
stats->was_inactive = false;
|
35
|
+
}
|
@@ -246,6 +246,14 @@ add_test_case(hpack_dynamic_table_empty_value)
|
|
246
246
|
add_test_case(hpack_dynamic_table_with_empty_header)
|
247
247
|
add_test_case(hpack_dynamic_table_size_update_from_setting)
|
248
248
|
|
249
|
+
if (ENABLE_LOCALHOST_INTEGRATION_TESTS)
|
250
|
+
# Tests should be named with localhost_integ_*
|
251
|
+
add_net_test_case(localhost_integ_hpack_stress)
|
252
|
+
add_net_test_case(localhost_integ_hpack_compression_stress)
|
253
|
+
add_net_test_case(localhost_integ_h2_upload_stress)
|
254
|
+
add_net_test_case(localhost_integ_h2_download_stress)
|
255
|
+
endif()
|
256
|
+
|
249
257
|
add_test_case(h2_header_empty_payload)
|
250
258
|
add_one_byte_at_a_time_test_set(h2_header_ex_2_1)
|
251
259
|
add_one_byte_at_a_time_test_set(h2_header_ex_2_2)
|
@@ -390,6 +398,7 @@ add_test_case(h2_client_stream_receive_trailing_headers)
|
|
390
398
|
add_test_case(h2_client_stream_err_receive_trailing_before_main)
|
391
399
|
add_test_case(h2_client_stream_receive_data)
|
392
400
|
add_test_case(h2_client_stream_err_receive_data_before_headers)
|
401
|
+
add_test_case(h2_client_stream_err_receive_data_not_match_content_length)
|
393
402
|
add_test_case(h2_client_stream_send_data)
|
394
403
|
add_test_case(h2_client_stream_send_lots_of_data)
|
395
404
|
add_test_case(h2_client_stream_send_stalled_data)
|
@@ -445,6 +454,13 @@ add_test_case(h2_client_get_received_goaway)
|
|
445
454
|
add_test_case(h2_client_request_apis_failed_after_connection_begin_shutdown)
|
446
455
|
add_test_case(h2_client_get_local_settings)
|
447
456
|
add_test_case(h2_client_get_remote_settings)
|
457
|
+
add_test_case(h2_client_error_from_outgoing_body_callback_reset_stream)
|
458
|
+
add_test_case(h2_client_error_from_incoming_headers_callback_reset_stream)
|
459
|
+
add_test_case(h2_client_error_from_incoming_headers_done_callback_reset_stream)
|
460
|
+
add_test_case(h2_client_error_from_incoming_body_callback_reset_stream)
|
461
|
+
add_test_case(h2_client_manual_data_write)
|
462
|
+
add_test_case(h2_client_manual_data_write_no_data)
|
463
|
+
add_test_case(h2_client_manual_data_write_connection_close)
|
448
464
|
|
449
465
|
add_test_case(server_new_destroy)
|
450
466
|
add_test_case(connection_setup_shutdown)
|
@@ -592,15 +608,26 @@ add_net_test_case(h2_sm_mock_multiple_connections)
|
|
592
608
|
add_net_test_case(h2_sm_mock_bad_connection_acquired)
|
593
609
|
add_net_test_case(h2_sm_mock_connections_closed_before_request_made)
|
594
610
|
add_net_test_case(h2_sm_mock_max_concurrent_streams_remote)
|
611
|
+
add_net_test_case(h2_sm_mock_fetch_metric)
|
595
612
|
add_net_test_case(h2_sm_mock_complete_stream)
|
596
613
|
add_net_test_case(h2_sm_mock_ideal_num_streams)
|
597
614
|
add_net_test_case(h2_sm_mock_large_ideal_num_streams)
|
598
615
|
add_net_test_case(h2_sm_mock_goaway)
|
616
|
+
add_net_test_case(h2_sm_connection_ping)
|
599
617
|
|
618
|
+
# Tests against real world server
|
600
619
|
add_net_test_case(h2_sm_acquire_stream)
|
601
620
|
add_net_test_case(h2_sm_acquire_stream_multiple_connections)
|
602
|
-
add_net_test_case(h2_sm_acquire_stream_stress)
|
603
621
|
add_net_test_case(h2_sm_closing_before_connection_acquired)
|
622
|
+
add_net_test_case(h2_sm_close_connection_on_server_error)
|
623
|
+
# Tests against local server
|
624
|
+
if (ENABLE_LOCALHOST_INTEGRATION_TESTS)
|
625
|
+
# Tests should be named with localhost_integ_*
|
626
|
+
add_net_test_case(localhost_integ_h2_sm_prior_knowledge)
|
627
|
+
add_net_test_case(localhost_integ_h2_sm_acquire_stream_stress)
|
628
|
+
add_net_test_case(localhost_integ_h2_sm_acquire_stream_stress_with_body)
|
629
|
+
add_net_test_case(localhost_integ_h2_sm_connection_monitor_kill_slow_connection)
|
630
|
+
endif()
|
604
631
|
|
605
632
|
add_test_case(random_access_set_sanitize_test)
|
606
633
|
add_test_case(random_access_set_insert_test)
|
@@ -42,8 +42,10 @@ static struct aws_http_headers *s_generate_headers(
|
|
42
42
|
struct aws_http_header path = {.name = aws_http_header_path, .value = aws_byte_cursor_from_c_str("/")};
|
43
43
|
aws_http_headers_add_header(headers, &path);
|
44
44
|
|
45
|
-
struct aws_http_header authority = {
|
46
|
-
|
45
|
+
struct aws_http_header authority = {
|
46
|
+
.name = aws_http_header_authority,
|
47
|
+
.value = aws_byte_cursor_from_c_str("example.com"),
|
48
|
+
};
|
47
49
|
aws_http_headers_add_header(headers, &authority);
|
48
50
|
|
49
51
|
} else if (header_style == HEADER_STYLE_RESPONSE) {
|
@@ -252,7 +254,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
252
254
|
struct aws_stream_status body_status;
|
253
255
|
aws_input_stream_get_status(body, &body_status);
|
254
256
|
AWS_FATAL_ASSERT(body_complete == body_status.is_end_of_stream)
|
255
|
-
|
257
|
+
aws_input_stream_release(body);
|
256
258
|
break;
|
257
259
|
}
|
258
260
|
case AWS_H2_FRAME_T_HEADERS: {
|
@@ -261,7 +261,6 @@ static struct aws_h2err s_decoder_on_headers_end(
|
|
261
261
|
bool malformed,
|
262
262
|
enum aws_http_header_block block_type,
|
263
263
|
void *userdata) {
|
264
|
-
|
265
264
|
return s_on_headers_end(false /*is_push_promise*/, stream_id, malformed, block_type, userdata);
|
266
265
|
}
|
267
266
|
|
@@ -611,7 +610,7 @@ int h2_fake_peer_send_data_frame_with_padding_length(
|
|
611
610
|
ASSERT_TRUE(msg->message_data.len != 0);
|
612
611
|
|
613
612
|
ASSERT_SUCCESS(testing_channel_push_read_message(peer->testing_channel, msg));
|
614
|
-
|
613
|
+
aws_input_stream_release(body_stream);
|
615
614
|
return AWS_OP_SUCCESS;
|
616
615
|
}
|
617
616
|
|
@@ -643,6 +642,8 @@ int h2_fake_peer_send_connection_preface_default_settings(struct h2_fake_peer *p
|
|
643
642
|
/******************************************************************************/
|
644
643
|
|
645
644
|
struct aws_input_stream_tester {
|
645
|
+
struct aws_input_stream base;
|
646
|
+
struct aws_allocator *allocator;
|
646
647
|
/* aws_input_stream_byte_cursor provides our actual functionality */
|
647
648
|
struct aws_input_stream *cursor_stream;
|
648
649
|
|
@@ -655,12 +656,12 @@ static int s_aws_input_stream_tester_seek(
|
|
655
656
|
int64_t offset,
|
656
657
|
enum aws_stream_seek_basis basis) {
|
657
658
|
|
658
|
-
struct aws_input_stream_tester *impl = stream
|
659
|
+
struct aws_input_stream_tester *impl = AWS_CONTAINER_OF(stream, struct aws_input_stream_tester, base);
|
659
660
|
return aws_input_stream_seek(impl->cursor_stream, offset, basis);
|
660
661
|
}
|
661
662
|
|
662
663
|
static int s_aws_input_stream_tester_read(struct aws_input_stream *stream, struct aws_byte_buf *dest) {
|
663
|
-
struct aws_input_stream_tester *impl = stream
|
664
|
+
struct aws_input_stream_tester *impl = AWS_CONTAINER_OF(stream, struct aws_input_stream_tester, base);
|
664
665
|
|
665
666
|
if (impl->is_reading_broken) {
|
666
667
|
return aws_raise_error(AWS_IO_STREAM_READ_FAILED);
|
@@ -678,21 +679,18 @@ static int s_aws_input_stream_tester_read(struct aws_input_stream *stream, struc
|
|
678
679
|
}
|
679
680
|
|
680
681
|
static int s_aws_input_stream_tester_get_status(struct aws_input_stream *stream, struct aws_stream_status *status) {
|
681
|
-
struct aws_input_stream_tester *impl = stream
|
682
|
+
struct aws_input_stream_tester *impl = AWS_CONTAINER_OF(stream, struct aws_input_stream_tester, base);
|
682
683
|
return aws_input_stream_get_status(impl->cursor_stream, status);
|
683
684
|
}
|
684
685
|
|
685
686
|
static int s_aws_input_stream_tester_get_length(struct aws_input_stream *stream, int64_t *out_length) {
|
686
|
-
struct aws_input_stream_tester *impl = stream
|
687
|
+
struct aws_input_stream_tester *impl = AWS_CONTAINER_OF(stream, struct aws_input_stream_tester, base);
|
687
688
|
return aws_input_stream_get_length(impl->cursor_stream, out_length);
|
688
689
|
}
|
689
690
|
|
690
|
-
static void s_aws_input_stream_tester_destroy(struct
|
691
|
-
|
692
|
-
|
693
|
-
aws_input_stream_destroy(impl->cursor_stream);
|
694
|
-
aws_mem_release(stream->allocator, stream);
|
695
|
-
}
|
691
|
+
static void s_aws_input_stream_tester_destroy(struct aws_input_stream_tester *impl) {
|
692
|
+
aws_input_stream_release(impl->cursor_stream);
|
693
|
+
aws_mem_release(impl->allocator, impl);
|
696
694
|
}
|
697
695
|
|
698
696
|
static struct aws_input_stream_vtable s_aws_input_stream_tester_vtable = {
|
@@ -700,38 +698,144 @@ static struct aws_input_stream_vtable s_aws_input_stream_tester_vtable = {
|
|
700
698
|
.read = s_aws_input_stream_tester_read,
|
701
699
|
.get_status = s_aws_input_stream_tester_get_status,
|
702
700
|
.get_length = s_aws_input_stream_tester_get_length,
|
703
|
-
.destroy = s_aws_input_stream_tester_destroy,
|
704
701
|
};
|
705
702
|
|
706
703
|
struct aws_input_stream *aws_input_stream_new_tester(struct aws_allocator *alloc, struct aws_byte_cursor cursor) {
|
707
704
|
|
708
|
-
struct
|
709
|
-
|
710
|
-
aws_mem_acquire_many(
|
711
|
-
alloc, 2, &stream, sizeof(struct aws_input_stream), &impl, sizeof(struct aws_input_stream_tester));
|
712
|
-
AWS_FATAL_ASSERT(stream);
|
713
|
-
|
714
|
-
AWS_ZERO_STRUCT(*stream);
|
715
|
-
AWS_ZERO_STRUCT(*impl);
|
716
|
-
|
717
|
-
stream->allocator = alloc;
|
718
|
-
stream->impl = impl;
|
719
|
-
stream->vtable = &s_aws_input_stream_tester_vtable;
|
705
|
+
struct aws_input_stream_tester *impl = aws_mem_calloc(alloc, 1, sizeof(struct aws_input_stream_tester));
|
706
|
+
AWS_FATAL_ASSERT(impl);
|
720
707
|
|
721
708
|
impl->max_bytes_per_read = SIZE_MAX;
|
722
709
|
|
723
710
|
impl->cursor_stream = aws_input_stream_new_from_cursor(alloc, &cursor);
|
724
711
|
AWS_FATAL_ASSERT(impl->cursor_stream);
|
725
|
-
|
726
|
-
|
712
|
+
impl->allocator = alloc;
|
713
|
+
impl->base.vtable = &s_aws_input_stream_tester_vtable;
|
714
|
+
aws_ref_count_init(
|
715
|
+
&impl->base.ref_count, impl, (aws_simple_completion_callback *)s_aws_input_stream_tester_destroy);
|
716
|
+
return &impl->base;
|
727
717
|
}
|
728
718
|
|
729
719
|
void aws_input_stream_tester_set_max_bytes_per_read(struct aws_input_stream *input_stream, size_t max_bytes) {
|
730
|
-
struct aws_input_stream_tester *impl = input_stream
|
720
|
+
struct aws_input_stream_tester *impl = AWS_CONTAINER_OF(input_stream, struct aws_input_stream_tester, base);
|
731
721
|
impl->max_bytes_per_read = max_bytes;
|
732
722
|
}
|
733
723
|
|
734
724
|
void aws_input_stream_tester_set_reading_broken(struct aws_input_stream *input_stream, bool is_broken) {
|
735
|
-
struct aws_input_stream_tester *impl = input_stream
|
725
|
+
struct aws_input_stream_tester *impl = AWS_CONTAINER_OF(input_stream, struct aws_input_stream_tester, base);
|
736
726
|
impl->is_reading_broken = is_broken;
|
737
727
|
}
|
728
|
+
|
729
|
+
struct aws_input_stream_tester_upload_impl {
|
730
|
+
struct aws_input_stream base;
|
731
|
+
size_t position;
|
732
|
+
size_t length;
|
733
|
+
size_t num_sentence_sent;
|
734
|
+
struct aws_allocator *allocator;
|
735
|
+
};
|
736
|
+
|
737
|
+
static int s_aws_input_stream_tester_upload_seek(
|
738
|
+
struct aws_input_stream *stream,
|
739
|
+
int64_t offset,
|
740
|
+
enum aws_stream_seek_basis basis) {
|
741
|
+
(void)stream;
|
742
|
+
(void)offset;
|
743
|
+
(void)basis;
|
744
|
+
|
745
|
+
/* Stream should never be seeked; all reads should be sequential. */
|
746
|
+
aws_raise_error(AWS_ERROR_UNKNOWN);
|
747
|
+
return AWS_OP_ERR;
|
748
|
+
}
|
749
|
+
|
750
|
+
const struct aws_byte_cursor s_test_string = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("This is CRT HTTP test.");
|
751
|
+
|
752
|
+
static int s_aws_input_stream_tester_upload_read(struct aws_input_stream *stream, struct aws_byte_buf *dest) {
|
753
|
+
(void)stream;
|
754
|
+
(void)dest;
|
755
|
+
|
756
|
+
struct aws_input_stream_tester_upload_impl *test_input_stream =
|
757
|
+
AWS_CONTAINER_OF(stream, struct aws_input_stream_tester_upload_impl, base);
|
758
|
+
|
759
|
+
while (dest->len < dest->capacity && test_input_stream->length - test_input_stream->position > 0) {
|
760
|
+
size_t buffer_pos = test_input_stream->position % s_test_string.len;
|
761
|
+
|
762
|
+
struct aws_byte_cursor source_byte_cursor = {
|
763
|
+
.len = s_test_string.len - buffer_pos,
|
764
|
+
.ptr = s_test_string.ptr + buffer_pos,
|
765
|
+
};
|
766
|
+
|
767
|
+
size_t remaining_in_buffer =
|
768
|
+
aws_min_size(dest->capacity - dest->len, test_input_stream->length - test_input_stream->position);
|
769
|
+
|
770
|
+
if (remaining_in_buffer < source_byte_cursor.len) {
|
771
|
+
source_byte_cursor.len = remaining_in_buffer;
|
772
|
+
}
|
773
|
+
|
774
|
+
aws_byte_buf_append(dest, &source_byte_cursor);
|
775
|
+
buffer_pos += source_byte_cursor.len;
|
776
|
+
|
777
|
+
test_input_stream->position += source_byte_cursor.len;
|
778
|
+
}
|
779
|
+
|
780
|
+
return AWS_OP_SUCCESS;
|
781
|
+
}
|
782
|
+
|
783
|
+
static int s_aws_input_stream_tester_upload_get_status(
|
784
|
+
struct aws_input_stream *stream,
|
785
|
+
struct aws_stream_status *status) {
|
786
|
+
(void)stream;
|
787
|
+
(void)status;
|
788
|
+
|
789
|
+
struct aws_input_stream_tester_upload_impl *test_input_stream =
|
790
|
+
AWS_CONTAINER_OF(stream, struct aws_input_stream_tester_upload_impl, base);
|
791
|
+
|
792
|
+
status->is_end_of_stream = test_input_stream->position == test_input_stream->length;
|
793
|
+
status->is_valid = true;
|
794
|
+
|
795
|
+
return AWS_OP_SUCCESS;
|
796
|
+
}
|
797
|
+
|
798
|
+
static int s_aws_input_stream_tester_upload_get_length(struct aws_input_stream *stream, int64_t *out_length) {
|
799
|
+
AWS_ASSERT(stream != NULL);
|
800
|
+
struct aws_input_stream_tester_upload_impl *test_input_stream =
|
801
|
+
AWS_CONTAINER_OF(stream, struct aws_input_stream_tester_upload_impl, base);
|
802
|
+
*out_length = (int64_t)test_input_stream->length;
|
803
|
+
return AWS_OP_SUCCESS;
|
804
|
+
}
|
805
|
+
|
806
|
+
static void s_aws_input_stream_tester_upload_destroy(struct aws_input_stream_tester_upload_impl *test_input_stream) {
|
807
|
+
aws_mem_release(test_input_stream->allocator, test_input_stream);
|
808
|
+
}
|
809
|
+
|
810
|
+
static struct aws_input_stream_vtable s_aws_input_stream_tester_upload_vtable = {
|
811
|
+
.seek = s_aws_input_stream_tester_upload_seek,
|
812
|
+
.read = s_aws_input_stream_tester_upload_read,
|
813
|
+
.get_status = s_aws_input_stream_tester_upload_get_status,
|
814
|
+
.get_length = s_aws_input_stream_tester_upload_get_length,
|
815
|
+
};
|
816
|
+
|
817
|
+
struct aws_input_stream *aws_input_stream_tester_upload_new(struct aws_allocator *alloc, size_t length) {
|
818
|
+
|
819
|
+
struct aws_input_stream_tester_upload_impl *test_input_stream =
|
820
|
+
aws_mem_calloc(alloc, 1, sizeof(struct aws_input_stream_tester_upload_impl));
|
821
|
+
test_input_stream->base.vtable = &s_aws_input_stream_tester_upload_vtable;
|
822
|
+
aws_ref_count_init(
|
823
|
+
&test_input_stream->base.ref_count,
|
824
|
+
test_input_stream,
|
825
|
+
(aws_simple_completion_callback *)s_aws_input_stream_tester_upload_destroy);
|
826
|
+
|
827
|
+
struct aws_input_stream *input_stream = &test_input_stream->base;
|
828
|
+
|
829
|
+
test_input_stream->position = 0;
|
830
|
+
test_input_stream->length = length;
|
831
|
+
test_input_stream->allocator = alloc;
|
832
|
+
test_input_stream->num_sentence_sent = length / s_test_string.len;
|
833
|
+
|
834
|
+
return input_stream;
|
835
|
+
}
|
836
|
+
|
837
|
+
size_t aws_input_stream_tester_upload_get_num_sentence_sent(struct aws_input_stream *stream) {
|
838
|
+
struct aws_input_stream_tester_upload_impl *test_input_stream =
|
839
|
+
AWS_CONTAINER_OF(stream, struct aws_input_stream_tester_upload_impl, base);
|
840
|
+
return test_input_stream->num_sentence_sent;
|
841
|
+
}
|
@@ -268,4 +268,10 @@ void aws_input_stream_tester_set_max_bytes_per_read(struct aws_input_stream *inp
|
|
268
268
|
|
269
269
|
void aws_input_stream_tester_set_reading_broken(struct aws_input_stream *input_stream, bool is_broken);
|
270
270
|
|
271
|
+
/**
|
272
|
+
* Create input stream that can upload a certain length of stuff
|
273
|
+
*/
|
274
|
+
struct aws_input_stream *aws_input_stream_tester_upload_new(struct aws_allocator *alloc, size_t length);
|
275
|
+
size_t aws_input_stream_tester_upload_get_num_sentence_sent(struct aws_input_stream *stream);
|
276
|
+
|
271
277
|
#endif /* AWS_HTTP_H2_TEST_HELPER_H */
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Local server
|
2
|
+
|
3
|
+
Local server based on [python-hyper/h2](https://github.com/python-hyper/h2).
|
4
|
+
|
5
|
+
## How to run the server
|
6
|
+
|
7
|
+
Python 3.5+ required.
|
8
|
+
|
9
|
+
- Install hyper h2 python module. `python3 -m pip install h2`
|
10
|
+
|
11
|
+
### TLS server
|
12
|
+
|
13
|
+
- The code is based the [example](https://github.com/python-hyper/h2/blob/master/examples/asyncio/asyncio-server.py) from hyper h2 server.
|
14
|
+
- Have the cert/key ready. The script now using `../resources/unittests.crt`, you can either just run the script within this directory, which will find the certificates and key from the related path, or you can use your own and change the code coordinately.
|
15
|
+
- Run python. `python3 ./server.py`.
|
16
|
+
|
17
|
+
#### Echo
|
18
|
+
|
19
|
+
- Minor changed based on the example to response the headers of requests back within the headers from `/echo`.
|
20
|
+
- To test the server runs correctly, you can do `curl -k -v -H "foo:bar" https://localhost:8443/echo` and check the result.
|
21
|
+
|
22
|
+
#### Download test
|
23
|
+
|
24
|
+
- To test download, when `:path` is `/downloadTest`, server will response a repeated string with length `self.download_test_length`, which is 2,500,000,000 now. It will be repeats of sting "This is CRT HTTP test."
|
25
|
+
- To test the server runs correctly, you can do `curl -k -v -H "foo:bar" https://localhost:8443/downloadTest` and check the result.
|
26
|
+
|
27
|
+
#### Slow Connection Test
|
28
|
+
|
29
|
+
- Simulate a slow connection when `:path` is `/slowConnTest`. The speed is controlled by `out_bytes_per_second`. Default speed is 900 B/s, which will send 900 bytes of data and wait a sec to send new 900 bytes of data.
|
30
|
+
|
31
|
+
#### Upload test
|
32
|
+
|
33
|
+
- To test upload, when `:method` is `POST` or `PUT`, server will response the length received from response body
|
34
|
+
- To test the server runs correctly, you can do `curl -k -X POST -F'data=@upload_test.txt' https://localhost:8443/upload_test` where `upload_test.txt` is file to upload.
|
35
|
+
|
36
|
+
### Non-TLS server
|
37
|
+
|
38
|
+
- The code is based the non-tls [example](http://python-hyper.org/projects/h2/en/stable/basic-usage.html) from hyper h2 server.
|
39
|
+
- Run python. `python3 ./non_tls_server.py`.
|
40
|
+
- To test the server runs correctly, you can do `curl -v --http2-prior-knowledge http://localhost:8080` and check the result.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# example server from http://python-hyper.org/projects/h2/en/stable/basic-usage.html
|
2
|
+
|
3
|
+
import json
|
4
|
+
import socket
|
5
|
+
|
6
|
+
import h2.connection
|
7
|
+
import h2.events
|
8
|
+
import h2.config
|
9
|
+
|
10
|
+
|
11
|
+
def send_response(conn, event):
|
12
|
+
stream_id = event.stream_id
|
13
|
+
response_data = b"success"
|
14
|
+
|
15
|
+
conn.send_headers(
|
16
|
+
stream_id=stream_id,
|
17
|
+
headers=[
|
18
|
+
(':status', '200'),
|
19
|
+
('content-length', str(len(response_data))),
|
20
|
+
],
|
21
|
+
)
|
22
|
+
conn.send_data(
|
23
|
+
stream_id=stream_id,
|
24
|
+
data=response_data,
|
25
|
+
end_stream=True
|
26
|
+
)
|
27
|
+
|
28
|
+
|
29
|
+
def handle(sock):
|
30
|
+
config = h2.config.H2Configuration(client_side=False)
|
31
|
+
conn = h2.connection.H2Connection(config=config)
|
32
|
+
conn.initiate_connection()
|
33
|
+
sock.sendall(conn.data_to_send())
|
34
|
+
|
35
|
+
while True:
|
36
|
+
data = sock.recv(65535)
|
37
|
+
if not data:
|
38
|
+
break
|
39
|
+
|
40
|
+
events = conn.receive_data(data)
|
41
|
+
for event in events:
|
42
|
+
if isinstance(event, h2.events.RequestReceived):
|
43
|
+
send_response(conn, event)
|
44
|
+
|
45
|
+
data_to_send = conn.data_to_send()
|
46
|
+
if data_to_send:
|
47
|
+
sock.sendall(data_to_send)
|
48
|
+
|
49
|
+
|
50
|
+
sock = socket.socket()
|
51
|
+
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
52
|
+
sock.bind(('0.0.0.0', 8080))
|
53
|
+
sock.listen(5)
|
54
|
+
|
55
|
+
while True:
|
56
|
+
handle(sock.accept()[0])
|