-
Notifications
You must be signed in to change notification settings - Fork 285
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
CP-50079: Parse cookies correctly #5821
CP-50079: Parse cookies correctly #5821
Conversation
Passed BST+BVT (Run 201239) |
f995928
to
16a5a35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not introduce List.hd
; not sure if it would be a good idea but the code could accept both delimiters - even mixed use and restricted later.
(* Determine if ';' or '&' is used as the separator. | ||
Both are assumed to be illegal characters otherwise *) | ||
let sep = | ||
match Astring.String.find (fun c -> c = ';') xs with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means we don't support a mix of ; and &. You could have used Astring.String.fields ~is_sep:(fun c -> c = ';' || c = '&')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a reasonable use case? Could do it if people think it's something worth supporting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think this is a bit weird but it's a simple solution because you don't have to detect the delimiter but rather accept both. Later we we restrict this by accepting only one and failing we we detect the other.
16a5a35
to
b3f4b91
Compare
Got rid of |
The suites are ordered and some take quite a long time to run, so introduce an option to only run some of them if necessary. Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
We used to send and parse cookies (internally, therefore it wasn't a big problem) with '&' as separators. Now we also accept ';' as separators (RFC-compliant), as preparation for sending cookies with ';' in the future. Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
Test helper functions had to be reworked to also allow sending HTTP requests through normal sockets, not only file sockets. A test was moved from the legacy endpoint to the new one. Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
41c66fa
to
45cdd70
Compare
Squashed the fixes. Ready for merging. |
Best reviewed by commit.
Currently we send and parse cookies incorrectly (internally, therefore it wasn't a big problem) with
&
as separators. This PR also accepts;
as separators (to be RFC-compliant), in preparation for sending cookies with;
in the future. Currently this change is limited to servers (accepting cookies), as old servers could interact with new clients sending newly-formatted cookies during upgrades, thus breaking them. We should wait until all servers we support upgrades from are new and then update the clients too. (We should really get a centralised place to track such long-term deprecation-like things.)Removes legacy
sync_config_files
interface - please advise as to what's the best way to proceed here is. Should we warn that said endpoint is deprecated, only support/2
(what my PR does at the moment)? Should we respond with new data to legacy requests instead?Expanded quicktests to verify correct parsing of cookies. Had to add new helper functions since
sync_config_files
requests from unix file sockets are always authenticated - we need to send a real one to check.Qt.http
is not a good fit here since it eventually calls into our library which always sets thebody = None
, and we need to verify the body itself.Also adds
-run-only X,Y,Z
and-list-tests
parameters to quicktests (currently they are not 'quick' at all).== These changes passed the quicktests, currently also running full BST+BVT.