Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.8' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer committed Nov 29, 2020
2 parents ddd00f7 + 88f8f3b commit eee5eea
Show file tree
Hide file tree
Showing 63 changed files with 730 additions and 1,680 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ jobs:
AIOHTTP_NO_EXTENSIONS: ${{ matrix.no-extensions }}
run: |
make vvtest
python -m coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unit
fail_ci_if_error: false
# python -m coverage xml
# - name: Upload coverage
# uses: codecov/codecov-action@v1
# with:
# file: ./coverage.xml
# flags: unit
# fail_ci_if_error: false

pre-deploy:
name: Pre-Deploy
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
.vimrc
.vscode
aiohttp/_find_header.c
aiohttp/_frozenlist.c
aiohttp/_frozenlist.html
aiohttp/_headers.html
aiohttp/_headers.pxi
aiohttp/_helpers.c
Expand Down
1 change: 1 addition & 0 deletions CHANGES/4054.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implemented readuntil in StreamResponse
6 changes: 6 additions & 0 deletions CHANGES/4700.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AioHTTPTestCase is more async friendly now.

For people who use unittest and are used to use unittest.TestCase
it will be easier to write new test cases like the sync version of the TestCase class,
without using the decorator `@unittest_run_loop`, just `async def test_*`.
The only difference is that for the people using python3.7 and below a new dependency is needed, it is `asynctestcase`.
2 changes: 2 additions & 0 deletions CHANGES/4942.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add predicate to ``AbstractCookieJar.clear``.
Add ``AbstractCookieJar.clear_domain`` to clean all domain and subdomains cookies only.
1 change: 1 addition & 0 deletions CHANGES/4984.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added a new exception type for Unix socket client errors which provides a more useful error message.
1 change: 1 addition & 0 deletions CHANGES/5094.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add keepalive_timeout parameter to web.run_app.
1 change: 1 addition & 0 deletions CHANGES/5105.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tracing for client sent headers
1 change: 1 addition & 0 deletions CHANGES/5106.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove Transfer-Encoding and Content-Type headers for 204 in StreamResponse
1 change: 1 addition & 0 deletions CHANGES/5192.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ABNORMAL_CLOSURE and BAD_GATEWAY to WSCloseCode
1 change: 1 addition & 0 deletions CHANGES/5259.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Acquire the connection before running traces to prevent race condition.
1 change: 1 addition & 0 deletions CHANGES/5267.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make type hints for http parser stricter
1 change: 1 addition & 0 deletions CHANGES/5293.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Switch to external frozenlist and aiosignal libraries.
5 changes: 5 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Alexey Stepanov
Amin Etesamian
Amit Tulshyan
Amy Boyle
Anas El Amraoui
Anders Melchiorsen
Andrei Ursulenko
Andrej Antonov
Expand All @@ -47,6 +48,7 @@ Arthur Darcet
Ben Bader
Ben Timby
Benedikt Reinartz
Bob Haddleton
Boris Feld
Boyi Chen
Brett Cannon
Expand Down Expand Up @@ -137,6 +139,7 @@ Jaesung Lee
Jake Davis
Jakob Ackermann
Jakub Wilk
Jan Buchar
Jashandeep Sohi
Jens Steinhauser
Jeonghun Lee
Expand Down Expand Up @@ -307,6 +310,8 @@ Young-Ho Cha
Yuriy Shatrov
Yury Selivanov
Yusuke Tsutsumi
Yuval Ofir
Zeal Wierslee
Zlatan Sičanica
Марк Коренберг
Семён Марьясин
3 changes: 1 addition & 2 deletions aiohttp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.7.3"
__version__ = "3.8.0a0"

from typing import Tuple

