mirror of
https://github.com/curl/curl.git
synced 2026-08-25 05:43:32 +03:00
PIPELINING_SERVER_BL: cleanup the internal list use
The list was freed incorrectly since the llist refactor of
cbae73e1dd. Added test 1550 to verify that it works and avoid future
regressions.
Reported-by: Pascal Terjan
Fixes #1584
Closes #1585
This commit is contained in:
parent
65ca030513
commit
6208547002
5 changed files with 92 additions and 22 deletions
|
|
@ -230,28 +230,27 @@ CURLMcode Curl_pipeline_set_site_blacklist(char **sites,
|
|||
return CURLM_OK;
|
||||
}
|
||||
|
||||
struct blacklist_node {
|
||||
struct curl_llist_element list;
|
||||
char server_name[1];
|
||||
};
|
||||
|
||||
bool Curl_pipeline_server_blacklisted(struct Curl_easy *handle,
|
||||
char *server_name)
|
||||
{
|
||||
if(handle->multi && server_name) {
|
||||
struct curl_llist *blacklist =
|
||||
struct curl_llist *list =
|
||||
Curl_multi_pipelining_server_bl(handle->multi);
|
||||
|
||||
if(blacklist) {
|
||||
struct curl_llist_element *curr;
|
||||
|
||||
curr = blacklist->head;
|
||||
while(curr) {
|
||||
char *bl_server_name;
|
||||
|
||||
bl_server_name = curr->ptr;
|
||||
if(strncasecompare(bl_server_name, server_name,
|
||||
strlen(bl_server_name))) {
|
||||
infof(handle, "Server %s is blacklisted\n", server_name);
|
||||
return TRUE;
|
||||
}
|
||||
curr = curr->next;
|
||||
struct curl_llist_element *e = list->head;
|
||||
while(e) {
|
||||
struct blacklist_node *bl = (struct blacklist_node *)e;
|
||||
if(strncasecompare(bl->server_name, server_name,
|
||||
strlen(bl->server_name))) {
|
||||
infof(handle, "Server %s is blacklisted\n", server_name);
|
||||
return TRUE;
|
||||
}
|
||||
e = e->next;
|
||||
}
|
||||
|
||||
DEBUGF(infof(handle, "Server %s is not blacklisted\n", server_name));
|
||||
|
|
@ -259,11 +258,6 @@ bool Curl_pipeline_server_blacklisted(struct Curl_easy *handle,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
struct blacklist_node {
|
||||
struct curl_llist_element list;
|
||||
char server_name[1];
|
||||
};
|
||||
|
||||
CURLMcode Curl_pipeline_set_server_blacklist(char **servers,
|
||||
struct curl_llist *list)
|
||||
{
|
||||
|
|
@ -286,8 +280,7 @@ CURLMcode Curl_pipeline_set_server_blacklist(char **servers,
|
|||
}
|
||||
strcpy(n->server_name, *servers);
|
||||
|
||||
Curl_llist_insert_next(list, list->tail, n->server_name,
|
||||
&n->list);
|
||||
Curl_llist_insert_next(list, list->tail, n, &n->list);
|
||||
servers++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue