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

Dev/location test pr #10

Merged
merged 8 commits into from
Jul 30, 2024
Merged

Conversation

miooo0o
Copy link
Collaborator

@miooo0o miooo0o commented Jul 26, 2024

Implemented the import of Config and Location classes and the creation of the correct response.

  • resolve build errors due to circular dependency
  • modularization of existing methods, logic refined in the meeting with @san-ghun
  • documentation
  • Renamed/unified some methods (mostly in HttpResponse, StaticFileHandler files)
  • Change ext in mime-type list so that it does not contain .

tested:

http://localhost:8080/fruits/index.html    -------> OK (file opened)
http://localhost:8080/fruits/   ------------------> OK (index.html fetching)
http://localhost:8080/    ------------------------> OK (index.html fetching)

Copy link
Owner

@san-ghun san-ghun left a comment

Choose a reason for hiding this comment

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

Hey @miooo0o ,
thanks for you hard work.

I see some parts that need modification.
Please have look at my review and change those points.

Leave comment or message after your modification.

Thanks!

std::string _extractPathFromUri(const std::string& uri);
std::string _getMatchedLocation(std::string path,
const std::map<std::string,
Location*>& locations);
Copy link
Owner

Choose a reason for hiding this comment

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

24, 25 줄에 있는 함수들은 왜 클래스 밖에 따로 선언하셨나요? 특별한 이유가 있을까요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

함수 위치가 확정이 안되서요. 따로 변경사항 없으면 나중에 member로 넣을거에요.

/// @brief Generates an HTML page with a directory listing.
/// @param path
/// @return Create a list of directories and files in HTML and export it to std::stringstream.
std::string genDirListingHtml(const std::string& path)
Copy link
Owner

Choose a reason for hiding this comment

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

이 함수는 클래스에서 따로 빼신거 잘 하신거 같아요. 어차피 나중에 디렉토리에 직접 탐색해서 있는 파일들 이름으로 하이퍼링크를 달면 될 거 같아서, 클래스에서 따로 빼서 쓰는 것도 좋은 선택인거 같네요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

오 그것도 좋은 생각입니다! 사실 이 함수도 일단은 member로 넣을 이유가 크게 없어서 빼둔건데 계속 유지하는거로 생각할게요!

{
// if (/* && location.location.isListDir() */)
// return (_handleDirListing(request, location));
return (_handleDirRequest(request, location));
Copy link
Owner

Choose a reason for hiding this comment

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

이거는 보정이 필요해 보입니다. 탭이 너무 많네요... ㅎ

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

확인하고 수정할게요!


std::cout << "TEST | absolute path that with index is built: " << _handledPath << std::endl;
if (isFile(_handledPath))
return (_handleNotFound());
Copy link
Owner

Choose a reason for hiding this comment

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

line 91: The condition is wrong.

  • I think you wanted to do like this:
if (!isFile(_handledPath))
    return (_handleNotFound());

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

이런 치명적인 실수를. 감사합니다, 수정할게요.

Copy link
Owner

@san-ghun san-ghun left a comment

Choose a reason for hiding this comment

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

Thanks for your correction.

@san-ghun san-ghun merged commit 08931a4 into san-ghun:main Jul 30, 2024
1 check passed
@miooo0o miooo0o deleted the dev/location_test_pr branch October 23, 2024 08:04
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