tests: add lots of regex matching to test-http-bad-server.t

This makes the test pass in Python 2.6. It's all one of two problems:

1)
  abort: error: '' (2.7)
  vs
  abort: error: (2.6)

2) 65537 (2.7) vs -1 (2.6)

With some...unfortunate escaping required due to how regular
expressions work. Sigh.
This commit is contained in:
Augie Fackler 2017-04-24 14:38:30 -04:00
parent b91fff0fe0
commit 88ed369fdf

View File

@ -71,13 +71,13 @@ Failure to read all bytes in initial HTTP request should yield connection relate
TODO this error message is not very good
$ hg clone http://localhost:$HGPORT/ clone
abort: error: ''
abort: error: (''|) (re)
[255]
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(1 from 65537) -> (1) G
readline\(1 from (-1|65537)\) -> \(1\) G (re)
read limit reached; closing socket
$ rm -f error.log
@ -87,13 +87,13 @@ Same failure, but server reads full HTTP request line
$ hg --config badserver.closeafterrecvbytes=40 serve -p $HGPORT -d --pid-file=hg.pid -E error.log
$ cat hg.pid > $DAEMON_PIDS
$ hg clone http://localhost:$HGPORT/ clone
abort: error: ''
abort: error: (''|) (re)
[255]
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(40 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\(40 from (-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(7 from -1) -> (7) Accept-
read limit reached; closing socket
@ -104,13 +104,13 @@ Failure on subsequent HTTP request on the same socket (cmd?batch)
$ hg --config badserver.closeafterrecvbytes=210 serve -p $HGPORT -d --pid-file=hg.pid -E error.log
$ cat hg.pid > $DAEMON_PIDS
$ hg clone http://localhost:$HGPORT/ clone
abort: error: ''
abort: error: (''|) (re)
[255]
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(210 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\(210 from (-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(177 from -1) -> (27) Accept-Encoding: identity\r\n
readline(150 from -1) -> (35) accept: application/mercurial-0.1\r\n
readline(115 from -1) -> (23) host: localhost:$HGPORT\r\n
@ -123,10 +123,10 @@ Failure on subsequent HTTP request on the same socket (cmd?batch)
write(21) -> Content-Length: 405\r\n
write(2) -> \r\n
write(405) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
readline(41 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
readline\(41 from (-1|65537)\) -> \(26\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(15 from -1) -> (15) Accept-Encoding
read limit reached; closing socket
readline(210 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
readline\(210 from (-1|65537)\) -> \(26\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(184 from -1) -> (27) Accept-Encoding: identity\r\n
readline(157 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(128 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
@ -143,13 +143,13 @@ Failure to read getbundle HTTP request
$ cat hg.pid > $DAEMON_PIDS
$ hg clone http://localhost:$HGPORT/ clone
requesting all changes
abort: error: ''
abort: error: (''|) (re)
[255]
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(292 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\(292 from (-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(259 from -1) -> (27) Accept-Encoding: identity\r\n
readline(232 from -1) -> (35) accept: application/mercurial-0.1\r\n
readline(197 from -1) -> (23) host: localhost:$HGPORT\r\n
@ -162,12 +162,12 @@ Failure to read getbundle HTTP request
write(21) -> Content-Length: 405\r\n
write(2) -> \r\n
write(405) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
readline(123 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
readline\(123 from (-1|65537)\) -> \(26\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(97 from -1) -> (27) Accept-Encoding: identity\r\n
readline(70 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(41 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
read limit reached; closing socket
readline(292 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
readline\(292 from (-1|65537)\) -> \(26\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(266 from -1) -> (27) Accept-Encoding: identity\r\n
readline(239 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(210 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
@ -183,9 +183,9 @@ Failure to read getbundle HTTP request
write(20) -> Content-Length: 42\r\n
write(2) -> \r\n
write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n;
readline(12 from 65537) -> (12) GET /?cmd=ge
readline\(12 from (-1|65537)\) -> \(12\) GET /\?cmd=ge (re)
read limit reached; closing socket
readline(292 from 65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
readline\(292 from (-1|65537)\) -> \(30\) GET /\?cmd=getbundle HTTP/1.1\\r\\n (re)
readline(262 from -1) -> (27) Accept-Encoding: identity\r\n
readline(235 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(206 from -1) -> (206) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Ali
@ -199,13 +199,13 @@ Now do a variation using POST to send arguments
$ cat hg.pid > $DAEMON_PIDS
$ hg clone http://localhost:$HGPORT/ clone
abort: error: ''
abort: error: (''|) (re)
[255]
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(315 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\(315 from (-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(282 from -1) -> (27) Accept-Encoding: identity\r\n
readline(255 from -1) -> (35) accept: application/mercurial-0.1\r\n
readline(220 from -1) -> (23) host: localhost:$HGPORT\r\n
@ -218,14 +218,14 @@ Now do a variation using POST to send arguments
write(21) -> Content-Length: 418\r\n
write(2) -> \r\n
write(418) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httppostargs httpmediatype=0.1rx,0.1tx,0.2tx compression=none
readline(146 from 65537) -> (27) POST /?cmd=batch HTTP/1.1\r\n
readline\(146 from (-1|65537)\) -> \(27\) POST /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(119 from -1) -> (27) Accept-Encoding: identity\r\n
readline(92 from -1) -> (41) content-type: application/mercurial-0.1\r\n
readline(51 from -1) -> (19) vary: X-HgProto-1\r\n
readline(32 from -1) -> (19) x-hgargs-post: 28\r\n
readline(13 from -1) -> (13) x-hgproto-1:
read limit reached; closing socket
readline(315 from 65537) -> (27) POST /?cmd=batch HTTP/1.1\r\n
readline\(315 from (-1|65537)\) -> \(27\) POST /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(288 from -1) -> (27) Accept-Encoding: identity\r\n
readline(261 from -1) -> (41) content-type: application/mercurial-0.1\r\n
readline(220 from -1) -> (19) vary: X-HgProto-1\r\n
@ -256,7 +256,7 @@ Server sends a single character from the HTTP response line
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\((-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (35) accept: application/mercurial-0.1\r\n
readline(-1) -> (23) host: localhost:$HGPORT\r\n
@ -281,7 +281,7 @@ Server sends an incomplete capabilities response body
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\((-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (35) accept: application/mercurial-0.1\r\n
readline(-1) -> (23) host: localhost:$HGPORT\r\n
@ -316,7 +316,7 @@ TODO this output is horrible
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\((-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (35) accept: application/mercurial-0.1\r\n
readline(-1) -> (23) host: localhost:$HGPORT\r\n
@ -329,7 +329,7 @@ TODO this output is horrible
write(21 from 21) -> (537) Content-Length: 405\r\n
write(2 from 2) -> (535) \r\n
write(405 from 405) -> (130) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
readline\((-1|65537)\) -> \(26\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
@ -359,7 +359,7 @@ TODO client spews a stack due to uncaught ValueError in batch.results()
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\((-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (35) accept: application/mercurial-0.1\r\n
readline(-1) -> (23) host: localhost:$HGPORT\r\n
@ -372,7 +372,7 @@ TODO client spews a stack due to uncaught ValueError in batch.results()
write(21 from 21) -> (602) Content-Length: 405\r\n
write(2 from 2) -> (600) \r\n
write(405 from 405) -> (195) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
readline\((-1|65537)\) -> \(26\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
@ -411,7 +411,7 @@ TODO this output is terrible
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\((-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (35) accept: application/mercurial-0.1\r\n
readline(-1) -> (23) host: localhost:$HGPORT\r\n
@ -424,7 +424,7 @@ TODO this output is terrible
write(21 from 21) -> (737) Content-Length: 405\r\n
write(2 from 2) -> (735) \r\n
write(405 from 405) -> (330) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
readline\((-1|65537)\) -> \(26\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
@ -440,7 +440,7 @@ TODO this output is terrible
write(20 from 20) -> (173) Content-Length: 42\r\n
write(2 from 2) -> (171) \r\n
write(42 from 42) -> (129) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n;
readline(65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
readline\((-1|65537)\) -> \(30\) GET /\?cmd=getbundle HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(-1) -> (396) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n
@ -472,7 +472,7 @@ Server sends empty HTTP body for getbundle
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\((-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (35) accept: application/mercurial-0.1\r\n
readline(-1) -> (23) host: localhost:$HGPORT\r\n
@ -485,7 +485,7 @@ Server sends empty HTTP body for getbundle
write(21 from 21) -> (775) Content-Length: 405\r\n
write(2 from 2) -> (773) \r\n
write(405 from 405) -> (368) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
readline\((-1|65537)\) -> \(26\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
@ -501,7 +501,7 @@ Server sends empty HTTP body for getbundle
write(20 from 20) -> (211) Content-Length: 42\r\n
write(2 from 2) -> (209) \r\n
write(42 from 42) -> (167) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n;
readline(65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
readline\((-1|65537)\) -> \(30\) GET /\?cmd=getbundle HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(-1) -> (396) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n
@ -535,7 +535,7 @@ Server sends partial compression string
$ killdaemons.py $DAEMON_PIDS
$ cat error.log
readline(65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n
readline\((-1|65537)\) -> \(33\) GET /\?cmd=capabilities HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (35) accept: application/mercurial-0.1\r\n
readline(-1) -> (23) host: localhost:$HGPORT\r\n
@ -548,7 +548,7 @@ Server sends partial compression string
write(21 from 21) -> (787) Content-Length: 405\r\n
write(2 from 2) -> (785) \r\n
write(405 from 405) -> (380) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none
readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n
readline\((-1|65537)\) -> \(26\) GET /\?cmd=batch HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(-1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n
@ -564,7 +564,7 @@ Server sends partial compression string
write(20 from 20) -> (223) Content-Length: 42\r\n
write(2 from 2) -> (221) \r\n
write(42 from 42) -> (179) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n;
readline(65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n
readline\((-1|65537)\) -> \(30\) GET /\?cmd=getbundle HTTP/1.1\\r\\n (re)
readline(-1) -> (27) Accept-Encoding: identity\r\n
readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n
readline(-1) -> (396) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n