diff --git a/default.config b/default.config index 41bc784..a287ed2 100644 --- a/default.config +++ b/default.config @@ -21,15 +21,21 @@ server { location /upload { root ./www/test/; index submit_form.html; - upload_dir ./www/uploaded/; - cgi_ext php; +# upload_dir ./www/uploaded/; +# cgi_ext php; } location /uploaded { - autoindex on; +# autoindex on; root ./www/uploaded/; + upload_dir ./www/uploaded/; } +# location /srcs/cgi-bin/ { +# root ./srcs/cgi-bin/; +# allow_methods POST; +# cgi_ext php; +# } location /list { autoindex on; diff --git a/srcs/cgi-bin/upload_file.php b/srcs/cgi-bin/upload_file.php index b3786cf..251aefb 100644 --- a/srcs/cgi-bin/upload_file.php +++ b/srcs/cgi-bin/upload_file.php @@ -10,8 +10,9 @@ # echo("File was uploaded successfully!"); // this part needs to be grabed from POST uri -//$target_dir = "./www/uploaded/"; -$target_dir = $_POST["upload_dir"]; +$target_dir = "./www/uploaded/"; +//$target_dir = $_POST["upload_dir"]; +//$target_dir = $_GET["upload_dir"]; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $fileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); diff --git a/srcs/webserv/method_get.cpp b/srcs/webserv/method_get.cpp index f60152e..f2ecc16 100644 --- a/srcs/webserv/method_get.cpp +++ b/srcs/webserv/method_get.cpp @@ -114,7 +114,7 @@ void Webserv::_autoindex(Client *client, const std::string &path) struct dirent *ent; // std::cout << "location root: " << client->assigned_location->root << " location path: " - << client->assigned_location->path << '\n'; +// << client->assigned_location->path << '\n'; std::cout << "Path in auto is: " << path << '\n'; if ( (dir = opendir(path.c_str()) ) != NULL) diff --git a/telnet_test.sh b/telnet_test.sh new file mode 100755 index 0000000..872367e --- /dev/null +++ b/telnet_test.sh @@ -0,0 +1,37 @@ +#! /bin/bash + +# no idea what we're doing here... + +PORT=80 +METHOD="GET" +PATH="/" +HOST="localhost $PORT" + +START="open $HOST" + +L1="$METHOD $PATH HTTP/1.1" + +run() +{ +# echo "this is a test" + +# $TEL_START + +# spaw telnet localhost $PORT + + echo $START + echo +# sleep 1 + echo $L1 + echo "Host: $HOST" + echo + echo + + +} + + + +#echo $START +run + diff --git a/telnet_test2.sh b/telnet_test2.sh new file mode 100755 index 0000000..a73144b --- /dev/null +++ b/telnet_test2.sh @@ -0,0 +1,8 @@ +#! /usr/bin/expect + +set timeout 20 +set Host "localhost 80" + +spawn telnet $Host + + diff --git a/www/test/submit_form.html b/www/test/submit_form.html index e8673c6..c4d556b 100644 --- a/www/test/submit_form.html +++ b/www/test/submit_form.html @@ -7,8 +7,9 @@
Time to submit something:
-