Does "post [variable] to URL" work from a revlet?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Paul.RaulersonBUSIvAg
Posts: 21
Joined: Tue Aug 07, 2012 2:00 pm

Does "post [variable] to URL" work from a revlet?

Post by Paul.RaulersonBUSIvAg » Mon Aug 13, 2012 7:57 pm

Writing first app in LiveCode and rather ambitiously, want it to run on Mac, Windows, iPad, and Web. Got the first three down, but the "post myVariable to URL syntax seems to fail pretty miserably when ran as a Web application. It basically just gets back an unexpected (blank?) response and errors out.

Is there a special trick to doing that, or are we supposed to submit Ajax like commands in some other way?
Works perfectly well on Mac, Windows, and an Pad.

Yours,
-Paul

Here is a code example, I did have to block out the program name and the server, they normally have content in them but the server won't let me post anything with a URL or link in it. :)

Code: Select all

put ( "PGM=XXXX&OG=01&SCR=XX&lang=e&port=p&WUID=" & urlencode(field WUID) \
        & "&WPWD=" & urlencode(field WPWD)  \
        & "&WPIN=" & urlencode(lPIN) )  \ 
        into vRequest
   post vRequest to URL
   put  it into vResponse
   put  urlDecode(vResponse)  into vResponse
   answer vResponse with "ok"

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Does "post [variable] to URL" work from a revlet?

Post by sturgis » Mon Aug 13, 2012 9:41 pm

In the standalone application settings for web did you put a check in the box for internet under security settings? This will cause a dialog to pop up asking the user to confirm that its ok for the revlet to access the internet.

Paul.RaulersonBUSIvAg
Posts: 21
Joined: Tue Aug 07, 2012 2:00 pm

Re: Does "post [variable] to URL" work from a revlet?

Post by Paul.RaulersonBUSIvAg » Mon Aug 13, 2012 10:29 pm

sturgis wrote:In the standalone application settings for web did you put a check in the box for internet under security settings? This will cause a dialog to pop up asking the user to confirm that its ok for the revlet to access the internet.
I did not see one for internet, but I did check and uncheck the one for network. I was thinking that having it checked meant it was disabled, but I probably read the docs wrong.
Thanks though!

-Paul

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Does "post [variable] to URL" work from a revlet?

Post by sturgis » Mon Aug 13, 2012 10:38 pm

DOh yep, its "network" that needs to be checked. Read what I mean not what I type! *grin*

Paul.RaulersonBUSIvAg
Posts: 21
Joined: Tue Aug 07, 2012 2:00 pm

Re: Does "post [variable] to URL" work from a revlet?

Post by Paul.RaulersonBUSIvAg » Mon Aug 13, 2012 11:54 pm

sturgis wrote:DOh yep, its "network" that needs to be checked. Read what I mean not what I type! *grin*
LOL!

Well, I was hoping that was the problem, and there was a setting stashed somewhere I missed. :)

Not happening though, has to be something I am doing (or not doing) I think, but whatever it is, it sure isn't very apparent.

Your,
Paul

Paul.RaulersonBUSrLn
Posts: 4
Joined: Tue Aug 07, 2012 2:00 pm

Re: Does "post [variable] to URL" work from a revlet?

Post by Paul.RaulersonBUSrLn » Tue Aug 14, 2012 5:05 am

Okay, I found the culprit, but it isn't pretty. :idea:

The Web Revlet is not processing the SSL connections correctly for some reason. This is causing most of the problems, as it looks like LC never connects. The error only appears when you check "result" instead of "it". The exact error message, using the HTTPS address for Google (Which I cannot type in here because I do not have permission to type in links or domain references. What is up with that?) is reproduced below:

Code: Select all

error -Error with certificate at depth: 1  issuer   = /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority  subject  = /C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA  err 20:unable to get local issuer certificate
It of course, works fine when you use http vice https.

This is a rather serious bug - who can afford to send any kind of sensitive information over a clear connection?

This problem is most likely a showstopper if there is no plan to fix it. I hate that.

The other problem I found was the "ask password clear " command causes whatever the user enters to be inverted - when running from an Revlet. Like the above SSL issue, it works fine from a standalone or on a iPad/iPhone.

What is the proper way to get these annoying bugs addressed? Should I use one of the "Quick Response" tech support incidents or is there is a better way?

I am really digging LC, and really like how it gets out of the way and lets you work with getting an App out the door. Unfortunately, the need to support a bit of Web stuff is critical.

Help?

-Paul

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Does "post [variable] to URL" work from a revlet?

Post by Klaus » Tue Aug 14, 2012 10:29 am

Hi Paul,

I have been bitten by this before! :?
Add this line before every post/access to HTTPS connections:
...
libUrlSetSSLVerification false
post whatever to url "https://wherever.com/mycgi"
...

Its not documented, but should do the trick.


Best

Klaus

Paul.RaulersonBUSIvAg
Posts: 21
Joined: Tue Aug 07, 2012 2:00 pm

Re: Does "post [variable] to URL" work from a revlet?

Post by Paul.RaulersonBUSIvAg » Tue Aug 14, 2012 3:58 pm

I would have sworn I posted a thank you- but it seems I did not. So...

Thank you Klaus! That worked and allowed me to move past an absolute showstopper.

I still want to follow up with it as a bug report, because it is a trifle nerve wracking depending upon an undocumented "feature" to make something actually work. :)
But thank you again!

Yours,
-Paul

Post Reply