[2286] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
| 3 | * wincgiutils.h
|
---|
| 4 | * Copyright (C) 1996
|
---|
| 5 | *
|
---|
| 6 | * A component of the fnord webserver written by [email protected].
|
---|
| 7 | *
|
---|
| 8 | * Altered for use with the Greenstone digital library software by the
|
---|
| 9 | * New Zealand Digital Library Project at the University of Waikato,
|
---|
| 10 | * New Zealand.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or modify
|
---|
| 13 | * it under the terms of the GNU General Public License as published by
|
---|
| 14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 15 | * (at your option) any later version.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful,
|
---|
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 20 | * GNU General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, write to the Free Software
|
---|
| 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 25 | *
|
---|
| 26 | *********************************************************************/
|
---|
| 27 |
|
---|
[611] | 28 | #define http_ok 0
|
---|
| 29 | #define http_error_url_invalid 11
|
---|
| 30 |
|
---|
[2286] | 31 | int parse_url(const text_t &url, text_t &protocol, text_t &machine,
|
---|
| 32 | int *port, text_t &name);
|
---|
[611] | 33 |
|
---|
| 34 | struct param_vals {char *name, *value; int vsize; char *dfault; };
|
---|
| 35 |
|
---|
| 36 |
|
---|
| 37 | int Send_String(char *str, RequestInfoT *RInfo);
|
---|
| 38 | int Send_String_N(char *str, int n, RequestInfoT *RInfo);
|
---|
| 39 | void send_retrieve_error(int error_num, char *msg1, char *msg2, RequestInfoT *RequestInfo);
|
---|
| 40 | int send_header(char *content, RequestInfoT *RequestInfo);
|
---|
| 41 | void decode(char *st);
|
---|
| 42 | void decode_template(int ntemp, param_vals tmplate[]);
|
---|
| 43 | void parse_query_string(char *qstring, int ntemp, param_vals tmplate[]);
|
---|
| 44 | int mg_sender(char *UDoc, int ULen, int DocNum, float Weight, void *RInfo);
|
---|
| 45 |
|
---|
| 46 | #define OUT_CONST_A(t) \
|
---|
| 47 | {if (Send_String_N(t, sizeof(t), RInfo) < 0) return;}
|
---|
| 48 |
|
---|
| 49 | #define OUT_CONST_B(t) \
|
---|
| 50 | {if (Send_String_N(t, sizeof(t), (RequestInfoT *)RInfo) < 0) return -1;}
|
---|
| 51 |
|
---|
| 52 | #define OUT_STRING_A(t) \
|
---|
| 53 | {if (Send_String(t, RInfo) < 0) return;}
|
---|
| 54 |
|
---|
| 55 | #define OUT_STRING_B(t) \
|
---|
| 56 | {if (Send_String(t, (RequestInfoT *)RInfo) < 0) return -1;}
|
---|
| 57 |
|
---|
| 58 | #define OUT_STRING_N_A(t,n) \
|
---|
| 59 | {if (Send_String_N(t, n, RInfo) < 0) return;}
|
---|
| 60 |
|
---|
| 61 | #define OUT_STRING_N_B(t,n) \
|
---|
| 62 | {if (Send_String_N(t, n, (RequestInfoT *)RInfo) < 0) return -1;}
|
---|