u413-284-si / webserv

This project is about setting up a http web server, providing a static website.
MIT License
0 stars 0 forks source link

Handle special cases concerning curly brackets #58

Closed QCHR1581 closed 1 week ago

QCHR1581 commented 3 weeks ago

Following cases regarding curly brackets should be handled (NINX accepts them)

1. Curly bracket on the next line

server 
{
}

Here, the server is not recognized because a bracket is expected to come after the server directive. Therefore, it is not added. No error.

2. Whitespaces between server and bracket

server         {
}

Here, the server is also not recognized because a space is expected to come after server, followed by the bracket. Therefore, it is not added. No error.

3. Directive on the same line as the bracket

server         {
root /workspaces/webserv/; }

Here, an error occurs: "Semicolon missing". The function processRemainingLine(line); processes a line further if something is found after the semicolon. After only the bracket is filtered out and the loop continues, it checks again if there is a semicolon, which causes the error.