|
@@ -1346,10 +1346,12 @@ static int rpc_scan(rpc_ctx_t* ctx, char* fmt, ...)
|
|
void** void_ptr;
|
|
void** void_ptr;
|
|
int read;
|
|
int read;
|
|
str line;
|
|
str line;
|
|
|
|
+ int nofault;
|
|
|
|
|
|
va_list ap;
|
|
va_list ap;
|
|
va_start(ap, fmt);
|
|
va_start(ap, fmt);
|
|
|
|
|
|
|
|
+ nofault = 0;
|
|
read = 0;
|
|
read = 0;
|
|
while(*fmt) {
|
|
while(*fmt) {
|
|
if (read_line(&line.s, &line.len, &ctx->read_h) < 0) {
|
|
if (read_line(&line.s, &line.len, &ctx->read_h) < 0) {
|
|
@@ -1359,11 +1361,15 @@ static int rpc_scan(rpc_ctx_t* ctx, char* fmt, ...)
|
|
ctx->line_no++;
|
|
ctx->line_no++;
|
|
|
|
|
|
switch(*fmt) {
|
|
switch(*fmt) {
|
|
|
|
+ case '*': /* start of optional parameters */
|
|
|
|
+ nofault = 1;
|
|
|
|
+ break;
|
|
case 'b': /* Bool */
|
|
case 'b': /* Bool */
|
|
case 't': /* Date and time */
|
|
case 't': /* Date and time */
|
|
case 'd': /* Integer */
|
|
case 'd': /* Integer */
|
|
if (!line.len) {
|
|
if (!line.len) {
|
|
- rpc_fault(ctx, 400, "Invalid parameter value on line %d",
|
|
|
|
|
|
+ if(nofault==0)
|
|
|
|
+ rpc_fault(ctx, 400, "Invalid parameter value on line %d",
|
|
ctx->line_no);
|
|
ctx->line_no);
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
@@ -1373,7 +1379,8 @@ static int rpc_scan(rpc_ctx_t* ctx, char* fmt, ...)
|
|
|
|
|
|
case 'f': /* double */
|
|
case 'f': /* double */
|
|
if (!line.len) {
|
|
if (!line.len) {
|
|
- rpc_fault(ctx, 400, "Invalid parameter value on line %d",
|
|
|
|
|
|
+ if(nofault==0)
|
|
|
|
+ rpc_fault(ctx, 400, "Invalid parameter value on line %d",
|
|
ctx->line_no);
|
|
ctx->line_no);
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
@@ -1385,8 +1392,10 @@ static int rpc_scan(rpc_ctx_t* ctx, char* fmt, ...)
|
|
case 'S': /* str structure */
|
|
case 'S': /* str structure */
|
|
l = new_chunk_unescape(&line);
|
|
l = new_chunk_unescape(&line);
|
|
if (!l) {
|
|
if (!l) {
|
|
- rpc_fault(ctx, 500, "Internal Server Error");
|
|
|
|
- ERR("Not enough memory\n");
|
|
|
|
|
|
+ if(nofault==0) {
|
|
|
|
+ rpc_fault(ctx, 500, "Internal Server Error");
|
|
|
|
+ ERR("Not enough memory\n");
|
|
|
|
+ }
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
/* Make sure it gets released at the end */
|
|
/* Make sure it gets released at the end */
|