Ticket #128 (closed defect)

Opened 16 years ago

Last modified 16 years ago

cookie-less session + redirect => crashy crash

Reported by: vegashacker Owned by: vegashacker
Priority: major Milestone:
Component: vegashacker/leftparen.plt Keywords:
Cc: Version: (2 2)
Racket Version: 4.1

Description

Reproduction:

(0) Remove any cookies from your browser that you already have for localhost (or whatever host you are running your app on).

(1) Create a page in your main.scm like this:

(define-session-page (index-page req sesh)
  (redirect-to "http://google.com"))

(2) ./script/start and hit http://localhost:8765

Kaboom with a "Page not found" and this unintelligible spew:

write-xml-content: received #<response/full>

 === context ===
/Applications/PLT Scheme v4.1.0.3/collects/xml/private/writer.ss:86:6: write-xml-content
/Applications/PLT Scheme v4.1.0.3/collects/xml/private/xexpr.ss:212:6: xexpr->string
/Applications/PLT Scheme v4.1.0.3/collects/scheme/list.ss:263:2: append-map
core
...r/private/servlet.ss:31:19
...r/private/servlet.ss:31:19
[snip]

Change History

Changed 16 years ago by vegashacker

  • status changed from new to accepted

What's going on here? We are specifying that a session is required, but since the browser has no cookie holding the session id, the response is created to instruct the browser to create said cookie. Meanwhile, the body of our page is a call ro redirect-to, which itself creates a full/response. The page code doesn't handle the situation well when it's trying to construct a response when the "content" is already a response.

Changed 16 years ago by vegashacker

Just added a patch to the git repo to provide a slightly better error message in this case (I used contracts to do this). Here's the new error message:

(planet "session.scm" ("vegashacker" "leftparen.plt" 3 0)) broke the contract
  (->*
   ((not/c any-responses?))
   (#:extras list? #:type bytes?)
   response?)
 on list-response; expected <(not/c any-responses?)>, given: (#<response/full>)

Here's the patch:
 http://github.com/vegashacker/leftparen/commit/78e2babbf42e1f87a8379590b6b90278d1780d1d

Changed 16 years ago by vegashacker

I've now fixed this on the git repo, so it'll be part of the next PLaneT release.

Here's the patch:  http://github.com/vegashacker/leftparen/commit/e72e3be38c637abfdc0300956e88bec1825ca1a9

Changed 16 years ago by vegashacker

  • status changed from accepted to closed

LeftParen? 0.4 (version (3 0) on PLaneT) is out, and this bug is fixed in it.

Note: See TracTickets for help on using tickets.