tests/test-hgweb-raw.t
changeset 16973 3d71807c3a48
parent 16913 f2719b387380
child 17017 953faba28e91
equal deleted inserted replaced
16972:5efe9c6a34fe 16973:3d71807c3a48
     3 Test raw style of hgweb
     3 Test raw style of hgweb
     4 
     4 
     5   $ hg init test
     5   $ hg init test
     6   $ cd test
     6   $ cd test
     7   $ mkdir sub
     7   $ mkdir sub
     8   $ cat >'sub/some "text".txt' <<ENDSOME
     8   $ cat >'sub/some text%.txt' <<ENDSOME
     9   > This is just some random text
     9   > This is just some random text
    10   > that will go inside the file and take a few lines.
    10   > that will go inside the file and take a few lines.
    11   > It is very boring to read, but computers don't
    11   > It is very boring to read, but computers don't
    12   > care about things like that.
    12   > care about things like that.
    13   > ENDSOME
    13   > ENDSOME
    14   $ hg add 'sub/some "text".txt'
    14   $ hg add 'sub/some text%.txt'
    15   warning: filename contains '"', which is reserved on Windows: 'sub/some "text".txt'
       
    16   $ hg commit -d "1 0" -m "Just some text"
    15   $ hg commit -d "1 0" -m "Just some text"
    17 
    16 
    18   $ hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid
    17   $ hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid
    19 
    18 
    20   $ cat hg.pid >> $DAEMON_PIDS
    19   $ cat hg.pid >> $DAEMON_PIDS
    21   $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?f=a23bf1310f6e;file=sub/some%20%22text%22.txt;style=raw' content-type content-length content-disposition) >getoutput.txt
    20   $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?f=bf0ff59095c9;file=sub/some%20text%25.txt;style=raw' content-type content-length content-disposition) >getoutput.txt
    22 
    21 
    23   $ while kill `cat hg.pid` 2>/dev/null; do sleep 0; done
    22   $ while kill `cat hg.pid` 2>/dev/null; do sleep 0; done
    24 
    23 
    25   $ cat getoutput.txt
    24   $ cat getoutput.txt
    26   200 Script output follows
    25   200 Script output follows
    27   content-type: application/binary
    26   content-type: application/binary
    28   content-length: 157
    27   content-length: 157
    29   content-disposition: inline; filename="some \"text\".txt"
    28   content-disposition: inline; filename="some text%.txt"
    30   
    29   
    31   This is just some random text
    30   This is just some random text
    32   that will go inside the file and take a few lines.
    31   that will go inside the file and take a few lines.
    33   It is very boring to read, but computers don't
    32   It is very boring to read, but computers don't
    34   care about things like that.
    33   care about things like that.
    35   $ cat access.log error.log
    34   $ cat access.log error.log
    36   127.0.0.1 - - [*] "GET /?f=a23bf1310f6e;file=sub/some%20%22text%22.txt;style=raw HTTP/1.1" 200 - (glob)
    35   127.0.0.1 - - [*] "GET /?f=bf0ff59095c9;file=sub/some%20text%25.txt;style=raw HTTP/1.1" 200 - (glob)
    37 
    36 
    38   $ rm access.log error.log
    37   $ rm access.log error.log
    39   $ hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid \
    38   $ hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid \
    40   > --config web.guessmime=True
    39   > --config web.guessmime=True
    41 
    40 
    42   $ cat hg.pid >> $DAEMON_PIDS
    41   $ cat hg.pid >> $DAEMON_PIDS
    43   $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?f=a23bf1310f6e;file=sub/some%20%22text%22.txt;style=raw' content-type content-length content-disposition) >getoutput.txt
    42   $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?f=bf0ff59095c9;file=sub/some%20text%25.txt;style=raw' content-type content-length content-disposition) >getoutput.txt
    44   $ while kill `cat hg.pid` 2>/dev/null; do sleep 0; done
    43   $ while kill `cat hg.pid` 2>/dev/null; do sleep 0; done
    45 
    44 
    46   $ cat getoutput.txt
    45   $ cat getoutput.txt
    47   200 Script output follows
    46   200 Script output follows
    48   content-type: text/plain; charset="ascii"
    47   content-type: text/plain; charset="ascii"
    49   content-length: 157
    48   content-length: 157
    50   content-disposition: inline; filename="some \"text\".txt"
    49   content-disposition: inline; filename="some text%.txt"
    51   
    50   
    52   This is just some random text
    51   This is just some random text
    53   that will go inside the file and take a few lines.
    52   that will go inside the file and take a few lines.
    54   It is very boring to read, but computers don't
    53   It is very boring to read, but computers don't
    55   care about things like that.
    54   care about things like that.
    56   $ cat access.log error.log
    55   $ cat access.log error.log
    57   127.0.0.1 - - [*] "GET /?f=a23bf1310f6e;file=sub/some%20%22text%22.txt;style=raw HTTP/1.1" 200 - (glob)
    56   127.0.0.1 - - [*] "GET /?f=bf0ff59095c9;file=sub/some%20text%25.txt;style=raw HTTP/1.1" 200 - (glob)
    58 
    57 
    59   $ cd ..
    58   $ cd ..