Skip to content

fix: handle discovery URL correctly#41

Open
shefali-kamal wants to merge 3 commits into
veraison:mainfrom
MonakaResearch:main
Open

fix: handle discovery URL correctly#41
shefali-kamal wants to merge 3 commits into
veraison:mainfrom
MonakaResearch:main

Conversation

@shefali-kamal

Copy link
Copy Markdown

No description provided.

DhanusML added 3 commits July 10, 2026 12:12
Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Handle discovery base urls as url::Url instead of String.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
@THS-on

THS-on commented Jul 21, 2026

Copy link
Copy Markdown
Member

@thomas-fossati can you have a look at it?

@thomas-fossati thomas-fossati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! I have left my usual handful of comments inlnie.

Comment thread src/lib.rs
.verification_url
.ok_or_else(|| Error::ConfigError("missing API endpoint".to_string()))?;
let Some(base_url) = &self.base_url else {
Err(Error::ConfigError("missing API endpoint".to_string()))?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not wrong but reads a bit odd :)

Suggested change
Err(Error::ConfigError("missing API endpoint".to_string()))?
return Err(Error::ConfigError("missing API endpoint".to_string()))

Comment thread src/lib.rs
Comment on lines +442 to +443
let verification_url = base_url.join("/.well-known/veraison/verification").unwrap();
let coserv_url = base_url.join("/.well-known/coserv-configuration").unwrap();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely stylistic comment: .expect("...") would document intent a bit more explictly.

Comment thread src/coserv.rs
);

let CoservQuery::EnvQuery(query) = coserv_out.query else {
panic!("query is not an environemnt query")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Suggested change
panic!("query is not an environemnt query")
panic!("query is not an environment query")

Comment thread src/lib.rs
.coserv_url
.ok_or_else(|| Error::ConfigError("missing API endpoint".to_string()))?;
// since paths are compile time constants, these will always be Ok(_)
let verification_url = base_url.join("/.well-known/veraison/verification").unwrap();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using join does reference resolution and therefore changes the previous behaviour (for the better!). Since the join argument starts with /, it's an absolute-path reference which replaces the entire base path.
Previously https://host/veraison + /.well-known/... would yield https://host/veraison/.well-known/...
Now: Url::parse("https://host/veraison").join("/.well-known/...") yields https://host/.well-known/...
This is more correct IMO, but may break some user's assumptions :-)
(Worth documenting.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants