Skip to content

Commit e2f9875

Browse files
CrowdHailerlpil
authored andcommitted
add further notes
1 parent 1923543 commit e2f9875

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/gleam/http.gleam

+1
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ fn parse_cookie_list(cookie_string) {
514514
/// Fetch the cookies sent in a request.
515515
///
516516
/// Note badly formed cookie pairs will be ignored.
517+
/// RFC6265 specifies that invalid cookie names/attributes should be ignored.
517518
pub fn get_req_cookies(req) -> List(tuple(String, String)) {
518519
let Request(headers: headers, ..) = req
519520

src/gleam/http/cookie.gleam

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ pub fn empty_attributes() {
3939
}
4040

4141
/// Helper to create sensible default attributes for a set cookie.
42+
///
43+
/// NOTE these defaults ensure you cookie is always available to you application.
44+
/// However this is not a fully secure solution.
45+
/// You should consider setting a Secure and/or SameSite attribute.
46+
///
47+
/// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#Attributes
4248
pub fn default_attributes() {
4349
Attributes(
4450
max_age: option.None,

0 commit comments

Comments
 (0)