has_valid_method.c 420 Bytes
#include <string.h>

#include "http/request.h"

char * http_method[N_HTTP_METHOD] = {
	"OPTIONS",
	"GET",
	"HEAD",
	"POST",
	"PUT",
	"DELETE",
	"TRACE",
	"CONNECT"};

int
httpRequestHasValidMethod(HttpRequest this)
{
	int i;

	if (NULL == this->method)
		return 0;

	for (i=0; i<N_HTTP_METHOD; i++) {
		if (0 == strcmp(http_method[i], this->method))
			break;
	}

	return (i != N_HTTP_METHOD);
}

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