File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,6 @@ const REGISTRY_CLIENT_ID: &str = "nydus-registry-client";
31
31
const HEADER_AUTHORIZATION : & str = "Authorization" ;
32
32
const HEADER_WWW_AUTHENTICATE : & str = "www-authenticate" ;
33
33
34
- const REDIRECTED_STATUS_CODE : [ StatusCode ; 2 ] = [
35
- StatusCode :: MOVED_PERMANENTLY ,
36
- StatusCode :: TEMPORARY_REDIRECT ,
37
- ] ;
38
-
39
34
const REGISTRY_DEFAULT_TOKEN_EXPIRATION : u64 = 10 * 60 ; // in seconds
40
35
41
36
/// Error codes related to registry storage backend operations.
@@ -724,9 +719,11 @@ impl RegistryReader {
724
719
}
725
720
} ;
726
721
let status = resp. status ( ) ;
722
+ let need_redirect =
723
+ status >= StatusCode :: MULTIPLE_CHOICES && status < StatusCode :: BAD_REQUEST ;
727
724
728
725
// Handle redirect request and cache redirect url
729
- if REDIRECTED_STATUS_CODE . contains ( & status ) {
726
+ if need_redirect {
730
727
if let Some ( location) = resp. headers ( ) . get ( "location" ) {
731
728
let location = location. to_str ( ) . unwrap ( ) ;
732
729
let mut location = Url :: parse ( location)
You can’t perform that action at this time.
0 commit comments