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
Connection: close
Accept: */*
Host: 127.0.0.1:8080
User-Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Accept-Encoding: gzip, br, zstd, deflate
[]
[]