delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/08/05/14:03:01

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:message-id:subject:from:to
:content-type; q=dns; s=default; b=SqOyfKO4eDDryegG4RckgqG9thXdd
nbTYcgGpKZCYmMW6H4go/FJIe+89kVECmXvOK1NOwwiLFxCvV1oO+KEymbhJErYG
x0/AAUJqI6QQpv+bE+JADQzgWd/c1Gm1uicr+tOQDCb6YR+q2RCpH64q0BTnbqJR
V+qjP7pBhrIeQw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:message-id:subject:from:to
:content-type; s=default; bh=/wJSmDFWdSRCUQCKrlYJYM287NE=; b=oHW
+kDz6hyE27VgiRUnnYgUaLmCQIIP4iEJ0vxopzGekkfZdcjwrI2Jsi8vEGE6idz/
SiBAXGpn3X+0D7bLmd3YT3JRrgJQzMzHkptcgz0AdZ5q24NYVoGhG1qaqKM6vovQ
JclnKKHYJV0bb3M943QOfZ4puJ3HQpoyK1w4gO84=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-we0-f174.google.com
MIME-Version: 1.0
X-Received: by 10.180.106.6 with SMTP id gq6mr9150309wib.5.1407261753059; Tue, 05 Aug 2014 11:02:33 -0700 (PDT)
Date: Tue, 5 Aug 2014 14:02:33 -0400
Message-ID: <CADO7cW+aRhikCkekmGRiT5sQjS8d9wYwd3q8jRxsrV=t+fXhwg@mail.gmail.com>
Subject: [cygstart] optional double slash after scheme for file URIs
From: Juan Gabriel Ricart <juangabriel DOT ricart AT gmail DOT com>
To: cygwin AT cygwin DOT com

Greetings,

Below you may find a trivial patch for the cygstart program (a part of
the cygutils package) for your review:

--- cygstart.c.old      2014-08-05 15:37:49.021062800 +0000
+++ cygstart.c.new      2014-08-05 14:20:54.318820400 +0000
@@ -591,8 +591,12 @@
   const wchar_t *pWinDir = NULL;
   int rc = 0;

-  if (strncmp (aPath, "file://", 7) == 0)
-    aPath += 7;
+  if (strncmp (aPath, "file:", 5) == 0)
+    {
+      aPath += 5;
+      if (strncmp (aPath, "//", 2) == 0)
+       aPath += 2;
+    }
 #ifdef __CYGWIN__
   /* Convert file path from POSIX to Windows, unless it looks like a URL */
   if (!strstr (aPath, "://") && strncmp (aPath, "mailto:", 7) != 0)

It makes the double slash after the scheme optional for file URIs. So
this error would not happen:

$ cygstart file:/home/ricartj/page.htm
Unable to start 'file:\home\ricartj\page.htm: The specified file was not found.

The reasons for this are enumerated below:

1. Although RFC 1738 explicitly documents the double slash as
 mandatory for file URIs (see Section 5), a new working draft is being
 proposed:

 http://tools.ietf.org/html/draft-kerwin-file-scheme-10

 which makes the double slash optional (see Section 2.2).

 2. Many browsers already cope with file URIs that do not contain the
 double slash, I personally tested this with Firefox and Internet
 Explorer. It would be great if cygstart could work like this as well.

Best regards,

--
Juan Ricart

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019