Fossil SCM

Drop URL fragments ('#', typically an HTML anchor) from address specifiers for http/s and ssh. From libfossil.

danshearer 2026-10-12 10:54 UTC trunk
Commit 7e13ac5c4efbe1627f0b8019258740b24fe208f72e6a479024c2f159c6e2cd89
1 file changed +4
+4
--- src/url.c
+++ src/url.c
@@ -256,10 +256,14 @@
256256
pUrlData->hostname = pUrlData->name;
257257
}
258258
}
259259
dehttpize(pUrlData->name);
260260
pUrlData->path = fossil_strdup(&zUrl[i]);
261
+ /* A fragment (typically an HTML anchor), should not be sent to a server
262
+ ** (RFC 3986 s 3.5, RFC 9112 s 3.2.1). Drop for these schemes.*/
263
+ for(i=0; pUrlData->path[i] && pUrlData->path[i]!='#'; i++){}
264
+ pUrlData->path[i] = 0;
261265
for(i=0; pUrlData->path[i] && pUrlData->path[i]!='?'; i++){}
262266
if( pUrlData->path[i] ){
263267
pUrlData->path[i] = 0;
264268
i++;
265269
}
266270
--- src/url.c
+++ src/url.c
@@ -256,10 +256,14 @@
256 pUrlData->hostname = pUrlData->name;
257 }
258 }
259 dehttpize(pUrlData->name);
260 pUrlData->path = fossil_strdup(&zUrl[i]);
 
 
 
 
261 for(i=0; pUrlData->path[i] && pUrlData->path[i]!='?'; i++){}
262 if( pUrlData->path[i] ){
263 pUrlData->path[i] = 0;
264 i++;
265 }
266
--- src/url.c
+++ src/url.c
@@ -256,10 +256,14 @@
256 pUrlData->hostname = pUrlData->name;
257 }
258 }
259 dehttpize(pUrlData->name);
260 pUrlData->path = fossil_strdup(&zUrl[i]);
261 /* A fragment (typically an HTML anchor), should not be sent to a server
262 ** (RFC 3986 s 3.5, RFC 9112 s 3.2.1). Drop for these schemes.*/
263 for(i=0; pUrlData->path[i] && pUrlData->path[i]!='#'; i++){}
264 pUrlData->path[i] = 0;
265 for(i=0; pUrlData->path[i] && pUrlData->path[i]!='?'; i++){}
266 if( pUrlData->path[i] ){
267 pUrlData->path[i] = 0;
268 i++;
269 }
270

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button