Merge branch 'stable-2.6' * stable-2.6: Update proxy example shown on container configuration error page Fix sample reverse proxy configuration for Apache Fix display of account name when name consists only of spaces Show filter field on project/group list screen before populating the list
diff --git a/Documentation/config-reverseproxy.txt b/Documentation/config-reverseproxy.txt index 67d2004..c932c0c 100644 --- a/Documentation/config-reverseproxy.txt +++ b/Documentation/config-reverseproxy.txt
@@ -28,36 +28,34 @@ Apache 2 Configuration ---------------------- -To run Gerrit behind an Apache server using 'mod_proxy', enable the +To run Gerrit behind an Apache server we cannot use 'mod_proxy' +directly, as Gerrit relies on getting unmodified escaped forward +slashes. Depending on the setting of 'AllowEncodedSlashes', +'mod_proxy' would either decode encoded slashes, or encode them once +again. Hence, we resort to using 'mod_rewrite'. To enable the necessary Apache2 modules: ---- - a2enmod proxy_http + a2enmod rewrite a2enmod ssl ; # optional, needed for HTTPS / SSL ---- -Configure an Apache VirtualHost to proxy to the Gerrit daemon, -setting the 'ProxyPass' line to use the 'http://' URL configured -above. Ensure the path of ProxyPass and httpd.listenUrl match, -or links will redirect to incorrect locations. +Configure an Apache VirtualHost to proxy to the Gerrit daemon, setting +the 'RewriteRule' line to use the 'http://' URL configured above. +Ensure the path of 'RewriteRule' (the part before '$1') and +httpd.listenUrl match, or links will redirect to incorrect locations. + +Note that this configuration allows to pass encoded characters to the +virtual host, which is potentially dangerous. Be sure to read up on +this topic and that you understand the risks. ---- <VirtualHost *> ServerName review.example.com - ProxyRequests Off - ProxyVia Off - ProxyPreserveHost On - - <Proxy *> - Order deny,allow - Allow from all - </Proxy> - - <Location /r/> - AllowEncodedSlashes NoDecode - </Location> - ProxyPass /r/ http://127.0.0.1:8081/r/ + AllowEncodedSlashes NoDecode + RewriteEngine On + RewriteRule ^/r/(.*) http://localhost:8081/r/$1 </VirtualHost> ----
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java index 0f3a445..37c3358 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java
@@ -125,7 +125,7 @@ } /** - * Formats an account as an name and an email address. + * Formats an account as a name and an email address. * <p> * Example output: * <ul> @@ -137,7 +137,7 @@ */ public static String nameEmail(AccountInfo info) { String name = info.name(); - if (name == null) { + if (name == null || name.trim().isEmpty()) { name = Gerrit.getConfig().getAnonymousCowardName(); } @@ -167,7 +167,7 @@ * returns a longer form that includes the email address. */ public static String name(AccountInfo ai) { - if (ai.name() != null) { + if (ai.name() != null && !ai.name().trim().isEmpty()) { return ai.name(); } String email = ai.email();
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ContactPanelShort.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ContactPanelShort.java index cba2f0b..f35bd4b 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ContactPanelShort.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ContactPanelShort.java
@@ -348,7 +348,7 @@ void doSave(final AsyncCallback<Account> onSave) { String newName = canEditFullName() ? nameTxt.getText() : null; - if ("".equals(newName)) { + if (newName != null && newName.trim().isEmpty()) { newName = null; }
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java index 07f25f4..dac0b6a 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java
@@ -18,7 +18,7 @@ import com.google.gerrit.client.Gerrit; import com.google.gerrit.client.groups.GroupMap; -import com.google.gerrit.client.rpc.ScreenLoadCallback; +import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.ui.AccountScreen; import com.google.gerrit.client.ui.FilteredUserInterface; import com.google.gerrit.client.ui.IgnoreOutdatedFilterResultsCallbackWrapper; @@ -54,6 +54,7 @@ @Override protected void onLoad() { super.onLoad(); + display(); refresh(); } @@ -62,9 +63,9 @@ : ADMIN_GROUPS + "?filter=" + URL.encodeQueryString(subname)); GroupMap.match(subname, new IgnoreOutdatedFilterResultsCallbackWrapper<GroupMap>(this, - new ScreenLoadCallback<GroupMap>(this) { + new GerritCallback<GroupMap>() { @Override - protected void preDisplay(final GroupMap result) { + public void onSuccess(GroupMap result) { groups.display(result, subname); groups.finishDisplay(); }
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java index 6af437c..ee58420 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java
@@ -21,7 +21,7 @@ import com.google.gerrit.client.GitwebLink; import com.google.gerrit.client.projects.ProjectInfo; import com.google.gerrit.client.projects.ProjectMap; -import com.google.gerrit.client.rpc.ScreenLoadCallback; +import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.ui.FilteredUserInterface; import com.google.gerrit.client.ui.HighlightingInlineHyperlink; import com.google.gerrit.client.ui.IgnoreOutdatedFilterResultsCallbackWrapper; @@ -63,6 +63,7 @@ @Override protected void onLoad() { super.onLoad(); + display(); refresh(); } @@ -71,9 +72,9 @@ : ADMIN_PROJECTS + "?filter=" + URL.encodeQueryString(subname)); ProjectMap.match(subname, new IgnoreOutdatedFilterResultsCallbackWrapper<ProjectMap>(this, - new ScreenLoadCallback<ProjectMap>(this) { + new GerritCallback<ProjectMap>() { @Override - protected void preDisplay(final ProjectMap result) { + public void onSuccess(ProjectMap result) { projects.display(result); } }));
diff --git a/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/auth/container/ConfigurationError.html b/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/auth/container/ConfigurationError.html index 7294012..a7cd489 100644 --- a/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/auth/container/ConfigurationError.html +++ b/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/auth/container/ConfigurationError.html
@@ -49,22 +49,16 @@ <VirtualHost <span class='ServerName'>review.example.com</span><span class='ServerPort'>:80</span>> ServerName <span class='ServerName'>review.example.com</span> - ProxyRequests Off - ProxyVia Off - ProxyPreserveHost On - - <Proxy *> - Order deny,allow - Allow from all - </Proxy> - <div class='apache_auth'> <Location <span class='ContextPath'>/r</span>/login/> AuthType Basic AuthName "Gerrit Code Review" Require valid-user ... </Location></div> - ProxyPass <span class='ContextPath'>/r</span>/ http://...<span class='ContextPath'>/r</span>/ + + AllowEncodedSlashes NoDecode + RewriteEngine On + RewriteRule ^<span class='ContextPath'>/r</span>/(.*) http://...<span class='ContextPath'>/r</span>/$1 </VirtualHost> </pre> </body>