Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
gevent
Commits
635bdd22
Commit
635bdd22
authored
Aug 02, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove gevent.http
parent
dc957cc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
48 deletions
+0
-48
gevent/http.py
gevent/http.py
+0
-48
No files found.
gevent/http.py
deleted
100644 → 0
View file @
dc957cc2
# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details.
raise
AssertionError
(
'TODO: gevent.http'
)
from
gevent
import
core
from
gevent.baseserver
import
BaseServer
from
gevent.hub
import
get_hub
__all__
=
[
'HTTPServer'
]
class
HTTPServer
(
BaseServer
):
"""An HTTP server based on libevent-http.
*handle* is called with one argument: an :class:`gevent.core.http_request` instance.
"""
default_response_headers
=
[(
'Connection'
,
'close'
)]
def
__init__
(
self
,
listener
,
handle
=
None
,
backlog
=
None
,
spawn
=
'default'
,
default_response_headers
=
'default'
):
BaseServer
.
__init__
(
self
,
listener
,
handle
=
handle
,
backlog
=
backlog
,
spawn
=
spawn
)
self
.
http
=
None
if
default_response_headers
!=
'default'
:
self
.
default_response_headers
=
default_response_headers
def
_on_request
(
self
,
request
):
spawn
=
self
.
_spawn
if
spawn
is
None
:
self
.
handle
(
request
)
else
:
if
self
.
full
():
self
.
_on_full
(
request
)
else
:
spawn
(
self
.
handle
,
request
)
def
_on_full
(
self
,
request
):
msg
=
'Service Temporarily Unavailable'
request
.
add_output_header
(
'Connection'
,
'close'
)
request
.
add_output_header
(
'Content-type'
,
'text/plain'
)
request
.
add_output_header
(
'Content-length'
,
str
(
len
(
msg
)))
request
.
send_reply
(
503
,
'Service Unavailable'
,
msg
)
def
start_accepting
(
self
):
reactor
=
get_hub
().
reactor
self
.
http
=
core
.
http
(
self
.
_on_request
,
self
.
default_response_headers
,
base
=
reactor
)
self
.
http
.
accept
(
self
.
socket
.
fileno
())
def
stop_accepting
(
self
):
self
.
http
=
None
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