Open thsmale opened 1 year ago
This is not good. You are returning a pointer to an automatic (scoped) variable, which will be destroyed when the function returns. The pointer will be left pointing at a destroyed variable, which will almost certainly produce "strange" results (undefined behaviour).
You should be allocating the string with malloc (e.g. char *rtnPtr = malloc(length)), then freeing it later in main.
going to add a parameter, request will now accept request and response. this gives user the ability to specify the size of the request they wish to receive
although char *response = request(struct Http options);
than check if response is NULL
is cleaner
update example request in documentation to reflect these changes