Skip to content

Conversation

alexarchambault
Copy link
Member

@alexarchambault alexarchambault commented Dec 12, 2021

Fixes #2287.

@@ -140,6 +140,10 @@ object CacheUrl {
// handling those ourselves, so that we can update credentials upon redirection
conn0.setInstanceFollowRedirects(false)

// Early in the development of coursier, I ran into some repositories (Sonatype ones?) not
// returning the same content for user agent "Java/…".
conn0.setRequestProperty("User-Agent", "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make

Suggested change
conn0.setRequestProperty("User-Agent", "")
conn0.setRequestProperty("User-Agent", "Coursier")

As initially proposed in #2246?

Copy link
Contributor

Choose a reason for hiding this comment

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

curl test says "Coursier" would work too

$ curl -H "User-Agent: Coursier" https://oss.sonatype.org/content/repositories/snapshots/org/zeromq/jeromq/0.5.3-SNAPSHOT/maven-metadata.xml

so I am happy with either.

Copy link
Member Author

@alexarchambault alexarchambault Dec 12, 2021

Choose a reason for hiding this comment

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

I think I'm going to cut a release with an empty user agent (former behavior), then one with a Coursier user agent. So that we can switch back to the other if the Coursier user agent ends up having issues too.

Copy link
Contributor

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Thanks 🙏

@alexarchambault alexarchambault merged commit 76e09fe into coursier:master Dec 12, 2021
@alexarchambault alexarchambault deleted the user-agent branch December 12, 2021 22:06
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 this pull request may close these issues.

Unable to download snapshot dependencies with 2.1.0-M1
3 participants