#ifndef STRUCTURES_H_
#define STRUCTURES_H_

#include <sys/stat.h>

#ifdef __NetBSD__
#include <sys/syslimits.h>
#endif

#include <stdio.h>
#include <stdlib.h>

#if defined(__sun) && defined(__illumos__)
#include "/opt/magic/include/magic.h"
#ifndef PATH_MAX
#include <limits.h>
#endif
#endif

#ifdef __linux__
#ifndef PATH_MAX
#include <linux/limits.h> /* for PATH_MAX */
#endif
#endif

#define HEAD 0
#define GET 1

#define SERVER_VERSION 1.0
#define SERVER_NAME "sws"

// holds all of the request info
typedef struct HTTP_REQUEST
{
	char protocol[BUFSIZ];
	char request_passedin[BUFSIZ];
	char request_time[BUFSIZ];
	int request_type;
	char path[PATH_MAX];
	char parsed_path[PATH_MAX];
	int status;
	int client_fd;
	size_t response_size;
	time_t if_modified_since_time;
} REQUEST;

typedef struct CGI_INFO
{
	REQUEST* http_request;
	char path[PATH_MAX];
	char parsed_path[PATH_MAX];
	char query_string[BUFSIZ];
	/* most of the existing possible meta-variables, minus non-supported ones */
	char request_method[BUFSIZ];

	char server_port[BUFSIZ];
	char server_protocol[BUFSIZ];
	char server_software[BUFSIZ];

	/* response variables */
	char content_type[BUFSIZ];
	size_t content_length;
} CGI;

#endif