Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
whayter committed Nov 2, 2021
2 parents b0d0447 + f0fa8b1 commit 8700883
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 35 deletions.
5 changes: 1 addition & 4 deletions config/macos_webserv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ server {
location ext .php {
limit_except GET POST;
cgi_exec /usr/local/bin/php-cgi;
return 307 php-cgi;
}
location ext .py {
cgi_exec ./www/hello.py;
Expand Down Expand Up @@ -49,14 +48,12 @@ server {
root ./www;
index subject.html;
location / {}
location /text {
return 204 "this is a return directive with text";
}
location /uri {
return 301 http://youtube.com;
}
}
server {
listen 8080;
listen 8083;
index notExist;
server_name srv_four;
Expand Down
5 changes: 1 addition & 4 deletions config/ubuntu_webserv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ server {
location ext .php {
limit_except GET POST;
cgi_exec /usr/bin/php-cgi;
return 307 php-cgi;
}
location ext .py {
cgi_exec ./www/hello.py;
Expand Down Expand Up @@ -49,14 +48,12 @@ server {
root ./www;
index subject.html;
location / {}
location /text {
return 204 "this is a return directive with text";
}
location /uri {
return 301 http://youtube.com;
}
}
server {
listen 8080;
listen 8083;
index notExist;
server_name srv_four;
Expand Down
50 changes: 25 additions & 25 deletions src/config/ServerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,36 +567,36 @@ Host ServerConfig::_parseListenValue(const pr::Token& t)
Host result;
unsigned long port;

std::string tmp;
// std::string tmp;

std::string::const_iterator it = t.value.begin();
std::string::const_iterator end = t.value.end();
// std::string::const_iterator it = t.value.begin();
// std::string::const_iterator end = t.value.end();

while(it != end && *it != ':')
tmp += *it++;
// while(it != end && *it != ':')
// tmp += *it++;

if (it == end)
{
it = tmp.begin();
end = tmp.end();
}
else
{
ft::lowerStringInPlace(tmp);
if (ft::isValidIpAddress(tmp.c_str()))
result.setHostname(tmp);
else
{
_throw_SyntaxError(t, std::string("context \"listen\" : invalid ip interface"));
}
it++;
tmp.clear();
while (it != end)
tmp += *it++;
}
// if (it == end)
// {
// it = tmp.begin();
// end = tmp.end();
// }
// else
// {
// ft::lowerStringInPlace(tmp);
// if (ft::isValidIpAddress(tmp.c_str()))
// result.setHostname(tmp);
// else
// {
// _throw_SyntaxError(t, std::string("context \"listen\" : invalid ip interface"));
// }
// it++;
// tmp.clear();
// while (it != end)
// tmp += *it++;
// }
char *nptr;
errno = 0;
port = strtoul(tmp.c_str(), &nptr, 10);
port = strtoul(t.value.c_str(), &nptr, 10);
if (port == ULONG_MAX && ft::make_error_code().value() == ft::errc::result_out_of_range)
_throw_SyntaxError(t, std::string("Overflow in context \"listen\"... thx bro --'"));
if (nptr[0])
Expand Down
4 changes: 2 additions & 2 deletions src/web/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ void Server::routine()
continue;
else if (_fds[i].revents & POLLHUP)
_disconnectDevice(i);
else if (_fds[i].revents & POLLOUT)
_sendResponses(i);
else if (_fds[i].revents & POLLIN)
{
if (_isServerIndex(i))
Expand All @@ -83,8 +85,6 @@ void Server::routine()
_buildResponses(i);
}
}
else if (_fds[i].revents & POLLOUT)
_sendResponses(i);
else
stop(-1);
}
Expand Down

0 comments on commit 8700883

Please sign in to comment.