public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: szgyg <szgyg@ludens.elte.hu>
To: cygwin-apps@cygwin.com
Subject: Re: [PATCH setup 2/2] Improve file:// url handling
Date: Thu, 08 Mar 2018 23:01:00 -0000	[thread overview]
Message-ID: <20180308230139.GA3428@MAY> (raw)
In-Reply-To: <71071a66-e7ed-8df2-47ac-38384c7ead74@dronecode.org.uk>

On Tue, Mar 06, 2018 at 08:43:47PM +0000, Jon Turney wrote:
> On 28/02/2018 11:51, SZAVAI Gyula wrote:
> > [...]
> > Most non-standard urls accepted by the old code should work, too.
> > Paths longer than 260 characters are not supported anymore.
> 
> Great, thanks! I applied these patches.

Thanks.

> > @@ -72,11 +74,24 @@ NetIO::open (char const *url, bool cachable)
> >     else if (strncmp (url, "ftps://", 7) == 0)
> >       proto = ftps;
> >     else if (strncmp (url, "file://", 7) == 0)
> > -    proto = file;
> > -  else
> >       {
> >         proto = file;
> > -      file_url = (std::string("file://") + url);
> > +
> > +      // WinInet expects a legacy file:// url
> > +      // (a windows path with "file://" prepended)
> > +      // https://blogs.msdn.microsoft.com/freeassociations/2005/05/19/the-bizarre-and-unhappy-story-of-file-urls/
> > +      char path[MAX_PATH];
> > +      DWORD len = MAX_PATH;
> > +      if (S_OK == PathCreateFromUrl(url, path, &len, 0))
> > +        {
> > +          file_url = std::string("file://") + path;
> > +          url = file_url.c_str();
> > +        }
> 
> If PathCreateFromUrl fails (longer than PATH_MAX?), how intelligibly is that
> failure reported?

We get the "Unable to get setup from" messagebox and a
"connection error: 206" line in setup.log.

from https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382%28v=vs.85%29.aspx
206 (0xCE)   ERROR_FILENAME_EXCED_RANGE   The filename or extension is too long.


> I suspect PathCreateFromUrlA is being called here.  What happens if there is
> a non-ascii character in the URL?

It doesn't work, but it didn't work before my changes either.
(I've tried 2.889 with greek and chinese directory names, and it has failed.)

s

      reply	other threads:[~2018-03-08 23:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 11:54 Remove legacy networking code, vol 2 SZAVAI Gyula
2018-02-28 11:54 ` [PATCH setup 1/2] NetIO: Remove unused url parsing code SZAVAI Gyula
2018-02-28 11:54 ` [PATCH setup 2/2] Improve file:// url handling SZAVAI Gyula
2018-03-06 20:43   ` Jon Turney
2018-03-08 23:01     ` szgyg [this message]

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=20180308230139.GA3428@MAY \
    --to=szgyg@ludens.elte.hu \
    --cc=cygwin-apps@cygwin.com \
    /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).