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
728b8b9b
Commit
728b8b9b
authored
Apr 29, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pywsgi: add format_request() and log_request(). patch by Ralf Schmitt.
parent
19dc8b66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
gevent/pywsgi.py
gevent/pywsgi.py
+16
-15
No files found.
gevent/pywsgi.py
View file @
728b8b9b
...
...
@@ -226,9 +226,21 @@ class HttpProtocol(BaseHTTPServer.BaseHTTPRequestHandler):
self
.
write
(
d
)
return
safe_write
def
log_request
(
self
,
*
args
):
self
.
server
.
log_message
(
self
.
format_request
(
*
args
))
def
format_request
(
self
,
length
=
'-'
):
return
'%s - - [%s] "%s" %s %s %.6f'
%
(
self
.
client_address
[
0
],
self
.
log_date_time_string
(),
self
.
requestline
,
self
.
status
.
split
()[
0
],
self
.
response_length
,
self
.
time_finish
-
self
.
time_start
)
def
handle_one_response
(
self
):
start
=
time
.
time
()
self
.
status
=
None
s
elf
.
time_s
tart
=
time
.
time
()
self
.
status
=
'-'
self
.
headers_sent
=
False
self
.
result
=
None
...
...
@@ -256,20 +268,9 @@ class HttpProtocol(BaseHTTPServer.BaseHTTPRequestHandler):
if
self
.
wsgi_input
.
position
<
self
.
environ
.
get
(
'CONTENT_LENGTH'
,
0
):
## Read and discard body
self
.
wsgi_input
.
read
()
finish
=
time
.
time
()
if
self
.
status
is
not
None
:
status
=
self
.
status
.
split
()[
0
]
else
:
status
=
'-'
self
.
server
.
log_message
(
'%s - - [%s] "%s" %s %s %.6f'
%
(
self
.
client_address
[
0
],
self
.
log_date_time_string
(),
self
.
requestline
,
status
,
self
.
response_length
,
finish
-
start
))
self
.
time_finish
=
time
.
time
()
self
.
log_request
()
def
get_environ
(
self
):
env
=
self
.
server
.
get_environ
()
...
...
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