#| -*-Scheme-*-
-$Id: httpio.scm,v 14.2 2008/08/25 08:23:32 cph Exp $
+$Id: httpio.scm,v 14.3 2008/08/25 08:48:16 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(guarantee-string body 'MAKE-SIMPLE-HTTP-RESPONSE)
(%make-http-response #f 200 (http-status-description 200) '() body))
-(define (http-entity? object)
+(define (http-message? object)
(or (http-request? object)
(http-response? object)))
-(define-guarantee http-entity "HTTP entity")
+(define-guarantee http-message "HTTP message")
-(define (http-entity-headers entity)
- (cond ((http-request? entity) (http-request-headers entity))
- ((http-response? entity) (http-response-headers entity))
- (else (error:not-http-entity entity 'HTTP-ENTITY-HEADERS))))
+(define (http-message-headers message)
+ (cond ((http-request? message) (http-request-headers message))
+ ((http-response? message) (http-response-headers message))
+ (else (error:not-http-message message 'HTTP-MESSAGE-HEADERS))))
-(define (http-entity-body entity)
- (cond ((http-request? entity) (http-request-body entity))
- ((http-response? entity) (http-response-body entity))
- (else (error:not-http-entity entity 'HTTP-ENTITY-BODY))))
+(define (http-message-body message)
+ (cond ((http-request? message) (http-request-body message))
+ ((http-response? message) (http-response-body message))
+ (else (error:not-http-message message 'HTTP-MESSAGE-BODY))))
(define (http-token? object)
(and (interned-symbol? object)
(if (> n 0)
(let ((m (read-string! buffer port)))
(if (= m 0)
- (error "Premature EOF in HTTP entity body."))
+ (error "Premature EOF in HTTP message body."))
(write-substring buffer 0 m output)
(loop (- n m))))))))))))
(%read-all port)))
(define (%no-read-body)
- (error "Unable to determine HTTP entity body length."))
+ (error "Unable to determine HTTP message body length."))
\f
;;;; Syntax
(= status 204)
(= status 304)))
\f
-(define (http-entity-body-port entity)
- (let ((port (open-input-octets (http-entity-body entity))))
- (receive (type coding) (http-content-type entity)
+(define (http-message-body-port message)
+ (let ((port (open-input-octets (http-message-body message))))
+ (receive (type coding) (http-content-type message)
(cond ((eq? (mime-type/top-level type) 'TEXT)
(port/set-coding port (or coding 'TEXT))
(port/set-line-ending port 'TEXT))
(port/set-line-ending port 'BINARY))))
port))
-(define (http-content-type entity)
- (let ((h (first-http-header 'CONTENT-TYPE entity)))
+(define (http-content-type message)
+ (let ((h (first-http-header 'CONTENT-TYPE message)))
(if h
(let ((s (rfc2822-header-value h)))
(let ((v (*parse-string parser:http-content-type s)))
(encapsulate vector->list
(* parse-parameter))))))
-(define (http-content-length entity)
- (%get-content-length (http-entity-headers entity)))
+(define (http-content-length message)
+ (%get-content-length (http-message-headers message)))
-(define (first-http-header name entity)
- (first-rfc2822-header name (http-entity-headers entity)))
+(define (first-http-header name message)
+ (first-rfc2822-header name (http-message-headers message)))
-(define (all-http-headers name entity)
- (all-rfc2822-headers name (http-entity-headers entity)))
\ No newline at end of file
+(define (all-http-headers name message)
+ (all-rfc2822-headers name (http-message-headers message)))
\ No newline at end of file
#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.661 2008/08/25 08:37:35 cph Exp $
+$Id: runtime.pkg,v 14.662 2008/08/25 08:48:19 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(parent (runtime))
(export ()
all-http-headers
- error:not-http-entity
+ error:not-http-message
error:not-http-header
error:not-http-request
error:not-http-response
error:not-simple-http-response
error:not-simple-http-uri
first-http-header
- guarantee-http-entity
+ guarantee-http-message
guarantee-http-header
guarantee-http-request
guarantee-http-response
guarantee-simple-http-uri
http-content-length
http-content-type
- http-entity-body
- http-entity-body-port
- http-entity-headers
- http-entity?
+ http-message-body
+ http-message-body-port
+ http-message-headers
+ http-message?
http-header?
http-request-body
http-request-headers
#| -*-Scheme-*-
-$Id: xml-rpc.scm,v 1.12 2008/08/24 07:21:03 cph Exp $
+$Id: xml-rpc.scm,v 1.13 2008/08/25 08:48:33 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(xml->octets (->request request 'XML-RPC)))))
(if (not (= 200 (http-response-status response)))
(error "HTTP error:" (http-response-reason response)))
- (xml-rpc:parse-response (read-xml (http-entity-body-port response)))))
+ (xml-rpc:parse-response (read-xml (http-message-body-port response)))))
(define (->request request caller)
(cond ((or (xml-document? request)