Skip to content

cURL Follow Redirect 301 #503

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

Closed
YarGnawh opened this issue Apr 29, 2015 · 5 comments
Closed

cURL Follow Redirect 301 #503

YarGnawh opened this issue Apr 29, 2015 · 5 comments

Comments

@YarGnawh
Copy link

should add -L it to xml="$(curl $url 2>/dev/null)"

__dnvm_find_latest() {
    local platform=$1
    local arch=$2

    if [ -z $platform ]; then
        local platform="mono"
    fi

    if ! __dnvm_has "curl"; then
        printf "%b\n" "${Red}$_DNVM_COMMAND_NAME needs curl to proceed. ${RCol}" >&2;
        return 1
    fi

    if [[ $platform == "mono" ]]; then
        #dnx-mono
        local packageId="$_DNVM_RUNTIME_PACKAGE_NAME-$platform"
    else
        #dnx-coreclr-linux-x64
        local packageId="$_DNVM_RUNTIME_PACKAGE_NAME-$platform-$(__dnvm_current_os)-$arch"
    fi
    local url="$DNX_ACTIVE_FEED/GetUpdates()?packageIds=%27$packageId%27&versions=%270.0%27&includePrerelease=true&includeAllVersions=false"
    xml="$(curl -L $url 2>/dev/null)"
    echo $xml | grep \<[a-zA-Z]:Version\>* >> /dev/null || return 1
    version="$(echo $xml | sed 's/.*<[a-zA-Z]:Version>\([^<]*\).*/\1/')"
    echo $version
}
@davidfowl
Copy link
Member

/cc @glennc

@YarGnawh
Copy link
Author

The 301 HTTP status is because _DNVM_DEFAULT_FEED="https://nuget.org/api/v2" gets redirected to https://www.nuget.org/api/v2. Should probably just add in the www

@darthdeus
Copy link

Adding www in the URL doesn't seem to help

$ dnvm install stable
Default stable feed (https://nuget.org/api/v2) is being overridden by the value of the DNX_FEED variable (https://www.nuget.org/api/v2/package/dnx-mono/stable).
Downloading dnx-mono.stable from https://www.nuget.org/api/v2/package/dnx-mono/stable
Download: https://www.nuget.org/api/v2/package/dnx-mono/stable/package/dnx-mono/stable
######################################################################## 100.0%
dnx-mono.stable was not found in repository https://www.nuget.org/api/v2/package/dnx-mono/stable
This is most likely caused by the feed not having the version that you typed. Check that you typed the right version and try again. Other possible causes are the feed doesn't have a DNX of the right name format or some other error caused a 404 on the server.

@YarGnawh
Copy link
Author

try version 1.0.0-beta4.

~ dnvm upgrade -f
Determining latest version
Latest version is 1.0.0-beta4
Forcing download by deleting /Users/rayhwang/.dnx/runtimes/dnx-mono.1.0.0-beta4 directory
Downloading dnx-mono.1.0.0-beta4 from https://www.nuget.org/api/v2
Download: https://www.nuget.org/api/v2/package/dnx-mono/1.0.0-beta4
######################################################################## 100.0%
Installing to /Users/rayhwang/.dnx/runtimes/dnx-mono.1.0.0-beta4
Adding /Users/rayhwang/.dnx/runtimes/dnx-mono.1.0.0-beta4/bin to process PATH
Updating alias 'default' to 'dnx-mono.1.0.0-beta4'

@muratg
Copy link
Contributor

muratg commented Apr 29, 2015

Tracked in aspnet/dnvm#235

@muratg muratg closed this as completed Apr 29, 2015
jkotalik pushed a commit that referenced this issue Nov 1, 2018
ryanbrandenburg pushed a commit that referenced this issue Nov 19, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants