Cookie Format

Posted on  by
EdgeCookiesView v1.17 - View cookies of Microsoft Edge Web browser
Copyright (c) 2018 - 2019 Nir Sofer

See Also

When it's turned on, '# Netscape HTTP Cookie File' header line is added to cookies.txt file format. When pressing F5 (Refresh) the refresh process is smoother, keeping the selected item and scroll position. Version 1.55: Added /DeleteCookiesWildcard which allows you to delete cookies from command-line that match the specified wildcard, for example.

  • To let cookies survive browser close, we can set either expires or max-age option. Expires=Tue, 19 Jan 2038 03:14:07 GMT; Cookie expiration date, when the browser will delete it automatically. The date must be exactly in this format, in GMT timezone. We can use date.toUTCString to get it. For instance, we can set the cookie to expire in 1 day.
  • This approach allows a single cookie to hold multiple name-value combinations without going over the browser’s cookie limit. The downside to creating cookies in this format is that custom parsing is needed to extract the values rather than relying on the much simplier cookie format.
  • Format 2.0 includes a new cookies field. All cookie headers in the request are combined with commas and added to the cookies field. In the response to the client, each cookie becomes a set-cookie header.

Description

EdgeCookiesView is a tool for Windows that displays the cookies stored by newer versions of Microsoft Edge Web browser and IE11 (Starting from Fall Creators Update 1709 of Windows 10).It also allows you to select one or more cookies and then export them to tab-delimited, csv file, html file, or to a file in cookies.txt format.You can read the cookies from the current running system or from the WebCacheV01.dat database on external hard drive.

Netscape Cookie Format

Notice: The new version of Edge is now based on Chromium, so you can use the ChromeCookiesView tool to view the cookies of this new Edge Web browser.

EdgeCookiesView vs IECookiesView

IECookiesView is very old tool originally developed in 2002 (!) and it still works with earlier versions of Edge Web browser that store the cookies in text files, exactly like Internet Explorer.But starting from Fall Creators Update 1709 of Windows 10, the cookies of Microsoft Edge Web browser are stored in the WebCacheV01.dat database together with the history and cache information, so IECookiesView cannot read the cookies of Edge anymore.
EdgeCookiesView is a new tool designed to read the cookies from the WebCacheV01.dat database.

Versions History

  • Version 1.17:
    • Added 'Add Remark Line To cookies.txt' option. When it's turned on, '# Netscape HTTP Cookie File' header line is added to cookies.txt file format.
  • Version 1.16:
    • Added 'Save File Encoding'.
  • Version 1.15:
    • Added 'Created In' column (Client or Server).
    • When choosing an external cookies file/folder in the 'Advanced Options' window, the path is now displayed in the window title.
  • Version 1.11:
    • Added 'Add Header Line To CSV/Tab-Delimited File' option (Turned on by default).
  • Version 1.10:
    • EdgeCookiesView now can also read the cookies folder of old versions of Edge/IE.In order to use this feature, open the 'Advanced Options' window (F9) , choose to load the cookies from 'Old cookies folder of Edge/IE' and then type the cookies folder.
    • Added /LoadFrom, /DatabaseFilename , /CookiesFolder command-line options to set the cookies database or folder from command-line.
  • Version 1.07:
    • Added 'Save All Items' option (Shift+Ctrl+S).
  • Version 1.06:
    • You can now resize the properties window, and the last size of this window is saved in the .cfg file.
    • You can now send the data to stdout by specifying empty string as filename, for example:
      EdgeCookiesView.exe /scomma ' more
  • Version 1.05:
    • Added option to choose another font (name and size) to display in the main window.
  • Version 1.00: First release.

Start Using EdgeCookiesView

This utility doesn't require any installation process or additional DLL files. In order to start using it, simply run the executable file - EdgeCookiesView.exe
After running EdgeCookiesView, the main window displays the cookies stored by Microsoft Edge Web browser (Assuming that you have Fall Creators Update 1709 of Windows 10 or later updates).If you want to view the cookies from external system, open the 'Advanced Options' window (F9), choose the 'External database file' option and then select the WebCacheV01.dat file in the external drive.

