header_size_get.c 575 Bytes
#include <search.h>
#include <string.h>
#include <sys/types.h>

#include "http/message.h"
#include "http/response.h"
#include "http/header.h"
#include "interface/http_intro.h"

static size_t size;

static
inline
void
addHeaderSize(const void * node, const VISIT which, const int depth)
{
	if (endorder == which || leaf == which) {
		size += httpHeaderSizeGet(*(HttpHeader *)node) + 2;
	}
}

size_t
httpMessageHeaderSizeGet(HttpMessage message)
{
	size = httpIntroSizeGet(message);

	twalk(message->header, addHeaderSize);
	size += 2;

	return size;
}

// vim: set ts=4 sw=4: