This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[cygstart] optional double slash after scheme for file URIs


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
+++      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

 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:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]