Commit Graph

23 Commits

Author SHA1 Message Date
Andrew Bettison
98ed0406c5 Refactor Rhizome result handling
- Introduce the new 'struct rhizome_bundle_result' that contains a
  rhizome_bundle_status enum value and an optional, nul-terminated
  string that provides an explanation of the cause of the status; add
  functions to construct, query, and free the struct

- Replace 'enum rhizome_add_result' with 'struct rhizome_bundle_result',
  removing an unnecessary level of enum interpretation

- Make rhizome_fill_manifest() return 'struct rhizome_bundle_result' and
  add logic to check that the supplied author SID is correct (previous
  behaviour was: if an incorrect author SID was supplied but the correct
  author could be found in the keyring, then the incorrect one was
  silently ignored)

- Simplify the response code in rhizome_restful.cc to take advantage of
  the new 'struct rhizome_bundle_result'; in particular, the mapping
  from 'enum rhizome_bundle_status' codes to HTTP status codes is now
  expressed in a single switch statement

- Fix some minor failures in test scripts revealed by the changes
2015-12-01 00:51:15 +10:30
Andrew Bettison
419364b5a9 Improve REST HTTP response status codes
List all the HTTP status codes in the REST API tech doc.

Only use 403 Forbidden for requests originating from a disallowed
origin (ie, not localhost).

- Return 400 for missing, unknown, duplicate and out-of-order form
  parts in POST requests.
- Return 415 Unsupported Media Type for unsupported form part
  Content-Disposition and Content-Type (including unsupported
  charset).
- Return 414 Request-URI Too Long for any buffer exhaustion while
  parsing request.
- Return 419 Authentication Timeout for missing crypto secret.
2015-11-02 12:26:40 +10:30
gardners
52bd428c09 make rhizome http port number configurable via serval.conf 2015-08-24 16:06:25 +09:30
Jeremy Lakeman
84caf21969 Use section linking to define httpd pages 2015-08-24 12:49:09 +09:30
Andrew Bettison
abb2a39330 Fix MeshMS REST newsince race condition
During GET /restful/meshms/SID1/SID2/newsince/messagelist.json, if a new
message was received before the request reached the end of its message
iterator and paused, then the new message did not make it into the
output.
2015-06-29 15:39:19 +09:30
Andrew Bettison
9f15c4770c Add [httpd/N] context to HTTP server logging 2015-06-29 15:39:19 +09:30
Andrew Bettison
0ac9d15b8f Rename variable to current_httpd_request_count 2015-06-29 15:39:19 +09:30
Andrew Bettison
6febcc350d Replace RESTful newsince polling with triggers
Remove the 'api.restful.newsince_poll_ms' config option, no longer
needed.
2015-06-02 02:23:06 +09:30
Andrew Bettison
ccf4824605 Add 'manifest-id' parameter to /restful/rhizome/insert 2015-03-28 05:09:38 +10:30
Andrew Bettison
015b4a0b07 Refactor and improve "journal append"
Distinguish between fatal and user-supplied-input errors, return
error descriptive text in a strbuf to allow dynamic content, apply
user-supplied field assgnments/deletions _after_ copying existing
manifest fields, use exit status 4 (invalid manifest) when applying
journal append to a non-journal or vice versa
2015-03-23 17:38:46 +10:30
Andrew Bettison
c9131f43a2 POST /restful/rhizome/append for journals 2015-03-02 18:52:12 +10:30
Jeremy Lakeman
ce21c64809 Allow serving of static http content from [etc]/static/ 2014-12-01 10:21:35 +10:30
Andrew Bettison
d8f26a76ee Accept '#passphrase' for bundle secret arguments
As well as a hex string.  Applies to CLI and also REST API.
Maximum pass phrase length is 80 ASCII chars.
2014-11-14 13:11:44 +10:30
Andrew Bettison
a4be1b0b0c Fix RESTful MeshMS newsince ACK logic
/restful/meshms/newsince/SID1/SID2/newsince/TOKEN/messagelist.json now
always lists an ACK as soon as it is received, instead of waiting for a
message to arrive as well.
2014-11-12 23:09:00 +10:30
Jeremy Lakeman
851144ea0a Refactor keyring identity iteration 2014-10-31 15:19:59 +10:30
Tobias Wooldridge
e79e74feb9 Exposes a list of configured identities through the REST API at /keyring/identities.json 2014-10-31 15:19:59 +10:30
Andrew Bettison
cf43635789 Improve Rhizome HTTP RESTful interface
Add RHIZOME_BUNDLE_STATUS_READONLY enum value

Tighten up switch statements on bundle and payload status enums (no
default labels)

Rename some recently added enum entries

Return bundle status and payload status in HTTP responses

Add test for failing to decrypt a foreign encrypted bundle payload,
fix bug that caused an assertion failure

Add tests for fetching a non-existent manifest and fetching bundles
whose payload blob is not in the store
2014-07-10 06:29:51 +09:30
Andrew Bettison
067340bbba Change HTTP Authorization realm to "Serval RESTful API"
Was "Serval Rhizome", which is not accurate
2014-06-30 11:11:01 +09:30
Jeremy Lakeman
186b6cbc2f Allow more servald's to be running during tests 2014-06-27 12:46:29 +09:30
Andrew Bettison
819b8dc9e7 MeshMS RESTful API stricter on incoming form data
/restful/meshms/SID/SID/sendmessage now enforces Content-Disposition:
form-data (was ignoring), and enforces Content-Type: text/plain;
charset=utf-8 (was ignoring)

New negative test cases to ensure that these are treated strictly
2014-06-23 12:27:09 +09:30
Andrew Bettison
fd86a3d17f Implement HTTP POST /restful/meshms/<SID>/<SID>/sendmessage
Rename struct meshms_ply fields from "buffer" to "record" for
consistency with comment terminology
2014-02-05 14:28:15 +10:30
Andrew Bettison
fb2709d10c Create rhizome_restful.c, meshms_restful.c
Move code from rhizome_http.c into rhizome_restful.c and
meshms_restful.c
2014-02-03 23:05:15 +10:30
Andrew Bettison
051066af86 Rename "rhizome_http.h" to "httpd.h" 2014-02-03 21:40:05 +10:30