File: http-flag0.mcl

package info (click to toggle)
mgmt 0.0.26.git.2024.10.25.85e1d6c0e8-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,364 kB
  • sloc: sh: 2,471; yacc: 1,285; makefile: 543; python: 196; lisp: 77
file content (37 lines) | stat: -rw-r--r-- 919 bytes parent folder | download
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
import "value"

http:server ":8080" {	# by default http uses :80 but using :8080 avoids needing root!
	#address => ":8080",	# you can override the name like this
	#timeout => 60,		# add a timeout (seconds)
}

# you can add a raw file like this...
http:file "/file1" {
	data => "hello, world, i'm file1 and i don't exist on disk!\n",
}

# wget --post-data 'key=hello&whatever=bye' -O - http://127.0.0.1:8080/flag1
http:flag "/flag1" {
	#server => ":8080",
	key => "key",
}
value "value1" {
	any => "tmp",	# can be any type
}
print "print1" {
	Meta:autogroup => false,
}

Http:Flag["/flag1"].value -> Print["print1"].msg
Http:Flag["/flag1"].value -> Value["value1"].any

$ret = value.get_str("value1")	# name of value resource
$val = $ret->value
test "get" {
	anotherstr => $val,
	onlyshow => ["AnotherStr",], # displays nicer
}
file "/tmp/file" {
	state => $const.res.file.state.exists,
	content => "value: ${val}\n",
}