has_keep_alive.c 515 Bytes
#include <string.h>
#include <ctype.h>

#include "http/message.h"
#include "http/request.h"
#include "http/header.h"


char
httpMessageHasKeepAlive(HttpMessage message)
{
	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: