Skip to content

Commit 5721689

Browse files
committed
remove last qtest
1 parent b36ea35 commit 5721689

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

src/Tiny_httpd_server.ml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -349,22 +349,6 @@ module Request = struct
349349
end
350350
end
351351
352-
(*$R
353-
let q = "GET hello HTTP/1.1\r\nHost: coucou\r\nContent-Length: 11\r\n\r\nsalutationsSOMEJUNK" in
354-
let str = Tiny_httpd.Byte_stream.of_string q in
355-
let r = Request.Internal_.parse_req_start ~get_time_s:(fun _ -> 0.) str in
356-
match r with
357-
| None -> assert_failure "should parse"
358-
| Some req ->
359-
assert_equal (Some "coucou") (Headers.get "Host" req.Request.headers);
360-
assert_equal (Some "coucou") (Headers.get "host" req.Request.headers);
361-
assert_equal (Some "11") (Headers.get "content-length" req.Request.headers);
362-
assert_equal "hello" req.Request.path;
363-
let req = Request.Internal_.parse_body req str |> Request.read_body_full in
364-
assert_equal ~printer:(fun s->s) "salutations" req.Request.body;
365-
()
366-
*)
367-
368352
module Response = struct
369353
type body =
370354
[ `String of string
@@ -967,7 +951,7 @@ module Unix_tcp_server_ = struct
967951
(try Unix.close client_sock with _ -> ());
968952
Sem_.release 1 self.sem_max_connections;
969953
raise e);
970-
ignore Unix.(sigprocmask SIG_UNBLOCK Sys.[ sigint; sighup ]);
954+
ignore Unix.(sigprocmask SIG_UNBLOCK Sys.[ sigint; sighup ])
971955
with e ->
972956
Sem_.release 1 self.sem_max_connections;
973957
_debug (fun k ->

tests/unit/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
(tests
3-
(names t_util t_buf)
3+
(names t_util t_buf t_server)
44
(package tiny_httpd)
55
(libraries tiny_httpd qcheck-core qcheck-core.runner test_util))

tests/unit/t_server.ml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
open Test_util
2+
open Tiny_httpd_server
3+
4+
let () =
5+
let q =
6+
"GET hello HTTP/1.1\r\n\
7+
Host: coucou\r\n\
8+
Content-Length: 11\r\n\
9+
\r\n\
10+
salutationsSOMEJUNK"
11+
in
12+
let str = Tiny_httpd.Byte_stream.of_string q in
13+
let r = Request.Internal_.parse_req_start ~get_time_s:(fun _ -> 0.) str in
14+
match r with
15+
| None -> failwith "should parse"
16+
| Some req ->
17+
assert_eq (Some "coucou") (Headers.get "Host" req.Request.headers);
18+
assert_eq (Some "coucou") (Headers.get "host" req.Request.headers);
19+
assert_eq (Some "11") (Headers.get "content-length" req.Request.headers);
20+
assert_eq "hello" req.Request.path;
21+
let req = Request.Internal_.parse_body req str |> Request.read_body_full in
22+
assert_eq ~to_string:(fun s -> s) "salutations" req.Request.body;
23+
()

0 commit comments

Comments
 (0)