tests/test-http-bad-server.t
changeset 48607 89485747b8f7
parent 48606 ee1235afda4b
child 48608 f87b632406a9
equal deleted inserted replaced
48606:ee1235afda4b 48607:89485747b8f7
    34   > [server]
    34   > [server]
    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 
    40   $ hg serve --config badserver.close-before-accept=true -p $HGPORT -d --pid-file=hg.pid
    41   $ hg serve --config badserver.close-before-accept=true -p $HGPORT -d --pid-file=hg.pid
    41   $ cat hg.pid > $DAEMON_PIDS
    42   $ cat hg.pid > $DAEMON_PIDS
    42 
    43 
    43   $ hg clone http://localhost:$HGPORT/ clone
    44   $ hg clone http://localhost:$HGPORT/ clone
    48 So ensure the process is dead.)
    49 So ensure the process is dead.)
    49 
    50 
    50   $ killdaemons.py $DAEMON_PIDS
    51   $ killdaemons.py $DAEMON_PIDS
    51 
    52 
    52 Failure immediately after accept() should yield connection related error message
    53 Failure immediately after accept() should yield connection related error message
       
    54 --------------------------------------------------------------------------------
    53 
    55 
    54   $ hg serve --config badserver.close-after-accept=true -p $HGPORT -d --pid-file=hg.pid
    56   $ hg serve --config badserver.close-after-accept=true -p $HGPORT -d --pid-file=hg.pid
    55   $ cat hg.pid > $DAEMON_PIDS
    57   $ cat hg.pid > $DAEMON_PIDS
    56 
    58 
    57 TODO: this usually outputs good results, but sometimes emits abort:
    59 TODO: this usually outputs good results, but sometimes emits abort:
    67   [100]
    69   [100]
    68 
    70 
    69   $ killdaemons.py $DAEMON_PIDS
    71   $ killdaemons.py $DAEMON_PIDS
    70 
    72 
    71 Failure to read all bytes in initial HTTP request should yield connection related error message
    73 Failure to read all bytes in initial HTTP request should yield connection related error message
       
    74 -----------------------------------------------------------------------------------------------
    72 
    75 
    73   $ hg serve --config badserver.close-after-recv-bytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log
    76   $ 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
    77   $ cat hg.pid > $DAEMON_PIDS
    75 
    78 
    76   $ hg clone http://localhost:$HGPORT/ clone
    79   $ hg clone http://localhost:$HGPORT/ clone
    84   read limit reached; closing socket
    87   read limit reached; closing socket
    85 
    88 
    86   $ rm -f error.log
    89   $ rm -f error.log
    87 
    90 
    88 Same failure, but server reads full HTTP request line
    91 Same failure, but server reads full HTTP request line
       
    92 -----------------------------------------------------
    89 
    93 
    90   $ hg serve --config badserver.close-after-recv-bytes=40 -p $HGPORT -d --pid-file=hg.pid -E error.log
    94   $ 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
    95   $ cat hg.pid > $DAEMON_PIDS
    92   $ hg clone http://localhost:$HGPORT/ clone
    96   $ hg clone http://localhost:$HGPORT/ clone
    93   abort: error: bad HTTP status line: * (glob)
    97   abort: error: bad HTTP status line: * (glob)
   101   read limit reached; closing socket
   105   read limit reached; closing socket
   102 
   106 
   103   $ rm -f error.log
   107   $ rm -f error.log
   104 
   108 
   105 Failure on subsequent HTTP request on the same socket (cmd?batch)
   109 Failure on subsequent HTTP request on the same socket (cmd?batch)
       
   110 -----------------------------------------------------------------
   106 
   111 
   107   $ hg serve --config badserver.close-after-recv-bytes=210,223 -p $HGPORT -d --pid-file=hg.pid -E error.log
   112   $ 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
   113   $ cat hg.pid > $DAEMON_PIDS
   109   $ hg clone http://localhost:$HGPORT/ clone
   114   $ hg clone http://localhost:$HGPORT/ clone
   110   abort: error: bad HTTP status line: * (glob)
   115   abort: error: bad HTTP status line: * (glob)
   143   read limit reached; closing socket
   148   read limit reached; closing socket
   144 
   149 
   145   $ rm -f error.log
   150   $ rm -f error.log
   146 
   151 
   147 Failure to read getbundle HTTP request
   152 Failure to read getbundle HTTP request
       
   153 --------------------------------------
   148 
   154 
   149   $ hg serve --config badserver.close-after-recv-bytes=308,317,304 -p $HGPORT -d --pid-file=hg.pid -E error.log
   155   $ 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
   156   $ cat hg.pid > $DAEMON_PIDS
   151   $ hg clone http://localhost:$HGPORT/ clone
   157   $ hg clone http://localhost:$HGPORT/ clone
   152   requesting all changes
   158   requesting all changes
   210   read limit reached; closing socket
   216   read limit reached; closing socket
   211 
   217 
   212   $ rm -f error.log
   218   $ rm -f error.log
   213 
   219 
   214 Now do a variation using POST to send arguments
   220 Now do a variation using POST to send arguments
       
   221 ===============================================
   215 
   222 
   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
   223   $ 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
   224   $ cat hg.pid > $DAEMON_PIDS
   218 
   225 
   219   $ hg clone http://localhost:$HGPORT/ clone
   226   $ hg clone http://localhost:$HGPORT/ clone
   268   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   275   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   269 
   276 
   270   $ rm -f error.log
   277   $ rm -f error.log
   271 
   278 
   272 Now move on to partial server responses
   279 Now move on to partial server responses
       
   280 =======================================
   273 
   281 
   274 Server sends a single character from the HTTP response line
   282 Server sends a single character from the HTTP response line
       
   283 -----------------------------------------------------------
   275 
   284 
   276   $ hg serve --config badserver.close-after-send-bytes=1 -p $HGPORT -d --pid-file=hg.pid -E error.log
   285   $ 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
   286   $ cat hg.pid > $DAEMON_PIDS
   278 
   287 
   279   $ hg clone http://localhost:$HGPORT/ clone
   288   $ hg clone http://localhost:$HGPORT/ clone
   301   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   310   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   302 
   311 
   303   $ rm -f error.log
   312   $ rm -f error.log
   304 
   313 
   305 Server sends an incomplete capabilities response body
   314 Server sends an incomplete capabilities response body
       
   315 -----------------------------------------------------
   306 
   316 
   307   $ hg serve --config badserver.close-after-send-bytes=180 -p $HGPORT -d --pid-file=hg.pid -E error.log
   317   $ 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
   318   $ cat hg.pid > $DAEMON_PIDS
   309 
   319 
   310   $ hg clone http://localhost:$HGPORT/ clone
   320   $ hg clone http://localhost:$HGPORT/ clone
   339   
   349   
   340 
   350 
   341   $ rm -f error.log
   351   $ rm -f error.log
   342 
   352 
   343 Server sends incomplete headers for batch request
   353 Server sends incomplete headers for batch request
       
   354 -------------------------------------------------
   344 
   355 
   345   $ hg serve --config badserver.close-after-send-bytes=709 -p $HGPORT -d --pid-file=hg.pid -E error.log
   356   $ 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
   357   $ cat hg.pid > $DAEMON_PIDS
   347 
   358 
   348 TODO this output is horrible
   359 TODO this output is horrible
   399   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   410   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   400 
   411 
   401   $ rm -f error.log
   412   $ rm -f error.log
   402 
   413 
   403 Server sends an incomplete HTTP response body to batch request
   414 Server sends an incomplete HTTP response body to batch request
       
   415 --------------------------------------------------------------
   404 
   416 
   405   $ hg serve --config badserver.close-after-send-bytes=774 -p $HGPORT -d --pid-file=hg.pid -E error.log
   417   $ 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
   418   $ cat hg.pid > $DAEMON_PIDS
   407 
   419 
   408 TODO client spews a stack due to uncaught ValueError in batch.results()
   420 TODO client spews a stack due to uncaught ValueError in batch.results()
   461   
   473   
   462 
   474 
   463   $ rm -f error.log
   475   $ rm -f error.log
   464 
   476 
   465 Server sends incomplete headers for getbundle response
   477 Server sends incomplete headers for getbundle response
       
   478 ------------------------------------------------------
   466 
   479 
   467   $ hg serve --config badserver.close-after-send-bytes=921 -p $HGPORT -d --pid-file=hg.pid -E error.log
   480   $ 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
   481   $ cat hg.pid > $DAEMON_PIDS
   469 
   482 
   470 TODO this output is terrible
   483 TODO this output is terrible
   542   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   555   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   543 
   556 
   544   $ rm -f error.log
   557   $ rm -f error.log
   545 
   558 
   546 Server stops before it sends transfer encoding
   559 Server stops before it sends transfer encoding
       
   560 ----------------------------------------------
   547 
   561 
   548   $ hg serve --config badserver.close-after-send-bytes=954 -p $HGPORT -d --pid-file=hg.pid -E error.log
   562   $ 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
   563   $ cat hg.pid > $DAEMON_PIDS
   550 
   564 
   551   $ hg clone http://localhost:$HGPORT/ clone
   565   $ hg clone http://localhost:$HGPORT/ clone
   571 #endif
   585 #endif
   572 
   586 
   573   $ rm -f error.log
   587   $ rm -f error.log
   574 
   588 
   575 Server sends empty HTTP body for getbundle
   589 Server sends empty HTTP body for getbundle
       
   590 ------------------------------------------
   576 
   591 
   577   $ hg serve --config badserver.close-after-send-bytes=959 -p $HGPORT -d --pid-file=hg.pid -E error.log
   592   $ 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
   593   $ cat hg.pid > $DAEMON_PIDS
   579 
   594 
   580   $ hg clone http://localhost:$HGPORT/ clone
   595   $ hg clone http://localhost:$HGPORT/ clone
   649   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   664   write(36) -> HTTP/1.1 500 Internal Server Error\r\n (no-py3 !)
   650 
   665 
   651   $ rm -f error.log
   666   $ rm -f error.log
   652 
   667 
   653 Server sends partial compression string
   668 Server sends partial compression string
       
   669 ---------------------------------------
   654 
   670 
   655   $ hg serve --config badserver.close-after-send-bytes=983 -p $HGPORT -d --pid-file=hg.pid -E error.log
   671   $ 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
   672   $ cat hg.pid > $DAEMON_PIDS
   657 
   673 
   658   $ hg clone http://localhost:$HGPORT/ clone
   674   $ hg clone http://localhost:$HGPORT/ clone
   731   write(27) -> 15\r\nInternal Server Error\r\n (no-py3 !)
   747   write(27) -> 15\r\nInternal Server Error\r\n (no-py3 !)
   732 
   748 
   733   $ rm -f error.log
   749   $ rm -f error.log
   734 
   750 
   735 Server sends partial bundle2 header magic
   751 Server sends partial bundle2 header magic
       
   752 -----------------------------------------
   736 
   753 
   737   $ hg serve --config badserver.close-after-send-bytes=980 -p $HGPORT -d --pid-file=hg.pid -E error.log
   754   $ 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
   755   $ cat hg.pid > $DAEMON_PIDS
   739 
   756 
   740   $ hg clone http://localhost:$HGPORT/ clone
   757   $ hg clone http://localhost:$HGPORT/ clone
   776 #endif
   793 #endif
   777 
   794 
   778   $ rm -f error.log
   795   $ rm -f error.log
   779 
   796 
   780 Server sends incomplete bundle2 stream params length
   797 Server sends incomplete bundle2 stream params length
       
   798 ----------------------------------------------------
   781 
   799 
   782   $ hg serve --config badserver.close-after-send-bytes=989 -p $HGPORT -d --pid-file=hg.pid -E error.log
   800   $ 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
   801   $ cat hg.pid > $DAEMON_PIDS
   784 
   802 
   785   $ hg clone http://localhost:$HGPORT/ clone
   803   $ hg clone http://localhost:$HGPORT/ clone
   823 #endif
   841 #endif
   824 
   842 
   825   $ rm -f error.log
   843   $ rm -f error.log
   826 
   844 
   827 Servers stops after bundle2 stream params header
   845 Servers stops after bundle2 stream params header
       
   846 ------------------------------------------------
   828 
   847 
   829   $ hg serve --config badserver.close-after-send-bytes=992 -p $HGPORT -d --pid-file=hg.pid -E error.log
   848   $ 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
   849   $ cat hg.pid > $DAEMON_PIDS
   831 
   850 
   832   $ hg clone http://localhost:$HGPORT/ clone
   851   $ hg clone http://localhost:$HGPORT/ clone
   869 #endif
   888 #endif
   870 
   889 
   871   $ rm -f error.log
   890   $ rm -f error.log
   872 
   891 
   873 Server stops sending after bundle2 part header length
   892 Server stops sending after bundle2 part header length
       
   893 -----------------------------------------------------
   874 
   894 
   875   $ hg serve --config badserver.close-after-send-bytes=1001 -p $HGPORT -d --pid-file=hg.pid -E error.log
   895   $ 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
   896   $ cat hg.pid > $DAEMON_PIDS
   877 
   897 
   878   $ hg clone http://localhost:$HGPORT/ clone
   898   $ hg clone http://localhost:$HGPORT/ clone
   918 #endif
   938 #endif
   919 
   939 
   920   $ rm -f error.log
   940   $ rm -f error.log
   921 
   941 
   922 Server stops sending after bundle2 part header
   942 Server stops sending after bundle2 part header
       
   943 ----------------------------------------------
   923 
   944 
   924   $ hg serve --config badserver.close-after-send-bytes=1048 -p $HGPORT -d --pid-file=hg.pid -E error.log
   945   $ 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
   946   $ cat hg.pid > $DAEMON_PIDS
   926 
   947 
   927   $ hg clone http://localhost:$HGPORT/ clone
   948   $ hg clone http://localhost:$HGPORT/ clone
   971 #endif
   992 #endif
   972 
   993 
   973   $ rm -f error.log
   994   $ rm -f error.log
   974 
   995 
   975 Server stops after bundle2 part payload chunk size
   996 Server stops after bundle2 part payload chunk size
       
   997 --------------------------------------------------
   976 
   998 
   977   $ hg serve --config badserver.close-after-send-bytes=1069 -p $HGPORT -d --pid-file=hg.pid -E error.log
   999   $ 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
  1000   $ cat hg.pid > $DAEMON_PIDS
   979 
  1001 
   980   $ hg clone http://localhost:$HGPORT/ clone
  1002   $ hg clone http://localhost:$HGPORT/ clone
  1027 #endif
  1049 #endif
  1028 
  1050 
  1029   $ rm -f error.log
  1051   $ rm -f error.log
  1030 
  1052 
  1031 Server stops sending in middle of bundle2 payload chunk
  1053 Server stops sending in middle of bundle2 payload chunk
       
  1054 -------------------------------------------------------
  1032 
  1055 
  1033   $ hg serve --config badserver.close-after-send-bytes=1530 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1056   $ 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
  1057   $ cat hg.pid > $DAEMON_PIDS
  1035 
  1058 
  1036   $ hg clone http://localhost:$HGPORT/ clone
  1059   $ hg clone http://localhost:$HGPORT/ clone
  1084 #endif
  1107 #endif
  1085 
  1108 
  1086   $ rm -f error.log
  1109   $ rm -f error.log
  1087 
  1110 
  1088 Server stops sending after 0 length payload chunk size
  1111 Server stops sending after 0 length payload chunk size
       
  1112 ------------------------------------------------------
  1089 
  1113 
  1090   $ hg serve --config badserver.close-after-send-bytes=1561 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1114   $ 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
  1115   $ cat hg.pid > $DAEMON_PIDS
  1092 
  1116 
  1093   $ hg clone http://localhost:$HGPORT/ clone
  1117   $ hg clone http://localhost:$HGPORT/ clone
  1145 #endif
  1169 #endif
  1146 
  1170 
  1147   $ rm -f error.log
  1171   $ rm -f error.log
  1148 
  1172 
  1149 Server stops sending after 0 part bundle part header (indicating end of bundle2 payload)
  1173 Server stops sending after 0 part bundle part header (indicating end of bundle2 payload)
       
  1174 ----------------------------------------------------------------------------------------
       
  1175 
  1150 This is before the 0 size chunked transfer part that signals end of HTTP response.
  1176 This is before the 0 size chunked transfer part that signals end of HTTP response.
  1151 
  1177 
  1152   $ hg serve --config badserver.close-after-send-bytes=1736 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1178   $ 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
  1179   $ cat hg.pid > $DAEMON_PIDS
  1154 
  1180 
  1214 
  1240 
  1215   $ rm -f error.log
  1241   $ rm -f error.log
  1216   $ rm -rf clone
  1242   $ rm -rf clone
  1217 
  1243 
  1218 Server sends a size 0 chunked-transfer size without terminating \r\n
  1244 Server sends a size 0 chunked-transfer size without terminating \r\n
       
  1245 --------------------------------------------------------------------
  1219 
  1246 
  1220   $ hg serve --config badserver.close-after-send-bytes=1739 -p $HGPORT -d --pid-file=hg.pid -E error.log
  1247   $ 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
  1248   $ cat hg.pid > $DAEMON_PIDS
  1222 
  1249 
  1223   $ hg clone http://localhost:$HGPORT/ clone
  1250   $ hg clone http://localhost:$HGPORT/ clone