Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for cleanPath (0.17 sec)

  1. src/net/http/server_test.go

    		in, want string
    	}{
    		{"//", "/"},
    		{"/x", "/x"},
    		{"//x", "/x"},
    		{"x//", "/x/"},
    		{"a//b/////c", "/a/b/c"},
    		{"/foo/../bar/./..//baz", "/baz"},
    	} {
    		got := cleanPath(test.in)
    		if got != test.want {
    			t.Errorf("%s: got %q, want %q", test.in, got, test.want)
    		}
    	}
    }
    
    func BenchmarkServerMatch(b *testing.B) {
    	fn := func(w ResponseWriter, r *Request) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 13 13:54:22 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  2. src/net/http/servemux121.go

    		}
    
    		return mux.handler(r.Host, r.URL.Path)
    	}
    
    	// All other requests have any port stripped and path cleaned
    	// before passing to mux.handler.
    	host := stripHostPort(r.Host)
    	path := cleanPath(r.URL.Path)
    
    	// If the given path is /tree and its handler is not registered,
    	// redirect for /tree/.
    	if u, ok := mux.redirectToPathSlash(host, path, r.URL); ok {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 15:40:38 UTC 2024
    - 5.8K bytes
    - Viewed (0)
  3. src/net/http/pattern.go

    	// At this point, rest is the path.
    	off += i
    
    	// An unclean path with a method that is not CONNECT can never match,
    	// because paths are cleaned before matching.
    	if method != "" && method != "CONNECT" && rest != cleanPath(rest) {
    		return nil, errors.New("non-CONNECT pattern with unclean path can never match")
    	}
    
    	seenNames := map[string]bool{} // remember wildcard names to catch dups
    	for len(rest) > 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 16:36:30 UTC 2024
    - 15.3K bytes
    - Viewed (0)
  4. src/net/http/server.go

    }
    
    // DefaultServeMux is the default [ServeMux] used by [Serve].
    var DefaultServeMux = &defaultServeMux
    
    var defaultServeMux ServeMux
    
    // cleanPath returns the canonical path for p, eliminating . and .. elements.
    func cleanPath(p string) string {
    	if p == "" {
    		return "/"
    	}
    	if p[0] != '/' {
    		p = "/" + p
    	}
    	np := path.Clean(p)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 17:57:01 UTC 2024
    - 123.4K bytes
    - Viewed (0)
Back to top