summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef77268)
raw | patch | inline | side by side (parent: ef77268)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Sat, 17 Jan 2015 15:10:46 +0000 (16:10 +0100) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Tue, 20 Jan 2015 05:49:36 +0000 (06:49 +0100) |
This allows multiple destinations to work again (fixes #821), using the
same logic as other write plugins.
The callback name would now be something like:
`write_http/http://example.com/endpoint`
which is not very nice.
The next step would be to change this plugin to use `<Node>` blocks
like many others, and pass the URL as a parameter inside each instance
block. So I see this patch as the minimum required to let 5.3 and 5.4
users use this plugin with multiple destinations.
Conflicts:
src/write_http.c
same logic as other write plugins.
The callback name would now be something like:
`write_http/http://example.com/endpoint`
which is not very nice.
The next step would be to change this plugin to use `<Node>` blocks
like many others, and pass the URL as a parameter inside each instance
block. So I see this patch as the minimum required to let 5.3 and 5.4
users use this plugin with multiple destinations.
Conflicts:
src/write_http.c
src/write_http.c | patch | blob | history |
diff --git a/src/write_http.c b/src/write_http.c
index eab1f617626123c5ba14893532d60c2960891c02..1253a26a8dc9fc15cb15352c117fb92ea084eab6 100644 (file)
--- a/src/write_http.c
+++ b/src/write_http.c
wh_callback_t *cb;
int buffer_size = 0;
user_data_t user_data;
+ char callback_name[DATA_MAX_NAME_LEN];
int i;
cb = malloc (sizeof (*cb));
/* Nulls the buffer and sets ..._free and ..._fill. */
wh_reset_buffer (cb);
- DEBUG ("write_http: Registering write callback with URL %s",
+ ssnprintf (callback_name, sizeof (callback_name), "write_http/%s",
cb->location);
+ DEBUG ("write_http: Registering write callback '%s' with URL '%s'",
+ callback_name, cb->location);
memset (&user_data, 0, sizeof (user_data));
user_data.data = cb;
user_data.free_func = NULL;
- plugin_register_flush ("write_http", wh_flush, &user_data);
+ plugin_register_flush (callback_name, wh_flush, &user_data);
user_data.free_func = wh_callback_free;
- plugin_register_write ("write_http", wh_write, &user_data);
+ plugin_register_write (callback_name, wh_write, &user_data);
return (0);
} /* }}} int wh_config_url */