Fossil SCM
Removed the special-cased addition of g.zExtra==parameter named "name" when running in JSON mode because it causes no end of grief in several JSON handlers and none of the handlers rely on that handling.
Commit
ccd6c879b4442c57acbf95118f0b7371613645a7
Parent
f7e215bcac885cb…
1 file changed
+14
-2
+14
-2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1310,13 +1310,25 @@ | ||
| 1310 | 1310 | if( g.zExtra ){ |
| 1311 | 1311 | /* CGI parameters get this treatment elsewhere, but places like getfile |
| 1312 | 1312 | ** will use g.zExtra directly. |
| 1313 | 1313 | ** Reminder: the login mechanism uses 'name' differently, and may |
| 1314 | 1314 | ** eventually have a problem/collision with this. |
| 1315 | + ** | |
| 1316 | + ** Disabled by stephan when running in JSON mode because this | |
| 1317 | + ** particular parameter name is very common and i have had no end | |
| 1318 | + ** of grief with this handling. The JSON API never relies on the | |
| 1319 | + ** handling below, and by disabling it in JSON mode i can remove | |
| 1320 | + ** lots of special-case handling in several JSON handlers. | |
| 1315 | 1321 | */ |
| 1316 | - dehttpize(g.zExtra); | |
| 1317 | - cgi_set_parameter_nocopy("name", g.zExtra); | |
| 1322 | +#ifdef FOSSIL_ENABLE_JSON | |
| 1323 | + if(!g.json.isJsonMode){ | |
| 1324 | +#endif | |
| 1325 | + dehttpize(g.zExtra); | |
| 1326 | + cgi_set_parameter_nocopy("name", g.zExtra); | |
| 1327 | +#ifdef FOSSIL_ENABLE_JSON | |
| 1328 | + } | |
| 1329 | +#endif | |
| 1318 | 1330 | } |
| 1319 | 1331 | |
| 1320 | 1332 | /* Locate the method specified by the path and execute the function |
| 1321 | 1333 | ** that implements that method. |
| 1322 | 1334 | */ |
| 1323 | 1335 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1310,13 +1310,25 @@ | |
| 1310 | if( g.zExtra ){ |
| 1311 | /* CGI parameters get this treatment elsewhere, but places like getfile |
| 1312 | ** will use g.zExtra directly. |
| 1313 | ** Reminder: the login mechanism uses 'name' differently, and may |
| 1314 | ** eventually have a problem/collision with this. |
| 1315 | */ |
| 1316 | dehttpize(g.zExtra); |
| 1317 | cgi_set_parameter_nocopy("name", g.zExtra); |
| 1318 | } |
| 1319 | |
| 1320 | /* Locate the method specified by the path and execute the function |
| 1321 | ** that implements that method. |
| 1322 | */ |
| 1323 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1310,13 +1310,25 @@ | |
| 1310 | if( g.zExtra ){ |
| 1311 | /* CGI parameters get this treatment elsewhere, but places like getfile |
| 1312 | ** will use g.zExtra directly. |
| 1313 | ** Reminder: the login mechanism uses 'name' differently, and may |
| 1314 | ** eventually have a problem/collision with this. |
| 1315 | ** |
| 1316 | ** Disabled by stephan when running in JSON mode because this |
| 1317 | ** particular parameter name is very common and i have had no end |
| 1318 | ** of grief with this handling. The JSON API never relies on the |
| 1319 | ** handling below, and by disabling it in JSON mode i can remove |
| 1320 | ** lots of special-case handling in several JSON handlers. |
| 1321 | */ |
| 1322 | #ifdef FOSSIL_ENABLE_JSON |
| 1323 | if(!g.json.isJsonMode){ |
| 1324 | #endif |
| 1325 | dehttpize(g.zExtra); |
| 1326 | cgi_set_parameter_nocopy("name", g.zExtra); |
| 1327 | #ifdef FOSSIL_ENABLE_JSON |
| 1328 | } |
| 1329 | #endif |
| 1330 | } |
| 1331 | |
| 1332 | /* Locate the method specified by the path and execute the function |
| 1333 | ** that implements that method. |
| 1334 | */ |
| 1335 |