Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update http (not s) refs to IETF URI to use https #739

Merged
merged 6 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
name: ${{ matrix.os }} Py-${{ matrix.python }} IPFS-${{ matrix.ipfs }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this should be here because this workflow is executed on push as well, for which I do not know what would be the PR head.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! This was added during the discovery phase before I realized that the absolute reference to the URI using the master branch was embedded in the test case. I will remove this change to test.yml.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the change to test.yml in f50d06f (below)

- name: Echo branch being used
run: git branch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this step?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the aforementioned sanity check. Not necessary but useful in the currently running GitHub action to validate the "default behavior". If the default behavior is, in fact, to use the PR commit instead of the main branch, I will remove it.

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion ipwb/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def cdx_cdxj_lines_from_file(warc_path, **enc_comp_opts):


def generate_cdxj_metadata(cdxj_lines=None):
metadata = ['!context ["http://tools.ietf.org/html/rfc7089"]']
metadata = ['!context ["https://tools.ietf.org/html/rfc7089"]']
meta_vals = {
'generator': f'InterPlanetary Wayback {ipwb_version}',
'created_at': datetime.datetime.now().isoformat()
Expand Down
2 changes: 1 addition & 1 deletion ipwb/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def generate_cdxj_timemap_from_cdxj_lines(
# unsurted URI will never have a scheme, add one
original_uri = f'http://{unsurt(original)}'

tm_data = '!context ["http://tools.ietf.org/html/rfc7089"]\n'
tm_data = '!context ["https://tools.ietf.org/html/rfc7089"]\n'
tm_data += f'!id {{"uri": "{tm_self}"}}\n'
tm_data += '!keys ["memento_datetime_YYYYMMDDhhmmss"]\n'
tm_data += f'!meta {{"original_uri": "{original_uri}"}}\n'
Expand Down
2 changes: 1 addition & 1 deletion samples/indexes/froggie_badHeaderHash.cdxj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!context ["http://tools.ietf.org/html/rfc7089"]
!context ["https://tools.ietf.org/html/rfc7089"]
!meta {"created_at": "2018-01-30T16:52:43.212606", "generator": "InterPlanetary Wayback 0.2018.01.10.0435"}
com,matkelly)/froggies/frog.png 20170301192639 {"locator": "urn:ipfs/QmUeko8zM7Xanwz6F9GtRH4rLAi4Poj3DMECGsci2BRQfs/QmPhMnX74cwqx2xgj9d3N3gTra8CzafXwSbUwU8xagMfqR", "original_uri": "http://matkelly.com/froggies/frog.png", "mime_type": "image/png", "status_code": "200"}
com,matkelly)/robots.txt 20170301192639 {"locator": "urn:ipfs/Qmbk3Aju7u26Pzk356a43wY9eUCScAJiLPxhvwsMoVt7Pd/QmYNB85U2txRAAdLp6wvZSPvd8AQq8UcjZJ2azhv5h6NF7", "original_uri": "http://matkelly.com/robots.txt", "mime_type": "text/plain", "status_code": "200"}
Expand Down
2 changes: 1 addition & 1 deletion samples/indexes/salam-home.cdxj
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
!context ["http://tools.ietf.org/html/rfc7089"]
!context ["https://tools.ietf.org/html/rfc7089"]
!meta {"created_at": "2018-07-28T14:07:36.044446", "generator": "InterPlanetary Wayback 0.2018.07.27.2357"}
edu,odu,cs)/~salam/ 20160305192247 {"locator": "urn:ipfs/QmNkt4JbkTemhUDmua7JW5NaTQWCrVZbk2EvUvhhPm9NJP/QmQr2uoXCbmC5c1vLngeE9HU1CHfF7BVG2z98JR6DQNFoU", "original_uri": "http://www.cs.odu.edu/~salam/", "mime_type": "text/html", "status_code": "200"}
8 changes: 4 additions & 4 deletions tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

def test_local():
assert get_web_archive_index(SAMPLE_INDEX).startswith(
'!context ["http://tools.ietf.org/html/rfc7089"]'
'!context ["https://tools.ietf.org/html/rfc7089"]'
)


def test_https():
assert get_web_archive_index(
'https://raw.githubusercontent.com/oduwsdl/ipwb/master/samples/' +
'indexes/salam-home.cdxj'
).startswith('!context ["http://tools.ietf.org/html/rfc7089"]')
).startswith('!context ["https://tools.ietf.org/html/rfc7089"]')


def test_ipfs_success():
Expand All @@ -35,7 +35,7 @@ def test_ipfs_success():
with mock.patch('ipfshttpclient.connect', connect_to_ipfs):
assert get_web_archive_index(
'QmReQCtRpmEhdWZVLhoE3e8bqreD8G3avGpVfcLD7r4K6W'
).startswith('!context ["http://tools.ietf.org/html/rfc7089"]')
).startswith('!context ["https://tools.ietf.org/html/rfc7089"]')


def test_ipfs_failure():
Expand Down Expand Up @@ -63,4 +63,4 @@ def test_ipfs_url_success():
with mock.patch('ipfshttpclient.connect', connect_to_ipfs):
assert get_web_archive_index(
'ipfs://QmReQCtRpmEhdWZVLhoE3e8bqreD8G3avGpVfcLD7r4K6W'
).startswith('!context ["http://tools.ietf.org/html/rfc7089"]')
).startswith('!context ["https://tools.ietf.org/html/rfc7089"]')