A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/ncbi__http__connector_8c_source.html below:

NCBI C++ ToolKit: src/connect/ncbi_http_connector.c Source File

40 #include <connect/ncbi_base64.h> 46 #define NCBI_USE_ERRCODE_X Connect_HTTP 49 #define HTTP_SOAK_READ_SIZE 16384 178  "HTTP_UNSAFE_REDIRECTS"

,

205  static const char

kAuthTagTemplate[] =

"Proxy-Authorization: Basic "

;

207  size_t

taglen, userlen, passlen,

len

,

n

;

208  const char

*

tag

, *user, *pass;

214  tag

= kAuthTagTemplate + 6;

215

taglen =

sizeof

(kAuthTagTemplate) - 7;

226  tag

= kAuthTagTemplate;

227

taglen =

sizeof

(kAuthTagTemplate) - 1;

238  if

(retry && uuu->

entity

)

248

userlen = strlen(user);

249

passlen = strlen(pass);

250

s =

buf

+

sizeof

(

buf

) - passlen;

251  if

(passlen > 2 && pass[0] ==

'['

&& pass[passlen - 1] ==

']'

) {

253

&&

len

== passlen - 2) {

260

memcpy(--s, user, userlen);

263

memcpy(s + userlen, pass, passlen);

264  len

= userlen + passlen;

268

userlen = (size_t)(s -

buf

);

269  assert

(userlen > taglen);

270

userlen -= taglen + 1;

273  if

(

len

!=

n

||

buf

[taglen + passlen])

275

memcpy(

buf

,

tag

, taglen);

289  return

scheme1 == scheme2 ? 1

: 0

;

296  unsigned int

ip1, ip2;

308  return

*buf1 &&

strcasecmp

(buf1, buf2) == 0 ? 1

: 0

;

368

net_info->

host

))) {

380

net_info->

host

))) {

389

&& (!same_port || !same_host ||

395

net_info->

host

) != 0))) {

412  return

port1 == port2

421  const char

* host_to,

422  unsigned short

port_to,

424  const char

* host_from,

425  unsigned short

port_from)

428  unsigned int

ip1, ip2;

438  strncpy0

(buf1, host_from,

sizeof

(buf1) - 1);

443  if

(ip1

&& ip1 == ip2)

446  strncpy0

(buf2, host_to,

sizeof

(buf2) - 1);

516

}

else if

(uuu->

vhost 558

?

"[HTTP%s%s] Too many failed attempts (%hu), giving up"

:

""

;

559

}

else if

(retry && retry->

mode

) {

563  switch

(retry->

mode

) {

572  else if

(!retry->

data

|| *retry->

data

==

'?'

)

585

reason =

"Prohibited"

;

593

reason =

"Spurious tunnel"

;

597

reason =

"Unknown failure of"

;

604

(

"[HTTP%s%s] %s %s%s to %s%s%s"

,

612

?

"redirect"

:

"submission"

,

613

retry->

data

?

"\""

:

"<"

,

614

retry->

data

? retry->

data

:

"NULL"

,

615

retry->

data

?

"\""

:

">"

));

618

(

"[HTTP%s%s] %s \"%s\""

,

622

?

"Finishing submission with"

:

"Redirecting to"

,

635

strcspn(retry->

data

,

" \t"

)) != 0) {

644

reason =

"not allowed with CONNECT"

;

648

reason =

"not implemented"

;

652

reason =

"cannot be done at this point"

;

661

reason =

"prohibited"

;

665

reason =

"required"

;

669

reason =

"unknown failure"

;

676

(

"[HTTP%s%s] %s %s %c%s%c"

,

680

?

"Authorization"

:

"Proxy authorization"

,

682  "(["

[!retry->

data

],

683

retry->

data

? retry->

data

:

"NULL"

,

684  ")]"

[!retry->

data

]));

687

(

"[HTTP%s%s] Authorizing%s"

,

697

(

"[HTTP%s%s] Unknown retry mode #%u"

,

699

url ? url :

""

, (

unsigned int

) retry->

mode

));

711

?

"[HTTP%s%s] Retry attempts (%hu) exhausted, giving up"

:

""

;

730 static char

*

x_HostPort

(

size_t

reserve,

const char

* host,

unsigned short

xport)

732  size_t

hostlen = strlen(host), portlen;

733  char

* hostport, port[16];

740

portlen = (size_t) sprintf(port,

":%hu"

, xport) + 1;

741

brackets = memchr(host,

':'

, hostlen) ? 2 : 0;

742

hostport = (

char

*)

malloc

(reserve + hostlen + brackets + portlen);

744  char

* ptr = hostport + reserve;

747

memcpy(ptr, host, hostlen);

751

memcpy(ptr, port, portlen);

760  unsigned short

port = net_info->

port

;

771

strcpy(

tag

, net_info->

host

);

783  size_t len

= strlen(

id

);

799  size_t len

= strlen(

id

);

815  size_t len

= strlen(

id

);

