Skip to content

Commit

Permalink
Remove text that comes from copying from gittr and doesn't make much …
Browse files Browse the repository at this point in the history
…sense out of context.

Signed-off-by: Scott Wisely <syd@scrimfind.org>
  • Loading branch information
foca authored and Syd committed Jan 9, 2009
1 parent 14f44b3 commit 01aafb0
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions book/Handlers.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,13 @@ or another site entirely.
The flow of requests during a redirect is:
Browser --> Server (redirect to '/') --> Browser (request '/') --> Server (result for '/')

Sinatra sends a 302 response code as a redirect by default. According to the
spec, 302 shouldn't change the request method, but you can see a note saying
that most clients do change it. Apparently the mobile browser that person was
using did things correctly (instead of the mainstream misinterpretation).

The fix for this in the spec is 2 different response codes: 303
and 307. 303 resets to GET, 307 keeps the same method.

To force Sinatra to send a different response code, it's very simple:

redirect '/', 303 # forces the 303 return code
redirect '/', 307 # forces the 307 return code

sessions
Sessions
--------

### Default Cookie Based Sessions
Expand Down Expand Up @@ -103,9 +95,9 @@ Lets first look at the simple use case:

Setting a path, expiration date, or domain gets a little more complicated - see the source code for set\_cookie if you want to dig deeper.

set_cookie("thing", { :domain => myDomain,
:path => myPath,
:expires => Date.new } )
set_cookie("thing", :domain => myDomain,
:path => myPath,
:expires => Date.new)

That's the easy stuff with cookies - It can also serialize Array objects,
separating them with ampersands (&), but when they come back, it doesn't
Expand Down

0 comments on commit 01aafb0

Please sign in to comment.