Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to access https://{IP} #153

Closed
frankiexyz opened this issue Jun 8, 2021 · 2 comments
Closed

Unable to access https://{IP} #153

frankiexyz opened this issue Jun 8, 2021 · 2 comments

Comments

@frankiexyz
Copy link

http works for some reason

➜ ~ xhs --help |grep ^xh
xh 0.10.0
➜ ~ xhs https://1.1.1.1      
Error: error sending request for url (https://1.1.1.1/): error trying to connect: invalid dnsname

Caused by:
    0: error trying to connect: invalid dnsname
    1: invalid dnsname
➜ ~ xhs http://1.1.1.1       
HTTP/1.1 301 Moved Permanently
cf-ray: 65be7493bc14ddcf-SIN
cf-request-id: 0a8ae730580000ddcfdd3fc000000001
connection: keep-alive
content-length: 167
content-type: text/html
date: Tue, 08 Jun 2021 01:47:59 GMT
location: https://1.1.1.1/
server: cloudflare
vary: Accept-Encoding

<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
@blyxxyz
Copy link
Collaborator

blyxxyz commented Jun 8, 2021

This seems to be a limitation of rustls, see rustls/rustls#184 and briansmith/webpki#54.

#136 is relevant, it shouldn't happen with the native TLS backend. Maybe we could automatically switch to it if it's available and we detect a URL with an IP address and HTTPS, but that might be too magical.

@ducaale
Copy link
Owner

ducaale commented Aug 5, 2021

xh v0.12.0 has been released which supports using the system's TLS library and in turn, can make a request to https://1.1.1.1

# make sure to enable the newly added native-tls feature when compiling xh i.e cargo build --features=native-tls
$ xh --native-tls https://1.1.1.1
HTTP/2.0 200 OK
age: 270
cache-control: public, max-age=14400
cf-cache-status: HIT
cf-ray: 67a3e3c28af3fe50-HEL
content-type: text/html
date: Thu, 05 Aug 2021 23:43:47 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: Fri, 06 Aug 2021 03:43:47 GMT
last-modified: Tue, 03 Aug 2021 14:31:58 GMT
served-in-seconds: 0.003
server: cloudflare
strict-transport-security: max-age=31536000
vary: Accept-Encoding
x-amz-request-id: tx0000000000000083a103c-00610953bb-5653bdb-default

# response body is omitted

@ducaale ducaale closed this as completed Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants