Questions tagged [http-content-length]

The Content-Length header specifies the length (in bytes) of the content, both for requests and responses.

The Content-Length header specifies the length (in bytes) of the content, both for requests and responses. It is especially important when using persistent connections, so the end of one message and the start of the next can be delineated. It is not used for chunked content.

118 questions
3
votes
3 answers

Java Applet 411 Content Length

I am new to Java. I wrote an applet with a gui that sends results (int w and int p) to a server, and I get the "411 Length Required" error. What am I doing wrong? How do you set a Content-Length? This is the method that communicates with the…
psdev
  • 43
  • 1
  • 5
3
votes
3 answers

WCF Content-Length HTTP header on outbound message

I'm in a tough situation in which a Java web service endpoint hosted on an IBM HTTP Server (IHS) requires a Content-Length header, although it supposedly conforms to HTTP/1.1. If I send the header, everything works. If I leave it off, I get a 500…
Dan Lynn
  • 251
  • 2
  • 8
3
votes
1 answer

PHP file_get_contents() follow Content-length header

i'm using code like this: //section with the important stuff for the client ob_start(); echo "Blah... Random Content" . rand(1,1000); $size = ob_get_length(); header("Content-Length: $size"); header('Connection:…
2
votes
2 answers

What content length should I send when I am encoding data with gzip?

I am writing a small web server and would like to send gzipped data. In the http header for the Content-Length field do I set the length of the compressed data or the length of the uncompressed data?
Jesse Vogt
  • 16,229
  • 16
  • 59
  • 72
2
votes
1 answer

How to disable Content-Length check?

Is there a way to disable checking for Content-Length header in the PUT requests on nginx?
ddario
  • 1,015
  • 3
  • 12
  • 25
2
votes
0 answers

Safari doesn't set content-length when using xmlhttprequest

I have a Javascript object that i am trying to post to the server with XMLHttpRequest() using JSON.stringify(). my code works fine in all major browsers except for Safari (5.1.2). My analysis shows that Safari, is in fact sending the data. i can…
Remus
  • 61
  • 7
2
votes
3 answers

How to validate content length of multipart form data in JavaScript?

I post FormData (including files) to a server that rejects requests with a content-length that exceeds a specific limit. I'd like to validate the content-length in my JavaScript client (browser) before doing a request that is doomed to be rejected.…
2
votes
2 answers

Axios set Content-Length manually, nodeJS

Is there a way to send a post request in nodeJS and specify th content-length. I tried (using axios): let data = `Some text data...........`; let form = await Axios.post( "url.......", data, { headers: { …
Shmili Breuer
  • 3,927
  • 2
  • 17
  • 26
2
votes
0 answers

Disable transfer-encoding in @RestController

I am having @RestController with endpoint like below (spring-boot version 1.5.9.RELEASE) @RestController public class Controller { @PostMapping(value = "profile", consumes = MediaType.APPLICATION_JSON_VALUE, produces =…
2
votes
2 answers

php cURL POST content length always show -1

I am new to using cURL for POST request to the server, but the server always show the content-length is -1, my code is below: $data = array( 'data' => 'Testing data', 'name' => 'Testing', 'no' => '1234' ); foreach($data as…
Nulra
  • 547
  • 5
  • 19
2
votes
3 answers

How to remove Content-length header from HTTP response generated in a simple server?

Following is my sample HTTP server. I need to remove the 'Content-length:' header generated at the response. I have tried many approaches and not succeded. Is there any way to remove the content-length from server response? public class…
Methma
  • 152
  • 3
  • 13
2
votes
2 answers

Download file via PHP script from FTP server to browser with Content-Length header without storing the file on the web server

I use this code to download a file to memory from ftp: public static function getFtpFileContents($conn_id , $file) { ob_start(); $result = ftp_get($conn_id, "php://output", $file, FTP_BINARY); $data = ob_get_contents(); …
Bad Mav
  • 23
  • 1
  • 8
2
votes
0 answers

Http content-length absence and keep-alive

I use Nginx + lua module and body_filter_by_lua directive. Nginx-lua docs said When the Lua code may change the length of the response body, then it is required to always clear out the Content-Length response header (if any) in a header filter to…
Pavel Patrin
  • 1,630
  • 1
  • 19
  • 33
2
votes
1 answer

Spring RestTemplate Large Files ContentLength Auto Changed

Got a question on RestTemplate with Large Files. Is there a max content length and/or does it automatically get changed despite explicitly being set? I have a file that is 5GB that I want to send to my CDN (Akamai) via HTTP PUT command. I've set it…
abeauchamp
  • 825
  • 2
  • 18
  • 29
2
votes
1 answer

Content length is not showing in HTTP response header

Accept-Ranges:bytes Cache-Control:max-age=1296915 Connection:Keep-Alive Content-Encoding:gzip Content-Type:application/pdf Date:Mon, 27 Jun 2016 07:24:58 GMT ETag:"9c96c69837a1d11:0-gzip" Keep-Alive:timeout=15, max=100 Last-Modified:Thu, 28 Apr 2016…