Skip to content

Commit

Permalink
make it build fine with HTTP-disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Mar 16, 2022
1 parent 873e05b commit 6be0394
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/curl/header.h
Expand Up @@ -46,7 +46,8 @@ typedef enum {
CURLHE_MISSING, /* no such header exists */
CURLHE_NOHEADERS, /* no headers at all exist (yet) */
CURLHE_OUT_OF_MEMORY, /* out of memory while processing */
CURLHE_BAD_ARGUMENT,
CURLHE_BAD_ARGUMENT, /* a function argument was not okay */
CURLHE_NOT_BUILT_IN /* if API was disabled in the build */
} CURLHcode;

CURL_EXTERN CURLHcode curl_easy_header(CURL *easy,
Expand Down
29 changes: 29 additions & 0 deletions lib/headers.c
Expand Up @@ -33,6 +33,8 @@
#include "curl_memory.h"
#include "memdebug.h"

#ifndef CURL_DISABLE_HTTP

/* Generate the curl_header struct for the user. This function MUST assign all
struct fields in the output struct. */
static void copy_header_external(struct Curl_easy *data,
Expand Down Expand Up @@ -255,3 +257,30 @@ CURLcode Curl_headers_cleanup(struct Curl_easy *data)
Curl_headers_init(data);
return CURLE_OK;
}

#else /* HTTP-disabled builds below */

CURLHcode curl_easy_header(CURL *easy,
const char *name,
size_t index,
unsigned int type,
struct curl_header **hout)
{
(void)easy;
(void)name;
(void)index;
(void)type;
(void)hout;
return CURLHE_NOT_BUILT_IN;
}

struct curl_header *curl_easy_nextheader(CURL *easy,
unsigned int type,
struct curl_header *prev)
{
(void)easy;
(void)type;
(void)prev;
return NULL;
}
#endif
7 changes: 7 additions & 0 deletions lib/headers.h
Expand Up @@ -23,6 +23,8 @@
***************************************************************************/
#include "curl_setup.h"

#ifndef CURL_DISABLE_HTTP

struct Curl_header_store {
struct Curl_llist_element node;
char *name;
Expand All @@ -46,4 +48,9 @@ CURLcode Curl_headers_init(struct Curl_easy *data);
*/
CURLcode Curl_headers_cleanup(struct Curl_easy *data);

#else
#define Curl_headers_push(x,y,z) CURLE_NOT_BUILT_IN
#define Curl_headers_cleanup(x) Curl_nop_stmt
#endif

#endif /* HEADER_CURL_HEADER_H */

0 comments on commit 6be0394

Please sign in to comment.