apply js-beautify changes selectivly

This commit is contained in:
Thomas Kriechbaumer 2015-06-26 11:47:39 +02:00
parent b3b4a63b05
commit 427e6d23ef
13 changed files with 188 additions and 168 deletions

View File

@ -18,5 +18,5 @@
"wrap_line_length": 80, "wrap_line_length": 80,
"wrap_attributes": "auto", "wrap_attributes": "auto",
"wrap_attributes_indent_size": 4, "wrap_attributes_indent_size": 4,
"end_with_newline": false "end_with_newline": true
} }

View File

@ -33,8 +33,8 @@
<h2>OFFSET</h2> <h2>OFFSET</h2>
<p> <p>
Offsets are calculated relative to the base message, before any injections or other transforms Offsets are calculated relative to the base message, before any injections or other
are applied. They have 3 flavors: transforms are applied. They have 3 flavors:
</p> </p>
<ul> <ul>
@ -66,8 +66,8 @@
<h3>Files</h3> <h3>Files</h3>
<p> <p>
You can load a value from a specified file path. To do so, you have to specify a _staticdir_ You can load a value from a specified file path. To do so, you have to specify a
option to pathod on the command-line, like so: _staticdir_ option to pathod on the command-line, like so:
</p> </p>
<pre class="example">pathod -d ~/myassets</pre> <pre class="example">pathod -d ~/myassets</pre>
@ -88,8 +88,8 @@
<p> <p>
An @-symbol lead-in specifies that generated data should be used. There are two components An @-symbol lead-in specifies that generated data should be used. There are two components
to a generator specification - a size, and a data type. By default pathod assumes to a generator specification - a size, and a data type. By default pathod
a data type of "bytes". assumes a data type of "bytes".
</p> </p>
<p>Here's a value specifier for generating 100 bytes: <p>Here's a value specifier for generating 100 bytes:
@ -98,15 +98,15 @@
</p> </p>
<p> <p>
You can use standard suffixes to indicate larger values. Here, for instance, is a specifier You can use standard suffixes to indicate larger values. Here, for instance, is a
for generating 100 megabytes: specifier for generating 100 megabytes:
</p> </p>
<pre class="example">@100m</pre> <pre class="example">@100m</pre>
<p> <p>
Data is generated and served efficiently - if you really want to send a terabyte of data Data is generated and served efficiently - if you really want to send a terabyte
to a client, pathod can do it. The supported suffixes are: of data to a client, pathod can do it. The supported suffixes are:
</p> </p>
<table class="table table-bordered"> <table class="table table-bordered">
@ -135,8 +135,8 @@
</table> </table>
<p> <p>
Data types are separated from the size specification by a comma. This specification generates Data types are separated from the size specification by a comma. This specification
100mb of ASCII: generates 100mb of ASCII:
</p> </p>
<pre class="example">@100m,ascii</pre> <pre class="example">@100m,ascii</pre>

View File

@ -7,16 +7,17 @@
<td>method</td> <td>method</td>
<td> <td>
<p> <p>
A <a href="#valuespec">VALUE</a> specifying the HTTP method to use. Standard A <a href="#valuespec">VALUE</a> specifying the HTTP method to
methods do not need to be enclosed in quotes, while non-standard methods use. Standard methods do not need to be enclosed in quotes, while
can be specified as quoted strings. non-standard methods can be specified as quoted strings.
</p> </p>
<p> <p>
The special method <b>ws</b> creates a valid websocket upgrade GET The special method <b>ws</b> creates a valid websocket upgrade
request, and signals to pathoc to switch to websocket recieve mode GET request, and signals to pathoc to switch to websocket recieve
if the server responds correctly. Apart from that, websocket requests mode if the server responds correctly. Apart from that, websocket
are just like any other, and all aspects of the request can be over-ridden. requests are just like any other, and all aspects of the request
can be over-ridden.
</p> </p>
</td> </td>
</tr> </tr>
@ -66,8 +67,8 @@
<tr> <tr>
<td>b<a href="#valuespec">VALUE</a></td> <td>b<a href="#valuespec">VALUE</a></td>
<td> <td>
Set the body. The appropriate Content-Length header is added automatically unless the Set the body. The appropriate Content-Length header is added automatically unless
"r" flag is set. the "r" flag is set.
</td> </td>
</tr> </tr>
@ -88,24 +89,24 @@
<tr> <tr>
<td>d<a href="#offsetspec">OFFSET</a></td> <td>d<a href="#offsetspec">OFFSET</a></td>
<td> <td>
<span class="badge badge-info">HTTP/1 only</span> <span class="badge badge-info">HTTP/1 only</span> Disconnect after
Disconnect after OFFSET bytes. OFFSET bytes.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>i<a href="#offsetspec">OFFSET</a>,<a href="#valuespec">VALUE</a></td> <td>i<a href="#offsetspec">OFFSET</a>,<a href="#valuespec">VALUE</a></td>
<td> <td>
<span class="badge badge-info">HTTP/1 only</span> <span class="badge badge-info">HTTP/1 only</span> Inject the specified
Inject the specified value at the offset. value at the offset.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>p<a href="#offsetspec">OFFSET</a>,SECONDS</td> <td>p<a href="#offsetspec">OFFSET</a>,SECONDS</td>
<td> <td>
<span class="badge badge-info">HTTP/1 only</span> <span class="badge badge-info">HTTP/1 only</span> Pause for SECONDS
Pause for SECONDS seconds after OFFSET bytes. SECONDS can be an integer or "f" to pause seconds after OFFSET bytes. SECONDS can be an integer or "f" to pause
forever. forever.
</td> </td>
</tr> </tr>

View File

@ -7,10 +7,10 @@
<td> <td>
<p>An integer specifying the HTTP response code.</p> <p>An integer specifying the HTTP response code.</p>
<p> <p>
The special method <b>ws</b> creates a valid websocket upgrade response The special method <b>ws</b> creates a valid websocket upgrade
(code 101), and moves pathod to websocket mode. Apart from that, websocket response (code 101), and moves pathod to websocket mode. Apart
responses are just like any other, and all aspects of the response from that, websocket responses are just like any other, and all
can be over-ridden. aspects of the response can be over-ridden.
</p> </p>
</td> </td>
</tr> </tr>
@ -18,8 +18,8 @@
<tr> <tr>
<td>m<a href="#valuespec">VALUE</a></td> <td>m<a href="#valuespec">VALUE</a></td>
<td> <td>
<span class="badge badge-info">HTTP/1 only</span> <span class="badge badge-info">HTTP/1 only</span> HTTP Reason message.
HTTP Reason message. Automatically chosen according to the response code if not specified. Automatically chosen according to the response code if not specified.
</td> </td>
</tr> </tr>
@ -55,32 +55,32 @@
<tr> <tr>
<td>b<a href="#valuespec">VALUE</a></td> <td>b<a href="#valuespec">VALUE</a></td>
<td> <td>
Set the body. The appropriate Content-Length header is added automatically unless the Set the body. The appropriate Content-Length header is added automatically unless
"r" flag is set. the "r" flag is set.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>d<a href="#offsetspec">OFFSET</a></td> <td>d<a href="#offsetspec">OFFSET</a></td>
<td> <td>
<span class="badge badge-info">HTTP/1 only</span> <span class="badge badge-info">HTTP/1 only</span> Disconnect after
Disconnect after OFFSET bytes. OFFSET bytes.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>i<a href="#offsetspec">OFFSET</a>,<a href="#valuespec">VALUE</a></td> <td>i<a href="#offsetspec">OFFSET</a>,<a href="#valuespec">VALUE</a></td>
<td> <td>
<span class="badge badge-info">HTTP/1 only</span> <span class="badge badge-info">HTTP/1 only</span> Inject the specified
Inject the specified value at the offset. value at the offset.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>p<a href="#offsetspec">OFFSET</a>,SECONDS</td> <td>p<a href="#offsetspec">OFFSET</a>,SECONDS</td>
<td> <td>
<span class="badge badge-info">HTTP/1 only</span> <span class="badge badge-info">HTTP/1 only</span> Pause for SECONDS
Pause for SECONDS seconds after OFFSET bytes. SECONDS can be an integer or "f" to pause seconds after OFFSET bytes. SECONDS can be an integer or "f" to pause
forever. forever.
</td> </td>
</tr> </tr>

