]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
IPFS: bugfixes
authorMark Gaiser <markg85@gmail.com>
Sat, 11 Nov 2023 12:08:59 +0000 (13:08 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 11 Nov 2023 22:28:13 +0000 (23:28 +0100)
- Fixed endianness bug in gateway file parsing
- Use IPFS_PATH in tests where IPFS_DATA was used
- Fixed typos from traling -> trailing
- Fixed broken link in IPFS.md

Follow-up to 859e88f6533f9e

Reported-by: Michael Kaufmann
Bug: https://github.com/curl/curl/pull/12152#issuecomment-1798214137
Closes #12305

docs/IPFS.md
src/tool_ipfs.c
tests/data/test736
tests/data/test737
tests/data/test738

index e369fffc754b398a1ad64d8685d0b120f2d193f0..24bba8b75a5c4aa7fef5d1f5b2157be878eb56cd 100644 (file)
@@ -69,7 +69,7 @@ If you trust this behavior from your gateway of choice then passing the `-L` opt
 Depending on the arguments, cURL could present the user with an error.
 
 ### Gateway file and environment variable
-cURL tried to look for the file: `~/.ipfs/gateway` but couldn't find it. It also tried to look for the `IPFS_GATEWAY` environment variable but couldn't find that either. This happens when no extra arguments are passed to cURL and letting it try to figure it out [automatically](#Automatic-gateway-detection).
+cURL tried to look for the file: `~/.ipfs/gateway` but couldn't find it. It also tried to look for the `IPFS_GATEWAY` environment variable but couldn't find that either. This happens when no extra arguments are passed to cURL and letting it try to figure it out [automatically](#automatic-gateway-detection).
 
 Any IPFS implementation that has gateway support should expose it's URL in `~/.ipfs/gateway`. If you are already running a gateway, make sure it exposes the file where cURL expects to find it.
 
index 271fff2cd8b3a3983390cea6219925d498093c63..435d1697ce4e90160b4bcb7b6b1a3d77c01c0274 100644 (file)
@@ -104,7 +104,8 @@ static char *ipfs_gateway(void)
 
     /* get the first line of the gateway file, ignore the rest */
     while((c = getc(gateway_file)) != EOF && c != '\n' && c != '\r') {
-      if(curlx_dyn_addn(&dyn, &c, 1))
+      char c_char = (char)c;
+      if(curlx_dyn_addn(&dyn, &c_char, 1))
         goto fail;
     }
 
index bdf5e842ecaa94f57185eaf51fa05ddcf0bedf2a..45d9a055a84e833bbff323e7c107c3515bb4a43e 100644 (file)
@@ -31,11 +31,10 @@ Hello curl from IPFS
 http
 </server>
 <setenv>
-HOME=%PWD/%LOGDIR
-IPFS_DATA=$HOME/.ipfs
+IPFS_PATH=%LOGDIR/.ipfs
 </setenv>
 <name>
-IPFS with IPFS_DATA set, no traling slash
+IPFS with IPFS_PATH set, no trailing slash
 </name>
 <command>
 ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u
index 709a93078af7728db1e8f988ac79c4c0bf3953e0..bc6e8576a43d61c9217b083641c6452613548c29 100644 (file)
@@ -31,11 +31,10 @@ Hello curl from IPFS
 http
 </server>
 <setenv>
-HOME=%PWD/%LOGDIR
-IPFS_DATA=$HOME/.ipfs/
+IPFS_PATH=%LOGDIR/.ipfs/
 </setenv>
 <name>
-IPFS with IPFS_DATA set, with traling slash
+IPFS with IPFS_PATH set, with trailing slash
 </name>
 <command>
 ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u
index b6691cfcf106f7dd31a61ff95eb88714a55f701b..5c05137dc3c9713c304a0820b91f2093290f9581 100644 (file)
@@ -17,11 +17,10 @@ IPFS
 http
 </server>
 <setenv>
-HOME=%PWD/%LOGDIR
-IPFS_DATA=%HOME/.ipfs/
+IPFS_PATH=%LOGDIR/.ipfs/
 </setenv>
 <name>
-IPFS with IPFS_DATA, no gateway file
+IPFS with IPFS_PATH, no gateway file
 </name>
 <command>
 ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u