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
@@ -104,7 +104,7 @@ TEST_CASE(h2_encoder_data) {
|
|
104
104
|
ASSERT_FALSE(body_stalled);
|
105
105
|
|
106
106
|
aws_byte_buf_clean_up(&output);
|
107
|
-
|
107
|
+
aws_input_stream_release(body);
|
108
108
|
aws_h2_frame_encoder_clean_up(&encoder);
|
109
109
|
return AWS_OP_SUCCESS;
|
110
110
|
}
|
@@ -158,7 +158,7 @@ TEST_CASE(h2_encoder_data_stalled) {
|
|
158
158
|
ASSERT_TRUE(body_stalled);
|
159
159
|
|
160
160
|
aws_byte_buf_clean_up(&output);
|
161
|
-
|
161
|
+
aws_input_stream_release(body);
|
162
162
|
aws_h2_frame_encoder_clean_up(&encoder);
|
163
163
|
return AWS_OP_SUCCESS;
|
164
164
|
}
|
@@ -201,7 +201,7 @@ TEST_CASE(h2_encoder_data_stalled_completely) {
|
|
201
201
|
|
202
202
|
/* clean up */
|
203
203
|
aws_byte_buf_clean_up(&output);
|
204
|
-
|
204
|
+
aws_input_stream_release(body);
|
205
205
|
aws_h2_frame_encoder_clean_up(&encoder);
|
206
206
|
return AWS_OP_SUCCESS;
|
207
207
|
}
|
@@ -0,0 +1,530 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3
|
+
* SPDX-License-Identifier: Apache-2.0.
|
4
|
+
*/
|
5
|
+
#include <aws/testing/aws_test_harness.h>
|
6
|
+
|
7
|
+
#include <aws/http/private/hpack.h>
|
8
|
+
|
9
|
+
#include <aws/common/clock.h>
|
10
|
+
#include <aws/common/condition_variable.h>
|
11
|
+
#include <aws/common/device_random.h>
|
12
|
+
#include <aws/common/environment.h>
|
13
|
+
#include <aws/common/string.h>
|
14
|
+
#include <aws/http/connection.h>
|
15
|
+
#include <aws/http/request_response.h>
|
16
|
+
#include <aws/io/channel_bootstrap.h>
|
17
|
+
#include <aws/io/event_loop.h>
|
18
|
+
#include <aws/io/logging.h>
|
19
|
+
#include <aws/io/socket.h>
|
20
|
+
#include <aws/io/stream.h>
|
21
|
+
#include <aws/io/tls_channel_handler.h>
|
22
|
+
|
23
|
+
#include "h2_test_helper.h"
|
24
|
+
|
25
|
+
#ifdef _MSC_VER
|
26
|
+
# pragma warning(disable : 4996) /* Disable warnings about sprintf() being insecure */
|
27
|
+
#endif
|
28
|
+
|
29
|
+
static int s_tester_on_headers(
|
30
|
+
struct aws_http_stream *stream,
|
31
|
+
enum aws_http_header_block header_block,
|
32
|
+
const struct aws_http_header *header_array,
|
33
|
+
size_t num_headers,
|
34
|
+
void *user_data) {
|
35
|
+
(void)stream;
|
36
|
+
(void)header_block;
|
37
|
+
struct aws_http_headers *received_headers = (struct aws_http_headers *)user_data;
|
38
|
+
|
39
|
+
for (size_t i = 0; i < num_headers; ++i) {
|
40
|
+
ASSERT_SUCCESS(aws_http_headers_add_header(received_headers, &header_array[i]));
|
41
|
+
}
|
42
|
+
return AWS_OP_SUCCESS;
|
43
|
+
}
|
44
|
+
|
45
|
+
static bool s_check_headers_received(
|
46
|
+
const struct aws_http_headers *received_headers,
|
47
|
+
const struct aws_http_headers *headers_to_check) {
|
48
|
+
for (size_t i = 0; i < aws_http_headers_count(headers_to_check); i++) {
|
49
|
+
struct aws_http_header header;
|
50
|
+
if (aws_http_headers_get_index(headers_to_check, i, &header)) {
|
51
|
+
return false;
|
52
|
+
}
|
53
|
+
struct aws_http_header received_header;
|
54
|
+
if (aws_http_headers_get_index(received_headers, i + 1, &received_header)) {
|
55
|
+
/* Not found */
|
56
|
+
return false;
|
57
|
+
}
|
58
|
+
if (!aws_byte_cursor_eq(&received_header.value, &header.value) ||
|
59
|
+
!aws_byte_cursor_eq(&received_header.name, &header.name)) {
|
60
|
+
return false;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
return true;
|
64
|
+
}
|
65
|
+
|
66
|
+
struct tester {
|
67
|
+
struct aws_allocator *alloc;
|
68
|
+
|
69
|
+
struct aws_event_loop_group *event_loop_group;
|
70
|
+
struct aws_host_resolver *host_resolver;
|
71
|
+
struct aws_client_bootstrap *client_bootstrap;
|
72
|
+
struct aws_tls_ctx_options tls_ctx_options;
|
73
|
+
struct aws_tls_ctx *tls_ctx;
|
74
|
+
struct aws_tls_connection_options tls_connection_options;
|
75
|
+
struct aws_http_connection *connection;
|
76
|
+
|
77
|
+
struct aws_mutex wait_lock;
|
78
|
+
struct aws_condition_variable wait_cvar;
|
79
|
+
|
80
|
+
bool shutdown_finished;
|
81
|
+
size_t wait_for_stream_completed_count;
|
82
|
+
size_t stream_completed_count;
|
83
|
+
size_t stream_complete_errors;
|
84
|
+
size_t stream_200_count;
|
85
|
+
size_t stream_4xx_count;
|
86
|
+
size_t stream_status_not_200_count;
|
87
|
+
|
88
|
+
uint64_t num_sen_received;
|
89
|
+
int stream_completed_error_code;
|
90
|
+
bool stream_completed_with_200;
|
91
|
+
|
92
|
+
size_t download_body_len;
|
93
|
+
size_t content_len;
|
94
|
+
|
95
|
+
int wait_result;
|
96
|
+
};
|
97
|
+
|
98
|
+
static struct tester s_tester;
|
99
|
+
|
100
|
+
#define DEFINE_HEADER(NAME, VALUE) \
|
101
|
+
{ .name = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL(NAME), .value = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL(VALUE), }
|
102
|
+
|
103
|
+
enum {
|
104
|
+
TESTER_TIMEOUT_SEC = 60, /* Give enough time for non-sudo users to enter password */
|
105
|
+
};
|
106
|
+
|
107
|
+
static void s_on_connection_setup(struct aws_http_connection *connection, int error_code, void *user_data) {
|
108
|
+
|
109
|
+
struct tester *tester = user_data;
|
110
|
+
AWS_FATAL_ASSERT(aws_mutex_lock(&tester->wait_lock) == AWS_OP_SUCCESS);
|
111
|
+
|
112
|
+
if (error_code) {
|
113
|
+
tester->wait_result = error_code;
|
114
|
+
goto done;
|
115
|
+
}
|
116
|
+
tester->connection = connection;
|
117
|
+
done:
|
118
|
+
AWS_FATAL_ASSERT(aws_mutex_unlock(&tester->wait_lock) == AWS_OP_SUCCESS);
|
119
|
+
aws_condition_variable_notify_one(&tester->wait_cvar);
|
120
|
+
}
|
121
|
+
|
122
|
+
static void s_on_connection_shutdown(struct aws_http_connection *connection, int error_code, void *user_data) {
|
123
|
+
|
124
|
+
(void)connection;
|
125
|
+
(void)error_code;
|
126
|
+
struct tester *tester = user_data;
|
127
|
+
AWS_FATAL_ASSERT(aws_mutex_lock(&tester->wait_lock) == AWS_OP_SUCCESS);
|
128
|
+
|
129
|
+
tester->shutdown_finished = true;
|
130
|
+
|
131
|
+
AWS_FATAL_ASSERT(aws_mutex_unlock(&tester->wait_lock) == AWS_OP_SUCCESS);
|
132
|
+
aws_condition_variable_notify_one(&tester->wait_cvar);
|
133
|
+
}
|
134
|
+
|
135
|
+
static bool s_is_connected(void *context) {
|
136
|
+
struct tester *tester = context;
|
137
|
+
|
138
|
+
return tester->connection != NULL;
|
139
|
+
}
|
140
|
+
|
141
|
+
static int s_wait_on_connection_connected(struct tester *tester) {
|
142
|
+
|
143
|
+
ASSERT_SUCCESS(aws_mutex_lock(&tester->wait_lock));
|
144
|
+
int signal_error = aws_condition_variable_wait_pred(&tester->wait_cvar, &tester->wait_lock, s_is_connected, tester);
|
145
|
+
ASSERT_SUCCESS(aws_mutex_unlock(&tester->wait_lock));
|
146
|
+
return signal_error;
|
147
|
+
}
|
148
|
+
|
149
|
+
static bool s_is_shutdown(void *context) {
|
150
|
+
struct tester *tester = context;
|
151
|
+
|
152
|
+
return tester->shutdown_finished;
|
153
|
+
}
|
154
|
+
|
155
|
+
static int s_wait_on_connection_shutdown(struct tester *tester) {
|
156
|
+
|
157
|
+
ASSERT_SUCCESS(aws_mutex_lock(&tester->wait_lock));
|
158
|
+
int signal_error = aws_condition_variable_wait_pred(&tester->wait_cvar, &tester->wait_lock, s_is_shutdown, tester);
|
159
|
+
ASSERT_SUCCESS(aws_mutex_unlock(&tester->wait_lock));
|
160
|
+
return signal_error;
|
161
|
+
}
|
162
|
+
|
163
|
+
static bool s_is_stream_completed_count_at_least(void *context) {
|
164
|
+
(void)context;
|
165
|
+
return s_tester.wait_for_stream_completed_count <= s_tester.stream_completed_count;
|
166
|
+
}
|
167
|
+
|
168
|
+
static int s_wait_on_streams_completed_count(size_t count) {
|
169
|
+
|
170
|
+
ASSERT_SUCCESS(aws_mutex_lock(&s_tester.wait_lock));
|
171
|
+
s_tester.wait_for_stream_completed_count = count;
|
172
|
+
int signal_error = aws_condition_variable_wait_pred(
|
173
|
+
&s_tester.wait_cvar, &s_tester.wait_lock, s_is_stream_completed_count_at_least, &s_tester);
|
174
|
+
ASSERT_SUCCESS(aws_mutex_unlock(&s_tester.wait_lock));
|
175
|
+
return signal_error;
|
176
|
+
}
|
177
|
+
|
178
|
+
static void s_tester_on_stream_completed(struct aws_http_stream *stream, int error_code, void *user_data) {
|
179
|
+
(void)user_data;
|
180
|
+
(void)stream;
|
181
|
+
AWS_FATAL_ASSERT(aws_mutex_lock(&s_tester.wait_lock) == AWS_OP_SUCCESS);
|
182
|
+
if (error_code) {
|
183
|
+
++s_tester.stream_complete_errors;
|
184
|
+
s_tester.stream_completed_error_code = error_code;
|
185
|
+
} else {
|
186
|
+
int status = 0;
|
187
|
+
if (aws_http_stream_get_incoming_response_status(stream, &status)) {
|
188
|
+
++s_tester.stream_complete_errors;
|
189
|
+
s_tester.stream_completed_error_code = aws_last_error();
|
190
|
+
} else {
|
191
|
+
if (status == 200) {
|
192
|
+
s_tester.stream_completed_with_200 = true;
|
193
|
+
++s_tester.stream_200_count;
|
194
|
+
} else if (status / 100 == 4) {
|
195
|
+
} else {
|
196
|
+
++s_tester.stream_status_not_200_count;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
200
|
+
++s_tester.stream_completed_count;
|
201
|
+
aws_condition_variable_notify_one(&s_tester.wait_cvar);
|
202
|
+
AWS_FATAL_ASSERT(aws_mutex_unlock(&s_tester.wait_lock) == AWS_OP_SUCCESS);
|
203
|
+
}
|
204
|
+
|
205
|
+
static struct aws_logger s_logger;
|
206
|
+
|
207
|
+
static int s_tester_init(struct tester *tester, struct aws_allocator *allocator, struct aws_byte_cursor host_name) {
|
208
|
+
aws_http_library_init(allocator);
|
209
|
+
|
210
|
+
ASSERT_SUCCESS(aws_mutex_init(&tester->wait_lock));
|
211
|
+
ASSERT_SUCCESS(aws_condition_variable_init(&tester->wait_cvar));
|
212
|
+
tester->event_loop_group = aws_event_loop_group_new_default(allocator, 1, NULL);
|
213
|
+
|
214
|
+
struct aws_host_resolver_default_options resolver_options = {
|
215
|
+
.el_group = tester->event_loop_group,
|
216
|
+
.max_entries = 8,
|
217
|
+
};
|
218
|
+
|
219
|
+
tester->host_resolver = aws_host_resolver_new_default(allocator, &resolver_options);
|
220
|
+
/* Create http connection */
|
221
|
+
struct aws_client_bootstrap_options bootstrap_options = {
|
222
|
+
.event_loop_group = tester->event_loop_group,
|
223
|
+
.host_resolver = tester->host_resolver,
|
224
|
+
};
|
225
|
+
tester->client_bootstrap = aws_client_bootstrap_new(allocator, &bootstrap_options);
|
226
|
+
|
227
|
+
aws_tls_ctx_options_init_default_client(&tester->tls_ctx_options, allocator);
|
228
|
+
aws_tls_ctx_options_set_alpn_list(&tester->tls_ctx_options, "h2");
|
229
|
+
/* Turn off peer verification as a localhost cert used */
|
230
|
+
tester->tls_ctx_options.verify_peer = false;
|
231
|
+
|
232
|
+
tester->tls_ctx = aws_tls_client_ctx_new(allocator, &tester->tls_ctx_options);
|
233
|
+
aws_tls_connection_options_init_from_ctx(&tester->tls_connection_options, tester->tls_ctx);
|
234
|
+
aws_tls_connection_options_set_server_name(&tester->tls_connection_options, allocator, &host_name);
|
235
|
+
struct aws_socket_options socket_options = {
|
236
|
+
.type = AWS_SOCKET_STREAM,
|
237
|
+
.connect_timeout_ms =
|
238
|
+
(uint32_t)aws_timestamp_convert(TESTER_TIMEOUT_SEC, AWS_TIMESTAMP_SECS, AWS_TIMESTAMP_MILLIS, NULL),
|
239
|
+
.keep_alive_timeout_sec = 0,
|
240
|
+
.keepalive = false,
|
241
|
+
.keep_alive_interval_sec = 0,
|
242
|
+
};
|
243
|
+
struct aws_http_connection_monitoring_options monitor_opt = {
|
244
|
+
.allowable_throughput_failure_interval_seconds = 1,
|
245
|
+
.minimum_throughput_bytes_per_second = 1000,
|
246
|
+
};
|
247
|
+
struct aws_http_client_connection_options client_options = {
|
248
|
+
.self_size = sizeof(struct aws_http_client_connection_options),
|
249
|
+
.allocator = allocator,
|
250
|
+
.bootstrap = tester->client_bootstrap,
|
251
|
+
.host_name = host_name,
|
252
|
+
.port = 8443,
|
253
|
+
.socket_options = &socket_options,
|
254
|
+
.user_data = tester,
|
255
|
+
.tls_options = &tester->tls_connection_options,
|
256
|
+
.on_setup = s_on_connection_setup,
|
257
|
+
.on_shutdown = s_on_connection_shutdown,
|
258
|
+
.monitoring_options = &monitor_opt,
|
259
|
+
};
|
260
|
+
ASSERT_SUCCESS(aws_http_client_connect(&client_options));
|
261
|
+
struct aws_logger_standard_options logger_options = {
|
262
|
+
.level = AWS_LOG_LEVEL_DEBUG, /* We are stress testing, and if this ever failed, the default trace level log is
|
263
|
+
too much to handle, let's do debug level instead */
|
264
|
+
.file = stderr,
|
265
|
+
};
|
266
|
+
|
267
|
+
aws_logger_init_standard(&s_logger, allocator, &logger_options);
|
268
|
+
aws_logger_set(&s_logger);
|
269
|
+
return AWS_OP_SUCCESS;
|
270
|
+
}
|
271
|
+
|
272
|
+
static int s_tester_clean_up(struct tester *tester) {
|
273
|
+
aws_http_connection_release(tester->connection);
|
274
|
+
ASSERT_SUCCESS(s_wait_on_connection_shutdown(tester));
|
275
|
+
|
276
|
+
aws_tls_connection_options_clean_up(&tester->tls_connection_options);
|
277
|
+
aws_tls_ctx_release(tester->tls_ctx);
|
278
|
+
aws_tls_ctx_options_clean_up(&tester->tls_ctx_options);
|
279
|
+
aws_client_bootstrap_release(tester->client_bootstrap);
|
280
|
+
aws_host_resolver_release(tester->host_resolver);
|
281
|
+
aws_event_loop_group_release(tester->event_loop_group);
|
282
|
+
|
283
|
+
aws_mutex_clean_up(&tester->wait_lock);
|
284
|
+
aws_http_library_clean_up();
|
285
|
+
aws_logger_clean_up(&s_logger);
|
286
|
+
return AWS_OP_SUCCESS;
|
287
|
+
}
|
288
|
+
|
289
|
+
AWS_STATIC_STRING_FROM_LITERAL(s_http_localhost_env_var, "AWS_TEST_LOCALHOST_HOST");
|
290
|
+
|
291
|
+
static int s_test_hpack_stress_helper(struct aws_allocator *allocator, bool compression) {
|
292
|
+
/* Test that makes tons of streams with all sorts of headers to stress hpack */
|
293
|
+
struct aws_string *http_localhost_host = NULL;
|
294
|
+
if (aws_get_environment_value(allocator, s_http_localhost_env_var, &http_localhost_host) ||
|
295
|
+
http_localhost_host == NULL) {
|
296
|
+
/* The envrionment variable is not set, default to localhost */
|
297
|
+
http_localhost_host = aws_string_new_from_c_str(allocator, "localhost");
|
298
|
+
}
|
299
|
+
struct aws_byte_cursor host_name = aws_byte_cursor_from_string(http_localhost_host);
|
300
|
+
ASSERT_SUCCESS(s_tester_init(&s_tester, allocator, host_name));
|
301
|
+
/* wait for connection connected */
|
302
|
+
ASSERT_SUCCESS(s_wait_on_connection_connected(&s_tester));
|
303
|
+
// localhost/echo is an echo server that will return the headers of your request from the body.
|
304
|
+
struct aws_http_header request_headers_src[] = {
|
305
|
+
DEFINE_HEADER(":method", "GET"),
|
306
|
+
DEFINE_HEADER(":scheme", "https"),
|
307
|
+
DEFINE_HEADER(":path", "/echo"),
|
308
|
+
{
|
309
|
+
.name = aws_byte_cursor_from_c_str(":authority"),
|
310
|
+
.value = host_name,
|
311
|
+
},
|
312
|
+
};
|
313
|
+
|
314
|
+
size_t num_to_acquire = 2000;
|
315
|
+
size_t num_headers_to_make = 100;
|
316
|
+
|
317
|
+
/* Use a pool of headers and a pool of values, pick up randomly from both pool to stress hpack */
|
318
|
+
size_t headers_pool_size = 500;
|
319
|
+
size_t values_pool_size = 66;
|
320
|
+
|
321
|
+
for (size_t i = 0; i < num_to_acquire; i++) {
|
322
|
+
struct aws_http_message *request = aws_http2_message_new_request(allocator);
|
323
|
+
ASSERT_NOT_NULL(request);
|
324
|
+
aws_http_message_add_header_array(request, request_headers_src, AWS_ARRAY_SIZE(request_headers_src));
|
325
|
+
struct aws_http_headers *request_headers = aws_http_message_get_headers(request);
|
326
|
+
struct aws_http_headers *test_headers =
|
327
|
+
aws_http_headers_new(allocator); /* as request headers has the pesudo headers, make a copy of the real
|
328
|
+
headers to check the result */
|
329
|
+
for (size_t j = 0; j < num_headers_to_make; j++) {
|
330
|
+
char test_header_str[256];
|
331
|
+
uint64_t random_64_bit_num = 0;
|
332
|
+
aws_device_random_u64(&random_64_bit_num);
|
333
|
+
|
334
|
+
size_t headers = (size_t)random_64_bit_num % headers_pool_size;
|
335
|
+
sprintf(test_header_str, "crttest-%zu", headers);
|
336
|
+
char test_value_str[256];
|
337
|
+
size_t value = (size_t)random_64_bit_num % values_pool_size;
|
338
|
+
sprintf(test_value_str, "value-%zu", value);
|
339
|
+
|
340
|
+
struct aws_http_header request_header = {
|
341
|
+
.compression =
|
342
|
+
compression
|
343
|
+
? random_64_bit_num % 3
|
344
|
+
: AWS_HTTP_HEADER_COMPRESSION_USE_CACHE, // With random type of compression, make sure it works
|
345
|
+
.name = aws_byte_cursor_from_c_str(test_header_str),
|
346
|
+
.value = aws_byte_cursor_from_c_str(test_value_str),
|
347
|
+
};
|
348
|
+
ASSERT_SUCCESS(aws_http_headers_add_header(request_headers, &request_header));
|
349
|
+
ASSERT_SUCCESS(aws_http_headers_add_header(test_headers, &request_header));
|
350
|
+
}
|
351
|
+
struct aws_http_headers *received_headers = aws_http_headers_new(allocator);
|
352
|
+
struct aws_http_make_request_options request_options = {
|
353
|
+
.self_size = sizeof(request_options),
|
354
|
+
.request = request,
|
355
|
+
.user_data = received_headers,
|
356
|
+
.on_response_headers = s_tester_on_headers,
|
357
|
+
.on_complete = s_tester_on_stream_completed,
|
358
|
+
};
|
359
|
+
struct aws_http_stream *stream = aws_http_connection_make_request(s_tester.connection, &request_options);
|
360
|
+
ASSERT_NOT_NULL(stream);
|
361
|
+
aws_http_stream_activate(stream);
|
362
|
+
aws_http_stream_release(stream);
|
363
|
+
|
364
|
+
/* Wait for the stream to complete */
|
365
|
+
ASSERT_SUCCESS(s_wait_on_streams_completed_count(1));
|
366
|
+
--s_tester.stream_completed_count;
|
367
|
+
ASSERT_TRUE(s_tester.stream_completed_with_200);
|
368
|
+
ASSERT_TRUE(s_check_headers_received(received_headers, test_headers));
|
369
|
+
|
370
|
+
aws_http_message_release(request);
|
371
|
+
aws_http_headers_release(test_headers);
|
372
|
+
aws_http_headers_release(received_headers);
|
373
|
+
}
|
374
|
+
|
375
|
+
aws_string_destroy(http_localhost_host);
|
376
|
+
return s_tester_clean_up(&s_tester);
|
377
|
+
}
|
378
|
+
|
379
|
+
AWS_TEST_CASE(localhost_integ_hpack_stress, test_hpack_stress)
|
380
|
+
static int test_hpack_stress(struct aws_allocator *allocator, void *ctx) {
|
381
|
+
(void)ctx;
|
382
|
+
return s_test_hpack_stress_helper(allocator, false /*compression*/);
|
383
|
+
}
|
384
|
+
|
385
|
+
AWS_TEST_CASE(localhost_integ_hpack_compression_stress, test_hpack_compression_stress)
|
386
|
+
static int test_hpack_compression_stress(struct aws_allocator *allocator, void *ctx) {
|
387
|
+
(void)ctx;
|
388
|
+
return s_test_hpack_stress_helper(allocator, true /*compression*/);
|
389
|
+
}
|
390
|
+
|
391
|
+
static int s_tester_on_put_body(struct aws_http_stream *stream, const struct aws_byte_cursor *data, void *user_data) {
|
392
|
+
|
393
|
+
(void)stream;
|
394
|
+
(void)user_data;
|
395
|
+
struct aws_string *content_length_header_str = aws_string_new_from_cursor(s_tester.alloc, data);
|
396
|
+
s_tester.num_sen_received = (uint64_t)strtoull((const char *)content_length_header_str->bytes, NULL, 10);
|
397
|
+
aws_string_destroy(content_length_header_str);
|
398
|
+
|
399
|
+
return AWS_OP_SUCCESS;
|
400
|
+
}
|
401
|
+
|
402
|
+
/* Test that upload a 2.5GB data to local server */
|
403
|
+
AWS_TEST_CASE(localhost_integ_h2_upload_stress, s_localhost_integ_h2_upload_stress)
|
404
|
+
static int s_localhost_integ_h2_upload_stress(struct aws_allocator *allocator, void *ctx) {
|
405
|
+
(void)ctx;
|
406
|
+
s_tester.alloc = allocator;
|
407
|
+
|
408
|
+
size_t length = 2500000000UL;
|
409
|
+
#ifdef AWS_OS_LINUX
|
410
|
+
/* Using Python hyper h2 server frame work, met a weird upload performance issue on Linux. Our client against nginx
|
411
|
+
* platform has not met the same issue. We assume it's because the server framework implementation. Use lower
|
412
|
+
* number of linux */
|
413
|
+
length = 250000000UL;
|
414
|
+
#endif
|
415
|
+
|
416
|
+
struct aws_string *http_localhost_host = NULL;
|
417
|
+
if (aws_get_environment_value(allocator, s_http_localhost_env_var, &http_localhost_host) ||
|
418
|
+
http_localhost_host == NULL) {
|
419
|
+
/* The envrionment variable is not set, default to localhost */
|
420
|
+
http_localhost_host = aws_string_new_from_c_str(allocator, "localhost");
|
421
|
+
}
|
422
|
+
struct aws_byte_cursor host_name = aws_byte_cursor_from_string(http_localhost_host);
|
423
|
+
ASSERT_SUCCESS(s_tester_init(&s_tester, allocator, host_name));
|
424
|
+
/* wait for connection connected */
|
425
|
+
ASSERT_SUCCESS(s_wait_on_connection_connected(&s_tester));
|
426
|
+
char content_length_sprintf_buffer[128] = "";
|
427
|
+
snprintf(content_length_sprintf_buffer, sizeof(content_length_sprintf_buffer), "%zu", length);
|
428
|
+
|
429
|
+
struct aws_http_header request_headers_src[] = {
|
430
|
+
DEFINE_HEADER(":method", "PUT"),
|
431
|
+
DEFINE_HEADER(":scheme", "https"),
|
432
|
+
DEFINE_HEADER(":path", "/upload_test.txt"),
|
433
|
+
{
|
434
|
+
.name = aws_byte_cursor_from_c_str(":authority"),
|
435
|
+
.value = host_name,
|
436
|
+
},
|
437
|
+
{
|
438
|
+
.name = aws_byte_cursor_from_c_str("content_length"),
|
439
|
+
.value = aws_byte_cursor_from_c_str(content_length_sprintf_buffer),
|
440
|
+
},
|
441
|
+
};
|
442
|
+
struct aws_http_message *request = aws_http2_message_new_request(allocator);
|
443
|
+
aws_http_message_add_header_array(request, request_headers_src, AWS_ARRAY_SIZE(request_headers_src));
|
444
|
+
struct aws_input_stream *body_stream = aws_input_stream_tester_upload_new(allocator, length);
|
445
|
+
aws_http_message_set_body_stream(request, body_stream);
|
446
|
+
aws_input_stream_release(body_stream);
|
447
|
+
|
448
|
+
struct aws_http_make_request_options request_options = {
|
449
|
+
.self_size = sizeof(request_options),
|
450
|
+
.request = request,
|
451
|
+
.on_complete = s_tester_on_stream_completed,
|
452
|
+
.on_response_body = s_tester_on_put_body,
|
453
|
+
};
|
454
|
+
struct aws_http_stream *stream = aws_http_connection_make_request(s_tester.connection, &request_options);
|
455
|
+
ASSERT_NOT_NULL(stream);
|
456
|
+
aws_http_stream_activate(stream);
|
457
|
+
aws_http_stream_release(stream);
|
458
|
+
|
459
|
+
/* Wait for the stream to complete */
|
460
|
+
ASSERT_SUCCESS(s_wait_on_streams_completed_count(1));
|
461
|
+
ASSERT_UINT_EQUALS(s_tester.num_sen_received, length);
|
462
|
+
ASSERT_TRUE(s_tester.stream_completed_with_200);
|
463
|
+
|
464
|
+
aws_http_message_release(request);
|
465
|
+
aws_string_destroy(http_localhost_host);
|
466
|
+
return s_tester_clean_up(&s_tester);
|
467
|
+
}
|
468
|
+
|
469
|
+
static int s_tester_on_download_body(
|
470
|
+
struct aws_http_stream *stream,
|
471
|
+
const struct aws_byte_cursor *data,
|
472
|
+
void *user_data) {
|
473
|
+
|
474
|
+
(void)stream;
|
475
|
+
(void)user_data;
|
476
|
+
s_tester.download_body_len += data->len;
|
477
|
+
|
478
|
+
return AWS_OP_SUCCESS;
|
479
|
+
}
|
480
|
+
/* Test that download a 2.5GB data from local server */
|
481
|
+
AWS_TEST_CASE(localhost_integ_h2_download_stress, s_localhost_integ_h2_download_stress)
|
482
|
+
static int s_localhost_integ_h2_download_stress(struct aws_allocator *allocator, void *ctx) {
|
483
|
+
(void)ctx;
|
484
|
+
s_tester.alloc = allocator;
|
485
|
+
size_t length = 2500000000UL; /* over int max, which it the max for settings */
|
486
|
+
|
487
|
+
struct aws_string *http_localhost_host = NULL;
|
488
|
+
if (aws_get_environment_value(allocator, s_http_localhost_env_var, &http_localhost_host) ||
|
489
|
+
http_localhost_host == NULL) {
|
490
|
+
/* The envrionment variable is not set, default to localhost */
|
491
|
+
http_localhost_host = aws_string_new_from_c_str(allocator, "localhost");
|
492
|
+
}
|
493
|
+
struct aws_byte_cursor host_name = aws_byte_cursor_from_string(http_localhost_host);
|
494
|
+
ASSERT_SUCCESS(s_tester_init(&s_tester, allocator, host_name));
|
495
|
+
/* wait for connection connected */
|
496
|
+
ASSERT_SUCCESS(s_wait_on_connection_connected(&s_tester));
|
497
|
+
|
498
|
+
struct aws_http_header request_headers_src[] = {
|
499
|
+
DEFINE_HEADER(":method", "GET"),
|
500
|
+
DEFINE_HEADER(":scheme", "https"),
|
501
|
+
DEFINE_HEADER(":path", "/downloadTest"),
|
502
|
+
{
|
503
|
+
.name = aws_byte_cursor_from_c_str(":authority"),
|
504
|
+
.value = host_name,
|
505
|
+
},
|
506
|
+
};
|
507
|
+
struct aws_http_message *request = aws_http2_message_new_request(allocator);
|
508
|
+
ASSERT_NOT_NULL(request);
|
509
|
+
aws_http_message_add_header_array(request, request_headers_src, AWS_ARRAY_SIZE(request_headers_src));
|
510
|
+
|
511
|
+
struct aws_http_make_request_options request_options = {
|
512
|
+
.self_size = sizeof(request_options),
|
513
|
+
.request = request,
|
514
|
+
.on_complete = s_tester_on_stream_completed,
|
515
|
+
.on_response_body = s_tester_on_download_body,
|
516
|
+
};
|
517
|
+
struct aws_http_stream *stream = aws_http_connection_make_request(s_tester.connection, &request_options);
|
518
|
+
ASSERT_NOT_NULL(stream);
|
519
|
+
aws_http_stream_activate(stream);
|
520
|
+
aws_http_stream_release(stream);
|
521
|
+
|
522
|
+
/* Wait for the stream to complete */
|
523
|
+
ASSERT_SUCCESS(s_wait_on_streams_completed_count(1));
|
524
|
+
ASSERT_UINT_EQUALS(s_tester.download_body_len, length);
|
525
|
+
ASSERT_TRUE(s_tester.stream_completed_with_200);
|
526
|
+
|
527
|
+
aws_http_message_release(request);
|
528
|
+
aws_string_destroy(http_localhost_host);
|
529
|
+
return s_tester_clean_up(&s_tester);
|
530
|
+
}
|