Re: read-header procedure of (web http) module has a bug?

2012-04-25 Thread Sunjoong Lee
This is not a question; are examples. Yesterday, Noah gave me an answer and
I tanks.

2012/4/25 Noah Lavine 
>
> Yes, that's right. And procedures at one level can always call to
> procedures at a higher level, but not the other way around.


;;; filename: called1.scm
(define (calling arg) (called arg))
(define (called arg) arg)
(display (calling 10))
(newline)

> Suppose there is a procedure to use another macro and definition of the
> > macro is after the procedure, is it illegal?
>
> Good question. I don't know the answer to that.


;;; filename: called2.scm
(define-syntax called (syntax-rules () ((_ arg) arg)))
(define (calling arg) (called arg))
(display (calling 10))
(newline)

In called1.scm, the order of calling and called are not a problem.
In called2.scm, called should be defined before calling.


A question about http-get of (web client)

2012-04-25 Thread Sunjoong Lee
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.