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

Enforce Date Type for Expires on Set-Cookie #1453

Closed
harshanarayana opened this issue Jan 2, 2019 · 5 comments
Closed

Enforce Date Type for Expires on Set-Cookie #1453

harshanarayana opened this issue Jan 2, 2019 · 5 comments

Comments

@harshanarayana
Copy link
Contributor

Description

As per the HTTP standard guidelines, the Expires parameter of the Set-Cookie needs to be a date in the format specified by the RFC 7231 as shown in Mozilla Dev Guide

Current encode method in sanic's Cookie class though enforces this standard, it will also allow you to set any item as a valid value via an exception catcher block.

Reference

  1. encode method in Cookie class
  2. Community Discussion Thread

Expected Behavior

Only a valid datetime object that can be converted into a RFC standard date needs to be taken as a valid item

@chenjr0719
Copy link
Member

@harshanarayana
Copy link
Contributor Author

@chenjr0719 ATM, the only way I can think of to enforce the string date format to be compliant with RCF would be via the strptime method. But is it even required to support the date in string format here? I personally think having just datetime support should be fine. But @huge-success/sanic-core-devs can pitch in and suggest maybe?

@ahopkins
Copy link
Member

ahopkins commented Jan 3, 2019

Seems like an extra check during the request/response cycle for a relatively unimportant edge case.

@LTMenezes
Copy link
Contributor

Is anybody currently working on this? I would like to work on this issue.

@ahopkins
Copy link
Member

@LTMenezes The job is yours!🤘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants