|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "curl_setup.h" |
|
|
|
|
|
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC) |
|
|
#include <curl/curl.h> |
|
|
#include "urldata.h" |
|
|
#include "altsvc.h" |
|
|
#include "curl_get_line.h" |
|
|
#include "strcase.h" |
|
|
#include "parsedate.h" |
|
|
#include "sendf.h" |
|
|
#include "warnless.h" |
|
|
#include "fopen.h" |
|
|
#include "rename.h" |
|
|
#include "strdup.h" |
|
|
#include "inet_pton.h" |
|
|
|
|
|
|
|
|
#include "curl_printf.h" |
|
|
#include "curl_memory.h" |
|
|
#include "memdebug.h" |
|
|
|
|
|
#define MAX_ALTSVC_LINE 4095 |
|
|
#define MAX_ALTSVC_DATELENSTR "64" |
|
|
#define MAX_ALTSVC_DATELEN 64 |
|
|
#define MAX_ALTSVC_HOSTLENSTR "512" |
|
|
#define MAX_ALTSVC_HOSTLEN 512 |
|
|
#define MAX_ALTSVC_ALPNLENSTR "10" |
|
|
#define MAX_ALTSVC_ALPNLEN 10 |
|
|
|
|
|
#define H3VERSION "h3" |
|
|
|
|
|
static enum alpnid alpn2alpnid(char *name) |
|
|
{ |
|
|
if(strcasecompare(name, "h1")) |
|
|
return ALPN_h1; |
|
|
if(strcasecompare(name, "h2")) |
|
|
return ALPN_h2; |
|
|
if(strcasecompare(name, H3VERSION)) |
|
|
return ALPN_h3; |
|
|
if(strcasecompare(name, "http/1.1")) |
|
|
return ALPN_h1; |
|
|
return ALPN_none; |
|
|
} |
|
|
|
|
|
|
|
|
const char *Curl_alpnid2str(enum alpnid id) |
|
|
{ |
|
|
switch(id) { |
|
|
case ALPN_h1: |
|
|
return "h1"; |
|
|
case ALPN_h2: |
|
|
return "h2"; |
|
|
case ALPN_h3: |
|
|
return H3VERSION; |
|
|
default: |
|
|
return ""; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void altsvc_free(struct altsvc *as) |
|
|
{ |
|
|
free(as->src.host); |
|
|
free(as->dst.host); |
|
|
free(as); |
|
|
} |
|
|
|
|
|
static struct altsvc *altsvc_createid(const char *srchost, |
|
|
const char *dsthost, |
|
|
size_t dlen, |
|
|
enum alpnid srcalpnid, |
|
|
enum alpnid dstalpnid, |
|
|
unsigned int srcport, |
|
|
unsigned int dstport) |
|
|
{ |
|
|
struct altsvc *as = calloc(1, sizeof(struct altsvc)); |
|
|
size_t hlen; |
|
|
if(!as) |
|
|
return NULL; |
|
|
hlen = strlen(srchost); |
|
|
DEBUGASSERT(hlen); |
|
|
DEBUGASSERT(dlen); |
|
|
if(!hlen || !dlen) { |
|
|
|
|
|
free(as); |
|
|
return NULL; |
|
|
} |
|
|
if((hlen > 2) && srchost[0] == '[') { |
|
|
|
|
|
srchost++; |
|
|
hlen -= 2; |
|
|
} |
|
|
else if(srchost[hlen - 1] == '.') |
|
|
|
|
|
hlen--; |
|
|
if((dlen > 2) && dsthost[0] == '[') { |
|
|
|
|
|
dsthost++; |
|
|
dlen -= 2; |
|
|
} |
|
|
|
|
|
as->src.host = Curl_memdup0(srchost, hlen); |
|
|
if(!as->src.host) |
|
|
goto error; |
|
|
|
|
|
as->dst.host = Curl_memdup0(dsthost, dlen); |
|
|
if(!as->dst.host) |
|
|
goto error; |
|
|
|
|
|
as->src.alpnid = srcalpnid; |
|
|
as->dst.alpnid = dstalpnid; |
|
|
as->src.port = curlx_ultous(srcport); |
|
|
as->dst.port = curlx_ultous(dstport); |
|
|
|
|
|
return as; |
|
|
error: |
|
|
altsvc_free(as); |
|
|
return NULL; |
|
|
} |
|
|
|
|
|
static struct altsvc *altsvc_create(char *srchost, |
|
|
char *dsthost, |
|
|
char *srcalpn, |
|
|
char *dstalpn, |
|
|
unsigned int srcport, |
|
|
unsigned int dstport) |
|
|
{ |
|
|
enum alpnid dstalpnid = alpn2alpnid(dstalpn); |
|
|
enum alpnid srcalpnid = alpn2alpnid(srcalpn); |
|
|
if(!srcalpnid || !dstalpnid) |
|
|
return NULL; |
|
|
return altsvc_createid(srchost, dsthost, strlen(dsthost), |
|
|
srcalpnid, dstalpnid, |
|
|
srcport, dstport); |
|
|
} |
|
|
|
|
|
|
|
|
static CURLcode altsvc_add(struct altsvcinfo *asi, char *line) |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
char srchost[MAX_ALTSVC_HOSTLEN + 1]; |
|
|
char dsthost[MAX_ALTSVC_HOSTLEN + 1]; |
|
|
char srcalpn[MAX_ALTSVC_ALPNLEN + 1]; |
|
|
char dstalpn[MAX_ALTSVC_ALPNLEN + 1]; |
|
|
char date[MAX_ALTSVC_DATELEN + 1]; |
|
|
unsigned int srcport; |
|
|
unsigned int dstport; |
|
|
unsigned int prio; |
|
|
unsigned int persist; |
|
|
int rc; |
|
|
|
|
|
rc = sscanf(line, |
|
|
"%" MAX_ALTSVC_ALPNLENSTR "s %" MAX_ALTSVC_HOSTLENSTR "s %u " |
|
|
"%" MAX_ALTSVC_ALPNLENSTR "s %" MAX_ALTSVC_HOSTLENSTR "s %u " |
|
|
"\"%" MAX_ALTSVC_DATELENSTR "[^\"]\" %u %u", |
|
|
srcalpn, srchost, &srcport, |
|
|
dstalpn, dsthost, &dstport, |
|
|
date, &persist, &prio); |
|
|
if(9 == rc) { |
|
|
struct altsvc *as; |
|
|
time_t expires = Curl_getdate_capped(date); |
|
|
as = altsvc_create(srchost, dsthost, srcalpn, dstalpn, srcport, dstport); |
|
|
if(as) { |
|
|
as->expires = expires; |
|
|
as->prio = prio; |
|
|
as->persist = persist ? 1 : 0; |
|
|
Curl_llist_append(&asi->list, as, &as->node); |
|
|
} |
|
|
} |
|
|
|
|
|
return CURLE_OK; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file) |
|
|
{ |
|
|
CURLcode result = CURLE_OK; |
|
|
FILE *fp; |
|
|
|
|
|
|
|
|
|
|
|
free(asi->filename); |
|
|
asi->filename = strdup(file); |
|
|
if(!asi->filename) |
|
|
return CURLE_OUT_OF_MEMORY; |
|
|
|
|
|
fp = fopen(file, FOPEN_READTEXT); |
|
|
if(fp) { |
|
|
struct dynbuf buf; |
|
|
Curl_dyn_init(&buf, MAX_ALTSVC_LINE); |
|
|
while(Curl_get_line(&buf, fp)) { |
|
|
char *lineptr = Curl_dyn_ptr(&buf); |
|
|
while(*lineptr && ISBLANK(*lineptr)) |
|
|
lineptr++; |
|
|
if(*lineptr == '#') |
|
|
|
|
|
continue; |
|
|
|
|
|
altsvc_add(asi, lineptr); |
|
|
} |
|
|
Curl_dyn_free(&buf); |
|
|
fclose(fp); |
|
|
} |
|
|
return result; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static CURLcode altsvc_out(struct altsvc *as, FILE *fp) |
|
|
{ |
|
|
struct tm stamp; |
|
|
const char *dst6_pre = ""; |
|
|
const char *dst6_post = ""; |
|
|
const char *src6_pre = ""; |
|
|
const char *src6_post = ""; |
|
|
CURLcode result = Curl_gmtime(as->expires, &stamp); |
|
|
if(result) |
|
|
return result; |
|
|
#ifdef USE_IPV6 |
|
|
else { |
|
|
char ipv6_unused[16]; |
|
|
if(1 == Curl_inet_pton(AF_INET6, as->dst.host, ipv6_unused)) { |
|
|
dst6_pre = "["; |
|
|
dst6_post = "]"; |
|
|
} |
|
|
if(1 == Curl_inet_pton(AF_INET6, as->src.host, ipv6_unused)) { |
|
|
src6_pre = "["; |
|
|
src6_post = "]"; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
fprintf(fp, |
|
|
"%s %s%s%s %u " |
|
|
"%s %s%s%s %u " |
|
|
"\"%d%02d%02d " |
|
|
"%02d:%02d:%02d\" " |
|
|
"%u %u\n", |
|
|
Curl_alpnid2str(as->src.alpnid), |
|
|
src6_pre, as->src.host, src6_post, |
|
|
as->src.port, |
|
|
|
|
|
Curl_alpnid2str(as->dst.alpnid), |
|
|
dst6_pre, as->dst.host, dst6_post, |
|
|
as->dst.port, |
|
|
|
|
|
stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday, |
|
|
stamp.tm_hour, stamp.tm_min, stamp.tm_sec, |
|
|
as->persist, as->prio); |
|
|
return CURLE_OK; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct altsvcinfo *Curl_altsvc_init(void) |
|
|
{ |
|
|
struct altsvcinfo *asi = calloc(1, sizeof(struct altsvcinfo)); |
|
|
if(!asi) |
|
|
return NULL; |
|
|
Curl_llist_init(&asi->list, NULL); |
|
|
|
|
|
|
|
|
asi->flags = CURLALTSVC_H1 |
|
|
#ifdef USE_HTTP2 |
|
|
| CURLALTSVC_H2 |
|
|
#endif |
|
|
#ifdef USE_HTTP3 |
|
|
| CURLALTSVC_H3 |
|
|
#endif |
|
|
; |
|
|
return asi; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CURLcode Curl_altsvc_load(struct altsvcinfo *asi, const char *file) |
|
|
{ |
|
|
DEBUGASSERT(asi); |
|
|
return altsvc_load(asi, file); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CURLcode Curl_altsvc_ctrl(struct altsvcinfo *asi, const long ctrl) |
|
|
{ |
|
|
DEBUGASSERT(asi); |
|
|
asi->flags = ctrl; |
|
|
return CURLE_OK; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Curl_altsvc_cleanup(struct altsvcinfo **altsvcp) |
|
|
{ |
|
|
if(*altsvcp) { |
|
|
struct Curl_llist_node *e; |
|
|
struct Curl_llist_node *n; |
|
|
struct altsvcinfo *altsvc = *altsvcp; |
|
|
for(e = Curl_llist_head(&altsvc->list); e; e = n) { |
|
|
struct altsvc *as = Curl_node_elem(e); |
|
|
n = Curl_node_next(e); |
|
|
altsvc_free(as); |
|
|
} |
|
|
free(altsvc->filename); |
|
|
free(altsvc); |
|
|
*altsvcp = NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CURLcode Curl_altsvc_save(struct Curl_easy *data, |
|
|
struct altsvcinfo *altsvc, const char *file) |
|
|
{ |
|
|
CURLcode result = CURLE_OK; |
|
|
FILE *out; |
|
|
char *tempstore = NULL; |
|
|
|
|
|
if(!altsvc) |
|
|
|
|
|
return CURLE_OK; |
|
|
|
|
|
|
|
|
if(!file && altsvc->filename) |
|
|
file = altsvc->filename; |
|
|
|
|
|
if((altsvc->flags & CURLALTSVC_READONLYFILE) || !file || !file[0]) |
|
|
|
|
|
return CURLE_OK; |
|
|
|
|
|
result = Curl_fopen(data, file, &out, &tempstore); |
|
|
if(!result) { |
|
|
struct Curl_llist_node *e; |
|
|
struct Curl_llist_node *n; |
|
|
fputs("# Your alt-svc cache. https://curl.se/docs/alt-svc.html\n" |
|
|
"# This file was generated by libcurl! Edit at your own risk.\n", |
|
|
out); |
|
|
for(e = Curl_llist_head(&altsvc->list); e; e = n) { |
|
|
struct altsvc *as = Curl_node_elem(e); |
|
|
n = Curl_node_next(e); |
|
|
result = altsvc_out(as, out); |
|
|
if(result) |
|
|
break; |
|
|
} |
|
|
fclose(out); |
|
|
if(!result && tempstore && Curl_rename(tempstore, file)) |
|
|
result = CURLE_WRITE_ERROR; |
|
|
|
|
|
if(result && tempstore) |
|
|
unlink(tempstore); |
|
|
} |
|
|
free(tempstore); |
|
|
return result; |
|
|
} |
|
|
|
|
|
static CURLcode getalnum(const char **ptr, char *alpnbuf, size_t buflen) |
|
|
{ |
|
|
size_t len; |
|
|
const char *protop; |
|
|
const char *p = *ptr; |
|
|
while(*p && ISBLANK(*p)) |
|
|
p++; |
|
|
protop = p; |
|
|
while(*p && !ISBLANK(*p) && (*p != ';') && (*p != '=')) |
|
|
p++; |
|
|
len = p - protop; |
|
|
*ptr = p; |
|
|
|
|
|
if(!len || (len >= buflen)) |
|
|
return CURLE_BAD_FUNCTION_ARGUMENT; |
|
|
memcpy(alpnbuf, protop, len); |
|
|
alpnbuf[len] = 0; |
|
|
return CURLE_OK; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool hostcompare(const char *host, const char *check) |
|
|
{ |
|
|
size_t hlen = strlen(host); |
|
|
size_t clen = strlen(check); |
|
|
|
|
|
if(hlen && (host[hlen - 1] == '.')) |
|
|
hlen--; |
|
|
if(hlen != clen) |
|
|
|
|
|
return FALSE; |
|
|
return strncasecompare(host, check, hlen); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void altsvc_flush(struct altsvcinfo *asi, enum alpnid srcalpnid, |
|
|
const char *srchost, unsigned short srcport) |
|
|
{ |
|
|
struct Curl_llist_node *e; |
|
|
struct Curl_llist_node *n; |
|
|
for(e = Curl_llist_head(&asi->list); e; e = n) { |
|
|
struct altsvc *as = Curl_node_elem(e); |
|
|
n = Curl_node_next(e); |
|
|
if((srcalpnid == as->src.alpnid) && |
|
|
(srcport == as->src.port) && |
|
|
hostcompare(srchost, as->src.host)) { |
|
|
Curl_node_remove(e); |
|
|
altsvc_free(as); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
#ifdef DEBUGBUILD |
|
|
|
|
|
|
|
|
static time_t altsvc_debugtime(void *unused) |
|
|
{ |
|
|
char *timestr = getenv("CURL_TIME"); |
|
|
(void)unused; |
|
|
if(timestr) { |
|
|
long val = strtol(timestr, NULL, 10); |
|
|
return (time_t)val; |
|
|
} |
|
|
return time(NULL); |
|
|
} |
|
|
#undef time |
|
|
#define time(x) altsvc_debugtime(x) |
|
|
#endif |
|
|
|
|
|
#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CURLcode Curl_altsvc_parse(struct Curl_easy *data, |
|
|
struct altsvcinfo *asi, const char *value, |
|
|
enum alpnid srcalpnid, const char *srchost, |
|
|
unsigned short srcport) |
|
|
{ |
|
|
const char *p = value; |
|
|
char alpnbuf[MAX_ALTSVC_ALPNLEN] = ""; |
|
|
struct altsvc *as; |
|
|
unsigned short dstport = srcport; |
|
|
CURLcode result = getalnum(&p, alpnbuf, sizeof(alpnbuf)); |
|
|
size_t entries = 0; |
|
|
#ifdef CURL_DISABLE_VERBOSE_STRINGS |
|
|
(void)data; |
|
|
#endif |
|
|
if(result) { |
|
|
infof(data, "Excessive alt-svc header, ignoring."); |
|
|
return CURLE_OK; |
|
|
} |
|
|
|
|
|
DEBUGASSERT(asi); |
|
|
|
|
|
|
|
|
if(strcasecompare(alpnbuf, "clear")) { |
|
|
|
|
|
altsvc_flush(asi, srcalpnid, srchost, srcport); |
|
|
return CURLE_OK; |
|
|
} |
|
|
|
|
|
do { |
|
|
if(*p == '=') { |
|
|
|
|
|
enum alpnid dstalpnid = alpn2alpnid(alpnbuf); |
|
|
p++; |
|
|
if(*p == '\"') { |
|
|
const char *dsthost = ""; |
|
|
size_t dstlen = 0; |
|
|
const char *value_ptr; |
|
|
char option[32]; |
|
|
unsigned long num; |
|
|
char *end_ptr; |
|
|
bool quoted = FALSE; |
|
|
time_t maxage = 24 * 3600; |
|
|
bool persist = FALSE; |
|
|
bool valid = TRUE; |
|
|
p++; |
|
|
if(*p != ':') { |
|
|
|
|
|
const char *hostp = p; |
|
|
if(*p == '[') { |
|
|
|
|
|
dstlen = strspn(++p, "0123456789abcdefABCDEF:."); |
|
|
if(p[dstlen] != ']') |
|
|
|
|
|
break; |
|
|
|
|
|
dstlen += 2; |
|
|
p = &p[dstlen-1]; |
|
|
} |
|
|
else { |
|
|
while(*p && (ISALNUM(*p) || (*p == '.') || (*p == '-'))) |
|
|
p++; |
|
|
dstlen = p - hostp; |
|
|
} |
|
|
if(!dstlen || (dstlen >= MAX_ALTSVC_HOSTLEN)) { |
|
|
infof(data, "Excessive alt-svc hostname, ignoring."); |
|
|
valid = FALSE; |
|
|
} |
|
|
else { |
|
|
dsthost = hostp; |
|
|
} |
|
|
} |
|
|
else { |
|
|
|
|
|
dsthost = srchost; |
|
|
dstlen = strlen(srchost); |
|
|
} |
|
|
if(*p == ':') { |
|
|
unsigned long port = 0; |
|
|
p++; |
|
|
if(ISDIGIT(*p)) |
|
|
|
|
|
port = strtoul(p, &end_ptr, 10); |
|
|
else |
|
|
end_ptr = (char *)p; |
|
|
if(!port || port > USHRT_MAX || end_ptr == p || *end_ptr != '\"') { |
|
|
infof(data, "Unknown alt-svc port number, ignoring."); |
|
|
valid = FALSE; |
|
|
} |
|
|
else { |
|
|
dstport = curlx_ultous(port); |
|
|
p = end_ptr; |
|
|
} |
|
|
} |
|
|
if(*p++ != '\"') |
|
|
break; |
|
|
|
|
|
|
|
|
for(;;) { |
|
|
while(ISBLANK(*p)) |
|
|
p++; |
|
|
if(*p != ';') |
|
|
break; |
|
|
p++; |
|
|
if(!*p || ISNEWLINE(*p)) |
|
|
break; |
|
|
result = getalnum(&p, option, sizeof(option)); |
|
|
if(result) { |
|
|
|
|
|
option[0] = '\0'; |
|
|
} |
|
|
while(*p && ISBLANK(*p)) |
|
|
p++; |
|
|
if(*p != '=') |
|
|
return CURLE_OK; |
|
|
p++; |
|
|
while(*p && ISBLANK(*p)) |
|
|
p++; |
|
|
if(!*p) |
|
|
return CURLE_OK; |
|
|
if(*p == '\"') { |
|
|
|
|
|
p++; |
|
|
quoted = TRUE; |
|
|
} |
|
|
value_ptr = p; |
|
|
if(quoted) { |
|
|
while(*p && *p != '\"') |
|
|
p++; |
|
|
if(!*p++) |
|
|
return CURLE_OK; |
|
|
} |
|
|
else { |
|
|
while(*p && !ISBLANK(*p) && *p!= ';' && *p != ',') |
|
|
p++; |
|
|
} |
|
|
num = strtoul(value_ptr, &end_ptr, 10); |
|
|
if((end_ptr != value_ptr) && (num < ULONG_MAX)) { |
|
|
if(strcasecompare("ma", option)) |
|
|
maxage = (time_t)num; |
|
|
else if(strcasecompare("persist", option) && (num == 1)) |
|
|
persist = TRUE; |
|
|
} |
|
|
} |
|
|
if(dstalpnid && valid) { |
|
|
if(!entries++) |
|
|
|
|
|
|
|
|
altsvc_flush(asi, srcalpnid, srchost, srcport); |
|
|
|
|
|
as = altsvc_createid(srchost, dsthost, dstlen, |
|
|
srcalpnid, dstalpnid, |
|
|
srcport, dstport); |
|
|
if(as) { |
|
|
|
|
|
|
|
|
as->expires = maxage + time(NULL); |
|
|
as->persist = persist; |
|
|
Curl_llist_append(&asi->list, as, &as->node); |
|
|
infof(data, "Added alt-svc: %s:%d over %s", dsthost, dstport, |
|
|
Curl_alpnid2str(dstalpnid)); |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
break; |
|
|
|
|
|
|
|
|
if(*p == ',') { |
|
|
|
|
|
p++; |
|
|
result = getalnum(&p, alpnbuf, sizeof(alpnbuf)); |
|
|
if(result) |
|
|
break; |
|
|
} |
|
|
} |
|
|
else |
|
|
break; |
|
|
} while(*p && (*p != ';') && (*p != '\n') && (*p != '\r')); |
|
|
|
|
|
return CURLE_OK; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Curl_altsvc_lookup(struct altsvcinfo *asi, |
|
|
enum alpnid srcalpnid, const char *srchost, |
|
|
int srcport, |
|
|
struct altsvc **dstentry, |
|
|
const int versions) |
|
|
{ |
|
|
struct Curl_llist_node *e; |
|
|
struct Curl_llist_node *n; |
|
|
time_t now = time(NULL); |
|
|
DEBUGASSERT(asi); |
|
|
DEBUGASSERT(srchost); |
|
|
DEBUGASSERT(dstentry); |
|
|
|
|
|
for(e = Curl_llist_head(&asi->list); e; e = n) { |
|
|
struct altsvc *as = Curl_node_elem(e); |
|
|
n = Curl_node_next(e); |
|
|
if(as->expires < now) { |
|
|
|
|
|
Curl_node_remove(e); |
|
|
altsvc_free(as); |
|
|
continue; |
|
|
} |
|
|
if((as->src.alpnid == srcalpnid) && |
|
|
hostcompare(srchost, as->src.host) && |
|
|
(as->src.port == srcport) && |
|
|
(versions & (int)as->dst.alpnid)) { |
|
|
|
|
|
*dstentry = as; |
|
|
return TRUE; |
|
|
} |
|
|
} |
|
|
return FALSE; |
|
|
} |
|
|
|
|
|
#endif |
|
|
|