calebkbrad / calebsserver

Implementation of an HTTP compliant web server from scratch. Done as a semester-long project for CS 531.
0 stars 0 forks source link

Assignment 2 #10

Open ibnesayeed opened 1 year ago

ibnesayeed commented 1 year ago
================================================================================Assignment: cs531a2
Student: Caleb Bradford <cs_cbrad022@cs.odu.edu>
Time: 20221205-193851 UTC
Repository: https://github.com/calebkbrad/calebsserver/tree/a2
Server: cs531-cs_cbrad022
================================================================================

Deploying server: cs531-cs_cbrad022

Cloning the `https://github.com/calebkbrad/calebsserver.git` repo and checking the `a2` branch/tag out
Released at: 2022-10-17T00:35:31Z
Step 1/13 : FROM    python:3
 ---> e285995a3494
Step 2/13 : LABEL   maintainer = "Caleb Bradford <@calebkbradford>"
 ---> Using cache
 ---> 74579e05b181
Step 3/13 : ENV WEBROOT="/var/www"
 ---> Using cache
 ---> d2ddd397f43b
Step 4/13 : WORKDIR ${WEBROOT}
 ---> Using cache
 ---> 5d9b75cadc40
Step 5/13 : RUN     wget https://raw.githubusercontent.com/ibnesayeed/webserver-tester/master/sample/cs531-test-files.tar.gz         && tar xvzf cs531-test-files.tar.gz         && rm -rf cs531-test-files.tar.gz
 ---> Using cache
 ---> fd41172e0a28
Step 6/13 : WORKDIR /app
 ---> Using cache
 ---> 635268e75bbc
Step 7/13 : COPY    src/server.py /app
 ---> Using cache
 ---> ede9ff9e643c
Step 8/13 : COPY    errorpages /app/errorpages
 ---> Using cache
 ---> 80321e5b759e
Step 9/13 : COPY    settings /app/settings
 ---> Using cache
 ---> e22f968bec72
Step 10/13 : RUN     touch /app/access.log
 ---> Using cache
 ---> 269e4404ae04
Step 11/13 : RUN     chmod a+x server.py
 ---> Using cache
 ---> 801bda62bca0
Step 12/13 : RUN     pip install pyyaml
 ---> Using cache
 ---> c79ae7a8c0ef
Step 13/13 : ENTRYPOINT [ "./server.py" ]
 ---> Using cache
 ---> 9d5d7432957b
Successfully built 9d5d7432957b
Successfully tagged cs531/cs_cbrad022:a2

A new container is created and the server `cs531-cs_cbrad022` is deployed successfully

Testing server: cs531-cs_cbrad022 against cs531a2 test suite

Testing cs531-cs_cbrad022:80
--------------------------------------------------------------------------------
test_get_directory_listing: Test whether a2-test directory root returns directory listing
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload contains `coolcar.html`
* Payload contains `ford`
* Socket connection is closed
[PASSED]

> GET http://cs531-cs_cbrad022/a2-test/ HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 03:46:18 GMT
< Content-Length: 4096
< 
* [Payload redacted (674 bytes)]

--------------------------------------------------------------------------------
test_redirect_to_trailing_slash_for_directory_url: Test whether redirects URL to trailing slashes when missing for existing directories
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `301`
* `Location` header is present
* `Location` header ends with `/a2-test/2/`
* Socket connection is closed
[PASSED]

> GET http://cs531-cs_cbrad022/a2-test/2 HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 301 Moved Permanently
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Location: /a2-test/2/
< 
* [Payload redacted (47 bytes)]

--------------------------------------------------------------------------------
test_redirect_to_trailing_slash_for_directory_path: Test whether redirects path to trailing slashes when missing for existing directories
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `301`
* `Location` header is present
* `Location` header ends with `/a2-test/1/`
* Socket connection is closed
[PASSED]

> GET /a2-test/1 HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 301 Moved Permanently
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Location: /a2-test/1/
< 
* [Payload redacted (47 bytes)]

--------------------------------------------------------------------------------
test_get_default_index_file: Test whether default index.html is returned instead of directory listing
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload is not empty
* Fetching `/a2-test/2/index.html` for content comparison
* Contents of `/a2-test/2/` and `/a2-test/2/index.html` are the same
* Socket connection is closed
[PASSED]

