Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Sep 26, 2017 1:06 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Using HTTPSocket Synchronously
PostPosted: Tue Apr 16, 2013 5:09 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
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?

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Tue Apr 16, 2013 5:19 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
This does work synchronously:
Dim Socket As New HTTPSocket
Dim Headers As InternetHeaders

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

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Tue Apr 16, 2013 6:53 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Works on prior versions (I tested 2010r5.1). Does not work on 2012r2.1 Looks like it got broke somewhere in between.


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Tue Apr 16, 2013 7:16 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
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. :?

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Wed Apr 17, 2013 10:33 pm 
Offline

Joined: Tue Nov 20, 2012 2:32 am
Posts: 5
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)


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Thu Apr 18, 2013 7:43 am 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
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

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Sun May 12, 2013 11:11 am 
Offline

Joined: Sat Jul 16, 2011 2:45 pm
Posts: 76
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Sun May 12, 2013 9:31 pm 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
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.

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Mon May 13, 2013 12:50 am 
Offline

Joined: Wed Dec 14, 2011 4:20 am
Posts: 84
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Tue May 28, 2013 7:12 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 7:05 am
Posts: 565
Location: Emsworth, UK
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!

_________________
Yes it's me in the avatar


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Tue May 28, 2013 8:16 am 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
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!

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Wed May 29, 2013 2:36 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 7:05 am
Posts: 565
Location: Emsworth, UK
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.

_________________
Yes it's me in the avatar


Top
 Profile  
Reply with quote  
 Post subject: Re: Using HTTPSocket Synchronously
PostPosted: Thu May 30, 2013 9:38 am 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
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.

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group