Skip to content
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

Redirect Loop Causes 414 Error in node-libcurl While Working Fine with Terminal curl #417

Open
jatin-vl opened this issue Sep 27, 2024 · 0 comments

Comments

@jatin-vl
Copy link

  1. Description
    I am encountering an issue where a simple GET request with automatic redirection works perfectly fine when run using the
    terminal curl command, but it results in an infinite redirect loop and eventually returns a 414 Request-URI Too Long error when
    using node-libcurl.

  2. Steps to Reproduce:
    2.1 Here is the basic setup:
    2.2 Terminal curl Request: When running the following command in the terminal:
    bash
    curl -X GET -I -L --insecure https://XXXXXX...
    The request works as expected, follows the redirects, and returns a 200 OK status after resolving the redirect.
    2.3 Now the behaviour from node-libcurl
    Initial URL: https://XXXXXX...
    302 Redirect to: https://XXXXXX.../login?ReturnUrl=%2F
    302 Redirect to: https://XXXXXX.../login?ReturnUrl=%252F
    302 Redirect to: https://XXXXXX.../login?ReturnUrl=%25252F

  3. Key Observations:
    The same URL works when using terminal curl with the -L option (follow redirects) and --insecure.
    The issue seems to be caused by improper handling of percent-encoded characters during the redirection process.
    The repeated percent-encoding during each redirect is likely causing the infinite loop and the 414 error.

    Environment:
    Node.js Version: 20.17.0
    node-libcurl Version: 4.0.0
    Operating System: Linux

  4. Additional Information:
    It seems that terminal curl correctly handles the percent-encoding when following redirects, while node-libcurl is not. This behavior
    is unexpected and leads to infinite redirects that result in a 414 error.

I would appreciate any insights or advice on how to resolve this issue or if there are specific configurations in node-libcurl that I might be missing.

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

No branches or pull requests

1 participant