]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
David Hull made the file: URL parser also accept the somewhat sloppy file
authorDaniel Stenberg <daniel@haxx.se>
Wed, 29 Oct 2003 09:53:21 +0000 (09:53 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 29 Oct 2003 09:53:21 +0000 (09:53 +0000)
syntax: file:/path. I added test case 203 to verify this.

CHANGES
RELEASE-NOTES
lib/url.c
tests/data/Makefile.am
tests/data/test203 [new file with mode: 0644]

diff --git a/CHANGES b/CHANGES
index cd7c715e7877dac825cfeb83cb4855198e026f22..ea67628743a234a2d88a1a33e8a8fd032eca9254 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,14 @@
                                   Changelog
 
 
+Daniel (29 October)
+- runtests.pl now checks for and use valgrind if present. It will redirect the
+  valgrind results in log/valgrind[num] but it currently doesn't scan that
+  file for any errors or anything, that is still only made manually.
+
+- David Hull made the file: URL parser also accept the somewhat sloppy file
+  syntax: file:/path. I added test case 203 to verify this.
+
 Daniel (28 October)
 - Dan C tracked down yet another weird behavior in the glibc gethostbyname_r()
   function for some specific versions (reported on 2.2.5 and 2.1.1), and
index 894ca0ca47f93a8ddb5c85548e0cea397143b650..cfb0687c573fed1e493b707f7faf5be7ca6056f0 100644 (file)
@@ -1,7 +1,11 @@
 Curl and libcurl 7.10.8 is out! A bugfix release.
 
+The 77th public curl release. Release number 104 counted from the very
+beginning.
+
 This release includes the following changes:
 
+ o file: URLs with only one initial slash now works too
  o we include a RELEASE-NOTES document in the release archive to summarize
    the big and visible changes and bugfixes
  o CURLOPT_MAXFILESIZE was added, and --max-filesize.
index ac2b6be9683083c36c421ed30593ea74e27127f7..5da898c5977434f5340c10419b42777234d11bc8 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -2002,9 +2002,19 @@ static CURLcode CreateConnection(struct SessionHandle *data,
    * proxy -- and we don't know if we will need to use SSL until we parse the
    * url ...
    ************************************************************/
-  if((2 == sscanf(data->change.url, "%64[^:]://%[^\n]",
+  if((2 == sscanf(data->change.url, "%64[^:]:%[^\n]",
                   conn->protostr,
                   conn->path)) && strequal(conn->protostr, "file")) {
+    if(conn->path[0] == '/' && conn->path[1] == '/') {
+      /* Allow omitted hostname (e.g. file:/<path>).  This is not strictly
+       * speaking a valid file: URL by RFC 1738, but treating file:/<path> as
+       * file://localhost/<path> is similar to how other schemes treat missing
+       * hostnames.  See RFC 1808. */
+
+      /* This cannot be done with strcpy() in a portable manner, since the
+         memory areas overlap! */
+      memmove(conn->path, conn->path + 2, strlen(conn->path + 2)+1);
+    }
     /*
      * we deal with file://<host>/<path> differently since it supports no
      * hostname other than "localhost" and "127.0.0.1", which is unique among
index f348df04ddbab65fbf90880bc4554a591c1be75d..207c72aa332b0eb6b73eeb7e45362dca8a15094d 100644 (file)
@@ -24,4 +24,4 @@ test62 test63 test64 test65 test66 test144 test145 test67 test68 test41 \
 test40 test42 test69 test70 test71 test72 test73 test146 test505 \
 test74 test75 test76 test77 test78 test147 test148 test506 test79 test80 \
 test81 test82 test83 test84 test85 test86 test87 test507 test149 test88 \
-test89 test90 test508 test91 test92
+test89 test90 test508 test91 test92 test203
diff --git a/tests/data/test203 b/tests/data/test203
new file mode 100644 (file)
index 0000000..051c8a8
--- /dev/null
@@ -0,0 +1,34 @@
+# Server-side
+<reply>
+<data>
+foo
+   bar
+bar
+   foo
+moo
+</data>
+</reply>
+
+# Client-side
+<client>
+<server>
+none
+</server>
+ <name>
+file:/path URL with a single slash
+ </name>
+ <command>
+file:%PWD/log/test203.txt
+</command>
+<file name="log/test203.txt">
+foo
+   bar
+bar
+   foo
+moo
+</file>
+</test>
+
+# Verify data after the test has been "shot"
+<verify>
+</verify>