Git Product home page Git Product logo

Comments (13)

an-tex avatar an-tex commented on May 13, 2024 2

Thanks for the reply @agudian ! I'll make a PR next week. Cheers

from s3mock.

an-tex avatar an-tex commented on May 13, 2024 1

Hi @DanieleSassoli . I've made the changes locally just yesterday but some tests started failing. I'll look into it later, if it's something I could need assistance with I'll open a PR with the failing tests so we can continue together? Cheers

from s3mock.

DanieleSassoli avatar DanieleSassoli commented on May 13, 2024 1

I believe this should be closed following #198?

from s3mock.

timoe avatar timoe commented on May 13, 2024 1

yepp, you're right.

from s3mock.

agudian avatar agudian commented on May 13, 2024

Interesting. Which request (or part of the multipart upload sequence) is causing the trouble?

I can see that for some of those methods we don't have a Content-Type defined... Would be nice if you could help us sort this out.

from s3mock.

sfali avatar sfali commented on May 13, 2024

After further investigation, looks like it is failing on initiateMultipartUpload, interestingly this method producing application/x-www-form-urlencoded .

from s3mock.

sfali avatar sfali commented on May 13, 2024

I tried changing application/x-www-form-urlencoded to application/octet-stream, the error I got back in my client was:

org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.

from s3mock.

an-tex avatar an-tex commented on May 13, 2024

I've just ran into the same issue. The problem is that the S3Mock Server (not the client) returns a Content-Type: application/x-www-form-urlencoded in the response of the initiateMultipartUpload endpoint (https://github.com/adobe/S3Mock/blob/master/server/src/main/java/com/adobe/testing/s3mock/FileStoreController.java#L969). The actual AWS endpoint returns a application/octet-stream (just checked), this (or application/xml) is what the strict Akka HTTP Client (which is used under the hood by Alpakka S3) expects for a XML response and fails otherwise.

The official AWS S3 documentation (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html) unfortunately doesn't define a Content-Type for the response. It seems most clients ignore the Content-Type of the Response and just parse it as XML, that's why this issue isn't so common. Nevertheless I believe for the S3 Mock to be an HTTP wise correct and AWS wise accurate implementation, it should also return the application/octet-stream Content-Type at least for this endpoint.

I'd be happy to create a PR if others think the same way.

from s3mock.

DanieleSassoli avatar DanieleSassoli commented on May 13, 2024

hey @an-tex, very good analysis, helped me understanding the issue a lot better.
Where you planning on raising a PR for this? I had the same issue and worked around it by using https://github.com/findify/s3mock but it seems like overall the project is not as well maintained as this one.

from s3mock.

an-tex avatar an-tex commented on May 13, 2024

I hoped for a feedback by the maintainers first if there's a reason for defining explicitly that content type. But seems that's not gonna happen ;) In the meantime I'm using https://github.com/gaul/s3proxy but would also rather switch back to this.

from s3mock.

agudian avatar agudian commented on May 13, 2024

@an-tex thanks for looking into it and finding the discrepancy. I think using the same content type as AWS does is the way to go.

A PR would be very welcome! 👍

from s3mock.

DanieleSassoli avatar DanieleSassoli commented on May 13, 2024

hey @an-tex, did you find any time to raise a PR for this? Might look into doing this myself if it's of any help...

from s3mock.

an-tex avatar an-tex commented on May 13, 2024

alright the issue is when annotating an endpoint with:

@RequestMapping(/*...*/ produces = {"application/octet-stream"})

the integration tests fail as the S3Mock returns a "400 - Bad Request" for most of the calls. This is the spring framework itself rejecting the request. I'm not sure why. Maybe it just doesn't know how to serialize the response? When I put application/xml it all works. So this might still be a better solution than the previous application/x-www-form-urlencoded? Any thoughts? I'll try out how the strict Akka HTTP Client handles this. If it's fine with this I'll just go ahead and create a PR then we can shift the implementation discussion there.

from s3mock.

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.