Real Software Forums
http://forums.realsoftware.com/

Using HTTPSocket Synchronously
http://forums.realsoftware.com/viewtopic.php?f=2&t=47613
Page 1 of 1

Author:  Jason_Adams [ Tue Apr 16, 2013 5:09 pm ]
Post subject:  Using HTTPSocket Synchronously

I'm having a strange issue with HTTPSocket. If I try to get the content of, for example, Google.com synchronously, it fails:
TextArea1.Text = socket.get("www.google.com", 5)


If, however, I do this asynchronously, it works just fine:
Event PushButton1.Action
socket.get("www.google.com")
End Event

Event socket.PageReceived
TextArea1.Text = content
End Event


Am I missing something?

Author:  Jason_Adams [ Tue Apr 16, 2013 5:19 pm ]
Post subject:  Re: Using HTTPSocket Synchronously

This does work synchronously:
Dim Socket As New HTTPSocket
Dim Headers As InternetHeaders

Headers = Socket.GetHeaders("www.google.com", 10)
MsgBox Headers.Source

Author:  timhare [ Tue Apr 16, 2013 6:53 pm ]
Post subject:  Re: Using HTTPSocket Synchronously

Works on prior versions (I tested 2010r5.1). Does not work on 2012r2.1 Looks like it got broke somewhere in between.

Author:  Jason_Adams [ Tue Apr 16, 2013 7:16 pm ]
Post subject:  Re: Using HTTPSocket Synchronously

Thanks for verifying that, Tim. I also found a feedback case, 22823, opened by Paul that was closed because it was done "by design". I emailed Paul to see what that means. :?

Author:  ALoren [ Wed Apr 17, 2013 10:33 pm ]
Post subject:  Re: Using HTTPSocket Synchronously

Strange, I'm on 2012r2 and this works fine for me:

Dim socket1 As New HTTPSocket
textarea1.text = socket1.Get("http://www.google.com",30)

Author:  Jason_Adams [ Thu Apr 18, 2013 7:43 am ]
Post subject:  Re: Using HTTPSocket Synchronously

ALoren wrote:
Strange, I'm on 2012r2 and this works fine for me:

Dim socket1 As New HTTPSocket
textarea1.text = socket1.Get("http://www.google.com",30)

Thanks! That means it got broke in the point-release. :P

Author:  lukus001 [ Sun May 12, 2013 11:11 am ]
Post subject:  Re: Using HTTPSocket Synchronously

Jason_Adams wrote:
ALoren wrote:
Strange, I'm on 2012r2 and this works fine for me:

Dim socket1 As New HTTPSocket
textarea1.text = socket1.Get("http://www.google.com",30)

Thanks! That means it got broke in the point-release. :P

Works on 2012r2.1 for me.

Author:  Jason_Adams [ Sun May 12, 2013 9:31 pm ]
Post subject:  Re: Using HTTPSocket Synchronously

It turns out it was an HTTP 1.1 issue. The HTTPSocket only supports 1.0, and google.com only replies with 1.1 information. Technically the socket is receiving the information, but as the connection isn't terminating the socket doesn't realize it's been sent -- the major difference between HTTP 1.0 and 1.1.

Author:  J.Hansen [ Mon May 13, 2013 12:50 am ]
Post subject:  Re: Using HTTPSocket Synchronously

Jason_Adams wrote:
It turns out it was an HTTP 1.1 issue. The HTTPSocket only supports 1.0, and google.com only replies with 1.1 information. Technically the socket is receiving the information, but as the connection isn't terminating the socket doesn't realize it's been sent -- the major difference between HTTP 1.0 and 1.1.


I guess, when RS will manage to provide support for HTTP 1.2 (probably take years) , the web servers are using HTTP/2.0 (https://en.wikipedia.org/wiki/HTTP_2.0) :D

Author:  msssltd [ Tue May 28, 2013 7:12 am ]
Post subject:  Re: Using HTTPSocket Synchronously

Jason_Adams wrote:
It turns out it was an HTTP 1.1 issue. The HTTPSocket only supports 1.0, and google.com only replies with 1.1 information.


Rubbish.

Try this. \r\n means the return key
telnet http://www.google.com 80
GET / HTTP/1.0\r\n
\r\n

Google declares a HTTP 1.0 response, provides a valid 302 redirect and drops the connection.

Now this
telnet http://www.google.com 80
GET / HTTP/1.1\r\n
Host: http://www.google.com\r\n
Connection: close\r\n
\r\n

Google declares a HTTP 1.1 response, provides a valid 302 redirect and drops the connection.

And finally
telnet http://www.google.com 80
get / http/1.0\r\n
\r\n

Google responds with a 400, bad request. Because the status line is lower case.

Google is conformant, as you might expect.

The answer you are looking for is, RS borked the HTTP socket. Which they won't admit!

Author:  Jason_Adams [ Tue May 28, 2013 8:16 am ]
Post subject:  Re: Using HTTPSocket Synchronously

Thanks, msssltd, I definitely yield to you for networking expertise. I've read your antipathy in the past towards the HTTPSocket, but you happen to have a Feedback case for this? If you do, please post the link here and I'll put it on my top list. Thanks!

Author:  msssltd [ Wed May 29, 2013 2:36 am ]
Post subject:  Re: Using HTTPSocket Synchronously

Antipathy is entirely the wrong word to use. Any antipathy I have here, is towards the manner in which RS does business.

I don't have a feedback number due to my current ambivalence towards RS and their products. In a nutshell, whatever issue I might come across in the network classes, I can (probably) resolve faster and more reliably than RS would, by using an old version of RS to re-write the functionality from the Socket class upwards.

Author:  Jason_Adams [ Thu May 30, 2013 9:38 am ]
Post subject:  Re: Using HTTPSocket Synchronously

msssltd wrote:
Antipathy is entirely the wrong word to use. Any antipathy I have here, is towards the manner in which RS does business.

Ah. Ok.

msssltd wrote:
I don't have a feedback number due to my current ambivalence towards RS and their products. In a nutshell, whatever issue I might come across in the network classes, I can (probably) resolve faster and more reliably than RS would, by using an old version of RS to re-write the functionality from the Socket class upwards.

That's unfortunate, as it makes it difficult for others to rally behind.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/