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
2
votes
1 answer

How not to let python requests calculate content-length and use the provided one?

We have some custom module where we have redefined open, seek, read, tell functions to read only a part of file according to the arguments. But, this logic overrides the default tell and python requests is trying to calculate the content-length…
GP92
  • 433
  • 1
  • 12
  • 30
2
votes
0 answers

Content-Length header value is not equal to real content length

Trying to close connection with browser and keep php process alive, but browser waiting for the process end. I think that the problem is in real content length. There is my code in ZF1: ob_end_clean(); header("Connection:…
Alex Rešatniak
  • 443
  • 1
  • 5
  • 9
2
votes
0 answers

Add response header based on another header in Lighttpd

I have a situation where I want to use "Content-Length" header from another domain with Lighttpd using XHR HEAD request but I get Refused to get unsafe header 'content-length' message. My idea is to add response header based on another response…
2
votes
3 answers

WebResponse contentLength property is -1?

I have a windows application that gets URL and download .jpeg file. For some urls the ContentLength property is -1, therefore it throws exception. Here is my code: var url = new Uri(sUrlToReadFileFrom[i]); _request =…
2
votes
1 answer

Is it possible to ignore Http Content-Length?

I am using Crawler4J to collect information about a website. But sometimes I get the following error: INFORMATION: Exception while fetching content for: {someurl} [Premature end of Content-Length delimited message body (expected: X; received:…
Hisushi
  • 67
  • 1
  • 11
2
votes
0 answers

R: RCurl postForm() with Content-Length > 1024

I'm having trouble POSTing data with Content-Length > 1024 using RCurl and postForm(). How can I increase the size limit of my HTTP request? curl.opts <- list(httpheader = "Expect:", httpheader = "Accept:text/xml", …
thulsadoom
  • 131
  • 5
2
votes
1 answer

JClouds S3: Specify Content Length when uploading file

I wrote an application using JClouds 1.6.2 and had file upload code like java.io.File file = ... blobStore.putBlob(containerName, blobStore.blobBuilder(name) .payload(file) .calculateMD5() .build() ); This worked perfectly…
Heinzi
  • 5,793
  • 4
  • 40
  • 69
2
votes
1 answer

Should I set response.setContentLength() header?

What happen if I do not specify the Content-Length header when I send a HttpServletResponse containing a zip file? I did some tests and it seems that the header is set by default with the correct file length. Can I be sure that this always happens.…
Panciz
  • 2,183
  • 2
  • 30
  • 54
1
vote
2 answers

Ignore Content-Length header when using file_get_contents

I need to get the contents of a page, which always sends a Content-Length: 0 header, however the page is never empty. The file_get_contents(url) just returns an empty string. The whole header returned by the page is: HTTP/1.1 200 OK X-Powered-By:…
Tyilo
  • 28,998
  • 40
  • 113
  • 198
1
vote
1 answer

Content-Length and httpCompression dilemma

My ASP.NET app returns JSON object to user, it contains binary encoded data. Due to this I decided to enable HTTP compression and the problem begun with Content-Length. If I enable compression the Content-Length header is ignored while response s…
Tomas
  • 17,551
  • 43
  • 152
  • 257
1
vote
1 answer

Content-Length Header in Http 2 for POST/PUT request with empty body required?

I am receiving a 411 length required error when sending HTTP2 POST requests without a body to an Azure API Management (but this is not a question about Azure). my request is: curl --location --request POST "..." --header "Content-Type:…
1
vote
0 answers

HTTP: pictures not fully received. how to avoid that, i.e. force browser to try again?

I have written a small picture script which shows a directory listing with thumbnails and also previews of the pictures. Directory listing example Image preview example Source code In some cases, when you click through several image previews (you…
Albert
  • 65,406
  • 61
  • 242
  • 386
1
vote
1 answer

Google Storage HEAD response missing content-length

I am using a library (Apache Libcloud) to make requests to google storage. Inside the library, a HEAD request is made to the URL that is queried within google storage. You can find the code for it here, search for def get_object. The important line…
1
vote
0 answers

How to increase range limit that can be requested partially when Transfer-Encoding = chunked?

I was trying to make a download manager that supports resume. My app uses the cookies and headers got from Chrome browser via an extension that I have. I faced a problem when I tried to send partially request to a url that has…
Ali Tor
  • 2,772
  • 2
  • 27
  • 58
1
vote
1 answer

How to add Content-Length header to cached files on Nginx?

I'm using using Nginx as Reverse Proxy and Caching the proxied response from my upstream server. So, I need to add a Content-Length header to this cached files before sending to my client. I've tried adding the $upstream_response_length variable to…
Miguel Torre
  • 11
  • 1
  • 2