#| -*-Scheme-*-
-$Id: httpio.scm,v 14.5 2008/08/27 03:59:47 cph Exp $
+$Id: httpio.scm,v 14.6 2008/08/27 04:58:09 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(define (make-http-request method uri version headers body)
(guarantee-http-token method 'MAKE-HTTP-REQUEST)
- (guarantee-http-uri uri 'MAKE-HTTP-REQUEST)
+ (guarantee-http-request-uri uri 'MAKE-HTTP-REQUEST)
(guarantee-http-version version 'MAKE-HTTP-REQUEST)
(receive (headers body)
(guarantee-headers&body headers body 'MAKE-HTTP-REQUEST)
(define-guarantee simple-http-request "simple HTTP request")
(define (make-simple-http-request uri)
- (guarantee-simple-http-uri uri 'MAKE-HTTP-REQUEST)
+ (guarantee-simple-http-request-uri uri 'MAKE-HTTP-REQUEST)
(%make-http-request '|GET| uri #f '() ""))
(define (simple-http-response? object)
(define-guarantee http-token "HTTP token")
-(define (http-uri? object)
- (or (absolute-uri? object)
- (simple-http-uri? object)))
+(define (http-request-uri? object)
+ (or (simple-http-request-uri? object)
+ (absolute-uri? object)
+ (and (string? object)
+ (string=? object "*"))
+ (uri-authority? object)))
-(define-guarantee http-uri "HTTP URI")
+(define-guarantee http-request-uri "HTTP URI")
-(define (simple-http-uri? object)
- (and (relative-uri? object)
+(define (simple-http-request-uri? object)
+ (and (uri? object)
+ (not (uri-scheme object))
(not (uri-authority object))
(uri-path-absolute? (uri-path object))))
-(define-guarantee simple-http-uri "simple HTTP URI")
+(define-guarantee simple-http-request-uri "simple HTTP URI")
\f
(define (http-version? object)
(and (pair? object)
(*parser
(seq "GET"
(noise match-wsp)
- parse-uri-no-authority)))
+ parse-uri-path-absolute)))
(define parse-request-line
(*parser
(seq (map string->symbol
- (match (+ (char-set char-set:http-token))))
+ parse-http-token)
(noise match-wsp)
- parse-uri-no-authority
+ (alt (match "*")
+ parse-absolute-uri
+ parse-uri-path-absolute
+ parse-uri-authority)
(noise match-wsp)
parse-version)))
+(define parse-http-token
+ (*parser (match (+ (char-set char-set:http-token)))))
+
(define parse-response-line
(*parser
(seq parse-version
#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.665 2008/08/26 08:33:35 cph Exp $
+$Id: runtime.pkg,v 14.666 2008/08/27 04:58:09 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
parse-partial-uri
parse-relative-uri
parse-uri
- parse-uri-no-authority
+ parse-uri-authority
+ parse-uri-path-absolute
partial-uri->string
partial-uri-authority
partial-uri-extra
error:not-http-message
error:not-http-header
error:not-http-request
+ error:not-http-request-uri
error:not-http-response
error:not-http-status
error:not-http-text
error:not-http-token
- error:not-http-uri
error:not-http-version
error:not-simple-http-request
+ error:not-simple-http-request-uri
error:not-simple-http-response
- error:not-simple-http-uri
first-http-header
guarantee-http-message
guarantee-http-header
guarantee-http-request
+ guarantee-http-request-uri
guarantee-http-response
guarantee-http-status
guarantee-http-text
guarantee-http-token
- guarantee-http-uri
guarantee-http-version
guarantee-simple-http-request
+ guarantee-simple-http-request-uri
guarantee-simple-http-response
- guarantee-simple-http-uri
http-content-length
http-content-type
http-message-body
http-status?
http-text?
http-token?
- http-uri?
+ http-request-uri?
http-version-major
http-version-minor
http-version:1.0
read-http-response
read-simple-http-request
read-simple-http-response
+ simple-http-request-uri?
simple-http-request?
simple-http-response?
- simple-http-uri?
write-http-request
write-http-response)
(initialization (initialize-package!)))
#| -*-Scheme-*-
-$Id: url.scm,v 1.55 2008/08/24 07:20:12 cph Exp $
+$Id: url.scm,v 1.56 2008/08/27 04:58:09 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(vector-ref v 3)
(vector-ref v 4)))
-(define parse-uri-no-authority
+(define parse-uri-path-absolute
(*parser
(encapsulate encapsulate-uri
(seq (values #f #f)
- parser:path-only))))
+ parser:path-absolute))))
\f
(define parser:uri
(*parser
(define parser:hier-part
(*parser
- (alt (seq "//" parser:authority parser:path-abempty)
- (seq (values #f) parser:path-absolute)
- (seq (values #f) parser:path-rootless)
- (seq (values #f) parser:path-empty))))
+ (alt (seq "//" parse-uri-authority parser:path-abempty)
+ (seq (values #f)
+ (alt parser:path-absolute
+ parser:path-rootless
+ parser:path-empty)))))
(define parser:uri-reference
(*parser
(define parser:relative-part
(*parser
- (alt (seq "//" parser:authority parser:path-abempty)
- (seq (values #f) parser:path-only))))
-
-(define parser:path-only
- (*parser
- (alt parser:path-absolute
- parser:path-noscheme
- parser:path-empty)))
+ (alt (seq "//" parse-uri-authority parser:path-abempty)
+ (seq (values #f)
+ (alt parser:path-absolute
+ parser:path-noscheme
+ parser:path-empty)))))
(define parser:scheme
(*parser
(seq (char-set char-set:uri-alpha)
(* (char-set char-set:uri-scheme)))))
-(define parser:authority
+(define parse-uri-authority
(*parser
(encapsulate (lambda (v)
(%make-uri-authority (vector-ref v 0)