From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sunjoong Lee Newsgroups: gmane.lisp.guile.user Subject: A question about http-get of (web client) Date: Thu, 26 Apr 2012 10:15:44 +0900 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d04428ff4794a5704be8abb47 X-Trace: dough.gmane.org 1335402979 27703 80.91.229.3 (26 Apr 2012 01:16:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 26 Apr 2012 01:16:19 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Apr 26 03:16:18 2012 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SNDJh-0007Fh-I7 for guile-user@m.gmane.org; Thu, 26 Apr 2012 03:16:17 +0200 Original-Received: from localhost ([::1]:44108 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNDJg-0005Qq-Rx for guile-user@m.gmane.org; Wed, 25 Apr 2012 21:16:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNDJb-0005M5-I9 for guile-user@gnu.org; Wed, 25 Apr 2012 21:16:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SNDJZ-0005F1-4K for guile-user@gnu.org; Wed, 25 Apr 2012 21:16:11 -0400 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:41986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SNDJY-0005EJ-RL for guile-user@gnu.org; Wed, 25 Apr 2012 21:16:09 -0400 Original-Received: by werj55 with SMTP id j55so551244wer.0 for ; Wed, 25 Apr 2012 18:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=g/JldeHJJ1Go2jrX2iEtLS/VmNGFeLUxecqGxegEt9s=; b=EvxiuHDpoyR7z5KgLQVsp6B2vNIH1hVLxrGvuhZK2eg3J9+dzIDELawNvkvVEyIW7q feICVqJrB/mx+OQKu+hJDqAIcPn1bboE0qfbPSFK+FUdBlEUki9EWvKNNlDGn24Q7OcY pprEnHp7mjCrP+8KKJ4ZQP+JGv3/1cNyoeQctOnLICTXdar4Xezj1whR1TfZdiUd3itR lkN2/Heix4TquutzxruHMvjcNv27pYK+K1SCjwFDvqvVQwDDJCNE3/9BsBINjDkqPt7j FQfPjf035uPVR+b3OIcp2zr2A9I6n6PXvmKAbQ1ZelTC8YcmC3WVv0BbJDv8AsiNPcwn 7LVQ== Original-Received: by 10.180.79.135 with SMTP id j7mr6708738wix.19.1335402966895; Wed, 25 Apr 2012 18:16:06 -0700 (PDT) Original-Received: by 10.223.93.206 with HTTP; Wed, 25 Apr 2012 18:15:44 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.169 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9393 Archived-At: --f46d04428ff4794a5704be8abb47 Content-Type: text/plain; charset=UTF-8 First, here is an example of http-get: (use-modules ((web uri) #:select (string->uri)) ((web client) #:select (http-get))) (call-with-values (lambda () (http-get (string->uri "http://www.gnu.org/software/guile/"))) (lambda (res-headers res-body) (display res-body) (newline))) It works well. But after changing url string from " http://www.gnu.org/software/guile/" to "http://www.gnu.org/", it did not work. Last two lines of Backtrace is: web/http.scm:184:11: In procedure read-header: web/http.scm:184:11: Throw to key `bad-header' with args `(uri "home.html")'. I think http://www.gnu.org/ need to know browser's encoding language. http-get accept extra-headers but I don't know how to fill the contents of headers in web and scheme. In scheme, I think acon magic(?) is needed. Please show me an example to fill headers. I want to fill browser's encoding language, browser's type and some cookies. Oh, cookie would be need if http://www.google.com/ , I think, and would be got from res-headers. --f46d04428ff4794a5704be8abb47 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable First, here is an example of http-get:

=C2=A0 = (use-modules ((web uri) =C2=A0 =C2=A0#:select (string->uri))
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((web client) #:sele= ct (http-get)))
=C2=A0 (call-with-values (lambda ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (http-get
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(string->uri "http://www.gnu.org/software/guile/"))= )
=C2=A0 =C2=A0 (lambda (res-headers res-body)
=C2=A0 =C2=A0 =C2=A0 (display res-body)
=C2=A0 =C2=A0 =C2=A0= (newline)))

It works well. But after = changing url string from "http://www.gnu.org/software/guile/" to "http://www.gnu.org/", it did not work. Last two line= s of=C2=A0Backtrace is:
=C2=A0 web/http.scm:184:11: In procedure read-header:
= =C2=A0 web/http.scm:184:11: Throw to key `bad-header' with args `(uri &= quot;home.html")'.

I think=C2=A0http://www.gnu.org/ need to know=C2=A0brow= ser's encoding language. http-get accept=C2=A0extra-headers but I don&#= 39;t know how to fill the contents of headers in web and scheme. In scheme,= I think acon magic(?) is needed. Please show me an example to fill headers= . I want to fill=C2=A0browser's encoding language, browser's type a= nd some cookies. Oh, cookie would be need if =C2=A0http://www.google.com/ , I think, and would be got from=C2= =A0res-headers.

--f46d04428ff4794a5704be8abb47--