Compare commits

...

2 Commits

Author SHA1 Message Date
drh 1d3082d1e3 Merge in the latest changes from trunk.
FossilOrigin-Name: c78b0d302c6908ad5bf75a4f6fb77d1a0b3e8a76
2013-08-07 18:07:05 +00:00
drh 6049a0fcfe Another attempt at generalizing the URI parsing so that it works with a
wider variety of file URIs and yet remains backwards compatible.

FossilOrigin-Name: de05eb75ecfd208846d583c82ec05c5c5ef7e8ce
2013-07-24 14:54:35 +00:00
5 changed files with 31 additions and 26 deletions
+8 -8
View File
@@ -1,5 +1,5 @@
C Add\sa\sguard\s#ifndef\sto\stest_intarray.h\sto\sprevent\sharm\sif\sit\sis\s#included\nmore\sthan\sonce.\s\sAdd\sa\scomment\son\sthe\sclosing\s#endif\sof\sthe\sguards\son\nsqlite3.h\sand\stest_multiplex.h.
D 2013-08-07T14:18:45.279
C Merge\sin\sthe\slatest\schanges\sfrom\strunk.
D 2013-08-07T18:07:05.014
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -185,7 +185,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
F src/legacy.c 0df0b1550b9cc1f58229644735e317ac89131f12
F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
F src/loadext.c 867c7b330b740c6c917af9956b13b81d0a048303
F src/main.c b2592b4119f9b34d20861d1a73a44f07d061508c
F src/main.c 0548b69c5a5f2a8e69788bda36d04e8e5f3e2760
F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 437c7c4af964895d4650f29881df63535caaa1fa
@@ -436,7 +436,7 @@ F test/e_resolve.test dcce9308fb13b934ce29591105d031d3e14fbba6
F test/e_select.test f2358d074bd82240bc79a8348f284a2a8909dc1f
F test/e_select2.test 22c660a7becf0712c95e1ca1b2d9e716a1261460
F test/e_update.test bea00499e43ee1da77b03cdb0b20c7c864c1ec5a
F test/e_uri.test a2c92d80093a7efdcfbb11093651cbea87097b6b
F test/e_uri.test ab2d29fd1fcf1868d545b2d28668b26f7ea3f5d7
F test/e_vacuum.test 5bfbdc21b65c0abf24398d0ba31dc88d93ca77a9
F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473
@@ -986,7 +986,7 @@ F test/unique.test cadb172bbd5a2e83cd644d186ccd602085e54edc
F test/unixexcl.test a9870e46cc6f8390a494513d4f2bf55b5a8b3e46
F test/unordered.test ef85ac8f2f3c93ed2b9e811b684de73175fc464c
F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172
F test/uri.test 63e03df051620a18f794b4f4adcdefb3c23b6751
F test/uri.test 4a6fee19bfe8a65a6d273032aa4fc842535b46b7
F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae
F test/vacuum.test ce91c39f7f91a4273bf620efad21086b5aa6ef1d
F test/vacuum2.test af432e6e3bfc0ea20a80cb86a03c7d9876d38324
@@ -1105,7 +1105,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P f8d8790ede0fcaf6c5b60ac22919c1d97c74e838
R 2f7b5cf183df4b523d2c445c6f8fcaa5
P de05eb75ecfd208846d583c82ec05c5c5ef7e8ce 0ad83ceb79767738bd06a28840cf84da0464ab4f
R 0ce59fb6c3ea08987233d9c84c484884
U drh
Z cdc793001b4bb9536e6929a443adf8d1
Z 60b3b3406d5d4733696840d09390c33a
+1 -1
View File
@@ -1 +1 @@
0ad83ceb79767738bd06a28840cf84da0464ab4f
c78b0d302c6908ad5bf75a4f6fb77d1a0b3e8a76
+22 -12
View File
@@ -2178,19 +2178,29 @@ int sqlite3ParseUri(
zFile = sqlite3_malloc(nByte);
if( !zFile ) return SQLITE_NOMEM;
/* Discard the scheme and authority segments of the URI. */
if( zUri[5]=='/' && zUri[6]=='/' ){
/* Mappings:
** URI FILENAME
** --------------------------- ----------------------
** file:abc/xyz abc/xyz
** file:/abc/xyz /abc/xyz
** file://abc/xyz //abc/xyz
** file:///abc/xyz /abc/xyz
** file:////abc/xyz //abc/xyz
** file://///abc/xyz //abc/xyz
** file://localhost/xyz /xyz
** file:///c:/abc/xyz /c:/abc/xyz (winOpen() removes leading /)
*/
iIn = 5;
if( strncmp(zUri+5, "///", 3)==0 ){
iIn = 7;
while( zUri[iIn] && zUri[iIn]!='/' ) iIn++;
if( iIn!=7 && (iIn!=16 || memcmp("localhost", &zUri[7], 9)) ){
*pzErrMsg = sqlite3_mprintf("invalid uri authority: %.*s",
iIn-7, &zUri[7]);
rc = SQLITE_ERROR;
goto parse_uri_out;
}
}else{
iIn = 5;
/* The following condition causes URIs with five leading / characters
** like file://///host/path to be converted into UNCs like //host/path.
** The correct URI for that UNC has only two or four leading / characters
** file://host/path or file:////host/path. But 5 leading slashes is a
** common error, we are told, so we handle it as a special case. */
if( strncmp(zUri+7, "///", 3)==0 ){ iIn++; }
}else if( strncmp(zUri+5, "//localhost/", 12)==0 ){
iIn = 16;
}
/* Copy the filename and any query parameters into the zFile buffer.
-2
View File
@@ -133,8 +133,6 @@ if {$tcl_platform(platform) == "unix"} {
foreach {tn uri error} "
1 {file://localhost[test_pwd /]test.db} {not an error}
2 {file://[test_pwd /]test.db} {not an error}
3 {file://x[test_pwd /]test.db} {invalid uri authority: x}
4 {file://invalid[test_pwd /]test.db} {invalid uri authority: invalid}
" {
do_test 2.$tn {
set DB [sqlite3_open_v2 $uri $flags ""]
-3
View File
@@ -281,9 +281,6 @@ foreach {tn uri res} {
1 "file://localhost/PWD/test.db" {not an error}
2 "file:///PWD/test.db" {not an error}
3 "file:/PWD/test.db" {not an error}
4 "file://l%6Fcalhost/PWD/test.db" {invalid uri authority: l%6Fcalhost}
5 "file://lbcalhost/PWD/test.db" {invalid uri authority: lbcalhost}
6 "file://x/PWD/test.db" {invalid uri authority: x}
} {
if {$tcl_platform(platform)=="windows"} {