// AddRequestTime is a web context that adds the current time to the request's context
323977
func AddRequestTime(ctx context.Context, rw http.ResponseWriter, r *http.Request, next ContextHandler) {
	next.ServeHTTPC(AddTime(ctx, time.Now()), rw, r)
}
132245
func (h *handler) addRequestOp(op *requestOp) {
	for _, id := range op.ids {
		h.respWait[string(id)] = op
	}
}
48949
func (w *webRequester) Request() error {
	resp, err := http.Get(w.url)
	resp.Body.Close()
	return err
}
1374528
func newRequest(method, pathPattern string, writer runtime.ClientRequestWriter) (*request, error) {
	return &request{
		pathPattern: pathPattern,
		method:      method,
		writer:      writer,
		header:      make(http.Header),
		query:       make(url.Values),
		timeout:     DefaultTimeout,
	}, nil
}
1268019
func (r *Timing) Add(duration time.Duration) {
	b := r.getCurrentBucket()

	r.Mutex.Lock()
	defer r.Mutex.Unlock()

	b.Durations = append(b.Durations, duration)
	r.removeOldBuckets()
}
847606
func WithRequestTimeout(t time.Duration) Option {
	return func(c *config) {
		c.requestTimeout = t
	}
}
31516
func HTTPRequestFromContext(ctx context.Context) *http.Request {
	req, _ := ctx.Value(httpRequestContextKey).(*http.Request)
	return req
}
823880
func (d Date) Add(duration time.Duration) Date {
	t := d.t.Add(toDays(duration))
	return Date{t: t}
}
757349
func (r *Report) AddContext(k string, v interface{}) {
	r.Request.Context[k] = v
}
1098678
func (r QueryRequest) ProxyRequest() (*query.ProxyRequest, error) {
	return r.proxyRequest(time.Now)
}
276080
func (c *Client) createRequestContext(opts *requestOptions) (reqContext.Context, reqContext.CancelFunc) {

	if opts.Timeouts == nil {
		opts.Timeouts = make(map[fab.TimeoutType]time.Duration)
	}

	if opts.Timeouts[fab.PeerResponse] == 0 {
		opts.Timeouts[fab.PeerResponse] = c.ctx.EndpointConfig().Timeout(fab.PeerResponse)
	}

	return contextImpl.NewRequest(c.ctx, contextImpl.WithTimeout(opts.Timeouts[fab.PeerResponse]), contextImpl.WithParent(opts.ParentContext))
}
977544
func Request(method, endpoint string) (r *Requester, err error) {
	url, err := stdurl.ParseRequestURI(endpoint)
	if err != nil {
		return nil, err
	}
	r = &Requester{
		Method:   strings.ToUpper(method),
		Endpoint: endpoint,
		Url:      url,
		Header:   make(http.Header),
		timeout:  defaultTimeout,
	}
	return
}
1003283
func (c *Client) NewRequest(method, path string, body *bytes.Buffer,
	requestDate string) (*http.Request, error) {

	url, err := url.Parse(c.URL + path)
	if err != nil {
		return nil, fmt.Errorf("Error parsing base URL: %s", err)
	}

	// Build the request
	req, err := http.NewRequest(method, url.String(), body)
	if err != nil {
		return nil, fmt.Errorf("Error creating request: %s", err)
	}

	// Calculate the hexadecimal HMAC SHA1 of requestDate using sKey
	key := []byte(c.SKey)
	h := hmac.New(sha1.New, key)
	if len(requestDate) == 0 {
		requestDate = time.Now().UTC().Format(http.TimeFormat)
	}
	h.Write([]byte(requestDate))
	hmacString := hex.EncodeToString(h.Sum(nil))

	// Add the authorization header
	req.Header.Add("X-Dnsme-Apikey", c.AKey)
	req.Header.Add("X-Dnsme-Requestdate", requestDate)
	req.Header.Add("X-Dnsme-Hmac", hmacString)
	req.Header.Add("Accept", "application/json")

	// If it's a not a get, add a content-type
	if method != "GET" {
		req.Header.Add("Content-Type", "application/json")
	}
	return req, nil
}
384217
func (s *StreamDescription) SetCreationRequestDateTime(v time.Time) *StreamDescription {
	s.CreationRequestDateTime = &v
	return s
}
131922
func (l *TimeLimiter) Add(d time.Duration) {
	l.add(time.Now(), d)
}
314790
func addTimeContext(db *sqlx.DB, in *dt.Msg) error {
	var addContext bool
	for _, stem := range in.Stems {
		if stem == "then" {
			addContext = true
			break
		}
	}
	if !addContext {
		return nil
	}
	var byt []byte
	var err error
	if in.User.ID > 0 {
		q := `SELECT value FROM states WHERE userid=$1 AND key=$2`
		err = db.Get(&byt, q, in.User.ID, keyContextTime)
	} else {
		q := `SELECT value FROM states
		      WHERE flexid=$1 AND flexidtype=$2 AND key=$3`
		err = db.Get(&byt, q, in.User.FlexID, in.User.FlexIDType,
			keyContextTime)
	}
	if err == sql.ErrNoRows {
		return nil
	}
	if err != nil {
		return err
	}
	var times []time.Time
	if err = json.Unmarshal(byt, &times); err != nil {
		return err
	}
	in.StructuredInput.Times = times
	return nil
}
678429
func newRequest(url, method string) *Request {
	var resp http.Response
	req := http.Request{
		Method:     method,
		Header:     make(http.Header),
		Proto:      "HTTP/1.1",
		ProtoMajor: 1,
		ProtoMinor: 1,
	}
	return &Request{url, &req, map[string]string{}, map[string]string{}, defaultSetting, &resp, nil}
}