tests/test-http-bad-server.t
changeset 48606 ee1235afda4b
parent 48605 089cb4d6af5a
child 48607 89485747b8f7
equal deleted inserted replaced
48605:089cb4d6af5a 48606:ee1235afda4b
    35   > compressionengines = none
    35   > compressionengines = none
    36   > EOF
    36   > EOF
    37 
    37 
    38 Failure to accept() socket should result in connection related error message
    38 Failure to accept() socket should result in connection related error message
    39 
    39 
    40   $ hg serve --config badserver.closebeforeaccept=true -p $HGPORT -d --pid-file=hg.pid
    40   $ hg serve --config badserver.close-before-accept=true -p $HGPORT -d --pid-file=hg.pid
    41   $ cat hg.pid > $DAEMON_PIDS
    41   $ cat hg.pid > $DAEMON_PIDS
    42 
    42 
    43   $ hg clone http://localhost:$HGPORT/ clone
    43   $ hg clone http://localhost:$HGPORT/ clone
    44   abort: error: (\$ECONNRESET\$|\$EADDRNOTAVAIL\$) (re)
    44   abort: error: (\$ECONNRESET\$|\$EADDRNOTAVAIL\$) (re)
    45   [100]
    45   [100]
    49 
    49 
    50   $ killdaemons.py $DAEMON_PIDS
    50   $ killdaemons.py $DAEMON_PIDS
    51 
    51 
    52 Failure immediately after accept() should yield connection related error message
    52 Failure immediately after accept() should yield connection related error message
    53 
    53 
    54   $ hg serve --config badserver.closeafteraccept=true -p $HGPORT -d --pid-file=hg.pid
    54   $ hg serve --config badserver.close-after-accept=true -p $HGPORT -d --pid-file=hg.pid
    55   $ cat hg.pid > $DAEMON_PIDS
    55   $ cat hg.pid > $DAEMON_PIDS
    56 
    56 
    57 TODO: this usually outputs good results, but sometimes emits abort:
    57 TODO: this usually outputs good results, but sometimes emits abort:
    58 error: '' on FreeBSD and OS X.
    58 error: '' on FreeBSD and OS X.
    59 What we ideally want are:
    59 What we ideally want are:
    68 
    68 
    69   $ killdaemons.py $DAEMON_PIDS
    69   $ killdaemons.py $DAEMON_PIDS
    70 
    70 
    71 Failure to read all bytes in initial HTTP request should yield connection related error message
    71 Failure to read all bytes in initial HTTP request should yield connection related error message
    72 
    72 
    73   $ hg serve --config badserver.closeafterrecvbytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log
    73   $ hg serve --config badserver.close-after-recv-bytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log
    74   $ cat hg.pid > $DAEMON_PIDS
    74   $ cat hg.pid > $DAEMON_PIDS
    75 
    75 
    76   $ hg clone http://localhost:$HGPORT/ clone
    76   $ hg clone http://localhost:$HGPORT/ clone
    77   abort: error: bad HTTP status line: * (glob)
    77   abort: error: bad HTTP status line: * (glob)
    78   [100]
    78   [100]
    85 
    85 
    86   $ rm -f error.log
    86   $ rm -f error.log
    87 
    87 
    88 Same failure, but server reads full HTTP request line
    88 Same failure, but server reads full HTTP request line
    89 
    89 
    90   $ hg serve --config badserver.closeafterrecvbytes=40 -p $HGPORT -d --pid-file=hg.pid -E error.log
    90   $ hg serve --config badserver.close-after-recv-bytes=40 -p $HGPORT -d --pid-file=hg.pid -E error.log
    91   $ cat hg.pid > $DAEMON_PIDS
    91   $ cat hg.pid > $DAEMON_PIDS
    92   $ hg clone http://localhost:$HGPORT/ clone
    92   $ hg clone http://localhost:$HGPORT/ clone
    93   abort: error: bad HTTP status line: * (glob)
    93   abort: error: bad HTTP status line: * (glob)
    94   [100]
    94   [100]
    95 
    95 
   102 
   102 
   103   $ rm -f error.log
   103   $ rm -f error.log
   104 
   104 
   105 Failure on subsequent HTTP request on the same socket (cmd?batch)
   105 Failure on subsequent HTTP request on the same socket (cmd?batch)
   106 
   106 
   107   $ hg serve --config badserver.closeafterrecvbytes=210,223 -p $HGPORT -d --pid-file=hg.pid -E error.log
   107   $ hg serve --config badserver.close-after-recv-bytes=210,223 -p $HGPORT -d --pid-file=hg.pid -E error.log
   108   $ cat hg.pid > $DAEMON_PIDS
   108   $ cat hg.pid > $DAEMON_PIDS
   109   $ hg clone http://localhost:$HGPORT/ clone
   109   $ hg clone http://localhost:$HGPORT/ clone
   110   abort: error: bad HTTP status line: * (glob)
   110   abort: error: bad HTTP status line: * (glob)
   111   [100]
   111   [100]
   112 
   112 
   144 
   144 
   145   $ rm -f error.log
   145   $ rm -f error.log
   146 
   146 
   147 Failure to read getbundle HTTP request
   147 Failure to read getbundle HTTP request
   148 
   148 
   149   $ hg serve --config badserver.closeafterrecvbytes=308,317,304 -p $HGPORT -d --pid-file=hg.pid -E error.log
   149   $ hg serve --config badserver.close-after-recv-bytes=308,317,304 -p $HGPORT -d --pid-file=hg.pid -E error.log
   150   $ cat hg.pid > $DAEMON_PIDS
   150   $ cat hg.pid > $DAEMON_PIDS
   151   $ hg clone http://localhost:$HGPORT/ clone
   151   $ hg clone http://localhost:$HGPORT/ clone
   152   requesting all changes
   152   requesting all changes
   153   abort: error: bad HTTP status line: * (glob)
   153   abort: error: bad HTTP status line: * (glob)
   154   [100]
   154   [100]
   211 
   211 
   212   $ rm -f error.log
   212   $ rm -f error.log
   213 
   213 
   214 Now do a variation using POST to send arguments
   214 Now do a variation using POST to send arguments
   215 
   215 
   216   $ hg serve --config experimental.httppostargs=true --config badserver.closeafterrecvbytes=329,344 -p $HGPORT -d --pid-file=hg.pid -E error.log
   216   $ hg serve --config experimental.httppostargs=true --config badserver.close-after-recv-bytes=329,344 -p $HGPORT -d --pid-file=hg.pid -E error.log
   217   $ cat hg.pid > $DAEMON_PIDS
   217   $ cat hg.pid > $DAEMON_PIDS
   218 
   218 
   219   $ hg clone http://localhost:$HGPORT/ clone
   219   $ hg clone http://localhost:$HGPORT/ clone
   220   abort: error: bad HTTP status line: * (glob)
   220   abort: error: bad HTTP status line: * (glob)
   221   [100]
   221   [100]
   271 
   271 
   272 Now move on to partial server responses
   272 Now move on to partial server responses
   273 
   273 
   274 Server sends a single character from the HTTP response line
   274 Server sends a single character from the HTTP response line
   275 
   275 
   276   $ hg serve --config badserver.closeaftersendbytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log
   276   $ hg serve --config badserver.close-after-send-bytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log
   277   $ cat hg.pid > $DAEMON_PIDS
   277   $ cat hg.pid > $DAEMON_PIDS
   278 
   278 
   279   $ hg clone http://localhost:$HGPORT/ clone
   279   $ hg clone http://localhost:$HGPORT/ clone
   280   abort: error: bad HTTP status line: H
   280   abort: error: bad HTTP status line: H
   281   [100]
   281   [100]
   302 
   302 
   303   $ rm -f error.log
   303   $ rm -f error.log
   304 
   304 
   305 Server sends an incomplete capabilities response body
   305 Server sends an incomplete capabilities response body
   306 
   306 
   307   $ hg serve --config badserver.closeaftersendbytes=180 -p $HGPORT -d --pid-file=hg.pid -E error.log
   307   $ hg serve --config badserver.close-after-send-bytes=180 -p $HGPORT -d --pid-file=hg.pid -E error.log
   308   $ cat hg.pid > $DAEMON_PIDS
   308   $ cat hg.pid > $DAEMON_PIDS
   309 
   309 
   310   $ hg clone http://localhost:$HGPORT/ clone
   310   $ hg clone http://localhost:$HGPORT/ clone
   311   abort: HTTP request error (incomplete response; expected 431 bytes got 20)
   311   abort: HTTP request error (incomplete response; expected 431 bytes got 20)
   312   (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
   312   (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator)
   340 
   340 
   341   $ rm -f error.log
   341   $ rm -f error.log
   342 
   342 
   343 Server sends incomplete headers for batch request
   343 Server sends incomplete headers for batch request
   344 
   344 
   345   $ hg serve --config badserver.closeaftersendbytes=709 -p $HGPORT -d --pid-file=hg.pid -E error.log
   345   $ hg serve --config badserver.close-after-send-bytes=709 -p $HGPORT -d --pid-file=hg.pid -E error.log
   346   $ cat hg.pid > $DAEMON_PIDS
   346   $ cat hg.pid > $DAEMON_PIDS
   347 
   347 
   348 TODO this output is horrible
   348 TODO this output is horrible
   349 
   349 
   350   $ hg clone http://localhost:$HGPORT/ clone
   350   $ hg clone http://localhost:$HGPORT/ clone
   400 
   400 
   401   $ rm -f error.log
   401   $ rm -f error.log
   402 
   402 
   403 Server sends an incomplete HTTP response body to batch request
   403 Server sends an incomplete HTTP response body to batch request
   404 
   404 
   405   $ hg serve --config badserver.closeaftersendbytes=774 -p $HGPORT -d --pid-file=hg.pid -E error.log
   405   $ hg serve --config badserver.close-after-send-bytes=774 -p $HGPORT -d --pid-file=hg.pid -E error.log
   406   $ cat hg.pid > $DAEMON_PIDS
   406   $ cat hg.pid > $DAEMON_PIDS
   407 
   407 
   408 TODO client spews a stack due to uncaught ValueError in batch.results()
   408 TODO client spews a stack due to uncaught ValueError in batch.results()
   409 #if no-chg
   409 #if no-chg
   410   $ hg clone http://localhost:$HGPORT/ clone 2> /dev/null
   410   $ hg clone http://localhost:$HGPORT/ clone 2> /dev/null
   462 
   462 
   463   $ rm -f error.log
   463   $ rm -f error.log
   464 
   464 
   465 Server sends incomplete headers for getbundle response
   465 Server sends incomplete headers for getbundle response
   466 
   466 
   467   $ hg serve --config badserver.closeaftersendbytes=921 -p $HGPORT -d --pid-file=hg.pid -E error.log
   467   $ hg serve --config badserver.close-after-send-bytes=921 -p $HGPORT -d --pid-file=hg.pid -E error.log
   468   $ cat hg.pid > $DAEMON_PIDS
   468   $ cat hg.pid > $DAEMON_PIDS
   469 
   469 
   470 TODO this output is terrible
   470 TODO this output is terrible
   471 
   471 
   472   $ hg clone http://localhost:$HGPORT/ clone
   472   $ hg clone http://localhost:$HGPORT/ clone
   543 
   543 
   544   $ rm -f error.log
   544   $ rm -f error.log
   545 
   545 
   546 Server stops before it sends transfer encoding
   546 Server stops before it sends transfer encoding
   547 
   547 
   548   $ hg serve --config badserver.closeaftersendbytes=954 -p $HGPORT -d --pid-file=hg.pid -E error.log
   548   $ hg serve --config badserver.close-after-send-bytes=954 -p $HGPORT -d --pid-file=hg.pid -E error.log
   549   $ cat hg.pid > $DAEMON_PIDS
   549   $ cat hg.pid > $DAEMON_PIDS
   550 
   550 
   551   $ hg clone http://localhost:$HGPORT/ clone
   551   $ hg clone http://localhost:$HGPORT/ clone
   552   requesting all changes
   552   requesting all changes
   553   abort: stream ended unexpectedly (got 0 bytes, expected 1)
   553   abort: stream ended unexpectedly (got 0 bytes, expected 1)
   572 
   572 
   573   $ rm -f error.log
   573   $ rm -f error.log
   574 
   574 
   575 Server sends empty HTTP body for getbundle
   575 Server sends empty HTTP body for getbundle
   576 
   576 
   577   $ hg serve --config badserver.closeaftersendbytes=959 -p $HGPORT -d --pid-file=hg.pid -E error.log
   577   $ hg serve --config badserver.close-after-send-bytes=959 -p $HGPORT -d --pid-file=hg.pid -E error.log
   578   $ cat hg.pid > $DAEMON_PIDS
   578   $ cat hg.pid > $DAEMON_PIDS
   579 
   579 
   580   $ hg clone http://localhost:$HGPORT/ clone
   580   $ hg clone http://localhost:$HGPORT/ clone
   581   requesting all changes
   581   requesting all changes
   582   abort: HTTP request error (incomplete response)
   582   abort: HTTP request error (incomplete response)
   650 
   650 
   651   $ rm -f error.log
   651   $ rm -f error.log
   652 
   652 
   653 Server sends partial compression string
   653 Server sends partial compression string
   654 
   654 
   655   $ hg serve --config badserver.closeaftersendbytes=983 -p $HGPORT -d --pid-file=hg.pid -E error.log
   655   $ hg serve --config badserver.close-after-send-bytes=983 -p $HGPORT -d --pid-file=hg.pid -E error.log
   656   $ cat hg.pid > $DAEMON_PIDS
   656   $ cat hg.pid > $DAEMON_PIDS
   657 
   657 
   658   $ hg clone http://localhost:$HGPORT/ clone
   658   $ hg clone http://localhost:$HGPORT/ clone
   659   requesting all changes
   659   requesting all changes
   660   abort: HTTP request error (incomplete response)
   660   abort: HTTP request error (incomplete response)
   732 
   732 
   733   $ rm -f error.log
   733   $ rm -f error.log
   734 
   734 
   735 Server sends partial bundle2 header magic
   735 Server sends partial bundle2 header magic
   736 
   736 
   737   $ hg serve --config badserver.closeaftersendbytes=980 -p $HGPORT -d --pid-file=hg.pid -E error.log
   737   $ hg serve --config badserver.close-after-send-bytes=980 -p $HGPORT -d --pid-file=hg.pid -E error.log
   738   $ cat hg.pid > $DAEMON_PIDS
   738   $ cat hg.pid > $DAEMON_PIDS
   739 
   739 
   740   $ hg clone http://localhost:$HGPORT/ clone
   740   $ hg clone http://localhost:$HGPORT/ clone
   741   requesting all changes
   741   requesting all changes
   742   abort: HTTP request error (incomplete response) (py3 !)
   742   abort: HTTP request error (incomplete response) (py3 !)
   777 
   777 
   778   $ rm -f error.log
   778   $ rm -f error.log
   779 
   779 
   780 Server sends incomplete bundle2 stream params length
   780 Server sends incomplete bundle2 stream params length
   781 
   781 
   782   $ hg serve --config badserver.closeaftersendbytes=989 -p $HGPORT -d --pid-file=hg.pid -E error.log
   782   $ hg serve --config badserver.close-after-send-bytes=989 -p $HGPORT -d --pid-file=hg.pid -E error.log
   783   $ cat hg.pid > $DAEMON_PIDS
   783   $ cat hg.pid > $DAEMON_PIDS
   784 
   784 
   785   $ hg clone http://localhost:$HGPORT/ clone
   785   $ hg clone http://localhost:$HGPORT/ clone
   786   requesting all changes
   786   requesting all changes
   787   abort: HTTP request error (incomplete response) (py3 !)
   787   abort: HTTP request error (incomplete response) (py3 !)
   824 
   824 
   825   $ rm -f error.log
   825   $ rm -f error.log
   826 
   826 
   827 Servers stops after bundle2 stream params header
   827 Servers stops after bundle2 stream params header
   828 
   828 
   829   $ hg serve --config badserver.closeaftersendbytes=992 -p $HGPORT -d --pid-file=hg.pid -E error.log
   829   $ hg serve --config badserver.close-after-send-bytes=992 -p $HGPORT -d --pid-file=hg.pid -E error.log
   830   $ cat hg.pid > $DAEMON_PIDS
   830   $ cat hg.pid > $DAEMON_PIDS
   831 
   831 
   832   $ hg clone http://localhost:$HGPORT/ clone
   832   $ hg clone http://localhost:$HGPORT/ clone
   833   requesting all changes
   833   requesting all changes
   834   abort: HTTP request error (incomplete response)
   834   abort: HTTP request error (incomplete response)
   870 
   870 
   871   $ rm -f error.log
   871   $ rm -f error.log
   872 
   872 
   873 Server stops sending after bundle2 part header length
   873 Server stops sending after bundle2 part header length
   874 
   874 
   875   $ hg serve --config badserver.closeaftersendbytes=1001 -p $HGPORT -d --pid-file=hg.pid -E error.log
   875   $ hg serve --config badserver.close-after-send-bytes=1001 -p $HGPORT -d --pid-file=hg.pid -E error.log
   876   $ cat hg.pid > $DAEMON_PIDS
   876   $ cat hg.pid > $DAEMON_PIDS
   877 
   877 
   878   $ hg clone http://localhost:$HGPORT/ clone
   878   $ hg clone http://localhost:$HGPORT/ clone
   879   requesting all changes
   879   requesting all changes
   880   abort: HTTP request error (incomplete response)
   880   abort: HTTP request error (incomplete response)
   919 
   919 
   920   $ rm -f error.log
   920   $ rm -f error.log
   921 
   921 
   922 Server stops sending after bundle2 part header
   922 Server stops sending after bundle2 part header
   923 
   923 
   924   $ hg serve --config badserver.closeaftersendbytes=1048 -p $HGPORT -d --pid-file=hg.pid -E error.log
   924   $ hg serve --config badserver.close-after-send-bytes=1048 -p $HGPORT -d --pid-file=hg.pid -E error.log
   925   $ cat hg.pid > $DAEMON_PIDS
   925   $ cat hg.pid > $DAEMON_PIDS
   926 
   926 
   927   $ hg clone http://localhost:$HGPORT/ clone
   927   $ hg clone http://localhost:$HGPORT/ clone
   928   requesting all changes
   928   requesting all changes
   929   adding changesets
   929   adding changesets
   972 
   972 
   973   $ rm -f error.log
   973   $ rm -f error.log
   974 
   974 
   975 Server stops after bundle2 part payload chunk size
   975 Server stops after bundle2 part payload chunk size
   976 
   976 
   977   $ hg serve --config badserver.closeaftersendbytes=1069 -p $HGPORT -d --pid-file=hg.pid -E error.log
   977   $ hg serve --config badserver.close-after-send-bytes=1069 -p $HGPORT -d --pid-file=hg.pid -E error.log
   978   $ cat hg.pid > $DAEMON_PIDS
   978   $ cat hg.pid > $DAEMON_PIDS
   979 
   979 
   980   $ hg clone http://localhost:$HGPORT/ clone
   980   $ hg clone http://localhost:$HGPORT/ clone
   981   requesting all changes
   981   requesting all changes
   982   adding changesets
   982   adding changesets
  1028 
  1028 
  1029   $ rm -f error.log
  1029   $ rm -f error.log
  1030 
  1030 
  1031 Server stops sending in middle of bundle2 payload chunk
  1031 Server stops sending in middle of bundle2 payload chunk
  1032 
  1032 
  1033   $ hg serve --config badserver.closeaftersendbytes=1530 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1033   $ hg serve --config badserver.close-after-send-bytes=1530 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1034   $ cat hg.pid > $DAEMON_PIDS
  1034   $ cat hg.pid > $DAEMON_PIDS
  1035 
  1035 
  1036   $ hg clone http://localhost:$HGPORT/ clone
  1036   $ hg clone http://localhost:$HGPORT/ clone
  1037   requesting all changes
  1037   requesting all changes
  1038   adding changesets
  1038   adding changesets
  1085 
  1085 
  1086   $ rm -f error.log
  1086   $ rm -f error.log
  1087 
  1087 
  1088 Server stops sending after 0 length payload chunk size
  1088 Server stops sending after 0 length payload chunk size
  1089 
  1089 
  1090   $ hg serve --config badserver.closeaftersendbytes=1561 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1090   $ hg serve --config badserver.close-after-send-bytes=1561 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1091   $ cat hg.pid > $DAEMON_PIDS
  1091   $ cat hg.pid > $DAEMON_PIDS
  1092 
  1092 
  1093   $ hg clone http://localhost:$HGPORT/ clone
  1093   $ hg clone http://localhost:$HGPORT/ clone
  1094   requesting all changes
  1094   requesting all changes
  1095   adding changesets
  1095   adding changesets
  1147   $ rm -f error.log
  1147   $ rm -f error.log
  1148 
  1148 
  1149 Server stops sending after 0 part bundle part header (indicating end of bundle2 payload)
  1149 Server stops sending after 0 part bundle part header (indicating end of bundle2 payload)
  1150 This is before the 0 size chunked transfer part that signals end of HTTP response.
  1150 This is before the 0 size chunked transfer part that signals end of HTTP response.
  1151 
  1151 
  1152   $ hg serve --config badserver.closeaftersendbytes=1736 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1152   $ hg serve --config badserver.close-after-send-bytes=1736 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1153   $ cat hg.pid > $DAEMON_PIDS
  1153   $ cat hg.pid > $DAEMON_PIDS
  1154 
  1154 
  1155   $ hg clone http://localhost:$HGPORT/ clone
  1155   $ hg clone http://localhost:$HGPORT/ clone
  1156   requesting all changes
  1156   requesting all changes
  1157   adding changesets
  1157   adding changesets
  1215   $ rm -f error.log
  1215   $ rm -f error.log
  1216   $ rm -rf clone
  1216   $ rm -rf clone
  1217 
  1217 
  1218 Server sends a size 0 chunked-transfer size without terminating \r\n
  1218 Server sends a size 0 chunked-transfer size without terminating \r\n
  1219 
  1219 
  1220   $ hg serve --config badserver.closeaftersendbytes=1739 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1220   $ hg serve --config badserver.close-after-send-bytes=1739 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1221   $ cat hg.pid > $DAEMON_PIDS
  1221   $ cat hg.pid > $DAEMON_PIDS
  1222 
  1222 
  1223   $ hg clone http://localhost:$HGPORT/ clone
  1223   $ hg clone http://localhost:$HGPORT/ clone
  1224   requesting all changes
  1224   requesting all changes
  1225   adding changesets
  1225   adding changesets