forked from TrueCloudLab/distribution
commit
67ff0a4772
4 changed files with 5 additions and 5 deletions
|
@ -38,7 +38,7 @@ func loginV1(authConfig *cliconfig.AuthConfig, registryEndpoint *Endpoint) (stri
|
||||||
|
|
||||||
loginAgainstOfficialIndex := serverAddress == IndexServer
|
loginAgainstOfficialIndex := serverAddress == IndexServer
|
||||||
|
|
||||||
// to avoid sending the server address to the server it should be removed before being marshalled
|
// to avoid sending the server address to the server it should be removed before being marshaled
|
||||||
authCopy := *authConfig
|
authCopy := *authConfig
|
||||||
authCopy.ServerAddress = ""
|
authCopy.ServerAddress = ""
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ type Endpoint struct {
|
||||||
URLBuilder *v2.URLBuilder
|
URLBuilder *v2.URLBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the formated URL for the root of this registry Endpoint
|
// Get the formatted URL for the root of this registry Endpoint
|
||||||
func (e *Endpoint) String() string {
|
func (e *Endpoint) String() string {
|
||||||
return fmt.Sprintf("%s/v%d/", e.URL, e.Version)
|
return fmt.Sprintf("%s/v%d/", e.URL, e.Version)
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,8 @@ func (tr *authTransport) RoundTrip(orig *http.Request) (*http.Response, error) {
|
||||||
// Authorization should not be set on 302 redirect for untrusted locations.
|
// Authorization should not be set on 302 redirect for untrusted locations.
|
||||||
// This logic mirrors the behavior in addRequiredHeadersToRedirectedRequests.
|
// This logic mirrors the behavior in addRequiredHeadersToRedirectedRequests.
|
||||||
// As the authorization logic is currently implemented in RoundTrip,
|
// As the authorization logic is currently implemented in RoundTrip,
|
||||||
// a 302 redirect is detected by looking at the Referer header as go http package adds said header.
|
// a 302 redirect is detected by looking at the Referrer header as go http package adds said header.
|
||||||
// This is safe as Docker doesn't set Referer in other scenarios.
|
// This is safe as Docker doesn't set Referrer in other scenarios.
|
||||||
if orig.Header.Get("Referer") != "" && !trustedLocation(orig) {
|
if orig.Header.Get("Referer") != "" && !trustedLocation(orig) {
|
||||||
return tr.RoundTripper.RoundTrip(orig)
|
return tr.RoundTripper.RoundTrip(orig)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ type SearchResults struct {
|
||||||
Query string `json:"query"`
|
Query string `json:"query"`
|
||||||
// NumResults indicates the number of results the query returned
|
// NumResults indicates the number of results the query returned
|
||||||
NumResults int `json:"num_results"`
|
NumResults int `json:"num_results"`
|
||||||
// Results is a slice containing the acutal results for the search
|
// Results is a slice containing the actual results for the search
|
||||||
Results []SearchResult `json:"results"`
|
Results []SearchResult `json:"results"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue