My original thinking was that everything should be implicit.  That was
good for my thesis, but not so good for anyone who wants to do something
I didn't anticipate.  The code (in rmsg.r:Mhttp()) tries to guess the
type of request you want using the rules:

  if Content-Type header WAS NOT given,
    use HEAD   if "ms"
    use GET    otherwise

  if Content-Type WAS given
    use POST   if Content-Type contains the string "form"
    use PUT    otherwise

At the time, nobody was using POST for anything except forms and
file-uploads, but file-upload can by done more efficiently using PUT.
Since PUT seems to have never really caught on, I suggest removing it.
Here's an untested patch against the current CVS:

Index: rmsg.r
===================================================================
RCS file: /cvsroot/unicon/unicon/src/runtime/rmsg.r,v
retrieving revision 1.2
diff -u -r1.2 rmsg.r
--- rmsg.r      30 Sep 2001 23:42:38 -0000      1.2
+++ rmsg.r      3 Mar 2003 17:14:54 -0000
@@ -199,12 +199,7 @@
                  break;
 
               case H_CONTENT_TYPE:
-                 if (strstr(colon, "form")) {
-                    req.type = POST;
-                    }
-                 else {
-                    req.type = PUT;
-                    }
+                 req.type = POST;
                  break;
 
               case H_HOST:


If anybody is using PUT now or in the future, we can always make it
selectable using an explicit switch (perhaps "mu" for "upload").

Steve

>A followup:
>
>(After fixing the bugs in the code snippets I sent in the earlier
>message, I'm wondering if what I need is a quick tutorial in using
>HTTP messaging with Unicon.  (I've looked at the Steven Lumos'
>document and it helps, but I'm still a bit thick on the subject):
>
>I want to send the following (say) as an HTTP POST action:
>----------------------------------------------------------------------
><?xml version="1.0" encoding="UTF-8"?>
><SOAP-ENV:Envelope
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsd="http://www.w3.org/1999/XMLSchema";
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
> <SOAP-ENV:Body>
>  <namesp:query xmlns:namesp="http://weaver.tuc.noao.edu/VSO_NSO";>
>    <value1 xsi:type="xsd:string">*</value1>
>    <value2 xsi:type="xsd:string">host = 'weaver'</value2>
>    <value3 xsi:type="xsd:string">date DESC</value3>
>  </namesp:query>
> </SOAP-ENV:Body>
></SOAP-ENV:Envelope>
>----------------------------------------------------------------------
>
>and then read back the result.  What attributes do I need to
>add to the open command to get that to happen?  Note that it's
>not a multipart form - the 'real content type' is 'text/xml' -
>so I don't know how to get Unicon to recognize that I want
>to send a POST action.  I've tried:
>------------------------------------------------------------
>    method call(rpc, args[])
>        local msg
>        msg := buildSoapMsg(rpc, args)
>        hdrs := mkHttpPostHdrs(msg)
>        write("Sending: \n",msg)
>
>        args := [proxy, "m"] ||| hdrs
>        svc := (open ! args) |
>               stop("Cannot get '",uri,"' connection!")
>               
>        writes(svc, msg)
>        result := ""
>        while result ||:= reads(svc, 8192)
>        close(svc)
>        write("\n\n\n")
>        write("Got: \n",result)
>--------------------------------------------------------------
>
>Where mkHttpPostHdrs(msg) is:
>
>--------------------------------------------------------------
>    method mkHttpPostHdrs(msg)
>        local a
>
>        a := []
>        put(a, "Context-Type: text/xml; charset=\"utf-8\" form")
>        put(a, "Content-Length: "||*msg)
>        put(a, "SOAPAction: \""||proxy||"\"")
>        return a
>    end
>--------------------------------------------------------------
>
>(These headers are what SOAP says are appropriate for use with
>a SOAP request message - plus the additional header (first)
>as: "POST: /SOAP HTTP/1.1" - I didn't show that here because
>my reading of the Unicon source code shows that being generated
>within Unicon on POST messages...)
>
>But the server gets an empty POST request.  Can someone point me
>to what I should be doing instead?  Thanks!
>
>-- 
>Steve Wampler <[EMAIL PROTECTED]>
>National Solar Observatory
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>Unicon-group mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/unicon-group


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to