Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Some HTTP servers (i.e. TDS) report a 0 value for Content-Length header. #66

Merged
merged 1 commit into from
Dec 15, 2014
Merged

Some HTTP servers (i.e. TDS) report a 0 value for Content-Length header. #66

merged 1 commit into from
Dec 15, 2014

Conversation

cofinoa
Copy link
Contributor

@cofinoa cofinoa commented Aug 3, 2014

This workaround guess the real value size, making a request with
a range heaer.

This commit guess the real value for the URL size, making a request with
a range.
@cofinoa cofinoa changed the title Some HTTP servers (i.e. TDS) a 0 value for Content-Length header. Some HTTP servers (i.e. TDS) report a 0 value for Content-Length header. Aug 3, 2014
@DennisHeimbigner
Copy link
Contributor

Can you tell me what problems arise from the 0 length value?
=Dennis Heimbigner
Unidata

cofinoa wrote:

This commit guess the real value for the URL size, making a request with
a range.
You can merge this Pull Request by running:

git pull https://github.com/cofinoa/thredds target-4.3.22

Or you can view, comment on it, or merge it online at:

#66

-- Commit Summary --

  • Some HTTP servers (i.e. TDS) a 0 value for Content-Length header.

-- File Changes --

M cdm/src/main/java/ucar/unidata/io/http/HTTPRandomAccessFile.java (8)

-- Patch Links --

https://github.com/Unidata/thredds/pull/66.patch
https://github.com/Unidata/thredds/pull/66.diff


Reply to this email directly or view it on GitHub:
#66

@cofinoa
Copy link
Contributor Author

cofinoa commented Aug 4, 2014

For Example this URL
http:https://opendap.bom.gov.au:8080/thredds/fileServer/poama/m24a/hindcasts/e00/dag_20111211.nc

is reporting a Content-Length value of 0, making the netcdf-java failing
to open it. This a excerpt from the ToolsUI's exception trying to open
the dataset:
java.io.EOFException: Reading
http:https://opendap.bom.gov.au:8080/thredds/fileServer/poama/m24a/hindcasts/e00/dag_20111211.nc
at 0 file length = 0
at ucar.unidata.io.RandomAccessFile.readFully(RandomAccessFile.java:747)
at ucar.unidata.io.RandomAccessFile.readFully(RandomAccessFile.java:726)
at ucar.nc2.grib.grib2.Grib2Iosp.isValidFile(Grib2Iosp.java:271)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:860)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:496)
........................................

With this workaround, the netcdf-java is able to process the dataset

Browsers or wget and curl tools are able to guess the size of the remote
file and download it with no problem.

Regards

Antonio

P.S: This a common issue with the HTTP service from TDS which I have
seen before but I haven't been able to track down the bug

El 03/08/2014 22:42, DennisHeimbigner escribió:

Can you tell me what problems arise from the 0 length value?
=Dennis Heimbigner
Unidata

cofinoa wrote:

This commit guess the real value for the URL size, making a request with
a range.
You can merge this Pull Request by running:

git pull https://github.com/cofinoa/thredds target-4.3.22

Or you can view, comment on it, or merge it online at:

#66

-- Commit Summary --

  • Some HTTP servers (i.e. TDS) a 0 value for Content-Length header.

-- File Changes --

M cdm/src/main/java/ucar/unidata/io/http/HTTPRandomAccessFile.java (8)

-- Patch Links --

https://github.com/Unidata/thredds/pull/66.patch
https://github.com/Unidata/thredds/pull/66.diff


Reply to this email directly or view it on GitHub:
#66


Reply to this email directly or view it on GitHub
#66 (comment).

JohnLCaron pushed a commit that referenced this pull request Dec 15, 2014
Some HTTP servers (i.e. TDS) report a 0 value for Content-Length header.
@JohnLCaron JohnLCaron merged commit 1a1ae38 into Unidata:target-4.3.22 Dec 15, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants