]> git.evergreen-ils.org Git - OpenSRF.git/blob - src/gateway/apachetools.h
LP1999823: Bump libtool library version
[OpenSRF.git] / src / gateway / apachetools.h
1 #ifndef APACHE_TOOLS_H
2 #define APACHE_TOOLS_H
3
4 #include "httpd.h"
5 #include "http_config.h"
6 #include "http_core.h"
7 #include "http_protocol.h"
8 //#include "apr_compat.h"
9 #include "apr_strings.h"
10 #include "apr_reslist.h"
11 #include "http_log.h"
12
13
14 #include "opensrf/string_array.h"
15 #include "opensrf/utils.h"
16 #include "opensrf/log.h"
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 #define APACHE_TOOLS_MAX_POST_SIZE 10485760 /* 10 MB */
23 #define OSRF_HTTP_ALL_HEADERS "X-OpenSRF-to,X-OpenSRF-xid,X-OpenSRF-from,X-OpenSRF-thread,X-OpenSRF-timeout,X-OpenSRF-service,X-OpenSRF-multipart"
24
25
26 /* parses apache URL params (GET and POST).  
27         Returns a osrfStringArray of the form [ key, val, key, val, ...]
28         Returns NULL if there are no params */
29 osrfStringArray* apacheParseParms(request_rec* r);
30
31 /* provide the params string array, and this will generate a 
32         string of array of param keys 
33         the returned osrfStringArray most be freed by the caller
34         */
35 osrfStringArray* apacheGetParamKeys(osrfStringArray* params);
36
37 /* provide the params string array and a key name, and 
38         this will provide the value found for that key 
39         the returned osrfStringArray most be freed by the caller
40         */
41 osrfStringArray* apacheGetParamValues(osrfStringArray* params, char* key);
42
43 /* returns the first value found for the given param.  
44         char* must be freed by the caller */
45 char* apacheGetFirstParamValue(osrfStringArray* params, char* key);
46
47 /* Writes msg to stderr, flushes stderr, and returns 0 */
48 int apacheDebug( char* msg, ... );
49
50 /* Writes to stderr, flushe stderr, and returns HTTP_INTERNAL_SERVER_ERROR; 
51  */
52 int apacheError( char* msg, ... );
53
54 /* Set headers for Cross Origin Resource Sharing requests
55    as per W3 standard http://www.w3.org/TR/cors/ */
56 int crossOriginHeaders(request_rec* r, osrfStringArray* allowedOrigins);
57
58 /*
59  * Creates an apache table* of cookie name / value pairs 
60  */
61 /*
62 apr_table_t* apacheParseCookies(request_rec *r);
63 */
64
65 #ifdef __cplusplus
66 }
67 #endif
68
69 #endif