mucked about with Telnet
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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)
|
||||
|
||||
37
telnet_test.sh
Executable file
37
telnet_test.sh
Executable file
@@ -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
|
||||
|
||||
8
telnet_test2.sh
Executable file
8
telnet_test2.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#! /usr/bin/expect
|
||||
|
||||
set timeout 20
|
||||
set Host "localhost 80"
|
||||
|
||||
spawn telnet $Host
|
||||
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
<h1 style="text-align:center">Webserv in Test</h1>
|
||||
<hr>
|
||||
<p style="text-align:center">Time to submit something:</p>
|
||||
<form action="./srcs/cgi-bin/upload_file.php" method="post">
|
||||
<input type="hidden" name="upload_dir" value="./www/uploaded/">
|
||||
<!-- <form action="./srcs/cgi-bin/upload_file.php" method="post" enctype="multipart/form-data"> -->
|
||||
<form action="/uploaded" method="post" enctype="multipart/form-data">
|
||||
<!-- <input type="hidden" name="upload_dir" value="./www/uploaded/"> -->
|
||||
<input type="file" id="fileToUpload" name="myFile">
|
||||
<input type="submit" value="Upload File">
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user