Giter Club home page Giter Club logo

curlie's People

Contributors

0mp avatar ajlanghorn avatar aliesbelik avatar aurieh avatar blackheaven avatar bored-engineer avatar dependabot[bot] avatar dezren39 avatar dmgk avatar donniewest avatar equal-l2 avatar frzam avatar jakewarren avatar jelloeater avatar js-everts avatar judaew avatar kbd avatar mateusz834 avatar mbodock avatar misery avatar nvllsvm avatar rhnvrm avatar rs avatar rugwirobaker avatar simon04 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

curlie's Issues

application/json accept header included even when no data passed

When no explicit Accept header nor any json payload (e.g., foo=bar, quz=42) are specified in the request, the following is a difference in handling wrt httpie:

$ curlie -v get http://example.net
* ...
GET / HTTP/1.1
Host: example.net
User-Agent: curl/7.64.1
Accept: application/json, */*

HTTP/1.1 200 OK
...

That is, curlie includes and gives preference to application/json in the Accept header in these cases. In contrast, httpie simply includes Accept: */*, which seems more flexible in general:

$ http -v get http://example.net
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: example.net
User-Agent: HTTPie/3.2.1
...

fwiw, CURL itself also just includes Accept: */*:

➜  ~ curl -v http://example.net
*   Trying 2606:2800:220:1:248:1893:25c8:1946...
* TCP_NODELAY set
* Connected to example.net (2606:2800:220:1:248:1893:25c8:1946) port 80 (#0)
> GET / HTTP/1.1
> Host: example.net
> User-Agent: curl/7.64.1
> Accept: */*
>
...

httpie format headers put in twice

λ echo '{"s3_input":"abcwav/sample_mono.wav", "s3_output":"abcmp3/output/0x212_a1.mp3"}' | curlie --curl POST https://myapp.net/encode \
Cache-Control:no-cache \
Content-Type:application/json

output

curl -X POST -H Cache-Control:no-cache -H Content-Type:application/json https://myapp.net/encode -s -S -v -d@- -H "Content-Type: application/json" -H "Accept: application/json, */*"

which should be

curl -X POST https://myapp.net/encode -s -S -v -d@- -H "Content-Type: application/json" -H "Accept: application/json, */*"

Deadlock with --version flag

Windows 10 and Powershell 7.3.8
curlie 1.7.1

curlie --version                                                                                                                                                                         

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
os/exec.(*Cmd).Wait(0xc00013a160)
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:518 +0x188
os/exec.(*Cmd).Run(0xc00002c180)
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:341 +0x39
main.main()
        /home/runner/work/curlie/curlie/main.go:167 +0x1485

goroutine 18 [chan receive]:
main.(*blockedWrite).Write(0xc0000da000, {0xc0001c4000, 0x11b, 0x8000})
        /home/runner/work/curlie/curlie/main.go:199 +0x35
io.copyBuffer({0x36c500, 0xc0000da000}, {0x36c560, 0xc0000e8000}, {0x0, 0x0, 0x0})
        /opt/hostedtoolcache/go/1.17.13/x64/src/io/io.go:425 +0x204
io.Copy(...)
        /opt/hostedtoolcache/go/1.17.13/x64/src/io/io.go:382
os/exec.(*Cmd).writerDescriptor.func1()
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:311 +0x3a
os/exec.(*Cmd).Start.func1(0x0)
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:444 +0x25
created by os/exec.(*Cmd).Start
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:443 +0x965

I also got a deadlock when trying to fetch JSON data

Same command works in curlie but not in curl

I am trying to run a POST request in vanilla cURL, but failing at it. I can easily run it in curlie (I expect the 500):

