CXM_web_dump.anubis
2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Created by PyramIDE.
* User: Jeremy
* Date: 09/08/2012
* Time: 16:14
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
read tools/basis.anubis
read system/string.anubis
read system/convert.anubis
read calexium_lib/web/CXM_common.anubis
read calexium_lib/web/CXM_multihost_http_server.anubis
/* Provides a dump of Web_arg List */
public define String
dump_web_arg_values
(
List(Web_arg) l,
)
=
if l is
{
[ ] then "\n",
[h . t] then if h is
{
web_arg(n,v) then "\n["+n+"] = '"+v+"'" + dump_web_arg_values(t),
upload(n,v,tfn) then "\n["+n+"] = '"+v+"'" + dump_web_arg_values(t)
}
}
.
/* Provides a dump of HTTP_Header List */
public define String
dump_http_headers
(
List(HTTP_header) l,
String prefix
)
=
if l is
{
[ ] then "", // no need to add \n => previous call has made it
[h . t] then prefix + h.name + " : " + h.value + "\n" + dump_http_headers(t, prefix)
}
.
/* Provides a dump of a HTTP_Info */
public define String
dump_http_info
(
HTTP_Info http_info,
)
=
/*
* Word32 ip_address, // IP address of the client
String hostname, // hostname requested by the client
String uri, // URI requested by the client
List(HTTP_header) http_headers, // HTTP headers sent by the client
Bool is_https,
One -> String generate_trust_ticket // may be used against denial of
*/
"IP Address : " + ip_addr_to_string(http_info.ip_address) + "\n"
+ "Hostname : " + http_info.hostname + "\n"
+ "URI : " + http_info.uri + "\n"
+ "HTTP Headers : \n" + dump_http_headers(http_info.http_headers,"\t") // no need to add \n => dump_http_headers does it
+ "Is HTTPS : " + to_String(http_info.is_https) + "\n"
.