Common Text-based Response Protocol

From secondtruthLabs Wiki
Jump to navigation Jump to search
Common Text-based Response Protocol
Developer secondtruthLabs
Status Stable
First published 2025
Latest version 1.0
Transport TCP
Encoding UTF-8
License Public Domain


The Common Text-based Response Protocol (CTRP) is a foundation protocol for building lightweight, text-based application protocols over TCP. Developed by secondtruthLabs, it defines common conventions for simple request-response communication patterns.

Overview[edit | edit source]

CTRP serves as a base layer upon which application-specific protocols can be built. Rather than defining a complete application protocol itself, CTRP establishes conventions for message formatting, status codes, and connection handling that derived protocols inherit and extend.

Design philosophy[edit | edit source]

CTRP follows a minimalist approach inspired by classic internet protocols like Finger and Gopher. Key principles include:

  • Simple enough to implement in a weekend
  • Consistent patterns across derived protocols
  • Optimized for text content delivery
  • Minimal overhead

Technical specification[edit | edit source]

Request format[edit | edit source]

Requests consist of a single line terminated by CRLF (\r\n):


Basic request format
{{{code}}}


The maximum request line length is 1024 bytes.

Response format[edit | edit source]

Responses begin with a status line, followed by optional content:


Response format
{{{code}}}


Content is terminated by a line containing only a period (.).

Status codes[edit | edit source]

CTRP uses a hierarchical status code system:

Range Category Description
1x Informational Request received, continuing process
2x Success Request successfully processed
3x Redirection Further action needed
4x Client Error Request contains bad syntax or cannot be fulfilled
5x Server Error Server failed to fulfill valid request
6x Service Error Service-level issues

Common status codes:

Code Message Meaning
20 OK Success
21 OK+MORE Success, more content available
40 BAD REQUEST Malformed request
41 NOT FOUND Requested resource not found
42 FORBIDDEN Access denied
50 ERROR General server error
51 NOT IMPLEMENTED Command not supported

Encoding[edit | edit source]

All CTRP communication uses UTF-8 encoding with CRLF line endings. This ensures consistent handling across platforms while supporting international character sets.

Transport security[edit | edit source]

CTRP supports optional TLS encryption. Implementations typically offer both plain TCP and TLS-secured connections on separate ports.

Derived protocols[edit | edit source]

The following protocols are built on CTRP:

See also[edit | edit source]

References[edit | edit source]


External links[edit | edit source]