Skylark.patch

First attempt of fix - Jan DolinĂ¡r, 06/16/2015 10:02 PM

Download (1.99 KB)

View differences:

uppsrc/Skylark/Compile.cpp (working copy)
40 40
	int args = 0;
41 41
	for(int i = 0; i < part.GetCount(); i++) {
42 42
		int p = (byte)*part[i];
43
		if(p == 255) // it's a ** node, we can supply unlimited number of arguments
44
			return -1;
43 45
		if(p >= 0 && p < 30)
44 46
			args = max(args, p + 1);
45 47
	}
uppsrc/Skylark/Dispatch.cpp (working copy)
138 138
			if(IsDigit(s[1]))
139 139
				linkargpos = argpos = minmax(atoi(~s + 1), 0, 30);
140 140
			else
141
			if(s[1] == '*')
141
			if(s[1] == '*') {
142 142
				argpos = DISPATCH_VARARGS;
143
				linkargpos = 255;
144
			}
143 145
			q = DispatchMap.GetCount();
144 146
			LLOG(" Adding arg " << argpos << ": " << q);
145 147
			n.subnode.Add(Null, q);
146 148
			DispatchMap.Add();
147 149
			DispatchMap[q].argpos = argpos;
148 150
			if(primary)
149
				linkpart.Add(String(linkargpos++, 1));
151
				linkpart.Add(String(min(linkargpos++,255), 1));
150 152
		}
151 153
		else {
152 154
			if(primary)
uppsrc/Skylark/Http.cpp (working copy)
326 326
{
327 327
	LTIMING("MakeLink");
328 328
	out.Cat("/");
329
	Bits usedArgs;
329 330
	for(int i = 0; i < part.GetCount(); i++) {
331
		int q = (byte)*part[i];
332
		if(q < 32)
333
			usedArgs.Set(q);
334
	}
335
	for(int i = 0; i < part.GetCount(); i++) {
330 336
		const String& p = part[i];
331 337
		if(i)
332 338
			out << '/';
......
336 342
				sUrlEncode(out, AsString(arg[q]));
337 343
		}
338 344
		else
345
		if(q == 255) {
346
			bool first = true;
347
			for(int j=0; j<arg.GetCount(); ++j) {
348
				if (usedArgs.Get(j))
349
					continue;
350
				if(!first) {
351
					out << '/';
352
				}
353
				first = false;
354
				sUrlEncode(out, AsString(arg[j]));
355
			}
356
		}
357
		else
339 358
			sUrlEncode(out, p);
340 359
	}
341 360
	bool get = false;