seems to avoid the #1155 log message which reveals the URI (and filecap).
Also add an [ERROR] marker to the flog entry, since unregisterProducer also
makes interrupted downloads appear "200 OK"; this makes it more obvious that
the download did not complete.
def start(self):
self._alive = True
self._deferred = defer.Deferred()
+ self._deferred.addBoth(self._done)
self._consumer.registerProducer(self, True)
self._maybe_fetch_next()
return self._deferred
+ def _done(self, res):
+ self._consumer.unregisterProducer()
+ return res
+
def _maybe_fetch_next(self):
if not self._alive or not self._hungry:
return
# done!
self._alive = False
self._hungry = False
- self._consumer.unregisterProducer()
self._deferred.callback(self._consumer)
return
n = self._node
level=log.WEIRD, parent=self._lp, umid="EYlXBg")
self._alive = False
self._hungry = False
- self._consumer.unregisterProducer()
self._deferred.errback(f)
def stopProducing(self):
+ log.msg("asked to stopProducing",
+ level=log.NOISY, parent=self._lp, umid="XIyL9w")
self._hungry = False
self._alive = False
# cancel any outstanding segment request
overwrite=replace)
def _done(filenode):
log.msg("webish upload complete",
- facility="tahoe.webish", level=log.NOISY)
+ facility="tahoe.webish", level=log.NOISY, umid="TCjBGQ")
if self.node:
# we've replaced an existing file (or modified a mutable
# file), so the response code is 200
return ""
d = self.filenode.read(req, first, size)
def _error(f):
+ log.msg("error during GET", facility="tahoe.webish", failure=f,
+ level=log.UNUSUAL, umid="xSiF3w")
+ req._tahoe_request_had_error = f # for HTTP-style logging
if req.startedWriting:
# The content-type is already set, and the response code has
# already been sent, so we can't provide a clean error
parse_qs = http.parse_qs
class MyRequest(appserver.NevowRequest):
fields = None
+ _tahoe_request_had_error = None
+
def requestReceived(self, command, path, version):
"""Called by channel when all data has been received.
uri = path + queryargs
- log.msg(format="web: %(clientip)s %(method)s %(uri)s %(code)s %(length)s",
+ error = ""
+ if self._tahoe_request_had_error:
+ error = " [ERROR]"
+
+ log.msg(format="web: %(clientip)s %(method)s %(uri)s %(code)s %(length)s%(error)s",
clientip=self.getClientIP(),
method=self.method,
uri=uri,
code=self.code,
length=(self.sentLength or "-"),
+ error=error,
facility="tahoe.webish",
level=log.OPERATIONAL,
)