[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Don't pay attention to the HTTP Reason-Phrase for ORPort descriptor downloads



commit 672046fbf6beb8de78d0b410a077a14992955728
Author: Dave Rolek <dmr-x@xxxxxxxxxx>
Date:   Tue Jun 5 20:54:09 2018 +0000

    Don't pay attention to the HTTP Reason-Phrase for ORPort descriptor downloads
---
 stem/descriptor/remote.py      | 2 +-
 test/unit/descriptor/remote.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index 9adc4466..b266409a 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -854,7 +854,7 @@ def _download_from_orport(endpoint, compression, resource):
       first_line, data = response.split(b'\r\n', 1)
       header_data, data = data.split(b'\r\n\r\n', 1)
 
-      if first_line != b'HTTP/1.0 200 OK':
+      if not first_line.startswith(b'HTTP/1.0 200 '):
         raise stem.ProtocolError("Response should begin with HTTP success, but was '%s'" % first_line)
 
       headers = {}
diff --git a/test/unit/descriptor/remote.py b/test/unit/descriptor/remote.py
index d654f61a..9afa624b 100644
--- a/test/unit/descriptor/remote.py
+++ b/test/unit/descriptor/remote.py
@@ -81,7 +81,7 @@ HEADER = '\r\n'.join([
 
 
 def _orport_mock(data, encoding = 'identity'):
-  data = b'HTTP/1.0 200 OK\r\n' + stem.util.str_tools._to_bytes(HEADER % encoding) + b'\r\n\r\n' + data
+  data = b'HTTP/1.0 200 This is fine\r\n' + stem.util.str_tools._to_bytes(HEADER % encoding) + b'\r\n\r\n' + data
   cells = []
 
   for hunk in [data[i:i + 50] for i in range(0, len(data), 50)]:



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits