Re: Buggy post url cmd - socket stays open

2003-07-24 Thread Pierre Sahores
Hi Alain,

Try this witch works for me perfectly from MC 2.32 to 2.5:

  set httpheaders to Content-type: application/x-www-form-urlencoded  return
  post fld 1 to url myURL

Hope this help.

Best,


On Thu, 2003-07-24 at 05:19, Alain Farmer wrote:
 Hello Scott and y'all,
 
 I have a persistant problem with the post url syntax
 of MetaCard 2.5, as I did with 2.4 as well. The client
 is a MetaCard 2.5 stack with the following handler in
 a button :
 
 on mouseUp
   put http://www.giguere.uqam.ca/; into myHost
   put myHost  XA/MenusXApost.cgi into myURL
   if the openSockets is empty then
 post field 1 to url myURL
 if the result is not empty
 then answer the result
 else answer it
   else
 beep
   end if
 end mouseUp
 
 The CGI program on the server-side is a
 HyperCard-based CGI which performs marvelously. It
 returns the minimum set of HTTP headers required by
 MetaCard. The proof of this is that the first click on
 the above button indeed returns what it is supposed
 to. Btw, I am using Webstar 2.1 on MacOS 8.6 on the
 server-side.
 
 The problem arises after the first click of this
 button. On the second and subsequent clicks of this
 button, the handler beeps, e.g. the openSockets is not
 empty which, IOW, means that the socket remains open
 after the first click. In fact, it (the socket)
 *never* closes, and this inhibits it from doing its
 thing more than once.
 
 My diagnostic, therefore, is that there is a bug in
 MC's post command whereby the socket that is opened is
 never closed. Please fix this *bug* by making the
 socket close automatically ASAP after the reply is
 received by the MC client. Or give us the new syntax
 we need to *close* the open sockets ourselves.
 
 If you disbelieve my account, then feel free to
 download a copy of my client stack which exhibits this
 problem :
 
   http://ufp.uqam.ca/MC/test_url_stuff.mc.zip
 
 Thank you for your time and earnest work,  :)
 
 Alain Farmer
 
 NB: This is relatively URGENT for me. Please respond
 as soon as you can [Scott]. It has nothing to do with
 the interface; this is clearly an engine issue.
 
 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard
-- 
Bien cordialement, Pierre Sahores

Serveurs d'applications  bases ACID SQL
Penser et produire l'avantage compétitif

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Buggy post url cmd - socket stays open

2003-07-24 Thread Dave Cragg
At 8:19 pm -0700 23/7/03, Alain Farmer wrote:
Hello Scott and y'all,

I have a persistant problem with the post url syntax
of MetaCard 2.5, as I did with 2.4 as well. The client
is a MetaCard 2.5 stack with the following handler in
a button :
on mouseUp
  put http://www.giguere.uqam.ca/; into myHost
  put myHost  XA/MenusXApost.cgi into myURL
  if the openSockets is empty then
post field 1 to url myURL
if the result is not empty
then answer the result
else answer it
  else
beep
  end if
end mouseUp
The CGI program on the server-side is a
HyperCard-based CGI which performs marvelously. It
returns the minimum set of HTTP headers required by
MetaCard. The proof of this is that the first click on
the above button indeed returns what it is supposed
to. Btw, I am using Webstar 2.1 on MacOS 8.6 on the
server-side.
The problem arises after the first click of this
button. On the second and subsequent clicks of this
button, the handler beeps, e.g. the openSockets is not
empty which, IOW, means that the socket remains open
after the first click. In fact, it (the socket)
*never* closes, and this inhibits it from doing its
thing more than once.

My diagnostic, therefore, is that there is a bug in
MC's post command whereby the socket that is opened is
never closed. Please fix this *bug* by making the
socket close automatically ASAP after the reply is
received by the MC client. Or give us the new syntax
we need to *close* the open sockets ourselves.
If you disbelieve my account, then feel free to
download a copy of my client stack which exhibits this
problem :
I believe you. But the behavior is intentional. By default, the 
libUrl script doesn't close the socket after completing a request. 
This allows re-use of the same socket which is useful if you are 
making a series of requests to the same server, and is in line with 
the HTTP 1.1 spec. (The socket will eventually get closed by the 
server.)

Is there any reason that you need to check that the openSockets is 
empty? If it's just to prevent someone clicking on the button again 
while the request is being handled, you could disable the button at 
the top of the script and re-enable it after the request has 
completed.

But if you really want to have the socket closed after the post 
competes, then the proper way would be to set the httpHeaders as 
follows:

set the httpHeaders to Connection: close

If you do this, the server should immediately close the socket after 
completing the post request (assuming the server is HTTP 1.1 
compliant -- I don't know about Webstar 2.1)

Cheers
Dave


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Buggy post url cmd - socket stays open

2003-07-24 Thread Alain Farmer
Hello,

 Hi Alain,
 Try this witch works for me perfectly from
 MC 2.32 to 2.5:
 set httpheaders to Content-type:
 application/x-www-form-urlencoded  return
 post fld 1 to url myURL
 Hope this help.

Thank you for the attempt, Pierre, but I tried it just
now and my problem remains unchanged. My client stack
is running on top of MacOS 8.6 ; do you have the same
setup as me? Perhaps this socket bug only affects
those using the classic MacOS, or perhaps just a bug
in versions of MacOS less than 9.x ...

Any further ideas?

Distressed,

Alain

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Buggy post url cmd - socket stays open

2003-07-24 Thread Yennie
FWIW, since this is in fact part of libURL, it is possible to edit the scripts in question and change their behavior if either the need is urgent or it doesn't get officially changed.

If you truly want the socket immediately closed, is there any reason why you can't check for it and close it yourself after the transfer is complete? i.e.

repeat until the openSockets is empty
  close socket (line 1 of the openSockets)
end repeat

HTH,
Brian

I believe you. But the behavior is intentional. By default, the
libUrl script doesn't close the socket after completing a request.
This allows re-use of the same socket which is useful if you are
making a series of requests to the same server, and is in line with
the HTTP 1.1 spec. (The socket will eventually get closed by the
server.)






--
Brian Yennie
Chief Technology Officer
QLD Learning, LLC
www.QLDLearning.com

PH: (904)-997-0212
EMAIL: [EMAIL PROTECTED]
---


Re: Buggy post url cmd - socket stays open

2003-07-24 Thread Alain Farmer
Bravo Yennie, you're a genius!  :))

 repeat until the openSockets is empty
 close socket (line 1 of the openSockets)
 end repeat

The above makes it work. I am thrilled!  :))

The close socket syntax is not documented anywhere.
Or perhaps it is only my Help stacks that are too
dated. Is it possible that my Help stacks were not
upgraded to 2.5 along with the engine? Is this a
'separate' step?

Thanks to y'all three for helping me so. Bonus points
go to Yennie for actually solving the problem. What
would I do without you MC veterans! This list is
essential. :))

Regards,

Alain

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Buggy post url cmd - socket stays open

2003-07-24 Thread Pierre Sahores
On Thu, 2003-07-24 at 22:18, Alain Farmer wrote:
 Hello,
 
  Hi Alain,
  Try this witch works for me perfectly from
  MC 2.32 to 2.5:
  set httpheaders to Content-type:
  application/x-www-form-urlencoded  return
  post fld 1 to url myURL
  Hope this help.
 
 Thank you for the attempt, Pierre, but I tried it just
 now and my problem remains unchanged. My client stack
 is running on top of MacOS 8.6 ; do you have the same
 setup as me? Perhaps this socket bug only affects
 those using the classic MacOS, or perhaps just a bug
 in versions of MacOS less than 9.x ...
 
 Any further ideas?
 
 Distressed,
 
 Alain
 
 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard

Hi Alain,

I don't use MacOS 8+Webstar+HC since 1999 and the up-on config is only
used on the linux and jaguar platforms (+Apache+PHP+MC+PostgreSQL).

You will probably get a best luck in listening to the Dave's and Brians
advices.
-- 
Bests, Pierre Sahores

Serveurs d'applications  bases ACID SQL
Penser et produire l'avantage compétitif

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Buggy post url cmd - socket stays open

2003-07-24 Thread Yennie
Alain,

Glad it worked.

"close socket" is documented under the "close" command, although a bit buried and sparse. You'll find it on the very last line of both the syntax listing and the help text.

FWIW, the Rev documentation is more complete on this particular command- I often find it helpful to have both sets of docs on hand.

Happy post-ing

--
Brian Yennie
Chief Technology Officer
QLD Learning, LLC
www.QLDLearning.com

PH: (904)-997-0212
EMAIL: [EMAIL PROTECTED]
---