Skip to content

Releases

3.14.5

Choose a tag to compare

@github-actions github-actions released this 11 Oct 00:56
v3.14.5
f17c631

Bug fixes

  • Stopped failing the WebSocket connection when a control frame has RSV1 set after permessage-deflate was negotiated; some clients set the bit on every frame and control frames are never decompressed -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #14007.

Contributor-facing changes

  • Changed two client tests to pass with a yarl that rejects an http URL
    with an empty host, such as http://, and writes http:/ without the
    // it used to add
    -- by :user:asvetlov.

    Related issues and pull requests on GitHub:
    #13964.


3.14.4

Choose a tag to compare

@github-actions github-actions released this 05 Oct 17:34
0c5e5e1

Features

  • Added :class:aiohttp.UploadTracker for observing a client request's upload progress -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13579.

  • Switched application/x-www-form-urlencoded parsing in
    :meth:~aiohttp.web.BaseRequest.post to the faster :func:yarl.query_to_pairs
    parser and added the client_max_fields argument to
    :class:~aiohttp.web.Application (default 1000) to cap the number of form
    fields accepted by :meth:~aiohttp.web.BaseRequest.post. Forms with more
    than 1000 fields now receive a 413 response unless the cap is raised;
    0 disables it -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #13738.

  • Added constants to aiohttp.hdrs for widely used headers: those that
    browsers send on every request (Sec-Fetch-*, Sec-CH-UA*,
    Sec-GPC, Upgrade-Insecure-Requests, Priority), W3C trace context
    (traceparent, tracestate, baggage), response security, reporting
    and caching headers, the remaining RFC 9110 and RFC 9530 fields,
    Content-ID and common de facto proxy and application headers, and
    grouped the constants by where the header is defined. The C parser returns
    these names as the shared :class:~multidict.istr constants instead of new
    :class:str objects, which made parsing a typical browser request about
    9% cheaper -- by :user:asvetlov.

    Related issues and pull requests on GitHub:
    #13886.

