Curl_checkheaders: make it available for IMAP and SMTP too

... not only HTTP uses this now.

Closes #1875
This commit is contained in:
Daniel Stenberg 2017-09-08 15:13:42 +02:00
parent 7207aaa696
commit 02eb6184ad
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 30 additions and 25 deletions

View file

@ -74,12 +74,37 @@
#include "non-ascii.h"
#include "http2.h"
#include "mime.h"
#include "strcase.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_SMTP) || \
!defined(CURL_DISABLE_IMAP)
/*
* checkheaders() checks the linked list of custom headers for a
* particular header (prefix).
*
* Returns a pointer to the first matching header or NULL if none matched.
*/
char *Curl_checkheaders(const struct connectdata *conn,
const char *thisheader)
{
struct curl_slist *head;
size_t thislen = strlen(thisheader);
struct Curl_easy *data = conn->data;
for(head = data->set.headers;head; head=head->next) {
if(strncasecompare(head->data, thisheader, thislen))
return head->data;
}
return NULL;
}
#endif
/*
* This function will call the read callback to fill our buffer with data
* to upload.