domenica 18 ottobre 2009

How to retrieve data passed inside the request header

Usually the browser provide a lot of information inside the header of a http request: not only the requested page, but also cookies, POST or GET variables, the user-agent etc.etc. All this data are stored in an array of strings and are accessible trough an external variable: environ.

Taking inspiration from the echo.c example of the development kit I made a simple application that gives back all the information stored inside the header and the body of a request, similar to the phpinfo() function present in PHP.

If you want to test the program you can download a zip file here. With the C source there is also a HTML file useful to test different types of GET or POST requests, otherwise you can download the full FLUS environment here where you can test all the example of my blog connecting to the homepage of the server.

Note: under some conditions some data are passed also in the body section of the request.

echo.c example of the Development Kit
URIs, Addressability, and the use of HTTP GET and POSTURIs, Addressability, and the use of HTTP GET and POST
Forms (W3C Reccomendation page)

2 commenti:

  1. The Data Stream Interface (DSI) is a session layer used to carry Apple Filing Protocol traffic over Transmission Control Protocol. When Apple introduced TCP with MacTCP and Open Transport in System 7 in the 1990s, they needed their file sharing protocol (AFP) to run on both TCP and AppleTalk. They introduced AppleTalk Session Protocol (ASP) and DSI for TCP coincidentally with AFP 2.x. Use of the method like Request Method: setHeader, Request Method: getHeader, Request Method: send, Request Method: cancel etc.