Fossil SCM
Refuse the TH1 redirect command only when there is no reply to write or a relative URL has no base URL, so that test-th-eval --cgi and --http still send a redirect to a full URL.
Commit
a0871ef274a3799d7135af5fe8840e493f12c1761f9447266a0b65b57d432181
Parent
45df7bfacffcfa6…
1 file changed
+4
-1
+4
-1
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -520,11 +520,14 @@ | ||
| 520 | 520 | ){ |
| 521 | 521 | int withMethod = 0; |
| 522 | 522 | if( argc!=2 && argc!=3 ){ |
| 523 | 523 | return Th_WrongNumArgs(interp, "redirect URL ?withMethod?"); |
| 524 | 524 | } |
| 525 | - if( !g.isHTTP ){ | |
| 525 | + if( g.httpOut==0 | |
| 526 | + || (g.zBaseURL==0 && fossil_strncmp(argv[1],"http:",5)!=0 | |
| 527 | + && fossil_strncmp(argv[1],"https:",6)!=0) | |
| 528 | + ){ | |
| 526 | 529 | Th_ErrorMessage(interp, "redirect is only allowed in a web request", |
| 527 | 530 | 0, 0); |
| 528 | 531 | return TH_ERROR; |
| 529 | 532 | } |
| 530 | 533 | if( argc==3 ){ |
| 531 | 534 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -520,11 +520,14 @@ | |
| 520 | ){ |
| 521 | int withMethod = 0; |
| 522 | if( argc!=2 && argc!=3 ){ |
| 523 | return Th_WrongNumArgs(interp, "redirect URL ?withMethod?"); |
| 524 | } |
| 525 | if( !g.isHTTP ){ |
| 526 | Th_ErrorMessage(interp, "redirect is only allowed in a web request", |
| 527 | 0, 0); |
| 528 | return TH_ERROR; |
| 529 | } |
| 530 | if( argc==3 ){ |
| 531 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -520,11 +520,14 @@ | |
| 520 | ){ |
| 521 | int withMethod = 0; |
| 522 | if( argc!=2 && argc!=3 ){ |
| 523 | return Th_WrongNumArgs(interp, "redirect URL ?withMethod?"); |
| 524 | } |
| 525 | if( g.httpOut==0 |
| 526 | || (g.zBaseURL==0 && fossil_strncmp(argv[1],"http:",5)!=0 |
| 527 | && fossil_strncmp(argv[1],"https:",6)!=0) |
| 528 | ){ |
| 529 | Th_ErrorMessage(interp, "redirect is only allowed in a web request", |
| 530 | 0, 0); |
| 531 | return TH_ERROR; |
| 532 | } |
| 533 | if( argc==3 ){ |
| 534 |