HTTP-Post: xojo.net.httpsocket on Xojo 2018-r4 and Windows

Dear all,

i have a http-post that did’nt work on Xojo 2018-r4 AND Windows.
On Mac all works fine.
With 2017-r3 it still works.

class: xojo.net.httpsocket

Code is below.
all within “HttpSocket_property.SetRequestContent” is not delievered on Windows. On Mac it works.
If i compile the same app with xojo 2017-r3, it works on Mac and win.

Best Regards,
Christian


If get_post = “POST” Then
If app.StageCode < 3 Then
If content.Length > 200 Then
System.DebugLog " • content => " + content.Left(130) + " … " + content.Right(60)
Else
System.DebugLog " • content => " + content
End
End
Dim data As Xojo.Core.MemoryBlock = Xojo.Core.TextEncoding.UTF8.ConvertTextToData(content)
HttpSocket_property.SetRequestContent(data, “application/x-www-form-urlencoded”)
System.DebugLog " • " + Str(data.Size) + " bytes"
System.DebugLog " • " + content.Left(500)
End

Yes there is a bug with http post. It doesn’t set the content (no http body) and the Content-Length header is not being added.

I have a bugreport open, xojo din’t comment to. It is a MAJOR issue if you have thousands of http calls using xojo.net.httpsocket on windows!

Thanks Derk!

I discovered that bug too. My solution was to switch to the new URLConnection class. There it works.

But another bug is that the totalBytes property of URLConnection.ReceivingProgressed is always wrong on Windows. This is the case already for years in all available http classes.

  • URLConnection
  • Xojo.Net.HTTPSocket
  • HTTPSecureSocket

Because of this, a ProgressBar for the download shows always wrong values on Windows.

And by the way: If you use URLConnection.ContentReceived on Windows, you can not use the following code:

myWindow.Show
//Do something on myWindow
myWindow.ShowModal

The window will be opened but immediately the app hangs and you have to force quit. My solution was to write a custom class based on UrlConnection that contains a Timer which handles the URLConnection.ReceivingProgressed event.

[quote=421531:@Yves Pellot]I discovered that bug too. My solution was to switch to the new URLConnection class. There it works.

But another bug is that the totalBytes property of URLConnection.ReceivingProgressed is always wrong on Windows. This is the case already for years in all available http classes.

  • URLConnection
  • Xojo.Net.HTTPSocket
  • HTTPSecureSocket

Because of this, a ProgressBar for the download shows always wrong values on Windows.

And by the way: If you use URLConnection.ContentReceived on Mac, you can not use the following code:

myWindow.Show
//Do something on myWindow
myWindow.ShowModal

The window will be opened but immediately the app hangs and you have to force quit. My solution was to write a custom class based on UrlConnection that contains a Timer which handles the URLConnection.ContentReceived event.[/quote]

How do you mean wrong? ReceivedProgress is the data received for the “chunk” only if i remember well.
Not for the entire page or file.

Thats from the manual. I thought that bytesReceived is only the size of the current part and totalBytes from the whole file. On Mac, this is true, on Windows totalBytes differs on every event call and is less than the size of the whole file.

The following events seem to have the same behaviour on Windows:

Have you filed a feedback case about this inconsistency? It would be nice to have a usable web socket.

Not until now. In my experience every new feature in XOJO comes with many new bugs – bugs that are usually so obvious that everyone will stumble across them who will use or test these features.

If I add a feedback case, Xojo will ask for a demo project for the bug or the case will be closed immediately. Then I have much (unpaid) work to isolate the problem and to provide a demo project. In my opinion this work should be done by XOJO, as they are responsible for a working product.
After that, a problem could be fixed in one of the next releases (waiting time a few months). In the meantime I can’t ship updates of my apps. – Or bugs get never fixed like that bug: feedback://showreport?report_id=43991
Because of that I usually look for a solution to ship around a bug. That takes only a few hours and I can ship updates of my apps soon.

Tried to open a case, but feedback is not working anymore for adding cases:


I made a mistake: That bug occurs on Windows and not on the Mac. Too much code in the last weeks. :slight_smile: There is already a bug report for that and it will get fixed for the next version according to Feedback.

[quote=421531:@Yves Pellot]And by the way: If you use URLConnection.ContentReceived on Windows, you can not use the following code:

myWindow.Show
//Do something on myWindow
myWindow.ShowModal

The window will be opened but immediately the app hangs and you have to force quit. My solution was to write a custom class based on UrlConnection that contains a Timer which handles the URLConnection.ReceivingProgressed event.[/quote]

I agree with you completely.

In the meantime I could open a feedback case.

The problem was that the Summary of the case was to short. I didn’t notice that and Feedback did only deactivate the “Submit” button without showing any reason.
Usually the field should be red, to inform the user. But this worked only after another try, so I found out. I guess there is a bug in Feedback too. :slight_smile:

URLConnection.ReceivingProgressed at file download - totalBytes shows wrong value: feedback://showreport?report_id=54685

The case has been marked as fixed within around 3 hours. Awesome job from Xojo this time!!! :wink: