Index: openacs-4/packages/acs-tcl/tcl/http-client-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/http-client-procs.tcl,v diff -u -r1.30.2.32 -r1.30.2.33 --- openacs-4/packages/acs-tcl/tcl/http-client-procs.tcl 8 Jul 2024 14:10:32 -0000 1.30.2.32 +++ openacs-4/packages/acs-tcl/tcl/http-client-procs.tcl 17 Jul 2024 12:34:55 -0000 1.30.2.33 @@ -924,7 +924,7 @@ # create the spool file set wfd [ad_opentmpfile spool_file] fconfigure $wfd -translation binary - + # flush currently collected payload puts -nonewline $wfd $payload # set required encoding for next content @@ -1768,7 +1768,7 @@ ## Issuing of the request - set cmd [list exec [::util::which curl] -s] + set cmd [list exec [::util::which curl] -s -k] if {$spool_p} { set spool_file [ad_tmpnam] @@ -1781,14 +1781,14 @@ lappend cmd --connect-timeout [timeout $timeout] } -# Antonio Pisano 2015-09-28: curl can follow redirects -# out of the box, but its behavior is to throw an error -# when maximum depth has been reached. I want it to -# return even a 3** page without complaining. -# # Set redirection up to max_depth -# if {$max_depth ne ""} { -# lappend cmd -L --max-redirs $max_depth -# } + # Antonio Pisano 2015-09-28: curl can follow redirects + # out of the box, but its behavior is to throw an error + # when maximum depth has been reached. I want it to + # return even a 3** page without complaining. + # # Set redirection up to max_depth + # if {$max_depth ne ""} { + # lappend cmd -L --max-redirs $max_depth + # } if {$method eq "GET"} { lappend cmd -G @@ -1848,6 +1848,7 @@ lappend cmd -D $resp_headers_tmpfile lappend cmd $url + #ns_log notice "running CURL cmd\n$cmd" set start_time [ns_time get] set response [{*}$cmd] set end_time [ns_time get] Index: openacs-4/packages/acs-tcl/tcl/test/http-client-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/http-client-procs.tcl,v diff -u -r1.1.2.24 -r1.1.2.25 --- openacs-4/packages/acs-tcl/tcl/test/http-client-procs.tcl 25 Feb 2024 17:25:16 -0000 1.1.2.24 +++ openacs-4/packages/acs-tcl/tcl/test/http-client-procs.tcl 17 Jul 2024 12:34:56 -0000 1.1.2.25 @@ -19,7 +19,7 @@ Test that JSON is encoded as expected } { set endpoint_name /acs-tcl-test-http-client-procs-util-http-json-encoding - set url [ad_url] + set url [::acs::test::url] # # Fallback to util_current_location if ad_url returns an empty string, # such in cases when the SystemUrl is not set. @@ -45,6 +45,7 @@ ns_return 200 application/json {$response} }] aa_log "Request with correct application/json mime_type" + aa_log "... [list util::http::[string tolower $m] -preference $impl -url $url]" set r [util::http::[string tolower $m] -preference $impl -url $url] set headers [dict get $r headers] set content_type [expr {[dict exists $headers content-type] ? @@ -58,7 +59,8 @@ if {$m eq "GET"} { set F_json [ad_opentmpfile tmpfile_app_json] if {$impl eq "curl"} { - puts $F_json [exec -ignorestderr [::util::which curl] $url -o -] + aa_log "... running [::util::which curl] $url -k -o -" + puts $F_json [exec -ignorestderr [::util::which curl] $url -k -o -] } else { ns_http run -method GET -spoolsize 0 -outputchan $F_json $url } @@ -69,6 +71,7 @@ ns_return 200 "application/json;charset=UTF-8" {$response} }] aa_log "Request with correct application/json;charset=UTF-8 mime_type" + aa_log "... running [list util::http::[string tolower $m] -preference $impl -url $url]" set r [util::http::[string tolower $m] -preference $impl -url $url] set headers [dict get $r headers] set content_type [expr {[dict exists $headers content-type] ? @@ -105,9 +108,9 @@ # encoding of the response to iso8859-2 if {$m eq "GET"} { set F_iso8859_2 [ad_opentmpfile tmpfile_iso8859_2] - + if {$impl eq "curl"} { - puts $F_iso8859_2 [exec -ignorestderr [::util::which curl] $url -o -] + puts $F_iso8859_2 [exec -ignorestderr [::util::which curl] $url -k -o -] } else { ns_http run -method GET -spoolsize 0 -outputchan $F_iso8859_2 $url }