Fossil SCM

A follow-up patch to the previous "name" change, to work around the problem of HTTP GET requests not yet knowing that they are in JSON mode (POST requests know this).

stephan 2012-03-18 03:37 trunk
Commit 3bf1ad01625df042f3c3e75677fead0ca81eee7c
1 file changed +11
+11
--- src/main.c
+++ src/main.c
@@ -1305,10 +1305,21 @@
13051305
}else{
13061306
g.zExtra = 0;
13071307
}
13081308
break;
13091309
}
1310
+#ifdef FOSSIL_ENABLE_JSON
1311
+ /*
1312
+ ** Workaround to allow us to customize some following behaviour for
1313
+ ** JSON mode. The problem is, we don't always know if we're in JSON
1314
+ ** mode at this point (namely, for GET mode we don't know but POST
1315
+ ** we do), so we snoop g.zPath and cheat a bit.
1316
+ */
1317
+ if( g.zPath && (0==strcmp("json",g.zPath)) ){
1318
+ g.json.isJsonMode = 1;
1319
+ }
1320
+#endif
13101321
if( g.zExtra ){
13111322
/* CGI parameters get this treatment elsewhere, but places like getfile
13121323
** will use g.zExtra directly.
13131324
** Reminder: the login mechanism uses 'name' differently, and may
13141325
** eventually have a problem/collision with this.
13151326
--- src/main.c
+++ src/main.c
@@ -1305,10 +1305,21 @@
1305 }else{
1306 g.zExtra = 0;
1307 }
1308 break;
1309 }
 
 
 
 
 
 
 
 
 
 
 
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
--- src/main.c
+++ src/main.c
@@ -1305,10 +1305,21 @@
1305 }else{
1306 g.zExtra = 0;
1307 }
1308 break;
1309 }
1310 #ifdef FOSSIL_ENABLE_JSON
1311 /*
1312 ** Workaround to allow us to customize some following behaviour for
1313 ** JSON mode. The problem is, we don't always know if we're in JSON
1314 ** mode at this point (namely, for GET mode we don't know but POST
1315 ** we do), so we snoop g.zPath and cheat a bit.
1316 */
1317 if( g.zPath && (0==strcmp("json",g.zPath)) ){
1318 g.json.isJsonMode = 1;
1319 }
1320 #endif
1321 if( g.zExtra ){
1322 /* CGI parameters get this treatment elsewhere, but places like getfile
1323 ** will use g.zExtra directly.
1324 ** Reminder: the login mechanism uses 'name' differently, and may
1325 ** eventually have a problem/collision with this.
1326

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button