Skip to content

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

Merged
joa-quim merged 5 commits into
GenericMappingTools:masterfrom
ES-Solar:fix-china-mirror-redirect
Jun 24, 2026
Merged

Fix DNS mirror forward redirects Issue: gmt-admin #297 Incorrect DNS settings for mirrors#9068
joa-quim merged 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.

@joa-quim joa-quim left a comment

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.

Tested it with the Portuguese site and it worked.
Also run the tests locally and all fine.

@ES-Solar

Copy link
Copy Markdown
Collaborator Author

Should i be concerned about the 4 pull_request failures? Also, there is a note that 'Merging is blocked You're not authorized to push to this branch.' Does my github account need additional privilege to merge the PR?

@joa-quim

Copy link
Copy Markdown
Member

I see only failures in MacOS and are not related to this. Linux is a mess download failures and Windows build is broken. I'll
merge it.

Does my github account need additional privilege to merge the PR?

Yes, and probably means that you must to be added to a group that has that privilege.

@joa-quim joa-quim merged commit 92c943b into GenericMappingTools:master Jun 24, 2026
9 of 13 checks passed
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