Code Monkey home page Code Monkey logo

Comments (7)

ericmj avatar ericmj commented on May 18, 2024 2

I agree. Please open a separate issue. I think having a separate library that handles IDNA would be ideal, we would only need some documentation on how to use the the library with Mint.

from mint.

chulkilee avatar chulkilee commented on May 18, 2024 1

I think this HTTP library should focus on HTTP handling, rather than having all convenient features for HTTP clients.

For "url helper methods", such as validation, auto-fix:

  • "modern" browser behavior is not necessarily "standard"
  • If bad value is given, then HTTP library should fail, instead of trying to auto-fix it

Those "convenience" features should be built on higher level, not this HTTP library level. For example, I'm using tesla and I can do all with Tesla middleware (e.g. see Tesla.Middleware.BaseUrl) - so that underlying HTTP library (e.g. hackney, httpc..) doesn't need to handle this.

For IDNA:

We may end up with common interface for IDNA (like we do for Json with jason and poison) so that we can evolve/release mint without being coupled with specific idna library.

from mint.

whatyouhide avatar whatyouhide commented on May 18, 2024

Forgive my ignorance but I am not an expert in this area. What would be missing from the Elixir URI module in the stdlib that we might want to add here?

from mint.

Virviil avatar Virviil commented on May 18, 2024

Well, I'm not sure if it's needed in Elixir Core, but for HTTP Client next functionality might be useful:

  1. URL normalization:

    # all examples are working in modern browsers
    "https://////www.google.com" -> "https:/www.google.com"
    "https://你好你好" -> "https://xn--6qqa088eba/"
    "https://0Xc0.0250.01" -> "https://192.168.0.1/"
    
  2. URL validation:

    https://www .google.com -> false
    
  3. Relative URLs:

    "../foo?a=bar#bazz" with base "https://www.google.com/maps" -> "https://www.google.com/foo?a=bar#bazz"
    

from mint.

ericmj avatar ericmj commented on May 18, 2024

Thanks for starting this discussion. Since xhttp is still being developed we should do this in steps, preferably small steps.

I think we can start by adding idna. We can use the library hackney uses but in the future I would like to investigate if we can reduce the size of the idna modules by implementing them in elixir and do the same code size optimizations elixir core does for the unicode modules (joining similar clauses and so on).

I would like to wait with the other whatwg normalizations, until we have looked at it more, for two main reasons; the whatwg spec looks very complex and I'm not sure a generic http client should have the same behavior as a browser.

Does this sound good to you?

from mint.

Virviil avatar Virviil commented on May 18, 2024

@ericmj This sounds really good. We will pend with investigations until something will become more clear. Hope this thread will help with coordinations upon given topic in the future.

from mint.

whatyouhide avatar whatyouhide commented on May 18, 2024

I agree with @chulkilee. I think we can close this issue and open one that will remind us to look into a IDNA interface. Wdyt @ericmj?

from mint.

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.