-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathquestions
56 lines (56 loc) · 3.52 KB
/
questions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
1. It is mentioned that we should send Content-Type: text/html
but if the request for directory indexing, does that mean
we should allow hyper links ? ANS: Not needed
2. Server A string identifying this server and version. -> SWS ??
3. Last-Modified The timestamp in GMT of the file’s last modification date
What should be returned for a directory ? -- ANS: last modification date of dir
What should be returned for a invalid file that doesn't exist? -- don't send
4. Do we need to support <1.0 and >1.0 ??
ANS : Support lesser versions, reject higher
What is the expected output for such cases, what will be the status code?
5. What is the status code to be returned if the request has a method that
we don't support? Eg: POST?? Bad Request maybe ? ANS : 405 Method not available
6. What should be the output for GET '/../../../../../../../../../etc/passwd' HTTP/1.0
and GET '/dir/file/../../dir/file' HTTP/1.0 -> ANS: dont allow anything apart from cwd use
realpath
7. What all request headers are we supposed to get as input / we should handle?
8. If-Modified-Since Request-Header is this the only header we support for request?
9. Keep-Alive: will we support this ?
10. INADDR_ANY PF_UNSPEC
11. Learn telnet
12. Send bad request for protocol greater than 1.0
13. Handle invalid request headers and send a response saying invalid request 400
14. Use magic for content-type
15. openssl s_client -connect www.stevens.edu:443 TODO:
16. What happens when the client is requesting type that is not available ?
Read RFC for Accept-Encoding ?
17. We only support one request header bruh
18. We can see all env vars using $env
19. If the request is not CGI, strip out the request params after ? char
20. Read http.cat website
21. symlinks shouldn't escape the work dir of the server
22. compared to the m_time of the if modified since date if the the date is
greater then don't send , else send the data 304 Not Modified -- TODO: lookup this
23. TODO: validate which function to call based on the requested resource bruh
CGI or USER DIR or DIR INDEXING or whatever
24. strtok TODO:
25. TODO: in the URI after the request method, see if they have the hostname and shit bruh
if the string starts with / then just do realpath if not then see if they are passing the
hostname or something and get the required path and use it in the real path bruh
26. mktime for creating a time, write regex for other two types of time as well
27. alarm SIGNAL HANDLER BABY -- for timeout
28. For timeout try to check the RFC page for what to do
29. timeout for connection bruh -- if there is no data output then use timeout
30. Withing given time I should get all the request and listen no more -- also for see the size & if
the size is large then stop
31. Instead of BUFSIZ use something based on the real life headers and construct it.
32. read about dualstack program from week 09 for IPV4 & IPV6 TLDR: add a flag which will disable IPV6ONLY
33. reasonable BACKLOG TODO: OPEN_MAX / 2 using uname
34. do more reading for select and understand how it is handling the simultaneous connections using file_des
35. read about pre-forking server, basically fork() before the listen call happens
36. if -d is not specified donot output anything bruh, just handle the err gracefully and if -d is mentioned
do something like fprintf(stderr, "") or perror()
37. if the critical resources are not available then maybe the base server dies
38. donot daemonize for args parsing, logging file open, create a socket listen on a port
39. ~ -> /home/vish/sws/
-- ~/ls.c