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

Malformed link header causes WAIT to display #308

Closed
machawk1 opened this issue Aug 10, 2020 · 4 comments · Fixed by #322
Closed

Malformed link header causes WAIT to display #308

machawk1 opened this issue Aug 10, 2020 · 4 comments · Fixed by #322

Comments

@machawk1
Copy link
Owner

See #307 and http://matkelly.com/temp/aac.txt

Some server config is causing the response header Link: <http://purl.org/memento/timegate/(null)://(null)(null)>;rel=timegate. Mink chokes on this when the URI cannot be retrieved citing 502 Bad Gateway. It ought to be more resilient and fail a little more gracefully or, like other instances, disregard the header if wonky or invalid.

@machawk1
Copy link
Owner Author

machawk1 commented Aug 10, 2020

This is happening because of an interesting .htaccess file in the /temp/ folder at matkelly.com:

RewriteRule ^/(.*) - [E=ORIGQRY:]
RewriteCond %{QUERY_STRING} .+
RewriteRule ^/(.*) - [E=ORIGQRY:?%{QUERY_STRING}]
RewriteRule ^/(.*) - [E=ORIGPROTO:http]
RewriteCond %{HTTPS} on
RewriteRule ^/(.*) - [E=ORIGPROTO:https]
Header always set Link "<http://purl.org/memento/timegate/%{ORIGPROTO}e://%{ORIGURI}e%{ORIGQRY}e>;rel=timegate"

This looks like it was borrowed from somewhere...probably from "how to enable Memento on your Apache server" docs from mementoweb.

EDIT: This htaccess is recursively applied as well. See curl -I http://matkelly.com/temp/tmp2/aad.txt.

@machawk1
Copy link
Owner Author

content.js sends a message in displayUIBasedOnContext() with the method findTMURI and value of the TimeGate URI. This message is received in mink.js and findTMURI() is called, which contains an AJAX request. On failure, because of the (a)synchronicity and loss of communication channel, a failure in this AJAX function cannot instruct the original caller to proceed with another variation.

@machawk1
Copy link
Owner Author

Much of this is fixed in 2969ad7 (issue-308 branch). On encountering a bad Link header value, after failing to query the TG, the Link header is removed and the same logic used to send the request for the URI-R to the aggregator.

This is not yet complete. In iterating through the headers, using JavaScript's delete to remove the attribute leaves a null value in the member. When reading these values over again in secondary processing, I had to manually check for this. I would like to see this better handled at the source before merging it in.

machawk1 added a commit that referenced this issue Oct 13, 2020
@machawk1
Copy link
Owner Author

Perhaps the remaining null is due to a pre-existing value not being cleared and some sort of "placeholder" remaining. When logging where setting the value, the attribute is not present. When reading the value, the null displays when iterating through each attribute after reading from localStorage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant