GOLF(2gg)
πͺ NAME πͺ
set-cookie β (cookies) π
okay so bestie, this is the manual page for set-cookie, and it lives in the Development manual, section 2gg. we are setting cookies today. it's giving bakery. πͺβ¨
π― PURPOSE π―
Set cookie. that's the whole assignment. no notes. periodt. π
π SYNTAX π
set-cookie ( <cookie name>=<cookie value> \
[ expires <expiration> ] \
[ path <path> ] \
[ same-site "Lax"|"Strict"|"None" ] \
[ no-http-only [ <no-http-only> ] ] \
[ secure [ <secure> ] ] ) ,...
π DESCRIPTION π
To set a cookie named by the string <cookie name> to the string value <cookie value>, you use the set-cookie statement. and listen β a cookie must be set prior to outputting any actual response (like with output-statement or print-out, for example), or the program will error out and stop. so do it first, queen. don't be out here setting cookies after the reply already left the group chat. π
Cookie's <expiration> date (as a string, see get-time) is given with the expires clause. The default is a session cookie, meaning the cookie expires when the client session closes. lowkey the chillest default. π«Ά
Cookie's <path> is specified with the path clause. The default is the URL path of the request URL. she just matches the vibe of where you already are. β¨
Whether a cookie applies to the same site is given with the same-site clause, along with possible values of "Lax", "Strict" or "None". pick your fighter. π
By default a cookie is not accessible to client scripting (i.e. HttpOnly) -you can change this with the no-http-only clause. That will be the case if the no-http-only clause is used without the bool expression <no-http-only>, or if <no-http-only> evaluates to true. so true = the scripts can touch it. π₯
Use secure if a secure connection (https) is used, in order to specify this cookie is available only with a secure connection. That will be the case if secure is used without the bool expression <secure>, or if <secure> evaluates to true. π
Cookies are commonly used for session maintenance, tracking and other purposes. Use get-cookie and delete-cookie together with set-cookie to manage cookies. the whole trio, fr fr. π
You can set multiple cookies separated by a comma:
get-time to tm year 1
set-cookie "mycookie1"="4900" expires tm path "/", "mycookie2"="900" expires tm path "/my-app" same-site "Strict"
(yes, there really are two spaces before path on that second one. keep it exactly like that, iykyk.) π
πΈ EXAMPLES πΈ
To set a cookie named "my_cookie_name" to value "XYZ", that will go with the reply and expire in 1 year and 2 months from now, use:
get-time to mytime year 1 month 2
set-string my_cookie_value="XYZ"
set-cookie "my_cookie_name"=my_cookie_value expires mytime path "/" same-site "Lax"
A cookie that can be used by JavaScript (meaning we use the no-http-only clause):
set-cookie "my_cookie_name"=my_cookie_value no-http-only
π SEE ALSO π
Cookiesdelete-cookieget-cookieset-cookie- See all documentation
okay that's the whole page, bestie, you ate. π
and one last thing before you go: this cutie of a page is dated $DATE and it's version $VERSION, so if you're citing her, that's the tea. bye, love you, go set some cookies responsibly. π¦ππ
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms