* bug#60528: uri->string swallows mandatory slashes
@ 2023-01-03 20:00 Liliana Marie Prikler
2023-01-04 8:11 ` tomas
0 siblings, 1 reply; 2+ messages in thread
From: Liliana Marie Prikler @ 2023-01-03 20:00 UTC (permalink / raw)
To: 60528
Hi folks,
Below some unexpected behaviour observed in Guile 3.0.8, but it also
dates back to 2.2.7 and possibly earlier versions.
scheme@(guile-user)> ,use (web uri)
scheme@(guile-user)> (string->uri "file:///home")
$1 = #<<uri> scheme: file userinfo: #f host: #f port: #f path: "/home"
query: #f fragment: #f>
scheme@(guile-user)> (uri->string $1)
$2 = "file:/home"
scheme@(guile-user)> (uri->string (build-uri 'file #:host "" #:path
"/home"))
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `uri-error' with args `("Expected valid host: ~s" (""))'.
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
Cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#60528: uri->string swallows mandatory slashes
2023-01-03 20:00 bug#60528: uri->string swallows mandatory slashes Liliana Marie Prikler
@ 2023-01-04 8:11 ` tomas
0 siblings, 0 replies; 2+ messages in thread
From: tomas @ 2023-01-04 8:11 UTC (permalink / raw)
To: 60528
[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]
On Tue, Jan 03, 2023 at 09:00:48PM +0100, Liliana Marie Prikler wrote:
> Hi folks,
>
> Below some unexpected behaviour observed in Guile 3.0.8, but it also
> dates back to 2.2.7 and possibly earlier versions.
>
> scheme@(guile-user)> ,use (web uri)
> scheme@(guile-user)> (string->uri "file:///home")
> $1 = #<<uri> scheme: file userinfo: #f host: #f port: #f path: "/home"
> query: #f fragment: #f>
> scheme@(guile-user)> (uri->string $1)
> $2 = "file:/home"
This looks strange, but not necessarily wrong. "file:///home" means
"empty authority", equivalent to "localhost" whereas "file:/home" means
"no authority". I'd expect the library to keep those two separate.
> scheme@(guile-user)> (uri->string (build-uri 'file #:host "" #:path
> "/home"))
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> Throw to key `uri-error' with args `("Expected valid host: ~s" (""))'.
Note that "no host" is not the empty string, but #f:
> scheme@(guile-user)> (uri->string (build-uri 'file #:host "" #:path
> "/home"))
scheme@(guile-user)> (uri->string (build-uri 'file #:host #f #:path "/home"))
$6 = "file:/home"
So it is consistent, albeit (to me) surprising. I'd have expect
your `$2' above to be "file:///home", with three slashes.
Cheers
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-04 8:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03 20:00 bug#60528: uri->string swallows mandatory slashes Liliana Marie Prikler
2023-01-04 8:11 ` tomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).