clean a litle the rep

This commit is contained in:
Benoit Chesneau 2010-01-21 00:51:48 +01:00
parent b568852465
commit 6da023a7da
10 changed files with 9 additions and 20008 deletions

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,6 @@ class Worker(object):
self.app = app
self.alive = True
self.log = logging.getLogger(__name__)
def close_on_exec(self, fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFD) | fcntl.FD_CLOEXEC

View File

@ -1,15 +0,0 @@
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Sun, 26 Apr 2009 11:11:49 GMT
Expires: Tue, 26 May 2009 11:11:49 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

View File

@ -1,16 +0,0 @@
HTTP/1.1 200 OK
Date: Tue, 04 Aug 2009 07:59:32 GMT
Server: Apache
X-Powered-By: Servlet/2.5 JSP/2.1
Content-Type: text/xml; charset=utf-8
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Client Error</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

View File

@ -1,2 +0,0 @@
HTTP/1.1 404 Not Found

View File

@ -1,2 +0,0 @@
HTTP/1.1 301

View File

@ -1,11 +0,0 @@
HTTP/1.1 200 OK
Content-Type: text/plain
Transfer-Encoding: chunked
25
This is the data in the first chunk
1C
and this is the second one
0

View File

@ -1,5 +0,0 @@
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Connection: close
these headers are from http://news.ycombinator.com/

View File

@ -1,7 +0,0 @@
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 11
Proxy-Connection: close
Date: Thu, 31 Dec 2009 20:55:48 +0000
hello world

View File

@ -37,11 +37,12 @@ class request(object):
class FakeSocket(object):
def __init__(self, data):
def __init__(self, data=""):
self.tmp = tempfile.TemporaryFile()
self.tmp.write(data)
self.tmp.flush()
self.tmp.seek(0)
if data:
self.tmp.write(data)
self.tmp.flush()
self.tmp.seek(0)
def fileno(self):
return self.tmp.fileno()
@ -52,6 +53,10 @@ class FakeSocket(object):
def recv(self, length=None):
return self.tmp.read()
def send(self, data):
self.tmp.write(data)
self.tmp.flush()
def seek(self, offset, whence=0):
self.tmp.seek(offset, whence)
@ -63,8 +68,6 @@ class http_request(object):
def __call__(self, func):
def run():
fsock = FakeSocket(data_source(self.fname))
req = HttpRequest(fsock, ('127.0.0.1', 6000),
('127.0.0.1', 8000))
func(req)