Noorem Tarkvaraarendaja eriala

H5: Küpsised

What is a cookie?

An HTTP cookie (also called web cookie, Internet cookie, browser cookie, or simply cookie) is a small block of data created by a web server while a user is browsing a website and placed on the user’s computer or other device by the user’s web browser. Cookies are placed on the device used to access a website, and more than one cookie may be placed on a user’s device during a session.

Cookies serve useful and sometimes essential functions on the web. They enable web servers to store stateful information (such as items added in the shopping cart in an online store) on the user’s device or to track the user’s browsing activity (including clicking particular buttons, logging in, or recording which pages were visited in the past). They can also be used to save information that the user previously entered into form fields, such as names, addresses, passwords, and payment card numbers for subsequent use.

Harjutus

  1. Saada xh käsurearakendusega Twitteri veebiserverile päring ning vaata, millised küpsised Twitteri veebiserver tagasi annab. 
  2. Uuri netist set-cookie päise anatoomiat (MDN Web Docs saidil on päris hea kirjeldus) ning analüüsi, millist infot, kellele ja kui kauaks Twitter sinu brauserisse üritas sokutada.

Kokkuvõtte

Ülesandes tuli saata HTTP-päring veebiserverile, kasutades käsurea töörista xh -h [URL], ning vaadata, milliseid küpsiseid server vastuseks saadab.