Skip to content

Commit fd98bff

Browse files
committed
add code to test access to GET arguments
1 parent fc6f20f commit fd98bff

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

examples/webserver/myserver.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@ function myserver() % called from C
22

33
switch (webserver.url())
44
case '/'
5-
stllog('hello from /')
5+
stllog('in /')
66
webserver.html('home here');
77
case '/bob'
88
%webserver.template('templates/home.html', values);
9-
stllog('bob');
9+
stllog('in /bob');
10+
a = webserver.getarg('a');
11+
if ~isempty(a)
12+
stllog('a = %s', cstring(a));
13+
end
1014
webserver.html('<html><body>hello <b>from</b> /bob</body></html>');
1115
case '/alice'
16+
stllog('in /alice')
1217
vals.a = 1;
1318
vals.b = 2;
1419
webserver.template('templates/alice.html', vals);
20+
case '/duck'
21+
webserver.file('duck.jpg', 'image/jpeg');
1522
end

0 commit comments

Comments
 (0)