Update of /cvsroot/monetdb/pathfinder/runtime
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25006
Modified Files:
xrpc_client.mx xrpc_server.mx
Log Message:
Removed the limitatin on the maximum number of parameters allowed in an
XRPC function call. This maximum is now unlimited.
Index: xrpc_client.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_client.mx,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- xrpc_client.mx 24 May 2007 13:22:14 -0000 1.36
+++ xrpc_client.mx 1 Jun 2007 16:32:53 -0000 1.37
@@ -925,7 +925,7 @@
/* Pointers to the current BUNs of the BATs. */
BUN p_vid, p_iter, p_item, p_kind;
- lng i, a, nr_args = 0, max_args = 0, arg_offset = 0;
+ lng i, a, nr_args = 0, arg_offset = 0;
lng argc = *arity, my_argc = 0;
lng iterc = *itercnt, my_iter = 0;
lng **argcnt = NULL; /* #items each [iter][param] contains */
@@ -962,7 +962,7 @@
}
b->pos = snprintf(b->buf, b->len, XRPC_HEADER,
- SOAP_NS, XRPC_NS, XS_NS, XSI_NS, XRPC_NS, XRPC_LOC,
+ SOAP_NS, XRPC_NS, XDT_NS, XS_NS, XSI_NS, XRPC_NS, XRPC_LOC,
rpc_module, rpc_uri, rpc_method, argc, iterc,
updCall?"true":"false");
@@ -984,7 +984,6 @@
argcnt[i][a] = 0;
}
}
- max_args = iterc * MAX_NR_PARAMS;
/* Calculate the number of values contained by every parameter of
* every iteration. */
@@ -1004,32 +1003,11 @@
a = *(oid*) BUNtail(fun_vid, p_vid);
argcnt[i-1][a]++;
nr_args++;
- if (nr_args == max_args) {
- GDKerror("CMDhttp_post: too many parameters.\n");
- clean_up(sock, out, bs, b, argcnt, iterc);
- return GDK_FAIL;
- }
}
- max_args = nr_args; /* actual number of argval-s */
nr_args = 0;
/* TODO: reuse serialization code to generate the message */
for (my_iter = 0; my_iter < iterc; my_iter++) {
- /* Enlarge the buffer if it is filled more than 80%.
- * FIXME: is this really necessary? Or should we just return an
- * error?
- */
- if (b->pos > (b->len * 0.8)) {
- b->len *= 2;
- char *bptr = realloc(b->buf, b->len);
- if (!bptr) {
- GDKerror("CMDhttp_post: failed to allocate larger message
buffer.\n");
- clean_up(sock, out, bs, b, argcnt, iterc);
- return GDK_FAIL;
- }
- b->buf = bptr;
- }
-
if (argc == 0) {
str2buf(b, "<xrpc:call/>");
continue;
@@ -1061,6 +1039,19 @@
chr elem_kind = 0;
oid item;
+ /* Enlarge the buffer if it is filled more than 80%. */
+ if (b->pos > (b->len * 0.8)) {
+ b->len *= 2;
+ char *bptr = realloc(b->buf, b->len);
+ if (!bptr) {
+ GDKerror("CMDhttp_post: failed to allocate "
+ "larger message buffer.\n");
+ clean_up(sock, out, bs, b, argcnt, iterc);
+ return GDK_FAIL;
+ }
+ b->buf = bptr;
+ }
+
a = arg_offset + k; /* index into fun_item|fun_kind */
item= *(oid*)BUNtail(fun_item, BUNptr(fun_item, a));
cmbn_cont_kind = *(int*)BUNtail(fun_kind, BUNptr(fun_kind, a));
@@ -1098,10 +1089,10 @@
i = *(oid*)BUNtail(fun_item, BUNptr(fun_item, a));
str_val = BUNtail(str_values, BUNptr(str_values, i));
b->pos += snprintf((b->buf + b->pos), (b->len -
b->pos),
- "<xrpc:atomic-value xmlns:xdt=\"%s\" "
- "xsi:type=\"xdt:untypedAtomic\">"
+ "<xrpc:atomic-value "
+ "xsi:type=\"xs:string\">"
"%s</xrpc:atomic-value>",
- XDT_NS, str_val);
+ str_val);
break;
case ATTR:
{
Index: xrpc_server.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/runtime/xrpc_server.mx,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- xrpc_server.mx 24 May 2007 13:22:14 -0000 1.46
+++ xrpc_server.mx 1 Jun 2007 16:32:53 -0000 1.47
@@ -187,6 +187,7 @@
#define XRPC_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" \
"<env:Envelope xmlns:env=\"%s\"" \
" xmlns:xrpc=\"%s\"" \
+ " xmlns:xdt=\"%s\" " \
" xmlns:xs=\"%s\"" \
" xmlns:xsi=\"%s\"" \
" xsi:schemaLocation=\"%s %s\">" \
@@ -219,7 +220,7 @@
#define XRPC_FOOTER "</xrpc:request>" \
"</env:Body>" \
- "</env:Envelope>"
+ "</env:Envelope>\n"
#endif /* XRPC_SERVER_H */
@@ -280,7 +281,7 @@
"<env:Reason>"
"<env:Text xml:lang=\"en\">%s</env:Text>"
"</env:Reason>"
- "</env:Fault></env:Body></env:Envelope>",
+ "</env:Fault></env:Body></env:Envelope>\n",
SOAP_NS, soap_err, err_reason);
}
@@ -691,7 +692,7 @@
str *argtpe = NULL, *argval = NULL;
lng i = 0, j = 0, k = 0, nattrs = 0;
- lng max_args = GDK_int_max;
+ lng max_args = MAX_NR_PARAMS;
char errstr[1024];
BAT *frag_root = NULL, *pre_size = NULL;
@@ -829,7 +830,7 @@
argcnt[i][j] = 0;
}
- max_args = iterc * MAX_NR_PARAMS;
+ max_args = iterc * (argc>0?argc:1) * MAX_NR_PARAMS;
argval = GDKmalloc(max_args * sizeof(char *));
argtpe = GDKmalloc(max_args * sizeof(char *));
if (!argval || !argtpe) {
@@ -865,11 +866,22 @@
tpe_node_size = pre_sizeT[tpe_node_pre];
if (nr_args == max_args) {
- snprintf(errstr, 1024, "XRPC request: too many "
- "parameters, maximum is %d", MAX_NR_PARAMS);
- send_err(out, 1, ERR404, "env:Sender", errstr);
- clean_up(argcnt,argtpe,argval,iterc,nr_args);
- return GDK_FAIL;
+ max_args += 2048;
+ char **bptr = GDKrealloc(argval, max_args * sizeof(char
*));
+ if (!bptr) {
+ send_err(out, 1, ERR500, "env:Receiver",OUT_OF_MEM);
+ clean_up(argcnt,argtpe,argval,iterc,nr_args);
+ return GDK_FAIL;
+ }
+ argval = bptr;
+
+ bptr = GDKrealloc(argtpe, max_args * sizeof(char *));
+ if (!bptr) {
+ send_err(out, 1, ERR500, "env:Receiver",OUT_OF_MEM);
+ clean_up(argcnt,argtpe,argval,iterc,nr_args);
+ return GDK_FAIL;
+ }
+ argtpe = bptr;
}
if (!(argtpe[nr_args] = get_type(tpe_node_pre,
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins