• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/curl/curl-7.36.0/lib/

Lines Matching defs:conn

90 static int http_getsock_do(struct connectdata *conn,
93 static int http_should_fail(struct connectdata *conn);
96 static CURLcode https_connecting(struct connectdata *conn, bool *done);
97 static int https_getsock(struct connectdata *conn,
153 CURLcode Curl_http_setup_conn(struct connectdata *conn)
157 DEBUGASSERT(conn->data->req.protop == NULL);
159 conn->data->req.protop = calloc(1, sizeof(struct HTTP));
160 if(!conn->data->req.protop)
245 static CURLcode http_output_basic(struct connectdata *conn, bool proxy)
249 struct SessionHandle *data = conn->data;
256 userp = &conn->allocptr.proxyuserpwd;
257 user = conn->proxyuser;
258 pwd = conn->proxypasswd;
261 userp = &conn->allocptr.userpwd;
262 user = conn->user;
263 pwd = conn->passwd;
344 static CURLcode http_perhapsrewind(struct connectdata *conn)
346 struct SessionHandle *data = conn->data;
366 if(conn->bits.authneg)
391 conn->bits.rewindaftersend = FALSE; /* default */
400 (conn->ntlm.state != NTLMSTATE_NONE) ||
401 (conn->proxyntlm.state != NTLMSTATE_NONE)) {
406 if(!conn->bits.authneg) {
407 conn->bits.rewindaftersend = TRUE;
413 if(conn->bits.close)
424 conn->bits.close = TRUE;
433 return Curl_readrewind(conn);
445 CURLcode Curl_http_auth_act(struct connectdata *conn)
447 struct SessionHandle *data = conn->data;
459 if(conn->bits.user_passwd &&
461 (conn->bits.authneg && data->req.httpcode < 300))) {
466 if(conn->bits.proxy_user_passwd &&
468 (conn->bits.authneg && data->req.httpcode < 300))) {
485 !conn->bits.rewindaftersend) {
486 code = http_perhapsrewind(conn);
494 conn->bits.authneg) {
507 if(http_should_fail(conn)) {
522 output_auth_headers(struct connectdata *conn,
528 struct SessionHandle *data = conn->data;
546 result = Curl_output_negotiate(conn, proxy);
557 result = Curl_output_ntlm(conn, proxy);
566 result = Curl_output_ntlm_wb(conn, proxy);
575 result = Curl_output_digest(conn,
586 if((proxy && conn->bits.proxy_user_passwd &&
588 (!proxy && conn->bits.user_passwd &&
591 result = http_output_basic(conn, proxy);
603 proxy?(conn->proxyuser?conn->proxyuser:""):
604 (conn->user?conn->user:""));
616 * method. conn->data->state.authdone is set to TRUE when authentication is
619 * @param conn all information about the current connection
628 Curl_http_output_auth(struct connectdata *conn,
635 struct SessionHandle *data = conn->data;
644 if((conn->bits.httpproxy && conn->bits.proxy_user_passwd) ||
645 conn->bits.user_passwd)
667 if(conn->bits.httpproxy &&
668 (conn->bits.tunnel_proxy == proxytunnel)) {
669 result = output_auth_headers(conn, authproxy, request, path, TRUE);
684 conn->bits.netrc ||
687 Curl_raw_equal(data->state.first_host, conn->host.name)) {
688 result = output_auth_headers(conn, authhost, request, path, FALSE);
703 CURLcode Curl_http_input_auth(struct connectdata *conn, bool proxy,
709 struct SessionHandle *data = conn->data;
756 neg = Curl_input_negotiate(conn, proxy, auth);
782 Curl_input_ntlm(conn, proxy, auth);
801 if((conn->challenge_header = strdup(auth)) == NULL)
829 dig = Curl_input_digest(conn, proxy, auth);
867 * @param conn all information about the current connection
873 static int http_should_fail(struct connectdata *conn)
878 DEBUGASSERT(conn);
879 data = conn->data;
936 if((httpcode == 401) && !conn->bits.user_passwd)
938 if((httpcode == 407) && !conn->bits.proxy_user_passwd)
957 struct connectdata *conn = (struct connectdata *)userp;
958 struct HTTP *http = conn->data->req.protop;
966 conn->data->req.forbidchunk = (http->sending == HTTPSEND_REQUEST)?TRUE:FALSE;
976 conn->fread_func = http->backup.fread_func;
977 conn->fread_in = http->backup.fread_in;
1014 struct connectdata *conn,
1029 struct HTTP *http = conn->data->req.protop;
1036 sockfd = conn->sock[socketindex];
1049 res = Curl_convert_to_network(conn->data, ptr, headersize);
1060 if(conn->handler->flags & PROTOPT_SSL) {
1075 memcpy(conn->data->state.uploadbuffer, ptr, sendsize);
1076 ptr = conn->data->state.uploadbuffer;
1081 res = Curl_write(conn, sockfd, ptr, sendsize, &amount);
1093 if(conn->data->set.verbose) {
1095 Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr, headlen, conn);
1099 Curl_debug(conn->data, CURLINFO_DATA_OUT,
1100 ptr+headlen, bodylen, conn);
1124 http->backup.fread_func = conn->fread_func;
1125 http->backup.fread_in = conn->fread_in;
1130 conn->fread_func = (curl_read_callback)readmoredata;
1131 conn->fread_in = (void *)conn;
1154 conn->writechannel_inuse = FALSE;
1306 CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
1312 conn->bits.close = FALSE;
1315 result = Curl_proxy_connect(conn);
1319 if(conn->tunnel_state[FIRSTSOCKET] == TUNNEL_CONNECT)
1323 if(conn->given->flags & PROTOPT_SSL) {
1325 result = https_connecting(conn, done);
1338 static int http_getsock_do(struct connectdata *conn,
1344 socks[0] = conn->sock[FIRSTSOCKET];
1349 static CURLcode https_connecting(struct connectdata *conn, bool *done)
1352 DEBUGASSERT((conn) && (conn->handler->flags & PROTOPT_SSL));
1355 result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, done);
1357 conn->bits.close = TRUE; /* a failed connection is marked for closure
1367 static int https_getsock(struct connectdata *conn,
1371 if(conn->handler->flags & PROTOPT_SSL) {
1372 struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET];
1379 socks[0] = conn->sock[FIRSTSOCKET];
1384 socks[0] = conn->sock[FIRSTSOCKET];
1392 static int https_getsock(struct connectdata *conn,
1396 (void)conn;
1409 CURLcode Curl_http_done(struct connectdata *conn,
1412 struct SessionHandle *data = conn->data;
1415 Curl_unencode_cleanup(conn);
1418 conn->fread_func = data->set.fread_func; /* restore */
1419 conn->fread_in = data->set.in; /* restore */
1420 conn->seek_func = data->set.seek_func; /* restore */
1421 conn->seek_client = data->set.seek_client; /* restore */
1452 !conn->bits.retry &&
1478 const struct connectdata *conn)
1482 ((conn->httpversion == 11) ||
1483 ((conn->httpversion != 10) &&
1489 struct connectdata *conn,
1496 if(conn->httpversion == 20) {
1500 if(use_http_1_1plus(data, conn)) {
1519 CURLcode Curl_add_custom_headers(struct connectdata *conn,
1523 struct curl_slist *headers=conn->data->set.headers;
1537 if(conn->allocptr.host &&
1542 else if(conn->data->set.httpreq == HTTPREQ_POST_FORM &&
1546 else if(conn->bits.authneg &&
1551 else if(conn->allocptr.te &&
1651 CURLcode Curl_http(struct connectdata *conn, bool *done)
1653 struct SessionHandle *data=conn->data;
1659 const char *host = conn->host.name;
1676 switch (conn->negnpn) {
1679 Curl_http2_init(conn);
1680 Curl_http2_switched(conn);
1698 data->state.first_host = strdup(conn->host.name);
1704 if((conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_FTP)) &&
1740 if(Curl_checkheaders(data, "User-Agent:") && conn->allocptr.uagent) {
1741 free(conn->allocptr.uagent);
1742 conn->allocptr.uagent=NULL;
1746 result = Curl_http_output_auth(conn, request, ppath, FALSE);
1755 conn->bits.authneg = TRUE;
1758 conn->bits.authneg = FALSE;
1760 Curl_safefree(conn->allocptr.ref);
1762 conn->allocptr.ref = aprintf("Referer: %s\r\n", data->change.referer);
1763 if(!conn->allocptr.ref)
1767 conn->allocptr.ref = NULL;
1774 Curl_safefree(conn->allocptr.accept_encoding);
1775 conn->allocptr.accept_encoding =
1777 if(!conn->allocptr.accept_encoding)
1793 Curl_safefree(conn->allocptr.te);
1796 conn->allocptr.te = cptr? aprintf("%s, TE\r\n" TE_HEADER, cptr):
1799 if(!conn->allocptr.te)
1804 if(conn->httpversion == 20)
1815 if((conn->handler->protocol&CURLPROTO_HTTP) &&
1818 if(conn->bits.authneg)
1821 else if(use_http_1_1plus(data, conn)) {
1840 Curl_safefree(conn->allocptr.host);
1844 Curl_raw_equal(data->state.first_host, conn->host.name))) {
1875 Curl_safefree(conn->allocptr.cookiehost);
1876 conn->allocptr.cookiehost = cookiehost;
1880 conn->allocptr.host = NULL;
1886 if(((conn->given->protocol&CURLPROTO_HTTPS) &&
1887 (conn->remote_port == PORT_HTTPS)) ||
1888 ((conn->given->protocol&CURLPROTO_HTTP) &&
1889 (conn->remote_port == PORT_HTTP)) )
1892 conn->allocptr.host = aprintf("Host: %s%s%s\r\n",
1893 conn->bits.ipv6_ip?"[":"",
1895 conn->bits.ipv6_ip?"]":"");
1897 conn->allocptr.host = aprintf("Host: %s%s%s:%hu\r\n",
1898 conn->bits.ipv6_ip?"[":"",
1900 conn->bits.ipv6_ip?"]":"",
1901 conn->remote_port);
1903 if(!conn->allocptr.host)
1909 if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
1915 if(conn->host.dispname != conn->host.name) {
1917 ptr = strstr(url, conn->host.dispname);
1924 size_t currlen = strlen(conn->host.dispname);
1925 size_t newlen = strlen(conn->host.name);
1935 memcpy(newurl + (ptr - url), conn->host.name, newlen);
1977 if(conn->bits.user_passwd && !conn->bits.userpwd_in_url)
2020 if(conn->seek_func) {
2021 seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
2075 if(conn->allocptr.rangeline)
2076 free(conn->allocptr.rangeline);
2077 conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n",
2084 if(conn->allocptr.rangeline)
2085 free(conn->allocptr.rangeline);
2091 conn->allocptr.rangeline =
2101 conn->allocptr.rangeline =
2110 conn->allocptr.rangeline =
2114 if(!conn->allocptr.rangeline)
2121 httpstring= use_http_1_1plus(data, conn)?"1.1":"1.0";
2138 conn->user, conn->passwd,
2163 conn->allocptr.proxyuserpwd?
2164 conn->allocptr.proxyuserpwd:"",
2165 conn->allocptr.userpwd?conn->allocptr.userpwd:"",
2166 (data->state.use_range && conn->allocptr.rangeline)?
2167 conn->allocptr.rangeline:"",
2170 conn->allocptr.uagent)?
2171 conn->allocptr.uagent:"",
2172 (conn->allocptr.host?conn->allocptr.host:""),
2174 conn->allocptr.te?conn->allocptr.te:"",
2177 conn->allocptr.accept_encoding)?
2178 conn->allocptr.accept_encoding:"",
2179 (data->change.referer && conn->allocptr.ref)?
2180 conn->allocptr.ref:"" /* Referer: <data> */,
2181 (conn->bits.httpproxy &&
2182 !conn->bits.tunnel_proxy &&
2193 Curl_safefree (conn->allocptr.userpwd);
2194 conn->allocptr.userpwd = NULL;
2199 if(!(conn->handler->flags&PROTOPT_SSL) &&
2203 result = Curl_http2_request_upgrade(req_buffer, conn);
2216 conn->allocptr.cookiehost?
2217 conn->allocptr.cookiehost:host,
2219 (conn->handler->protocol&CURLPROTO_HTTPS)?
2268 result = Curl_add_custom_headers(conn, req_buffer);
2282 if(!http->sendit || conn->bits.authneg) {
2288 result = Curl_add_buffer_send(req_buffer, conn,
2294 Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,
2306 on. The conn->fread_func pointer itself will be changed for the
2309 http->form.fread_func = conn->fread_func;
2312 conn->fread_func = (curl_read_callback)Curl_FormReader;
2313 conn->fread_in = &http->form;
2327 result = expect100(data, conn, req_buffer);
2358 result = Curl_add_buffer_send(req_buffer, conn,
2364 Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
2384 if(conn->bits.authneg)
2399 result = expect100(data, conn, req_buffer);
2411 result = Curl_add_buffer_send(req_buffer, conn,
2417 Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
2427 if(conn->bits.authneg)
2468 result = expect100(data, conn, req_buffer);
2479 if(conn->httpversion != 20 &&
2530 conn->fread_func = (curl_read_callback)readmoredata;
2531 conn->fread_in = (void *)conn;
2546 if(data->req.upload_chunky && conn->bits.authneg) {
2563 if(!conn->bits.authneg) {
2570 result = Curl_add_buffer_send(req_buffer, conn, &data->info.request_size,
2576 Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
2587 result = Curl_add_buffer_send(req_buffer, conn,
2594 Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE, &http->readbytecount,
2605 if(Curl_pgrsUpdate(conn))
2696 checkprotoprefix(struct SessionHandle *data, struct connectdata *conn,
2700 if(conn->handler->protocol & CURLPROTO_RTSP)
2703 (void)conn;
2793 struct connectdata *conn,
2821 if(!checkprotoprefix(data, conn, data->state.headerbuff)) {
2854 !checkprotoprefix(data, conn, data->state.headerbuff)) {
2918 Curl_http2_switched(conn);
2928 if((k->size == -1) && !k->chunk && !conn->bits.close &&
2929 (conn->httpversion >= 11) &&
2930 !(conn->handler->protocol & CURLPROTO_RTSP) &&
2939 conn->bits.close = TRUE;
2947 if(http_should_fail(conn)) {
2961 result = Curl_client_write(conn, writetype,
2977 result = Curl_http_auth_act(conn);
2983 if((!conn->bits.authneg) && !conn->bits.close &&
2984 !conn->bits.rewindaftersend) {
3008 conn->bits.close = TRUE; /* close after this */
3022 if(conn->bits.rewindaftersend) {
3077 k->str_start, headerlen, conn);
3120 if(conn->handler->protocol & CURLPROTO_HTTP) {
3124 &conn->httpversion,
3127 conn->httpversion += 10 * httpversion_major;
3134 conn->httpversion = 10;
3143 conn->httpversion = 10;
3148 else if(conn->handler->protocol & CURLPROTO_RTSP) {
3152 &conn->rtspversion,
3155 conn->rtspversion += 10 * rtspversion_major;
3156 conn->httpversion = 11; /* For us, RTSP acts like HTTP 1.1 */
3167 data->info.httpversion = conn->httpversion;
3169 data->state.httpversion > conn->httpversion)
3171 data->state.httpversion = conn->httpversion;
3182 ((k->httpcode != 401) || !conn->bits.user_passwd) &&
3183 ((k->httpcode != 407) || !conn->bits.proxy_user_passwd) ) {
3198 if(conn->httpversion == 10) {
3203 conn->bits.close = TRUE;
3205 else if(conn->httpversion >= 11 &&
3206 !conn->bits.close) {
3215 cb_ptr = conn->bundle;
3217 if(!Curl_pipeline_site_blacklisted(data, conn))
3278 conn->bits.close = TRUE;
3300 if(conn->bundle && conn->bundle->server_supports_pipelining) {
3302 conn->bundle->server_supports_pipelining = FALSE;
3306 else if((conn->httpversion == 10) &&
3307 conn->bits.httpproxy &&
3316 conn->bits.close = FALSE; /* don't close when done */
3319 else if((conn->httpversion == 11) &&
3320 conn->bits.httpproxy &&
3327 conn->bits.close = TRUE; /* close when done */
3330 else if((conn->httpversion == 10) &&
3338 conn->bits.close = FALSE; /* don't close when done */
3348 conn->bits.close = TRUE; /* close when done */
3376 Curl_httpchunk_init(conn);
3418 conn->httpversion == 20)) {
3476 conn->allocptr.cookiehost?
3477 conn->allocptr.cookiehost:conn->host.name,
3500 result = Curl_http_input_auth(conn, proxy, auth);
3528 result = http_perhapsrewind(conn);
3534 else if(conn->handler->protocol & CURLPROTO_RTSP) {
3535 result = Curl_rtsp_parseheader(conn, k->p);
3550 k->p, (size_t)k->hbuflen, conn);
3552 result = Curl_client_write(conn, writetype, k->p, k->hbuflen);