size_get.c 461 Bytes
#include <string.h>
#include <sys/types.h>

#include "http/response.h"
#include "http/header.h"

size_t
httpResponseSizeGet(HttpResponse response)
{
	int    i;
	size_t size = 0;

	size += strlen(response->version) + 1;
	size += 4; // for status
	size += strlen(response->reason) + 2;

	for (i=0; i<response->nheader; i++) {
		size += httpHeaderSizeGet(response->header[i]) + 2;
	}

	size += 2;
	size += response->nbody;

	return size;
}

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