Expand Down Expand Up @@ -78,7 +78,6 @@
DefaultResolver as DefaultResolver,
ThreadedResolver as ThreadedResolver,
)
from .signals import Signal as Signal
from .streams import (
EMPTY_PAYLOAD as EMPTY_PAYLOAD,
DataQueue as DataQueue,
Expand Down
108 changes: 0 additions & 108 deletions aiohttp/_frozenlist.pyx

This file was deleted.

11 changes: 9 additions & 2 deletions aiohttp/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,22 @@ async def close(self) -> None:
IterableBase = Iterable


ClearCookiePredicate = Callable[["Morsel[str]"], bool]


class AbstractCookieJar(Sized, IterableBase):
"""Abstract Cookie Jar."""

def __init__(self, *, loop: Optional[asyncio.AbstractEventLoop] = None) -> None:
self._loop = get_running_loop(loop)

@abstractmethod
def clear(self) -> None:
"""Clear all cookies."""
def clear(self, predicate: Optional[ClearCookiePredicate] = None) -> None:
"""Clear all cookies if no predicate is passed."""

@abstractmethod
def clear_domain(self, domain: str) -> None:
"""Clear all cookies for domain and all subdomains."""

@abstractmethod
def update_cookies(self, cookies: LooseCookies, response_url: URL = URL()) -> None:
Expand Down
26 changes: 25 additions & 1 deletion aiohttp/client_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import warnings
from typing import TYPE_CHECKING, Any, Optional, Tuple, Union

from .http_parser import RawResponseMessage
from .typedefs import LooseHeaders

try:
Expand Down Expand Up @@ -195,14 +196,37 @@ class ClientProxyConnectionError(ClientConnectorError):
"""


class UnixClientConnectorError(ClientConnectorError):
"""Unix connector error.
Raised in :py:class:`aiohttp.connector.UnixConnector`
if connection to unix socket can not be established.
"""

def __init__(
self, path: str, connection_key: ConnectionKey, os_error: OSError
) -> None:
self._path = path
super().__init__(connection_key, os_error)

@property
def path(self) -> str:
return self._path

def __str__(self) -> str:
return "Cannot connect to unix socket {0.path} ssl:{1} [{2}]".format(
self, self.ssl if self.ssl is not None else "default", self.strerror
)


class ServerConnectionError(ClientConnectionError):
"""Server connection errors."""


class ServerDisconnectedError(ServerConnectionError):
"""Server disconnected."""

def __init__(self, message: Optional[str] = None) -> None:
def __init__(self, message: Union[RawResponseMessage, str, None] = None) -> None:
if message is None:
message = "Server disconnected"

Expand Down
6 changes: 3 additions & 3 deletions aiohttp/client_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, loop: asyncio.AbstractEventLoop) -> None:

self._should_close = False

self._payload = None
self._payload: Optional[StreamReader] = None
self._skip_payload = False
self._payload_parser = None

Expand Down Expand Up @@ -223,15 +223,15 @@ def data_received(self, data: bytes) -> None:

self._upgraded = upgraded

payload = None
payload: Optional[StreamReader] = None
for message, payload in messages:
if message.should_close:
self._should_close = True

self._payload = payload

if self._skip_payload or message.code in (204, 304):
self.feed_data((message, EMPTY_PAYLOAD), 0) # type: ignore
self.feed_data((message, EMPTY_PAYLOAD), 0)
else:
self.feed_data((message, payload), 0)
if payload is not None:
Expand Down
9 changes: 9 additions & 0 deletions aiohttp/client_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ async def send(self, conn: "Connection") -> "ClientResponse":
on_chunk_sent=functools.partial(
self._on_chunk_request_sent, self.method, self.url
),
on_headers_sent=functools.partial(
self._on_headers_request_sent, self.method, self.url
),
)

if self.compress:
Expand Down Expand Up @@ -701,6 +704,12 @@ async def _on_chunk_request_sent(self, method: str, url: URL, chunk: bytes) -> N
for trace in self._traces:
await trace.send_request_chunk_sent(method, url, chunk)

async def _on_headers_request_sent(
self, method: str, url: URL, headers: "CIMultiDict[str]"
) -> None:
for trace in self._traces:
await trace.send_request_headers(method, url, headers)


class ClientResponse(HeadersMixin):

Expand Down
Loading

0 comments on commit eee5eea

Please sign in to comment.