Giter VIP home page Giter VIP logo

Comments (5)

tsegismont avatar tsegismont commented on August 15, 2024

@cescoffier thanks very much for the reproducer, it allows to quickly spot the problem

It looks like the problem is not related to HTTP/2, but to io.vertx.core.net.impl.HostAndPortImpl#parseHostAndPort implementation. When an nip url is used, it assumes an IP address has been parsed, then expects a colon to be found, because the host+port string is larger than the parsed IP address length. Instead, it find the dot in .nip.io and returns null:

  public static HostAndPortImpl parseHostAndPort(String s, int schemePort) { // s is 127.0.0.1.nip.io:8443
    int pos = parseHost(s, 0, s.length()); // pos is 9 because parseHost computes the host to be 127.0.0.1
    if (pos == s.length()) {
      return new HostAndPortImpl(s, schemePort);
    }
    if (pos < s.length() && s.charAt(pos) == ':') { // expected colon but finds dot
      String host = s.substring(0, pos);
      int port = 0;
      while (++pos < s.length()) {
        int digit = parseDigit(s, pos, s.length());
        if (digit == -1) {
          return null;
        }
        port = port * 10 + digit;
      }
      return new HostAndPortImpl(host, port);
    }
    return null; // returns null
  }

Or did I miss something?

from vertx-web.

tsegismont avatar tsegismont commented on August 15, 2024

@cescoffier I've filed eclipse-vertx/vert.x#4947

When it's fixed, we'll see if there's another problem or not (unless you have more info in the meantime).

from vertx-web.

tsegismont avatar tsegismont commented on August 15, 2024

@cescoffier I've tried again with this patch and the problem goes away (the browser displays Hello World - https://127.0.0.1.nip.io:8443/)

The reproducer was missing options.setUseAlpn(true); so that HTTP/2 is negotiated between the client and the server. Even with this configuration, the browser displays the expected message (because the value is stored in the authority header).

So, as far as I can see, there is no issue with HTTP/2, only a bug in Vert.x core related to nip hosts parsing. If you can provide more info, I'll take another look. Otherwise, I'll close this issue after merging eclipse-vertx/vert.x#4947

from vertx-web.

cescoffier avatar cescoffier commented on August 15, 2024

@tsegismont Thanks! I merged the PR.

from vertx-web.

tsegismont avatar tsegismont commented on August 15, 2024

Closing as this is a Vert.x core bug, fixed upstream eclipse-vertx/vert.x#4947

from vertx-web.

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.