Skip to content

Commit 46f6948

Browse files
author
Yieen
committed
Merge branch 'main' of github.com:PythonGermany/42_webserv
2 parents e25026e + ad4ce11 commit 46f6948

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

TODO.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
- [ ] fcntl subject
55
- [ ] remove inet_ntop
66

7-
- [ ] Is is possible for client to send data whilst cgi is processing?
8-
- [ ] (Optional) Fix problem of no server response in case of connection being destructed due to timeout, in every case but especially if cgi is active
9-
- [ ] (Optional) Implement try_files or similar
10-
- [ ] (Does not occur anymore without having actively tried to fix it) Investigate random closing of program without any notice after sending a first request
117

128
- [x] Implement and fix chunked request trailer parsing
139
- [x] Figure out why resolving symlinks doesnt work
@@ -21,5 +17,9 @@
2117
- [x] Implement chunked transfer encoding (https://datatracker.ietf.org/doc/html/rfc2616#section-3.6
2218
&& https://datatracker.ietf.org/doc/html/rfc2616#section-19.4.6)
2319

20+
- [ ] <del>Is is possible for client to send data whilst cgi is processing?</del>
21+
- [ ] <del>(Optional) Fix problem of no server response in case of connection being destructed due to timeout, in every case but especially if cgi is active</del>
22+
- [ ] <del>(Optional) Implement try_files or similar</del>
23+
- [ ] <del>(Does not occur anymore without having actively tried to fix it) Investigate random closing of program without any notice after sending a first request</del>
2424
- [ ] <del>Maybe use streambufs instead of streams https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary</del>
2525
- [ ] <del>Maybe implement configurable default mime</del>

src/http/Http.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,7 @@ void Http::processCgi(std::string contentLength) {
286286
env.push_back("CONTENT_TYPE=" + _request.getHeaderField("Content-type"));
287287
}
288288

289-
// TODO: Implement correct server name selection if there are multiple server
290-
// names set in the listen directive. Check if according to cgi
291-
std::string servername;
292-
if (_context->exists("server_name", true))
293-
servername = _context->getDirective("server_name", true)[0][0];
294-
else
295-
servername = _request.getHeaderField("Host");
296-
env.push_back("SERVER_NAME=" + servername);
289+
env.push_back("SERVER_NAME=" + _request.getHeaderField("Host"));
297290
env.push_back("SERVER_PORT=" + toString<in_port_t>(host.port()));
298291
std::ostringstream oss;
299292
oss << "REMOTE_ADDR=" << client;
@@ -303,9 +296,6 @@ void Http::processCgi(std::string contentLength) {
303296
env.push_back("HTTP_COOKIE=" + _request.getHeaderField("Cookie"));
304297
env.push_back("HTTP_USER_AGENT=" + _request.getHeaderField("User-Agent"));
305298

306-
// env.push_back("PATH_INFO=" ...); // TODO: Implement
307-
// env.push_back("PATH_TRANSLATED=" ...);
308-
309299
runCGI(cgiProgramPathname, std::vector<std::string>(1, pathname), env);
310300
if (_request.isMethod("POST") == false) cgiCloseSendPipe();
311301
_response.clear();

src/utils/File.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ int File::createDirPath() {
104104
while (pos != std::string::npos) {
105105
std::string dir = _path.substr(0, pos);
106106
if (dir != "" && !File(dir).exists())
107-
if (mkdir(dir.c_str(), 0755) != 0)
108-
return -1; // TODO: Possibly find alternative
107+
if (mkdir(dir.c_str(), 0755) !=
108+
0) // Needed only for non subject bonus functionality
109+
return -1;
109110
pos = _path.find_first_of('/', pos + 1);
110111
}
111112
return 0;

0 commit comments

Comments
 (0)