w3d4 Flashcards Preview

App Academy Readings > w3d4 > Flashcards

Flashcards in w3d4 Deck (16)
Loading flashcards...
1

What does it mean that HTTP is a stateless protocol?

All requests are independent of one another; no information is saved between requests.

2

What is an advantage of a stateless protocol?

It allows for server speed optimizations.

3

What is a cookie?

A piece of data stored in a web browser that is sent along with HTTP requests to help the server identify information about the sender; solves the problem of statelessness.

4

How does a server check that a cookie is valid?

When the cookie is initially set, the server stores token in its database, and it compares the sent cookie to the stored cookie token.

5

What is a permanent cookie?

A cookie with an expiration date very far in the future, which causes it to persist for a long time.

6

What is a session cookie?

A cookie without an expiration date, which will be deleted when the browser closes.

7

How can cookies be used, for example, to allow a non-logged in user to store items in their cart?

By giving the anonymous user a session cookie.

8

What is an advantage of keeping cookie sizes under 4kB?

If a cookie needs to be sent multiple times, then keeping the size small will speed up internet use.

9

T/F: Important information which persists can be stored in cookies.

F; Users clear cookies all the time so you shouldn't count on its presence.

10

What is a session?

Data about a particular HTTP transaction which is reused for future contexts. Cookies are an implementation of sessions.

11

What does the sessions hash contain?

Data about previous sessions.

12

How do we remove something from the sessions hash?

Set it to nil

13

What is the flash hash?

A hash of values that is available during the next request, but is cleared with each new request.

14

What do we do if we want to display the flash hash in the same request?

Use flash.now

15

What is a CSRF attack?

A cross site request forgery, in which a deceptive form on one site sends data to another site.

16

What is an authenticity token?

A token for a user that is uploaded/set with each new request.