$ curlie -v -H 'X-SLURM-USER-TOKEN: someLongToken' -H 'X-SLURM-USER-NAME: lmdamato' -X POST -d '{"job":{"environment":{"LD_LIBRARY_PATH":"/lib/:/lib64/:/usr/local/lib","PATH":"/bin:/usr/bin/:/usr/local/bin/"},"name":"my_test_hello_world_job","partition":"QT","qos":"medium"},"script":"#!/bin/bash\n/bin/hostname"}' http://myslurmhost:6820/slurm/v0.0.37/job/submit
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to myslurmhost (127.0.0.1) port 6820 (#0)
POST /slurm/v0.0.37/job/submit HTTP/1.1
Host: myslurmhost:6820
User-Agent: curl/7.61.1
X-SLURM-USER-TOKEN: someLongToken
X-SLURM-USER-NAME: lmdamato
Content-Type: application/json
Accept: application/json, */*
Content-Length: 217

{
    "job": {
        "environment": {
            "LD_LIBRARY_PATH": "/lib/:/lib64/:/usr/local/lib",
            "PATH": "/bin:/usr/bin/:/usr/local/bin/"
        },
        "name": "my_test_hello_world_job",
        "partition": "QT",
        "qos": "medium"
    },
    "script": "#!/bin/bash\n/bin/hostname"
}


* upload completely sent off: 217 out of 217 bytes
HTTP/1.1 500 INTERNAL ERROR
Connection: Close
Content-Length: 385
Content-Type: application/json

* Closing connection 0
{
    "meta": {
        "plugin": {
            "type": "openapi\/v0.0.37",
            "name": "Slurm OpenAPI v0.0.37"
        },
        "Slurm": {
            "version": {
                "major": 21,
                "micro": 7,
                "minor": 8
            },
            "release": "21.08.7"
        }
    },
    "errors": [
        {
            "error_code": 5005,
            "error": "Zero Bytes were transmitted or received"
        }
    ]
}

But the exact same command in vanilla cURL won't work:

$ curl -v -H 'X-SLURM-USER-TOKEN: someLongToken' -H 'X-SLURM-USER-NAME: lmdamato' -X POST -d '{"job":{"environment":{"LD_LIBRARY_PATH":"/lib/:/lib64/:/usr/local/lib","PATH":"/bin:/usr/bin/:/usr/local/bin/"},"name":"my_test_hello_world_job","partition":"QT","qos":"medium"},"script":"#!/bin/bash\n/bin/hostname"}' http://myslurmhost:6820/slurm/v0.0.37/job/submit
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to myslurmhost (127.0.0.1) port 6820 (#0)
> POST /slurm/v0.0.37/job/submit HTTP/1.1
> Host: myslurmhost:6820
> User-Agent: curl/7.61.1
> Accept: */*
> X-SLURM-USER-TOKEN: someLongToken
> X-SLURM-USER-NAME: lmdamato
> Content-Length: 217
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 217 out of 217 bytes
< HTTP/1.1 400 BAD REQUEST
< Connection: Close
< Content-Length: 22
< Content-Type: text/plain
< 
* Closing connection 0
Unable to parse query.

Can someone help me understand why?

How to tell installed version?

I'm working on publishing curlie to https://webinstall.dev/curlie (and I'll PR as an additional install method once I'm done), but I need to know what version of curlie is presently installed to know whether or not to re-install a new version.

How can I tell which version is the installed version?

This gives me the curl version only:

curlie --version

panic: close of closed channel

After updating to the latest version I'm getting this panic

panic: close of closed channel

Happens with both homebrew and webi installs on macOS. To reproduce run

curlie -L google.com

Supply default options via environment variable

Thank you for curlie ❤️
I find myself stumbling over curl's behavior of returning a 0 exit code when a >= 400 status code was returned from the server. The -f parameters solves that issue for me but supplying it to every curlie command is tedious. I was wondering whether you'd find it acceptable to supply parameters via environment variables or even a configuration file.

Incorrect version info in `--version`

curlie --version shows

curl 7.82.0 (x86_64-pc-linux-gnu) libcurl/7.82.0 OpenSSL/1.1.1m zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.47.0
Release-Date: 2022-03-05

instead of

curlie 1.6.7 (x86_64-pc-linux-gnu) libcurl/7.82.0 OpenSSL/1.1.1m zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.47.0
Release-Date: 2022-03-05

Please bump golang.org/x/sys dependency

The version of golang.org/x/sys this package depends on is too outdated to support recent platforms such as riscv64-freebsd. Please bump the dependency to the most recent version to fix the build.

HTTPie JSON array syntax doesn’t work

With HTTPie and xh, I can pass in a JSON item as an array:

xh -v httpbin.org/post tables[]=users
# or 
http -v httpbin.org/post tables[]=users

This sends a JSON object:

{
    "tables": [
        "users"
    ]
}

This syntax doesn’t work in curlie. It sends this instead:

{
    "tables[]": "users"
}

Avoid using black or white font colors

This is currently not usable for users using white background terminal. Is there a config for setting colors?

image

In any case, I would like to suggest avoiding white and black colors, so that it works everywhere without configuring (if at all configuration is available). This "color ban" is pretty standard in most CLIs that output colors.

Bad handling of --proxy curl option

curlie --curl --proxy 10.42.42.4:13128 http://perdu.com
gives
curl --proxy -H http://perdu.com http://10.42.42.4:13128 -s -S -v -H "Accept: application/json, */*"
where it should give
curl --proxy 10.42.42.4:13128 http://perdu.com -s -S -v -H "Accept: application/json, */*"

The problem is in the parsing of curl -h output, proxy option line is (at least in my cur version)
-x, --proxy [protocol://]host[:port] Use this proxy
and does not contain <.*?> as expected by args/gen.sh

curl --version
curl 7.72.0 (x86_64-pc-linux-gnu) libcurl/7.72.0 OpenSSL/1.1.1h zlib/1.2.11 zstd/1.4.5 libidn2/2.3.0 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.41.0 Release-Date: 2020-08-19 Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd

OPTIONS method gets interpreted as a URL

Is there any way to make an OPTIONS request with curlie? It's always interpreting it as a URL for me.

➜ curlie GET https://example.com
HTTP/2 200
etc. etc.

➜ curlie OPTIONS https://example.com
curl: (6) Could not resolve host: OPTIONS

➜ curlie OPTIONS https://example.com --curl
curl -H https://example.com http://OPTIONS -s -S -v -H "Accept: application/json, */*"

Coloring HTML ouput

HTTPie colors HTML output in addition to JSON. From what I see, Curlie only colors JSON. Can HTML coloring be added?

Prints junk to screen in Windows Console (cmd.exe)

Re: @bitcrazed's comment #12 (comment):
Apparently Console can support colors, but we need a special syscall SetConsoleMode for Windows to do so.

I think Go's x/sys/windows package exposes the necessary GetConsoleMode and SetConsoleMode syscalls, so this should be doable.

Basic flow:

  1. GetConsoleMode
  2. OR with ENABLE_VIRTUAL_TERMINAL_PROCESSING
  3. SetConsoleMode
    • If ERROR, no color support => disable color
    • else, has color support

I probably won't get to this right away, but I've left enough info for someone else to be able to fix it if they have the time and inclination before I do.

@rs Want to tag with with Up For Grabs / Good First Issue? I think any Windows + Go developer should be able to handle this (and I can post it in the #golang Slack as well)

Feature Request: Session Support

curl allows users to support cookie based sessions with the --cookie-jar and --cookie flags.

httpie has similar functionality with the --session flag.

Are there any plans to add similar functionality with curlie?

If there is already a way to do this (since curlie is a wrapper around curl), I'm not seeing a way to do this in the docs.

Incorrect handling of single quotes in JSON output

Curlie is incorrectly handling single quotes in JSON output, where single quotes are removed from the output.

{
        "test": "Single 'quotes' inside 'this' string are gone"
}

becomes:

{
        "test": "Single quotes inside this string are gone"
}

Difference in (-d) parsing between curlie and curl

It looks like curlie gets a little confused when passing -d:

$ curlie https://httpbin.org/post -d 'foo=bar'
...
{
    "args": {

    },
    "data": "foo=bar&{\"foo\":\"bar\"}",
    "files": {

    },
    "form": {

    },
    "headers": {
        "Accept": "application/json, */*",
        "Content-Length": "21",
        "Content-Type": "application/json",
        "Host": "httpbin.org",
        "User-Agent": "curl/7.64.1"
    },
    "json": null,
    ...
}
$  curl https://httpbin.org/post -d 'foo=bar'
{
  "args": {},
  "data": "",
  "files": {},
  "form": {
    "foo": "bar"
  },
  "headers": {
    "Accept": "*/*",
    "Content-Length": "7",
    "Content-Type": "application/x-www-form-urlencoded",
    "Host": "httpbin.org",
    "User-Agent": "curl/7.64.1"
  },
  "json": null,
  ...
}

I'm assuming this is a bug where it's doing both JSON parsing and passing data?

Allow plain curl input?

I like the output formatting or Curlie and also its HTTPie-like syntax sugar but sometimes, I have a curl command in my clipboard and would love to paste it to Curlie, something like this:

curlie --raw -H 'Some-Header: ABC' https://example.com

Do you think this would be possible? I can imagine some challenges around various curl flags but generally, it would be very useful if Curlie understood some of the basic curl switches.

Support some HTTPie options like `--print`?

In curl, it's surprisingly difficult to output some things, like request & response headers without the TLS negotiation (see e.g. here).

HTTPie has a useful -p / --print flag, I realize that curlie is just a frontend for curl so this is probably out of scope but I wanted to ask what you think about it, or if there are other tricks of how to take the already grayed out text of the -v / --verbose option and remove it completely.

--write-out formatted incorrectly

One of my favourite curl features is the ability to display additional info via the --write-out or -w parameter.
More info on this parameter: https://ec.haxx.se/usingcurl/usingcurl-verbose/usingcurl-writeout

I have for example a "template" at ~/.curl-extras with the following contents:

size_request:  %{size_request}b\n
size_download: %{size_download}b\n
time_total:    %{time_total}s\n

This appends additional info (timings and sizes, in this case) to the output, e.g.:

➜ curl "httpbin.org/headers" -w "@$HOME/.curl-extras"  
{
  "headers": {
    "Accept": "*/*", 
    "Host": "httpbin.org", 
    "User-Agent": "curl/7.64.1", 
    "X-Amzn-Trace-Id": "Root=1-5f3a7921-d59081ec96facb5e0d05149c"
  }
}

size_request:  82b
size_download: 173b
time_total:    0.234310s

However, with curlie the newlines are removed and some unexpected colors are applied:

HTTP/1.1 200 OK
Date: Mon, 17 Aug 2020 12:33:39 GMT
Content-Type: application/json
Content-Length: 191
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

{
    "headers": {
        "Accept": "application/json, */*",
        "Host": "httpbin.org",
        "User-Agent": "curl/7.64.1",
        "X-Amzn-Trace-Id": "Root=1-5f3a7923-ec04c2802d0278c01cbb1700"
    }
}
size_request: 100bsize_download: 191btime_total: 0.226571s%

Screenshot 2020-08-17 at 15 16 30

Hopefully this is something that can be fixed - though I can imagine this being a challenge as I expect that curlie tries to format all of curls stdout.

Allow disabling reading from `stdin`

When using curlie in a script, I have an issue due those lines where it unconditionally tries to read from stdin, even if I try to close the standard input in my script before calling curlie.

Due to the way the endpoint I'm trying to call works, this leads to a 404 because of it.

A flag to disable that automatic behavior sounds like a good fix to me.

[Windows] fatal error: all goroutines are asleep - deadlock!

$ curlie example.com
HTTP/1.1 200 OK
Age: 171654
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Sun, 14 May 2023 01:37:42 GMT
Etag: "3147526947+ident"
Expires: Sun, 21 May 2023 01:37:42 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Server: ECS (sab/5785)
Vary: Accept-Encoding
X-Cache: HIT
Content-Length: 1256

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
os/exec.(*Cmd).Wait(0xc000148160)
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:518 +0x188
os/exec.(*Cmd).Run(0xc000072120)
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:341 +0x39
main.main()
        /home/runner/work/curlie/curlie/main.go:167 +0x1485

goroutine 6 [chan receive]:
main.(*blockedWrite).Write(0xc0000040d8, {0xc000086000, 0x4e8, 0x8000})
        /home/runner/work/curlie/curlie/main.go:199 +0x35
io.copyBuffer({0x92c500, 0xc0000040d8}, {0x92c560, 0xc000006050}, {0x0, 0x0, 0x0})
        /opt/hostedtoolcache/go/1.17.13/x64/src/io/io.go:425 +0x204
io.Copy(...)
        /opt/hostedtoolcache/go/1.17.13/x64/src/io/io.go:382
os/exec.(*Cmd).writerDescriptor.func1()
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:311 +0x3a
os/exec.(*Cmd).Start.func1(0x0)
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:444 +0x25
created by os/exec.(*Cmd).Start
        /opt/hostedtoolcache/go/1.17.13/x64/src/os/exec/exec.go:443 +0x965

while curl works fine

$ curl -v example.com
*   Trying 93.184.216.34:80...
* Connected to example.com (93.184.216.34) port 80 (#0)
> GET / HTTP/1.1
> Host: example.com
> User-Agent: curl/8.0.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Age: 79461
< Cache-Control: max-age=604800
< Content-Type: text/html; charset=UTF-8
< Date: Sun, 14 May 2023 01:38:50 GMT
< Etag: "3147526947"
< Expires: Sun, 21 May 2023 01:38:50 GMT
< Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
< Server: ECS (sab/5751)
< Vary: Accept-Encoding
< X-Cache: HIT
< Content-Length: 1256
<
<!doctype html>
<html>
<head>
    <title>Example Domain</title>

    <meta charset="utf-8" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">
    body {
        background-color: #f0f0f2;
        margin: 0;
        padding: 0;
        font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

    }
    div {
        width: 600px;
        margin: 5em auto;
        padding: 2em;
        background-color: #fdfdff;
        border-radius: 0.5em;
        box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
    }
    a:link, a:visited {
        color: #38488f;
        text-decoration: none;
    }
    @media (max-width: 700px) {
        div {
            margin: 0 auto;
            width: auto;
        }
    }
    </style>
</head>

<body>
<div>
    <h1>Example Domain</h1>
    <p>This domain is for use in illustrative examples in documents. You may use this
    domain in literature without prior coordination or asking for permission.</p>
    <p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>
* Connection #0 to host example.com left intact

Windows 11 (10.0.22624.1755), installed with scoop

Build instructions?

How do I build this project from git myself without waiting for officially releases?

Cut a new release for v1.4.1

Would you mind cutting a new release for v1.4.1?

Tokens directly available at https://github.com/settings/tokens

export GITHUB_TOKEN=xxxx
git clone [email protected]:rs/curlie.git
pushd curlie
    git tag -a v1.4.1 -m "Windows, color, and version updates"
    git push --tags

    goreleaser

I realize that you've done this several times already, but I thought giving the copy/paste might make it more convenient.

curl option --aws-sigv4 values get interpreted as headers

When I am using the newer curl option aws-sigv4, curlie interprets it as headers:

curlie https://REDACTED.execute-api.eu-west-1.amazonaws.com/REDACTED --curl --aws-sigv4 "aws:amz:eu-west-1" --user "$(aws configure get aws_access_key_id):$(aws configure get aws_secret_access_key)"

curl --aws-sigv4 --user REDACTED:REDACTED -H aws:amz:eu-west-1 https://REDACTED.execute-api.eu-west-1.amazonaws.com/REDACTED -s -S -v -H "Accept: application/json, */*"

Pagination flag

Idk if I am missing something, but it would be nice to have a --paginate flag or the like (with optionally a custom pager or just using the env PAGER with default to less) because otherwise I have to do this to preserve the coloring:

unbuffer curlie URL | less

output duplicated when using HEAD requests

The output is duplicated when using the -I, --head options.

curlie_head

I don't get the duplicated output when using curlie -I -s httpbin.org/headers but then it isn't colorized.

I'll send a PR if I am able to figure out why it's happening. Awesome program!

JSONRPC request failing with HTTP/0.9 not allowed

Hello, I'm trying to issue a jsonrpc request and curl complains about the http version.

With httpie:

$ http localhost:8901 method=foobar params:='[""]'

http: error: ConnectionError: ('Connection aborted.', BadStatusLine('Content-Length: 75\r\n')) while doing a POST request to URL: http://localhost:8901/

With curlie:

$ curlie localhost:8901 method=foobar params:='[""]'
curl: (1) Received HTTP/0.9 when not allowed

Version:

$ curlie --version
curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.8 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.10.0 nghttp2/1.52.0
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

Feature request: file embedding (@file and =@file and :=@file)

It would be great to support the file embedding syntax from httpie. From the httpie docs:

      '@' Form file fields (only with --form or --multipart):

          cv@~/Documents/CV.pdf
          cv@'~/Documents/CV.pdf;type=application/pdf'

      '=@' A data field like '=', but takes a file path and embeds its content:

           essay=@Documents/essay.txt

      ':=@' A raw JSON field like ':=', but takes a file path and embeds its content:

          package:=@./package.json

Curlie not formating Json if it starts with a square bracket

Expected:

$ ./curlie localhost:8080
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 05 May 2020 09:51:37 GMT
Content-Length: 41

[
    {
        "key": "value"
    },
    {
        "key": "another value"
    }
]

Got:

$ curlie localhost:8080
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 05 May 2020 09:49:47 GMT
Content-Length: 41

[{"key":"value"},{"key":"another value"}]

Inquiry about Integrating Curlie Documentation into tldr

Hello Curlie Team,

I've been a user and fan of Curlie for some time now, and I greatly appreciate the efforts your team has put into creating a user-friendly interface for working with cURL commands.

I recently came across the tldr project (tldr-pages), which offers simplified and practical help pages for various command-line tools. It occurred to me that Curlie's ease of use and feature-rich frontend for cURL could be a valuable addition to the tldr project. This could help introduce more users to Curlie and provide them with a straightforward way to learn and use its capabilities.

I'm curious if there are any plans or discussions within your team to integrate Curlie's documentation and examples into the tldr-pages collection. It seems like a great opportunity to enhance the visibility and adoption of Curlie, while also contributing to the tldr community.

Additionally, I'd like to express my willingness to contribute to this effort if the Curlie team is interested. Whether it's assisting with documentation, providing examples, or helping with any technical aspects, I'd be more than happy to contribute my time and skills.

Thank you for your hard work on Curlie, and I'm looking forward to hearing your thoughts on this potential collaboration.

Details on error filtered out

curlie is fantastic, however sometimes it seems some errors are hidden. For example, curl shows:

$ command curl -OL https://get-ghcup.haskell.org | sh
curl: Remote file name has no length!
curl: (23) Failed writing received data to disk/application

But, curlie shows

$ curlie -OL https://get-ghcup.haskell.org | sh
curl: (23) Failed writing received data to disk/application

As I forgot I aliased curlie to curl, I assumed the error was something to do with my computer running out of storage, rather than the no-length remote file name or using the -O option on a file that didn't have the required metadata. Maybe the errors on curlie should match?

Regards
Edwin

Invalid category provided

First... great idea to "merge" httpie and curl.

I tried curlie with ArchLinux and curl 7.73.0. If I type just "curlie" I do not get a correct "help".

$ curlie
Usage: curlie [options...] [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
Invalid category provided, here is a list of all categories:

 auth        Different types of authentication methods
 connection  Low level networking operations
 curl        The command line tool itself
 dns         General DNS options
 file        FILE protocol options
 ftp         FTP protocol options
 http        HTTP and HTTPS protocol options
 imap        IMAP protocol options
 misc        Options that don't fit into any other category
 output      The output of curl
 pop3        POP3 protocol options
 post        HTTP Post specific options
 proxy       All options related to proxies
 scp         SCP protocol options
 sftp        SFTP protocol options
 smtp        SMTP protocol options
 ssh         SSH protocol options
 telnet      TELNET protocol options
 tftp        TFTP protocol options
 tls         All TLS/SSL related options
 upload      All options for uploads
 verbose     Options related to any kind of command line output of curl

If I try this on my AlpineLinux with curl 7.71.1 it seems to work:

$ curlie
Usage: curlie [options...] [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
     --abstract-unix-socket <path> Connect via abstract Unix domain socket
     --alt-svc <file name> Enable alt-svc with this cache file
     --anyauth       Pick any authentication method
 -a, --append        Append to target file when uploading
     --basic         Use HTTP Basic Authentication
     --cacert <file> CA certificate to verify peer against
     --capath <dir>  CA directory to verify peer against
 -E, --cert <certificate[:password]> Client certificate file
...

Looks like curlie do not like newest curl. ;-)

btw: I added an AlpineLinux package https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/14110

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.