Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for sanitizeCookieValue (0.23 sec)

  1. src/net/http/cookie.go

    	const extraCookieLength = 110
    	var b strings.Builder
    	b.Grow(len(c.Name) + len(c.Value) + len(c.Domain) + len(c.Path) + extraCookieLength)
    	b.WriteString(c.Name)
    	b.WriteRune('=')
    	b.WriteString(sanitizeCookieValue(c.Value, c.Quoted))
    
    	if len(c.Path) > 0 {
    		b.WriteString("; Path=")
    		b.WriteString(sanitizeCookiePath(c.Path))
    	}
    	if len(c.Domain) > 0 {
    		if validCookieDomain(c.Domain) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 18:33:05 UTC 2024
    - 13.9K bytes
    - Viewed (0)
  2. src/net/http/cookie_test.go

    		{"a ", false, `"a "`},
    		{"a,z", false, `"a,z"`},
    		{",z", false, `",z"`},
    		{"a,", false, `"a,"`},
    	}
    	for _, tt := range tests {
    		if got := sanitizeCookieValue(tt.in, tt.quoted); got != tt.want {
    			t.Errorf("sanitizeCookieValue(%q) = %q; want %q", tt.in, got, tt.want)
    		}
    	}
    
    	if got, sub := logbuf.String(), "dropping invalid bytes"; !strings.Contains(got, sub) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 18:33:05 UTC 2024
    - 26.2K bytes
    - Viewed (0)
  3. src/net/http/request.go

    // AddCookie only sanitizes c's name and value, and does not sanitize
    // a Cookie header already present in the request.
    func (r *Request) AddCookie(c *Cookie) {
    	s := fmt.Sprintf("%s=%s", sanitizeCookieName(c.Name), sanitizeCookieValue(c.Value, c.Quoted))
    	if c := r.Header.Get("Cookie"); c != "" {
    		r.Header.Set("Cookie", c+"; "+s)
    	} else {
    		r.Header.Set("Cookie", s)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 49.4K bytes
    - Viewed (0)
Back to top