testing added as well as more robust behivior

This commit is contained in:
User 2025-04-25 18:22:18 +03:00 committed by nevakrien
parent 01603f988e
commit bf25e678cf
10 changed files with 492 additions and 14 deletions

View file

@ -303,6 +303,8 @@ struct altsvcinfo *Curl_altsvc_init(void)
return NULL;
Curl_llist_init(&asi->list, NULL);
asi->used = FALSE;
/* set default behavior */
asi->flags = CURLALTSVC_H1
#ifdef USE_HTTP2

View file

@ -48,6 +48,8 @@ struct altsvcinfo {
char *filename;
struct Curl_llist list; /* list of entries */
long flags; /* the publicly set bitmask */
BIT(used);
};
const char *Curl_alpnid2str(enum alpnid id);

View file

@ -3427,7 +3427,6 @@ static void conn_meta_freeentry(void *p)
static CURLcode create_conn(struct Curl_easy *data,
struct connectdata **in_connect,
bool *reusedp,
bool *async,
bool *use_slist)
{
CURLcode result = CURLE_OK;
@ -3539,9 +3538,10 @@ static CURLcode create_conn(struct Curl_easy *data,
* Process the "connect to" linked list of hostname/port mappings.
* Do this after the remote port number has been fixed in the URL.
*************************************************************/
if(*use_slist) {
*use_slist = FALSE; /* next retry without slist */
if(!data->asi || !data->asi->used) {
result = parse_connect_to_slist(data, conn, data->set.connect_to);
if(data->asi)
data->asi->used = TRUE;
if(result)
goto out;
}
@ -3856,11 +3856,13 @@ CURLcode Curl_connect(struct Curl_easy *data,
{
CURLcode result;
struct connectdata *conn;
<<<<<<< HEAD
bool reused = FALSE;
=======
bool use_slist = TRUE; /* start by attempting to use the slist */
>>>>>>> 3edfc1476 (first draft)
#ifndef CURL_DISABLE_ALTSVC
if(data->asi)
data->asi->used = FALSE;
#endif
*asyncp = FALSE; /* assume synchronous resolves by default */
*protocol_done = FALSE;
@ -3869,32 +3871,33 @@ CURLcode Curl_connect(struct Curl_easy *data,
Curl_req_hard_reset(&data->req, data);
/* call the stuff that needs to be called */
<<<<<<< HEAD
result = create_conn(data, &conn, &reused);
if(result == CURLE_NO_CONNECTION_AVAILABLE) {
DEBUGASSERT(!conn);
return result;
}
=======
result = create_conn(data, &conn, asyncp, &use_slist);
#ifndef CURL_DISABLE_ALTSVC
/* if we failed because of the avc cache retry */
if(result && data-> asi
&& !use_slist
&& data->asi->used
&& !(data-> asi-> flags & CURLALTSVC_NO_RETRY)
) {
infof(data, "Alt-Svc connection failed, retrying with original target");
if(conn && result != CURLE_NO_CONNECTION_AVAILABLE) {
Curl_detach_connection(data);
Curl_conn_terminate(data, conn, TRUE);
}
Curl_req_hard_reset(&data->req, data);
result = create_conn(data, &conn, asyncp, &use_slist);
result = create_conn(data, &conn, asyncp);
}
#endif
>>>>>>> 3edfc1476 (first draft)
if(!result) {
DEBUGASSERT(conn);