aiohttp icon indicating copy to clipboard operation
aiohttp copied to clipboard

Client session new args max_line_size and max_field_size

Open starflows opened this issue 2 years ago • 2 comments

What do these changes do?

Add new arguments max_line_size and max_field_size to ClientSession.

Are there changes in behavior for the user?

No, both arguments are optional and will use the same default values as previously when unset.

Related issue number

https://github.com/aio-libs/aiohttp/issues/2304 https://github.com/aio-libs/aiohttp/issues/2988 https://github.com/aio-libs/aiohttp/issues/3862

Checklist

  • [x] I think the code is well written
  • [x] Unit tests for the changes exist
  • [x] 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."

starflows avatar May 09 '22 08:05 starflows

I'll leave this one for @asvetlov to evaluate when he comes back. It looks like he has some kind of plan for this: https://github.com/aio-libs/aiohttp/issues/2304#issuecomment-335099602

But, #2988 and #3862 appear to be unrelated. They both refer to setting limits in an Application in regards to incoming requests.

Dreamsorcerer avatar May 09 '22 22:05 Dreamsorcerer

Codecov Report

Merging #6744 (644787b) into master (72d3d4b) will decrease coverage by 0.00%. The diff coverage is 91.42%.

@@            Coverage Diff             @@
##           master    #6744      +/-   ##
==========================================
- Coverage   93.44%   93.43%   -0.01%     
==========================================
  Files         104      104              
  Lines       30627    30697      +70     
  Branches     3076     3086      +10     
==========================================
+ Hits        28620    28683      +63     
- Misses       1838     1844       +6     
- Partials      169      170       +1     
Flag Coverage Δ
unit 93.36% <91.42%> (-0.01%) :arrow_down:

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

Impacted Files Coverage Δ
aiohttp/client.py 24.51% <0.00%> (-0.33%) :arrow_down:
aiohttp/client_proto.py 96.71% <ø> (ø)
tests/test_client_functional.py 98.54% <100.00%> (+0.04%) :arrow_up:
aiohttp/web_protocol.py 89.39% <0.00%> (-0.29%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 72d3d4b...644787b. Read the comment docs.

codecov[bot] avatar May 10 '22 05:05 codecov[bot]

Is this feature available to use?

sumeshmurali avatar Mar 06 '23 13:03 sumeshmurali

It looks like this is in the most recent codebase:

https://github.com/aio-libs/aiohttp/blob/bc37e44f233ab8f5ed543ba842b1a4866cd77252/aiohttp/client.py#L222

added using:

https://github.com/aio-libs/aiohttp/commit/ecd9c72697ca1529e7cae4693775612987a2a6d2

However, trying to use this leads to the following error:

TypeError: ClientSession.__init__() got an unexpected keyword argument 'max_line_size'

And it is also missing from the official documentation: https://docs.aiohttp.org/en/stable/_modules/aiohttp/client.html#ClientSession https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientSession

fili avatar Aug 11 '23 11:08 fili

Ah, didn't notice the duplicate. There are tests in that code, so if you can change one to reproduce the failure and fix the problem, then we can merge it.

Dreamsorcerer avatar Aug 11 '23 12:08 Dreamsorcerer