redirect patch for libdap-3.7.6/HTTPConnect.cc
Rob Cermak
cermak at sfos.uaf.edu
Wed May 2 23:55:30 PDT 2007
Here is the small patch that allows for server redirection.
1. Use at your own risk! This is alpha code.
2. It needs a safety belt. Does not handle infinite redirection!
http://ak.aoos.org/data/patch/hyrax_redirect.patch
Notes: Feel free to ask Steve any questions about this patch. As always,
if there is a better way to implement it, please do so. We are just
glad to help.
_From the 30,000 ft view:
Looks like we hunt for the 'location:' string. We do not check for 301
or 302 responses. This string is stored for later and accessible via
get_location method.
Later in the call once all the headers come in, we check if there was a
location passed in the headers and calls fetch_url again (recursively)?.
I get lost in the if statement :)
The result is that GDAL and getdap can find data again with just a few
lines in Apache to perform the redirect.
[cermak at penguin sync]$ curl -I
http://ak.aoos.org/dap/data/FNMOC/sst/latest.nc.bz2.html
HTTP/1.1 302 Found
Date: Thu, 03 May 2007 06:18:19 GMT
Server: Apache/2.2.3 (Mandriva Linux/PREFORK-1mdv2007.0)
Location: http://ak.aoos.org:8080/opendap/FNMOC/sst/latest.nc.bz2.html
Content-Type: text/html; charset=iso-8859-1
[cermak at penguin sync]$ getdap -v -d
http://ak.aoos.org/dap/data/FNMOC/sst/latest.nc.bz2
Fetching: http://ak.aoos.org/dap/data/FNMOC/sst/latest.nc.bz2
DAP version: 3.2, Server version: bes/3.4.1
DDS:
Dataset {
Float64 lon[lon = 3600];
Float64 lat[lat = 1586];
Float64 time[time = 1];
String ob[time = 1][nob = 19];
Grid {
Array:
Float32 sst[time = 1][lat = 1586][lon = 3600];
Maps:
Float64 time[time = 1];
Float64 lat[lat = 1586];
Float64 lon[lon = 3600];
} sst;
} latest.nc;
[cermak at penguin sync]$ gdalinfo
"http://ak.aoos.org/dap/data/FNMOC/sst/latest.nc.bz2?sst[0][y][x]"
Warning 1: I connected to the URL but could not get a DAP 3.x version
string from the server. I will continue to connect but access may fail.
Driver: DODS/DAP 3.x servers
Size is 3600, 1586
Coordinate System is `'
Origin = (-179.950000000000017,-0.025000000000000)
Pixel Size = (0.100000000000000,0.050000000000000)
Corner Coordinates:
Upper Left (-179.9500000, -0.0250000)
Lower Left (-179.9500000, 79.2750000)
Upper Right ( 180.0500000, -0.0250000)
Lower Right ( 180.0500000, 79.2750000)
Center ( 0.0500000, 39.6250000)
Band 1 Block=512x128 Type=Float32, ColorInterp=Undefined
NoData Value=-99999
Overviews: 1800x793, 900x396, 450x198, 225x99
BES and topcat are setup as per wiki instructions no serious modifications.
The only things needed in Apache are:
RewriteEngine On
RewriteRule ^/dap/data(.*) "http://ak.aoos.org:8080/opendap$1"
RewriteRule ^/opendap/nph-dods/data(.*) "http://ak.aoos.org:8080/opendap$1"
This is the good news.
Rob
--
Alaska Ocean Observing System
Data Manager
907-474-7948
==============================================================================
To unsubscribe opendap, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================
More information about the Opendap
mailing list