Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

git-svn-id: svn://cherokee-project.com/cherokee-pyscgi@1908 5dc97367-…

…97f1-0310-9951-d761b3857238
  • Loading branch information...
commit 2d3536033ad69ab2038b3921dc6c54810774e336 1 parent 2050db5
@alobbs alobbs authored
Showing with 22 additions and 6 deletions.
  1. +9 −0 ChangeLog
  2. +13 −6 pyscgi/pyscgi.py
View
9 ChangeLog
@@ -1,3 +1,12 @@
+2008-08-27 Alvaro Lopez Ortega <alvaro@alobbs.com>
+
+ * pyscgi.py (SCGIHandler.handle_request): The default handler
+ method had to use send() so reply the requests rather than the low
+ level self.wfile socket.
+
+ * Applies a couple of changes that there released with 1.7 but
+ that for some reason were not committed.
+
2008-03-23 Alvaro Lopez Ortega <alvaro@alobbs.com>
* pyscgi/pyscgi.py: Added a new method send() to write the
View
19 pyscgi/pyscgi.py
@@ -41,7 +41,7 @@
import errno
import sys
-__version__ = '1.6'
+__version__ = '1.8'
__author__ = 'Alvaro Lopez Ortega'
@@ -52,14 +52,18 @@ def __init__ (self, request, client_address, server):
SocketServer.StreamRequestHandler.__init__ (self, request, client_address, server)
def __safe_read (self, lenght):
- while True:
+ while True:
+ chunk = None
try:
- return self.rfile.read(lenght)
+ chunk = self.rfile.read(lenght)
+ return chunk
except socket.error, (err, strerr):
if err == errno.EAGAIN or \
err == errno.EWOULDBLOCK or \
err == errno.EINPROGRESS:
- continue
+ if chunk:
+ return chunk
+ continue
raise
def send(self, buf):
@@ -110,6 +114,8 @@ def __read_env (self):
def handle_post (self):
if not self.env.has_key('CONTENT_LENGTH'):
return
+ if self.post:
+ return
length = int(self.env['CONTENT_LENGTH'])
self.post = self.__safe_read(length)
@@ -128,8 +134,9 @@ def handle (self):
except: pass
def handle_request (self):
- self.wfile.write("Content-Type: text/plain\r\n\r\n")
- self.wfile.write("handle_request() should be overridden")
+ self.send('Status: 200 OK\r\n')
+ self.send("Content-Type: text/plain\r\n\r\n")
+ self.send("handle_request() should be overridden")
class SCGIServer(SocketServer.ThreadingTCPServer):
Please sign in to comment.
Something went wrong with that request. Please try again.