cookie protocol
play

Cookie Protocol Server sets cookies in response header: - PowerPoint PPT Presentation

Cookie Protocol Server sets cookies in response header: Set-Cookie: session=0x4137f; Expires=Wed, 09 Jun 2012 10:18:14 GMT Name Value Expiration Time Browser returns cookies in headers of later requests: Cookie: session=0x4137fd6a CS


  1. Cookie Protocol ● Server sets cookies in response header: Set-Cookie: session=0x4137f; Expires=Wed, 09 Jun 2012 10:18:14 GMT Name Value Expiration Time ● Browser returns cookies in headers of later requests: Cookie: session=0x4137fd6a CS 142 Lecture Notes: Cookies Slide 1

  2. Easter Egg Controller class RailsIntroController < ApplicationController def hello @warning = false if session[:count] == nil then session[:count] = 0 end session[:count] = session[:count] + 1 if (session[:count] >= 3) then session[:count] = 0 @warning = true end ... end CS 142 Lecture Notes: Cookies Slide 2

  3. Easter Egg View <%@title = "Hello, User"%> <p> This page was fetched at <%= Time.now() %> </p> <% if @warning %> <p> <b>HEY!</b> Don't you have anything better to do than just redisplaying me over and over? </p> <% end %> CS 142 Lecture Notes: Cookies Slide 3

  4. CS 142 Lecture Notes: Cookies Slide 4

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend