Skip to content

assignments: [5-aws] Create non-static/non-dynamic file for test_bad_path_404 #11

Description

@doringeman

Question

Should not it be forbidden to be able to receive a file from outside the directories static/ and dynamic/?

I presume that test_bad_path_404 should verify this.
However, it tests the same thing as test_get_bad_file_404, namely that 404 should be returned for a non-existent file.

Solution

Create the file xyzt/abcdef.dat before trying to get it.

Expected outcome

Receive 404 Not Found or 403 Forbidden.

The mentioned tests

5-aws/checker-lin/_test/run_test.sh:506

test_get_bad_file_404()
{
	init_test

	echo -ne "GET /$(basename $static_folder)/abcdef.dat HTTP/1.0\r\n\r\n" | \
		nc -q 1 localhost $aws_listen_port > abcdef.dat 2> /dev/null

	head -1 abcdef.dat | grep '^HTTP/' | grep '404' > /dev/null 2>&1
	basic_test test $? -eq 0

	rm abcdef.dat
	cleanup_test
}

# Use non-static and non-dynamic file path
test_bad_path_404()
{
	init_test

	echo -ne "GET /xyzt/abcdef.dat HTTP/1.0\r\n\r\n" | \
		nc -q 1 localhost $aws_listen_port > abcdef.dat 2> /dev/null

	head -1 abcdef.dat | grep '^HTTP/' | grep '404' > /dev/null 2>&1
	basic_test test $? -eq 0

	rm abcdef.dat
	cleanup_test
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions