source: trunk/gsdl/src/recpt/cgiutils.h@ 12513

Last change on this file since 12513 was 12513, checked in by kjdon, 18 years ago

Added Stefan's fileupload code to replace use of cgicc by depositor. parsing post data, generating fileupload structures and saving the file

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/**********************************************************************
2 *
3 * cgiutils.h -- general cgi utilities
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *********************************************************************/
25
26
27#ifndef CGIUTILS_H
28#define CGIUTILS_H
29
30#include "gsdlconf.h"
31#include "text_t.h"
32#include "cgiargs.h"
33
34// parse data obtained through a CGI POST request
35text_t parse_post_data (text_t &content_type, text_t &raw_post_data,
36 fileupload_tmap &fileuploads, const text_t &gsdlhome);
37
38// convert %xx and + to their appropriate equivalents
39void decode_cgi_arg (text_t &argstr);
40
41// split up the cgi arguments
42void split_cgi_args (const cgiargsinfoclass &argsinfo, text_t argstr,
43 cgiargsclass &args);
44
45text_t encode_commas (const text_t &intext);
46text_t decode_commas (const text_t &intext);
47
48// turns any '-' in a cgi argument into "(-)"
49text_t minus_safe (const text_t &intext);
50
51// returns the encoded version of a cgi argument
52text_t cgi_safe (const text_t &intext);
53
54// check_save_conf_str checks the configuration string for
55// the saved args and makes sure it does not conflict with
56// the information about the arguments. If an error is encountered
57// it will return false and the program should not produce any
58// output.
59bool check_save_conf_str (const text_t &saveconf,
60 const cgiargsinfoclass &argsinfo,
61 ostream &logout);
62
63// create_save_conf_str will create a configuration string
64// based on the information in argsinfo. This method of configuration
65// is not recomended as small changes can produce large changes in
66// the resulting configuration string (for instance a totally different
67// ordering). Only arguments which "must" be saved are included in
68// the resulting string.
69text_t create_save_conf_str (const cgiargsinfoclass &argsinfo,
70 ostream &logout);
71
72// expand_compress_args will expand the compressed arguments based
73// on compressconf placing the results in args if they are not
74// already defined. If it encounters an error it will return false
75// and output more information to logout.
76bool expand_save_args (const cgiargsinfoclass &argsinfo,
77 const text_t &saveconf,
78 cgiargsclass &args,
79 ostream &logout);
80
81// adds the default values for those arguments which have not
82// been specified
83void add_default_args (const cgiargsinfoclass &argsinfo,
84 cgiargsclass &args,
85 ostream &logout);
86
87void add_fileupload_args (const cgiargsinfoclass &argsinfo,
88 cgiargsclass &args,
89 fileupload_tmap &fileuploads,
90 ostream &logout);
91
92// compress_save_args will compress the arguments and return
93// them in compressed_args. If an error was encountered
94// compressed_args will be set to to "", an error will be
95// written to logout, and the function will return false.
96bool compress_save_args (const cgiargsinfoclass &argsinfo,
97 const text_t &saveconf,
98 cgiargsclass &args,
99 text_t &compressed_args,
100 outconvertclass &outconvert,
101 ostream &logout);
102
103// args_tounicode converts any arguments which are not in unicode
104// to unicode using inconvert
105void args_tounicode (cgiargsclass &args, inconvertclass &inconvert);
106
107text_t gsdl_getenv (const text_t &name, text_tmap &fcgienv);
108
109#endif
Note: See TracBrowser for help on using the repository browser.