ib-TTP

From WiredWiki
Jump to navigationJump to search
ib-TTP

Ib logo.png

  1. Persistent Transmission
  2. Transactional Transmission
  3. Polling Retrieval
  4. Polling Syndication
  5. Aggregation
  6. Ident–Auth

The internetworked binary Transactional Transmission Protocol, or ib-TTP for short, is the second subprotocol of the internetworked binary master protocol. It provides one-and-done-style transactional bidirectional transmission of data between endpoints on a network such as the Worldwide Web, much like the original designs of HTTP, FTP and more.

Model

Like HTTP, ib-TTP has a client-server model where the client sends a request and the server responds with a response.

A request is laid out like so:

Size Name Explanation
4 flags Flags bitfield. See below for layout.
20 hash SHA-1 checksum of previous data. Only present if flags.form is delta.
8 range_a First bound of the request payload range. Only present if flags.form is ranged.
8 range_b Second bound of the request payload range. Only present if flags.form is ranged.
4 authctx_ct Number of authorisation contexts provided minus 1. Only present if flags.authed is 1.
4 uri_sz Size of the request URI, denoted in octets.
8 payload_sz Size of request payload, denoted in octets. Only present if flags.payload is 1.
varies authctxs Authorisation contexts of the client's request. Only present if code.authed is 1.
varies uri URI of resource being requested, excluding the protocol portion (e.g. http:). Example: //example.com/hello.jpeg. The encoding must be UTF-8.
varies payload Payload contents. Only present if flags.payload is 1.
Bit Name Explanation
0-2 method Request method. (0=GET, 1=HEAD, 2=POST, 3=PUT, 4=PATCH, 5=DELETE, 6=OPTIONS, 7=TRACE)
3-4 form What form the response is being requested in. (0=normal, 1=delta, 2=ranged, 3=test)
6 authed Whether any authorisation contexts (credentials and/or behalves) have been sent as part of the request. At least one context must be sent for a request to be considered "authed".
7 payload Whether the request has a payload or not.
8-31 reserved Reserved. Must be zero.

Status codes

ib-TTP also has a grouped collection of status codes similar in function to the numeric status codes of HTTP. However, ib-TTP status codes are constrained into an 8-bit integer and are conventionally represented in octal. This is done since the 8-bit number is divided into 4 groups of 64 codes each according to the type of status code, causing the greatest digit to typify the response code at a glance.

Code Explanation
0o0XX Successful codes
0o1XX Neutral codes (includes redirects)
0o2XX Negative/failure codes, client is at fault
0o3XX Negative/failure codes, server is at fault

Successful codes

Code Name Description HTTP equiv.
0o000 OK The request was successful. 200
0o001 No content The response header may be informative, but no response body was given. 204
0o002 Partial content Returned upon requests invoking the range field to request a certain part of a resource. 206
0o003 Created The request succeeded, and a new resource was created as a result. 201
0o004 Accepted The request has been received but not yet acted upon. 202
0o005 Non-Authoritative OK The response is not necessarily the same as is available from the origin server, but is collected from a local or a third-party copy. 203
0o006 Reset content Tells the client to reset the context from which they made the request. 205

Neutral codes

Code Name Description HTTP equiv.
0o100 Continue An informational code telling the client to carry on with the request, or ignore this response if the request is finished. 100
0o101 Switch protocols Used in response to the upgrade field of a request. 101
0o102 Processing Server has received the request but does not yet have a response ready. 102
0o103 Further hints To be used with the link response field, giving the client URIs to load resources from before the server sends its response. 103
0o104 Multiple choice The request has more than one possible response, and the client must choose which one it wants. 300
0o105 Moved The requested resource was moved to a new location. Strictly speaking this has the same semantics as HTTP 307 Moved Temporarily, as ib-TTP has no semantics for permanent moves. 301, 307
0o106 Strictly moved This is the same as 0o105, except that the request method must be kept the same, i.e. a POST request made to URI A that returns 0o106 must cause a POST request to the URI it points to. 308
0o107 Not modified This is used for caching purposes. It tells the client that the response has not been modified, so the client can continue to use the same cached version of the response. 304

Negative/failure codes, client

Code Name Description HTTP equiv.
0o200 Bad request The server could not understand the request due to invalid syntax. 400
0o201 Unauthenticated The client must first authenticate to proceed with their request. 401
0o202 Forbidden The client does not have access rights to view the given resource. 403
0o203 Not found No resource was found at the location the client specified. 404
0o204 Wrong method The request method is known by the server but is not supported by the target resource. For example, an API may not allow calling DELETE to remove a resource. 405
0o205 Unacceptable This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content that conforms to the criteria given by the user agent. 406
0o206 Timeout This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. 408
0o207 Conflict This response is sent when a request conflicts with the current state of the server. You do realise this means war? 409
0o210 Length needed Server rejected the request because the length request field is not defined and the server requires it. 411
0o211 Requirement failed The client has indicated requirements in its request header which the server does not meet. 412
0o212 Payload too large Request entity is larger than limits defined by server. 413
0o213 Headers too large The server is unwilling to process the request because its header fields are too large. 431
0o214 URI too long The URI requested by the client is longer than the server is willing to interpret. 414
0o215 Unsupported content format The format of the requested data is not supported by the server, so the server is rejecting the request. 415
0o216 Range out-of-bounds The range specified in the request cannot be fulfilled. It is often likely that the range is outside the size of the target URI's data. 416
0o217 Upgrade needed The server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. 426
0o220 Requirement needed The origin server requires the request to be conditional. This response is intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. 428
0o221 Too many requests The user has sent too many requests in a given amount of time. This is also known as "rate limiting". 429
0o222 Unavailable for legal reasons The user agent requested a resource that cannot legally be provided, such as a web page censored by a government. 451

Negative/failure codes, server

Code Name Description HTTP equiv.
0o300 Internal error The server has encountered a situation it does not know how to handle. 500
0o301 Unimplemented The request method is not supported by the server and cannot be handled. 501
0o302 Bad gateway This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response. 502
0o303 Service unavailable The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. 503
0o304 Gateway timeout This error response is given when the server is acting as a gateway and cannot get a response in time. 504
0o305 Protocol version unsupported The protocol version specified in the request is too new for the server to handle. 505
0o306 Loop detected The server detected an infinite loop while processing the request. 508