您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ websValid函数代码示例

51自学网 2021-06-03 09:54:43
  C++
这篇教程C++ websValid函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中websValid函数的典型用法代码示例。如果您正苦于以下问题:C++ websValid函数的具体用法?C++ websValid怎么用?C++ websValid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了websValid函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: websFormHandler

int websFormHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, 	char_t *url, char_t *path, char_t *query){	sym_t		*sp;	char_t		formBuf[FNAMESIZE];	char_t		*cp, *formName;	int			(*fn)(void *sock, char_t *path, char_t *args);	a_assert(websValid(wp));	a_assert(url && *url);	a_assert(path && *path == '/');	websStats.formHits++;/* *	Extract the form name */	gstrncpy(formBuf, path, TSZ(formBuf));	if ((formName = gstrchr(&formBuf[1], '/')) == NULL) {		websError(wp, 200, T("Missing form name"));		return 1;	}	formName++;	if ((cp = gstrchr(formName, '/')) != NULL) {		*cp = '/0';	}/* *	Lookup the C form function first and then try tcl (no javascript support  *	yet). */	sp = symLookup(formSymtab, formName);	if (sp == NULL) {		websError(wp, 200, T("Form %s is not defined"), formName);	} else {		fn = (int (*)(void *, char_t *, char_t *)) sp->content.value.integer;		a_assert(fn);		if (fn) {/* *			For good practice, forms must call websDone() */			(*fn)((void*) wp, formName, query);/* *			Remove the test to force websDone, since this prevents *			the server "push" from a form> */#if 0 /* push */			if (websValid(wp)) {				websError(wp, 200, T("Form didn't call websDone"));			}#endif /* push */		}	}	return 1;}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:56,


示例2: websPageReadData

int websPageReadData(webs_t wp, char *buf, int nBytes){#ifdef WEBS_PAGE_ROM	a_assert(websValid(wp));	return websRomPageReadData(wp, buf, nBytes);#else	a_assert(websValid(wp));	return gread(wp->docfd, buf, nBytes);#endif}
开发者ID:Manish-cimcon,项目名称:micro,代码行数:11,


示例3: fileWriteEvent

/*    Do output back to the browser in the background. This is a socket write handler.    This bypasses the output buffer and writes directly to the socket. */static void fileWriteEvent(Webs *wp){    char    *buf;    ssize   len, wrote;    assert(wp);    assert(websValid(wp));    /*        Note: websWriteSocket may return less than we wanted. It will return -1 on a socket error.     */    if ((buf = walloc(ME_GOAHEAD_LIMIT_BUFFER)) == NULL) {        websError(wp, HTTP_CODE_INTERNAL_SERVER_ERROR, "Cannot get memory");        return;    }    /*        OPT - we could potentially save this buffer so that on short-writes, it does not need to be re-read.     */    while ((len = websPageReadData(wp, buf, ME_GOAHEAD_LIMIT_BUFFER)) > 0) {        if ((wrote = websWriteSocket(wp, buf, len)) < 0) {            break;        }        if (wrote != len) {            websPageSeek(wp, - (len - wrote), SEEK_CUR);            break;        }    }    wfree(buf);    if (len <= 0) {        websDone(wp);    }}
开发者ID:blueskit,项目名称:goahead,代码行数:36,


示例4: websHeader

/*    Don't use these routes. Use websWriteHeaders, websEndHeaders instead.    Write a webs header. This is a convenience routine to write a common header for a form back to the browser. */PUBLIC void websHeader(Webs *wp){    assure(websValid(wp));    websWriteHeaders(wp, -1, 0);    websWriteEndHeaders(wp);    websWrite(wp, "<html>/n");}
开发者ID:kamihouse,项目名称:goahead,代码行数:13,


示例5: websTidyUrl

static int websTidyUrl(webs_t wp){	char_t	*parts[64];					/* Array of ptr's to URL parts */	char_t	*token, *url, *tidyurl;	int		i, len, npart;	a_assert(websValid(wp));/* *	Copy the string so we don't destroy the original (yet) */	url = bstrdup(B_L, wp->url);	websDecodeUrl(url, url, gstrlen(url));	len = npart = 0;	parts[0] = NULL;	token = gstrtok(url, T("/"));/* *	Look at each directory segment and process "." and ".." segments *	Don't allow the browser to pop outside the root web.  */	while (token != NULL) {		if (gstrcmp(token, T("..")) == 0) {			if (npart > 0) {				npart--;			}		} else if (gstrcmp(token, T(".")) != 0) {			parts[npart] = token;			len += gstrlen(token) + 1;			npart++;		}		token = gstrtok(NULL, T("/"));	}/* *	Re-construct URL. Need extra space all "/" and null. */	if (npart || (gstrcmp(url, T("/")) == 0) || (url[0] == '/0')) {		tidyurl = balloc(B_L, (len + 2) * sizeof(char_t));		*tidyurl = '/0';		for (i = 0; i < npart; i++) {			gstrcat(tidyurl, T("/"));			gstrcat(tidyurl, parts[i]);		}		bfree(B_L, url);		bfree(B_L, wp->url);		wp->url = tidyurl;		return 0;	} else {		bfree(B_L, url);		return -1;	}}
开发者ID:sd-eblana,项目名称:bawx,代码行数:58,


示例6: uploadHandler

/*    The upload handler functions as a filter. It never actually handles a request */static bool uploadHandler(Webs *wp){    assert(websValid(wp));    if (!(wp->flags & WEBS_UPLOAD)) {        return 0;    }    return initUpload(wp);}
开发者ID:Truhigh,项目名称:goahead,代码行数:12,


示例7: websPageSeek

void websPageSeek(webs_t wp, long offset){	a_assert(websValid(wp));#ifdef WEBS_PAGE_ROM	websRomPageSeek(wp, offset, SEEK_CUR);#else	glseek(wp->docfd, offset, SEEK_CUR);#endif}
开发者ID:Manish-cimcon,项目名称:micro,代码行数:10,


示例8: websPageOpen

int websPageOpen(webs_t wp, char_t *lpath, char_t *path, int mode, int perm){	a_assert(websValid(wp));#ifdef WEBS_PAGE_ROM	return websRomPageOpen(wp, path, mode, perm);#else	return (wp->docfd = gopen(lpath, mode, perm));#endif /* WEBS_PAGE_ROM */}
开发者ID:Manish-cimcon,项目名称:micro,代码行数:10,


示例9: websDefaultWriteEvent

static void websDefaultWriteEvent(webs_t wp){	int		len, wrote, flags, bytes, written;	char	*buf;	a_assert(websValid(wp));	flags = websGetRequestFlags(wp);	websSetTimeMark(wp);	wrote = bytes = 0;	written = websGetRequestWritten(wp);/* *	We only do this for non-ASP documents */	if ( !(flags & WEBS_ASP)) {		bytes = websGetRequestBytes(wp);/* *		Note: websWriteDataNonBlock may return less than we wanted. It will *		return -1 on a socket error */		if ((buf = balloc(B_L, PAGE_READ_BUFSIZE)) == NULL) {			websError(wp, 200, T("Can't get memory"));		} else {			while ((len = websPageReadData(wp, buf, PAGE_READ_BUFSIZE)) > 0) {				if ((wrote = websWriteDataNonBlock(wp, buf, len)) < 0) {					break;				}				written += wrote;				if (wrote != len) {					websPageSeek(wp, - (len - wrote));					break;				}			}/* *			Safety. If we are at EOF, we must be done */			if (len == 0) {				a_assert(written >= bytes);				written = bytes;			}			bfree(B_L, buf);		}	}/* *	We're done if an error, or all bytes output */	websSetRequestWritten(wp, written);	if (wrote < 0 || written >= bytes) {		websDone(wp, 200);	}}
开发者ID:epicsdeb,项目名称:rtems,代码行数:55,


示例10: websPageClose

void websPageClose(webs_t wp){	a_assert(websValid(wp));#ifdef WEBS_PAGE_ROM	websRomPageClose(wp->docfd);#else	if (wp->docfd >= 0) {		gclose(wp->docfd);		wp->docfd = -1;	}#endif}
开发者ID:Manish-cimcon,项目名称:micro,代码行数:13,


示例11: websPageOpen

int websPageOpen(webs_t wp, char_t *lpath, char_t *path, int mode, int perm){#if defined(WIN32)	errno_t	error;#endif	a_assert(websValid(wp));#ifdef WEBS_PAGE_ROM	return websRomPageOpen(wp, path, mode, perm);#elif defined(WIN32)	error = _sopen_s(&(wp->docfd), lpath, mode, _SH_DENYNO, _S_IREAD);	return (wp->docfd = gopen(lpath, mode, _S_IREAD));#else	return (wp->docfd = gopen(lpath, mode, perm));#endif /* WEBS_PAGE_ROM */}
开发者ID:18959263172,项目名称:httpserver,代码行数:15,


示例12: websRomPageOpen

int websRomPageOpen(webs_t wp, char_t *path, int mode, int perm){	websRomPageIndexType	*wip;	sym_t					*sp;	a_assert(websValid(wp));	a_assert(path && *path);	if ((sp = symLookup(romTab, path)) == NULL) {		return -1;	}	wip = (websRomPageIndexType*) sp->content.value.integer;	wip->pos = 0;	return (wp->docfd = wip - websRomPageIndex);}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:15,


示例13: websRomPageReadData

int websRomPageReadData(webs_t wp, char *buf, int nBytes){	websRomPageIndexType	*wip;	int						len;	a_assert(websValid(wp));	a_assert(buf);	a_assert(wp->docfd >= 0);	wip = &websRomPageIndex[wp->docfd];	len = min(wip->size - wip->pos, nBytes);	memcpy(buf, &wip->page[wip->pos], len);	wip->pos += len;	return len;}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:16,


示例14: websPublishHandler

static int websPublishHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, 	int sid, char_t *url, char_t *path, char_t *query){	int		len;	a_assert(websValid(wp));	a_assert(path);/* *	Trim the urlPrefix off the path and set the webdirectory. Add one to step  *	over the trailing '/' */	len = gstrlen(urlPrefix) + 1;	websSetRequestPath(wp, webDir, &path[len]);	return 0;}
开发者ID:sd-eblana,项目名称:bawx,代码行数:16,


示例15: write

/*    Javascript write command. This implemements <% write("text"); %> command */PUBLIC int websJstWrite(int jid, Webs *wp, int argc, char **argv){    int     i;    assert(websValid(wp));    for (i = 0; i < argc; ) {        assert(argv);        if (websWriteBlock(wp, argv[i], strlen(argv[i])) < 0) {            return -1;        }        if (++i < argc) {            if (websWriteBlock(wp, " ", 1) < 0) {                return -1;            }        }    }    return 0;}
开发者ID:hockeydennisk,项目名称:goahead,代码行数:22,


示例16: websAspWrite

int websAspWrite(int ejid, webs_t wp, int argc, char_t **argv){	int		i;	a_assert(websValid(wp));	for (i = 0; i < argc; ) {		a_assert(argv);		if (websWriteBlock(wp, argv[i], gstrlen(argv[i])) < 0) {			return -1;		}		if (++i < argc) {			if (websWriteBlock(wp, T(" "), 2) < 0) {				return -1;			}		}	}	return 0;}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:19,


示例17: actionHandler

/*    Process an action request. Returns 1 always to indicate it handled the URL */static bool actionHandler(Webs *wp){    WebsKey     *sp;    char        actionBuf[BIT_GOAHEAD_LIMIT_URI + 1];    char        *cp, *actionName;    WebsAction  fn;    assert(websValid(wp));    assert(actionTable >= 0);    /*        Extract the action name     */    scopy(actionBuf, sizeof(actionBuf), wp->path);    if ((actionName = strchr(&actionBuf[1], '/')) == NULL) {        websError(wp, HTTP_CODE_NOT_FOUND, "Missing action name");        return 1;    }    actionName++;    if ((cp = strchr(actionName, '/')) != NULL) {        *cp = '/0';    }    /*        Lookup the C action function first and then try tcl (no javascript support yet).     */    sp = hashLookup(actionTable, actionName);    if (sp == NULL) {        websError(wp, HTTP_CODE_NOT_FOUND, "Action %s is not defined", actionName);    } else {        fn = (WebsAction) sp->content.value.symbol;        assert(fn);        if (fn) {#if BIT_GOAHEAD_LEGACY            (*((WebsProc) fn))((void*) wp, actionName, wp->query);#else            (*fn)((void*) wp);#endif        }    }    return 1;}
开发者ID:aifler,项目名称:goahead,代码行数:44,


示例18: actionHandler

/*    Process an action request. Returns 1 always to indicate it handled the URL */static bool actionHandler(Webs *wp){    WebsKey     *sp;    char        formBuf[BIT_LIMIT_FILENAME];    char        *cp, *formName;    WebsAction  fn;    assure(websValid(wp));    assure(formSymtab >= 0);    /*        Extract the form name     */    scopy(formBuf, sizeof(formBuf), wp->path);    if ((formName = strchr(&formBuf[1], '/')) == NULL) {        websError(wp, HTTP_CODE_NOT_FOUND, "Missing form name");        return 1;    }    formName++;    if ((cp = strchr(formName, '/')) != NULL) {        *cp = '/0';    }    /*        Lookup the C form function first and then try tcl (no javascript support yet).     */    sp = hashLookup(formSymtab, formName);    if (sp == NULL) {        websError(wp, HTTP_CODE_NOT_FOUND, "Action %s is not defined", formName);    } else {        fn = (WebsAction) sp->content.value.symbol;        assure(fn);        if (fn) {#if BIT_LEGACY            (*fn)((void*) wp, formName, wp->query);#else            (*fn)((void*) wp);#endif        }    }    return 1;}
开发者ID:kamihouse,项目名称:goahead,代码行数:44,


示例19: websRomPageSeek

long websRomPageSeek(webs_t wp, long offset, int origin){	websRomPageIndexType	*wip;	long pos;	a_assert(websValid(wp));	a_assert(origin == SEEK_SET || origin == SEEK_CUR || origin == SEEK_END);	a_assert(wp->docfd >= 0);	wip = &websRomPageIndex[wp->docfd];	if (origin != SEEK_SET && origin != SEEK_CUR && origin != SEEK_END) {		errno = EINVAL;		return -1;	}	if (wp->docfd < 0) {		errno = EBADF;		return -1;	}	pos = offset;	switch (origin) {	case SEEK_CUR:		pos = wip->pos + offset;		break;	case SEEK_END:		pos = wip->size + offset;		break;	default:		break;	}	if (pos < 0) {		errno = EBADF;		return -1;	}	return (wip->pos = pos);}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:40,


示例20: websHeader

void websHeader(webs_t wp){	a_assert(websValid(wp));	websWrite(wp, T("HTTP/1.0 200 OK/n"));/* *	By license terms the following line of code must not be modified */	websWrite(wp, T("Server: %s/r/n"), WEBS_NAME);	websWrite(wp, T("Pragma: no-cache/n"));	websWrite(wp, T("Cache-control: no-cache/n"));	websWrite(wp, T("Content-Type: text/html/n"));	websWrite(wp, T("/n"));	websWrite(wp, T("<html>/n<head>/n"));	websWrite(wp, T("<title>My Title</title>"));	websWrite(wp, T("<link rel=/"stylesheet/" href=/"/style/normal_ws.css/"/				type=/"text/css/">"));	websWrite(wp, T("<meta http-equiv=/"content-type/" content=/"text/html;/				charset=utf-8/">"));	websWrite(wp, T("</head>/n<body>/n"));}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:23,


示例21: websFooter

void websFooter(webs_t wp){	a_assert(websValid(wp));	websWrite(wp, T("</body>/n</html>/n"));}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:6,


示例22: websCgiHandler

/* *	Process a form request. Returns 1 always to indicate it handled the URL */int websCgiHandler(webs_t wp, char_t *urlPrefix, char_t *webDir, int arg, 		char_t *url, char_t *path, char_t* query){	cgiRec		*cgip;	sym_t		*s;	char_t		cgiBuf[FNAMESIZE], *stdIn, *stdOut, cwd[FNAMESIZE];	char_t		*cp, *cgiName, *cgiPath, **argp, **envp, **ep;	int			n, envpsize, argpsize, pHandle, cid;	a_assert(websValid(wp));	a_assert(url && *url);	a_assert(path && *path == '/');	websStats.cgiHits++;/* *	Extract the form name and then build the full path name.  The form *	name will follow the first '/' in path. */	gstrncpy(cgiBuf, path, TSZ(cgiBuf));	if ((cgiName = gstrchr(&cgiBuf[1], '/')) == NULL) {		websError(wp, 200, T("Missing CGI name"));		return 1;	}	cgiName++;	if ((cp = gstrchr(cgiName, '/')) != NULL) {		*cp = '/0';	}	fmtAlloc(&cgiPath, FNAMESIZE, T("%s/%s/%s"), websGetDefaultDir(),		CGI_BIN, cgiName);#ifndef VXWORKS/* *	See if the file exists and is executable.  If not error out. *	Don't do this step for VxWorks, since the module may already *	be part of the OS image, rather than in the file system. */	{		gstat_t		sbuf;		if (gstat(cgiPath, &sbuf) != 0 || (sbuf.st_mode & S_IFREG) == 0) {			websError(wp, 200, T("CGI process file does not exist"));			bfree(B_L, cgiPath);			return 1;		}#if (defined (WIN) || defined (CE))		if (gstrstr(cgiPath, T(".exe")) == NULL &&			gstrstr(cgiPath, T(".bat")) == NULL) {#elif (defined (NW))			if (gstrstr(cgiPath, T(".nlm")) == NULL) {#else		if (gaccess(cgiPath, X_OK) != 0) {#endif /* WIN || CE */			websError(wp, 200, T("CGI process file is not executable"));			bfree(B_L, cgiPath);			return 1;		}	}#endif /* ! VXWORKS */         /* *	Get the CWD for resetting after launching the child process CGI */	ggetcwd(cwd, FNAMESIZE);/* *	Retrieve the directory of the child process CGI */	if ((cp = gstrrchr(cgiPath, '/')) != NULL) {		*cp = '/0';		gchdir(cgiPath);		*cp = '/';	}/* *	Build command line arguments.  Only used if there is no non-encoded *	= character.  This is indicative of a ISINDEX query.  POST separators *	are & and others are +.  argp will point to a balloc'd array of  *	pointers.  Each pointer will point to substring within the *	query string.  This array of string pointers is how the spawn or  *	exec routines expect command line arguments to be passed.  Since  *	we don't know ahead of time how many individual items there are in *	the query string, the for loop includes logic to grow the array  *	size via brealloc. */	argpsize = 10;	argp = balloc(B_L, argpsize * sizeof(char_t *));	*argp = cgiPath;	n = 1;	if (gstrchr(query, '=') == NULL) {		websDecodeUrl(query, query, gstrlen(query));		for (cp = gstrtok(query, T(" ")); cp != NULL; ) {			*(argp+n) = cp;			n++;			if (n >= argpsize) {				argpsize *= 2;				argp = brealloc(B_L, argp, argpsize * sizeof(char_t *));//.........这里部分代码省略.........
开发者ID:Bytewerk,项目名称:uClinux-ipcam,代码行数:101,


示例23: websProcessUploadData

PUBLIC int websProcessUploadData(Webs *wp) {    char    *line, *nextTok;    ssize   len, nbytes;    int     done, rc;        for (done = 0, line = 0; !done; ) {        if  (wp->uploadState == UPLOAD_BOUNDARY || wp->uploadState == UPLOAD_CONTENT_HEADER) {            /*                Parse the next input line             */            line = wp->input.servp;            if ((nextTok = memchr(line, '/n', bufLen(&wp->input))) == 0) {                /* Incomplete line */                break;            }            *nextTok++ = '/0';            nbytes = nextTok - line;            websConsumeInput(wp, nbytes);            strim(line, "/r", WEBS_TRIM_END);            len = strlen(line);            if (line[len - 1] == '/r') {                line[len - 1] = '/0';            }        }        switch (wp->uploadState) {        case 0:            if (initUpload(wp) < 0) {                done++;            }            break;        case UPLOAD_BOUNDARY:            if (processContentBoundary(wp, line) < 0) {                done++;            }            break;        case UPLOAD_CONTENT_HEADER:            if (processUploadHeader(wp, line) < 0) {                done++;            }            break;        case UPLOAD_CONTENT_DATA:            if ((rc = processContentData(wp)) < 0) {                done++;            }            if (bufLen(&wp->input) < wp->boundaryLen) {                /*  Incomplete boundary - return to get more data */                done++;            }            break;        case UPLOAD_CONTENT_END:            done++;            break;        }    }    if (!websValid(wp)) {        return -1;    }    bufCompact(&wp->input);    return 0;}
开发者ID:Truhigh,项目名称:goahead,代码行数:65,


示例24: websValidateUrl

int websValidateUrl(webs_t wp, char_t *path){   /*     Thanks to Dhanwa T ([email
C++ websWrite函数代码示例
C++ websGetVar函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。