curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: curl post fails.

From: jian he via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 4 Oct 2022 13:08:48 +0530

Hi.

On Tue, Oct 4, 2022 at 12:13 PM jian he <jian.universality_at_gmail.com> wrote:

> Hi.
>
>
> On Mon, Oct 3, 2022 at 3:31 AM Ray Satiro via curl-library <
> curl-library_at_lists.haxx.se> wrote:
>
>> On 10/2/2022 2:09 PM, jian he via curl-library wrote:
>>
>> Follow this url (https://www.backblaze.com/b2/docs/b2_upload_file.html)
>> The command line way will work.
>>
>>> FILE_TO_UPLOAD=/home/jian/helloc/curl_1.c
>>> MIME_TYPE=text/plain
>>> SHA1_OF_FILE=$(openssl dgst -sha1 $FILE_TO_UPLOAD | awk '{print $2;}')
>>> UPLOAD_URL=
>>> https://pod-040-2009-17.backblaze.com/b2api/v2/b2_upload_file/daed35e922928ea38f340519/c004_v0402009_t0052
>>>
>>> UPLOAD_AUTHORIZATION_TOKEN="4_004ad5922e3f4590000000000_01a7620b_106677_upld_sg7Wnh52ocxqngTkjBLSfzE_ZzM="
>>> curl \
>>> -v \
>>> -H "Authorization: $UPLOAD_AUTHORIZATION_TOKEN" \
>>> -H "X-Bz-File-Name: $FILE_TO_UPLOAD" \
>>> -H "Content-Type: $MIME_TYPE" \
>>> -H "X-Bz-Content-Sha1: $SHA1_OF_FILE" \
>>> -H "X-Bz-Info-Author: unknown" \
>>> -H "X-Bz-Server-Side-Encryption: AES256" \
>>> --data-binary "_at_$FILE_TO_UPLOAD" \
>>> $UPLOAD_URL
>>>
>>
>> I am trying to write it in libcurl. Then it fails.
>> /*
>> gcc -Wall -Wextra -pedantic -Wshadow -Ofast curl_upload.c -lcurl &&./a.out
>> valgrind ./a.out
>> openssl dgst -sha1 "/home/jian/helloc/curl_stmp1.c" | awk '{print $2;}'
>> 03cc73740b9672c51a0cfe1b382c11bbb6a706c7
>> */
>> #include <stdio.h>
>> #include <curl/curl.h>
>> #include <string.h>
>> #include <stdlib.h>
>> #include <errno.h>
>> #include <sys/stat.h>
>> #include<stdlib.h>
>> const char access_token[] =
>> "4_004ad5922e3f4590000000000_01a7620b_106677_upld_sg7Wnh52ocxqngTkjBLSfzE_ZzM=";
>> const char upload_url[] = "
>> https://pod-040-2009-17.backblaze.com/b2api/v2/b2_upload_file/daed35e922928ea38f340519/c004_v0402009_t0052
>> ";
>> const char buckId[] = "daed35e922928ea38f340519";
>> int main(void)
>> {
>> // unsigned char buffer[BUFSIZ];
>> CURL *curl_handle = curl_easy_init();
>> struct stat file_info;
>> char *filename = "curl_1.c";
>> char *path = realpath(filename,NULL);
>> stat(filename,&file_info);
>>
>> printf("%s file size is %zu bytes\n",path,file_info.st_size);
>> FILE *fp = fopen(path,"rb");
>> if(fp == NULL){
>> perror("failed");
>> return 1;
>> }
>>
>> struct curl_slist *chunk = NULL;
>> chunk = curl_slist_append(chunk,"Content-Type: text/plain");
>> chunk = curl_slist_append(chunk,"X-Bz-File-Name:
>> /home/jian/helloc/curl_1.c");
>> chunk = curl_slist_append(chunk,"Content-Length: 799");
>> chunk = curl_slist_append(chunk,"Content-Length: 799");
>> chunk = curl_slist_append(chunk,"X-Bz-Server-Side-Encryption:
>> AES256");
>> chunk = curl_slist_append(chunk,"X-Bz-Content-Sha1:
>> 4ce3ebcd1ac59818d2884b4e96123b794ba69c4c");
>> chunk = curl_slist_append(chunk,"X-Bz-Info-Author: unknown");
>>
>> /* Content-Length: [NUMBER_OF_BYTES_IN_FILE] */
>> char size[200];
>> snprintf(size,200,"Content-Length: %lld",(long long
>> int)file_info.st_size);
>> printf("size=%s\n",size);
>>
>> char auth[300];
>> strcat(auth,"Authorization: ");
>> strcat(auth,access_token);
>> printf("auth:%s\n\n\n",auth);
>> chunk = curl_slist_append(chunk,auth);
>> curl_easy_setopt(curl_handle,CURLOPT_VERBOSE,1L);
>> curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER,chunk);
>> curl_easy_setopt(curl_handle, CURLOPT_HTTP_VERSION,
>> CURL_HTTP_VERSION_1_1);
>> curl_easy_setopt(curl_handle,CURLOPT_URL,upload_url);
>> curl_easy_setopt(curl_handle,CURLOPT_POST,1L);
>> curl_easy_setopt(curl_handle,CURLOPT_READDATA,fp);
>> CURLcode res = curl_easy_perform(curl_handle);
>> if(res != CURLE_OK){
>> fprintf(stderr,"curl_easy_perform() failed:
>> %s\n",curl_easy_strerror(res));
>> }else{
>> printf("\n\nSuccess\n");
>> }
>> curl_easy_cleanup(curl_handle);
>> return 0;
>> }
>>
>> The verbose message:
>>
>>> /home/jian/helloc/curl_1.c file size is 759 bytes
>>> size=Content-Length: 759
>>> auth:Authorization:
>>> 4_004ad5922e3f4590000000000_01a7620b_106677_upld_sg7Wnh52ocxqngTkjBLSfzE_ZzM=
>>>
>>>
>>> * Trying 149.137.133.93:443...
>>> * Connected to pod-040-2009-17.backblaze.com (149.137.133.93) port 443
>>> (#0)
>>> * found 384 certificates in /etc/ssl/certs
>>> * GnuTLS ciphers: NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509:-VERS-SSL3.0
>>> * ALPN, offering http/1.1
>>> * SSL connection using TLS1.3 / ECDHE_RSA_AES_128_GCM_SHA256
>>> * server certificate verification OK
>>> * server certificate status verification SKIPPED
>>> * common name: backblaze.com (matched)
>>> * server certificate expiration date OK
>>> * server certificate activation date OK
>>> * certificate public key: RSA
>>> * certificate version: #3
>>> * subject: CN=backblaze.com
>>> * start date: Mon, 26 Sep 2022 21:40:41 GMT
>>> * expire date: Sun, 25 Dec 2022 21:40:40 GMT
>>> * issuer: C=US,O=Let's Encrypt,CN=R3
>>> * ALPN, server did not agree to a protocol
>>> > POST
>>> /b2api/v2/b2_upload_file/daed35e922928ea38f340519/c004_v0402009_t0052
>>> HTTP/1.1
>>> Host: pod-040-2009-17.backblaze.com
>>> Accept: */*
>>> Transfer-Encoding: chunked
>>> Content-Type: text/plain
>>> X-Bz-File-Name: /home/jian/helloc/curl_1.c
>>> Content-Length: 799
>>> Content-Length: 799
>>> X-Bz-Server-Side-Encryption: AES256
>>> X-Bz-Content-Sha1: 4ce3ebcd1ac59818d2884b4e96123b794ba69c4c
>>> X-Bz-Info-Author: unknown
>>> Authorization:
>>> 4_004ad5922e3f4590000000000_01a7620b_106677_upld_sg7Wnh52ocxqngTkjBLSfzE_ZzM=
>>> Expect: 100-continue
>>>
>>> * Mark bundle as not supporting multiuse
>>> < HTTP/1.1 400
>>> < Content-Type: text/html;charset=utf-8
>>> < Content-Language: en
>>> < Content-Length: 435
>>> < Date: Sun, 02 Oct 2022 18:02:23 GMT
>>> < Connection: close
>>> <
>>> * Closing connection 0
>>> <!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad
>>> Request</title><style type="text/css">body
>>> {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b
>>> {color:white;background-color:#525D76;} h1 {font-size:22px;} h2
>>> {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;}
>>> .line
>>> {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP
>>> Status 400 – Bad Request</h1></body></html>
>>>
>>> Success
>>>
>>
>> I am not so sure why it failed.
>> Interesting part: if I only have one chunk =
>> curl_slist_append(chunk,"Content-Length: 799");
>> then it will fail error message is like:
>> {
>> "code": "bad_request",
>> "message": "Missing header: Content-Length",
>> "status": 400
>> * Closing connection 0
>> }
>>
>> If I have two lines chunk = curl_slist_append(chunk,"Content-Length:
>> 799"); then it will fail because of Bad Request.
>> Why did I set Length to 799? 759 + 40 = 799.
>> In the doc: https://www.backblaze.com/b2/docs/b2_upload_file.html aout
>> Content length:
>>
>>> The number of bytes in the file being uploaded. Note that this header is
>>> required; you cannot leave it out and just use chunked encoding.
>>> When sending the SHA1 checksum at the end, the Content-Length should be
>>> set to the size of the file plus the 40 bytes of hex checksum.
>>>
>>
>> Since the only message is "HTTP Status 400 – Bad Request" then I don't
>> know how to debug it any more...
>>
>>
>> You can use curl option --libcurl [1] to get the source code equivalent.
>> That will show you that CURLOPT_POSTFIELDS and CURLOPT_POSTFIELDSIZE_LARGE
>> are used to respectively set the already read in data and its size.
>>
>> In your example you have chosen instead to use CURLOPT_POST [2] and
>> CURLOPT_READDATA to read the data from a file. That's fine, however you
>> should also set CURLOPT_SEEKFUNCTION [3] (basically forward to fseek; read
>> the doc for pitfalls) and CURLOPT_SEEKDATA to the same pointer as READDATA.
>> That way if the first post request fails (like, authentication required)
>> the file can be properly rewound and read again from the beginning.
>>
>> Your example also sets the content length header twice, but it should not
>> do that even once. By using the read function you are by default sending
>> data using chunked encoding, and then you are adding the content length
>> header. The bad request looks like this:
>>
>> Transfer-Encoding: chunked
>> Content-Type: text/plain
>> X-Bz-File-Name: /home/jian/helloc/curl_1.c
>> Content-Length: 799
>> Content-Length: 799
>>
>> You could set CURLOPT_POSTFIELDSIZE_LARGE to set the content length
>> instead of using chunked encoding. These are things you need to review the
>> documentation for, review the links at the bottom of this e-mail.
>>
>> There are other problems with your example. You are not checking the
>> return code of stat and you are concatenating to an uninitialized string
>> auth[] which will likely cause memory corruption.
>>
>>
>> [1]: https://curl.se/docs/manpage.html#--libcurl
>> [2]: https://curl.se/libcurl/c/CURLOPT_POST.html
>> [3]: https://curl.se/libcurl/c/CURLOPT_SEEKFUNCTION.html
>>
>> --
>> Unsubscribe: https://lists.haxx.se/listinfo/curl-library
>> Etiquette: https://curl.se/mail/etiquette.html
>>
>
>
> Thanks for the command line --libcurl trick. By following through example
> code, the CURLOPT_POSTFIELDS option is easier to understand compared to
> CURLOPT_READDATA.
>
> How does the curl command line encode the PNG file data to (char
> *postdata) [0]?
>
>
> [0]: https://curl.se/libcurl/c/CURLOPT_POSTFIELDS.html
>
> --
> I recommend David Deutsch's <<The Beginning of Infinity>>
>
> Jian
>
>
>
If the file is text, then all things would be pretty easy. However, if I
upload a png file, Then the auto generated c code will not build and run
again.

The following code is generated by curl. It cannot recompile and run again.

/********* Sample code generated by the curl command line tool **********
 * All curl_easy_setopt() options are documented at:
 * https://curl.se/libcurl/c/curl_easy_setopt.html\
 *
 *
gcc testcurl_elephant.c -lcurl &&./a.out

 ************************************************************************/
#include <curl/curl.h>

int main(int argc, char *argv[])
{
  CURLcode ret;
  CURL *hnd;
  struct curl_slist *slist1;

  slist1 = NULL;
  slist1 = curl_slist_append(slist1, "Authorization:
4_004ad5922e3f4590000000002_01a7683f_d87468_upld_MYVQlhLtt7es6KyLq72D4HEBH9U=");
  slist1 = curl_slist_append(slist1, "X-Bz-File-Name:
/home/jian/helloc/elephant.png");
  slist1 = curl_slist_append(slist1, "Content-Type: image/png");
  slist1 = curl_slist_append(slist1, "X-Bz-Content-Sha1:
037a513d56d029729e044d6a8e68e68025aaf0c2");
  slist1 = curl_slist_append(slist1, "X-Bz-Info-Author: unknown");
  slist1 = curl_slist_append(slist1, "X-Bz-Server-Side-Encryption: AES256");

  hnd = curl_easy_init();
  curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
  curl_easy_setopt(hnd, CURLOPT_URL, "
https://pod-040-2001-00.backblaze.com/b2api/v2/b2_upload_file/daed35e922928ea38f340519/c004_v0402001_t0049
");
  curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
  curl_easy_setopt(hnd, CURLOPT_POSTFIELDS,
"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x02\x1c\x00\x00\x02-\x08\x06\x00\x00\x00r\xd8\xa3t\x00\x00\x00\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\x00\x00\x07tIME\x07\xd8\x01\x10\x13\x12\x01NS\x17\xa1\x00\x00
\x00IDATx\x9c\xec\x9dwxT\xd7\xb5\xb7\xdf\x19\xf5Q\xef\x12*HBB\x08$z\x11\x180`\xb01`p\x89\xe3\xb8&N\x9c8q\x8b\x9d\x1b\xdf\xf8\xe6\xc6I\xae\xd3\x9c\xd8\x9f\xe3\x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12\xc7
\x07\xa5\x0b\xe1\x1e\xe0+\x94\xf2][\xe2\x0c\xdc\x06<\x84\x12=\x93\xefK\tz\xbd\x9e\xe8\xe8h\x12\x12\x12\x18=z4\xd1\xd1\xd1\xc4\xc4\xc4\\x\x1e\x11\x11\x81\x8b\x8b\x8b\xad\xdd\x1c\x10MMM\x14\x16\x16RXXHQQ\xd1\x85\xe7\x85\x85\x85\x14\x17\x17\xd3\xdb;\xec+\xe4\xeb\x80\xd7\x81\x97\xb1\xef\x1b\x1a\x9b\"/l}3\x07x\x10\xb8\x1d\xfb\xef\xb6(\x11\xc3\x82\x92\x88\xba\x1d\xd8\x8a2\x8fa\xa8\xeeT\xfcP\x8eL\x1e\x01\xa2\x86hO\x89\x9d\x11\x18\x18Hbb\"\xe3\xc6\x8dc\xec\xd8\xb1$$$\\\xf8\xea\xe6\xe6fk\xf7\xacNww7\x05\x05\x05dee\x91\x91\x91\xc1\xa9S\xa7HOO\xa7\xb8\xb8\x18\x8be\xd8\x9dVt\x00\xaf\x00\x7fF\x11!\x92\x8b\x90\x82\xe3k|\x80\xbbQ\x84\xc6$\x1b\xfb\"\xb1\x1d\x1d(5\xf8[\x81/Q\x92P\xb5&\x04x\x12\xf8\tr\x06\xc7\x88\xc1\xdd\xdd\x9d\xe4\xe4dRRR\xbe\xf15<<\xdc\xd6\xae\xd9%---\x9c:u\x8aS\xa7Nq\xf2\xe4I\x8e\x1e=Jzz\xfap\x89\x86\x18\x81\x17\x81\xff\x87\xec+t\x01)8\x94\n\x80'P\x84\x86\xb7\x8d}\x91\xd8\x1fgP\x84\xc7\x97(\xc70\"e\xb8a\xc0\x7f\xa3\xfc\xae\x19\xc4]\x93\xd8+z\xbd\x9e\xa4\xa4$f\xce\x9c\xc9\x8c\x193\x989s&\x13'N\x1c6G
\xf6\x8a\xd1h\xe4\xd0\xa1C\x1c8p\x80\xbd{\xf7r\xf8\xf0aZ[[m\xed\xd6\x95hB\x11\x1d/\xa2\x88\x90\x11\xcdH\x16\x1ccQ.\xfe\xf7\"\x9bqI\x06\x86\x91\xafg0l\xe0\xebAwW\xc3\x0bx\n\xf8)\x0e\xd8U\xd6\xd3\xd3\x13www|}}1\x18\x0cW<\x06hii\xc1d2\xd1\xda\xdaJoo/F\xa3\x91\x9e\x9e\x9e!\xf4\xd6:\x8c\x1a5\x8a\xd9\xb3g3k\xd6,f\xcc\x98\xc1\xb4i\xd3\xf0\xf6\x96\xf7/\xd6\xc6d2q\xf2\xe4I\xf6\xef\xdf\xcf\x96-[\xd8\xb5k\x17\xed\xed\xed\xb6v\xab/\xea\x80?\xa1\xe4x\x8c\xb4\xdeA\x17\x18\x89\x82#\x1a\xf8?\x94\x8a\x13\xbd\x8d}\x91\x0c_\xbaP\x8e]\xd6\xa2L\xa1\xec+\r\xdf\x19%G\xe3\xd7(C\xf7\x86\r\xae\xae\xaeDGG\x13\x17\x17GLL\x0cQQQ\x84\x87\x87\x13\x1c\x1cLpp0!!!\x04\x07\x07\xe3\xe3s\xb5I\xf4W\xa7\xbd\xbd\x9d\xa6\xa6&\x9a\x9a\x9ahll\xa4\xa9\xa9\x89\xba\xba:***\xa8\xaa\xaa\xa2\xaa\xaa\x8a\xca\xcaJ***(--\xa5\xbb\xdb\xf6\xd7\xeb\xd0\xd0P\x16,X\xc0\xc2\x85\x0bY\xb8p!c\xc7\x8e\xb5\xb5K\x12\xa0\xb3\xb3\x93\x9d;w\xb2q\xe3F6m\xdaDAA\x81\xad]\xba\x94\\\xe01\x94r\xda\x11\xc7H\x12\x1cA\xc0/Q*\x01...");
  curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)50279);
  curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1);
  curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/7.81.0");
  curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
  curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_2TLS);
  curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
  curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
  curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);

  /* Here is a list of options the curl code used that cannot get generated
     as source easily. You may choose to either not use them or implement
     them yourself.

  CURLOPT_WRITEDATA set to a objectpointer
  CURLOPT_INTERLEAVEDATA set to a objectpointer
  CURLOPT_WRITEFUNCTION set to a functionpointer
  CURLOPT_READDATA set to a objectpointer
  CURLOPT_READFUNCTION set to a functionpointer
  CURLOPT_SEEKDATA set to a objectpointer
  CURLOPT_SEEKFUNCTION set to a functionpointer
  CURLOPT_ERRORBUFFER set to a objectpointer
  CURLOPT_STDERR set to a objectpointer
  CURLOPT_DEBUGFUNCTION set to a functionpointer
  CURLOPT_DEBUGDATA set to a objectpointer
  CURLOPT_HEADERFUNCTION set to a functionpointer
  CURLOPT_HEADERDATA set to a objectpointer

  */

  ret = curl_easy_perform(hnd);

  curl_easy_cleanup(hnd);
  hnd = NULL;
  curl_slist_free_all(slist1);
  slist1 = NULL;

  return (int)ret;
}
/**** End of sample code ****/

-- 
 I recommend David Deutsch's <<The Beginning of Infinity>>
  Jian


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2022-10-04