-
-
Notifications
You must be signed in to change notification settings - Fork 750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix OSS check #479
Fix OSS check #479
Conversation
Updated with an optimization that saving headers in a local variable. Now it only needs to send 2 requests to check OSS resources, while the old implementation needs 4 requests. |
I agree I tried reproducing with MacOS and centos:6.6 and ubuntu:12.04 and ubuntu:latest. For your interest, I am trying a different approach by changing function is_ok() {
if command -v curl &> /dev/null; then
${GET} --fail --head "$1" &> /dev/null || return 1
else
${GET} --spider "$1" &> /dev/null || return 1
fi
} |
@JohnRGee It was several months ago. Maybe something has changed. Thanks for your |
Redirects:
I checked archlinux and centos and ubuntu and Mac. Example: # wget -O- --spider https://npm.taobao.org/mirrors/node/v9.11.0/node-v9.11.0-linux-arm64.tar.gz
...
HTTP request sent, awaiting response... 302 Found
Location: http://cdn.npm.taobao.org/dist/node/v9.11.0/node-v9.11.0-linux-arm64.tar.gz [following]
Spider mode enabled. Check if remote file exists.
--2018-07-21 12:07:49-- http://cdn.npm.taobao.org/dist/node/v9.11.0/node-v9.11.0-linux-arm64.tar.gz
...
HTTP request sent, awaiting response... 200 OK
Length: 17897624 (17M) [application/octet-stream]
Remote file exists.
# curl --head -L https://npm.taobao.org/mirrors/node/v9.11.0/node-v9.11.0-linux-arm64.tar.gz
HTTP/2 302
...
HTTP/1.1 200 OK
...
Content-Length: 17897624
.... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I am not a maintainer.)
When I tried working through the code I found it does not currently work as intended. The location
returned is currently all lowercase.
$ curl -Is -L https://npm.taobao.org/mirrors/node/v10.0.0/node-v10.0.0-darwin-x64.tar.gz | grep ocation
location: http://cdn.npm.taobao.org/dist/node/v10.0.0/node-v10.0.0-darwin-x64.tar.gz
I checked and headers are officially case insensitive, so I suggest the searches are case insensitive too.
See #560 for open issue. Subscribe to that for updates and/or add 👍 to show interest |
Pull Request Template:
Describe what you did
Fix function
is_oss_ok
.awk
picks the wrong location with\r
at the endHow you did it
Fixed by,
awk
withsed
How to verify it doesn't effect the functionality of n
NODE_MIRROR=https://npm.taobao.org/mirrors/node/ n 8.9.0
If this solves an issue, please put issue in PR notes.
If this solves an issue, please include the output of issue that had problems and then the fixed output from the same command.
Squash any unnecessary commits to keep history clean as possible
Only 1 commit.
Place description for the changelog in PR so we can tally all changes for any future release
Fix OSS check then able to download from special mirror sites.