Bug fixes

  • Remove overlapping slots in RequestHandler,
    fix broken slots inheritance in :py:class:~aiohttp.web.StreamResponse.

    Related issues and pull requests on GitHub:
    #6547.

  • Fixed a segmentation fault in the C HTTP parser on Python 3.12 and newer when payload decompression raised an error while pending decompressed data was being drained, as seen with brotlicffi 1.2 -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #13203, #13249.

  • Rejected control characters in the request target in the pure-Python HTTP parser,
    matching the llhttp-backed parser, which already refuses them
    -- by :user:arshsmith1.

    Related issues and pull requests on GitHub:
    #13212.

  • Stripped the trailing whitespace from header values in the C HTTP parser,
    so that it matches the pure-Python parser and :rfc:9110#section-5.5
    -- by :user:LuShadowX.

    Related issues and pull requests on GitHub:
    #13246.

  • Fixed the WebSocket reader rejecting a compressed data frame with close code 1002 when a control frame arrived before the first data frame (regression in 3.14.2) -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13274.

  • Fixed internally retried requests sending a truncated body when the request
    data was a file object.

    Related issues and pull requests on GitHub:
    #13329, #13330.

  • Fixed event loop state possibly being corrupted on Python 3.12+ -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13346.

  • Fixed the HTTP parser raising :exc:~aiohttp.ClientPayloadError when a fully received Content-Length body was pending completion -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13348.

  • Bounded the per-read object overhead the WebSocket reader retains while reassembling a frame delivered across many small reads; the reads are joined once when the frame completes, and folded into a single buffer if they exceed a fragment cap, so a frame dribbled in tiny reads cannot pin unbounded per-read overhead -- by :user:Dreamsorcerer and :user:bdraco.

    Related issues and pull requests on GitHub:
    #13352, #13488.

  • Fixed requests pipelined behind a request whose upgrade the handler declined
    going unanswered once there were more of them than the per-connection queue
    holds. With the pure-Python parser the same requests were also served more
    than once -- by :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #13356.

  • Reduced CPU consumption when encountering many concatenated members in a compressed payload and rejected large amounts of members -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13362.

  • Fixed excessive memory consumption with small WebSocket messages -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13393.

  • Fixed an integer overflow on too large messages -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13415.

  • Switched multipart handling to use spooled temporary files to reduce number of file descriptors needed -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13426.

  • Fixed a limit on message tail after an upgrade request -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13501.

  • Fixed some edge case handling in multipart parts using base 64 encoding -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13509.

  • Fixed Cython 3.3.0 failing to compile the WebSocket reader: dropped the
    Final[...] annotation from ALLOWED_CLOSE_CODES and the int
    annotation from the local start_pos in WebSocketReader._feed_data,
    both of which conflicted with declarations in reader_c.pxd under
    Cython 3.3.0 -- by :user:Georgefifth.

    Related issues and pull requests on GitHub:
    #13520.

  • Fixed the WebSocket reader accepting a new data frame injected between the
    fragments of an in-progress message; per :rfc:6455#section-5.4 every frame
    after the first fragment and before the FIN must be a continuation, and
    such a stream is now rejected as a protocol error -- by :user:arshsmith1.

    Related issues and pull requests on GitHub:
    #13553.

  • Fixed a connection being eligible for reuse after its request was cancelled
    or failed while waiting for a 100 Continue response or finalizing the
    body; the request headers were already sent, so reusing the connection
    corrupted the next request on it -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13579.

  • Fixed BaseRequest.http_range not accepting case-insensitive range units -- by :user:Manny7717.

    Related issues and pull requests on GitHub:
    #13580, #13581.

  • Fixed CookieJar.update_cookies() to copy user-passed mutable Morsel objects -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13637.

  • Fixed unbounded memory growth on a client WebSocket connection. A frame
    protocol error detaches the reader but leaves the connection upgraded, so a
    peer could stream unlimited data into an internal buffer when the application
    never called :meth:~aiohttp.ClientWebSocketResponse.receive; that data is
    now discarded, since nothing can parse it. Data arriving before the reader is
    installed is bounded by read_bufsize, which now applies to this buffer as
    well as to :attr:~aiohttp.ClientResponse.content
    -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #13655, #13743.

  • Fixed pure-Python request parser not reading a body in a HEAD request -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13671.

  • Fixed host-only cookie state being lost on expiration -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13674.

  • Fixed a possible OverflowError on cookies and a connection not being closed properly -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13677.

  • The first-request deadline now also closes connections whose first request body stalls, while a body that is still arriving extends the deadline instead of being interrupted -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13681.

  • Fixed idle connections not being closed if no request was received -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13681.

  • Fixed :meth:~aiohttp.web.Application.add_domain not routing a request to
    its domain application when the Host header carried a port and the
    domain was registered without one, or, for a wildcard domain, uppercase
    letters -- by :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #13693.

  • Added empty __slots__ to AbstractRouteDef so that RouteDef and
    StaticDef instances no longer carry an unused __dict__.

    Related issues and pull requests on GitHub:
    #13716.

  • Fixed BaseConnector(keepalive_timeout=None) crashing on the second request to the same host with TypeError: '<=' not supported between instances of 'float' and 'NoneType' -- by :user:ishan-1010.

    Related issues and pull requests on GitHub:
    #13756, #13757.

  • Fixed a crash in :meth:~aiohttp.BodyPartReader.read_chunk on a body part
    with an explicit Content-Length: 0: the part fell through to the
    streaming read strategy, whose minimum chunk size assertion then failed for
    chunk sizes below the boundary length. Such parts now yield an immediate
    empty chunk, like any other part with a known length
    -- by :user:istoolsfox.

    Related issues and pull requests on GitHub:
    #13758, #13760.

  • Fixed Set-Cookie parsing treating unrecognized attributes as additional
    cookies. Each Set-Cookie header now sets exactly one cookie and
    unrecognized attributes are ignored, per :rfc:6265#section-5.2, preventing
    a malicious server from creating an attacker-selected number of cookie
    objects (and correspondingly large outgoing Cookie headers) from a
    bounded amount of response data. DummyCookieJar, and CookieJar in
    safe mode for IP-address origins, no longer parse Set-Cookie headers at
    all -- by :user:Dreamsorcerer.

    *Related issues and p...

