Skip to content

Commit

Permalink
recorder: Allow ipv4-mapped addresses in assert
Browse files Browse the repository at this point in the history
Closes #286
  • Loading branch information
chfoo committed Oct 19, 2015
1 parent 1546fe5 commit 36fdf27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Unreleased

* Fixed: ``--output-document`` file doesn't contain content.
* Fixed: OverflowError when URL contains invalid port number greater than 65535 or less than 0.
* Fixed: AssertionError when saving IPv4-mapped IPv6 addresses to WARC files.
* Changed: The setup file no longer requires optional psutil.


Expand Down
6 changes: 3 additions & 3 deletions wpull/recorder/warc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import glob
from tempfile import NamedTemporaryFile
import contextlib
import gettext
import glob
import gzip
import io
import logging
Expand Down Expand Up @@ -530,7 +530,7 @@ def close(self):

def pre_request(self, request):
assert re.match(
r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[a-f0-9:]+)$',
r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[a-f0-9:.]+)$',
request.address[0]), \
'IP address needed, got {}'.format(request.address[0])

Expand All @@ -555,7 +555,7 @@ def request(self, request):

def pre_response(self, response):
assert re.match(
r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[a-f0-9:]+)$',
r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[a-f0-9:.]+)$',
self._request.address[0]), \
'IP address needed, got {}'.format(self._request.address[0])

Expand Down

0 comments on commit 36fdf27

Please sign in to comment.