diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/civetweb/examples/_obsolete/docroot/prime_numbers.lp | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/civetweb/examples/_obsolete/docroot/prime_numbers.lp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/civetweb/examples/_obsolete/docroot/prime_numbers.lp b/src/civetweb/examples/_obsolete/docroot/prime_numbers.lp new file mode 100644 index 000000000..0c71bb824 --- /dev/null +++ b/src/civetweb/examples/_obsolete/docroot/prime_numbers.lp @@ -0,0 +1,46 @@ +HTTP/1.0 200 OK +Content-Type: text/html + +<html> + <p>Prime numbers from 0 to 100, calculated by Lua:</p> + <? + function is_prime(n) + if n <= 0 then return false end + if n <= 2 then return true end + if (n % 2 == 0) then return false end + for i = 3, n / 2, 2 do + if (n % i == 0) then return false end + end + return true + end + + for i = 1, 100 do + if is_prime(i) then mg.write('<span>' .. i .. '</span> ') end + end + + ?> + + <p>Reading POST data from Lua (click submit):</p> + <form method="POST" ><input type="text" name="t1"/><input type="submit"></form> + + <pre> + POST data: [<? + local post_data = '' + if mg.request_info.request_method == 'POST' then + post_data = mg.read() + end + mg.write(post_data) + ?>] + request method: [<? mg.write(mg.request_info.request_method) ?>] + IP/port: [<? mg.write(mg.request_info.remote_ip, ':', + mg.request_info.remote_port) ?>] + URI: [<? mg.write(mg.request_info.uri) ?>] + HTTP version [<? mg.write(mg.request_info.http_version) ?>] + HEADERS: + <? + for name, value in pairs(mg.request_info.http_headers) do + mg.write(name, ':', value, '\n') + end + ?> +</pre> +</html> |