Burp Suite User Forum

Create new post

request().url() return value inconsistent

James | Last updated: Apr 12, 2024 02:25PM UTC

While working on an extension I came across an odd behavior but I'm not sure if it's expected or something with my extension code. It looks like for some reason, the HttpReuqestResponse.request().url() returns different values depending on how the HttpRequestResponse object is created. When creating HttpRequestResponse objects manually from base64 decoded data the url() method returns only the path (e.g. /some/path instead of https://myhost.com/some/path). While my HttpHandler code does the usual HttpRequestResponse creation using responseReceived and responseReceived.initiatingRequest() and a call to .request().url() returns the full path (e.g. https://myhost.com/some/path) I'm continuing to debug and go over the docs but I'm running out of ideas. If anyone else can confirm this behavior or point me to a potential solution I'd be thankful.

Hannah, PortSwigger Agent | Last updated: Apr 12, 2024 03:00PM UTC

Hi Do the created HttpRequestResponses all have an attached HttpService, or have they been created without an HttpService?

James | Last updated: Apr 12, 2024 03:04PM UTC

ah ha, I have not used HttpService.

James | Last updated: Apr 12, 2024 03:18PM UTC

Thank you Hannah! If anyone else finds it helpful my solution was the following: val service = HttpService.httpService(url) //url is a string returned from DB query val decodedRequest: String = String(Base64.getDecoder().decode(encodedRequest)) //val request = HttpRequest.httpRequest(decodedRequest) request obj without service loses the hostname and protocol val request = HttpRequest.httpRequest(service, decodedRequest) //solution

Hannah, PortSwigger Agent | Last updated: Apr 15, 2024 08:41AM UTC

Glad to hear that helped! If there's anything else we can help with, then please let us know.

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.