Documentation generated by XL CLAIRE v3.3.37 at Fri, 17 Nov 2006
| categories Http filters Chunked transfer coding |
Content length spy |
chunker implement the RFC2616 (sec 3.6.1) "Chunked transfer coding" used to define the body-length of a message. Unlike content-length, chunked coding allow stream oriented message generation (i.e. a message which has an undefined length at the time it is generated).
| Chunked transfer coding | categories Http filters Content length spy |
Boundary reader |
| Content length spy | categories Http filters Boundary reader |
HTML special char convertion |
| Boundary reader | categories Http filters HTML special char convertion |
Request input processing Maximun POST size |
| Http filters HTML special char convertion |
categories Request input processing Maximun POST size |
Simple form variables |
As a security concern, we may define the environment variable WCL_MAX_POST that specifies a maximun size in mega-octet for POST data. When this variable is specified the request input processor checks that the length of the input message is lesser than the specified maximun POST size and raise an error otherwise.
| Maximun POST size | categories Request input processing Simple form variables |
Multivalued form variables |
The HTTP handler is able to read a request input which is either of content
type multipart/form-data or application/x-www-form-urlencoded.
These protocols are use by the client to send form variables. Form
variables are usualy defined with a name and a value. When reading the
input of a request the HTTP handler fills a table that associates a form
variable names to its value both represented as string. Let's consider the
following form :
When this form is submited by the client a new entry is added in the $ table
with the key field_name and the value string that was
entered by the client in the text input, such we can use :
?><form>
<input type=text name='name'>
<input type=submit>
</form><?
Notice that the $ table defaults to false such we can test the existence of
a form variable with :
$["name"]
Also notice that a form field that is left empty is usualy not part of the
submited request.
if $["name"]
...
If the same variable name is used for multiple form variable then the entry in the $ table will be set to the last occurrence found during the request input processing.
| Simple form variables | categories Request input processing Multivalued form variables |
Uploads |
To handle multiple values for a given variable name one should use
the bracket notation as follow :
If the above form is submited as is (i.e. specified defulat values
are left unchenged by the client) we would find entries in the $,
$keys and, $value tables :
?><form>
<input type=text name='name[key1]' value='val1'>
<input type=text name='name[key2]' value='val2'>
<input type=text name='name[]' value='val3'>
<input type=submit>
</form><?
Notice that when we use the bracket notation for a variable name, $ is filled with all
values found for that name and if the key enclosed by the brackets isn't empty then
the $keys and $value would also be updated. $keys contains all found keys for a given
name and $value contain the value for a given name/key pair.
$["name"] => list("val1", "val2", "val3")
$keys["name"] => list("key1", "key2")
$value["name", "key1"] => "val1"
$value["name", "key2"] => "val2"
| Multivalued form variables | categories Request input processing Uploads |
Last, the input processor is able to read multipart/form-data encoded
forms which may be used to make a form with an input of type file :
When such a form is submited, the request input processor create a new
entry in the $ table (as for simple form variables) of the upload type.
An upload correspond to a file, that would be been saved by the server
on the hard disk at the file_path attribute of the upload :
?><form method=POST enctype="multipart/form-data">
<input type=file name="file">
<input type=submit>
</form><?
The directory where file are uploaded is taken from the environment
variable WCL_UPLOAD_FOLDER.
if $["file"]
let f := fopen($["file"].file_path, "r")
in ...
| categories | Simple form variables | Http table |
$ is filled by the request input processor with all values found for a given variable name.
| categories | Multivalued form variables | Http table |
The $keys table is filled by the input processor with the list of keys found for a given variable name.
| categories | Multivalued form variables | Http table |
The $value table is filled by the input processor the value of the the given variable name and key pair.
| categories | Uploads | ephemeral | Http class |
An upload object is created for a form input when it is of type file. original_name/original_path would contain the name/path of the file from the client-side point of view, content_type would contain the MIME type od the uploaded file (e.g. "text/plain"), file_size is the size of the file in bytes. file_folder is the path of the server-side directory where the server uploaded the file (It is taken as the value of the environment variable WCL_UPLOAD_FOLDER) and file_path is the server-side path of the uploaded file.
| categories | Boundary reader | normal dispatch | Http method |
boundary_reader implements a subset of RFC2046.
| categories | Chunked transfer coding | normal dispatch | Http method |
chunker!(self) creates a read/write filter that handle chunked encoded datas.
| categories | Content length spy | normal dispatch | Http method |
content_length_spy!(self) is equivalent to content_length_spy!(self, integer!(getenv("CONTENT_LENGTH"))). The CONTENT_LENGTH environment variable is usualy sets in a CGI environment.
| categories | Content length spy | normal dispatch | Http method |
The content length spy is used to force an EOF condition after content_length bytes which prevent blocking read to occur past the message body.
| categories | HTML special char convertion | normal dispatch | Http method |
html_special_char_converter!(self) is equivalent to html_special_char_converter!(self, true).
| categories | HTML special char convertion | normal dispatch | Http method |
html_special_char_converter!(self, convert_slash_n_and_space?) creates a new converter. A convertion is applied on each following chars :
| categories | Boundary reader | normal dispatch | Http method |
last_boundary?(self) checks the last end of file condition also correspond to the last boundary i.e. all bounded block have been read.
| categories | Boundary reader | normal dispatch | Http method |
reach_boundary(self) reset the end of file condition such we are ready to read a new bounded block.