// HTTP2MatchHeaderFieldPrefixSendSettings matches the header field prefix
// and writes the settings to the server. Prefer HTTP2HeaderFieldPrefix over
// this one, if the client does not block on receiving a SETTING frame.
174183
func HTTP2MatchHeaderFieldPrefixSendSettings(name, valuePrefix string) MatchWriter {
	return func(w io.Writer, r io.Reader) bool {
		return matchHTTP2Field(w, r, name, func(gotValue string) bool {
			return strings.HasPrefix(gotValue, valuePrefix)
		})
	}
}
558784
func ParsePrefix(line string) *Prefix {
	// Start by creating an Prefix with nothing but the host
	id := &Prefix{
		Name: line,
	}

	uh := strings.SplitN(id.Name, "@", 2)
	if len(uh) == 2 {
		id.Name, id.Host = uh[0], uh[1]
	}

	nu := strings.SplitN(id.Name, "!", 2)
	if len(nu) == 2 {
		id.Name, id.User = nu[0], nu[1]
	}

	return id
}
1168281
func (s *ReplicationRuleFilter) SetPrefix(v string) *ReplicationRuleFilter {
	s.Prefix = &v
	return s
}
619566
func (s *AnalyticsS3BucketDestination) SetPrefix(v string) *AnalyticsS3BucketDestination {
	s.Prefix = &v
	return s
}
190736
func (s *ListObjectVersionsInput) SetPrefix(v string) *ListObjectVersionsInput {
	s.Prefix = &v
	return s
}
67933
func (c *Conn) MatchPrefix(key string, maxrecords int64) ([]string, error) {
	keystransmit := []KV{
		{"prefix", []byte(key)},
		{"max", []byte(strconv.FormatInt(maxrecords, 10))},
	}
	code, m, err := c.doRPC("/rpc/match_prefix", keystransmit)
	if err != nil {
		return nil, err
	}
	if code != 200 {
		return nil, makeError(m)
	}
	res := make([]string, 0, len(m))
	for _, kv := range m {
		if kv.Key[0] == '_' {
			res = append(res, string(kv.Key[1:]))
		}
	}
	if len(res) == 0 {
		// yeah, gokabinet was weird here.
		return nil, ErrSuccess
	}
	return res, nil
}
1297004
func (s *S3ResourceClassification) SetPrefix(v string) *S3ResourceClassification {
	s.Prefix = &v
	return s
}
972786
func (s *RestoreDBInstanceFromS3Input) SetS3Prefix(v string) *RestoreDBInstanceFromS3Input {
	s.S3Prefix = &v
	return s
}
1122648
func filterMatchingPrefix(entries []string, prefixEntry string) []string {
	start := 0
	end := len(entries)
	for {
		if start == end {
			break
		}
		if hasPrefix(entries[start], prefixEntry) {
			break
		}
		start++
	}
	for {
		if start == end {
			break
		}
		if hasPrefix(entries[end-1], prefixEntry) {
			break
		}
		end--
	}
	sort.Strings(entries[start:end])
	return entries[start:end]
}
352989
func (c *Config) AddFlagsPrefix(fs *flag.FlagSet, prefix string) {
	fs.Var(&c.Level, prefix+"log-level",
		"The logging level. Valid options are: debug, info, warning, error.")
}
6422
func ParseSettings(b []byte) []http2.Setting {
	var r []http2.Setting
	for i := 0; i < len(b)/6; i++ {
		r = append(r, http2.Setting{
			ID:  http2.SettingID(binary.BigEndian.Uint16(b[i*6:])),
			Val: binary.BigEndian.Uint32(b[i*6+2:]),
		})
	}
	return r
}
186341
func SetResponseHeader(key, val string) ServerResponseFunc {
	return func(ctx context.Context, md *metadata.MD, _ *metadata.MD) context.Context {
		key, val := EncodeKeyValue(key, val)
		(*md)[key] = append((*md)[key], val)
		return ctx
	}
}
1269427
func PathPrefix(r *http.Request) string {
	if prefix := httputil.PathBase(r); prefix != "" {
		return prefix
	}
	return "/"
}
486675
func ListPrefix(prefix string) (KeyValuePairs, error) {
	v, err := Client().ListPrefix(prefix)
	Trace("ListPrefix", err, logrus.Fields{fieldPrefix: prefix, fieldNumEntries: len(v)})
	return v, err
}
627848
func getSenderPrefix(mvalid chat1.MessageUnboxedValid, conv chat1.ConversationLocal, currentUsername string) (senderPrefix string) {
	if showSenderPrefix(mvalid, conv) {
		sender := mvalid.SenderUsername
		if sender == currentUsername {
			senderPrefix = "You: "
		} else {
			senderPrefix = fmt.Sprintf("%s: ", sender)
		}
	}
	return senderPrefix
}
481071
func parseSignedHeader(signedHdrElement string) ([]string, APIErrorCode) {
	signedHdrFields := strings.Split(strings.TrimSpace(signedHdrElement), "=")
	if len(signedHdrFields) != 2 {
		return nil, ErrMissingFields
	}
	if signedHdrFields[0] != "SignedHeaders" {
		return nil, ErrMissingSignHeadersTag
	}
	if signedHdrFields[1] == "" {
		return nil, ErrMissingFields
	}
	signedHeaders := strings.Split(signedHdrFields[1], ";")
	return signedHeaders, ErrNone
}
30714
func (l *Logger) SetPrefix(prefix string) {
	for _, r := range l.Receivers {
		r.SetPrefix(prefix)
	}
}