本文整理汇总了C++中ejsToMulti函数的典型用法代码示例。如果您正苦于以下问题:C++ ejsToMulti函数的具体用法?C++ ejsToMulti怎么用?C++ ejsToMulti使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ejsToMulti函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: secure
/*
function secure(keyFile: Path, certFile: Path!, protocols: Array? = null, ciphers: Array? = null): Void
*/
static EjsObj *hs_secure(Ejs *ejs, EjsHttpServer *sp, int argc, EjsObj **argv)
{
#if BIT_PACK_SSL
EjsArray *protocols;
cchar *token;
int mask, protoMask, i;
if (sp->ssl == 0 && ((sp->ssl = mprCreateSsl(1)) == 0)) {
return 0;
}
if (!ejsIs(ejs, argv[0], Null)) {
mprSetSslKeyFile(sp->ssl, ejsToMulti(ejs, argv[0]));
}
if (!ejsIs(ejs, argv[1], Null)) {
mprSetSslCertFile(sp->ssl, ejsToMulti(ejs, argv[1]));
}
if (argc >= 3 && ejsIs(ejs, argv[2], Array)) {
protocols = (EjsArray*) argv[2];
protoMask = 0;
for (i = 0; i < protocols->length; i++) {
token = ejsToMulti(ejs, ejsGetProperty(ejs, protocols, i));
mask = -1;
if (*token == '-') {
token++;
mask = 0;
} else if (*token == '+') {
token++;
}
if (scaselesscmp(token, "SSLv2") == 0) {
protoMask &= ~(MPR_PROTO_SSLV2 & ~mask);
protoMask |= (MPR_PROTO_SSLV2 & mask);
} else if (scaselesscmp(token, "SSLv3") == 0) {
protoMask &= ~(MPR_PROTO_SSLV3 & ~mask);
protoMask |= (MPR_PROTO_SSLV3 & mask);
} else if (scaselesscmp(token, "TLSv1") == 0) {
protoMask &= ~(MPR_PROTO_TLSV1 & ~mask);
protoMask |= (MPR_PROTO_TLSV1 & mask);
} else if (scaselesscmp(token, "ALL") == 0) {
protoMask &= ~(MPR_PROTO_ALL & ~mask);
protoMask |= (MPR_PROTO_ALL & mask);
}
}
mprSetSslProtocols(sp->ssl, protoMask);
}
if (argc >= 4 && ejsIs(ejs, argv[3], Array)) {
mprSetSslCiphers(sp->ssl, ejsToMulti(ejs, argv[3]));
}
#else
ejsThrowReferenceError(ejs, "SSL support was not included in the build");
#endif
return 0;
}
开发者ID:monmarzia,项目名称:ejs-2,代码行数:58,代码来源:ejsHttpServer.c
示例2: setCredentials
/*
function setCredentials(username: String?, password: String?, authType: String?): Void
*/
static EjsObj *http_setCredentials(Ejs *ejs, EjsHttp *hp, int argc, EjsObj **argv)
{
cchar *authType, *password, *user;
user = (argc <= 0) ? 0 : ejsToMulti(ejs, argv[0]);
password = (argc <= 1) ? 0 : ejsToMulti(ejs, argv[1]);
authType = (argc <= 2) ? 0 : ejsToMulti(ejs, argv[2]);
if (ejsIs(ejs, argv[0], Null)) {
httpResetCredentials(hp->conn);
} else {
httpSetCredentials(hp->conn, user, password, authType);
}
return 0;
}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:17,代码来源:ejsHttp.c
示例3: method
/*
function set method(value: String): Void
*/
static EjsObj *http_set_method(Ejs *ejs, EjsHttp *hp, int argc, EjsObj **argv)
{
cchar *method;
method = ejsToMulti(ejs, argv[0]);
if (strcmp(method, "DELETE") != 0 && strcmp(method, "GET") != 0 && strcmp(method, "HEAD") != 0 &&
strcmp(method, "OPTIONS") != 0 && strcmp(method, "POST") != 0 && strcmp(method, "PUT") != 0 &&
strcmp(method, "TRACE") != 0) {
ejsThrowArgError(ejs, "Unknown HTTP method");
return 0;
}
hp->method = ejsToMulti(ejs, argv[0]);
return 0;
}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:17,代码来源:ejsHttp.c
示例4: component
/*
Encode a Uri component (ECMA Standard)
static function encodeComponent(str: String): String
*/
static EjsObj *encodeURIComponent(Ejs *ejs, EjsObj *unused, int argc, EjsObj **argv)
{
char *encoded;
encoded = mprUriEncode(ejsToMulti(ejs, argv[0]), MPR_ENCODE_JS_URI_COMPONENT);
return (EjsObj*) ejsCreateStringFromAsc(ejs, encoded);
}
开发者ID:monmarzia,项目名称:ejs-2,代码行数:11,代码来源:ejsUri.c
示例5: exit
/*
Exit the application
static function exit(status: Number, how: String = "default"): void
MOB - status is not implemented
*/
static EjsObj *app_exit(Ejs *ejs, EjsObj *unused, int argc, EjsObj **argv)
{
cchar *how;
int status, mode;
if (ejs->dontExit) {
ejsThrowStateError(ejs, "App.exit has been disabled");
return 0;
}
status = argc >= 1 ? ejsGetInt(ejs, argv[0]) : 0;
how = ejsToMulti(ejs, argc >= 2 ? ejsToString(ejs, argv[1]): ESV(empty));
if (scmp(how, "default") == 0) {
mode = MPR_EXIT_DEFAULT;
} else if (scmp(how, "immediate") == 0) {
mode = MPR_EXIT_IMMEDIATE;
} else if (scmp(how, "graceful") == 0) {
mode = MPR_EXIT_GRACEFUL;
} else {
mode = MPR_EXIT_NORMAL;
}
mprTerminate(mode, status);
ejsAttention(ejs);
return 0;
}
开发者ID:liexusong,项目名称:ejs-2,代码行数:30,代码来源:ejsApp.c
示例6: chdir
/*
Set the current working directory
function chdir(value: String|Path): void
*/
static EjsObj *app_chdir(Ejs *ejs, EjsObj *unused, int argc, EjsObj **argv)
{
cchar *path;
assert(argc == 1);
if (ejsIs(ejs, argv[0], Path)) {
path = ((EjsPath*) argv[0])->value;
} else if (ejsIs(ejs, argv[0], String)) {
path = ejsToMulti(ejs, argv[0]);
} else {
ejsThrowIOError(ejs, "Bad path");
return NULL;
}
#if WINDOWS
{
MprFileSystem *fs;
fs = mprLookupFileSystem(path);
if (!mprPathExists(path, X_OK) && *path == '/') {
path = sjoin(fs->cygwin, path, NULL);
}
}
#endif
if (chdir((char*) path) < 0) {
ejsThrowIOError(ejs, "Cannot change the current directory");
}
return 0;
}
开发者ID:leemit,项目名称:ejscript,代码行数:34,代码来源:ejsApp.c
示例7: assert
static EjsObj *loadXml(Ejs *ejs, EjsXML *xml, int argc, EjsObj **argv)
{
MprFile *file;
MprXml *xp;
cchar *filename;
assert(argc == 1 && ejsIs(ejs, argv[0], String));
filename = ejsToMulti(ejs, argv[0]);
file = mprOpenFile(filename, O_RDONLY, 0664);
if (file == 0) {
ejsThrowIOError(ejs, "Cannot open: %s", filename);
return 0;
}
// TODO - convert to open/close
xp = ejsCreateXmlParser(ejs, xml, filename);
if (xp == 0) {
ejsThrowMemoryError(ejs);
mprCloseFile(file);
return 0;
}
mprXmlSetInputStream(xp, readFileData, (void*) file);
if (mprXmlParse(xp) < 0 && !ejsHasException(ejs)) {
ejsThrowIOError(ejs, "Cannot parse XML file: %s\nDetails %s", filename, mprXmlGetErrorMsg(xp));
}
mprCloseFile(file);
return 0;
}
开发者ID:embedthis,项目名称:ejscript,代码行数:29,代码来源:ejsXML.c
示例8: createSearch
/*
Get a default search path. NOTE: this does not modify ejs->search.
function get createSearch(searchPaths: String): Array
*/
static EjsArray *app_createSearch(Ejs *ejs, EjsObj *app, int argc, EjsObj **argv)
{
cchar *searchPath;
searchPath = (argc == 0) ? NULL : ejsToMulti(ejs, argv[0]);
return ejsCreateSearchPath(ejs, searchPath);
}
开发者ID:leemit,项目名称:ejscript,代码行数:11,代码来源:ejsApp.c
示例9: postMessage
/*
Post a message to this worker. Note: the worker is the destination worker which may be the parent.
function postMessage(data: Object, ports: Array = null): Void
*/
static EjsObj *workerPostMessage(Ejs *ejs, EjsWorker *worker, int argc, EjsObj **argv)
{
EjsString *data;
EjsWorker *target;
MprDispatcher *dispatcher;
Message *msg;
if (worker->state >= EJS_WORKER_CLOSED) {
ejsThrowStateError(ejs, "Worker has completed");
return 0;
}
/*
Create the event with serialized data in the originating interpreter. It owns the data.
*/
ejsBlockGC(ejs);
if ((data = ejsToJSON(ejs, argv[0], NULL)) == 0) {
ejsThrowArgError(ejs, "Cannot serialize message data");
return 0;
}
if ((msg = createMessage()) == 0) {
ejsThrowMemoryError(ejs);
return 0;
}
target = worker->pair;
msg->data = ejsToMulti(ejs, data);
msg->worker = target;
msg->callback = "onmessage";
msg->callbackSlot = ES_Worker_onmessage;
dispatcher = target->ejs->dispatcher;
mprCreateEvent(dispatcher, "postMessage", 0, doMessage, msg, 0);
return 0;
}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:38,代码来源:ejsWorker.c
示例10: send
/*
function send(...content): Number
*/
static EjsNumber *ws_send(Ejs *ejs, EjsWebSocket *ws, int argc, EjsObj **argv)
{
EjsArray *args;
EjsByteArray *ba;
EjsAny *arg;
ssize nbytes;
int i;
args = (EjsArray*) argv[0];
if (ws->conn->state < HTTP_STATE_PARSED && !waitForHttpState(ws, HTTP_STATE_PARSED, -1, 1)) {
return ESV(null);
}
nbytes = 0;
for (i = 0; i < args->length; i++) {
if ((arg = ejsGetProperty(ejs, args, i)) != 0) {
if (ejsIs(ejs, arg, ByteArray)) {
ba = (EjsByteArray*) arg;
nbytes = ejsGetByteArrayAvailableData(ba);
nbytes = httpSendBlock(ws->conn, WS_MSG_BINARY, (cchar*) &ba->value[ba->readPosition], nbytes, HTTP_BLOCK);
} else {
nbytes = httpSend(ws->conn, ejsToMulti(ejs, arg));
}
if (nbytes < 0) {
return ESV(null);
}
}
}
return ejsCreateNumber(ejs, (MprNumber) nbytes);
}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:32,代码来源:ejsWebSocket.c
示例11: File
/*
Constructor
function File(path: Object, options: Object = null)
*/
static EjsFile *fileConstructor(Ejs *ejs, EjsFile *fp, int argc, EjsObj **argv)
{
EjsObj *pp, *options;
cchar *path;
if (argc < 1 || argc > 2) {
ejsThrowArgError(ejs, "Bad args");
return 0;
}
pp = argv[0];
if (ejsIs(ejs, pp, Path)) {
path = ((EjsPath*) pp)->value;
} else if (ejsIs(ejs, pp, String)) {
path = ejsToMulti(ejs, pp);
} else {
ejsThrowIOError(ejs, "Bad path");
return 0;
}
fp->path = mprNormalizePath(path);
if (argc == 2) {
options = (argc >= 2) ? argv[1] : 0;
openFile(ejs, fp, 1, &options);
}
return fp;
}
开发者ID:coordcn,项目名称:ejs,代码行数:29,代码来源:ejsFile.c
示例12: memset
EjsString *ejsSerializeWithOptions(Ejs *ejs, EjsAny *vp, EjsObj *options)
{
Json json;
EjsObj *arg;
EjsString *result;
int i;
memset(&json, 0, sizeof(Json));
json.depth = 99;
json.quotes = 1;
json.indent = sclone(" ");
if (options) {
json.options = options;
if ((arg = ejsGetPropertyByName(ejs, options, EN("baseClasses"))) != 0) {
json.baseClasses = (arg == ESV(true));
}
if ((arg = ejsGetPropertyByName(ejs, options, EN("depth"))) != 0) {
json.depth = ejsGetInt(ejs, arg);
}
if ((arg = ejsGetPropertyByName(ejs, options, EN("indent"))) != 0) {
if (ejsIs(ejs, arg, String)) {
json.indent = (char*) ejsToMulti(ejs, arg);
// TODO - get another solution to hold
} else if (ejsIs(ejs, arg, Number)) {
i = ejsGetInt(ejs, arg);
if (0 <= i && i < MPR_MAX_STRING) {
json.indent = mprAlloc(i + 1);
// TODO - get another solution to hold
memset(json.indent, ' ', i);
json.indent[i] = '\0';
}
}
}
if ((arg = ejsGetPropertyByName(ejs, options, EN("commas"))) != 0) {
json.commas = (arg == ESV(true));
}
if ((arg = ejsGetPropertyByName(ejs, options, EN("hidden"))) != 0) {
json.hidden = (arg == ESV(true));
}
if ((arg = ejsGetPropertyByName(ejs, options, EN("namespaces"))) != 0) {
json.namespaces = (arg == ESV(true));
}
if ((arg = ejsGetPropertyByName(ejs, options, EN("quotes"))) != 0) {
json.quotes = (arg != ESV(false));
}
if ((arg = ejsGetPropertyByName(ejs, options, EN("pretty"))) != 0) {
json.pretty = (arg == ESV(true));
}
json.replacer = ejsGetPropertyByName(ejs, options, EN("replacer"));
if (!ejsIsFunction(ejs, json.replacer)) {
json.replacer = NULL;
}
}
mprRelease(json.indent);
mprHold(json.indent);
result = serialize(ejs, vp, &json);
// TODO - get another solution to hold
return result;
}
开发者ID:varphone,项目名称:ejs-2,代码行数:60,代码来源:ejsJSON.c
示例13: form
/*
function form(uri: String = null, formData: Object = null): Http
Issue a POST method with form data
*/
static EjsHttp *http_form(Ejs *ejs, EjsHttp *hp, int argc, EjsObj **argv)
{
EjsObj *data;
if (argc == 2 && !ejsIs(ejs, argv[1], Null)) {
/*
Prep here to reset the state. The ensures the current headers will be preserved.
Users may have called setHeader to define custom headers. Users must call reset if they want to clear
prior headers.
*/
httpPrepClientConn(hp->conn, 1);
mprFlushBuf(hp->requestContent);
data = argv[1];
if (ejsGetLength(ejs, data) > 0) {
prepForm(ejs, hp, NULL, data);
} else {
mprPutStringToBuf(hp->requestContent, ejsToMulti(ejs, data));
}
mprAddNullToBuf(hp->requestContent);
httpSetHeader(hp->conn, "Content-Type", "application/x-www-form-urlencoded");
/* Ensure this gets recomputed */
httpRemoveHeader(hp->conn, "Content-Length");
}
return startHttpRequest(ejs, hp, "POST", argc, argv);
}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:29,代码来源:ejsHttp.c
示例14: WebSocket
/*
function WebSocket(uri: Uri, protocols = null, options)
options = {
certificate: Path,
verify: Boolean,
}
*/
static EjsWebSocket *wsConstructor(Ejs *ejs, EjsWebSocket *ws, int argc, EjsObj **argv)
{
EjsAny *certificate;
bool verify;
assert(ejsIsPot(ejs, ws));
ejsLoadHttpService(ejs);
ws->ejs = ejs;
verify = 0;
ws->uri = httpUriToString(((EjsUri*) argv[0])->uri, 0);
if (argc >= 2) {
if (ejsIs(ejs, argv[1], Array)) {
ws->protocols = sclone((ejsToString(ejs, argv[1]))->value);
} else if (ejsIs(ejs, argv[1], String)) {
ws->protocols = sclone(((EjsString*) argv[1])->value);
} else {
ws->protocols = sclone("chat");
}
} else {
ws->protocols = sclone("chat");
}
if (*ws->protocols == '\0') {
ejsThrowArgError(ejs, "Bad protocol");
return 0;
}
if (argc >= 3) {
ws->frames = ejsGetPropertyByName(ejs, argv[2], EN("frames")) == ESV(true);
verify = ejsGetPropertyByName(ejs, argv[2], EN("verify")) == ESV(true);
if ((certificate = ejsGetPropertyByName(ejs, argv[2], EN("certificate"))) != 0) {
ws->certFile = ejsToMulti(ejs, argv[0]);
}
}
if ((ws->conn = httpCreateConn(MPR->httpService, NULL, ejs->dispatcher)) == 0) {
ejsThrowMemoryError(ejs);
return 0;
}
httpSetAsync(ws->conn, 1);
httpPrepClientConn(ws->conn, 0);
httpSetConnNotifier(ws->conn, webSocketNotify);
httpSetWebSocketProtocols(ws->conn, ws->protocols);
httpSetConnContext(ws->conn, ws);
if (sstarts(ws->uri, "wss")) {
ws->ssl = mprCreateSsl(0);
mprVerifySslIssuer(ws->ssl, verify);
mprVerifySslPeer(ws->ssl, verify);
#if FUTURE
if (!hp->caFile) {
//MOB - Some define for this.
hp->caFile = mprJoinPath(mprGetAppDir(), "http-ca.crt");
}
mprSetSslCaFile(hp->ssl, hp->caFile);
mprSetSslCaFile(hp->ssl, mprJoinPath(mprGetAppDir(), "http-ca.crt"));
#endif
}
startWebSocketRequest(ejs, ws);
return ws;
}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:67,代码来源:ejsWebSocket.c
示例15: provider
/*
function set provider(name: String): Void
*/
static EjsObj *http_set_provider(Ejs *ejs, EjsHttp *hp, int argc, EjsObj **argv)
{
if (!hp->ssl) {
hp->ssl = mprCreateSsl(0);
}
mprSetSslProvider(hp->ssl, ejsToMulti(ejs, argv[0]));
return 0;
}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:11,代码来源:ejsHttp.c
示例16: setupTrace
static void setupTrace(Ejs *ejs, HttpTrace *trace, int dir, EjsObj *options)
{
EjsArray *extensions;
EjsObj *ext;
HttpTrace *tp;
int i, level, *levels;
tp = &trace[dir];
levels = tp->levels;
if ((level = getNumOption(ejs, options, "all")) >= 0) {
for (i = 0; i < HTTP_TRACE_MAX_ITEM; i++) {
levels[i] = level;
}
} else {
levels[HTTP_TRACE_CONN] = getNumOption(ejs, options, "conn");
levels[HTTP_TRACE_FIRST] = getNumOption(ejs, options, "first");
levels[HTTP_TRACE_HEADER] = getNumOption(ejs, options, "headers");
levels[HTTP_TRACE_BODY] = getNumOption(ejs, options, "body");
}
tp->size = getNumOption(ejs, options, "size");
if ((extensions = (EjsArray*) ejsGetPropertyByName(ejs, options, EN("include"))) != 0) {
if (!ejsIs(ejs, extensions, Array)) {
ejsThrowArgError(ejs, "include is not an array");
return;
}
tp->include = mprCreateHash(0, 0);
for (i = 0; i < extensions->length; i++) {
if ((ext = ejsGetProperty(ejs, extensions, i)) != 0) {
mprAddKey(tp->include, ejsToMulti(ejs, ejsToString(ejs, ext)), "");
}
}
}
if ((extensions = (EjsArray*) ejsGetPropertyByName(ejs, options, EN("exclude"))) != 0) {
if (!ejsIs(ejs, extensions, Array)) {
ejsThrowArgError(ejs, "exclude is not an array");
return;
}
tp->exclude = mprCreateHash(0, 0);
for (i = 0; i < extensions->length; i++) {
if ((ext = ejsGetProperty(ejs, extensions, i)) != 0) {
mprAddKey(tp->exclude, ejsToMulti(ejs, ejsToString(ejs, ext)), MPR->emptyString);
}
}
}
}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:45,代码来源:ejsHttp.c
示例17: open
/*
Constructor
function open(options: Object = null): File
NOTE: options can be an options hash or as mode string
*/
static EjsObj *openFile(Ejs *ejs, EjsFile *fp, int argc, EjsObj **argv)
{
EjsObj *options;
cchar *mode;
int perms, omode;
if (argc < 0 || argc > 1) {
ejsThrowArgError(ejs, "Bad args");
return 0;
}
options = argv[0];
if (argc == 0 || !ejsIsDefined(ejs, options)) {
omode = O_RDONLY | O_BINARY;
perms = EJS_FILE_PERMS;
fp->mode = EJS_FILE_READ;
mode = "r";
} else {
if (ejsIs(ejs, options, String)) {
mode = ejsToMulti(ejs, options);
perms = EJS_FILE_PERMS;
} else {
perms = ejsGetNumOption(ejs, options, "permissions", EJS_FILE_PERMS, 1);
mode = getStrOption(ejs, options, "mode", "r", 1);
if (ejs->exception) {
return 0;
}
}
omode = mapMode(mode);
if (!(omode & O_WRONLY)) {
fp->mode |= EJS_FILE_READ;
}
if (omode & (O_WRONLY | O_RDWR)) {
fp->mode |= EJS_FILE_WRITE;
}
}
fp->modeString = sclone(mode);
fp->perms = perms;
if (fp->file) {
mprCloseFile(fp->file);
}
fp->file = mprOpenFile(fp->path, omode, perms);
if (fp->file == 0) {
ejsThrowIOError(ejs, "Cannot open %s", fp->path);
return 0;
}
if (options) {
ejsSetPathAttributes(ejs, fp->path, options);
}
#if ME_CC_MMU && FUTURE
mprGetPathInfo(&fp->info);
fp->mapped = mapFile(fp, fp->info.size, MPR_MAP_READ | MPR_MAP_WRITE);
#endif
fp->mode |= EJS_FILE_OPEN;
return (EjsObj*) fp;
}
开发者ID:coordcn,项目名称:ejs,代码行数:61,代码来源:ejsFile.c
示例18: getenv
/*
Get an environment var
function getenv(key: String): String
*/
static EjsAny *app_getenv(Ejs *ejs, EjsObj *app, int argc, EjsObj **argv)
{
cchar *value;
value = getenv(ejsToMulti(ejs, argv[0]));
if (value == 0) {
return ESV(null);
}
return ejsCreateStringFromAsc(ejs, value);
}
开发者ID:leemit,项目名称:ejscript,代码行数:14,代码来源:ejsApp.c
示例19: prepForm
/*
Prepare form data as a series of key-value pairs. Data is formatted according to www-url-encoded specs by
mprSetHttpFormData. Objects are flattened into a one level key/value pairs. Keys can have embedded "." separators.
E.g. name=value&address=77%20Park%20Lane
*/
static void prepForm(Ejs *ejs, EjsHttp *hp, cchar *prefix, EjsObj *data)
{
EjsName qname;
EjsObj *vp;
EjsString *value;
cchar *key, *sep, *vstr;
char *encodedKey, *encodedValue, *newPrefix, *newKey;
int i, count;
count = ejsGetLength(ejs, data);
for (i = 0; i < count; i++) {
if (ejsIs(ejs, data, Array)) {
key = itos(i);
} else {
qname = ejsGetPropertyName(ejs, data, i);
key = ejsToMulti(ejs, qname.name);
}
vp = ejsGetProperty(ejs, data, i);
if (vp == 0) {
continue;
}
if (ejsGetLength(ejs, vp) > 0) {
if (prefix) {
newPrefix = sfmt("%s.%s", prefix, key);
prepForm(ejs, hp, newPrefix, vp);
} else {
prepForm(ejs, hp, key, vp);
}
} else {
value = ejsToString(ejs, vp);
sep = (mprGetBufLength(hp->requestContent) > 0) ? "&" : "";
if (prefix) {
newKey = sjoin(prefix, ".", key, NULL);
encodedKey = mprUriEncode(newKey, MPR_ENCODE_URI_COMPONENT);
} else {
encodedKey = mprUriEncode(key, MPR_ENCODE_URI_COMPONENT);
}
vstr = ejsToMulti(ejs, value);
encodedValue = mprUriEncode(vstr, MPR_ENCODE_URI_COMPONENT);
mprPutToBuf(hp->requestContent, "%s%s=%s", sep, encodedKey, encodedValue);
}
}
}
开发者ID:soffmodd,项目名称:ejs-2,代码行数:48,代码来源:ejsHttp.c
示例20: name
/*
function set name(hostname: String): Void
*/
static EjsObj *hs_set_name(Ejs *ejs, EjsHttpServer *sp, int argc, EjsObj **argv)
{
HttpHost *host;
sp->name = ejsToMulti(ejs, argv[0]);
if (sp->endpoint && sp->name) {
host = mprGetFirstItem(sp->endpoint->hosts);
httpSetHostName(host, sp->name);
}
return 0;
}
开发者ID:embedthis,项目名称:ejs.web,代码行数:14,代码来源:ejsHttpServer.c
注:本文中的ejsToMulti函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论