mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
try to fix test failing due to url-encoding
https://travis-ci.org/internetarchive/warcprox/jobs/588557539 test_domain_data_soft_limit not sure what changed, maybe the requests library, though i can't reproduce locally, but explicitly decoding should fix the problem
This commit is contained in:
parent
da9c4b0b4e
commit
d1b52f8d80
@ -52,6 +52,7 @@ import mock
|
|||||||
import email.message
|
import email.message
|
||||||
import socketserver
|
import socketserver
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import http.server as http_server
|
import http.server as http_server
|
||||||
@ -175,8 +176,10 @@ class _TestHttpRequestHandler(http_server.BaseHTTPRequestHandler):
|
|||||||
def build_response(self):
|
def build_response(self):
|
||||||
m = re.match(r'^/([^/]+)/([^/]+)$', self.path)
|
m = re.match(r'^/([^/]+)/([^/]+)$', self.path)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
special_header = 'warcprox-test-header: {}!'.format(m.group(1)).encode('utf-8')
|
seg1 = urllib.parse.unquote(m.group(1))
|
||||||
payload = 'I am the warcprox test payload! {}!\n'.format(10*m.group(2)).encode('utf-8')
|
seg2 = urllib.parse.unquote(m.group(2))
|
||||||
|
special_header = 'warcprox-test-header: {}!'.format(seg1).encode('utf-8')
|
||||||
|
payload = 'I am the warcprox test payload! {}!\n'.format(10*seg2).encode('utf-8')
|
||||||
headers = (b'HTTP/1.1 200 OK\r\n'
|
headers = (b'HTTP/1.1 200 OK\r\n'
|
||||||
+ b'Content-Type: text/plain\r\n'
|
+ b'Content-Type: text/plain\r\n'
|
||||||
+ special_header + b'\r\n'
|
+ special_header + b'\r\n'
|
||||||
@ -1351,7 +1354,7 @@ def test_domain_data_soft_limit(
|
|||||||
warcprox_.proxy.remote_connection_pool.clear()
|
warcprox_.proxy.remote_connection_pool.clear()
|
||||||
|
|
||||||
# novel, pushes stats over the limit
|
# novel, pushes stats over the limit
|
||||||
url = 'https://muh.XN--Zz-2Ka.locALHOst:{}/z/~'.format(https_daemon.server_port)
|
url = 'https://muh.XN--Zz-2Ka.locALHOst:{}/z/%7E'.format(https_daemon.server_port)
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
url, proxies=archiving_proxies, headers=headers, stream=True,
|
url, proxies=archiving_proxies, headers=headers, stream=True,
|
||||||
verify=False)
|
verify=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user