From 179cc8dc1fd40fb44e8795af43ba6c4e22b22b0d Mon Sep 17 00:00:00 2001
From: Aldo Cortesi
Date: Mon, 4 May 2015 09:54:59 +1200
Subject: [PATCH] Split up language docs, document websocket code
specification.
---
libpathod/templates/docs_lang.html | 248 +-----------------
libpathod/templates/docs_lang_requests.html | 107 ++++++++
libpathod/templates/docs_lang_responses.html | 90 +++++++
libpathod/templates/docs_lang_websockets.html | 48 ++++
4 files changed, 249 insertions(+), 244 deletions(-)
create mode 100644 libpathod/templates/docs_lang_requests.html
create mode 100644 libpathod/templates/docs_lang_responses.html
create mode 100644 libpathod/templates/docs_lang_websockets.html
diff --git a/libpathod/templates/docs_lang.html b/libpathod/templates/docs_lang.html
index ac3f85822..ce778dc97 100644
--- a/libpathod/templates/docs_lang.html
+++ b/libpathod/templates/docs_lang.html
@@ -16,257 +16,17 @@
-
-
code:[colon-separated list of features]
-
-
-
-
- code |
-
- An integer specifying the HTTP response code.
-
- The special method ws creates a valid
- websocket upgrade response (code 101), and moves pathod
- to websocket mode. Apart from that, websocket responses
- are just like any other, and all aspects of the
- response can be over-ridden.
- |
-
-
-
- bVALUE |
-
- Set the body. The appropriate Content-Length header is
- added automatically unless the "r" flag is set.
- |
-
-
-
- cVALUE |
-
- A shortcut for setting the Content-Type header. Equivalent to
- h"Content-Type"=VALUE
- |
-
-
-
- dOFFSET |
-
- Disconnect after OFFSET bytes.
- |
-
-
-
- hVALUE=VALUE |
-
- Set a header.
- |
-
-
-
-
- iOFFSET,VALUE |
-
- Inject the specified value at the offset.
- |
-
-
-
- lVALUE |
-
- A shortcut for setting the Location header. Equivalent to
- h"Location"=VALUE
- |
-
-
-
- mVALUE |
-
- HTTP Reason message. Automatically chosen according to
- the response code if not specified.
- |
-
-
-
- pOFFSET,SECONDS |
-
- Pause for SECONDS seconds after OFFSET bytes. SECONDS can
- be an integer or "f" to pause forever.
- |
-
-
-
- r |
-
- Set the "raw" flag on this response. Pathod will not
- calculate a Content-Length header if a body is set, or add
- a Date header to the response.
- |
-
-
-
+ {% include "docs_lang_responses.html" %}
-
-
-
-
method:path:[colon-separated list of features]
-
-
-
-
-
- method |
-
-
- A VALUE specifying the HTTP
- method to use. Standard methods do not need to be
- enclosed in quotes, while non-standard methods can be
- specified as quoted strings.
-
- The special method ws creates a valid
- websocket upgrade GET request, and signals to pathoc to
- switch to websocket recieve mode if the server responds
- correctly. Apart from that, websocket requests are just
- like any other, and all aspects of the request can be
- over-ridden.
- |
-
-
-
- bVALUE |
-
- Set the body. The appropriate Content-Length header is
- added automatically unless the "r" flag is set.
- |
-
-
-
- cVALUE |
-
- A shortcut for setting the Content-Type header. Equivalent to
- h"Content-Type"=VALUE
- |
-
-
-
- dOFFSET |
-
- Disconnect after OFFSET bytes.
- |
-
-
-
- hVALUE=VALUE |
-
- Set a header.
- |
-
-
-
- iOFFSET,VALUE |
-
- Inject the specified value at the offset.
- |
-
-
-
- pOFFSET,SECONDS |
-
- Pause for SECONDS seconds after OFFSET bytes. SECONDS can
- be an integer or "f" to pause forever.
- |
-
-
-
- r |
-
- Set the "raw" flag on this response. Pathod will not
- calculate a Content-Length header if a body is set.
- |
-
-
-
- sVALUE |
-
- An embedded Response specification, appended to the path
- of the request.
- |
-
-
-
- uVALUE uSHORTCUT |
-
-
-
- Set a User-Agent header on this request. You can
- specify either a complete VALUE, or a User-Agent shortcut:
-
-
- {% for i in uastrings %}
-
- {{ i[1] }} |
- {{ i[0] }} |
-
- {% endfor %}
-
-
- |
-
-
-
+ {% include "docs_lang_requests.html" %}
-
-
-
wf:[colon-separated list of features]
-
-
-
-
-
- bVALUE |
-
- Set the frame payload. If a masking key is present, the
- value is encoded automatically.
- |
-
-
-
- dOFFSET |
-
- Disconnect after OFFSET bytes.
- |
-
-
-
- iOFFSET,VALUE |
-
- Inject the specified value at the offset.
- |
-
-
-
- pOFFSET,SECONDS |
-
- Pause for SECONDS seconds after OFFSET bytes. SECONDS can
- be an integer or "f" to pause forever.
- |
-
-
-
-
-
-
+ {% include "docs_lang_websockets.html" %}
-
-
-
-
+
diff --git a/libpathod/templates/docs_lang_requests.html b/libpathod/templates/docs_lang_requests.html
new file mode 100644
index 000000000..72391587d
--- /dev/null
+++ b/libpathod/templates/docs_lang_requests.html
@@ -0,0 +1,107 @@
+
+method:path:[colon-separated list of features]
+
+
+
+
+
+ method |
+
+
+ A VALUE specifying the HTTP
+ method to use. Standard methods do not need to be
+ enclosed in quotes, while non-standard methods can be
+ specified as quoted strings.
+
+ The special method ws creates a valid
+ websocket upgrade GET request, and signals to pathoc to
+ switch to websocket recieve mode if the server responds
+ correctly. Apart from that, websocket requests are just
+ like any other, and all aspects of the request can be
+ over-ridden.
+ |
+
+
+
+ bVALUE |
+
+ Set the body. The appropriate Content-Length header is
+ added automatically unless the "r" flag is set.
+ |
+
+
+
+ cVALUE |
+
+ A shortcut for setting the Content-Type header. Equivalent to
+ h"Content-Type"=VALUE
+ |
+
+
+
+ dOFFSET |
+
+ Disconnect after OFFSET bytes.
+ |
+
+
+
+ hVALUE=VALUE |
+
+ Set a header.
+ |
+
+
+
+ iOFFSET,VALUE |
+
+ Inject the specified value at the offset.
+ |
+
+
+
+ pOFFSET,SECONDS |
+
+ Pause for SECONDS seconds after OFFSET bytes. SECONDS can
+ be an integer or "f" to pause forever.
+ |
+
+
+
+ r |
+
+ Set the "raw" flag on this response. Pathod will not
+ calculate a Content-Length header if a body is set.
+ |
+
+
+
+ sVALUE |
+
+ An embedded Response specification, appended to the path
+ of the request.
+ |
+
+
+
+ uVALUE uSHORTCUT |
+
+
+
+ Set a User-Agent header on this request. You can
+ specify either a complete VALUE, or a User-Agent shortcut:
+
+
+ {% for i in uastrings %}
+
+ {{ i[1] }} |
+ {{ i[0] }} |
+
+ {% endfor %}
+
+
+ |
+
+
+
diff --git a/libpathod/templates/docs_lang_responses.html b/libpathod/templates/docs_lang_responses.html
new file mode 100644
index 000000000..e8590addb
--- /dev/null
+++ b/libpathod/templates/docs_lang_responses.html
@@ -0,0 +1,90 @@
+
+code:[colon-separated list of features]
+
+
+
+
+ code |
+
+ An integer specifying the HTTP response code.
+
+ The special method ws creates a valid
+ websocket upgrade response (code 101), and moves pathod
+ to websocket mode. Apart from that, websocket responses
+ are just like any other, and all aspects of the
+ response can be over-ridden.
+ |
+
+
+
+ bVALUE |
+
+ Set the body. The appropriate Content-Length header is
+ added automatically unless the "r" flag is set.
+ |
+
+
+
+ cVALUE |
+
+ A shortcut for setting the Content-Type header. Equivalent to
+ h"Content-Type"=VALUE
+ |
+
+
+
+ dOFFSET |
+
+ Disconnect after OFFSET bytes.
+ |
+
+
+
+ hVALUE=VALUE |
+
+ Set a header.
+ |
+
+
+
+
+ iOFFSET,VALUE |
+
+ Inject the specified value at the offset.
+ |
+
+
+
+ lVALUE |
+
+ A shortcut for setting the Location header. Equivalent to
+ h"Location"=VALUE
+ |
+
+
+
+ mVALUE |
+
+ HTTP Reason message. Automatically chosen according to
+ the response code if not specified.
+ |
+
+
+
+ pOFFSET,SECONDS |
+
+ Pause for SECONDS seconds after OFFSET bytes. SECONDS can
+ be an integer or "f" to pause forever.
+ |
+
+
+
+ r |
+
+ Set the "raw" flag on this response. Pathod will not
+ calculate a Content-Length header if a body is set, or add
+ a Date header to the response.
+ |
+
+
+
diff --git a/libpathod/templates/docs_lang_websockets.html b/libpathod/templates/docs_lang_websockets.html
new file mode 100644
index 000000000..c414320cd
--- /dev/null
+++ b/libpathod/templates/docs_lang_websockets.html
@@ -0,0 +1,48 @@
+wf:[colon-separated list of features]
+
+
+
+
+
+ bVALUE |
+
+ Set the frame payload. If a masking key is present, the
+ value is encoded automatically.
+ |
+
+
+
+ cINTEGER |
+
+
+ Set the op code. This can either be an integer from 0-15, or be
+ one of the following opcode names: continue,
+ text, binary, close, ping,
+ pong.
+ |
+
+
+
+ dOFFSET |
+
+ Disconnect after OFFSET bytes.
+ |
+
+
+
+ iOFFSET,VALUE |
+
+ Inject the specified value at the offset.
+ |
+
+
+
+ pOFFSET,SECONDS |
+
+ Pause for SECONDS seconds after OFFSET bytes. SECONDS can
+ be an integer or "f" to pause forever.
+ |
+
+
+
+