An activity diagram to describe the resolution of HTTP response status codes, given various headers, implemented via semantical callbacks.
And it goes on Twitter as #httpdd - HTTP Decision Diagram.
The diagram follows the indications in RFC7230 RFC7231 RFC7232 RFC7233 RFC7234 RFC7235, and fills in the void where necessary. Under no circumstances does this diagram override the HTTP specifications. If it does, please file an issue as soon as possible.
- PNG (export)
- Omnigraffle (source)
- Size: A0 - 84.1 x 59.4 cm
- Grid size: 0.5
- Dot density: 96 dpi
- JSON (export)
- Cosmogol (source)
- Internet Draft - Cosmogol: a language to describe finite state machines
The decision diagram is split into standalone color-coded blocks
- System (white)
- Request (blue)
- Accept (green)
- Retrieve (white)
- Precondition (yellow)
- Create/Process
- Response (cyan)
- Alternative (gray)
NOTE All variables referenced below may have specific variances from the under_score notation - camelCase, PascalCase, etc. - when implemented.
The decision diagram makes use of different types of callbacks to get request or resource specific information. Regardless of the type though, each callback MUST
- have read-write access to 2 variables:
Transaction
andContext
- refrain from doing more/less than what the decision block states
- have pertinent defaults
Transaction
MUST be a key-value structure, initialized when receiving the request, with the following keys:
request
=version
= HTTP version e.g. '1.1'method
= Uppercase HTTP methodscheme
= Lowercase scheme e.g. 'http'host
=source
= Original host e.g. 'example.com:8080'hostname
= Lowercase hostname e.g. 'example.com'port
= e.g. '8080'
target
= Key-value of request URI partspath
= e.g. '/p/a/t/h'query
= e.g. '?query=string'
headers
= Key-value of lowercase header names and their valuesaccept
=accept-language
=accept-charset
=accept-encoding
=content-type
=content-length
=
representation
=h
= Key-value of lowercase header names and their data structures/classes/modules/helpersaccept
= AcceptHeadercontent-encoding
= ContentEncodingHeadercontent-type
= ContentTypeHeadercontent-language
= ContentLanguageHeaderexpect
= ExpectHeaderif-match
= IfMatchHeaderif-modified-since
= IfUnmodifiedSinceHeaderif-none-match
= IfNoneMatchHeaderif-unmodified-since
= IfModifiedSinceHeader
response
=status
=headers
=representation
=h
=allow
= AllowHeadercontent-encoding
= ContentEncodingHeadercontent-type
= ContentTypeHeadercontent-language
= ContentLanguageHeadercontent-location
= ContentLocationHeader
content
= Key-value pairs of content headers and their chosen values (initially during the accept phase, and optionally modified afterwards)type
=language
=charset
=encoding
=
error
=described-by
=support-id
=title
=detail
=
log
=transitions
= Arrayfrom
=to
=
callbacks
= Arraystate
=callback
=result
=
Context MUST be whatever the resource developer desires. It MUST be irrelevant to the decision flow. For the sake of clarity though, in this documentation you may find these references:
request
=entity
=
response
=entity
=
error
=entity
=
Some callbacks MUST be built-in by the system, and thus they are not explicitly marked on the diagram. They are not specific to the resource or the request and they are an implementation of HTTP-specific logic.
Resource logic is coded in these callbacks as an answer to binary questions - TRUE or FALSE. These callbacks have the power to end the decision flow early.
Resource logic is coded in these callbacks as variable values. Each callback defines the type that it handles, and returning an unexpected type or value will yield 500 Internal Server Error. These callbacks do NOT have the power to end the decision flow early.