View File

@ -15,8 +15,8 @@
<td> c<a href="#valuespec">INTEGER</a> </td> <td> c<a href="#valuespec">INTEGER</a> </td>
<td> <td>
Set the op code. This can either be an integer from 0-15, or be one of the following opcode Set the op code. This can either be an integer from 0-15, or be one of the following
names: <b>text</b> (the default), opcode names: <b>text</b> (the default),
<b>continue</b>, <b>binary</b>, <b>close</b>, <b>ping</b>, <b>continue</b>, <b>binary</b>, <b>close</b>, <b>ping</b>,
<b>pong</b>. <b>pong</b>.
@ -47,9 +47,10 @@
<tr> <tr>
<td> k<a href="#valuespec">VALUE</a> </td> <td> k<a href="#valuespec">VALUE</a> </td>
<td> <td>
Set the masking key. The resulting value must be exactly 4 bytes long. The special form Set the masking key. The resulting value must be exactly 4 bytes long. The special
<b>knone</b> specifies that no key should be set, even form
if the mask bit is on. <b>knone</b> specifies that no key should be set, even if the mask
bit is on.
</td> </td>
</tr> </tr>
@ -70,8 +71,8 @@
<tr> <tr>
<td> p<a href="#offsetspec">OFFSET</a>,SECONDS </td> <td> p<a href="#offsetspec">OFFSET</a>,SECONDS </td>
<td> <td>
Pause for SECONDS seconds after OFFSET bytes. SECONDS can be an integer or "f" to pause Pause for SECONDS seconds after OFFSET bytes. SECONDS can be an integer or "f" to
forever. pause forever.
</td> </td>
</tr> </tr>

View File

@ -9,10 +9,10 @@
<div class="row"> <div class="row">
<div class="span6"> <div class="span6">
<p> <p>
Behind the pathod and pathoc command-line tools lurks <b>libpathod</b>, a Behind the pathod and pathoc command-line tools lurks <b>libpathod</b>,
powerful library for manipulating and serving HTTP requests and responses. a powerful library for manipulating and serving HTTP requests and responses.
The canonical documentation for the library is in the code, and can be accessed The canonical documentation for the library is in the code, and can be
using pydoc. accessed using pydoc.
</p> </p>
</div> </div>
<div class="span6"> <div class="span6">

View File

