alibaba / alibaba/anyproxy

🐞BUG: not working with IPv6 ips to https (fix inside)

Open
#125 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.9k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Now if we get an ipv6 request to https it will break here
lib/requestHandler.js
```
function connectReqHandler(req, socket, head){
var host = req.url.split(":")[0],
targetPort= req.url.split(":")[1],
```
because a request would look like: https://[fa80::ee85:ffd0:2004:4947]:443/
so we need to separate this events
```
let host;
let targetPort;
if (req.url.indexOf('\]') > 0) {
host = req.url.split(/[\[\]]/)[1];
targetPort = req.url.split("]:")[1];
} else {
host = req.url.split(":")[0];
targetPort = req.url.split(":")[1];
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Read lib/requestHandler.js, starting at connectReqHandler and its parsing of req.url. Exercise the HTTPS proxy path with an IPv6 address in brackets, then verify that ordinary IPv4 requests still work. Done means both address forms reach the intended host and port without breaking request handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.