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
@@ -54,6 +54,7 @@ static struct aws_http_stream *s_connection_make_request(
|
|
54
54
|
struct aws_http_connection *client_connection,
|
55
55
|
const struct aws_http_make_request_options *options);
|
56
56
|
static void s_connection_close(struct aws_http_connection *connection_base);
|
57
|
+
static void s_connection_stop_new_request(struct aws_http_connection *connection_base);
|
57
58
|
static bool s_connection_is_open(const struct aws_http_connection *connection_base);
|
58
59
|
static bool s_connection_new_requests_allowed(const struct aws_http_connection *connection_base);
|
59
60
|
static void s_connection_update_window(struct aws_http_connection *connection_base, uint32_t increment_size);
|
@@ -68,7 +69,7 @@ static int s_connection_send_ping(
|
|
68
69
|
const struct aws_byte_cursor *optional_opaque_data,
|
69
70
|
aws_http2_on_ping_complete_fn *on_completed,
|
70
71
|
void *user_data);
|
71
|
-
static
|
72
|
+
static void s_connection_send_goaway(
|
72
73
|
struct aws_http_connection *connection_base,
|
73
74
|
uint32_t http2_error,
|
74
75
|
bool allow_more_streams,
|
@@ -146,6 +147,8 @@ struct aws_h2err s_decoder_on_goaway(
|
|
146
147
|
uint32_t error_code,
|
147
148
|
struct aws_byte_cursor debug_data,
|
148
149
|
void *userdata);
|
150
|
+
static void s_reset_statistics(struct aws_channel_handler *handler);
|
151
|
+
static void s_gather_statistics(struct aws_channel_handler *handler, struct aws_array_list *stats);
|
149
152
|
|
150
153
|
static struct aws_http_connection_vtable s_h2_connection_vtable = {
|
151
154
|
.channel_handler_vtable =
|
@@ -157,6 +160,8 @@ static struct aws_http_connection_vtable s_h2_connection_vtable = {
|
|
157
160
|
.initial_window_size = s_handler_initial_window_size,
|
158
161
|
.message_overhead = s_handler_message_overhead,
|
159
162
|
.destroy = s_handler_destroy,
|
163
|
+
.reset_statistics = s_reset_statistics,
|
164
|
+
.gather_statistics = s_gather_statistics,
|
160
165
|
},
|
161
166
|
|
162
167
|
.on_channel_handler_installed = s_handler_installed,
|
@@ -164,6 +169,7 @@ static struct aws_http_connection_vtable s_h2_connection_vtable = {
|
|
164
169
|
.new_server_request_handler_stream = NULL,
|
165
170
|
.stream_send_response = NULL,
|
166
171
|
.close = s_connection_close,
|
172
|
+
.stop_new_requests = s_connection_stop_new_request,
|
167
173
|
.is_open = s_connection_is_open,
|
168
174
|
.new_requests_allowed = s_connection_new_requests_allowed,
|
169
175
|
.update_window = s_connection_update_window,
|
@@ -219,6 +225,14 @@ static void s_release_stream_and_connection_lock(struct aws_h2_stream *stream, s
|
|
219
225
|
(void)err;
|
220
226
|
}
|
221
227
|
|
228
|
+
static void s_add_time_measurement_to_stats(uint64_t start_ns, uint64_t end_ns, uint64_t *output_ms) {
|
229
|
+
if (end_ns > start_ns) {
|
230
|
+
*output_ms += aws_timestamp_convert(end_ns - start_ns, AWS_TIMESTAMP_NANOS, AWS_TIMESTAMP_MILLIS, NULL);
|
231
|
+
} else {
|
232
|
+
*output_ms = 0;
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
222
236
|
/**
|
223
237
|
* Internal function for bringing connection to a stop.
|
224
238
|
* Invoked multiple times, including when:
|
@@ -331,6 +345,7 @@ static struct aws_h2_connection *s_connection_new(
|
|
331
345
|
aws_linked_list_init(&connection->thread_data.pending_settings_queue);
|
332
346
|
aws_linked_list_init(&connection->thread_data.pending_ping_queue);
|
333
347
|
aws_linked_list_init(&connection->thread_data.stalled_window_streams_list);
|
348
|
+
aws_linked_list_init(&connection->thread_data.waiting_streams_list);
|
334
349
|
aws_linked_list_init(&connection->thread_data.outgoing_frames_queue);
|
335
350
|
|
336
351
|
if (aws_mutex_init(&connection->synced_data.lock)) {
|
@@ -366,12 +381,15 @@ static struct aws_h2_connection *s_connection_new(
|
|
366
381
|
memcpy(connection->synced_data.settings_peer, aws_h2_settings_initial, sizeof(aws_h2_settings_initial));
|
367
382
|
memcpy(connection->synced_data.settings_self, aws_h2_settings_initial, sizeof(aws_h2_settings_initial));
|
368
383
|
|
369
|
-
connection->thread_data.window_size_peer =
|
370
|
-
connection->thread_data.window_size_self =
|
384
|
+
connection->thread_data.window_size_peer = AWS_H2_INIT_WINDOW_SIZE;
|
385
|
+
connection->thread_data.window_size_self = AWS_H2_INIT_WINDOW_SIZE;
|
371
386
|
|
372
387
|
connection->thread_data.goaway_received_last_stream_id = AWS_H2_STREAM_ID_MAX;
|
373
388
|
connection->thread_data.goaway_sent_last_stream_id = AWS_H2_STREAM_ID_MAX;
|
374
389
|
|
390
|
+
aws_crt_statistics_http2_channel_init(&connection->thread_data.stats);
|
391
|
+
connection->thread_data.stats.was_inactive = true; /* Start with non active streams */
|
392
|
+
|
375
393
|
connection->synced_data.is_open = true;
|
376
394
|
connection->synced_data.new_stream_error_code = AWS_ERROR_SUCCESS;
|
377
395
|
|
@@ -453,6 +471,7 @@ static void s_handler_destroy(struct aws_channel_handler *handler) {
|
|
453
471
|
!aws_hash_table_is_valid(&connection->thread_data.active_streams_map) ||
|
454
472
|
aws_hash_table_get_entry_count(&connection->thread_data.active_streams_map) == 0);
|
455
473
|
|
474
|
+
AWS_ASSERT(aws_linked_list_empty(&connection->thread_data.waiting_streams_list));
|
456
475
|
AWS_ASSERT(aws_linked_list_empty(&connection->thread_data.stalled_window_streams_list));
|
457
476
|
AWS_ASSERT(aws_linked_list_empty(&connection->thread_data.outgoing_streams_list));
|
458
477
|
AWS_ASSERT(aws_linked_list_empty(&connection->synced_data.pending_stream_list));
|
@@ -548,10 +567,9 @@ static struct aws_h2_pending_goaway *s_new_pending_goaway(
|
|
548
567
|
}
|
549
568
|
struct aws_h2_pending_goaway *pending_goaway;
|
550
569
|
void *debug_data_storage;
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
}
|
570
|
+
/* mem acquire cannot fail anymore */
|
571
|
+
aws_mem_acquire_many(
|
572
|
+
allocator, 2, &pending_goaway, sizeof(struct aws_h2_pending_goaway), &debug_data_storage, debug_data.len);
|
555
573
|
if (debug_data.len) {
|
556
574
|
memcpy(debug_data_storage, debug_data.ptr, debug_data.len);
|
557
575
|
debug_data.ptr = debug_data_storage;
|
@@ -793,7 +811,11 @@ static int s_encode_data_from_outgoing_streams(struct aws_h2_connection *connect
|
|
793
811
|
|
794
812
|
AWS_PRECONDITION(aws_channel_thread_is_callers_thread(connection->base.channel_slot->channel));
|
795
813
|
struct aws_linked_list *outgoing_streams_list = &connection->thread_data.outgoing_streams_list;
|
814
|
+
if (aws_linked_list_empty(outgoing_streams_list)) {
|
815
|
+
return AWS_OP_SUCCESS;
|
816
|
+
}
|
796
817
|
struct aws_linked_list *stalled_window_streams_list = &connection->thread_data.stalled_window_streams_list;
|
818
|
+
struct aws_linked_list *waiting_streams_list = &connection->thread_data.waiting_streams_list;
|
797
819
|
|
798
820
|
/* If a stream stalls, put it in this list until the function ends so we don't keep trying to read from it.
|
799
821
|
* We put it back at the end of function. */
|
@@ -813,7 +835,7 @@ static int s_encode_data_from_outgoing_streams(struct aws_h2_connection *connect
|
|
813
835
|
"Peer connection's flow-control window is too small now %zu. Connection will stop sending DATA until "
|
814
836
|
"WINDOW_UPDATE is received.",
|
815
837
|
connection->thread_data.window_size_peer);
|
816
|
-
|
838
|
+
goto done;
|
817
839
|
}
|
818
840
|
|
819
841
|
/* Stop looping if message is so full it's not worth the bother */
|
@@ -851,9 +873,13 @@ static int s_encode_data_from_outgoing_streams(struct aws_h2_connection *connect
|
|
851
873
|
case AWS_H2_DATA_ENCODE_ONGOING:
|
852
874
|
aws_linked_list_push_back(outgoing_streams_list, node);
|
853
875
|
break;
|
854
|
-
case
|
876
|
+
case AWS_H2_DATA_ENCODE_ONGOING_BODY_STREAM_STALLED:
|
855
877
|
aws_linked_list_push_back(&stalled_streams_list, node);
|
856
878
|
break;
|
879
|
+
case AWS_H2_DATA_ENCODE_ONGOING_WAITING_FOR_WRITES:
|
880
|
+
stream->thread_data.waiting_for_writes = true;
|
881
|
+
aws_linked_list_push_back(waiting_streams_list, node);
|
882
|
+
break;
|
857
883
|
case AWS_H2_DATA_ENCODE_ONGOING_WINDOW_STALLED:
|
858
884
|
aws_linked_list_push_back(stalled_window_streams_list, node);
|
859
885
|
AWS_H2_STREAM_LOG(
|
@@ -878,6 +904,16 @@ done:
|
|
878
904
|
return aws_raise_error(aws_error_code);
|
879
905
|
}
|
880
906
|
|
907
|
+
if (aws_linked_list_empty(outgoing_streams_list)) {
|
908
|
+
/* transition from something to write -> nothing to write */
|
909
|
+
uint64_t now_ns = 0;
|
910
|
+
aws_channel_current_clock_time(connection->base.channel_slot->channel, &now_ns);
|
911
|
+
s_add_time_measurement_to_stats(
|
912
|
+
connection->thread_data.outgoing_timestamp_ns,
|
913
|
+
now_ns,
|
914
|
+
&connection->thread_data.stats.pending_outgoing_stream_ms);
|
915
|
+
}
|
916
|
+
|
881
917
|
return AWS_OP_SUCCESS;
|
882
918
|
}
|
883
919
|
|
@@ -1199,34 +1235,28 @@ struct aws_h2err s_decoder_on_data_begin(
|
|
1199
1235
|
return err;
|
1200
1236
|
}
|
1201
1237
|
}
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1238
|
+
/* Handle automatic updates of the connection flow window */
|
1239
|
+
uint32_t auto_window_update;
|
1240
|
+
if (connection->conn_manual_window_management) {
|
1241
|
+
/* Automatically update the flow-window to account for padding, even though "manual window management"
|
1206
1242
|
* is enabled. We do this because the current API doesn't have any way to inform the user about padding,
|
1207
|
-
* so we can't expect them to manage it themselves.
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
CONNECTION_LOGF(
|
1213
|
-
DEBUG,
|
1214
|
-
connection,
|
1215
|
-
"DATA with %" PRIu32
|
1216
|
-
" padding. Updating the window for padding and one byte for padding length automatically.",
|
1217
|
-
total_padding_bytes - 1 /* one byte for padding length */);
|
1243
|
+
* so we can't expect them to manage it themselves. */
|
1244
|
+
auto_window_update = total_padding_bytes;
|
1245
|
+
} else {
|
1246
|
+
/* Automatically update the full amount we just received */
|
1247
|
+
auto_window_update = payload_len;
|
1218
1248
|
}
|
1219
1249
|
|
1220
|
-
|
1221
|
-
|
1222
|
-
if (s_connection_send_update_window(connection, payload_len)) {
|
1250
|
+
if (auto_window_update != 0) {
|
1251
|
+
if (s_connection_send_update_window(connection, auto_window_update)) {
|
1223
1252
|
return aws_h2err_from_last_error();
|
1224
1253
|
}
|
1225
1254
|
CONNECTION_LOGF(
|
1226
1255
|
TRACE,
|
1227
1256
|
connection,
|
1228
|
-
"
|
1229
|
-
|
1257
|
+
"Automatically updating connection window by %" PRIu32 "(%" PRIu32 " due to padding).",
|
1258
|
+
auto_window_update,
|
1259
|
+
total_padding_bytes);
|
1230
1260
|
}
|
1231
1261
|
|
1232
1262
|
return AWS_H2ERR_SUCCESS;
|
@@ -1722,6 +1752,17 @@ static void s_handler_installed(struct aws_channel_handler *handler, struct aws_
|
|
1722
1752
|
/* enqueue the initial settings frame here */
|
1723
1753
|
aws_linked_list_push_back(&connection->thread_data.outgoing_frames_queue, &init_settings_frame->node);
|
1724
1754
|
|
1755
|
+
/* If not manual connection window management, update the connection window to max. */
|
1756
|
+
if (!connection->conn_manual_window_management) {
|
1757
|
+
uint32_t initial_window_update_size = AWS_H2_WINDOW_UPDATE_MAX - AWS_H2_INIT_WINDOW_SIZE;
|
1758
|
+
struct aws_h2_frame *connection_window_update_frame =
|
1759
|
+
aws_h2_frame_new_window_update(connection->base.alloc, 0 /* stream_id */, initial_window_update_size);
|
1760
|
+
AWS_ASSERT(connection_window_update_frame);
|
1761
|
+
/* enqueue the windows update frame here */
|
1762
|
+
aws_linked_list_push_back(
|
1763
|
+
&connection->thread_data.outgoing_frames_queue, &connection_window_update_frame->node);
|
1764
|
+
connection->thread_data.window_size_self += initial_window_update_size;
|
1765
|
+
}
|
1725
1766
|
aws_h2_try_write_outgoing_frames(connection);
|
1726
1767
|
return;
|
1727
1768
|
|
@@ -1750,11 +1791,21 @@ static void s_stream_complete(struct aws_h2_connection *connection, struct aws_h
|
|
1750
1791
|
aws_linked_list_remove(&stream->node);
|
1751
1792
|
}
|
1752
1793
|
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1794
|
+
if (aws_hash_table_get_entry_count(&connection->thread_data.active_streams_map) == 0 &&
|
1795
|
+
connection->thread_data.incoming_timestamp_ns != 0) {
|
1796
|
+
uint64_t now_ns = 0;
|
1797
|
+
aws_channel_current_clock_time(connection->base.channel_slot->channel, &now_ns);
|
1798
|
+
/* transition from something to read -> nothing to read and nothing to write */
|
1799
|
+
s_add_time_measurement_to_stats(
|
1800
|
+
connection->thread_data.incoming_timestamp_ns,
|
1801
|
+
now_ns,
|
1802
|
+
&connection->thread_data.stats.pending_incoming_stream_ms);
|
1803
|
+
connection->thread_data.stats.was_inactive = true;
|
1804
|
+
connection->thread_data.incoming_timestamp_ns = 0;
|
1756
1805
|
}
|
1757
1806
|
|
1807
|
+
aws_h2_stream_complete(stream, error_code);
|
1808
|
+
|
1758
1809
|
/* release connection's hold on stream */
|
1759
1810
|
aws_http_stream_release(&stream->base);
|
1760
1811
|
}
|
@@ -1848,15 +1899,28 @@ static void s_move_stream_to_thread(
|
|
1848
1899
|
goto error;
|
1849
1900
|
}
|
1850
1901
|
|
1851
|
-
|
1852
|
-
if (aws_h2_stream_on_activated(stream, &
|
1902
|
+
enum aws_h2_stream_body_state body_state = AWS_H2_STREAM_BODY_STATE_NONE;
|
1903
|
+
if (aws_h2_stream_on_activated(stream, &body_state)) {
|
1853
1904
|
goto error;
|
1854
1905
|
}
|
1855
1906
|
|
1856
|
-
if (
|
1857
|
-
|
1907
|
+
if (aws_hash_table_get_entry_count(&connection->thread_data.active_streams_map) == 1) {
|
1908
|
+
/* transition from nothing to read -> something to read */
|
1909
|
+
uint64_t now_ns = 0;
|
1910
|
+
aws_channel_current_clock_time(connection->base.channel_slot->channel, &now_ns);
|
1911
|
+
connection->thread_data.incoming_timestamp_ns = now_ns;
|
1858
1912
|
}
|
1859
1913
|
|
1914
|
+
switch (body_state) {
|
1915
|
+
case AWS_H2_STREAM_BODY_STATE_WAITING_WRITES:
|
1916
|
+
aws_linked_list_push_back(&connection->thread_data.waiting_streams_list, &stream->node);
|
1917
|
+
break;
|
1918
|
+
case AWS_H2_STREAM_BODY_STATE_ONGOING:
|
1919
|
+
aws_linked_list_push_back(&connection->thread_data.outgoing_streams_list, &stream->node);
|
1920
|
+
break;
|
1921
|
+
default:
|
1922
|
+
break;
|
1923
|
+
}
|
1860
1924
|
return;
|
1861
1925
|
error:
|
1862
1926
|
/* If the stream got into any datastructures, s_stream_complete() will remove it */
|
@@ -1943,6 +2007,7 @@ static void s_cross_thread_work_task(struct aws_channel_task *task, void *arg, e
|
|
1943
2007
|
s_send_goaway(connection, goaway->http2_error, goaway->allow_more_streams, &goaway->debug_data);
|
1944
2008
|
aws_mem_release(connection->base.alloc, goaway);
|
1945
2009
|
}
|
2010
|
+
|
1946
2011
|
/* It's likely that frames were queued while processing cross-thread work.
|
1947
2012
|
* If so, try writing them now */
|
1948
2013
|
aws_h2_try_write_outgoing_frames(connection);
|
@@ -2064,6 +2129,18 @@ static void s_connection_close(struct aws_http_connection *connection_base) {
|
|
2064
2129
|
s_stop(connection, false /*stop_reading*/, false /*stop_writing*/, true /*schedule_shutdown*/, AWS_ERROR_SUCCESS);
|
2065
2130
|
}
|
2066
2131
|
|
2132
|
+
static void s_connection_stop_new_request(struct aws_http_connection *connection_base) {
|
2133
|
+
struct aws_h2_connection *connection = AWS_CONTAINER_OF(connection_base, struct aws_h2_connection, base);
|
2134
|
+
|
2135
|
+
{ /* BEGIN CRITICAL SECTION */
|
2136
|
+
s_lock_synced_data(connection);
|
2137
|
+
if (!connection->synced_data.new_stream_error_code) {
|
2138
|
+
connection->synced_data.new_stream_error_code = AWS_ERROR_HTTP_CONNECTION_CLOSED;
|
2139
|
+
}
|
2140
|
+
s_unlock_synced_data(connection);
|
2141
|
+
} /* END CRITICAL SECTION */
|
2142
|
+
}
|
2143
|
+
|
2067
2144
|
static bool s_connection_is_open(const struct aws_http_connection *connection_base) {
|
2068
2145
|
struct aws_h2_connection *connection = AWS_CONTAINER_OF(connection_base, struct aws_h2_connection, base);
|
2069
2146
|
bool is_open;
|
@@ -2294,7 +2371,7 @@ closed:
|
|
2294
2371
|
return aws_raise_error(AWS_ERROR_INVALID_STATE);
|
2295
2372
|
}
|
2296
2373
|
|
2297
|
-
static
|
2374
|
+
static void s_connection_send_goaway(
|
2298
2375
|
struct aws_http_connection *connection_base,
|
2299
2376
|
uint32_t http2_error,
|
2300
2377
|
bool allow_more_streams,
|
@@ -2304,11 +2381,6 @@ static int s_connection_send_goaway(
|
|
2304
2381
|
struct aws_h2_pending_goaway *pending_goaway =
|
2305
2382
|
s_new_pending_goaway(connection->base.alloc, http2_error, allow_more_streams, optional_debug_data);
|
2306
2383
|
|
2307
|
-
if (!pending_goaway) {
|
2308
|
-
/* error happened during acquire memory. Error code raised there and skip logging. */
|
2309
|
-
return AWS_OP_ERR;
|
2310
|
-
}
|
2311
|
-
|
2312
2384
|
bool was_cross_thread_work_scheduled = false;
|
2313
2385
|
bool connection_open;
|
2314
2386
|
{ /* BEGIN CRITICAL SECTION */
|
@@ -2319,7 +2391,7 @@ static int s_connection_send_goaway(
|
|
2319
2391
|
s_unlock_synced_data(connection);
|
2320
2392
|
CONNECTION_LOG(DEBUG, connection, "Goaway not sent, connection is closed or closing.");
|
2321
2393
|
aws_mem_release(connection->base.alloc, pending_goaway);
|
2322
|
-
|
2394
|
+
return;
|
2323
2395
|
}
|
2324
2396
|
was_cross_thread_work_scheduled = connection->synced_data.is_cross_thread_work_task_scheduled;
|
2325
2397
|
connection->synced_data.is_cross_thread_work_task_scheduled = true;
|
@@ -2340,8 +2412,6 @@ static int s_connection_send_goaway(
|
|
2340
2412
|
CONNECTION_LOG(TRACE, connection, "Scheduling cross-thread work task");
|
2341
2413
|
aws_channel_schedule_task_now(connection->base.channel_slot->channel, &connection->cross_thread_work_task);
|
2342
2414
|
}
|
2343
|
-
done:
|
2344
|
-
return AWS_OP_SUCCESS;
|
2345
2415
|
}
|
2346
2416
|
|
2347
2417
|
static void s_get_settings_general(
|
@@ -2732,3 +2802,49 @@ static size_t s_handler_message_overhead(struct aws_channel_handler *handler) {
|
|
2732
2802
|
/* "All frames begin with a fixed 9-octet header followed by a variable-length payload" (RFC-7540 4.1) */
|
2733
2803
|
return 9;
|
2734
2804
|
}
|
2805
|
+
|
2806
|
+
static void s_reset_statistics(struct aws_channel_handler *handler) {
|
2807
|
+
struct aws_h2_connection *connection = handler->impl;
|
2808
|
+
aws_crt_statistics_http2_channel_reset(&connection->thread_data.stats);
|
2809
|
+
if (aws_hash_table_get_entry_count(&connection->thread_data.active_streams_map) == 0) {
|
2810
|
+
/* Check the current state */
|
2811
|
+
connection->thread_data.stats.was_inactive = true;
|
2812
|
+
}
|
2813
|
+
return;
|
2814
|
+
}
|
2815
|
+
|
2816
|
+
static void s_gather_statistics(struct aws_channel_handler *handler, struct aws_array_list *stats) {
|
2817
|
+
|
2818
|
+
struct aws_h2_connection *connection = handler->impl;
|
2819
|
+
AWS_PRECONDITION(aws_channel_thread_is_callers_thread(connection->base.channel_slot->channel));
|
2820
|
+
|
2821
|
+
/* TODO: Need update the way we calculate statistics, to account for user-controlled pauses.
|
2822
|
+
* If user is adding chunks 1 by 1, there can naturally be a gap in the upload.
|
2823
|
+
* If the user lets the stream-window go to zero, there can naturally be a gap in the download. */
|
2824
|
+
uint64_t now_ns = 0;
|
2825
|
+
if (aws_channel_current_clock_time(connection->base.channel_slot->channel, &now_ns)) {
|
2826
|
+
return;
|
2827
|
+
}
|
2828
|
+
|
2829
|
+
if (!aws_linked_list_empty(&connection->thread_data.outgoing_streams_list)) {
|
2830
|
+
s_add_time_measurement_to_stats(
|
2831
|
+
connection->thread_data.outgoing_timestamp_ns,
|
2832
|
+
now_ns,
|
2833
|
+
&connection->thread_data.stats.pending_outgoing_stream_ms);
|
2834
|
+
|
2835
|
+
connection->thread_data.outgoing_timestamp_ns = now_ns;
|
2836
|
+
}
|
2837
|
+
if (aws_hash_table_get_entry_count(&connection->thread_data.active_streams_map) != 0) {
|
2838
|
+
s_add_time_measurement_to_stats(
|
2839
|
+
connection->thread_data.incoming_timestamp_ns,
|
2840
|
+
now_ns,
|
2841
|
+
&connection->thread_data.stats.pending_incoming_stream_ms);
|
2842
|
+
|
2843
|
+
connection->thread_data.incoming_timestamp_ns = now_ns;
|
2844
|
+
} else {
|
2845
|
+
connection->thread_data.stats.was_inactive = true;
|
2846
|
+
}
|
2847
|
+
|
2848
|
+
void *stats_base = &connection->thread_data.stats;
|
2849
|
+
aws_array_list_push_back(stats, &stats_base);
|
2850
|
+
}
|
@@ -8,6 +8,7 @@
|
|
8
8
|
#include <aws/http/private/strutil.h>
|
9
9
|
|
10
10
|
#include <aws/common/string.h>
|
11
|
+
#include <aws/http/status_code.h>
|
11
12
|
#include <aws/io/logging.h>
|
12
13
|
|
13
14
|
#include <inttypes.h>
|
@@ -259,6 +260,8 @@ struct aws_h2_decoder {
|
|
259
260
|
* We continue decoding and report that it's malformed in on_headers_end(). */
|
260
261
|
bool malformed;
|
261
262
|
|
263
|
+
bool body_headers_forbidden;
|
264
|
+
|
262
265
|
/* Buffer up cookie header fields to concatenate separate ones */
|
263
266
|
struct aws_byte_buf cookies;
|
264
267
|
/* If separate cookie fields have different compression types, the concatenated cookie uses the strictest type.
|
@@ -1178,9 +1181,16 @@ static struct aws_h2err s_flush_pseudoheaders(struct aws_h2_decoder *decoder) {
|
|
1178
1181
|
DECODER_LOG(ERROR, decoder, "Informational (1xx) response cannot END_STREAM");
|
1179
1182
|
goto malformed;
|
1180
1183
|
}
|
1184
|
+
current_block->body_headers_forbidden = true;
|
1181
1185
|
} else {
|
1182
1186
|
current_block->block_type = AWS_HTTP_HEADER_BLOCK_MAIN;
|
1183
1187
|
}
|
1188
|
+
/**
|
1189
|
+
* RFC-9110 8.6.
|
1190
|
+
* A server MUST NOT send a Content-Length header field in any response with a status code of 1xx
|
1191
|
+
* (Informational) or 204 (No Content).
|
1192
|
+
*/
|
1193
|
+
current_block->body_headers_forbidden |= status_code == AWS_HTTP_STATUS_CODE_204_NO_CONTENT;
|
1184
1194
|
|
1185
1195
|
} else {
|
1186
1196
|
/* Trailing header block. */
|
@@ -1339,18 +1349,37 @@ static struct aws_h2err s_process_header_field(
|
|
1339
1349
|
if (aws_byte_buf_append_dynamic(¤t_block->cookies, &header_field->value)) {
|
1340
1350
|
return aws_h2err_from_last_error();
|
1341
1351
|
}
|
1352
|
+
/* Early return */
|
1353
|
+
return AWS_H2ERR_SUCCESS;
|
1354
|
+
case AWS_HTTP_HEADER_TRANSFER_ENCODING:
|
1355
|
+
case AWS_HTTP_HEADER_UPGRADE:
|
1356
|
+
case AWS_HTTP_HEADER_KEEP_ALIVE:
|
1357
|
+
case AWS_HTTP_HEADER_PROXY_CONNECTION: {
|
1358
|
+
/* connection-specific header field are treated as malformed (RFC9113 8.2.2) */
|
1359
|
+
DECODER_LOGF(
|
1360
|
+
ERROR,
|
1361
|
+
decoder,
|
1362
|
+
"Connection-specific header ('" PRInSTR "') found, not allowed in HTTP/2",
|
1363
|
+
AWS_BYTE_CURSOR_PRI(name));
|
1364
|
+
goto malformed;
|
1365
|
+
} break;
|
1366
|
+
|
1367
|
+
case AWS_HTTP_HEADER_CONTENT_LENGTH:
|
1368
|
+
if (current_block->body_headers_forbidden) {
|
1369
|
+
/* The content-length are forbidden */
|
1370
|
+
DECODER_LOG(ERROR, decoder, "Unexpected Content-Length header found");
|
1371
|
+
goto malformed;
|
1372
|
+
}
|
1342
1373
|
break;
|
1343
|
-
/* TODO: Validate connection-specific header field (RFC7540 8.1.2.2) */
|
1344
1374
|
default:
|
1345
|
-
/* Deliver header-field via callback */
|
1346
|
-
if (current_block->is_push_promise) {
|
1347
|
-
DECODER_CALL_VTABLE_STREAM_ARGS(decoder, on_push_promise_i, header_field, name_enum);
|
1348
|
-
} else {
|
1349
|
-
DECODER_CALL_VTABLE_STREAM_ARGS(
|
1350
|
-
decoder, on_headers_i, header_field, name_enum, current_block->block_type);
|
1351
|
-
}
|
1352
1375
|
break;
|
1353
1376
|
}
|
1377
|
+
/* Deliver header-field via callback */
|
1378
|
+
if (current_block->is_push_promise) {
|
1379
|
+
DECODER_CALL_VTABLE_STREAM_ARGS(decoder, on_push_promise_i, header_field, name_enum);
|
1380
|
+
} else {
|
1381
|
+
DECODER_CALL_VTABLE_STREAM_ARGS(decoder, on_headers_i, header_field, name_enum, current_block->block_type);
|
1382
|
+
}
|
1354
1383
|
}
|
1355
1384
|
|
1356
1385
|
return AWS_H2ERR_SUCCESS;
|
@@ -31,7 +31,7 @@ const uint32_t aws_h2_settings_initial[AWS_HTTP2_SETTINGS_END_RANGE] = {
|
|
31
31
|
[AWS_HTTP2_SETTINGS_HEADER_TABLE_SIZE] = 4096,
|
32
32
|
[AWS_HTTP2_SETTINGS_ENABLE_PUSH] = 1,
|
33
33
|
[AWS_HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS] = UINT32_MAX, /* "Initially there is no limit to this value" */
|
34
|
-
[AWS_HTTP2_SETTINGS_INITIAL_WINDOW_SIZE] =
|
34
|
+
[AWS_HTTP2_SETTINGS_INITIAL_WINDOW_SIZE] = AWS_H2_INIT_WINDOW_SIZE,
|
35
35
|
[AWS_HTTP2_SETTINGS_MAX_FRAME_SIZE] = 16384,
|
36
36
|
[AWS_HTTP2_SETTINGS_MAX_HEADER_LIST_SIZE] = UINT32_MAX, /* "The initial value of this setting is unlimited" */
|
37
37
|
};
|
@@ -227,6 +227,7 @@ static void s_frame_priority_settings_encode(
|
|
227
227
|
writes_ok &= aws_byte_buf_write_u8(output, priority->weight);
|
228
228
|
|
229
229
|
AWS_ASSERT(writes_ok);
|
230
|
+
(void)writes_ok;
|
230
231
|
}
|
231
232
|
|
232
233
|
/***********************************************************************************************************************
|
@@ -279,6 +280,7 @@ static void s_frame_prefix_encode(
|
|
279
280
|
writes_ok &= aws_byte_buf_write_be32(output, stream_id);
|
280
281
|
|
281
282
|
AWS_ASSERT(writes_ok);
|
283
|
+
(void)writes_ok;
|
282
284
|
}
|
283
285
|
|
284
286
|
/***********************************************************************************************************************
|
@@ -444,6 +446,7 @@ int aws_h2_encode_data_frame(
|
|
444
446
|
*stream_window_size_peer -= (int32_t)payload_len;
|
445
447
|
|
446
448
|
AWS_ASSERT(writes_ok);
|
449
|
+
(void)writes_ok;
|
447
450
|
return AWS_OP_SUCCESS;
|
448
451
|
|
449
452
|
handle_waiting_for_more_space:
|
@@ -501,6 +504,8 @@ static struct aws_h2_frame *s_frame_new_headers_or_push_promise(
|
|
501
504
|
const struct aws_h2_frame_priority_settings *optional_priority,
|
502
505
|
uint32_t promised_stream_id) {
|
503
506
|
|
507
|
+
/* TODO: Host and ":authority" are no longer permitted to disagree. Should we enforce it here or sent it as
|
508
|
+
* requested, let the server side reject the request? */
|
504
509
|
AWS_PRECONDITION(allocator);
|
505
510
|
AWS_PRECONDITION(frame_type == AWS_H2_FRAME_T_HEADERS || frame_type == AWS_H2_FRAME_T_PUSH_PROMISE);
|
506
511
|
AWS_PRECONDITION(headers);
|
@@ -721,6 +726,7 @@ static void s_encode_single_header_block_frame(
|
|
721
726
|
}
|
722
727
|
|
723
728
|
AWS_ASSERT(writes_ok);
|
729
|
+
(void)writes_ok;
|
724
730
|
|
725
731
|
/* Success! Wrote entire frame. It's safe to change state now */
|
726
732
|
frame->state =
|
@@ -887,6 +893,7 @@ static int s_frame_prebuilt_encode(
|
|
887
893
|
struct aws_byte_cursor chunk = aws_byte_cursor_advance(&frame->cursor, chunk_len);
|
888
894
|
writes_ok &= aws_byte_buf_write_from_whole_cursor(output, chunk);
|
889
895
|
AWS_ASSERT(writes_ok);
|
896
|
+
(void)writes_ok;
|
890
897
|
|
891
898
|
if (frame->cursor.len == 0) {
|
892
899
|
*complete = true;
|
@@ -966,6 +973,7 @@ struct aws_h2_frame *aws_h2_frame_new_rst_stream(
|
|
966
973
|
bool writes_ok = true;
|
967
974
|
writes_ok &= aws_byte_buf_write_be32(&frame->encoded_buf, error_code);
|
968
975
|
AWS_ASSERT(writes_ok);
|
976
|
+
(void)writes_ok;
|
969
977
|
|
970
978
|
return &frame->base;
|
971
979
|
}
|
@@ -1026,6 +1034,7 @@ struct aws_h2_frame *aws_h2_frame_new_settings(
|
|
1026
1034
|
writes_ok &= aws_byte_buf_write_be32(&frame->encoded_buf, settings_array[i].value);
|
1027
1035
|
}
|
1028
1036
|
AWS_ASSERT(writes_ok);
|
1037
|
+
(void)writes_ok;
|
1029
1038
|
|
1030
1039
|
return &frame->base;
|
1031
1040
|
}
|
@@ -1059,6 +1068,7 @@ struct aws_h2_frame *aws_h2_frame_new_ping(
|
|
1059
1068
|
bool writes_ok = true;
|
1060
1069
|
writes_ok &= aws_byte_buf_write(&frame->encoded_buf, opaque_data, AWS_HTTP2_PING_DATA_SIZE);
|
1061
1070
|
AWS_ASSERT(writes_ok);
|
1071
|
+
(void)writes_ok;
|
1062
1072
|
|
1063
1073
|
/* PING responses SHOULD be given higher priority than any other frame */
|
1064
1074
|
frame->base.high_priority = ack;
|
@@ -1117,6 +1127,7 @@ struct aws_h2_frame *aws_h2_frame_new_goaway(
|
|
1117
1127
|
writes_ok &= aws_byte_buf_write_be32(&frame->encoded_buf, error_code);
|
1118
1128
|
writes_ok &= aws_byte_buf_write_from_whole_cursor(&frame->encoded_buf, debug_data);
|
1119
1129
|
AWS_ASSERT(writes_ok);
|
1130
|
+
(void)writes_ok;
|
1120
1131
|
|
1121
1132
|
return &frame->base;
|
1122
1133
|
}
|
@@ -1165,6 +1176,7 @@ struct aws_h2_frame *aws_h2_frame_new_window_update(
|
|
1165
1176
|
bool writes_ok = true;
|
1166
1177
|
writes_ok &= aws_byte_buf_write_be32(&frame->encoded_buf, window_size_increment);
|
1167
1178
|
AWS_ASSERT(writes_ok);
|
1179
|
+
(void)writes_ok;
|
1168
1180
|
|
1169
1181
|
return &frame->base;
|
1170
1182
|
}
|