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

ssl support #712

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

ssl support #712

wants to merge 23 commits into from

Conversation

zrvku2000
Copy link

@zrvku2000 zrvku2000 commented Jan 22, 2025

What do these changes do?

implements ssl support

Are there changes in behavior for the user?

no

Related issue number

Fixes #208

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 95.70552% with 7 lines in your changes missing coverage. Please review.

Project coverage is 96.10%. Comparing base (dd571e6) to head (214e6a6).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
aiohttp_devtools/runserver/config.py 83.33% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #712      +/-   ##
==========================================
+ Coverage   95.85%   96.10%   +0.24%     
==========================================
  Files          23       23              
  Lines        1714     1847     +133     
  Branches      198      112      -86     
==========================================
+ Hits         1643     1775     +132     
- Misses         46       49       +3     
+ Partials       25       23       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Dreamsorcerer
Copy link
Member

Thanks, looking good. Just need to review the test failures and coverage.

@zrvku2000
Copy link
Author

zrvku2000 commented Jan 29, 2025

2.2.1 version of 'livereload.js' doesn't check browser's 'location.protocol' property and always uses 'ws' specification for handshake. So aux server reverted to http.

@Dreamsorcerer
Copy link
Member

One test still failing. I'd suggest moving the test to test_runserver_main.py as well, I don't think we need a dedicated ssl file for it.

@zrvku2000
Copy link
Author

zrvku2000 commented Feb 1, 2025

Windows tests are failing... Didn't even check that for this os... Ok, I'll check and correct them on VM. This may be problem with self-signed test certs...

@zrvku2000
Copy link
Author

Tests for Linux, Linux PyPy, MacOS and Windows perform well in my local environment.

Comment on lines +116 to +122
if self.ssl_rootcert_file_path:
try:
client_ssl_context.load_verify_locations(self.ssl_rootcert_file_path)
except FileNotFoundError as e:
raise AdevConfigError('{}: {}'.format(e.strerror, self.ssl_rootcert_file_path))
except Exception:
raise AdevConfigError('invalid root cert file: {}'.format(self.ssl_rootcert_file_path))
Copy link
Member

Choose a reason for hiding this comment

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

Is it difficult to create a test for this code? Seems to be the only missing coverage now.

client_ssl_context.load_verify_locations(self.ssl_rootcert_file_path)
except FileNotFoundError as e:
raise AdevConfigError('{}: {}'.format(e.strerror, self.ssl_rootcert_file_path))
except Exception:
Copy link
Member

Choose a reason for hiding this comment

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

I also wonder about catching arbitrary exceptions. I'd assume the only other errors we should expect here are ssl.SSLError exceptions.

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.

Features Request: Add HTTPS Support
2 participants