ESP_HTTP_CLIENT PUT REQUEST fails every time

Ian777
Posts: 21
Joined: Sun Jun 17, 2018 11:31 pm

ESP_HTTP_CLIENT PUT REQUEST fails every time

Postby Ian777 » Thu Mar 07, 2019 11:34 am

Hey everyone!

I'm completely lost at this point. I'm trying to do a put request while reading in data from an sdcard. To test it I have written a function as described here: https://docs.espressif.com/projects/esp ... ttp-stream

It fails every time though, I did run the esp_http_client example code and all of the tests passed. I've also tried to run the code I wrote below with various different sites and a local server. It fails each time. I'm quite new to this so not entirely sure what I'm doing wrong. The PUT request below is one of many functions (the rest work), so for now I'm only posting the relevant portion below:

  1. void Send_data(char* tstamp,esp_http_client_handle_t client,esp_http_client_config_t config){
  2.     //SEND DATA TO SERVER IN BATCHES
  3.     // SET HEADERS AND HAVE A FIXED CONTENT LENGTH FOR TESTING
  4.     esp_http_client_set_method(client, HTTP_METHOD_PUT);
  5.     esp_http_client_set_header(client, "User-Agent", "python-requests/2.18.4");
  6.     esp_http_client_set_header(client,"Accept-Encoding","gzip, deflate");
  7.     esp_http_client_set_header(client,"Accept","*/*");
  8.     esp_http_client_set_header(client,"Connection","keep-alive");
  9.     esp_http_client_set_header(client,"Content-length","1024");
  10.     //esp_http_client_set_header(client,"Cookie",cookie);
  11.  
  12.     //SET THE URL FOR TESTING TO HTTPBIN
  13.     esp_http_client_set_url(client, "http://httpbin.org/put");
  14.  
  15.     //OPEN A CONNECTION AND ENSURE THE LENGTH IS LONGER
  16.     //THAN THE DATA TO BE WRITTEN WITH THE WRITE FUNCTION
  17.     printf(" \n OPEN \n");
  18.     err = esp_http_client_open(client,2000);
  19.     if (err == ESP_OK) {
  20.         ESP_LOGI(TAG, "HTTP OPEN Status = %d, content_length = %d",
  21.                  esp_http_client_get_status_code(client),
  22.                  esp_http_client_get_content_length(client));
  23.     } else {
  24.         ESP_LOGE(TAG, "HTTP OPEN request failed: %s", esp_err_to_name(err));
  25.     }
  26.  
  27.     /
  28.     printf(" \n WRITE \n");
  29.     //READ DATA IN FROM SDCARD TO BUFFER
  30.     int ret = 0;
  31.     ret= fread(buffer,1,1024,f);
  32.     printf("\n %d \n",ret);
  33.  
  34.     //WRITE DATA TO HTTPBIN
  35.     err= esp_http_client_write(client, buff11, ret);
  36.     if (err == ESP_OK) {
  37.         ESP_LOGI(TAG, "HTTP WRITE Status = %d, content_length = %d",
  38.                  esp_http_client_get_status_code(client),
  39.                  esp_http_client_get_content_length(client));
  40.     } else {
  41.         ESP_LOGE(TAG, "HTTP WRITE request failed: %s", esp_err_to_name(err));
  42.     }
  43.    
  44.     // FETCH THE RESPONSE HEADERS
  45.     err = esp_http_client_fetch_headers(client);
  46.     if (err == ESP_OK) {
  47.         ESP_LOGI(TAG, "HTTP WRITE Status = %d, content_length = %d",
  48.                  esp_http_client_get_status_code(client),
  49.                  esp_http_client_get_content_length(client));
  50.     } else {
  51.         ESP_LOGE(TAG, "HTTP WRITE request failed: %s", esp_err_to_name(err));
  52.     }
  53.     printf(" \n CLOSE \n");
  54.  
  55.     err = esp_http_client_read(client,buff12,1000);
  56.     if (err == ESP_OK) {
  57.         ESP_LOGI(TAG, "HTTP READ_HEADER Status = %d, content_length = %d",
  58.                  esp_http_client_get_status_code(client),
  59.                  esp_http_client_get_content_length(client));
  60.     } else {
  61.         ESP_LOGE(TAG, "HTTP READ_HEADER request failed: %s", esp_err_to_name(err));
  62.     }
  63.     printf("\n %s \n",buff12);
  64.  
  65.     //CLOSE THE CONNECTION - CLEANUP ISN'T DONE HERE BUT IN THE NEXT REQUEST
  66.     err = esp_http_client_close(client);
  67.     if (err == ESP_OK) {
  68.         ESP_LOGI(TAG, "HTTP CLOSE Status = %d, content_length = %d",
  69.                  esp_http_client_get_status_code(client),
  70.                  esp_http_client_get_content_length(client));
  71.     } else {
  72.         ESP_LOGE(TAG, "HTTP CLOSE request failed: %s", esp_err_to_name(err));
  73.     }
  74.  
  75.     fclose(f);
  76.     free(buff11);
  77.     free(buff12);
  78.  
  79. }

This code returns the following output:
  1. OPEN
  2. I (7180) HTTP_CLIENT: HTTP OPEN Status = 200, content_length = 38
  3.  
  4.  WRITE
  5. 1024E (7180) HTTP_CLIENT: HTTP WRITE request failed: ERROR
  6. E (12180) HTTP_CLIENT: HTTP WRITE request failed: ESP_FAIL
  7.  
  8.  CLOSE
  9. E (17180) HTTP_CLIENT: HTTP READ_HEADER request failed: ERROR
  10.  
  11.  <h1 style='color:blue'>logged in!</h1>
  12. I (17180) HTTP_CLIENT: HTTP CLOSE Status = -1, content_length = 38
  13. EXIT SEND FUNCTION
  14. I (17180) example: Data sent to database
This was actually when I was testing it to my local server (Hence why the header returns logged in!, the prior request was a login to the server afterwhich I passed the cookie in this request), but the output remains the same no matter where I test it. The connection opens and then write fails.

Any help will really be appreciated as I'm completely lost!
TIA!

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: ESP_HTTP_CLIENT PUT REQUEST fails every time

Postby fly135 » Thu Mar 07, 2019 5:35 pm

Few things that make me wonder...

1) You read the data into buffer and write from buf11.

2) I don't think you can send raw binary data without content-type octal.

3) The URL has a put at the end. Could be ok, but don't know.

John A

Ian777
Posts: 21
Joined: Sun Jun 17, 2018 11:31 pm

Re: ESP_HTTP_CLIENT PUT REQUEST fails every time

Postby Ian777 » Thu Mar 07, 2019 6:26 pm

Hi @fly135!

Thank you for the reply!

1) That's definitely an error I made prior to posting. I was debugging and tried to send a buffer that I manually filled with data.

2) I added this to the code. I'm still trying to wrap my head around the headers. So this was one of the things that I'm really not sure about.

3) I copied this url for testing from the example code in esp_http_client :
  1.   //PUT
  2.     esp_http_client_set_url(client, "http://httpbin.org/put");
  3.     esp_http_client_set_method(client, HTTP_METHOD_PUT);
  4.     err = esp_http_client_perform(client);
  5.     if (err == ESP_OK) {
  6.         ESP_LOGI(TAG, "HTTP PUT Status = %d, content_length = %d",
  7.                 esp_http_client_get_status_code(client),
  8.                 esp_http_client_get_content_length(client));
  9.     } else {
  10.         ESP_LOGE(TAG, "HTTP PUT request failed: %s", esp_err_to_name(err));
  11.     }
I made the changes but still seem to be getting a write fail. Any further help would be highly appreciated, or if you know of any example code to get a better feel for this, I would really appreciate it. TIA!

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: ESP_HTTP_CLIENT PUT REQUEST fails every time

Postby fly135 » Fri Mar 08, 2019 1:01 am

The source code is in the $IDF_PATH/components/esp_http_client folder. I would examine it. Find out why it's failing. Put some prints in it. You can copy that directory into a components directory in your project folder and it will override the IDF version. That way you won't contaminate the IDF accidentally.

I use a managed switch with port forwarding connected to the wifi router and can snoop network packets with wireshark. Since you are HTTP and not HTTPS, you'll be able to see what's going back and forth.

John A

Ian777
Posts: 21
Joined: Sun Jun 17, 2018 11:31 pm

Re: ESP_HTTP_CLIENT PUT REQUEST fails every time

Postby Ian777 » Sun Mar 10, 2019 12:44 pm

Hi fly135,

