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 user agent and log URL #11852

Merged
merged 13 commits into from
Sep 29, 2024
Merged

Update user agent and log URL #11852

merged 13 commits into from
Sep 29, 2024

Conversation

koppor
Copy link
Member

@koppor koppor commented Sep 29, 2024

This updates the user agent to the latest one by FireFox (source: https://www.whatismybrowser.com/guides/the-latest-user-agent/firefox)

This also logs the URL used for an error HTTP response.

Example:

INFO: https://www.researchgate.net/search.Search.html?type=publication&query=Paranoid%3A%20a%20global%20secure%20file%20access%20control%20system: SimpleHttpResponse{statusCode=403, response

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@@ -384,7 +384,7 @@ public URLConnection openConnection() throws FetcherException {
} else if (status >= 400) {
// in case of an error, propagate the error message
SimpleHttpResponse httpResponse = new SimpleHttpResponse(httpURLConnection);
LOGGER.info("{}", httpResponse);
LOGGER.info("{}: {}", this.source, httpResponse);
Copy link
Member

Choose a reason for hiding this comment

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

This will leak api keys? I remember that we had an issue about this

Copy link
Member Author

Choose a reason for hiding this comment

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

Quick fix at 390d2ce

@koppor
Copy link
Member Author

koppor commented Sep 29, 2024

WTF, one needs to enable TLS 1.2 manually?! -- implemented at 0f3b387

https://www.java.com/en/configure_crypto.html

@koppor
Copy link
Member Author

koppor commented Sep 29, 2024

According to https://de.wikipedia.org/wiki/Transport_Layer_Security it should matter if TLS 1.2 or TLS 1.3.

I saw a green test "fullTextFoundByDOI" at ResearchGateTest. But only once 😥.

@koppor
Copy link
Member Author

koppor commented Sep 29, 2024

Note sure if we really need it - https://stackoverflow.com/a/73097062/873282 - but that I saw the green test... Not sure how to proceed. I would keep this change and see if there are any changes (to the better or to the worse). The other alternative is to check which protocols are used etc.

try {
HttpsURLConnection.setDefaultSSLSocketFactory(socketFactory);
Copy link
Member

Choose a reason for hiding this comment

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

I think this will have an impact of using custom SSL certifactes now

Copy link
Member Author

Choose a reason for hiding this comment

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

I checked. --> TrustStore is created at org.jabref.logic.net.ssl.TrustStoreManager#configureTrustStore.

I created JavaDoc for it: 300b7b3

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, maybe, this only works if we do this setting?! - I am not sure. How can we test this?

Copy link
Member

Choose a reason for hiding this comment

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

From what I see it should be enough if we set in the truststore manager

Copy link
Member Author

Choose a reason for hiding this comment

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

I was about to revert the change ^^. -- Since its an alpha, we can take the risk?

@Siedlerchr
Copy link
Member

can you take a look at the bvb fetcher? java.lang.IllegalArgumentException: Expected authority at index 8: https://

@koppor
Copy link
Member Author

koppor commented Sep 29, 2024

can you take a look at the bvb fetcher? java.lang.IllegalArgumentException: Expected authority at index 8: https://

Fixed in d4e933a

That was a follow-up to #11824

.withField(StandardField.AUTHOR, "Bloch, Joshua")
.withField(StandardField.TITLEADDON, "Joshua Bloch")
.withField(StandardField.EDITION, "3. Auflage, Übersetzung der englischsprachigen 3. Originalausgabe 2018")
.withField(StandardField.FILE, "ParsedFileField{description='', link='http://search.ebscohost.com/login.aspx?direct=true&scope=site&db=nlebk&db=nlabk&AN=1906353', fileType='PDF'}")
Copy link
Member

Choose a reason for hiding this comment

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

Better use withFiles(List.of(new LInkedFile(

Copy link
Member Author

Choose a reason for hiding this comment

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

Was a bug in the fetcher. Fixed at 654616c.

Copy link
Member Author

Choose a reason for hiding this comment

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

One more: d1c33d9

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Sep 29, 2024
Copy link
Contributor

github-actions bot commented Sep 29, 2024

The build for this PR is no longer available. Please visit https://builds.jabref.org/main/ for the latest build.

@Siedlerchr Siedlerchr added this pull request to the merge queue Sep 29, 2024
Merged via the queue into main with commit 8309e65 Sep 29, 2024
27 of 28 checks passed
@Siedlerchr Siedlerchr deleted the update-user-agent branch September 29, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants