1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * cgiutils.h -- general cgi utilities
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * PUT COPYRIGHT NOTICE HERE
|
---|
7 | *
|
---|
8 | * $Id: cgiutils.h 154 1999-02-08 01:28:01Z rjmcnab $
|
---|
9 | *
|
---|
10 | *********************************************************************/
|
---|
11 |
|
---|
12 |
|
---|
13 | #ifndef CGIUTILS_H
|
---|
14 | #define CGIUTILS_H
|
---|
15 |
|
---|
16 | #include "gsdlconf.h"
|
---|
17 | #include "text_t.h"
|
---|
18 | #include "cgiargs.h"
|
---|
19 |
|
---|
20 |
|
---|
21 | // convert %xx and + to their appropriate equivalents
|
---|
22 | void decode_cgi_arg (text_t &argstr);
|
---|
23 |
|
---|
24 | // split up the cgi arguments
|
---|
25 | void split_cgi_args (text_t argstr, cgiargsclass &args);
|
---|
26 |
|
---|
27 | // returns the encoded version of a cgi argument
|
---|
28 | text_t cgi_safe (const text_t &intext);
|
---|
29 |
|
---|
30 | // check_save_conf_str checks the configuration string for
|
---|
31 | // the saved args and makes sure it does not conflict with
|
---|
32 | // the information about the arguments. If an error is encountered
|
---|
33 | // it will return false and the program should not produce any
|
---|
34 | // output.
|
---|
35 | bool check_save_conf_str (const text_t &saveconf,
|
---|
36 | const cgiargsinfoclass &argsinfo,
|
---|
37 | ostream &logout);
|
---|
38 |
|
---|
39 | // create_save_conf_str will create a configuration string
|
---|
40 | // based on the information in argsinfo. This method of configuration
|
---|
41 | // is not recomended as small changes can produce large changes in
|
---|
42 | // the resulting configuration string (for instance a totally different
|
---|
43 | // ordering). Only arguments which "must" be saved are included in
|
---|
44 | // the resulting string.
|
---|
45 | text_t create_save_conf_str (const cgiargsinfoclass &argsinfo,
|
---|
46 | ostream &logout);
|
---|
47 |
|
---|
48 | // expand_compress_args will expand the compressed arguments based
|
---|
49 | // on compressconf placing the results in args if they are not
|
---|
50 | // already defined. If it encounters an error it will return false
|
---|
51 | // and output more information to logout.
|
---|
52 | bool expand_save_args (const cgiargsinfoclass &argsinfo,
|
---|
53 | const text_t &saveconf,
|
---|
54 | cgiargsclass &args,
|
---|
55 | ostream &logout);
|
---|
56 |
|
---|
57 | // adds the default values for those arguments which have not
|
---|
58 | // been specified
|
---|
59 | void add_default_args (const cgiargsinfoclass &argsinfo,
|
---|
60 | cgiargsclass &args,
|
---|
61 | ostream &logout);
|
---|
62 |
|
---|
63 | // compress_save_args will compress the arguments and return
|
---|
64 | // them in compressed_args. If an error was encountered
|
---|
65 | // compressed_args will be set to to "", an error will be
|
---|
66 | // written to logout, and the function will return false.
|
---|
67 | bool compress_save_args (const cgiargsinfoclass &argsinfo,
|
---|
68 | const text_t &saveconf,
|
---|
69 | cgiargsclass &args,
|
---|
70 | text_t &compressed_args,
|
---|
71 | ostream &logout);
|
---|
72 |
|
---|
73 | // args_tounicode converts any arguments which are not in unicode
|
---|
74 | // to unicode using inconvert
|
---|
75 | void args_tounicode (cgiargsclass &args, inconvertclass &inconvert);
|
---|
76 |
|
---|
77 | #endif
|
---|