Commit Graph

433 Commits

Author SHA1 Message Date
Aldo Cortesi
61f8992fbf Change response spec format to code[:features]
Reason message is now specified as just another feature with the "m" mnemonic.
2012-10-28 22:18:06 +13:00
Aldo Cortesi
07560ffe30 Cleaup, ABC for Value classes. 2012-10-28 22:00:19 +13:00
Aldo Cortesi
35f37626a9 Clean up .accept() signature. 2012-10-28 17:39:58 +13:00
Aldo Cortesi
7d74f75f6d Split Code and Reason into separate _Component objects. 2012-10-28 17:07:16 +13:00
Aldo Cortesi
e9af434c2b .body and .method to lazy generator instantiation.
Also introduce a _Component ABC.
2012-10-28 14:15:29 +13:00
Aldo Cortesi
9d42a06c92 Move message body to new lazy-generator scheme. 2012-10-28 12:56:08 +13:00
Aldo Cortesi
f54ed69a35 Adjust serve() API. 2012-10-28 09:06:55 +13:00
Aldo Cortesi
ac5aacce44 Remove check argument to serve() methods.
Refactoring means we can now do this without a callback.

Also introduce the maximum_length method that estimates the max possible
message length.
2012-10-27 17:40:22 +13:00
Aldo Cortesi
06864e5a1b Major refactoring towars separate representation of expressions and request/response service. 2012-10-27 14:00:50 +13:00
Aldo Cortesi
6174e46023 Unit test suite love: 100% coverage
Also start figuring out how to sanitize binary data in the JSON API.
2012-10-25 10:59:18 +13:00
Aldo Cortesi
173b5c596e Start moving policy checks to service-time, rather than parse-time. 2012-10-25 09:45:55 +13:00
Aldo Cortesi
c684f7417d Extend Action and Value classes
- Values now know how to print their own specs
- Actions now know how to print their own specs
- Actions have a resolve_offset method that resolves relative and random offsets.
2012-10-24 11:32:53 +13:00
Aldo Cortesi
e83392bfc8 Start making Action objects more sophisticated. 2012-10-05 11:23:30 +13:00
Aldo Cortesi
495daf2b64 Remove actions log and explain, preparing for a more sophisticated take on this. 2012-10-05 11:14:17 +13:00
Aldo Cortesi
f5d5cc4988 rparse.py -> language.py 2012-10-05 10:30:32 +13:00
Aldo Cortesi
d3e1f8a014 Stub out documentation changes 2012-10-04 12:17:35 +13:00
Aldo Cortesi
41f1c66772 Add -q and -r flags to pathod, logging request and respnose bytes.
- These flags also mean that a bytes log is included in the internal log
buffer.
- There's an -x flag to turn on hex dump output in the text logs (does
not affect the log buffer).
2012-10-01 12:48:26 +13:00
Aldo Cortesi
915bcfbd30 Add timeout argument to Pathod, and matching -t command-line option. 2012-10-01 12:01:02 +13:00
Aldo Cortesi
8bb81be2b0 Add pathoc -T to ignore timeouts.
Also move -c to -C for consistency.
2012-09-28 11:38:49 +12:00
Aldo Cortesi
65108ed429 Add pathoc -o, oneshot mode, exits after the first non-ignored response. 2012-09-27 10:56:06 +12:00
Aldo Cortesi
7209a75201 Add pathoc -c to specify a list of return codes to ignore. 2012-09-27 09:44:25 +12:00
Aldo Cortesi
10a19fc4da Refactor print_requests -> print_request
- Change to handle one request at a time
- Shift error handling around
2012-09-26 14:25:39 +12:00
Aldo Cortesi
424d15c28b Expand the docs to explain pathoc multiple requests. 2012-09-26 11:21:40 +12:00
Aldo Cortesi
b67d99638a Response printing
Options to output full response, as sniffed from the socket.
2012-09-26 11:07:22 +12:00
Aldo Cortesi
a69d602087 Hex and verbatim output of requests.
This works by sniffing traffic through the socket, so always gives us the exact
traffic sent upstream.
2012-09-26 10:38:47 +12:00
Aldo Cortesi
0a5d4fbbbb Stub out new output argument structure. 2012-09-26 10:12:30 +12:00
Aldo Cortesi
0dd250d4f8 Fix utils.get_header case handling. 2012-09-24 10:08:18 +12:00
Aldo Cortesi
9db2bcabad Auto-generate download links. 2012-08-25 11:30:55 +12:00
Aldo Cortesi
d36cf63112 Bump for minor release. 2012-08-25 11:26:18 +12:00
Aldo Cortesi
2f7188164c Download page, MANIFEST.in 2012-08-23 12:54:58 +12:00
Aldo Cortesi
b78a3817cd Adjust examples and docs. 2012-08-23 12:37:02 +12:00
Aldo Cortesi
d758409b76 Make sure date stamps are added to all logs. 2012-08-23 12:00:16 +12:00
Aldo Cortesi
95968ad558 Don't allow negative integer offsets for now. 2012-08-17 10:08:02 +12:00
Aldo Cortesi
13cb0cab90 Tweak front page: correct public pathod URL, more illustrative examples. 2012-08-16 22:29:14 +12:00
Aldo Cortesi
51d10f53c1 Add Cache-Control directives to static pages. 2012-08-11 17:06:51 +12:00
Aldo Cortesi
8d26db4931 Docs. 2012-08-07 23:19:48 +12:00
Aldo Cortesi
158106d346 Doc tweaks. 2012-07-30 21:12:42 +12:00
Aldo Cortesi
fde65270af Testing examples and docs. 2012-07-30 20:58:59 +12:00
Aldo Cortesi
e52a37ffa9 Cleanup of libpathod.test, test example for front page. 2012-07-30 17:29:36 +12:00
Aldo Cortesi
e26aac1d3c 100% test coverage. 2012-07-30 13:52:40 +12:00
Aldo Cortesi
43314c77c8 Handle invalid headers better. 2012-07-30 12:53:41 +12:00
Aldo Cortesi
5b08703fa8 Handle disconnects on flush. 2012-07-30 12:02:42 +12:00
Aldo Cortesi
b1ac4245c8 docs: pathod 2012-07-30 00:14:34 +12:00
Aldo Cortesi
bc1cfd9f75 Docs. 2012-07-29 22:26:31 +12:00
Aldo Cortesi
d7db6757b2 Listen on localhost by default. 2012-07-29 17:29:38 +12:00
Aldo Cortesi
c21639deab Tweak about page to be less po-faced. 2012-07-29 16:46:24 +12:00
Aldo Cortesi
08b95f6aa1 Refactor preview display pages. 2012-07-29 16:33:45 +12:00
Aldo Cortesi
483e8182ff Add new styling (thanks to bootswatch.com) 2012-07-29 13:55:59 +12:00
Aldo Cortesi
d8c53cbc57 Add an option to specify a log file to pathod. 2012-07-27 14:03:15 +12:00
Aldo Cortesi
3e158211a8 Add a --nohang flag that turns off pauses in response generation. 2012-07-26 20:01:51 +12:00
Aldo Cortesi
b879890412 Add the public pathod server. 2012-07-25 13:07:27 +12:00
Aldo Cortesi
eb43291b3c Note that pauses are skipped during previews. 2012-07-25 12:49:22 +12:00
Aldo Cortesi
24f69419df Unit test about page. 2012-07-25 12:39:51 +12:00
Aldo Cortesi
adac9a35c3 Use tabs for request/response definitions on language docs page. 2012-07-25 12:36:53 +12:00
Aldo Cortesi
87306164a6 Expand examples for responses, remove dupes from pathod doc. 2012-07-25 12:18:36 +12:00
Aldo Cortesi
0b916ebbb1 Add a basic about page. 2012-07-25 11:55:44 +12:00
Aldo Cortesi
410144c579 Add examples for each preview form. 2012-07-25 11:36:19 +12:00
Aldo Cortesi
e7e6a60246 Nicer error for empty preview spec submission. 2012-07-25 10:55:00 +12:00
Aldo Cortesi
59f408dcf4 Refine parse error message a bit. 2012-07-25 10:44:21 +12:00
Aldo Cortesi
8cfbc2f80e Refactor test.py, add unit tests for app.py corner case. 2012-07-25 10:34:57 +12:00
Aldo Cortesi
e1df7f47a6 Sizing and placeholder for preview forms. 2012-07-25 10:24:09 +12:00
Aldo Cortesi
7dab85e8b1 Handle file access denied errors in previews. 2012-07-25 00:18:23 +12:00
Aldo Cortesi
64ef0a4561 Swap the offset, seconds arguments for the pause operator.
This makes it uniform with the other operators.s
2012-07-24 23:57:18 +12:00
Aldo Cortesi
cb09488dc8 Make actions at end of message work. 2012-07-24 23:49:58 +12:00
Aldo Cortesi
8f0ebb405d Hide "go" button if crafting is off. Use configured crafting anchor point. 2012-07-24 23:38:41 +12:00
Aldo Cortesi
ab59d6dccf Add preview for pathoc requests to web app. 2012-07-24 23:13:04 +12:00
Aldo Cortesi
6c565e778f Make previews safer by stripping pauses. 2012-07-24 22:38:48 +12:00
Aldo Cortesi
e9de11f0e3 Don't add stuff to our internal log buffer if noapi is on. 2012-07-24 22:30:15 +12:00
Aldo Cortesi
11896d2118 Turn off /log when noapi is set. 2012-07-24 22:27:04 +12:00
Aldo Cortesi
eb1f2c3fc4 Add option to specify craft anchor point. 2012-07-24 21:51:43 +12:00
Aldo Cortesi
97fe026c32 Add basic docs for request spec language. 2012-07-24 21:45:05 +12:00
Aldo Cortesi
94b491bb27 Add a Host header to pathoc requests by default. 2012-07-24 21:38:28 +12:00
Aldo Cortesi
9502eeadaa Document raw flag. 2012-07-24 12:52:53 +12:00
Aldo Cortesi
a9e60fa3e6 Add a Date header to server responses, unless raw is set. 2012-07-24 12:46:14 +12:00
Aldo Cortesi
dbed251fb9 Add a raw modifier to requests and responses, which turn off automatic additions.
For now, this just turns off adding a Content-Length header when a body is specified.
2012-07-24 12:18:14 +12:00
Aldo Cortesi
2dd2137d44 Better handling of binary data output by pathoc. 2012-07-24 00:00:55 +12:00
Aldo Cortesi
a950a4d7a3 Add pathod --noapi to turn off the service API. 2012-07-23 23:31:26 +12:00
Aldo Cortesi
190392ea13 Add a --nocraft option to pathod that turns off crafting. 2012-07-23 21:39:31 +12:00
Aldo Cortesi
622a2b5607 Add a --noweb option to turn web iface off, refactor unit tests. 2012-07-23 19:55:33 +12:00
Aldo Cortesi
eba485f5eb 100% unit test coverage 2012-07-23 19:25:57 +12:00
Aldo Cortesi
763e1ff786 pathod.py unit tests++ 2012-07-23 17:53:17 +12:00
Aldo Cortesi
1d1098687c 100% test coverage for pathoc.py 2012-07-23 17:42:44 +12:00
Aldo Cortesi
c1f75dd5a3 Use local scrolling with a JQuery module, because anchor jumps are braindead. 2012-07-23 17:30:50 +12:00
Aldo Cortesi
091d90011b Unify offset specifications, and document them. 2012-07-23 17:19:25 +12:00
Aldo Cortesi
2880fee4e3 Escape unprintable content in preview. 2012-07-23 16:39:25 +12:00
Aldo Cortesi
773ada882d Unit tests for most of app.py, return 404 for unknown log entry. 2012-07-23 16:18:47 +12:00
Aldo Cortesi
3027aae142 Use configured size limit to keep previews in check. 2012-07-23 15:38:06 +12:00
Aldo Cortesi
5283bb2507 Refactor rparse.InternalResponse -> rparse.PathodErrorResponse 2012-07-23 15:11:40 +12:00
Aldo Cortesi
1c45f5b05c Use policy hook to apply a size limit in pathod, add corresponding cmdline arg. 2012-07-23 15:03:56 +12:00
Aldo Cortesi
c7b5faf7db Add hooks for policy checks of served data. 2012-07-23 14:37:00 +12:00
Aldo Cortesi
204a556aa7 Add function for effective length calculation when actions are present. 2012-07-23 10:47:33 +12:00
Aldo Cortesi
32bd16aa31 Make file generators display nicely in pathoc actions dump. 2012-07-22 23:51:44 +12:00
Aldo Cortesi
96db3557ce Constrain file access to configured directory in pathod. 2012-07-22 23:46:56 +12:00
Aldo Cortesi
1b03fd6780 Allow execution of specs from file, using +./path 2012-07-22 23:37:46 +12:00
Aldo Cortesi
33208b8720 Doc reorg. 2012-07-22 22:24:16 +12:00
Aldo Cortesi
817e550aa1 Multiline specifications for pathod and pathoc. 2012-07-22 15:26:05 +12:00
Aldo Cortesi
1e93e42883 Escape special characters in first line error log. 2012-07-22 12:40:27 +12:00
Aldo Cortesi
8d8ede7e26 Handle invalid content length headers. 2012-07-22 12:30:10 +12:00
Aldo Cortesi
7a49cdfef3 More robust response handling. 2012-07-21 20:50:41 +12:00
Aldo Cortesi
86fe199988 pathoc: add a flag to dump request information. 2012-07-21 20:20:37 +12:00
Aldo Cortesi
059a232903 Add support for client timeout to pathoc. 2012-07-21 16:19:44 +12:00
Aldo Cortesi
3e6f440b8d Document Python-style string escaping. 2012-07-21 14:17:41 +12:00
Aldo Cortesi
8ec44c6277 Allow Python string escape sequences in value literals. 2012-07-21 14:12:45 +12:00
Aldo Cortesi
8e0c01ae39 Fine-tuning for injection: docs, bugfixes. 2012-07-20 23:47:34 +12:00
Aldo Cortesi
d7841898e3 Add an injection operator. 2012-07-20 23:36:39 +12:00
Aldo Cortesi
2bdbbaa8af Convert documentation to HTML, fix styling. 2012-07-20 23:19:58 +12:00
Aldo Cortesi
21ef35fd28 Much simpler rewrite of inner data sending loop.
We don't have to do the asynchronous code contortion anymore.
2012-07-20 20:14:35 +12:00
Aldo Cortesi
3d9e8b2dbf We shouldn't ever get a socket error emanating from netlib. 2012-07-20 15:21:36 +12:00
Aldo Cortesi
03f4dcc02b Extend test suite to cover SSL. Log SSL connection errors. 2012-07-20 13:21:33 +12:00
Aldo Cortesi
76f0c3ea78 Handle invalid first line errors, add an error log buffer type. 2012-07-20 11:40:37 +12:00
Aldo Cortesi
1bb93176da Handle NetLibDisconnect error. 2012-07-09 11:09:37 +12:00
Aldo Cortesi
2cb55ee0f5 Factor out request printing in to a method, and test it. 2012-06-30 10:51:13 +12:00
Aldo Cortesi
654a84174a Move docs into pathod server. 2012-06-29 11:53:59 +12:00
Aldo Cortesi
1b42f5ab1f Allow naked literals for path specification. 2012-06-29 10:42:15 +12:00
Aldo Cortesi
9588da4ab4 Catch errors that may happen on interpreter shutdown. 2012-06-27 16:15:22 +12:00
Aldo Cortesi
8f148b6b14 Split pathod and pathoc daemon test suites out. 2012-06-26 17:28:07 +12:00
Aldo Cortesi
a68b4498b8 Allow naked value literal for pathoc path specifications. 2012-06-26 15:36:59 +12:00
Aldo Cortesi
65aef81997 parse -> parse_response in web app 2012-06-26 15:09:05 +12:00
Aldo Cortesi
33be5a72bf Fixed the WSGI server hang in netlib, remove fudge. 2012-06-26 14:49:40 +12:00
Aldo Cortesi
15aab74ddb Catch and log SSL connection errors. Improve log format. 2012-06-26 11:03:35 +12:00
Aldo Cortesi
f32258e8f7 Port pathoc to new netlib API. Add SNI. 2012-06-26 10:15:11 +12:00
Aldo Cortesi
8352c0278f Handle client close more gracefully. 2012-06-25 11:34:29 +12:00
Aldo Cortesi
3d8610b6bc Move server to new explicit netlib API. 2012-06-25 11:22:44 +12:00
Aldo Cortesi
15c48cfc5e Simple HTTP connection keep-alive for pathod. 2012-06-24 23:11:25 +12:00
Aldo Cortesi
a747043cc8 Use http.read_response to read server response.
Also add a few different output formats, and a verbosity flag.
2012-06-24 22:59:20 +12:00
Aldo Cortesi
ddda57179a read_headers now returns an ODictCaseless object. 2012-06-24 21:49:43 +12:00
Aldo Cortesi
65487ead6d Logging truss for pathod. 2012-06-24 21:40:31 +12:00
Aldo Cortesi
90c6fb394d Sketch out pathoc commandline interaction. 2012-06-24 21:10:10 +12:00
Aldo Cortesi
8bec99f858 Request service rendering. 2012-06-24 19:12:52 +12:00
Aldo Cortesi
2ac84be7cb Add Path specification to request parser. 2012-06-24 18:38:22 +12:00
Aldo Cortesi
f8622ea914 Simple request spec parsing. 2012-06-24 17:47:55 +12:00
Aldo Cortesi
75f06d56cd Request method parsing. 2012-06-24 17:23:37 +12:00
Aldo Cortesi
d4ad3f0b2c Refactor to extract ready_actions and write_values. 2012-06-24 17:01:04 +12:00
Aldo Cortesi
4fc64ac04f Enable anchors on command line. 2012-06-24 16:38:32 +12:00
Aldo Cortesi
e6aa9ff675 Re-enable anchors. 2012-06-24 16:20:50 +12:00
Aldo Cortesi
877b5a2d11 Add staticdir to test.Test. 2012-06-24 15:12:31 +12:00
Aldo Cortesi
2e558b7e9d Fix disconnect, improve coverage, enable file value specifier. 2012-06-24 15:07:45 +12:00
Aldo Cortesi
b71e2f6f2b More doc refinement. 2012-06-24 11:14:54 +12:00
Aldo Cortesi
e236d7746a Move http.py to netlib.http_status 2012-06-23 18:34:35 +12:00
Aldo Cortesi
cb2f11a68e Bump version, adapt for API canges in netlib. 2012-06-23 14:06:54 +12:00
Aldo Cortesi
b335b3a335 Remove last vestige of Tornado pathod. 2012-06-21 17:00:04 +12:00
Aldo Cortesi
cd8fba1d70 Finalize porting built-in web app to Flask. 2012-06-21 16:54:49 +12:00
Aldo Cortesi
f88e899274 Built-in app: Index page. 2012-06-21 16:25:27 +12:00
Aldo Cortesi
f0fd33fb11 Log inspection and manipulation from tests. 2012-06-21 15:39:40 +12:00
Aldo Cortesi
12c140b951 Restore client argument parsing. Add thread-safe logging subsystem. 2012-06-21 14:29:49 +12:00
Aldo Cortesi
1089a52f3d Disconnect, rest refactoring. 2012-06-21 10:56:30 +12:00
Aldo Cortesi
de00497b40 Re-enable SSL service. 2012-06-20 10:59:38 +12:00
Aldo Cortesi
7922e70037 Basic response generation. 2012-06-20 10:51:37 +12:00
Aldo Cortesi
892ee2a904 Start porting web app to Flask. 2012-06-19 16:57:57 +12:00
Aldo Cortesi
a700721891 Porting to netlib proceeds apace. 2012-06-19 13:23:07 +12:00
Aldo Cortesi
bd99a13f39 Start refactoring towards netlib, adding SNI and client testing. 2012-06-17 07:57:24 +12:00
Aldo Cortesi
b1f410c78d Join thread on test exit to avoid race condition. 2012-06-09 20:42:43 +12:00
Aldo Cortesi
00c8bef0ff Port test suite over to Nose. 2012-06-09 15:08:51 +12:00
Aldo Cortesi
a29ebe31dc SSL support for test struss.
Also, rewrite requests usage for latest version.
2012-06-07 17:02:17 +12:00
Aldo Cortesi
9ae53aecd0 We can't sensibly unit test pages withhout firing up a server.
We've just added functionality to do this ourselves, so rip out the old stuff.
2012-06-07 16:35:54 +12:00
Aldo Cortesi
26c8437e88 Better test daemon cleanup, improve utils test coverage. 2012-06-07 14:05:42 +12:00
Aldo Cortesi
34ffe46fa0 Add /api/info, returning general info on the running pathod daemon. 2012-06-07 11:39:37 +12:00
Aldo Cortesi
14b2a69d21 Start building a Pathod unit testing truss.
- Add test.py, which will house the testing API.
- Extend API with a shutdown method, used to terminate the test daemon.
- Refactor to allow clean shutdown.
2012-06-07 11:23:23 +12:00
Aldo Cortesi
b5a74a26ee Let Pathod pick an arbitrary empty port if -p 0 is specified. 2012-06-07 10:17:30 +12:00
Aldo Cortesi
049d3d2b45 lippathod/app.py -> libpathod/pathod.py 2012-06-07 08:50:06 +12:00
Aldo Cortesi
d171e13fd3 Fix redundant imports, tweak TODO for 0.2 2012-04-30 10:09:16 +12:00
Aldo Cortesi
3365acf69f Clear log API. 2012-04-30 09:54:49 +12:00
Aldo Cortesi
24b0acbfab Log retrieval API. 2012-04-30 09:46:49 +12:00
Aldo Cortesi
04f4f8e2a1 setup.py, LICENSE, README.txt 2012-04-29 21:30:48 +12:00
Aldo Cortesi
ccd6eeed4b Make "Go" button on preview form work. 2012-04-29 21:22:00 +12:00
Aldo Cortesi
1431b36c4a Preview in web application. 2012-04-29 21:15:02 +12:00
Aldo Cortesi
37e880b399 Add a rendered version of the docs to the web app. 2012-04-29 18:56:49 +12:00
Aldo Cortesi
5650086ca1 First pass at a README. 2012-04-29 17:37:47 +12:00
Aldo Cortesi
f2b11e5d5c Add logging, expose logs through the web app interface. 2012-04-29 16:22:53 +12:00
Aldo Cortesi
fd946f0c04 Basic logging. 2012-04-29 14:59:54 +12:00
Aldo Cortesi
6d4500c679 Regularize language even further
- Unify offset specifcation syntax, so there's now oly one form for specify
pauses and disconnects.
- Use @ instead of ! for content generation. Mildy more convenient in the shell.
2012-04-29 14:20:27 +12:00
Aldo Cortesi
f03ce81070 Anchor management: list and remove anchors. 2012-04-29 12:18:34 +12:00
Aldo Cortesi
2d88d88f8c Basic anchor adding. 2012-04-29 12:05:38 +12:00
Aldo Cortesi
7ca5c7ae90 Basic SSL support. 2012-04-29 11:18:56 +12:00
Aldo Cortesi
77eca33f26 Refactor application definitions and startup.
Also, create one of the dodgiest web testing trusses in history. Tornado just
seems to have no nice way of doing this.
2012-04-29 10:56:33 +12:00
Aldo Cortesi
ee909e265b Add a shortcut for setting Location header. 2012-04-28 22:54:45 +12:00
Aldo Cortesi
2d989e2fbb Add a shortcut for setting content-type. 2012-04-28 22:51:36 +12:00
Aldo Cortesi
5052a6d34e Unify pause and disconnect event frameworks. 2012-04-28 22:28:28 +12:00
Aldo Cortesi
7810ee475d More language tweaks.
Separators this time - move to colon-separated features, use = for header
key/value separation.
2012-04-28 17:28:40 +12:00
Aldo Cortesi
a779aac9db Make specification language more terse, and more regular. 2012-04-28 17:12:39 +12:00
Aldo Cortesi
5fc2a63781 Better internal error pages. 2012-04-28 14:43:57 +12:00
Aldo Cortesi
2c8f17eae7 First pass at static file serving. 2012-04-28 13:16:51 +12:00
Aldo Cortesi
b4105be21e Initial checkin. 2012-04-28 12:42:03 +12:00