Read more

3.14.3

Choose a tag to compare

@github-actions github-actions released this 22 Jul 23:07
5e392ce

Bug fixes

  • Fixed the client dropping only the first Authorization, Cookie and
    Proxy-Authorization header when a redirect crossed an origin -- by :user:arshsmith1.

    Related issues and pull requests on GitHub:
    #13180.

  • Fixed error message construction in the C HTTP parser -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #13222.


3.14.2

Choose a tag to compare

@github-actions github-actions released this 20 Jul 19:47
c1b9212

Bug fixes

  • Fixed :py:attr:~aiohttp.web.StreamResponse.last_modified rounding a
    :class:datetime.datetime with a fractional second down.

    Related issues and pull requests on GitHub:
    #5303.

  • Fixed resolving localhost on Windows to fall back without AI_ADDRCONFIG
    when the first lookup fails, so localhost still works without an active
    network.

    Related issues and pull requests on GitHub:
    #5357.

  • Rejected multipart body parts whose Content-Length header is not a
    plain sequence of digits (e.g. +5, -1, 1_0), matching the
    strictness of the main request parser per :rfc:9110#section-8.6
    -- by :user:dxbjavid.

    Related issues and pull requests on GitHub:
    #12794.

  • Fixed GunicornWebWorker endlessly reloading when app fails during startup -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12879.

  • Fixed some inconsistent case sensitivity on request methods -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12931.

  • Fixed IndexError: string index out of range in parse_content_disposition
    when a header parameter has an empty value (e.g. filename=).
    -- by :user:JSap0914.

    Related issues and pull requests on GitHub:
    #12948.

  • Fixed the sock_read timeout being re-armed on a keep-alive connection after
    it had been returned to the pool. An idle pooled connection could be left with a
    pending read timeout that fired and poisoned it, so the next request reusing the
    connection failed immediately with :exc:aiohttp.SocketTimeoutError. The read
    timeout is now only rescheduled when resuming a transport that was actually
    paused -- by :user:daragok.

    Related issues and pull requests on GitHub:
    #12953, #12954.

  • Fixed the client decompressing frames when permessage-deflate was not negotiated -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12976.

  • Fixed DigestAuthMiddleware raising an IndexError on empty domain -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12983.

  • Fixed :class:~aiohttp.DigestAuthMiddleware corrupting the Digest
    challenge when a WWW-Authenticate response offered more than one
    authentication scheme -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12984.

  • Fixed client not closing cleanly after an exception -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12985.

  • Fixed control frames breaking fragmented WebSocket messages -- by :user:arshsmith1.

    Related issues and pull requests on GitHub:
    #12988.

  • Fixed parse_content_disposition rejecting otherwise-valid
    Content-Disposition header values that contain optional whitespace (OWS)
    around the disposition type (e.g. "form-data ; name=\"field\"").
    The disposition type is now stripped before token validation, consistent with
    how parameter keys are already handled -- by :user:JSap0914.

    Related issues and pull requests on GitHub:
    #12996.

  • Fixed an :exc:IndexError in the pure-Python HTTP parser -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13001.

  • Fixed parsing optional whitespace in Content-Disposition -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13002.

  • Fixed request body not being read on rejected WebSocket upgrades -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13016.

  • Fixed :exc:LookupError (and an unguarded :exc:UnicodeDecodeError) escaping
    Content-Disposition parsing when a multipart part supplies an extended
    parameter with an unknown charset
    -- by :user:arshsmith1.

    Related issues and pull requests on GitHub:
    #13042.

  • Fixed escape_quotes in the Digest authentication middleware not escaping
    backslashes, so a WWW-Authenticate challenge value containing a backslash
    could break out of its quoted-string in the generated Authorization header
    -- by :user:dxbjavid.

    Related issues and pull requests on GitHub:
    #13054.

  • Fixed Python parser not rejecting a bare LF in the request line -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13136.

  • Fixed the C HTTP parser folding the fragment into the query string for an
    origin-form request target with an empty query (e.g. /path?#frag),
    which diverged from the pure-Python parser -- by :user:GiulioDER.

    Related issues and pull requests on GitHub:
    #13171.

  • Fixed the C parser reporting newer HTTP methods such as QUERY as <unknown>;
    the method table is now derived from the vendored llhttp instead of a hand-maintained count
    -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #13174.

Packaging updates and notes for downstreams

  • Upgraded llhttp to v9.4.2 -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12956.

Contributor-facing changes

  • Added admin documentation on incident response and on running reproducer code
    safely, covering security vulnerability handling and supply-chain, account, and
    CI/infrastructure compromise -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12914.


3.14.1

Choose a tag to compare

@github-actions github-actions released this 07 Jun 20:37
9c35d03

Bug fixes

  • Fixed a race condition in :py:class:~aiohttp.TCPConnector where closing the connector while a DNS resolution was in-flight could raise :py:exc:AttributeError instead of :py:exc:~aiohttp.ClientConnectionError -- by :user:goingforstudying-ctrl.

    Related issues and pull requests on GitHub:
    #12497.

  • Fixed CancelledError not closing a connection -- by :user:aiolibsbot.

    Related issues and pull requests on GitHub:
    #12795.

  • Tightened up some websocket parser checks -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12817.

  • Fixed :class:~aiohttp.CookieJar dropping the host-only flag of cookies when persisted with :meth:~aiohttp.CookieJar.save and reloaded with :meth:~aiohttp.CookieJar.load, so a cookie set without a Domain attribute is again scoped to the exact host that set it after a reload; the absolute expiration deadline is now persisted as well, so a reloaded cookie keeps its original lifetime instead of being rescheduled from the load time. :meth:~aiohttp.CookieJar.load now replaces the jar contents rather than merging onto prior state, and loaded cookies pass through the same acceptance rules as :meth:~aiohttp.CookieJar.update_cookies, so a cookie for an IP-address host is dropped when loaded into a jar created without unsafe=True -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12824.

  • Scoped :class:~aiohttp.DigestAuthMiddleware credentials to the origin of the first request it handles, so a redirect to a different origin no longer triggers a digest response computed from the configured credentials; a challenge from another origin is only answered when that origin falls within a protection space advertised by the anchor origin through the RFC 7616 domain directive -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12825.

  • Fixed the C HTTP parser not enforcing max_line_size on a request target or response reason phrase that is split across multiple reads; each fragment was checked on its own, so an accumulated line could exceed the limit without raising LineTooLong. The accumulated length is now checked, matching the pure-Python parser -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12826.

  • Changed :class:~aiohttp.TCPConnector to reject legacy non-canonical numeric IPv4 host forms such as 2130706433, 017700000001 and 127.1 with :exc:~aiohttp.InvalidUrlClientError; only canonical dotted-quad IPv4 literals are now treated as IP address literals, while every other host is sent through the configured resolver -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12827.

  • Fixed :meth:~aiohttp.StreamReader.readany and :meth:~aiohttp.StreamReader.read_nowait joining data fed back into the buffer during the call (when draining below the low water mark resumes reading) into a single unbounded :class:bytes; a call now returns only the chunks that were buffered when it started, keeping the drain of an unread auto-decompressed request body bounded by the read buffer -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12828.

  • Bounded the number of parsed-but-unhandled pipelined HTTP/1 requests buffered per connection on the server; once the queue reaches an internal limit the parser stops emitting and the transport is paused, resuming as the request handler drains the queue, so a client keeping one handler busy can no longer accumulate an unbounded backlog of pipelined requests -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12830.

  • Fixed :meth:aiohttp.web.Response.write_eof skipping Payload.close() when the body write was interrupted by an error or cancellation, for example when a client disconnects mid-response; the payload close hook now runs in a finally so a :class:~aiohttp.payload.Payload body always releases its resources -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12831.

  • Fixed the pure-Python HTTP parser not enforcing max_line_size on a chunk-size line when the whole line arrived in a single read; the limit was only applied to chunk-size metadata split across reads. The complete-line case is now checked too, matching the split-line behavior -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12832.

  • Included the per-request server_hostname override in the :class:~aiohttp.TCPConnector connection pool key, so a pooled TLS connection is no longer reused for a request that sets server_hostname to a different value -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12835.


3.14.0

Choose a tag to compare

@github-actions github-actions released this 01 Jun 19:31
edb2724

We have a new website! https://aio-libs.org
Subscribe to the news feed to find out more about what we're working on in future.

Features

  • Added RequestKey and ResponseKey classes,
    which enable static type checking for request & response
    context storages in the same way that AppKey does for Application
    -- by :user:gsoldatov.

    Related issues and pull requests on GitHub:
    #11766.

  • Added :func:~aiohttp.encode_basic_auth for encoding HTTP Basic
    Authentication credentials. Replaces the now-deprecated
    :class:~aiohttp.BasicAuth -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12499.

  • Started accepting :term:asynchronous context managers <asynchronous context manager> for cleanup contexts.
    Legacy single-yield :term:asynchronous generator cleanup contexts continue to be
    supported; async context managers are adapted internally so they are
    entered at startup and exited during cleanup.

    -- by :user:MannXo.

    Related issues and pull requests on GitHub:
    #11681.

  • Added :py:attr:~aiohttp.CookieJar.cookies and :py:attr:~aiohttp.CookieJar.host_only_cookies read-only properties to :py:class:~aiohttp.CookieJar exposing the stored cookies with their full attributes -- by :user:Br1an67.

    Related issues and pull requests on GitHub:
    #3951.

  • Added :py:attr:~aiohttp.web.TCPSite.port accessor for dynamic port allocations in :class:~aiohttp.web.TCPSite -- by :user:twhittock-disguise and :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #10665.

  • Added decode_text parameter to :meth:~aiohttp.ClientSession.ws_connect and :class:~aiohttp.web.WebSocketResponse to receive WebSocket TEXT messages as raw bytes instead of decoded strings, enabling direct use with high-performance JSON parsers like orjson -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #11763, #11764.

  • Large overhaul of parser/decompression code.

    The zip bomb security fix in 3.13 stopped highly compressed payloads
    from being decompressed, regardless of validity. Now aiohttp will
    decompress such payloads in chunks of 256+ KiB, allowing safe decompression
    of such payloads.

    -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #11966.

  • Added explicit APIs for bytes-returning JSON serializer:
    JSONBytesEncoder type, JsonBytesPayload,
    :func:~aiohttp.web.json_bytes_response,
    :meth:~aiohttp.web.WebSocketResponse.send_json_bytes and
    :meth:~aiohttp.ClientWebSocketResponse.send_json_bytes methods, and
    json_serialize_bytes parameter for :class:~aiohttp.ClientSession
    -- by :user:kevinpark1217.

    Related issues and pull requests on GitHub:
    #11989.

  • Added :attr:~aiohttp.ClientResponse.output_size and
    :attr:~aiohttp.ClientResponse.upload_complete -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12452.

Bug fixes

  • Fixed ZLibDecompressor silently dropping data past the first
    member when decompressing concatenated gzip/deflate streams. Each subsequent
    member is now handed to a fresh decompressor, matching the behaviour already
    implemented for ZSTD multi-frame streams.

    -- by :user:Ashutosh-177

    Related issues and pull requests on GitHub:
    #7157.

  • Improved the parser error message shown when TLS handshake bytes are received on an HTTP port -- by :user:puneetdixit200.

    Related issues and pull requests on GitHub:
    #10142.

  • Fixed the C parser failing to reject a response with a body when none was expected -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #10587.

  • Fixed http parser not rejecting HTTP/1.1 requests that do not have valid Host header.
    -- by :user:Cycloctane.

    Related issues and pull requests on GitHub:
    #10600.

  • Fixed misleading TLS-in-TLS warning being emitted when sending HTTPS requests through an HTTP proxy. The warning now only fires when the proxy itself uses HTTPS, which is the only case where TLS-in-TLS actually applies -- by :user:wavebyrd.

    Related issues and pull requests on GitHub:
    #10683.

  • Fixed AssertionError when the transport is None during WebSocket
    preparation or file response sending (e.g. when a client disconnects
    immediately after connecting). A ConnectionResetError is now raised
    instead -- by :user:agners.

    Related issues and pull requests on GitHub:
    #11761.

  • Fixed ad-hoc cookies passed to individual requests not being sent when the session's cookie jar has unsafe=True and the target URL uses an IP address, by copying the unsafe setting from the session's cookie jar to the temporary cookie jar -- by :user:Krishnachaitanyakc.

    Related issues and pull requests on GitHub:
    #12011.

  • Reset the WebSocket heartbeat timer on inbound data to avoid false ping/pong timeouts while receiving large frames
    -- by :user:hoffmang9.

    Related issues and pull requests on GitHub:
    #12030.

  • Switched :py:meth:~aiohttp.CookieJar.save to use JSON format and
    :py:meth:~aiohttp.CookieJar.load to try JSON first with a fallback to
    a restricted pickle unpickler -- by :user:YuvalElbar6.

    Related issues and pull requests on GitHub:
    #12091.

  • Fixed redirects with consumed non-rewindable request bodies to raise
    :class:aiohttp.ClientPayloadError instead of silently sending an empty body.

    Related issues and pull requests on GitHub:
    #12195.

  • Fixed zstd decompression failing with ClientPayloadError when the server
    sends a response as multiple zstd frames -- by :user:josu-moreno.

    Related issues and pull requests on GitHub:
    #12234.

  • Fixed spurious Future exception was never retrieved warning on disconnect during back-pressure -- by :user:availov.

    Related issues and pull requests on GitHub:
    #12281.

  • Cookiejar.save() now uses 0x600 permissions to better protect them from being read by other users -- by :user:digiscrypt.

    Related issues and pull requests on GitHub:
    #12312.

  • Fixed a crash (:external+python:exc:~http.cookies.CookieError) in the cookie parser when receiving cookies
    containing ASCII control characters on CPython builds with the :cve:2026-3644
    patch. The parser now gracefully skips cookies whose value contains control
    characters instead of letting the exception propagate -- by :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #12395.

  • Fixed digest authentication failing for requests whose path or query string contains percent-encoded reserved characters; the digest signature now uses the encoded request-target that is sent on the wire instead of the decoded form -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12436.

  • Fixed :func:aiohttp.web.run_app losing inner traceback frames when an
    exception is raised during application startup (e.g. inside
    cleanup_ctx or on_startup). Regression since 3.10.6.

    Related issues and pull requests on GitHub:
    #12493.

  • Fixed per-request cookies not being dropped on cross-origin redirects -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12550.

  • Fixed invalid bytes being allowed in multipart/payload headers -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12719.

  • Fixed :py:meth:~aiohttp.FormData.add_field accepting invalid bytes in name and filename -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12721.

  • Fixed websocket upgrade occurring when header contained a value like notupgrade -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12723.

Deprecations (removal in next major release)

  • Deprecated :class:~aiohttp.BasicAuth and the auth / proxy_auth
    parameters. They will be removed in aiohttp 4.0. Use the new
    :func:~aiohttp.encode_basic_auth helper together with
    headers={"Authorization": ...} (or
    proxy_headers={"Proxy-Authorization": ...} for proxies) instead.
    Note that encode_basic_auth() defaults to utf-8, not latin1
    -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12499.

  • Added deprecation warning to aiohttp.pytest_plugin, please switch to pytest-aiohttp -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #10785.

Removals and backward incompatible breaking changes

  • Stopped calling :func:socket.getfqdn as the fallback for
    :attr:aiohttp.web.BaseRequest.host. :func:socket.getfqdn
    performs blocking reverse DNS resolution on the event loop
    thread and can stall a worker for many seconds when the system
    resolver is slow, and could be triggered remotely by an HTTP/1.0
    request that omits the Host header. The fallback when no
    Host header is present is now the local socket address the
    request arrived on (transport sockname), or an empty string
    if no transport information is available. Code that relied on
    the FQDN being returned must now read it from
    :func:socket.getfqdn directly, off the event loop
    -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #9308, #12597.

  • Dropped support for Python 3.9 -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #11601.

  • Tightened outbound header serialization to reject all ASCII control
    characters forbidden by :rfc:9110#section-5.5 and :rfc:9112#section-4
    (0x00-0x08, 0x0A-0x1F, 0x7F) in status lines,
    header field-names, and field-values. Previously only CR, LF and NUL were
    rejected. HTAB (0x09) remains permitted in field values. Applications
    ...

Read more

3.13.5

Choose a tag to compare

@github-actions github-actions released this 31 Mar 21:54
v3.13.5
1c1dfb0

Bug fixes

  • Skipped the duplicate singleton header check in lax mode (the default for response
    parsing). In strict mode (request parsing, or -X dev), all RFC 9110 singletons
    are still enforced -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #12302.


3.13.4

Choose a tag to compare

@github-actions github-actions released this 28 Mar 17:12
9f7c7ab

Features

  • Added max_headers parameter to limit the number of headers that should be read from a response -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #11955.

  • Added a dns_cache_max_size parameter to TCPConnector to limit the size of the cache -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12106.

Bug fixes

  • Fixed server hanging indefinitely when chunked transfer encoding chunk-size
    does not match actual data length. The server now raises
    TransferEncodingError instead of waiting forever for data that will
    never arrive -- by :user:Fridayai700.

    Related issues and pull requests on GitHub:
    #10596.

  • Fixed access log timestamps ignoring daylight saving time (DST) changes. The
    previous implementation used :py:data:time.timezone which is a constant and
    does not reflect DST transitions -- by :user:nightcityblade.

    Related issues and pull requests on GitHub:
    #11283.

  • Fixed RuntimeError: An event loop is running error when using aiohttp.GunicornWebWorker
    or aiohttp.GunicornUVLoopWebWorker on Python >=3.14.
    -- by :user:Tasssadar.

    Related issues and pull requests on GitHub:
    #11701.

  • Fixed :exc:ValueError when creating a TLS connection with ClientTimeout(total=0) by converting 0 to None before passing to ssl_handshake_timeout in :py:meth:asyncio.loop.start_tls -- by :user:veeceey.

    Related issues and pull requests on GitHub:
    #11859.

  • Restored :py:meth:~aiohttp.BodyPartReader.decode as a synchronous method
    for backward compatibility. The method was inadvertently changed to async
    in 3.13.3 as part of the decompression bomb security fix. A new
    :py:meth:~aiohttp.BodyPartReader.decode_iter method is now available
    for non-blocking decompression of large payloads using an async generator.
    Internal aiohttp code uses the async variant to maintain security protections.

    Changed multipart processing chunk sizes from 64 KiB to 256KiB, to better
    match aiohttp internals
    -- by :user:bdraco and :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #11898.

  • Fixed false-positive :py:class:DeprecationWarning for passing enable_cleanup_closed=True to :py:class:~aiohttp.TCPConnector specifically on Python 3.12.7.
    -- by :user:Robsdedude.

    Related issues and pull requests on GitHub:
    #11972.

  • Fixed _sendfile_fallback over-reading beyond requested count -- by :user:bysiber.

    Related issues and pull requests on GitHub:
    #12096.

  • Fixed digest auth dropping challenge fields with empty string values -- by :user:bysiber.

    Related issues and pull requests on GitHub:
    #12097.

  • ClientConnectorCertificateError.os_error no longer raises :exc:AttributeError
    -- by :user:themylogin.

    Related issues and pull requests on GitHub:
    #12136.

  • Adjusted pure-Python request header value validation to align with RFC 9110 control-character handling, while preserving lax response parser behavior, and added regression tests for Host/header control-character cases.
    -- by :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #12231.

  • Rejected duplicate singleton headers (Host, Content-Type,
    Content-Length, etc.) in the C extension HTTP parser to match
    the pure Python parser behaviour, preventing potential host-based
    access control bypasses via parser differentials
    -- by :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #12240.

  • Aligned the pure-Python HTTP request parser with the C parser by splitting
    comma-separated and repeated Connection header values for keep-alive,
    close, and upgrade handling -- by :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #12249.

Improved documentation

  • Documented :exc:asyncio.TimeoutError for WebSocketResponse.receive()
    and related methods -- by :user:veeceey.

    Related issues and pull requests on GitHub:
    #12042.

Packaging updates and notes for downstreams

  • Upgraded llhttp to 3.9.1 -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #12069.

Contributor-facing changes

  • The benchmark CI job now runs only in the upstream repository -- by :user:Cycloctane.

    It used to always fail in forks, which this change fixed.

    Related issues and pull requests on GitHub:
    #11737.

  • Fixed flaky performance tests by using appropriate fixed thresholds that account for CI variability -- by :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #11992.

Miscellaneous internal changes

  • Fixed test_invalid_idna to work with idna 3.11 by using an invalid character (\u0080) that is rejected by yarl during URL construction -- by :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #12027.

  • Fixed race condition in test_data_file on Python 3.14 free-threaded builds -- by :user:rodrigobnogueira.

    Related issues and pull requests on GitHub:
    #12170.


3.13.3

Choose a tag to compare

@github-actions github-actions released this 03 Jan 17:27
41f01ed

This release contains fixes for several vulnerabilities. It is advised to
upgrade as soon as possible.

Bug fixes

  • Fixed proxy authorization headers not being passed when reusing a connection, which caused 407 (Proxy authentication required) errors
    -- by :user:GLeurquin.

    Related issues and pull requests on GitHub:
    #2596.

  • Fixed multipart reading failing when encountering an empty body part -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #11857.

  • Fixed a case where the parser wasn't raising an exception for a websocket continuation frame when there was no initial frame in context.

    Related issues and pull requests on GitHub:
    #11862.

Removals and backward incompatible breaking changes

  • Brotli and brotlicffi minimum version is now 1.2.
    Decompression now has a default maximum output size of 32MiB per decompress call -- by :user:Dreamsorcerer.

    Related issues and pull requests on GitHub:
    #11898.

Packaging updates and notes for downstreams

  • Moved dependency metadata from :file:setup.cfg to :file:pyproject.toml per :pep:621
    -- by :user:cdce8p.

    Related issues and pull requests on GitHub:
    #11643.

Contributor-facing changes

  • Removed unused update-pre-commit github action workflow -- by :user:Cycloctane.

    Related issues and pull requests on GitHub:
    #11689.

Miscellaneous internal changes

  • Optimized web server performance when access logging is disabled by reducing time syscalls -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #10713.

  • Added regression test for cached logging status -- by :user:meehand.

    Related issues and pull requests on GitHub:
    #11778.


3.13.2

Choose a tag to compare

@github-actions github-actions released this 28 Oct 20:53
v3.13.2
91547df

Bug fixes

  • Fixed cookie parser to continue parsing subsequent cookies when encountering a malformed cookie that fails regex validation, such as Google's g_state cookie with unescaped quotes -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #11632.

  • Fixed loading netrc credentials from the default :file:~/.netrc (:file:~/_netrc on Windows) location when the :envvar:NETRC environment variable is not set -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #11713, #11714.

  • Fixed WebSocket compressed sends to be cancellation safe. Tasks are now shielded during compression to prevent compressor state corruption. This ensures that the stateful compressor remains consistent even when send operations are cancelled -- by :user:bdraco.

    Related issues and pull requests on GitHub:
    #11725.