Giter Site home page Giter Site logo

Comments (8)

bmuskalla avatar bmuskalla commented on August 10, 2024 1

May I ask why using Gradle as User-Agent gets a different treatment and works? Funny enough, my interest in this API is driven by supporting AdoptOpenJDK in Gradle ;)

from openjdk-api-v3.

ParkerM avatar ParkerM commented on August 10, 2024

I can reproduce your curl request error, and adding -H "user-agent: Gradle" to the end seems to fix it. Not sure if that behavior was intentional but seems kinda buggy to me. (Unless it's a weird limitation of the service provider or something like that) (this appears to be intended behavior per the tests)

from openjdk-api-v3.

ParkerM avatar ParkerM commented on August 10, 2024

A test attempting to replicate the failure can be found here (sorry about all the reference noise above).

On second thought, I think the test failure here is just due to missing test fixture data (it returns 404 instead of 403). The same test passes with jdk8u212-b04, which also returns a 403 using the curl command mentioned above.

from openjdk-api-v3.

ParkerM avatar ParkerM commented on August 10, 2024

It appears that this may be related to the way AWS handles (or does not handle) HEAD requests. If I include the --cookie option like so:

  curl -v -L --cookie --head "https://api.adoptopenjdk.net/v3/binary/version/jdk-11.0.6%2B10/linux/x64/jdk/hotspot/normal/adoptopenjdk?project=jdk"

Then the API -> GitHub -> AWS redirect goes through, then proceeds to vomit binary into my terminal until I have to force close it.

You can see the same behavior by hitting the GitHub release URL (with -L) or the AWS redirect URL (without -L) directly.

from openjdk-api-v3.

karianna avatar karianna commented on August 10, 2024

Ah yes, our API does require a user agent - CC @johnoliver for more context

from openjdk-api-v3.

johnoliver avatar johnoliver commented on August 10, 2024

It was originally put in to allow Gradle to download our binaries (see elastic/elasticsearch#55125 and https://github.com/elastic/elasticsearch/pull/55127/files @james-crowley may be able to give more context there) and yes this was to be a work around for the fact that aws did not allow HEAD requests and Gradle required them to work.

In general I am not a fan of our current HEAD behaviour as (from my reading of it) HEAD should return the same as GET, but to work around the aws and gradle issues HEAD (with the gradle user agent) will return a response while GET will redirect you. As this is non standard we felt it was better to limit the effect to gradle only. Unfortunately adding the functionality highlights HEAD in the swagger docs, I could not find a way to hide the HEAD request from the documentation which is not ideal.

from openjdk-api-v3.

james-crowley avatar james-crowley commented on August 10, 2024

@johnoliver Thanks for tagging me in this issue. @bmuskalla like @johnoliver mentioned this implementation of checking if the user-agent is Gradle was due to AWS not allowing HEAD requests.

In my digging around I did find this issue/comment, gradle/gradle#5322 (comment). I was excited to see that Gradle worked with GitHub to support HEAD requests. When trying to fetch the AdoptOpenJDK file, GitHub redirects to AWS and Gradle tries to do a HEAD request on AWS but AWS does not support HEAD requests. Thus downloading the file fails and errors out when building with Gradle.

I agree with @johnoliver, this implementation in the API is not ideal. @bmuskalla is there anything on Gradle’s side of things that can be implemented to fix this bug? Also let me know if I can help with anything. Glad to see AdoptOpenJDK support coming to Gradle!

from openjdk-api-v3.

karianna avatar karianna commented on August 10, 2024

This has been resolved

from openjdk-api-v3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.