mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2026-03-07 21:37:57 -05:00
* fix: use realpath to validate filesystem paths against traversal - add string_prefix helper to check path containment - compute root_canonical once per add_vfs_ call - use realpath only for filesystem (on_fs=true), keeping simple contains_dot_dot check for VFS - paths are already URL-decoded by Route.rest_of_path_urlencoded * fix: add header size limits to prevent memory exhaustion add optional limits to Headers.parse_: - max_headers: 100 (default) - max_header_size: 16KiB per header (default) - max_total_size: 256KiB total (default) returns 431 status code when limits exceeded per RFC 6585.
84 lines
1.6 KiB
Text
84 lines
1.6 KiB
Text
(executable
|
|
(name sse_server)
|
|
(modules sse_server)
|
|
(libraries tiny_httpd logs unix ptime ptime.clock.os))
|
|
|
|
(executable
|
|
(name sse_client)
|
|
(modules sse_client)
|
|
(libraries unix))
|
|
|
|
(executable
|
|
(name echo)
|
|
(flags :standard -warn-error -a+8)
|
|
(modules echo vfs)
|
|
(libraries
|
|
tiny_httpd
|
|
logs
|
|
tiny_httpd_camlzip
|
|
tiny_httpd.multipart-form-data))
|
|
|
|
(executable
|
|
(name writer)
|
|
(flags :standard -warn-error -a+8)
|
|
(modules writer)
|
|
(libraries tiny_httpd logs))
|
|
|
|
(executable
|
|
(name echo_ws)
|
|
(flags :standard -warn-error -a+8)
|
|
(modules echo_ws)
|
|
(libraries tiny_httpd tiny_httpd.ws logs))
|
|
|
|
(rule
|
|
(targets test_output.txt)
|
|
(deps
|
|
(:script ./run_test.sh)
|
|
./sse_client.exe
|
|
./sse_server.exe)
|
|
(enabled_if
|
|
(= %{system} "linux"))
|
|
(package tiny_httpd)
|
|
(action
|
|
(with-stdout-to
|
|
%{targets}
|
|
(run %{script}))))
|
|
|
|
(rule
|
|
(alias runtest)
|
|
(package tiny_httpd)
|
|
(enabled_if
|
|
(= %{system} "linux"))
|
|
(deps test_output.txt)
|
|
(action
|
|
(diff test_output.txt.expected test_output.txt)))
|
|
|
|
; produce an embedded FS
|
|
|
|
(rule
|
|
(targets vfs.ml)
|
|
(deps
|
|
(source_tree files)
|
|
(:out test_output.txt.expected))
|
|
(enabled_if
|
|
(= %{system} "linux"))
|
|
(action
|
|
(run
|
|
%{bin:tiny-httpd-vfs-pack}
|
|
-o
|
|
%{targets}
|
|
--mirror=files/
|
|
--file=test_out.txt,%{out}
|
|
; --url=example_dot_com,http://example.com ; this breaks tests in opam sandbox 😢
|
|
)))
|
|
|
|
(rule
|
|
(targets vfs.ml)
|
|
(enabled_if
|
|
(<> %{system} "linux"))
|
|
(action
|
|
(with-stdout-to
|
|
%{targets}
|
|
(progn
|
|
(echo "let embedded_fs = Tiny_httpd_dir.Embedded_fs.create ~mtime:0. ()")
|
|
(echo "let vfs = Tiny_httpd_dir.Embedded_fs.to_vfs embedded_fs")))))
|