@@ -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 );
@@ -598,8 +598,8 @@ static int post_all_requests(struct flb_out_http *ctx,
598598 }
599599
600600 if (body_found && headers_found ) {
601- flb_plg_trace (ctx -> ins , "posting record %zu" , record_count ++ );
602- ret = http_post (ctx , body , body_size , event_chunk -> tag ,
601+ flb_plg_trace (ctx -> ins , "sending record %zu" , record_count ++ );
602+ ret = http_request (ctx , body , body_size , event_chunk -> tag ,
603603 flb_sds_len (event_chunk -> tag ), headers );
604604 }
605605 else {
@@ -649,15 +649,15 @@ static void cb_http_flush(struct flb_event_chunk *event_chunk,
649649 (ctx -> out_format == FLB_PACK_JSON_FORMAT_STREAM ) ||
650650 (ctx -> out_format == FLB_PACK_JSON_FORMAT_LINES ) ||
651651 (ctx -> out_format == FLB_HTTP_OUT_GELF )) {
652- ret = http_post (ctx , out_body , out_size ,
653- event_chunk -> tag , flb_sds_len (event_chunk -> tag ), NULL );
652+ ret = http_request (ctx , out_body , out_size ,
653+ event_chunk -> tag , flb_sds_len (event_chunk -> tag ), NULL );
654654 flb_sds_destroy (out_body );
655655 }
656656 else {
657657 /* msgpack */
658- ret = http_post (ctx ,
659- event_chunk -> data , event_chunk -> size ,
660- event_chunk -> tag , flb_sds_len (event_chunk -> tag ), NULL );
658+ ret = http_request (ctx ,
659+ event_chunk -> data , event_chunk -> size ,
660+ event_chunk -> tag , flb_sds_len (event_chunk -> tag ), NULL );
661661 }
662662 }
663663
@@ -759,6 +759,11 @@ static struct flb_config_map config_map[] = {
759759 0 , FLB_TRUE , offsetof(struct flb_out_http , uri ),
760760 "Specify an optional HTTP URI for the target web server, e.g: /something"
761761 },
762+ {
763+ FLB_CONFIG_MAP_STR , "http_method" , "POST" ,
764+ 0 , FLB_FALSE , 0 ,
765+ "Specify the HTTP method to use. Supported methods are POST and PUT"
766+ },
762767
763768 /* Gelf Properties */
764769 {
0 commit comments