Commit a2670e2e authored by 's avatar

Added P.Eby patch to deal with IRIX cgi-fcgi where the client doesnt

seem to know when its done sending stdin and ZServer hangs waiting for
it. The patch makes ZServer ignore stdin if there is no Content-Length
and makes it stop looking if Content-Length or more bytes have already
been read.
parent efede089
...@@ -430,6 +430,10 @@ class FCGIChannel(asynchat.async_chat): ...@@ -430,6 +430,10 @@ class FCGIChannel(asynchat.async_chat):
elif rec.recType == FCGI_PARAMS: elif rec.recType == FCGI_PARAMS:
if rec.contentLength == 0: # end of the stream if rec.contentLength == 0: # end of the stream
self.remainingRecs = self.remainingRecs - 1 self.remainingRecs = self.remainingRecs - 1
self.content_length=string.atoi(self.env.get(
'CONTENT_LENGTH','0'))
if self.content_length==0:
self.remainingRecs = self.remainingRecs - 1
else: else:
self.env.update(rec.values) self.env.update(rec.values)
...@@ -447,6 +451,10 @@ class FCGIChannel(asynchat.async_chat): ...@@ -447,6 +451,10 @@ class FCGIChannel(asynchat.async_chat):
self.stdin=t self.stdin=t
self.using_temp_stdin=1 self.using_temp_stdin=1
self.stdin.write(rec.content) self.stdin.write(rec.content)
self.content_length = self.content_length - rec.contentLength
if self.content_length <= 0:
self.remainingRecs = self.remainingRecs - 1
# read some filter data # read some filter data
elif rec.recType == FCGI_DATA: elif rec.recType == FCGI_DATA:
...@@ -457,7 +465,7 @@ class FCGIChannel(asynchat.async_chat): ...@@ -457,7 +465,7 @@ class FCGIChannel(asynchat.async_chat):
# We've processed the record. Now what do we do? # We've processed the record. Now what do we do?
if self.remainingRecs: if self.remainingRecs > 0:
# prepare to get the next record # prepare to get the next record
self.setInitialState() self.setInitialState()
......
...@@ -430,6 +430,10 @@ class FCGIChannel(asynchat.async_chat): ...@@ -430,6 +430,10 @@ class FCGIChannel(asynchat.async_chat):
elif rec.recType == FCGI_PARAMS: elif rec.recType == FCGI_PARAMS:
if rec.contentLength == 0: # end of the stream if rec.contentLength == 0: # end of the stream
self.remainingRecs = self.remainingRecs - 1 self.remainingRecs = self.remainingRecs - 1
self.content_length=string.atoi(self.env.get(
'CONTENT_LENGTH','0'))
if self.content_length==0:
self.remainingRecs = self.remainingRecs - 1
else: else:
self.env.update(rec.values) self.env.update(rec.values)
...@@ -447,6 +451,10 @@ class FCGIChannel(asynchat.async_chat): ...@@ -447,6 +451,10 @@ class FCGIChannel(asynchat.async_chat):
self.stdin=t self.stdin=t
self.using_temp_stdin=1 self.using_temp_stdin=1
self.stdin.write(rec.content) self.stdin.write(rec.content)
self.content_length = self.content_length - rec.contentLength
if self.content_length <= 0:
self.remainingRecs = self.remainingRecs - 1
# read some filter data # read some filter data
elif rec.recType == FCGI_DATA: elif rec.recType == FCGI_DATA:
...@@ -457,7 +465,7 @@ class FCGIChannel(asynchat.async_chat): ...@@ -457,7 +465,7 @@ class FCGIChannel(asynchat.async_chat):
# We've processed the record. Now what do we do? # We've processed the record. Now what do we do?
if self.remainingRecs: if self.remainingRecs > 0:
# prepare to get the next record # prepare to get the next record
self.setInitialState() self.setInitialState()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment