tests/test-http-proxy
branchstable
changeset 12795 3cb0559e44d0
parent 12793 469850088fc1
parent 12794 6bf8d48bec8e
child 12796 bc69ba99e34b
equal deleted inserted replaced
12793:469850088fc1 12795:3cb0559e44d0
     1 #!/bin/sh
       
     2 
       
     3 hg init a
       
     4 cd a
       
     5 echo a > a
       
     6 hg ci -Ama -d '1123456789 0'
       
     7 hg --config server.uncompressed=True serve -p $HGPORT -d --pid-file=hg.pid
       
     8 cat hg.pid >> $DAEMON_PIDS
       
     9 
       
    10 cd ..
       
    11 ("$TESTDIR/tinyproxy.py" $HGPORT1 localhost >proxy.log 2>&1 </dev/null &
       
    12 echo $! > proxy.pid)
       
    13 cat proxy.pid >> $DAEMON_PIDS
       
    14 sleep 2
       
    15 
       
    16 echo %% url for proxy, stream
       
    17 http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --uncompressed http://localhost:$HGPORT/ b | \
       
    18   sed -e 's/[0-9][0-9.]*/XXX/g' -e 's/[KM]\(B\/sec\)/X\1/'
       
    19 cd b
       
    20 hg verify
       
    21 cd ..
       
    22 
       
    23 echo %% url for proxy, pull
       
    24 http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT/ b-pull
       
    25 cd b-pull
       
    26 hg verify
       
    27 cd ..
       
    28 
       
    29 echo %% host:port for proxy
       
    30 http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ c
       
    31 
       
    32 echo %% proxy url with user name and password
       
    33 http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ d
       
    34 
       
    35 echo %% url with user name and password
       
    36 http_proxy=http://user:passwd@localhost:$HGPORT1 hg clone --config http_proxy.always=True http://user:passwd@localhost:$HGPORT/ e
       
    37 
       
    38 echo %% bad host:port for proxy
       
    39 http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f
       
    40 
       
    41 echo %% do not use the proxy if it is in the no list
       
    42 http_proxy=localhost:$HGPORT1 hg clone --config http_proxy.no=localhost http://localhost:$HGPORT/ g
       
    43 
       
    44 cat proxy.log | sed -e 's/^.*\] /XXX /' -e 's/:[0-9][0-9]*/:/'
       
    45 exit 0