/*****
* HTTPP.h : Private HTTP.c header file.
*
* This file Version	$Revision: 1.1 $
*
* Creation date:		Tue Oct 21 01:57:37 GMT+0100 1997
* Last modification: 	$Date: 1997/10/23 00:28:29 $
* By:					$Author: newt $
* Current State:		$State: Exp $
*
* Author:				Richard Offer
*
* Copyright (C) 1994-1997 by Richard Offer <offer@sgi.com>
* All Rights Reserved
*
* This file is part of insert_program_name_here
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****/
/*****
* $Source: /usr/local/rcs/Newt/XmHTML/RCS/HTTPP.h,v $
*****/
/*****
* ChangeLog 
* $Log: HTTPP.h,v $
* Revision 1.1  1997/10/23 00:28:29  newt
* Initial Revision
*
*****/ 

#ifndef _HTTPP_h_
#define _HTTPP_h_

#include "HTTP.h"

#define HTTP_VERSION_09 900
#define HTTP_VERSION_10 1000
#define HTTP_VERSION_11 1100

#define GETMETHOD "GET "
#define POSTMETHOD "POST "
#define HTTPVERSION " HTTP/1.0\r\n"
#define NEWLINE "\r\n"
#define CONTENT_LEN "Content-Length: "
#define CONTENT_TYPE "Content-Type: text/plain"

/* this is the strlen of the Content-length of the form data 
 * 10 => forms with up to 100000000 bytes 
 * of data */
#define MAX_FORM_LEN 10

#define CHUNKSIZE 65536			/* make read requests in this size increments */

/* HTTP server response definition */
typedef struct _HTTPResponse {
	unsigned char *data;			/* message */
	int http_version;				/* server version */
	HTTPRequestReturn status_code;	/* request succeeded? */
	HTTPNamedValues *headers;		/* array of returned headers */
	int num_headers;				/* no of headers */
} HTTPResponse;


/* Function Prototypes */

/* delete a no longer required response */
static void deleteResponse(HTTPResponse * res);

/* create a new response */
static HTTPResponse *newResponse(char *buf);

/*****
* hexify src and append to dest. Return value points to the next available
* position in dest.
*****/
static char *appendHex(char *dest, char *src);

/* convert all name-value pairs to a valid QUERY_STRING format */
static char *encodeFormData(HTTPNamedValues * formdata);

/* decode an hexified response from a HTTP server */
static unsigned char *unencodeResponse(char *buf, size_t len);

/* Don't add anything after this endif! */
#endif /* _HTTPP_h_ */