831  size_t len

= strlen(

id

);

876

(

"[HTTP%s%s] Connector is no longer usable"

,

907

uuu->

reused

= sock ? 1

: 0

;

920

net_info->

user

[0] =

'\0'

;

921

net_info->

pass

[0] =

'\0'

;

922  if

(net_info->

port

== 0)

934  int

reset_user_header;

935  char

* http_user_header;

960

(uuu->

net_info

,

"Transfer-Encoding: chunked"

)) {

993

}

else if

(!(temp = (

char

*)

malloc

(

len

))

998  free

((

void

*) path);

1007  if

((temp = (

char

*) strchr(path,

'?'

)) != 0)

1010  if

(args && (!*args || *args ==

'#'

))

1040  size_t

args_len = strcspn(args,

"#"

);

1041  size_t size

= args_len * 3;

1042  size_t

rd_len, wr_len;

1044  if

(!(temp = (

char

*)

malloc

(

size

+ strlen(args+args_len) +1))){

1048

(

"[HTTP%s%s] Out of memory encoding" 1049  " URL arguments (%lu bytes)"

,

1052

(

unsigned long

)(

size

+ strlen

1053

(args + args_len) +1)));

1055  free

((

void

*) path);

1060  assert

(rd_len == args_len);

1062

strcpy(temp + wr_len, args + args_len);

1076

(uuu->

net_info

,

"User-Agent: NCBIHttpConnector" 1086  "Connection: keep-alive"

);

1088

reset_user_header = 1;

1090

reset_user_header = 0;

1104

memset(&extra, 0,

sizeof

(extra));

1106

extra.host = uuu->

vhost

;

1120

extrap,

flags

, &sock);

1124  if

