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

Pattypan should send a correct user agent when making request to commons.wikimedia.org #146

Closed
reedy opened this issue Nov 8, 2021 · 5 comments
Assignees
Milestone

Comments

@reedy
Copy link

reedy commented Nov 8, 2021

Following on from #138 and the Phabricator tasks...

Can someone please look and verify pattypan is actually using its own user agent in requests?

public static final String USERAGENT = NAME + "/" + VERSION + " (https://github.com/yarl/pattypan)";

Looking at some of the code, it does seem there is some setup for it such as surrounding the above, but looking at the logs (from the Wikimedia side), it doesn't seem to result in any entries, which is odd.

vicuna seems to be fine.

@Abbe98
Copy link
Collaborator

Abbe98 commented Nov 8, 2021

It appears to be used in the session setup:

WIKI.setUserAgent(Settings.USERAGENT);

@reedy
Copy link
Author

reedy commented Nov 8, 2021

Yeah, which is why I've created the task.

The useragent doesn't seem to be making it to Wikimedia's Logstash servers which makes me feel like something in the plumbing isn't quite right here.

I noticed yarl/vicuna@0dc286f where it was done in a few more places, I'm not sure specifically why like that

@Abbe98
Copy link
Collaborator

Abbe98 commented Nov 8, 2021

We only call setUserAgent once because we only got one instance of the Wiki.java class.

I will need to have a look when I got a debugger at hand, I assume that WIKI.setUserAgent(Settings.USERAGENT); is either dead code or we lose the state of WIKI somewhere.

@Abbe98 Abbe98 self-assigned this Feb 21, 2022
Abbe98 added a commit to Abbe98/pattypan that referenced this issue Feb 22, 2022
The initialization of the Wiki.java session in Session.java was overwritten by the one in Main.java.

This change removes the initialization in Session.java entierly.

Side effects:
- added logging of the user agent
@Abbe98 Abbe98 added this to the 22.03 milestone Feb 22, 2022
@Abbe98
Copy link
Collaborator

Abbe98 commented Feb 22, 2022

The initialization of the Wiki.java session in Session.java was overwritten by the one in Main.java. I removed the one in Session.java as it would end up being overwritten anyway. Marking this for the 22.03 release.

@Abbe98 Abbe98 changed the title Double check user agent is working Pattypan should send a correct user agent when making request to commons.wikimedia.org Feb 22, 2022
Abbe98 added a commit that referenced this issue Feb 22, 2022
@reedy
Copy link
Author

reedy commented Feb 22, 2022

Yay. Thanks!

@Abbe98 Abbe98 closed this as completed Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants