-
Notifications
You must be signed in to change notification settings - Fork 156
Add support for socket options #668
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
Changes from 7 commits
889c99e
3dc8bda
2b91aef
52572b3
9052db4
ba607f2
6528f56
71bfdb2
149a17c
29072a8
e40b7dd
143ec83
3694ee3
8518eb0
1cb9803
866a08e
0b334f0
c60f303
dda9578
9337eee
8cf32b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,13 +1,13 @@ | ||||||
| import ssl | ||||||
| import sys | ||||||
| from types import TracebackType | ||||||
| from typing import Iterable, Iterator, List, Optional, Type | ||||||
| from typing import Iterable, Iterator, Iterable, List, Optional, Type | ||||||
|
|
||||||
| from .._exceptions import ConnectionNotAvailable, UnsupportedProtocol | ||||||
| from .._models import Origin, Request, Response | ||||||
| from .._synchronization import Event, Lock | ||||||
| from ..backends.sync import SyncBackend | ||||||
| from ..backends.base import NetworkBackend | ||||||
| from ..backends.base import SOCKET_OPTION, NetworkBackend | ||||||
| from .connection import HTTPConnection | ||||||
| from .interfaces import ConnectionInterface, RequestInterface | ||||||
|
|
||||||
|
|
@@ -53,6 +53,7 @@ def __init__( | |||||
| local_address: Optional[str] = None, | ||||||
| uds: Optional[str] = None, | ||||||
| network_backend: Optional[NetworkBackend] = None, | ||||||
| socket_options: Optional[Iterable[SOCKET_OPTION]] = None, | ||||||
| ) -> None: | ||||||
| """ | ||||||
| A connection pool for making HTTP requests. | ||||||
|
|
@@ -108,6 +109,7 @@ def __init__( | |||||
| self._network_backend = ( | ||||||
| SyncBackend() if network_backend is None else network_backend | ||||||
| ) | ||||||
| self._socket_options = () if socket_options is None else socket_options | ||||||
|
||||||
| self._socket_options = () if socket_options is None else socket_options | |
| self._socket_options = socket_options |
it looks to me like we should leave self._socket_options as optional throughout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we always make sure to check if socket_options is not None before using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make sense for us to do the if socket_options is None dance at the last possible point, in the network backends.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep this optional just now.