> GET http://cs531-cs_cbrad022/a2-test/2/ HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"
< 
* [Payload redacted (1936 bytes)]

--------------------------------------------------------------------------------
test_redirect_as_per_regexp_trailing_wildcard_capture: Test whether redirects as per the regular expression with wildcard trailing capture group
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `302`
* `Location` header is present
* `Location` header ends with `/a2-test/1/1.1/assignment1.ppt`
[PASSED]

> HEAD /a2-test/1/1.3/assignment1.ppt HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 302 Found
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Location: /a2-test/1/1.1/assignment1.ppt
< 
* [Payload redacted (55 bytes)]

--------------------------------------------------------------------------------
test_redirect_as_per_regexp_trailing_specific_file: Test whether redirects as per the regular expression with a specific trailing file name
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `302`
* `Location` header is present
* `Location` header ends with `/a2-test/galaxie.html`
[PASSED]

> HEAD /a2-test/coolcar.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 302 Found
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Location: /a2-test/galaxie.html
< 
* [Payload redacted (55 bytes)]

--------------------------------------------------------------------------------
test_dont_redirect_target_file: Test whether the target of the configured redirect returns 200 OK
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload is empty
[PASSED]

> HEAD /a2-test/galaxie.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 03:44:27 GMT
< Content-Length: 96
< ETag: "7d344af10346d1a6f168ecc66d6885af"

--------------------------------------------------------------------------------
test_conditional_head_fresh: Test whether conditional HEAD of a fresh file returns 304 Not Modified
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
[FAILED] ASSERTION: Status expected `304`, returned `200`

> HEAD /a2-test/2/fairlane.html HTTP/1.1
> Host: cs531-cs_cbrad022
> If-Modified-Since: Sat, 20 Oct 2018 02:33:21 GMT
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"

--------------------------------------------------------------------------------
test_conditional_head_stale: Test whether conditional HEAD of a stale file returns 200 OK
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload is empty
[PASSED]

> HEAD /a2-test/2/fairlane.html HTTP/1.1
> Host: cs531-cs_cbrad022
> If-Modified-Since: Sat, 20 Oct 2018 02:33:20 GMT
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"

--------------------------------------------------------------------------------
test_conditional_head_invalid_datetime: Test whether conditional HEAD with invalid datetime returns 200 OK
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload is empty
[PASSED]

> HEAD /a2-test/2/fairlane.html HTTP/1.1
> Host: cs531-cs_cbrad022
> If-Modified-Since: who-doesn't-want-a-fairlane?
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"

--------------------------------------------------------------------------------
test_conditional_head_unsupported_datetime_format: Test whether conditional HEAD with unsupported datetime format returns 200 OK
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload is empty
[PASSED]

> HEAD /a2-test/2/fairlane.html HTTP/1.1
> Host: cs531-cs_cbrad022
> If-Modified-Since: 2018-10-20 02:33:21.304307000 -0000
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"

--------------------------------------------------------------------------------
test_include_etag: Test whether the HEAD response contains an ETag
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `ETag` header is present
* `ETag` is not empty and properly formatted in double quotes as `"e5359f8ba4c1697b0d5088c8344d08d5"`
[PASSED]

> HEAD /a2-test/2/fairlane.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"

--------------------------------------------------------------------------------
test_valid_etag_ok: Test whether a valid ETag returns 200 OK
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload contains `1966 Ford Fairlane`
[PASSED]

> GET /a2-test/2/fairlane.html HTTP/1.1
> Host: cs531-cs_cbrad022
> If-Match: "e5359f8ba4c1697b0d5088c8344d08d5"
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"
< 
* [Payload redacted (1936 bytes)]

--------------------------------------------------------------------------------
test_etag_if_match_failure: Test whether a random ETag returns 412 Precondition Failed
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `412`
[PASSED]

> GET /a2-test/2/fairlane.html HTTP/1.1
> Host: cs531-cs_cbrad022
> If-Match: "203948kjaldsf002"
> Connection: close
> 

< HTTP/1.1 412 Precondition Failed
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (76 bytes)]

