Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
doringeman opened this issue May 12, 2020 · 3 comments

Comments

@doringeman
Copy link

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
}
@razvancrainea
Copy link
Contributor

According to our specifications, we don't enforce the server to only serve the static and dynamic directories, we just specify how to handle them.
Regarding the other directories, since there is nothing specified, you can treat them as you wish.
The two tests you mention are just there to verify that if we trigger a request for a file that does not exist, the server will return a 404 not found.
I find however the request you opened valid - we should indeed define how the server should handle other directories - I will keep this issue open until we make a decision regarding this.

@edi33416
Copy link
Contributor

@razvancrainea Have you made a decision regarding this?

I'd like to archive this repo and add a note specifying that it was moved to https://github.com/systems-cs-pub-ro/so
to avoid confusion.
Before I do this, I'd like to close all the existing Issues

@razvancrainea
Copy link
Contributor

This is basically a TODO for this year's assignment - I will transfer it in the new repository.

@razvancrainea razvancrainea transferred this issue from systems-cs-pub-ro/so-assignments Mar 17, 2021
@razvancrainea razvancrainea changed the title [5-aws] Create non-static/non-dynamic file for test_bad_path_404 assignments: [5-aws] Create non-static/non-dynamic file for test_bad_path_404 Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants