has_keep_alive.c
560 Bytes
#include <string.h>
#include <ctype.h>
#include "http/message.h"
#include "http/request.h"
#include "http/header.h"
char
httpRequestHasKeepAlive(HttpRequest request)
{
HttpMessage message = (HttpMessage)request;
char * header;
char * header_ptr;
header = httpHeaderGet(&(message->header), "connection");
if (NULL == header) {
return 0;
}
for (header_ptr = header; 0 != *header_ptr; header_ptr++) {
*header_ptr = tolower(*header_ptr);
}
if (0 == strcmp(header, "keep-alive")) {
return 1;
}
return 0;
}
// vim: set ts=4 sw=4: