key fields headers in map are in lowercase

+ getters for this map are case insensitive
+ change request fiel 'path' for 'uri', 'query', and 'abs_path'
This commit is contained in:
hugogogo
2022-08-07 13:06:16 +02:00
parent 63ff42b57d
commit e0fd743b5b
7 changed files with 89 additions and 40 deletions

View File

@@ -1,20 +1,36 @@
## questions :
## work together
#### questions
- in client.cpp i fill the port, is there a default one in case it's not in the request ?
- le cgi-script doit renvoyer au moins un header suivit d'une ligne vide
- ce header est soit "Content-Type", soit "Location", soit "Status"
- il peut dans certains cas envoyer d'autres headers
- le serveur doit verifier qu'il n'y a pas de doublons dans les headers
- le serveur doit verifier le formatage des headers (typiquement l'encodage, par exemple pour les newlines)
- ? comment on passe le body-message au script ? section 4.2
-> en ecrivant le body dans le fd temp sur lequel on a branché stdin et stdout avant d'execve le script
- ? on doit gerer l'authentification ?
-> pas pour l'instant on va dire :p
- ? pourquoi on construit un script-cgi ? section 3.3
- ? on doit gerer l'authentification ?
- ? pourquoi on doit construire un script-cgi ? section 3.3
- ? si l'uri correspond au script-cgi, ca appel le script donc ? section 3.3
#### notifications
- i changed the Client getters in two categories :
- getters for requests infos : `get_rq_<info>`
- getters for client sides infos : `get_cl_<info>` (such as ip of client)
- i changed the variables in request struct in Client :
- `path` become `uri` (ex. /path/to/file?var=val)
- add `abs_path` (ex. /path/to/file )
- add `query` (ex. var=val)
- the header fields names, as key in map, are stored in lowercase, and getters are case-insensitives
#### share knowledge
##### cgi
- the cgi-script will send back at least one header field followed by an empty line
- this header field will be one of three :
- "Content-Type"
- "Location"
- "Status"
- the cgi-script may send back more header fields
- the server must check and modify few things :
- there is no duplicate in headers fields (if there is, resolve conflict)
- there is no space between the field name and the ":"
- the newlines are of form "\r\n", and not "\n" only
- if the location field is not present, then if the status field is not present either, then the status code is 200
- the cgi-script can return a location field, of two types :
- local redirection : start with a "/", the server must answer as if this was the request uri
- client redirection : start with <name-of-cheme>":", the server must send back a status 302 with this uri to the client
- to pass the body-message to the cgi-script, we write it into the temporary fd on which the script read it's standard input
---
## man
@@ -141,10 +157,12 @@
- local redirect response :
- it must return only a Location field
- it contains a local path URI and query string ('local-pathquery')
- the local path URI must start with a "/"
- the server must generate the response for this local-pathquery
- client redirect response :
- it must return only a Location field
- it contains an absolute URI path, to indicate the client that it should reprocess the request with this URI
- the absolute URI always start with the name of scheme followed by ":"
- the http server must generate a 302 'Found' message
- client redirect response with document
- it must return a Location field with an absolute URI path