Skip to content

Commit bf88a5b

Browse files
committed
Error out on connect
...
1 parent dd28535 commit bf88a5b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/httpproxy/main.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ http.createServer { req, res in
77
// log request
88
req.log.log("\(req.method) \(req.url)")
99

10+
guard req.method != "CONNECT" else {
11+
req.log.error("Connect not supported.")
12+
res.writeHead(501)
13+
res.end()
14+
return
15+
}
1016
guard let url = URL(string: req.url),
1117
let scheme = url.scheme, let host = url.host else
1218
{

0 commit comments

Comments
 (0)