1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
|
** Ensure that JSON mode is set up if we're visiting /json, to allow
** us to customize some following behaviour (error handling and only
** process JSON-mode POST data if we're actually in a /json
** page). This is normally set up before this routine is called, but
** it looks like the ssh_request_loop() approach to dispatching
** might bypass that.
*/
if( g.json.isJsonMode==0 && zPathInfo!=0
&& 0==strncmp("/json",zPathInfo,5)
&& (zPathInfo[5]==0 || zPathInfo[5]=='/')){
g.json.isJsonMode = 1;
}
#endif
/* If the repository has not been opened already, then find the
** repository based on the first element of PATH_INFO and open it.
*/
if( !g.repositoryOpen ){
char *zRepo; /* Candidate repository name */
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
|
** Ensure that JSON mode is set up if we're visiting /json, to allow
** us to customize some following behaviour (error handling and only
** process JSON-mode POST data if we're actually in a /json
** page). This is normally set up before this routine is called, but
** it looks like the ssh_request_loop() approach to dispatching
** might bypass that.
*/
if( g.json.isJsonMode==0 && zPathInfo!=0 ){
if(0==strncmp("/json",zPathInfo,5)
&& (zPathInfo[5]==0 || zPathInfo[5]=='/')){
g.json.isJsonMode = 1;
}else if(g.zCmdName!=0 && 0==strcmp("server",g.zCmdName)){
/* When running in server "directory" mode, zPathInfo is
** prefixed with the repository's name, so in order to determine
** whether or not we're really running in json mode we have to
** try a bit harder. Problem reported here:
** https://fossil-scm.org/forum/forumpost/e4953666d6
*/
ReCompiled * pReg = 0;
const char * zErr = re_compile(&pReg, "^/[^/]+/json(/.*)?", 0);
assert(zErr==0 && "Regex compilation failed?");
if(zErr==0 &&
re_match(pReg, (const unsigned char *)zPathInfo, -1)){
g.json.isJsonMode = 1;
}
re_free(pReg);
}
}
#endif
/* If the repository has not been opened already, then find the
** repository based on the first element of PATH_INFO and open it.
*/
if( !g.repositoryOpen ){
char *zRepo; /* Candidate repository name */
|