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


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: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8

  3. Host:

  4. If-Modified-Since: Fri, 01 Mar 2024 20:22:11 GMT

  5. User-Agent: CCBot/2.0 (

  6. Accept-Encoding: br,gzip

  7. Accept-Language: en-US,en;q=0.5

The request

Other items

Parsed query data

Parsed POST data

Valid XHTML 1.0!