Skip to content

Commit

Permalink
fix: conf error_msg
Browse files Browse the repository at this point in the history
  • Loading branch information
ak0327 committed Mar 8, 2024
1 parent e78c34f commit 54a3972
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,9 @@ run_parse_test :
#cmake -S . -B build
cmake --build build
./build/unit_test --gtest_filter=TestParser*
#./build/unit_test --gtest_filter=TestParser:TestParse
# ./build/unit_test --gtest_filter=TestParser:TestParse
#./build/unit_test --gtest_filter=TestParser.ParseServer
# ./build/unit_test --gtest_filter=TestParser.ParseHttp

.PHONY : run_config_test
run_config_test :
Expand Down
2 changes: 2 additions & 0 deletions srcs/Config/ConfigParser/http_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ Result<int, std::string> ConfigParser::parse_http_block(TokenItr *current,
&http_config->send_timeout_sec,
SEND_TIMEOUT_DIRECTIVE,
is_valid_send_timeout);
} else {
result = Result<int, std::string>::err(create_syntax_err_msg(*current, end));
}

if (result.is_err()) {
Expand Down
22 changes: 22 additions & 0 deletions test/test_conf/ng/ng_http_block/http_ng14.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
http {
recv_timeout 10s;
send_timeout 10s;
keepalive_timeout 10s;
keepalive_timeout 10s; # ng

server {
listen 4242 default_server;
server_name webserv static_server;

session_timeout 10s;

location / {
root html;
index index.html;

limit_except GET {
deny all;
}
}
}
} # http
21 changes: 21 additions & 0 deletions test/test_conf/ng/ng_http_block/http_ng15.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
http {
recv_timeout 10s;
send_timeout 10s;

server {
listen 4242 default_server;
server_name webserv static_server;

session_timeout 10s;
keepalive_timeout 10s; # ng

location / {
root html;
index index.html;

limit_except GET {
deny all;
}
}
}
} # http
21 changes: 21 additions & 0 deletions test/test_conf/ng/ng_http_block/http_ng16.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
http {
recv_timeout 10s;
send_timeout 10s;

server {
listen 4242 default_server;
server_name webserv static_server;

session_timeout 10s;

location / {
root html;
index index.html;

limit_except GET {
deny all;
}
keepalive_timeout 10s; # ng
}
}
} # http
18 changes: 18 additions & 0 deletions test/test_conf/ng/ng_http_block/http_ng17.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
http {
server {
listen 4242 default_server;
server_name webserv static_server;

session_timeout 10s;

location / {
root html;
index index.html;

limit_except GET {
deny all;
}
}
}
} # http
keepalive_timeout 10s; # ng
17 changes: 17 additions & 0 deletions test/test_conf/ng/ng_http_block/http_ng18.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
http {
server {
listen 4242 default_server;
server_name webserv static_server;

session_timeout 10s;

location / {
root html;
index index.html;

limit_except { # ng
deny all;
}
}
}
} # http
17 changes: 17 additions & 0 deletions test/test_conf/ng/ng_http_block/http_ng19.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
http {
server {
listen 4242 default_server;
server_name webserv static_server;

session_timeout 10s;

location / {
root html;
index index.html;

}
limit_except GET { #ng
deny all;
}
}
} # http
17 changes: 17 additions & 0 deletions test/test_conf/ng/ng_http_block/http_ng20.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
http {
server {
listen 4242 default_server;
server_name webserv static_server;

session_timeout 10s;

location / {
root html;
index index.html;

}
}
limit_except GET { #ng
deny all;
}
} # http
21 changes: 21 additions & 0 deletions test/test_conf/ok/ok_http_block/http_ok3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
http {
recv_timeout 10s;
send_timeout 10s;
keepalive_timeout 10s;

server {
listen 4242 default_server;
server_name webserv static_server;

session_timeout 10s;

location / {
root html;
index index.html;

limit_except GET {
deny all;
}
}
}
} # http
2 changes: 0 additions & 2 deletions test/unit_test/TestParserFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5005,6 +5005,4 @@ TEST(TestParser, ParseHttp) {

print_error_msg(result, __LINE__);
ASSERT_TRUE(result.is_err());


}

0 comments on commit 54a3972

Please sign in to comment.