summaryrefslogtreecommitdiff
path: root/lib/transfer.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-09-08 15:13:42 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-09-11 00:26:17 +0200
commit02eb6184ad6ba6133382dfe24b45472176df92f7 (patch)
tree0c18b8dd868fec7eccbe0f028c95da857db9cc2e /lib/transfer.c
parent7207aaa69696a5d28fbb628954f74ecbe2df97dc (diff)
downloadcurl-02eb6184ad6ba6133382dfe24b45472176df92f7.tar.gz
Curl_checkheaders: make it available for IMAP and SMTP too
... not only HTTP uses this now. Closes #1875
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 24a21aa46..b36de2803 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -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.