guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A question about http-get of (web client)


From: Sunjoong Lee
Subject: Re: A question about http-get of (web client)
Date: Fri, 27 Apr 2012 23:20:01 +0900

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 <address@hidden>
(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>]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]