这篇教程C++ FCGI_Accept函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FCGI_Accept函数的典型用法代码示例。如果您正苦于以下问题:C++ FCGI_Accept函数的具体用法?C++ FCGI_Accept怎么用?C++ FCGI_Accept使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FCGI_Accept函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: fcgi_acceptint fcgi_accept(){#ifdef Q_OS_WIN if ( FCGX_IsCGI() ) return FCGI_Accept(); else return FCGX_Accept( &FCGI_stdin->fcgx_stream, &FCGI_stdout->fcgx_stream, &FCGI_stderr->fcgx_stream, &environ );#else return FCGI_Accept();#endif}
开发者ID:geodenilson,项目名称:Quantum-GIS,代码行数:11,
示例2: http_threadvoid http_thread(void *args){ if(!init()) { print("http_init() failed/n"); return; } while(FCGI_Accept() >= 0) { FCGI_printf("Content-type: text/html/r/nStatus: 200 OK/r/n/r/n"); char *name = getenv("SCRIPT_NAME"); _Bool q = 0; if(name[0] == '/' && name[1] == 'q') { if(name[2] == 0) { q = 1; } else if(strcmp(name + 2, "key") == 0) { uint8_t k[64]; key_to_string(k, key.public); FCGI_fwrite(k, sizeof(k), 1, FCGI_stdout); continue; } else if(strcmp(name + 2, "stat") == 0) { FCGI_printf("Number of registered names: %u<br/>Number of successful Tox DNS requests: %u/n", stat.registered, stat.requests); continue; } }
开发者ID:GrayHatter,项目名称:tox-dns,代码行数:27,
示例3: luafcgi_acceptstatic int luafcgi_accept( lua_State * const L ) { const int rv = FCGI_Accept(); lua_pushboolean( L, rv == 0 ); return 1;}
开发者ID:abyxcos,项目名称:lua-fcgi,代码行数:7,
示例4: mainint main (){ char **initialEnv = environ; g_cgi_cfg = new CCgiCfg("/data/server/cgi-bin/sh/cgi_cfg.txt"); while (FCGI_Accept() >= 0) { CIfBase* ifobj = CIfFactory::getIfObj(); if(ifobj == NULL) { LogError("error_env_platform", ""); continue; } ifobj->SetServName(my_getenv("SERVER_NAME")); char* pszReq = my_getenv("QUERY_STRING"); ifobj->login(pszReq); delete ifobj; } delete (CWorldBase*)g_pTheWorld; return 0;}
开发者ID:Joinhack,项目名称:fragement,代码行数:25,
示例5: mainint main() { Database *db = Database::getInstance(); Session *session = Session::getInstance(); while (FCGI_Accept() >= 0) { Json::FastWriter fw; Json::Value root; string result("fail"); string detail(""); session->sessionInit(); vector<unordered_map<string,string> > query_result; if(session->checkSession() == false){ detail = detail + "unlogin"; }else{ char query_buf[1024] = {0}; string user_id; user_id = session->getValue("user_id");<<<<<<< HEAD snprintf(query_buf,sizeof(query_buf),"select b.no_id, b.type, a.user_id, a.username, b.additional_message, b.created_time from users a INNER JOIN (select * from notification where rece_id = %d and state = 0) b on a.user_id = b.rece_id union select b.no_id, b.type, b.send_id, a.username, b.additional_message, b.created_time from users a INNER JOIN (select * from notification where send_id = %d and state = 1) b on a.user_id = b.send_id",atoi(user_id.c_str()),atoi(user_id.c_str()));======= snprintf(query_buf,sizeof(query_buf),"(SELECT no_id,type,send_id,notification.state,username,nickname,created_time,additional_message FROM notification inner join users on users.user_id=send_id where rece_id=%d and notification.state=0) union (SELECT no_id,type,rece_id as send_id,notification.state,username,nickname,created_time,additional_message FROM notification inner join users on users.user_id=rece_id where send_id=%d and notification.state=1)",atoi(user_id.c_str()),atoi(user_id.c_str()));>>>>>>> 637973e20ec3876ad1a721cb4a71526d24d68c4f
开发者ID:Kallima03,项目名称:cgi_web,代码行数:25,
示例6: mainint main () { char * request_uri; /* Load the controller .so from this sub directory */ route_import_controllers("controllers/"); /* Initialize session system */ session_init(); while (FCGI_Accept() >= 0) { /* Record start time */ gettimeofday(&start_time,NULL); request_uri = cleanrequest( getenv("REQUEST_URI")); /* Initialize session for this request */ fprintf(stderr, "Request for %s/n", request_uri ); /* Dispatch the request to the correct controller */ route_dispatch(request_uri); free(request_uri); /* Calculate total runtime of the operation */ gettimeofday(&end_time,NULL); timeval_diff( &difference_time, &end_time, &start_time ); printf("time: %ld.%06ld/n", difference_time.tv_sec, difference_time.tv_usec); FCGI_Finish(); } fprintf(stderr, "FF Exiting/n"); return 0;}
开发者ID:adamsch1,项目名称:ff,代码行数:34,
示例7: ows_error/* * Return an ExceptionReport as specified in OWS 1.1.0 specification */void ows_error(ows * o, enum ows_error_code code, char *message, char *locator){ assert(o); assert(message); assert(locator); assert(!o->exit); o->exit = true; ows_log(o, 1, message);#if TINYOWS_FCGI if ((o->init && FCGI_Accept() >= 0) || !o->init) {#endif fprintf(o->output, "Content-Type: application/xml/n/n"); fprintf(o->output, "<?xml version='1.0' encoding='UTF-8'?>/n"); fprintf(o->output, "<ows:ExceptionReport/n"); fprintf(o->output, " xmlns='http://www.opengis.net/ows'/n"); fprintf(o->output, " xmlns:ows='http://www.opengis.net/ows'/n"); fprintf(o->output, " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'/n"); fprintf(o->output, " xsi:schemaLocation='http://www.opengis.net/ows"); fprintf(o->output, " http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd'/n"); fprintf(o->output, " version='1.1.0' language='en'>/n"); fprintf(o->output, " <ows:Exception exceptionCode='%s' locator='%s'>/n", ows_error_code_string(code), locator); fprintf(o->output, " <ows:ExceptionText>%s</ows:ExceptionText>/n", message); fprintf(o->output, " </ows:Exception>/n"); fprintf(o->output, "</ows:ExceptionReport>/n");#if TINYOWS_FCGI fflush(o->output); }#endif}
开发者ID:Ezio47,项目名称:tinyows,代码行数:37,
示例8: mainint main() { while (FCGI_Accept() >= 0) { printf("Content-type: text/r/n"); printf("Set-Cookie: name=value with spaces; and a semicolon/r/n"); printf("Set-Cookie: name2=value2/r/n/r/n"); printf("Cookie:%s/n", getenv("COOKIE_STRING")); }}
开发者ID:119,项目名称:MCTX3420,代码行数:8,
示例9: ewf_fastcgi_acceptint ewf_fastcgi_accept( void ){ if ( FCGI_Accept( ) < 0 ) { return EWF_ERROR; } return EWF_SUCCESS;}
开发者ID:neufbox,项目名称:misc,代码行数:8,
示例10: soap_serveSOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap* soap){#ifndef WITH_FASTCGI unsigned int k = soap->max_keep_alive;#endif do {#ifdef WITH_FASTCGI if (FCGI_Accept() < 0) { soap->error = SOAP_EOF; return soap_send_fault(soap); }#endif soap_begin(soap);#ifndef WITH_FASTCGI if (soap->max_keep_alive > 0 && !--k) soap->keep_alive = 0;#endif if (soap_begin_recv(soap)) { if (soap->error < SOAP_STOP) {#ifdef WITH_FASTCGI soap_send_fault(soap);#else return soap_send_fault(soap);#endif } soap_closesock(soap); continue; } if (soap_envelope_begin_in(soap) || soap_recv_header(soap) || soap_body_begin_in(soap) || soap_serve_request(soap) || (soap->fserveloop && soap->fserveloop(soap))) {#ifdef WITH_FASTCGI soap_send_fault(soap);#else return soap_send_fault(soap);#endif }#ifdef WITH_FASTCGI soap_destroy(soap); soap_end(soap); } while (1);#else } while (soap->keep_alive);
开发者ID:249CAAFE40,项目名称:mangos-wotlk,代码行数:58,
示例11: mainint main(int argc, char *argv){ int count = 0; while (FCGI_Accept() >= 0) { FCGI_printf("Content-type: text/*/r/n/r/n"); printf("Hi, I am Zhangpengpeng./t %d %s /n", count++, getenv("SERVER_NAME")); } return 0;}
开发者ID:rocflyhi,项目名称:glow,代码行数:9,
示例12: mainint main(void){ pci_init();#ifdef ENABLE_FASTCGI while(FCGI_Accept() >= 0) {#endif qentry_t *req = qcgireq_parse(NULL, 0); char *name = req->getstr(req, "username", true); if(name == NULL){ qcgires_redirect(req, BAD_REGISTER); goto end; } char *admin = req->getstr(req, "adminpassword", true); if(admin == NULL){ qcgires_redirect(req, BAD_REGISTER); free(name); goto end; } if(strncmp(admin, ADMIN_SECRET, strlen(ADMIN_SECRET)) != 0){ fprintf(stderr, "%s%s/n", "Invalid Registration Attempt: ", admin); qcgires_redirect(req, BAD_REGISTER); free(name); free(admin); goto end; } if( create_user(name) == 1 ){ /* Log the User in */ qentry_t *sess = NULL; sess = qcgisess_init(req, NULL); qcgisess_settimeout(sess, SESSION_TIME); if(sess){ sess->putstr(sess, "username", name, true); qcgisess_save(sess); sess->free(sess); } qcgires_redirect(req, APPLICATION); }else{ fprintf(stderr, "%s%s/n", "Could not create user: ", name); qcgires_redirect(req, BAD_REGISTER); } free(name); free(admin); end: qcgires_setcontenttype(req, "text/html"); // De-allocate memories req->free(req);#ifdef ENABLE_FASTCGI }#endif return 0;}
开发者ID:EdgeCaseBerg,项目名称:pChat,代码行数:56,
示例13: main/********************************************************************* FUNCTION main** STDIN is input from the HTTP server through FastCGI wrapper * (sent to ncxserver)* STDOUT is output to the HTTP server (rcvd from ncxserver)* * RETURNS:* 0 if NO_ERR* 1 if error connecting or logging into ncxserver*********************************************************************/int main (int argc, char **argv, char **envp){ int status = 0; yang_api_profile_t yang_api_profile; /* setup global vars used across all requests */ status = yang_api_init(&yang_api_profile); if (status != OK) { printf("Content-type: text/html/r/n/r/n" "<html><head><title>YANG-API echo</title></head>" "<body><h1>YANG-API init failed</h1></body></html>/n"); } /* temp: exit on all errors for now */ while (status == OK && FCGI_Accept() >= 0) {#ifdef DEBUG_TRACE printf("Content-type: text/html/r/n/r/n" "<html><head><title>YANG-API echo</title></head>" "<body><h1>YANG-API echo</h1>/n<pre>/n"); PrintEnv("Request environment", environ);#endif status = save_environment_vars(&yang_api_profile); if (status != OK) { continue; } status = setenv("REMOTE_USER", yang_api_profile.username, 0); if (status != 0) { continue; }#ifdef DEBUG_TRACE printf("start invoke netconf-subsystem-pro/n");#endif status = run_subsystem_ex(PROTO_ID_YANGAPI, 3, argc, argv, envp, read_yangapi_buff, send_yangapi_buff, yang_api_profile.content_length); if (status != OK) { continue; }#ifdef DEBUG_TRACE printf("/n</pre></body></html>/n");#endif cleanup_request(&yang_api_profile); } /* while */ yang_api_cleanup(&yang_api_profile); return status;} /* main */
开发者ID:pikagrue,项目名称:test-repository-2,代码行数:67,
示例14: mainint main(int argc, char **argv){ initialize(); while (FCGI_Accept() >= 0) { handle_request(); } return 0;}
开发者ID:paulquevedo,项目名称:raspi,代码行数:10,
示例15: main/* * A typical FastCGI main program: Initialize, then loop * calling FCGI_Accept and performing the accepted request. * Do cleanup operations incrementally between requests. */void main(void){ Initialize(); while(FCGI_Accept() >= 0) { PerformRequest(); FCGI_Finish(); GarbageCollectStep(); ConditionalCheckpoint(); }}
开发者ID:TVilaboa,项目名称:InvestigacionC,代码行数:15,
示例16: fcgiwrap_mainstatic void fcgiwrap_main(void){ signal(SIGCHLD, SIG_IGN); signal(SIGPIPE, SIG_IGN); inherited_environ = environ; while (FCGI_Accept() >= 0) { handle_fcgi_request(); }}
开发者ID:jeremyz,项目名称:fcgiwrap,代码行数:11,
示例17: mainint main(void){ while(FCGI_Accept() >= 0) { printf("Content-type: text/html/r/nStatus: 200 OK/r/n/r/n"); } return 0;}
开发者ID:jayant7k,项目名称:coding-adventure,代码行数:11,
示例18: soap_beginint dpws_discoveryService::serve(){#ifndef WITH_FASTCGI unsigned int k = this->max_keep_alive;#endif do { soap_begin(this);#ifdef WITH_FASTCGI if (FCGI_Accept() < 0) { this->error = SOAP_EOF; return soap_send_fault(this); }#endif soap_begin(this);#ifndef WITH_FASTCGI if (this->max_keep_alive > 0 && !--k) this->keep_alive = 0;#endif if (soap_begin_recv(this)) { if (this->error < SOAP_STOP) {#ifdef WITH_FASTCGI soap_send_fault(this);#else return soap_send_fault(this);#endif } soap_closesock(this); continue; } if (soap_envelope_begin_in(this) || soap_recv_header(this) || soap_body_begin_in(this) || dispatch() || (this->fserveloop && this->fserveloop(this))) {#ifdef WITH_FASTCGI soap_send_fault(this);#else return soap_send_fault(this);#endif }#ifdef WITH_FASTCGI soap_destroy(this); soap_end(this); } while (1);#else } while (this->keep_alive);
开发者ID:119-org,项目名称:TND,代码行数:54,
示例19: mainint main(void){#ifdef ENABLE_FASTCGI while(FCGI_Accept() >= 0) {#endif qentry_t *req = qcgireq_parse(NULL, 0); // fetch queries time_t expire = (time_t)req->getint(req, "expire"); char *mode = req->getstr(req, "mode", false); char *name = req->getstr(req, "name", false); char *value = req->getstr(req, "value", false); // start session. qentry_t *sess = qcgisess_init(req, NULL); // Mose case, you don't need to set timeout. this is just example if (expire > 0) qcgisess_settimeout(sess, expire); if (mode) { switch (mode[0]) { case 's': // set req->putstr(sess, name, value, true); break; case 'r': // remove req->remove(sess, name); break; case 'd': // destroy qcgisess_destroy(sess); qcgires_setcontenttype(req, "text/plain"); printf("Session destroyed./n");#ifdef ENABLE_FASTCGI continue;#else return 0;#endif case 'v': // view default: break; } } // screen out qcgires_setcontenttype(req, "text/plain"); req->print(sess, stdout, true); // save session & free allocated memories qcgisess_save(sess); sess->free(sess); req->free(req);#ifdef ENABLE_FASTCGI }#endif return 0;}
开发者ID:EdgeCaseBerg,项目名称:pChat,代码行数:54,
示例20: mainint main (){ while (FCGI_Accept() >= 0) { printf("Content-type: text/html;charset=utf-8/r/n"); cgiInit(); run(); destory(); } return 0;}
开发者ID:skyformat99,项目名称:cgi,代码行数:12,
示例21: mainvoid main(void){ int count = 0; while(FCGI_Accept() >= 0) { printf("Content-type: text/html/r/n" "/r/n" "<title>FastCGI Hello! (C, fcgi_stdio library)</title>" "<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>" "Request number %d running on host <i>%s</i>/n", ++count, getenv("SERVER_NAME")); }}
开发者ID:28msec,项目名称:fastcgi-tests,代码行数:12,
示例22: mainint main(void){ while(FCGI_Accept() >= 0) { char *query = getenv("QUERY_STRING"); char *root = getenv("DOCUMENT_ROOT"); char *script = getenv("SCRIPT_NAME"); char *request = getenv("REQUEST_URI"); printf("Content-type: text/html/r/nStatus: 200 OK/r/n/r/n"); printf("<pre>"); printf("query:%s/ndoc_root:%s/nscript:%s/nrequest_uri:%s", query, root, script, request); } return 0;}
开发者ID:pengwenbin7,项目名称:cerp,代码行数:15,
示例23: mainint main(int argc, char **argv){ if (initiate(argv[0]) == -1) return -1; if (connect_2_analyze_server(&analyze_fd) == -1) analyze_broken = 1; else analyze_broken = 0; connect_2_backup_server(&backup_fd); store_result_t result; while( FCGI_Accept() >= 0) { //用cgic初始化获取post数据 cgic_initiate(0, 0); FCGI_printf("Content-type:image/gif/r/n/r/n"); //判断数据合法性,如合法则放入result中 if( prepare_data(&result) == -1) goto continue_tag; //先发到缓存 if (backup_fd == -1) connect_2_backup_server(&backup_fd);//重新连接 if (backup_fd != -1) send_2_server(&result, &backup_fd, "backup", analyze_broken); //将数据发送出去 if (analyze_fd == -1) { if (connect_2_analyze_server(&analyze_fd) == -1)//重新连接 analyze_broken = 1; else analyze_broken = 0; } if(analyze_fd != -1) send_2_server(&result, &analyze_fd, "analyze", 0);continue_tag: //释放cgic中取数据所分配的内存 cgiFreeResources(); FCGI_Finish(); } close(analyze_fd); close(backup_fd); destroy(); return 1;}
开发者ID:Zhanyin,项目名称:taomee,代码行数:48,
示例24: mainint main(void){ int count = 0; char url[MAX_URL_SIZE]; while(FCGI_Accept() >= 0) { printf("Content-type: text/html/r/n" "/r/n" "<title>CGI Hello!</title>" "<h1>CGI Hello!</h1>" "Request number %d running on host <i>%s</i>./n<br/>", ++count, getenv("SERVER_NAME")); strcpy(url, getenv("REQUEST_URI")); printf("The request URI is: %s./n<br/>", url); } return 0;}
开发者ID:esicenter,项目名称:seminar1,代码行数:16,
示例25: mainint main (int argc, char *argv[]){ char *query_string, *method, *len = 0x0; int count = 0; int i, ilen = 0; while (FCGI_Accept() >= 0) { printf("Content-type: text/html/r/n" "/r/n" "<title>FastCGI Hello!</title>" "<h1>FastCGI Hello!</h1>" "Request number %d running on host <i>%s</i>/n", ++count, getenv("SERVER_NAME")); printf("<p>If you have configured fastcgi correctly, then " "the request number should increment every time you " "hit reload on your browser. You should also see " "/"%s/" (the name of this program) showing up in ps ax./n", argv[0]); query_string = getenv ("QUERY_STRING"); printf ("<p>The QUERY_STRING environment vairable is %s/n" "The other environment variables are:<p>", query_string); for (i = 0; environ[i]; i++) { printf ("<br>%s/n", environ[i]); } method = getenv ("REQUEST_METHOD"); if (!strcmp (method, "POST")) { char * bufp; ilen = atoi (getenv ("CONTENT_LENGTH")); printf ("<P>This is a method=post request, " "with content length=%d<P>/n", ilen); bufp = (char *) malloc (ilen); fread (bufp, ilen, 1, stdin); printf ("The POST data is<P>%s/n", bufp); free (bufp); } } return 0;}
开发者ID:573,项目名称:gnucash,代码行数:47,
示例26: mainint main(int argc, char* argv[]) { int count = 0; while (FCGI_Accept() >= 0) { printf( "Content-type: text/html/r/n" "/r/n" "<title>FastCGI Hello! (C, fcgi_stdio library)</title>/n" "<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>/n" "Query: <i>%s</i>/r/n" "Request number %d running on host <i>%s</i>/n", getenv("QUERY_STRING"), ++count, getenv("SERVER_HOSTNAME") ); }; return 0;}
开发者ID:povrazor,项目名称:MyCGI,代码行数:17,
示例27: mainint main (){ char **initialEnv = environ; int count = 0; while (FCGI_Accept() >= 0) { char *contentLength = getenv("CONTENT_LENGTH"); int len; printf("Content-type: text/html/r/n" "/r/n" "<title>FastCGI echo</title>" "<h1>FastCGI echo</h1>/n" "Request number %d, Process ID: %d<p>/n", ++count, getpid()); if (contentLength != NULL) { len = strtol(contentLength, NULL, 10); } else { len = 0; } if (len <= 0) { printf("No data from standard input.<p>/n"); } else { int i, ch; printf("Standard input:<br>/n<pre>/n"); for (i = 0; i < len; i++) { if ((ch = getchar()) < 0) { printf("Error: Not enough bytes received on standard input<p>/n"); break; } putchar(ch); } printf("/n</pre><p>/n"); } //PrintEnv("Request environment", environ); //PrintEnv("Initial environment", initialEnv); } /* while */ return 0;}
开发者ID:Strongc,项目名称:study_example,代码行数:45,
示例28: mainint main(void){ char *user, *password; user = getenv("USER"); if (user == NULL) { user = "doe"; } password = getenv("PASSWORD"); if (password == NULL) { password = "xxxx"; } FCGX_Init(); FCGX_OpenSocket(":9000", 500); while (FCGI_Accept() >= 0) { char *remoteUser, *remotePassword; remoteUser = getenv("REMOTE_USER"); remotePassword = getenv("REMOTE_PASSWD"); if ((remoteUser == NULL) || (remotePassword == NULL) || strcmp(remoteUser, user) || strcmp(remotePassword, password)) { printf("Status: 401 Unauthorized/r/n" "WWW-Authenticate: Basic realm=/"Test/"/r/n" "/r/n"); } else { char *processId = getenv("QUERY_STRING"); if (processId == NULL || strlen(processId) == 0) { processId = "0"; } printf("Status: 200 OK/r/n" "Variable-AUTH_TYPE: Basic/r/n" "Variable-REMOTE_PASSWD:/r/n" "Variable-PROCESS_ID: %s/r/n" "/r/n", processId); } } return 0;}
开发者ID:infinitude-cn,项目名称:cpp,代码行数:42,
注:本文中的FCGI_Accept函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FCLOSE函数代码示例 C++ FCEU_printf函数代码示例 |