Skip to content

http2 test: Cover empty header values, client cancellation, throttled download - #1131

Open
PaulLodge wants to merge 1 commit into
apache:trunkfrom
PaulLodge:port2-http2
Open

PaulLodge wants to merge 1 commit into
apache:trunkfrom
PaulLodge:port2-http2

Conversation

@PaulLodge

Copy link
Copy Markdown
Contributor

Added a new TestEmptyHeaderValues class in test_200_header_invalid.py, a client cancellation test in test_105_timeout.py, and a throttled large download as test_901_h2_limit_rate.py.

  • This PR does not report or address a security vulnerability
    (see SECURITY.md and
    https://www.apache.org/security/#reporting-a-vulnerability).
  • Code follows the httpd style guide.
  • New log messages (level debug or higher) use an empty APLOGNO() tag;
    numbers are assigned by a committer at merge time (see docs/log-message-tags/README).
  • If the change is user-visible, a changes-entries/*.txt file is included,
    following the template in README.CHANGES (not needed otherwise).
  • Test cases based on pyhttpd are included where appropriate, in the
    test/modules/xxx directory matching the modules/xxx module source,
    or test/modules/core for core server changes. On Unix, verify these
    pass locally with e.g. make check-pytest PYTEST_DIRS=test/modules/xxx.

@arturobernalg

Copy link
Copy Markdown
Member

Thanks for these. A few notes:

  1. The three TestEmptyHeaderValues tests don't send an empty header: curl's -H 'X-Empty-Value:' removes the header instead (see --header in the curl man page). -H 'X-Empty-Value;' sends it with an empty value. With that change they still pass here on trunk. They could also assert that the header arrived, e.g. request /hecho.py?name=X_EMPTY_VALUE and check r.response['header']['x_empty_value'] == ''.

  2. test_h2_105_13: necho.py sleeps wait2 before the body, so with wait2=2 and --max-time 1 curl always exits 28 (10 out of 10 here). The assert could be r.exit_code == 28.

  3. test_901 takes ~15s here (1 MB at 64k). --limit-rate 256k brings it to ~4s, or data-100k at 64k to ~1.5s. There is no 9xx range yet; maybe put it next to test_h2_008_03, which already uses --limit-rate? Its _class_scope fixture also needs @classmethod like the other classes; pytest 9 warns about a class-scoped fixture as an instance method.

@PaulLodge

Copy link
Copy Markdown
Contributor Author

Hi @arturobernalg many thanks for the feedback and catching those issues with the tests, it's really appreciated.

… download

TestEmptyHeaderValues class in test_200_header_invalid.py (sending the
empty values with curl -H "X;" and asserting their arrival via
hecho.py), a client cancellation test in test_105_timeout.py, and a
throttled download in test_008_ranges.py next to the existing
--limit-rate use.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants