• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

Resolved Error 400 on POST request

jojo

New Pleskian
Hi,

When I perform a post request to a PHP script everything works fine, until I increase the header size, then I get an Error 400.

In the request header I have Token field, if it has around 14 characters or less, then the POST request goes through just fine, and I get read the token from the header.
If I increase the token size from 14 characters to something around 20 characters for example, I get error 400 and the post request fails.

The request header looks like this: (C++)
Code:
String data;
  data = F("POST /create.php HTTP/1.1\r\n");
  data += F("cache-control: no-cache\r\n");
  data += F("Content-Type: multipart/form-data; boundary=");
  data += BOUNDARY;
  data += "\r\n";
  data += F("User-Agent: mydevice/0.0.1\r\n");
  data += F("Accept: */*\r\n");
  data += F("Host: ");
  data += SERVER;
  data += F("\r\n");
  data += F("token: ");
  data += token;           // if this token is "1234567890101112" it works, if it's more than that, 400 error.
  data += "\r\n";
  data += F("accept-encoding: gzip, deflate\r\n");
  data += F("Connection: keep-alive\r\n");
  data += F("content-length: ");
  data += String(length);
  data += "\r\n";
  data += "\r\n";
  return (data);

Any help is appreciated.
 
Back
Top