52 #define DEFAULT_ADMINISTRATOR "cedar_db@hao.ucar.edu"
53 #define INCORRECT_REQUEST (BES_NOT_FOUND_ERROR + 1)
54 #define INCORRECT_REQUEST_MSG "undefined request"
89 int status = BESCmdInterface::execute_request(
"cedar" ) ;
109 string s_cookie = cookie ;
110 string var =
"OpenDAP.remoteuser=" ;
111 int user_var = s_cookie.find( var ) ;
114 string s_user_var = s_cookie.substr( user_var + var.length(),
115 s_cookie.length() ) ;
116 int semi = s_user_var.find(
";" ) ;
123 user = s_user_var.substr( 0, semi ) ;
153 std::string::size_type http = https.find(
"HTTP");
154 if( http == string::npos )
160 _dhi.transmit_protocol =
"HTTP" ;
166 string user =
"undef" ;
192 BESDEBUG(
"apache",
"BESApacheInterface dhi = " << _dhi << endl )
194 BESCmdInterface::initialize() ;
272 bool ishttp = false ;
273 if( _dhi.transmit_protocol ==
"HTTP" )
288 return BESCmdInterface::exception_manager( e ) ;
292 return BESCmdInterface::exception_manager( e ) ;
296 BESApacheInterface::welcome_browser()
301 (*
BESLog::TheLog()) <<
"Incoming request from " << who.c_str() <<
" using " << agent.c_str() << endl;
304 int mo=agent.find(
"Mozilla");
305 int ho=agent.find(
"HotJava");
310 string administrator =
312 if(administrator==
"")
313 cout <<
"BES: internal server error please contact"
315 <<
"with the following message:\n" ;
317 cout <<
"BES: internal server error please contact"
318 << administrator.c_str()
319 <<
"with the following message:\n" ;
320 cout <<
"BES: cannot interact with browser" << agent.c_str() << endl ;
327 if( (method!=
"GET") && (method!=
"POST") )
331 string administrator =
333 if(administrator==
"")
334 cout <<
"BES: internal server error please contact"
335 << DEFAULT_ADMINISTRATOR
336 <<
"with the following message:\n" ;
338 cout <<
"BES: internal server error please contact"
339 << administrator.c_str()
340 <<
"with the following message:\n" ;
341 cout <<
"BES: fatal, cannot get/understand the key BES.DefaultResponseMethod"
346 cout <<
"HTTP/1.0 200 OK\n" ;
347 cout <<
"Content-type: text/html\n\n" ;
352 cout <<
"<TITLE> Request to the BES server</TITLE>\n" ;
355 cout <<
"<form action=\"http://" << _dri->
server_name
357 <<
"\" method=get>\n" ;
358 else if (method==
"POST")
359 cout <<
"<form action=\"http://" << _dri->
server_name
361 <<
"\" method=post>\n" ;
363 cout <<
"<p>Request: <br><textarea name=\"request\" cols=85 rows=11 size=40,4 wrap=\"virtual\" ></textarea></p>\n" ;
364 cout <<
"<input type=\"submit\" value=\"Submit to BES\">\n" ;
365 cout <<
"<input type=\"reset\" value=\"Clean Text Field\">\n" ;
366 cout <<
"</form>\n" ;
367 cout <<
"</body>\n" ;
368 cout <<
"</html>\n" ;
const char * user_address
remote ip address of client machine
#define DEFAULT_ADMINISTRATOR
exception thrown if inernal error encountered
#define BES_INTERNAL_ERROR
virtual int execute_request()
Override execute_request in order to register memory pool.
#define INCORRECT_REQUEST
virtual void set_error_type(int type)
Set the return code for this particular error class.
const char * server_port
TCP port number where the server running Apache is listening.
void find_user_from_cookie(const char *cookie, string &user)
Find and set the user from the cookie set in the browser.
static BESMemoryGlobalArea * initialize_memory_pool()
const char * script_name
uri of the request
#define INCORRECT_REQUEST_MSG
virtual int get_error_type()
Return the return code for this error class.
virtual string get_message()
get the error message for this exception
const char * server_name
name of server running Apache server
Structure storing information from the Apache module.
Abstract exception class for the BES with basic string message.
const char * server_address
not used
static void set_mime_text(ostream &strm)
Generate an HTTP 1.0 response header for a text document.
const char * request
BES request string.
virtual void initialize()
Initialize the BES object from the apache environment.
#define BES_INTERNAL_FATAL_ERROR
virtual ~BESApacheInterface()
const char * token
session token passed in URL
const char * cookie
server cookies set in users browser
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
virtual int exception_manager(BESError &e)
Handle any exceptions generated from the request.
static void register_global_pool()
const char * user_agent
information about the user agent originating the request, e.g.
static BESKeys * TheKeys()
static bool unregister_global_pool()
BESApacheInterface(const BESDataRequestInterface &dri)
Instantiate a BESApacheInterface object.
const char * server_protocol
protocol of the request, such as "HTTP/0.9" or "HTTP/1.1"
virtual void validate_data_request()
Validate the information in the BESDataRequestInterface.