@ -7,12 +7,12 @@
</div> </div>
<p> <p>
Pathoc is a perverse HTTP daemon designed to let you craft almost any conceivable HTTP Pathoc is a perverse HTTP daemon designed to let you craft almost any conceivable
request, including ones that creatively violate the standards. HTTP requests are specified HTTP request, including ones that creatively violate the standards. HTTP requests
using a are specified using a
<a href="/docs/language">small, terse language</a>, which pathod shares with its server-side <a href="/docs/language">small, terse language</a>, which pathod shares with
twin <a href="/docs/pathod">pathod</a>. To view pathoc's complete range of options, its server-side twin <a href="/docs/pathod">pathod</a>. To view pathoc's complete
use the command-line help: range of options, use the command-line help:
</p> </p>
<pre class="terminal">pathoc --help</pre> <pre class="terminal">pathoc --help</pre>
@ -27,8 +27,8 @@
<pre class="terminal">pathoc hostname request [request ...]</pre> <pre class="terminal">pathoc hostname request [request ...]</pre>
<p> <p>
That is, we specify the hostname to connect to, followed by one or more requests. Lets That is, we specify the hostname to connect to, followed by one or more requests.
start with a simple example: Lets start with a simple example:
</p> </p>
<pre class="terminal"> <pre class="terminal">
@ -36,10 +36,10 @@
</pre> </pre>
<p> <p>
Here, we make a GET request to the path / on port 80 of google.com. Pathoc's output tells Here, we make a GET request to the path / on port 80 of google.com. Pathoc's output
us that the server responded with a 301. We can tell pathoc to connect using SSL, tells us that the server responded with a 301. We can tell pathoc to connect
in which case the default port is changed to 443 (you can over-ride the default using SSL, in which case the default port is changed to 443 (you can over-ride
port with the <b>-p</b> command-line option): the default port with the <b>-p</b> command-line option):
</p> </p>
<pre class="terminal"> <pre class="terminal">
@ -64,8 +64,8 @@
</pre> </pre>
<p> <p>
In this case, pathoc issues the specified requests over the same TCP connection - so in In this case, pathoc issues the specified requests over the same TCP connection -
the above example only one connection is made to google.com so in the above example only one connection is made to google.com
</p> </p>
<p>The other way to issue multiple requets is to use the <b>-n</b> flag:</p> <p>The other way to issue multiple requets is to use the <b>-n</b> flag:</p>
@ -76,8 +76,8 @@
</pre> </pre>
<p> <p>
The output is identical, but two separate TCP connections are made to the upstream server. The output is identical, but two separate TCP connections are made to the upstream
These two specification styles can be combined: server. These two specification styles can be combined:
</p> </p>
<pre class="terminal"> <pre class="terminal">
@ -96,8 +96,9 @@
</div> </div>
<p> <p>
The combination of pathoc's powerful request specification language and a few of its command-line The combination of pathoc's powerful request specification language and a few of
options makes for quite a powerful basic fuzzer. Here's an example: its command-line options makes for quite a powerful basic fuzzer. Here's
an example:
</p> </p>
<pre class="terminal"> <pre class="terminal">
@ -105,18 +106,18 @@
</pre> </pre>
<p> <p>
The request specified here is a valid GET with a body consisting of 10 random bytes, but The request specified here is a valid GET with a body consisting of 10 random bytes,
with 1 random byte inserted in a random place. This could be in the headers, in but with 1 random byte inserted in a random place. This could be in the headers,
the initial request line, or in the body itself. There are a few things to note in the initial request line, or in the body itself. There are a few things
here: to note here:
</p> </p>
<ul> <ul>
<li> <li>
Corrupting the request in this way will often make the server enter a state where it's Corrupting the request in this way will often make the server enter a state where
awaiting more input from the client. This is where the it's awaiting more input from the client. This is where the
<b>-t</b> option comes in, which sets a timeout that causes pathoc to disconnect <b>-t</b> option comes in, which sets a timeout that causes pathoc to
after two seconds. disconnect after two seconds.
</li> </li>
<li> <li>
@ -124,16 +125,16 @@
</li> </li>
<li> <li>
The <b>-I</b> option tells pathoc to ignore HTTP 200 response codes. You can The <b>-I</b> option tells pathoc to ignore HTTP 200 response codes.
use this to fine-tune what pathoc considers to be an exceptional condition, You can use this to fine-tune what pathoc considers to be an exceptional
and therefore log-worthy. condition, and therefore log-worthy.
</li> </li>
<li> <li>
The <b>-e</b> option tells pathoc to print an explanation of each logged request, The <b>-e</b> option tells pathoc to print an explanation of each logged
in the form of an expanded pathoc specification with all random portions and request, in the form of an expanded pathoc specification with all random
automatic header additions resolved. This lets you precisely replay a request portions and automatic header additions resolved. This lets you precisely
that triggered an error. replay a request that triggered an error.
</li> </li>
</ul> </ul>
</section> </section>
@ -146,25 +147,26 @@
<p> <p>
Pathoc has a reasonably sophisticated suite of features for interacting with proxies. Pathoc has a reasonably sophisticated suite of features for interacting with proxies.
The proxy request syntax very closely mirrors that of straight HTTP, which means The proxy request syntax very closely mirrors that of straight HTTP, which
that it is possible to make proxy-style requests using pathoc without any additional means that it is possible to make proxy-style requests using pathoc without
syntax, by simply specifying a full URL instead of a simple path: any additional syntax, by simply specifying a full URL instead of a simple
path:
</p> </p>
<pre class="terminal">&gt; pathoc -p 8080 localhost "get:'http://google.com'"</pre> <pre class="terminal">&gt; pathoc -p 8080 localhost "get:'http://google.com'"</pre>
<p> <p>
Another common use case is to use an HTTP CONNECT request to probe remote servers via Another common use case is to use an HTTP CONNECT request to probe remote servers
a proxy. This is done with the <b>-c</b> command-line option, which allows via a proxy. This is done with the <b>-c</b> command-line option,
you to specify a remote host and port pair: which allows you to specify a remote host and port pair:
</p> </p>
<pre class="terminal">&gt; pathoc -c google.com:80 -p 8080 localhost get:/</pre> <pre class="terminal">&gt; pathoc -c google.com:80 -p 8080 localhost get:/</pre>
<p> <p>
Note that pathoc does <b>not</b> negotiate SSL without being explictly instructed Note that pathoc does <b>not</b> negotiate SSL without being explictly instructed
to do so. If you're making a CONNECT request to an SSL-protected resource, you to do so. If you're making a CONNECT request to an SSL-protected resource,
must also pass the <b>-s</b> flag: you must also pass the <b>-s</b> flag:
</p> </p>
<pre class="terminal">&gt; pathoc -sc google.com:443 -p 8080 localhost get:/</pre> <pre class="terminal">&gt; pathoc -sc google.com:443 -p 8080 localhost get:/</pre>
@ -177,19 +179,19 @@
</div> </div>
<p> <p>
One interesting feature of the Request sppecification language is that you can embed a One interesting feature of the Request sppecification language is that you can embed
response specifcation in it, which is then added to the request path. Here's an a response specifcation in it, which is then added to the request path. Here's
example: an example:
</p> </p>
<pre class="terminal">&gt; pathoc localhost:9999 "get:/p/:s'401:ir,@1'"</pre> <pre class="terminal">&gt; pathoc localhost:9999 "get:/p/:s'401:ir,@1'"</pre>
<p> <p>
This crafts a request that connects to the pathod server, and which then crafts a response This crafts a request that connects to the pathod server, and which then crafts a
that generates a 401, with one random byte embedded at a random point. The response response that generates a 401, with one random byte embedded at a random
specification is parsed and expanded by pathoc, so you see syntax errors immediately. point. The response specification is parsed and expanded by pathoc, so you
This really becomes handy when combined with the <b>-e</b> flag to show see syntax errors immediately. This really becomes handy when combined with
the expanded request: the <b>-e</b> flag to show the expanded request:
</p> </p>
<pre class="terminal"> <pre class="terminal">
@ -197,13 +199,13 @@
<< 401 Unoauthorized: 0 bytes </pre> << 401 Unoauthorized: 0 bytes </pre>
<p> <p>
Note that the embedded response has been resolved <i>before</i> being Note that the embedded response has been resolved <i>before</i> being sent
sent to the server, so that "ir,@1" (embed a random byte at a random location) to the server, so that "ir,@1" (embed a random byte at a random location)
has become "i15,\'o\'" (embed the character "o" at offset 15). You now has become "i15,\'o\'" (embed the character "o" at offset 15). You now have
have a pathoc request specification that is precisely reproducable, even a pathoc request specification that is precisely reproducable, even with
with random components. This feature comes in terribly handy when testing random components. This feature comes in terribly handy when testing a proxy,
a proxy, since you can now drive the server repsonse completely from the since you can now drive the server repsonse completely from the client, and
client, and have a complete log of reproducible requests to analyse afterwards. have a complete log of reproducible requests to analyse afterwards.
</p> </p>
</section> </section>
{% endblock %} {% endblock %}

