Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Implement Location #9

Merged
merged 7 commits into from
Jul 26, 2024
Merged

[feat] Implement Location #9

merged 7 commits into from
Jul 26, 2024

Conversation

san-ghun
Copy link
Owner

  • Implemented Location class related functionalities.

    • Updated Config class to parse and store Location object.
    • Implemented methods for Location class.
  • Updated constructors of classes to set initial values.

  • Added a global variable to handle SIGINT.

    • Took care of still reachable memory issue, not to happen.

san-ghun added 7 commits July 20, 2024 22:45
- Edit redirection value of location /obst/ for better readability.
- Temporarly, changed all properties for Location into public for development purpose.
- Changed data type of _redirectCode from int to string.
- Added new constructors for Location class.
- Updated Config to have a map of Location pointer, not the value, to allocate Location in memory dynamically.
- Added Sample Location objects in Config for dev purpose.
- Updated Config destructor to delete Location instances in Config._locationMap.
- Added volatile bool g_sigint global variable haveing default value as 'false', and turn it into 'true' when sigint been sent.
- Added this feature to prevent 'still reachable' memory remain after the program exit() with SIGINT handler.
- Server::start() will check g_sigint value during loop, and when g_sigint turn to 'true', program will break from the loop and call Server::stop().
- By exiting server.start(), the program will exit with return value 0. And this will prevent 'still reachable' memory issue.

- Added lines of code to apply and set initial value for Server constructor.
- Added lines of code in Server:stop() method to clear and remove remaining values.
- Implemented methods of Location class.
- Added lines of code in constructor to set initial values.
- Added new methods and a property, _isListdir.
- Updated the constructor to have intial value.
- Implemented code blocks to parse and store Location.
- Removed sample Locations code block.
- Added new method getErrorPage(const int code) to return error page for certain HTTP response code for error.
- Added new method getLocation(const std::string key) to return Location\*.
- Restored private properties that were in public for a moment, before the implementation of Location class.
@san-ghun san-ghun requested a review from miooo0o July 23, 2024 18:51
@san-ghun san-ghun self-assigned this Jul 23, 2024
Copy link
Collaborator

@miooo0o miooo0o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I received the PR, applied it, and tested it. It works properly. There is a problem in the build errors due to circular dependency, but I fixed it in my branch. I will use it and send it in the next PR.

src/util/Config.cpp Show resolved Hide resolved
include/webserv.hpp Show resolved Hide resolved
@miooo0o miooo0o merged commit 2fdcf24 into main Jul 26, 2024
1 check passed
@san-ghun san-ghun deleted the dev/location branch July 26, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants