login about faq

Bonjour,

I've been playing around with the REST module for a couple of days, to make a script that can automatically download from dl.free.fr With other websites, the tests all work excellent! but with this particular website I have a problem: the header does not return a content type, and also does not return a chunked response!

The response header is quite empty to be honest: Date: Tue, 10 Oct 2016 14:59:10 GMT Server: Apache/DL [Apr 9 2012 10:05:09] Cache-Control: no-cache Expires: Fri, 29 Oct 1998 10:10:45 GMT Connection: close Content-Type: text/html

Which results in an error in the rest module: (understandable)

readResponseBody: No Content-Length header AND not a chunked response. Assuming no response body.

However, in firefox there is content! meaning the assumption in this case is wrong. Also, some reading learned me that the server is not required to send content-length or chunked data. (even though it would make live easier if it did...)

Is is possible to obtain the HTML of this page, so I can perform the download? I have not yet found a method using the Chilkat manual for REST.

Cordialement, Marcel

asked Oct 11 at 17:43

Marcel's gravatar image

Marcel
11

edited Oct 11 at 17:44


I fixed the REST API so that it will work with the situation you described above. If you need a preRelease build, please let me know the programming language, operating system, and anything else to know the exact build required.

link

answered Oct 11 at 20:26

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Bonjour, I was also wondering how the client could know when the data is transmitted, but of course: connection: close is the solution! i'm using the x64 .net4.6 C# solution (win10) installed via nuGet. It says version 9.5.0.60. A preRelease could be very usefull, so I can continue the project.

(Oct 12 at 06:24) Marcel

Hi Marcel,

The Chilkat Http object will handle it. You can just pass the URL to the Http.Download method if you want to download directly to a file, or you could call Http.QuickGetStr to return the HTML as a string.

I'll see what can be done about the REST object. The big problem with not having a Content-Length or chunked response is that, if the client decides to read until the server closes the connection, it could hang if the server does not close the connection. Assuming the connection will be closed, then all is OKD. If the server sends a "Connection: close" header (and is speaking truthgully), and dl.free.fr does, then no hang should occur when reading until the socket is closed. I'm assuming that's what Chilkat.Http is doing...

link

answered Oct 11 at 18:31

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×33
×11

Asked: Oct 11 at 17:43

Seen: 192 times

Last updated: Oct 12 at 06:24

powered by OSQA