42Webserver / 42-Vienna-Webserv

This project is about writing our own HTTP server in C++
1 stars 0 forks source link

Delete Request Function should take filePath string? #51

Closed Nikster3k closed 2 weeks ago

Nikster3k commented 1 month ago

Should the deleteRequest function take the filepath string? Because if we have uri "/delete/" and we have an index file for that location should we first do our filepath stuff and have "{root}/index.file" and try to delete this file?

https://github.com/42Webserver/42-Vienna-Webserv/blob/9f11f972579caa4d947689053b2313e7e64787da/Response.cpp#L264-L282

Nikster3k commented 1 month ago

I think "root" + "uri" is also wrong. because when we have location "/delete" and uri "/delete/file.txt" we want filepath "{root}/file.txt" and not "{root}/delete/file.txt"

Nikster3k commented 1 month ago

Changed it on my PathInfo branch. But does it make sense if we call delete on a location/dir uri="/directory/" that we delete index file if that location has one? I think its okay

windchaser-surf commented 1 month ago

how is it possible, that we delete index file?

Nikster3k commented 1 month ago

Because if we call delete on uri="/dir/" we do our filepath checking and filepath will end up being "{root}/{indexfile}". And then we delete filepath

windchaser-surf commented 1 month ago

ah ok. yeah. I mean we can handle like this. but what happen if we get a delete request with uri /{root}/[anyfile.txt}, and we do not found this file? we are also deleting index?

Nikster3k commented 1 month ago

Will be closed with #50