@@ -203,7 +203,6 @@ static void init_curl_handle(CURLM *curl_mhandle, CurlData *cdata, char *url, ch
203
203
ereport (ERROR , errmsg ("curl_multi_add_handle returned %s" , curl_multi_strerror (code )));
204
204
}
205
205
206
-
207
206
static void consume_request_queue (CURLM * curl_mhandle ){
208
207
int ret_code = SPI_execute_with_args ("\
209
208
WITH\
@@ -245,28 +244,26 @@ static void consume_request_queue(CURLM *curl_mhandle){
245
244
246
245
CurlData * cdata = palloc (sizeof (CurlData ));
247
246
248
- struct curl_slist * request_headers = NULL ;
249
247
Datum headersBin = SPI_getbinval (SPI_tuptable -> vals [j ], SPI_tuptable -> tupdesc , 5 , & tupIsNull );
250
248
251
249
if (!tupIsNull ) {
252
250
ArrayType * pgHeaders = DatumGetArrayTypeP (headersBin );
251
+ struct curl_slist * request_headers = NULL ;
252
+
253
253
request_headers = pg_text_array_to_slist (pgHeaders , request_headers );
254
+
255
+ CURL_SLIST_APPEND (request_headers , "User-Agent: pg_net/" EXTVERSION );
256
+
257
+ cdata -> request_headers = request_headers ;
254
258
}
255
259
256
260
char * reqBody = NULL ;
257
261
Datum bodyBin = SPI_getbinval (SPI_tuptable -> vals [j ], SPI_tuptable -> tupdesc , 6 , & tupIsNull );
258
262
if (!tupIsNull ) reqBody = TextDatumGetCString (bodyBin );
259
263
260
-
261
264
cdata -> body = makeStringInfo ();
262
265
cdata -> id = id ;
263
266
264
- struct curl_slist * new_headers = curl_slist_append (request_headers , "User-Agent: pg_net/" EXTVERSION );
265
- if (new_headers == NULL )
266
- ereport (ERROR , errmsg ("curl_slist_append returned NULL" ));
267
-
268
- cdata -> request_headers = new_headers ;
269
-
270
267
init_curl_handle (curl_mhandle , cdata , url , reqBody , method , timeout_milliseconds );
271
268
}
272
269
}
0 commit comments