-
Notifications
You must be signed in to change notification settings - Fork 52
fix: add http:// prefix to server address in schema requests #362
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,7 +178,7 @@ func testServerIsValid(serverAdds []string, hgSpace, hGraph, username, password | |
| wg.Add(1) | ||
| go func(addr string, ctx context.Context, cancel context.CancelFunc) { | ||
| defer wg.Done() | ||
| url := fmt.Sprintf("%v/graphspaces/%v/graphs/%v/schema?format=json", addr, hgSpace, hGraph) | ||
| url := fmt.Sprintf("http://%v/graphspaces/%v/graphs/%v/schema?format=json", addr, hgSpace, hGraph) | ||
| req, err := http.NewRequest(http.MethodGet, url, nil) | ||
| req.SetBasicAuth(username, password) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Optional, or a follow-up issue:
This goroutine has no Suggested change: move |
||
| if err != nil { | ||
|
|
@@ -208,7 +208,7 @@ func GetHugegraphSchema(serverAddr, hgName, username, password string) (map[stri | |
| logrus.Errorf("split hg name failed, %v", err.Error()) | ||
| return nil, fmt.Errorf("split hg name failed, %v", err.Error()) | ||
| } | ||
| url := fmt.Sprintf("%v/graphspaces/%v/graphs/%v/schema?format=json", serverAddr, hgSpace, hGraph) | ||
| url := fmt.Sprintf("http://%v/graphspaces/%v/graphs/%v/schema?format=json", serverAddr, hgSpace, hGraph) | ||
| // retry 3 times | ||
| var propertyFromHg map[string]any | ||
| for i := 0; i < 3; i++ { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addr.FindServerAddr()stores that value inoutput.hugegraph_server(vermeer/apps/worker/compute_bl.go:518), andHugegraphWriter.Init()concatenates it into request URLs atvermeer/apps/graphio/hugegraph.go:568,591,633. With PD returningserver:8080, the probe now succeeds ashttp://server:8080/...but write-back constructsserver:8080/graphspaces/..., whichhttp.NewRequestrejects because it has no valid HTTP scheme. The same unconditional prefixing turns a pre-schemed address intohttp://http://...orhttp://https://..., whereas the old code accepted such a base URL. Normalize the address once at discovery, preserve an existinghttp/httpsscheme, use the normalized base for both read and write paths, and add raw and pre-schemed coverage.