Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for hasToken (0.13 sec)

  1. src/cmd/go/internal/base/limit.go

    }
    
    // AcquireNet acquires a semaphore token for a network operation.
    func AcquireNet() (release func(), err error) {
    	hasToken := false
    	if n, ok := NetLimit(); ok {
    		if n == 0 {
    			return nil, fmt.Errorf("network disabled by %v=%v", NetLimitGodebug.Name(), NetLimitGodebug.Value())
    		}
    		netLimitSem <- struct{}{}
    		hasToken = true
    	}
    
    	checker := new(netTokenChecker)
    	runtime.SetFinalizer(checker, (*netTokenChecker).panicUnreleased)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 19 02:47:12 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  2. src/net/http/header_test.go

    	{"BAR, FOO, BAZ", "foo", true},
    	{"foobar", "foo", false},
    	{"barfoo ", "foo", false},
    }
    
    func TestHasToken(t *testing.T) {
    	for _, tt := range hasTokenTests {
    		if hasToken(tt.header, tt.token) != tt.want {
    			t.Errorf("hasToken(%q, %q) = %v; want %v", tt.header, tt.token, !tt.want, tt.want)
    		}
    	}
    }
    
    func TestNilHeaderClone(t *testing.T) {
    	t1 := Header(nil)
    	t2 := t1.Clone()
    	if t2 != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 07 01:07:32 UTC 2022
    - 6.1K bytes
    - Viewed (0)
  3. src/net/http/header.go

    // returned without modifications.
    func CanonicalHeaderKey(s string) string { return textproto.CanonicalMIMEHeaderKey(s) }
    
    // hasToken reports whether token appears with v, ASCII
    // case-insensitive, with space or comma boundaries.
    // token must be all lowercase.
    // v may contain mixed cased.
    func hasToken(v, token string) bool {
    	if len(token) > len(v) || token == "" {
    		return false
    	}
    	if v == token {
    		return true
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 22:14:00 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  4. src/net/http/request.go

    func (r *Request) expectsContinue() bool {
    	return hasToken(r.Header.get("Expect"), "100-continue")
    }
    
    func (r *Request) wantsHttp10KeepAlive() bool {
    	if r.ProtoMajor != 1 || r.ProtoMinor != 0 {
    		return false
    	}
    	return hasToken(r.Header.get("Connection"), "keep-alive")
    }
    
    func (r *Request) wantsClose() bool {
    	if r.Close {
    		return true
    	}
    	return hasToken(r.Header.get("Connection"), "close")
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 49.4K bytes
    - Viewed (0)
  5. src/net/http/transfer.go

    			return false
    		}
    		return true
    	}
    
    	return false
    }
    
    func (t *transferWriter) writeHeader(w io.Writer, trace *httptrace.ClientTrace) error {
    	if t.Close && !hasToken(t.Header.get("Connection"), "close") {
    		if _, err := io.WriteString(w, "Connection: close\r\n"); err != nil {
    			return err
    		}
    		if trace != nil && trace.WroteHeaderField != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 22:14:00 UTC 2024
    - 31.1K bytes
    - Viewed (0)
  6. src/net/http/server.go

    	// protocol switch response and if KeepAlives are not enabled.
    	// See https://golang.org/issue/36381.
    	delConnectionHeader := w.closeAfterReply &&
    		(!keepAlivesEnabled || !hasToken(cw.header.get("Connection"), "close")) &&
    		!isProtocolSwitchResponse(w.status, header)
    	if delConnectionHeader {
    		delHeader("Connection")
    		if w.req.ProtoAtLeast(1, 1) {
    			setHeader.connection = "close"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 17:57:01 UTC 2024
    - 123.4K bytes
    - Viewed (0)
  7. src/cmd/go/internal/modindex/read.go

    		// mtime precision, reject caching if a file was read that
    		// is less than modTimeCutoff old.
    		//
    		// This is the same strategy used for hashing test inputs.
    		// See hashOpen in cmd/go/internal/test/test.go for the
    		// corresponding code.
    		if info.ModTime().After(cutoff) {
    			return cache.ActionID{}, ErrNotIndexed
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 14:34:32 UTC 2024
    - 29.7K bytes
    - Viewed (0)
  8. src/cmd/go/internal/test/test.go

    			}
    			if a.Package.Root == "" || search.InDir(name, a.Package.Root) == "" {
    				// Do not recheck files outside the module, GOPATH, or GOROOT root.
    				break
    			}
    			fh, err := hashOpen(name)
    			if err != nil {
    				if cache.DebugTest {
    					fmt.Fprintf(os.Stderr, "testcache: %s: input file %s: %s\n", a.Package.ImportPath, name, err)
    				}
    				return cache.ActionID{}, err
    			}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 14:34:32 UTC 2024
    - 71.9K bytes
    - Viewed (0)
Back to top