chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 21:25:35 +0000 (22:25 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 21:25:35 +0000 (22:25 +0100)
server

diff --git a/server b/server
index 6a71bfd..3bfbc42 100755 (executable)
--- a/server
+++ b/server
@@ -158,18 +158,23 @@ def process_request(request, desca):
   try:
     d = request.args[b'd'][0]
     desca['d'] = d
-  except KeyError: d = b''
+    desca['dlen'] = len(d)
+  except KeyError:
+    d = b''
+    desca['dlen'] = None
+
+  log_http(desca, 'processing', idof=id(request), d=d)
 
   cl.process_arriving_data(d)
   cl.new_request(request)
 
-def log_http(desca, msg):
+def log_http(desca, msg, **kwargs):
   try:
-    d = desca['d']
+    kwargs['d'] = desca['d']
     del desca['d']
   except KeyError:
-    d = None
-  log_debug(DBG.HTTP, msg + repr(desca), d=d)
+    pass
+  log_debug(DBG.HTTP, msg + repr(desca), **kwargs)
 
 class IphttpResource(twisted.web.resource.Resource):
   isLeaf = True
@@ -185,7 +190,7 @@ class IphttpResource(twisted.web.resource.Resource):
       request.setHeader('Content-Type','text/plain; charset="utf-8"')
       request.setResponseCode(400)
       return (emsg + ' # ' + repr(desca) + '\r\n').encode('utf-8')
-    log_http(desca, '... [%s]' % id(request))
+    log_debug(DBG.HTTP_CTRL, '...', idof=id(request))
     return NOT_DONE_YET
 
   def render_GET(self, request):