tkohegyi / mitmJavaProxy

HTTP/HTTPS MITM Java Proxy with the possibility of intercepting and investigating/altering both requests and responses.
https://github.com/tkohegyi/mitmJavaProxy
Apache License 2.0
16 stars 6 forks source link

HTTPS call causes E500, if cannot resolve DNS record #18

Open tkohegyi opened 10 months ago

tkohegyi commented 10 months ago

Internal error (E500) occurs in proxy if DNS record cannot be resolved during a HTTPS call.

Answer (incorrect): 14:05:09.380 [SocketListener0-1] DEBUG n.l.b.p.s.SeleniumProxyHandler - CONNECT: ..... 14:05:09.418 [SocketListener0-1] DEBUG n.l.b.p.s.SeleniumProxyHandler - error during handleConnect java.net.UnknownHostException: No such host is known (....) 14:05:09.422 [SocketListener0-1] DEBUG n.l.b.p.jetty.http.HttpConnection - RESPONSE: HTTP/1.1 500 java%2Enet%2EUnknownHostException%3A+No+such+host+is+known+.....

In case of HTTP, E404 is used (let say it is correct): 14:03:58.604 [SocketListener0-1] DEBUG n.l.b.p.jetty.http.HttpConnection - RESPONSE: HTTP/1.1 404 Not Found

quickest test command (if proxy is running on localhost and at port 9092): curl --insecure -X GET https://no.dns.record -x 127.0.0.1:9092 result: curl: (56) CONNECT tunnel failed, response 500

tkohegyi commented 10 months ago

This fix addresses it: https://github.com/tkohegyi/mitmJavaProxy/commit/89f776109c7851181f8067c2adfb413579338b17