ansible/hg-web: enable accepting arguments via HTTP POST (
bug 1350285); r?glob
Mercurial has an optional feature that when enabled has the server
advertise to clients that Mercurial wire protocol arguments should be
transmitted via HTTP POST request bodies instead of via request headers
on GET requests.
Transferring arguments via POST bodies avoids potential issues with
HTTP request headers overflowing server limits. This commonly results
in errors like "413 Request Entity Too Large," which Mozilla has seen
on both the origin Apache HTTP server and on the load balancer.
After several years of playing cat and mouse with HTTP request header
limits, let's avoid the problem by switching to HTTP POST for argument
passing.
After this patch, if someone sees an HTTP 413 response, it is likely
they are running an old Mercurial client.
MozReview-Commit-ID: IJp0w5lXLqd
--- a/ansible/roles/hg-web/files/hgrc
+++ b/ansible/roles/hg-web/files/hgrc
@@ -52,16 +52,22 @@ hgmo = /var/hg/version-control-tools/hge
[interhg]
a_httplinks = s|(https?://\S+)|<a href="\1">\1</a>|i
bugzilla = s|((?:bug[\s#]*|b=#?|#)(\d{4,}))|<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=\2" title="Bug \2">\1</a>|i
#[serverlog]
#reporoot = /repo_local/mozilla/
+[experimental]
+# Repos with large numbers of heads can overflow limits in total size of HTTP
+# request headers. Enable argument passing via HTTP POST bodies to work around
+# this limit.
+httppostargs = true
+
[bundleclone]
pullmanifest=True
[obshacks]
# Enable the user that runs hgweb and performs replication to exchange
# obsolescence markers, even if not enabled for regular users.
obsolescenceexchangeusers = hg
new file mode 100644
--- /dev/null
+++ b/hgserver/tests/test-http-post-args.t
@@ -0,0 +1,21 @@
+#require hgmodocker
+
+ $ . $TESTDIR/hgserver/tests/helpers.sh
+ $ hgmoenv
+
+Create a dummy repo
+
+ $ hgmo create-repo mozilla-central scm_level_3
+ (recorded repository creation in replication log)
+
+HTTP POST should be used for some HTTP requests
+
+ $ hg -q clone ${HGWEB_0_URL}mozilla-central clone
+ $ hgmo exec hgweb0 cat /var/log/httpd/hg.mozilla.org/access_log
+ $DOCKER_HOSTNAME - - [*] "GET /mozilla-central?cmd=capabilities HTTP/1.1" 200 351 "-" "mercurial/proto-1.0 (Mercurial *)" (glob)
+ $DOCKER_HOSTNAME - - [*] "POST /mozilla-central?cmd=batch HTTP/1.1" 200 42 "-" "mercurial/proto-1.0 (Mercurial *)" (glob)
+ $DOCKER_HOSTNAME - - [*] "POST /mozilla-central?cmd=getbundle HTTP/1.1" 200 86 "-" "mercurial/proto-1.0 (Mercurial *)" (glob)
+
+Cleanup
+
+ $ hgmo clean