tests/test-issue1102.t
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 10 Mar 2018 11:03:45 -0800
changeset 36861 2cdf47e14c30
parent 28251 4591cd6b6794
child 49426 805419729e11
permissions -rw-r--r--
hgweb: refactor the request draining code The previous code for draining was only invoked in a few places in the wire protocol. Behavior wasn't consist. Furthermore, it was difficult to reason about. With us converting the input stream to a capped reader, it is now safe to always drain the input stream when its size is known because we can never overrun the input and read into the next HTTP request. The only question is "should we?" This commit changes the draining code so every request is examined. Draining now kicks in for a few requests where it wouldn't before. But I think the code is sufficiently restricted so the behavior is safe. Possibly the most dangerous part of this code is the issuing of Connection: close for POST and PUT requests that don't have a Content-Length. I don't think there are any such uses in our WSGI application, so this should be safe. In the near future, I plan to significantly refactor the WSGI response handling. I anticipate this code evolving a bit. So any minor regressions around draining or connection closing behavior might be fixed as a result of that work. All tests pass with this change. That scares me a bit because it means we are lacking low-level tests for the HTTP protocol. Differential Revision: https://phab.mercurial-scm.org/D2769

  $ rm -rf a
  $ hg init a
  $ cd a
  $ echo a > a
  $ hg ci -Am0
  adding a
  $ hg tag t1 # 1
  $ hg tag --remove t1 # 2

  $ hg co 1
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg tag -f -r0 t1
  $ hg tags
  tip                                3:a49829c4fc11
  t1                                 0:f7b1eb17ad24

  $ cd ..