Fossil SCM
Enable TH1 hooks for all web pages, known and unknown.
Commit
f90f723010b6bd1c87fe140099ee59646111fa43
Parent
53f5e1f9ed6f59d…
1 file changed
+23
-7
+23
-7
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1543,21 +1543,37 @@ | ||
| 1543 | 1543 | } |
| 1544 | 1544 | |
| 1545 | 1545 | /* Locate the method specified by the path and execute the function |
| 1546 | 1546 | ** that implements that method. |
| 1547 | 1547 | */ |
| 1548 | - if( name_search(g.zPath, aWebpage, count(aWebpage), &idx) && | |
| 1549 | - name_search("not_found", aWebpage, count(aWebpage), &idx) ){ | |
| 1548 | + if( name_search(g.zPath, aWebpage, count(aWebpage), &idx) ){ | |
| 1550 | 1549 | #ifdef FOSSIL_ENABLE_JSON |
| 1551 | 1550 | if(g.json.isJsonMode){ |
| 1552 | 1551 | json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,0); |
| 1553 | 1552 | }else |
| 1554 | 1553 | #endif |
| 1555 | 1554 | { |
| 1556 | - cgi_set_status(404,"Not Found"); | |
| 1557 | - @ <h1>Not Found</h1> | |
| 1558 | - @ <p>Page not found: %h(g.zPath)</p> | |
| 1555 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 1556 | + int rc; | |
| 1557 | + if( !g.fNoThHook ){ | |
| 1558 | + rc = Th_WebpageHook(g.zPath, 0); | |
| 1559 | + }else{ | |
| 1560 | + rc = TH_OK; | |
| 1561 | + } | |
| 1562 | + if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ | |
| 1563 | + if( rc==TH_OK || rc==TH_RETURN ){ | |
| 1564 | +#endif | |
| 1565 | + cgi_set_status(404,"Not Found"); | |
| 1566 | + @ <h1>Not Found</h1> | |
| 1567 | + @ <p>Page not found: %h(g.zPath)</p> | |
| 1568 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 1569 | + } | |
| 1570 | + if( !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ | |
| 1571 | + Th_WebpageNotify(g.zPath, 0); | |
| 1572 | + } | |
| 1573 | + } | |
| 1574 | +#endif | |
| 1559 | 1575 | } |
| 1560 | 1576 | }else if( aWebpage[idx].xFunc!=page_xfer && db_schema_is_outofdate() ){ |
| 1561 | 1577 | #ifdef FOSSIL_ENABLE_JSON |
| 1562 | 1578 | if(g.json.isJsonMode){ |
| 1563 | 1579 | json_err(FSL_JSON_E_DB_NEEDS_REBUILD,NULL,0); |
| @@ -1584,11 +1600,11 @@ | ||
| 1584 | 1600 | ** |
| 1585 | 1601 | ** TH_CONTINUE: The xFunc() will be skipped, the TH1 notification will be |
| 1586 | 1602 | ** executed. |
| 1587 | 1603 | */ |
| 1588 | 1604 | int rc; |
| 1589 | - if( !g.isHTTP && !g.fNoThHook ){ | |
| 1605 | + if( !g.fNoThHook ){ | |
| 1590 | 1606 | rc = Th_WebpageHook(aWebpage[idx].zName, aWebpage[idx].cmdFlags); |
| 1591 | 1607 | }else{ |
| 1592 | 1608 | rc = TH_OK; |
| 1593 | 1609 | } |
| 1594 | 1610 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| @@ -1595,11 +1611,11 @@ | ||
| 1595 | 1611 | if( rc==TH_OK || rc==TH_RETURN ){ |
| 1596 | 1612 | #endif |
| 1597 | 1613 | aWebpage[idx].xFunc(); |
| 1598 | 1614 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 1599 | 1615 | } |
| 1600 | - if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ | |
| 1616 | + if( !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ | |
| 1601 | 1617 | Th_WebpageNotify(aWebpage[idx].zName, aWebpage[idx].cmdFlags); |
| 1602 | 1618 | } |
| 1603 | 1619 | } |
| 1604 | 1620 | #endif |
| 1605 | 1621 | } |
| 1606 | 1622 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1543,21 +1543,37 @@ | |
| 1543 | } |
| 1544 | |
| 1545 | /* Locate the method specified by the path and execute the function |
| 1546 | ** that implements that method. |
| 1547 | */ |
| 1548 | if( name_search(g.zPath, aWebpage, count(aWebpage), &idx) && |
| 1549 | name_search("not_found", aWebpage, count(aWebpage), &idx) ){ |
| 1550 | #ifdef FOSSIL_ENABLE_JSON |
| 1551 | if(g.json.isJsonMode){ |
| 1552 | json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,0); |
| 1553 | }else |
| 1554 | #endif |
| 1555 | { |
| 1556 | cgi_set_status(404,"Not Found"); |
| 1557 | @ <h1>Not Found</h1> |
| 1558 | @ <p>Page not found: %h(g.zPath)</p> |
| 1559 | } |
| 1560 | }else if( aWebpage[idx].xFunc!=page_xfer && db_schema_is_outofdate() ){ |
| 1561 | #ifdef FOSSIL_ENABLE_JSON |
| 1562 | if(g.json.isJsonMode){ |
| 1563 | json_err(FSL_JSON_E_DB_NEEDS_REBUILD,NULL,0); |
| @@ -1584,11 +1600,11 @@ | |
| 1584 | ** |
| 1585 | ** TH_CONTINUE: The xFunc() will be skipped, the TH1 notification will be |
| 1586 | ** executed. |
| 1587 | */ |
| 1588 | int rc; |
| 1589 | if( !g.isHTTP && !g.fNoThHook ){ |
| 1590 | rc = Th_WebpageHook(aWebpage[idx].zName, aWebpage[idx].cmdFlags); |
| 1591 | }else{ |
| 1592 | rc = TH_OK; |
| 1593 | } |
| 1594 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| @@ -1595,11 +1611,11 @@ | |
| 1595 | if( rc==TH_OK || rc==TH_RETURN ){ |
| 1596 | #endif |
| 1597 | aWebpage[idx].xFunc(); |
| 1598 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 1599 | } |
| 1600 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 1601 | Th_WebpageNotify(aWebpage[idx].zName, aWebpage[idx].cmdFlags); |
| 1602 | } |
| 1603 | } |
| 1604 | #endif |
| 1605 | } |
| 1606 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1543,21 +1543,37 @@ | |
| 1543 | } |
| 1544 | |
| 1545 | /* Locate the method specified by the path and execute the function |
| 1546 | ** that implements that method. |
| 1547 | */ |
| 1548 | if( name_search(g.zPath, aWebpage, count(aWebpage), &idx) ){ |
| 1549 | #ifdef FOSSIL_ENABLE_JSON |
| 1550 | if(g.json.isJsonMode){ |
| 1551 | json_err(FSL_JSON_E_RESOURCE_NOT_FOUND,NULL,0); |
| 1552 | }else |
| 1553 | #endif |
| 1554 | { |
| 1555 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 1556 | int rc; |
| 1557 | if( !g.fNoThHook ){ |
| 1558 | rc = Th_WebpageHook(g.zPath, 0); |
| 1559 | }else{ |
| 1560 | rc = TH_OK; |
| 1561 | } |
| 1562 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| 1563 | if( rc==TH_OK || rc==TH_RETURN ){ |
| 1564 | #endif |
| 1565 | cgi_set_status(404,"Not Found"); |
| 1566 | @ <h1>Not Found</h1> |
| 1567 | @ <p>Page not found: %h(g.zPath)</p> |
| 1568 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 1569 | } |
| 1570 | if( !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 1571 | Th_WebpageNotify(g.zPath, 0); |
| 1572 | } |
| 1573 | } |
| 1574 | #endif |
| 1575 | } |
| 1576 | }else if( aWebpage[idx].xFunc!=page_xfer && db_schema_is_outofdate() ){ |
| 1577 | #ifdef FOSSIL_ENABLE_JSON |
| 1578 | if(g.json.isJsonMode){ |
| 1579 | json_err(FSL_JSON_E_DB_NEEDS_REBUILD,NULL,0); |
| @@ -1584,11 +1600,11 @@ | |
| 1600 | ** |
| 1601 | ** TH_CONTINUE: The xFunc() will be skipped, the TH1 notification will be |
| 1602 | ** executed. |
| 1603 | */ |
| 1604 | int rc; |
| 1605 | if( !g.fNoThHook ){ |
| 1606 | rc = Th_WebpageHook(aWebpage[idx].zName, aWebpage[idx].cmdFlags); |
| 1607 | }else{ |
| 1608 | rc = TH_OK; |
| 1609 | } |
| 1610 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| @@ -1595,11 +1611,11 @@ | |
| 1611 | if( rc==TH_OK || rc==TH_RETURN ){ |
| 1612 | #endif |
| 1613 | aWebpage[idx].xFunc(); |
| 1614 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 1615 | } |
| 1616 | if( !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 1617 | Th_WebpageNotify(aWebpage[idx].zName, aWebpage[idx].cmdFlags); |
| 1618 | } |
| 1619 | } |
| 1620 | #endif |
| 1621 | } |
| 1622 |