syndicate-protocols/schemas/http.prs

70 lines
2.2 KiB
Plaintext
Raw Normal View History

2022-12-13 05:08:34 +00:00
version 1 .
# Assertion in driver DS
# Causes creation of server and route
2024-02-05 22:14:19 +00:00
HttpBinding = <http-bind @host HostPattern @port int @method MethodPattern @path PathPattern @handler #:HttpRequest> .
2022-12-13 05:08:34 +00:00
# Assertion in driver DS
# Describes active server and route
2022-12-13 05:08:34 +00:00
HttpService = <http-service @host HostPattern @port int @method MethodPattern @path PathPattern> .
# Assertion in driver DS
# Describes active listener
2022-12-13 05:08:34 +00:00
HttpListener = <http-listener @port int> .
HostPattern = @host string / @any #f .
PathPattern = [PathPatternElement ...] .
PathPatternElement = @label string / @wildcard =_ / @rest =... .
MethodPattern = @any #f / @specific @"Lowercase" symbol .
# Assertion in driver DS
2022-12-13 05:08:34 +00:00
HttpRequest = <http-request
@sequenceNumber int
@host RequestHost
2022-12-13 05:08:34 +00:00
@port int
@method @"Lowercase" symbol
@path [string ...]
@headers Headers
@query {symbol: [QueryValue ...] ...:...}
@body RequestBody> .
Headers = {@"Lowercase" symbol: string ...:...} .
QueryValue = @string string / <file @filename string @headers Headers @body bytes> .
RequestBody = @present bytes / @absent #f .
RequestHost = @present string / @absent #f .
2022-12-13 05:08:34 +00:00
# Assertion to handler entity
2024-02-05 22:14:19 +00:00
HttpContext = <request @req HttpRequest @res #:HttpResponse> .
2022-12-13 05:08:34 +00:00
2024-04-10 12:31:27 +00:00
# HttpResponse protocol. Delivered to the `res` ref in `HttpContext`.
#
# Use of `processing` is optional, so the flow is either:
#
# +processing . (status | header)* . chunk* . done? . -processing
#
# or
#
# (status | header)* . chunk* . done
#
# Done triggers completion of the response and retraction of the frame by the peer, whether
# `processing` is used or not. In addition, if `processing` is used, its retraction triggers
# completion and termination. If `processing` is retracted before `status` is delivered, the
# response is considered a 500.
#
2022-12-13 05:08:34 +00:00
@<TODO "trailers?">
HttpResponse =
2024-04-10 12:31:27 +00:00
# Assertion - frames the response.
2024-04-01 13:56:07 +00:00
/ <processing>
2024-04-10 12:31:27 +00:00
# Remainder are messages.
2022-12-13 05:08:34 +00:00
/ <status @code int @message string>
/ <header @name symbol @value string>
2024-04-10 12:31:27 +00:00
/ <chunk @chunk Chunk>
/ <done @chunk Chunk>
2022-12-13 05:08:34 +00:00
.
Chunk = @string string / @bytes bytes .
# e.g. text/plain, text/html, application/json
2022-12-13 05:08:34 +00:00
MimeType = symbol .