Arc Forumnew | comments | leaders | submitlogin
Arc webapp invaded by ruby!
1 point by globalrev 5993 days ago | 1 comment
The defop-raw and defopr-raw macros let the handler function add HTTP headers. The handler must then output a blank line followed by the HTML content or redirect path. One use of this is to add cookies to the headers.

(defop-raw bar (str req) (w/stdout str (prn "Set-Cookie: mycookie=42") (prn) (prn (req 'ip)) (br) (prn (req 'cooks)) (br) (prn (req 'args))))

On the second reload (after the cookie gets assigned), http://localhost:8080/bar?x=1&y=2&z will display:

127.0.0.1 ((mycookie 42)) ((x 1) (y 2) (z ))

This illustrates how the handler can access the client's IP address, the cookies, and the URL query parameters. The handle does not have access to other HTTP headers.

i get:

::1 ((_myRubyPrograms_session BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%250ASGFzaHsABjoKQHVzZWR7AA%253D%253D--53e5b53eb0a44d3aaf49f3d364b1af88c78eca69) (mycookie 42)) ((x 1) (y 2) (z ))

why is the ruby-stuff there and how do take it away?



2 points by cchooper 5993 days ago | link

It looks like some Ruby program has dropped a cookie. defop-raw will bring back all cookies created by localhost, so perhaps you've been running some Ruby web service from your machine?

The solution is to clear out your cookies.

-----