Quick Filter

If you want to find specific cookies, simply activate the 'Quick Filter' feature by pressing Ctrl+Q and then type the host name or the cookie name and EdgeCookiesView will display the desired cookies.

Command-Line Options

/DatabaseFilename <Filename>Specifies the database filename to load (When using /LoadFrom 2 )
/scookiestxt <Filename>Save the cookies of Edge Web browser in cookies.txt format.
/stab <Filename>Save the cookies of Edge Web browser into a tab-delimited text file.
/shtml <Filename>Save the cookies of Edge Web browser into HTML file (Horizontal).
/sxml <Filename>Save the cookies of Edge Web browser into XML file.
/sort <column>This command-line option can be used with other save options for sorting by the desired column.The <column> parameter can specify the column index (0 for the first column, 1 for the second column, and so on) orthe name of the column, like 'Host Name' and 'Name'.You can specify the '~' prefix character (e.g: '~Value') if you want to sort in descending order.You can put multiple /sort in the command-line if you want to sort by multiple columns.

Examples:
EdgeCookiesView.exe /LoadFrom 3 /CookiesFolder 'C:Usersuser10AppDataRoamingMicrosoftWindowsCookies' /scomma 'c:tempMyCookies.csv'
EdgeCookiesView.exe /LoadFrom 2 /DatabaseFilename 'K:Usersuser20AppDataLocalMicrosoftWindowsWebCacheWebCacheV01.dat' /scookiestxt 'c:tempcookies.txt'

Translating EdgeCookiesView to other languages

In order to translate EdgeCookiesView to other language, follow the instructions below:
  1. Run EdgeCookiesView with /savelangfile parameter:
    EdgeCookiesView.exe /savelangfile
    A file named EdgeCookiesView_lng.ini will be created in the folder of EdgeCookiesView utility.
  2. Open the created language file in Notepad or in any other text editor.
  3. Translate all string entries to the desired language.Optionally, you can also add your name and/or a link to your Web site. (TranslatorName and TranslatorURL values) If you add this information, it'll be used in the 'About' window.
  4. After you finish the translation, Run EdgeCookiesView, and all translated strings will be loaded from the language file.
    If you want to run EdgeCookiesView without the translation, simply rename the language file, or move it to another folder.

License

This utility is released as freeware. You are allowed to freely distribute this utility via floppy disk, CD-ROM, Internet, or in any other way, as long as you don't charge anything for this and you don'tsell it or distribute it as a part of commercial product. If you distribute this utility, you must include all files inthe distribution package, without any modification !

Disclaimer

The software is provided 'AS IS' without any warranty, either expressed or implied,including, but not limited to, the implied warranties of merchantability and fitnessfor a particular purpose. The author will not be liable for any special, incidental,consequential or indirect damages due to loss of data or any other reason.

Feedback

If you have any problem, suggestion, comment, or you found a bug in my utility, you can send a message to nirsofer@yahoo.com

EdgeCookiesView is also available in other languages. In order to change the language of EdgeCookiesView, download the appropriate language zip file, extract the 'edgecookiesview_lng.ini', and put it in the same folder that you Installed EdgeCookiesView utility.

LanguageTranslated ByDateVersion
Brazilian PortuguesePaulo Guzmán08/10/20181.05
DutchJan Verheijen18/08/20191.17
FrenchLargo16/12/20181.10
German«Latino» auf WinTotal.de18/08/20191.17
Greekgeogeo.gr17/03/20191.11
Portuguese Braziligorruckert06/04/20181.00
RomanianJaff (Oprea Nicolae)03/01/20191.10
Russian02/04/20181.00
Simplified ChineseDickMoore03/05/20201.17
SlovakFrantišek Fico27/08/20191.17
SpanishRicardo A. Rivas24/07/20201.17
Traditional ChineseDanfong Hsieh17/08/20191.17
Docs Overview
Project
Protocols
Releases
Tool
Related:
curl man page
Manual
HTTP Scripting

Cookie overview

Cookies are name=contents pairs that a HTTP server tells the client to hold and then the client sends back those to the server on subsequent requests to the same domains and paths for which the cookies were set.

Cookies are either 'session cookies' which typically are forgotten when the session is over which is often translated to equal when browser quits, or the cookies aren't session cookies they have expiration dates after which the client will throw them away.

Cookies are set to the client with the Set-Cookie: header and are sent to servers with the Cookie: header.

For a very long time, the only spec explaining how to use cookies was the original Netscape spec from 1994.

In 2011, RFC6265 was finally published and details how cookies work within HTTP. In 2016, an update which added support for prefixes was proposed, and in 2017, another update was drafted to deprecate modification of 'secure' cookies from non-secure origins. Both of these drafts have been incorporated into a proposal to replace RFC6265. Cookie prefixes and secure cookie modification protection has been implemented by curl.

Cookies saved to disk

Netscape once created a file format for storing cookies on disk so that they would survive browser restarts. curl adopted that file format to allow sharing the cookies with browsers, only to see browsers move away from that format. Modern browsers no longer use it, while curl still does.

The netscape cookie file format stores one cookie per physical line in the file with a bunch of associated meta data, each field separated with TAB. That file is called the cookiejar in curl terminology.

When libcurl saves a cookiejar, it creates a file header of its own in which there is a URL mention that will link to the web version of this document.

Cookie file format

The cookie file format is text based and stores one cookie per line. Lines that start with # are treated as comments.

Each line that each specifies a single cookie consists of seven text fields separated with TAB characters. A valid line must end with a newline character.

Fields in the file

Field number, what type and example data and the meaning of it:

  1. string example.com - the domain name
  2. boolean FALSE - include subdomains
  3. string /foobar/ - path
  4. boolean TRUE - send/receive over HTTPS only
  5. number 1462299217 - expires at - seconds since Jan 1st 1970, or 0
  6. string person - name of the cookie
  7. string daniel - value of the cookie

Cookies with curl the command line tool

curl has a full cookie 'engine' built in. If you just activate it, you can have curl receive and send cookies exactly as mandated in the specs.

Command line options:

-b, --cookie

tell curl a file to read cookies from and start the cookie engine, or if it isn't a file it will pass on the given string. -b name=var works and so does -b cookiefile.

Formatter

-j, --junk-session-cookies

when used in combination with -b, it will skip all 'session cookies' on load so as to appear to start a new cookie session.

-c, --cookie-jar

tell curl to start the cookie engine and write cookies to the given file after the request(s)

Cookies with libcurl

libcurl offers several ways to enable and interface the cookie engine. These options are the ones provided by the native API. libcurl bindings may offer access to them using other means.

CURLOPT_COOKIE

Is used when you want to specify the exact contents of a cookie header to send to the server.

CURLOPT_COOKIEFILE

Cookies Website

Tell libcurl to activate the cookie engine, and to read the initial set of cookies from the given file. Read-only.

What Is A Cookie

CURLOPT_COOKIEJAR

Cookie Format Converter

Tell libcurl to activate the cookie engine, and when the easy handle is closed save all known cookies to the given cookiejar file. Write-only.

CURLOPT_COOKIELIST

Provide detailed information about a single cookie to add to the internal storage of cookies. Pass in the cookie as a HTTP header with all the details set, or pass in a line from a netscape cookie file. This option can also be used to flush the cookies etc.

CURLINFO_COOKIELIST

Extract cookie information from the internal cookie storage as a linked list.

Cookies with javascript

These days a lot of the web is built up by javascript. The webbrowser loads complete programs that render the page you see. These javascript programs can also set and access cookies.

Cookie File Format

Since curl and libcurl are plain HTTP clients without any knowledge of or capability to handle javascript, such cookies will not be detected or used.

Often, if you want to mimic what a browser does on such websites, you can record web browser HTTP traffic when using such a site and then repeat the cookie operations using curl or libcurl.