Skip to content

Fix DNS mirror forward redirects Issue: gmt-admin #297 Incorrect DNS settings for mirrors#9068

Open
ES-Solar wants to merge 5 commits into
GenericMappingTools:masterfrom
ES-Solar:fix-china-mirror-redirect
Open

Fix DNS mirror forward redirects Issue: gmt-admin #297 Incorrect DNS settings for mirrors#9068
ES-Solar wants to merge 5 commits into
GenericMappingTools:masterfrom
ES-Solar:fix-china-mirror-redirect

Conversation

@ES-Solar

Copy link
Copy Markdown
Collaborator

Problem

Related to GenericMappingTools/gmt-admin#297

Alias server names such as china and australia expand to Hover DNS
URL-forwards (e.g., http://china.generic-mapping-tools.org) that redirect
all requests to the mirror root — stripping the file path in the process.
This caused every file download to fail: GMT received an HTML directory
listing instead of the requested grid or cache file.

Fix

gmtremote_resolve_redirect() in gmt_remote.c follows the redirect chain
once at session start to discover the real mirror base URL
(e.g., https://mirrors.ustc.edu.cn/gmtdata). gmt_dataserver_url() caches
the result for the process lifetime and uses it for all subsequent file URL
construction. Direct http:// URLs and servers with no redirect are
unaffected.

Test

Added test/gmt_remote/dataserver_alias.sh which forces GMT_DATA_SERVER=oceania,
clears the local cache, downloads @earth_relief_15m_g.grd, and verifies the
grid region with gmt grdinfo -I-.

Comment thread test/gmt_remote/dataserver_alias.sh Outdated
# body that GMT cannot parse as a netCDF grid, causing the test to fail.

# Remove any cached copy to force a real download from the server
rm -f "${HOME}/.gmt/server/earth/earth_relief/earth_relief_15m_g.grd"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the earth_relief_01d_p.grd grid instead. Much smaller.

@joa-quim

Copy link
Copy Markdown
Member

Also, don't you have permission writes to master? Because PRs submitted to master are much easier for us to test.

@ES-Solar

Copy link
Copy Markdown
Collaborator Author

I updated the test to use the smaller grid.

was used to the updating my fork and thought that was the preferred workflow. I'll change that for the next PR I contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants