Hi all,
I've got a plugin which is POSTing text/xml data. Unfortunately I
always get 'broken pipe' exceptions. I have written a small test
server to verify the clients behaviour and all seems fine. Any ideas
what might be wrong here?
[Update]:
Well, it seems I *can* actually read the data (via req.read()) and
everything kinda works. Still, the error: (32, 'Broken pipe') occurs
on each request POSTed to my process_request. Besides being slightly
annoying it eats tracebacks which makes debugging harder.
thanks
Paul
Details (hope indentation will not get messed up):
plattform: linux
python: 2.5.4
trac: 0.12dev (today)
def process_request(self, req):
if req.method == 'POST':
data = req.read()
req.send_response(301)
req.end_headers()
#....process data....
raise RequestDone
tracd traceback:
127.0.0.1 - - [04/Mar/2009 23:45:45] "POST /tracenv/collector HTTP/
1.1" 301 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1',
60572)
Traceback (most recent call
last):
File "/usr/lib/python2.5/SocketServer.py", line 464, in
process_request_thread
self.finish_request(request,
client_address)
File "/usr/lib/python2.5/SocketServer.py", line 254, in
finish_request
self.RequestHandlerClass(request, client_address,
self)
File "/usr/lib/python2.5/SocketServer.py", line 522, in
__init__
self.handle()
File "/usr/lib/python2.5/BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "/home/pkoelle/trac012dev/trac/web/wsgi.py", line 175, in
handle_one_request
gateway.run(self.server.application)
File "/home/pkoelle/trac012dev/trac/web/wsgi.py", line 98, in run
self._write('')
File "/home/pkoelle/trac012dev/trac/web/wsgi.py", line 196, in
_write
self.handler.send_response(int(status[:3]))
File "/usr/lib/python2.5/BaseHTTPServer.py", line 371, in
send_response
self.send_header('Date', self.date_time_string())
File "/usr/lib/python2.5/BaseHTTPServer.py", line 376, in
send_header
self.wfile.write("%s: %s\r\n" % (keyword, value))
File "/usr/lib/python2.5/socket.py", line 274, in write
self.flush()
File "/usr/lib/python2.5/socket.py", line 261, in flush
self._sock.sendall(buffer)
error: (32, 'Broken pipe')
-----------------------------------------------------
with "raise RequestDone" only:
Exception happened during processing of request from ('127.0.0.1',
38794)
Traceback (most recent call last):
File "/usr/lib/python2.5/SocketServer.py", line 464, in
process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.5/SocketServer.py", line 254, in
finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.5/SocketServer.py", line 522, in __init__
self.handle()
File "/usr/lib/python2.5/BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "/home/pkoelle/trac012dev/trac/web/wsgi.py", line 175, in
handle_one_request
gateway.run(self.server.application)
File "/home/pkoelle/trac012dev/trac/web/wsgi.py", line 98, in run
self._write('')
File "/home/pkoelle/trac012dev/trac/web/wsgi.py", line 192, in
_write
assert self.headers_set, 'Response not started'
AssertionError: Response not started
simple test server:
---------------------------------
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class PostHandler(BaseHTTPRequestHandler):
def do_POST(self):
print "headers -> %s" % self.headers
data = self.rfile.read()
self.send_response(301)
self.end_headers()
print "DATA: %s" % data
def main():
try:
srv = HTTPServer(('', 8080), PostHandler)
srv.serve_forever()
except KeyboardInterrupt:
srv.socket.close()
-----------------------------------
request headers:
Host: 127.0.0.1:8080
Content-Type: text/
xml
Content-Length:
1271
Pragma: no-
cache
Accept: */
*
User-Agent: myapp/0.2
Connection: close
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---