Skip to content

Commit

Permalink
Fix spec_version value from WebSocket and HTTP connection scopes (#1337)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored Jan 25, 2022
1 parent e659cf5 commit fa5ad7c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/protocols/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ async def asgi(receive, send):


asgi_scope_data = [
(asgi3app, {"version": "3.0", "spec_version": "2.1"}),
(asgi2app, {"version": "2.0", "spec_version": "2.1"}),
(asgi3app, {"version": "3.0", "spec_version": "2.3"}),
(asgi2app, {"version": "2.0", "spec_version": "2.3"}),
]


Expand Down
2 changes: 1 addition & 1 deletion uvicorn/protocols/http/h11_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def handle_events(self):
"type": "http",
"asgi": {
"version": self.config.asgi_version,
"spec_version": "2.1",
"spec_version": "2.3",
},
"http_version": event.http_version.decode("ascii"),
"server": self.server,
Expand Down
2 changes: 1 addition & 1 deletion uvicorn/protocols/http/httptools_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def on_url(self, url):
self.headers = []
self.scope = {
"type": "http",
"asgi": {"version": self.config.asgi_version, "spec_version": "2.1"},
"asgi": {"version": self.config.asgi_version, "spec_version": "2.3"},
"http_version": "1.1",
"server": self.server,
"client": self.client,
Expand Down
2 changes: 1 addition & 1 deletion uvicorn/protocols/websockets/websockets_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async def process_request(self, path, headers):

self.scope = {
"type": "websocket",
"asgi": {"version": self.config.asgi_version, "spec_version": "2.1"},
"asgi": {"version": self.config.asgi_version, "spec_version": "2.3"},
"http_version": "1.1",
"scheme": self.scheme,
"server": self.server,
Expand Down
2 changes: 1 addition & 1 deletion uvicorn/protocols/websockets/wsproto_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def handle_connect(self, event):
raw_path, _, query_string = event.target.partition("?")
self.scope = {
"type": "websocket",
"asgi": {"version": self.config.asgi_version, "spec_version": "2.1"},
"asgi": {"version": self.config.asgi_version, "spec_version": "2.3"},
"http_version": "1.1",
"scheme": self.scheme,
"server": self.server,
Expand Down

0 comments on commit fa5ad7c

Please sign in to comment.