browserup / browserup-proxy

BrowserUp Proxy is a free utility to watch, test, and manipulate web application network traffic and performance.
https://browserup.com
Apache License 2.0
164 stars 41 forks source link

I see "MalformedURLException: unknown protocol" in logs #385

Open asolntsev opened 2 years ago

asolntsev commented 2 years ago

Describe the bug Sometimes I see "MalformedURLException: unknown protocol" error in logs, though everything works well.

I think BUP should just ignore such URLs like content-signature-2.cdn.mozilla.net. It seems these are some internal resources used by browser itself.

[LittleProxy-7-ClientToProxyWorker-1] ERROR com.browserup.bup.BrowserUpProxyServer - The requested URL is not valid.
    java.net.MalformedURLException: unknown protocol: content-signature-2.cdn.mozilla.net
        at java.base/java.net.URL.<init>(URL.java:652)
        at java.base/java.net.URL.<init>(URL.java:541)
        at java.base/java.net.URL.<init>(URL.java:488)
        at com.browserup.bup.BrowserUpProxyServer$2.lookupChainedProxies(BrowserUpProxyServer.java:412)
        at org.littleshoot.proxy.impl.ProxyToServerConnection.create(ProxyToServerConnection.java:199)
        at org.littleshoot.proxy.impl.ClientToProxyConnection.doReadHTTPInitial(ClientToProxyConnection.java:314)
        at org.littleshoot.proxy.impl.ClientToProxyConnection.readHTTPInitial(ClientToProxyConnection.java:223)
        at org.littleshoot.proxy.impl.ClientToProxyConnection.readHTTPInitial(ClientToProxyConnection.java:87)
        at org.littleshoot.proxy.impl.ProxyConnection.readHTTP(ProxyConnection.java:140)
        at org.littleshoot.proxy.impl.ProxyConnection.read(ProxyConnection.java:120)
        at org.littleshoot.proxy.impl.ProxyConnection.channelRead0(ProxyConnection.java:556)
        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
        ...

Please complete the following information:

mauromol commented 10 months ago

Yes, it seems like Firefox is producing requests without the protocol and this causes the above exception because httpRequest.uri() is returning a hostname (possibly with port) without any protocol...

mauromol commented 10 months ago

By the way, this is a duplicate of #258.