Skip to content

Commit

Permalink
file upload is back baby
Browse files Browse the repository at this point in the history
  • Loading branch information
endcerro committed Jan 6, 2022
1 parent b2ea3a3 commit e0a3c1c
Show file tree
Hide file tree
Showing 54 changed files with 11 additions and 6 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified Makefile
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified YoupiBanane/Yeah/not_happy.bad_extension
100644 → 100755
Empty file.
Empty file modified YoupiBanane/nop/other.pouic
100644 → 100755
Empty file.
Empty file modified YoupiBanane/nop/youpi.bad_extension
100644 → 100755
Empty file.
Empty file modified YoupiBanane/youpi.bad_extension
100644 → 100755
Empty file.
Empty file modified YoupiBanane/youpi.bla
100644 → 100755
Empty file.
Empty file modified config/YoupiBanane.conf
100644 → 100755
Empty file.
Empty file modified config/base.conf
100644 → 100755
Empty file.
Empty file modified config/complicado.conf
100644 → 100755
Empty file.
Empty file modified config/demo.conf
100644 → 100755
Empty file.
Empty file modified config/double.conf
100644 → 100755
Empty file.
Empty file modified config/locations.conf
100644 → 100755
Empty file.
Empty file modified config/nginx.default.conf
100644 → 100755
Empty file.
Empty file modified default_error_pages/403.html
100644 → 100755
Empty file.
Empty file modified default_error_pages/404.html
100644 → 100755
Empty file.
Empty file modified default_error_pages/405.html
100644 → 100755
Empty file.
Empty file modified en.subject.pdf
100644 → 100755
Empty file.
Empty file modified incl/client.hpp
100644 → 100755
Empty file.
Empty file modified incl/includes.hpp
100644 → 100755
Empty file.
Empty file modified incl/location.hpp
100644 → 100755
Empty file.
Empty file modified incl/log.hpp
100644 → 100755
Empty file.
Empty file modified incl/request.hpp
100644 → 100755
Empty file.
Empty file modified incl/server.hpp
100644 → 100755
Empty file.
Empty file modified incl/webserv.hpp
100644 → 100755
Empty file.
Empty file modified nginx.output
100644 → 100755
Empty file.
Empty file modified notes/Response Status Codes.md
100644 → 100755
Empty file.
Empty file modified notes/config.md
100644 → 100755
Empty file.
Empty file modified notes/requests_examples/chrome_request.txt
100644 → 100755
Empty file.
Empty file modified notes/requests_examples/firefox_request.txt
100644 → 100755
Empty file.
Empty file modified notes/requests_examples/safari_request.txt
100644 → 100755
Empty file.
Empty file modified srcs/client.cpp
100644 → 100755
Empty file.
Empty file modified srcs/location.cpp
100644 → 100755
Empty file.
Empty file modified srcs/main.cpp
100644 → 100755
Empty file.
Empty file modified srcs/parse.cpp
100644 → 100755
Empty file.
17 changes: 11 additions & 6 deletions srcs/request.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: edal--ce <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/15 17:21:43 by hthomas #+# #+# */
/* Updated: 2022/01/06 10:21:05 by edal--ce ### ########.fr */
/* Updated: 2022/01/06 11:22:02 by edal--ce ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -126,11 +126,16 @@ Request::Request(const string &buffer)

// If there is content length, then we are in post mode, add Body header;
if (headers.count("Content-Length") > 0)
headers.insert(pair<string, string>("Body", &buffer[pos]));
{
unsigned int t = ::atoi(headers["Content-Length"].c_str());

headers.insert(pair<string, string>("Body", string(buffer, pos, t )));
DEBUG("INSERTING BODY, POS IS |" << headers["Body"]<<"|");
}

// for (map<string, string>::iterator it = headers.begin(); it != headers.end(); it++)
// DEBUG(it->first << ": " << it->second);
// DEBUG("****** REQUEST PARSED *******");
for (map<string, string>::iterator it = headers.begin(); it != headers.end(); it++)
DEBUG(it->first << ": " << it->second);
DEBUG("****** REQUEST PARSED *******");
// DEBUG("Done")
}

Expand Down Expand Up @@ -438,7 +443,7 @@ void Request::launch_cgi(string &body, const int pos)
if (type == "POST")
{
close(in_pipe[0]);

DEBUG("WRITING |"<<headers["Body"] <<'|');
if (write(in_pipe[1], headers["Body"].c_str(), headers["Body"].size()) < 0)
DEBUG("WRITE ERROR");
close(in_pipe[1]);
Expand Down
Empty file modified srcs/server.cpp
100644 → 100755
Empty file.
Empty file modified srcs/utils_header.cpp
100644 → 100755
Empty file.
Empty file modified srcs/utils_parsing.cpp
100644 → 100755
Empty file.
Empty file modified srcs/webserv.cpp
100644 → 100755
Empty file.
Empty file modified website/cgi-bin/file_upload.py
100644 → 100755
Empty file.
Empty file modified website/cgi-bin/form.php
100644 → 100755
Empty file.
Empty file modified website/cgi-bin/form.py
100644 → 100755
Empty file.
Empty file modified website/demo/form.php
100644 → 100755
Empty file.
Empty file modified website/demo/hello.html
100644 → 100755
Empty file.
Empty file modified website/demo/img-up.php
100644 → 100755
Empty file.
Empty file modified website/demo/index.html
100644 → 100755
Empty file.
Empty file modified website/demo/myscript.js
100644 → 100755
Empty file.
Empty file modified website/demo/style.css
100644 → 100755
Empty file.
Empty file modified website/demo/uploadscover3.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified website/first/page.html
100644 → 100755
Empty file.
Empty file modified website/first/second/page.html
100644 → 100755
Empty file.

0 comments on commit e0a3c1c

Please sign in to comment.