aiohttp icon indicating copy to clipboard operation
aiohttp copied to clipboard

Support setting response header size limits

Open jorop opened this issue 3 years ago • 3 comments
trafficstars

What do these changes do?

Allow the user to set the response header limits. The properties max_line_size, max_headers and max_field_size can be set on ClientSession creation. Default values are: max_line_size=8190 max_headers=32768 and max_field_size=8190. Thus the user can set and - when needed - receive bigger response headers.

Are there changes in behavior for the user?

No

Related issue number

#2304

Checklist

  • [x] I think the code is well written
  • [x] Unit tests for the changes exist
  • [ ] Documentation reflects the changes
  • [ ] If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • [x] Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

jorop avatar Jan 25 '22 09:01 jorop

When will this change be approved? This issue is very important to the use of the library.

manuel2295 avatar Mar 04 '22 12:03 manuel2295

There is a test failure, which I've not looked at closely yet. It's not one I've seen before though.

Dreamsorcerer avatar Mar 04 '22 16:03 Dreamsorcerer

This is the test that failed: https://github.com/aio-libs/aiohttp/runs/5072020477?check_suite_focus=true#step:10:3041 It looks like the plausible timeout for this test is set too narrow. Can we run the test again and look at the results? Seems not related to the code changes here.

smonist avatar Mar 14 '22 14:03 smonist

Hello @Dreamsorcerer!

Is it possible to merge this PR ? :)

Thanks

dmitry-brazhenko avatar Apr 25 '23 09:04 dmitry-brazhenko

Codecov Report

Merging #6559 (e8064f9) into master (315ae90) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #6559   +/-   ##
=======================================
  Coverage   97.31%   97.31%           
=======================================
  Files         107      107           
  Lines       31414    31484   +70     
  Branches     3927     3937   +10     
=======================================
+ Hits        30569    30639   +70     
  Misses        641      641           
  Partials      204      204           
Flag Coverage Δ
CI-GHA 97.22% <100.00%> (+<0.01%) :arrow_up:
OS-Linux 96.88% <100.00%> (+<0.01%) :arrow_up:
OS-Windows 95.24% <100.00%> (-0.05%) :arrow_down:
OS-macOS 96.46% <100.00%> (+<0.01%) :arrow_up:
Py-3.10.11 96.67% <100.00%> (-0.31%) :arrow_down:
Py-3.11.0 96.41% <100.00%> (+<0.01%) :arrow_up:
Py-3.7.16 96.70% <100.00%> (+<0.01%) :arrow_up:
Py-3.7.9 95.17% <100.00%> (+0.01%) :arrow_up:
Py-3.8.10 95.09% <100.00%> (+0.01%) :arrow_up:
Py-3.8.16 96.61% <100.00%> (+<0.01%) :arrow_up:
Py-3.9.13 ?
Py-3.9.16 96.63% <100.00%> (+<0.01%) :arrow_up:
Py-pypy7.3.11 94.12% <100.00%> (+<0.01%) :arrow_up:
VM-macos 96.46% <100.00%> (+<0.01%) :arrow_up:
VM-ubuntu 96.88% <100.00%> (+<0.01%) :arrow_up:
VM-windows 95.24% <100.00%> (-0.05%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiohttp/client_proto.py 96.73% <ø> (ø)
aiohttp/client.py 94.84% <100.00%> (+0.06%) :arrow_up:
tests/test_client_functional.py 98.51% <100.00%> (+0.04%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Apr 25 '23 17:04 codecov[bot]

Backport to 3.9: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply ecd9c72697ca1529e7cae4693775612987a2a6d2 on top of patchback/backports/3.9/ecd9c72697ca1529e7cae4693775612987a2a6d2/pr-6559

Backporting merged PR #6559 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these instructions you'll refer to it by the name upstream. If you don't have it, here's how you can add it:
    $ git remote add upstream https://github.com/aio-libs/aiohttp.git
    
  3. Ensure you have the latest copy of upstream and prepare a branch that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.9/ecd9c72697ca1529e7cae4693775612987a2a6d2/pr-6559 upstream/3.9
    
  4. Now, cherry-pick PR #6559 contents into that branch:
    $ git cherry-pick -x ecd9c72697ca1529e7cae4693775612987a2a6d2
    
    If it'll yell at you with something like fatal: Commit ecd9c72697ca1529e7cae4693775612987a2a6d2 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x ecd9c72697ca1529e7cae4693775612987a2a6d2
    
  5. At this point, you'll probably encounter some merge conflicts. You must resolve them in to preserve the patch from PR #6559 as close to the original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.9/ecd9c72697ca1529e7cae4693775612987a2a6d2/pr-6559
    
  7. Create a PR, ensure that the CI is green. If it's not — update it so that the tests and any other checks pass. This is it! Now relax and wait for the maintainers to process your pull request when they have some cycles to do reviews. Don't worry — they'll tell you if any improvements are necessary when the time comes!

🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.

patchback[bot] avatar Apr 25 '23 17:04 patchback[bot]

If someone could handle the backport to 3.9 as above, that'd be great.

Dreamsorcerer avatar Apr 25 '23 17:04 Dreamsorcerer

Awesome to see this change coming 😃 . Is there any ETA of the 3.9 release?

rohansahai avatar Apr 28 '23 19:04 rohansahai

Not yet, but still waiting on the backport to 3.9, if you'd like to help out: https://github.com/aio-libs/aiohttp/pull/6559#issuecomment-1522189057

Dreamsorcerer avatar Apr 28 '23 21:04 Dreamsorcerer