• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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