##// END OF EJS Templates
hgweb: support constructing URLs from an alternate base URL...
hgweb: support constructing URLs from an alternate base URL The web.baseurl config option allows server operators to define a custom URL for hosted content. The way it works today is that hgwebdir parses this config option into URL components then updates the appropriate WSGI environment variables so the request "lies" about its details. For example, SERVER_NAME is updated to reflect the alternate base URL's hostname. The WSGI environment should not be modified because WSGI applications may want to know the original request details (for debugging, etc). This commit teaches our request parser about the existence of an alternate base URL. If defined, the advertised URL and other self-reflected paths will take the alternate base URL into account. The hgweb WSGI application didn't use web.baseurl. But hgwebdir did. We update hgwebdir to alter the environment parsing accordingly. The old code around environment manipulation has been removed. With this change, parserequestfromenv() has grown to a bit unwieldy. Now that practically everyone is using it, it is obvious that there is some unused features that can be trimmed. So look for this in follow-up commits. Differential Revision: https://phab.mercurial-scm.org/D2822

File last commit:

r35269:44b8b5ad default
r36916:219b2335 default
Show More
test-http-proxy.t
125 lines | 6.5 KiB | text/troff | Tads3Lexer
/ tests / test-http-proxy.t
Matt Mackall
tests: replace exit 80 with #require
r22046 #require serve
Matt Mackall
tests: unify test-http-proxy
r12449
$ hg init a
$ cd a
$ echo a > a
$ hg ci -Ama -d '1123456789 0'
adding a
Jun Wu
tests: reorder hg serve commands...
r28549 $ hg serve --config server.uncompressed=True -p $HGPORT -d --pid-file=hg.pid
Matt Mackall
tests: unify test-http-proxy
r12449 $ cat hg.pid >> $DAEMON_PIDS
$ cd ..
Matt Harbison
test-http-proxy: redirect proxy stdout to /dev/null...
r32916 $ tinyproxy.py $HGPORT1 localhost 2>proxy.log >/dev/null </dev/null &
Mads Kiilerich
tests: use 'do sleep 0' instead of 'do true', also on first line of command...
r16496 $ while [ ! -f proxy.pid ]; do sleep 0; done
Matt Mackall
tests: unify test-http-proxy
r12449 $ cat proxy.pid >> $DAEMON_PIDS
url for proxy, stream
Gregory Szorc
commands: rename clone --uncompressed to --stream and document...
r34394 $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --stream http://localhost:$HGPORT/ b
Matt Mackall
tests: unify test-http-proxy
r12449 streaming all changes
3 files to transfer, 303 bytes of data
Thomas Arendsen Hein
tests: check for (*/sec) instead of (*B/sec) to match (X bytes/sec)...
r14023 transferred * bytes in * seconds (*/sec) (glob)
Durham Goode
clone: fix copying bookmarks in uncompressed clones (issue4430)...
r23116 searching for changes
no changes found
Matt Mackall
tests: unify test-http-proxy
r12449 updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd b
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
1 files, 1 changesets, 1 total revisions
$ cd ..
url for proxy, pull
$ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT/ b-pull
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets 83180e7845de
Matt Mackall
tests: unify test-http-proxy
r12449 updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd b-pull
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
1 files, 1 changesets, 1 total revisions
$ cd ..
host:port for proxy
$ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets 83180e7845de
Matt Mackall
tests: unify test-http-proxy
r12449 updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
proxy url with user name and password
$ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ d
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets 83180e7845de
Matt Mackall
tests: unify test-http-proxy
r12449 updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
url with user name and password
$ http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets 83180e7845de
Matt Mackall
tests: unify test-http-proxy
r12449 updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Augie Fackler
tests: also allow "Protocol not supported" in test-http-proxy error...
r30851 bad host:port for proxy ("Protocol not supported" can happen on
misconfigured hosts)
Matt Mackall
tests: unify test-http-proxy
r12449
$ http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f
Boris Feld
tests: fix two http tests to also pass inside manylinux1 docker...
r32079 abort: error: (Connection refused|Protocol not supported|.* actively refused it|Cannot assign requested address) (re)
Matt Mackall
tests: unify test-http-proxy
r12449 [255]
do not use the proxy if it is in the no list
$ http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.no=localhost http://localhost:$HGPORT/ g
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets 83180e7845de
Matt Mackall
tests: unify test-http-proxy
r12449 updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cat proxy.log
Mads Kiilerich
tests: reintroduce ":$HGPORT" in test output...
r12643 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
Augie Fackler
tests: re-add (glob) for $LOCALIP matches...
r35153 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=branchmap HTTP/1.1" - - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
$LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
$LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D83180e7845de420a1bb46896fd5fe05294f8d629 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
Boris Feld
pull: retrieve bookmarks through the binary part when possible...
r35269 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=83180e7845de420a1bb46896fd5fe05294f8d629&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
Pierre-Yves David
test: use bundle2 in test-http-proxy...
r25371 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
Augie Fackler
tests: re-add (glob) for $LOCALIP matches...
r35153 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
Boris Feld
pull: retrieve bookmarks through the binary part when possible...
r35269 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
Matt Mackall
bookmarks: merge low-level push/pull support into core
r13364 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
Augie Fackler
tests: re-add (glob) for $LOCALIP matches...
r35153 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
Boris Feld
pull: retrieve bookmarks through the binary part when possible...
r35269 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
Matt Mackall
bookmarks: merge low-level push/pull support into core
r13364 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
Augie Fackler
tests: re-add (glob) for $LOCALIP matches...
r35153 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
Boris Feld
pull: retrieve bookmarks through the binary part when possible...
r35269 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
Matt Mackall
bookmarks: merge low-level push/pull support into core
r13364 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
Augie Fackler
tests: re-add (glob) for $LOCALIP matches...
r35153 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)
Boris Feld
pull: retrieve bookmarks through the binary part when possible...
r35269 $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob)