comparison tests/test-http-bad-server.t @ 39483:1fc39367eafd

httppeer: calculate total expected bytes correctly User-facing error messages that handled httplib.IncompleteRead errors in Mercurial used to look like this: abort: HTTP request error (incomplete response; expected 3 bytes got 1) But the errors that are being handled underneath the UI look like this: IncompleteRead(1 bytes read, 3 more expected) I.e. the error actually counts total number of expected bytes minus bytes already received. Before, users could see weird messages like "expected 10 bytes got 10", while in reality httplib expected 10 _more_ bytes (20 in total).
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 08 Sep 2018 23:57:07 +0800
parents 88be288e8ac1
children 98995b689e03
comparison
equal deleted inserted replaced
39482:77a2f6d805f2 39483:1fc39367eafd
273 273
274 $ hg serve --config badserver.closeaftersendbytes=180 -p $HGPORT -d --pid-file=hg.pid -E error.log 274 $ hg serve --config badserver.closeaftersendbytes=180 -p $HGPORT -d --pid-file=hg.pid -E error.log
275 $ cat hg.pid > $DAEMON_PIDS 275 $ cat hg.pid > $DAEMON_PIDS
276 276
277 $ hg clone http://localhost:$HGPORT/ clone 277 $ hg clone http://localhost:$HGPORT/ clone
278 abort: HTTP request error (incomplete response; expected 416 bytes got 20) 278 abort: HTTP request error (incomplete response; expected 436 bytes got 20)
279 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) 279 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
280 [255] 280 [255]
281 281
282 $ killdaemons.py $DAEMON_PIDS 282 $ killdaemons.py $DAEMON_PIDS
283 283
598 $ hg serve --config badserver.closeaftersendbytes=985 -p $HGPORT -d --pid-file=hg.pid -E error.log 598 $ hg serve --config badserver.closeaftersendbytes=985 -p $HGPORT -d --pid-file=hg.pid -E error.log
599 $ cat hg.pid > $DAEMON_PIDS 599 $ cat hg.pid > $DAEMON_PIDS
600 600
601 $ hg clone http://localhost:$HGPORT/ clone 601 $ hg clone http://localhost:$HGPORT/ clone
602 requesting all changes 602 requesting all changes
603 abort: HTTP request error (incomplete response; expected 1 bytes got 3) 603 abort: HTTP request error (incomplete response; expected 4 bytes got 3)
604 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) 604 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
605 [255] 605 [255]
606 606
607 $ killdaemons.py $DAEMON_PIDS 607 $ killdaemons.py $DAEMON_PIDS
608 608
622 $ hg serve --config badserver.closeaftersendbytes=994 -p $HGPORT -d --pid-file=hg.pid -E error.log 622 $ hg serve --config badserver.closeaftersendbytes=994 -p $HGPORT -d --pid-file=hg.pid -E error.log
623 $ cat hg.pid > $DAEMON_PIDS 623 $ cat hg.pid > $DAEMON_PIDS
624 624
625 $ hg clone http://localhost:$HGPORT/ clone 625 $ hg clone http://localhost:$HGPORT/ clone
626 requesting all changes 626 requesting all changes
627 abort: HTTP request error (incomplete response; expected 1 bytes got 3) 627 abort: HTTP request error (incomplete response; expected 4 bytes got 3)
628 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) 628 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
629 [255] 629 [255]
630 630
631 $ killdaemons.py $DAEMON_PIDS 631 $ killdaemons.py $DAEMON_PIDS
632 632
731 $ hg clone http://localhost:$HGPORT/ clone 731 $ hg clone http://localhost:$HGPORT/ clone
732 requesting all changes 732 requesting all changes
733 adding changesets 733 adding changesets
734 transaction abort! 734 transaction abort!
735 rollback completed 735 rollback completed
736 abort: HTTP request error (incomplete response; expected 459 bytes got 7) 736 abort: HTTP request error (incomplete response; expected 466 bytes got 7)
737 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) 737 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
738 [255] 738 [255]
739 739
740 $ killdaemons.py $DAEMON_PIDS 740 $ killdaemons.py $DAEMON_PIDS
741 741
797 adding manifests 797 adding manifests
798 adding file changes 798 adding file changes
799 added 1 changesets with 1 changes to 1 files 799 added 1 changesets with 1 changes to 1 files
800 transaction abort! 800 transaction abort!
801 rollback completed 801 rollback completed
802 abort: HTTP request error (incomplete response; expected 23 bytes got 9) 802 abort: HTTP request error (incomplete response; expected 32 bytes got 9)
803 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) 803 (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
804 [255] 804 [255]
805 805
806 $ killdaemons.py $DAEMON_PIDS 806 $ killdaemons.py $DAEMON_PIDS
807 807