// HTTP POST /:version/sessions/:id/recording
513846
func (s *APIServer) uploadSessionRecording(auth ClientI, w http.ResponseWriter, r *http.Request, p httprouter.Params, version string) (interface{}, error) {
	var files form.Files
	var namespace, sid string

	err := form.Parse(r,
		form.FileSlice("recording", &files),
		form.String("namespace", &namespace, form.Required()),
		form.String("sid", &sid, form.Required()),
	)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	if r.MultipartForm != nil {
		defer r.MultipartForm.RemoveAll()
	}
	if !services.IsValidNamespace(namespace) {
		return nil, trace.BadParameter("invalid namespace %q", namespace)
	}
	if len(files) != 1 {
		return nil, trace.BadParameter("expected a single file parameter but got %d", len(files))
	}
	defer files[0].Close()
	if err = auth.UploadSessionRecording(events.SessionRecording{
		SessionID: session.ID(sid),
		Namespace: namespace,
		Recording: files[0],
	}); err != nil {
		return nil, trace.Wrap(err)
	}
	return message("ok"), nil
}
13665
func Session(r *http.Request, name string) *sessions.Session {
	session, _ := Store.Get(r, name)
	return session
}
1193966
func (api *Client) CreateRecordingTranscription(id string) (string, error) {
	_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(recordingsPath), id, transcriptionsPath))
	if err != nil {
		return "", err
	}
	return getIDFromLocationHeader(headers), nil
}
334765
func (r *recorder) WriteHeader(code int) {
	resp := http.Response{StatusCode: code, Header: r.Header()}
	resp.Write(r.server)
}
586946
func (s *Registry) Save(w http.ResponseWriter) error {
	var errMulti MultiError
	for name, info := range s.sessions {
		session := info.s
		if session.store == nil {
			errMulti = append(errMulti, fmt.Errorf(
				"sessions: missing store for session %q", name))
		} else if err := session.store.Save(s.request, w, session); err != nil {
			errMulti = append(errMulti, fmt.Errorf(
				"sessions: error saving session %q -- %v", name, err))
		}
	}
	if errMulti != nil {
		return errMulti
	}
	return nil
}
631517
func (c *Client) AddRecord(domainID int, body Record) (*Record, error) {
	uri := fmt.Sprintf("/%d/records/", domainID)
	req, err := c.newRequest(http.MethodPost, uri, body)
	if err != nil {
		return nil, err
	}

	record := &Record{}
	_, err = c.do(req, record)
	if err != nil {
		return nil, err
	}

	return record, nil
}
594385
func POST(ctx log.Interface, server string, strategy auth.Strategy, URI string, headers map[string]string, body, res interface{}) error {
	return performRequest(ctx, server, strategy, "POST", URI, headers, body, res, MaxRedirects)
}
507863
func (record *SessionRecord) Serialize() ([]byte, error) {
	rs := &protobuf.RecordStructure{}
	rs.CurrentSession = record.sessionState.SS
	for _, s := range record.PreviousStates {
		rs.PreviousSessions = append(rs.PreviousSessions, s.SS)
	}
	b, err := proto.Marshal(rs)
	if err != nil {
		return nil, err
	}
	return b, nil
}
1066121
func (s *Segment) RecordRequest(req *http.Request, namespace string) {
	s.Lock()
	defer s.Unlock()

	if s.HTTP == nil {
		s.HTTP = &HTTP{}
	}

	s.Namespace = namespace
	s.HTTP.Request = requestData(req)
}
534941
func (s *Server) Post(path string, h HandlerFunc, opts ...HandlerOption) {
	s.register(http.MethodPost, path, h, opts...)
}
886579
func (c *CredentialGraphClient) Post(ctx context.Context, t *CredentialGraph) (CredentialGraph, error) {
	resp := rawGraph{}
	err := c.client.RoundTrip(ctx, "POST", "/credentialgraph", nil, t, &resp)
	if err != nil {
		return nil, err
	}

	return resp.convert()
}
958654
func Post(baseURL string, object *jsh.Object) (*jsh.Document, *http.Response, error) {
	request, err := PostRequest(baseURL, object)
	if err != nil {
		return nil, nil, err
	}

	return Do(request, jsh.ObjectMode)
}
1366720
func (_class SessionClass) GetRecord(sessionID SessionRef, self SessionRef) (_retval SessionRecord, _err error) {
	_method := "session.get_record"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertSessionRecordToGo(_method + " -> ", _result.Value)
	return
}
1177486
func (m *MultiLog) UploadSessionRecording(rec SessionRecording) error {
	var errors []error
	for _, log := range m.loggers {
		errors = append(errors, log.UploadSessionRecording(rec))
	}
	return trace.NewAggregate(errors...)
}
1074833
func (c *CookieOverseer) SessionID(w http.ResponseWriter, r *http.Request) (string, error) {
	panic("cookie sessions do not use session ids")
}
772980
func (r *recorder) Activity(server string, id uint64) {
	r.mu.Lock()
	defer r.mu.Unlock()
	if !r.enabled {
		return
	}

	if pos := r.findIndex(server, id); pos >= 0 {
		r.entries[pos].LastSeen = r.clock.Now()
	}
}
565162
func (twilio *Twilio) voicePost(formValues url.Values) (*VoiceResponse, *Exception, error) {
	var voiceResponse *VoiceResponse
	var exception *Exception
	twilioUrl := twilio.BaseUrl + "/Accounts/" + twilio.AccountSid + "/Calls.json"

	res, err := twilio.post(formValues, twilioUrl)
	if err != nil {
		return voiceResponse, exception, err
	}
	defer res.Body.Close()

	decoder := json.NewDecoder(res.Body)

	if res.StatusCode != http.StatusCreated {
		exception = new(Exception)
		err = decoder.Decode(exception)

		// We aren't checking the error because we don't actually care.
		// It's going to be passed to the client either way.
		return voiceResponse, exception, err
	}

	voiceResponse = new(VoiceResponse)
	err = decoder.Decode(voiceResponse)
	return voiceResponse, exception, err
}