这篇教程C++ url_decode函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中url_decode函数的典型用法代码示例。如果您正苦于以下问题:C++ url_decode函数的具体用法?C++ url_decode怎么用?C++ url_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了url_decode函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: qstring_next_pair/* parse a cgi query string returning one key-value pair at a time */bool qstring_next_pair(const char *qstring, char *buf, char **vbuf, uint32_t buflen) { static const char *q = NULL; char *eob; // set up if not currently working on a qstring if (q == NULL) q = qstring; if (*q == '/0') { q = NULL; // set internal state (no work in progress) return false; // signal this query string is fully parsed } eob = buf + buflen - 1; *vbuf = buf; // in case there is no '=' while (*q != '/0') { if (buf >= eob) // check for buffer overflow break; if (*q == '=') { *buf++ = '/0'; *vbuf = buf; ++q; } else if (*q == '&') { ++q; break; } else { *buf++ = *q++; } } *buf = '/0'; // terminate value string url_decode(buf); if (*vbuf != buf) url_decode(*vbuf); return true;}
开发者ID:cengelen,项目名称:BliksemWP,代码行数:34,
示例2: url_parse_paramstatic int url_parse_param(const char* param, url_t* uri){ const char *pn, *pv; char buffer[MAX_PATH]; url_param_t *pp; for(pn = param; param && *param && uri->count < MAX_PARAMS; pn=param+1) { param = strchr(pn, '&'); pv = strchr(pn, '='); if(!pv || pv == pn || (param && pv>param)) // name is null continue; memset(buffer, 0, sizeof(buffer)); pp = &uri->params[uri->count++]; url_decode(pn, pv-pn, buffer, sizeof(buffer)); pp->name = strdup(buffer); ++pv; if(param) { url_decode(pv, param-pv, buffer, sizeof(buffer)); } else { url_decode(pv, -1, buffer, sizeof(buffer)); } pp->value = strdup(buffer); } return 0;}
开发者ID:azalpy,项目名称:sdk,代码行数:32,
示例3: http_alarmvoid http_alarm(char *rx, unsigned int rx_len){ unsigned int i, save; char *time, *item; ALARMTIME t; save=0; time=0; item=0; for(; rx_len!=0;) { if(strncmpi(rx, "time=", 5) == 0) { rx += 5; rx_len -= 5; time = rx; i = url_decode(rx, rx, rx_len); rx += i; rx_len -= i; } else if(strncmpi(rx, "item=", 5) == 0) { rx += 5; rx_len -= 5; item = rx; i = url_decode(rx, rx, rx_len); rx += i; rx_len -= i; } else if(strncmpi(rx, "save=", 5) == 0) { rx += 5; rx_len -= 5; save = 1; } else { rx++; rx_len--; } } if(save && time && item) { if((strlen(time) > 3) || (strlen(item) > 0)) { i = atoi(item); alarm_parsetime(time, &t); alarm_settime(i, &t); alarm_load(); menu_drawwnd(1); } } return;}
开发者ID:Bob4ik888,项目名称:WebRadio,代码行数:34,
示例4: parse_getstatic void parse_get( value *p, const char *args ) { char *aand, *aeq, *asep; value tmp; while( true ) { aand = strchr(args,'&'); if( aand == NULL ) { asep = strchr(args,';'); aand = asep; } else { asep = strchr(args,';'); if( asep != NULL && asep < aand ) aand = asep; } if( aand != NULL ) *aand = 0; aeq = strchr(args,'='); if( aeq != NULL ) { *aeq = 0; tmp = alloc_array(3); val_array_ptr(tmp)[0] = url_decode(args,(int)(aeq-args)); val_array_ptr(tmp)[1] = url_decode(aeq+1,(int)strlen(aeq+1)); val_array_ptr(tmp)[2] = *p; *p = tmp; *aeq = '='; } if( aand == NULL ) break; *aand = (aand == asep)?';':'&'; args = aand+1; }}
开发者ID:HaxeFoundation,项目名称:neko,代码行数:31,
示例5: parse_urlstruct url parse_url(char *uri, char *query){ struct url url = {0}; char *dir, *name; unsigned i; if (!(dir = strtok(uri, "/"))) { /* * strtok() never return an empty string. And that's * what we usually want, because "/players/" will be * handled the same than "/players". * * However, the root route doesn't have a name, hence * the default page doesn't either. So to allow default * page for root directory, we make a special case and * use an empty string. */ strcpy(uri, ""); url.dirs[0] = uri; url.ndirs = 1; } else { do { if (url.ndirs == MAX_DIRS) error(414, NULL); url_decode(dir); url.dirs[url.ndirs] = dir; url.ndirs++; } while ((dir = strtok(NULL, "/"))); } /* * Load arg 'name' and 'val' in two steps to not mix up strtok() * instances. */ if (query[0] == '/0') return url; name = strtok(query, "&"); while (name) { if (url.nargs == MAX_ARGS) error(414, NULL); url.args[url.nargs].name = name; url.nargs++; name = strtok(NULL, "&"); } for (i = 0; i < url.nargs; i++) { strtok(url.args[i].name, "="); url.args[i].val = strtok(NULL, "="); if (url.args[i].val) url_decode(url.args[i].val); } return url;}
开发者ID:needs,项目名称:teerank,代码行数:59,
示例6: test_url_decodevoid test_url_decode() { char buf[20]; url_decode(buf, "/foo%20bar"); info("URL decoded: %s", buf); assert(strcmp("/foo bar", buf) == 0); url_decode(buf, "/%E4%B8%AD%E5%9B%BD%E4%BA%BA"); info("URL decoded: %s", buf); assert(strcmp("/中国人", buf) == 0);}
开发者ID:doop-ymc,项目名称:breeze,代码行数:9,
示例7: g_hash_newGHashTable *http_parse_header (http_request *h, gchar *req) { GHashTable *head = g_hash_new(); gchar **lines, **items, *key, *val, *p, prefix[50]; guint i; h->method = NULL; h->uri = NULL; h->header = head; if (req == NULL) return head; lines = g_strsplit( req, "/r/n", 0 ); if (lines == NULL || lines[0] == NULL) return head; items = g_strsplit( lines[0], " ", 3 ); h->method = g_strdup( items[0] ); h->uri = g_strdup( items[1] ); // if (CONFd("Verbosity") >= 8) g_message( "http_parse_header: method_len: %d, uri_len: %d", strlen(h->method), strlen(h->uri)); if (CONFd("Verbosity") >= 8) g_message( "http_parse_header: Method: %s", h->method ); if (CONFd("Verbosity") >= 8) g_message( "http_parse_header: URI: %s", url_decode(h->uri) ); g_strfreev( items ); for (i = 1; lines[i] != NULL && lines[i][0] != '/0'; i++ ) { key = lines[i]; val = strchr(key, ':'); if (val != NULL) { /* Separate the key from the value */ *val = '/0'; /* Normalize key -- lowercase every after 1st char */ for (p = key + 1; *p != '/0'; p++) *p = tolower(*p); /* Strip ": " plus leading and trailing space from val */ g_strchomp( val += 2 ); // ": " //if ( strcmp(key, "Referer" )== 0) { // if (CONFd("Verbosity") >= 8) g_message("http_parse_header: Referer: %s", url_decode(val) ); //} //else { if (CONFd("Verbosity") >= 8) { g_snprintf(prefix, 50, "http_parse_header: %s: ", key); syslog_message(prefix, url_decode(val), strlen(url_decode(val)) ); } g_hash_set( head, key, val ); //} } } g_strfreev( lines ); h->header = head; return head;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:57,
示例8: parse_parameters/** * Parses the query string into parameters */static void parse_parameters(multimap_t * const params, char * query_string){ if (query_string) { size_t query_string_len = strlen(query_string); char * buf = query_string; char * end_buf = buf + query_string_len; char * key = NULL; size_t key_len = 0; char * value = NULL; size_t value_len = 0; while (buf < end_buf) { char * end = strpbrk(buf, "=&;#"); size_t len = end ? end - buf : end_buf - buf; char next = end ? *end : 0; switch (next) { case '=': { key = buf; key_len = len; } break; case '&': case ';': case '#': case '/0': { if (key) { value = buf; value_len = len; } else { // key with no value key = buf; key_len = len; value = ""; value_len = 0; } char * decoded_key = url_decode(key, key_len); char * decoded_value = url_decode(value, value_len); multimap_put(params, decoded_key, decoded_value); key = NULL; value = NULL; } break; } buf += len + 1; } }}
开发者ID:gregory144,项目名称:prism-web-server,代码行数:55,
示例9: http_auth_initstatic void http_auth_init(const char *url){ char *at, *colon, *cp, *slash, *decoded; int len; cp = strstr(url, "://"); if (!cp) return; /* * Ok, the URL looks like "proto://something". Which one? * "proto://<user>:<pass>@<host>/...", * "proto://<user>@<host>/...", or just * "proto://<host>/..."? */ cp += 3; at = strchr(cp, '@'); colon = strchr(cp, ':'); slash = strchrnul(cp, '/'); if (!at || slash <= at) return; /* No credentials */ if (!colon || at <= colon) { /* Only username */ len = at - cp; user_name = xmalloc(len + 1); memcpy(user_name, cp, len); user_name[len] = '/0'; decoded = url_decode(user_name); free(user_name); user_name = decoded; user_pass = NULL; } else { len = colon - cp; user_name = xmalloc(len + 1); memcpy(user_name, cp, len); user_name[len] = '/0'; decoded = url_decode(user_name); free(user_name); user_name = decoded; len = at - (colon + 1); user_pass = xmalloc(len + 1); memcpy(user_pass, colon + 1, len); user_pass[len] = '/0'; decoded = url_decode(user_pass); free(user_pass); user_pass = decoded; }}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:48,
示例10: parseURLint parseURL(ExHttp *pHttp){ /* we should treat URL carefully to prevent security issues. */ char *ePos = NULL; char *pBuf = pHttp->curPos; TRIM_HEAD(&pBuf); pHttp->url = pBuf; SKIP(&pBuf, ' '); TRIMI_LB_TAIL(pBuf); TRIM_HEAD(&pBuf); pHttp->protocol = pBuf; SKIP(&pBuf, '/n'); TRIMI_LB_TAIL(pBuf); pHttp->curPos = pBuf; pHttp->queryString = NULL; if (*(pHttp->method) == 'G') { /* if URL is empty, take index file as default */ if (*(pHttp->url) == '/0') { pHttp->url = (char *) IndexFile; } else if ((ePos = strchr(pHttp->url, '?')) != NULL) { *ePos = '/0'; pHttp->queryString = ++ePos; pHttp->paramEndPos = find_lb_end(pHttp->protocol); } } /* convert URL to UTF-8 encoding */ return url_decode(pHttp->url, pHttp->url, 0);}
开发者ID:Jay87682,项目名称:eserv,代码行数:32,
示例11: URLDecodestatic std::string URLDecode(const std::string& url) { char* s = url_decode(url.c_str()); std::string result = s; free(s); return result;}
开发者ID:Royalone-mobile,项目名称:roboTV,代码行数:7,
示例12: parse_struct_infostatic intparse_struct_info (unsigned char *where, size_t length, const char *start, const char *end, P11KitUri *uri){ unsigned char *value; size_t value_length; int ret; assert (start <= end); ret = url_decode (start, end, &value, &value_length); if (ret < 0) return ret; /* Too long, shouldn't match anything */ if (value_length > length) { free (value); uri->unrecognized = 1; return 1; } memset (where, ' ', length); memcpy (where, value, value_length); free (value); return 1;}
开发者ID:tjwei,项目名称:WebKitGtkKindleDXG,代码行数:27,
示例13: parse_string_attributestatic intparse_string_attribute (const char *name, const char *start, const char *end, P11KitUri *uri){ unsigned char *value; CK_ATTRIBUTE attr; size_t length; int ret; assert (start <= end); if (strcmp ("id", name) == 0) attr.type = CKA_ID; else if (strcmp ("object", name) == 0) attr.type = CKA_LABEL; else return 0; ret = url_decode (start, end, &value, &length); if (ret < 0) return ret; attr.pValue = value; attr.ulValueLen = length; uri_take_attribute (uri, &attr); return 1;}
开发者ID:tjwei,项目名称:WebKitGtkKindleDXG,代码行数:27,
示例14: mainint main(){ formu.lu = 1; tt_nsconnect("ns-server.epita.fr", 4242, "EdzC*nO4", "poulai_f"); /*tt_nsgetinfo("poulai_f");*/ /*tt_nssendmsg("poulai_f", "si ce message appara C++ url_encode函数代码示例 C++ url_close函数代码示例
|