From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89787 invoked by alias); 18 May 2017 21:19:12 -0000 Mailing-List: contact cygwin-apps-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-apps-cvs-owner@sourceware.org Received: (qmail 89726 invoked by uid 9795); 18 May 2017 21:19:11 -0000 Date: Thu, 18 May 2017 21:19:00 -0000 Message-ID: <20170518211911.89697.qmail@sourceware.org> From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [setup - the official Cygwin setup program used to install Cygwin and keep it up to date] branch master, updated. release_2.879 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 60800b0ec9e4ba2c37edd51d4877a717cf9e722e X-Git-Newrev: 9b9237fbce6e8005fcda57241598181fb2b4985f X-SW-Source: 2017-q2/txt/msg00032.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=9b9237fbce6e8005fcda57241598181fb2b4985f commit 9b9237fbce6e8005fcda57241598181fb2b4985f Author: Jon Turney Date: Thu May 18 13:01:06 2017 +0100 Use INTERNET_FLAG_RESYNCHRONIZE when fetching cacheable URLs with wininet It seems this is needed for correct cache behaviour when the server doesn't add an ETags header (i.e. sending an If-Modified-Since: request). Why would we want sane behaviour by default, eh? Diff: --- Makefile.am | 10 ++++++++++ configure.ac | 3 +++ geturl.cc | 7 ++----- nio-ie5.cc | 22 +++++++++++++++++++--- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index a947a78..9b11917 100644 --- a/Makefile.am +++ b/Makefile.am @@ -273,6 +273,7 @@ inilint_SOURCES = \ GITVER := $(shell cd $(srcdir) && git describe --match release_\* --abbrev=6 --dirty || "N/A") VER := $(subst release_,,$(GITVER)) +ARCH := @ARCH@ setup_version.c : Makefile @echo "Setup version: " $(VER) @@ -301,9 +302,18 @@ strip: all $(OBJCOPY) --strip-all setup$(EXEEXT) $(OBJCOPY) --add-gnu-debuglink=setup.dbg setup$(EXEEXT) setup$(EXEEXT) +CLEANFILES += setup.dbg + upx: strip @if [ -e `which upx` ]; then\ upx --best --lzma setup$(EXEEXT) ;\ else \ echo "UPX doesn't seem to be installed, cannot compress setup$(EXEEXT)." ;\ fi + +release: upx + cp setup.dbg setup-${VER}.${ARCH}.dbg + cp setup${EXEEXT} setup-${VER}.${ARCH}${EXEEXT} + +clean-local: + rm -f setup*${EXEEXT} setup*.dbg diff --git a/configure.ac b/configure.ac index 42ad3e2..ab548c0 100644 --- a/configure.ac +++ b/configure.ac @@ -74,15 +74,18 @@ dnl add portability sources to inilint case "$host" in i?86-*-mingw32) SETUP="setup" + ARCH="x86" ;; x86_64-*-mingw32) SETUP="setup" + ARCH="x86_64" ;; *) AC_MSG_ERROR([Cygwin Setup can only be built for Win32 or Win64 hosts]) ;; esac AC_SUBST(SETUP) +AC_SUBST(ARCH) AC_CONFIG_FILES([Makefile tests/Makefile]) AC_OUTPUT diff --git a/geturl.cc b/geturl.cc index 53c0a3b..1c1d1c6 100644 --- a/geturl.cc +++ b/geturl.cc @@ -108,14 +108,12 @@ progress (int bytes) static void getUrlToStream (const string &_url, io_stream *output) { - Log (LOG_BABBLE) << "getUrlToStream " << _url << endLog; is_local_install = (source == IDC_SOURCE_LOCALDIR); init_dialog (_url, 0); NetIO *n = NetIO::open (_url.c_str(), true); if (!n || !n->ok ()) { delete n; - Log (LOG_BABBLE) << "getUrlToStream failed!" << endLog; throw new Exception (TOSTRING(__LINE__) " " __FILE__, "Error opening url", APPERR_IO_ERROR); } @@ -144,6 +142,8 @@ getUrlToStream (const string &_url, io_stream *output) if (n) delete (n); /* reseeking is up to the recipient if desired */ + + Log (LOG_BABBLE) << "Fetched URL: " << _url << endLog; } io_stream * @@ -152,7 +152,6 @@ get_url_to_membuf (const string &_url, HWND owner) io_stream_memory *membuf = new io_stream_memory (); try { - Log (LOG_BABBLE) << "get_url_to_membuf " << _url << endLog; getUrlToStream (_url, membuf); if (membuf->seek (0, IO_SEEK_SET)) @@ -168,7 +167,6 @@ get_url_to_membuf (const string &_url, HWND owner) { if (e->errNo() != APPERR_IO_ERROR) throw e; - Log (LOG_BABBLE) << "get_url_to_membuf failed!" << endLog; delete membuf; return 0; } @@ -217,7 +215,6 @@ get_url_to_file (const string &_url, if (!n || !n->ok ()) { delete n; - Log (LOG_BABBLE) << "get_url_to_file failed!" << endLog; return 1; } diff --git a/nio-ie5.cc b/nio-ie5.cc index daf29ad..7708d4c 100644 --- a/nio-ie5.cc +++ b/nio-ie5.cc @@ -26,6 +26,7 @@ #include "msg.h" #include "netio.h" #include "nio-ie5.h" +#include "LogSingleton.h" static HINTERNET internet_direct = 0; static HINTERNET internet_preconfig = 0; @@ -55,6 +56,8 @@ NetIO (_url) if (!cachable) { flags |= INTERNET_FLAG_NO_CACHE_WRITE; + } else { + flags |= INTERNET_FLAG_RESYNCHRONIZE; } connection = InternetOpenUrl (*internet, url, NULL, 0, flags, 0); @@ -83,17 +86,22 @@ try_again: if (!connection) { - if (GetLastError () == ERROR_INTERNET_EXTENDED_ERROR) + DWORD e = GetLastError (); + if (e == ERROR_INTERNET_EXTENDED_ERROR) { char buf[2000]; DWORD e, l = sizeof (buf); InternetGetLastResponseInfo (&e, buf, &l); mbox (0, buf, "Internet Error", MB_OK); } + else + { + Log (LOG_PLAIN) << "connection error: " << e << endLog; + } } - DWORD type, type_s; - type_s = sizeof (type); + ULONG type = 0; + DWORD type_s = sizeof (type); InternetQueryOption (connection, INTERNET_OPTION_HANDLE_TYPE, &type, &type_s); @@ -106,6 +114,9 @@ try_again: HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &type, &type_s, NULL)) { + if (type != 200) + Log (LOG_PLAIN) << "HTTP status " << type << " fetching " << url << endLog; + if (type == 401) /* authorization required */ { flush_io (); @@ -128,6 +139,11 @@ try_again: } } } + + InternetQueryOption (connection, INTERNET_OPTION_REQUEST_FLAGS, + &type, &type_s); + if (type & INTERNET_REQFLAG_FROM_CACHE) + Log (LOG_BABBLE) << "Request for URL " << url << " satisfied from cache" << endLog; } void