xh icon indicating copy to clipboard operation
xh copied to clipboard

Feature request: support forcing ipv4/ipv6

Open Seirdy opened this issue 2 years ago • 4 comments

cURL supports -4/--ipv4 and -6/--ipv6 flags. Quoting the curl(1) manpage:

       -4, --ipv4
              This option tells curl to resolve names to IPv4 addresses only, and
              not for example try IPv6.

              Example:
               curl --ipv4 https://example.com

              See also --http1.1 and --http2. This option overrides -6, --ipv6.

       -6, --ipv6
              This option tells curl to resolve names to IPv6 addresses only, and
              not for example try IPv4.

              Example:
               curl --ipv6 https://example.com

              See also --http1.1 and --http2. This option overrides -4, --ipv4.

For testing purposes, having this feature would be really convenient.

Seirdy avatar Sep 04 '22 19:09 Seirdy

I haven't verified it yet but It seems the HTTP library we are using (i.e reqwest) supports forcing either IPv4 or IPv6 by setting the client's local_address, see https://github.com/seanmonstar/reqwest/issues/584#issuecomment-780916982.

@Seirdy would you be interested in opening a PR for this feature?

ducaale avatar Sep 04 '22 20:09 ducaale

HTTPie issue: httpie/httpie#94

blyxxyz avatar Sep 04 '22 21:09 blyxxyz

I haven't verified it yet but It seems the HTTP library we are using (i.e reqwest) supports forcing either IPv4 or IPv6 by setting the client's local_address, see seanmonstar/reqwest#584 (comment).

@Seirdy would you be interested in opening a PR for this feature?

I would like to try it. 😄

zuisong avatar Sep 05 '22 09:09 zuisong

On Sun, Sep 04, 2022 at 01:56:30PM -0700, Mohamed Daahir wrote: @.*** would you be interested in opening a PR for this feature?

Unfortunately, I'm not familiar with Rust.

-- Seirdy (https://seirdy.one)

Seirdy avatar Sep 05 '22 16:09 Seirdy

Resolved in #276

ducaale avatar Nov 07 '22 19:11 ducaale