unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Sunjoong Lee <sunjoong@gmail.com>
To: guile-user@gnu.org
Subject: Re: A question about http-get of (web client)
Date: Fri, 27 Apr 2012 23:20:01 +0900	[thread overview]
Message-ID: <CAK93xhoEk70qP3PW-kjnEQVXsMxaxFLVUy9+uLrid9byr+OHGw@mail.gmail.com> (raw)
In-Reply-To: <CAK93xhqy79WKXpaOCBtoH0jYYB6oywVufh=DmqK5MazsS4_W+Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]

I think I found the cause of the error; the error was in
declare-uri-header! That was not a encoding problem.

http://www.gnu.org/home.html will send Content-Location header and it is
home.en.html if your Accept-Language is en-US. Yes!! This is a relativeURI.

Location is absolute URI but Content-Location and Referer may be relative
URI or absolute URI. Current declare-uri-header! can do only absolute URI
because string->uri returns false value whenever not absolute URI!!

2012/4/26 Sunjoong Lee <sunjoong@gmail.com>
>
> (use-modules ((srfi srfi-11) #:select (let-values))
>              ((web uri)      #:select (string->uri))
>              ((web client)   #:select (http-get)))
> (let-values (((res-headers res-body)
>               (http-get (string->uri "http://www.gnu.org/home.html")
>                         #:extra-headers
>                         (acons 'Accept "text/html"
>                                (acons 'Accept-Charset "ISO-8859-1"
>                                       (acons 'Accept-Language "en-US"
>                                              '()))))))
>   (display res-body)
>   (newline))
>
> Above code makes an error:
>   ...
>   In web/response.scm:
>    187: 2 [read-response #<input-output: socket 5>]
>   In web/http.scm:
>    218: 1 [lp ((server . "Apache/2.2.14") (date . #))]
>    184: 0 [read-header #<input-output: socket 5>]
>

[-- Attachment #2: Type: text/html, Size: 2843 bytes --]

      reply	other threads:[~2012-04-27 14:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26  1:15 A question about http-get of (web client) Sunjoong Lee
2012-04-26 12:50 ` Sunjoong Lee
2012-04-27 14:20   ` Sunjoong Lee [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK93xhoEk70qP3PW-kjnEQVXsMxaxFLVUy9+uLrid9byr+OHGw@mail.gmail.com \
    --to=sunjoong@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).