Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shrapnel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
shrapnel
Commits
5835454d
Commit
5835454d
authored
Jun 21, 2012
by
Sam Rushing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTTP_Upgrade: allow a handler to upgrade out of HTTP
parent
78cca542
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
coro/http/server.py
coro/http/server.py
+7
-2
No files found.
coro/http/server.py
View file @
5835454d
...
...
@@ -16,7 +16,7 @@ import sys
import
time
import
zlib
from
protocol
import
latch
,
http_file
,
header_set
from
protocol
import
latch
,
http_file
,
header_set
,
HTTP_Upgrade
W
=
sys
.
stderr
.
write
...
...
@@ -70,6 +70,7 @@ class connection:
self
.
conn
=
conn
self
.
peer
=
peer
self
.
stream
=
read_stream
.
sock_stream
(
self
.
conn
)
upgrade
=
False
try
:
try
:
for
request
in
request_stream
(
self
,
self
.
stream
).
gen_requests
():
...
...
@@ -87,6 +88,9 @@ class connection:
request
.
wait_until_done
()
except
(
coro
.
TimeoutError
,
coro
.
Interrupted
):
raise
except
HTTP_Upgrade
:
upgrade
=
True
break
except
:
tb
=
coro
.
compact_traceback
()
request
.
error
(
500
,
tb
)
...
...
@@ -94,7 +98,8 @@ class connection:
except
(
OSError
,
coro
.
TimeoutError
,
coro
.
ClosedError
):
pass
finally
:
self
.
conn
.
close
()
if
not
upgrade
:
self
.
conn
.
close
()
def
pick_handler
(
self
,
request
):
for
handler
in
self
.
server
.
handlers
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment