Skip to content

Commit 0ddd688

Browse files
committed
Cool URI don't change... except when they do.
1 parent ab93b1e commit 0ddd688

File tree

12 files changed

+61
-61
lines changed

12 files changed

+61
-61
lines changed

src/websockets/asyncio/connection.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ async def recv(self, decode: bool | None = None) -> Data:
200200
A string (:class:`str`) for a Text_ frame or a bytestring
201201
(:class:`bytes`) for a Binary_ frame.
202202
203-
.. _Text: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
204-
.. _Binary: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
203+
.. _Text: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
204+
.. _Binary: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
205205
206206
You may override this behavior with the ``decode`` argument:
207207
@@ -253,8 +253,8 @@ async def recv_streaming(self, decode: bool | None = None) -> AsyncIterator[Data
253253
An iterator of strings (:class:`str`) for a Text_ frame or
254254
bytestrings (:class:`bytes`) for a Binary_ frame.
255255
256-
.. _Text: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
257-
.. _Binary: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
256+
.. _Text: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
257+
.. _Binary: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
258258
259259
You may override this behavior with the ``decode`` argument:
260260
@@ -290,16 +290,16 @@ async def send(self, message: Data | Iterable[Data] | AsyncIterable[Data]) -> No
290290
bytes-like object (:class:`bytes`, :class:`bytearray`, or
291291
:class:`memoryview`) is sent as a Binary_ frame.
292292
293-
.. _Text: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
294-
.. _Binary: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
293+
.. _Text: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
294+
.. _Binary: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
295295
296296
:meth:`send` also accepts an iterable or an asynchronous iterable of
297297
strings, bytestrings, or bytes-like objects to enable fragmentation_.
298298
Each item is treated as a message fragment and sent in its own frame.
299299
All items must be of the same type, or else :meth:`send` will raise a
300300
:exc:`TypeError` and the connection will be closed.
301301
302-
.. _fragmentation: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.4
302+
.. _fragmentation: https://datatracker.ietf.org/doc/html/rfc6455#section-5.4
303303
304304
:meth:`send` rejects dict-like objects because this is often an error.
305305
(If you really want to send the keys of a dict-like object as fragments,
@@ -524,7 +524,7 @@ async def ping(self, data: Data | None = None) -> Awaitable[None]:
524524
"""
525525
Send a Ping_.
526526
527-
.. _Ping: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.2
527+
.. _Ping: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2
528528
529529
A ping may serve as a keepalive or as a check that the remote endpoint
530530
received all messages up to this point
@@ -574,7 +574,7 @@ async def pong(self, data: Data = b"") -> None:
574574
"""
575575
Send a Pong_.
576576
577-
.. _Pong: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.3
577+
.. _Pong: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3
578578
579579
An unsolicited pong may serve as a unidirectional heartbeat.
580580

src/websockets/extensions/permessage_deflate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class ClientPerMessageDeflateFactory(ClientExtensionFactory):
262262
263263
Parameters behave as described in `section 7.1 of RFC 7692`_.
264264
265-
.. _section 7.1 of RFC 7692: https://www.rfc-editor.org/rfc/rfc7692.html#section-7.1
265+
.. _section 7.1 of RFC 7692: https://datatracker.ietf.org/doc/html/rfc7692#section-7.1
266266
267267
Set them to :obj:`True` to include them in the negotiation offer without a
268268
value or to an integer value to include them with this value.
@@ -462,7 +462,7 @@ class ServerPerMessageDeflateFactory(ServerExtensionFactory):
462462
463463
Parameters behave as described in `section 7.1 of RFC 7692`_.
464464
465-
.. _section 7.1 of RFC 7692: https://www.rfc-editor.org/rfc/rfc7692.html#section-7.1
465+
.. _section 7.1 of RFC 7692: https://datatracker.ietf.org/doc/html/rfc7692#section-7.1
466466
467467
Set them to :obj:`True` to include them in the negotiation offer without a
468468
value or to an integer value to include them with this value.

src/websockets/headers.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def build_host(host: str, port: int, secure: bool) -> str:
4040
Build a ``Host`` header.
4141
4242
"""
43-
# https://www.rfc-editor.org/rfc/rfc3986.html#section-3.2.2
43+
# https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2
4444
# IPv6 addresses must be enclosed in brackets.
4545
try:
4646
address = ipaddress.ip_address(host)
@@ -59,8 +59,8 @@ def build_host(host: str, port: int, secure: bool) -> str:
5959

6060

6161
# To avoid a dependency on a parsing library, we implement manually the ABNF
62-
# described in https://www.rfc-editor.org/rfc/rfc6455.html#section-9.1 and
63-
# https://www.rfc-editor.org/rfc/rfc7230.html#appendix-B.
62+
# described in https://datatracker.ietf.org/doc/html/rfc6455#section-9.1 and
63+
# https://datatracker.ietf.org/doc/html/rfc7230#appendix-B.
6464

6565

6666
def peek_ahead(header: str, pos: int) -> str | None:
@@ -183,7 +183,7 @@ def parse_list(
183183
InvalidHeaderFormat: On invalid inputs.
184184
185185
"""
186-
# Per https://www.rfc-editor.org/rfc/rfc7230.html#section-7, "a recipient
186+
# Per https://datatracker.ietf.org/doc/html/rfc7230#section-7, "a recipient
187187
# MUST parse and ignore a reasonable number of empty list elements";
188188
# hence while loops that remove extra delimiters.
189189

@@ -320,7 +320,7 @@ def parse_extension_item_param(
320320
if peek_ahead(header, pos) == '"':
321321
pos_before = pos # for proper error reporting below
322322
value, pos = parse_quoted_string(header, pos, header_name)
323-
# https://www.rfc-editor.org/rfc/rfc6455.html#section-9.1 says:
323+
# https://datatracker.ietf.org/doc/html/rfc6455#section-9.1 says:
324324
# the value after quoted-string unescaping MUST conform to
325325
# the 'token' ABNF.
326326
if _token_re.fullmatch(value) is None:
@@ -489,7 +489,7 @@ def build_www_authenticate_basic(realm: str) -> str:
489489
realm: Identifier of the protection space.
490490
491491
"""
492-
# https://www.rfc-editor.org/rfc/rfc7617.html#section-2
492+
# https://datatracker.ietf.org/doc/html/rfc7617#section-2
493493
realm = build_quoted_string(realm)
494494
charset = build_quoted_string("UTF-8")
495495
return f"Basic realm={realm}, charset={charset}"
@@ -539,8 +539,8 @@ def parse_authorization_basic(header: str) -> tuple[str, str]:
539539
InvalidHeaderValue: On unsupported inputs.
540540
541541
"""
542-
# https://www.rfc-editor.org/rfc/rfc7235.html#section-2.1
543-
# https://www.rfc-editor.org/rfc/rfc7617.html#section-2
542+
# https://datatracker.ietf.org/doc/html/rfc7235#section-2.1
543+
# https://datatracker.ietf.org/doc/html/rfc7617#section-2
544544
scheme, pos = parse_token(header, 0, "Authorization")
545545
if scheme.lower() != "basic":
546546
raise exceptions.InvalidHeaderValue(
@@ -580,7 +580,7 @@ def build_authorization_basic(username: str, password: str) -> str:
580580
This is the reverse of :func:`parse_authorization_basic`.
581581
582582
"""
583-
# https://www.rfc-editor.org/rfc/rfc7617.html#section-2
583+
# https://datatracker.ietf.org/doc/html/rfc7617#section-2
584584
assert ":" not in username
585585
user_pass = f"{username}:{password}"
586586
basic_credentials = base64.b64encode(user_pass.encode()).decode()

src/websockets/http11.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def d(value: bytes) -> str:
4848
return value.decode(errors="backslashreplace")
4949

5050

51-
# See https://www.rfc-editor.org/rfc/rfc7230.html#appendix-B.
51+
# See https://datatracker.ietf.org/doc/html/rfc7230#appendix-B.
5252

5353
# Regex for validating header names.
5454

@@ -122,7 +122,7 @@ def parse(
122122
ValueError: If the request isn't well formatted.
123123
124124
"""
125-
# https://www.rfc-editor.org/rfc/rfc7230.html#section-3.1.1
125+
# https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.1
126126

127127
# Parsing is simple because fixed values are expected for method and
128128
# version and because path isn't checked. Since WebSocket software tends
@@ -146,7 +146,7 @@ def parse(
146146

147147
headers = yield from parse_headers(read_line)
148148

149-
# https://www.rfc-editor.org/rfc/rfc7230.html#section-3.3.3
149+
# https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.3
150150

151151
if "Transfer-Encoding" in headers:
152152
raise NotImplementedError("transfer codings aren't supported")
@@ -227,7 +227,7 @@ def parse(
227227
ValueError: If the response isn't well formatted.
228228
229229
"""
230-
# https://www.rfc-editor.org/rfc/rfc7230.html#section-3.1.2
230+
# https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2
231231

232232
try:
233233
status_line = yield from parse_line(read_line)
@@ -255,7 +255,7 @@ def parse(
255255

256256
headers = yield from parse_headers(read_line)
257257

258-
# https://www.rfc-editor.org/rfc/rfc7230.html#section-3.3.3
258+
# https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.3
259259

260260
if "Transfer-Encoding" in headers:
261261
raise NotImplementedError("transfer codings aren't supported")
@@ -324,7 +324,7 @@ def parse_headers(
324324
ValueError: If the request isn't well formatted.
325325
326326
"""
327-
# https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2
327+
# https://datatracker.ietf.org/doc/html/rfc7230#section-3.2
328328

329329
# We don't attempt to support obsolete line folding.
330330

@@ -378,7 +378,7 @@ def parse_line(
378378
line = yield from read_line(MAX_LINE_LENGTH)
379379
except RuntimeError:
380380
raise exceptions.SecurityError("line too long")
381-
# Not mandatory but safe - https://www.rfc-editor.org/rfc/rfc7230.html#section-3.5
381+
# Not mandatory but safe - https://datatracker.ietf.org/doc/html/rfc7230#section-3.5
382382
if not line.endswith(b"\r\n"):
383383
raise EOFError("line without CRLF")
384384
return line[:-2]

src/websockets/legacy/http.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def d(value: bytes) -> str:
2222
return value.decode(errors="backslashreplace")
2323

2424

25-
# See https://www.rfc-editor.org/rfc/rfc7230.html#appendix-B.
25+
# See https://datatracker.ietf.org/doc/html/rfc7230#appendix-B.
2626

2727
# Regex for validating header names.
2828

@@ -64,7 +64,7 @@ async def read_request(stream: asyncio.StreamReader) -> tuple[str, Headers]:
6464
ValueError: If the request isn't well formatted.
6565
6666
"""
67-
# https://www.rfc-editor.org/rfc/rfc7230.html#section-3.1.1
67+
# https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.1
6868

6969
# Parsing is simple because fixed values are expected for method and
7070
# version and because path isn't checked. Since WebSocket software tends
@@ -111,7 +111,7 @@ async def read_response(stream: asyncio.StreamReader) -> tuple[int, str, Headers
111111
ValueError: If the response isn't well formatted.
112112
113113
"""
114-
# https://www.rfc-editor.org/rfc/rfc7230.html#section-3.1.2
114+
# https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2
115115

116116
# As in read_request, parsing is simple because a fixed value is expected
117117
# for version, status_code is a 3-digit number, and reason can be ignored.
@@ -150,7 +150,7 @@ async def read_headers(stream: asyncio.StreamReader) -> Headers:
150150
Non-ASCII characters are represented with surrogate escapes.
151151
152152
"""
153-
# https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2
153+
# https://datatracker.ietf.org/doc/html/rfc7230#section-3.2
154154

155155
# We don't attempt to support obsolete line folding.
156156

@@ -195,7 +195,7 @@ async def read_line(stream: asyncio.StreamReader) -> bytes:
195195
# Security: this guarantees header values are small (hard-coded = 8 KiB)
196196
if len(line) > MAX_LINE_LENGTH:
197197
raise SecurityError("line too long")
198-
# Not mandatory but safe - https://www.rfc-editor.org/rfc/rfc7230.html#section-3.5
198+
# Not mandatory but safe - https://datatracker.ietf.org/doc/html/rfc7230#section-3.5
199199
if not line.endswith(b"\r\n"):
200200
raise EOFError("line without CRLF")
201201
return line[:-2]

src/websockets/legacy/protocol.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ class WebSocketCommonProtocol(asyncio.Protocol):
8080
especially in the presence of proxies with short timeouts on inactive
8181
connections. Set ``ping_interval`` to :obj:`None` to disable this behavior.
8282
83-
.. _Ping: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.2
83+
.. _Ping: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2
8484
8585
If the corresponding Pong_ frame isn't received within ``ping_timeout``
8686
seconds, the connection is considered unusable and is closed with code 1011.
8787
This ensures that the remote endpoint remains responsive. Set
8888
``ping_timeout`` to :obj:`None` to disable this behavior.
8989
90-
.. _Pong: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.3
90+
.. _Pong: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3
9191
9292
See the discussion of :doc:`timeouts <../../topics/timeouts>` for details.
9393
@@ -447,7 +447,7 @@ def close_code(self) -> int | None:
447447
WebSocket close code, defined in `section 7.1.5 of RFC 6455`_.
448448
449449
.. _section 7.1.5 of RFC 6455:
450-
https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.5
450+
https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5
451451
452452
:obj:`None` if the connection isn't closed yet.
453453
@@ -465,7 +465,7 @@ def close_reason(self) -> str | None:
465465
WebSocket close reason, defined in `section 7.1.6 of RFC 6455`_.
466466
467467
.. _section 7.1.6 of RFC 6455:
468-
https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.6
468+
https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6
469469
470470
:obj:`None` if the connection isn't closed yet.
471471
@@ -516,8 +516,8 @@ async def recv(self) -> Data:
516516
A string (:class:`str`) for a Text_ frame. A bytestring
517517
(:class:`bytes`) for a Binary_ frame.
518518
519-
.. _Text: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
520-
.. _Binary: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
519+
.. _Text: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
520+
.. _Binary: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
521521
522522
Raises:
523523
ConnectionClosed: When the connection is closed.
@@ -583,16 +583,16 @@ async def send(
583583
bytes-like object (:class:`bytes`, :class:`bytearray`, or
584584
:class:`memoryview`) is sent as a Binary_ frame.
585585
586-
.. _Text: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
587-
.. _Binary: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
586+
.. _Text: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
587+
.. _Binary: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
588588
589589
:meth:`send` also accepts an iterable or an asynchronous iterable of
590590
strings, bytestrings, or bytes-like objects to enable fragmentation_.
591591
Each item is treated as a message fragment and sent in its own frame.
592592
All items must be of the same type, or else :meth:`send` will raise a
593593
:exc:`TypeError` and the connection will be closed.
594594
595-
.. _fragmentation: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.4
595+
.. _fragmentation: https://datatracker.ietf.org/doc/html/rfc6455#section-5.4
596596
597597
:meth:`send` rejects dict-like objects because this is often an error.
598598
(If you want to send the keys of a dict-like object as fragments, call
@@ -803,7 +803,7 @@ async def ping(self, data: Data | None = None) -> Awaitable[float]:
803803
"""
804804
Send a Ping_.
805805
806-
.. _Ping: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.2
806+
.. _Ping: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2
807807
808808
A ping may serve as a keepalive, as a check that the remote endpoint
809809
received all messages up to this point, or to measure :attr:`latency`.
@@ -862,7 +862,7 @@ async def pong(self, data: Data = b"") -> None:
862862
"""
863863
Send a Pong_.
864864
865-
.. _Pong: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.5.3
865+
.. _Pong: https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3
866866
867867
An unsolicited pong may serve as a unidirectional heartbeat.
868868
@@ -1559,8 +1559,8 @@ def broadcast(
15591559
object (:class:`bytes`, :class:`bytearray`, or :class:`memoryview`) is sent
15601560
as a Binary_ frame.
15611561
1562-
.. _Text: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
1563-
.. _Binary: https://www.rfc-editor.org/rfc/rfc6455.html#section-5.6
1562+
.. _Text: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
1563+
.. _Binary: https://datatracker.ietf.org/doc/html/rfc6455#section-5.6
15641564
15651565
:func:`broadcast` pushes the message synchronously to all connections even
15661566
if their write buffers are overflowing. There's no backpressure.

src/websockets/legacy/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def process_origin(
388388
389389
"""
390390
# "The user agent MUST NOT include more than one Origin header field"
391-
# per https://www.rfc-editor.org/rfc/rfc6454.html#section-7.3.
391+
# per https://datatracker.ietf.org/doc/html/rfc6454#section-7.3.
392392
try:
393393
origin = headers.get("Origin")
394394
except MultipleValuesError as exc:

src/websockets/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def close_code(self) -> int | None:
175175
`WebSocket close code`_.
176176
177177
.. _WebSocket close code:
178-
https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.5
178+
https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5
179179
180180
:obj:`None` if the connection isn't closed yet.
181181
@@ -193,7 +193,7 @@ def close_reason(self) -> str | None:
193193
`WebSocket close reason`_.
194194
195195
.. _WebSocket close reason:
196-
https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.6
196+
https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6
197197
198198
:obj:`None` if the connection isn't closed yet.
199199

src/websockets/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def process_origin(self, headers: Headers) -> Origin | None:
307307
308308
"""
309309
# "The user agent MUST NOT include more than one Origin header field"
310-
# per https://www.rfc-editor.org/rfc/rfc6454.html#section-7.3.
310+
# per https://datatracker.ietf.org/doc/html/rfc6454#section-7.3.
311311
try:
312312
origin = headers.get("Origin")
313313
except MultipleValuesError as exc:

0 commit comments

Comments
 (0)