From: Chris Hanson Date: Tue, 16 Sep 2008 05:39:00 +0000 (+0000) Subject: Fix WRITE-HTTP-REQUEST to handle weird URI variants. X-Git-Tag: 20090517-FFI~147 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6e0706f9a9bab0ed17aeee5b7087a53ec872642e;p=mit-scheme.git Fix WRITE-HTTP-REQUEST to handle weird URI variants. --- diff --git a/v7/src/runtime/httpio.scm b/v7/src/runtime/httpio.scm index 00bfe7401..4e2917c5d 100644 --- a/v7/src/runtime/httpio.scm +++ b/v7/src/runtime/httpio.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: httpio.scm,v 14.7 2008/09/15 05:15:17 cph Exp $ +$Id: httpio.scm,v 14.8 2008/09/16 05:39:00 cph Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -128,8 +128,7 @@ USA. (define (http-request-uri? object) (or (simple-http-request-uri? object) (absolute-uri? object) - (and (string? object) - (string=? object "*")) + (eq? object '*) (uri-authority? object))) (define-guarantee http-request-uri "HTTP URI") @@ -156,7 +155,15 @@ USA. (%text-mode port) (write-http-token (http-request-method request) port) (write-string " " port) - (write-uri (http-request-uri request) port) + (let ((uri (http-request-uri request))) + (cond ((uri? uri) + (write-uri uri port)) + ((uri-authority? uri) + (write-uri-authority uri port)) + ((eq? uri '*) + (write-char #\* port)) + (else + (error "Ill-formed HTTP request:" request)))) (if (http-request-version request) (begin (write-string " " port) @@ -272,7 +279,7 @@ USA. (seq (map string->symbol (match (+ (char-set char-set:http-token)))) " " - (alt (match "*") + (alt (map intern (match "*")) parse-absolute-uri parse-uri-path-absolute parse-uri-authority)