Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to URL.with_port() input filtering #793

Merged
merged 9 commits into from
Dec 12, 2022
Merged

Conversation

dereckt
Copy link
Contributor

@dereckt dereckt commented Dec 5, 2022

What do these changes do?

These changes fix the improper validation issues with URL.with_port(). Essentially, it restricts ports to be from 0 to 65535 (tcp limit), and fixes the weird handling of the 0 port

Are there changes in behavior for the user?

The URL.with_port() function will now throw errors when Booleans or invalid ports are arguments.

Related issue number

#746

Implementation Inquiry

Currently, this is set up to allow port 0 to function and not throw errors. From what I looked up it seems to be possible to use the 0 port (officially it does "not exist"), though since it's a special case and issue #746 says that the output should throw an error, I'm unsure if I'm handling it correctly.

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes - Documentation does not go into specifics for input/output on this function
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> (e.g. 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.

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Dec 5, 2022
@dereckt dereckt marked this pull request as ready for review December 7, 2022 01:38
@dereckt dereckt changed the title With port Fix to URL.with_port() input filtering Dec 7, 2022
@codecov
Copy link

codecov bot commented Dec 8, 2022

Codecov Report

Merging #793 (c0820a1) into master (d703adb) will increase coverage by 0.26%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #793      +/-   ##
==========================================
+ Coverage   99.46%   99.73%   +0.26%     
==========================================
  Files           4        4              
  Lines         750      753       +3     
  Branches      167      210      +43     
==========================================
+ Hits          746      751       +5     
+ Misses          3        2       -1     
+ Partials        1        0       -1     
Flag Coverage Δ
unit 99.60% <100.00%> (+0.13%) ⬆️

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

Impacted Files Coverage Δ
yarl/_url.py 99.65% <100.00%> (+<0.01%) ⬆️
yarl/_quoting.py 100.00% <0.00%> (+20.00%) ⬆️

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

Copy link
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@asvetlov asvetlov merged commit 94b8679 into aio-libs:master Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants