Andrew Bettison
0769fa54e8
Improve MeshMS RESTful HTTP failure reporting
...
Add "meshms_status_code" element to simple JSON responses
2014-02-07 16:28:40 +10:30
Andrew Bettison
015ed0b181
Refactor to rename "Rhizome HTTP server" to "HTTPD server"
...
Move HTTPD start/stop/dispatch logic from rhizome_httpd.c into new
httpd.c
Rename config.debug.httpd -> config.debug.http_server
Rename config.debug.rhizome_httpd -> config.debug.httpd
Rename config.debug.rhizome_nohttptx -> config.debug.nohttptx
2014-02-03 15:56:07 +10:30
Andrew Bettison
8897563d09
Implement HTTP GET /restful/meshms/<SID>/conversationlist.json
2014-01-23 10:52:43 +10:30
Andrew Bettison
6a1c8bcf5a
All HTTP RESTful responses are JSON, not HTTP
...
Even error responses (typically code 403)
2014-01-20 15:44:21 +10:30
Andrew Bettison
ee9c96bb8c
Implement HTTP POST /restful/rhizome/insert
...
Change HTTP request buffer pointers from (const char*) to (char*)
because some Rhizome operations can modify received data in-place, eg,
when decrypting it.
2013-12-30 18:09:56 +10:30
Andrew Bettison
0c88f8bf89
Replace str_to_uint() with str_to_uint32()
...
Also str_to_int() with str_to_int32()
2013-12-30 16:30:43 +10:30
Andrew Bettison
b37e27f5da
Improve HTTP server multipart body parsing
...
Every handler function can return an HTTP response status code
to terminate request parsing and start the response.
2013-12-27 19:07:00 +10:30
Andrew Bettison
d7b926c39c
HTTP server response codes 408, 409
2013-12-20 11:29:26 +10:30
Andrew Bettison
f5b757c022
Remove some unconditional debug from HTTP server
2013-12-18 17:44:16 +10:30
Andrew Bettison
f3c88def41
Refactor HTTP server result code handling
...
Rhizome dispatch functions now simply return the HTTP result code, or 1
if they have initiated the response themselves.
2013-12-16 15:09:46 +10:30
Andrew Bettison
98a6fc55d9
HTTP server support for extra response headers
2013-12-13 14:49:40 +10:30
Andrew Bettison
dd1e9f2ffb
Improve HTTP server string reservation
...
So that reserved strings can be released, reclaiming buffer space for
responses and for response header strings
2013-12-12 17:49:19 +10:30
Andrew Bettison
1e96a8745d
Merge branch 'development' into 'naf4'
2013-12-11 15:15:31 +10:30
Andrew Bettison
4428a76379
Use ssize_t for read(2) and write(2) return value
...
Test for errors using == -1 not < 0, and cast to (size_t) subsequently
Fixes some -Wsign-compare warnings
2013-12-10 17:21:35 +10:30
Andrew Bettison
40698b14e0
Fix bug in HTTP server: GET Content-Type
...
Was incorrectly detecting that a Content-Type header was supplied
with a GET request, when in fact none had been supplied
2013-12-05 17:24:54 +10:30
Andrew Bettison
9b64bb87e0
Uniform copyright notices
...
Added some missing copyright/license block comments
2013-12-04 17:15:36 +10:30
Andrew Bettison
1acfff6ab5
Add HTTP server pause response function
2013-11-19 15:38:45 +10:30
Andrew Bettison
f2b652c094
Refactor Base64 decoding from HTTP server to str.c
...
Also add a Base64 encoding function, not tested yet
2013-11-15 17:09:55 +10:30
Andrew Bettison
9418f9d65d
Refactor HTTP string utils into str.[hc]
...
Improve "str.h" layout and commenting. Re-implement hexvalue().
2013-11-14 23:13:37 +10:30
Andrew Bettison
6b961c56ce
Fix HTTP /restful/rhizome/bundlelist.json
...
Write test case assertions using jq(1) utility, increase from four
bundles to 100.
Fix bugs in HTTP server content generation logic.
Make payload content generator read payload 4KiB at a time, to
always read on filesystem block boundaries for performance. Increase
size of payload in relevant test case.
2013-11-11 16:21:26 +10:30
Andrew Bettison
d5b48f5a9e
Improve HTTP server generated content logic
...
Content generator functions now take arguments describing the buffer
they are to fill, and respond with a struct containing the number of
bytes filled, and the number of free bytes needed before being called
again.
The HTTP response logic now fills the buffer as much as possible before
calling write(2) by topping it up instead of waiting for it to be
completely emptied before generating more content.
2013-11-09 11:31:21 +10:30
Andrew Bettison
d337542067
Improve HTTP server generated content logic
...
Support generated content with an unspecified Content-Length. Generator
functions return 1 if there is more content to come, and 0 if they have
just produced the last piece of content.
2013-11-07 23:39:24 +10:30
Andrew Bettison
47988bfe0f
Make Content-Length optional in HTTP responses
...
To eventually support the /restful/rhizome/bundlelist.json query which
will not compute in advance the length of its response.
2013-11-07 17:18:38 +10:30
Andrew Bettison
016fbe0244
Merge branch 'development' into 'naf4'
2013-11-04 20:01:58 +10:30
Andrew Bettison
e61466b815
Fix printf format string for 32-bit systems
...
The C standard defines the difference between two (char*) pointers is
defined to be either short, int or long. Not long long (64 bits). On
64-bit systems, logging "%"PRIhttp_size_t (int64_t) for pointer
difference works by coincidence because a long or int is 64 bits, but
causes SEGV on 32 bit platforms.
The portable solution is to log pointer differences using "%d" and
explicitly cast the pointer difference to (int) in the arg list, or
"%ld" and cast it to (long).
2013-11-04 19:33:15 +10:30
Jeremy Lakeman
5e756bec1e
Fix types for 64-bit compilation
2013-10-30 17:23:44 +10:30
Andrew Bettison
2ac1bc3240
Get HTTP Basic authentication working
...
Second 'rhizomehttp' test now passes
2013-10-30 11:07:45 +10:30
Andrew Bettison
21fe12859f
Implement HTTP basic authentication
...
Use it in /restful/rhizome/bundlelist.json -- first 'rhizomehttp' test
passes
2013-10-29 17:32:04 +10:30
Andrew Bettison
b9faf54c91
Support more HTTP multipart inner headers
...
Now Content-Length and Content-Type are parsed as well as
Content-Disposition
2013-10-28 22:27:27 +10:30
Andrew Bettison
3cac1b51a1
Fix subtle MIME parsing bug
2013-10-28 17:50:49 +10:30
Andrew Bettison
6ee691b161
Fix bugs in new HTTP server MIME body parsing code
...
Fixes all remaining 'rhizomeprotocol' test failures.
2013-10-28 14:25:16 +10:30
Andrew Bettison
2a9329c0c8
Fix bugs in new HTTP server MIME body parsing code
...
Fixes 'rhizomeprotocol' test 24 HttpImport. Five tests still fail.
2013-10-27 13:19:23 +10:30
Andrew Bettison
0397a47753
Fix some test failures in new HTTP server code
2013-10-26 20:28:47 +10:30
Andrew Bettison
5ff5a02bb9
Fix a couple more bugs in new HTTP server code
2013-10-25 23:57:23 +10:30
Andrew Bettison
6488f7ad65
Fix basic bugs in new HTTP server code
...
All 'rhizomeprotocol' HTTP tests still fail
2013-10-25 17:38:51 +10:30
Andrew Bettison
291a631095
New header file "fdqueue.h"
...
So that "http_server.h" does not have to include "serval.h" which
creates a circular dependency.
Remove the __SERVALDNA__HTTP_SERVER_IMPLEMENTATION hack from
"http_server.h"
2013-10-25 00:20:53 +10:30
Andrew Bettison
fa21bec880
Rewrite HTTP server
2013-10-25 00:19:37 +10:30