@@ -293,15 +293,15 @@ static CURLcode http_output_basic(struct connectdata *conn, bool proxy)
293293
294294 if (proxy ) {
295295#ifndef CURL_DISABLE_PROXY
296- userp = & conn -> allocptr .proxyuserpwd ;
296+ userp = & data -> state . aptr .proxyuserpwd ;
297297 user = conn -> http_proxy .user ;
298298 pwd = conn -> http_proxy .passwd ;
299299#else
300300 return CURLE_NOT_BUILT_IN ;
301301#endif
302302 }
303303 else {
304- userp = & conn -> allocptr .userpwd ;
304+ userp = & data -> state . aptr .userpwd ;
305305 user = conn -> user ;
306306 pwd = conn -> passwd ;
307307 }
@@ -344,8 +344,9 @@ static CURLcode http_output_bearer(struct connectdata *conn)
344344{
345345 char * * userp ;
346346 CURLcode result = CURLE_OK ;
347+ struct Curl_easy * data = conn -> data ;
347348
348- userp = & conn -> allocptr .userpwd ;
349+ userp = & data -> state . aptr .userpwd ;
349350 free (* userp );
350351 * userp = aprintf ("Authorization: Bearer %s\r\n" ,
351352 conn -> data -> set .str [STRING_BEARER ]);
@@ -1769,7 +1770,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
17691770 CURLcode result = CURLE_OK ;
17701771 char * compare = semicolonp ? semicolonp : headers -> data ;
17711772
1772- if (conn -> allocptr .host &&
1773+ if (data -> state . aptr .host &&
17731774 /* a Host: header was sent already, don't pass on any custom Host:
17741775 header as that will produce *two* in the same request! */
17751776 checkprefix ("Host:" , compare ))
@@ -1787,7 +1788,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
17871788 we will force length zero then */
17881789 checkprefix ("Content-Length:" , compare ))
17891790 ;
1790- else if (conn -> allocptr .te &&
1791+ else if (data -> state . aptr .te &&
17911792 /* when asking for Transfer-Encoding, don't pass on a custom
17921793 Connection: */
17931794 checkprefix ("Connection:" , compare ))
@@ -2030,8 +2031,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
20302031 with the user-agent string specified, we erase the previously made string
20312032 here. */
20322033 if (Curl_checkheaders (conn , "User-Agent" )) {
2033- free (conn -> allocptr .uagent );
2034- conn -> allocptr .uagent = NULL ;
2034+ free (data -> state . aptr .uagent );
2035+ data -> state . aptr .uagent = NULL ;
20352036 }
20362037
20372038 /* setup the authentication headers */
@@ -2059,14 +2060,14 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
20592060 else
20602061 conn -> bits .authneg = FALSE;
20612062
2062- Curl_safefree (conn -> allocptr .ref );
2063+ Curl_safefree (data -> state . aptr .ref );
20632064 if (data -> change .referer && !Curl_checkheaders (conn , "Referer" )) {
2064- conn -> allocptr .ref = aprintf ("Referer: %s\r\n" , data -> change .referer );
2065- if (!conn -> allocptr .ref )
2065+ data -> state . aptr .ref = aprintf ("Referer: %s\r\n" , data -> change .referer );
2066+ if (!data -> state . aptr .ref )
20662067 return CURLE_OUT_OF_MEMORY ;
20672068 }
20682069 else
2069- conn -> allocptr .ref = NULL ;
2070+ data -> state . aptr .ref = NULL ;
20702071
20712072#if !defined(CURL_DISABLE_COOKIES )
20722073 if (data -> set .str [STRING_COOKIE ] && !Curl_checkheaders (conn , "Cookie" ))
@@ -2075,15 +2076,15 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
20752076
20762077 if (!Curl_checkheaders (conn , "Accept-Encoding" ) &&
20772078 data -> set .str [STRING_ENCODING ]) {
2078- Curl_safefree (conn -> allocptr .accept_encoding );
2079- conn -> allocptr .accept_encoding =
2079+ Curl_safefree (data -> state . aptr .accept_encoding );
2080+ data -> state . aptr .accept_encoding =
20802081 aprintf ("Accept-Encoding: %s\r\n" , data -> set .str [STRING_ENCODING ]);
2081- if (!conn -> allocptr .accept_encoding )
2082+ if (!data -> state . aptr .accept_encoding )
20822083 return CURLE_OUT_OF_MEMORY ;
20832084 }
20842085 else {
2085- Curl_safefree (conn -> allocptr .accept_encoding );
2086- conn -> allocptr .accept_encoding = NULL ;
2086+ Curl_safefree (data -> state . aptr .accept_encoding );
2087+ data -> state . aptr .accept_encoding = NULL ;
20872088 }
20882089
20892090#ifdef HAVE_LIBZ
@@ -2099,7 +2100,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
20992100 char * cptr = Curl_checkheaders (conn , "Connection" );
21002101#define TE_HEADER "TE: gzip\r\n"
21012102
2102- Curl_safefree (conn -> allocptr .te );
2103+ Curl_safefree (data -> state . aptr .te );
21032104
21042105 if (cptr ) {
21052106 cptr = Curl_copy_header_value (cptr );
@@ -2108,11 +2109,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
21082109 }
21092110
21102111 /* Create the (updated) Connection: header */
2111- conn -> allocptr .te = aprintf ("Connection: %s%sTE\r\n" TE_HEADER ,
2112+ data -> state . aptr .te = aprintf ("Connection: %s%sTE\r\n" TE_HEADER ,
21122113 cptr ? cptr : "" , (cptr && * cptr ) ? ", " :"" );
21132114
21142115 free (cptr );
2115- if (!conn -> allocptr .te )
2116+ if (!data -> state . aptr .te )
21162117 return CURLE_OUT_OF_MEMORY ;
21172118 }
21182119#endif
@@ -2195,7 +2196,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
21952196 te = "Transfer-Encoding: chunked\r\n" ;
21962197 }
21972198
2198- Curl_safefree (conn -> allocptr .host );
2199+ Curl_safefree (data -> state . aptr .host );
21992200
22002201 ptr = Curl_checkheaders (conn , "Host" );
22012202 if (ptr && (!data -> state .this_is_a_follow ||
@@ -2230,19 +2231,19 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
22302231 if (colon )
22312232 * colon = 0 ; /* The host must not include an embedded port number */
22322233 }
2233- Curl_safefree (conn -> allocptr .cookiehost );
2234- conn -> allocptr .cookiehost = cookiehost ;
2234+ Curl_safefree (data -> state . aptr .cookiehost );
2235+ data -> state . aptr .cookiehost = cookiehost ;
22352236 }
22362237#endif
22372238
22382239 if (strcmp ("Host:" , ptr )) {
2239- conn -> allocptr .host = aprintf ("Host:%s\r\n" , & ptr [5 ]);
2240- if (!conn -> allocptr .host )
2240+ data -> state . aptr .host = aprintf ("Host:%s\r\n" , & ptr [5 ]);
2241+ if (!data -> state . aptr .host )
22412242 return CURLE_OUT_OF_MEMORY ;
22422243 }
22432244 else
22442245 /* when clearing the header */
2245- conn -> allocptr .host = NULL ;
2246+ data -> state . aptr .host = NULL ;
22462247 }
22472248 else {
22482249 /* When building Host: headers, we must put the host name within
@@ -2254,18 +2255,18 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
22542255 (conn -> remote_port == PORT_HTTP )) )
22552256 /* if(HTTPS on port 443) OR (HTTP on port 80) then don't include
22562257 the port number in the host string */
2257- conn -> allocptr .host = aprintf ("Host: %s%s%s\r\n" ,
2258+ data -> state . aptr .host = aprintf ("Host: %s%s%s\r\n" ,
22582259 conn -> bits .ipv6_ip ?"[" :"" ,
22592260 host ,
22602261 conn -> bits .ipv6_ip ?"]" :"" );
22612262 else
2262- conn -> allocptr .host = aprintf ("Host: %s%s%s:%d\r\n" ,
2263+ data -> state . aptr .host = aprintf ("Host: %s%s%s:%d\r\n" ,
22632264 conn -> bits .ipv6_ip ?"[" :"" ,
22642265 host ,
22652266 conn -> bits .ipv6_ip ?"]" :"" ,
22662267 conn -> remote_port );
22672268
2268- if (!conn -> allocptr .host )
2269+ if (!data -> state . aptr .host )
22692270 /* without Host: we can't make a nice request */
22702271 return CURLE_OUT_OF_MEMORY ;
22712272 }
@@ -2436,21 +2437,21 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
24362437 if (((httpreq == HTTPREQ_GET ) || (httpreq == HTTPREQ_HEAD )) &&
24372438 !Curl_checkheaders (conn , "Range" )) {
24382439 /* if a line like this was already allocated, free the previous one */
2439- free (conn -> allocptr .rangeline );
2440- conn -> allocptr .rangeline = aprintf ("Range: bytes=%s\r\n" ,
2440+ free (data -> state . aptr .rangeline );
2441+ data -> state . aptr .rangeline = aprintf ("Range: bytes=%s\r\n" ,
24412442 data -> state .range );
24422443 }
24432444 else if ((httpreq == HTTPREQ_POST || httpreq == HTTPREQ_PUT ) &&
24442445 !Curl_checkheaders (conn , "Content-Range" )) {
24452446
24462447 /* if a line like this was already allocated, free the previous one */
2447- free (conn -> allocptr .rangeline );
2448+ free (data -> state . aptr .rangeline );
24482449
24492450 if (data -> set .set_resume_from < 0 ) {
24502451 /* Upload resume was asked for, but we don't know the size of the
24512452 remote part so we tell the server (and act accordingly) that we
24522453 upload the whole file (again) */
2453- conn -> allocptr .rangeline =
2454+ data -> state . aptr .rangeline =
24542455 aprintf ("Content-Range: bytes 0-%" CURL_FORMAT_CURL_OFF_T
24552456 "/%" CURL_FORMAT_CURL_OFF_T "\r\n" ,
24562457 data -> state .infilesize - 1 , data -> state .infilesize );
@@ -2460,7 +2461,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
24602461 /* This is because "resume" was selected */
24612462 curl_off_t total_expected_size =
24622463 data -> state .resume_from + data -> state .infilesize ;
2463- conn -> allocptr .rangeline =
2464+ data -> state . aptr .rangeline =
24642465 aprintf ("Content-Range: bytes %s%" CURL_FORMAT_CURL_OFF_T
24652466 "/%" CURL_FORMAT_CURL_OFF_T "\r\n" ,
24662467 data -> state .range , total_expected_size - 1 ,
@@ -2469,11 +2470,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
24692470 else {
24702471 /* Range was selected and then we just pass the incoming range and
24712472 append total size */
2472- conn -> allocptr .rangeline =
2473+ data -> state . aptr .rangeline =
24732474 aprintf ("Content-Range: bytes %s/%" CURL_FORMAT_CURL_OFF_T "\r\n" ,
24742475 data -> state .range , data -> state .infilesize );
24752476 }
2476- if (!conn -> allocptr .rangeline )
2477+ if (!data -> state . aptr .rangeline )
24772478 return CURLE_OUT_OF_MEMORY ;
24782479 }
24792480 }
@@ -2545,24 +2546,24 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
25452546
25462547 ftp_typecode ,
25472548 httpstring ,
2548- (conn -> allocptr . host ?conn -> allocptr .host :"" ),
2549- conn -> allocptr .proxyuserpwd ?
2550- conn -> allocptr .proxyuserpwd :"" ,
2551- conn -> allocptr . userpwd ?conn -> allocptr .userpwd :"" ,
2552- (data -> state .use_range && conn -> allocptr .rangeline )?
2553- conn -> allocptr .rangeline :"" ,
2549+ (data -> state . aptr . host ?data -> state . aptr .host :"" ),
2550+ data -> state . aptr .proxyuserpwd ?
2551+ data -> state . aptr .proxyuserpwd :"" ,
2552+ data -> state . aptr . userpwd ?data -> state . aptr .userpwd :"" ,
2553+ (data -> state .use_range && data -> state . aptr .rangeline )?
2554+ data -> state . aptr .rangeline :"" ,
25542555 (data -> set .str [STRING_USERAGENT ] &&
25552556 * data -> set .str [STRING_USERAGENT ] &&
2556- conn -> allocptr .uagent )?
2557- conn -> allocptr .uagent :"" ,
2557+ data -> state . aptr .uagent )?
2558+ data -> state . aptr .uagent :"" ,
25582559 http -> p_accept ?http -> p_accept :"" ,
2559- conn -> allocptr . te ?conn -> allocptr .te :"" ,
2560+ data -> state . aptr . te ?data -> state . aptr .te :"" ,
25602561 (data -> set .str [STRING_ENCODING ] &&
25612562 * data -> set .str [STRING_ENCODING ] &&
2562- conn -> allocptr .accept_encoding )?
2563- conn -> allocptr .accept_encoding :"" ,
2564- (data -> change .referer && conn -> allocptr .ref )?
2565- conn -> allocptr .ref :"" /* Referer: <data> */ ,
2563+ data -> state . aptr .accept_encoding )?
2564+ data -> state . aptr .accept_encoding :"" ,
2565+ (data -> change .referer && data -> state . aptr .ref )?
2566+ data -> state . aptr .ref :"" /* Referer: <data> */ ,
25662567#ifndef CURL_DISABLE_PROXY
25672568 (conn -> bits .httpproxy &&
25682569 !conn -> bits .tunnel_proxy &&
@@ -2577,8 +2578,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
25772578
25782579 /* clear userpwd and proxyuserpwd to avoid re-using old credentials
25792580 * from re-used connections */
2580- Curl_safefree (conn -> allocptr .userpwd );
2581- Curl_safefree (conn -> allocptr .proxyuserpwd );
2581+ Curl_safefree (data -> state . aptr .userpwd );
2582+ Curl_safefree (data -> state . aptr .proxyuserpwd );
25822583 free (altused );
25832584
25842585 if (result )
@@ -2602,8 +2603,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
26022603 if (data -> cookies && data -> state .cookie_engine ) {
26032604 Curl_share_lock (data , CURL_LOCK_DATA_COOKIE , CURL_LOCK_ACCESS_SINGLE );
26042605 co = Curl_cookie_getlist (data -> cookies ,
2605- conn -> allocptr .cookiehost ?
2606- conn -> allocptr .cookiehost :host ,
2606+ data -> state . aptr .cookiehost ?
2607+ data -> state . aptr .cookiehost :host ,
26072608 data -> state .up .path ,
26082609 (conn -> handler -> protocol & CURLPROTO_HTTPS )?
26092610 TRUE:FALSE);
@@ -3915,8 +3916,8 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
39153916 data -> cookies , TRUE, FALSE, headp + 11 ,
39163917 /* If there is a custom-set Host: name, use it
39173918 here, or else use real peer host name. */
3918- conn -> allocptr .cookiehost ?
3919- conn -> allocptr .cookiehost :conn -> host .name ,
3919+ data -> state . aptr .cookiehost ?
3920+ data -> state . aptr .cookiehost :conn -> host .name ,
39203921 data -> state .up .path ,
39213922 (conn -> handler -> protocol & CURLPROTO_HTTPS )?
39223923 TRUE:FALSE);
0 commit comments