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

Bug: I'm not correctly passing through headers #10

Closed
simonw opened this issue Jun 6, 2020 · 0 comments
Closed

Bug: I'm not correctly passing through headers #10

simonw opened this issue Jun 6, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Jun 6, 2020

Consider this code:

asgi-csrf/asgi_csrf.py

Lines 63 to 76 in a0647ad

new_headers = []
if page_needs_vary_cookie:
# Loop through original headers, modify or add "vary"
found_vary = False
for key, value in original_headers:
if key == b"vary":
found_vary = True
vary_bits = [v.strip() for v in value.split(b",")]
if b"Cookie" not in vary_bits:
vary_bits.append(b"Cookie")
value = b", ".join(vary_bits)
new_headers.append((key, value))
if not found_vary:
new_headers.append((b"vary", b"Cookie"))

If page_needs_vary_cookie is False, the existing headers are not copied over.

@simonw simonw added the bug Something isn't working label Jun 6, 2020
@simonw simonw closed this as completed in 5d788af Jun 6, 2020
simonw added a commit that referenced this issue Jun 6, 2020
simonw added a commit to simonw/datasette that referenced this issue Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant