Ejemplo n.º 1
0
/* The sample content handler */
static int apm_test_handler(request_rec *r)
{
    if (strcmp(r->handler, "apm_test")) {
        return DECLINED;
    }
    r->content_type = "text/html";      

    if (!r->header_only){

      apm_test_cfg *conf = 
	(apm_test_cfg *)
	ap_get_module_config(r->per_dir_config, &apm_test_module);
      apm_test_server_cfg *sv_conf =
	(apm_test_server_cfg *)
	ap_get_module_config(r->server->module_config, &apm_test_module);

      if(conf->is_val_a_set){
        ap_rputs("mod_apm_test val a is set\n", r);
      }else{
        ap_rputs("mod_apm_test val a is not set\n", r);
      }

      ap_rprintf(r, "## server parameter %ld\n", sv_conf->server_param);
    }
    return OK;
}
Ejemplo n.º 2
0
static int helloworld_handler(request_rec* r) {
    if ( !r->handler || strcmp(r->handler, "helloworld") ) {
        return DECLINED ;   /* none of our business */
        }
    if ( r->method_number != M_GET ) {
        return HTTP_METHOD_NOT_ALLOWED ;  /* Reject other methods */
        }
    ap_set_content_type(r, "text/html;charset=ascii") ;
    ap_rputs(
        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n", r) ;
    ap_rputs(
        "<html><head><title>Apache HelloWorld Module</title></head>", r) ;
    ap_rputs("<body><h1>Hello World!</h1>", r) ;
    ap_rputs("<p>This is the Apache HelloWorld module!</p>", r) ;

    /* Print the headers and env */
    /* Note that the response headers and environment may be empty at
     * this point.  The CGI environment is an overhead we dispense
     * with in a module, unless another module that requires it
     * (e.g. mod_rewrite) has set it up.
     */
    printtable(r, r->headers_in, "Request Headers", "Header", "Value") ;
    printtable(r, r->headers_out, "Response Headers", "Header", "Value") ;
    printtable(r, r->subprocess_env, "Environment", "Variable", "Value") ;

    ap_rputs("</body></html>", r) ;
    return OK ;
    }
Ejemplo n.º 3
0
/* This does some initial checking, like if we're running on a SSL line or not */
static int checkInitial(request_rec *r) 
{
  return OK;
  yubiauth_dir_cfg *cfg = ap_get_module_config(r->per_dir_config, &authn_yubikey_module);
  ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_DEBUG, 0, r,
                LOG_PREFIX "requireSecure: %d", cfg->requireSecure);
  /* If no securiy is wanted or scheme is already https */
    if (!cfg->requireSecure || !strncmp(ap_http_scheme(r), "https", 5)) {
      return OK;
    }
    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
		  LOG_PREFIX "The server is configured to use HTTPS on URI: %s", r->uri);
    if(cfg->externalErrorPage == TRUE){
      /* We explicitly want that to be overridable */
      //return HTTP_BAD_REQUEST;
      return HTTP_NOT_ACCEPTABLE;
    } 
      
    /* Tell the user/admin what's going on instead of just showing BAD_REQUEST */
    ap_rputs(DOCTYPE_HTML_4_0T, r);
    ap_set_content_type(r, "text/html;");
    ap_rputs(ERROR_TEXT, r);
    ap_finalize_request_protocol(r);
    return HTTP_BAD_REQUEST;
}
Ejemplo n.º 4
0
static void zipread_showheader(request_rec * r, char *fn)
{
    ap_rputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\n\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html>\n<head>\n",r);
    ap_rprintf(r,"<title>Index of %s</title>\n", fn);
    ap_rputs("</head>\n<body bgcolor=\"#ffffff\" text=\"#000000\">\n\n<table><tr><td bgcolor=\"#ffffff\" class=\"title\">\n<font size=\"+3\" face=\"Helvetica,Arial,sans-serif\">\n",r);
    ap_rprintf(r,"<b>Index of %s</b></font>\n", fn);
    ap_rputs("</td></tr></table><pre>",r);
}
Ejemplo n.º 5
0
static void jsonEndDocument( struct tabix_callback_t* handler)
	{
	ap_rputs("}\n",handler->r);
	if(handler->jsonp_callback!=NULL)
		{
		ap_rputs(");\n",handler->r);
		}
	}
Ejemplo n.º 6
0
static void write_headers(request_rec *r, const char **names)
{
	ap_rputs("<tr>", r);
	const char **n;
	for (n = names; *n; n++) {
		ap_rprintf(r, "<th>%s</th>", *n);
	}
	ap_rputs("<tr/>\n", r);
}
Ejemplo n.º 7
0
static int xmlPrintBody(struct tabix_callback_t* handler,const kstring_t *line)
	{
	int i,prev=0,n_field=0;
	ap_rputs("<tr>",handler->r);
	for(i=0;i<= line->l;++i)
		{
		if(line->s[i]=='\t' || i==line->l)
			{
			ap_rputs("<td",handler->r);
			if(n_field==0 && (handler->file_format==E_FORMAT_VCF || handler->file_format==E_FORMAT_BED))
				{
				ap_rputs(" type=\"chrom\"",handler->r);
				}
			else if(n_field==1 && handler->file_format==E_FORMAT_VCF)
				{
				ap_rputs(" type=\"pos\"",handler->r);
				}
			else if(n_field==1 && handler->file_format==E_FORMAT_BED)
				{
				ap_rputs(" type=\"start\"",handler->r);
				}
			else if(n_field==2 && handler->file_format==E_FORMAT_BED)
				{
				ap_rputs(" type=\"end\"",handler->r);
				}
			ap_rputs(">",handler->r);
			ap_xmlNPuts(&(line->s)[prev],i-prev,handler->r);
			ap_rputs("</td>",handler->r);
			if(i==line->l) break;
			++n_field;
			prev=i+1;
			}
		}
	return ap_rputs("</tr>\n",handler->r);
	}
Ejemplo n.º 8
0
static void write_global_stats_full(request_rec *r, const global_snapshot *ss)
{
	ap_rputs("<dl>\n", r);
	ap_rprintf(r, "<dt>%d files saved, totalizing %s (%ld discarded)</dt>\n",
			ss->rec_count, format_mbyte(r->pool, ss->total_mb), ss->discarded);
	ap_rprintf(r, "<dt><strong>Queue time</strong>: Total: %s - Avg: %.3f ms </dt>\n",
			format_msec(r->pool, ss->total_queuetime_ms), ss->avg_queuetime_ms);
	ap_rprintf(r, "<dt><strong>Write time</strong>: Total: %s - Avg: %.3f ms - Bandwidth: %.1f Mb/s</dt>\n",
			format_msec(r->pool, ss->total_writetime_ms), ss->avg_writetime_ms, ss->bandwidth);
	ap_rputs("</dl>\n", r);
}
Ejemplo n.º 9
0
static void write_process_stats(request_rec *r, int i, process_snapshot *ss)
{
	ap_rputs("<tr>", r);
	ap_rprintf(r, "<td><strong>%d</strong></td>",  i);
	ap_rprintf(r, "<td>%d</td>",                   ss->pid);
	ap_rprintf(r, "<td>%d/%d</td>",                ss->count_process, ss->count_slot);
	ap_rprintf(r, "<td><strong>%s</strong></td>",  status_str(ss->status));
	ap_rprintf(r, "<td>%d</td>",                   ss->queue_len);
	ap_rprintf(r, "<td>%ld</td>",                  ss->discarded);
	ap_rputs("</tr>", r);
}
Ejemplo n.º 10
0
// this function takes a ", " separated list of groups and attempts to add
// CSS to the page from the config
static void add_group_css(request_rec *r, void *config, char * group) {
	moon_svr_cfg* cfg = config;
	char * css = apr_pcalloc(r->pool,1);
	char * next_css;
	char * temp_css;
	char * begin_ptr = NULL;
	char * end_ptr = NULL;
	char buf[MAX_GROUP_STR_LEN];
	int diff = 0;
	if(group != NULL) {
		end_ptr = strchr(group, ',');
		begin_ptr = group;
		while(end_ptr != NULL) {
			diff =  end_ptr - begin_ptr;
			if(diff >= MAX_GROUP_STR_LEN) {
				ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server, "group name too long");
				continue;
			}
			strncpy(buf,begin_ptr,diff);
			buf[diff] = '\0';
			next_css = apr_hash_get(cfg->group_to_css, buf, APR_HASH_KEY_STRING);
			if(next_css != NULL) {
				temp_css = apr_palloc(r->pool, strlen(css)+strlen(next_css)+1);
				strcpy(temp_css,css);
				strcat(temp_css,next_css);
				css = temp_css;
			}
			begin_ptr = end_ptr+2;
			end_ptr = strchr(begin_ptr, ',');
		}
		strcpy(buf,begin_ptr);
		next_css = apr_hash_get(cfg->group_to_css, buf, APR_HASH_KEY_STRING);
		if(next_css != NULL) {
			temp_css = apr_palloc(r->pool, strlen(css)+strlen(next_css)+1);
			strcpy(temp_css,css);
			strcat(temp_css,next_css);
			css = temp_css;
		}
		
		if(strlen(css)==0) {
				css = apr_hash_get(cfg->group_to_css, "", APR_HASH_KEY_STRING);
		}
	}
	else {
		css = apr_hash_get(cfg->group_to_css, "", APR_HASH_KEY_STRING);
	}
	if(css == NULL) {
		return;
	}
	ap_rputs(OPEN_STYLE,r);
	ap_rprintf(r,"#%s{%s}",ELEMENT_ID_FOR_USER,css);
	ap_rputs(CLOSE_STYLE,r);
}
Ejemplo n.º 11
0
static int less_handler(request_rec* r)
{
	struct stat info;
	struct stat lessinfo;
	char * lessfilename = NULL;
	char * command = NULL;
	int status;
	int newer = 0;
	int error = 0;
	char * errornum = NULL;

	if (!r->handler || strcmp(r->handler, "less"))
	return DECLINED;

	if (r->method_number != M_GET)
	return HTTP_METHOD_NOT_ALLOWED;

	asprintf(&lessfilename, "%s.less", r->filename);
	asprintf(&command, "lessc %s > %s", r->filename, lessfilename);

	if (!file_exists(lessfilename)){

		status = system(command);
		if(status != 0)
			return DECLINED;

	}

	if (file_exists(lessfilename)){

		if ((stat(r->filename,&info) == 0) && (stat(lessfilename,&lessinfo) == 0) && (info.st_mtime > lessinfo.st_mtime))
			status = system(command);
		
		if ((error = read_file(lessfilename)) != 1){
			ap_set_content_type(r, "text/css");
        		ap_rputs(source,r);
			free(source);
			return OK;

		} else {

			asprintf(&errornum, "%d", error);
			ap_set_content_type(r, "text/css");
        		ap_rputs(errornum,r);
			free(source);
			return OK;

		}

	}
    	
}
Ejemplo n.º 12
0
mrb_value ap_mrb_rputs(mrb_state *mrb, mrb_value str)
{
    mrb_value msg;

    mrb_get_args(mrb, "o", &msg);
    if (mrb_type(msg) == MRB_TT_STRING) {
        ap_rputs(RSTRING_PTR(msg), ap_mrb_get_request()); 
    } else {
        ap_rputs("not string", ap_mrb_get_request()); 
    }

    return str;
}
Ejemplo n.º 13
0
void markdown_output(MMIOT *doc, request_rec *r)
{
    char *title;
    int ret;
    int size;
    char *p;
    markdown_conf *conf;
    list_t *css;

    conf = (markdown_conf *) ap_get_module_config(r->per_dir_config,
                                                  &markdown_module);
    ret = mkd_compile(doc, MKD_TOC|MKD_AUTOLINK);
    ap_rputs("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", r);
    ap_rputs("<!DOCTYPE html PUBLIC \n"
             "          \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
             "          \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n",
             r);
    ap_rputs("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n", r);
    ap_rputs("<head>\n", r);

    if (conf->css) {
        ap_rputs("<meta http-equiv=\"Content-Type\""
                 " content=\"text/html; charset=UTF-8\" />\n", r);
        ap_rputs("<meta http-equiv=\"Content-Style-Type\""
                 " content=\"text/css\" />\n", r);
		css = conf->css;
		do{
            ap_rprintf(r,
                       "<link rel=\"stylesheet\" href=\"%s\""
                       " type=\"text/css\" />\n",
                       (char *)css->data);
            css = (list_t *)css->next;
		}while(css);
    }
    title = mkd_doc_title(doc);
    if (title) {
        ap_rprintf(r, "<title>%s</title>\n", title);
    }
    ap_rputs("</head>\n", r);
    ap_rputs("<body>\n", r);
    if (title) {
        ap_rprintf(r, "<h1 class=\"title\">%s</h1>\n", title);
    }
    if ((size = mkd_document(doc, &p)) != EOF) {
        ap_rwrite(p, size, r);
    }
    ap_rputc('\n', r);
    ap_rputs("</body>\n", r);
    ap_rputs("</html>\n", r);
    mkd_cleanup(doc);
}
Ejemplo n.º 14
0
/*  _________________________________________________________________
**
**  SSL Extension to mod_status
**  _________________________________________________________________
*/
static int ssl_ext_status_hook(request_rec *r, int flags)
{
    SSLSrvConfigRec *sc = mySrvConfig(r->server);

    if (sc == NULL || flags & AP_STATUS_SHORT)
        return OK;

    ap_rputs("<hr>\n", r);
    ap_rputs("<table cellspacing=0 cellpadding=0>\n", r);
    ap_rputs("<tr><td bgcolor=\"#000000\">\n", r);
    ap_rputs("<b><font color=\"#ffffff\" face=\"Arial,Helvetica\">SSL/TLS Session Cache Status:</font></b>\r", r);
    ap_rputs("</td></tr>\n", r);
    ap_rputs("<tr><td bgcolor=\"#ffffff\">\n", r);

    if (sc->mc->nSessionCacheMode == SSL_SCMODE_DBM)
        ssl_scache_dbm_status(r, flags, r->pool);
    else if (sc->mc->nSessionCacheMode == SSL_SCMODE_SHMCB)
        ssl_scache_shmcb_status(r, flags, r->pool);
#ifdef HAVE_DISTCACHE
    else if (sc->mc->nSessionCacheMode == SSL_SCMODE_DC)
        ssl_scache_dc_status(r, flags, r->pool);
#endif

    ap_rputs("</td></tr>\n", r);
    ap_rputs("</table>\n", r);
    return OK;
}
Ejemplo n.º 15
0
/** HTML handlers ***************************************************/
static void htmlStartDocument( struct tabix_callback_t* handler)
	{
	const char* region=HttpParamGet(handler->httParams,"region");

	ap_set_content_type(handler->r, MIME_TYPE_HTML);
	ap_rputs("<!doctype html>\n<html lang=\"en\">",handler->r);
	ap_rputs("<head>",handler->r);
	printDefaulthtmlHead(handler->r);
	ap_rputs("</head>",handler->r);
	ap_rputs("<body>",handler->r);
	ap_rputs("<form>"
		"<label for='format'>Format:</label> <select  id='format' name='format'>"
		"<option value='html'>html</option>"
		"<option value='json'>json</option>"
		"<option value='xml'>xml</option>"
		"<option value='text'>text</option>"
		"</select> "
		"<label for='limit'>Limit:</label> <input id='limit' name='limit' type='number' value='10'/> "
		"<label for='region'>Region:</label> <input id='region' name='region' placeholder='chrom:start-end' "
		,handler->r);
	
	if(region!=NULL)
	    {
	    ap_rputs(" value=\"",handler->r);
	    ap_xmlPuts(region,handler->r);
	    ap_rputs("\"",handler->r);
	    }

	ap_rputs("/> <input type='submit'/></form><div>",handler->r);
	}
Ejemplo n.º 16
0
static void jsonStartDocument( struct tabix_callback_t* handler)
	{
	if(handler->jsonp_callback!=NULL)
			{
			ap_set_content_type(handler->r, MIME_TYPE_JAVASCRIPT);
			ap_rputs(handler->jsonp_callback,handler->r);
			ap_rputc('(',handler->r);
			}
	else
			{
			ap_set_content_type(handler->r, MIME_TYPE_JSON);
			}
	ap_rputs("{",handler->r);
	}
Ejemplo n.º 17
0
/**
 * Called by other modules to print their "jmx beans" to the response in
 * whatever format was requested by the client.
 */
static apr_status_t bmx_bean_print_text_plain(request_rec *r,
                                              const struct bmx_bean *bean)
{
    apr_size_t objectname_strlen = bmx_objectname_strlen(bean->objectname) + 1;
    char *objectname_str = apr_palloc(r->pool, objectname_strlen);
    (void)bmx_objectname_str(bean->objectname, objectname_str,
                             objectname_strlen);
    (void)ap_rputs("Name: ", r);
    (void)ap_rputs(objectname_str, r);
    (void)ap_rputs("\n", r);

    /* for each element in bean->bean_properties, print it */
    if (!APR_RING_EMPTY(&(bean->bean_props), bmx_property, link)) {
        struct bmx_property *p = NULL;
        const char *value;
        for (p = APR_RING_FIRST(&(bean->bean_props));
             p != APR_RING_SENTINEL(&(bean->bean_props), bmx_property, link);
             p = APR_RING_NEXT(p, link)) {
            (void)ap_rputs(p->key, r);
            (void)ap_rputs(": ", r);
            value = property_print(r->pool, p);
            if (value)
                (void)ap_rputs(value, r);
            (void)ap_rputs("\n", r);
        }
    }
    (void)ap_rputs("\n", r);
    return APR_SUCCESS;
}
// Multicast index handler
static int multicast_index_handler(request_rec *rec)
{
  multicast_conf* conf = ap_get_module_config(rec->per_dir_config, &multicast_index_module);
  apr_status_t status = APR_SUCCESS;
  apr_finfo_t finfo;
  apr_dir_t* dir;

  if(strcasecmp(rec->handler, MULTICAST_INDEX)) return DECLINED;
  if(!conf || !conf->enabled) return DECLINED;
  if(rec->method_number!=M_GET) return DECLINED;

  // setup content-type of response.
  rec->content_type = "text/json";

  // do request
  status = apr_dir_open(&dir, rec->filename, rec->pool);
  if(status!=APR_SUCCESS) {
    // 404 Not Found.
    rec->status = HTTP_NOT_FOUND;
    return multicast_404_not_found(rec, conf);
  }

  // 200 OK.
  if(!rec->header_only) {
    int the_first = TRUE;
    ap_rputs("[", rec);
    while((status=apr_dir_read(&finfo, APR_FINFO_NAME|APR_FINFO_TYPE, dir))==APR_SUCCESS) {
      if((strcmp(finfo.name, ".")==0) || (strcmp(finfo.name, "..")==0)) continue;
      if(the_first) { the_first = FALSE; } else { ap_rputs(",", rec); }
      switch(finfo.filetype) {
      case APR_DIR:
        ap_rprintf(rec, "\"%s/\"", finfo.name);
        break;
      case APR_REG:
        ap_rprintf(rec, "\"%s\"", finfo.name);
        break;
      case APR_LNK:
        ap_rprintf(rec, "\"%s@\"", finfo.name);
        break;
      default:
        break;
      }
    }
    ap_rputs("]\n", rec);
    rec->status = HTTP_OK;
  }
  apr_dir_close(dir);

  return multicast_200_ok(rec, conf);
}
Ejemplo n.º 19
0
/*  _________________________________________________________________
**
**  SSL Extension to mod_status
**  _________________________________________________________________
*/
static int ssl_ext_status_hook(request_rec *r, int flags)
{
    SSLModConfigRec *mc = myModConfig(r->server);

    if (mc == NULL || flags & AP_STATUS_SHORT || mc->sesscache == NULL)
        return OK;

    ap_rputs("<hr>\n", r);
    ap_rputs("<table cellspacing=0 cellpadding=0>\n", r);
    ap_rputs("<tr><td bgcolor=\"#000000\">\n", r);
    ap_rputs("<b><font color=\"#ffffff\" face=\"Arial,Helvetica\">SSL/TLS Session Cache Status:</font></b>\r", r);
    ap_rputs("</td></tr>\n", r);
    ap_rputs("<tr><td bgcolor=\"#ffffff\">\n", r);

    if (mc->sesscache->flags & AP_SOCACHE_FLAG_NOTMPSAFE) {
        ssl_mutex_on(r->server);
    }

    mc->sesscache->status(mc->sesscache_context, r, flags);

    if (mc->sesscache->flags & AP_SOCACHE_FLAG_NOTMPSAFE) {
        ssl_mutex_off(r->server);
    }

    ap_rputs("</td></tr>\n", r);
    ap_rputs("</table>\n", r);
    return OK;
}
Ejemplo n.º 20
0
static void write_stats_full(request_rec *r, global_snapshot *gs, process_snapshot **sn)
{
	ap_rputs("<hr><h2>Tee status</h2>\n", r);
	write_global_stats_full(r, gs);
	ap_rputs("<table>\n", r);
	const char *headers[] = { "Slot", "PID", "Acc", "Status", "Queue Len", "Discarded", NULL };
	write_headers(r, headers);
	int i;
	for (i = 0; i < global_stats->count; i++) {
		if (sn[i])
			write_process_stats(r, i, sn[i]);
	}
	ap_rputs("</table>\n", r);
	ap_rputs(legend, r);
}
Ejemplo n.º 21
0
/*
 * Display an XHTML MIME structure
 * 'link' must already be properly URI-escaped
 */
void mbox_mime_display_static_structure(request_rec *r,
                                        mbox_mime_message_t *m, char *link)
{
    int i;

    if (!m) {
        return;
    }

    ap_rputs("<li>", r);

    if (m->body_len) {
        ap_rprintf(r, "<a rel=\"nofollow\" href=\"%s\">", link);
    }

    if (m->content_name) {
        ap_rprintf(r, "%s (%s)",
                   ESCAPE_OR_BLANK(r->pool, m->content_name),
                   ESCAPE_OR_BLANK(r->pool, m->content_type));
    }
    else {
        ap_rprintf(r, "Unnamed %s", ESCAPE_OR_BLANK(r->pool, m->content_type));
    }

    if (m->body_len) {
        ap_rputs("</a>", r);
    }

    ap_rprintf(r, " (%s, %s, %" APR_SIZE_T_FMT " bytes)</li>\n",
               m->content_disposition, mbox_cte_to_char(m->cte), m->body_len);

    if (!m->sub) {
        return;
    }

    for (i = 0; i < m->sub_count; i++) {
        ap_rputs("<ul>\n", r);

        if (link[strlen(link) - 1] == '/') {
            link[strlen(link) - 1] = 0;
        }

        mbox_mime_display_static_structure(r, m->sub[i],
                                           apr_psprintf(r->pool, "%s/%d",
                                                        link, i + 1));
        ap_rputs("</ul>\n", r);
    }
}
Ejemplo n.º 22
0
static int write_msg(request_rec *r, msg_t *msg)
{
    ap_set_content_type(r, "application/octet-stream");
    ap_rputs(msg->data, r);

    return OK;
}
Ejemplo n.º 23
0
/* The sample content handler */
static int logtest_handler(request_rec *r)
{
    //if (strcmp(r->handler, "logtest")) {
    //    return DECLINED;
    //}
    r->content_type = "text/html";      

	SemanticLogger log(r);
	SemanticLogRoute* route = new SemanticLogFileRoute();
	route->setLogFile("/tmp/output");
	route->setRotate(true);
	log.addRoute(route);
	log.applicationLog(1, "error\n", SemanticLogger::INFO, "aaa.aa.aaaaa", "test", "{\"ssss\":12344 }");

	std::map<std::string, std::string> itms;  // 文字×文字のmapを指定
	itms.insert(std::pair<std::string, std::string>("01", "C++"));  // 値を挿入
	itms.insert(std::pair<std::string, std::string>("02", "C#"));
	itms.insert(std::pair<std::string, std::string>("03", "VB"));
	itms.insert(std::pair<std::string, std::string>("04", "Java"));
	itms.insert(std::pair<std::string, std::string>("05", "XML"));
	log.applicationLog(2, "trace\n", SemanticLogger::TRACE, "aaa.aa.aaaaa", itms);
	log.applicationLog(3, "info\n", SemanticLogger::INFO, "aaa.aa.aaaaa");

    if (!r->header_only)
	{
        ap_rputs("The sample page from mod_logtest.c\n", r);
		ap_rprintf(r, "handler: %s", r->handler);
	}
    return OK;
}
Ejemplo n.º 24
0
/**
define write_raw(text: String)

This writes 'text' directly to the server without performing any HTML character
escaping. Use this only if you are certain that there is no possibility of HTML
injection.
*/
void lily_apache_server_write_raw(lily_vm_state *vm, uint16_t argc, uint16_t *code)
{
    lily_value **vm_regs = vm->vm_regs;
    char *value = vm_regs[code[1]]->value.string->string;

    ap_rputs(value, (request_rec *)vm->data);
}
Ejemplo n.º 25
0
// ## void Request.puts(String s)
static KMETHOD Request_puts(KonohaContext *kctx, KonohaStack *sfp)
{
    kRequest *self = (kRequest *) sfp[0].asObject;
    kString *data = sfp[1].asString;
    ap_rputs(kString_text(data), self->r);
    KReturnVoid();
}
Ejemplo n.º 26
0
void util_ldap_compare_node_display(request_rec *r, util_ald_cache_t *cache, void *n)
{
    util_compare_node_t *node = (util_compare_node_t *)n;
    char date_str[APR_CTIME_LEN+1];
    char *buf, *cmp_result;

    apr_ctime(date_str, node->lastcompare);

    if (node->result == LDAP_COMPARE_TRUE) {
        cmp_result = "LDAP_COMPARE_TRUE";
    }
    else if (node->result == LDAP_COMPARE_FALSE) {
        cmp_result = "LDAP_COMPARE_FALSE";
    }
    else {
        cmp_result = apr_itoa(r->pool, node->result);
    }

    buf = apr_psprintf(r->pool, 
             "<tr valign='top'>"
             "<td nowrap>%s</td>"
             "<td nowrap>%s</td>"
             "<td nowrap>%s</td>"
             "<td nowrap>%s</td>"
             "<td nowrap>%s</td>"
             "<tr>",
         node->dn,
         node->attrib,
         node->value,
         date_str,
         cmp_result);

    ap_rputs(buf, r);
}
Ejemplo n.º 27
0
/*
 * Provide information for "status" logic
 */
static void advertise_info(request_rec *r)
{
    server_rec *s = main_server;
    /* Find the VirtualHost (Server) that does the Advertise */
    while (s) {
        void *sconf = s->module_config;
        mod_advertise_config *mconf = ap_get_module_config(sconf, &advertise_module);
        ap_rprintf(r, "Server: %s ", s->server_hostname);
        if (s->is_virtual && s->addrs) {
           server_addr_rec *srec = s->addrs;
           ap_rprintf(r, "VirtualHost: %s:%d", srec->virthost, srec->host_port);
        }
        if (mconf->ma_advertise_server != NULL) {
            ap_rprintf(r, " Advertising on Group %s Port %d ", mconf->ma_advertise_adrs, mconf->ma_advertise_port);
            ap_rprintf(r, "for %s://%s:%d every %d seconds<br/>",
                       mconf->ma_advertise_srvm, mconf->ma_advertise_srvs,
                       mconf-> ma_advertise_srvp,
                       apr_time_sec(mconf->ma_advertise_freq)
                       );
        } else {
            ap_rputs("<br/>", r);
        }
        s = s->next;
    }
}
Ejemplo n.º 28
0
static void ssl_ext_ms_display_cb(char *str, void *_r)
{
    request_rec *r = (request_rec *)_r;
    if (str != NULL)
        ap_rputs(str, r);
    return;
}
/* The sample content handler */
static int helloworld_handler(request_rec *r)
{
    r->content_type = "text/html";      
    ap_send_http_header(r);
    if (!r->header_only)
        ap_rputs("The sample page from mod_helloworld.c\n", r);
    return OK;
}
Ejemplo n.º 30
0
// this function takes a user name and the server config and attempts to add CSS rules
// to the page if they exist
static void add_user_css(request_rec *r, void *config, char * user) {
	moon_svr_cfg* cfg = config;
	char * css;

	if(user != NULL) {
		css = apr_hash_get(cfg->user_to_css, user, APR_HASH_KEY_STRING);
		if(css == NULL) {
			css = apr_hash_get(cfg->user_to_css, "", APR_HASH_KEY_STRING);
		}
	} 
	else {
		css = apr_hash_get(cfg->user_to_css, "", APR_HASH_KEY_STRING);
	}
	if(css==NULL) {
		return;
	}
	ap_rputs(OPEN_STYLE,r);
	ap_rprintf(r,"#%s{%s}",ELEMENT_ID_FOR_USER,css);
	ap_rputs(CLOSE_STYLE,r);
}