Commit Graph

50 Commits

Author SHA1 Message Date
Andrew Bettison
29ce8994f2 Improve HTTP Content-Type handling
Undo a change from late 2015 that allowed the format=text+binarysig
parameter of the rhizome/manifest MIME content-type to be optional -- it
is easy to provide that parameter via libcurl, and the lbard code has
just been updated to provide it.

Make Content-Type handling consistent throughout the Serval DNA code by
using 'struct mime_content_type' to represent both parsed (request) and
sent (response) Content-Type fields, replacing ad-hoc in-line string
literals.

Fix some TODOs by adding the "serval/sid", "rhizome/bid" and
"rhizome/bundlesecret" MIME types, which remain optional for the time
being to preserve REST API compatibility with clients that do not set
the Content-Type of their 'bundle-author', 'bundle-id' and
'bundle-secret' parameters.
2017-10-20 09:55:21 +10:30
Andrew Bettison
093bdfdcd3 Add FALLTHROUGH macro to silence -Wimplicit-fallthrough in GCC7 2017-09-11 12:43:38 +09:30
Jeremy Lakeman
d1a1a41f08 Escape codepoints U+10000 to U+10FFFF in json output as surrogate pairs 2017-06-29 19:23:51 +09:30
Jeremy Lakeman
5b75221c91 Fix compiler warnings when building with android ndk 13b 2016-11-07 10:38:23 +10:30
Jeremy Lakeman
d0da910b19 Avoid undefined behaviour as highlighted by clang 2016-01-27 16:27:47 +10:30
Andrew Bettison
e770998372 Fix empty-string tests on char[]
Caused compiler errors, thanks to Jonas Höchst for reporting.
2015-10-01 07:05:17 +09:30
Jeremy Lakeman
75df3bd4ec Format network addresses using posix API 2015-09-28 11:58:48 +09:30
Andrew Bettison
71c7a4f870 strbuf_json_atom() supports JSON objects and arrays 2015-08-31 19:16:30 +09:30
Andrew Bettison
8d799840df Add alloca_sourceloc(), refactored from log.c 2015-06-29 15:39:19 +09:30
Jeremy Lakeman
4891348684 Ensure unicode strings are correctly handled 2015-06-29 15:12:05 +09:30
Andrew Bettison
04b2a20e54 Rhizome Java API: improved form-data headers
Change manifest Content-Type from rhizome-manifest/text to
rhizome/manifest; format="text+binarysig"

Add "Content-Transfer-Encoding" form-part headers to Java API
sent form parts, although not currently checked by Rhizome
RESTful interface
2014-07-10 21:12:40 +09:30
Andrew Bettison
2c0efc6334 Set up SEGV crash handler in main() not server()
Now all commands will attempt to log a GDB backtrace on a crash, not
just the server daemon process.

Added strbuf_append_signal_name()
2014-05-08 14:24:00 +09:30
Andrew Bettison
60201d78c9 Fix Android compile failure: st_mtim, UTIME_OMIT
Use utimes(2) instead of utimensat(2), use struct timeval instead of
struct timespec

Add strbuf helper functions for struct timeval and time_ms_t
2014-05-02 15:47:51 +09:30
Andrew Bettison
684735b11c Fix config file timestamp bug
Ensure that timestamp always advances by at least one second every time
the config file is modified, add test case

Refactor test defs: detecting started HTTPD is not specific to Rhizome

Refactor struct file_meta and associated functions into "io.h" and io.c

