diff options
author | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
commit | d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch) | |
tree | 9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/gns/plugin_rest_gns.c | |
parent | a0fce305c565c0937d917a92712f15e9c5736260 (diff) | |
download | gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip |
uncrustify as demanded.
Diffstat (limited to 'src/gns/plugin_rest_gns.c')
-rw-r--r-- | src/gns/plugin_rest_gns.c | 284 |
1 files changed, 142 insertions, 142 deletions
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index 1ecde12f0..2fc103ef6 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c | |||
@@ -16,7 +16,7 @@ | |||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @author Philippe Buschmann | 21 | * @author Philippe Buschmann |
22 | * @file gns/plugin_rest_gns.c | 22 | * @file gns/plugin_rest_gns.c |
@@ -65,17 +65,14 @@ static char *allow_methods; | |||
65 | /** | 65 | /** |
66 | * @brief struct returned by the initialization function of the plugin | 66 | * @brief struct returned by the initialization function of the plugin |
67 | */ | 67 | */ |
68 | struct Plugin | 68 | struct Plugin { |
69 | { | ||
70 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 69 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
71 | }; | 70 | }; |
72 | 71 | ||
73 | /** | 72 | /** |
74 | * The request handle | 73 | * The request handle |
75 | */ | 74 | */ |
76 | struct RequestHandle | 75 | struct RequestHandle { |
77 | { | ||
78 | |||
79 | /** | 76 | /** |
80 | * Connection to GNS | 77 | * Connection to GNS |
81 | */ | 78 | */ |
@@ -143,35 +140,36 @@ struct RequestHandle | |||
143 | * @param handle Handle to clean up | 140 | * @param handle Handle to clean up |
144 | */ | 141 | */ |
145 | static void | 142 | static void |
146 | cleanup_handle (void *cls) | 143 | cleanup_handle(void *cls) |
147 | { | 144 | { |
148 | struct RequestHandle *handle = cls; | 145 | struct RequestHandle *handle = cls; |
149 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n"); | 146 | |
147 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n"); | ||
150 | 148 | ||
151 | if (NULL != handle->gns_lookup) | 149 | if (NULL != handle->gns_lookup) |
152 | { | 150 | { |
153 | GNUNET_GNS_lookup_with_tld_cancel (handle->gns_lookup); | 151 | GNUNET_GNS_lookup_with_tld_cancel(handle->gns_lookup); |
154 | handle->gns_lookup = NULL; | 152 | handle->gns_lookup = NULL; |
155 | } | 153 | } |
156 | if (NULL != handle->gns) | 154 | if (NULL != handle->gns) |
157 | { | 155 | { |
158 | GNUNET_GNS_disconnect (handle->gns); | 156 | GNUNET_GNS_disconnect(handle->gns); |
159 | handle->gns = NULL; | 157 | handle->gns = NULL; |
160 | } | 158 | } |
161 | 159 | ||
162 | if (NULL != handle->timeout_task) | 160 | if (NULL != handle->timeout_task) |
163 | { | 161 | { |
164 | GNUNET_SCHEDULER_cancel (handle->timeout_task); | 162 | GNUNET_SCHEDULER_cancel(handle->timeout_task); |
165 | handle->timeout_task = NULL; | 163 | handle->timeout_task = NULL; |
166 | } | 164 | } |
167 | if (NULL != handle->url) | 165 | if (NULL != handle->url) |
168 | GNUNET_free (handle->url); | 166 | GNUNET_free(handle->url); |
169 | if (NULL != handle->name) | 167 | if (NULL != handle->name) |
170 | GNUNET_free (handle->name); | 168 | GNUNET_free(handle->name); |
171 | if (NULL != handle->emsg) | 169 | if (NULL != handle->emsg) |
172 | GNUNET_free (handle->emsg); | 170 | GNUNET_free(handle->emsg); |
173 | 171 | ||
174 | GNUNET_free (handle); | 172 | GNUNET_free(handle); |
175 | } | 173 | } |
176 | 174 | ||
177 | 175 | ||
@@ -181,39 +179,40 @@ cleanup_handle (void *cls) | |||
181 | * @param cls the `struct RequestHandle` | 179 | * @param cls the `struct RequestHandle` |
182 | */ | 180 | */ |
183 | static void | 181 | static void |
184 | do_error (void *cls) | 182 | do_error(void *cls) |
185 | { | 183 | { |
186 | struct RequestHandle *handle = cls; | 184 | struct RequestHandle *handle = cls; |
187 | struct MHD_Response *resp; | 185 | struct MHD_Response *resp; |
188 | json_t *json_error = json_object (); | 186 | json_t *json_error = json_object(); |
189 | char *response; | 187 | char *response; |
190 | 188 | ||
191 | if (NULL != handle->timeout_task) | 189 | if (NULL != handle->timeout_task) |
192 | GNUNET_SCHEDULER_cancel (handle->timeout_task); | 190 | GNUNET_SCHEDULER_cancel(handle->timeout_task); |
193 | handle->timeout_task = NULL; | 191 | handle->timeout_task = NULL; |
194 | if (NULL == handle->emsg) | 192 | if (NULL == handle->emsg) |
195 | handle->emsg = GNUNET_strdup (GNUNET_REST_GNS_ERROR_UNKNOWN); | 193 | handle->emsg = GNUNET_strdup(GNUNET_REST_GNS_ERROR_UNKNOWN); |
196 | 194 | ||
197 | json_object_set_new (json_error, "error", json_string (handle->emsg)); | 195 | json_object_set_new(json_error, "error", json_string(handle->emsg)); |
198 | 196 | ||
199 | if (0 == handle->response_code) | 197 | if (0 == handle->response_code) |
200 | handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; | 198 | handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; |
201 | response = json_dumps (json_error, 0); | 199 | response = json_dumps(json_error, 0); |
202 | resp = GNUNET_REST_create_response (response); | 200 | resp = GNUNET_REST_create_response(response); |
203 | handle->proc (handle->proc_cls, resp, handle->response_code); | 201 | handle->proc(handle->proc_cls, resp, handle->response_code); |
204 | json_decref (json_error); | 202 | json_decref(json_error); |
205 | GNUNET_free (response); | 203 | GNUNET_free(response); |
206 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 204 | GNUNET_SCHEDULER_add_now(&cleanup_handle, handle); |
207 | } | 205 | } |
208 | 206 | ||
209 | 207 | ||
210 | static void | 208 | static void |
211 | do_timeout (void *cls) | 209 | do_timeout(void *cls) |
212 | { | 210 | { |
213 | struct RequestHandle *handle = cls; | 211 | struct RequestHandle *handle = cls; |
212 | |||
214 | handle->timeout_task = NULL; | 213 | handle->timeout_task = NULL; |
215 | handle->response_code = MHD_HTTP_REQUEST_TIMEOUT; | 214 | handle->response_code = MHD_HTTP_REQUEST_TIMEOUT; |
216 | do_error (handle); | 215 | do_error(handle); |
217 | } | 216 | } |
218 | 217 | ||
219 | 218 | ||
@@ -226,10 +225,10 @@ do_timeout (void *cls) | |||
226 | * @param rd the records in reply | 225 | * @param rd the records in reply |
227 | */ | 226 | */ |
228 | static void | 227 | static void |
229 | handle_gns_response (void *cls, | 228 | handle_gns_response(void *cls, |
230 | int was_gns, | 229 | int was_gns, |
231 | uint32_t rd_count, | 230 | uint32_t rd_count, |
232 | const struct GNUNET_GNSRECORD_Data *rd) | 231 | const struct GNUNET_GNSRECORD_Data *rd) |
233 | { | 232 | { |
234 | struct RequestHandle *handle = cls; | 233 | struct RequestHandle *handle = cls; |
235 | struct MHD_Response *resp; | 234 | struct MHD_Response *resp; |
@@ -239,22 +238,22 @@ handle_gns_response (void *cls, | |||
239 | handle->gns_lookup = NULL; | 238 | handle->gns_lookup = NULL; |
240 | 239 | ||
241 | if (GNUNET_NO == was_gns) | 240 | if (GNUNET_NO == was_gns) |
242 | { | 241 | { |
243 | handle->response_code = MHD_HTTP_NOT_FOUND; | 242 | handle->response_code = MHD_HTTP_NOT_FOUND; |
244 | handle->emsg = GNUNET_strdup (GNUNET_REST_GNS_NOT_FOUND); | 243 | handle->emsg = GNUNET_strdup(GNUNET_REST_GNS_NOT_FOUND); |
245 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 244 | GNUNET_SCHEDULER_add_now(&do_error, handle); |
246 | return; | 245 | return; |
247 | } | 246 | } |
248 | 247 | ||
249 | result_obj = GNUNET_JSON_from_gnsrecord (handle->name, rd, rd_count); | 248 | result_obj = GNUNET_JSON_from_gnsrecord(handle->name, rd, rd_count); |
250 | 249 | ||
251 | result = json_dumps (result_obj, 0); | 250 | result = json_dumps(result_obj, 0); |
252 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); | 251 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); |
253 | resp = GNUNET_REST_create_response (result); | 252 | resp = GNUNET_REST_create_response(result); |
254 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 253 | handle->proc(handle->proc_cls, resp, MHD_HTTP_OK); |
255 | GNUNET_free (result); | 254 | GNUNET_free(result); |
256 | json_decref (result_obj); | 255 | json_decref(result_obj); |
257 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 256 | GNUNET_SCHEDULER_add_now(&cleanup_handle, handle); |
258 | } | 257 | } |
259 | 258 | ||
260 | 259 | ||
@@ -266,9 +265,9 @@ handle_gns_response (void *cls, | |||
266 | * @param cls the RequestHandle | 265 | * @param cls the RequestHandle |
267 | */ | 266 | */ |
268 | void | 267 | void |
269 | get_gns_cont (struct GNUNET_REST_RequestHandle *con_handle, | 268 | get_gns_cont(struct GNUNET_REST_RequestHandle *con_handle, |
270 | const char *url, | 269 | const char *url, |
271 | void *cls) | 270 | void *cls) |
272 | { | 271 | { |
273 | struct RequestHandle *handle = cls; | 272 | struct RequestHandle *handle = cls; |
274 | struct GNUNET_HashCode key; | 273 | struct GNUNET_HashCode key; |
@@ -277,50 +276,50 @@ get_gns_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
277 | 276 | ||
278 | name = NULL; | 277 | name = NULL; |
279 | handle->name = NULL; | 278 | handle->name = NULL; |
280 | if (strlen (GNUNET_REST_API_NS_GNS) < strlen (handle->url)) | 279 | if (strlen(GNUNET_REST_API_NS_GNS) < strlen(handle->url)) |
281 | { | 280 | { |
282 | name = &handle->url[strlen (GNUNET_REST_API_NS_GNS) + 1]; | 281 | name = &handle->url[strlen(GNUNET_REST_API_NS_GNS) + 1]; |
283 | } | 282 | } |
284 | 283 | ||
285 | if (NULL == name) | 284 | if (NULL == name) |
286 | { | 285 | { |
287 | handle->response_code = MHD_HTTP_NOT_FOUND; | 286 | handle->response_code = MHD_HTTP_NOT_FOUND; |
288 | handle->emsg = GNUNET_strdup (GNUNET_REST_GNS_NOT_FOUND); | 287 | handle->emsg = GNUNET_strdup(GNUNET_REST_GNS_NOT_FOUND); |
289 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 288 | GNUNET_SCHEDULER_add_now(&do_error, handle); |
290 | return; | 289 | return; |
291 | } | 290 | } |
292 | if (0 >= strlen (name)) | 291 | if (0 >= strlen(name)) |
293 | { | 292 | { |
294 | handle->response_code = MHD_HTTP_NOT_FOUND; | 293 | handle->response_code = MHD_HTTP_NOT_FOUND; |
295 | handle->emsg = GNUNET_strdup (GNUNET_REST_GNS_NOT_FOUND); | 294 | handle->emsg = GNUNET_strdup(GNUNET_REST_GNS_NOT_FOUND); |
296 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 295 | GNUNET_SCHEDULER_add_now(&do_error, handle); |
297 | return; | 296 | return; |
298 | } | 297 | } |
299 | handle->name = GNUNET_strdup (name); | 298 | handle->name = GNUNET_strdup(name); |
300 | 299 | ||
301 | handle->record_type = UINT32_MAX; | 300 | handle->record_type = UINT32_MAX; |
302 | GNUNET_CRYPTO_hash (GNUNET_REST_GNS_PARAM_RECORD_TYPE, | 301 | GNUNET_CRYPTO_hash(GNUNET_REST_GNS_PARAM_RECORD_TYPE, |
303 | strlen (GNUNET_REST_GNS_PARAM_RECORD_TYPE), | 302 | strlen(GNUNET_REST_GNS_PARAM_RECORD_TYPE), |
304 | &key); | 303 | &key); |
305 | if (GNUNET_YES == | 304 | if (GNUNET_YES == |
306 | GNUNET_CONTAINER_multihashmap_contains (con_handle->url_param_map, &key)) | 305 | GNUNET_CONTAINER_multihashmap_contains(con_handle->url_param_map, &key)) |
307 | { | 306 | { |
308 | record_type = | 307 | record_type = |
309 | GNUNET_CONTAINER_multihashmap_get (con_handle->url_param_map, &key); | 308 | GNUNET_CONTAINER_multihashmap_get(con_handle->url_param_map, &key); |
310 | handle->record_type = GNUNET_GNSRECORD_typename_to_number (record_type); | 309 | handle->record_type = GNUNET_GNSRECORD_typename_to_number(record_type); |
311 | } | 310 | } |
312 | 311 | ||
313 | if (UINT32_MAX == handle->record_type) | 312 | if (UINT32_MAX == handle->record_type) |
314 | { | 313 | { |
315 | handle->record_type = GNUNET_GNSRECORD_TYPE_ANY; | 314 | handle->record_type = GNUNET_GNSRECORD_TYPE_ANY; |
316 | } | 315 | } |
317 | 316 | ||
318 | handle->gns_lookup = GNUNET_GNS_lookup_with_tld (handle->gns, | 317 | handle->gns_lookup = GNUNET_GNS_lookup_with_tld(handle->gns, |
319 | handle->name, | 318 | handle->name, |
320 | handle->record_type, | 319 | handle->record_type, |
321 | GNUNET_NO, | 320 | GNUNET_NO, |
322 | &handle_gns_response, | 321 | &handle_gns_response, |
323 | handle); | 322 | handle); |
324 | } | 323 | } |
325 | 324 | ||
326 | 325 | ||
@@ -332,18 +331,18 @@ get_gns_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
332 | * @param cls the RequestHandle | 331 | * @param cls the RequestHandle |
333 | */ | 332 | */ |
334 | static void | 333 | static void |
335 | options_cont (struct GNUNET_REST_RequestHandle *con_handle, | 334 | options_cont(struct GNUNET_REST_RequestHandle *con_handle, |
336 | const char *url, | 335 | const char *url, |
337 | void *cls) | 336 | void *cls) |
338 | { | 337 | { |
339 | struct MHD_Response *resp; | 338 | struct MHD_Response *resp; |
340 | struct RequestHandle *handle = cls; | 339 | struct RequestHandle *handle = cls; |
341 | 340 | ||
342 | //independent of path return all options | 341 | //independent of path return all options |
343 | resp = GNUNET_REST_create_response (NULL); | 342 | resp = GNUNET_REST_create_response(NULL); |
344 | MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods); | 343 | MHD_add_response_header(resp, "Access-Control-Allow-Methods", allow_methods); |
345 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 344 | handle->proc(handle->proc_cls, resp, MHD_HTTP_OK); |
346 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 345 | GNUNET_SCHEDULER_add_now(&cleanup_handle, handle); |
347 | return; | 346 | return; |
348 | } | 347 | } |
349 | 348 | ||
@@ -354,20 +353,20 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
354 | * @param handle the request handle | 353 | * @param handle the request handle |
355 | */ | 354 | */ |
356 | static void | 355 | static void |
357 | init_cont (struct RequestHandle *handle) | 356 | init_cont(struct RequestHandle *handle) |
358 | { | 357 | { |
359 | struct GNUNET_REST_RequestHandlerError err; | 358 | struct GNUNET_REST_RequestHandlerError err; |
360 | static const struct GNUNET_REST_RequestHandler handlers[] = | 359 | static const struct GNUNET_REST_RequestHandler handlers[] = |
361 | {{MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_GNS, &get_gns_cont}, | 360 | { { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_GNS, &get_gns_cont }, |
362 | {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_GNS, &options_cont}, | 361 | { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_GNS, &options_cont }, |
363 | GNUNET_REST_HANDLER_END}; | 362 | GNUNET_REST_HANDLER_END }; |
364 | 363 | ||
365 | if (GNUNET_NO == | 364 | if (GNUNET_NO == |
366 | GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle)) | 365 | GNUNET_REST_handle_request(handle->rest_handle, handlers, &err, handle)) |
367 | { | 366 | { |
368 | handle->response_code = err.error_code; | 367 | handle->response_code = err.error_code; |
369 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 368 | GNUNET_SCHEDULER_add_now(&do_error, handle); |
370 | } | 369 | } |
371 | } | 370 | } |
372 | 371 | ||
373 | 372 | ||
@@ -383,30 +382,30 @@ init_cont (struct RequestHandle *handle) | |||
383 | * @return GNUNET_OK if request accepted | 382 | * @return GNUNET_OK if request accepted |
384 | */ | 383 | */ |
385 | static void | 384 | static void |
386 | rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | 385 | rest_process_request(struct GNUNET_REST_RequestHandle *rest_handle, |
387 | GNUNET_REST_ResultProcessor proc, | 386 | GNUNET_REST_ResultProcessor proc, |
388 | void *proc_cls) | 387 | void *proc_cls) |
389 | { | 388 | { |
390 | struct RequestHandle *handle = GNUNET_new (struct RequestHandle); | 389 | struct RequestHandle *handle = GNUNET_new(struct RequestHandle); |
391 | 390 | ||
392 | handle->response_code = 0; | 391 | handle->response_code = 0; |
393 | handle->timeout = | 392 | handle->timeout = |
394 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60); | 393 | GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60); |
395 | handle->proc_cls = proc_cls; | 394 | handle->proc_cls = proc_cls; |
396 | handle->proc = proc; | 395 | handle->proc = proc; |
397 | handle->rest_handle = rest_handle; | 396 | handle->rest_handle = rest_handle; |
398 | 397 | ||
399 | handle->url = GNUNET_strdup (rest_handle->url); | 398 | handle->url = GNUNET_strdup(rest_handle->url); |
400 | if (handle->url[strlen (handle->url) - 1] == '/') | 399 | if (handle->url[strlen(handle->url) - 1] == '/') |
401 | handle->url[strlen (handle->url) - 1] = '\0'; | 400 | handle->url[strlen(handle->url) - 1] = '\0'; |
402 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting...\n"); | 401 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting...\n"); |
403 | handle->gns = GNUNET_GNS_connect (cfg); | 402 | handle->gns = GNUNET_GNS_connect(cfg); |
404 | init_cont (handle); | 403 | init_cont(handle); |
405 | 404 | ||
406 | handle->timeout_task = | 405 | handle->timeout_task = |
407 | GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_timeout, handle); | 406 | GNUNET_SCHEDULER_add_delayed(handle->timeout, &do_timeout, handle); |
408 | 407 | ||
409 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected\n"); | 408 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connected\n"); |
410 | } | 409 | } |
411 | 410 | ||
412 | 411 | ||
@@ -417,7 +416,7 @@ rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
417 | * @return NULL on error, otherwise the plugin context | 416 | * @return NULL on error, otherwise the plugin context |
418 | */ | 417 | */ |
419 | void * | 418 | void * |
420 | libgnunet_plugin_rest_gns_init (void *cls) | 419 | libgnunet_plugin_rest_gns_init(void *cls) |
421 | { | 420 | { |
422 | static struct Plugin plugin; | 421 | static struct Plugin plugin; |
423 | struct GNUNET_REST_Plugin *api; | 422 | struct GNUNET_REST_Plugin *api; |
@@ -425,21 +424,21 @@ libgnunet_plugin_rest_gns_init (void *cls) | |||
425 | cfg = cls; | 424 | cfg = cls; |
426 | if (NULL != plugin.cfg) | 425 | if (NULL != plugin.cfg) |
427 | return NULL; /* can only initialize once! */ | 426 | return NULL; /* can only initialize once! */ |
428 | memset (&plugin, 0, sizeof (struct Plugin)); | 427 | memset(&plugin, 0, sizeof(struct Plugin)); |
429 | plugin.cfg = cfg; | 428 | plugin.cfg = cfg; |
430 | api = GNUNET_new (struct GNUNET_REST_Plugin); | 429 | api = GNUNET_new(struct GNUNET_REST_Plugin); |
431 | api->cls = &plugin; | 430 | api->cls = &plugin; |
432 | api->name = GNUNET_REST_API_NS_GNS; | 431 | api->name = GNUNET_REST_API_NS_GNS; |
433 | api->process_request = &rest_process_request; | 432 | api->process_request = &rest_process_request; |
434 | GNUNET_asprintf (&allow_methods, | 433 | GNUNET_asprintf(&allow_methods, |
435 | "%s, %s, %s, %s, %s", | 434 | "%s, %s, %s, %s, %s", |
436 | MHD_HTTP_METHOD_GET, | 435 | MHD_HTTP_METHOD_GET, |
437 | MHD_HTTP_METHOD_POST, | 436 | MHD_HTTP_METHOD_POST, |
438 | MHD_HTTP_METHOD_PUT, | 437 | MHD_HTTP_METHOD_PUT, |
439 | MHD_HTTP_METHOD_DELETE, | 438 | MHD_HTTP_METHOD_DELETE, |
440 | MHD_HTTP_METHOD_OPTIONS); | 439 | MHD_HTTP_METHOD_OPTIONS); |
441 | 440 | ||
442 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Gns REST API initialized\n")); | 441 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, _("Gns REST API initialized\n")); |
443 | return api; | 442 | return api; |
444 | } | 443 | } |
445 | 444 | ||
@@ -451,15 +450,16 @@ libgnunet_plugin_rest_gns_init (void *cls) | |||
451 | * @return always NULL | 450 | * @return always NULL |
452 | */ | 451 | */ |
453 | void * | 452 | void * |
454 | libgnunet_plugin_rest_gns_done (void *cls) | 453 | libgnunet_plugin_rest_gns_done(void *cls) |
455 | { | 454 | { |
456 | struct GNUNET_REST_Plugin *api = cls; | 455 | struct GNUNET_REST_Plugin *api = cls; |
457 | struct Plugin *plugin = api->cls; | 456 | struct Plugin *plugin = api->cls; |
457 | |||
458 | plugin->cfg = NULL; | 458 | plugin->cfg = NULL; |
459 | 459 | ||
460 | GNUNET_free_non_null (allow_methods); | 460 | GNUNET_free_non_null(allow_methods); |
461 | GNUNET_free (api); | 461 | GNUNET_free(api); |
462 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Gns REST plugin is finished\n"); | 462 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Gns REST plugin is finished\n"); |
463 | return NULL; | 463 | return NULL; |
464 | } | 464 | } |
465 | 465 | ||