summaryrefslogtreecommitdiff
path: root/src/journal/journal-remote-parse.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-03-15 15:58:03 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-03-17 01:55:48 -0400
commitcc64d0175a3c2c974709e9962c00fbe04d74c43f (patch)
treeb03dc9591925761c583a8b14c101c1052f1ace0d /src/journal/journal-remote-parse.c
parentfdfccdbc985944a57017a25f44dd6acc1a937bab (diff)
journal-remote: HTTP(s) support
The whole tool is made dependent on µhttpd availability. It should be easy to make the µhttpd parts conditional, but since transfer over HTTP seems to be the primary use case, currently this is not done. Current implementation uses nested epoll loops: sd-event is used for the external event loop, and µhttpd uses epoll in its own loop. Unfortunately µhttpd does not expose enough information to add the descriptors it uses to the external event loop. This means that starvation of other events is possible, if one of the inner µhttpd loops is constantly busy. This means that µhttpd servers should not be mixed with other sources. The TLS authentication parts haven't been really tested properly, and should not be take too seriously.
Diffstat (limited to 'src/journal/journal-remote-parse.c')
-rw-r--r--src/journal/journal-remote-parse.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/journal/journal-remote-parse.c b/src/journal/journal-remote-parse.c
index ee2260c5a9..c961844c44 100644
--- a/src/journal/journal-remote-parse.c
+++ b/src/journal/journal-remote-parse.c
@@ -100,6 +100,20 @@ static int get_line(RemoteSource *source, char **line, size_t *size) {
return 1;
}
+int push_data(RemoteSource *source, const char *data, size_t size) {
+ assert(source);
+ assert(source->state != STATE_EOF);
+
+ if (!GREEDY_REALLOC(source->buf, source->size,
+ source->filled + size))
+ return log_oom();
+
+ memcpy(source->buf + source->filled, data, size);
+ source->filled += size;
+
+ return 0;
+}
+
static int fill_fixed_size(RemoteSource *source, void **data, size_t size) {
int n;
char *newbuf = NULL;