Skip to content

Commit

Permalink
doh: CURL_DISABLE_DOH
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed May 13, 2019
1 parent 52dfab6 commit ae4adae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/doh.c
Expand Up @@ -22,6 +22,8 @@


#include "curl_setup.h" #include "curl_setup.h"


#ifndef CURL_DISABLE_DOH

#include "urldata.h" #include "urldata.h"
#include "curl_addrinfo.h" #include "curl_addrinfo.h"
#include "doh.h" #include "doh.h"
Expand Down Expand Up @@ -960,3 +962,5 @@ CURLcode Curl_doh_is_resolved(struct connectdata *conn,


return CURLE_OK; return CURLE_OK;
} }

#endif /* CURL_DISABLE_DOH */
10 changes: 9 additions & 1 deletion lib/doh.h
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2018 - 2019, 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
Expand All @@ -25,6 +25,8 @@
#include "urldata.h" #include "urldata.h"
#include "curl_addrinfo.h" #include "curl_addrinfo.h"


#ifndef CURL_DISABLE_DOH

/* /*
* Curl_doh() resolve a name using DoH (DNS-over-HTTPS). It resolves a name * Curl_doh() resolve a name using DoH (DNS-over-HTTPS). It resolves a name
* and returns a 'Curl_addrinfo *' with the address information. * and returns a 'Curl_addrinfo *' with the address information.
Expand Down Expand Up @@ -102,4 +104,10 @@ DOHcode doh_decode(unsigned char *doh,
struct dohentry *d); struct dohentry *d);
void de_cleanup(struct dohentry *d); void de_cleanup(struct dohentry *d);
#endif #endif

#else /* if DOH is disabled */
#define Curl_doh(a,b,c,d) NULL
#define Curl_doh_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST
#endif

#endif /* HEADER_CURL_DOH_H */ #endif /* HEADER_CURL_DOH_H */
2 changes: 2 additions & 0 deletions lib/urldata.h
Expand Up @@ -604,7 +604,9 @@ struct SingleRequest {
char *upload_fromhere; char *upload_fromhere;
void *protop; /* Allocated protocol-specific data. Each protocol void *protop; /* Allocated protocol-specific data. Each protocol
handler makes sure this points to data it needs. */ handler makes sure this points to data it needs. */
#ifndef CURL_DISABLE_DOH
struct dohdata doh; /* DoH specific data for this request */ struct dohdata doh; /* DoH specific data for this request */
#endif
bit header:1; /* incoming data has HTTP header */ bit header:1; /* incoming data has HTTP header */
bit content_range:1; /* set TRUE if Content-Range: was found */ bit content_range:1; /* set TRUE if Content-Range: was found */
bit upload_done:1; /* set to TRUE when doing chunked transfer-encoding bit upload_done:1; /* set to TRUE when doing chunked transfer-encoding
Expand Down

0 comments on commit ae4adae

Please sign in to comment.