I've solved the majority of my issues at this point except for https:

Here's the code snippet I'm currently using :
  1. void Send_data(char* tstamp,esp_http_client_handle_t client,esp_http_client_config_t config){
  2.  
  3.     //all local declarations
  4.  
  5.     //declaration for timers
  6.     float start1;
  7.     float end1;
  8.     int record = 0;
  9.     float start;
  10.     float end;
  11.  
  12.  
  13.     //declaration for esp_http_client return values
  14.     int headers_read;
  15.     int amount_sent;
  16.     int amount_read = 1000;
  17.     int status;
  18.     esp_err_t err;
  19.  
  20.     //amount of data read from sdcard
  21.     int ret;
  22.  
  23.     //data buffers
  24.     char* buff11 = malloc(sizeof(char)*(8096+1));
  25.     char* buff12 = malloc(sizeof(char)*(1000+1));
  26.  
  27.     //start the timing process for the total upload
  28.     start1 = esp_timer_get_time();
  29.     start1 = start1/1000000;
  30.  
  31.     //set the servers url
  32.     esp_http_client_set_url(client, "https://httpbin.org/put");
  33.  
  34.     //format file name for path
  35.     char * cc = malloc(1000);
  36.     strcpy(cc,"/sdcard/");
  37.     strcat(cc,tstamp);
  38.  
  39.     //open file that contains data to be uploaded -- as binary
  40.     FILE* f = fopen(cc, "rb");
  41.     if (f == NULL) {
  42.         ESP_LOGE(TAG, "Failed to open file for writing");
  43.         return;
  44.     }
  45.  
  46.     //determine size of file for http_client_open
  47.     fseek(f,0,SEEK_END);
  48.     long int filesize = ftell(f);
  49.     char filesi[20];
  50.     printf("filesize is %ld \n",filesize);
  51.     fseek(f,0,SEEK_SET);
  52.  
  53.     //reformat filesize for Content-length header
  54.     sprintf(filesi,"%ld",filesize);
  55.  
  56.  
  57.     //Set method and headers for request
  58.     esp_http_client_set_method(client, HTTP_METHOD_PUT);
  59.     esp_http_client_set_header(client, "User-Agent", "ESP32 HTTP Client/1.0");
  60.     esp_http_client_set_header(client,"Accept","*/*");
  61.     esp_http_client_set_header(client,"Connection","keep-alive");
  62.     esp_http_client_set_header(client,"Content-length",filesi);
  63.     esp_http_client_set_header(client,"Content-Type","application/octet-stream");
  64.     //  esp_http_client_set_header(client,"Cookie",cookie);
  65.  
  66.     //Open the connection
  67.     err = esp_http_client_open(client,filesize);
  68.     if (err == ESP_OK) {
  69.         ESP_LOGI(TAG, "HTTP OPEN Status = %d, content_length = %d",
  70.                  esp_http_client_get_status_code(client),
  71.                  esp_http_client_get_content_length(client));
  72.     } else {
  73.         ESP_LOGE(TAG, "HTTP OPEN request failed: %s", esp_err_to_name(err));
  74.     }
  75.  
  76.  
  77.     //Start writing data to server
  78.     ret= fread(buff11,1,8096,f);
  79.     //while the file contains data, write it to the server
  80.     while(ret > 0){
  81.  
  82.         record = record + ret;
  83.         printf("amount of data read from sd = %d\n",ret);
  84.         start = esp_timer_get_time();
  85.         start = start/1000000;
  86.         amount_sent= esp_http_client_write(client, buff11, ret);
  87.         end = esp_timer_get_time();
  88.         end = end/1000000;
  89.  
  90.         printf("The current upload rate is = %.4f KB/s \n", (amount_sent/1000)/(end-start));
  91.  
  92.         start = esp_timer_get_time();
  93.         start = start/1000000;
  94.  
  95.         ret= fread(buff11,1,8096,f);
  96.         end = esp_timer_get_time();
  97.         end = end/1000000;
  98.         printf("The current SD_CARD rate is = %.4f KB/s \n", (ret/1000)/(end-start));
  99.         printf("amount of data sent = %d \n",amount_sent);
  100.         printf("TOTAL AMOUNT OF DATA READ = %d \n",record);
  101.     }
  102.  
  103.     //read amount of response headers from server
  104.     headers_read = esp_http_client_fetch_headers(client);
  105.     printf("\n amount of headers read = %d \n",headers_read);
  106.  
  107.     //get the status code for the request
  108.     status = esp_http_client_get_status_code(client);
  109.     printf("\nThe response code is: %d\n",status);
  110.  
  111.     //start reading the servers response
  112.     while(amount_read >= 1000){
  113.  
  114.         start = esp_timer_get_time();
  115.         start = start/1000;
  116.         amount_read = esp_http_client_read(client,buff12,1000);
  117.         end = esp_timer_get_time();
  118.         end = end/1000;
  119.         printf("The current download rate is = %.4f KB/s \n", (amount_read/1000)/(end-start));
  120.  
  121.         printf("\n amount of data read = %d \n",amount_read);
  122.  
  123.     }
  124.  
  125.     //close the connection
  126.     err = esp_http_client_close(client);
  127.     if (err == ESP_OK) {
  128.         ESP_LOGI(TAG, "HTTP CLOSE Status = %d, content_length = %d",
  129.                  esp_http_client_get_status_code(client),
  130.                  esp_http_client_get_content_length(client));
  131.     } else {
  132.         ESP_LOGE(TAG, "HTTP CLOSE request failed: %s", esp_err_to_name(err));
  133.     }
  134.     //free the local pointers
  135.     fclose(f);
  136.     free(buff11);
  137.     free(buff12);
  138.     free(cc);
  139.     //NOTE : THE CONNECTION IS CLEANED UP HERE, AS THE LOGOUT STILL NEEDS TO BE DONE FOR THE PERSISTENT SESSION
  140.     end1 = esp_timer_get_time();
  141.     end1 = end1/1000000;
  142.     printf("The total upload time is = %.4f seconds \n", (end1-start1));
  143.  
  144.  
  145. }
This reads in data from a textfile and sends it to a test server.

The config is done prior to this here:
  1.    esp_http_client_config_t config = {
  2.         .url = "addressremovedforforum",
  3.         .event_handler = _http_event_handler,
  4.  
  5.  
  6.     };
  7.     esp_http_client_handle_t client = esp_http_client_init(&config);
The output looks great, but it always returns 502 bad gateway no matter what. I've tried several test servers and even my own which I know works with a python request.


Here's the output from putty ( I'm only posting a portion of the write functions output as I'm sending 6MB so it's a lot):

  1.  
  2. The current upload rate is = 83.6318 KB/s
  3. The current SD_CARD rate is = 1133.5957 KB/s
  4. amount of data sent = 8096
  5. TOTAL AMOUNT OF DATA READ = 6452512
  6. amount of data read from sd = 8096
  7. [0;32mI (94970) mbedtls: ssl_tls.c:8619 => write
  8. [0m
  9. [0;32mI (94975) mbedtls: ssl_tls.c:3337 => write record
  10. [0m
  11. [0;32mI (94980) mbedtls: ssl_tls.c:1441 => encrypt buf
  12. [0m
  13. [0;32mI (95018) mbedtls: ssl_tls.c:1777 <= encrypt buf
  14. [0m
  15. [0;32mI (95040) mbedtls: ssl_tls.c:2751 => flush output
  16. [0m
  17. [0;32mI (95041) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  18. [0m
  19. [0;32mI (95045) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  20. [0m
  21. [0;32mI (95050) mbedtls: ssl_tls.c:2803 <= flush output
  22. [0m
  23. [0;32mI (95056) mbedtls: ssl_tls.c:3470 <= write record
  24. [0m
  25. [0;32mI (95061) mbedtls: ssl_tls.c:8647 <= write
  26. [0m
  27. The current upload rate is = 82.8259 KB/s
  28. The current SD_CARD rate is = 1182.1600 KB/s
  29. amount of data sent = 8096
  30. TOTAL AMOUNT OF DATA READ = 6460608
  31. amount of data read from sd = 8096
  32. [0;32mI (95084) mbedtls: ssl_tls.c:8619 => write
  33. [0m
  34. [0;32mI (95088) mbedtls: ssl_tls.c:3337 => write record
  35. [0m
  36. [0;32mI (95094) mbedtls: ssl_tls.c:1441 => encrypt buf
  37. [0m
  38. [0;32mI (95131) mbedtls: ssl_tls.c:1777 <= encrypt buf
  39. [0m
  40. [0;32mI (95153) mbedtls: ssl_tls.c:2751 => flush output
  41. [0m
  42. [0;32mI (95153) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  43. [0m
  44. [0;32mI (95159) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  45. [0m
  46. [0;32mI (95163) mbedtls: ssl_tls.c:2803 <= flush output
  47. [0m
  48. [0;32mI (95168) mbedtls: ssl_tls.c:3470 <= write record
  49. [0m
  50. [0;32mI (95174) mbedtls: ssl_tls.c:8647 <= write
  51. [0m
  52. The current upload rate is = 83.3725 KB/s
  53. The current SD_CARD rate is = 1186.1720 KB/s
  54. amount of data sent = 8096
  55. TOTAL AMOUNT OF DATA READ = 6468704
  56. amount of data read from sd = 8096
  57. [0;32mI (95196) mbedtls: ssl_tls.c:8619 => write
  58. [0m
  59. [0;32mI (95201) mbedtls: ssl_tls.c:3337 => write record
  60. [0m
  61. [0;32mI (95207) mbedtls: ssl_tls.c:1441 => encrypt buf
  62. [0m
  63. [0;32mI (95242) mbedtls: ssl_tls.c:1777 <= encrypt buf
  64. [0m
  65. [0;32mI (95263) mbedtls: ssl_tls.c:2751 => flush output
  66. [0m
  67. [0;32mI (95263) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  68. [0m
  69. [0;32mI (95269) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  70. [0m
  71. [0;32mI (95273) mbedtls: ssl_tls.c:2803 <= flush output
  72. [0m
  73. [0;32mI (95278) mbedtls: ssl_tls.c:3470 <= write record
  74. [0m
  75. [0;32mI (95284) mbedtls: ssl_tls.c:8647 <= write
  76. [0m
  77. The current upload rate is = 85.7661 KB/s
  78. The current SD_CARD rate is = 933.7275 KB/s
  79. amount of data sent = 8096
  80. TOTAL AMOUNT OF DATA READ = 6476800
  81. amount of data read from sd = 8096
  82. [0;32mI (95308) mbedtls: ssl_tls.c:8619 => write
  83. [0m
  84. [0;32mI (95311) mbedtls: ssl_tls.c:3337 => write record
  85. [0m
  86. [0;32mI (95316) mbedtls: ssl_tls.c:1441 => encrypt buf
  87. [0m
  88. [0;32mI (95353) mbedtls: ssl_tls.c:1777 <= encrypt buf
  89. [0m
  90. [0;32mI (95375) mbedtls: ssl_tls.c:2751 => flush output
  91. [0m
  92. [0;32mI (95375) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  93. [0m
  94. [0;32mI (95380) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  95. [0m
  96. [0;32mI (95385) mbedtls: ssl_tls.c:2803 <= flush output
  97. [0m
  98. [0;32mI (95391) mbedtls: ssl_tls.c:3470 <= write record
  99. [0m
  100. [0;32mI (95396) mbedtls: ssl_tls.c:8647 <= write
  101. [0m
  102. The current upload rate is = 83.9062 KB/s
  103. The current SD_CARD rate is = 905.5060 KB/s
  104. amount of data sent = 8096
  105. TOTAL AMOUNT OF DATA READ = 6484896
  106. amount of data read from sd = 8096
  107. [0;32mI (95419) mbedtls: ssl_tls.c:8619 => write
  108. [0m
  109. [0;32mI (95423) mbedtls: ssl_tls.c:3337 => write record
  110. [0m
  111. [0;32mI (95428) mbedtls: ssl_tls.c:1441 => encrypt buf
  112. [0m
  113. [0;32mI (95465) mbedtls: ssl_tls.c:1777 <= encrypt buf
  114. [0m
  115. [0;32mI (95487) mbedtls: ssl_tls.c:2751 => flush output
  116. [0m
  117. [0;32mI (95487) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  118. [0m
  119. [0;32mI (95493) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  120. [0m
  121. [0;32mI (95497) mbedtls: ssl_tls.c:2803 <= flush output
  122. [0m
  123. [0;32mI (95502) mbedtls: ssl_tls.c:3470 <= write record
  124. [0m
  125. [0;32mI (95508) mbedtls: ssl_tls.c:8647 <= write
  126. [0m
  127. The current upload rate is = 84.2297 KB/s
  128. The current SD_CARD rate is = 1116.6943 KB/s
  129. amount of data sent = 8096
  130. TOTAL AMOUNT OF DATA READ = 6492992
  131. amount of data read from sd = 8096
  132. [0;32mI (95530) mbedtls: ssl_tls.c:8619 => write
  133. [0m
  134. [0;32mI (95535) mbedtls: ssl_tls.c:3337 => write record
  135. [0m
  136. [0;32mI (95540) mbedtls: ssl_tls.c:1441 => encrypt buf
  137. [0m
  138. [0;32mI (95577) mbedtls: ssl_tls.c:1777 <= encrypt buf
  139. [0m
  140. [0;32mI (95599) mbedtls: ssl_tls.c:2751 => flush output
  141. [0m
  142. [0;32mI (95600) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  143. [0m
  144. [0;32mI (95604) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  145. [0m
  146. [0;32mI (95609) mbedtls: ssl_tls.c:2803 <= flush output
  147. [0m
  148. [0;32mI (95615) mbedtls: ssl_tls.c:3470 <= write record
  149. [0m
  150. [0;32mI (95620) mbedtls: ssl_tls.c:8647 <= write
  151. [0m
  152. The current upload rate is = 83.6318 KB/s
  153. The current SD_CARD rate is = 1100.2896 KB/s
  154. amount of data sent = 8096
  155. TOTAL AMOUNT OF DATA READ = 6501088
  156. amount of data read from sd = 8096
  157. [0;32mI (95643) mbedtls: ssl_tls.c:8619 => write
  158. [0m
  159. [0;32mI (95647) mbedtls: ssl_tls.c:3337 => write record
  160. [0m
  161. [0;32mI (95653) mbedtls: ssl_tls.c:1441 => encrypt buf
  162. [0m
  163. [0;32mI (95689) mbedtls: ssl_tls.c:1777 <= encrypt buf
  164. [0m
  165. [0;32mI (95712) mbedtls: ssl_tls.c:2751 => flush output
  166. [0m
  167. [0;32mI (95712) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  168. [0m
  169. [0;32mI (95719) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  170. [0m
  171. [0;32mI (95722) mbedtls: ssl_tls.c:2803 <= flush output
  172. [0m
  173. [0;32mI (95727) mbedtls: ssl_tls.c:3470 <= write record
  174. [0m
  175. [0;32mI (95733) mbedtls: ssl_tls.c:8647 <= write
  176. [0m
  177. The current upload rate is = 83.3725 KB/s
  178. The current SD_CARD rate is = 1114.3209 KB/s
  179. amount of data sent = 8096
  180. TOTAL AMOUNT OF DATA READ = 6509184
  181. amount of data read from sd = 8096
  182. [0;32mI (95755) mbedtls: ssl_tls.c:8619 => write
  183. [0m
  184. [0;32mI (95760) mbedtls: ssl_tls.c:3337 => write record
  185. [0m
  186. [0;32mI (95765) mbedtls: ssl_tls.c:1441 => encrypt buf
  187. [0m
  188. [0;32mI (95801) mbedtls: ssl_tls.c:1777 <= encrypt buf
  189. [0m
  190. [0;32mI (95825) mbedtls: ssl_tls.c:2751 => flush output
  191. [0m
  192. [0;32mI (95825) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  193. [0m
  194. [0;32mI (95831) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  195. [0m
  196. [0;32mI (95835) mbedtls: ssl_tls.c:2803 <= flush output
  197. [0m
  198. [0;32mI (95840) mbedtls: ssl_tls.c:3470 <= write record
  199. [0m
  200. [0;32mI (95846) mbedtls: ssl_tls.c:8647 <= write
  201. [0m
  202. The current upload rate is = 83.0950 KB/s
  203. The current SD_CARD rate is = 1170.2858 KB/s
  204. amount of data sent = 8096
  205. TOTAL AMOUNT OF DATA READ = 6517280
  206. amount of data read from sd = 8096
  207. [0;32mI (95869) mbedtls: ssl_tls.c:8619 => write
  208. [0m
  209. [0;32mI (95873) mbedtls: ssl_tls.c:3337 => write record
  210. [0m
  211. [0;32mI (95879) mbedtls: ssl_tls.c:1441 => encrypt buf
  212. [0m
  213. [0;32mI (95914) mbedtls: ssl_tls.c:1777 <= encrypt buf
  214. [0m
  215. [0;32mI (95938) mbedtls: ssl_tls.c:2751 => flush output
  216. [0m
  217. [0;32mI (95938) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  218. [0m
  219. [0;32mI (95943) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  220. [0m
  221. [0;32mI (95947) mbedtls: ssl_tls.c:2803 <= flush output
  222. [0m
  223. [0;32mI (95953) mbedtls: ssl_tls.c:3470 <= write record
  224. [0m
  225. [0;32mI (95959) mbedtls: ssl_tls.c:8647 <= write
  226. [0m
  227. The current upload rate is = 83.5785 KB/s
  228. The current SD_CARD rate is = 1174.2173 KB/s
  229. amount of data sent = 8096
  230. TOTAL AMOUNT OF DATA READ = 6525376
  231. amount of data read from sd = 8096
  232. [0;32mI (95981) mbedtls: ssl_tls.c:8619 => write
  233. [0m
  234. [0;32mI (95985) mbedtls: ssl_tls.c:3337 => write record
  235. [0m
  236. [0;32mI (95991) mbedtls: ssl_tls.c:1441 => encrypt buf
  237. [0m
  238. [0;32mI (96028) mbedtls: ssl_tls.c:1777 <= encrypt buf
  239. [0m
  240. [0;32mI (96051) mbedtls: ssl_tls.c:2751 => flush output
  241. [0m
  242. [0;32mI (96051) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  243. [0m
  244. [0;32mI (96056) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  245. [0m
  246. [0;32mI (96061) mbedtls: ssl_tls.c:2803 <= flush output
  247. [0m
  248. [0;32mI (96066) mbedtls: ssl_tls.c:3470 <= write record
  249. [0m
  250. [0;32mI (96072) mbedtls: ssl_tls.c:8647 <= write
  251. [0m
  252. The current upload rate is = 83.1016 KB/s
  253. The current SD_CARD rate is = 1087.7345 KB/s
  254. amount of data sent = 8096
  255. TOTAL AMOUNT OF DATA READ = 6533472
  256. amount of data read from sd = 8096
  257. [0;32mI (96094) mbedtls: ssl_tls.c:8619 => write
  258. [0m
  259. [0;32mI (96098) mbedtls: ssl_tls.c:3337 => write record
  260. [0m
  261. [0;32mI (96104) mbedtls: ssl_tls.c:1441 => encrypt buf
  262. [0m
  263. [0;32mI (96141) mbedtls: ssl_tls.c:1777 <= encrypt buf
  264. [0m
  265. [0;32mI (96163) mbedtls: ssl_tls.c:2751 => flush output
  266. [0m
  267. [0;32mI (96163) mbedtls: ssl_tls.c:2770 message length: 8125, out_left: 8125
  268. [0m
  269. [0;32mI (96168) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 8125 (-0xffffe043)
  270. [0m
  271. [0;32mI (96173) mbedtls: ssl_tls.c:2803 <= flush output
  272. [0m
  273. [0;32mI (96178) mbedtls: ssl_tls.c:3470 <= write record
  274. [0m
  275. [0;32mI (96184) mbedtls: ssl_tls.c:8647 <= write
  276. [0m
  277. The current upload rate is = 83.7922 KB/s
  278. The current SD_CARD rate is = 954.4078 KB/s
  279. amount of data sent = 8096
  280. TOTAL AMOUNT OF DATA READ = 6541568
  281. amount of data read from sd = 3232
  282. [0;32mI (96206) mbedtls: ssl_tls.c:8619 => write
  283. [0m
  284. [0;32mI (96211) mbedtls: ssl_tls.c:3337 => write record
  285. [0m
  286. [0;32mI (96216) mbedtls: ssl_tls.c:1441 => encrypt buf
  287. [0m
  288. [0;32mI (96244) mbedtls: ssl_tls.c:1777 <= encrypt buf
  289. [0m
  290. [0;32mI (96262) mbedtls: ssl_tls.c:2751 => flush output
  291. [0m
  292. [0;32mI (96262) mbedtls: ssl_tls.c:2770 message length: 3261, out_left: 3261
  293. [0m
  294. [0;32mI (96266) mbedtls: ssl_tls.c:2775 ssl->f_send() returned 3261 (-0xfffff343)
  295. [0m
  296. [0;32mI (96272) mbedtls: ssl_tls.c:2803 <= flush output
  297. [0m
  298. [0;32mI (96277) mbedtls: ssl_tls.c:3470 <= write record
  299. [0m
  300. [0;32mI (96283) mbedtls: ssl_tls.c:8647 <= write
  301. [0m
  302. The current upload rate is = 36.5239 KB/s
  303. The current SD_CARD rate is = 0.0000 KB/s
  304. amount of data sent = 3232
  305. TOTAL AMOUNT OF DATA READ = 6544800
  306. [0;32mI (96594) mbedtls: ssl_tls.c:8207 => read
  307. [0m
  308. [0;32mI (96595) mbedtls: ssl_tls.c:4305 => read record
  309. [0m
  310. [0;32mI (96595) mbedtls: ssl_tls.c:2532 => fetch input
  311. [0m
  312. [0;32mI (96599) mbedtls: ssl_tls.c:2693 in_left: 0, nb_want: 5
  313. [0m
  314. [0;32mI (96606) mbedtls: ssl_tls.c:2717 in_left: 0, nb_want: 5
  315. [0m
  316. [0;32mI (96612) mbedtls: ssl_tls.c:2718 ssl->f_recv(_timeout)() returned 5 (-0xfffffffb)
  317. [0m
  318. [0;32mI (96620) mbedtls: ssl_tls.c:2738 <= fetch input
  319. [0m
  320. [0;32mI (96626) mbedtls: ssl_tls.c:2532 => fetch input
  321. [0m
  322. [0;32mI (96631) mbedtls: ssl_tls.c:2693 in_left: 5, nb_want: 377
  323. [0m
  324. [0;32mI (96639) mbedtls: ssl_tls.c:2717 in_left: 5, nb_want: 377
  325. [0m
  326. [0;32mI (96644) mbedtls: ssl_tls.c:2718 ssl->f_recv(_timeout)() returned 372 (-0xfffffe8c)
  327. [0m
  328. [0;32mI (96652) mbedtls: ssl_tls.c:2738 <= fetch input
  329. [0m
  330. [0;32mI (96660) mbedtls: ssl_tls.c:1790 => decrypt buf
  331. [0m
  332. [0;32mI (96664) mbedtls: ssl_tls.c:2372 <= decrypt buf
  333. [0m
  334. [0;32mI (96670) mbedtls: ssl_tls.c:4379 <= read record
  335. [0m
  336. [0;32mI (96674) mbedtls: ssl_tls.c:8495 <= read
  337. [0m
  338.  
  339.  Server
  340.  
  341.  nginx/1.14.0 (Ubuntu)  
  342.  
  343.  Date
  344.  
  345.  Sun, 10 Mar 2019 01:15:22 GMT  
  346.  
  347.  Content-Type
  348.  
  349.  text/html  
  350.  
  351.  Content-Length
  352.  
  353.  182  
  354.  
  355.  Connection
  356.  
  357.  keep-alive  
  358. <html>
  359.  
  360. <head><title>502 Bad Gateway</title></head>
  361.  
  362. <body bgcolor="white">
  363.  
  364. <center><h1>502 Bad Gateway</h1></center>
  365.  
  366. <hr><center>nginx/1.14.0 (Ubuntu)</center>
  367.  
  368. </body>
  369.  
  370. </html>
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378. THEEEEE RESPONSE IS CHUNKED!!!!
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  amount of headers read = 182
  385.  
  386. The response code is: 502
  387. The current download rate is = 0.0000 KB/s
  388.  
  389.  amount of data read = 266
  390. [0;31mE (96731) HTTP_CLIENT: HTTP CLOSE request failed: ESP_FAIL[0m
  391. The total upload time is = 90.9440 seconds
  392. [0;32mI (96738) HTTP_CLIENT: HTTP CLEANUP Status = 502, content_length = 182[0m
Everything sees fine to me until the response code 502 is returned. Also is this the best speed I can expect? The upload speed that is? I've got a 20 mbps upload/download connection with great signal strength.

Thanks for all the help thus far! I really appreciate it!

EDIT : THE FULL OUTPUT LOG CAN BE FOUND HERE : https://paste.ubuntu.com/p/5MVnSZh46t/

Who is online

Users browsing this forum: No registered users and 86 guests