In addition, Flight Simulator provides the following objects:
The agent object allows you to control the 'user agent' -- the software that makes requests to the webserver. The Agent object is implicitly created and can be referenced by the name agent in your session script.
Causes the agent to make an HTTP GET request for the named object. Any headers set with setHeader(name, value) will be cleared after this call.
Causes the agent to make an HTTP POST request to the named object. The data in the Form object, form, will be passed to the server.
Sets the named cookie to the given value. This cookie will only be send by the agent when requesting objects in the given path. The expiry time of the cookie is unknown, so it will last for the duration of this session.
Sets the named cookie to the given value. This cookie will only be sent by the agent when requesting objects in the given path. The cookie will be deleted from the agent after the given expiry time.
Sets the named header to the given value for the next request the agent makes. If you want all subsequent requests to send the given header, use setPersistentHeader(name, value).
Sets the named header to the given value for the next, and all subsequent requests. To stop the header being sent, make a call to removePersistentHeader(name).
Stop the named header (as set by setPersistentHeader(name, value)) from being sent with any further requests.
Set the host to which all subsequent requests for objects will be made. Each host has a seperate set of cookies -- cookies set agains one host will not be sent in requests to another.
Set the If-Modified-Since header to the given timestamp.
Set the If-Modified-Since header to the given timestamp and length.
Set the If-Modified-Since header to reflect the Last-Modified (and possibly Content-Length) property of the named object in the agent's cache (name should be the the full URL of the object you are about to request).
Represents the data in an HTML form, that may be sent in a POST request. The following code creates a Form and sets the values of some fields:
myForm = new Form(); myForm['title'] = 'New title'; myForm['body'] = 'This is the body text'; // a name *can* have multiple values (e.g. checkboxes), myForm['options'] = '223'; myForm['options'] = '272'; myForm['options'] = '273'; agent.post('/cgi-bin/script.pl', myForm)
You may optionaly specify the encoding in which the data is to be sent. At present, the default, and only supported option is