--------------------------------------------------------------------------------
test_implicit_keep_alive_until_timeout: Test whether the socket connection is kept alive by default and closed after the set timeout
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload is empty
* Socket connection is kept alive
* Making a subsequent request after `5` seconds
* Reusing existing connection
* Request data sent
* Response data read
* Response parsed
* Status is `408`
* `Connection` header is present
* `Connection` header has value `close`
* Socket connection is closed
[PASSED]

> HEAD /a2-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> 
> HEAD /a2-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:38:58 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"
< 
< HTTP/1.1 408 Request Timeout
< Date: Mon, 05 Dec 2022 07:39:03 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (105 bytes)]

--------------------------------------------------------------------------------
test_explicit_keep_alive_until_timeout: Test whether the socket connection is kept alive when explicitly requested and closed after the set timeout
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload is empty
* Socket connection is kept alive
* Making a subsequent request after `5` seconds
* Reusing existing connection
* Request data sent
* Response data read
* Response parsed
* Status is `408`
* `Connection` header is present
* `Connection` header has value `close`
* Socket connection is closed
[PASSED]

> HEAD /a2-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: keep-alive
> 
> HEAD /a2-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: keep-alive
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:39:04 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"
< 
< HTTP/1.1 408 Request Timeout
< Date: Mon, 05 Dec 2022 07:39:09 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (105 bytes)]

--------------------------------------------------------------------------------
test_trace_unnecessary_conditionals: Test whether many unnecessary conditionals are not processed
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `message/http`
* Payload begins with `TRACE /a2-test/2/index.html HTTP/1.1`
[PASSED]

> TRACE /a2-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> If-Match: "not-a-real-etag"
> If-None-Match: "also-not-a-real-etag"
> If-Modified-Since: Fri, 19 Oct 2018 22:33:21 GMT
> If-Unmodified-Since: Fri, 19 Oct 2018 22:33:21 GMT
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:39:11 GMT
< Server: calebsserver
< Connection: close
< Content-Type: message/http
< 
* [Payload redacted (254 bytes)]

--------------------------------------------------------------------------------
test_pipeline_requests: Test whether multiple pipelined requests are processed and returned in the same order
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Parsing second response
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Parsing third response
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload contains `coolcar.html`
* Payload contains `ford`
* Socket connection is closed
[PASSED]

> HEAD /a2-test/ HTTP/1.1
> Host: cs531-cs_cbrad022
> 
> HEAD /a2-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> 
> GET /a2-test/ HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:39:11 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 03:46:18 GMT
< Content-Length: 4096
< 
< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:39:11 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"
< 
< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:39:11 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 03:46:18 GMT
< Content-Length: 4096
< 
* [Payload redacted (674 bytes)]

--------------------------------------------------------------------------------
test_long_lived_connection: Test whether the socket connection is kept alive to process multiple requests successively
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload is empty
* Socket connection is kept alive
* Making second request
* Reusing existing connection
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload is empty
* Socket connection is kept alive
* Making third request
* Reusing existing connection
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* Payload contains `coolcar.html`
* Payload contains `ford`
* Socket connection is closed
[PASSED]

> HEAD /a2-test/ HTTP/1.1
> Host: cs531-cs_cbrad022
> 
> HEAD /a2-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> 
> GET /a2-test/ HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:39:11 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 03:46:18 GMT
< Content-Length: 4096
< 
< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:39:11 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"
< 
< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:39:12 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 03:46:18 GMT
< Content-Length: 4096
< 
* [Payload redacted (674 bytes)]

=================================== SUMMARY ====================================
Server: cs531-cs_cbrad022:80
Test Case Results:
PASSED: test_get_directory_listing
PASSED: test_redirect_to_trailing_slash_for_directory_url
PASSED: test_redirect_to_trailing_slash_for_directory_path
PASSED: test_get_default_index_file
PASSED: test_redirect_as_per_regexp_trailing_wildcard_capture
PASSED: test_redirect_as_per_regexp_trailing_specific_file
PASSED: test_dont_redirect_target_file
FAILED: test_conditional_head_fresh
PASSED: test_conditional_head_stale
PASSED: test_conditional_head_invalid_datetime
PASSED: test_conditional_head_unsupported_datetime_format
PASSED: test_include_etag
PASSED: test_valid_etag_ok
PASSED: test_etag_if_match_failure
PASSED: test_implicit_keep_alive_until_timeout
PASSED: test_explicit_keep_alive_until_timeout
PASSED: test_trace_unnecessary_conditionals
PASSED: test_pipeline_requests
PASSED: test_long_lived_connection
--------------------------------------------------------------------------------
TOTAL: 19, PASSED: 18, FAILED: 1
===============================================================================

