>
>From: Kevin James <[EMAIL PROTECTED]>
>Subject: Posting w/MC 2.4.1
>Date: Sun, 11 Nov 2001 15:18:10 -0500
>MIME-Version: 1.0
>Content-Type: text/plain; charset="us-ascii" ; format="flowed"
>
>I'm having trouble posting with MC 2.4.1.  Specifically, the reply
>from the server does not get put into the local variable "it" ... the
>socket remains open and MC hangs.
>
>My particular scenario is posting to a FileMaker database, but the
>same behavior occurs sometimes ... but not always ... when I post to
>other cgis.
>
>Data is posted to the server without a problem ... and if you observe
>things with a session watcher, the server does send a reply to MC ...
>but MC doesn't seem to be able to discern when the server has
>finished sending its reply.
>
>Interested?  Have a go at it ... example stack at
>
>http://www.hwbf.org/pub/incoming/post_2_4_1.zip
>
>Webserved view of what I'm posting to:
>
>http://160.129.74.247/FMRes/FMPro?-DB=employees.fp3&-Lay=Summary&-Token=25&-Format=TableVw.htm&-Error=Err.htm&-Findall
>
>Kevin

Same problem since libUrl. I've written my own POST procedure, which 
works properly (I'm using MetaCard as a client for a knowledge base 
in Lisp by the way of cl-http).
You need only a declaration of your headers in the global variable 
TheHttpHeaders.

The posting procedure is "tellserver". theRequest is the url and 
theMessage is what you want to post.
The result is in the global array UrlBuffer (see the commented line 
in the script).  If you don't use headers, then I think you need to 
drop the second line of the script.

Note that the protocol is HTTP 1.0.


global TheHttpHeaders, UrlBuffer, ServerId, TransmitStatus

on tellServer theRequest, theMessage
   put "POST" && theRequest && "HTTP/1.0" into tRequest
   put cr & TheHttpHeaders after tRequest
   put cr & "Content-Type: APPLICATION/X-WWW-FORM-URLENCODED" & cr &\
       "Content-Length:" && the number of chars in theMessage after tRequest
   replace cr with crlf in tRequest
   open socket ServerId
   write tRequest & crlf & crlf & theMessage & crlf to socket ServerId
   put empty into TransmitStatus
   read from socket ServerId with message "readSocket"
   repeat until TransmitStatus
     wait for messages
   end repeat
   --
   #if ShowServerResponse then put UrlBuffer[Header] & cr & "--------" 
& cr & UrlBuffer[Content] into fld "Listener" of stack TheTranscript
end tellServer

on askServer theRequest
   local tRequest
   put "GET" && theRequest && "HTTP/1.0" into tRequest
   put cr & TheHttpHeaders after tRequest
   put empty into TransmitStatus
   replace cr with crlf in tRequest
   open socket ServerId
   write tRequest & crlf & crlf  to socket ServerId
   read from socket ServerId with message "readSocket"
   repeat until TransmitStatus
     wait for messages
   end repeat
   --
   put UrlBuffer[Header] & cr & "--------" & cr & UrlBuffer[Content] 
into fld "Source"
   set the htmlText of fld "Text" to UrlBuffer[Content]
   # if ShowServerResponse then put UrlBuffer[Header] & cr & 
"--------" & cr & UrlBuffer[Content] into fld "Listener" of stack 
TheTranscript
end askServer

on readSocket x,y
   put true into TransmitStatus
   get offset (crlf & crlf, y)
   if it >0 then
     put char 1 to (it-1) of y into UrlBuffer[Header]
     put char (it+4) to -1 of y into UrlBuffer[Content]
   else
     put empty into UrlBuffer[Header]
     put y into UrlBuffer[Content]
   end if
   close socket ServerId
end readSocket



Hope this may help you.

H. Chaudet
-- 
-----------------------------------------------------------------------------
Herve Chaudet                                          e-mail : [EMAIL PROTECTED]
   mobile : 33-(0)-608-05-98-09
  Unit� UPRES EA 2672
   Faculte de Medecine - 27, Bd Jean Moulin - 13385 Marseille cedex 5 - France
       Tel 33-(0)-491-79-19-10 ; Fax 33-(0)-491-79-40-13
  Service de l'Information Medicale
   Hopital Nord - Chemin des Bourrelly - 13326 Marseille cedex 15 - France
       Tel 33-(0)-491-96-80-20
-----------------------------------------------------------------------------

Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to