Added `server-product-info' to provide the information for the Server
response-header. Rewrote error handling code to provide more information in the body. Adjust `read-request' to pass the connection to `parse-request', see changes in messages.cl.
This commit is contained in:
@ -112,6 +112,16 @@ connection."))
|
|||||||
condition))))
|
condition))))
|
||||||
,@body)))))
|
,@body)))))
|
||||||
|
|
||||||
|
(defgeneric server-product-info (server)
|
||||||
|
(:documentation
|
||||||
|
"Return a list of Product-Info strings suitable for the HTTP
|
||||||
|
Server Response-Header."))
|
||||||
|
|
||||||
|
(defmethod server-product-info (server)
|
||||||
|
(declare (ignore server))
|
||||||
|
;; Default for people to lazy to adjust
|
||||||
|
'("CLASH/1.0"))
|
||||||
|
|
||||||
;;; Simple Server
|
;;; Simple Server
|
||||||
|
|
||||||
(defclass simple-http-server (http-server)
|
(defclass simple-http-server (http-server)
|
||||||
@ -125,7 +135,7 @@ connection."))
|
|||||||
(close-connection connection))
|
(close-connection connection))
|
||||||
|
|
||||||
(defmethod read-request ((server simple-http-server) connection)
|
(defmethod read-request ((server simple-http-server) connection)
|
||||||
(parse-request server (connection-stream connection)))
|
(parse-request server connection))
|
||||||
|
|
||||||
(defmethod serve-request ((server simple-http-server) request)
|
(defmethod serve-request ((server simple-http-server) request)
|
||||||
(let ((resource (namespace-lookup-url (http-server-namespace server)
|
(let ((resource (namespace-lookup-url (http-server-namespace server)
|
||||||
@ -221,11 +231,10 @@ connection."))
|
|||||||
(apply #'make-instance
|
(apply #'make-instance
|
||||||
'string-entity
|
'string-entity
|
||||||
:body
|
:body
|
||||||
(format nil "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">~%<HTML><HEAD>~%<TITLE>~D ~A</TITLE>~%</HEAD>~%<BODY>~%<H1>~A</H1>~%<P>~A</P>~%</BODY></HTML>"
|
(format nil "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">~%<HTML><HEAD>~%<TITLE>~3D ~A</TITLE>~%</HEAD>~%<BODY>~%<H1>~2:*~3D ~A</H1>~%<PRE>~%~A~%</PRE>~%</BODY></HTML>"
|
||||||
(clash-error-code condition)
|
(clash-error-code condition)
|
||||||
(HTTP-Code-Description (clash-error-code condition))
|
(HTTP-Code-Description (clash-error-code condition))
|
||||||
(HTTP-Code-Description (clash-error-code condition))
|
condition)
|
||||||
(HTTP-Code-Description (clash-error-code condition)))
|
|
||||||
(clash-error-entity-initargs condition))
|
(clash-error-entity-initargs condition))
|
||||||
(clash-error-response-initargs condition)))
|
(clash-error-response-initargs condition)))
|
||||||
(error
|
(error
|
||||||
|
|||||||
Reference in New Issue
Block a user