Fossil SCM
Always redirect incoming HTTP requests to the /xfer method when the content-type is application/x-fossil.
Commit
16ec6e558bf28c73cc0eeab87aa1618091474fdf
Parent
26a2b61dbd76b10…
2 files changed
+8
+6
+8
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -695,12 +695,20 @@ | ||
| 695 | 695 | process_multipart_form_data(z, len); |
| 696 | 696 | } |
| 697 | 697 | }else if( strcmp(zType, "application/x-fossil")==0 ){ |
| 698 | 698 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 699 | 699 | blob_uncompress(&g.cgiIn, &g.cgiIn); |
| 700 | + /* If the content type is application/x-fossil, then ignore | |
| 701 | + ** the path in the first line of the HTTP header and always | |
| 702 | + ** use the /xfer method since the /xfer method is the only | |
| 703 | + ** method that understands the application/x-fossil content | |
| 704 | + ** type. | |
| 705 | + */ | |
| 706 | + cgi_replace_parameter("PATH_INFO", "/xfer"); | |
| 700 | 707 | }else if( strcmp(zType, "application/x-fossil-debug")==0 ){ |
| 701 | 708 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 709 | + cgi_replace_parameter("PATH_INFO", "/xfer"); /* See comment above */ | |
| 702 | 710 | } |
| 703 | 711 | } |
| 704 | 712 | |
| 705 | 713 | z = (char*)P("HTTP_COOKIE"); |
| 706 | 714 | if( z ){ |
| 707 | 715 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -695,12 +695,20 @@ | |
| 695 | process_multipart_form_data(z, len); |
| 696 | } |
| 697 | }else if( strcmp(zType, "application/x-fossil")==0 ){ |
| 698 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 699 | blob_uncompress(&g.cgiIn, &g.cgiIn); |
| 700 | }else if( strcmp(zType, "application/x-fossil-debug")==0 ){ |
| 701 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | z = (char*)P("HTTP_COOKIE"); |
| 706 | if( z ){ |
| 707 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -695,12 +695,20 @@ | |
| 695 | process_multipart_form_data(z, len); |
| 696 | } |
| 697 | }else if( strcmp(zType, "application/x-fossil")==0 ){ |
| 698 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 699 | blob_uncompress(&g.cgiIn, &g.cgiIn); |
| 700 | /* If the content type is application/x-fossil, then ignore |
| 701 | ** the path in the first line of the HTTP header and always |
| 702 | ** use the /xfer method since the /xfer method is the only |
| 703 | ** method that understands the application/x-fossil content |
| 704 | ** type. |
| 705 | */ |
| 706 | cgi_replace_parameter("PATH_INFO", "/xfer"); |
| 707 | }else if( strcmp(zType, "application/x-fossil-debug")==0 ){ |
| 708 | blob_read_from_channel(&g.cgiIn, g.httpIn, len); |
| 709 | cgi_replace_parameter("PATH_INFO", "/xfer"); /* See comment above */ |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | z = (char*)P("HTTP_COOKIE"); |
| 714 | if( z ){ |
| 715 |
+6
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -487,10 +487,16 @@ | ||
| 487 | 487 | ** only. |
| 488 | 488 | */ |
| 489 | 489 | static int disableLogin = 0; |
| 490 | 490 | |
| 491 | 491 | /* |
| 492 | +** The CGI/HTTP preprocessor always redirects requests with a content-type | |
| 493 | +** of application/x-fossil or application/x-fossil-debug to this page, | |
| 494 | +** regardless of what path was specified in the HTTP header. This allows | |
| 495 | +** clone clients to specify a URL that omits default pathnames, such | |
| 496 | +** as "http://fossil-scm.morg/" instead of "http://fossil-scm.org/index.cgi". | |
| 497 | +** | |
| 492 | 498 | ** WEBPAGE: xfer |
| 493 | 499 | ** |
| 494 | 500 | ** This is the transfer handler on the server side. The transfer |
| 495 | 501 | ** message has been uncompressed and placed in the g.cgiIn blob. |
| 496 | 502 | ** Process this message and form an appropriate reply. |
| 497 | 503 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -487,10 +487,16 @@ | |
| 487 | ** only. |
| 488 | */ |
| 489 | static int disableLogin = 0; |
| 490 | |
| 491 | /* |
| 492 | ** WEBPAGE: xfer |
| 493 | ** |
| 494 | ** This is the transfer handler on the server side. The transfer |
| 495 | ** message has been uncompressed and placed in the g.cgiIn blob. |
| 496 | ** Process this message and form an appropriate reply. |
| 497 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -487,10 +487,16 @@ | |
| 487 | ** only. |
| 488 | */ |
| 489 | static int disableLogin = 0; |
| 490 | |
| 491 | /* |
| 492 | ** The CGI/HTTP preprocessor always redirects requests with a content-type |
| 493 | ** of application/x-fossil or application/x-fossil-debug to this page, |
| 494 | ** regardless of what path was specified in the HTTP header. This allows |
| 495 | ** clone clients to specify a URL that omits default pathnames, such |
| 496 | ** as "http://fossil-scm.morg/" instead of "http://fossil-scm.org/index.cgi". |
| 497 | ** |
| 498 | ** WEBPAGE: xfer |
| 499 | ** |
| 500 | ** This is the transfer handler on the server side. The transfer |
| 501 | ** message has been uncompressed and placed in the g.cgiIn blob. |
| 502 | ** Process this message and form an appropriate reply. |
| 503 |