public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: "Åke Rehnman" <ake.rehnman@gmail.com>
To: Jon Turney <jon.turney@dronecode.org.uk>, cygwin-apps@cygwin.com
Subject: Re: [PATCH setup 11/11] Use wininet for fetching URLs in direct (non-proxy) case (DO NOT APPLY)
Date: Tue, 02 May 2017 19:29:00 -0000	[thread overview]
Message-ID: <c2c1eeb6-9a54-1d45-ac7c-9f2cb8b8ac97@gmail.com> (raw)
In-Reply-To: <664411e6-ac32-ab77-1b62-72bafc8bacd8@dronecode.org.uk>

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

Hi,

>> One thought though, why not let wininet take care of file:// URL's as
>> well? Or actually don't try to parse the url string at all and just pass
>> it down to NETIO_IE5 unfiltered? The advantage is setup would be able to
>
> I'd be happy to look at a separate patch to do this.
See proposed incremental patch. Have a look, give me your thoughts.

>
>> handle what ever protocols wininet has. Also letting wininet taking care
>> of file:// url's would let the user install from a local network
>
> I'm pretty sure I've done that in the past, so I think it already 
> works.  The form of file: URL required might not be strictly correct, 
> though, (I think file:////server/pathname/ ?)
Seem to work with \\server\share_name\path or //server/share_name/path 
now anyway

/Ake

[-- Attachment #2: 0001-Use-wininet-for-file-protocol.patch --]
[-- Type: text/plain, Size: 1725 bytes --]

From 4e8a95e59bf761bc4d0bcc4ba3ec042401073b54 Mon Sep 17 00:00:00 2001
From: Ake Rehnman <ake.rehnman at gmail.com>
Date: Tue, 2 May 2017 20:55:07 +0200
Subject: [PATCH 1/1] Use wininet for "file://" protocol. Use NetIO_File for
 unknown protocols.

---
 netio.cc    | 10 ++++++----
 nio-file.cc |  7 -------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/netio.cc b/netio.cc
index cf634c1..07ee217 100644
--- a/netio.cc
+++ b/netio.cc
@@ -126,7 +126,7 @@ NetIO::open (char const *url, bool cachable)
 {
   NetIO *rv = 0;
   enum
-  { http, https, ftp, ftps, file }
+  { http, https, ftp, ftps, file, unk }
   proto;
   if (strncmp (url, "http://", 7) == 0)
     proto = http;
@@ -136,10 +136,12 @@ NetIO::open (char const *url, bool cachable)
     proto = ftp;
   else if (strncmp (url, "ftps://", 7) == 0)
     proto = ftps;
-  else
+  else if (strncmp (url, "file://", 7) == 0)
     proto = file;
+  else
+    proto = unk;
 
-  if (proto == file)
+  if (proto == unk)
     rv = new NetIO_File (url);
   else if (net_method == IDC_NET_IE5)
     rv = new NetIO_IE5 (url, false, cachable);
@@ -157,7 +159,7 @@ NetIO::open (char const *url, bool cachable)
 	case ftp:
 	  rv = new NetIO_FTP (url);
 	  break;
-	case file:
+	case unk:
 	  rv = new NetIO_File (url);
 	  break;
 	default:
diff --git a/nio-file.cc b/nio-file.cc
index e69f1ff..c302616 100644
--- a/nio-file.cc
+++ b/nio-file.cc
@@ -35,13 +35,6 @@ NetIO (Purl)
     {
       file_size = get_file_size (std::string("file://") + path);
     }
-  else
-    {
-      const char *err = strerror (errno);
-      if (!err)
-	err = "(unknown error)";
-      note (NULL, IDS_ERR_OPEN_READ, path, err);
-    }
 }
 
 NetIO_File::~NetIO_File ()
-- 
2.12.2


  reply	other threads:[~2017-05-02 19:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28 12:12 [PATCH setup 00/11] Various setup patches Jon Turney
2017-04-28 12:12 ` [PATCH setup 01/11] Remove pointless abstract base class IniDBBuilder Jon Turney
2017-04-28 12:12 ` [PATCH setup 02/11] Remove unused package_status_t stored in packageversion class Jon Turney
2017-04-28 12:13 ` [PATCH setup 06/11] packageversion::sourcePackageSpecification() is const Jon Turney
2017-04-28 12:13 ` [PATCH setup 11/11] Use wininet for fetching URLs in direct (non-proxy) case (DO NOT APPLY) Jon Turney
2017-04-28 15:33   ` Åke Rehnman
2017-04-29 10:53     ` Jon Turney
2017-05-01 12:58       ` Jon Turney
2017-05-01 15:31         ` Åke Rehnman
2017-05-01 20:45           ` Jon Turney
2017-05-02  7:28             ` Åke Rehnman
2017-05-02 11:05               ` Jon Turney
2017-05-02 19:29                 ` Åke Rehnman [this message]
2017-05-03 16:37                   ` Jon Turney
     [not found]                     ` <60ed2d4e-7c89-a9b8-e3ab-e3d0819b7e56@gmail.com>
2017-05-04 10:11                       ` Jon Turney
2017-05-16 14:00                         ` Jon Turney
     [not found]                           ` <e402101c-8e7d-98ed-b39a-c82100d6d59f@gmail.com>
2017-05-17 10:55                             ` Jon Turney
2017-05-03  7:22                 ` Brian Inglis
2017-05-03 16:37                   ` Jon Turney
2017-04-28 12:13 ` [PATCH setup 10/11] Don't show source-only packages in package list Jon Turney
2017-05-01 14:45   ` Yaakov Selkowitz
2017-05-01 19:35     ` Jon Turney
2017-04-28 12:13 ` [PATCH setup 03/11] Remove cygpackage::destroy() because it does nothing Jon Turney
2017-04-28 12:13 ` [PATCH setup 07/11] Don't handle missing 'version:' Jon Turney
2017-04-28 12:13 ` [PATCH setup 09/11] Make building with DEBUG less useless Jon Turney
2017-04-28 12:13 ` [PATCH setup 08/11] Don't do unneeded work when changing stability level Jon Turney
2017-04-28 12:13 ` [PATCH setup 04/11] Make packageversion::source(|s) const Jon Turney
2017-04-28 12:13 ` [PATCH setup 05/11] Use const version of packageversion::depends() in PrereqChecker Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2c1eeb6-9a54-1d45-ac7c-9f2cb8b8ac97@gmail.com \
    --to=ake.rehnman@gmail.com \
    --cc=cygwin-apps@cygwin.com \
    --cc=jon.turney@dronecode.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).