Cookies not working and proposed fix.

Issue #9 resolved
Johnny Depp created an issue

I could only get it to work when I changed the following in leech and leech-defualt

from:

![ ! -z "$COOKIE" ] && CURL_COOKIE_OPTS="-b '$COOKIE'"

to:

![ ! -z "$COOKIE" ] && CURL_COOKIE_OPTS="-b $COOKIE"

I can now use COOKIE="/path/to/cookie.txt" without issue. Tested on Debian Jessie.

Comments (9)

  1. Aleksey Tulinov repo owner

    Thanks for looking into this. I've applied fix in d450d61 along with some other fixes in previous commits. You could let me know if all changes work for you, otherwise i'll mark this issue as resolved in a couple of weeks.

  2. Johnny Depp reporter

    I'm testing with cookie.txt (no spaces in path). Your addition to leech-defualt produced:

    Failed: 1 (Error: invalid or corrupt torrent file)
    

    It works with:

    cd "$LEECH_DOWNLOADS_DIR" && exec curl -s -f -k -L -g \
        --connect-timeout "$LEECH_TIMEOUT" --max-time "$LEECH_TIMEOUT" \
        $CURL_COOKIE_OPTS \
        -C - \
        "$LEECH_URL" >"$OUTPUT"
    
  3. Aleksey Tulinov repo owner

    Your fix is fine, but i don't like the inconsistency in how it worked when downloading feed and didn't work when downloading file. I think it might be considered regression introduced in 33fccd9d (released in leech 1.6), i reverted those changes in 34dc380 (master).

    Now it will pass $COOKIE directly to cURL without intermediate steps, i believe this should work as expected. If it still doesn't - please let me know.

  4. Aleksey Tulinov repo owner

    Thank you for reporting this. Fix will be included into next leech release - couple of weeks from now if nothing else pops up.

  5. Aleksey Tulinov repo owner
    • changed status to open

    I'm reopening this. I remembered why original change (33fccd9d) that broke cookies was made, it's related to a message on OpenWRT forum:

    I noticed that if $COOKIE is not set, the '-b' flag is immediately followed by $FOOD, leading to the following error: Downloading feed: http://..../ Failed: 4

    cURL error 4 is:

    CURLE_NOT_BUILT_IN (4) A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision. This means that a feature or option was not enabled or explicitly disabled when libcurl was built and in order to get it to function you have to get a rebuilt libcurl.

    So apparently original problem was in cookies support not being built into cURL.

    In latest changes leech will always set -b option again. So change to fix cookies (34dc380) is potentially bad and need to be reevaluated

  6. Aleksey Tulinov repo owner

    I don't see a point to look into issue reported on OpenWrt forum any further. This fix will be released in a couple of weeks or so in leech 1.7.

  7. Log in to comment