instance_id stringlengths 10 57 | file_changes listlengths 1 15 | repo stringlengths 7 53 | base_commit stringlengths 40 40 | problem_statement stringlengths 11 52.5k | patch stringlengths 251 7.06M |
|---|---|---|---|---|---|
encode__httpx-2382 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_multipart.py:FileField.get_length",
"httpx/_multipart.py:FileField.render_data",
"httpx/_multipart.py:MultipartStream.iter_chunks_lengths",
"httpx/_multipart.py:MultipartS... | encode/httpx | af56476a8c4b35a0b27e165a7fccae08b307e32c | Add support for streaming multipart/form-data
(After initial discussion in https://github.com/encode/httpx/discussions/2227.)
As far as I see, there's no way to stream `multipart/form-data` uploads when the `Content-Length` is unknown, since HTTPX tries to get byte size some way or another (last resort is to read it... | diff --git a/httpx/_multipart.py b/httpx/_multipart.py
index 2c08776..1d46d96 100644
--- a/httpx/_multipart.py
+++ b/httpx/_multipart.py
@@ -135,19 +135,18 @@ class FileField:
self.file = fileobj
self.headers = headers
- def get_length(self) -> int:
+ def get_length(self) -> typing.Optional[in... |
encode__httpx-2400 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_multipart.py:FileField.__init__"
],
"edited_modules": [
"httpx/_multipart.py:FileField"
]
},
"file": "httpx/_multipart.py"
},
{
"changes": {
"added... | encode/httpx | 770d4f2254acd5f4c67eaf25634f70ec1640c443 | The code in the document does not work
Hi. The code in the [document](https://www.python-httpx.org/advanced/#:~:text=files%20%3D%20%7B%27upload%2Dfile%27%3A%20(None%2C%20%27text%20content%27%2C%20%27text/plain%27)%7D) does not work
```
import httpx
files = {'upload-file': (None, 'text content', 'text/plain')}
r =... | diff --git a/httpx/_multipart.py b/httpx/_multipart.py
index 0329649..2c08776 100644
--- a/httpx/_multipart.py
+++ b/httpx/_multipart.py
@@ -122,8 +122,14 @@ class FileField:
# requests does the opposite (it overwrites the header with the 3rd tuple element)
headers["Content-Type"] = content_ty... |
encode__httpx-2423 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_decoders.py:LineDecoder.__init__",
"httpx/_decoders.py:LineDecoder.decode",
"httpx/_decoders.py:LineDecoder.flush"
],
"edited_modules": [
"httpx/_decoders.py:L... | encode/httpx | e486fbceea7a933baa4b52852681f9c6ac80ac96 | LineDecoder is accidentally quadratic: iter_lines() seems to hang forever
When calling `Response.iter_lines()`, things can seem to hang forever.
The problem is that `LineDecoder` is quadratic in it's string copying behaviour. If a 31MB chunk with 18,768 lines is passed in to `LineDecoder()` then it takes 1m45s to pr... | diff --git a/httpx/_decoders.py b/httpx/_decoders.py
index 2f3a447..500ce7f 100644
--- a/httpx/_decoders.py
+++ b/httpx/_decoders.py
@@ -259,66 +259,56 @@ class LineDecoder:
"""
Handles incrementally reading lines from text.
- Uses universal line decoding, supporting any of `\n`, `\r`, or `\r\n`
- as ... |
encode__httpx-2481 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/_types.py"
},
{
"changes": {
"added_entities": [
"httpx/_urls.py:URL.raw"
],
"added_modules": null,
"edited_enti... | encode/httpx | 933551c51985375423ca60a880210aef34f1c620 | Breaking drop of URL.raw in patch release 0.23.1
The patch release `0.23.1` included a breaking change in #2241
The justification seems to be that "we don't use it", but `url.raw` is a public property used by other libraries including `ddtrace` 0.x versions: https://github.com/DataDog/dd-trace-py/blob/v0.61.3/ddtra... | diff --git a/httpx/_types.py b/httpx/_types.py
index f3c1f6e..6b610e1 100644
--- a/httpx/_types.py
+++ b/httpx/_types.py
@@ -16,6 +16,7 @@ from typing import (
Iterator,
List,
Mapping,
+ NamedTuple,
Optional,
Sequence,
Tuple,
@@ -31,6 +32,16 @@ if TYPE_CHECKING: # pragma: no cover
P... |
encode__httpx-2495 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_content.py:encode_content"
],
"edited_modules": [
"httpx/_content.py:encode_content"
]
},
"file": "httpx/_content.py"
}
] | encode/httpx | 563a1031f5bd37445d2fdbf622ba5cab926207c9 | AsyncClient.request runtime error: "Attempted to send an sync request with an AsyncClient instance"
Ran into this issue as well. It was surprising to end up with a `RuntimeError: Attempted to send an sync request with an AsyncClient instance` error, when my actual issue had nothing to do with sync/async (in my case sub... | diff --git a/httpx/_content.py b/httpx/_content.py
index 3cbca7a..1c450b7 100644
--- a/httpx/_content.py
+++ b/httpx/_content.py
@@ -114,7 +114,11 @@ def encode_content(
headers = {"Content-Length": str(content_length)} if body else {}
return headers, ByteStream(body)
- elif isinstance(content, I... |
encode__httpx-2523 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_utils.py:primitive_value_to_str"
],
"edited_modules": [
"httpx/_utils.py:primitive_value_to_str"
]
},
"file": "httpx/_utils.py"
}
] | encode/httpx | 10a3b68a71d6cb16b170dec4efe2ec1ae197d65f | Support passing bytes keys/values in `params=...`
``` python
>>> httpx.get('https://example.org', params={b'testparam': b'testvalue'}).url
URL('https://example.org?b%27testparam%27=b%27testvalue%27')
```
I don't think this is intentional, as there is an isinstance check for bytes in the ``flatten_queryparams`` fu... | diff --git a/httpx/_utils.py b/httpx/_utils.py
index 1f64dee..1e1570e 100644
--- a/httpx/_utils.py
+++ b/httpx/_utils.py
@@ -67,7 +67,11 @@ def primitive_value_to_str(value: "PrimitiveData") -> str:
return "false"
elif value is None:
return ""
- return str(value)
+ elif isinstance(value, (s... |
encode__httpx-2659 | [
{
"changes": {
"added_entities": [
"httpx/_utils.py:is_ipv4_hostname",
"httpx/_utils.py:is_ipv6_hostname"
],
"added_modules": [
"httpx/_utils.py:is_ipv4_hostname",
"httpx/_utils.py:is_ipv6_hostname"
],
"edited_entities": [
"httpx/_utils.py:ge... | encode/httpx | 7d7c4f15b8784e4a550d974139acfa64193b32c2 | The `get_environment_proxies` function in _utils.py does not support IPv4, IPv6 correctly
Hi, I encountered error when my environment `no_proxy` includes IPv6 address like `::1`. It is wrongly transformed into `all://*::1` and causes urlparse error since the _urlparse.py parses the `:1` as port.
 -> typing.Dict[str, typing.Optional[s... |
encode__httpx-2671 | [
{
"changes": {
"added_entities": [
"httpx/_urlparse.py:is_safe"
],
"added_modules": [
"httpx/_urlparse.py:is_safe"
],
"edited_entities": [
"httpx/_urlparse.py:quote"
],
"edited_modules": [
"httpx/_urlparse.py:quote"
]
},
"fi... | encode/httpx | 15d09a3bbc20372cd87e48f17f7c9381c8220a0f | Percent sign not encoded when present in query params value
Since httpx 0.24 the behavior regarding query params changed, and possibly contains a bug.
Use case: passing a pre-signed storage url to some webservice which then downloads the file.
The presigned url will contain some percent-escaped sequences.
With... | diff --git a/httpx/_urlparse.py b/httpx/_urlparse.py
index 0fbec35..6522d91 100644
--- a/httpx/_urlparse.py
+++ b/httpx/_urlparse.py
@@ -399,7 +399,7 @@ def normalize_path(path: str) -> str:
def percent_encode(char: str) -> str:
"""
- Replace every character in a string with the percent-encoded representatio... |
encode__httpx-2701 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_urlparse.py:urlparse"
],
"edited_modules": [
"httpx/_urlparse.py:urlparse"
]
},
"file": "httpx/_urlparse.py"
}
] | encode/httpx | df5dbc05580a4c3225e70153729e2a306d67a472 | Square brackets no longer work
A GET request such as `/?arr[]=1&arr[]=2` is perfectly legal and it means that you are trying to send an array of values to the endpoint.
Unluckily after 0.23.3 it stopped working because requests are sent as `/?arr%5B%5D=1&arr%5B%5D=2`
| diff --git a/httpx/_urlparse.py b/httpx/_urlparse.py
index 5ee6e58..69ff0b4 100644
--- a/httpx/_urlparse.py
+++ b/httpx/_urlparse.py
@@ -253,12 +253,19 @@ def urlparse(url: str = "", **kwargs: typing.Optional[str]) -> ParseResult:
if has_authority:
path = normalize_path(path)
- parsed_path: str = quo... |
encode__httpx-273 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/client.py:Client.check_concurrency_backend"
],
"edited_modules": [
"httpx/client.py:Client"
]
},
"file": "httpx/client.py"
},
{
"changes": {
"added_... | encode/httpx | a4b93b91c03239738f6c118570fdfa155e7fe11e | Backend test parametrization
Now that almost all of HTTPX internals are relying on the concurrency backend, and before tackling the Trio backend (#120), it would be good to parametrize all tests with a `backend` fixture.
For now, it would only point to `AsyncioBackend`, but we're going to need it for `TrioBackend` a... | diff --git a/httpx/client.py b/httpx/client.py
index f7a3c5d..37e824f 100644
--- a/httpx/client.py
+++ b/httpx/client.py
@@ -633,12 +633,17 @@ class Client(BaseClient):
# concurrency backends.
# The sync client performs I/O on its own, so it doesn't need to support
# arbitrary concurrency bac... |
encode__httpx-2990 | [
{
"changes": {
"added_entities": [
"httpx/_urlparse.py:percent_encoded"
],
"added_modules": [
"httpx/_urlparse.py:percent_encoded"
],
"edited_entities": [
"httpx/_urlparse.py:urlparse",
"httpx/_urlparse.py:is_safe",
"httpx/_urlparse.py:quote"... | encode/httpx | 3b9060ee1121b48669e0b30045c9344065f4f2ae | ULR parser percent encoding corrupting query params
It appears that the url parser is corrupting query params by incorrectly percent encoding them.
I noticed there's [this comment](https://github.com/encode/httpx/blob/0.25.0/httpx/_urlparse.py#L263-L264) which indicates this percent encoding does not accurately foll... | diff --git a/httpx/_urlparse.py b/httpx/_urlparse.py
index c44e351..07bbea9 100644
--- a/httpx/_urlparse.py
+++ b/httpx/_urlparse.py
@@ -260,10 +260,8 @@ def urlparse(url: str = "", **kwargs: typing.Optional[str]) -> ParseResult:
# For 'path' we need to drop ? and # from the GEN_DELIMS set.
parsed_path: str =... |
encode__httpx-301 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/client.py:BaseClient.__init__"
],
"edited_modules": [
"httpx/client.py:BaseClient"
]
},
"file": "httpx/client.py"
},
{
"changes": {
"added_entities"... | encode/httpx | a46462764e89bbcf2ac9587e11296a171cef8306 | Add support for SSLKEYLOGFILE for Python 3.8b4+
Python 3.8b4 (with OpenSSL 1.1.1) added support for the `SSLKEYLOGFILE` environment variable which will be very useful for using Wireshark to do analysis of HTTP/2 requests for example.
This should be a small change within `SSLConfig._create_default_ssl_context()` see ... | diff --git a/.travis.yml b/.travis.yml
index 07207f9..2a8da53 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,6 +20,7 @@ matrix:
env: NOX_SESSION=test-3.7
- python: 3.8-dev
env: NOX_SESSION=test-3.8
+ dist: bionic # Required to get OpenSSL 1.1.1+
install:
- pip install --upgrade nox
diff... |
encode__httpx-310 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/middleware.py:RedirectMiddleware.build_redirect_request",
"httpx/middleware.py:RedirectMiddleware.redirect_headers"
],
"edited_modules": [
"httpx/middleware.py:Redirect... | encode/httpx | b8c5e7a8528978e646c28a5837df5085ea3803fc | h11._util.LocalProtocolError: Too little data for declared Content-Length
client POC:
```python
import asyncio
import logging
import httpx
logging.basicConfig(level=logging.DEBUG)
async def test():
client = httpx.AsyncClient()
url = 'http://127.0.0.1:8000/debug'
resp = await client.post(url... | diff --git a/httpx/middleware.py b/httpx/middleware.py
index 4ed750e..aa994db 100644
--- a/httpx/middleware.py
+++ b/httpx/middleware.py
@@ -88,7 +88,7 @@ class RedirectMiddleware(BaseMiddleware):
) -> AsyncRequest:
method = self.redirect_method(request, response)
url = self.redirect_url(request,... |
encode__httpx-324 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/dispatch/http2.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/middle... | encode/httpx | 6b97b2ed00a03d7528abcb45d59e111bebdf0c1a | Deletion of non-existent keys from `Headers` should raise KeyError.
Prompted by #310
To replicate:
```python
headers = httpx.Headers()
del headers['DOES_NOT_EXIST'] # Should raise a KeyError, but doesn't
```
To resolve this issue we'll need to:
* Ensure that deletion of non-existant keys raises a KeyEr... | diff --git a/httpx/dispatch/http2.py b/httpx/dispatch/http2.py
index 786110c..fd40964 100644
--- a/httpx/dispatch/http2.py
+++ b/httpx/dispatch/http2.py
@@ -4,7 +4,7 @@ import typing
import h2.connection
import h2.events
-from ..concurrency.base import BaseStream, ConcurrencyBackend, TimeoutFlag, BaseEvent
+from ..... |
encode__httpx-3412 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/__version__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_decoders... | encode/httpx | 189fc4bcbe5f314128775dec66a616ac9a31ad48 | Zstandard data is incomplete on HEAD requests
Tried to do a HEAD request with a server answering with `zstd` encoding by default but since the content is empty `ZStandardDecoder` is raising `DecodingError("Zstandard data is incomplete")` when calling `flush()`.
Tried to fix the problem by adding a check if `ret` is ... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3c16d66..4e2afe2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
-## [Unreleased]
+## 0.28.0 (...)
The... |
encode__httpx-377 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/client.py:BaseClient.__init__",
"httpx/client.py:BaseClient._get_response",
"httpx/client.py:AsyncClient.get",
"httpx/client.py:AsyncClient.options",
"httpx/client.... | encode/httpx | e62e5c3758b10a8830c751acbe588d7b572a9957 | SSL handshake failed on verifying the certificate
**im using charlesproxy for debugging each requests. Proxy ip and cert is from charlesproxy**
My code:
```
import httpx
client = httpx.Client(proxies={
"http": "http://192.168.1.78:8888",
"https": "http://192.168.1.78:8888",
})
client_cer = r'C:\... | diff --git a/httpx/client.py b/httpx/client.py
index 30beeb7..73b3069 100644
--- a/httpx/client.py
+++ b/httpx/client.py
@@ -107,13 +107,6 @@ class BaseClient:
else:
self.base_url = URL(base_url)
- if proxies is None and trust_env:
- proxies = typing.cast(ProxiesTypes, get_envi... |
encode__httpx-386 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/models.py:QueryParams.__init__"
],
"edited_modules": [
"httpx/models.py:QueryParams"
]
},
"file": "httpx/models.py"
},
{
"changes": {
"added_entitie... | encode/httpx | 31730e709597baaa7b2364fee041dfa985169789 | Query params should support list-of-strings values.
Hi,
I recently tried to use `httpx` instead of `requests` in my simple app that calls few API endpoints and suddenly it did not work.
The problem here is that `httpx` and `requests` process query parameters differently.
Here's a simple script to see how both... | diff --git a/httpx/models.py b/httpx/models.py
index f70fdf4..136aa41 100644
--- a/httpx/models.py
+++ b/httpx/models.py
@@ -32,6 +32,7 @@ from .exceptions import (
from .multipart import multipart_encode
from .status_codes import StatusCode
from .utils import (
+ flatten_queryparams,
guess_json_utf,
is... |
encode__httpx-502 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/client.py:BaseClient._get_response"
],
"edited_modules": [
"httpx/client.py:BaseClient"
]
},
"file": "httpx/client.py"
},
{
"changes": {
"added_enti... | encode/httpx | 2fcf23bbfe41c5526cb35a65d32dd98dde786988 | Logging levels
I've been spending some time looking at logging levels with `uvicorn` lately, see eg. https://github.com/encode/uvicorn/pull/474 and would like to take a consistent approach across other projects in `encode`.
We've currently got some very detailed logging, that's available, tho it's really at a "dig i... | diff --git a/docs/environment_variables.md b/docs/environment_variables.md
index 74c2243..15723fb 100644
--- a/docs/environment_variables.md
+++ b/docs/environment_variables.md
@@ -16,9 +16,9 @@ and what function they serve:
Valid values: `debug`, `trace` (case-insensitive)
-If set to `trace`, then low-level detai... |
encode__httpx-510 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/api.py:request"
],
"edited_modules": [
"httpx/api.py:request"
]
},
"file": "httpx/api.py"
},
{
"changes": {
"added_entities": null,
"added_mod... | encode/httpx | 2fcf23bbfe41c5526cb35a65d32dd98dde786988 | Hints on self-signed certificates
In https://github.com/encode/httpx/issues/503, @gvbgduh mentioned the need to make HTTP/2 requests to a local server. Because of our current implementation (require TLS for HTTP/2, as browsers do), this typically requires to setup a local self-signed certificate for use in tests.
I'... | diff --git a/docs/advanced.md b/docs/advanced.md
index f0d402b..3e73f5b 100644
--- a/docs/advanced.md
+++ b/docs/advanced.md
@@ -362,3 +362,38 @@ is set to `None` or it cannot be inferred from it, HTTPX will default to
...
}
```
+
+## SSL certificates
+
+When making a request over HTTPS, HTTPX needs to verify the ... |
encode__httpx-521 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/__version__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/concurren... | encode/httpx | 1a32cf036a825f6eb35395af5388a3b23180a82e | HTTPX claims Python 3.6+ support when asyncio backend TCPStream.start_tls explicitly does not support Python 3.6
As stated, HTTPX explicitly does not support Python 3.6 [here](https://github.com/encode/httpx/blob/master/httpx/concurrency/asyncio.py#L61) but declares Python 3.6 support [here](https://github.com/encode/h... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cea654..34d47ec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## 0.7.7 (November 15, 2019)
+
+### Fi... |
encode__httpx-524 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/__version__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/client.py... | encode/httpx | 1a32cf036a825f6eb35395af5388a3b23180a82e | h11._util.RemoteProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE
I intermittently got this error when load testing uvicorn endpoint.
This error comes from a proxy endpoint where I am also using `encode/http3` to perform HTTP client calls.
```
File "/project/venv/... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cea654..3734b1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## 0.7.8 (November 17, 2019)
+
+### Ad... |
encode__httpx-534 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/__version__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/client.py... | encode/httpx | 6045ee242fbe0308ce9d5faf654f5de68e1a3dd8 | Use the existing runloop for sync calls in async handler
Hi, this library looks awesome and I really want to use it; but I seem to have hit a blocker and can't seem to find a solution in the docs.
TL;DR: Is there any way to provide our own runloop when using the `sync` calls as looking through the source the sync ca... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 34d47ec..3734b1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## 0.7.8 (November 17, 2019)
+
+### Ad... |
encode__httpx-535 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/__version__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/client.py... | encode/httpx | 6045ee242fbe0308ce9d5faf654f5de68e1a3dd8 | Python 3.7: RuntimeError: read() called while another coroutine is already waiting for incoming data
As we already discussed with @florimondmanca in https://github.com/encode/httpx/issues/382, I am reporting this issue here.
I get the following error: `RuntimeError: read() called while another coroutine is already... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 34d47ec..3734b1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## 0.7.8 (November 17, 2019)
+
+### Ad... |
encode__httpx-563 | [
{
"changes": {
"added_entities": [
"httpx/client.py:Client.dispatcher_for_url"
],
"added_modules": null,
"edited_entities": [
"httpx/client.py:Client.send_single_request",
"httpx/client.py:Client._dispatcher_for_request"
],
"edited_modules": [
... | encode/httpx | 44ad295572f7569f6b02c9868ee22fda594c21a4 | Timeout from ConnectionPool on number of concurrent requests larger than max_connections
While investigating https://github.com/encode/httpx/issues/551 I noticed that when issuing a high number of concurrent requests to a server an `TimeoutError`.
Running this example adapted from #551:
```python
import asyncio
... | diff --git a/httpx/client.py b/httpx/client.py
index 30e2181..4c594f2 100644
--- a/httpx/client.py
+++ b/httpx/client.py
@@ -535,7 +535,7 @@ class Client:
Sends a single request, without handling any redirections.
"""
- dispatcher = self._dispatcher_for_request(request, self.proxies)
+ ... |
encode__httpx-574 | [
{
"changes": {
"added_entities": [
"httpx/models.py:Response.is_error"
],
"added_modules": null,
"edited_entities": [
"httpx/models.py:Response.raise_for_status"
],
"edited_modules": [
"httpx/models.py:Response"
]
},
"file": "httpx/models... | encode/httpx | 9df76ccfe97d4df57a5dad832ef137d68282b432 | Add equivalent to requests.response `ok` property
Hey there, I'm wondering do we have some equivalent of `requests.response:ok` property in `httpx` library? If no, Is it planning to be added sometime in the future? thx! | diff --git a/docs/compatibility.md b/docs/compatibility.md
index a95c12c..d652a0a 100644
--- a/docs/compatibility.md
+++ b/docs/compatibility.md
@@ -14,6 +14,7 @@ to the API in our own documentation. The following exceptions apply:
but also provide lower-cased versions for API compatibility with `requests`.
* `stream... |
encode__httpx-593 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/__init__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules":... | encode/httpx | c08ae7796f01bf0be6b3d43bfd4c4a0b169dca49 | Fine-tuning timeouts from the default timeout config
Currently, if we want to change only one of the three timeouts (connect, read, write) we need to build a full-blown `TimeoutConfig`. But there is no way to use the default timeout values.
```python
>>> import httpx
>>> httpx.config.DEFAULT_TIMEOUT_CONFIG
Timeou... | diff --git a/README.md b/README.md
index 808e77b..358e98a 100644
--- a/README.md
+++ b/README.md
@@ -24,12 +24,12 @@ or trio, and is able to support making large numbers of requests concurrently.
**Note**: *HTTPX should still be considered in alpha. We'd love early users and feedback,
but would strongly recommend pin... |
encode__httpx-600 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/__init__.py"
},
{
"changes": {
"added_entities": [
"httpx/api.py:stream"
],
"added_modules": [
"httpx/api.py:s... | encode/httpx | e56e120175f4938d45c91c66bdd9b7f9d415e9bb | Garbage collected responses should warn if still open.
See https://github.com/encode/httpx/issues/393#issuecomment-538370554
Reviewing the streaming API
Right now we issue streaming requests using...
```python
response = await client.get(url, stream=True)
```
And have the following stream-specific methods...
... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index e6d5a84..a589d30 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,11 +4,34 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## Master
+
+### Added
+
+- Added con... |
encode__httpx-603 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/__init__.py"
},
{
"changes": {
"added_entities": [
"httpx/concurrency/asyncio.py:AsyncioBackend.fork"
],
"added_module... | encode/httpx | bb6e52f3566a79978f590e5a677eb057a68ad3a9 | Drop background manager (in favour of a two-function fork primitive).
I think we're running against the grain with our current `read`, `write`, `background_manager` API on the backends.
Switching to the same style as the `hip` project is using for its concurrency backends is likely a smart thing for us to do here...... | diff --git a/httpx/__init__.py b/httpx/__init__.py
index 686359a..b6cd6df 100644
--- a/httpx/__init__.py
+++ b/httpx/__init__.py
@@ -3,12 +3,7 @@ from .api import delete, get, head, options, patch, post, put, request, stream
from .auth import BasicAuth, DigestAuth
from .client import Client
from .concurrency.asyncio... |
encode__httpx-627 | [
{
"changes": {
"added_entities": [
"httpx/concurrency/asyncio.py:AsyncioBackend.time"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"httpx/concurrency/asyncio.py:AsyncioBackend"
]
},
"file": "httpx/concurrency/asyncio.py"
},
... | encode/httpx | 869714fbf5f2a1bfda8d6f906930f49032507d7a | Keep-Alive timeouts
We should automatically close any Keep-Alive connections after a timeout period. | diff --git a/docs/compatibility.md b/docs/compatibility.md
index 8f4a19b..506340c 100644
--- a/docs/compatibility.md
+++ b/docs/compatibility.md
@@ -4,7 +4,7 @@ HTTPX aims to be compatible with the `requests` API wherever possible.
This documentation outlines places where the API differs...
-## Request URLS
+## Re... |
encode__httpx-629 | [
{
"changes": {
"added_entities": [
"httpx/concurrency/asyncio.py:AsyncioBackend.time"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"httpx/concurrency/asyncio.py:AsyncioBackend"
]
},
"file": "httpx/concurrency/asyncio.py"
},
... | encode/httpx | 1d25bd58a86d725754c4fe1ae4fc4cd3c22b9b57 | HTTP/2 download speeds / flow control settings
Which having an initial look at HTTP/3, @jlaine dug out that we seem to have signiifcantly slow uploading right now.
First thing to do would be to investigate and replicate, by eg. compare and contrast a simple upload from `httpx` vs `requests/urllib3` - does it replica... | diff --git a/docs/compatibility.md b/docs/compatibility.md
index 8f4a19b..506340c 100644
--- a/docs/compatibility.md
+++ b/docs/compatibility.md
@@ -4,7 +4,7 @@ HTTPX aims to be compatible with the `requests` API wherever possible.
This documentation outlines places where the API differs...
-## Request URLS
+## Re... |
encode__httpx-649 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/client.py:Client.merge_url"
],
"edited_modules": [
"httpx/client.py:Client"
]
},
"file": "httpx/client.py"
},
{
"changes": {
"added_entities": null,... | encode/httpx | 6c69e0936b0ee1849f0749f04113ec3e6c92c9ff | ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:852)
Hi guys by any chance any of you have seen this issue when using httpx + trio, if so how did you manage to fix it?
This is happening when starting a request to an IP on port 80 that then redirects to 443.
```
Traceback (most recent call la... | diff --git a/httpx/client.py b/httpx/client.py
index a6c22d8..1ceea14 100644
--- a/httpx/client.py
+++ b/httpx/client.py
@@ -338,7 +338,8 @@ class Client:
"""
url = self.base_url.join(relative_url=url)
if url.scheme == "http" and hstspreload.in_hsts_preload(url.host):
- url = url.c... |
encode__httpx-653 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/models.py:URL.__init__"
],
"edited_modules": [
"httpx/models.py:URL"
]
},
"file": "httpx/models.py"
}
] | encode/httpx | 5ee512d803d1d6b49dc171e1114f0075618de78e | `params` overrides query string in url
Hi,
I noticed a difference between `httpx` and `requests` when processing query parameters. I provided the `params` for the url with query string, `requests` would **merge** `params` into query string, but `httpx` replaces the whole query string.
Here is a simple script:
... | diff --git a/httpx/models.py b/httpx/models.py
index ad3599b..fc938c3 100644
--- a/httpx/models.py
+++ b/httpx/models.py
@@ -90,9 +90,14 @@ class URL:
if self.is_absolute_url:
self._uri_reference = self._uri_reference.normalize()
- # Add any query parameters.
+ # Add any query para... |
encode__httpx-685 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/auth.py:DigestAuth.__call__"
],
"edited_modules": [
"httpx/auth.py:DigestAuth"
]
},
"file": "httpx/auth.py"
}
] | encode/httpx | bc6163c55a75f2e655ff59301ce0a53fa12973ec | DigestAuth should raise a clear error if the request cannot replay.
Our DigestAuth implementation cannot work with non-replayable requests.
We ought to raise a nice clear error if `request.stream.is_replayable` is not True. | diff --git a/httpx/auth.py b/httpx/auth.py
index e0ef50c..e412c57 100644
--- a/httpx/auth.py
+++ b/httpx/auth.py
@@ -6,7 +6,7 @@ import typing
from base64 import b64encode
from urllib.request import parse_http_list
-from .exceptions import ProtocolError
+from .exceptions import ProtocolError, RequestBodyUnavailable... |
encode__httpx-697 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/content_streams.py:AsyncIteratorStream.__init__",
"httpx/content_streams.py:AsyncIteratorStream.__aiter__"
],
"edited_modules": [
"httpx/content_streams.py:AsyncIterato... | encode/httpx | 35b7516674ced88073eace33b5d58c4c4d6bab65 | AsnycIteratorStream should error if `__iter__` called twice.
For defensive programming, the `AsyncIteratorStream` implementation should track `.stream_consumed` in `__iter__`, and raise a `RuntimeError` if it is called twice. | diff --git a/httpx/content_streams.py b/httpx/content_streams.py
index 62d150b..73ef59e 100644
--- a/httpx/content_streams.py
+++ b/httpx/content_streams.py
@@ -7,6 +7,7 @@ from json import dumps as json_dumps
from pathlib import Path
from urllib.parse import urlencode
+from .exceptions import StreamConsumed
from ... |
encode__httpx-758 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/decoders.py:DeflateDecoder.__init__",
"httpx/decoders.py:DeflateDecoder.decode"
],
"edited_modules": [
"httpx/decoders.py:DeflateDecoder"
]
},
"file": "ht... | encode/httpx | bdfabe1e9a910e2fc63582199eb26386b69ea551 | DecodingError with zlib-compressed responses
Using the following minimal WSGI app:
```python
import zlib
def app(environ, start_response):
start_response("200 OK", [("Content-Encoding", "deflate")])
return [zlib.compress(b"hello world")]
```
This works fine in a web browser.
Requests is quite ha... | diff --git a/docs/quickstart.md b/docs/quickstart.md
index 25c1cea..a147b04 100644
--- a/docs/quickstart.md
+++ b/docs/quickstart.md
@@ -255,7 +255,7 @@ httpx.exceptions.HttpError: 404 Not Found
Any successful response codes will simply return `None` rather than raising an exception.
-``` python
+```python
>>> r.... |
encode__httpx-763 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/decoders.py:DeflateDecoder.__init__",
"httpx/decoders.py:DeflateDecoder.decode"
],
"edited_modules": [
"httpx/decoders.py:DeflateDecoder"
]
},
"file": "ht... | encode/httpx | 956129fbf71495c97844dc7adf4b595a9da4cd18 | urllib3.ProxyManager() instantiation is broken.
python 3.7.5
httpx 0.11.0
urllib3 1.25.7
```
$ ipython3 -c 'import httpx; r = httpx.get("https://www.google.com")'
parse_url http://127.0.0.1:1234 <class 'httpx.models.URL'>
---------------------------------------------------------------------------
TypeError ... | diff --git a/README.md b/README.md
index cf6b9b3..27fd542 100644
--- a/README.md
+++ b/README.md
@@ -39,6 +39,18 @@ Let's get started...
'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'
```
+Or, using the async API...
+
+_Use [IPython](https://ipython.readthedocs.io/en/stable/) or Python 3.8+ wit... |
encode__httpx-774 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/client.py:BaseClient.redirect_url"
],
"edited_modules": [
"httpx/client.py:BaseClient"
]
},
"file": "httpx/client.py"
},
{
"changes": {
"added_entit... | encode/httpx | 5a63540e8ab35209849894819ac731c836fdcf27 | Handle redirects with missing hostname in `Location:` header.
While doing something like this:
```
import httpx
def run_sync(url):
with httpx.Client(verify=False) as client:
response = client.get(url)
print(response)
run_sync('http://62.28.16.253')
```
I get a `httpx.exceptions.Inv... | diff --git a/httpx/client.py b/httpx/client.py
index 590d5d0..4991478 100644
--- a/httpx/client.py
+++ b/httpx/client.py
@@ -330,6 +330,11 @@ class BaseClient:
url = URL(location, allow_relative=True)
+ # Handle malformed 'Location' headers that are "absolute" form, have no host.
+ # See: htt... |
encode__httpx-823 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "httpx/__version__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_client.p... | encode/httpx | 50d337e807839c21e796fd8b01c67d8a672a9721 | httpx.Client misses the prepare_request method | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d81336..748ac94 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,39 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## 0.12.1 (March 19th, 2020)
+
+### Fi... |
encode__httpx-861 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_content_streams.py:encode"
],
"edited_modules": [
"httpx/_content_streams.py:encode"
]
},
"file": "httpx/_content_streams.py"
}
] | encode/httpx | 43ec09c3cbb089edd2e83ccc717fb95beef0c189 | Redundant `boundary` if files/data is empty
If you try to send a post request with empty data and files — you will create a body with one `--boundary--` string, which can break the server.
It's because httpx create MultipartStream for `data={}, files={}`:
https://github.com/encode/httpx/blob/a82adcc933345c6b8cb1623... | diff --git a/httpx/_content_streams.py b/httpx/_content_streams.py
index 5f3237e..afffed3 100644
--- a/httpx/_content_streams.py
+++ b/httpx/_content_streams.py
@@ -323,7 +323,7 @@ def encode(
Handles encoding the given `data`, `files`, and `json`, returning
a `ContentStream` implementation.
"""
- if ... |
encode__httpx-883 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_content_streams.py:ByteStream.get_headers"
],
"edited_modules": [
"httpx/_content_streams.py:ByteStream"
]
},
"file": "httpx/_content_streams.py"
}
] | encode/httpx | 21f533774f87292c2381376eb40f3216a48eee06 | Sync client fails on ASGI apps with unhelpful traceback
I tried using httpx with with an ASGI app in the way that was implied by the docs. It throws an error that feels like a problem with httpx, as FastAPI is currently being used in production in other ways. If you confirm that this is a bug in httpx, I'm willing (a... | diff --git a/docs/api.md b/docs/api.md
index 3889d8c..c63d4ec 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -38,6 +38,13 @@
:docstring:
:members: headers cookies params request get head options post put patch delete build_request send close
+## `AsyncClient`
+
+::: httpx.AsyncClient
+ :docstring:
+ :m... |
encode__httpx-968 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_client.py:Client.init_transport",
"httpx/_client.py:Client.init_proxy_transport",
"httpx/_client.py:AsyncClient.init_transport",
"httpx/_client.py:AsyncClient.init_proxy_t... | encode/httpx | 9b6605c3d519142db7ebaf56c13094bf779c7dea | Deprecate ProxyLimits naming in favour of max_connections and max_keepalive
Prompted by https://github.com/encode/httpx/pull/942#discussion_r424341967
The `PoolLimits` class uses `soft_limit` and `hard_limit` whereas in httpcore we use `max_connections` and `max_keepalive` which are clearer. | diff --git a/docs/advanced.md b/docs/advanced.md
index 4d1f1d8..2c1f1a6 100644
--- a/docs/advanced.md
+++ b/docs/advanced.md
@@ -404,14 +404,14 @@ response = client.get('http://example.com/')
You can control the connection pool size using the `pool_limits` keyword
argument on the client. It takes instances of `httpx.... |
encode__httpx-995 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"httpx/_models.py:Request.prepare"
],
"edited_modules": [
"httpx/_models.py:Request"
]
},
"file": "httpx/_models.py"
}
] | encode/httpx | 66a45379594e5cf836e4743931119e76dc8f22c7 | Content-Length header is missing in POST/DELETE/PUT/PATCH requests without body
### Checklist
<!-- To help keep this issue tracker clean and focused, please make sure you tried *all* the following resources before submitting your question. -->
- [x] I searched the [HTTPX documentation](https://www.python-httpx.or... | diff --git a/httpx/_models.py b/httpx/_models.py
index 865fd9a..683dde1 100644
--- a/httpx/_models.py
+++ b/httpx/_models.py
@@ -616,6 +616,9 @@ class Request:
auto_headers: typing.List[typing.Tuple[bytes, bytes]] = []
has_host = "host" in self.headers
+ has_content_length = (
+ "c... |
encode__starlette-1041 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/responses.py:StreamingResponse.__init__"
],
"edited_modules": [
"starlette/responses.py:StreamingResponse"
]
},
"file": "starlette/responses.py"
}
] | encode/starlette | c300bdc5b88f6e3c4467f361c82e3445811cc70f | StreamingResponse doesn't support PEP-492 asynchronous iterators
[PEP-492 asynchronous iterators](https://www.python.org/dev/peps/pep-0492/#asynchronous-iterators-and-async-for) have the following signature:
```python
class AsyncIterable:
def __aiter__(self):
return self
async def __anext__(sel... | diff --git a/starlette/responses.py b/starlette/responses.py
index 24e3b54..d5f2734 100644
--- a/starlette/responses.py
+++ b/starlette/responses.py
@@ -1,6 +1,5 @@
import hashlib
import http.cookies
-import inspect
import json
import os
import stat
@@ -204,7 +203,7 @@ class StreamingResponse(Response):
m... |
encode__starlette-105 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/cors.py:CORSMiddleware.__init__",
"starlette/middleware/cors.py:CORSMiddleware.__call__",
"starlette/middleware/cors.py:CORSMiddleware.simple_response",
"sta... | encode/starlette | cc09042c1ca5ccac78bf0ff689faa5dcd3e04f3a | Credentialed CORS standard requests should not respond with wildcard origins
See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Credentialed_requests_and_wildcards
If a standard request is made, that includes any cookie headers, then CORSMiddleware *ought* to strictly respond with the requested origin, rath... | diff --git a/starlette/middleware/cors.py b/starlette/middleware/cors.py
index 7345531..8bc3380 100644
--- a/starlette/middleware/cors.py
+++ b/starlette/middleware/cors.py
@@ -32,6 +32,8 @@ class CORSMiddleware:
simple_headers = {}
if "*" in allow_origins:
simple_headers["Access-Control-... |
encode__starlette-109 | [
{
"changes": {
"added_entities": [
"starlette/datastructures.py:URL.__repr__"
],
"added_modules": null,
"edited_entities": [
"starlette/datastructures.py:URL.__init__"
],
"edited_modules": [
"starlette/datastructures.py:URL"
]
},
"file": ... | encode/starlette | 02aaa4bddfe126b1458184b1ee1e8604af5041c7 | scope["server"] can be None
From https://asgi.readthedocs.io/en/latest/specs/www.html#connection-scope
> server: A two-item iterable of [host, port], where host is the listening address for this server as a unicode string, and port is the integer listening port. Optional, defaults to None.
https://github.com/enco... | diff --git a/starlette/datastructures.py b/starlette/datastructures.py
index 558c8a9..2705fd3 100644
--- a/starlette/datastructures.py
+++ b/starlette/datastructures.py
@@ -7,16 +7,20 @@ class URL:
def __init__(self, url: str = "", scope: Scope = None) -> None:
if scope is not None:
assert no... |
encode__starlette-1147 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/sessions.py:SessionMiddleware.__call__"
],
"edited_modules": [
"starlette/middleware/sessions.py:SessionMiddleware"
]
},
"file": "starlette/middlew... | encode/starlette | 23e15789bf6b879b455f1249e47a43d4c752b3ed | Session cookie should use root path
The session cookie currently uses '/'.
It should really use the ASGI root path instead, in case the application is submounted. | diff --git a/starlette/middleware/sessions.py b/starlette/middleware/sessions.py
index d1b1d5a..a13ec5c 100644
--- a/starlette/middleware/sessions.py
+++ b/starlette/middleware/sessions.py
@@ -49,14 +49,16 @@ class SessionMiddleware:
async def send_wrapper(message: Message) -> None:
if message["... |
encode__starlette-1164 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/responses.py:RedirectResponse.__init__"
],
"edited_modules": [
"starlette/responses.py:RedirectResponse"
]
},
"file": "starlette/responses.py"
}
] | encode/starlette | 995d70c7c6de60b98d799601433f3963b97d28fc | RedirectResponse call to `quote_plus` replaces spaces & `%20`'s with `+` character
### Checklist
<!-- Please make sure you check all these items before submitting your bug report. -->
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull requests to f... | diff --git a/starlette/responses.py b/starlette/responses.py
index ff122fb..d660cd9 100644
--- a/starlette/responses.py
+++ b/starlette/responses.py
@@ -7,7 +7,7 @@ import sys
import typing
from email.utils import formatdate
from mimetypes import guess_type as mimetypes_guess_type
-from urllib.parse import quote, qu... |
encode__starlette-1220 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/staticfiles.py:StaticFiles.get_response",
"starlette/staticfiles.py:StaticFiles.lookup_path"
],
"edited_modules": [
"starlette/staticfiles.py:StaticFiles"
]
... | encode/starlette | 28088573aebc70807ef2aa422000cddb93b57a70 | `StaticFiles` causes Internal Server Error when user accesses existing files as directory
### Checklist
<!-- Please make sure you check all these items before submitting your bug report. -->
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull reques... | diff --git a/starlette/staticfiles.py b/starlette/staticfiles.py
index 33ea0b0..39a6972 100644
--- a/starlette/staticfiles.py
+++ b/starlette/staticfiles.py
@@ -7,12 +7,8 @@ from email.utils import parsedate
import anyio
from starlette.datastructures import URL, Headers
-from starlette.responses import (
- FileR... |
encode__starlette-1240 | [
{
"changes": {
"added_entities": [
"starlette/datastructures.py:MutableHeaders.__ior__",
"starlette/datastructures.py:MutableHeaders.__or__"
],
"added_modules": null,
"edited_entities": [
"starlette/datastructures.py:MutableHeaders.update"
],
"edited_m... | encode/starlette | c91014dae84012cb59c1c22ae058aa9733212284 | Unable to merge MutableHeaders with dict
### Checklist
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull requests to fix it yet.
### Describe the bug
Unable to merge `MutableHeaders` with `dict`.
### To reproduce
```python3
from starlett... | diff --git a/starlette/datastructures.py b/starlette/datastructures.py
index 1a8b965..5986328 100644
--- a/starlette/datastructures.py
+++ b/starlette/datastructures.py
@@ -618,6 +618,19 @@ class MutableHeaders(Headers):
for idx in reversed(pop_indexes):
del self._list[idx]
+ def __ior__(self... |
encode__starlette-134 | [
{
"changes": {
"added_entities": [
"starlette/lifespan.py:LifespanContext.wait_shutdown"
],
"added_modules": null,
"edited_entities": [
"starlette/lifespan.py:LifespanHandler.add_event_handler",
"starlette/lifespan.py:LifespanHandler.run_lifespan",
"starle... | encode/starlette | 49f76ab5e9ef0ce5d966485553ad6019a9d37da5 | Support `shutdown` as a synonym for `cleanup`
* Support either `cleanup` or `shutdown` as the ASGI lifespan message name.
* Update uvicorn to move to shutdown - https://github.com/encode/uvicorn/issues/233
* Finally, after a small period of time, drop `cleanup`
Easy PR for a contributor to jump on would be address... | diff --git a/docs/applications.md b/docs/applications.md
index 2cce4ab..d4b44ca 100644
--- a/docs/applications.md
+++ b/docs/applications.md
@@ -56,7 +56,7 @@ There are two ways to add event handlers:
* `@app.on_event(event_type)` - Add an event, decorator style
* `app.add_event_handler(event_type, func)` - Add an ev... |
encode__starlette-1349 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/formparsers.py:MultiPartParser.parse"
],
"edited_modules": [
"starlette/formparsers.py:MultiPartParser"
]
},
"file": "starlette/formparsers.py"
}
] | encode/starlette | f12c92a21500d484b3d48f965bb605c1bbe193bc | Insufficient input validation of content-type 'multipart/form-data'
### Checklist
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull requests to fix it yet.
### Describe the bug
Not actually a bug, but insufficient input validation.
### To re... | diff --git a/starlette/formparsers.py b/starlette/formparsers.py
index decaf0b..fd19492 100644
--- a/starlette/formparsers.py
+++ b/starlette/formparsers.py
@@ -159,7 +159,7 @@ class MultiPartParser:
charset = params.get(b"charset", "utf-8")
if type(charset) == bytes:
charset = charset.de... |
encode__starlette-1350 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/staticfiles.py:StaticFiles.__init__",
"starlette/staticfiles.py:StaticFiles.get_directories"
],
"edited_modules": [
"starlette/staticfiles.py:StaticFiles"
]
... | encode/starlette | 1d1dcba1b811265b7e80e143b21ad316046ccdab | StaticFiles support for directories other than "statics"
### Checklist
<!-- Please make sure you check all these items before submitting your feature request. -->
- [/] There are no similar issues or pull requests for this yet.
- [X - tried to get feedback but no replies] I discussed this idea on the [community ... | diff --git a/docs/staticfiles.md b/docs/staticfiles.md
index d8786af..3591b4f 100644
--- a/docs/staticfiles.md
+++ b/docs/staticfiles.md
@@ -6,7 +6,7 @@ Starlette also includes a `StaticFiles` class for serving files in a given direc
Signature: `StaticFiles(directory=None, packages=None, check_dir=True)`
* `directo... |
encode__starlette-1356 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/routing.py:WebSocketRoute.__init__"
],
"edited_modules": [
"starlette/routing.py:WebSocketRoute"
]
},
"file": "starlette/routing.py"
}
] | encode/starlette | f53faba229e3fa2844bc3753e233d9c1f54cca52 | WebSocketRoute does not work with functools.partial
### Checklist
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull requests to fix it yet.
### Describe the bug
Accessing a WebSocketRoute with async function wrapped in functools.partial raises Type... | diff --git a/starlette/routing.py b/starlette/routing.py
index 3c11c1b..982980c 100644
--- a/starlette/routing.py
+++ b/starlette/routing.py
@@ -276,7 +276,10 @@ class WebSocketRoute(BaseRoute):
self.endpoint = endpoint
self.name = get_name(endpoint) if name is None else name
- if inspect.isf... |
encode__starlette-1377 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/staticfiles.py:StaticFiles.__init__",
"starlette/staticfiles.py:StaticFiles.get_directories",
"starlette/staticfiles.py:StaticFiles.get_path",
"starlette/staticfiles.py... | encode/starlette | d81545c71a7988cfd57c613be02f4661449c0793 | StaticFiles middleware doesn't follow symlinks
### Checklist
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull requests to fix it yet.
### Describe the bug
The StaticFiles middleware is checking the `os.realpath` of a file and returning a 404 f... | diff --git a/starlette/staticfiles.py b/starlette/staticfiles.py
index d09630f..da10a39 100644
--- a/starlette/staticfiles.py
+++ b/starlette/staticfiles.py
@@ -3,6 +3,7 @@ import os
import stat
import typing
from email.utils import parsedate
+from pathlib import Path
import anyio
@@ -51,7 +52,7 @@ class Static... |
encode__starlette-1395 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/responses.py:Response.init_headers"
],
"edited_modules": [
"starlette/responses.py:Response"
]
},
"file": "starlette/responses.py"
}
] | encode/starlette | 9d686a7125131fe026071d04e0d0e0a726e1afc5 | Missing content-length header field in some responses
### Checklist
<!-- Please make sure you check all these items before submitting your bug report. -->
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull requests to fix it yet.
### Describe th... | diff --git a/starlette/responses.py b/starlette/responses.py
index ffde4b9..da765cf 100644
--- a/starlette/responses.py
+++ b/starlette/responses.py
@@ -70,8 +70,8 @@ class Response:
populate_content_length = b"content-length" not in keys
populate_content_type = b"content-type" not in keys
-... |
encode__starlette-1397 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/responses.py:Response.init_headers"
],
"edited_modules": [
"starlette/responses.py:Response"
]
},
"file": "starlette/responses.py"
}
] | encode/starlette | 165592fb89ad26383b4a8122b4829bdfe4c64d60 | Add EmptyResponse class
HTTP responses with status codes 1xx, 204, 205, and 304 are special cases. 1xx, 204, 304 responses must not include a message body. The empty message body for 205 responses can be handled in a few ways, but the only one that would make sense for Starlette would be to add a Content-Length heade... | diff --git a/starlette/responses.py b/starlette/responses.py
index da765cf..26d7305 100644
--- a/starlette/responses.py
+++ b/starlette/responses.py
@@ -71,7 +71,11 @@ class Response:
populate_content_type = b"content-type" not in keys
body = getattr(self, "body", None)
- if body is not N... |
encode__starlette-1417 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/websockets.py:WebSocketDisconnect.__init__",
"starlette/websockets.py:WebSocket.close",
"starlette/websockets.py:WebSocketClose.__init__",
"starlette/websockets.py:WebS... | encode/starlette | 9d282a937c968b6b3068730af2c8967aec80b736 | [Feature] Reason for websocket.close
I've recently started actively developing with websockets in starlette. When closing a websocket you can provide a code e.g. 1000, 1008 … to tell the client the basic reason. But the websocket protocol allows the developer to also give UTF-8-encoded data as a complementary descripti... | diff --git a/docs/websockets.md b/docs/websockets.md
index 43406ac..1128bce 100644
--- a/docs/websockets.md
+++ b/docs/websockets.md
@@ -75,7 +75,7 @@ Use `websocket.receive_json(data, mode="binary")` to receive JSON over binary da
### Closing the connection
-* `await websocket.close(code=1000)`
+* `await websocke... |
encode__starlette-145 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/formparsers.py:FormParser.on_field_start",
"starlette/formparsers.py:FormParser.on_field_name",
"starlette/formparsers.py:FormParser.on_field_data",
"starlette/formpars... | encode/starlette | a32ea0a8e89567b24f3b8cd04847a1b01c9e98f0 | Drop `StaticFile` app.
We have `FileResponse` and `StaticFiles`.
I think that including the `StaticFile` ASGI app complicates things unnecessarily, and that we should probably remove it.
* Drop `StaticFile` app.
* Put runtime checks that file exists, and file is a regular file in `FileResponse`. | diff --git a/docs/staticfiles.md b/docs/staticfiles.md
index 03d9a58..f1b9d0a 100644
--- a/docs/staticfiles.md
+++ b/docs/staticfiles.md
@@ -1,20 +1,17 @@
-As well as the `FileResponse` class, Starlette also includes ASGI applications
-for serving a specific file or directory:
+Starlette also includes an `StaticFiles... |
encode__starlette-1459 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/base.py:BaseHTTPMiddleware.__call__"
],
"edited_modules": [
"starlette/middleware/base.py:BaseHTTPMiddleware"
]
},
"file": "starlette/middleware/ba... | encode/starlette | d6269e2f26fd41aa7d08f72a896b45162df69115 | Raising Exceptions in sub-applications routes
### Checklist
- [X] The bug is reproducible against the latest release or `master`.
- [X] There are no similar issues or pull requests to fix it yet.
### Describe the bug
Let's start with this PR: #1262
It's about preventing raise `anyio.ExceptionGroup` in view... | diff --git a/starlette/middleware/base.py b/starlette/middleware/base.py
index 423f407..bfb4a54 100644
--- a/starlette/middleware/base.py
+++ b/starlette/middleware/base.py
@@ -52,6 +52,9 @@ class BaseHTTPMiddleware:
assert message["type"] == "http.response.body"
yield ... |
encode__starlette-1472 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/websockets.py:WebSocket.receive",
"starlette/websockets.py:WebSocket.send",
"starlette/websockets.py:WebSocket.receive_text",
"starlette/websockets.py:WebSocket.receive... | encode/starlette | a6d3d8f0179cb1c2ac283bb5db779f6075854a66 | Where assert statements are guarding against invalid ASGI messaging, use RuntimeError instead.
### Checklist
- [X] There are no similar issues or pull requests for this yet.
- [X] I discussed this idea on the [community chat](https://gitter.im/encode/community) and feedback is positive.
### Is your feature relat... | diff --git a/starlette/websockets.py b/starlette/websockets.py
index da74060..03ed199 100644
--- a/starlette/websockets.py
+++ b/starlette/websockets.py
@@ -34,13 +34,21 @@ class WebSocket(HTTPConnection):
if self.client_state == WebSocketState.CONNECTING:
message = await self._receive()
... |
encode__starlette-1553 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/routing.py:get_name"
],
"edited_modules": [
"starlette/routing.py:get_name"
]
},
"file": "starlette/routing.py"
}
] | encode/starlette | 487f05dfc641a0632be8bd405add6454cab4f6b0 | Route naming introspection always return "method" for method endpoints
Discussion was done at https://gitter.im/encode/community. Bug was confirmed by @Kludex.
## Description
methods don't get detected on `is_function`, then we assume that `<object>.__class__.__name__ ` will give the right name (my_method on the e... | diff --git a/starlette/routing.py b/starlette/routing.py
index 0388304..ea6ec21 100644
--- a/starlette/routing.py
+++ b/starlette/routing.py
@@ -84,7 +84,7 @@ def websocket_session(func: typing.Callable) -> ASGIApp:
def get_name(endpoint: typing.Callable) -> str:
- if inspect.isfunction(endpoint) or inspect.isc... |
encode__starlette-1643 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/formparsers.py:MultiPartParser.parse"
],
"edited_modules": [
"starlette/formparsers.py:MultiPartParser"
]
},
"file": "starlette/formparsers.py"
}
] | encode/starlette | 82e07b3492802c43970314414dbd44d783f0e281 | multipart/form-data subpart without name causes internal error
### Checklist
<!-- Please make sure you check all these items before submitting your bug report. -->
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull requests to fix it yet.
### De... | diff --git a/setup.cfg b/setup.cfg
index 734fa81..8dad329 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -30,6 +30,7 @@ filterwarnings=
error
ignore: run_until_first_complete is deprecated and will be removed in a future version.:DeprecationWarning
ignore: starlette\.middleware\.wsgi is deprecated and will be... |
encode__starlette-1648 | [
{
"changes": {
"added_entities": [
"starlette/schemas.py:BaseSchemaGenerator._remove_converter"
],
"added_modules": null,
"edited_entities": [
"starlette/schemas.py:BaseSchemaGenerator.get_endpoints"
],
"edited_modules": [
"starlette/schemas.py:BaseSch... | encode/starlette | 92c1f1e5503012f48d6bfbc3ed5af4f4bad23e28 | Endpoint path parameters type specification compatibility with OAS
When specifying a convertor type for a path parameter like so:
```
...
Route('/users/{user_id:int}', user, methods=["GET", "POST"])
...
```
The OAS schema generated using `SchemaGenerator` interprets the whole portion within `{}` eg. `'user_id:... | diff --git a/starlette/schemas.py b/starlette/schemas.py
index 6ca764f..55bf7b3 100644
--- a/starlette/schemas.py
+++ b/starlette/schemas.py
@@ -1,4 +1,5 @@
import inspect
+import re
import typing
from starlette.requests import Request
@@ -49,10 +50,11 @@ class BaseSchemaGenerator:
for route in routes:
... |
encode__starlette-1715 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/base.py:BaseHTTPMiddleware.__call__"
],
"edited_modules": [
"starlette/middleware/base.py:BaseHTTPMiddleware"
]
},
"file": "starlette/middleware/ba... | encode/starlette | 70971eac55e5c8821d9e6af5fcf7bb995cc10570 | Background tasks don't work with middleware that subclasses `BaseHTTPMiddleware`
When using background tasks with middleware, requests are not processed until the background task has finished.
1. Use the example below
2. Make several requests in a row - works as expected
3. Uncomment `app.add_middleware(Transparen... | diff --git a/starlette/middleware/base.py b/starlette/middleware/base.py
index 49a5e3e..586c987 100644
--- a/starlette/middleware/base.py
+++ b/starlette/middleware/base.py
@@ -4,12 +4,13 @@ import anyio
from starlette.requests import Request
from starlette.responses import Response, StreamingResponse
-from starlet... |
encode__starlette-173 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/routing.py:replace_params",
"starlette/routing.py:Route.__init__",
"starlette/routing.py:Route.url_path_for",
"starlette/routing.py:WebSocketRoute.__init__",
"s... | encode/starlette | ed970c86be89a497e8082429726ce94dedcc6c0e | [question] how to mount router into Starlette app? `app.mount('/', router)` does't work
Example:
```python
from starlette.applications import Starlette
from starlette.middleware.cors import CORSMiddleware
from starlette.requests import Request
from starlette.routing import Router, Route
import uvicorn
from v... | diff --git a/starlette/routing.py b/starlette/routing.py
index 9f29d99..a2b851f 100644
--- a/starlette/routing.py
+++ b/starlette/routing.py
@@ -8,7 +8,7 @@ from enum import Enum
from starlette.datastructures import URL, URLPath
from starlette.exceptions import HTTPException
from starlette.requests import Request
-f... |
encode__starlette-195 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/staticfiles.py:StaticFiles.__init__"
],
"edited_modules": [
"starlette/staticfiles.py:StaticFiles"
]
},
"file": "starlette/staticfiles.py"
}
] | encode/starlette | 58888bb53fa54991479d8a9a4c32d6b41b334b2c | Check directory exists when instantiating `StaticFiles`
The `StaticFiles` application should ensure that the directory exists at the point it is instantiated.
(With an optional switch to turn this behavior off) | diff --git a/docs/staticfiles.md b/docs/staticfiles.md
index 448cc3b..cc8db5e 100644
--- a/docs/staticfiles.md
+++ b/docs/staticfiles.md
@@ -1,7 +1,12 @@
-Starlette also includes a `StaticFiles` class for serving a specific directory:
+Starlette also includes a `StaticFiles` class for serving files in a given directo... |
encode__starlette-208 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/responses.py:Response.__init__",
"starlette/responses.py:Response.init_headers"
],
"edited_modules": [
"starlette/responses.py:Response"
]
},
"file": ... | encode/starlette | 3a16d660490b54daad5711749fa00fd7a0970b4e | the raw "Response" should'nt mandatory a content ... no ?
I need to manage myself the etag/304 response ...
to send a 304 if-none-match, I use :
Response(status_code=304,content="",headers=rheaders)
But the body content should not be written ... here the content is mandatory : None cause troubble, and emp... | diff --git a/starlette/responses.py b/starlette/responses.py
index a6ebe8c..4390c29 100644
--- a/starlette/responses.py
+++ b/starlette/responses.py
@@ -31,13 +31,16 @@ class Response:
def __init__(
self,
- content: typing.Any,
+ content: typing.Any = None,
status_code: int = 200,... |
encode__starlette-2711 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/staticfiles.py:StaticFiles.lookup_path"
],
"edited_modules": [
"starlette/staticfiles.py:StaticFiles"
]
},
"file": "starlette/staticfiles.py"
}
] | encode/starlette | b68a142a356ede730083347f254e1eae8b5c803e | When the directory itself being a symlink does not work.
My test code:
```python
from fastapi import FastAPI
import uvicorn
from staticfiles import StaticFiles
app = FastAPI()
app.mount("/music", StaticFiles(directory="/home/hanxi/work/xiaomusic/music", follow_symlink=True), name="music")
uvicorn.run(
... | diff --git a/starlette/staticfiles.py b/starlette/staticfiles.py
index 7498c30..746e740 100644
--- a/starlette/staticfiles.py
+++ b/starlette/staticfiles.py
@@ -155,7 +155,7 @@ class StaticFiles:
full_path = os.path.abspath(joined_path)
else:
full_path = os.path.realpath(j... |
encode__starlette-272 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "starlette/datastructures.py"
},
{
"changes": {
"added_entities": [
"starlette/requests.py:HTTPConnection.client"
],
"added_m... | encode/starlette | 6d04e284d9951b62ba90e6bf5a9a897afaba4a29 | Get client IP address
Hi, i started using **Starlette** recently and for my application i need to log the client's IP address. It's important to note that i use **Hypercorn** as my ASGI server and it works great.
I started searching on Google how to get the IP address from **Starlette**, and i couldn't find it anywhe... | diff --git a/docs/requests.md b/docs/requests.md
index e07d687..295fb85 100644
--- a/docs/requests.md
+++ b/docs/requests.md
@@ -61,6 +61,15 @@ Router path parameters are exposed as a dictionary interface.
For example: `request.path_params['username']`
+#### Client Address
+
+The client's remote address is exposed... |
encode__starlette-2812 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/base.py:BaseHTTPMiddleware.__call__"
],
"edited_modules": [
"starlette/middleware/base.py:BaseHTTPMiddleware"
]
},
"file": "starlette/middleware/ba... | encode/starlette | f13d354e18141cea9041ffad603d98197d880a73 | middleware causes exceptions to not be raised/handled silently (back again)
Regression of #1976 #1977 #1609 #1940
This time I have noticed that changing `MyExc(Exception)` to `MyExc(BaseException)` means the error does get sent to stdout (if that helps) I tried to have a dig but I am not too sure where that catch e... | diff --git a/starlette/middleware/base.py b/starlette/middleware/base.py
index f146984..2a59337 100644
--- a/starlette/middleware/base.py
+++ b/starlette/middleware/base.py
@@ -103,10 +103,9 @@ class BaseHTTPMiddleware:
request = _CachedRequest(scope, receive)
wrapped_receive = request.wrapped_receive... |
encode__starlette-2815 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/formparsers.py:MultiPartParser.__init__"
],
"edited_modules": [
"starlette/formparsers.py:MultiPartParser"
]
},
"file": "starlette/formparsers.py"
},
{
... | encode/starlette | d6ace924c4b8732a54c97c198ee48a2b582f84f5 | MultiPartException: Part exceeded maximum size 1M
It came from [here](https://github.com/encode/starlette/commit/fd038f3070c302bff17ef7d173dbb0b007617733#diff-59eaf7e36ef8b186735f99bca714455f02f04cee26e014dc89120417996d35b2R121). @ version [0.41.3](https://github.com/encode/starlette/releases/tag/0.41.3)
Need to m... | diff --git a/docs/requests.md b/docs/requests.md
index 9140bb9..368755f 100644
--- a/docs/requests.md
+++ b/docs/requests.md
@@ -113,12 +113,12 @@ state with `disconnected = await request.is_disconnected()`.
Request files are normally sent as multipart form data (`multipart/form-data`).
-Signature: `request.form(m... |
encode__starlette-291 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/responses.py:Response.init_headers"
],
"edited_modules": [
"starlette/responses.py:Response"
]
},
"file": "starlette/responses.py"
}
] | encode/starlette | 9d20c9f6d6a8e659460e6781745d8a286dc42442 | Content-Type and Content-Length headers not automatically populated if headers is given
Hi! I was playing around with responses and stumbled upon what seems like a bug. I have already pushed a [fix](https://github.com/florimondmanca/starlette/commit/e6dc80d203b613f211003df63352a37550538e9a) on my fork and would be happ... | diff --git a/starlette/responses.py b/starlette/responses.py
index 542e800..3b8d275 100644
--- a/starlette/responses.py
+++ b/starlette/responses.py
@@ -63,8 +63,8 @@ class Response:
for k, v in headers.items()
]
keys = [h[0] for h in raw_headers]
- populate_content... |
encode__starlette-320 | [
{
"changes": {
"added_entities": [
"starlette/requests.py:Request.is_disconnected"
],
"added_modules": null,
"edited_entities": [
"starlette/requests.py:Request.__init__",
"starlette/requests.py:Request.stream"
],
"edited_modules": [
"starlette... | encode/starlette | af105b23d53efc41265793d4d74c2720038be529 | Detect/handle closed client connections
It appears like starlette does not cancel inner processing for when a client disconnects.
With the following code it will keep on fetching from the remote, although the
client has disconnected already, e.g. when cancelling a curl call.
```python
@app.route(…)
async def f... | diff --git a/docs/requests.md b/docs/requests.md
index 295fb85..d0cbfe7 100644
--- a/docs/requests.md
+++ b/docs/requests.md
@@ -109,3 +109,7 @@ class App:
If you access `.stream()` then the byte chunks are provided without storing
the entire body to memory. Any subsequent calls to `.body()`, `.form()`, or `.json()`
... |
encode__starlette-33 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/response.py:FileResponse.__call__"
],
"edited_modules": [
"starlette/response.py:FileResponse"
]
},
"file": "starlette/response.py"
}
] | encode/starlette | 590db3d6ea6c7f3b03013209822cda2c54dc38ae | Error serving static files larger than 4096 bytes
Static files larger than 4096 bytes do not appear to be served correctly.
Here's a test I just wrote that illustrates the problem: https://github.com/simonw/starlette/commit/e2d6665fa5c32e77a3fe22836b14620a7f5999bb
Running that test gives me the following output:
... | diff --git a/starlette/response.py b/starlette/response.py
index db5bac8..f189ef3 100644
--- a/starlette/response.py
+++ b/starlette/response.py
@@ -177,5 +177,9 @@ class FileResponse(Response):
chunk = await file.read(self.chunk_size)
more_body = len(chunk) == self.chunk_size
... |
encode__starlette-409 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/cors.py:CORSMiddleware.__init__",
"starlette/middleware/cors.py:CORSMiddleware.preflight_response"
],
"edited_modules": [
"starlette/middleware/cors.py:C... | encode/starlette | 9944bb7048458fed0c096a5f77baaa369935cec6 | Config/Settings dump?
What's the best way to dump all of the settings using starlette.config? I want to create an endpoint to make it easy to review the settings being used but I don't want the Secrets to be viewable, e.g. things like:
JWT_SECRET = config("JWT_SECRET", cast=starlette.datastructures.Secret)
We... | diff --git a/docs/config.md b/docs/config.md
index baa9e38..7c5b2a6 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -9,13 +9,13 @@ that is not committed to source control.
```python
from starlette.applications import Starlette
from starlette.config import Config
-from starlette.datastructures import CommaSeparat... |
encode__starlette-488 | [
{
"changes": {
"added_entities": [
"starlette/middleware/errors.py:ServerErrorMiddleware.genenrate_frame_html"
],
"added_modules": null,
"edited_entities": [
"starlette/middleware/errors.py:ServerErrorMiddleware.generate_frame_html",
"starlette/middleware/errors.p... | encode/starlette | d23bfd0d8ff68d535d0283aa4099e5055da88bb9 | Error in app startup event is not logged and does not prevent startup
Related #431 #177 and mentioned here https://github.com/encode/uvicorn/issues/333#issuecomment-484885300
Scenario:
I have a 'startup' event handler:
```python
@app.on_event('startup')
async def startup():
initialise()
```
and I am runn... | diff --git a/starlette/middleware/errors.py b/starlette/middleware/errors.py
index 54f5fd2..b56d6ba 100644
--- a/starlette/middleware/errors.py
+++ b/starlette/middleware/errors.py
@@ -121,7 +121,7 @@ class ServerErrorMiddleware:
# to optionally raise the error within the test case.
raise exc ... |
encode__starlette-557 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/base.py:BaseHTTPMiddleware.call_next"
],
"edited_modules": [
"starlette/middleware/base.py:BaseHTTPMiddleware"
]
},
"file": "starlette/middleware/b... | encode/starlette | 03bfdbc674975a2149b034f32825001e15182f13 | mypy errors when accessing Request.state
From https://www.starlette.io/requests/:
> Other state
>
> If you want to store additional information on the request you can do so using request.state.
>
> For example:
>
> request.state.time_started = time.time()
This causes mypy errors since any accessed/set attribu... | diff --git a/starlette/middleware/base.py b/starlette/middleware/base.py
index ea5afb2..67d35cc 100644
--- a/starlette/middleware/base.py
+++ b/starlette/middleware/base.py
@@ -29,7 +29,7 @@ class BaseHTTPMiddleware:
loop = asyncio.get_event_loop()
queue = asyncio.Queue() # type: asyncio.Queue
- ... |
encode__starlette-563 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/httpsredirect.py:HTTPSRedirectMiddleware.__call__"
],
"edited_modules": [
"starlette/middleware/httpsredirect.py:HTTPSRedirectMiddleware"
]
},
"fil... | encode/starlette | b2f9f4359b93a9f941779c575af764019e5183c7 | Use "308 Permanent Redirect" for redirect slashes behavior.
Hi,
I stumbled upon a quirk in starlette that is not properly documented. It seems like all of my HTTP request to a route without trailing slash are being redirected to route with trailing slashes. Say I am hitting `http://hostname/mountpoint/api` it will be ... | diff --git a/starlette/middleware/httpsredirect.py b/starlette/middleware/httpsredirect.py
index 13f3a70..7f646ed 100644
--- a/starlette/middleware/httpsredirect.py
+++ b/starlette/middleware/httpsredirect.py
@@ -13,7 +13,7 @@ class HTTPSRedirectMiddleware:
redirect_scheme = {"http": "https", "ws": "wss"}[... |
encode__starlette-699 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/datastructures.py:URL.__init__",
"starlette/datastructures.py:URLPath.make_absolute_url"
],
"edited_modules": [
"starlette/datastructures.py:URL",
"starlett... | encode/starlette | 1ea45ad54954e6af78a640acc4cd7cc665beb901 | Starlette behind reverse proxy, url_for does not return externally valid urls
Suppose I have my application reverse proxied, such that http://my.domain/foo (e.g. Traefik or Nginx) has the upstream http://localhost:8000 (the Starlette app). `url_for` will generate urls relative to the upstream url. How do I make it prod... | diff --git a/starlette/datastructures.py b/starlette/datastructures.py
index 930c581..4080624 100644
--- a/starlette/datastructures.py
+++ b/starlette/datastructures.py
@@ -21,7 +21,7 @@ class URL:
scheme = scope.get("scheme", "http")
server = scope.get("server", None)
path = scop... |
encode__starlette-701 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/routing.py:Mount.url_path_for"
],
"edited_modules": [
"starlette/routing.py:Mount"
]
},
"file": "starlette/routing.py"
}
] | encode/starlette | a92df1f61ede3b63ee9dcb315ce363c14242597b | Mounts without a name strips the path arg from calls to child routes in url_path_for
I'm using an unnamed Mount which contains a mount to a StaticFiles instance and when using "url_for" it is unable to find the matching file. After a bit of digging it seems to be directly related to url_for_path in Mount clearing the p... | diff --git a/starlette/routing.py b/starlette/routing.py
index 7a0d7ef..a1e4619 100644
--- a/starlette/routing.py
+++ b/starlette/routing.py
@@ -336,15 +336,18 @@ class Mount(BaseRoute):
else:
# 'name' matches "<mount_name>:<child_name>".
remaining_name = name[len(self.nam... |
encode__starlette-761 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/errors.py:ServerErrorMiddleware.__call__"
],
"edited_modules": [
"starlette/middleware/errors.py:ServerErrorMiddleware"
]
},
"file": "starlette/mid... | encode/starlette | 6182d0a0bc7e5817197d2919b18d67f70e3a71d1 | Background tasks exception handler
Currently, if a background task faces an exception, it isn't handled and there's no way to handle it (rather than wrapping the task)
My suggestion is to be able to add exception handler for background tasks, as there is for requests. | diff --git a/docs/exceptions.md b/docs/exceptions.md
index bf460d2..9818a20 100644
--- a/docs/exceptions.md
+++ b/docs/exceptions.md
@@ -75,6 +75,24 @@ should bubble through the entire middleware stack as exceptions. Any error
logging middleware should ensure that it re-raises the exception all the
way up to the serv... |
encode__starlette-8 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/decorators.py:asgi_application"
],
"edited_modules": [
"starlette/decorators.py:asgi_application"
]
},
"file": "starlette/decorators.py"
},
{
"changes... | encode/starlette | 4c621d58c0ce2f111fee4745f944ea6417f1cb53 | Request should present a scope-like interface
The `Request` class should present a dict-like interface so that it can be used in the same way as `scope`. Should also allow it to be instantiated without a `receive` channel being set initially. | diff --git a/README.md b/README.md
index f80bdb0..a8fb92f 100644
--- a/README.md
+++ b/README.md
@@ -152,7 +152,7 @@ the incoming request, rather than accessing the ASGI scope and receive channel d
### Request
-Signature: `Request(scope, receive)`
+Signature: `Request(scope, receive=None)`
```python
class App:... |
encode__starlette-801 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/middleware/cors.py:CORSMiddleware.is_allowed_origin"
],
"edited_modules": [
"starlette/middleware/cors.py:CORSMiddleware"
]
},
"file": "starlette/middleware/c... | encode/starlette | 5c43dde0ec0917673bb280bcd7ab0c37b78061b7 | Dangerous example regex for CORS Middleware?
Looking at the docs for CORS Middlware here: https://www.starlette.io/middleware/#corsmiddleware , under the `allow_origin_regex` attribute, the example value is `https://.*\.example\.org`.
However, based on the handler code for this at https://github.com/encode/starlette... | diff --git a/starlette/middleware/cors.py b/starlette/middleware/cors.py
index ad2eeff..90ba180 100644
--- a/starlette/middleware/cors.py
+++ b/starlette/middleware/cors.py
@@ -87,7 +87,7 @@ class CORSMiddleware:
if self.allow_all_origins:
return True
- if self.allow_origin_regex is not N... |
encode__starlette-867 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"starlette/requests.py:HTTPConnection.cookies"
],
"edited_modules": [
"starlette/requests.py:HTTPConnection"
]
},
"file": "starlette/requests.py"
}
] | encode/starlette | 0cb2d909a2a6d21219c66f8eec75a95f4b6d1c53 | [bug] Invalid cookie name leads to exception
When handling a request with an invalid cookie name (does not conform to RFC2109) starlette raises an exception. i.e iam/cookiename
This is because Starlette uses Python's stdlib cookie library, which is very strict.
I do understand the strictness, but in real life scenari... | diff --git a/docs/requests.md b/docs/requests.md
index f0ffc66..a72cb75 100644
--- a/docs/requests.md
+++ b/docs/requests.md
@@ -73,6 +73,8 @@ Cookies are exposed as a regular dictionary interface.
For example: `request.cookies.get('mycookie')`
+Cookies are ignored in case of an invalid cookie. (RFC2109)
+
#### B... |
encode__starlette-92 | [
{
"changes": {
"added_entities": [
"starlette/middleware/cors.py:CORSMiddleware.is_allowed_origin"
],
"added_modules": null,
"edited_entities": [
"starlette/middleware/cors.py:CORSMiddleware.__init__",
"starlette/middleware/cors.py:CORSMiddleware.__call__",
... | encode/starlette | bdf99f1f6173dc4fbe9ea323bf3f86905d479ac1 | Add `allow_origin_regex` to CORSMiddleware.
It'd be helpful if `CORSMiddleware` supported an `allow_origin_regex`, so that users could do...
```python
# Enforce a subdomain CORS policy
app.add_middleware(CORSMiddleware, allow_origin_regex="(http|https)://*.example.com")
```
Or...
```python
# Enforce an HTT... | diff --git a/starlette/middleware/cors.py b/starlette/middleware/cors.py
index e299e74..99b0687 100644
--- a/starlette/middleware/cors.py
+++ b/starlette/middleware/cors.py
@@ -3,6 +3,7 @@ from starlette.responses import PlainTextResponse
from starlette.types import ASGIApp, ASGIInstance, Scope
import functools
impo... |
encode__typesystem-109 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "setup.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
... | encode/typesystem | e806f2a4407615cd841f8938aafc656c9d7f4d0b | Password field
What do you think about this kind of field?
I was thinking about expanding String type as a first option:
`typesystem.String(format='password')`
or adding new kind of field `typesystem.Password`
Both options will ensure to create "password" type of input with hidden value.
The latter would ... | diff --git a/README.md b/README.md
index 147ffa6..9c18e6b 100644
--- a/README.md
+++ b/README.md
@@ -39,16 +39,16 @@ Python 3.6+
$ pip3 install typesystem
```
-If you'd like you use the form rendering you'll also want to install `jinja2`.
+If you'd like you use the form rendering using `jinja2`:
```shell
-$ pip3... |
encode__typesystem-111 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "typesystem/__init__.py"
},
{
"changes": {
"added_entities": [
"typesystem/fields.py:Email.__init__"
],
"added_modules": [
... | encode/typesystem | 851b60f3e08ae37b6548cc42e0e5407934f0a0d9 | `Email` field
adding new `Email` field:
- Validates inputs to be valid emails
- Displayed as `<input type="email">` in forms | diff --git a/typesystem/__init__.py b/typesystem/__init__.py
index 165a090..1f72729 100644
--- a/typesystem/__init__.py
+++ b/typesystem/__init__.py
@@ -8,6 +8,7 @@ from typesystem.fields import (
Date,
DateTime,
Decimal,
+ Email,
Field,
Float,
Integer,
@@ -35,6 +36,7 @@ __all__ = [
... |
encode__typesystem-122 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"typesystem/json_schema.py:from_json_schema",
"typesystem/json_schema.py:to_json_schema"
],
"edited_modules": [
"typesystem/json_schema.py:from_json_schema",
"typesyst... | encode/typesystem | 2e9dc5671d72fde45a1684cc28434b56ee3eda06 | References are broken for JSON schema (0.4.0)
### Checklist
<!-- Please make sure you check all these items before submitting your bug report. -->
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull requests to fix it yet.
### Describe the bug
Q... | diff --git a/docs/json_schema.md b/docs/json_schema.md
index a66f287..7605a76 100644
--- a/docs/json_schema.md
+++ b/docs/json_schema.md
@@ -7,7 +7,7 @@ TypeSystem can convert Schema or Field instances to/from JSON Schema.
All references should be of the style `{"$ref": "#/components/schemas/..."}`.
Using h... |
encode__typesystem-16 | [
{
"changes": {
"added_entities": [
"typesystem/fields.py:Field.get_default_value"
],
"added_modules": null,
"edited_entities": [
"typesystem/fields.py:Object.validate_value"
],
"edited_modules": [
"typesystem/fields.py:Object",
"typesystem/fiel... | encode/typesystem | 2fcc6daebd0193a02d135daee4564f0e219e95ed | Callable defaults
Eg.
```python
class Something(typesystem.Schema):
created = typesystem.DateTime(default=datetime.datetime.now)
...
``` | diff --git a/typesystem/fields.py b/typesystem/fields.py
index 90716ef..266177c 100644
--- a/typesystem/fields.py
+++ b/typesystem/fields.py
@@ -63,6 +63,12 @@ class Field:
def has_default(self) -> bool:
return hasattr(self, "default")
+ def get_default_value(self) -> typing.Any:
+ default = g... |
encode__typesystem-39 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"typesystem/forms.py:Form.render_field"
],
"edited_modules": [
"typesystem/forms.py:Form"
]
},
"file": "typesystem/forms.py"
}
] | encode/typesystem | 765ae6dfb810d853d5a91dcbc42bfc07750fdeee | Don't echo values back if `format="password"`
Just needs a tweak in `Form.render_field` to set `value=""`, and a test case. | diff --git a/docs/schemas.md b/docs/schemas.md
index 4064ca0..b75f524 100644
--- a/docs/schemas.md
+++ b/docs/schemas.md
@@ -105,7 +105,7 @@ print(dict(album))
Index lookup on schema instances returns serialized datatypes.
```python
-print(type(album['release_date']))
+print(type(album.release_date))
# <class 'str... |
encode__typesystem-44 | [
{
"changes": {
"added_entities": [
"typesystem/fields.py:normalize_regex"
],
"added_modules": [
"typesystem/fields.py:normalize_regex"
],
"edited_entities": [
"typesystem/fields.py:String.__init__",
"typesystem/fields.py:String.validate"
],
... | encode/typesystem | fc0800939c47c254f4fcc3f92dacd0b899cb8402 | better error messages for regular expression validation
string fields can have a `pattern` for validation, and since `re.search()` is used under the hood, the pattern can be either a regular expression as a string or a compiled regular expression (`re.compile(...)` is cached and can have flags).
so far so good, but ... | diff --git a/docs/fields.md b/docs/fields.md
index 0f694b0..5ce383b 100644
--- a/docs/fields.md
+++ b/docs/fields.md
@@ -58,7 +58,7 @@ For example: `username = typesystem.String(max_length=100)`
* `trim_whitespace` - A boolean indicating if leading/trailing whitespace should be removed on validation. **Default: `True`... |
encode__typesystem-65 | [
{
"changes": {
"added_entities": [
"typesystem/base.py:Message.__hash__",
"typesystem/base.py:BaseError.__hash__"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"typesystem/base.py:Message",
"typesystem/base.py:BaseError"
... | encode/typesystem | 453c6fb05a43efe26ffeb476ca311a199a4fb704 | ValidationError can't be shown with `traceback.print_exc()` in Python 3.6
Consider the following code:
```python
import traceback
import typesystem
try:
typesystem.Integer().validate("hello")
except typesystem.ValidationError:
traceback.print_exc()
```
Because of an issue with Python 3.6 discusse... | diff --git a/typesystem/base.py b/typesystem/base.py
index bd15068..def115c 100644
--- a/typesystem/base.py
+++ b/typesystem/base.py
@@ -78,6 +78,10 @@ class Message:
and self.end_position == other.end_position
)
+ def __hash__(self) -> int:
+ ident = (self.code, tuple(self.index))
+ ... |
encode__uvicorn-114 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "uvicorn/__init__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"uvicorn/protocol... | encode/uvicorn | df2e97eaf6560dc4f7f3d321ab1f085553125ba0 | RuntimeError in uvicorn for some requests
`uvicorn==0.2.5` is throwing errors for some requests.
```
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/chillar/.virtualenvs/library/lib/python3.6/site-packages/uvicorn/protocols/http/httptools.py", line 196, in run_asgi
resul... | diff --git a/uvicorn/__init__.py b/uvicorn/__init__.py
index bfd395e..385fbc3 100644
--- a/uvicorn/__init__.py
+++ b/uvicorn/__init__.py
@@ -1,4 +1,4 @@
from uvicorn.main import main, run
-__version__ = "0.2.5"
+__version__ = "0.2.6"
__all__ = ["main", "run"]
diff --git a/uvicorn/protocols/http/h11.py b/uvicorn/pro... |
encode__uvicorn-115 | [
{
"changes": {
"added_entities": [
"uvicorn/protocols/http/h11.py:H11Protocol.handle_events",
"uvicorn/protocols/http/h11.py:H11Protocol.on_response_complete"
],
"added_modules": null,
"edited_entities": [
"uvicorn/protocols/http/h11.py:H11Protocol.data_received",... | encode/uvicorn | 870a8e24a6e9bda8be473e991b99ed7b172d5648 | Pipelining support in `httptools` implementation
We've temporarily dropped pipelining support from the `httptools` implementation, although everythings in place in order to support it. Need to:
Keep track of queued request/response cycles if a new cycle starts before the existing one has finished. Callback to the pr... | diff --git a/README.md b/README.md
index 07ab4ef..cb26c8d 100644
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@ class App():
})
await send({
'type': 'http.response.body',
- 'body': b'Hello, world!',
+ 'body': 'Hello, world!',
})
```
diff --git a/uvicor... |
encode__uvicorn-1263 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "uvicorn/main.py"
},
{
"changes": {
"added_entities": [
"uvicorn/protocols/http/httptools_impl.py:HttpToolsProtocol.on_message_begin"
... | encode/uvicorn | 521b83ed0edd46eabba61a9ba4f4f3c0a58fce58 | httptools.parser.errors.HttpParserInvalidURLError on fragmented first line of the HTTP request.
### Checklist
<!-- Please make sure you check all these items before submitting your bug report. -->
- [x] The bug is reproducible against the latest release and/or `master`.
- [x] There are no similar issues or pull ... | diff --git a/docs/deployment.md b/docs/deployment.md
index 60d1af7..2224f98 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -39,12 +39,15 @@ Options:
of using the current working directory.
--reload-include TEXT Set glob patterns to include while watching
... |
encode__uvicorn-1267 | [
{
"changes": {
"added_entities": [
"uvicorn/config.py:_normalize_dirs"
],
"added_modules": [
"uvicorn/config.py:_normalize_dirs"
],
"edited_entities": [
"uvicorn/config.py:resolve_reload_patterns",
"uvicorn/config.py:Config.__init__"
],
"... | encode/uvicorn | 81802ceee2a2c62f0b10f78e2b6366b47bc76f72 | Passing `reload_dirs` as a string instead of a list
@Roang-zero1 @euri10 @Kludex this PR introduced a regression and deleted the test for it (`test_reload_dir_is_set()`). Previously you could pass `reload_dirs` a string instead of a list. Now:
```python
Config('myapp:app', reload=True, reload_dirs='src')
```
prints... | diff --git a/uvicorn/config.py b/uvicorn/config.py
index 683a830..59c94b4 100644
--- a/uvicorn/config.py
+++ b/uvicorn/config.py
@@ -180,7 +180,15 @@ def resolve_reload_patterns(
directories = list(set(directories).difference(set(children)))
- return (list(set(patterns)), directories)
+ return list(set(p... |
encode__uvicorn-1329 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "uvicorn/main.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"uvicorn/middleware/w... | encode/uvicorn | 521b83ed0edd46eabba61a9ba4f4f3c0a58fce58 | WSGI interface: reading request body is O(n^2) wrt payload size
Hello!
This is related to https://github.com/encode/uvicorn/issues/371 and potentially a duplicate/complementary information, feel free to close if it is deemed to be the case.
I was fooling around with different WSGI and ASGI servers while hacking on ... | diff --git a/docs/deployment.md b/docs/deployment.md
index 60d1af7..2224f98 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -39,12 +39,15 @@ Options:
of using the current working directory.
--reload-include TEXT Set glob patterns to include while watching
... |
encode__uvicorn-1600 | [
{
"changes": {
"added_entities": [
"uvicorn/server.py:Server._serve",
"uvicorn/server.py:Server.capture_signals"
],
"added_modules": null,
"edited_entities": [
"uvicorn/server.py:Server.__init__",
"uvicorn/server.py:Server.serve",
"uvicorn/server.p... | encode/uvicorn | f73b8beeb1499ca5fcec3067cf89dad5326a0984 | uvicorn eats SIGINTs, does not propagate exceptions
The following snippet cannot be killed with a SIGINT (ctrl+c):
```python
import asyncio
from starlette.applications import Starlette
from uvicorn import Config, Server
async def web_ui():
await Server(Config(Starlette())).serve()
async def task():
... | diff --git a/uvicorn/server.py b/uvicorn/server.py
index c7645f3..bfce1b1 100644
--- a/uvicorn/server.py
+++ b/uvicorn/server.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import asyncio
+import contextlib
import logging
import os
import platform
@@ -11,7 +12,7 @@ import threading
import time
from emai... |
encode__uvicorn-165 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"uvicorn/protocols/http/h11_impl.py:RequestResponseCycle.send"
],
"edited_modules": [
"uvicorn/protocols/http/h11_impl.py:RequestResponseCycle"
]
},
"file": "uvicorn/pro... | encode/uvicorn | 5e2da780ae775dbe963066554d3bb230a41c7f9c | Drop response body on HEAD requests | diff --git a/uvicorn/protocols/http/h11_impl.py b/uvicorn/protocols/http/h11_impl.py
index ab9cdaf..598b5e0 100644
--- a/uvicorn/protocols/http/h11_impl.py
+++ b/uvicorn/protocols/http/h11_impl.py
@@ -465,7 +465,10 @@ class RequestResponseCycle:
more_body = message.get("more_body", False)
# ... |
encode__uvicorn-166 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"uvicorn/protocols/http/h11_impl.py:RequestResponseCycle.__init__",
"uvicorn/protocols/http/h11_impl.py:RequestResponseCycle.send",
"uvicorn/protocols/http/h11_impl.py:RequestResponseCycl... | encode/uvicorn | fa5185f348aa3be814f986abdec967d9de4a57f3 | Support `Expect: 100-Continue`
* Deal with `Expect: 100-Continue` headers gracefully, by only sending if the request body is read prior to sending the response headers. | diff --git a/uvicorn/protocols/http/h11_impl.py b/uvicorn/protocols/http/h11_impl.py
index 598b5e0..23c021d 100644
--- a/uvicorn/protocols/http/h11_impl.py
+++ b/uvicorn/protocols/http/h11_impl.py
@@ -361,6 +361,7 @@ class RequestResponseCycle:
# Connection state
self.disconnected = False
sel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.