37. Options that alter the behavour of the module CGI

[<<<] [>>>]

Options can be set using the ScriptBasic command option. Each option has a 32bit value. The options should be set before calling the very first function of this module.

These options are:

Name: cgi$BufferIncrease

Default value: 1024 byte

The size of the internal buffer that is used to hold the header lines of a multipart upload. This is the initial size of the buffer and this is the size of the automatic increase whenever the buffer needs size increase.

Name: cgi$BufferMax

Default value: 10240 byte

This is the maximal size of the buffer. If the buffer gets larger than this size the cgi handling process fails. This helps you stop attacks that send endless header fields in a multipart upload.

Name: cgi$ContentMax

Default value: 10Mbyte

The maximal size of the http request.

Name: cgi$FileMax

Default value: 10Mbyte

The maximal size of an uploaded file. If there are more than one file files uploaded in a single http request their total size should also be less than the configuration parameter cgi$ContentMax.

Name: cgi$Method

Default value: GET, POST, UPLOAD

The allowed configuration methods. To set the value of this option you can use the constants defined in the file cgi.bas. These are:

const None   = &H00000000
const Get    = &H00000001
const Post   = &H00000002
const Upload = &H00000006
const Put    = &H00000008
const Del    = &H00000010
const Copy   = &H00000020
const Move   = &H00000040
const Head   = &H00000080

If a client starts your CGI program with a method that is not allowed the cgi modul will not handle that and stop with error.

You can allow more than one methods for the program. In that case the different options should be given in an expression with biwise OR connected. For example, if you want to allow GET and POST operation handled by your CGI program, but do not want to allow upload you can use the following code segment:

import cgi.bas
option cgi$Method cgi::Get or cgi::Post

When you want to allow upload you can write

import cgi.bas
option cgi$Method cgi::Upload

because cgi::Upload is a special kind of POST operation and therefore the bits controlling the methods permissions are set according to this.

[<<<] [>>>]