View File

@ -10,8 +10,8 @@
Pathod is a pathological HTTP daemon designed to let you craft almost any conceivable Pathod is a pathological HTTP daemon designed to let you craft almost any conceivable
HTTP response, including ones that creatively violate the standards. HTTP responses HTTP response, including ones that creatively violate the standards. HTTP responses
are specified using a are specified using a
<a href="/docs/language">small, terse language</a>, which pathod shares with its evil <a href="/docs/language">small, terse language</a>, which pathod shares with
twin <a href="/docs/pathoc">pathoc</a>. its evil twin <a href="/docs/pathoc">pathoc</a>.
</p> </p>
<section> <section>
@ -24,27 +24,27 @@
<pre class="terminal">./pathod</pre> <pre class="terminal">./pathod</pre>
<p> <p>
By default, the service listens on port 9999 of localhost. Pathod's documentation is self-hosting, By default, the service listens on port 9999 of localhost. Pathod's documentation
and the pathod daemon exposes an interface that lets you play with the specifciation is self-hosting, and the pathod daemon exposes an interface that lets you
language, preview what responses and requests would look like on the wire, and play with the specifciation language, preview what responses and requests
view internal logs. To access all of this, just fire up your browser, and point would look like on the wire, and view internal logs. To access all of this,
it to the following URL: just fire up your browser, and point it to the following URL:
</p> </p>
<pre class="example">http://localhost:9999</pre> <pre class="example">http://localhost:9999</pre>
<p> <p>
The default crafting anchor point is the path <b>/p/</b>. Anything after this The default crafting anchor point is the path <b>/p/</b>. Anything after
URL prefix is treated as a response specifier. So, hitting the following URL will this URL prefix is treated as a response specifier. So, hitting the following
generate an HTTP 200 response with 100 bytes of random data: URL will generate an HTTP 200 response with 100 bytes of random data:
</p> </p>
<pre class="example">http://localhost:9999/p/200:b@100</pre> <pre class="example">http://localhost:9999/p/200:b@100</pre>
<p> <p>
See the <a href="/docs/language">language documentation</a> to get (much) fancier. See the <a href="/docs/language">language documentation</a> to get (much)
The pathod daemon also takes a range of configuration options. To view those, fancier. The pathod daemon also takes a range of configuration options. To
use the command-line help: view those, use the command-line help:
</p> </p>
<pre class="terminal">./pathod --help</pre> <pre class="terminal">./pathod --help</pre>
@ -57,17 +57,17 @@
</div> </div>
<p> <p>
Pathod automatically responds to both straight HTTP and proxy requests. For proxy requests, Pathod automatically responds to both straight HTTP and proxy requests. For proxy
the upstream host is ignored, and the path portion of the URL is used to match requests, the upstream host is ignored, and the path portion of the URL is
anchors. This lets you test software that supports a proxy configuration by spoofing used to match anchors. This lets you test software that supports a proxy
responses from upstream servers. configuration by spoofing responses from upstream servers.
</p> </p>
<p> <p>
By default, we treat all proxy CONNECT requests as HTTPS traffic, serving the response By default, we treat all proxy CONNECT requests as HTTPS traffic, serving the response
using either pathod's built-in certificates, or the cert/key pair specified by using either pathod's built-in certificates, or the cert/key pair specified
the user. You can over-ride this behaviour if you're testing a client that makes by the user. You can over-ride this behaviour if you're testing a client
a non-SSL CONNECT request using the -C command-line option. that makes a non-SSL CONNECT request using the -C command-line option.
</p> </p>
</section> </section>
@ -78,16 +78,16 @@
</div> </div>
<p> <p>
Anchors provide an alternative to specifying the response in the URL. Instead, you attach Anchors provide an alternative to specifying the response in the URL. Instead, you
a response to a pre-configured anchor point, specified with a regex. When a URL attach a response to a pre-configured anchor point, specified with a regex.
matching the regex is requested, the specified response is served. When a URL matching the regex is requested, the specified response is served.
</p> </p>
<pre class="terminal">./pathod -a "/foo=200"</pre> <pre class="terminal">./pathod -a "/foo=200"</pre>
<p> <p>
Here, "/foo" is the regex specifying the anchor path, and the part after the "=" is a Here, "/foo" is the regex specifying the anchor path, and the part after the "="
response specifier. is a response specifier.
</p> </p>
</section> </section>
@ -98,11 +98,11 @@
</div> </div>
<p> <p>
There are two operators in the <a href="/docs/language">language</a> that load There are two operators in the <a href="/docs/language">language</a> that
contents from file - the <b>+</b> operator to load an entire request specification load contents from file - the <b>+</b> operator to load an entire request
from file, and the <b>&gt;</b> value specifier. In pathod, both of these operators specification from file, and the <b>&gt;</b> value specifier. In pathod,
are restricted to a directory specified at startup, or disabled if no directory both of these operators are restricted to a directory specified at startup,
is specified:</p> or disabled if no directory is specified:</p>
<pre class="terminal">./pathod -d ~/staticdir"</pre> <pre class="terminal">./pathod -d ~/staticdir"</pre>
</section> </section>
@ -131,8 +131,8 @@
</div> </div>
<p> <p>
pathod exposes a simple API, intended to make it possible to drive and inspect the daemon pathod exposes a simple API, intended to make it possible to drive and inspect the
remotely for use in unit testing and the like. daemon remotely for use in unit testing and the like.
</p> </p>
<table class="table table-bordered"> <table class="table table-bordered">
@ -158,13 +158,12 @@
/api/log /api/log
</td> </td>
<td> <td>
Returns the current log buffer. At the moment the buffer size is 500 entries - when the Returns the current log buffer. At the moment the buffer size is 500 entries - when
log grows larger than this, older entries are discarded. The returned the log grows larger than this, older entries are discarded.
data is a JSON dictionary, with the form: The returned data is a JSON dictionary, with the form:
<pre>{ 'log': [ ENTRIES ] } </pre> <pre>{ 'log': [ ENTRIES ] } </pre> You can preview the JSON data
returned for a log entry through the built-in web interface.
You can preview the JSON data returned for a log entry through the built-in web interface.
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -7,10 +7,10 @@
</div> </div>
<p>The <b>libpathod.test</b> module is a light, flexible testing layer for HTTP clients. <p>The <b>libpathod.test</b> module is a light, flexible testing layer for HTTP clients.
It works by firing up a Pathod instance in a separate thread, letting you use Pathod's It works by firing up a Pathod instance in a separate thread, letting you use
full abilities to generate responses, and then query Pathod's internal logs to establish Pathod's full abilities to generate responses, and then query Pathod's internal
what happened. All the mechanics of startup, shutdown, finding free ports and so forth logs to establish what happened. All the mechanics of startup, shutdown, finding
are taken care of for you. free ports and so forth are taken care of for you.
</p> </p>
<p>The canonical docs can be accessed using pydoc: </p> <p>The canonical docs can be accessed using pydoc: </p>
@ -19,9 +19,9 @@
<p> <p>
The remainder of this page demonstrates some common interaction patterns using The remainder of this page demonstrates some common interaction patterns using
<a <a href="http://nose.readthedocs.org/en/latest/">nose</a>. These examples are
href="http://nose.readthedocs.org/en/latest/">nose</a>. These examples are also applicable with only minor modification to most also applicable with only minor modification to most commonly used Python testing
commonly used Python testing engines. engines.
</p> </p>
<section> <section>

