NCBI C++ ToolKit
Classes | Functions | Variables
ncbi_http_session.cpp File Reference
#include <ncbi_pch.hpp>
#include "ncbi_ansi_ext.h"
#include "ncbi_servicep.h"
#include <corelib/ncbifile.hpp>
#include <corelib/request_ctx.hpp>
#include <corelib/ncbimtx.hpp>
#include <corelib/ncbistr.hpp>
#include <connect/ncbi_http_session.hpp>
#include <stdlib.h>
+ Include dependency graph for ncbi_http_session.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CFileDataProvider
 
class  CFormDataEncoder
 
struct  SRetryProcessing
 
struct  SRetryProcessing::SValueRestorer< TMember, TValue >
 
struct  SAdjustData
 

Functions

static void s_ParseHttpHeader (const CTempString &from, CHttpHeaders::THeaders &to)
 
static Int8 s_SimpleRand (Int8 range)
 
static void x_WritePartHeader (CNcbiOstream &out, const string &boundary, const string &name, const string &content_type, const string &filename=kEmptyStr)
 
unsigned short x_RetriesToMaxtry (unsigned short retries)
 
static void s_Cleanup (void *user_data)
 
 DEFINE_STATIC_FAST_MUTEX (s_SessionMutex)
 
CHttpResponse g_HttpGet (const CUrl &url, const CHttpParam &param)
 Shortcut for GET request. More...
 
CHttpResponse g_HttpGet (const CUrl &url, const CTimeout &timeout, THttpRetries retries)
 Shortcut for GET request. More...
 
CHttpResponse g_HttpGet (const CUrl &url, const CHttpHeaders &headers, const CTimeout &timeout, THttpRetries retries)
 Shortcut for GET request with custom headers. More...
 
CHttpResponse g_HttpPost (const CUrl &url, CTempString data, const CHttpParam &param)
 Shortcut for POST request. More...
 
CHttpResponse g_HttpPost (const CUrl &url, CTempString data, CTempString content_type, const CTimeout &timeout, THttpRetries retries)
 Shortcut for POST request. More...
 
CHttpResponse g_HttpPost (const CUrl &url, const CHttpHeaders &headers, CTempString data, CTempString content_type, const CTimeout &timeout, THttpRetries retries)
 Shortcut for POST request with custom headers. More...
 
CHttpResponse g_HttpPut (const CUrl &url, CTempString data, const CHttpParam &param)
 Shortcut for PUT request. More...
 
CHttpResponse g_HttpPut (const CUrl &url, CTempString data, CTempString content_type, const CTimeout &timeout, THttpRetries retries)
 Shortcut for PUT request. More...
 
CHttpResponse g_HttpPut (const CUrl &url, const CHttpHeaders &headers, CTempString data, CTempString content_type, const CTimeout &timeout, THttpRetries retries)
 Shortcut for PUT request with custom headers. More...
 

Variables

static const char * kHttpHeaderNames []
 
static const char * kReservedHeaders []
 
static CSafeStatic< CHttpHeaders::THeaderValueskEmptyValues
 
static const char kHttpHeaderDelimiter = ':'
 
const char * kContentType_FormUrlEnc = "application/x-www-form-urlencoded"
 
const char * kContentType_MultipartFormData = "multipart/form-data"
 

Function Documentation

◆ DEFINE_STATIC_FAST_MUTEX()

DEFINE_STATIC_FAST_MUTEX ( s_SessionMutex  )

◆ s_Cleanup()

static void s_Cleanup ( void *  user_data)
static

Definition at line 836 of file ncbi_http_session.cpp.

Referenced by CHttpRequest::x_InitConnection().

◆ s_ParseHttpHeader()

static void s_ParseHttpHeader ( const CTempString from,
CHttpHeaders::THeaders to 
)
static

◆ s_SimpleRand()

static Int8 s_SimpleRand ( Int8  range)
static

Definition at line 347 of file ncbi_http_session.cpp.

References a, last(), and compile_time_bits::range().

Referenced by CHttpFormData::CreateBoundary().

◆ x_RetriesToMaxtry()

unsigned short x_RetriesToMaxtry ( unsigned short  retries)
inline

Definition at line 566 of file ncbi_http_session.cpp.

Referenced by CHttpRequest::x_InitConnection().

◆ x_WritePartHeader()

static void x_WritePartHeader ( CNcbiOstream out,
const string boundary,
const string name,
const string content_type,
const string filename = kEmptyStr 
)
static

Definition at line 384 of file ncbi_http_session.cpp.

References HTTP_EOL, and out().

Referenced by CHttpFormData::WriteFormData().

Variable Documentation

◆ kContentType_FormUrlEnc

const char* kContentType_FormUrlEnc = "application/x-www-form-urlencoded"

◆ kContentType_MultipartFormData

const char* kContentType_MultipartFormData = "multipart/form-data"

Definition at line 227 of file ncbi_http_session.cpp.

Referenced by CHttpFormData::GetContentTypeStr().

◆ kEmptyValues

Definition at line 74 of file ncbi_http_session.cpp.

Referenced by CHttpHeaders::GetAllValues().

◆ kHttpHeaderDelimiter

const char kHttpHeaderDelimiter = ':'
static

Definition at line 75 of file ncbi_http_session.cpp.

Referenced by CHttpHeaders::GetHttpHeader(), and s_ParseHttpHeader().

◆ kHttpHeaderNames

const char* kHttpHeaderNames[]
static
Initial value:
= {
"Cache-Control",
"Content-Length",
"Content-Type",
"Cookie",
"Date",
"Expires",
"Location",
"Range",
"Referer",
"Set-Cookie",
"User-Agent",
"Host"
}

Definition at line 52 of file ncbi_http_session.cpp.

Referenced by CHttpHeaders::GetHeaderName().

◆ kReservedHeaders

const char* kReservedHeaders[]
static
Initial value:
= {
"NCBI-SID",
"NCBI-PHID"
}

Definition at line 69 of file ncbi_http_session.cpp.

Referenced by CHttpHeaders::x_IsReservedHeader().

Modified on Fri Sep 20 14:58:18 2024 by modify_doxy.py rev. 669887