HTTP Cookies

From Ever changing code
Revision as of 11:08, 23 June 2020 by Pio2pio (talk | contribs) (Created page with "This is about [https://tools.ietf.org/html/rfc6265#page-17 HTTP State Management Mechanism] but gluing various resources. = Setting cookies = Y...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is about HTTP State Management Mechanism but gluing various resources.

Setting cookies

You can set cookies using the -b (short for --cookie) flag. You specify the key and the value for the cookie with the flag. Here͛s an example showing how to set two cookies:

curl --cookie "name=john;course=linux beginner" httpbin.org/cookies

Notice that cookies are separated by a semicolon and that you do not need to encode spaces as a plus sign.This brings us to the end of the guide on using curl. The next part of the guide will introduce you to HTTP headers.

Cookie header

The cookie header contains all the cookies and their values. Cookies are used to identify the users, maintain sessions, and so on. Example:

Cookie: name=John;course=Linux