#25619 closed New feature (fixed)
Make runserver use HTTP 1.1
Reported by: | Gerben Morsink | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | k@…, clokep@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
And http_version 1.0 is not working with websockets.
I don't know exactly why this is happening, but I don't think it is meant to be like this.
I think HTTP/1.1 is fine to use for the development runserver.
Change History (17)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I cannot confirm this, I've checked with one of my site with Django 1.8 and the response was HTTP/1.1 200 OK
.
By the way, this is probably controlled by the Web server, not Django.
comment:3 by , 9 years ago
Resolution: | worksforme |
---|---|
Status: | closed → new |
Oh, sorry, I didn't pay attention to the runserver
part...
comment:4 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Version: | 1.7 → master |
Looks like that change would be required:
-
django/core/servers/basehttp.py
diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py index 4e2f8dd..1e0f0c2 100644
a b class WSGIServer(simple_server.WSGIServer, object): 86 86 87 87 # Inheriting from object required on Python 2. 88 88 class ServerHandler(simple_server.ServerHandler, object): 89 http_version = "1.1" 89 90 def handle_error(self): 90 91 # Ignore broken pipe errors, otherwise pass on 91 92 if not is_broken_pipe_error():
However, I didn't find the possible faulty commit.
comment:5 by , 9 years ago
Has patch: | set |
---|
comment:6 by , 9 years ago
Summary: | Since Django ~1.6.4 the dev runserver uses http_version 1.0, before it was 1.1 → Make runserver use HTTP 1.1 |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Type: | Bug → New feature |
comment:7 by , 9 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
As noted on the pull request , it looks to me like we'd also need to set WSGIServer.protocol_version() too. Not sure this is trivial given the sentence in the Python docs, "If set to 'HTTP/1.1', the server will permit HTTP persistent connections; however, your server must then include an accurate Content-Length header (using send_header()) in all of its responses to clients." Given that, I'd be surprised if older versions of runserver really used HTTP 1.1.
comment:8 by , 9 years ago
Seems this ticket depends on #5897 (setting Content-Length on non-streaming responses).
comment:9 by , 9 years ago
Cc: | added |
---|
comment:10 by , 8 years ago
Patch needs improvement: | unset |
---|
comment:11 by , 8 years ago
Patch needs improvement: | set |
---|
As noted on the PR, this causes problems when running the selenium tests, at least on Chrome.
comment:12 by , 8 years ago
Cc: | added |
---|
comment:13 by , 8 years ago
Patch needs improvement: | unset |
---|
I've recreated a pull request after #20238 has been fixed. Hopefully selenium tests will pass now.
comment:14 by , 8 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
What methodology are you using to test? Can you bisect Django's commit history to determine where the behavior changed?