Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

CONNECT host:port request produces MalformedURLException: unknown protocol: ... #258

Description

@vlsi

Describe the bug
A clear and concise description of what the bug is.

url = new URL(httpRequest.uri()); throws exceptions because the URI does not always include the protocol.

I suggest that the proxy should recognize such URIs and handle them appropriately (e.g. by adding a dummy https:// if missing)

To Reproduce
Steps to reproduce the behavior:

        val selenideConfig = SelenideConfig()
        val seleniumProxy = Proxy().setHttpProxy("${proxy.host}:${proxy.port}")
        val selenideProxy = SelenideProxyServer(selenideConfig, seleniumProxy)
        selenideProxy.proxy.chainedProxyAuthorization("username", "password", AuthType.BASIC)
        selenideProxy.start()
        val lazyDriver = LazyDriver(selenideConfig, selenideProxy.createSeleniumProxy(), Collections.emptyList())
        val selenideDriver = SelenideDriver(selenideConfig, lazyDriver)
        selenideDriver.open("https://www.google.com/")

Expected behavior

There should be no errors (and stacktraces) in case of successful operation.

Please complete the following information:

  • OS: macOS
  • Browser Chrome
  • Version 82

Additional context

java.net.MalformedURLException: unknown protocol: accounts.google.com
	at java.base/java.net.URL.<init>(URL.java:664) ~[na:na]
	at java.base/java.net.URL.<init>(URL.java:553) ~[na:na]
	at java.base/java.net.URL.<init>(URL.java:500) ~[na:na]
	at com.browserup.bup.BrowserUpProxyServer$2.lookupChainedProxies(BrowserUpProxyServer.java:412) ~[browserup-proxy-core-2.1.0.jar:na]
	at org.littleshoot.proxy.impl.ProxyToServerConnection.create(ProxyToServerConnection.java:178) ~[littleproxy-2.0.0-beta-5.jar:na]
	at org.littleshoot.proxy.impl.ClientToProxyConnection.doReadHTTPInitial(ClientToProxyConnection.java:281) ~[littleproxy-2.0.0-beta-5.jar:na]
	at org.littleshoot.proxy.impl.ClientToProxyConnection.readHTTPInitial(ClientToProxyConnection.java:187) ~[littleproxy-2.0.0-beta-5.jar:na]
	at org.littleshoot.proxy.impl.ClientToProxyConnection.readHTTPInitial(ClientToProxyConnection.java:55) ~[littleproxy-2.0.0-beta-5.jar:na]
	at org.littleshoot.proxy.impl.ProxyConnection.readHTTP(ProxyConnection.java:144) ~[littleproxy-2.0.0-beta-5.jar:na]
	at org.littleshoot.proxy.impl.ProxyConnection.read(ProxyConnection.java:122) ~[littleproxy-2.0.0-beta-5.jar:na]
	at org.littleshoot.proxy.impl.ProxyConnection.channelRead0(ProxyConnection.java:582) ~[littleproxy-2.0.0-beta-5.jar:na]
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.48.Final.jar:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.48.Final.jar:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.48.Final.jar:4.1.48.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.48.Final.jar:4.1.48.Final]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions