This specific test case is now using the new "close when a pattern is seen"
approach compared to the more fragile "that many bytes were sent" approach.
Since such change are still a bit noisy, we split each change in there own
changesets.
Alphare |
hg-reviewers |
This specific test case is now using the new "close when a pattern is seen"
approach compared to the more fragile "that many bytes were sent" approach.
Since such change are still a bit noisy, we split each change in there own
changesets.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | tests/test-http-bad-server.t (54 lines) |
Exception: connection closed after sending N bytes | Exception: connection closed after sending N bytes | ||||
$ rm -f error.log | $ rm -f error.log | ||||
Server sends incomplete headers for getbundle response | Server sends incomplete headers for getbundle response | ||||
------------------------------------------------------ | ------------------------------------------------------ | ||||
$ hg serve --config badserver.close-after-send-bytes=921 -p $HGPORT -d --pid-file=hg.pid -E error.log | $ hg serve \ | ||||
> --config badserver.close-after-send-patterns='(.*Content-Type: application/mercuri){3}' \ | |||||
> -p $HGPORT -d --pid-file=hg.pid -E error.log | |||||
$ cat hg.pid > $DAEMON_PIDS | $ cat hg.pid > $DAEMON_PIDS | ||||
TODO this output is terrible | TODO this output is terrible | ||||
$ hg clone http://localhost:$HGPORT/ clone | $ hg clone http://localhost:$HGPORT/ clone | ||||
requesting all changes | requesting all changes | ||||
abort: 'http://localhost:$HGPORT/' does not appear to be an hg repository: | abort: 'http://localhost:$HGPORT/' does not appear to be an hg repository: | ||||
---%<--- (application/mercuri) | ---%<--- (application/mercuri) | ||||
---%<--- | ---%<--- | ||||
[255] | [255] | ||||
$ killdaemons.py $DAEMON_PIDS | $ killdaemons.py $DAEMON_PIDS | ||||
$ cat error.log | "$PYTHON" $TESTDIR/filtertraceback.py | $ cat error.log | "$PYTHON" $TESTDIR/filtertraceback.py | ||||
readline(~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n | readline(~) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n | ||||
readline(*) -> (27) Accept-Encoding: identity\r\n (glob) | readline(*) -> (27) Accept-Encoding: identity\r\n (glob) | ||||
readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) | readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) | ||||
readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) | readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) | ||||
readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) | readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) | ||||
readline(*) -> (2) \r\n (glob) | readline(*) -> (2) \r\n (glob) | ||||
sendall(160 from 160) -> (761) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) | sendall(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py36 !) | ||||
sendall(431 from 431) -> (330) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) | sendall(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py36 !) | ||||
write(160 from 160) -> (780) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) | write(160) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 431\r\n\r\n (py3 no-py36 !) | ||||
write(431 from 431) -> (330) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) | write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (py3 no-py36 !) | ||||
write(36 from 36) -> (885) HTTP/1.1 200 Script output follows\r\n (no-py3 !) | write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) | ||||
write(23 from 23) -> (862) Server: badhttpserver\r\n (no-py3 !) | write(23) -> Server: badhttpserver\r\n (no-py3 !) | ||||
write(37 from 37) -> (825) Date: $HTTP_DATE$\r\n (no-py3 !) | write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) | ||||
write(41 from 41) -> (784) Content-Type: application/mercurial-0.1\r\n (no-py3 !) | write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) | ||||
write(21 from 21) -> (763) Content-Length: 431\r\n (no-py3 !) | write(21) -> Content-Length: 431\r\n (no-py3 !) | ||||
write(2 from 2) -> (761) \r\n (no-py3 !) | write(2) -> \r\n (no-py3 !) | ||||
write(431 from 431) -> (330) batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) | write(431) -> batch branchmap $USUAL_BUNDLE2_CAPS_NO_PHASES$ changegroupsubset compression=none getbundle httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash (no-py3 !) | ||||
readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n | readline(~) -> (26) GET /?cmd=batch HTTP/1.1\r\n | ||||
readline(*) -> (27) Accept-Encoding: identity\r\n (glob) | readline(*) -> (27) Accept-Encoding: identity\r\n (glob) | ||||
readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) | readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) | ||||
readline(*) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) | readline(*) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) | ||||
readline(*) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) | readline(*) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) | ||||
readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) | readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) | ||||
readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) | readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) | ||||
readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) | readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) | ||||
readline(*) -> (2) \r\n (glob) | readline(*) -> (2) \r\n (glob) | ||||
sendall(159 from 159) -> (171) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 42\r\n\r\n (py36 !) | sendall(159) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 42\r\n\r\n (py36 !) | ||||
sendall(42 from 42) -> (129) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (py36 !) | sendall(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (py36 !) | ||||
write(159 from 159) -> (171) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 42\r\n\r\n (py3 no-py36 !) | write(159) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.1\r\nContent-Length: 42\r\n\r\n (py3 no-py36 !) | ||||
write(42 from 42) -> (129) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (py3 no-py36 !) | write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (py3 no-py36 !) | ||||
write(36 from 36) -> (294) HTTP/1.1 200 Script output follows\r\n (no-py3 !) | write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) | ||||
write(23 from 23) -> (271) Server: badhttpserver\r\n (no-py3 !) | write(23) -> Server: badhttpserver\r\n (no-py3 !) | ||||
write(37 from 37) -> (234) Date: $HTTP_DATE$\r\n (no-py3 !) | write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) | ||||
write(41 from 41) -> (193) Content-Type: application/mercurial-0.1\r\n (no-py3 !) | write(41) -> Content-Type: application/mercurial-0.1\r\n (no-py3 !) | ||||
write(20 from 20) -> (173) Content-Length: 42\r\n (no-py3 !) | write(20) -> Content-Length: 42\r\n (no-py3 !) | ||||
write(2 from 2) -> (171) \r\n (no-py3 !) | write(2) -> \r\n (no-py3 !) | ||||
write(42 from 42) -> (129) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (no-py3 !) | write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; (no-py3 !) | ||||
readline(~) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n | readline(~) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n | ||||
readline(*) -> (27) Accept-Encoding: identity\r\n (glob) | readline(*) -> (27) Accept-Encoding: identity\r\n (glob) | ||||
readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) | readline(*) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) | ||||
readline(*) -> (440) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n (glob) | readline(*) -> (440) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n (glob) | ||||
readline(*) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) | readline(*) -> (61) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull\r\n (glob) | ||||
readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) | readline(*) -> (35) accept: application/mercurial-0.1\r\n (glob) | ||||
readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) | readline(*) -> (2?) host: localhost:$HGPORT\r\n (glob) | ||||
readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) | readline(*) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) | ||||
readline(*) -> (2) \r\n (glob) | readline(*) -> (2) \r\n (glob) | ||||
sendall(129 from 167) -> (0) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercuri (py36 !) | sendall(129 from 167) -> (0) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercuri (py36 !) | ||||
write(129 from 167) -> (0) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercuri (py3 no-py36 !) | write(129 from 167) -> (0) HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercuri (py3 no-py36 !) | ||||
write(36 from 36) -> (93) HTTP/1.1 200 Script output follows\r\n (no-py3 !) | write(36) -> HTTP/1.1 200 Script output follows\r\n (no-py3 !) | ||||
write(23 from 23) -> (70) Server: badhttpserver\r\n (no-py3 !) | write(23) -> Server: badhttpserver\r\n (no-py3 !) | ||||
write(37 from 37) -> (33) Date: $HTTP_DATE$\r\n (no-py3 !) | write(37) -> Date: $HTTP_DATE$\r\n (no-py3 !) | ||||
write(33 from 41) -> (0) Content-Type: application/mercuri (no-py3 !) | write(33 from 41) -> (0) Content-Type: application/mercuri (no-py3 !) | ||||
write limit reached; closing socket | write limit reached; closing socket | ||||
$LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=getbundle': (glob) | ||||
Traceback (most recent call last): | Traceback (most recent call last): | ||||
Exception: connection closed after sending N bytes | Exception: connection closed after sending N bytes | ||||
write(293) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\nHTTP/1.1 500 Internal Server Error\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nTransfer-Encoding: chunked\r\n\r\n (py3 no-py36 !) | write(293) -> HTTP/1.1 200 Script output follows\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nContent-Type: application/mercurial-0.2\r\nTransfer-Encoding: chunked\r\n\r\nHTTP/1.1 500 Internal Server Error\r\nServer: badhttpserver\r\nDate: $HTTP_DATE$\r\nTransfer-Encoding: chunked\r\n\r\n (py3 no-py36 !) | ||||