Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove double / when requesting index.txt #223

Closed
tschmidtb51 opened this issue Jul 14, 2022 · 6 comments · Fixed by #226
Closed

Remove double / when requesting index.txt #223

tschmidtb51 opened this issue Jul 14, 2022 · 6 comments · Fixed by #226
Assignees

Comments

@tschmidtb51
Copy link
Collaborator

Currently, the GET request looks like:

https://domain.example/.well-known/csaf//index.txt
https://domain.example/.well-known/csaf//changes.csv

We should remove one / to avoid redirects.

@s-l-teichmann
Copy link
Contributor

My idea is to use https://pkg.go.dev/net/[email protected]#URL.JoinPath for this.
(As it will come with Go 1.19 we should have a back-ported version hidden behind a build tag)

@tschmidtb51
Copy link
Collaborator Author

My idea is to use https://pkg.go.dev/net/[email protected]#URL.JoinPath for this.

In general, I like the idea. Nevertheless, I guess we can do the short term fix (see #224).

@tschmidtb51
Copy link
Collaborator Author

tschmidtb51 commented Jul 14, 2022

(As it will come with Go 1.19 we should have a back-ported version hidden behind a build tag)

Did you mean back-porting it into this project? 🤔 Wouldn't be my first choice... What about making 1.19 mandatory? (When was it released?)

@s-l-teichmann
Copy link
Contributor

Go 1.19 is not release, yet. So its not a good idea to make it mandatory.
PR #226 copies the relevant parts from the Go 1.19 source into our source (BSD licensed).
A build tag ensures that this implementation is only used when compiled with Go versions below 1.19.
In the 1.19+ case the version from the stdlib ist taken.
We can remove this conditional compilation when 1.19 is stable.

@s-l-teichmann
Copy link
Contributor

s-l-teichmann commented Jul 14, 2022

Background why I would go this way is that we are joining URL path in other contexts, too. Issue #158 is another suspicious case where a simple string concat of URL strings leads to bad results.

@Fadiabb
Copy link
Contributor

Fadiabb commented Jul 18, 2022

Hint: I've used the short term fix in the #176. Maybe its time to check if we close or merge this one.

@bernhardreiter bernhardreiter linked a pull request Jul 18, 2022 that will close this issue
bernhardreiter added a commit that referenced this issue Jul 18, 2022
* Use url.JoinPath to join URLs from a few places.
* Add util/joinpath.go from go 1.19, add the license in REUSE 3.0 compatible manner.

resolve #223

Co-authored-by: Bernhard Reiter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants