Parse an Upgrade protocol from ``header`` at the given position. Return the protocol value and the new position. Raises: InvalidHeaderFormat: On invalid inputs.
(
header: str, pos: int, header_name: str
)
| 266 | |
| 267 | |
| 268 | def parse_upgrade_protocol( |
| 269 | header: str, pos: int, header_name: str |
| 270 | ) -> tuple[UpgradeProtocol, int]: |
| 271 | """ |
| 272 | Parse an Upgrade protocol from ``header`` at the given position. |
| 273 | |
| 274 | Return the protocol value and the new position. |
| 275 | |
| 276 | Raises: |
| 277 | InvalidHeaderFormat: On invalid inputs. |
| 278 | |
| 279 | """ |
| 280 | match = _protocol_re.match(header, pos) |
| 281 | if match is None: |
| 282 | raise InvalidHeaderFormat(header_name, "expected protocol", header, pos) |
| 283 | return cast(UpgradeProtocol, match.group()), match.end() |
| 284 | |
| 285 | |
| 286 | def parse_upgrade(header: str) -> list[UpgradeProtocol]: |
nothing calls this directly
no test coverage detected
searching dependent graphs…