Closed
Description
I don't know if this is a normal behaviour but if I send a large body (a file > 1MB) the CURLOPT_POSTFIELDS option is not used but the CURLOPT_READFUNCTION instead and in the createHeaders
method the content-length
header is set to 0.
Doing this, my server doest not reveive data, all is empty.
So 2 possible scenario :
- my server is not well configured and does not deal correctly with the request received
- the
content-length
should be set with the body size if present.
If I set the content-length header with the body, my server receive all the data and have an expected behaviour, I put this for my test :
if ('content-length' === $header) {
$values = [0];
if (array_key_exists(CURLOPT_POSTFIELDS, $options)) {
$values = [strlen($options[CURLOPT_POSTFIELDS])];
} else {
$body = $request->getBody();
$bodySize = $body->getSize();
if ($bodySize > 0) {
$values = [(string) $bodySize];
}
}
}
but maybe the CURLOPT_INFILESIZE
is a better option