content-length is 0 because there is no content. headers are not content.
drgottjr, thank you for the answer.
But based on your answer, I don’t understand what is the point of that fragment of Erel’s code if ContentLength will always be equal to zero?
I'm trying to find out the content length of a file before downloading it, by doing a HEAD request: Dim httpjob As HttpJob httpjob.Initialize("httpreturnfunction", Me) httpjob.GetRequest.Timeout = 5000 httpjob.head(filename) httpjob.GetRequest.InitializeHead(filename) However, I'm getting a Bad...
But in any case, how to find out the size of a JPG file without downloading it, but by downloading only the header?
OliverA, thank you for your opinion.
But your option from that thread, unfortunately, doesn’t work either:
I'm trying to find out the content length of a file before downloading it, by doing a HEAD request: Dim httpjob As HttpJob httpjob.Initialize("httpreturnfunction", Me) httpjob.GetRequest.Timeout = 5000 httpjob.head(filename) httpjob.GetRequest.InitializeHead(filename) However, I'm getting a Bad...
I've already tried it with different pictures on different sites.
Sub Test
Dim filename As String = "https://b4x-4c17.kxcdn.com/android/forum/data/avatars/m/86/86664.jpg?1520274433"
Dim j As HttpJob
j.Initialize("", Me)
j.head(filename)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log("j.GetString = " & j.GetString)
Else
Log(j.ErrorMessage)
End If
j.Release
End Sub
The result is this:
WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
Program started.
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
j.GetString =