mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 07:38:49 -05:00
Curl_checkheaders: make it available for IMAP and SMTP too
... not only HTTP uses this now. Closes #1875
This commit is contained in:
parent
7207aaa696
commit
02eb6184ad
21
lib/http.c
21
lib/http.c
@ -172,27 +172,6 @@ CURLcode Curl_http_setup_conn(struct connectdata *conn)
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* checkheaders() checks the linked list of custom HTTP 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* checkProxyHeaders() checks the linked list of custom proxy headers
|
* checkProxyHeaders() checks the linked list of custom proxy headers
|
||||||
* if proxy headers are not available, then it will lookup into http header
|
* if proxy headers are not available, then it will lookup into http header
|
||||||
|
@ -40,8 +40,6 @@ bool Curl_compareheader(const char *headerline, /* line to check */
|
|||||||
const char *header, /* header keyword _with_ colon */
|
const char *header, /* header keyword _with_ colon */
|
||||||
const char *content); /* content string to find */
|
const char *content); /* content string to find */
|
||||||
|
|
||||||
char *Curl_checkheaders(const struct connectdata *conn,
|
|
||||||
const char *thisheader);
|
|
||||||
char *Curl_copy_header_value(const char *header);
|
char *Curl_copy_header_value(const char *header);
|
||||||
|
|
||||||
char *Curl_checkProxyheaders(const struct connectdata *conn,
|
char *Curl_checkProxyheaders(const struct connectdata *conn,
|
||||||
|
@ -1820,7 +1820,7 @@ CURLcode curl_mime_headers(curl_mimepart *part,
|
|||||||
void Curl_mime_initpart(curl_mimepart *part, struct Curl_easy *easy)
|
void Curl_mime_initpart(curl_mimepart *part, struct Curl_easy *easy)
|
||||||
{
|
{
|
||||||
(void) part;
|
(void) part;
|
||||||
(void) data;
|
(void) easy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Curl_mime_cleanpart(curl_mimepart *part)
|
void Curl_mime_cleanpart(curl_mimepart *part)
|
||||||
|
@ -74,12 +74,37 @@
|
|||||||
#include "non-ascii.h"
|
#include "non-ascii.h"
|
||||||
#include "http2.h"
|
#include "http2.h"
|
||||||
#include "mime.h"
|
#include "mime.h"
|
||||||
|
#include "strcase.h"
|
||||||
|
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
#include "curl_memory.h"
|
#include "curl_memory.h"
|
||||||
#include "memdebug.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
|
* This function will call the read callback to fill our buffer with data
|
||||||
* to upload.
|
* to upload.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -22,6 +22,9 @@
|
|||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
char *Curl_checkheaders(const struct connectdata *conn,
|
||||||
|
const char *thisheader);
|
||||||
|
|
||||||
void Curl_init_CONNECT(struct Curl_easy *data);
|
void Curl_init_CONNECT(struct Curl_easy *data);
|
||||||
|
|
||||||
CURLcode Curl_pretransfer(struct Curl_easy *data);
|
CURLcode Curl_pretransfer(struct Curl_easy *data);
|
||||||
|
Loading…
Reference in New Issue
Block a user