-adapt calls of make-error-response

-allow header in 405 answers
-answer 501, not 405, for unimplemented/unrecognized methods
This commit is contained in:
vibr 2004-08-11 14:51:51 +00:00
parent 5f64e72cd0
commit 880a05229c
4 changed files with 27 additions and 11 deletions

View File

@ -259,9 +259,11 @@
(else (make-error-response (status-code forbidden) req)))))
(else
((string=? request-method "POST")
(make-error-response (status-code method-not-allowed) req
request-method))))))
"GET, HEAD"))
(else
(make-error-response (status-code not-implemented) req))))))
(define (directory-index-serve-response fname file-path req options)
(file-serve-response (string-append fname "index.html") file-path req options))
@ -445,9 +447,12 @@
(let ((n-files (directory-index req fname port options)))
(emit-tag port 'hr)
(format port "~d files" n-files))))))))))))
(else
(make-error-response (status-code method-not-allowed) req
request-method)))))
((string=? request-method "POST")
(make-error-response (status-code method-not-allowed) req
"GET, HEAD"))
(else
(make-error-response (status-code not-implemented) req)))))
(define (index-or-directory-serve-response fname file-path req options)
(let ((index-fname (string-append fname "index.html")))

View File

@ -172,10 +172,12 @@
out))
(with-tag out address ()
(write-string address out)))))))
(else
((or (string=? request-method "HEAD")
(string=? request-method "POST"))
(make-error-response (status-code method-not-allowed) req
request-method)))))))
"GET"))
(else
(make-error-response (status-code not-implemented) req)))))))
(define split-header-line
(let ((split (infix-splitter (make-regexp "(, *)|( +)|( *\t *)")))

View File

@ -70,9 +70,13 @@
(with-tag out address ()
(display address out)))))))
(else
((or (string=? request-method "HEAD")
(string=? request-method "POST"))
(make-error-response (status-code method-not-allowed) req
request-method)))))))
"GET"))
(else
(make-error-response (status-code not-implemented) req)))))))
(define (cat-man-page key section out)
(let ((title (if section

View File

@ -38,8 +38,13 @@
(cond
((string=? request-method "POST") ; Could do others also.
(seval path req))
((or (string=? request-method "HEAD")
(string=? request-method "GET"))
(make-error-response (status-code method-not-allowed) req
"POST"))
(else
(make-error-response (status-code method-not-allowed) req request-method)))))
(make-error-response (status-code not-implemented) req)))))
(define (seval path req)
(make-response