[plt-scheme] A problem with HTTP request and unbound identifier

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sat Mar 7 19:32:52 EST 2009

Hi,

On Sat, Mar 7, 2009 at 1:17 AM, TPJ <tprimke at gmail.com> wrote:
> Hello.
>
> I'm new to both Scheme and web programming.
>
> I'm trying to find out a way to learn more about http requests, and
> here's my code (based on the one found in PLT Web tutorial):
>
> -----------------------
>
> #lang web-server/insta
>
> (require net/url-structs)
> (require web-server/http/request-structs)
>
> (define (show-url req)
>  (let* ( (r-url (request-url req))

There is no request-url, there is request-uri

>          (sch (url-scheme r-url)) )
>    (display sch)
>    (newline)))

This will display to current-input-port anyways. I think you want:

(url->string (request-uri req))

>
> (define (get-get req)
>  (show-url req)
>  '(html

This is a ' not a ` so , doesn't do anything.

>    (head (title "Test"))
>    (body (p ,(bytes-string/utf8 (request-method req))))))

This should be bytes->string/utf-8 I believe

>
> (define (start req)
>  (get-get req))
>
> -----------------------
>
> It was meant to display some information about URL and the "GET" or
> "POST" as the HTTP request method on the generated web-page, but it
> doesn't work. All I get after using the "Run" button (I use DrScheme)
> is the error message:
>
> expand: unbound identifier in module in: request-url
>
> What am I doing wrong?
>
> BTW, before I got this error message, the code:
>
> ,(bytes-string/utf8 (request-method req))
>
> was returning "&request;" string. It wasn't something I expected...
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>

Jay

-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.