42 #include "http_config.h"
43 #include "http_core.h"
45 #include "http_protocol.h"
46 #include "http_request.h"
47 #include "http_main.h"
48 #include "util_script.h"
54 char *
ltoa(
long val,
char *buf,
int base)
57 if (base > 36 || base < 2)
64 r = ldiv (labs(val), base);
67 buf =
ltoa ( r.quot, buf, base);
71 *buf++ =
"0123456789abcdefghijklmnopqrstuvwxyz"[(int)r.rem];
77 static int util_read(request_rec *r,
const char **rbuf)
81 if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)))
86 if (ap_should_client_block(r))
88 char argsbuffer[HUGE_STRING_LEN];
89 int rsize, len_read, rpos=0;
90 long length = r->remaining;
91 *rbuf = (
char*) ap_pcalloc(r->pool, length + 1);
93 ap_hard_timeout(
"util_read", r);
95 while((len_read = ap_get_client_block(r, argsbuffer,
sizeof(argsbuffer))) > 0)
98 if ((rpos + len_read) > length)
100 rsize = length - rpos;
106 memcpy((
char*)*rbuf + rpos, argsbuffer, rsize);
116 header_trace(
void *data,
const char *key,
const char *val )
118 request_rec *r = (request_rec *)data ;
119 cerr <<
"Header Field '" << key <<
"' = '" << val <<
"'" << endl ;
124 list_headers( request_rec *r )
126 ap_table_do( header_trace, r, r->headers_in, NULL ) ;
129 static int opendap_handler(request_rec *r)
131 char port_number_buffer[80];
132 dup2(r->connection->client->fd,STDOUT_FILENO);
149 ltoa(ap_get_server_port(r), port_number_buffer, 10);
153 rq.
user_agent = ap_table_get(r->headers_in,
"User-Agent");
155 const char* m_method = r->method;
158 cerr <<
"mod_opendap: Fatal, Cannot load request method" << endl;
163 if ( strcmp(m_method,
"GET") == 0 )
165 if(r->parsed_uri.query)
178 else if (strcmp(m_method,
"POST") == 0 )
180 const char *post_data=0;
181 util_read(r, &post_data);
200 rq.
cookie = ap_table_get( r->headers_in,
"Cookie" ) ;
205 while( rq.
request && status == 0 )
222 static handler_rec opendap_handlers[] =
224 {
"opendap-handler", opendap_handler},
231 STANDARD_MODULE_STUFF,
const char * user_address
remote ip address of client machine
module MODULE_VAR_EXPORT opendap_module
const char * server_port
TCP port number where the server running Apache is listening.
const char * process_token(const char *s)
Find the session token from the URL and convert it to readable format.
const char * script_name
uri of the request
const char * process_user(const char *s)
Find the username from the URL and convert it to readable format.
int call_BES(const BESDataRequestInterface &re)
Execute the given request using BESApacheInterface interface.
const char * server_name
name of server running Apache server
Structure storing information from the Apache module.
const char * get_next_request()
void process_request(const char *s)
Find the request from the URL and convert it to readable format.
const char * server_address
not used
const char * request
BES request string.
const char * token
session token passed in URL
char * ltoa(long val, char *buf, int base)
const char * cookie
server cookies set in users browser
const char * get_first_request()
const char * user_agent
information about the user agent originating the request, e.g.
const char * server_protocol
protocol of the request, such as "HTTP/0.9" or "HTTP/1.1"