Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ACCEPT_ENCODING on DAP requests #2630

Merged
merged 3 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ This file contains a high-level description of this package's evolution. Release

## 4.9.2 - TBD

* Fix byterange failures for certain URLs. See [Github #????](https://github.com/Unidata/netcdf-c/pull/????).
* Fix 'make distcheck' error in run_interop.sh. See [Github #2631](https://github.com/Unidata/netcdf-c/pull/2631).
* Update `nc-config` to remove inclusion from automatically-detected `nf-config` and `ncxx-config` files, as the wrong files could be included in the output. This is in support of [GitHub #2274](https://github.com/Unidata/netcdf-c/issues/2274).
* Update H5FDhttp.[ch] to work with HDF5 version 1.14.0. See [Github #2615](https://github.com/Unidata/netcdf-c/pull/2615).
* [Bug Fix] Update DAP code to enable CURLOPT_ACCEPT_ENCODING by default. See [Github #2630](https://github.com/Unidata/netcdf-c/pull/2630).
* [Bug Fix] Fix byterange failures for certain URLs. See [Github #????](https://github.com/Unidata/netcdf-c/pull/????).
* [Bug Fix] Fix 'make distcheck' error in run_interop.sh. See [Github #2631](https://github.com/Unidata/netcdf-c/pull/2631).
* [Enhancement] Update `nc-config` to remove inclusion from automatically-detected `nf-config` and `ncxx-config` files, as the wrong files could be included in the output. This is in support of [GitHub #2274](https://github.com/Unidata/netcdf-c/issues/2274).
* [Enhancement] Update H5FDhttp.[ch] to work with HDF5 version 1.14.0. See [Github #2615](https://github.com/Unidata/netcdf-c/pull/2615).

## 4.9.1 - February 2, 2023

Expand Down
4 changes: 2 additions & 2 deletions include/ncauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Every curl connection will need a copy of this.
typedef struct NCauth {
struct curlflags {
int proto_https; /* is https: supported? */
int compress; /*CURLOPT_ENCODING*/
int verbose; /*CURLOPT_ENCODING*/
int encode; /*turn on CURLOPT_ACCEPT_ENCODING*/
int verbose; /*CURLOPT_VERBOSE*/
int timeout; /*CURLOPT_TIMEOUT*/
int connecttimeout; /*CURLOPT_CONNECTTIMEOUT*/
int maxredirs; /*CURLOPT_MAXREDIRS*/
Expand Down
14 changes: 7 additions & 7 deletions libdap4/d4curlfunctions.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ set_curlflag(NCD4INFO* state, int flag)
case CURLOPT_ERRORBUFFER:
SETCURLOPT(state, CURLOPT_ERRORBUFFER, state->curl->errdata.errorbuf);
break;
case CURLOPT_ENCODING:
#ifdef CURLOPT_ENCODING
if(state->auth->curlflags.compress) {
SETCURLOPT(state, CURLOPT_ENCODING,"deflate, gzip");
case CURLOPT_ACCEPT_ENCODING:
if(state->auth->curlflags.encode) {
SETCURLOPT(state, CURLOPT_ACCEPT_ENCODING, "" ); /* Accept all available encodings */
} else {
SETCURLOPT(state, CURLOPT_ACCEPT_ENCODING, NULL);
}
#endif
break;
case CURLOPT_PROXY:
if(state->auth->proxy.host != NULL) {
Expand Down Expand Up @@ -192,7 +192,7 @@ NCD4_set_flags_perlink(NCD4INFO* state)
{
int ret = NC_NOERR;
/* Following are always set */
if(ret == NC_NOERR) ret = set_curlflag(state,CURLOPT_ENCODING);
if(ret == NC_NOERR) ret = set_curlflag(state,CURLOPT_ACCEPT_ENCODING);
if(ret == NC_NOERR) ret = set_curlflag(state,CURLOPT_NETRC);
if(ret == NC_NOERR) ret = set_curlflag(state,CURLOPT_VERBOSE);
if(ret == NC_NOERR) ret = set_curlflag(state,CURLOPT_TIMEOUT);
Expand Down Expand Up @@ -396,7 +396,7 @@ NCD4_set_curlstate(NCD4INFO* state, int flag, void* value)
case CURLOPT_ERRORBUFFER:
/* no need to store; will always be set */
break;
case CURLOPT_ENCODING:
case CURLOPT_ACCEPT_ENCODING:
/* no need to store; will always be set to fixed value */
break;
case CURLOPT_PROXY:
Expand Down
11 changes: 5 additions & 6 deletions libdispatch/dauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ static const char* AUTHDEFAULTS[] = {
"HTTP.SSL.VERIFYHOST","-1", /* Use default */
"HTTP.TIMEOUT","1800", /*seconds */ /* Long but not infinite */
"HTTP.CONNECTTIMEOUT","50", /*seconds */ /* Long but not infinite */
NULL
"HTTP.ENCODE","1", /* Use default */
NULL,
};

/* Forward */
Expand Down Expand Up @@ -108,8 +109,6 @@ NC_authsetup(NCauth** authp, NCURI* uri)
to getinfo e.g. host+port from url
*/

setauthfield(auth,"HTTP.DEFLATE",
NC_rclookup("HTTP.DEFLATE",uri_hostport,uri->path));
setauthfield(auth,"HTTP.VERBOSE",
NC_rclookup("HTTP.VERBOSE",uri_hostport,uri->path));
setauthfield(auth,"HTTP.TIMEOUT",
Expand Down Expand Up @@ -220,10 +219,10 @@ setauthfield(NCauth* auth, const char* flag, const char* value)
{
int ret = NC_NOERR;
if(value == NULL) goto done;
if(strcmp(flag,"HTTP.DEFLATE")==0) {
if(atoi(value)) auth->curlflags.compress = 1;
if(strcmp(flag,"HTTP.ENCODE")==0) {
if(atoi(value)) {auth->curlflags.encode = 1;} else {auth->curlflags.encode = 0;}
#ifdef DEBUG
nclog(NCLOGNOTE,"HTTP.DEFLATE: %ld", (long)auth->curlflags.compress);
nclog(NCLOGNOTE,"HTTP.encode: %ld", (long)auth->curlflags.encode);
#endif
}
if(strcmp(flag,"HTTP.VERBOSE")==0) {
Expand Down
2 changes: 1 addition & 1 deletion oc2/daplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ daplexcleanup(DAPlexstate** lexstatep)
*/
#ifdef DECODE_PARTIAL
static const char* decodeset = /* Specify which characters are decoded */
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_!~*'-\"";
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_!~*'-\"@";
#endif

char*
Expand Down
2 changes: 1 addition & 1 deletion oc2/occurlflags.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ static struct OCCURLFLAG oc_curlflags[] = {
#ifdef HAVE_CURLOPT_BUFFERSIZE
{"CURLOPT_BUFFERSIZE",CURLOPT_BUFFERSIZE,98,CF_LONG},
#endif
{"CURLOPT_ACCEPT_ENCODING",CURLOPT_ENCODING,10102,CF_STRING},
{"CURLOPT_CAINFO",CURLOPT_CAINFO,10065,CF_STRING},
{"CURLOPT_CAPATH",CURLOPT_CAPATH,10097,CF_STRING},
{"CURLOPT_COOKIEFILE",CURLOPT_COOKIEFILE,10031,CF_STRING},
{"CURLOPT_COOKIEJAR",CURLOPT_COOKIEJAR,10082,CF_STRING},
{"CURLOPT_ENCODING",CURLOPT_ENCODING,10102,CF_STRING},
{"CURLOPT_ERRORBUFFER",CURLOPT_ERRORBUFFER,10010,CF_STRING},
{"CURLOPT_FOLLOWLOCATION",CURLOPT_FOLLOWLOCATION,52,CF_LONG},
{"CURLOPT_HTTPAUTH",CURLOPT_HTTPAUTH,1007,CF_LONG},
Expand Down
12 changes: 6 additions & 6 deletions oc2/occurlfunctions.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ ocset_curlflag(OCstate* state, int flag)
SETCURLOPT(state, CURLOPT_ERRORBUFFER, state->error.curlerrorbuf);
break;

case CURLOPT_ENCODING:
#ifdef CURLOPT_ENCODING
if(state->auth->curlflags.compress) {
SETCURLOPT(state, CURLOPT_ENCODING,"deflate, gzip");
case CURLOPT_ACCEPT_ENCODING:
if(state->auth->curlflags.encode) {
SETCURLOPT(state, CURLOPT_ACCEPT_ENCODING, "" ); /* Accept all available encodings */
} else {
SETCURLOPT(state, CURLOPT_ACCEPT_ENCODING, NULL);
}
#endif
break;

case CURLOPT_PROXY:
Expand Down Expand Up @@ -200,7 +200,7 @@ ocset_flags_perlink(OCstate* state)
OCerror stat = OC_NOERR;

/* Following are always set */
if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_ENCODING);
if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_ACCEPT_ENCODING);
if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_NETRC);
if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_VERBOSE);
if(stat == OC_NOERR) stat = ocset_curlflag(state,CURLOPT_TIMEOUT);
Expand Down