git://blacka.com
/
python-rwhoisd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8fef481
)
Handle thrown RwhoisErrors
author
David Blacka
<davidb@euphoria.local>
Sun, 15 Jun 2008 14:26:59 +0000
(10:26 -0400)
committer
David Blacka
<davidb@euphoria.local>
Sun, 15 Jun 2008 14:26:59 +0000
(10:26 -0400)
rwhoisd/RwhoisServer.py
patch
|
blob
|
history
diff --git
a/rwhoisd/RwhoisServer.py
b/rwhoisd/RwhoisServer.py
index
e989ce0
..
e46a7d5
100644
(file)
--- a/
rwhoisd/RwhoisServer.py
+++ b/
rwhoisd/RwhoisServer.py
@@
-84,13
+84,16
@@
class RwhoisHandler(SocketServer.StreamRequestHandler):
# we can skip blank lines.
if not line:
continue
# we can skip blank lines.
if not line:
continue
-
- if line.startswith("-"):
- self.handle_directive(session, line)
- else:
- self.handle_query(session, line)
- if not session.holdconnect:
- self.quit_flag = True
+
+ try:
+ if line.startswith("-"):
+ self.handle_directive(session, line)
+ else:
+ self.handle_query(session, line)
+ if not session.holdconnect:
+ self.quit_flag = True
+ except Rwhois.RwhoisError, e:
+ self.handle_error(session, e)
self.wfile.flush()
self.wfile.flush()
@@
-114,6
+117,10
@@
class RwhoisHandler(SocketServer.StreamRequestHandler):
print "%s query %s" % (self.client_address, line)
query_processor.process_query(session, line)
print "%s query %s" % (self.client_address, line)
query_processor.process_query(session, line)
+ def handle_error(self, session, error):
+ code = error[0]
+ msg = error[1]
+ session.wfile.write(Rwhois.error_message((code, msg)))
def usage(pname):
print """\
def usage(pname):
print """\