The Arg

This page displays the Arg #arg structure supplied to the out/1 function.

The #arg structure is a very important datastructure for the yaws programmer. It is the main mechanism whereby the server can pass data to the web application. There are several data items which are of interest to the webapplication, such as which headers were sent from the client, etc. The #arg recored is defined in yaws_api.hrl and is defined as:



-record(arg, {
          clisock,        %% the socket leading to the peer client
          client_ip_port, %% {Ip, Port} for the client
          headers,        %% headers
          req,            %% request
          orig_req,       %% original request
          clidata,        %% The client data (as a binary in POST requests)
          server_path,    %% The normalized server path
          querydata,      %% Was the URL on the form of ...?query (GET reqs)
          appmoddata,     %% the remainder of the path leading up to the query
          docroot,        %% where's the data
          fullpath,       %% full deep path to yaws file
          cont,                  %% Continuation for chunked multipart uploads
          state,          %% State for use by users of the out/1 callback
          pid,            %% pid of the yaws worker process
          opaque,         %% useful to pass static data
          appmod_prepath, %% path in front of: <appmod><appmoddata>
          pathinfo        %% Set to 'd/e' when calling c.yaws for the request
                          %% http://some.host/a/b/c.yaws/d/e
         }).

    

As we have seen is several previous examples, the out/1 function defined in .yaws files, gets invoked with a single argument which is a #arg{} record, fitting the specific HTTP request being served.

The code to display the #arg{} record is in defined in file arg2.yaws and is invoked at arg2.yaws

The headers passed to us were:

  1. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

  2. Host: yaws.hyber.org

  3. User-Agent: CCBot/2.0 (http://commoncrawl.org/faq/)

  4. Accept-Language: en-us,en-gb,en;q=0.7,*;q=0.3

  5. Accept-Encoding: x-gzip, gzip, deflate

The request

Other items

Parsed query data
[]

Parsed POST data
[]

Valid XHTML 1.0!