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. Connection: Keep-Alive

  2. Accept: */*

  3. Host: localhost:8000

  4. Referer: http://localhost:8000/

  5. User-Agent: Wget/1.24.5

  6. Accept-Encoding: identity

The request

Other items

Parsed query data
[]

Parsed POST data
[]

Valid XHTML 1.0!