// checks for a valid Header
14232
func validateCommonHeader(hdr *common.Header) (*common.ChannelHeader, *common.SignatureHeader, error) {
	if hdr == nil {
		return nil, nil, errors.New("nil header")
	}

	chdr, err := utils.UnmarshalChannelHeader(hdr.ChannelHeader)
	if err != nil {
		return nil, nil, err
	}

	shdr, err := utils.GetSignatureHeader(hdr.SignatureHeader)
	if err != nil {
		return nil, nil, err
	}

	err = validateChannelHeader(chdr)
	if err != nil {
		return nil, nil, err
	}

	err = validateSignatureHeader(shdr)
	if err != nil {
		return nil, nil, err
	}

	return chdr, shdr, nil
}
50172
func (c *ResetCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}
1283941
func IsValid(uuid string) bool {
	_, err := Parse(uuid)
	return err == nil
}
1374553
func (m *JwtHeader) Validate() error {
	if m == nil {
		return nil
	}

	if len(m.GetName()) < 1 {
		return JwtHeaderValidationError{
			field:  "Name",
			reason: "value length must be at least 1 bytes",
		}
	}

	// no validation rules for ValuePrefix

	return nil
}
329250
func (s *keyCheckV1) Check(key string) (res *http.Response, err error) {
	req, err := http.NewRequest("GET", s.target, nil)
	req.Header.Add(HeaderKeyName, key)
	res, err = s.client.Do(req)
	return
}
969734
func (r *httpVPackResponse) Header(key string) string {
	return r.resp.Header.Get(key)
}
321858
func (p patterns) IsValid(value string) bool {
	for _, pattern := range p {
		if strings.HasPrefix(http.CanonicalHeaderKey(value), pattern) {
			return true
		}
	}
	return false
}
174492
func (r *Request) Header(key, value string) *Request {
	r.req.Header.Set(key, value)
	return r
}
331645
func VerifyHTTPHeader(r *http.Request) error {
	token := r.Header.Get(HeaderName)
	if len(token) == 0 {
		return trace.BadParameter("cannot retrieve CSRF token from HTTP header %q", HeaderName)
	}

	err := VerifyToken(token, r)
	if err != nil {
		return trace.Wrap(err)
	}

	return nil
}
21454
func (verification *TokenVerification) Valid() bool {
	if verification.HTTPResponse.StatusCode == 200 && verification.Token == "is valid" {
		return true
	}

	return false
}
881917
func checkHeaders(a, b jose.Header) error {
	if len(a)+len(b) == 0 {
		return ErrTwoEmptyHeaders
	}
	for key := range a {
		if b.Has(key) && !IgnoreDupes {
			return ErrDuplicateHeaderParameter
		}
	}
	return nil
}
381050
func (c *Connection) checkSubscribeHeaders(h Headers) error {
	if _, ok := h.Contains(HK_DESTINATION); !ok {
		return EREQDSTSUB
	}
	//
	am, ok := h.Contains(HK_ACK)
	//
	switch c.Protocol() {
	case SPL_10:
		if ok { // Client supplied ack header
			if !validAckModes10[am] {
				return ESBADAM
			}
		}
	case SPL_11:
		fallthrough
	case SPL_12:
		if ok { // Client supplied ack header
			if !(validAckModes10[am] || validAckModes1x[am]) {
				return ESBADAM
			}
		}
	default:
		log.Fatalf("Internal protocol level error:<%s>\n", c.Protocol())
	}
	return nil
}
1266769
func (f *ScmpFilter) IsValid() bool {
	f.lock.Lock()
	defer f.lock.Unlock()

	return f.valid
}
1306491
func (c *SucceedCall) Header() http.Header {
	if c.header_ == nil {
		c.header_ = make(http.Header)
	}
	return c.header_
}
454689
func (header *tokenHeader) valid() bool {
	// RFC7515 s4.1.1 alg MUST be present
	if header.alg == "" {
		return false
	}
	// RFC7515 4.1.11 JWS is invalid if there is a critical parameter that we did not recognize
	for _, u := range header.unknown {
		if header.crit[u] {
			return false
		}
	}
	return true
}
905464
func (ck *TCPCheck) Valid() error {
	if ck.Name == "" {
		return fmt.Errorf("invalid value for `Name`, must contain non-empty string")
	}

	if ck.Hostname == "" {
		return fmt.Errorf("invalid value for `Hostname`, must contain non-empty string")
	}

	if ck.Resolution != 1 && ck.Resolution != 5 && ck.Resolution != 15 &&
		ck.Resolution != 30 && ck.Resolution != 60 {
		return fmt.Errorf("invalid value %v for `Resolution`, allowed values are [1,5,15,30,60]", ck.Resolution)
	}

	if ck.Port < 1 {
		return fmt.Errorf("Invalid value for `Port`.  Must contain an integer >= 1")
	}

	return nil
}
1124697
func IsHeader(packet []byte) bool {
	return len(packet) > 6 && packet[0]&1 == 1 &&
		packet[1] == 'v' &&
		packet[2] == 'o' &&
		packet[3] == 'r' &&
		packet[4] == 'b' &&
		packet[5] == 'i' &&
		packet[6] == 's'
}