Skip to content

Commit

Permalink
update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
ak0327 committed Mar 8, 2024
1 parent 54a3972 commit 5b920d7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ NAME = webserv

CXX = c++
CXXFLAGS = -std=c++98 -Wall -Wextra -Werror -MMD -MP -pedantic
CXXFLAGS += -g -fsanitize=address,undefined -fno-omit-frame-pointer
#CXXFLAGS += -g -fsanitize=address,undefined -fno-omit-frame-pointer
CXXFLAGS += -D USE_SELECT
#CXXFLAGS += -D USE_POLL
CXXFLAGS += -D DEBUG
Expand Down
6 changes: 6 additions & 0 deletions conf/webserv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ http {
index index.html;
}

location /post_only/ {
limit_except POST {
deny all;
}
}

location /delete_only/ {
autoindex on;

Expand Down
1 change: 1 addition & 0 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ <h3>GET</h3>
<li><a href="/dir_a/index.html">/dir_a/index.html</a>
<li><a href="/a/b/">/a/b/ -> /a/b/file_b.html</a>
<li><a href="/a/b/c/">/a/b/c/ -> /a/b/c/index.html</a>
<li><a href="/post_only/">/post_only/</a>
<li><a href="/delete_only/">/delete_only/ allow 127.0.0.1 -> ok?</a>
</ul>
<br>
Expand Down
15 changes: 8 additions & 7 deletions srcs/HttpResponse/POST/post_target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,28 +293,29 @@ StatusCode HttpResponse::upload_file() {
// cgi -> error / response
// api -> error / response
StatusCode HttpResponse::post_target() {
// DEBUG_PRINT(YELLOW, " POST 1 target[%s]", this->request_.request_target().c_str());
DEBUG_PRINT(YELLOW, " POST 1 target[%s]", this->request_.target().c_str());

if (!is_method_available()) {
// DEBUG_PRINT(YELLOW, " POST 2 err: 405");
DEBUG_PRINT(YELLOW, " POST 2 err: 405");
return MethodNotAllowed;
}

// dynamic?
// Yes -> dynamic
if (is_dynamic_endpoint()) {
// DEBUG_PRINT(YELLOW, " POST 3 -> dynamic");
DEBUG_PRINT(YELLOW, " POST 3 -> dynamic");
return response_dynamic();
}

std::string boundary;
if (is_multipart_form_data(&boundary)) {
// DEBUG_PRINT(YELLOW, " upload_file -> multipart_form");
DEBUG_PRINT(YELLOW, " upload_file -> multipart_form");
return upload_multipart_form_data(boundary);
}
// DEBUG_PRINT(YELLOW, " upload_file err: 400");

// std::cout << WHITE << "post 4" << RESET << std::endl;
// DEBUG_PRINT(YELLOW, " POST 4s err: 400");
DEBUG_PRINT(YELLOW, " upload_file err: 400");

std::cout << WHITE << "post 4" << RESET << std::endl;
DEBUG_PRINT(YELLOW, " POST 4s err: 400");
return BadRequest;
}

0 comments on commit 5b920d7

Please sign in to comment.