From bc1cfd9f759a7b966ab27256dba6de2dd7bb221f Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 29 Jul 2012 22:26:31 +1200 Subject: [PATCH] Docs. --- libpathod/templates/docs_pathod.html | 99 ++++++++++++++++++++-------- 1 file changed, 71 insertions(+), 28 deletions(-) diff --git a/libpathod/templates/docs_pathod.html b/libpathod/templates/docs_pathod.html index a135da956..194fe4739 100644 --- a/libpathod/templates/docs_pathod.html +++ b/libpathod/templates/docs_pathod.html @@ -8,28 +8,87 @@ -

At pathod's heart is a small, terse language for crafting HTTP responses, -designed to be easy to specify in a request URL. The simplest way to use -pathod is to fire up the daemon, and specify the response behaviour you -want using this language in the request URL. Here's a minimal example:

+

Pathod is a pathological HTTP daemon, designed to let you craft arbitrarily +malevolent HTTP responses. It lets you thoroughly exercise the failure modes of +HTTP clients by creatively violating the standards. HTTP responses are +specified using a small, terse language, which +pathod shares with its evil twin pathoc.

-
http://localhost:9999/p/200
-

Everything after the "/p/" path component is a response specifier - in this -case just a vanilla 200 OK response. See the docs below to get (much) fancier. +

+ + +

To start playing with pathod, simply fire up the daemon:

+ +
./pathod
+ +

By default, the service listens on port 9999 of localhost. Pathod's +documentation is self-hosting, and the pathod daemon exposes an interface that +lets you play with the specifciation language, preview what responses and +requests would look like on the wire, and view internal logs. To access all of +this, just fire up your browser, and point it to the following URL:

+ +
http://localhost:9999
+ +

The default crafting anchor point is the path /p/. Anything after +this URL prefix is treated as a response specifier. Hitting the following URL +will generate an HTTP 200 response with 100 bytes of random data:

+ +
http://localhost:9999/p/200:b@100
+ +

See the language documentation to get (much) +fancier. The pathod daemon also takes a number of configuration options. To +view those, use the command-line help:

+ +
./pathod --help
+ + +
+ + +
+ + You can also add anchors to the pathod server that serve a fixed response whenever a matching URL is requested:

-
pathod -a "/foo=200"
+
./pathod -a "/foo=200"

Here, "/foo" a regex specifying the anchor path, and the part after the "=" is a response specifier.

-

pathod also has a nifty built-in web interface, which lets you play with -the language by previewing responses, exposes activity logs, online help and -various other goodies. Try it by visiting the server root:

+
+ + +
+ + + +
+ + +
+ + +

Pathod uses the non-standard 800 response code to indicate internal + errors, to distinguish them from crafted responses. For example, a request + to:

+ +
http://localhost:9999/p/foo
+ +

... will return an 800 response because "foo" is not a valid page + specifier.

+ +
-
http://localhost:9999
-
- - -

Pathod uses the non-standard 800 response code to indicate internal - errors, to distinguish them from crafted responses. For example, a request - to:

- -
http://localhost:9999/p/foo
- -

... will return an 800 response because "foo" is not a valid page - specifier.

- -
- {% endblock %}