"dial attempt failed" for localhost domain, but success for 127.0.0.1 on Chrome
- Dominant language
- Go
- Stars
- 17.1k
- Forks
- 3.2k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 11
Description
#### Version information:
go-ipfs version: 0.4.4-
Repo version: 4
System version: amd64/linux
Golang version: go1.7
Chrome Version 47.0 (64-bit)
#### Type:
Bug
#### Priority:
P4
#### Description:
Chrome browser shows different responses for LOCALHOST and 127.0.0.1 domain
cURL gives X-Stream-Error with -I option for both LOCALHOST and 127.0.0.1
cURL give both success with -v option for both LOCALHOST and 127.0.0.1
## CHROME:
### LOCALHOST REQUEST
http://localhost:5001/api/v0/swarm/connect?arg=/ip4/149.56.14.160/tcp/4001/ipfs/QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX
### RESPONSE
{"Message":"connect QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX failure: dial attempt failed","Code":0}
### 127.0.0.1 REQUEST
http://127.0.0.1:5001/api/v0/swarm/connect?arg=/ip4/149.56.14.160/tcp/4001/ipfs/QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX
### RESPONSE
{"Strings":["connect QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX success"]}
## cURL with -I option:
### LOCALHOST REQUEST / RESPONSE
curl -I -H "Cache-Control: no-cache" http://localhost:5001/api/v0/swarm/connect?arg=/ip4/149.56.14.160/tcp/4001/ipfs/QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX
HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
Content-Type: application/json
Server: go-ipfs/0.4.4
Trailer: X-Stream-Error
Vary: Origin
Date: Tue, 03 Jan 2017 05:21:00 GMT
### 127.0.0.1 REQUEST / RESPONSE
curl -I -H "Cache-Control: no-cache" http://127.0.0.1:5001/api/v0/swarm/connect?arg=/ip4/149.56.14.160/tcp/4001/ipfs/QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX
HTTP/1.1 200 OK
Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
Content-Type: application/json
Server: go-ipfs/0.4.4
Trailer: X-Stream-Error
Vary: Origin
Date: Tue, 03 Jan 2017 05:22:05 GMT
## cURL with -v option:
### LOCALHOST REQUEST / RESPONSE
curl -v -H "Cache-Control: no-cache" http://localhost:5001/api/v0/swarm/connect?arg=/ip4/149.56.14.160/tcp/4001/ipfs/QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX
\* About to connect() to localhost port 5001 (#0)
\* Trying 127.0.0.1... connected
\> GET /api/v0/swarm/connect?arg=/ip4/149.56.14.160/tcp/4001/ipfs/QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX HTTP/1.1
\> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
\> Host: localhost:5001
\> Accept: */*
\> Cache-Control: no-cache
\>
< HTTP/1.1 200 OK
< Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Content-Type: application/json
< Server: go-ipfs/0.4.4
< Trailer: X-Stream-Error
< Vary: Origin
< Date: Tue, 03 Jan 2017 05:38:59 GMT
< Transfer-Encoding: chunked
<
{"Strings":["connect QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX success"]}
\* Connection #0 to host localhost left intact
\* Closing connection #0
### 127.0.0.1 REQUEST / RESPONSE
curl -v -H "Cache-Control: no-cache" http://127.0.0.1:5001/api/v0/swarm/connect?arg=/ip4/149.56.14.160/tcp/4001/ipfs/QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX
\* About to connect() to 127.0.0.1 port 5001 (#0)
\* Trying 127.0.0.1... connected
\> GET /api/v0/swarm/connect?arg=/ip4/149.56.14.160/tcp/4001/ipfs/QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX HTTP/1.1
\> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
\> Host: 127.0.0.1:5001
\> Accept: */*
\> Cache-Control: no-cache
\>
< HTTP/1.1 200 OK
< Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
< Content-Type: application/json
< Server: go-ipfs/0.4.4
< Trailer: X-Stream-Error
< Vary: Origin
< Date: Tue, 03 Jan 2017 05:37:27 GMT
< Transfer-Encoding: chunked
<
{"Strings":["connect QmU33iCTrgMhurhEvLG25j4AMz82r8P3wqBPwUAtKmBHXX success"]}
\* Connection #0 to host 127.0.0.1 left intact
\* Closing connection #0
Contributor guide
Assessment
This issue has not been assessed yet.