Fix Git HTTP redirects not working with query parameter

What does this MR do and why?

Previously if you attempted to request the following URL:

https://gitlab.com/<repository path>.git?ref=<branch><path>

This would fail with an endless redirect to the origin path. The previous implementation attempted to strip the .git from the end of a URL, but that meant any query parameters attached to the URL would prevent that substitution from happening.

Fix this by parsing the URL and stripping the path so that handle this properly.

Relates to #472072 (closed)

How to set up and validate locally

  1. On your GDK master, run:
curl "http://gdk.test:3443/toolbox/gitlab-smoke-tests.git?ref=heads"
  1. You should see something like:
* Request completely sent off
< HTTP/1.1 302 Found
< Transfer-Encoding: chunked
< Date: Mon, 19 Aug 2024 20:19:36 GMT
< Location: https://gdk.test:3443/toolbox/gitlab-smoke-tests?ref=heads
  1. On master, notice the URL doesn't change:
* Request completely sent off
< HTTP/1.1 302 Found
< Transfer-Encoding: chunked
< Date: Mon, 19 Aug 2024 20:21:15 GMT
< Location: https://gdk.test:3443/toolbox/gitlab-smoke-tests.git?ref=heads
Edited by Stan Hu

Merge request reports

Loading