Introduce new response type :HTTP-NPH-RESPONSE for nph-... CGI
scripts.
This commit is contained in:
parent
da98e19193
commit
9dac2674b4
|
@ -170,12 +170,15 @@
|
|||
(let ((response ((httpd-options-request-handler options)
|
||||
(http-url-path (request-url req))
|
||||
req)))
|
||||
(if (eq? (response-code response)
|
||||
(status-code redirect))
|
||||
(redirect-loop (redirect-request req response sock options))
|
||||
(values req response))))))))
|
||||
(cond
|
||||
((nph-response? response)
|
||||
(values req response))
|
||||
((eq? (response-code response) (status-code redirect))
|
||||
(redirect-loop (redirect-request req response sock options)))
|
||||
(else
|
||||
(values req response)))))))))
|
||||
(lambda (req response)
|
||||
|
||||
|
||||
(send-http-response req response
|
||||
(socket:inport sock)
|
||||
(socket:outport sock)
|
||||
|
@ -332,21 +335,23 @@
|
|||
(write-crlf port))
|
||||
|
||||
(define (send-http-response request response input-port output-port options)
|
||||
|
||||
(if request
|
||||
(begin
|
||||
(if (not (v0.9-request? request))
|
||||
(send-http-headers response output-port))
|
||||
|
||||
(if (not (string=? (request-method request) "HEAD"))
|
||||
(display-http-body (response-body response) input-port output-port options))
|
||||
|
||||
(http-log request (response-code response)))
|
||||
(begin
|
||||
;; We have a bad request error. Try to report this headerless.
|
||||
(display-http-body (response-body response) input-port output-port options)
|
||||
;; no CLF-logging
|
||||
)))
|
||||
(cond
|
||||
((not request)
|
||||
;; We have a bad request error. Try to report this headerless.
|
||||
(display-http-body (response-body response) input-port output-port options)
|
||||
;; no CLF-logging
|
||||
)
|
||||
((nph-response? response)
|
||||
(display-http-body (nph-response-body response) input-port output-port options)
|
||||
(http-log request (response-code response)))
|
||||
(else
|
||||
(if (not (v0.9-request? request))
|
||||
(send-http-headers response output-port))
|
||||
|
||||
(if (not (string=? (request-method request) "HEAD"))
|
||||
(display-http-body (response-body response) input-port output-port options))
|
||||
|
||||
(http-log request (response-code response)))))
|
||||
|
||||
(define (send-http-header-fields headers port)
|
||||
(for-each (lambda (pair)
|
||||
|
|
|
@ -15,6 +15,15 @@
|
|||
(extras response-extras)
|
||||
(body response-body))
|
||||
|
||||
;; This is mainly for nph-... CGI scripts.
|
||||
;; This means that the body will output the entire MIME message, not
|
||||
;; just the part after the headers.
|
||||
|
||||
(define-record-type http-nph-response :http-nph-response
|
||||
(make-nph-response body)
|
||||
nph-response?
|
||||
(body nph-response-body))
|
||||
|
||||
(define-record-type http-writer-body :http-writer-body
|
||||
(make-writer-body proc)
|
||||
writer-body?
|
||||
|
|
|
@ -273,6 +273,9 @@
|
|||
response-extras
|
||||
response-body
|
||||
|
||||
make-nph-response nph-response?
|
||||
nph-response-body
|
||||
|
||||
make-writer-body writer-body?
|
||||
make-reader-writer-body reader-writer-body?
|
||||
make-redirect-body redirect-body? redirect-body-location
|
||||
|
|
Loading…
Reference in New Issue