@@ -1510,6 +1510,12 @@ int flb_http_client_ng_init(struct flb_http_client_ng *client,
15101510{
15111511 memset (client , 0 , sizeof (struct flb_http_client_ng ));
15121512
1513+ client -> temporary_buffer = cfl_sds_create_size (HTTP_CLIENT_TEMPORARY_BUFFER_SIZE );
1514+
1515+ if (client -> temporary_buffer == NULL ) {
1516+ return -1 ;
1517+ }
1518+
15131519 client -> protocol_version = protocol_version ;
15141520 client -> upstream_ha = upstream_ha ;
15151521 client -> upstream = upstream ;
@@ -1583,6 +1589,12 @@ void flb_http_client_ng_destroy(struct flb_http_client_ng *client)
15831589 FLB_LOCK_INFINITE_RETRY_LIMIT ,
15841590 FLB_LOCK_DEFAULT_RETRY_DELAY );
15851591
1592+ if (client -> temporary_buffer != NULL ) {
1593+ cfl_sds_destroy (client -> temporary_buffer );
1594+
1595+ client -> temporary_buffer = NULL ;
1596+ }
1597+
15861598 cfl_list_foreach_safe (iterator ,
15871599 iterator_backup ,
15881600 & client -> sessions ) {
@@ -1701,6 +1713,7 @@ struct flb_http_client_session *flb_http_client_session_begin(struct flb_http_cl
17011713 int protocol_version ;
17021714 struct flb_upstream_node * upstream_node ;
17031715 struct flb_connection * connection ;
1716+ struct flb_upstream * upstream ;
17041717 struct flb_http_client_session * session ;
17051718 const char * alpn ;
17061719
@@ -1711,11 +1724,15 @@ struct flb_http_client_session *flb_http_client_session_begin(struct flb_http_cl
17111724 return NULL ;
17121725 }
17131726
1727+ upstream = upstream_node -> u ;
1728+
17141729 connection = flb_upstream_conn_get (upstream_node -> u );
17151730 }
17161731 else {
17171732 upstream_node = NULL ;
17181733
1734+ upstream = client -> upstream ;
1735+
17191736 connection = flb_upstream_conn_get (client -> upstream );
17201737 }
17211738
@@ -1747,6 +1764,10 @@ struct flb_http_client_session *flb_http_client_session_begin(struct flb_http_cl
17471764 protocol_version = HTTP_PROTOCOL_VERSION_11 ;
17481765 }
17491766
1767+ if (protocol_version == HTTP_PROTOCOL_VERSION_20 ) {
1768+ flb_stream_disable_keepalive (& upstream -> base );
1769+ }
1770+
17501771 session = flb_http_client_session_create (client , protocol_version , connection );
17511772
17521773 if (session == NULL ) {
@@ -1932,20 +1953,20 @@ struct flb_http_response *flb_http_client_request_execute(struct flb_http_reques
19321953
19331954static int flb_http_client_session_read (struct flb_http_client_session * session )
19341955{
1935- unsigned char input_buffer [1024 * 65 ];
19361956 ssize_t result ;
19371957
19381958 result = flb_io_net_read (session -> connection ,
1939- (void * ) & input_buffer ,
1940- sizeof ( input_buffer ));
1959+ (void * ) session -> parent -> temporary_buffer ,
1960+ cfl_sds_avail ( session -> parent -> temporary_buffer ));
19411961
19421962 if (result <= 0 ) {
19431963 return -1 ;
19441964 }
19451965
1946- result = (ssize_t ) flb_http_client_session_ingest (session ,
1947- input_buffer ,
1948- result );
1966+ result = (ssize_t ) flb_http_client_session_ingest (
1967+ session ,
1968+ (unsigned char * ) session -> parent -> temporary_buffer ,
1969+ result );
19491970
19501971 if (result < 0 ) {
19511972 return -2 ;
0 commit comments