Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

In 1869 the waffle iron was invented for people who had wrinkled waffles.


devel / comp.unix.shell / Re: The weird HTTP POST data transfer problem using curl.

SubjectAuthor
* Re: The weird HTTP POST data transfer problem using curl.Ben Bacarisse
`* Re: The weird HTTP POST data transfer problem using curl.hongy...@gmail.com
 `* Re: The weird HTTP POST data transfer problem using curl.Ben Bacarisse
  +- Re: The weird HTTP POST data transfer problem using curl.hongy...@gmail.com
  `* Re: The weird HTTP POST data transfer problem using curl.hongy...@gmail.com
   +- Re: The weird HTTP POST data transfer problem using curl.hongy...@gmail.com
   +- Re: The weird HTTP POST data transfer problem using curl.Helmut Waitzmann
   `* Re: The weird HTTP POST data transfer problem using curl.Ben Bacarisse
    `* Re: The weird HTTP POST data transfer problem using curl.hongy...@gmail.com
     `* Re: The weird HTTP POST data transfer problem using curl.Ben Bacarisse
      `* Re: The weird HTTP POST data transfer problem using curl.hongy...@gmail.com
       +- Re: The weird HTTP POST data transfer problem using curl.Janis Papanagnou
       +* Re: The weird HTTP POST data transfer problem using curl.Kaz Kylheku
       |`- Re: The weird HTTP POST data transfer problem using curl.Kenny McCormack
       `* Re: The weird HTTP POST data transfer problem using curl.Helmut Waitzmann
        +- Re: The weird HTTP POST data transfer problem using curl.hongy...@gmail.com
        `* Re: The weird HTTP POST data transfer problem using curl.Helmut Waitzmann
         `- Re: The weird HTTP POST data transfer problem using curl.hongy...@gmail.com

1
Re: The weird HTTP POST data transfer problem using curl.

<8735tp4u8j.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3926&group=comp.unix.shell#3926

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Thu, 10 Jun 2021 16:25:32 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <8735tp4u8j.fsf@bsb.me.uk>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="98633eaec156f0b9205697f3f0ffc1eb";
logging-data="5556"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/vstfu9aS4T2jq0+mT8690RwCGaOr8Jbs="
Cancel-Lock: sha1:mggMsROL4yrXfvzQ8IByDfpI7oc=
sha1:GKlB42kPjNbj/zgpJd35k4W7aCg=
X-BSB-Auth: 1.3aed9fb4a9bb44a8ccff.20210610162532BST.8735tp4u8j.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 10 Jun 2021 15:25 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com> writes:

> 2. Pass the value of ``--data'' as below failed:
>
> $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
> -H 'app_id: my-app-id' \
> -H 'app_key: my-app-key' \
> -H 'Content-Type: application/json' \
> --data '{ "src": "data:image/jpeg;base64,'$(base64 -i schrodinger.png)'" }'
> {"error":"SyntaxError: Unexpected end of JSON input","error_info": ...

You need ""s round the result of base64. The original was all inside
""s.

--data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'

--
Ben.

Re: The weird HTTP POST data transfer problem using curl.

<9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3927&group=comp.unix.shell#3927

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:620a:2ec:: with SMTP id a12mr1437581qko.92.1623373188832;
Thu, 10 Jun 2021 17:59:48 -0700 (PDT)
X-Received: by 2002:ac8:6885:: with SMTP id m5mr1658884qtq.268.1623373188658;
Thu, 10 Jun 2021 17:59:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Thu, 10 Jun 2021 17:59:48 -0700 (PDT)
In-Reply-To: <8735tp4u8j.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=40.83.115.116; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 40.83.115.116
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com> <8735tp4u8j.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
Subject: Re: The weird HTTP POST data transfer problem using curl.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 11 Jun 2021 00:59:48 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Fri, 11 Jun 2021 00:59 UTC

On Thursday, June 10, 2021 at 11:25:37 PM UTC+8, Ben Bacarisse wrote:
> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>
> > 2. Pass the value of ``--data'' as below failed:
> >
> > $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
> > -H 'app_id: my-app-id' \
> > -H 'app_key: my-app-key' \
> > -H 'Content-Type: application/json' \
> > --data '{ "src": "data:image/jpeg;base64,'$(base64 -i schrodinger.png)'" }'
> > {"error":"SyntaxError: Unexpected end of JSON input","error_info": ...
>
> You need ""s round the result of base64. The original was all inside
> ""s.
> --data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'

Still failed as shown following:

$ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
-H 'app_id: xxx' \
-H 'app_key: xxx' \
-H 'Content-Type: application/json' \
--data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'
{"error":"SyntaxError: Unexpected token \n in JSON at position 109","error_info":{"id":"json_syntax","message":"SyntaxError: Unexpected token \n in JSON at position 109"}}

What's wrong with my version above?

HY

Re: The weird HTTP POST data transfer problem using curl.

<87o8cd2l0e.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3928&group=comp.unix.shell#3928

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Fri, 11 Jun 2021 03:27:45 +0100
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <87o8cd2l0e.fsf@bsb.me.uk>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk>
<9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="91c561f73afa3ab3f3e32fc9f4e36d5e";
logging-data="3239"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194cHmQ32bkaHQHha2uRSqrQTzWWupakKo="
Cancel-Lock: sha1:tKoip6IDtY7Z5Y8SxS3YVyEUsOc=
sha1:KT76ZdAWMTeEORvgz9wcLCgV2qw=
X-BSB-Auth: 1.210f6cc430ae7a870704.20210611032745BST.87o8cd2l0e.fsf@bsb.me.uk
 by: Ben Bacarisse - Fri, 11 Jun 2021 02:27 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com> writes:

> On Thursday, June 10, 2021 at 11:25:37 PM UTC+8, Ben Bacarisse wrote:
>> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>>
>> > 2. Pass the value of ``--data'' as below failed:
>> >
>> > $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
>> > -H 'app_id: my-app-id' \
>> > -H 'app_key: my-app-key' \
>> > -H 'Content-Type: application/json' \
>> > --data '{ "src": "data:image/jpeg;base64,'$(base64 -i schrodinger.png)'" }'
>> > {"error":"SyntaxError: Unexpected end of JSON input","error_info": ...
>>
>> You need ""s round the result of base64. The original was all inside
>> ""s.
>> --data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'
>
> Still failed as shown following:
>
> $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
> -H 'app_id: xxx' \
> -H 'app_key: xxx' \
> -H 'Content-Type: application/json' \
> --data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'
> {"error":"SyntaxError: Unexpected token \n in JSON at position 109","error_info":{"id":"json_syntax","message":"SyntaxError: Unexpected token \n in JSON at position 109"}}
>
> What's wrong with my version above?

I thought it was a quoting problem, but it's a newline problem.
Apparently (I know nothing about the details of JSON) JSON strings can't
include newlines. The echo in the first version replaces them with
spaces. If that works, why change it?

If you don't like echo (or the spaces that result) you can use

$(base64 -w0 schrodinger.png)

if your base64 command has that option. Or you could

$(base64 schrodinger.png | tr -d '\n')

--
Ben.

Re: The weird HTTP POST data transfer problem using curl.

<cea3a692-c386-48bc-ae34-e378e764c725n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3929&group=comp.unix.shell#3929

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ac8:6d15:: with SMTP id o21mr2289853qtt.54.1623388547124;
Thu, 10 Jun 2021 22:15:47 -0700 (PDT)
X-Received: by 2002:a05:620a:4dd:: with SMTP id 29mr2194524qks.100.1623388546905;
Thu, 10 Jun 2021 22:15:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Thu, 10 Jun 2021 22:15:46 -0700 (PDT)
In-Reply-To: <87o8cd2l0e.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=211.23.211.42; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 211.23.211.42
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk> <9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cea3a692-c386-48bc-ae34-e378e764c725n@googlegroups.com>
Subject: Re: The weird HTTP POST data transfer problem using curl.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 11 Jun 2021 05:15:47 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Fri, 11 Jun 2021 05:15 UTC

On Friday, June 11, 2021 at 10:27:50 AM UTC+8, Ben Bacarisse wrote:
> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>
> > On Thursday, June 10, 2021 at 11:25:37 PM UTC+8, Ben Bacarisse wrote:
> >> "hongy...@gmail.com" <hongy...@gmail.com> writes:
> >>
> >> > 2. Pass the value of ``--data'' as below failed:
> >> >
> >> > $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
> >> > -H 'app_id: my-app-id' \
> >> > -H 'app_key: my-app-key' \
> >> > -H 'Content-Type: application/json' \
> >> > --data '{ "src": "data:image/jpeg;base64,'$(base64 -i schrodinger.png)'" }'
> >> > {"error":"SyntaxError: Unexpected end of JSON input","error_info": ...
> >>
> >> You need ""s round the result of base64. The original was all inside
> >> ""s.
> >> --data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'
> >
> > Still failed as shown following:
> >
> > $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
> > -H 'app_id: xxx' \
> > -H 'app_key: xxx' \
> > -H 'Content-Type: application/json' \
> > --data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'
> > {"error":"SyntaxError: Unexpected token \n in JSON at position 109","error_info":{"id":"json_syntax","message":"SyntaxError: Unexpected token \n in JSON at position 109"}}
> >
> > What's wrong with my version above?
> I thought it was a quoting problem, but it's a newline problem.
> Apparently (I know nothing about the details of JSON) JSON strings can't
> include newlines. The echo in the first version replaces them with
> spaces. If that works, why change it?
>
> If you don't like echo (or the spaces that result) you can use
>
> $(base64 -w0 schrodinger.png)
>
> if your base64 command has that option. Or you could
>
> $(base64 schrodinger.png | tr -d '\n')

Thank you. Both of the above two methods do the trick.

HY

Re: The weird HTTP POST data transfer problem using curl.

<7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3930&group=comp.unix.shell#3930

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a37:cc6:: with SMTP id 189mr2177306qkm.261.1623389111930;
Thu, 10 Jun 2021 22:25:11 -0700 (PDT)
X-Received: by 2002:ac8:47d4:: with SMTP id d20mr2222667qtr.243.1623389111777;
Thu, 10 Jun 2021 22:25:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Thu, 10 Jun 2021 22:25:11 -0700 (PDT)
In-Reply-To: <87o8cd2l0e.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.232; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.232
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk> <9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
Subject: Re: The weird HTTP POST data transfer problem using curl.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 11 Jun 2021 05:25:11 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Fri, 11 Jun 2021 05:25 UTC

On Friday, June 11, 2021 at 10:27:50 AM UTC+8, Ben Bacarisse wrote:
> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>
> > On Thursday, June 10, 2021 at 11:25:37 PM UTC+8, Ben Bacarisse wrote:
> >> "hongy...@gmail.com" <hongy...@gmail.com> writes:
> >>
> >> > 2. Pass the value of ``--data'' as below failed:
> >> >
> >> > $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
> >> > -H 'app_id: my-app-id' \
> >> > -H 'app_key: my-app-key' \
> >> > -H 'Content-Type: application/json' \
> >> > --data '{ "src": "data:image/jpeg;base64,'$(base64 -i schrodinger.png)'" }'
> >> > {"error":"SyntaxError: Unexpected end of JSON input","error_info": ...
> >>
> >> You need ""s round the result of base64. The original was all inside
> >> ""s.
> >> --data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'
> >
> > Still failed as shown following:
> >
> > $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
> > -H 'app_id: xxx' \
> > -H 'app_key: xxx' \
> > -H 'Content-Type: application/json' \
> > --data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'
> > {"error":"SyntaxError: Unexpected token \n in JSON at position 109","error_info":{"id":"json_syntax","message":"SyntaxError: Unexpected token \n in JSON at position 109"}}
> >
> > What's wrong with my version above?
> I thought it was a quoting problem, but it's a newline problem.

Why didn't it complain about the error message in my original failed version?

> Apparently (I know nothing about the details of JSON) JSON strings can't
> include newlines. The echo in the first version replaces them with
> spaces. If that works, why change it?

Though my original first version works, it's cumbersome/lengthy to some extent. So, I want to have a more concise solution.

>
> If you don't like echo (or the spaces that result) you can use
>
> $(base64 -w0 schrodinger.png)
>
> if your base64 command has that option. Or you could
>
> $(base64 schrodinger.png | tr -d '\n')
>
> --
> Ben.

Re: The weird HTTP POST data transfer problem using curl.

<cb939679-ede1-4e24-a665-6cd4d33407b4n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3931&group=comp.unix.shell#3931

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a37:9244:: with SMTP id u65mr2206678qkd.46.1623389248945;
Thu, 10 Jun 2021 22:27:28 -0700 (PDT)
X-Received: by 2002:a37:44cb:: with SMTP id r194mr2127699qka.425.1623389248740;
Thu, 10 Jun 2021 22:27:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Thu, 10 Jun 2021 22:27:28 -0700 (PDT)
In-Reply-To: <7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=103.142.140.222; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.142.140.222
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk> <9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk> <7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cb939679-ede1-4e24-a665-6cd4d33407b4n@googlegroups.com>
Subject: Re: The weird HTTP POST data transfer problem using curl.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 11 Jun 2021 05:27:28 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Fri, 11 Jun 2021 05:27 UTC

On Friday, June 11, 2021 at 1:25:14 PM UTC+8, hongy...@gmail.com wrote:
> On Friday, June 11, 2021 at 10:27:50 AM UTC+8, Ben Bacarisse wrote:
> > "hongy...@gmail.com" <hongy...@gmail.com> writes:
> >
> > > On Thursday, June 10, 2021 at 11:25:37 PM UTC+8, Ben Bacarisse wrote:
> > >> "hongy...@gmail.com" <hongy...@gmail.com> writes:
> > >>
> > >> > 2. Pass the value of ``--data'' as below failed:
> > >> >
> > >> > $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
> > >> > -H 'app_id: my-app-id' \
> > >> > -H 'app_key: my-app-key' \
> > >> > -H 'Content-Type: application/json' \
> > >> > --data '{ "src": "data:image/jpeg;base64,'$(base64 -i schrodinger.png)'" }'
> > >> > {"error":"SyntaxError: Unexpected end of JSON input","error_info": ...
> > >>
> > >> You need ""s round the result of base64. The original was all inside
> > >> ""s.
> > >> --data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'
> > >
> > > Still failed as shown following:
> > >
> > > $ curl -x socks5://127.0.0.1:18888 -X POST https://api.mathpix.com/v3/text \
> > > -H 'app_id: xxx' \
> > > -H 'app_key: xxx' \
> > > -H 'Content-Type: application/json' \
> > > --data '{ "src": "data:image/jpeg;base64,'"$(base64 -i schrodinger.png)"'" }'
> > > {"error":"SyntaxError: Unexpected token \n in JSON at position 109","error_info":{"id":"json_syntax","message":"SyntaxError: Unexpected token \n in JSON at position 109"}}
> > >
> > > What's wrong with my version above?
> > I thought it was a quoting problem, but it's a newline problem.
> Why didn't it complain about the error message in my original failed version?

I mean the error message mentioned above here, i.e., the newline problem.

> > Apparently (I know nothing about the details of JSON) JSON strings can't
> > include newlines. The echo in the first version replaces them with
> > spaces. If that works, why change it?
> Though my original first version works, it's cumbersome/lengthy to some extent. So, I want to have a more concise solution.
> >
> > If you don't like echo (or the spaces that result) you can use
> >
> > $(base64 -w0 schrodinger.png)
> >
> > if your base64 command has that option. Or you could
> >
> > $(base64 schrodinger.png | tr -d '\n')
> >
> > --
> > Ben.

Re: The weird HTTP POST data transfer problem using curl.

<83v96kdcep.fsf@helmutwaitzmann.news.arcor.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3932&group=comp.unix.shell#3932

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!J52mKkgZRa3ydCgpCCJ+Rg.user.gioia.aioe.org.POSTED!not-for-mail
From: nn.throt...@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Fri, 11 Jun 2021 10:38:06 +0200
Organization: Aioe.org NNTP Server
Lines: 37
Message-ID: <83v96kdcep.fsf@helmutwaitzmann.news.arcor.de>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk>
<9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk>
<7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
NNTP-Posting-Host: J52mKkgZRa3ydCgpCCJ+Rg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Cancel-Lock: sha1:k6Wx6f/1Ibo1DRCXvVU04AZbp0A=
X-Notice: Filtered by postfilter v. 0.9.2
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Mail-Copies-To: nobody
 by: Helmut Waitzmann - Fri, 11 Jun 2021 08:38 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com>:
>On Friday, June 11, 2021 at 10:27:50 AM UTC+8, Ben Bacarisse wrote:

>> I thought it was a quoting problem, but it's a newline problem.
>>
>
>Why didn't it complain about the error message in my original
>failed version?

In your original version, there weren't any newlines, because you
eliminated them by accident.

Read the docs to learn about the way the shell processes command
substitution ($( ... ), see
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03>)
and field splitting on unquoted expansions (see
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05>),
the way "echo" outputs its arguments (see
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html#tag_20_37_10>),
and the way the shell processes command substitution ($( ... ), see
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03>).

But I don't recommend using "echo":  As soon as there are
backslashes to be placed in the json data, "echo" might interpret
the backslashes, thus corrupting the json data.  Better use the
"base64" "-w" option with its argument 0, as suggested by Ben.

By the way, this is common shell knowledge.  You should really start
learning the shell.  Maybe, you'll have more success doing that
after you'll have learned the "exec" family of functions (see
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html#top>)
of the system interface.

Re: The weird HTTP POST data transfer problem using curl.

<87im2k38lf.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3933&group=comp.unix.shell#3933

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Fri, 11 Jun 2021 13:10:36 +0100
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <87im2k38lf.fsf@bsb.me.uk>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk>
<9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk>
<7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="91c561f73afa3ab3f3e32fc9f4e36d5e";
logging-data="7072"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ICMNOMKM45E+yG5Us2rV10aSB3iJb5Y0="
Cancel-Lock: sha1:qEWqOtQ0rAoQfp8POaCPsN9Cvs0=
sha1:n5Cyr1wHRq4YHN6PiFgCdJIjR2c=
X-BSB-Auth: 1.5b9ed22ee15a80a068e5.20210611131036BST.87im2k38lf.fsf@bsb.me.uk
 by: Ben Bacarisse - Fri, 11 Jun 2021 12:10 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com> writes:

> On Friday, June 11, 2021 at 10:27:50 AM UTC+8, Ben Bacarisse wrote:

>> I thought it was a quoting problem, but it's a newline problem.
>
> Why didn't it complain about the error message in my original failed
> version?

In that version (IIRC) the echo command substitution cases another round
of word splitting that replaces newlines with spaces.

--
Ben.

Re: The weird HTTP POST data transfer problem using curl.

<0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3934&group=comp.unix.shell#3934

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:622a:89:: with SMTP id o9mr3601619qtw.339.1623416570178;
Fri, 11 Jun 2021 06:02:50 -0700 (PDT)
X-Received: by 2002:a37:5847:: with SMTP id m68mr3570577qkb.111.1623416569972;
Fri, 11 Jun 2021 06:02:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Fri, 11 Jun 2021 06:02:49 -0700 (PDT)
In-Reply-To: <87im2k38lf.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.100; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.100
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk> <9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk> <7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
<87im2k38lf.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com>
Subject: Re: The weird HTTP POST data transfer problem using curl.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 11 Jun 2021 13:02:50 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Fri, 11 Jun 2021 13:02 UTC

On Friday, June 11, 2021 at 8:10:42 PM UTC+8, Ben Bacarisse wrote:
> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>
> > On Friday, June 11, 2021 at 10:27:50 AM UTC+8, Ben Bacarisse wrote:
>
> >> I thought it was a quoting problem, but it's a newline problem.
> >
> > Why didn't it complain about the error message in my original failed
> > version?
> In that version (IIRC) the echo command substitution cases another round
> of word splitting that replaces newlines with spaces.

If so, why the following version doesn't work?:

--data '{ "src": "data:image/jpeg;base64,'$(base64 schrodinger.png |tr '\n' ' ')'" }'

HY

Re: The weird HTTP POST data transfer problem using curl.

<874ke42kr0.fsf@bsb.me.uk>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3935&group=comp.unix.shell#3935

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Fri, 11 Jun 2021 21:45:39 +0100
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <874ke42kr0.fsf@bsb.me.uk>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk>
<9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk>
<7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
<87im2k38lf.fsf@bsb.me.uk>
<0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="91c561f73afa3ab3f3e32fc9f4e36d5e";
logging-data="16375"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18V5/efwhrjVXyqk1E19gJcjOP/jv+Zcbk="
Cancel-Lock: sha1:DMuL/KBf9WEoE8w8flbEib3rdgc=
sha1:rbAqCrckHm//M0st4/AJY2lriFM=
X-BSB-Auth: 1.3cc24199c4e14be81be3.20210611214539BST.874ke42kr0.fsf@bsb.me.uk
 by: Ben Bacarisse - Fri, 11 Jun 2021 20:45 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com> writes:

> On Friday, June 11, 2021 at 8:10:42 PM UTC+8, Ben Bacarisse wrote:
>> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>>
>> > On Friday, June 11, 2021 at 10:27:50 AM UTC+8, Ben Bacarisse wrote:
>>
>> >> I thought it was a quoting problem, but it's a newline problem.
>> >
>> > Why didn't it complain about the error message in my original failed
>> > version?
>> In that version (IIRC) the echo command substitution cases another round
>> of word splitting that replaces newlines with spaces.
>
> If so, why the following version doesn't work?:
>
> --data '{ "src": "data:image/jpeg;base64,'$(base64 schrodinger.png |tr
> '\n' ' ')'" }'

Because the spaces appear in different contexts.

Let's simplify:
$ cat lines
abc
def
ghi
$ printf "[%s]" '{'$(tr -d '\n' <lines)'}'
[{abcdefghi}]

After the format, printf gets one argument.

$ printf "[%s]" '{'$(tr '\n' ' ' <lines)'}'
[{abc][def][ghi][}]

printf gets four arguments. This is what you latest example does. The
--data option is not followed by one argument but by many depending on
how many lines the base64 encoding contains.

$ printf "[%s]" "$(echo '{'$(cat lines)'}')"
[{abc def ghi}]

printf gets one argument with newlines (except for the last) replaced by
the shell's word separator.

You need to find way to develop the skills to investigate these
questions for yourself.

--
Ben.

Re: The weird HTTP POST data transfer problem using curl.

<c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3936&group=comp.unix.shell#3936

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a0c:a99c:: with SMTP id a28mr7246606qvb.33.1623453119098;
Fri, 11 Jun 2021 16:11:59 -0700 (PDT)
X-Received: by 2002:a05:620a:4dd:: with SMTP id 29mr6342940qks.100.1623453118916;
Fri, 11 Jun 2021 16:11:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Fri, 11 Jun 2021 16:11:58 -0700 (PDT)
In-Reply-To: <874ke42kr0.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.120; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.120
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk> <9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk> <7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
<87im2k38lf.fsf@bsb.me.uk> <0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com>
<874ke42kr0.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com>
Subject: Re: The weird HTTP POST data transfer problem using curl.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 11 Jun 2021 23:11:59 +0000
Content-Type: text/plain; charset="UTF-8"
 by: hongy...@gmail.com - Fri, 11 Jun 2021 23:11 UTC

On Saturday, June 12, 2021 at 4:45:45 AM UTC+8, Ben Bacarisse wrote:
> "hongy...@gmail.com" <hongy...@gmail.com> writes:
>
> > On Friday, June 11, 2021 at 8:10:42 PM UTC+8, Ben Bacarisse wrote:
> >> "hongy...@gmail.com" <hongy...@gmail.com> writes:
> >>
> >> > On Friday, June 11, 2021 at 10:27:50 AM UTC+8, Ben Bacarisse wrote:
> >>
> >> >> I thought it was a quoting problem, but it's a newline problem.
> >> >
> >> > Why didn't it complain about the error message in my original failed
> >> > version?
> >> In that version (IIRC) the echo command substitution cases another round
> >> of word splitting that replaces newlines with spaces.
> >
> > If so, why the following version doesn't work?:
> >
> > --data '{ "src": "data:image/jpeg;base64,'$(base64 schrodinger.png |tr
> > '\n' ' ')'" }'
> Because the spaces appear in different contexts.
>
> Let's simplify:
> $ cat lines
> abc
> def
> ghi
> $ printf "[%s]" '{'$(tr -d '\n' <lines)'}'
> [{abcdefghi}]
>
> After the format, printf gets one argument.
>
> $ printf "[%s]" '{'$(tr '\n' ' ' <lines)'}'
> [{abc][def][ghi][}]
>
> printf gets four arguments. This is what you latest example does. The
> --data option is not followed by one argument but by many depending on
> how many lines the base64 encoding contains.
>
> $ printf "[%s]" "$(echo '{'$(cat lines)'}')"
> [{abc def ghi}]
>
> printf gets one argument with newlines (except for the last) replaced by
> the shell's word separator.
>
> You need to find way to develop the skills to investigate these
> questions for yourself.

Really. It's the heart of learning. In fact, I've tried to use `diff' and process substitution `<( echo ... )' to compare the different methods, but failed to dig out any valuable clues.
HY

Re: The weird HTTP POST data transfer problem using curl.

<sa0u5q$bb9$1@news-1.m-online.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3937&group=comp.unix.shell#3937

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Sat, 12 Jun 2021 02:12:42 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 21
Message-ID: <sa0u5q$bb9$1@news-1.m-online.net>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk>
<9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk>
<7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
<87im2k38lf.fsf@bsb.me.uk>
<0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com>
<874ke42kr0.fsf@bsb.me.uk>
<c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com>
NNTP-Posting-Host: 2001:a61:252a:da01:f478:8947:c0dc:d2d0
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1623456762 11625 2001:a61:252a:da01:f478:8947:c0dc:d2d0 (12 Jun 2021 00:12:42 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Sat, 12 Jun 2021 00:12:42 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com>
 by: Janis Papanagnou - Sat, 12 Jun 2021 00:12 UTC

On 12.06.2021 01:11, hongy...@gmail.com wrote:
> On Saturday, June 12, 2021 at 4:45:45 AM UTC+8, Ben Bacarisse wrote:
>>
>> You need to find way to develop the skills to investigate these
>> questions for yourself.
>
> Really. It's the heart of learning. In fact, I've tried to use `diff'
> and process substitution `<( echo ... )' to compare the different
> methods, but failed to dig out any valuable clues.

"Finding ways to develop skills" has nothing to do with diff, or echo,
or process substitution, or other "different [technical] methods".

I read it as a meta-suggestion and would interpret it as "learn how to
fish" as opposed to "try all the fishing tools until it somehow works".

Something like decomposing the task you have in small pieces and learn
how these pieces behave, then once you have confidence about the parts
compose the more complex code patterns.

Janis

Re: The weird HTTP POST data transfer problem using curl.

<20210611181311.893@kylheku.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3938&group=comp.unix.shell#3938

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 563-365-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Sat, 12 Jun 2021 01:27:02 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <20210611181311.893@kylheku.com>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk>
<9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk>
<7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
<87im2k38lf.fsf@bsb.me.uk>
<0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com>
<874ke42kr0.fsf@bsb.me.uk>
<c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com>
Injection-Date: Sat, 12 Jun 2021 01:27:02 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="039482fd1145e2a25a8c789836712d55";
logging-data="11413"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jTRe3kNaVtYZfmx7MV3yxMtj2TxOCSwU="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:dC9kPB34wBaEe2jmfhGdY3wOZSc=
 by: Kaz Kylheku - Sat, 12 Jun 2021 01:27 UTC

On 2021-06-11, hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
> Really. It's the heart of learning.

Given that you've been posting since 2009 and still struggle
with absolute basics, you might want to be to be looking for the path to
the "heart of retaining".

What's the use of learning, if it is gone the next day?

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: The weird HTTP POST data transfer problem using curl.

<sa222r$23l14$1@news.xmission.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3939&group=comp.unix.shell#3939

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Sat, 12 Jun 2021 10:25:31 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sa222r$23l14$1@news.xmission.com>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com> <874ke42kr0.fsf@bsb.me.uk> <c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com> <20210611181311.893@kylheku.com>
Injection-Date: Sat, 12 Jun 2021 10:25:31 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="2216996"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Sat, 12 Jun 2021 10:25 UTC

In article <20210611181311.893@kylheku.com>,
Kaz Kylheku <563-365-8930@kylheku.com> wrote:
>On 2021-06-11, hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
>> Really. It's the heart of learning.
>
>Given that you've been posting since 2009 and still struggle
>with absolute basics, you might want to be to be looking for the path to
>the "heart of retaining".
>
>What's the use of learning, if it is gone the next day?

Ya know... Usenetters like to make fun of:

1) People who post via Google Groups
and
2) People like hongy

But, if you get right down to it, if it weren't for one or both of these
kind of posters, we'd get no traffic here at all.

Now, there was a time (like, 4 decades ago), when zero traffic was actually
sort of the goal (because we had enough traffic that we knew we'd never
achieve that goal), but those days are now gone.

So, be careful what you wish for...

--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/GodDelusion

Re: The weird HTTP POST data transfer problem using curl.

<83y2bfarte.fsf@helmutwaitzmann.news.arcor.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3940&group=comp.unix.shell#3940

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!O4t09VtHg0gti8SL11Zguw.user.gioia.aioe.org.POSTED!not-for-mail
From: nn.throt...@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Sat, 12 Jun 2021 19:58:05 +0200
Organization: Aioe.org NNTP Server
Lines: 50
Message-ID: <83y2bfarte.fsf@helmutwaitzmann.news.arcor.de>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk>
<9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk>
<7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
<87im2k38lf.fsf@bsb.me.uk>
<0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com>
<874ke42kr0.fsf@bsb.me.uk>
<c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
NNTP-Posting-Host: O4t09VtHg0gti8SL11Zguw.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
X-Notice: Filtered by postfilter v. 0.9.2
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
Cancel-Lock: sha1:kNOri9knU3fTMOx/nqM2ucdHLAA=
Mail-Copies-To: nobody
 by: Helmut Waitzmann - Sat, 12 Jun 2021 17:58 UTC

"hongy...@gmail.com" <hongyi.zhao@gmail.com>:

>In fact, I've tried to use `diff' and process substitution `<( echo
>... )' to compare the different methods, but failed to dig out any
>valuable clues.

The problem is, that you apparently don't know what the shell does: 
The shell reads and parses its commandline.  Then, when it is going
to start a utility (in shell grammar speech: a simple command) it
has to construct an “execve” (see
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html#top>)
argument vector out of the command line.  Part of this construction
is field splitting, which occurs when expansions of shell parameters
(like “$variable”) or of command substitution (like “$(base64 …)”)
are used without double quotes.

You also apparently don't know, what the “echo” utility does.  If
you knew it, you wouldn't use it in your use case.  But as long as
you don't understand, what an “execve” argument vector is, you won't
understand, that “echo” does not just copy its shell command line to
standard output, because “echo” will never see such a thing like a
shell command line.  “echo” will process the elements of its given
“execve” argument vector, writing the results to standard output,
separated by single spaces.

And you apparently don't know, what the “base64” utility does.  If
you knew it, you would have given it the “-w” “0” parameters (like
Ben suggested).

First learn unix or linux – here: how utilities are started by means
of the “exec” family of functions –, then come back to the shell and
learn, how it constructs an “execve” argument vector out of its
commandline using quoted and unquoted variable expansions and quoted
and unquoted command substitutions.

As long as you don't know that, you'll never dig out any valuable
clues.

Re: The weird HTTP POST data transfer problem using curl.

<68e6e506-0f3a-4ee0-923c-44083e120b98n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3941&group=comp.unix.shell#3941

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:ae9:e84f:: with SMTP id a76mr11032374qkg.366.1623550722310;
Sat, 12 Jun 2021 19:18:42 -0700 (PDT)
X-Received: by 2002:a37:44cb:: with SMTP id r194mr10653050qka.425.1623550722134;
Sat, 12 Jun 2021 19:18:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sat, 12 Jun 2021 19:18:41 -0700 (PDT)
In-Reply-To: <83y2bfarte.fsf@helmutwaitzmann.news.arcor.de>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.176; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.176
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk> <9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk> <7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
<87im2k38lf.fsf@bsb.me.uk> <0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com>
<874ke42kr0.fsf@bsb.me.uk> <c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com>
<83y2bfarte.fsf@helmutwaitzmann.news.arcor.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <68e6e506-0f3a-4ee0-923c-44083e120b98n@googlegroups.com>
Subject: Re: The weird HTTP POST data transfer problem using curl.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Sun, 13 Jun 2021 02:18:42 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3979
 by: hongy...@gmail.com - Sun, 13 Jun 2021 02:18 UTC

On Sunday, June 13, 2021 at 1:58:34 AM UTC+8, Helmut Waitzmann wrote:
> "hongy...@gmail.com" <hongy...@gmail.com>:
> >In fact, I've tried to use `diff' and process substitution `<( echo
> >... )' to compare the different methods, but failed to dig out any
> >valuable clues.
> The problem is, that you apparently don't know what the shell does:
> The shell reads and parses its commandline. Then, when it is going
> to start a utility (in shell grammar speech: a simple command) it
> has to construct an “execve” (see
> <https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html#top>)
> argument vector out of the command line. Part of this construction
> is field splitting, which occurs when expansions of shell parameters
> (like “$variable”) or of command substitution (like “$(base64 …)”)
> are used without double quotes.
>
> You also apparently don't know, what the “echo” utility does. If
> you knew it, you wouldn't use it in your use case. But as long as
> you don't understand, what an “execve” argument vector is, you won't
> understand, that “echo” does not just copy its shell command line to
> standard output, because “echo” will never see such a thing like a
> shell command line. “echo” will process the elements of its given
> “execve” argument vector, writing the results to standard output,
> separated by single spaces.
>
> And you apparently don't know, what the “base64” utility does. If
> you knew it, you would have given it the “-w” “0” parameters (like
> Ben suggested).
>
> First learn unix or linux – here: how utilities are started by means
> of the “exec” family of functions –, then come back to the shell and
> learn, how it constructs an “execve” argument vector out of its
> commandline using quoted and unquoted variable expansions and quoted
> and unquoted command substitutions.
>
> As long as you don't know that, you'll never dig out any valuable
> clues.

Thank you very much for your, as always, profound and thorough analysis.

Re: The weird HTTP POST data transfer problem using curl.

<83czspbbqe.fsf@helmutwaitzmann.news.arcor.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3942&group=comp.unix.shell#3942

 copy link   Newsgroups: comp.unix.shell
Path: i2pn2.org!i2pn.org!aioe.org!smO8ITndQNl4leIx1WP6Vg.user.gioia.aioe.org.POSTED!not-for-mail
From: nn.throt...@xoxy.net (Helmut Waitzmann)
Newsgroups: comp.unix.shell
Subject: Re: The weird HTTP POST data transfer problem using curl.
Date: Mon, 14 Jun 2021 01:12:25 +0200
Organization: Aioe.org NNTP Server
Lines: 54
Message-ID: <83czspbbqe.fsf@helmutwaitzmann.news.arcor.de>
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com>
<8735tp4u8j.fsf@bsb.me.uk>
<9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com>
<87o8cd2l0e.fsf@bsb.me.uk>
<7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com>
<87im2k38lf.fsf@bsb.me.uk>
<0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com>
<874ke42kr0.fsf@bsb.me.uk>
<c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com>
<83y2bfarte.fsf@helmutwaitzmann.news.arcor.de>
Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
NNTP-Posting-Host: smO8ITndQNl4leIx1WP6Vg.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Cancel-Lock: sha1:LxEKFXcDq+UdU8kJTt3Xd8+WGvM=
Mail-Copies-To: nobody
Mail-Reply-To: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <oe.throttle@xoxy.net>
X-Notice: Filtered by postfilter v. 0.9.2
 by: Helmut Waitzmann - Sun, 13 Jun 2021 23:12 UTC

Helmut Waitzmann <nn.throttle@xoxy.net>:

>The shell reads and parses its commandline.  Then, when it is going
>to start a utility (in shell grammar speech: a simple command) it
>has to construct an “execve” (see
><https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html#top>)
>argument vector out of the command line.  Part of this construction
>is field splitting, which occurs when expansions of shell
>parameters (like “$variable”) or of command substitution (like
>“$(base64 …)”) are used without double quotes.

[…]

>But as long as you don't understand, what an “execve” argument
>vector is, you won't understand, that “echo” does not just copy its
>shell command line to standard output, because “echo” will never
>see such a thing like a shell command line.  “echo” will process
>the elements of its given “execve” argument vector, writing the
>results to standard output, separated by single spaces.

[…]

>First learn unix or linux – here: how utilities are started by
>means of the “exec” family of functions –, then come back to the
>shell and learn, how it constructs an “execve” argument vector out
>of its commandline using quoted and unquoted variable expansions
>and quoted and unquoted command substitutions.

To get a more thorough insight into “execve” you might read the book

Maurice J. Bach: The Design Of The Unix Operating System

Prentice-Hall International, London, 1986

which explains the basics.  It even has a chapter about the shell. 
Maybe you could borrow it from a library.  Probably there are other
good books (which I don't know of), too.

The EXAMPLE section of the execve(2) manual page shows two small
programs (written in the C programming language), which demonstrate
the use and the purpose of the “execve” argument vector.

Re: The weird HTTP POST data transfer problem using curl.

<59e8f9a9-284f-4b78-9ced-020cb9738dcbn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=3943&group=comp.unix.shell#3943

 copy link   Newsgroups: comp.unix.shell
X-Received: by 2002:a05:620a:10ac:: with SMTP id h12mr14043799qkk.370.1623627907858; Sun, 13 Jun 2021 16:45:07 -0700 (PDT)
X-Received: by 2002:a05:620a:4090:: with SMTP id f16mr14207584qko.225.1623627907717; Sun, 13 Jun 2021 16:45:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.unix.shell
Date: Sun, 13 Jun 2021 16:45:07 -0700 (PDT)
In-Reply-To: <83czspbbqe.fsf@helmutwaitzmann.news.arcor.de>
Injection-Info: google-groups.googlegroups.com; posting-host=103.142.140.223; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.142.140.223
References: <12b6a8f4-c1c0-4dfe-9323-b169d222b026n@googlegroups.com> <8735tp4u8j.fsf@bsb.me.uk> <9a88f930-6150-4681-ab21-b2d8deff3479n@googlegroups.com> <87o8cd2l0e.fsf@bsb.me.uk> <7094ec8c-7bca-458b-9bad-4403ecc7b0ban@googlegroups.com> <87im2k38lf.fsf@bsb.me.uk> <0d6dfc84-e25a-4ef7-b388-07317f76b9a0n@googlegroups.com> <874ke42kr0.fsf@bsb.me.uk> <c3b99bbe-6771-4740-8f67-89541dddba3cn@googlegroups.com> <83y2bfarte.fsf@helmutwaitzmann.news.arcor.de> <83czspbbqe.fsf@helmutwaitzmann.news.arcor.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <59e8f9a9-284f-4b78-9ced-020cb9738dcbn@googlegroups.com>
Subject: Re: The weird HTTP POST data transfer problem using curl.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Sun, 13 Jun 2021 23:45:07 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 52
 by: hongy...@gmail.com - Sun, 13 Jun 2021 23:45 UTC

On Monday, June 14, 2021 at 7:19:28 AM UTC+8, Helmut Waitzmann wrote:
> Helmut Waitzmann <nn.th...@xoxy.net>:
> >The shell reads and parses its commandline. Then, when it is going
> >to start a utility (in shell grammar speech: a simple command) it
> >has to construct an “execve” (see
> ><https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html#top>)
> >argument vector out of the command line. Part of this construction
> >is field splitting, which occurs when expansions of shell
> >parameters (like “$variable”) or of command substitution (like
> >“$(base64 …)”) are used without double quotes.
> […]
> >But as long as you don't understand, what an “execve” argument
> >vector is, you won't understand, that “echo” does not just copy its
> >shell command line to standard output, because “echo” will never
> >see such a thing like a shell command line. “echo” will process
> >the elements of its given “execve” argument vector, writing the
> >results to standard output, separated by single spaces.
> […]
> >First learn unix or linux – here: how utilities are started by
> >means of the “exec” family of functions –, then come back to the
> >shell and learn, how it constructs an “execve” argument vector out
> >of its commandline using quoted and unquoted variable expansions
> >and quoted and unquoted command substitutions.
> To get a more thorough insight into “execve” you might read the book
>
>
> Maurice J. Bach: The Design Of The Unix Operating System
>
> Prentice-Hall International, London, 1986

Thank you. I'll try to find and read it.

>
> which explains the basics. It even has a chapter about the shell.
> Maybe you could borrow it from a library. Probably there are other
> good books (which I don't know of), too.
>
> The EXAMPLE section of the execve(2) manual page shows two small
> programs (written in the C programming language), which demonstrate
> the use and the purpose of the “execve” argument vector.

Thank you. I'll try to read them.

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor