Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for GetSourceScheme (0.19 sec)

  1. internal/handlers/proxy.go

    	// prefixed by 'proto='. The match is case-insensitive.
    	protoRegex = regexp.MustCompile(`(?i)^(;|,| )+(?:proto=)(https|http)`)
    )
    
    // GetSourceScheme retrieves the scheme from the X-Forwarded-Proto and RFC7239
    // Forwarded headers (in that order).
    func GetSourceScheme(r *http.Request) string {
    	var scheme string
    
    	// Retrieve the scheme from X-Forwarded-Proto.
    	if proto := r.Header.Get(xForwardedProto); proto != "" {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Dec 22 00:56:55 GMT 2023
    - 5.1K bytes
    - Viewed (0)
  2. internal/handlers/proxy_test.go

    	}
    	for _, v := range headers {
    		req := &http.Request{
    			Header: http.Header{
    				v.key: []string{v.val},
    			},
    		}
    		res := GetSourceScheme(req)
    		if res != v.expected {
    			t.Errorf("wrong header for %s: got %s want %s", v.key, res,
    				v.expected)
    		}
    	}
    }
    
    // TestGetSourceIP - check the source ip of a request is parsed correctly.
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Dec 22 00:56:55 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  3. cmd/api-response.go

    func getObjectLocation(r *http.Request, domains []string, bucket, object string) string {
    	// unit tests do not have host set.
    	if r.Host == "" {
    		return path.Clean(r.URL.Path)
    	}
    	proto := handlers.GetSourceScheme(r)
    	if proto == "" {
    		proto = getURLScheme(globalIsTLS)
    	}
    	u := &url.URL{
    		Host:   r.Host,
    		Path:   path.Join(SlashSeparator, bucket, object),
    		Scheme: proto,
    	}
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 33.3K bytes
    - Viewed (2)
Back to top