diff --git a/Makefile b/Makefile index a67a053..5ea3244 100644 --- a/Makefile +++ b/Makefile @@ -55,9 +55,11 @@ $(NAME): $(OBJS) clean: rm -rf $(OBJS_D) + echo "$(_RED).o Files Deleted 😱$(_END)" fclean: clean rm -f $(NAME) + echo "$(_RED)$(NAME) Deleted 😱$(_END)" re: fclean all diff --git a/Tester/expected_results/expected_path_test.txt b/Tester/expected_results/expected_path_test.txt new file mode 100644 index 0000000..e09bbf5 --- /dev/null +++ b/Tester/expected_results/expected_path_test.txt @@ -0,0 +1,116 @@ +telnet> Trying 127.0.0.1... +Connected to localhost. +Escape character is '^]'. +HTTP/1.1 200 OK +Server: Webserv/0.1 +Connection: keep-alive +Content-Type: text/html; charset=UTF-8 +Content-Length: 193 + + + +
+(Ëš3Ëš)
+ + +HTTP/1.1 200 OK +Server: Webserv/0.1 +Connection: keep-alive +Content-Type: text/html; charset=UTF-8 +Content-Length: 290 + + + + +(Ëš3Ëš)
+ + +HTTP/1.1 200 OK +Server: Webserv/0.1 +Connection: keep-alive +Content-Type: text/html; charset=UTF-8 +Content-Length: 290 + + + + +(Ëš3Ëš)
+ + +HTTP/1.1 +Server: Webserv/0.1 +Connection: keep-alive +Content-Type: text/html; charset=UTF-8 +Content-Length: 1277 + +.. +upload_form.html +form_get.html +kermit.ico +upload_form_single.html +Cagneyc_intro.gif +Van_Eyck_Portrait_Arnolfini.jpg +root.png +test +drill.jpg +punpun.png +favicon.ico +index.html +rfc2119.html +error_pages +rfc2119_files +
Le Webserv/0.1
+ + +HTTP/1.1 404 Not Found +Server: Webserv/0.1 +Connection: keep-alive +Content-Type: text/html; charset=UTF-8 +Content-Length: 210 + + + + +Le Webserv/0.1
+ + diff --git a/telnet_test.sh b/Tester/telnet_test.sh similarity index 60% rename from telnet_test.sh rename to Tester/telnet_test.sh index 8bb0f73..5b45829 100755 --- a/telnet_test.sh +++ b/Tester/telnet_test.sh @@ -1,24 +1,12 @@ #! /bin/bash + +# DO I EVEN NEED THIS FILE ? could i just put this stuff in maint_test.sh? or would it not modify the vars... + + # you need to put absolutely everything in "" -########## -# Colors -########## - - -_GREY='\033[30m' -_RED='\033[0;31m' -_GREEN='\033[32m' -_YELLOW='\033[33m' -_BLUE='\033[34m' -_PURPLE='\033[35m' -_CYAN='\033[36m' -_WHITE='\033[37m' -_END='\033[0m' - - #test_file=$1 #source $test_file @@ -31,24 +19,6 @@ start_telnet() sleep 1 } -run_telnet() -{ - echo "$connect_to_telnet" - sleep 1 - echo -e "$request" -# echo "$l1" -# echo "$header" -# echo -# echo $body -# echo -# echo - - echo - sleep 1 - -# ret = $(arg | telnet) - -} run() { @@ -57,10 +27,22 @@ run() run_this_test - } +#### DEPRICATED ###### + +run_telnet() +{ + echo "$connect_to_telnet" + sleep 1 + echo -e "$request" + echo + sleep 1 + +# ret = $(arg | telnet) + +} run_a_test() { @@ -69,36 +51,7 @@ run_a_test() echo -e "$_RED$request$_END" } &> test.log -# run_telnet -# echo ${pid} -# echo -e "$_END---" - echo -e "$request" | telnet -# run_telnet | telnet -# run_telnet - -# echo -# echo "----- end of test -----" -} - -run_all() -{ - echo - -# ./webserv $config_file 2>&1 > webserv.log & - - - -#while something i change headers - -# for i in "${methods[@]}" -# do -# expected_result="something" -# run_a_test -# echo -e "${_GREEN}$expected_result${_END}" -## echo -# done - } diff --git a/telnet_test2.sh b/Tester/telnet_test2.sh similarity index 100% rename from telnet_test2.sh rename to Tester/telnet_test2.sh diff --git a/test_header.sh b/Tester/test_header.sh similarity index 71% rename from test_header.sh rename to Tester/test_header.sh index 8f1c988..8f8e5ef 100644 --- a/test_header.sh +++ b/Tester/test_header.sh @@ -2,7 +2,7 @@ test_name="Header Test" -config_file="default.config" +config_file="test1.config" port=4040 host="localhost" @@ -53,3 +53,31 @@ run_this_test() # expected result... +files=() + +file="expected_header_test.txt" +files+=("expected_header_test.txt") +#files+=("expected_path_root_test.txt") + + +local_expected_test_files=() +test_path="" + +add_path() +{ + for i in "${files[@]}" + do + local_expected_test_files+=("$test_path$i") + done +} + +#add_path + + + + + + + + + diff --git a/Tester/test_method.sh b/Tester/test_method.sh new file mode 100644 index 0000000..076d7eb --- /dev/null +++ b/Tester/test_method.sh @@ -0,0 +1,83 @@ +#! /bin/bash + +test_name="Method Test" + +config_file="test1.config" +port=4040 +host="localhost" + +paths=("/") # you can add many +methods=("GET" "POST" "DELETE" "GUMBALL") +#methods=("GET") +httpz=("HTTP/1.1") + + + + +# the parts we will send to webserv + + +# let main.sh handle the l1 + + + +header="Host: $host\n" +header+="Nonsense: fu\n" + +#header_cycle=("Transfer-encoding: fu" "Content-encoding: fu") + +#header+="Transfer-encoding: fu\n" +#header+="Content-endcoding: fu\n" +body= + + +run_this_test() +{ + + for i in "${methods[@]}" + do + l1="$i ${paths[0]} ${httpz[0]}" + request="$l1\n$header\n$body\n" + { + echo "----- $test_name -----" + echo -e "$_RED$request$_END" + } >> telnet.out + echo -e "$request" + sleep 1 + echo -e "\n\n" >> telnet.out + done + +} + + + +# expected result... + +files=() + +file="expected_method_test.txt" +files+=("expected_method_test.txt") +#files+=("expected_path_root_test.txt") + + +local_expected_test_files=() +test_path="" + +add_path() +{ + for i in "${files[@]}" + do + local_expected_test_files+=("$test_path$i") + done +} + +#add_path + + + + + + + + + diff --git a/Tester/test_path.sh b/Tester/test_path.sh new file mode 100644 index 0000000..3439313 --- /dev/null +++ b/Tester/test_path.sh @@ -0,0 +1,75 @@ +#! /bin/bash + +test_name="Path Test" + +config_file="test1.config" +port=4040 +host="localhost" + +paths=("/" "/test" "/test/" "/list" "list" "/wrong") # you can add many +#paths=("/") # you can add many +#methods=("GET" "POST" "DELETE") +methods=("GET") +httpz=("HTTP/1.1") + + + +l1="${methods[0]} ${paths[0]} ${httpz[0]}" + +header="Host: $host" +body= + + +run_this_test() +{ + + for i in "${paths[@]}" + do + l1="${methods[0]} $i ${httpz[0]}" + request="$l1\n$header\n$body\n" + { + echo "----- $test_name -----" + echo -e "$_RED$request$_END" + } >> telnet.log + # echo -e "$request" > compare.txt >> telnet.out + echo -e "$request" + sleep 1 + echo -e "\n" >> telnet.log + done + +} + + + +# expected result... + + +files=() + +file="expected_path_test.txt" +files+=("expected_path_test.txt") +#files+=("expected_path_root_test.txt") +#files+=("expected_path_testnoslash_test.txt") +#files+=("expected_path_testslash_test.txt") +#files+=("expected_path_list_test.txt") +#files+=("expected_path_badlist_test.txt") +#files+=("expected_path_wrong_test.txt") + + +#local_expected_test_file=$file +local_expected_test_files=() +test_path="" + +add_path() +{ + for i in "${files[@]}" + do + local_expected_test_files+=("$test_path$i") + done +} + +#add_path + + + + diff --git a/test_template.sh b/Tester/test_template.sh similarity index 100% rename from test_template.sh rename to Tester/test_template.sh diff --git a/Tester/www/Cagneyc_intro.gif b/Tester/www/Cagneyc_intro.gif new file mode 100644 index 0000000..ed470b9 Binary files /dev/null and b/Tester/www/Cagneyc_intro.gif differ diff --git a/Tester/www/Van_Eyck_Portrait_Arnolfini.jpg b/Tester/www/Van_Eyck_Portrait_Arnolfini.jpg new file mode 100644 index 0000000..5da9b16 Binary files /dev/null and b/Tester/www/Van_Eyck_Portrait_Arnolfini.jpg differ diff --git a/Tester/www/drill.jpg b/Tester/www/drill.jpg new file mode 100644 index 0000000..1812dbd Binary files /dev/null and b/Tester/www/drill.jpg differ diff --git a/Tester/www/error_pages/error_404.html b/Tester/www/error_pages/error_404.html new file mode 100644 index 0000000..fa18a2b --- /dev/null +++ b/Tester/www/error_pages/error_404.html @@ -0,0 +1,11 @@ + + + +Le Webserv/0.1
+ + diff --git a/Tester/www/favicon.ico b/Tester/www/favicon.ico new file mode 100644 index 0000000..8be776b Binary files /dev/null and b/Tester/www/favicon.ico differ diff --git a/Tester/www/form_get.html b/Tester/www/form_get.html new file mode 100644 index 0000000..8379b2d --- /dev/null +++ b/Tester/www/form_get.html @@ -0,0 +1,84 @@ + + + + +(Ëš3Ëš)
+ + diff --git a/Tester/www/kermit.ico b/Tester/www/kermit.ico new file mode 100644 index 0000000..8be776b Binary files /dev/null and b/Tester/www/kermit.ico differ diff --git a/Tester/www/punpun.png b/Tester/www/punpun.png new file mode 100644 index 0000000..90543fa Binary files /dev/null and b/Tester/www/punpun.png differ diff --git a/Tester/www/rfc2119.html b/Tester/www/rfc2119.html new file mode 100644 index 0000000..42168fa --- /dev/null +++ b/Tester/www/rfc2119.html @@ -0,0 +1,312 @@ + + + + + + + + +Network Working Group S. Bradner +Request for Comments: 2119 Harvard University +BCP: 14 March 1997 +Category: Best Current Practice + + + Key words for use in RFCs to Indicate Requirement Levels + +Status of this Memo + + This document specifies an Internet Best Current Practices for the + Internet Community, and requests discussion and suggestions for + improvements. Distribution of this memo is unlimited. + +Abstract + + In many standards track documents several words are used to signify + the requirements in the specification. These words are often + capitalized. This document defines these words as they should be + interpreted in IETF documents. Authors who follow these guidelines + should incorporate this phrase near the beginning of their document: + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL + NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT + RECOMMENDED", "MAY", and "OPTIONAL" in this document are to + be interpreted as described in RFC 2119. +\ No newline at end of file diff --git a/Tester/www/rfc2119_files/errata-base.css b/Tester/www/rfc2119_files/errata-base.css new file mode 100644 index 0000000..c34a536 --- /dev/null +++ b/Tester/www/rfc2119_files/errata-base.css @@ -0,0 +1,139 @@ + diff --git a/Tester/www/rfc2119_files/errata-color.css b/Tester/www/rfc2119_files/errata-color.css new file mode 100644 index 0000000..74428de --- /dev/null +++ b/Tester/www/rfc2119_files/errata-color.css @@ -0,0 +1,43 @@ + diff --git a/Tester/www/rfc2119_files/errata-monochrome.css b/Tester/www/rfc2119_files/errata-monochrome.css new file mode 100644 index 0000000..be74384 --- /dev/null +++ b/Tester/www/rfc2119_files/errata-monochrome.css @@ -0,0 +1,34 @@ + diff --git a/Tester/www/rfc2119_files/errata-printer.css b/Tester/www/rfc2119_files/errata-printer.css new file mode 100644 index 0000000..4a3dab3 --- /dev/null +++ b/Tester/www/rfc2119_files/errata-printer.css @@ -0,0 +1,43 @@ + diff --git a/Tester/www/rfc2119_files/errata.js b/Tester/www/rfc2119_files/errata.js new file mode 100644 index 0000000..4e29587 --- /dev/null +++ b/Tester/www/rfc2119_files/errata.js @@ -0,0 +1,4 @@ +function hideFunction(nodeId) { + var ul = document.getElementById(nodeId) + ul.className = (ul.className=="nodeOpenClass") ? "nodeCloseClass" : "nodeOpenClass" +} diff --git a/Tester/www/rfc2119_files/errata.js.téléchargement b/Tester/www/rfc2119_files/errata.js.téléchargement new file mode 100644 index 0000000..4e29587 --- /dev/null +++ b/Tester/www/rfc2119_files/errata.js.téléchargement @@ -0,0 +1,4 @@ +function hideFunction(nodeId) { + var ul = document.getElementById(nodeId) + ul.className = (ul.className=="nodeOpenClass") ? "nodeCloseClass" : "nodeOpenClass" +} diff --git a/Tester/www/root.png b/Tester/www/root.png new file mode 100644 index 0000000..ebd1548 Binary files /dev/null and b/Tester/www/root.png differ diff --git a/Tester/www/test/index1.html b/Tester/www/test/index1.html new file mode 100644 index 0000000..f976302 --- /dev/null +++ b/Tester/www/test/index1.html @@ -0,0 +1,14 @@ + + + ++ Note that the force of these words is modified by the requirement + level of the document in which they are used. + +1. MUST This word, or the terms "REQUIRED" or "SHALL", means that the + definition is an absolute requirement of the specification. +++EID 499 (Verified) is as follows: + +Section: Abstract + +Original Text: + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL + NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and + "OPTIONAL" in this document are to be interpreted as described in + RFC 2119. + +Corrected Text: + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL + NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT + RECOMMENDED", "MAY", and "OPTIONAL" in this document are to + be interpreted as described in RFC 2119. ++Notes:
+The phrase "NOT RECOMMENDED" is missing from this sentence. +++EID 493 (Verified) is as follows: + +Section: 1 + +Original Text: + +2. MUST NOT This phrase, or the phrase "SHALL NOT", mean that the + definition is an absolute prohibition of the specification. + +Corrected Text: + +2. MUST NOT This phrase, or the phrase "SHALL NOT", means that the + definition is an absolute prohibition of the specification. ++Notes:
+ +++EID 498 (Verified) is as follows: + +Section: 1 + +Original Text: + +4. SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean that + there may exist valid reasons in particular circumstances when the + particular behavior is acceptable or even useful, but the full + implications should be understood and the case carefully weighed + before implementing any behavior described with this label. + +Corrected Text: + +4. SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED", means that + there may exist valid reasons in particular circumstances when the + particular behavior is acceptable or even useful, but the full + implications should be understood and the case carefully weighed + before implementing any behavior described with this label. ++Notes:
+ +++ +EID 500 (Verified) is as follows: + +Section: 1 + +Original Text: + +3. SHOULD This word, or the adjective "RECOMMENDED", mean that there + may exist valid reasons in particular circumstances to ignore a + particular item, but the full implications must be understood and + carefully weighed before choosing a different course. + +Corrected Text: + +3. SHOULD This word, or the adjective "RECOMMENDED", means that there + may exist valid reasons in particular circumstances to ignore a + particular item, but the full implications must be understood and + carefully weighed before choosing a different course. ++Notes:
+ ++2. MUST NOT This phrase, or the phrase "SHALL NOT", mean that the + definition is an absolute prohibition of the specification. + +3. SHOULD This word, or the adjective "RECOMMENDED", mean that there + may exist valid reasons in particular circumstances to ignore a + particular item, but the full implications must be understood and + carefully weighed before choosing a different course. + +4. SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean that + there may exist valid reasons in particular circumstances when the + particular behavior is acceptable or even useful, but the full + implications should be understood and the case carefully weighed + before implementing any behavior described with this label. + +5. MAY This word, or the adjective "OPTIONAL", mean that an item is + truly optional. One vendor may choose to include the item because a + particular marketplace requires it or because the vendor feels that + it enhances the product while another vendor may omit the same item. + An implementation which does not include a particular option MUST be + prepared to interoperate with another implementation which does + include the option, though perhaps with reduced functionality. In the + same vein an implementation which does include a particular option + MUST be prepared to interoperate with another implementation which + does not include the option (except, of course, for the feature the + option provides). +++EID 495 (Verified) is as follows: + +Section: 1 + +Original Text: + +1. MUST This word, or the terms "REQUIRED" or "SHALL", mean that the + definition is an absolute requirement of the specification. + + +Corrected Text: + +1. MUST This word, or the terms "REQUIRED" or "SHALL", means that the + definition is an absolute requirement of the specification. ++Notes:
+ ++6. Guidance in the use of these Imperatives + + Imperatives of the type defined in this memo must be used with care + and sparingly. In particular, they MUST only be used where it is + actually required for interoperation or to limit behavior which has + potential for causing harm (e.g., limiting retransmissions) For +++EID 5101 (Verified) is as follows: + +Section: 5 + +Original Text: + +5. MAY This word, or the adjective "OPTIONAL", mean that an item is + truly optional. One vendor may choose to include the item because a + particular marketplace requires it or because the vendor feels that + it enhances the product while another vendor may omit the same item. + An implementation which does not include a particular option MUST be + prepared to interoperate with another implementation which does + include the option, though perhaps with reduced functionality. In the + same vein an implementation which does include a particular option + MUST be prepared to interoperate with another implementation which + does not include the option (except, of course, for the feature the + option provides.) + +Corrected Text: + +5. MAY This word, or the adjective "OPTIONAL", mean that an item is + truly optional. One vendor may choose to include the item because a + particular marketplace requires it or because the vendor feels that + it enhances the product while another vendor may omit the same item. + An implementation which does not include a particular option MUST be + prepared to interoperate with another implementation which does + include the option, though perhaps with reduced functionality. In the + same vein an implementation which does include a particular option + MUST be prepared to interoperate with another implementation which + does not include the option (except, of course, for the feature the + option provides). ++Notes:
+Full stop should appear outside the parentheses in the last sentence. +example, they must not be used to try to impose a particular method + on implementors where the method is not required for + interoperability. + +7. Security Considerations + + These terms are frequently used to specify behavior with security + implications. The effects on security of not implementing a MUST or + SHOULD, or doing something the specification says MUST NOT or SHOULD + NOT be done may be very subtle. Document authors should take the time + to elaborate the security implications of not following + recommendations or requirements as most implementors will not have + had the benefit of the experience and discussion that produced the + specification. + +8. Acknowledgments + + The definitions of these terms are an amalgam of definitions taken + from a number of RFCs. In addition, suggestions have been + incorporated from a number of people including Robert Ullmann, Thomas + Narten, Neal McBurnett, and Robert Elz. + +9. Author's Address + + Scott Bradner + Harvard University + 1350 Mass. Ave. + Cambridge, MA 02138 + + phone - +1 617 495 3864 + + email - sob@harvard.edu + + + + + + +++EID 494 (Verified) is as follows: + +Section: 6 + +Original Text: + +(e.g., limiting retransmisssions) + +Corrected Text: + +(e.g., limiting retransmissions) ++Notes:
+ +++EID 496 (Verified) is as follows: + +Section: 6 + +Original Text: + + In particular, they MUST only be used where it is actually required + for interoperation or to limit behavior which has potential for + causing harm (e.g., limiting retransmisssions) For example, they + must not be used to try to impose a particular method on + implementors where the method is not required for interoperability. + +Corrected Text: + + In particular, they MUST only be used where it is actually required + for interoperation or to limit behavior which has potential for + causing harm (e.g., limiting retransmissions). For example, they + must not be used to try to impose a particular method on + implementors where the method is not required for interoperability. ++Notes:
+ +
(Ëš3Ëš)
+ + diff --git a/Tester/www/test/something.html b/Tester/www/test/something.html new file mode 100644 index 0000000..5eb0f8b --- /dev/null +++ b/Tester/www/test/something.html @@ -0,0 +1,11 @@ + + + +(Ëš3Ëš)
+ + diff --git a/Tester/www/test/submit_form.html b/Tester/www/test/submit_form.html new file mode 100644 index 0000000..c4d556b --- /dev/null +++ b/Tester/www/test/submit_form.html @@ -0,0 +1,17 @@ + + + +Time to submit something:
+ + + + diff --git a/Tester/www/test/test_deeper/index1.html b/Tester/www/test/test_deeper/index1.html new file mode 100644 index 0000000..c5c0b87 --- /dev/null +++ b/Tester/www/test/test_deeper/index1.html @@ -0,0 +1,11 @@ + + + +(Ëš3Ëš)
+ + diff --git a/Tester/www/test/test_deeper/something.html b/Tester/www/test/test_deeper/something.html new file mode 100644 index 0000000..c864180 --- /dev/null +++ b/Tester/www/test/test_deeper/something.html @@ -0,0 +1,11 @@ + + + +(Ëš3Ëš)
+ + diff --git a/Tester/www/test/test_deeper/super_deep/something.html b/Tester/www/test/test_deeper/super_deep/something.html new file mode 100644 index 0000000..94fb38c --- /dev/null +++ b/Tester/www/test/test_deeper/super_deep/something.html @@ -0,0 +1,11 @@ + + + +(Ëš3Ëš)
+ + diff --git a/Tester/www/upload_form.html b/Tester/www/upload_form.html new file mode 100644 index 0000000..2d00e92 --- /dev/null +++ b/Tester/www/upload_form.html @@ -0,0 +1,12 @@ + + diff --git a/Tester/www/upload_form_single.html b/Tester/www/upload_form_single.html new file mode 100644 index 0000000..4adb11e --- /dev/null +++ b/Tester/www/upload_form_single.html @@ -0,0 +1,10 @@ + + diff --git a/compare.txt b/compare.txt index bf282f7..e09bbf5 100644 --- a/compare.txt +++ b/compare.txt @@ -18,3 +18,99 @@ Content-Length: 193(Ëš3Ëš)