/* * 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; } }
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); }
/* * This handler is invoked by the toolbus module whenever an event is received * from the toolbus. */ ATerm toolbus_handler( int tb_conn, ATerm input ) { ATerm rv = NULL; /* return value, gets sent back to the toolbus */ ATerm myterm; /* general purpose */ ATerm myterm2; /* general purpose */ char html_buf[HTML_BUF_SIZE]; char *html_text; ATfprintf( stderr, "mod_toolbus: toolbus_handler(): received: %t\n", input ); fflush( stderr ); /* * match input from toolbus */ /* toolbus asked for a signature check */ if(ATmatch(input, "rec-do(signature(<term>,<term>))", &myterm, &myterm2)) { ATfprintf( stderr, "mod_toolbus: toolbus_handler(): signature check\n" ); fflush( stderr ); rv = NULL; /* we don't do a signature check */ } /* receive ack of an event we sent (that's how we initiated our session) */ else if( ATmatch( input, "rec-ack-event(<term>)", &myterm ) ) { ATfprintf( stderr, "mod_toolbus: toolbus_handler(): rec-ack-event: %t\n", myterm ); fflush( stderr ); rv = NULL; } /* toolbus asked us to display an HTML page encoded as an ATerm */ else if( ATmatch( input, "rec-do(reply-html(<term>))", &myterm ) ) { ATfprintf(stderr, "mod_toolbus: toolbus_handler(): rec-do(reply-html())\n" ); ATparseHTML( myterm, html_buf, HTML_BUF_SIZE ); ap_rprintf( global_http_req, html_buf ); global_is_tb_session_done ++; /* after this we're done */ rv = NULL; } else if( ATmatch( input, "rec-do(reply-text(<str>))", &html_text ) ) { ATfprintf(stderr, "mod_toolbus: toolbus_handler(): rec-do(reply-text())\n" ); ap_rprintf( global_http_req, html_text ); global_is_tb_session_done ++; /* after this we're done */ rv = NULL; } else /* default response */ { global_is_tb_session_done ++; ATfprintf( stderr, "mod_toolbus: toolbus_handler(): event: default\n" ); fflush( stderr ); rv = NULL; } ATfprintf( stderr, "mod_toolbus: toolbus_handler(): leaving...\n" ); fflush( stderr ); return rv; }
static void format_kbyte_out(request_rec *r, apr_off_t kbytes) { if (kbytes < KBYTE) ap_rprintf(r, "%d kB", (int) kbytes); else if (kbytes < MBYTE) ap_rprintf(r, "%.1f MB", (float) kbytes / KBYTE); else ap_rprintf(r, "%.1f GB", (float) kbytes / MBYTE); }
/** * Print the statistics for each JVM. */ static void jvm_status(cluster_t *cluster, request_rec *r) { int i; stream_t s; ap_rputs("<center><table border=2 width='80%'>\n", r); ap_rputs("<tr><th width=\"30%\">Host</th>\n", r); ap_rputs(" <th>Active</th>\n", r); ap_rputs(" <th>Pooled</th>\n", r); ap_rputs(" <th>Connect<br>Timeout</th>\n", r); ap_rputs(" <th>Live<br>Time</th>\n", r); ap_rputs(" <th>Dead<br>Time</th>\n", r); ap_rputs("</tr>\n", r); for (; cluster; cluster = cluster->next) { for (i = 0; i < cluster->srun_capacity; i++) { cluster_srun_t *cluster_srun = cluster->srun_list + i; srun_t *srun = cluster_srun->srun; int port; int pool_count; if (! srun) continue; port = srun->port; pool_count = ((srun->conn_head - srun->conn_tail + CONN_POOL_SIZE) % CONN_POOL_SIZE); ap_rputs("<tr>", r); if (! cse_open(&s, cluster, cluster_srun, r->pool, 0)) { ap_rprintf(r, "<td bgcolor='#ff6666'>%d. %s:%d%s (down)</td>", cluster_srun->index + 1, srun->hostname ? srun->hostname : "localhost", port, cluster_srun->is_backup ? "*" : ""); } else { ap_rprintf(r, "<td bgcolor='#66ff66'>%d. %s:%d%s (ok)</td>", cluster_srun->index + 1, srun->hostname ? srun->hostname : "localhost", port, cluster_srun->is_backup ? "*" : ""); } /* This needs to be close, because cse_open doesn't use recycle. */ cse_close(&s, "caucho-status"); LOG(("close\n")); ap_rprintf(r, "<td align=right>%d</td><td align=right>%d</td>", srun->active_sockets, pool_count); ap_rprintf(r, "<td align=right>%d</td><td align=right>%d</td><td align=right>%d</td>", srun->connect_timeout, srun->live_time, srun->dead_time); ap_rputs("</tr>\n", r); } } ap_rputs("</table></center>\n", r); }
/* Format the number of bytes nicely */ static void format_byte_out(request_rec *r, apr_off_t bytes) { if (bytes < (5 * KBYTE)) ap_rprintf(r, "%d B", (int) bytes); else if (bytes < (MBYTE / 2)) ap_rprintf(r, "%.1f kB", (float) bytes / KBYTE); else if (bytes < (GBYTE / 2)) ap_rprintf(r, "%.1f MB", (float) bytes / MBYTE); else ap_rprintf(r, "%.1f GB", (float) bytes / GBYTE); }
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); }
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); }
int webgfarm_api_v1_read_dir(request_rec *r) { char *filepath = webgfarm_api_v1_getfilepath(r); if (filepath == NULL || strlen(filepath) == 0) { return HTTP_FORBIDDEN; } gfarm_error_t gerr; GFS_DirPlus gfs_dirplus; // open dir gerr = gfs_opendirplus(filepath, &gfs_dirplus); if (gerr != GFARM_ERR_NO_ERROR) { switch (gerr) { case GFARM_ERR_NO_SUCH_FILE_OR_DIRECTORY: return HTTP_NOT_FOUND; break; case GFARM_ERR_PERMISSION_DENIED: return HTTP_FORBIDDEN; break; //FIXEME: Support more error; default: return HTTP_INTERNAL_SERVER_ERROR; } } // read dir struct gfs_dirent *dent; struct gfs_stat *st; gerr = gfs_readdirplus(gfs_dirplus, &dent, &st); while (dent != NULL) { if (gerr != GFARM_ERR_NO_ERROR) { gerr = gfs_closedirplus(gfs_dirplus); return HTTP_INTERNAL_SERVER_ERROR; } if (dent->d_type == GFS_DT_REG) { ap_rprintf(r, "%s\n", dent->d_name); } else if (dent->d_type == GFS_DT_DIR) { ap_rprintf(r, "%s/\n", dent->d_name); } gerr = gfs_readdirplus(gfs_dirplus, &dent, &st); } // close dir gerr = gfs_closedirplus(gfs_dirplus); if (gerr != GFARM_ERR_NO_ERROR) { return HTTP_INTERNAL_SERVER_ERROR; } else { return OK; } }
// 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); }
/** * Writes a single chunk of multipart/x-mixed-replace content */ static void osrfHttpTranslatorWriteChunk(osrfHttpTranslator* trans, transport_message* msg) { osrfLogInternal(OSRF_LOG_MARK, "sending multipart chunk %s", msg->body); ap_rprintf(trans->apreq, "Content-type: %s\n\n%s\n\n", JSON_CONTENT_TYPE, msg->body); //osrfLogInternal(OSRF_LOG_MARK, "Apache sending data: Content-type: %s\n\n%s\n\n", //JSON_CONTENT_TYPE, msg->body); if(trans->complete) { ap_rprintf(trans->apreq, "--%s--\n", trans->delim); //osrfLogInternal(OSRF_LOG_MARK, "Apache sending data: --%s--\n", trans->delim); } else { ap_rprintf(trans->apreq, "--%s\n", trans->delim); //osrfLogInternal(OSRF_LOG_MARK, "Apache sending data: --%s\n", trans->delim); } ap_rflush(trans->apreq); }
/* * 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); } }
/* 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; }
/* 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; }
static int printitem(void* rec, const char* key, const char* value) { /* rec is a userdata pointer. We'll pass the request_rec in it */ request_rec* r = rec ; ap_rprintf(r, "<tr><th scope=\"row\">%s</th><td>%s</td></tr>\n", ap_escape_html(r->pool, key), ap_escape_html(r->pool, value)) ; /* Zero would stop iterating; any other return value continues */ return 1 ; }
static void readPostData(request_rec* r) { int rc; if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)) != OK) { ap_rprintf(r, "readPostData\trc\t[%d]<br>", rc); } else { if (ap_should_client_block(r)) { char data[HUGE_STRING_LEN]; int rsize, len_read, rpos=0; long length = r->remaining; while ((len_read = ap_get_client_block(r, data, sizeof(data))) > 0) { ap_rprintf(r, "Read Data : <br>[%s]<br>", data); } } else { ap_rprintf(r, "readPostData\t[NULL]<br>"); } } }
/** helper to write out the headers */ static int ListHeadersCallback(void *rec, const char *key, const char *value) { request_rec *r = (request_rec *) rec; ap_rprintf(r, "%s: %s<br>", key, value); return 1; }
static int htmlPrintBody(struct tabix_callback_t* handler,const kstring_t *line) { int i,prev=0,n_field=0; ap_rprintf(handler->r,"<tr class=\"row%d\">",(int)(handler->count%2)); for(i=0;i<= line->l;++i) { if(line->s[i]=='\t' || i==line->l) { int len=i-prev; int only_digit=1,j; ap_rputs("<td",handler->r); if(n_field==0 && (handler->file_format==E_FORMAT_VCF || handler->file_format==E_FORMAT_BED)) { ap_rputs(" class=\"tbxc\"",handler->r); } else if(n_field==1 && handler->file_format==E_FORMAT_VCF) { ap_rputs(" class=\"tbxp\"",handler->r); } else if(n_field==1 && handler->file_format==E_FORMAT_BED) { ap_rputs(" class=\"tbxs\"",handler->r); } else if(n_field==2 && handler->file_format==E_FORMAT_BED) { ap_rputs(" class=\"tbxe\"",handler->r); } ap_rputs(">",handler->r); for(j=2;j< len && line->l >2 ;++j) { if(!isdigit(line->s[i+j])) { only_digit=0; break; } } // ncbi rs ? if(line->l >2 && only_digit==1 && line->s[0]=='r' && line->s[1]=='s') { ap_rputs("<a href=\"http://www.ncbi.nlm.nih.gov/projects/SNP/snp_ref.cgi?rs=",handler->r); ap_rwrite((void*)&(line->s)[prev+2],len-2,handler->r); ap_rputs("\">",handler->r); ap_rwrite((void*)&(line->s)[prev],len,handler->r); ap_rputs("</a>",handler->r); } else { ap_xmlNPuts(&(line->s)[prev],len,handler->r); } ap_rputs("</td>",handler->r); if(i==line->l) break; ++n_field; prev=i+1; } } return ap_rputs("</tr>\n",handler->r); }
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); }
void ssl_scache_dc_status(request_rec *r, int flags, apr_pool_t *pool) { SSLModConfigRec *mc = myModConfig(r->server); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "distributed scache 'ssl_scache_dc_status'"); ap_rprintf(r, "cache type: <b>DC (Distributed Cache)</b>, " " target: <b>%s</b><br>", mc->szSessionCacheDataFile); }
static void write_stats_auto(request_rec *r, const global_snapshot *ss) { ap_rprintf(r, "TeeTotalFiles: %d\n", ss->rec_count); ap_rprintf(r, "TeeDiscardedFiles: %ld\n", ss->discarded); ap_rprintf(r, "TeeMBytesSaved: %f\n", ss->total_mb); ap_rprintf(r, "TeeTotalQueueMs: %f\n", ss->total_queuetime_ms); ap_rprintf(r, "TeeAvgQueueMs: %f\n", ss->avg_queuetime_ms); ap_rprintf(r, "TeeTotalWriteMs: %f\n", ss->total_writetime_ms); ap_rprintf(r, "TeeAvgWriteMs: %f\n", ss->avg_writetime_ms); ap_rprintf(r, "TeeMBytesPerSecWritten: %f\n", ss->bandwidth); }
static void show_time(request_rec *r, time_t tsecs) { long days, hrs, mins, secs; secs = tsecs % 60; tsecs /= 60; mins = tsecs % 60; tsecs /= 60; hrs = tsecs % 24; days = tsecs / 24; if (days) ap_rprintf(r, " %ld day%s", days, days == 1 ? "" : "s"); if (hrs) ap_rprintf(r, " %ld hour%s", hrs, hrs == 1 ? "" : "s"); if (mins) ap_rprintf(r, " %ld minute%s", mins, mins == 1 ? "" : "s"); if (secs) ap_rprintf(r, " %ld second%s", secs, secs == 1 ? "" : "s"); }
static int document_select(request_rec *r, softbot_handler_rec *s) { int rv = 0; uint32_t docid = 0; char* OID = 0; char* DID = 0; char content_type[SHORT_STRING_SIZE+1]; OID = apr_pstrdup(r->pool, apr_table_get(s->parameters_in, "OID")); DID = apr_pstrdup(r->pool, apr_table_get(s->parameters_in, "DID")); if( (OID == NULL || strlen(OID) == 0) && (DID == NULL || strlen(DID) == 0) ) { MSG_RECORD(&s->msg, error, "oid, did is null, get parameter exist with oid or did."); return FAIL; } if (canned_doc == NULL) { canned_doc = (char *)sb_malloc(DOCUMENT_SIZE); if (canned_doc == NULL) { MSG_RECORD(&s->msg, crit, "out of memory: %s", strerror(errno)); return FAIL; } } if(OID != NULL) decodencpy(OID, OID, strlen(OID)); if(DID == NULL) { rv = sb_run_get_docid(did_db, OID, &docid); if ( rv < 0 ) { MSG_RECORD(&s->msg, error, "cannot get docid of OID[%s]", OID); return FAIL; } if( rv == DOCID_NOT_REGISTERED ) { MSG_RECORD(&s->msg, error, "not registerd OID[%s]", OID); return FAIL; } } else { docid = atoi(DID); } rv = sb_run_cdm_get_xmldoc(cdm_db, docid, canned_doc, DOCUMENT_SIZE); if ( rv < 0 ) { MSG_RECORD(&s->msg, error, "cannot get document[%u]", docid); return FAIL; } snprintf( content_type, SHORT_STRING_SIZE, "text/xml; charset=%s", default_charset); ap_set_content_type(r, content_type); ap_rprintf(r, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", default_charset); ap_rwrite(canned_doc, strlen(canned_doc), r); return SUCCESS; }
apr_status_t mbox_send_header_includes(request_rec *r, mbox_dir_cfg_t *conf) { if (conf->header_include_file) { RETURN_NOT_SUCCESS(mbox_send_include_file(r, conf->header_include_file)); } if (conf->style_path) { ap_rprintf(r, " <link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n", conf->style_path); } return APR_SUCCESS; }
// 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); }
apr_status_t mbox_send_footer_includes(request_rec *r, mbox_dir_cfg_t *conf) { if (conf->footer_include_file) { RETURN_NOT_SUCCESS(mbox_send_include_file(r, conf->footer_include_file)); } if (conf->script_path) { ap_rprintf(r, " <script type=\"text/javascript\" src=\"%s\"></script>\n", conf->script_path); } return APR_SUCCESS; }
void util_ldap_dn_compare_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_dn_compare_node_t *node = n; ap_rprintf(r, "<tr valign='top'>" "<td nowrap>%s</td>" "<td nowrap>%s</td>" "</tr>", node->reqdn, node->dn); }
void util_ldap_url_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_url_node_t *node = n; char date_str[APR_CTIME_LEN]; const char *type_str; util_ald_cache_t *cache_node; int x; for (x=0;x<3;x++) { switch (x) { case 0: cache_node = node->search_cache; type_str = "Searches"; break; case 1: cache_node = node->compare_cache; type_str = "Compares"; break; case 2: default: cache_node = node->dn_compare_cache; type_str = "DN Compares"; break; } if (cache_node->marktime) { apr_ctime(date_str, cache_node->marktime); } else date_str[0] = 0; ap_rprintf(r, "<tr valign='top'>" "<td nowrap>%s (%s)</td>" "<td nowrap>%ld</td>" "<td nowrap>%ld</td>" "<td nowrap>%ld</td>" "<td nowrap>%" APR_TIME_T_FMT "</td>" "<td nowrap>%ld</td>" "<td nowrap>%s</td>" "</tr>", node->url, type_str, cache_node->size, cache_node->maxentries, cache_node->numentries, apr_time_sec(cache_node->ttl), cache_node->fullmark, date_str); } }
void util_ldap_compare_node_display(request_rec *r, util_ald_cache_t *cache, void *n) { util_compare_node_t *node = n; char date_str[APR_CTIME_LEN]; char *cmp_result; char *sub_groups_val; char *sub_groups_checked; 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); } if (node->subgroupList) { sub_groups_val = "Yes"; } else { sub_groups_val = "No"; } if (node->sgl_processed) { sub_groups_checked = "Yes"; } else { sub_groups_checked = "No"; } ap_rprintf(r, "<tr valign='top'>" "<td nowrap>%s</td>" "<td nowrap>%s</td>" "<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, sub_groups_val, sub_groups_checked); }
static int foo_handler(request_rec *r) { logdebug("HANDLER"); if (!r->handler || strcmp(r->handler, "foo-handler")) return DECLINED; ap_set_content_type(r, "text/plain"); (*nrequest)++; ap_rprintf(r, "Ohai from pid %u! nrequest = %d\n", getpid(), *nrequest); logdebugf("nrequest = %d", *nrequest); return OK; }