Destroying server: cs531-cs_cbrad022
Server `cs531-cs_cbrad022` destroyed successfully.
ibnesayeed commented 1 year ago
================================================================================
Assignment: cs531a1
Student: Caleb Bradford <cs_cbrad022@cs.odu.edu>
Time: 20221205-193736 UTC
Repository: https://github.com/calebkbrad/calebsserver/tree/a2
Server: cs531-cs_cbrad022
================================================================================

Deploying server: cs531-cs_cbrad022

Cloning the `https://github.com/calebkbrad/calebsserver.git` repo and checking the `a2` branch/tag out
Released at: 2022-10-17T00:35:31Z
Step 1/13 : FROM    python:3
 ---> e285995a3494
Step 2/13 : LABEL   maintainer = "Caleb Bradford <@calebkbradford>"
 ---> Using cache
 ---> 74579e05b181
Step 3/13 : ENV WEBROOT="/var/www"
 ---> Using cache
 ---> d2ddd397f43b
Step 4/13 : WORKDIR ${WEBROOT}
 ---> Using cache
 ---> 5d9b75cadc40
Step 5/13 : RUN     wget https://raw.githubusercontent.com/ibnesayeed/webserver-tester/master/sample/cs531-test-files.tar.gz         && tar xvzf cs531-test-files.tar.gz         && rm -rf cs531-test-files.tar.gz
 ---> Using cache
 ---> fd41172e0a28
Step 6/13 : WORKDIR /app
 ---> Using cache
 ---> 635268e75bbc
Step 7/13 : COPY    src/server.py /app
 ---> Using cache
 ---> ede9ff9e643c
Step 8/13 : COPY    errorpages /app/errorpages
 ---> Using cache
 ---> 80321e5b759e
Step 9/13 : COPY    settings /app/settings
 ---> Using cache
 ---> e22f968bec72
Step 10/13 : RUN     touch /app/access.log
 ---> Using cache
 ---> 269e4404ae04
Step 11/13 : RUN     chmod a+x server.py
 ---> Using cache
 ---> 801bda62bca0
Step 12/13 : RUN     pip install pyyaml
 ---> Using cache
 ---> c79ae7a8c0ef
Step 13/13 : ENTRYPOINT [ "./server.py" ]
 ---> Using cache
 ---> 9d5d7432957b
Successfully built 9d5d7432957b
Successfully tagged cs531/cs_cbrad022:a2

A new container is created and the server `cs531-cs_cbrad022` is deployed successfully

Testing server: cs531-cs_cbrad022 against cs531a1 test suite

Testing cs531-cs_cbrad022:80
--------------------------------------------------------------------------------
test_url_get_ok: Test whether the URL of the assignment 1 directory returns HTTP/1.1 200 OK on GET
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* HTTP version is `HTTP/1.1`
* Status is `200`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
[PASSED]

> GET http://cs531-cs_cbrad022/a1-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"
< 
* [Payload redacted (1936 bytes)]

--------------------------------------------------------------------------------
test_url_head_ok: Test whether the URL of the assignment 1 directory returns 200 on HEAD
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
* Payload is empty
[PASSED]

> HEAD http://cs531-cs_cbrad022/a1-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"

--------------------------------------------------------------------------------
test_path_head_ok: Test whether the relative path of the assignment 1 directory returns 200 on HEAD
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/html`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
* Payload is empty
[PASSED]

> HEAD /a1-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 1936
< ETag: "e5359f8ba4c1697b0d5088c8344d08d5"

--------------------------------------------------------------------------------
test_path_options_ok: Test whether the relative path of the assignment 1 directory returns 200 on OPTIONS
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Allow` header is present
* `Allow` header contains `GET`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
[PASSED]

> OPTIONS /a1-test/2/index.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Connection: close
< Allow: GET, HEAD, OPTIONS, TRACE

--------------------------------------------------------------------------------
test_get_missing: Test whether a non-existing path returns 404 on GET
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* HTTP version is `HTTP/1.1`
* Status is `404`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
[PASSED]

> GET /1/1.1/go%20hokies.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 404 Not Found
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (95 bytes)]

--------------------------------------------------------------------------------
test_get_duplicate_path_prefix: Test tight path prefix checking
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* HTTP version is `HTTP/1.1`
* Status is `404`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
[PASSED]

> GET /a1-test/a1-test/ HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 404 Not Found
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (91 bytes)]

--------------------------------------------------------------------------------
test_unsupported_version: Test whether a request with unsupported version returns 505
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `505`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
[PASSED]

> GET / HTTP/1.11
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 505 HTTP Version not Supported
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (73 bytes)]

--------------------------------------------------------------------------------
test_invalid_request: Test whether an invalid request returns 400
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `400`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
[PASSED]

> qwerty
> 

< HTTP/1.1 400 Bad Request
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (91 bytes)]

--------------------------------------------------------------------------------
test_missing_host_header: Test whether missing Host header in a request returns 400
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `400`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
[PASSED]

> GET / HTTP/1.1
> Connection: close
> 

< HTTP/1.1 400 Bad Request
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (91 bytes)]

--------------------------------------------------------------------------------
test_post_not_implemented: Test whether the assignment 1 returns 501 on POST
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `501`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
[PASSED]

> POST /a1-test/ HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 501 Not Implemented
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (67 bytes)]

--------------------------------------------------------------------------------
test_trace_echoback: Test whether the server echoes back the request on TRACE
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `message/http`
* `Date` header is present
* `Date` header is in the preferred RCF7231 format
* Payload begins with `TRACE /a1-test/1/1.4/ HTTP/1.1`
* Payload contains `User-Agent: CS531 Assignment 1 Tester/1670269062`
* Payload contains `Connection: close`
[PASSED]

> TRACE /a1-test/1/1.4/ HTTP/1.1
> Host: cs531-cs_cbrad022
> User-Agent: CS531 Assignment 1 Tester/1670269062
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Connection: close
< Content-Type: message/http
< 
* [Payload redacted (128 bytes)]

--------------------------------------------------------------------------------
test_get_escaped_file_name: Test whether the escaped file name is respected
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* Payload contains `lower case html`
[PASSED]

> GET http://cs531-cs_cbrad022/a1-test/1/1.4/test%3A.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 25
< ETag: "4400055101ad85035c4d0d010bf199b6"
< 
* [Payload redacted (25 bytes)]

--------------------------------------------------------------------------------
test_get_escape_escaping_character: Test whether the escaped escaping caracter in a file name is respected
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* Payload contains `Go Monarchs!`
[PASSED]

> GET http://cs531-cs_cbrad022/a1-test/1/1.4/escape%25this.html HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: text/html
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 67
< ETag: "d23695deea09abedde3aaf360277a782"
< 
* [Payload redacted (67 bytes)]

--------------------------------------------------------------------------------
test_get_jpeg_image: Test whether a JPEG image returns 200 with proper Content-Length on GET
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Length` header is present
* `Content-Length` header has value `38457`
* Payload size is `38457` bytes
[PASSED]

> GET http://cs531-cs_cbrad022/a1-test/2/0.jpeg HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: image/jpeg
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 38457
< ETag: "a5ee39e4649fdd082e17b9c6a5758885"
< 
* [Payload redacted (38457 bytes)]

--------------------------------------------------------------------------------
test_get_case_sensitive_file_extension: Test whether file extensions are treated case-sensitive
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* HTTP version is `HTTP/1.1`
* Status is `404`
[PASSED]

> GET http://cs531-cs_cbrad022/a1-test/2/0.JPEG HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 404 Not Found
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Connection: close
< 
* [Payload redacted (91 bytes)]

--------------------------------------------------------------------------------
test_get_empty_text_file: Test whether an empty file returns zero bytes with 200 on GET
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/plain`
* `Content-Length` header is present
* `Content-Length` header has value `0`
* Payload is empty
[PASSED]

> GET http://cs531-cs_cbrad022/a1-test/4/thisfileisempty.txt HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: text/plain
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 0
< ETag: "d41d8cd98f00b204e9800998ecf8427e"

--------------------------------------------------------------------------------
test_get_empty_unknown_file_directory: Test whether an unknown empty file or directory returns zero bytes and a valid Content-Type with 200 on GET
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `application/octet-stream`
* `Content-Length` header is present
* `Content-Length` header has value `0`
* Payload is empty
[PASSED]

> GET http://cs531-cs_cbrad022/a1-test/4/directory3isempty HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: application/octet-stream
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 0
< ETag: "d41d8cd98f00b204e9800998ecf8427e"

--------------------------------------------------------------------------------
test_get_filename_with_many_dots: Test whether file names with multiple dots return 200 on GET
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/xml`
[PASSED]

> GET http://cs531-cs_cbrad022/a1-test/1/1.2/arXiv.org.Idenitfy.repsonse.xml HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: text/xml
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 3142
< ETag: "60757ce40ecb43052efe0f5a329a3d0d"
< 
* [Payload redacted (3142 bytes)]

--------------------------------------------------------------------------------
test_get_magic_cookie_of_a_binary_file: Test whether a GIF file contains identifying magic cookie
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* Payload begins with `GIF89a`
[PASSED]

> GET http://cs531-cs_cbrad022/a1-test/2/6.gif HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:42 GMT
< Server: calebsserver
< Content-Type: image/gif
< Last-Modified: Sat, 20 Oct 2018 02:33:21 GMT
< Content-Length: 49803
< ETag: "f15d0e729fffe52ad0afc2320484c553"
< 
* [Payload redacted (49803 bytes)]

--------------------------------------------------------------------------------
test_access_log_as_virtual_uri: Test whether the access log is available as a Virtual URI in the Common Log Format
* Connecting to the `cs531-cs_cbrad022:80` server
* Request data sent
* Response data read
* Response parsed
* Status is `200`
* `Content-Type` header is present
* `Content-Type` header begins with `text/plain`
* Payload is not empty
* Selected log entry `172.18.0.2 - - [05/Dec/2022:19:37:42 +0000] "GET http://cs531-cs_cbrad022/a1-test/1/1.4/escape%25this.html HTTP/1.1" 200 67`
* `172.18.0.2` is a valid IP address
* `172.18.0.2` is potentially the IP address of a client
* `05/Dec/2022:19:37:42 +0000` is formatted correctly
* `200` is a valid status code
* `67` is a valid size
[PASSED]

> GET /.well-known/access.log HTTP/1.1
> Host: cs531-cs_cbrad022
> Connection: close
> 

< HTTP/1.1 200 OK
< Date: Mon, 05 Dec 2022 07:37:43 GMT
< Server: calebsserver
< Content-Type: text/plain
< Last-Modified: Mon, 05 Dec 2022 07:37:43 GMT
< Content-Length: 1766
< ETag: "264b3e793ef8a9051ed657ea5327c43e"
< 
* [Payload redacted (1768 bytes)]

=================================== SUMMARY ====================================
Server: cs531-cs_cbrad022:80
Test Case Results:
PASSED: test_url_get_ok
PASSED: test_url_head_ok
PASSED: test_path_head_ok
PASSED: test_path_options_ok
PASSED: test_get_missing
PASSED: test_get_duplicate_path_prefix
PASSED: test_unsupported_version
PASSED: test_invalid_request
PASSED: test_missing_host_header
PASSED: test_post_not_implemented
PASSED: test_trace_echoback
PASSED: test_get_escaped_file_name
PASSED: test_get_escape_escaping_character
PASSED: test_get_jpeg_image
PASSED: test_get_case_sensitive_file_extension
PASSED: test_get_empty_text_file
PASSED: test_get_empty_unknown_file_directory
PASSED: test_get_filename_with_many_dots
PASSED: test_get_magic_cookie_of_a_binary_file
PASSED: test_access_log_as_virtual_uri
--------------------------------------------------------------------------------
TOTAL: 20, PASSED: 20, FAILED: 0
===============================================================================

Destroying server: cs531-cs_cbrad022
Server `cs531-cs_cbrad022` destroyed successfully.