Fossil SCM

branch/fix_remote_url_overwrite_with_proxy

3 years, 11 months ago by mgagnon

Purpose of this branch and the problem it solve:

  • It prevent the remote-url from being replaced by the Proxy setting
    when url_remember() is called at any time after the function
    url_enable_proxy().

  • url_enable_proxy() function replace g.url.canonical by the
    proxy address to permit transport_open() function down the
    road to connect at the proxy address where and the full canonical
    is used inside the http header payload to inform the proxy about
    destination address to connect.

  • This code doesn't change anything in the existing content of g.url.
    It just added 1 new field which keep a backup of the original
    canonical url when http_proxy is use, so it can use this backup
    when code was intended to use the real server address instead of
    the proxy.

    • The existing g.url.proxyUrlPath field already works a similar
      way to backup the original path part of the url when a proxy
      is used. So this branch try to reproduce similar pattern with
      a new g.url.proxyUrlCanonical field.
  • examples:

  • when it's time to save the remote-url in repo or global config
    database.

    • (trunk will overwrite with proxy address when sync is
      successful and proxy is used)
  • when printing some info on screen (call of sync_explain())

    • (trunk will print: e.g. "pull from <the proxy url>")

Tested and seems to works with and without proxy set, (from env variable
or proxy setting).

Side note:

One could say that the ideal fix would be to change
transport_open() to check if a proxy is use and connect to the
proxy ip that would be saved in a distinct field (may be inside g.url).
But this would be a much more invasive change that can potentially break
stuff. The way this branch is implemented now, it is almost a no-op when
a proxy is not use, and a very small change when proxy is use.
(the diff is way smaller than this wiki)

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button