X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=apt_p2p%2FHTTPServer.py;h=f3d6de72525281df73660f35adc252f26d630414;hb=40ef1ce5ded865bc9c339d15e667e87fc5775a7c;hp=224f411db250a9bf2b2c989a8f3841fa1a9a21e1;hpb=bb36ae6bc51a6a97ff06e627ce716c3915f8439d;p=quix0rs-apt-p2p.git diff --git a/apt_p2p/HTTPServer.py b/apt_p2p/HTTPServer.py index 224f411..f3d6de7 100644 --- a/apt_p2p/HTTPServer.py +++ b/apt_p2p/HTTPServer.py @@ -56,7 +56,7 @@ class FileDownloader(static.File): class FileUploaderStream(stream.FileStream): """Modified to make it suitable for streaming to peers. - Streams the file is small chunks to make it easier to throttle the + Streams the file in small chunks to make it easier to throttle the streaming to peers. @ivar CHUNK_SIZE: the size of chunks of data to send at a time @@ -214,7 +214,8 @@ class TopLevel(resource.Resource): return None, () # Find the file in the database - hash = unquote_plus(segments[1]) + # Have to unquote_plus the uri, because the segments are unquoted by twisted + hash = unquote_plus(request.uri[3:]) files = self.db.lookupHash(hash) if files: # If it is a file, return it @@ -226,7 +227,7 @@ class TopLevel(resource.Resource): log.msg('Sending torrent string %s to %s' % (b2a_hex(hash), request.remoteAddr)) return static.Data(bencode({'t': files[0]['pieces']}), 'application/x-bencoded'), () else: - log.msg('Hash could not be found in database: %s' % hash) + log.msg('Hash could not be found in database: %r' % hash) # Only local requests (apt) get past this point if request.remoteAddr.host != "127.0.0.1":