- "If you are seeing this page, your gopher browser does not\r\n"
- "properly support URL directory entries or cannot follow such\r\n"
- "links. To view the link you requested, use a web browser to\r\n"
- "open the follwing url:\r\n"
- "\r\n"
- url "\r\n")))
+ "<html><head><title>Redirection</title>"
+ "<meta http-equiv=\"refresh\" content=\"10; URL='" url "'\" />"
+ "</head><body>"
+ "<p>If you are seeing this page, your gopher browser does not "
+ "properly support URL directory entries or cannot follow such "
+ "links.</p>"
+ "<p>If you are viewing this page using a web browser, you should "
+ "be redirected shortly. Otherwise, you can manually open the "
+ "the follwing url:\n"
+ "\n"
+ "<a href=\"" url "\">" url "</a>\n"
+ "</body></html>")))
+
+(define (serve-script selector arguments config)
+ (let ((filename (make-pathname (config-root-dir config) selector)))
+ (if (legal-script-filename? filename config)
+ (let* ((sexp (with-input-from-file filename read))
+ (script-result (with-selector-dir
+ selector config
+ (lambda ()
+ (apply (eval sexp) arguments)))))
+ (when (pair? script-result)
+ (serve-records script-result
+ (pathname-directory selector) config)
+ (print ".\r")))
+ (error "No legal index script not found." filename))))