[Factor-talk] http.factor: cookie sometimes returns non resizable collection

2010-07-18 Thread Jim mack
Sorry, I don't build from source on my windows laptop, so here's a manual fix:

http.factor
: parse-cookie ( string -- seq )

] { } make ;

needs to be:
] V{ } make ;

the test on put-cookie doesn't have it parsing a request.  Writing
that test is beyond me at the moment.
This does break 4 existing tests that hardcode a cookie result of { }.

This may apply to parse-set-cookie as well, but I didn't test this.

Detail of Problem:

Trying to use put-cookie, stepped as far as the final push, the
inspector showed a stack
T{ request ...}
T{ cookie ... }
{ ~cookie~ ~cookie~ ~cookie~ }

and push fails with Sequence index out of bounds
index 3
seq   { ~cookie~ ~cookie~ ~cookie~ }
URL http://localhost/abc;


(U) Quotation: [ set-namestack init-catchstack self quot call - stop ]

(O) Word: handle-client
(O) Method: M\ http-server handle-client*
(O) Word: do-request
(O) Method: M\ sessions call-responder*
(O) Word: handle-get
(U) Quotation: [
2dup [
~quotation~ dip

dup terminated? ~quotation~ ~quotation~ if
] 2dip - rot [ 2drop ] [ wrong-values ] if
]
(U) Quotation: [
[ ~quotation~ dip dip ] dip - dup terminated?

[ 2drop f ]
[ dup in length swap out length check-datastack ] if
]
(U) Quotation: [ swap [ call ] dip - ]
Word: dip
(O) Word: route-and-return
(O) Word: (route-and-return)

(U) Quotation: [ set-password-for-machine - f ]
(U) Quotation: [ [ request get ] dip pkey  put-cookie - drop ]
(U) Quotation: [
[ break name dupd get-cookie ~quotation~ when* ] keep
over cookies push -

]
(O) Method: M\ sequence set-nth
(O) Word: bounds-error
(O) Method: M\ object throw
(U) Quotation: [
63 special-object error-thread set-global
continuation - error-continuation set-global rethrow

]



-- 
Jim
I'm for extending the working Medicare program for our seniors all the way
back to contraception, so Americans can concentrate on living their lives
without fear of changing a job, going bankrupt from deductibles or fighting
HMO bureaucracy.
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] http.factor: cookie sometimes returns non resizable collection

2010-07-18 Thread Jim mack
On further thought, probably I'm incorrect in trying to set a cookie in the
request, rather than the response.

Sorry :)

On Sun, Jul 18, 2010 at 1:56 PM, Jim mack j...@less2do.com wrote:

 Sorry, I don't build from source on my windows laptop, so here's a manual fix:

 http.factor
 : parse-cookie ( string -- seq )
 
 ] { } make ;

 needs to be:
 ] V{ } make ;

 the test on put-cookie doesn't have it parsing a request.  Writing that test 
 is beyond me at the moment.
 This does break 4 existing tests that hardcode a cookie result of { }.

 This may apply to parse-set-cookie as well, but I didn't test this.

 Detail of Problem:

 Trying to use put-cookie, stepped as far as the final push, the inspector 
 showed a stack
 T{ request ...}
 T{ cookie ... }

 { ~cookie~ ~cookie~ ~cookie~ }


 and push fails with Sequence index out of bounds
 index 3
 seq   { ~cookie~ ~cookie~ ~cookie~ }
 URL http://localhost/abc;
 

 
 (U) Quotation: [ set-namestack init-catchstack self quot call - stop ]

 (O) Word: handle-client
 (O) Method: M\ http-server handle-client*
 (O) Word: do-request
 (O) Method: M\ sessions call-responder*
 (O) Word: handle-get
 (U) Quotation: [
 2dup [
 ~quotation~ dip


 dup terminated? ~quotation~ ~quotation~ if
 ] 2dip - rot [ 2drop ] [ wrong-values ] if
 ]
 (U) Quotation: [
 [ ~quotation~ dip dip ] dip - dup terminated?


 [ 2drop f ]
 [ dup in length swap out length check-datastack ] if
 ]
 (U) Quotation: [ swap [ call ] dip - ]
 Word: dip
 (O) Word: route-and-return
 (O) Word: (route-and-return)


 (U) Quotation: [ set-password-for-machine - f ]
 (U) Quotation: [ [ request get ] dip pkey  put-cookie - drop ]
 (U) Quotation: [
 [ break name dupd get-cookie ~quotation~ when* ] keep
 over cookies push -


 ]
 (O) Method: M\ sequence set-nth
 (O) Word: bounds-error
 (O) Method: M\ object throw
 (U) Quotation: [
 63 special-object error-thread set-global
 continuation - error-continuation set-global rethrow


 ]



 --
 Jim
 I'm for extending the working Medicare program for our seniors all the way
 back to contraception, so Americans can concentrate on living their lives
 without fear of changing a job, going bankrupt from deductibles or fighting
 HMO bureaucracy.




-- 
Jim
I'm for extending the working Medicare program for our seniors all the way
back to contraception, so Americans can concentrate on living their lives
without fear of changing a job, going bankrupt from deductibles or fighting
HMO bureaucracy.
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk