Add documentation for lots of the "undocumented" bits
All checks were successful
/ test (push) Successful in 6s
All checks were successful
/ test (push) Successful in 6s
In the Guile Documenta generated documentation.
This commit is contained in:
parent
d282841a78
commit
d0ff89023b
8 changed files with 140 additions and 5 deletions
|
|
@ -141,23 +141,29 @@ closes PORT, unless KEEP-ALIVE? is true."
|
|||
|
||||
(define request-body-ended-prematurely-error?
|
||||
(exception-predicate &request-body-ended-prematurely))
|
||||
(set-procedure-property! request-body-ended-prematurely-error? 'documentation
|
||||
"Return @code{#t} if OBJ is a @code{&request-body-ended-prematurely} exception.")
|
||||
|
||||
(define (request-body-port/knots r)
|
||||
(define (request-body-port/knots request)
|
||||
"Return an input port for reading the body of request REQUEST.
|
||||
Handles chunked transfer encoding."
|
||||
(cond
|
||||
((member '(chunked) (request-transfer-encoding r))
|
||||
(make-chunked-input-port (request-port r)
|
||||
((member '(chunked) (request-transfer-encoding request))
|
||||
(make-chunked-input-port (request-port request)
|
||||
#:keep-alive? #t))
|
||||
(else
|
||||
(let ((content-length
|
||||
(request-content-length r)))
|
||||
(request-content-length request)))
|
||||
(make-delimited-input-port
|
||||
(request-port r)
|
||||
(request-port request)
|
||||
content-length
|
||||
(lambda (bytes-read)
|
||||
(raise-exception
|
||||
(make-request-body-ended-prematurely-error bytes-read))))))))
|
||||
|
||||
(define (read-request-body/knots r)
|
||||
"Read and return the full body of request R as a bytevector.
|
||||
Handles chunked transfer encoding."
|
||||
(cond
|
||||
((member '(chunked) (request-transfer-encoding r))
|
||||
(get-bytevector-all
|
||||
|
|
@ -299,6 +305,8 @@ on the procedure being called at any particular time."
|
|||
#f)
|
||||
|
||||
(define (default-write-response-exception-handler exn request)
|
||||
"Default handler for exceptions raised while writing an HTTP response.
|
||||
Logs the error for REQUEST to the current error port."
|
||||
(if (and (exception-with-origin? exn)
|
||||
(string=? (exception-origin exn)
|
||||
"fport_write"))
|
||||
|
|
@ -528,6 +536,18 @@ on the procedure being called at any particular time."
|
|||
web-server?
|
||||
(socket web-server-socket)
|
||||
(port web-server-port))
|
||||
(set-procedure-property!
|
||||
(macro-transformer (module-ref (current-module) 'web-server?))
|
||||
'documentation
|
||||
"Return @code{#t} if OBJ is a @code{<web-server>}.")
|
||||
(set-procedure-property!
|
||||
(macro-transformer (module-ref (current-module) 'web-server-socket))
|
||||
'documentation
|
||||
"Return the socket of the web server.")
|
||||
(set-procedure-property!
|
||||
(macro-transformer (module-ref (current-module) 'web-server-port))
|
||||
'documentation
|
||||
"Return the port number of the web server.")
|
||||
|
||||
(define* (run-knots-web-server handler #:key
|
||||
(host #f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue