Answer the question
In order to leave comments, you need to log in
Is it possible to fake Content-length?
I did not find info on the Internet.
Is the header with content-length sent by the browser or how does it all happen?
For example, the server accepts a request for a file, is it safe to trust the content-length?
Answer the question
In order to leave comments, you need to log in
If the Content-Length is greater than the actual body, then the web server will wait for data to be received and eventually timeout without waiting for all the data (or part of the next request will end up at the end of the body of the current one), if vice versa, then the end of the current request will end up in the beginning of the next one and the next request will fail.
That is, if you received a valid request, then Content-Length is the actual amount of data.
If you implement an HTTP server yourself, you need to check all this, but if you use a ready-made one, then in fact, yes, you can trust it.
I think this can be easily checked with curl and manual header generation.
$post_data = array(
"end" => array("dateTime" => "2013-14-11T10:40:00.000-07:00"),
"start" => array("dateTime" => "2013-14-11T10:00:00.000-07:00"),
"summary" => "my_summary",
"description" => "my_description"
);
$post_data = json_encode($post_data);
curl_setopt($ch2, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($post_data),)
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question