##// END OF EJS Templates
httppeer: use util.readexactly() to abort on incomplete responses...
av6 -
r39520:98995b68 default
parent child Browse files
Show More
@@ -401,8 +401,8 b' def parsev1commandresponse(ui, baseurl, '
401 elif version_info == (0, 2):
401 elif version_info == (0, 2):
402 # application/mercurial-0.2 always identifies the compression
402 # application/mercurial-0.2 always identifies the compression
403 # engine in the payload header.
403 # engine in the payload header.
404 elen = struct.unpack('B', resp.read(1))[0]
404 elen = struct.unpack('B', util.readexactly(resp, 1))[0]
405 ename = resp.read(elen)
405 ename = util.readexactly(resp, elen)
406 engine = util.compengines.forwiretype(ename)
406 engine = util.compengines.forwiretype(ename)
407
407
408 resp = engine.decompressorreader(resp)
408 resp = engine.decompressorreader(resp)
@@ -464,6 +464,26 b' TODO this output is terrible'
464
464
465 $ rm -f error.log
465 $ rm -f error.log
466
466
467 Server stops before it sends transfer encoding
468
469 $ hg serve --config badserver.closeaftersendbytes=959 -p $HGPORT -d --pid-file=hg.pid -E error.log
470 $ cat hg.pid > $DAEMON_PIDS
471
472 $ hg clone http://localhost:$HGPORT/ clone
473 requesting all changes
474 abort: stream ended unexpectedly (got 0 bytes, expected 1)
475 [255]
476
477 $ killdaemons.py $DAEMON_PIDS
478
479 $ tail -4 error.log
480 write(41 from 41) -> (25) Content-Type: application/mercurial-0.2\r\n
481 write(25 from 28) -> (0) Transfer-Encoding: chunke
482 write limit reached; closing socket
483 write(36) -> HTTP/1.1 500 Internal Server Error\r\n
484
485 $ rm -f error.log
486
467 Server sends empty HTTP body for getbundle
487 Server sends empty HTTP body for getbundle
468
488
469 $ hg serve --config badserver.closeaftersendbytes=964 -p $HGPORT -d --pid-file=hg.pid -E error.log
489 $ hg serve --config badserver.closeaftersendbytes=964 -p $HGPORT -d --pid-file=hg.pid -E error.log
General Comments 0
You need to be logged in to leave comments. Login now