Changeset 8451 in project

02/13/08 14:37:18 (12 years ago)

Changes applied for elf ( through svnwiki:

documenting my changes to the method.

1 edited


  • wiki/http

    r7159 r8451  
    6565===== http:POST
    67  [procedure] (http:POST REQUEST [ARGUMENTS] [DELIM1] [DELIM2] [ENCODER])
     67 [procedure] (http:POST REQUEST [ARGUMENTS] #!key [headers: LIST] [type: CTYPE] [delim: DELIM])
    6969Sends a ''POST'' request represented by {{REQUEST}}, which may be a string (an URL)
    7070or a HTTP request object, and returns a string containing the body of the servers response.
    71 {{ARGUMENTS}} should be either a list of parameters passed in the body of the POST
    72 request and should contain strings of the form {{"name=value"}},
    73 or an alist of {{"name"}} and {{"value"}}.
    75 If {{REQUEST}} is a string or a HTTP request object whose {{Content-Type}} attribute is
    76 {{application/x-www-form-urlencoded}}, the HTTP body is created with the form
    77 {{"name1=value1&name2=value2..."}}.
    78 Otherwise, the HTTP body is concatenated using {{DELIM1}},
    79 {{DELIM2}}, and {{ENCODER}}. The {{REQUEST}} keeps a Cookie header, as with {{http:GET}}
     71{{ARGUMENTS}} may be one of several forms depending on the value of the {{Content-Type}} attribute. If {{ARGUMENTS}} is unspecified, the body will be blank (i.e., a headers-only request).
     72{{DELIM}} is an arbitrary separator string defaulting to the null-string.  The behaviour of {{DELIM}} is dependent on {{Content-Type}}.
     73{{HEADERS}} should be either null or a list composed of {{(ATTRIBUTE . VALUE)}} pairs.  {{Connection}} and {{Content-Type}}, if unspecified, will be added automatically.  Attributes are not case sensitive.  Any attributes explicitly given in {{HEADERS}} are used, even if normally autogenerated. 
     74{{CTYPE}} is the {{Content-Type}} header attribute, and defaults to {{application/x-www-form-urlencoded}}.  {{http:POST}} knows several values of {{Content-Type}} and will create the body appropriately, as given below:
     79<td>{{ARGUMENTS}} may be a string or a list.  The list may contain either {{(NAME . VALUE)}} pairs or strings of the form {{"name=value"}}.  The message body is generated as {{"name1=val1&name2=val2..."}}.  {{DELIM}} is ignored.</td></tr>
     81<td>{{ARGUMENTS}} may be a string or a list.  {{DELIM}} is used as the boundary string, if given.  If {{DELIM}} is not specified, it defaults to {{----chicken-scheme---}}.  The {{Content-Type}} header is automatically annotated with the boundary metadata.  Each bounded part is generated, including the whitespace separators.  The {{ARGUMENTS}} list must be composed of elements of the following types, where each element of the top-level list is a separate multipart:
     82; {{NAME}} : name attrib of this part is set to {{NAME}}.  Body is empty.
     83; {{(NAME . VALUE)}} : name attrib of this part is {{NAME}}.  Body is {{VALUE}}.
     84; {{(NAME (ATTRIB . AVAL) ... VALUE)}} : name attrib of this part is {{NAME}}.  Every following {{(ATTRIB . AVAL)}} pair is added to the part header as {{ATTRIB=""AVAL""}} and separated with semicolons.  If {{ATTRIB}} ends with a colon, it is whitespace separated and added to the body (to allow file transmission).  {{VALUE}} is added to the body after all attribs  are processed, and must NOT be a pair.</td></tr>
     85<tr><td>everything else</td>
     86<td>{{ARGUMENTS}} may be either a string or a list of strings.  Lists of strings are concatenated with {{DELIM}} as a separator.</td></tr>
     89The above alterations are performed only when {{ARGUMENTS}} is a list.  If given as a string, the body is set to the string value without any alteration.  All values other than strings or lists generate an error.
     91The {{REQUEST}} keeps a Cookie header, as with {{http:GET}}.
Note: See TracChangeset for help on using the changeset viewer.