@@ -472,7 +472,7 @@ header_array_to_slist(ArrayType *array, struct curl_slist *headers)
472
472
iterator = array_create_iterator (array , 0 );
473
473
#endif
474
474
475
- while ( array_iterate (iterator , & value , & isnull ) )
475
+ while ( array_iterate (iterator , & value , & isnull ))
476
476
{
477
477
HeapTupleHeader rec ;
478
478
HeapTupleData tuple ;
@@ -720,12 +720,18 @@ http_get_handle()
720
720
/* User can over-ride with http_set_curlopt() if they wish */
721
721
curl_easy_setopt (handle , CURLOPT_CONNECTTIMEOUT , 1 );
722
722
}
723
+ /* Always reset because we're going to infull the user */
724
+ /* set options down below */
725
+ else
726
+ {
727
+ curl_easy_reset (handle );
728
+ }
723
729
724
730
if (!handle )
725
731
ereport (ERROR , (errmsg ("Unable to initialize CURL" )));
726
732
727
- /* Persist any options that have been set on the handle this session */
728
- while (1 )
733
+ /* Bring in any options the users has set this session */
734
+ while (1 )
729
735
{
730
736
opt = settable_curlopts [i ++ ];
731
737
if (!opt .curlopt_str ) break ;
@@ -748,10 +754,10 @@ Datum http_reset_curlopt(PG_FUNCTION_ARGS)
748
754
{
749
755
int i = 0 ;
750
756
/* Set up global HTTP handle */
751
- g_http_handle = http_get_handle ();
752
- curl_easy_reset (g_http_handle );
757
+ CURL * handle = http_get_handle ();
758
+ curl_easy_reset (handle );
753
759
754
- while (1 )
760
+ while (1 )
755
761
{
756
762
http_curlopt * opt = settable_curlopts + i ++ ;
757
763
if (!opt -> curlopt_str ) break ;
@@ -789,7 +795,7 @@ Datum http_set_curlopt(PG_FUNCTION_ARGS)
789
795
curlopt = text_to_cstring (curlopt_txt );
790
796
value = text_to_cstring (value_txt );
791
797
792
- while (1 )
798
+ while (1 )
793
799
{
794
800
http_curlopt * opt = settable_curlopts + i ++ ;
795
801
if (!opt -> curlopt_str ) break ;
0 commit comments