<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/d741f0cb57fdeadcb7db33b1525812a813e79919">https://github.com/macports/macports-base/commit/d741f0cb57fdeadcb7db33b1525812a813e79919</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new d741f0c Fixes to HTTP compression behavior (#167)
</span>d741f0c is described below
<span style='display:block; white-space:pre;color:#808000;'>commit d741f0cb57fdeadcb7db33b1525812a813e79919
</span>Author: David Gilman <davidgilman1@gmail.com>
AuthorDate: Sat Feb 1 19:56:00 2020 -0500
<span style='display:block; white-space:pre;color:#404040;'> Fixes to HTTP compression behavior (#167)
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> * curl.tcl: improve test reporting
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> * curl.c: invert curl to disable compression by default
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> * livecheck: enable curl compression by default
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> * curl.c: handle definition of CURLOPT_ENCODING
</span>---
src/pextlib1.0/curl.c | 13 ++++++-------
src/pextlib1.0/tests/curl.tcl | 18 +++++++++---------
src/port1.0/portlivecheck.tcl | 7 ++++++-
3 files changed, 21 insertions(+), 17 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/pextlib1.0/curl.c b/src/pextlib1.0/curl.c
</span><span style='display:block; white-space:pre;color:#808080;'>index b160618..7822850 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/pextlib1.0/curl.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/pextlib1.0/curl.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -61,7 +61,7 @@
</span>
#if defined CURLOPT_ACCEPT_ENCODING
#define _CURL_ENCODING CURLOPT_ACCEPT_ENCODING
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#elif defined CURLOPT_ENCODING
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#else
</span> #define _CURL_ENCODING CURLOPT_ENCODING
#endif
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -156,7 +156,7 @@ SetResultFromCurlMErrorCode(Tcl_Interp *interp, CURLMcode inErrorCode)
</span> /**
* curl fetch subcommand entry point.
*
<span style='display:block; white-space:pre;background:#ffe0e0;'>- * syntax: curl fetch [--disable-epsv] [--ignore-ssl-cert] [--remote-time] [-u userpass] [--effective-url lasturlvar] [--progress "builtin"|callback] [--disable-compression] url filename
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * syntax: curl fetch [--disable-epsv] [--ignore-ssl-cert] [--remote-time] [-u userpass] [--effective-url lasturlvar] [--progress "builtin"|callback] [--enable-compression] url filename
</span> *
* @param interp current interpreter
* @param objc number of parameters
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -197,7 +197,7 @@ CurlFetchCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
</span> struct curl_slist *headers = NULL;
struct CURLMsg *info = NULL;
int running; /* number of running transfers */
<span style='display:block; white-space:pre;background:#ffe0e0;'>- char* acceptEncoding = "";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ char* acceptEncoding = NULL;
</span>
/* we might have options and then the url and the file */
/* let's process the options first */
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -283,8 +283,8 @@ CurlFetchCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
</span> theResult = TCL_ERROR;
break;
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- } else if (strcmp(theOption, "--disable-compression") == 0) {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- acceptEncoding = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else if (strcmp(theOption, "--enable-compression") == 0) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ acceptEncoding = "";
</span> } else {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "curl fetch: unknown option ", theOption, NULL);
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -496,8 +496,7 @@ CurlFetchCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[])
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- /* we want compression by default, but can optionally disable it.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- * a CURLOPT_ACCEPT_ENCODING of "" means to let cURL write the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* a CURLOPT_ACCEPT_ENCODING of "" means to let cURL write the
</span> * Accept-Encoding header for you, based on what the library
* was compiled to support.
* A value of NULL disables all attemps at decompressing responses.
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/pextlib1.0/tests/curl.tcl b/src/pextlib1.0/tests/curl.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 0d55a84..b51d0e1 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/pextlib1.0/tests/curl.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/pextlib1.0/tests/curl.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -12,16 +12,16 @@ proc main {pextlibname} {
</span> curl fetch --ignore-ssl-cert $dummyroot/dummy $tempfile
# check the md5 sum of the file.
<span style='display:block; white-space:pre;background:#ffe0e0;'>- test {[md5 file $tempfile] == "5421fb0f76c086a1e14bf33d25b292d4"}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test "md5sum" {[md5 file $tempfile] == "5421fb0f76c086a1e14bf33d25b292d4"}
</span>
# check we indeed get a 404 a dummy file over HTTP.
<span style='display:block; white-space:pre;background:#ffe0e0;'>- test {[catch {curl fetch --ignore-ssl-cert $dummyroot/404 $tempfile}]}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test "dummy404" {[catch {curl fetch --ignore-ssl-cert $dummyroot/404 $tempfile}]}
</span>
# check the modification date of the dummy file.
set seconds [clock scan 2007-06-16Z]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- test {[curl isnewer --ignore-ssl-cert $dummyroot/dummy [clock scan 2007-06-16Z]]}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test "mtime1" {[curl isnewer --ignore-ssl-cert $dummyroot/dummy [clock scan 2007-06-16Z]]}
</span> set seconds [clock scan 2007-06-17Z]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- test {![curl isnewer --ignore-ssl-cert $dummyroot/dummy [clock scan 2007-06-17Z]]}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test "mtime2" {![curl isnewer --ignore-ssl-cert $dummyroot/dummy [clock scan 2007-06-17Z]]}
</span>
# use --disable-epsv
#curl fetch --disable-epsv ftp://ftp.cup.hp.com/dist/networking/benchmarks/netperf/archive/netperf-2.2pl5.tar.gz $tempfile
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -32,18 +32,18 @@ proc main {pextlibname} {
</span> #curl fetch -u "I accept www.opensource.org/licenses/cpl:." http://www.research.att.com/~gsf/download/tgz/sfio.2005-02-01.tgz $tempfile
#test {[md5 file $tempfile] == "48f45c7c77c23ab0ccca48c22b3870de"}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- curl fetch https://www.whatsmyip.org/http-compression-test/ $tempfile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ curl fetch --enable-compression https://www.whatsmyip.org/http-compression-test/ $tempfile
</span> grepper $tempfile {gz_yes}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- curl fetch --disable-compression https://www.whatsmyip.org/http-compression-test/ $tempfile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ curl fetch https://www.whatsmyip.org/http-compression-test/ $tempfile
</span> grepper $tempfile {gz_no}
file delete -force $tempfile
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-proc test {args} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc test {test_name args} {
</span> if {[catch {uplevel 1 expr $args} result] || !$result} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "[uplevel 1 subst -nocommands $args] == $result"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts "test $test_name failed: [uplevel 1 subst -nocommands $args] == $result"
</span> exit 1
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -57,7 +57,7 @@ proc grepper {filepath regex} {
</span> }
}
close $fd
<span style='display:block; white-space:pre;background:#ffe0e0;'>- test {$hasMatch == 1}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test "grepper $regex" {$hasMatch == 1}
</span> }
main $argv
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port1.0/portlivecheck.tcl b/src/port1.0/portlivecheck.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 862ff2b..7c37bd6 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port1.0/portlivecheck.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port1.0/portlivecheck.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -45,7 +45,7 @@ namespace eval portlivecheck {
</span> }
# define options
<span style='display:block; white-space:pre;background:#ffe0e0;'>-options livecheck.url livecheck.type livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version livecheck.ignore_sslcert livecheck.curloptions
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+options livecheck.url livecheck.type livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version livecheck.ignore_sslcert livecheck.compression livecheck.curloptions
</span>
# defaults
default livecheck.url {$homepage}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -56,11 +56,13 @@ default livecheck.name default
</span> default livecheck.distname default
default livecheck.version {$version}
default livecheck.ignore_sslcert no
<span style='display:block; white-space:pre;background:#e0ffe0;'>+default livecheck.compression yes
</span> default livecheck.curloptions {"--append-http-header" "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}
proc portlivecheck::livecheck_main {args} {
global livecheck.url livecheck.type livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version \
livecheck.ignore_sslcert \
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ livecheck.compression \
</span> livecheck.curloptions \
homepage portpath workpath \
master_sites name subport distfiles
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -81,6 +83,9 @@ proc portlivecheck::livecheck_main {args} {
</span> if {[tbool livecheck.ignore_sslcert]} {
lappend curl_options "--ignore-ssl-cert"
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[tbool livecheck.compression]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend curl_options "--enable-compression"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
# Check _resources/port1.0/livecheck for available types.
set types_dir [getdefaultportresourcepath "port1.0/livecheck"]
</pre><pre style='margin:0'>
</pre>