Hi team,
1) getting the parameters
I worked on the get_param function this week and i commited it on CVS.
there are 3 functions : get_params, get_couple_from_params and check_couples.
They all are in main.c, would it be useful to have it elsewhere ?
- get_params : get the characters placed after "?" in the URL
(?var1=val1&var2=val2)
- get_couple_from_params : extract the couples from the params
- check_couple : check the couples syntax.
Questions :
- How many params do we have to take care of ? (in my code, max_params=5).
Note : I have a bug if the numbers of params in the URL is higher than
max_params, nothing happens.
- To store the couples, i use a char *couple[max_params], would it be better
with a char **couple ?
- In check_couple : there is a list of allowed characters. It is to be
completed. I still have troubles with characters like : "%2F".
I think that's all for now, please note that this code is a first try to take
care of the parameters stored in the URL. It _needs_ some optimisation and
verification (especially for the malloc).
Give me your opinion/corrections...
2) The POST method
I read that when a Post method is sent by a client, the request looks like :
[HEADER
containing a Content-length]
CRLF
[BODY
containing the params
i.e : var1=val1&var2=val2]
My problem is that i cannot mange to get the whole request from the client. So
i cannot get the parameters sent by the POST method. Any clue ?
Regards,
Florent
|