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
6c8789c9
Commit
6c8789c9
authored
Jan 28, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test__pywsgi.py: add a test case for read_requestline
parent
0a43651c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
greentest/test__pywsgi.py
greentest/test__pywsgi.py
+45
-0
No files found.
greentest/test__pywsgi.py
View file @
6c8789c9
...
...
@@ -955,6 +955,51 @@ class TestInvalidEnviron(TestCase):
read_http
(
fd
)
class
TestSubclass1
(
TestCase
):
validator
=
None
def
application
(
self
,
environ
,
start_response
):
start_response
(
'200 OK'
,
[])
return
[]
def
init_server
(
self
,
application
):
WSGIHandler
=
self
.
get_wsgi_module
().
WSGIHandler
class
Handler
(
WSGIHandler
):
def
read_requestline
(
self
):
data
=
self
.
rfile
.
read
(
7
)
if
data
[
0
]
==
'<'
:
try
:
data
+=
self
.
rfile
.
read
(
15
)
if
data
.
lower
()
==
'<policy-file-request/>'
:
self
.
socket
.
sendall
(
'HELLO'
)
else
:
self
.
log_error
(
'Invalid request: %r'
,
data
)
finally
:
self
.
socket
.
shutdown
(
socket
.
SHUT_WR
)
self
.
socket
.
close
()
self
.
socket
=
None
else
:
return
data
+
self
.
rfile
.
readline
()
self
.
server
=
self
.
get_wsgi_module
().
WSGIServer
((
'127.0.0.1'
,
0
),
application
,
handler_class
=
Handler
)
def
test
(
self
):
fd
=
self
.
makefile
()
fd
.
write
(
'<policy-file-request/>
\
x00
'
)
self
.
assertEqual
(
fd
.
read
(),
'HELLO'
)
fd
=
self
.
makefile
()
fd
.
write
(
'GET / HTTP/1.1
\
r
\
n
Host: localhost
\
r
\
n
Connection: close
\
r
\
n
\
r
\
n
'
)
read_http
(
fd
)
fd
=
self
.
makefile
()
fd
.
write
(
'<policy-file-XXXuest/>
\
x00
'
)
self
.
assertEqual
(
fd
.
read
(),
''
)
del
CommonTests
if
__name__
==
'__main__'
:
...
...
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