Add various strbuf helper functions for formatting struct timespec
and struct file_meta to assist debug logging
2014-04-29 15:04:20 +09:30
Andrew Bettison
67e3079aa3 Fix return value of mdp_send() 2014-04-16 19:28:11 +09:30
Andrew Bettison
116389b589 "struct json_atom" with strbuf helper functions 2014-02-07 15:59:34 +10: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
de46223cc4 strbuf_json_boolean() 2014-01-20 15:43:37 +10:30
Andrew Bettison
27b37c143f Fix -Wsign-compare warnings in strbuf 2013-12-09 16:29:06 +10:30
Petter Reinholdtsen
804af66308 Add supid copyright headers on request from Andrew Bettison in the serval project. 2013-12-07 18:38:14 +01:00
Petter Reinholdtsen
36a2eed016 Merge latest version. Clean up merge conflict. 2013-12-01 00:06:36 +01:00
Jeremy Lakeman
0d5d878521 Refactor socket name and address length handling 2013-11-27 13:08:37 +10:30
Andrew Bettison
39d6c4fc3a strbuf_append_sockaddr_in() 2013-11-26 15:33:54 +10:30
Andrew Bettison
1634d68dd0 Format UUID strings as lower case hex 2013-11-13 12:45:02 +10:30
Andrew Bettison
9ecf9891fb Add strbuf JSON helper functions 2013-11-07 23:39:53 +10:30
Petter Reinholdtsen
93c43da89b Merge current development branch. 2013-10-30 18:10:08 +01:00
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
8f60a4ceb5 Fix bugs in new HTTP server MIME body parsing code
Fixes 'rhizomeprotocol' test 24 HttpAddLocal.  Four tests still fail.
2013-10-28 12:08:57 +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
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
Petter Reinholdtsen
0d9a812824 Reorder keywords to avoid compilter warnings. 2013-10-13 22:12:17 +02:00
Andrew Bettison
0437e4adbb Add writev_all() function
Use it in rhizome_write_manifest_file() instead of two separate write(2)
system calls or buffered stdio.
2013-10-12 03:54:18 +10:30
Jeremy Lakeman
bc538f8bf3 Fix format for 64bit compilers 2013-09-20 14:39:44 +09:30
Andrew Bettison
d64d9487c1 Issue #20: improve socket set-up logging 2013-09-19 04:30:40 +09:30
Andrew Bettison
2b3119b49b Issue #20: merge branch 'sockets' into 'development'
Daniel's improvements to the local file/abstract socket code, with many
improvements to bring it up to date.
2013-09-19 04:30:14 +09:30
Andrew Bettison
c6666387e8 Add strbuf_append_strftime() 2013-04-04 17:40:58 +10:30
Andrew Bettison
f995a2a42d More strbuf helper functions
strbuf_append_argv()

strbuf_path_join()
2012-12-04 09:47:39 +10:30
Andrew Bettison
d503c8da75 Fix Android compile error 2012-10-24 15:36:52 +10:30
Andrew Bettison
5d62be7b0f Issue #30, easy logging of struct sockaddr 2012-10-23 18:07:56 +10:30
Andrew Bettison
46f81d9d2e Fix formatting bug in strbuf_toprint() et al
Was printing chars above \x7f as \xffffffhh.
2012-10-03 17:10:57 +09:30
Andrew Bettison
62f8d223ea Improve alloca_toprint() functions
Replace "..." quoting with `...` quoting in output, to avoid slosh-escaping the
common double-quote character (") in log output.

Introduce alloca_str_toprint() function that produces an entire null-terminated
string in printable form.

Change various toprint strbuf helper functions to take two optional quote chars
instead of one mandatory.
2012-09-28 17:46:40 +09:30
Andrew Bettison
07349c3aea Improve copyright attributions and comments 2012-07-30 16:15:42 +09:30
Andrew Bettison
bbd28eed45 Add strbuf_toprint(), strbuf_toprint_quoted(), etc. 2012-07-27 18:04:46 +09:30
Andrew Bettison
99ead3b9b1 Add strbuf_append_shell_quote() function 2012-07-26 18:30:24 +09:30
Andrew Bettison
04b95d2590 Merge branch 'andrew' into 'master' 2012-07-25 18:04:16 +09:30
Andrew Bettison
6de247e576 Improve diagnosis of SEGV failures in tests 2012-07-24 15:39:36 +09:30
Andrew Bettison
3b44bb6e58 More progress on dnahelper 2012-07-19 17:59:45 +09:30
Andrew Bettison
5aac5a3854 Unfinished dnahelper implementation 2012-07-18 19:16:30 +09:30
Andrew Bettison
c7488de510 Add strbuf_helpers.[ch]
Functions to help assemble strbuf contents.
2012-07-11 14:11:59 +09:30