tests/test-hgweb-head.t
author Raphaël Gomès <rgomes@octobus.net>
Mon, 04 Nov 2024 15:23:41 +0100
changeset 52311 f7b2806035a7
parent 49905 cd125eef4388
permissions -rw-r--r--
rust: update `clap` to the latest 4.x version This brings in more up-to-date dependencies, some bug fixes (none of which are relevant yet), and slightly improved compile times.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49905
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     1
#require serve
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     2
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     3
Some tests for hgweb responding to HEAD requests
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     4
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     5
  $ hg init test
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     6
  $ cd test
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     7
  $ mkdir da
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     8
  $ echo foo > da/foo
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     9
  $ echo foo > foo
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    10
  $ hg ci -Ambase
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    11
  adding da/foo
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    12
  adding foo
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    13
  $ hg bookmark -r0 '@'
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    14
  $ hg bookmark -r0 'a b c'
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    15
  $ hg bookmark -r0 'd/e/f'
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    16
  $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    17
  $ cat hg.pid >> $DAEMON_PIDS
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    18
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    19
manifest
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    20
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    21
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/?style=raw' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    22
  200 Script output follows
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    23
  content-type: text/plain; charset=ascii
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    24
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    25
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/da?style=raw' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    26
  200 Script output follows
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    27
  content-type: text/plain; charset=ascii
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    28
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    29
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    30
plain file
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    31
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    32
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/foo?style=raw' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    33
  200 Script output follows
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    34
  content-disposition: inline; filename="foo"
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    35
  content-length: 4
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    36
  content-type: application/binary
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    37
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    38
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    39
should give a 404 - static file that does not exist
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    40
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    41
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'static/bogus' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    42
  404 Not Found
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    43
  content-type: text/html; charset=ascii
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    44
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    45
  [1]
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    46
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    47
should give a 404 - bad revision
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    48
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    49
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/spam/foo?style=raw' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    50
  404 Not Found
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    51
  content-type: text/plain; charset=ascii
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    52
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    53
  [1]
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    54
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    55
should give a 400 - bad command
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    56
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    57
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/foo?cmd=spam&style=raw' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    58
  400* (glob)
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    59
  content-type: text/plain; charset=ascii
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    60
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    61
  [1]
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    62
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    63
should give a 404 - file does not exist
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    64
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    65
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/bork?style=raw' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    66
  404 Not Found
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    67
  content-type: text/plain; charset=ascii
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    68
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    69
  [1]
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    70
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    71
try bad style
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    72
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    73
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'file/tip/?style=foobar' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    74
  200 Script output follows
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    75
  content-type: text/html; charset=ascii
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    76
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    77
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    78
log
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    79
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    80
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'log?style=raw' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    81
  200 Script output follows
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    82
  content-type: text/plain; charset=ascii
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    83
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    84
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    85
access bookmarks
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    86
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    87
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'rev/@?style=paper' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    88
  200 Script output follows
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    89
  content-type: text/html; charset=ascii
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    90
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    91
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    92
static file
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    93
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    94
  $ get-with-headers.py localhost:$HGPORT --method=HEAD 'static/style-gitweb.css' - date etag server
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    95
  200 Script output follows
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    96
  content-length: 9074
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    97
  content-type: text/css
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    98
  
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    99
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   100
  $ killdaemons.py
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   101
cd125eef4388 tests: check how hgweb handles HEAD requests
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
   102
  $ cd ..