lib icon indicating copy to clipboard operation
lib copied to clipboard

Improve tolerance of :uri parsing to connect

Open reify-james-vickers opened this issue 3 years ago • 2 comments

Currently protojure.grpc.client.providers.http2/connect requires a very specific format for :uri and does not accept some that it perhaps could. The URI's it seems to accept have scheme as well as port number, e.g. http://localhost:8080. Any piece missing makes the parsing fail, sometimes with a relatively opaque exception. It would be helpful for instance to support formats like:

  • http://some-host or https://some-host, using the default port numbers for these protocols (i.e. 80 for http and 443 for https)
    • Currently omitting the port number causes an exception: (NumberFormatException) at java.lang.Integer/parseInt (Integer.java:614): null
  • some-host.com or similar URI's that omit the connection protocol; not clear if it's really necessary to have the protocol or if it can default to something like https or correspond to what :ssl is defined/provided as.

reify-james-vickers avatar May 06 '22 21:05 reify-james-vickers

Yeah, this has bugged me for a while, too. Just never got around to fixing it. PR welcome.

ghaskins avatar May 07 '22 02:05 ghaskins

https://github.com/protojure/lib/pull/137

Found it a bit harder to support something like "something.com" with no scheme because lambdaisland/uri apparently won't read a host from that, doesn't seem too important anyway.

reify-james-vickers avatar May 10 '22 18:05 reify-james-vickers