You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7974d4d
Browse filesBrowse the repository at this point in the historyBrowse files
Modifies web-server/http/cookie-parse, web-server/http/cookie,
and web-server/http/id-cookie to use net/cookies from the net-cookies
package, rather than the deprecated net/cookie.
in which case it will be converted to a @racket[date?] value.
290
301
}
291
302
292
303
@defproc[(cookie->header [c cookie?]) header?]{
@@ -348,50 +359,101 @@ FAQ} lists a few options. A convenient purely Racket-based option is
348
359
available (@racket[make-secret-salt/file]),
349
360
which is implemented using @racket[crypto-random-bytes].
350
361
351
-
@defproc[(make-id-cookie
352
-
[name cookie-name?]
353
-
[secret-salt bytes?]
354
-
[value cookie-value?]
355
-
[#:path path (or/c false/c string?) #f])
356
-
cookie?]{
362
+
@defproc*[([(make-id-cookie
363
+
[name (and/c string? cookie-name?)]
364
+
[value (and/c string? cookie-value?)]
365
+
[#:key secret-salt bytes?]
366
+
[#:path path (or/c path/extension-value? #f) #f]
367
+
[#:expires expires (or/c date? #f) #f]
368
+
[#:max-age max-age
369
+
(or/c (and/c integer? positive?) #f) #f]
370
+
[#:domain domain (or/c domain-value? #f) #f]
371
+
[#:secure? secure? any/c #f]
372
+
[#:http-only? http-only? any/c #f]
373
+
[#:extension extension
374
+
(or/c path/extension-value? #f) #f])
375
+
cookie?]
376
+
[(make-id-cookie
377
+
[name (and/c string? cookie-name?)]
378
+
[secret-salt bytes?]
379
+
[value (and/c string? cookie-value?)]
380
+
[#:path path (or/c path/extension-value? #f) #f]
381
+
[#:expires expires (or/c date? #f) #f]
382
+
[#:max-age max-age
383
+
(or/c (and/c integer? positive?) #f) #f]
384
+
[#:domain domain (or/c domain-value? #f) #f]
385
+
[#:secure? secure? any/c #f]
386
+
[#:http-only? http-only? any/c #t]
387
+
[#:extension extension
388
+
(or/c path/extension-value? #f) #f])
389
+
cookie?])]{
357
390
Generates an authenticated cookie named @racket[name] containing @racket[value], signed with @racket[secret-salt].
391
+
392
+
The calling conventions allow @racket[secret-salt] to be given either as a keyword
393
+
argument (mirroring the style of @racket[make-cookie]) or a by-position argument
394
+
(for compatability with older versions of this library).
395
+
396
+
The other arguments are passed to @racket[make-cookie]; however, note that the
397
+
default value for @racket[http-only?] is @racket[#t]. Users will also likely
398
+
want to set @racket[secure?] to @racket[#t] when using HTTPS.
358
399
}
359
400
360
-
@defproc[(request-id-cookie
361
-
[name cookie-name?]
362
-
[secret-salt bytes?]
363
-
[request request?]
364
-
[#:timeout timeout +inf.0])
365
-
(or/c false/c cookie-value?)]{
366
-
Extracts the first authenticated cookie named @racket[name] that was previously signed with @racket[secret-salt] before @racket[timeout] from @racket[request]. If no valid cookie is available, returns @racket[#f].
0 commit comments