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

Fetching PURLs doesn't follow redirects #746

Open
thatbudakguy opened this issue Jan 27, 2023 · 0 comments
Open

Fetching PURLs doesn't follow redirects #746

thatbudakguy opened this issue Jan 27, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@thatbudakguy
Copy link
Member

discovered when working with @cbeer that fetching a particular PURL via HTTP doesn't seem to follow redirection on our aliased domains. the output of the following two (example) commands is different:

echo "zt944np1693" | traject -c config.rb -s purl.url=https://purl-stage.stanford.edu/ --stdin
echo "zt944np1693" | traject -c config.rb -s purl.url=https://sul-purl-stage.stanford.edu/ --stdin

because purl-stage is an alias for sul-purl-stage, the former command fails somewhat silently — the empty response body of the redirect results in the fetched record having no unique identifier, so it is skipped for indexing. if sul-purl-stage is used instead, the real publicXML can be fetched.

this behavior may be ruby implementation dependent — a first place to look might be:

def self.fetch(url)
if defined?(JRUBY_VERSION)
response = Manticore.get(url)
response.body if response.code == 200
else
response = HTTP.get(url)
response.body if response.status.ok?
end
end

@thatbudakguy thatbudakguy added the bug Something isn't working label Jan 27, 2023
@thatbudakguy thatbudakguy self-assigned this Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant