[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
http-read with cookie
From: |
Sunjoong Lee |
Subject: |
http-read with cookie |
Date: |
Sun, 6 May 2012 16:39:27 +0900 |
Hello,
I recognize we need handling https because most login process of web pages require it but have no idea of it now. During some trial, I made a very little effort and want to share it. Of course, there shold be the better way; I'm a newbie yet.
1.1 Exampe of http-get:
(receive (header body)
(display header)
(newline))
(receive (header body)
(display header)
(newline))
1.2 Output of above example:
#<<response> version: (1 . 1) code: 200 reason-phrase: "OK" headers: ((vary accept-language cookie referer) (content-type text/html (charset . "ISO-8859-1")) (etag "fe11bb5c119a4c282ecbc99fc66bc7f1" . #t) (last-modified . #<date nanosecond: 0 second: 41 minute: 20 hour: 23 day: 5 month: 5 year: 2012 zone-offset: 0>) (date . #<date nanosecond: 0 second: 9 minute: 3 hour: 7 day: 6 month: 5 year: 2012 zone-offset: 0>) (expires . #<date nanosecond: 0 second: 9 minute: 3 hour: 7 day: 6 month: 5 year: 2012 zone-offset: 0>) (cache-control private (max-age . 3600)) (x-content-type-options . "nosniff") (set-cookie . "PREF=ID=6d783c184a55e937:TM=1336287789:LM=1336287789:S=p7v3fPvc55hTb15k; expires=Tue, 06-May-2014 07:03:09 GMT; path=/; domain=.
google.com") (server . "codesite_static_content") (x-xss-protection . "1; mode=block") (x-frame-options . "SAMEORIGIN") (connection close)) port: #<closed: file 0>>
#<<response> version: (1 . 1) code: 200 reason-phrase: "OK" headers: ((vary accept-language cookie referer) (content-type text/html (charset . "ISO-8859-1")) (etag "fe11bb5c119a4c282ecbc99fc66bc7f1" . #t) (last-modified . #<date nanosecond: 0 second: 46 minute: 32 hour: 4 day: 6 month: 5 year: 2012 zone-offset: 0>) (date . #<date nanosecond: 0 second: 10 minute: 3 hour: 7 day: 6 month: 5 year: 2012 zone-offset: 0>) (expires . #<date nanosecond: 0 second: 10 minute: 3 hour: 7 day: 6 month: 5 year: 2012 zone-offset: 0>) (cache-control private (max-age . 3600)) (x-content-type-options . "nosniff") (set-cookie . "PREF=ID=e7e80585317f6678:TM=1336287790:LM=1336287790:S=PQWgTbaxsZyIqeVy; expires=Tue, 06-May-2014 07:03:10 GMT; path=/; domain=.
google.com") (server . "codesite_static_content") (x-xss-protection . "1; mode=block") (x-frame-options . "SAMEORIGIN") (connection close)) port: #<closed: file 0>>
1.3 Discussion about above output:
2) Example displays two headers, so the output is two line. In the first line,
http://code.google.com/ replied with set-cookie PREF. You may want to send cookie header when the next request. If not so, the server would re-send set-cookie PREF again as seen in second line.
3) Cookie header is essential when making a session. In above example, of course, actually no need to making a session, so no need cookie, it's just a test.
2.1 Example of http-read:
(receive (header body)
(display header)
(newline))
(receive (header body)
(display header)
(newline))
2.2 Output of above example:
#<<response> version: (1 . 1) code: 200 reason-phrase: "OK" headers: ((vary accept-language cookie referer) (content-type text/html (charset . "ISO-8859-1")) (etag "fe11bb5c119a4c282ecbc99fc66bc7f1" . #t) (last-modified . #<date nanosecond: 0 second: 46 minute: 32 hour: 4 day: 6 month: 5 year: 2012 zone-offset: 0>) (date . #<date nanosecond: 0 second: 58 minute: 23 hour: 7 day: 6 month: 5 year: 2012 zone-offset: 0>) (expires . #<date nanosecond: 0 second: 58 minute: 23 hour: 7 day: 6 month: 5 year: 2012 zone-offset: 0>) (cache-control private (max-age . 3600)) (x-content-type-options . "nosniff") (set-cookie . "PREF=ID=8253d36f6bcd8b99:TM=1336289038:LM=1336289038:S=xDYcthWhrVAC2asa; expires=Tue, 06-May-2014 07:23:58 GMT; path=/; domain=.
google.com") (server . "codesite_static_content") (x-xss-protection . "1; mode=block") (x-frame-options . "SAMEORIGIN") (connection close)) port: #<closed: file 0>>
#<<response> version: (1 . 1) code: 200 reason-phrase: "OK" headers: ((vary accept-language cookie referer) (content-type text/html (charset . "ISO-8859-1")) (etag "fe11bb5c119a4c282ecbc99fc66bc7f1" . #t) (last-modified . #<date nanosecond: 0 second: 46 minute: 32 hour: 4 day: 6 month: 5 year: 2012 zone-offset: 0>) (date . #<date nanosecond: 0 second: 58 minute: 23 hour: 7 day: 6 month: 5 year: 2012 zone-offset: 0>) (expires . #<date nanosecond: 0 second: 58 minute: 23 hour: 8 day: 6 month: 5 year: 2012 zone-offset: 0>) (cache-control public (max-age . 3600)) (x-content-type-options . "nosniff") (server . "codesite_static_content") (x-xss-protection . "1; mode=block") (x-frame-options . "SAMEORIGIN") (connection close)) port: #<closed: file 0>>
2.3 Discussion about above output:
1) http-read can accept a string URL as it's first argument; of course, it can accept a uri object like result of string->uri.
2) In the first line, the server replied with set-cookie PREF like 1.2 but there is no second set-cookie PREF in the second line because http-read had sent cookie header when second request.
I had attatched a code of http-read.
http-read.scm.gz
Description: GNU Zip compressed data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- http-read with cookie,
Sunjoong Lee <=