Shared conditional-response evaluation for GET, HEAD, and QUERY.
server.conditional
| Name | Type | Default | Description |
|---|---|---|---|
type
|
|
— | |
qualified_name
|
|
— | |
element_type
|
|
— | |
description
|
|
— | |
source_file
|
|
— | |
line_number
|
|
— | |
is_autodoc
|
|
— | |
autodoc_element
|
|
— | |
_autodoc_template
|
|
— | |
_autodoc_url_path
|
|
— | |
_autodoc_page_type
|
|
— | |
title
|
|
— | |
doc_content_hash
|
|
— |
Symbols on this page
Return whether an HTML response carries a nonce-based CSP.
A per-request CSP nonce makes the final HTML representation unsafe to
reuse through304 Not…
Parse an HTTP-date header into a POSIX timestamp, or None if invalid.
Apply RFC 9110 weak comparison for If-None-Match.
Apply RFC 9110 strong comparison for If-Match.
Return 304 when request validators match an ordinary representation.
has_nonce_csp_html
function
def has_nonce_csp_html(response: Response) -> bool
Return whether an HTML response carries a nonce-based CSP.
A per-request CSP nonce makes the final HTML representation unsafe to
reuse through304 Not Modified: the browser could combine a cached
body containing nonce A with a newly generated policy containing nonce B.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
response
|
Response
|
— |
parse_http_date
function
def parse_http_date(value: str) -> float | None
Parse an HTTP-date header into a POSIX timestamp, or None if invalid.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value
|
str
|
— |
etag_matches
function
def etag_matches(if_none_match: str, etag: str) -> bool
Apply RFC 9110 weak comparison for If-None-Match.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
if_none_match
|
str
|
— | |
etag
|
str
|
— |
_strong_etag_matches
function
def _strong_etag_matches(if_match: str, etag: str) -> bool
Apply RFC 9110 strong comparison for If-Match.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
if_match
|
str
|
— | |
etag
|
str
|
— |
evaluate_conditional_response
function
def evaluate_conditional_response(request: Request, response: Response) -> Response
Return 304 when request validators match an ordinary representation.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
request
|
Request
|
— | |
response
|
Response
|
— |
View source · /home/runner/work/chirp/chirp/site/../src/chirp/server/conditional.py:1