(reset_user_header) {

1130  free

((

void

*) path);

1132  free

((

void

*) args);

1159  if

(status == eIO_Closed)

1234

status =

ctx

.status;

1263

|| (timeout && !(timeout->

sec

| timeout->

usec

)))) {

1270

sprintf(what,

"write request body at offset %lu"

,

1271

(

unsigned long

) off);

1273

strcpy(what,

"write request body"

);

1276

strcpy(what,

"finalize request body"

);

1278

strcpy(what,

"finalize request"

);

1283

(

"[HTTP%s%s] Cannot %s (%s)"

,

1302  const char

* e = (

const char

*) memchr(param,

'='

, paramlen);

1304  if

(!e || e == param)

1306  if

((

len

= (

size_t

)(++e - param)) >= paramlen)

1309  if

(strcspn(param,

" \t"

) <

len

)

1311  if

(*e ==

'\''

|| *e ==

'"'

) {

1315  if

(!(e = (

const char

*) memchr(e + 1, *e, --

len

)))

1319

e += strcspn(e,

" \t"

);

1320  if

(e != param + paramlen && e + strspn(e,

" \t"

) != param + paramlen)

1332  size_t

word = strcspn(

text

,

" \t"

);

1336  const char

* param =

text

+ word;

1337  for

(param += strspn(param,

" \t"

); param <

text

+

len

;

1338

param += strspn(param,

", \t"

)) {

1339  size_t

paramlen = (size_t)(

text

+

len

- param);

1340  const char

* c = (

const char

*) memchr(param,

','

, paramlen);

1342

paramlen = (size_t)(c - param);

1345  if

(paramlen > 6 &&

strncasecmp

(param,

"realm="

, 6) == 0)

1347

param += c ? ++paramlen : paramlen;

1396  if

(!

first

&& (

str

[0] !=

'\r'

||

str

[1] !=

'\n'

)) {

1418

sprintf(errbuf,

"Partial read %lu out of %lu"

,

1420

(

unsigned long

)

size

);

1427

:

"Protocol error"

;

1431

(

"[HTTP%s%s] Cannot read chunk size: %s%.*s%s"

,

1435

!

str

? (

int

) strlen(err) : (

int

)(

size

- (

first

? 2 : 4)),

1470  if

(status == eIO_Closed) {

1473

(

"[HTTP%s%s] Cannot read chunk tail"

,

1515

(

"[HTTP%s%s] Cannot allocate response chunk" 1519

(

unsigned long

)

size

, &

"s"

[

size

== 1]));

1539

(

"[HTTP%s%s] Cannot collect response body"

,

1547  if

(status == eIO_Closed)

1572  "HTTP_ERROR_HEADER_ONLY"

,

1573  val

,

sizeof

(

val

), 0);

1586

eHTTP_NcbiMsg = 1 << 0,

1587

eHTTP_NcbiSid = 1 << 1,

1588

eHTTP_Location = 1 << 2,

1589

eHTTP_Connection = 1 << 3,

1590

eHTTP_Authenticate = 1 << 4,

1591

eHTTP_ContentLength = 1 << 5,

1592

eHTTP_TransferEncoding = 1 << 6

1594  typedef unsigned short

THTTP_Tags;

1595  char

* url = 0, *hdr, *s;

1604

memset(retry, 0,

sizeof

(*retry));

1618

(

"[HTTP%s%s] Cannot allocate header" 1622

(

unsigned long

)

size

));

1629  if

(memcmp(&hdr[

size

- 4],

"\r\n\r\n"

, 4) == 0) {

1631

hdr[

size

] =

'\0'

;

1647  else if

(tmo->

sec

| tmo->

usec

)

1656

(

"[HTTP%s%s] Cannot %s header (%s)"

,

1678  if

(sscanf(hdr,

"HTTP/%*d.%*d %d "

, &http_code) != 1 || !http_code)

1680

uuu->

http_code

= (

unsigned

short) http_code;

1681  if

(http_code < 200 || 299 < http_code) {

1682  if

(http_code == 304)

1684  else if

(http_code == 301 || http_code == 302 || http_code == 307)

1686  else if

(http_code == 303)

1688  else if

(http_code == 401)

1690  else if

(http_code == 407)

1692  else if

(http_code <= 0 ||

1693

http_code == 400 || http_code == 403 ||

1694

http_code == 404 || http_code == 405 ||

1695

http_code == 406 || http_code == 410) {

1705  const char

* header_header;

1706  if

(!http_code || http_code == 304)

1707

header_header =

"HTTP header"

;

1709

header_header =

"HTTP header (fatal)"

;

1711

header_header =

"HTTP header (error)"

;

1713

header_header =

"HTTP header (redirect)"

;

1715

header_header =

"HTTP header (see other)"

;

1717

header_header =

"HTTP header (authentication)"

;

1718  else if

(retry->

mode

)

1719

header_header = 0,

assert

(0);

1721

header_header =

"HTTP header (retriable server error)"

;

1727

url ? url :

""

, header_header));

1738

sprintf(

text

,

"%d"

, http_code);

1740

strcpy(

text

,

"occurred"

);

1742

(

"[HTTP%s%s] Fatal error %s"

,

1744

url ? url :

""

,

text

));

1761

(

"[HTTP%s%s] HTTP header (parse error)"

,

1776

(eHTTP_NcbiMsg | eHTTP_Connection

1782

tags |= eHTTP_ContentLength | eHTTP_TransferEncoding;

1786  for

(s = strchr(hdr,

'\n'

); s && *s; s = strchr(s + 1,

'\n'

)) {

1787  if

(tags & eHTTP_NcbiMsg) {

1790  if

(

strncasecmp

(s, kNcbiMsgTag,

sizeof

(kNcbiMsgTag) - 1) == 0) {

1791  char

*

msg

= s +

sizeof

(kNcbiMsgTag) - 1, *e;

1792  while

(*

msg

&&

isspace

((

unsigned char

)(*msg)))

1794  if

(!(e = strchr(

msg

,

'\r'

)) && !(e = strchr(

msg

,

'\n'

)))

1797  if

(!

isspace

((

unsigned char

) e[-1]))

1799

}

while

(--e >

msg

);

1800  n

= (size_t)(e -

msg

);

1812

(

"[NCBI-MESSAGE] %s"

,

msg

));

1816

tags &= (THTTP_Tags)(~eHTTP_NcbiMsg);

1820  if

(tags & eHTTP_NcbiSid) {

1823  if

(

strncasecmp

(s, kNcbiSidTag,

sizeof

(kNcbiSidTag) - 1) == 0) {

1824  char

* sid = s +

sizeof

(kNcbiSidTag) - 1, *e;

1825  while

(*sid &&

isspace

((

unsigned char

)(*sid)))

1827  if

(!(e = strchr(sid,

'\r'

)) && !(e = strchr(sid,

'\n'

)))

1830  if

(!

isspace

((

unsigned char

) e[-1]))

1832

}

while

(--e > sid);

1833  n

= (size_t)(e - sid);

1840

tags &= (THTTP_Tags)(~eHTTP_NcbiSid);

1844  if

(tags & eHTTP_Location) {

1846  static const char

kLocationTag[] =

"\nLocation:"

;

1848  if

(

strncasecmp

(s, kLocationTag,

sizeof

(kLocationTag) - 1) == 0) {

1849  char

* loc = s +

sizeof

(kLocationTag) - 1, *e;

1850  while

(*loc &&

isspace

((

unsigned char

)(*loc)))

1852  if

(!(e = strchr(loc,

'\r'

)) && !(e = strchr(loc,

'\n'

)))

1855  if

(!

isspace

((

unsigned char

) e[-1]))

1857

}

while

(--e > loc);

1858  n

= (size_t)(e - loc);

1864

tags &= (THTTP_Tags)(~eHTTP_Location);

1868  if

(tags & eHTTP_Connection) {

1870  static const char

kConnectionTag[] =

"\nConnection:"

;

1871  if

(

strncasecmp

(s, kConnectionTag,

sizeof

(kConnectionTag)-1) == 0){

1872  char

* con = s +

sizeof

(kConnectionTag) - 1, *e;

1873  while

(*con &&

isspace

((

unsigned char

)(*con)))

1875  if

(!(e = strchr(con,

'\r'

)) && !(e = strchr(con,

'\n'

)))

1878  if

(!

isspace

((

unsigned char

) e[-1]))

1880

}

while

(--e > con);

1881  while

((

n

= (

size_t

)(e - con)) > 0) {

1882  const char

* c = (

const char

*) memchr(con,

','

,

n

);

1886  if

(!

isspace

((

unsigned char

) c[-1]))

1888

}

while

(--c > con);

1889

m = (size_t)(c - con);

1892  if

(m == 5 &&

strncasecmp

(con,

"close"

, 5) == 0) {

1896  if

(m == 10 &&

strncasecmp

(con,

"keep-alive"

, 10) == 0) {

1903  while

(con < e &&

isspace

((

unsigned char

)(*con)))

1906

tags &= (THTTP_Tags)(~eHTTP_Connection);

1910  if

(tags & eHTTP_Authenticate) {

1912  static const char

kAuthenticateTag[] =

"-Authenticate:"

;

1920

kAuthenticateTag,

sizeof

(kAuthenticateTag)-1)==0) {

1921  char

* txt = s +

n

+

sizeof

(kAuthenticateTag) - 1, *e;

1922  while

(*txt &&

isspace

((

unsigned char

)(*txt)))

1924  if

(!(e = strchr(txt,

'\r'

)) && !(e = strchr(txt,

'\n'

)))

1927  if

(!

isspace

((

unsigned char

) e[-1]))

1929

}

while

(--e > txt);

1930  n

= (size_t)(e - txt);

1936

tags &= (THTTP_Tags)(~eHTTP_Authenticate);

1940  if

(tags & eHTTP_ContentLength) {

1942  static const char

kContentLenTag[] =

"\nContent-Length:"

;

1943  if

(

strncasecmp

(s, kContentLenTag,

sizeof

(kContentLenTag)-1) == 0){

1947  const char

*

len

= s +

sizeof

(kContentLenTag) - 1, *e;

1949  while

(*

len

&&

isspace

((

unsigned char

)(*len)))

1951  if

(!(e = strchr(

len

,

'\r'

)) && !(e = strchr(

len

,

'\n'

)))

1954  if

(!

isspace

((

unsigned char

) e[-1]))

1956

}

while

(--e >

len

);

1964

tags &= (THTTP_Tags)(~eHTTP_ContentLength);

1968  if

(tags & eHTTP_TransferEncoding) {

1969  static const char

kTransferEncodingTag[] =

"\nTransfer-Encoding:"

;

1971  sizeof

(kTransferEncodingTag)-1) == 0) {

1972  const char

* te = s +

sizeof

(kTransferEncodingTag) - 1, *e;

1973  while

(*te &&

isspace

((

unsigned char

)(*te)))

1975  if

(!(e = strchr(te,

'\r'

)) && !(e = strchr(te,

'\n'

)))

1978  if

(!

isspace

((

unsigned char

) e[-1]))

1981  n

= (size_t)(e - te);

1982  if

(

n

== 7 &&

strncasecmp

(&e[-7],

"chunked"

, 7) == 0

1983

&& (

isspace

((

unsigned char

) e[-8])

1984

|| e[-8] ==

':'

|| e[-8] ==

','

)) {

1988

tags &= (THTTP_Tags)

1989

(~(eHTTP_ContentLength | eHTTP_TransferEncoding));

1994

(

"[HTTP%s%s] Chunked transfer encoding" 2020

(

"[HTTP%s%s] Cannot save HTTP header"

,

2033  if

(!http_code || http_code == 304) {

2059  const char

* err = status != eIO_Closed ?

IO_StatusStr

(status) : 0;

2067

(

"[HTTP%s%s] Server error message incomplete (%s)"

,

2069

url ? url :

""

, err));

2073

(

"[HTTP%s%s] No error message received from server" 2078

err ? err :

""

, &

")"

[!err]));

2079

}

else if

((s = (

char

*)

malloc

(

size

)) != 0) {

2083

(

"[HTTP%s%s] Cannot extract server error message" 2084  " from buffer entirely (%lu/%lu)"

,

2087

(

unsigned long

)

n

, (

unsigned long

)

size

));

2091

(

"[HTTP%s%s] Server error message%s%s%s"

,

2095

err ? err :

""

, &

")"

[!err]));

2100

(

"[HTTP%s%s] Cannot allocate server error message" 2104

(

unsigned long

)

size

, &

"s"

[

size

== 1]));

2181

|| (timeout && !(timeout->

sec

| timeout->

usec

)))) {

2189

adjust =

s_Adjust

(uuu, &retry, status, extract);

2193  if

(adjust != eIO_Closed)

2219  size_t size

,

size_t

* n_read)

2237

}

else if

(status != eIO_Closed)

2241  return

status ? status : eIO_Closed;

2251

status = eIO_Closed;

2255  size_t

n_peeked, n_decoded;

2257  size_t

peek_size =

size

> remain ? (size_t)(remain + 1) :

size

;

2258  void

* peek_buf =

malloc

(peek_size *= 3);

2267  assert

(n_peeked == n_decoded);

2274  if

(status == eIO_Closed)

2283

(

"[HTTP%s%s] Cannot URL-decode data: %s"

,

2299  if

(status == eIO_Closed) {

2307  const char

* how = 0;

2309  if

(status == eIO_Closed) {

2311

how =

"Premature EOM in"

;

2320  assert

(*n_read >= excess);

2321

*n_read -= (size_t) excess;

2325

how =

"Got too much"

;

2331

(

"[HTTP%s%s] %s data: received " 2335

url ? url :

""

, how,

2382  if

(status == eIO_Closed)

2590

(

"[HTTP%s%s] Illegal write (%lu byte%s) with %s"

,

2593

(

unsigned long

)

size

, &

"s"

[

size

== 1],

2595

?

"GET"

:

"HEAD"

));

2622  size

+= (size_t)

n

+ 2;

2633  size_t

dst_size = 3 *

size

;

2634  void

* dst =

malloc

(dst_size);

2697  assert

(n_read && !*n_read);

2699

status =

s_Read

(uuu, (

char

*)

buf

+ x_read,

size

- x_read, n_read);

2788

vhost = s + (6 -

first

);

2789

vhost += strspn(vhost,

"\t "

);

2790  if

(!(bare = (*vhost !=

'['

)))

2793

strcspn(vhost, bare ?

":\r\n"

:

"]\r\n"

));

2795

&& (s[4 -

first

] ==

'-'

|| s[4 -

first

] ==

':'

)) {

2802

}

else if

(!*has_sid

2807  if

(!(s = strchr(++s,

'\n'

)))

2815

sprintf(

buf

,

"User-Agent: %.80s"

, s);

2820  if

(*s && has_ref <= 0) {

2821  size_t len

= strlen(s);

2822  char

* ref = (

char

*) realloc((

void

*) s, 10 +

len

);

2825

memcpy(ref,

"Referer: "

, 9);

2841  const char

* user_header,

2878  if

(user_header && *user_header

2892

xxx->

path

[0] =

'\0'

;

2949  const char

* user_header,

2996  const char

* user_header,

3012

parse_header, user_data, adjust,

cleanup

);

3019  const void

* init_data,

3025  unsigned short

http_code;

3034

user_data, adjust, &uuu);

3048

*sock = uuu->

sock

;

3064  switch

(http_code) {

static void cleanup(void)

static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)

static void fatal(const char *msg,...)

static const char * str(char *buf, int n)

int BUF_Write(BUF *pBuf, const void *data, size_t size)

int BUF_Prepend(BUF *pBuf, const void *data, size_t size)

int BUF_AppendEx(BUF *pBuf, void *base, size_t alloc_size, void *data, size_t size)

size_t BUF_Read(BUF buf, void *data, size_t size)

int BUF_Splice(BUF *dst, BUF src)

size_t BUF_Peek(BUF buf, void *data, size_t size)

size_t BUF_PeekAtCB(BUF buf, size_t pos, size_t(*callback)(void *cbdata, const void *buf, size_t size), void *cbdata, size_t size)

void BUF_Destroy(BUF buf)

void(* FHTTP_NcbiMessageHook)(const char *message)

EIO_Status HTTP_CreateTunnel(const SConnNetInfo *net_info, THTTP_Flags flags, SOCK *sock)

Same as HTTP_CreateTunnelEx(net_info, flags, 0, 0, 0, 0, sock)

FSetupVTable setup

init meta, may not be NULL

#define CONN_SET_METHOD(meta, method, function, connector)

CONNECTOR HTTP_CreateConnectorEx(const SConnNetInfo *net_info, THTTP_Flags flags, FHTTP_ParseHeader parse_header, void *user_data, FHTTP_Adjust adjust, FHTTP_Cleanup cleanup)

Create new CONNECTOR structure to hit the specified URL using HTTP with either POST / GET (or ANY) me...

unsigned int THTTP_Flags

Bitwise OR of EHTTP_Flag.

int(* FHTTP_Adjust)(SConnNetInfo *net_info, void *user_data, unsigned int failure_count)

#define CONN_SET_DEFAULT_TIMEOUT(meta, timeout)

void(* FHTTP_Cleanup)(void *user_data)

CONNECTOR next

linked list

CONNECTOR HTTP_CreateConnector(const SConnNetInfo *net_info, const char *user_header, THTTP_Flags flags)

Same as HTTP_CreateConnector(net_info, flags, 0, 0, 0, 0) with the passed "user_header" overriding th...

void HTTP_SetNcbiMessageHook(FHTTP_NcbiMessageHook hook)

Set a message hook procedure for messages originating from NCBI via HTTP.

FDestroy destroy

destroys handle, can be NULL

EHTTP_HeaderParse

The extended version HTTP_CreateConnectorEx() is able to track the HTTP response chain and also chang...

void * handle

data handle of the connector

SMetaConnector * meta

back link to original meta

EHTTP_HeaderParse(* FHTTP_ParseHeader)(const char *http_header, void *user_data, int server_error)

EIO_Status HTTP_CreateTunnelEx(const SConnNetInfo *net_info, THTTP_Flags flags, const void *init_data, size_t init_size, void *user_data, FHTTP_Adjust adjust, SOCK *sock)

Create a tunnel to "net_info->host:net_info->port" via an HTTP proxy server located at "net_info->htt...

const STimeout g_NcbiDefConnTimeout

DEF_CONN_TIMEOUT as STimeout.

@ fHTTP_DropUnread

Each microsession drops unread data.

@ fHTTP_AdjustOnRedirect

Call adjust routine for redirects, too.

@ fHTTP_NoUpread

Do not use SOCK_SetReadOnWrite()

@ fHTTP_NoAutoRetry

No auto-retries allowed.

@ fHTTP_AutoReconnect

See HTTP_CreateConnectorEx()

@ fHTTP_KeepHeader

Keep HTTP header (see limitations)

@ fHTTP_NoAutomagicSID

Do not add NCBI SID automagically.

@ fHTTP_SuppressMessages

Most annoying ones reduced to traces.

@ fHTTP_UnsafeRedirects

Any redirect will be honored.

@ fHTTP_Flushable

Connector will really flush on Flush()

@ fHTTP_PushAuth

HTTP/1.1 pushes out auth if present.

@ fHTTP_WriteThru

HTTP/1.1 writes through (chunked)

@ eHTTP_HeaderSuccess

Parse succeeded, retain server status.

@ eHTTP_HeaderError

Parse failed, treat as a server error.

@ eHTTP_HeaderContinue

Parse succeeded, continue with body.

@ eHTTP_HeaderComplete

Parse succeeded, no more processing.

@ fHCC_UrlEncodeOutput

Obsolete, may not work, do not use!

@ fHCC_UrlDecodeInput

Obsolete, may not work, do not use!

@ fHCC_UrlEncodeArgs

NB: Error-prone semantics, do not use!

int SOCK_isipEx(const char *host, int fullquad)

Check whether a given string represents a valid bare IPv4 address.

int SOCK_IsSecure(SOCK sock)

Check whether a socket is using SSL (Secure Socket Layer).

EIO_Status SOCK_SetTimeout(SOCK sock, EIO_Event event, const STimeout *timeout)

Specify timeout for the connection I/O (see SOCK_[Read|Write|Close]()).

EIO_Status SOCK_Close(SOCK sock)

Close the SOCK handle, and destroy all relevant internal data.

const char * SOCK_gethostbyaddr(unsigned int addr, char *buf, size_t buflen)

Same as SOCK_gethostbyaddrEx(,,<current API data logging>)

EIO_Status SOCK_Read(SOCK sock, void *buf, size_t size, size_t *n_read, EIO_ReadMethod how)

Read/peek up to "size" bytes from "sock" to a buffer pointed to by "buf".

EIO_Status SOCK_Status(SOCK sock, EIO_Event direction)

Return low-level socket I/O status of *last* socket operation.

unsigned int SOCK_gethostbyname(const char *hostname)

Same as SOCK_gethostbynameEx(,<current API data logging>)

EIO_Status SOCK_Pushback(SOCK sock, const void *data, size_t size)

Push the specified data back to the socket's input queue (in the socket's internal read buffer).

EIO_Status SOCK_Wait(SOCK sock, EIO_Event event, const STimeout *timeout)

Block on the socket until either the specified "event" is available or "timeout" expires (if "timeout...

EIO_Status SOCK_Abort(SOCK sock)

If there is outstanding connection or output data pending, cancel it.

EIO_Status SOCK_Write(SOCK sock, const void *data, size_t size, size_t *n_written, EIO_WriteMethod how)

Write "size" bytes of "data" to "sock".

const STimeout * SOCK_GetTimeout(SOCK sock, EIO_Event event)

Get the connection's i/o timeout (or NULL, if the timeout is infinite).

unsigned int TSOCK_Flags

bitwise "OR" of ESOCK_Flags

@ fSOCK_KeepAlive

keep socket alive (if supported by OS)

@ fSOCK_Secure

subsumes CloseOnExec regardless of Keep

ELOG_Level

Log severity level.

char http_proxy_host[255+1]

int ConnNetInfo_ExtendUserHeader(SConnNetInfo *net_info, const char *header)

EIO_Status URL_ConnectEx(const char *host, unsigned short port, const char *path, const char *args, TReqMethod req_method, size_t content_length, const STimeout *o_timeout, const STimeout *rw_timeout, const char *user_header, SURLExtra *extra, TSOCK_Flags flags, SOCK *sock)

char http_proxy_user[63+1]

unsigned short http_proxy_port

#define NCBI_BIGCOUNT_FORMAT_SPEC_HEX

int ConnNetInfo_OverrideUserHeader(SConnNetInfo *net_info, const char *header)

int ConnNetInfo_PreOverrideUserHeader(SConnNetInfo *net_info, const char *header)

int ConnNetInfo_ParseURL(SConnNetInfo *net_info, const char *url)

int ConnNetInfo_SetArgs(SConnNetInfo *net_info, const char *args)

int ConnNetInfo_AppendUserHeader(SConnNetInfo *net_info, const char *header)

SConnNetInfo * ConnNetInfo_Clone(const SConnNetInfo *net_info)

LOG CORE_GetLOG(void)

Get the log handle that is to be used by the core internals (CORE LOG).

unsigned int usec

microseconds (modulo 1,000,000)

char http_proxy_pass[63+1]

const char * ConnNetInfo_GetArgs(const SConnNetInfo *net_info)

char * ConnNetInfo_URL(const SConnNetInfo *net_info)

const char * IO_StatusStr(EIO_Status status)

Get the text form of an enum status value.

const char * CORE_GetAppName(void)

Obtain current application name (toolkit dependent).

EIO_ReadMethod

I/O read method.

int ConnNetInfo_SetUserHeader(SConnNetInfo *net_info, const char *header)

void ConnNetInfo_DeleteUserHeader(SConnNetInfo *net_info, const char *header)

void ConnNetInfo_Log(const SConnNetInfo *net_info, ELOG_Level sev, LOG log)

const char * http_user_header

EBProxyType http_proxy_mask

char * CORE_GetNcbiRequestID(ENcbiRequestID reqid)

Obtain current NCBI request ID (if known, per thread).

#define ConnNetInfo_PostOverrideUserHeader

EIO_Status SOCK_StripToPattern(SOCK sock, const void *pattern, size_t pattern_size, BUF *discard, size_t *n_discarded)

EIO_Event

I/O event (or direction).

void URL_Encode(const void *src_buf, size_t src_size, size_t *src_read, void *dst_buf, size_t dst_size, size_t *dst_written)

#define NCBI_BIGCOUNT_FORMAT_SPEC

int ConnNetInfo_Boolean(const char *str)

EBDebugPrintout debug_printout

int URL_DecodeEx(const void *src_buf, size_t src_size, size_t *src_read, void *dst_buf, size_t dst_size, size_t *dst_written, const char *allow_symbols)

const char * http_referer

void ConnNetInfo_Destroy(SConnNetInfo *net_info)

int ConnNetInfo_SetFrag(SConnNetInfo *net_info, const char *frag)

uint64_t TNCBI_BigCount

Big unsigned integer for file size and position.

@ eIO_Timeout

timeout expired before any I/O succeeded

@ eIO_NotSupported

operation is not supported or is not available

@ eIO_Success

everything is fine, no error occurred

@ eIO_Unknown

unknown I/O error (likely fatal but can retry)

@ eIO_InvalidArg

bad argument / parameter value(s) supplied

@ fProxy_Http

$http_proxy used

@ fProxy_Https

$https_proxy used

@ eIO_ReadPlain

read readily available data only, wait if none

@ eIO_ReadPeek

do eIO_ReadPlain but leave data in input queue

@ eIO_ReadPersist

read exactly as much as requested, w/waits

@ eIO_WritePlain

write as much as possible, report back how much

@ eIO_Close

also serves as an error indicator in SOCK_Poll

@ eNcbiRequestID_SID

NCBI Session ID.

@ eNcbiTraceState

OpenTelemetry tracestate header.

@ eNcbiRequestID_HitID

NCBI Hit ID.

@ eNcbiTraceParent

OpenTelemetry traceparent header.

if(yy_accept[yy_current_state])

static void text(MDB_val *v)

const struct ncbi::grid::netcache::search::fields::SIZE size

char * strncpy0(char *s1, const char *s2, size_t n)

Copy not more than "n" characters from string "s2" into "s1", and return the result,...

#define HTTP_NCBI_MESSAGE

SConnNetInfo * ConnNetInfo_CloneInternal(const SConnNetInfo *info)

const char * ConnNetInfo_GetValueInternal(const char *service, const char *param, char *value, size_t value_size, const char *def_value)

SConnNetInfo * ConnNetInfo_CreateInternal(const char *service)

static int x_IsValidChallenge(const char *text, size_t len)

static EIO_Status x_ReadChunkTail(SHttpConnector *uuu)

static EHTTP_Redirect x_Redirect(SHttpConnector *uuu, const SRetry *retry)

static int x_SamePort(unsigned short port1, EBURLScheme scheme1, unsigned short port2, EBURLScheme scheme2)

static const char kHttpHostTag[]

static int x_UnsafeRedirectOK(SHttpConnector *uuu)

static EIO_Status s_Connect(SHttpConnector *uuu, const STimeout *timeout, EExtractMode extract)

static int x_Pushback(SOCK sock, BUF buf)

static const char * x_SetHttpHostTag(SConnNetInfo *net_info)

static EIO_Status s_Adjust(SHttpConnector *uuu, const SRetry *retry, EIO_Status status, EExtractMode extract)

static void s_DestroyHttpConnector(SHttpConnector *uuu)

static char * s_VT_Descr(CONNECTOR connector)

static EIO_Status s_Read(SHttpConnector *uuu, void *buf, size_t size, size_t *n_read)

static EIO_Status s_VT_Write(CONNECTOR connector, const void *buf, size_t size, size_t *n_written, const STimeout *timeout)

@ eRetry_ProxyAuthenticate

static EIO_Status s_VT_Read(CONNECTOR connector, void *buf, size_t size, size_t *n_read, const STimeout *timeout)

static char * x_HostPort(size_t reserve, const char *host, unsigned short xport)

static const char * s_VT_GetType(CONNECTOR connector)

static EIO_Status s_ReadData(SHttpConnector *uuu, void *buf, size_t size, size_t *n_read, EIO_ReadMethod how)

static int x_IsValidParam(const char *param, size_t paramlen)

static EIO_Status s_ReadHeader(SHttpConnector *uuu, SRetry *retry, EExtractMode extract)

static int x_SameProxyHost(const char *host1, const char *host2)

static int x_RedirectOK(EBURLScheme scheme_to, const char *host_to, unsigned short port_to, EBURLScheme scheme_from, const char *host_from, unsigned short port_from)

static int x_SameScheme(EBURLScheme scheme1, EBURLScheme scheme2)

static EIO_Status s_VT_Close(CONNECTOR connector, const STimeout *timeout)

static int s_TunnelAdjust(SConnNetInfo *net_info, void *data, unsigned int arg)

static int s_CallAdjust(SHttpConnector *uuu, unsigned int arg)

static EIO_Status s_VT_Flush(CONNECTOR connector, const STimeout *timeout)

static int x_ErrorHeaderOnly(SHttpConnector *uuu)

static EIO_Status s_VT_Open(CONNECTOR connector, const STimeout *timeout)

static EIO_Status s_ConnectAndSend(SHttpConnector *uuu, const STimeout *timeout, EExtractMode extract)

#define HTTP_SOAK_READ_SIZE

static CONNECTOR s_CreateConnector(const SConnNetInfo *net_info, const char *user_header, THTTP_Flags flags, FHTTP_ParseHeader parse_header, void *user_data, FHTTP_Adjust adjust, FHTTP_Cleanup cleanup)

static void x_SetRequestIDs(SConnNetInfo *net_info)

static size_t x_PushbackBuf(void *data, const void *buf, size_t size)

static int x_IsWriteThru(const SHttpConnector *uuu)

static void s_OpenHttpConnector(SHttpConnector *uuu, const STimeout *timeout)

static EIO_Status s_Disconnect(SHttpConnector *uuu, const STimeout *timeout, EExtractMode extract)

static EIO_Status x_ReadChunkHead(SHttpConnector *uuu, int first)

static const char * x_FixupUserHeader(SConnNetInfo *net_info, int has_ref, int *has_sid)

static int s_MessageIssued

static FHTTP_NcbiMessageHook s_MessageHook

static size_t x_WriteBuf(void *data, const void *buf, size_t size)

static void s_Setup(CONNECTOR connector)

static void s_DropConnection(SHttpConnector *uuu, enum EConnState state)

static EIO_Status s_CreateHttpConnector(const SConnNetInfo *net_info, const char *user_header, int tunnel, THTTP_Flags flags, void *user_data, FHTTP_Adjust adjust, SHttpConnector **http)

static unsigned short x_PortForScheme(unsigned port, EBURLScheme scheme)

static int x_SameOrDefPort(unsigned short port1, EBURLScheme scheme1, unsigned short port2, EBURLScheme scheme2)

static EIO_Status s_VT_Status(CONNECTOR connector, EIO_Event dir)

static EIO_Status s_VT_Wait(CONNECTOR connector, EIO_Event event, const STimeout *timeout)

static EIO_Status s_PreRead(SHttpConnector *uuu, const STimeout *timeout, EExtractMode extract)

static void x_Close(SHttpConnector *uuu)

static EHTTP_Auth x_Authenticate(SHttpConnector *uuu, ERetry auth, int retry)

static void s_Destroy(CONNECTOR connector)

static const STimeout kZeroTimeout

#define CORE_DATAF_X(subcode, level, data, size, fmt_args)

#define CORE_LOGF_X(subcode, level, fmt_args)

#define CORE_LOGF_ERRNO_X(subcode, level, error, fmt_args)

static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

const STimeout * o_timeout

unsigned char minor_fault

unsigned short major_fault

FHTTP_ParseHeader parse_header

const STimeout * w_timeout


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4