Work on responses
This commit is contained in:
parent
8912994e1d
commit
a3a48a841e
3 changed files with 18 additions and 2 deletions
|
@ -36,3 +36,18 @@ void responseSetBody(Response *rsp, char *string, bool updateContentLength){
|
|||
contentLengthHeader->value = strdup(value);
|
||||
}
|
||||
}
|
||||
|
||||
void responseAddHeader(Response *rsp, char header[]){
|
||||
if ( rsp->headers == NULL ){
|
||||
rsp->headers = malloc(sizeof( HeaderList ));
|
||||
rsp->headers->header = newHeader( header );
|
||||
rsp->headers->next = NULL;
|
||||
} else
|
||||
addHeader( rsp->headers, header );
|
||||
|
||||
}
|
||||
|
||||
Response* newResponseFromSocket(int socket){
|
||||
Response *rsp = newResponse();
|
||||
return rsp;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ typedef struct {
|
|||
Response* newResponse();
|
||||
char *responseToString(Response *rsp);
|
||||
void responseSetBody(Response *rsp, char *string, bool updateContentLength);
|
||||
//void* responseAddHeader(Response *req, char line[]);
|
||||
void responseAddHeader(Response *rsp, char header[]);
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue