Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for pathUnescape (0.21 sec)

  1. src/cmd/go/testdata/script/bug.txt

    -- main.go --
    package main
    
    import (
    	"fmt"
    	"net/url"
    	"os"
    	"path/filepath"
    )
    
    func main() {
    	u, err := url.Parse(os.Args[1])
    	if err != nil {
    		panic(err)
    	}
    	body, err := url.PathUnescape(u.Query().Get("body"))
    	if err != nil {
    		panic(err)
    	}
    	out := filepath.Join(os.TempDir(), "browser")
    	f, err := os.Create(out)
    	if err != nil {
    		panic(err)
    	}
    	fmt.Fprintln(f, body)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 24 21:26:10 UTC 2022
    - 963 bytes
    - Viewed (0)
  2. src/net/http/pattern.go

    	// Valid Go identifier.
    	for i, c := range s {
    		if !unicode.IsLetter(c) && c != '_' && (i == 0 || !unicode.IsDigit(c)) {
    			return false
    		}
    	}
    	return true
    }
    
    func pathUnescape(path string) string {
    	u, err := url.PathUnescape(path)
    	if err != nil {
    		// Invalidly escaped path; use the original
    		return path
    	}
    	return u
    }
    
    // relationship is a relationship between two patterns, p1 and p2.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 16:36:30 UTC 2024
    - 15.3K bytes
    - Viewed (0)
  3. src/net/http/routing_tree.go

    	if c := n.multiChild; c != nil {
    		// Don't record a match for a nameless wildcard (which arises from a
    		// trailing slash in the pattern).
    		if c.pattern.lastSegment().s != "" {
    			matches = append(matches, pathUnescape(path[1:])) // remove initial slash
    		}
    		return c, matches
    	}
    	return nil, nil
    }
    
    // firstSegment splits path into its first segment, and the rest.
    // The path must begin with "/".
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 30 15:43:24 UTC 2024
    - 7.5K bytes
    - Viewed (0)
  4. src/net/url/url_test.go

    	for _, tt := range pathEscapeTests {
    		actual := PathEscape(tt.in)
    		if tt.out != actual {
    			t.Errorf("PathEscape(%q) = %q, want %q", tt.in, actual, tt.out)
    		}
    
    		// for bonus points, verify that escape:unescape is an identity.
    		roundtrip, err := PathUnescape(actual)
    		if roundtrip != tt.in || err != nil {
    			t.Errorf("PathUnescape(%q) = %q, %s; want %q, %s", actual, roundtrip, err, tt.in, "[no error]")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 22:52:38 UTC 2024
    - 52.1K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apiserver/pkg/authentication/request/headerrequest/requestheader.go

    			if len(headerValue) > 0 {
    				ret = append(ret, headerValue)
    			}
    		}
    	}
    	return ret
    }
    
    func unescapeExtraKey(encodedKey string) string {
    	key, err := url.PathUnescape(encodedKey) // Decode %-encoded bytes.
    	if err != nil {
    		return encodedKey // Always record extra strings, even if malformed/unencoded.
    	}
    	return key
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 29 18:19:54 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  6. tests/integration/security/normalization_test.go

    	}
    	var percentEncodedCases []expect
    	for i := 1; i <= 0xff; i++ {
    		input := fmt.Sprintf("/admin%%%.2x", i)
    		output := input
    		if supportedPercentEncode(i) {
    			var err error
    			output, err = url.PathUnescape(input)
    			switch i {
    			case 0x5c:
    				output = strings.ReplaceAll(output, `\`, `/`)
    			case 0x7e:
    				output = strings.ReplaceAll(output, `%7e`, `~`)
    			}
    			if err != nil {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Apr 08 22:02:59 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  7. src/net/url/example_test.go

    	"fmt"
    	"log"
    	"net/url"
    	"strings"
    )
    
    func ExamplePathEscape() {
    	path := url.PathEscape("my/cool+blog&about,stuff")
    	fmt.Println(path)
    
    	// Output:
    	// my%2Fcool+blog&about%2Cstuff
    }
    
    func ExamplePathUnescape() {
    	escapedPath := "my%2Fcool+blog&about%2Cstuff"
    	path, err := url.PathUnescape(escapedPath)
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Println(path)
    
    	// Output:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 7.2K bytes
    - Viewed (0)
  8. cmd/utils.go

    			ep = path.Clean(ep)
    			ep += slashSeparator
    		} else {
    			ep = path.Clean(ep)
    		}
    		ep = ep[1:]
    	}
    	return ep
    }
    
    // unescapeGeneric is similar to url.PathUnescape or url.QueryUnescape
    // depending on input, additionally also handles situations such as
    // `//` are normalized as `/`, also removes any `/` prefix before
    // returning.
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Wed Jun 05 22:00:34 UTC 2024
    - 31.9K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go

    		b.WriteString("[")
    		b.WriteString(strings.Join(groups, ","))
    		b.WriteString("]")
    	}
    	return b.String()
    }
    
    func unescapeExtraKey(encodedKey string) string {
    	key, err := url.PathUnescape(encodedKey) // Decode %-encoded bytes.
    	if err != nil {
    		return encodedKey // Always record extra strings, even if malformed/unencoded.
    	}
    	return key
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Aug 07 10:10:35 UTC 2023
    - 9.5K bytes
    - Viewed (0)
  10. src/net/url/url.go

    }
    
    // PathUnescape does the inverse transformation of [PathEscape],
    // converting each 3-byte encoded substring of the form "%AB" into the
    // hex-decoded byte 0xAB. It returns an error if any % is not followed
    // by two hexadecimal digits.
    //
    // PathUnescape is identical to [QueryUnescape] except that it does not
    // unescape '+' to ' ' (space).
    func PathUnescape(s string) (string, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:16:53 UTC 2024
    - 36.1K bytes
    - Viewed (0)
Back to top