User data from the client are transferred either in the URL (with the GET method) or in the body of the request (with the POST method). See section 8.7.1 for more details.
Here is a typical GET request from our WOO interface:
GET http://tecfamoo.unige.ch:7777/1202?verb=options&do=Do+it%21 HTTP/1.0You can see that the
?is used to separate contents from the URL.
Now let's have a look a character encoding produced when sending user data with the POST method. The user data are transferred with a string that will look like this:
name=Daniel&age=old&string=Hello+there+%21for a form input like this:
<input type="text" size=20 name=name><br> Your age: <input type="radio" name=age value="young" checked> < 30 <input type="radio" name=age value="old"> > 30 <p>Input something please:<br> <input type="text" name=string size=60><br>For each named widget we will receive a
<name>=<value>pair and all pairs will be separated by
&signs as you can figure out from the example above.
Special signs like ``/'', the space and the end-of-line character
are also encoded specially. The space character is usually
done with a ``+'', but most other characters use a hex encoding.
E.g. the ``!'' sign is encoded as
Cgi-bin scripts must decode those strings.
The string containing
variable=value pairs is usually
passed to a CGI program through UNIX environment variables (in the
case of GET) or the standard input (in the case of POST).
In E_Web the query string is given as an argument to API verbs
Other environment variables (both in the UNIX world and the MOO)
can be used by the CGI program to retrieve additional information,
e.g. content length, the remote host and various client information.
All you need to do now is producing the Virtual Document passed back to the client. With a typical UNIX environment you just write HTML lines to the standard output. Usually the server will produce minimal response header for you, but you can do it yourself too. The minimal requirement with most servers is that you write a content type header line, e.g.
In the next section 8.8 you will learn how to do this with E_Web.