From 5b920d78591d6289e20fb5f4b66c20a1ba45d059 Mon Sep 17 00:00:00 2001 From: takira Date: Fri, 8 Mar 2024 11:48:57 +0900 Subject: [PATCH] update index.html --- Makefile | 2 +- conf/webserv.conf | 6 ++++++ html/index.html | 1 + srcs/HttpResponse/POST/post_target.cpp | 15 ++++++++------- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 6a95da2e..4e5583bc 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/conf/webserv.conf b/conf/webserv.conf index 93843917..59e48a1a 100644 --- a/conf/webserv.conf +++ b/conf/webserv.conf @@ -74,6 +74,12 @@ http { index index.html; } + location /post_only/ { + limit_except POST { + deny all; + } + } + location /delete_only/ { autoindex on; diff --git a/html/index.html b/html/index.html index a986b97d..26d710fb 100644 --- a/html/index.html +++ b/html/index.html @@ -50,6 +50,7 @@

GET

  • /dir_a/index.html
  • /a/b/ -> /a/b/file_b.html
  • /a/b/c/ -> /a/b/c/index.html +
  • /post_only/
  • /delete_only/ allow 127.0.0.1 -> ok?
    diff --git a/srcs/HttpResponse/POST/post_target.cpp b/srcs/HttpResponse/POST/post_target.cpp index acb6f2cc..4564d0bc 100644 --- a/srcs/HttpResponse/POST/post_target.cpp +++ b/srcs/HttpResponse/POST/post_target.cpp @@ -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; }