netcdf-c/ncdap_test/t_auth.c
dmh baed147ba4 [NCF-277]
Fix Http Basic Authorization.
The problem is really in oc2.0.
In order for it to work,
the CURLOPT_COOKIEJAR must have
a non-null value. The code
was already there, but not being
used for some reason.
1. fixed cookiejar code in oc2.0
2. synched oc2.0 with netcdf-c/oc2
3. added a test case
2013-11-15 11:38:54 -07:00

30 lines
659 B
C

#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <netcdf.h>
#define BASICAUTHURL "http://tiggeUser:tigge@thredds-test.ucar.edu/thredds/dodsC/restrict/testData.nc"
static void
CHECK(int e, const char* msg)
{
if(e == NC_NOERR) return;
if(msg == NULL) msg = "Error";
printf("%s: %s\n", msg, nc_strerror(e));
exit(1);
}
int
main()
{
int ncid,retval;
printf("Testing: Http Basic Authorization\n");
retval = nc_open(BASICAUTHURL, 0, &ncid);
CHECK(retval,"*** Fail: Http Basic Authorization");
retval = nc_close(ncid);
printf("*** PASS: Http Basic Authorization\n");
return 0;
}