Skip to content

Commit

Permalink
Rename writebackhost to putendpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
joereuss12 committed Dec 20, 2023
1 parent b1049d5 commit b066f2c
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion client/director.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func CreateNsFromDirectorResp(dirResp *http.Response) (namespace namespaces.Name
namespace.UseTokenOnRead, _ = strconv.ParseBool(xPelicanNamespace["require-token"])
namespace.ReadHTTPS, _ = strconv.ParseBool(xPelicanNamespace["readhttps"])
namespace.DirListHost = xPelicanNamespace["collections-url"]
namespace.WritebackHost = xPelicanNamespace["writebackhost"]
namespace.PutEndpoint = xPelicanNamespace["putendpoint"]

var xPelicanAuthorization map[string]string
if len(dirResp.Header.Values("X-Pelican-Authorization")) > 0 {
Expand Down
8 changes: 4 additions & 4 deletions client/handle_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,13 +835,13 @@ func UploadFile(src string, origDest *url.URL, token string, namespace namespace
}

// Parse the writeback host as a URL
writebackhostUrl, err := url.Parse(namespace.WritebackHost)
putEndpointUrl, err := url.Parse(namespace.PutEndpoint)
if err != nil {
return 0, err
}

dest := &url.URL{
Host: writebackhostUrl.Host,
Host: putEndpointUrl.Host,
Scheme: "https",
Path: origDest.Path,
}
Expand Down Expand Up @@ -1089,11 +1089,11 @@ func StatHttp(dest *url.URL, namespace namespaces.Namespace) (uint64, error) {
}

// Parse the writeback host as a URL
writebackhostUrl, err := url.Parse(namespace.WritebackHost)
putEndpointUrl, err := url.Parse(namespace.PutEndpoint)
if err != nil {
return 0, err
}
dest.Host = writebackhostUrl.Host
dest.Host = putEndpointUrl.Host
dest.Scheme = "https"

canDisableProxy := CanDisableProxy()
Expand Down
2 changes: 1 addition & 1 deletion client/handle_http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func TestFullUpload(t *testing.T) {
testURL, err := url.Parse(ts.URL)
assert.NoError(t, err, "Error parsing test URL")
testNamespace := namespaces.Namespace{
WritebackHost: "https://" + testURL.Host,
PutEndpoint: "https://" + testURL.Host,
}

// Upload the file
Expand Down
2 changes: 1 addition & 1 deletion director/advertise.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func AdvertiseOSDF() error {
nsAd.RequireToken = ns.UseTokenOnRead
nsAd.Path = ns.Path
nsAd.DirlistHost = ns.DirlistHost
nsAd.WritebackHost = ns.WritebackHost
nsAd.PutEndpoint = ns.PutEndpoint
issuerURL, err := url.Parse(ns.CredentialGeneration.Issuer)
if err != nil {
log.Warningf("Invalid URL %v when parsing topology response: %v\n", ns.CredentialGeneration.Issuer, err)
Expand Down
2 changes: 1 addition & 1 deletion director/cache_ads.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type (
BasePath string `json:"basePath"`
VaultServer string `json:"vaultServer"`
DirlistHost string `json:"dirlisthost"`
WritebackHost string `json:"writebackhost"`
PutEndpoint string `json:"writebackhost"`
}

ServerAd struct {
Expand Down
4 changes: 2 additions & 2 deletions director/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ func RedirectToCache(ginCtx *gin.Context) {
ginCtx.Writer.Header()["X-Pelican-Token-Generation"] = []string{tokenGen}
}
}
ginCtx.Writer.Header()["X-Pelican-Namespace"] = []string{fmt.Sprintf("namespace=%s, require-token=%v, collections-url=%s, writebackhost=%s",
namespaceAd.Path, namespaceAd.RequireToken, namespaceAd.DirlistHost, namespaceAd.WritebackHost)}
ginCtx.Writer.Header()["X-Pelican-Namespace"] = []string{fmt.Sprintf("namespace=%s, require-token=%v, collections-url=%s, putendpoint=%s",
namespaceAd.Path, namespaceAd.RequireToken, namespaceAd.DirlistHost, namespaceAd.PutEndpoint)}

// Note we only append the `authz` query parameter in the case of the redirect response and not the
// duplicate link metadata above. This is purposeful: the Link header might get too long if we repeat
Expand Down
2 changes: 1 addition & 1 deletion namespaces/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type Namespace struct {
Issuer string `json:"issuer"`
ReadHTTPS bool `json:"readhttps"`
UseTokenOnRead bool `json:"usetokenonread"`
WritebackHost string `json:"writebackhost"`
PutEndpoint string `json:"writebackhost"`
DirListHost string `json:"dirlisthost"`
}

Expand Down
2 changes: 1 addition & 1 deletion namespaces/namespaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func TestFullNamespace(t *testing.T) {
assert.Equal(t, true, ns.ReadHTTPS)
assert.Equal(t, true, ns.UseTokenOnRead)
assert.Equal(t, "/ospool/PROTECTED", ns.Path)
assert.Equal(t, "https://origin-auth2001.chtc.wisc.edu:1095", ns.WritebackHost)
assert.Equal(t, "https://origin-auth2001.chtc.wisc.edu:1095", ns.PutEndpoint)

}

Expand Down
2 changes: 1 addition & 1 deletion origin_ui/advertise.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (server *OriginServer) CreateAdvertisement(name string, originUrl string, o
Strategy: "OAuth2",
BasePath: prefix,
// TODO: This is set to the origin for now needs to become configurable
WritebackHost: originUrl,
PutEndpoint: originUrl,
}
ad = director.OriginAdvertise{
Name: name,
Expand Down
2 changes: 1 addition & 1 deletion utils/web_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type (
Path string `json:"path"`
ReadHTTPS bool `json:"readhttps"`
UseTokenOnRead bool `json:"usetokenonread"`
WritebackHost string `json:"writebackhost"`
PutEndpoint string `json:"writebackhost"`
}

TopologyNamespacesJSON struct {
Expand Down

0 comments on commit b066f2c

Please sign in to comment.