Skip to content

Curly brace made the request host and port incorrect #378

@thibaut-sticky

Description

@thibaut-sticky

Hi all,

I use browsermob to listen the requests sent by a video player within a browser.
I have a particular check where I assert a domain is well called.

HarEntry currentEntry = ...
String domain = "mydomain.fr";
String currentUrl = currentEntry.getRequest().getUrl();
mydomain.equals(new URI(currentUrl).getHost());

It works fine for almost my test, but it failed for one.
After investigation, it appears that currentEntry.getRequest().getUrl() returned http://mydomain.frhttp://mydomain.fr/dt?tv={c:45,d=45}
As you can see the domain is duplicate. This wrong URL is made here:

net.lightbody.bmp.filters.HttpsAwareFiltersAdapter#getFullUrl
net.lightbody.bmp.util.BrowserMobHttpUtil#getHostAndPortFromRequest

There is a URISyntaxException due to the curly brace. And as said the comment

could not parse the URI, so fall through and return the URI as-is

I know curly brace is not a valid char, but would be possible to handle such case? For instance, instead of do nothing try to encode URL.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions