21.01.2013 Views

Techniques for Web Telerobotics - Australia's Telerobot on the Web ...

Techniques for Web Telerobotics - Australia's Telerobot on the Web ...

Techniques for Web Telerobotics - Australia's Telerobot on the Web ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

32 The CGI System<br />

and <strong>on</strong>e where a checkbox was present but not checked. Images behave in a similar way; <strong>on</strong>ly if<br />

<strong>the</strong> image is clicked is it present in <strong>the</strong> values sent with <strong>the</strong> request. Images act as both an input<br />

and submit element. Once an image is clicked <strong>the</strong> mouse locati<strong>on</strong> is encoded as two seperate name<br />

value pairs and <strong>the</strong> <str<strong>on</strong>g>for</str<strong>on</strong>g>m is sent. This means that it is not possible to click two images in a <str<strong>on</strong>g>for</str<strong>on</strong>g>m,<br />

as <strong>the</strong> <str<strong>on</strong>g>for</str<strong>on</strong>g>m is automatically sent after <strong>the</strong> first <strong>on</strong>e.<br />

3.2.3 State Management<br />

State management using CGI scripts is awkward, due to <strong>the</strong> stateless request resp<strong>on</strong>se nature of<br />

HTTP, and <strong>the</strong> lack of persistence of CGI process. Each request from a browser is serviced by a<br />

new CGI process. For a complex system a large porti<strong>on</strong> of <strong>the</strong> CGI processes work may involve<br />

re-establishing <strong>the</strong> state of <strong>the</strong> previous request. The new request must be matched up with <strong>the</strong><br />

previous request from <strong>the</strong> same user. Some piece of data such as a sessi<strong>on</strong> identifier must persist<br />

across sequential requests from <strong>the</strong> same user known as a sessi<strong>on</strong>. This identifier can <strong>the</strong>n be used<br />

to re-establich <strong>the</strong> previous state from some <str<strong>on</strong>g>for</str<strong>on</strong>g>m of persisitent storage. Alternatively, all state<br />

in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> can pass between <strong>the</strong> browser and CGI script with every c<strong>on</strong>versati<strong>on</strong>. This is <strong>on</strong>ly<br />

practial where <strong>the</strong> amount of state in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> is small, is not shared with o<strong>the</strong>r users, and does<br />

not change between requests. Some of <strong>the</strong> more popular techniques <str<strong>on</strong>g>for</str<strong>on</strong>g> identifying sessi<strong>on</strong>s are as<br />

follows:<br />

• Remote Address<br />

• URL<br />

• Hidden field in a HTTP <str<strong>on</strong>g>for</str<strong>on</strong>g>m<br />

• Cookies<br />

Using remote address is included because it is often implemented as a first attempt at sessi<strong>on</strong><br />

management. However, it is not reliable, as multiple users may have <strong>the</strong> same IP address, due to<br />

proxies or shared workstati<strong>on</strong>s. Some people also seem to have dynamic IP addresses that change<br />

from request to request.<br />

Passing in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> as part of <strong>the</strong> URL is a widely used soluti<strong>on</strong> that works quite reliably. This<br />

can be d<strong>on</strong>e using <strong>the</strong> query string, as used by search engines, or by adding extra path in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong><br />

after <strong>the</strong> script name. However this can cause problems as URLs become very c<strong>on</strong>fusing and<br />

might refer to old sessi<strong>on</strong> identifiers.<br />

A third technique of use when all pages are navigated using HTML <str<strong>on</strong>g>for</str<strong>on</strong>g>ms is to use a hidden field.<br />

This will be included in <strong>the</strong> variables passed to <strong>the</strong> CGI script. This works very reliably provided

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!