Issue 1917: gitHttpUrl from config file section [gerrit] does not apply for registered users
Status:  New
Owner: ----
Reported by lars.klo...@software-friends.de, May 16, 2013
Affected Version: 2.5.1

What steps will reproduce the problem?
1. Have Gerrit running with HTTP daemon configured, but without gitHttpUrl set in config file section [gerrit].
2. Register yourself with Gerrit. (For each patch set, the HTTP download URLs default to Gerrit server.)
3. Add "gitHttpUrl = https://<anotherHost>/gerrit/ to config file section [gerrit], restart Gerrit, clear Browser cache.
4. Log into Gerrit with previously registered User.

What is the expected output? What do you see instead?
The download URLs should start with the configured path.
Instead they are still the same as before.

Please provide any additional information below.
I heard from Users that registered with Gerrit after this configurational change, that the newly configured URL is displayed.
Is it possible, that this URL is somehow cached per user account? If so, how can this cache be cleared without risk of using relevant data?
Aug 8, 2013
#1 mgm.andr...@gmail.com
I could reproduce the problem.
If a project allows "Read" access for anonymous users for "Reference:refs/*" than the configured url will appear. If not than the url will be generated from request url.

To fix the problem replace the method siteReliesOnHttp() of com.google.gerrit.client.download.DownloadUrlLink with following code.

  public static boolean siteReliesOnHttp() {
    return Gerrit.getConfig().getGitHttpUrl() != null
        && (Gerrit.getConfig().getAuthType() == AuthType.CUSTOM_EXTENSION
        && !Gerrit.getConfig().siteHasUsernames() || Gerrit.getConfig().getAuthType() == AuthType.HTTP);
  }