View File

@ -8,7 +8,9 @@
<pre>pip install pathod</pre> <pre>pip install pathod</pre>
<p>This will automatically pull in all the dependencies, and you should be good to go.</p> <p>
This will automatically pull in all the dependencies, and you should be good to go.
</p>
</section> </section>
<section> <section>

View File

@ -19,6 +19,7 @@
padding-top: 60px; padding-top: 60px;
padding-bottom: 40px; padding-bottom: 40px;
} }
</style> </style>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
@ -68,5 +69,7 @@
} }
}); });
}); });
</script> </script>
</html> </html>

View File

@ -7,8 +7,10 @@
<a class="innerlink" data-toggle="collapse" data-target="#requestexamples">examples</a> <a class="innerlink" data-toggle="collapse" data-target="#requestexamples">examples</a>
<div id="requestexamples" class="collapse"> <div id="requestexamples" class="collapse">
<p>Check out the <a href="/docs/language">complete language docs</a>. Here are some examples <p>
to get you started:</p> Check out the <a href="/docs/language">complete language docs</a>. Here are
some examples to get you started:
</p>
<table class="table table-bordered"> <table class="table table-bordered">
<tbody> <tbody>

View File

@ -1,15 +1,19 @@
<form style="margin-bottom: 0" class="form-inline" method="GET" action="/response_preview"> <form style="margin-bottom: 0" class="form-inline" method="GET" action="/response_preview">
<input style="width: 18em" id="spec" name="spec" class="input-medium" value="{{spec}}" <input style="width: 18em" id="spec" name="spec" class="input-medium" value="{{spec}}"
placeholder="code:[features]"> placeholder="code:[features]">
<input type="submit" class="btn" value="preview"> {% if not nocraft %} <input type="submit" class="btn" value="preview">
<a href="#" id="submitspec" class="btn">go</a> {% endif %} {% if not nocraft %}
<a href="#" id="submitspec" class="btn">go</a>
{% endif %}
</form> </form>
<a class="innerlink" data-toggle="collapse" data-target="#responseexamples">examples</a> <a class="innerlink" data-toggle="collapse" data-target="#responseexamples">examples</a>
<div id="responseexamples" class="collapse"> <div id="responseexamples" class="collapse">
<p>Check out the <a href="/docs/language">complete language docs</a>. Here are some examples <p>
to get you started:</p> Check out the <a href="/docs/language">complete language docs</a>. Here are
some examples to get you started:
</p>
<table class="table table-bordered"> <table class="table table-bordered">
<tbody> <tbody>
@ -19,7 +23,9 @@
</tr> </tr>
<tr> <tr>
<td><a href="/response_preview?spec=200:r">200:r</a></td> <td><a href="/response_preview?spec=200:r">200:r</a></td>
<td>A basic HTTP 200 response with no Content-Length header. This will hang.</td> <td>A basic HTTP 200 response with no Content-Length header. This will
hang.
</td>
</tr> </tr>
<tr> <tr>
<td><a href="/response_preview?spec=200:da">200:da</a></td> <td><a href="/response_preview?spec=200:da">200:da</a></td>
@ -27,8 +33,10 @@
</tr> </tr>
<tr> <tr>
<td><a href="/response_preview?spec=200:b@100">200:b@100</a></td> <td><a href="/response_preview?spec=200:b@100">200:b@100</a></td>
<td>100 random bytes as the body. A Content-Lenght header is added, so the <td>
disconnect is no longer needed.</td> 100 random bytes as the body. A Content-Lenght header is added, so the disconnect
is no longer needed.
</td>
</tr> </tr>
<tr> <tr>
<td><a href='/response_preview?spec=200:b@100:h"Server"="&apos;;drop table servers;"'>200:b@100:h"Etag"="';drop table servers;"</a></td> <td><a href='/response_preview?spec=200:b@100:h"Server"="&apos;;drop table servers;"'>200:b@100:h"Etag"="';drop table servers;"</a></td>
@ -58,8 +66,10 @@
<td> <td>
<a href="/response_preview?spec=200:b@100:h@1k,ascii_letters='foo'">200:b@100:h@1k,ascii_letters='foo'</a> <a href="/response_preview?spec=200:b@100:h@1k,ascii_letters='foo'">200:b@100:h@1k,ascii_letters='foo'</a>
</td> </td>
<td>100 ASCII bytes as the body, randomly generated 100k header name, with <td>
the value 'foo'.</td> 100 ASCII bytes as the body, randomly generated 100k header name, with the value
'foo'.
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>