Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit d232a12
Merge: 837bd0e 2edeae4
Author: Masakazu Kitajo <[email protected]>
Date:   Tue Jun 29 15:41:34 2021 +0900

    Merge branch 'master' into quic-latest

    * master:
      reuse multiple times (apache#7992)
      Test bad request behavior (apache#7884)
      Fix BoringSSL build (apache#8001)
      Update TSHttpTxnAborted API to distinguish client/server aborts (apache#7901)
      Enforce case for well known methods (apache#7886)
      Add null checks for http_load (apache#7995)

commit 837bd0e
Author: Masakazu Kitajo <[email protected]>
Date:   Mon Jun 28 15:11:03 2021 +0900

    Fix unit tests for QUICStreamState

commit c5bb9e0
Merge: 0a63fa9 202b250
Author: Masakazu Kitajo <[email protected]>
Date:   Mon Jun 28 10:02:54 2021 +0900

    Merge branch 'master' into quic-latest

    * master:
      Implement TLSBasicSupport for QUICNetVC (apache#7959)
      Reload server session inactivity timeout before placing a session into the pool (apache#7618)
      Use OpeSSL EVP API if SHA1 API is unavailable  (cache_promote) (apache#7447)
      Cleanup: Get rid of HTTP2_SESSION_EVENT_RECV (apache#7879)
      Timing and permissions update for regex_revalidate test (apache#7998)
      limit m_current_range to max value in RangeTransform (apache#4843)
      Allow to TLS handshake to error out on TSVConnReenable (apache#7994)
      Cleanup: Get rid of HTTP2_SESSION_EVENT_INIT (apache#7878)
      Add hook for loading certificate and key data from plugin  (apache#6609)
      Doc: Now's Minute invocation error (apache#7990)
      Fix typo in configure.ac (apache#7993)

commit 0a63fa9
Merge: 312cf39 bd93f2a
Author: Masakazu Kitajo <[email protected]>
Date:   Fri Jun 25 14:34:55 2021 +0900

    Merge branch 'master' into quic-latest

    * master:
      Don't rely on SSLNetVC when HttpSM gathers info about SSL (apache#7961)
      conf_remap: demote 'Invalid configuration' to warning (apache#7991)
      Cleans up the code bit, including milliseconds consistency (apache#7989)
      Pass through expect header and handle 100-continue response (apache#7962)
      Treat TRACE with body as bad request (apache#7905)
      Thread safe Mersenne Twister 64 using c++11 (apache#7859)
      ESI plugin documentation updates. (apache#7970)
      Add log name configuration and stderr/stdout support. (apache#7937)
      Cleanup: Constify MIMEHdr (apache#7949)
      Fixed compile error with Linux AIO unit test (apache#7958)
      Note YAML parser library bug, and work-around, in documentation. (apache#7963)
      Ensure that the content-length value is only digits (apache#7964)
      String the url fragment for outgoing requests (apache#7966)
      Fix for HTTP/2 frames (apache#7965)
      Improve parsing error messages for strategies.yaml. (apache#7948)
      fix the scheme of h2 0rtt tests (apache#7957)
      Fix double test flakiness due to EOS/TXN_CLOSE race (apache#7956)
      Use proxy.config.log.hostname for rotated log filenames (apache#7943)
      Fixed memory leak in the QUIC stream manager (apache#7951)
      Fixup TS_USE_LINUX_NATIVE_AIO AIO_MODE_NATIVE (apache#7832)
      Update GitHub stale action to auto close old PRs (apache#7952)
      Revert "Do not invalidate cached resources upon error responses to unsafe methods (apache#7864)" (apache#7954)
      regex_revalidate: add stats for miss/stale counts (apache#7950)
      Do not invalidate cached resources upon error responses to unsafe methods (apache#7864)
      Add an HTTP/2 304 "Not Modified" AuTest. (apache#7882)
      regex_revalidate: optionally retain rule epoch state across restarts (apache#7939)
      Fixed memory leak in QUIC ack frame unit test (apache#7947)
      cache_promote: Don't promote on uncacheable requests (apache#7942)
      Fix dynamic-stack-buffer-overflow of cachekey plugin (apache#7945)
      Compilation error fixes for QUIC unit tests (apache#7944)
      Adds bytes counting as a trigger to the cache_promote LRU (apache#7765)
      Add a JSON schema for strategies.yaml (apache#7932)
      Remove second call to TRANSACT_RETURN while handling cache write lock (apache#7873)
      Close connection after every bad request for HTTP/1.1 (apache#7885)
      Pin Sphinx to 3.x to unblock `make html` (apache#7940)
      Add support for Remap rule hit stats (apache#7936)
      Remove scrap log object dead code (apache#7935)
      Add STL forward iterators to DLL container. (apache#7934)
      Add log SQUID code testing to redirect.test.py Au test. (apache#7870)
      Fix race condition on server session state (apache#7921)
      regex_reval: bug where rule type is always reported as the first (apache#7928)
      Remove duplicate entry in overridable txn vars. (apache#7930)
      Satisfy ci/jenkins/bin/clang-format.sh (apache#7929)
      Add a basic Au test using strategies.yaml, with consistent hashing. (apache#7911)
      Add a chunked negative revalidating test. (apache#7907)
      Ensure that URL components are valid when alternate eviction is logged (apache#7924)
      fix grammar (apache#7927)
      AuTest: Enable h2spec generic test cases (apache#7926)
      Adjust vc read errors (apache#7923)
      Remove bucket search from IntrusiveHashMap::erase (apache#7848)
      Ensure TS_VCONN_CLOSE_HOOK hook is called during TS_EVENT_VCONN_CLOSE. (apache#7913)
      Update docs languages file to add 9.1.x for en and ja (apache#7917)
      * Adds a new peering ring mode to next hop selection strategies. (apache#7897)
      Add Au test for strategies.yaml, with consistent hashing, with fallover. (apache#7914)
      Make HttpSM server reference a Transaction instead of a Session (apache#7849)
      Set accept_options of Http1Transaction in Http1ClientSession::new_connection() (apache#7894)
      Reset Http1Transaction before adding vc to keep_alive_queue (apache#7892)
      Add dead server policy control and metric. Improve messages. (apache#7757)
      Ensure the HTTP protion of the protocol string is upper case (apache#7904)
      Fixed spelling mistakes in the docs (apache#7896)
      add MISS capability to the regex_revalidate plugin (apache#7899)
      docs: fix capitalization of Linux (apache#7898)
      Redirect - Make TS to honour the number_of_redirections configuration value (apache#7867)
      Clean up producer more regularly (apache#7386)
      Fix crash in open_close_h2 (apache#7586)
      Cleanup Http2ClientSession SessionHandler (apache#7876)
      Enforce HTTP parsing restrictions on HTTP versions supported (apache#7875)
      Do not delete the continuation twice (apache#7862)
      Cleanup: refer Http2ClientSession::mutex (apache#7853)
      Autest - Proxy Verifier Extension, add context template $-base string substitution in the replay file. (apache#7866)
      Fixed some spelling mistakes in comments (apache#7869)
      Fixed ASAN issues with MMH test (apache#7868)
      Cleanup: Move member functions defined inside of class definitions of Http2ConnectionState & Http2ConnectionSettings (apache#7854)
      Add URI Signing cdnistd Claim Implementation (apache#7822)
      Adds a new --enable-all-asserts configure option (apache#7858)
      Unifdef test code for MMH and moved it into its own test file (apache#7841)
      Clean up lua plugin doc for overridable configurations (apache#7844)
      Save and propagate epoll network error (apache#7809)
      Add method to write an IpAddr value to a sockaddr. (apache#7821)
      Add proxy.config.http.max_proxy_cycles (apache#7657)
      Update NextHop strategies so that unavailable server retry codes (apache#7837)
      generator: allow for POST requests (apache#7635)
      Fixed double declaration types for log buffer tracking (apache#7847)
      Extra braces for clang 5 / ubuntu 16.04 on array initialization (apache#7842)

     Conflicts:
    	iocore/net/quic/QUICStreamFactory.cc

commit 312cf39
Merge: f90e8dd 5cdc145
Author: Masakazu Kitajo <[email protected]>
Date:   Mon May 17 10:07:42 2021 +0900

    Merge branch 'master' into quic-latest

    * master:
      Get rid of code for OpenSSL that has old QUIC API (apache#7599)
      Fixed warning in gcc 11 about array not being initalized (apache#7840)
      Don't call next next dup on destroyed mime field mloc. (apache#7833)
      build_h3_tools: use OpenSSL_1_1_1k+quic (apache#7836)
      Address assert on captive_action (apache#7807)
      Fix so EOS are delivered to sessions in the pool (apache#7828)
      Fix a format specifier for size_t (apache#7830)
      Fix stall on sending response for request with trailer header (apache#7831)
      Simplification dir_init_done (apache#7817)
      Remove unused member from HttpSM (apache#7835)
      AuTest: use exteneded help output to determin curl feature support (apache#7834)
      Apply fmt compile time argument checking to log functions (apache#7829)
      Adds new X-Cache-Info header to the xdebug plugin (apache#7784)
      Cleanup: Remove unused members of Http2Stream (apache#7813)
      Cleanup: unused functions of Http2ClientSession (apache#7812)
      Cancel cross_thread_event on clear_io_events (apache#7815)
      Cleanup: Remove a meaningless Http2Stream::do_io_close() call (apache#7814)
      Eliminate next dup call using stale mime field mloc is s3_auth plugin. (apache#7825)
      NetEvent cleanup - replace #define with constexpr (apache#7804)
      fix origin session related crashes (apache#7808)
      Update HTTP version info in HostDB on new outbound connection (apache#7816)
      Remove a redundant argument (apache#7811)
      SSL Cert lookup using PP dest ip when ProxyProtocol is enabled (apache#7802)
      Fix MLoc assert caused by s3auth (apache#7790)
      Fix cpu utilization problem in session cache (apache#7719)
      Fix to cookie_remap.cc tp avoid Intel compiler warning. (apache#7792)
      TSHttpTxnCacheDiskPathGet - tighten up the code a bit. (apache#7806)
      Doc: tcpinfo plugin table formatting (apache#7805)
      fix DNS spike issue for TCP_RETRY mode (apache#7307)
      Adds new TS API TSHttpTxnCacheDiskPathGet (apache#7783)
      tests: Fixes spelling (apache#7789)
      Traffic Dump: Add an HTTP/3 AuTest (apache#7758)
      use sendmsg and recvmsg (apache#7793)
      HTTP: clean up the http_hdr_describe format error (apache#7797)
      Fixes an issue where next hop unit tests crash when run on macOS. (apache#7787)
      Apply log throttling to HTTP/2 session error rate messages (apache#7772)
      Cleans up uninitialized warning in LogMessage.cc (apache#7788)
      Short circuit remap reload when a valid remap file is not specified (apache#7782)
      DNS: Clean up argument passing to DNS queries. (apache#7778)
      Remove extra verify-callback (apache#7540)
      Augment test cases for tls_verify_override test (apache#7736)
      Make when_to_revalidate setting available on HTTPS (apache#7753)
      Add traffic_server command line option for debugging in Au test. (apache#7762)
      Test: Update tls_partial_blind_tunnel to have a nameserver. (apache#7773)
      Test: update tls_forward_nonhttp to have a nameserver. (apache#7774)
      Test: add nameserver to log-filter test. (apache#7776)
      BWF: Add support for std::error_code. (apache#7777)
      Test: add nameserver to log-field test. (apache#7779)
      Test: add nameserver to regex_remap test. (apache#7775)
      Elevate privileges for traffic_manager during SSL cert reload (apache#7770)
      Clean up HTTP version processing (apache#7766)
      Remove proxy.config.http.down_server.abort_threshold (apache#7748)
      Remove undocumented keepalive_internal_vc setting (apache#7693)
      doc: header_rewrite random function not inclusive (apache#7760)
      Experimental Cache fill plugin (apache#7470)
      Remove references to removed options (apache#7756)
      Propagate TLS errors (apache#7714)
      AuTest extension: check for unrecognized configurations (apache#7752)
      Fixes errors in the strategies.yaml documentation. (apache#7745)
      Updates to Nexthop strategies to limit the number of simultaneous (apache#7744)
      Fixes Issue apache#7739 - Next hop strategy with bad 'to' URL causes TS crash. (apache#7749)
      header_rewrite: Various fixes for MaxMind support (apache#7746)
      Remove unused variable is_revalidation_necessary (apache#7747)
      Fix simple remapping in regex_remap plugin. (apache#7718)
      Adding DNS TTL AuTests. (apache#7742)
      Add a chunked disabled test. (apache#7743)
      Fix monitor threads in lib records to exit on system shutdown. (apache#7731)
      Add overload for memcpy to take a destination buffer and source string_view / TextView (apache#7732)
      Test: Add nameserver to TLS tunnel forward test. (apache#7733)
      AIO_NOT_IN_PROGRESS should not be 0 (apache#7734)
      if transaction status non-success, bypass intercept plugin (apache#7724)
      ink_utf8_to_latin1 is not defined, removing declaration (apache#7737)
      Fix build on FreeBSD 13 (apache#7730)
      Update VSCode CPP Standard (apache#7723)
      Updating to use Proxy Verifier 2.2.0 (apache#7729)
      header_rewrite: Allow for relative path to geo database files (apache#7727)
      Override proxy.config.ssl.client.sni_policy from sni.yaml (apache#7703)
      compress.test.py: Reference config file from Test.RunDirectory (apache#7725)
      Ran clang-tidy over the code (apache#7708)
      Deny unknown transfer encoding values (apache#7694)
      Fix doc for http2.no_activity_timeout_in (apache#7721)
      Add DynamicStats (apache#7704)
      header_rewrite: allow for use of maxminddb as source of geo truth (apache#7695)
      Include in parentselectdefs.h in install target (apache#7713)
      uri_signing: fix warning which affects ubuntu:20.04 builds (apache#7717)
      Increase the maximum slice block size from 32MB to 128MB (apache#7709)

commit f90e8dd
Author: Masakazu Kitajo <[email protected]>
Date:   Tue Jan 12 12:21:51 2021 +0900

    Add QUICStreamStateListener

commit f66646c
Merge: be9837c 9f9594f
Author: Masakazu Kitajo <[email protected]>
Date:   Sat Apr 17 13:57:50 2021 +0900

    Merge branch 'master' into quic-latest

    * master:
      Fix ALPN support on QUIC connections (apache#7593)
      fix mem leak in session cache (apache#7707)
      Parent Select Plugin (apache#7467)
      Add new TS API function TSUrlRawPortGet. (apache#7568)
      Add NixOS support (apache#7697)
      Remove support for --enable-remote-cov-commit (apache#7700)
      Remove configure-time loopback interface detection (apache#7702)
      Add sqpv log field for server protocol (apache#7680)
      Call do_io_close instead of HTTP2_SESSION_EVENT_FINI handler (apache#7594)
      Fix a bug in tspush that pushes corrupted content to cache (apache#7696)
      Automatically marks PRs and issues stale (apache#7675)
      New rate_limit plugin for simple resource limitations (apache#7623)
      Remove undefined method HttpSM::perform_nca_cache_action (apache#7692)
      Remove undefined method HttpSM::setup_client_header_nca (apache#7691)
      Scalar; Move "tag" struct to be inside the "ts" namespace to avoid collisions. (apache#7690)
      Rollback LAZY_BUF_ALLOC remove in HttpTunnel (apache#7583)
      Add class to normalize handling of pending action (apache#7667)
      Make HTTP/2 Curl AuTest gold files case insensitive (apache#7683)
      Add STL compliant field iteration to MIMEHdr. - rebase. (apache#7476)
      Fix use of -mcx16 flag - only use if it compiles cleanly. (apache#7684)
      Refine connection failure logging and messages and eliminate suprious connection errors (apache#7580)
      Add close header normalize openclose test (apache#7679)
      Fix has_consumer_besides_client to deal with no clients (apache#7685)
      create a new cache status RWW_HIT (apache#7670)
      Updating to AuTest 1.10.0 (apache#7682)
      sslheaders AuTest: Skip if plugin does not exist (apache#7678)
      Add AuTest for Background Fill (apache#7613)
      Do NOT kill tunnel if it has any consumer besides HT_HTTP_CLIENT (apache#7641)
      AuTest: address various permissions issues (apache#7668)
      Adding TCP Info header support to header rewrite (apache#7516)
      Refine Inline.cc carveout for arm64 darwin builds (apache#7662)
      Comment why log eviction isn't implemented via a log field. (apache#7648)
      Fixing Throttler.h for older clang and gcc compilers (apache#7651)
      Update -with-profile and add some profiling documentation (apache#7601)
      Use correct default value for verify.server.policy (apache#7636)
      Update server_response_body_bytes when background fill worked (apache#7621)
      Remove erroneous manager.log mesg with remap include file reload (apache#7646)
      Change ROUNDUP from function-like macro to function template. (apache#7614)
      Document http.default_buffer_water_mark (apache#7612)
      Add proxy.config.cache.log.alternate.eviction (apache#7629)
      Fix HttpSessionManager::acquireSession from previous rebase error (apache#7631)
      Fix tls_client_versions and tls_hooks18 tests (apache#7645)
      Updating documentation for negative_revalidating_lifetime (apache#7633)
      Remove reference to client.verify.server from tests and other bits (apache#7639)
      Add pooled_server_connections metric (apache#7627)
      Expose URL element methods through HTTPHdr (apache#7628)
      Add default implementation for allow_half_open (apache#7630)
      Add thread yeield to avoid busy waiting in LogObject::_checkout_write(). (apache#7576)
      Add proxy.process.http.background_fill_total_count (apache#7625)
      statichit: misc. fixes (apache#7634)
      Remove unused variables (apache#7626)
      Adding negative revalidating AuTests. (apache#7620)
      Add failed state to hostdb to better track failing origins (apache#7291)
      Use standard isdigit library function (apache#7619)
      Typo in output when forcing kqueue for configure (apache#7617)
      Implement log throttling (apache#7279)
      Increase Proxy Verifier caching delay. (apache#7616)
      Set pcre_malloc/free function pointers in core main() only. (apache#7608)

commit be9837c
Merge: 99ff68f d4fc16f
Author: Masakazu Kitajo <[email protected]>
Date:   Wed Mar 17 09:38:59 2021 +0900

    Merge branch 'master' into quic-latest

    * master:
      Fix the connection limit crash while using parents (apache#7604)
      Remove inline for detail::cache::CacheData::idAddr (apache#7592)
      Remove UnixNetVConnection::startEvent - not actually called. (apache#7596)
      Use return values to fix ubuntu release build error (apache#7591)
      Fix double destuct on Http2Stream termination (apache#7600)
      Add pointer/reference upcast function that is checked in debug builds. (apache#7582)
      Call constructors and destructors for H1/2 Session/Transaction via ClassAllocator (apache#7584)
      Add gold test for remap config .include directive. (apache#7589)
      Change the default value for verify.server.policy (apache#7587)
      Build the test library for tls_engine consistently (apache#7588)
      Generalize ALPN logic (apache#7555)
      Fix the final consumer write size from unchunked to chunked tunnel (apache#7577)
      Reactivate accept_no_activity_timeout (apache#7408)
      Tidy up session/transaction destruction process (apache#7571)
      Remove ProxyTransaction::set_proxy_ssn (apache#7567)
      Introduce TLSBasicSupport interface (apache#7556)
      Cleanup: Rename IOBufferReader of Http2ClientSession (apache#7569)
      Add a check for compress response, if from server and 304, then check cache for headers instead of the 304 response (apache#7564)
      Updates the STATUS file with all recent releases (apache#7566)
      Make Allocator.h less silly (no creepy "proto" object). (apache#6241)
      Cleanup: Remove unused member of Http2ClientSession (apache#7570)
      enable origin server session cache by default (apache#7537)
      Add tscontdestroy when transaction is closed and pacing rate is reset (apache#7572)
      Remove reference to CoreUtils (apache#7557)
      Remove unused enums from YamlSNIConfig struct. (apache#7565)
      Removes deprecated sni.yaml option: disable_h2 (apache#7547)
      This PR updates parent selection to limit the number of simultaneous (apache#7485)
      Fix KA header not checking strategy (apache#7483)
      Get rid of kruft LogObject copy constructor. (apache#7553)
      For TSHttpHdrEffectiveUrlBufGet(), include scheme for request to server URL. (apache#7545)
      Adding lower_ support to stats and bonding_slave data points for port status (apache#7560)
      Change cookie_remap plugin to allow use of pre-remap URL (and components). (apache#7519)
      check verify policy and properties (apache#7559)
      Fix parent.config to 504 not 502 on timeout (apache#7558)
      use SSL_CTX address as part of the lookup key (apache#7552)
      Add ALPN support on TLS Partial Blind Tunnel (apache#7511)
      Add server_name option to proxy.config.ssl.client.sni_policy (apache#7533)
      Fix a crash on origin session reuse (apache#7543)
      Removes the test plugins from the .spec file / RPM (apache#7551)
      Convert the inactive_client_timeout test to use Proxy Verifier (apache#7535)
      Fix ja3_fingerprint configure syntax (apache#7550)
      Fix asserts in multiplexer plugin. (apache#7532)
      parse expiration time and reload config at time out (apache#7281)
      Fix origin_session_reuse test (apache#7542)
      Fix tls_session_reuse test (apache#7541)
      Split SSL_CTX initialization logic into small functions (apache#7434)
      Remove dependency for SSL stuff from P_Net.h (apache#7531)
      Unify all the connect timeouts into one (apache#7335)
      Fix lua_states_stats Au test. (apache#7232)
      origin session reuse (apache#7479)
      Updating to use Proxy Verifier 2.1.0 (apache#7534)
      update the session reuse tests (apache#7529)

commit 99ff68f
Author: Masakazu Kitajo <[email protected]>
Date:   Wed Feb 17 11:14:40 2021 +0900

    Fix link error

commit c4ad0c0
Merge: c40d95a cd33010
Author: Masakazu Kitajo <[email protected]>
Date:   Wed Feb 17 09:56:25 2021 +0900

    Merge branch 'master' into quic-latest

    * master:
      Select lua context per thread (apache#7465)
      Fix out of bounds access error in jtest (apache#7526)
      Disable compiling Inline.cc on macOS (apache#7389)
      Makes sure the types are correct, avoiding compiler warnings (apache#7523)
      Move has_request_body to ProxyTransaction (apache#7499)
      Make the H3 build script work properly on Debian platforms (apache#7522)
      slice/handleFirstServerHeader: return sooner on requested range errors (apache#7486)
      Add new log field for negotiated ALPN Protocol ID with the client (apache#7491)
      Add Outbound PROXY Protocol (v1/v2) Support (apache#7446)
      Updates the Dockerfile for debian (apache#7518)
      Disable client inactivity timeout while server is processing POST request (apache#7309)
      Upgrade Catch.hpp to v2.13.4 (apache#7464)
      Move reopen_moved_log_files to log flushing thread (apache#7450)
      replace psutil.pid() with psutil.process_iter() for safer execution (apache#7515)
      Fix spacing in clang-analyzer.sh script (apache#7480)
      Fix out of bounds access error in ats_base64_decode (apache#7490)
      Updated to build lastest versions of Fedora and CentOS docker images (apache#7505)
      Fix QUIC unit tests build issue on GNU ld (apache#7496)
      Fix QUIC unit test failures (apache#7497)
      Fixed build issues with Fedora 34 (apache#7506)
      Fixing DNS local_ipv* config option (apache#7507)
      traffic_dump: AuTests to use Proxy Verifier. (apache#7502)
      Disable ja3 plugin when building with boringssl (apache#7500)
      Avoid -Warray-bounds on PROXY Protocol Builder (apache#7488)
      AuTest: Upgrade to Proxy Verifier 2.0.2 (apache#7493)
      fix certs (apache#7494)
      Add zlib1g-dev to Debian dependencies in README (apache#7495)
      Unit Test -  Increase openssl's key size. Place test certs into a common test folder. (apache#7451)
      Add basic type aliases for std::chrono types to ink_time.h for future use. (apache#7482)
      traffic_ctl - Fix lookup key for run-root option (apache#7484)
      update thread config tests (apache#7370)
      Perf: Replace casecmp with memcmp in HPACK static table lookup (apache#6521)
      Add PROXY Protocol Builder (apache#7445)
      Adjust so transfer-encoding header can be treated hop-by-hop (apache#7473)
      Convert auxkey form 2 uint32_t to 1 uint64_t. (apache#7350)
      Remove the queuing option from proxy.config.http.per_server.connection (apache#7302)
      Remove unused function ink_microseconds. (apache#7481)
      use std::unordered_map to store sessions (apache#7405)
      drop use of BIO_f_base64 and EVP_PKEY_new_mac_key (apache#7106)
      Do not write to the cache if the plugin decides not to write to the cache (apache#7461)
      API to retrieve NoStore set by plugins (apache#7439)
      Update AuTest version update directions for pipenv (apache#7469)
      Add command line utility to help convert remap plugin usage to ATS9. (apache#7426)
      Cleanup: Get rid of MIMEFieldWrapper from HPACK encoding (apache#6520)
      Proxy Verifier: Making use of delay directives for caching tests. (apache#7468)
      Cleanup: Add SNIRoutingType (apache#7453)
      Updating to Proxy Verifier v2.0.0 (apache#7454)
      Adjust to actually try a server address more than once (apache#7288)
      Change atoi to atol, causing obvious issues on what needs to be int64's (apache#7466)
      Cleans up duplicated TSOutboundConnectionMatchType definition (apache#7090)
      Fixing compress expectation for new microserver (apache#7463)
      Update to the new MicroServer 1.0.6 release (apache#7460)
      CacheRead: clear dir entry if doc is found to be truncated (apache#7064)
      Do not provide a stale negative cache (apache#7422)
      Generalize SNI support (apache#6870)
      Add synchronization between UDPNetProcessor::UDPBind in main Thread and initialize_thread_for_udp_net in ET_UDP Thread (apache#7407)
      Fix heap use after free in DNSProcessor::getby() (apache#3871)
      Fix comment in include/tscore/Filenames.h. (apache#7457)
      Fix Makefile target for creating changelogs (apache#7455)
      Change squid log code for self looping (apache#7443)
      Enhancements for compress plugin (apache#7416)
      Add incoming PROXY Protocol v2 support (apache#7340)
      Cleanup: Remove unused members of NextHopProperty (apache#7436)
      Small fix to regex_remap PR # 7347. (apache#7437)
      PoolableSession (apache#6828)
      option to disable compression for range request's response (apache#7287)
      Make TSUrlSchemeGet() return scheme implied by URL type when there is no explicit scheme. (apache#7262)

commit c40d95a
Merge: 573035c ecd70df
Author: Masakazu Kitajo <[email protected]>
Date:   Wed Jan 20 09:39:34 2021 +0900

    Merge branch 'master' into quic-latest

    * master:
      Fix a link error on traffi_quic command (apache#7433)
      Fix stall on outbound TLS handshake (apache#7432)
      Fix the Proxy Verifier AuTest extension to handle cert paths correctly (apache#7415)
      Update documentation for TSSslSessionInsert (apache#7420)
      Improve zlib detection logic (apache#7430)
      Fix parent connect fail segfault (apache#7429)

commit 573035c
Merge: 5704095 95b8d57
Author: Masakazu Kitajo <[email protected]>
Date:   Fri Jan 15 23:24:29 2021 +0900

    Merge branch 'master' into quic-latest

    * master:
      Doc: Fix typo in negative_revalidating_lifetime (apache#7427)
      Change comment handling for long lines in url_sig plugin (apache#7421)
      Add unit tests for PROXY Protocol v1 parser (apache#7332)
      LGTM: Remove superfluous const qualifier in return type (apache#7412)
      Fix issue with unavailable server retry codes (apache#7410)
      Remove the warning statement (apache#7414)
      default to throttling and subsequently simplify the transfer code (apache#7257)
      Improvement to lua plugin (apache#7413)
      Make places to bind/unbind SSL object with/from NetVC (apache#7399)
      traffic_ctl - plugin msg  now require only the tag as mandatory field data field is now optional. (apache#7364)
      API - Add new api function TSHttpTxnServerSsnTransactionCount() to retrieve the number of transactions between TS proxy and the origin server from a single session. (apache#7387)
      Fix clang compiler complaint about an unused parameter in SNIAction. (apache#7409)
      Add compression support to stats_over_http (apache#7393)
      Doc: Fix INPUT tag of Doxyfile (apache#7404)
      Remove unneeded variables in UnixNetVConnection (apache#7403)
      Correctly pass back errno to HttpSM (apache#7402)
      Reverting to old negative_caching conditional behavior (apache#7401)
      Remove unused MAYBE_ABORT state (apache#7400)
      traffic_manager should not retry on disk failure (apache#7397)
      Eliminate dangling pointer into stack space. (apache#7392)
      This PR aims to address some of the lock contention found and (apache#7377)
      Remove a special treatment for SSLNetVC in migrateToCurrentThread() (apache#7384)
      Replace ::exit() with _exit() to avoid secondary cleanup cores (apache#7395)
      [Doc] Fix build warnings (apache#7391)
      Clear call_sm on tunnel reset (apache#7352)
      Unused code: HostDBContinuation::removeEvent (apache#7383)
      Traffic Dump: Fix stream-id printing after first transaction. (apache#7311)
      Add comments to ink_queue.h. (apache#7376)
      Cleanup incoming PROXY Protocol v1 (apache#7331)
      In CI, only run autopep8 on branches that enforce autopep8 (apache#7270)
      Fix FreeBSD 12 link issue in test_libhttp2. (apache#7367)
      Adjust flags to ensure tunnel producer is cleaned up (apache#7336)
      Cleanup: Remove SSL Wire Trace releated code in UnixNetVConnection (apache#7368)
      Use EVP MAC API if available (apache#7363)
      Use EVP API instead of MD5_Init/Update/Final (secure_link plugin) (apache#7355)
      Use ERR_get_error_all if available (apache#7354)
      Use OpeSSL EVP API instead of SHA256_Init/Update/Final (apache#7342)
      Cleanup: Get rid of NetVConnection::outstanding() (apache#7366)
      Cleanup: Remove unused functions (apache#7365)
      Add a post case to the conn_timeout test (apache#7334)
      Fix sni ip_allow and host_sni_policy (apache#7349)
      AuTest for Split DNS (apache#7325)
      Make reloading client certificate configuration more reliable (apache#7313)
      Add negative caching tests and fixes. (apache#7361)
      ESI: Ensure gzip header is always initialized (apache#7360)
      Allow for regex_remap of pristine URL. (apache#7347)
      Set thread mutex to the DNSHandler mutex of SplitDNS (apache#7321)
      Fix lookup split dns rule with fast path (apache#7320)
      Add note to background fetch about include/exclude (apache#7343)
      AuTest for incoming PROXY Protocol v1 (apache#7326)
      Fix vc close migration race condition (apache#7337)
      TLS Session Reuse: Downgrade add_session messages to debug (apache#7345)
      TLS Session Reuse: Downgrade noisy log to debug (apache#7344)
      Remove the last remnants of the enable_url_expandomatic (apache#7276)
      Remove unnecessary cast from ReverseProxy. (apache#7329)
      Updates the Dockerfile with more packages (apache#7323)
      fixup in HttpSM to only set [TS_MILESTONE_SERVER_CLOSE if TS_MILESTONE_SERVER_CONNECT has been set (apache#7259)
      Add option for hybrid global and thread session pools (apache#6978)
      Get appropriate locks on SSN_START hook delays (apache#7295)
      s3_auth: demote noisy errors around configuration that doesn't affect plugin usability (apache#7306)
      Follow the comments in I_Thread.h, add an independent ink_thread_key for EThread. (apache#6288)
      Reduce the number of write operation on H2 (apache#7282)

commit 5704095
Merge: 882a79d 0c88b24
Author: Masakazu Kitajo <[email protected]>
Date:   Wed Oct 28 21:06:11 2020 +0900

    Merge branch 'master' into quic-latest

    * master:
      Adds a shell script to help build the H3 toolchains (apache#7299)
      Remove unfinished h2c support (apache#7286)
      Allow disabling SO_MARK and IP_TOS usage (apache#7292)
      Enable all h2spec test (apache#7289)
      Fix bad HTTP/2 post client causing stuck HttpSM (apache#7237)
      Sticky server does not work with H2 client (apache#7261)
      7096: Synchronize Server Session Management and Network I/O (apache#7278)
      HostDB: remove unused field in HostDBApplicationInfo, and update remaining types in http_data to fix broken padding. (apache#7264)
      Add support for a new (TSMgmtDataTypeGet) mgmt API function to retrieve the record data type (apache#7221)
      Fix example in default sni.yaml configuration. (apache#7277)
      Fix proxy.process.http.current_client_transactions (apache#7258)
      Add AuTest for HTTP/2 Graceful Shutdown (apache#7271)
      Fix truncated reponse on HTTP/2 graceful shutdown (apache#7267)
      url_sig add 'ignore_expiry = true' option for log replay testing (apache#7231)
      Respecting default rolling_enabled in plugins. (apache#7275)
      gracefully handle TSReleaseAsserts in statichit and generator plugins (apache#7269)
      Removes commented out code from esi plugin (apache#7273)
      Allow initial // in request targets. (apache#7266)
      Document external log rotation support via SIGUSR2 (apache#7265)
      Let Dedicated EThreads use `EThread::schedule` (apache#7228)
      HostDB: Fix cache data version checking to use full version, not major version. (apache#7263)
      Bugfix: set a default inactivity timeout only if a read or write I/O operation was set (apache#7226)
      Treat objects with negative max-age CC directives as stale. (apache#7260)
      Remove some usless defines, which just obsfucates code (apache#7252)
      Remove useless if for port set assertion. (apache#7250)
      Fix test_error_page_selection memory leaks and logic errors (apache#7248)
      [multiplexer] option to skip post/put requests (apache#7233)
      Incorporates the latest CI build changes (apache#7251)
      Add support for server protocol stack API (apache#7239)
      Fix for plugins ASAN suppression file (apache#7249)
      RolledLogDeleter: do not sort on each candidate consideration. (apache#7243)
      Make double Au test more reliable. (apache#7216)
      Ensure that ca override does not get lost (apache#7219)
      Stop crash on disk failure (apache#7218)
      Do not cache Transfer-Encoding header (apache#7234)
      clean up body factory tests (apache#7236)
      Revert "Create an explicit runroot.yaml for AuTests (apache#7177)" (apache#7235)
      New option to dead server to not retry during dead period (apache#7142)
      Increment ssl_error_syscall only if not EOF (apache#7225)
      Fix renamed setting in default config (apache#7224)
      Log config reload: use new config for initialization (apache#7215)
      Introduce proxy-verifier to AuTests (apache#7211)
      Follow redirection responses when refreshing stale cache objects. (apache#7213)
      Create an explicit runroot.yaml for AuTests (apache#7177)
      Support external log rotation tools via SIGUSR2 (apache#6806)
      Add support for TS API for Note, Status, Warning, Alert (apache#7208)
      If the weight is 0, the SRV record should be selected from the highest priority group (apache#7206)
      Cleanup: remove unnecessary memset() within dns_process() (apache#7209)
      Docs cleanup (apache#7210)
      Strip whitespaces after field-name and before the colon in headers from the origin (apache#7202)
      Adds new plugin: statichit (apache#7173)
      Add duplicate header field processing when creating outgoing response (apache#7207)

commit 882a79d
Merge: 2a9887f bb5c390
Author: Masakazu Kitajo <[email protected]>
Date:   Fri Sep 18 10:01:14 2020 +0900

    Merge branch 'master' into quic-latest

    * master:
      Rename ambiguous log variable (apache#7199)
      KWF useless member function HttpSM::kill_this_async_hook(). (apache#7198)
      Fix the active_timeout test to work without quic enabled (apache#7197)
      Remove obsolete cdn_ HttpTransact vars (apache#7182)
      Remove unused HttpUpdate mechanism (apache#7194)
      Updates the list of supported / linked Docs versions (apache#7152)
      Make custom xdebug HTTP header name available to other plugins. (apache#7193)
      Update sni outbound policy to allow directly setting the outbound SNI. (apache#7188)

commit 2a9887f
Author: Masakazu Kitajo <[email protected]>
Date:   Wed Sep 16 17:54:01 2020 +0900

    Avoid unnecessary QUIC CID randomization

commit 42e8898
Author: Masakazu Kitajo <[email protected]>
Date:   Tue Sep 15 12:41:28 2020 +0900

    Simplify interface between H3 and QUIC, and remove memcopy between them

commit 112fc71
Merge: ac31ada b090964
Author: Masakazu Kitajo <[email protected]>
Date:   Tue Sep 15 09:21:25 2020 +0900

    Merge branch 'master' into quic-latest

    * master:
      Add an autest testcase for HTTP3 (apache#7063)
      Fix TSHttpTxnServerPacket* API's to correctly update existing server connections (apache#7175)
      Do not lose original inactivity timeout on disable (apache#7134)
      Emits log when OCSP fails to connect to server (apache#7183)
      autopep8: avoid running on non-tracked files. (apache#7186)
      TextView: Add additional constructor tests. (apache#7189)
      Remove duplicate code (apache#7180)
      TextView: add constructor size values to enable strlen even for null pointers. (apache#7185)
      Add virtual destructor to QUICRTTProvider. (apache#7184)
      AuTest: Reuse venv if it exists already (apache#7178)
      TS_API for Note,Status,Warning,Alert,Fatal (apache#7181)
      Traffic Dump: Record HTTP/2 priority. (apache#7149)
      leaks in logs (apache#7172)
      Additions to enable loading qat_engine (apache#7150)
      Removes references to non-existent function handle_conditional_headers (apache#7162)
      Fix apache#7164 Chaning Warning to Debug and creating a stat for inserting duplicates to pending dns (apache#7166)
      Fix apache#7167, make autopep8 failure (apache#7168)
      MicroDNS Extension: handle different 'default' types (apache#7159)
      Traffic Dump documentation for post_process.py (apache#7161)
      Fix memory leaks in multiplexer plugin (apache#7160)
      rc: fixes systemd unit file stopping (apache#7157)
      Fix lua plugin mem leak problem (apache#7158)
      Don't make an error on duplicated RETIRE_CONNECTION frames (apache#7131)
      URL::parse fixes for empty paths (apache#7119)
      Replace ACTION_RESULT_NONE with nullptr (apache#7135)
      Add metric tracking async job pauses (apache#7153)
      PluginFactory - Remove unused code that was left from last PluginFactory change(TSPluginDSOReloadEnable) (apache#7155)
      Fix stale pointer due to SSL config reload (apache#7148)
      slice: check if vio is still valid before calling TSVIODone* on shutdown (apache#7147)
      Deprecate cqhv field (apache#7143)
      Don't return QUIC frame if the size exceeds maximum frame size (apache#7121)
      Check VIO availability before acquiring a lock for it (apache#7145)
      Fix apache#7116, skip the insertion of the same continuation to pending dns (apache#7117)
      Allow override of CA certs for cert from client based on SNI server name sent by client. (apache#7130)
      Fix typo in cache docs (apache#7144)
      remove useless shortopt (apache#7138)
      Protect TSActionCancel from null INKContInternal actions (apache#7128)
      Check VIO availability before checking whether the VIO has data (apache#7120)
      Accept NAT rebinding on a QUIC connection (apache#7123)
      Fixes garbled logs when using %<vbn> log tag (apache#7140)
      Removes duplicated listing of files in same Makefile target (apache#7137)
      Updated gdb mutex script to get process file for Fedora 32 (apache#7133)
      SSLConfig mem leak fix (apache#7125)
      Replaces "smart" quotes with ASCII equivalents (apache#7126)
      Comment out a wrong assertion in QUIC Loss Detection logic (apache#7129)
      Add member initialization to the Errata class. (apache#7132)
      Cancel active/inactive timeout on closing Http2Stream (apache#7111)
      Add modsecurity lua script to example (apache#7105)
      Expose remap config file callback (apache#7073)
      Make tls_hooks tests more likely to pass (apache#7122)

commit ac31ada
Merge: 4d579f4 e904dbc
Author: Masakazu Kitajo <[email protected]>
Date:   Mon Aug 17 09:14:14 2020 +0900

    Merge branch 'master' into quic-latest

    * master:
      Backing out my update of our jenkin's autest file. (apache#7118)
      Don't send image/webp responses from cache to broswers that don't support it (apache#7104)
      Updating our autest suite to require Python3.6 (apache#7113)
      Squashed commit of the following: (apache#7110)
      Supporting out of source builds for AuTests. (apache#7109)
      Fixes uninitialized variables found by Xcode (apache#7100)
      Add cross references between server session sharing match and upstream connection tracking match. (apache#7038)
  • Loading branch information
maskit committed Jun 29, 2021
1 parent 2edeae4 commit ee2ee83
Show file tree
Hide file tree
Showing 53 changed files with 2,003 additions and 1,905 deletions.
3 changes: 3 additions & 0 deletions iocore/net/quic/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ libquic_a_SOURCES = \
QUICNewRenoCongestionController.cc \
QUICFlowController.cc \
QUICStreamState.cc \
QUICStreamAdapter.cc \
QUICStreamVCAdapter.cc \
QUICStream.cc \
QUICHandshake.cc \
QUICPacketHeaderProtector.cc \
Expand Down Expand Up @@ -92,6 +94,7 @@ libquic_a_SOURCES = \
QUICFrameGenerator.cc \
QUICFrameRetransmitter.cc \
QUICAddrVerifyState.cc \
QUICTransferProgressProvider.cc \
QUICBidirectionalStream.cc \
QUICCryptoStream.cc \
QUICUnidirectionalStream.cc \
Expand Down
90 changes: 85 additions & 5 deletions iocore/net/quic/Mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "QUICPinger.h"
#include "QUICPadder.h"
#include "QUICHandshakeProtocol.h"
#include "QUICStreamAdapter.h"

class MockQUICContext;

Expand Down Expand Up @@ -717,6 +718,76 @@ class MockQUICLossDetector : public QUICLossDetector
MockQUICCongestionController _cc;
};

class MockQUICStreamAdapter : public QUICStreamAdapter
{
public:
MockQUICStreamAdapter(QUICStream &stream) : QUICStreamAdapter(stream) {}

void
write_to_stream(const uint8_t *buf, size_t len)
{
this->_total_sending_data_len += len;
this->_sending_data_len += len;
}

int64_t
write(QUICOffset offset, const uint8_t *data, uint64_t data_length, bool fin) override
{
this->_total_receiving_data_len += data_length;
this->_receiving_data_len += data_length;
return data_length;
}
bool
is_eos() override
{
return false;
}
uint64_t
unread_len() override
{
return this->_sending_data_len;
}
uint64_t
read_len() override
{
return 0;
}
uint64_t
total_len() override
{
return this->_total_sending_data_len;
}
void
encourge_read() override
{
}
void
encourge_write() override
{
}
void
notify_eos() override
{
}

protected:
Ptr<IOBufferBlock>
_read(size_t len) override
{
this->_sending_data_len -= len;
Ptr<IOBufferBlock> block = make_ptr<IOBufferBlock>(new_IOBufferBlock());
block->alloc(iobuffer_size_to_index(len, BUFFER_SIZE_INDEX_32K));
block->fill(len);
return block;
}

private:
size_t _sending_data_len = 0;
size_t _total_sending_data_len = 0;
size_t _receiving_data_len = 0;
size_t _total_receiving_data_len = 0;
};

class MockQUICApplication : public QUICApplication
{
public:
Expand All @@ -726,20 +797,29 @@ class MockQUICApplication : public QUICApplication
main_event_handler(int event, Event *data)
{
if (event == 12345) {
QUICStreamIO *stream_io = static_cast<QUICStreamIO *>(data->cookie);
stream_io->write_reenable();
}
return EVENT_CONT;
}

void
on_new_stream(QUICStream &stream) override
{
auto ite = this->_streams.emplace(stream.id(), stream);
QUICStreamAdapter &adapter = ite.first->second;
stream.set_io_adapter(&adapter);
}

void
send(const uint8_t *data, size_t size, QUICStreamId stream_id)
{
QUICStreamIO *stream_io = this->_find_stream_io(stream_id);
stream_io->write(data, size);
auto ite = this->_streams.find(stream_id);
auto &adapter = ite->second;
adapter.write_to_stream(data, size);

eventProcessor.schedule_imm(this, ET_CALL, 12345, stream_io);
// eventProcessor.schedule_imm(this, ET_CALL, 12345, adapter);
}

std::unordered_map<QUICStreamId, MockQUICStreamAdapter> _streams;
};

class MockQUICPacketR : public QUICPacketR
Expand Down
248 changes: 1 addition & 247 deletions iocore/net/quic/QUICApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,172 +24,6 @@
#include "QUICApplication.h"
#include "QUICStream.h"

static constexpr char tag_stream_io[] = "quic_stream_io";
static constexpr char tag_app[] = "quic_app";

#define QUICStreamIODebug(fmt, ...) \
Debug(tag_stream_io, "[%s] [%" PRIu64 "] " fmt, this->_stream_vc->connection_info()->cids().data(), this->_stream_vc->id(), \
##__VA_ARGS__)

//
// QUICStreamIO
//
QUICStreamIO::QUICStreamIO(QUICApplication *app, QUICStreamVConnection *stream_vc) : _stream_vc(stream_vc)
{
this->_read_buffer = new_MIOBuffer(BUFFER_SIZE_INDEX_8K);
this->_write_buffer = new_MIOBuffer(BUFFER_SIZE_INDEX_8K);

this->_read_buffer_reader = this->_read_buffer->alloc_reader();
this->_write_buffer_reader = this->_write_buffer->alloc_reader();

switch (stream_vc->direction()) {
case QUICStreamDirection::BIDIRECTIONAL:
this->_read_vio = stream_vc->do_io_read(app, INT64_MAX, this->_read_buffer);
this->_write_vio = stream_vc->do_io_write(app, INT64_MAX, this->_write_buffer_reader);
break;
case QUICStreamDirection::SEND:
this->_write_vio = stream_vc->do_io_write(app, INT64_MAX, this->_write_buffer_reader);
break;
case QUICStreamDirection::RECEIVE:
this->_read_vio = stream_vc->do_io_read(app, INT64_MAX, this->_read_buffer);
break;
default:
ink_assert(false);
break;
}
}

QUICStreamIO::~QUICStreamIO()
{
// All readers will be deallocated
free_MIOBuffer(this->_read_buffer);
free_MIOBuffer(this->_write_buffer);
};

uint32_t
QUICStreamIO::stream_id() const
{
return this->_stream_vc->id();
}

bool
QUICStreamIO::is_bidirectional() const
{
return this->_stream_vc->is_bidirectional();
}

int64_t
QUICStreamIO::read(uint8_t *buf, int64_t len)
{
if (is_debug_tag_set(tag_stream_io)) {
if (this->_read_vio->nbytes == INT64_MAX) {
QUICStreamIODebug("nbytes=- ndone=%" PRId64 " read_avail=%" PRId64 " read_len=%" PRId64, this->_read_vio->ndone,
this->_read_buffer_reader->read_avail(), len);
} else {
QUICStreamIODebug("nbytes=%" PRId64 " ndone=%" PRId64 " read_avail=%" PRId64 " read_len=%" PRId64, this->_read_vio->nbytes,
this->_read_vio->ndone, this->_read_buffer_reader->read_avail(), len);
}
}

int64_t nread = this->_read_buffer_reader->read(buf, len);
if (nread > 0) {
this->_read_vio->ndone += nread;
}

this->_stream_vc->on_read();

return nread;
}

int64_t
QUICStreamIO::peek(uint8_t *buf, int64_t len)
{
return this->_read_buffer_reader->memcpy(buf, len) - reinterpret_cast<char *>(buf);
}

void
QUICStreamIO::consume(int64_t len)
{
this->_read_buffer_reader->consume(len);
this->_stream_vc->on_read();
}

bool
QUICStreamIO::is_read_done() const
{
return this->_read_vio->ntodo() == 0;
}

int64_t
QUICStreamIO::write(const uint8_t *buf, int64_t len)
{
SCOPED_MUTEX_LOCK(lock, this->_write_vio->mutex, this_ethread());

int64_t nwritten = this->_write_buffer->write(buf, len);
if (nwritten > 0) {
this->_nwritten += nwritten;
}

return len;
}

int64_t
QUICStreamIO::write(IOBufferReader *r, int64_t len)
{
SCOPED_MUTEX_LOCK(lock, this->_write_vio->mutex, this_ethread());

int64_t bytes_avail = this->_write_buffer->write_avail();

if (bytes_avail > 0) {
if (is_debug_tag_set(tag_stream_io)) {
if (this->_write_vio->nbytes == INT64_MAX) {
QUICStreamIODebug("nbytes=- ndone=%" PRId64 " write_avail=%" PRId64 " write_len=%" PRId64, this->_write_vio->ndone,
bytes_avail, len);
} else {
QUICStreamIODebug("nbytes=%" PRId64 " ndone=%" PRId64 " write_avail=%" PRId64 " write_len=%" PRId64,
this->_write_vio->nbytes, this->_write_vio->ndone, bytes_avail, len);
}
}

int64_t bytes_len = std::min(bytes_avail, len);
int64_t nwritten = this->_write_buffer->write(r, bytes_len);

if (nwritten > 0) {
this->_nwritten += nwritten;
}

return nwritten;
} else {
return 0;
}
}

// TODO: Similar to other "write" apis, but do not copy.
int64_t
QUICStreamIO::write(IOBufferBlock *b)
{
ink_assert(!"not implemented yet");
return 0;
}

void
QUICStreamIO::write_done()
{
this->_write_vio->nbytes = this->_nwritten;
}

void
QUICStreamIO::read_reenable()
{
return this->_read_vio->reenable();
}

void
QUICStreamIO::write_reenable()
{
return this->_write_vio->reenable();
}

//
// QUICApplication
//
Expand All @@ -198,84 +32,4 @@ QUICApplication::QUICApplication(QUICConnection *qc) : Continuation(new_ProxyMut
this->_qc = qc;
}

QUICApplication::~QUICApplication()
{
for (auto const &kv : this->_stream_map) {
delete kv.second;
}
}

// @brief Bind stream and application
void
QUICApplication::set_stream(QUICStreamVConnection *stream_vc, QUICStreamIO *stream_io)
{
if (stream_io == nullptr) {
stream_io = new QUICStreamIO(this, stream_vc);
}
this->_stream_map.insert(std::make_pair(stream_vc->id(), stream_io));
}

// @brief Bind stream and application
void
QUICApplication::set_stream(QUICStreamIO *stream_io)
{
this->_stream_map.insert(std::make_pair(stream_io->stream_id(), stream_io));
}

bool
QUICApplication::is_stream_set(QUICStreamVConnection *stream)
{
auto result = this->_stream_map.find(stream->id());

return result != this->_stream_map.end();
}

void
QUICApplication::reenable(QUICStreamVConnection *stream)
{
QUICStreamIO *stream_io = this->_find_stream_io(stream->id());
if (stream_io) {
stream_io->read_reenable();
stream_io->write_reenable();
} else {
Debug(tag_app, "[%s] Unknown Stream id=%" PRIx64, this->_qc->cids().data(), stream->id());
}

return;
}

void
QUICApplication::unset_stream(QUICStreamVConnection *stream)
{
QUICStreamIO *stream_io = this->_find_stream_io(stream->id());
if (stream_io) {
this->_stream_map.erase(stream->id());
}
}

QUICStreamIO *
QUICApplication::_find_stream_io(QUICStreamId id)
{
auto result = this->_stream_map.find(id);

if (result == this->_stream_map.end()) {
return nullptr;
} else {
return result->second;
}
}

QUICStreamIO *
QUICApplication::_find_stream_io(VIO *vio)
{
if (vio == nullptr) {
return nullptr;
}

QUICStream *stream = dynamic_cast<QUICStream *>(vio->vc_server);
if (stream == nullptr) {
return nullptr;
}

return this->_find_stream_io(stream->id());
}
QUICApplication::~QUICApplication() {}
Loading

0 comments on commit ee2ee83

Please sign in to comment.