This protocol proposal is a copy and use of HTTP protocol, but changing rules of use to reduce data transfer and use custom messages. The client and server may be not process or send headers or body.
Request
To make a request to host is needle:
- The client shall to send a method.
- The client shall to send a resource.
- The client shall to send the version of HTTP protocol.
- The client may be not send a headers.
- The client may be not send a body.
method " " resource " " protocol-version "rnrn"
Method
Same rules of HTTP, else:
- All HTTP methods, according HTTP defined protocol, shall be recognized by host.
- Custom methods may be recognized by host.
- The host may be not accept specific method. In this situation, the response shall be 405, like normal HTTP behavior.
Resource
Same rules of HTTP. Any URL defined by host.
Protocol Version
The client may be send any HTTP protocol version, using same rules of HTTP protocol.
Responses
For all responses to clients from server is needle:
- The server shall be process the method.
- The server shall be process the resource.
- The server shall be process the protocol version.
- The server shall be send a protocol version.
- The server shall be send a response code.
- The server shall be send a response message.
- The server shall be send a standardized HTTP response codes and messages, according defined protocol.
- The server may be send a custom response code.
- The server may be send a custom response message.
- The server may be not a send headers.
- The server may be not a send body.
- The server may be not process a headers and body sent.
- The client may be not process a headers and body received.
protocol-version " " response-code " " response-message "rnrn"
Version
Same rules of request
Response Code
- Same rules of HTTP.
- Custom codes allowed.
Response Message
- Same rules of HTTP.
- Custom messages allowed.
protocol version | " " | response code | " " | response message | "rnrn" |
Examples
Simple request to root resource
GET / HTTP/1.1
HTTP/1.1 200 OK
Ping server
GET / HTTP/1.1
HTTP/1.1 200 OK