Webserv Request Flow
Webserv Request Flow
if =>
Transfer-Encoding header
RETURN
Error
if =>
Error
have “/” at the end this directory has
TRUE
an index file and cgi
400 Bad Request RETURN Not Found is_uri_has_/_in_end() Returtn Code Depend on cgi
FALSE RETURN
409 Conflict
RETURN
Error
if =>
Found
if =>
TRUE
Error
if =>
FALSE TRUE TRUE RETURN
Request uri contain
if=>
if =>
Delete Succes
Request body larger
File
RETURN
204 No Content
than client max body size
Error
RETURN
SUCESS
RETURN
403 Forbidden requested location
has_write_acces_on_folder()
FALSE
FAILED
get_matched_location_for_request_uri()
if =>
TRUE FALSE
if =>
if =>
no location match
No Lcoation Found
TRUE requested location
is_location_have_redirection()
make a 301 redirection
if =>
you request uri doesn’t
FALSE
is_dir_has_index_files()
this directory does’t
RETURN
have an index file
uplaod the Post
location support
is_uri_has_/_in_end()
if =>
is_method_allowded_in_location()
upload
method not allowded TRUE
TRUE
FALSE
if =>
if =>
you request
this directory has
a directory
FALSE
an index file
TRUE
if =>
Returtn Code Depend on cgi
check_which_requested_method()
if_location_support_upload()
get_requested_resource() location has cgi run cgi on requested file
Directory TRUE
if =>
requested resource
get_requested_resource()
not found in root Not Found
if_location_has_cgi()
FALSE RETURN
403 Forbidden
get_resource_type()
if =>
Found
get_resource_type() location doesn’t have cgi
File
RETURN
Directory File
if =>
404 Not Found
is_uri_has_/_in_end()
you request a file if =>
you request
a directory
make a 301 redirection
if =>
if =>
TRUE
if =>
RETURN
TRUE
if =>
200 OK
location have cgi
Allowded Chars in request uri
if =>
OFF
autoindex off
ON
of the directory
Returtn Code Depend on cgi
200 OK