[plt-scheme] Web server and response/basic fields

From: Edmund Dengler (edmundd at eSentire.com)
Date: Sun May 22 16:40:21 EDT 2005

Greetings!

I am trying to access the fields of a "response" structure returned by
"make-response/full".

(require (lib "response.ss" "web-server"))

(define x (make-response/full
             200 "OK" (current-seconds) #"text/html" '()
             (list "<html><body>Hello</body></html>")))

(display x)(newline)
(display (response/full-body x))(newline)
(display (response/basic-extras x))(newline)

I get the following output:
#<struct:response/full>
(<html><body>Hello</body></html>)
reference to undefined identifier: response/basic-extras

Similar results if I change "response/basic-extras" to
"response/full-extras".

Looking at "response.ss", it looks like "response/basic" is not provided.

I added an extra section to the start of "provide/contract":

   [struct response/basic
           ([code number?]
            [message string?]
            [seconds number?]
            [mime bytes?]
            [extras (listof (cons/c symbol? string?))])]

and when a reran the test, I get:
#<struct:response/full>
(<html><body>Hello</body></html>)
()

(as expected).

Question #1: Should the "response/full" have provided the "response/basic"
accessor functions?

However, when I try to run the web server, I now get:

compile: variable not provided (directly or indirectly and at the expected position) from module: |,/opt/pkgs/mzscheme/current/collects/web-server/response| in: provide/contract-contract-id-TEXT/HTML-MIME-TYPE.50

I tried moving the section around (even sticking it in a separate
"provide/contract" clause), but get similar errors, eg:

compile: variable not provided (directly or indirectly and at the expected position) from module: |,/opt/pkgs/mzscheme/current/collects/web-server/response| in: TEXT/HTML-MIME-TYPE

Question #2: Any ideas on how to fix this issue? Or where to look?

Regards!
Ed



Posted on the users mailing list.