mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
a2e0f069ec
Primary change is to cleanup code and remove duplicated code. 1. Unify the rc file reading into libdispatch/drc.c. Eventually extend if we need rc file for netcdf itself as opposed to the dap code. 2. Unify the extraction from the rc file of DAP authorization info. 3. Misc. other small unifications: make temp file, read file. 4. Avoid use of libcurl when reading file:// because there is some kind of problem with the Visual Studio version. Might be related to the winpath problem. In any case, do direct read instead. 5. Add new error code NC_ERCFILE for errors in reading RC file. 6. Complete documentation cleanup as indicated in this comment https://github.com/Unidata/netcdf-c/pull/472#issuecomment-325926426 7. Convert some occurrences of #ifdef _WIN32 to #ifdef _MSC_VER
59 lines
1.7 KiB
C
59 lines
1.7 KiB
C
/*
|
|
Copyright (c) 1998-2017 University Corporation for Atmospheric Research/Unidata
|
|
See LICENSE.txt for license information.
|
|
*/
|
|
|
|
/*
|
|
Common authorization tracking.
|
|
Currently for DAP2 and DAP4 protocols.
|
|
Every curl connection will need a copy of this.
|
|
*/
|
|
|
|
#ifndef NCAUTH_H
|
|
#define NCAUTH_H
|
|
|
|
/* Need these support includes */
|
|
#include "ncrc.h"
|
|
|
|
typedef struct NCauth {
|
|
struct curlflags {
|
|
int proto_https; /* is https: supported? */
|
|
int compress; /*CURLOPT_ENCODING*/
|
|
int verbose; /*CURLOPT_ENCODING*/
|
|
int timeout; /*CURLOPT_TIMEOUT*/
|
|
int maxredirs; /*CURLOPT_MAXREDIRS*/
|
|
char* useragent; /*CURLOPT_USERAGENT*/
|
|
int cookiejarcreated;
|
|
char* cookiejar; /*CURLOPT_COOKIEJAR,CURLOPT_COOKIEFILE*/
|
|
char* netrc; /*CURLOPT_NETRC,CURLOPT_NETRC_FILE*/
|
|
} curlflags;
|
|
struct ssl {
|
|
int verifypeer; /* CURLOPT_SSL_VERIFYPEER;
|
|
do not do this when cert might be self-signed
|
|
or temporarily incorrect */
|
|
int verifyhost; /* CURLOPT_SSL_VERIFYHOST; for client-side verification */
|
|
char* certificate; /*CURLOPT_SSLCERT*/
|
|
char* key; /*CURLOPT_SSLKEY*/
|
|
char* keypasswd; /*CURLOPT_SSLKEYPASSWD*/
|
|
char* cainfo; /* CURLOPT_CAINFO; certificate authority */
|
|
char* capath; /*CURLOPT_CAPATH*/
|
|
} ssl;
|
|
struct proxy {
|
|
char *host; /*CURLOPT_PROXY*/
|
|
int port; /*CURLOPT_PROXYPORT*/
|
|
char* user; /*CURLOPT_PROXYUSERNAME*/
|
|
char* pwd; /*CURLOPT_PROXYPASSWORD*/
|
|
} proxy;
|
|
struct credentials {
|
|
char *user; /*CURLOPT_USERNAME*/
|
|
char *pwd; /*CURLOPT_PASSWORD*/
|
|
} creds;
|
|
} NCauth;
|
|
|
|
extern int NC_authsetup(NCauth*, NCURI*);
|
|
extern void NC_authclear(NCauth*);
|
|
extern char* NC_combinehostport(NCURI*);
|
|
extern int NC_parsecredentials(const char* userpwd, char** userp, char** pwdp);
|
|
|
|
#endif /*NCAUTH_H*/
|