@@ -109,10 +109,10 @@ static void append_headers(struct flb_http_client *c,
109109 }
110110}
111111
112- static int http_post (struct flb_out_http * ctx ,
113- const void * body , size_t body_len ,
114- const char * tag , int tag_len ,
115- char * * headers )
112+ static int http_request (struct flb_out_http * ctx ,
113+ const void * body , size_t body_len ,
114+ const char * tag , int tag_len ,
115+ char * * headers )
116116{
117117 int ret = 0 ;
118118 int out_ret = FLB_OK ;
@@ -173,7 +173,7 @@ static int http_post(struct flb_out_http *ctx,
173173
174174
175175 /* Create HTTP client context */
176- c = flb_http_client (u_conn , FLB_HTTP_POST , ctx -> uri ,
176+ c = flb_http_client (u_conn , ctx -> http_method , ctx -> uri ,
177177 payload_buf , payload_size ,
178178 ctx -> host , ctx -> port ,
179179 ctx -> proxy , 0 );
@@ -596,8 +596,8 @@ static int post_all_requests(struct flb_out_http *ctx,
596596 }
597597
598598 if (body_found && headers_found ) {
599- flb_plg_trace (ctx -> ins , "posting record %zu" , record_count ++ );
600- ret = http_post (ctx , body , body_size , event_chunk -> tag ,
599+ flb_plg_trace (ctx -> ins , "sending record %zu" , record_count ++ );
600+ ret = http_request (ctx , body , body_size , event_chunk -> tag ,
601601 flb_sds_len (event_chunk -> tag ), headers );
602602 }
603603 else {
@@ -647,15 +647,15 @@ static void cb_http_flush(struct flb_event_chunk *event_chunk,
647647 (ctx -> out_format == FLB_PACK_JSON_FORMAT_STREAM ) ||
648648 (ctx -> out_format == FLB_PACK_JSON_FORMAT_LINES ) ||
649649 (ctx -> out_format == FLB_HTTP_OUT_GELF )) {
650- ret = http_post (ctx , out_body , out_size ,
651- event_chunk -> tag , flb_sds_len (event_chunk -> tag ), NULL );
650+ ret = http_request (ctx , out_body , out_size ,
651+ event_chunk -> tag , flb_sds_len (event_chunk -> tag ), NULL );
652652 flb_sds_destroy (out_body );
653653 }
654654 else {
655655 /* msgpack */
656- ret = http_post (ctx ,
657- event_chunk -> data , event_chunk -> size ,
658- event_chunk -> tag , flb_sds_len (event_chunk -> tag ), NULL );
656+ ret = http_request (ctx ,
657+ event_chunk -> data , event_chunk -> size ,
658+ event_chunk -> tag , flb_sds_len (event_chunk -> tag ), NULL );
659659 }
660660 }
661661
@@ -757,6 +757,11 @@ static struct flb_config_map config_map[] = {
757757 0 , FLB_TRUE , offsetof(struct flb_out_http , uri ),
758758 "Specify an optional HTTP URI for the target web server, e.g: /something"
759759 },
760+ {
761+ FLB_CONFIG_MAP_STR , "http_method" , "POST" ,
762+ 0 , FLB_FALSE , 0 ,
763+ "Specify the HTTP method to use. Supported methods are POST and PUT"
764+ },
760765
761766 /* Gelf Properties */
762767 {
0 commit comments