Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch extension-cgi Excluding Merge-Ins
This is equivalent to a diff from 35d609a0ba to c2a98a5d62
|
2019-07-25
| ||
| 21:11 | Add the /ext page that will run CGI or deliver static content from a document hierarchy specified by the --extroot command-line option on "fossil server" or the extroot: option in the CGI file. check-in: ec56c69fe9 user: drh tags: trunk | |
| 21:09 | Remove an unused variable. Closed-Leaf check-in: c2a98a5d62 user: drh tags: extension-cgi | |
| 20:53 | Ensure that the cgi_decode_post_parameters() routine does not delete the raw content used by the /xfer page. check-in: af3a8dbe09 user: drh tags: extension-cgi | |
| 17:07 | Add the ability to extend a Fossil server using CGI. This is a refactor of the prior sub-cgi branch. check-in: ed2def5ffb user: drh tags: extension-cgi | |
|
2019-07-23
| ||
| 23:25 | Initial but incomplete work on an experimental /aux page that runs secondary CGI that has access to the Fossil user login credentials and similar information. This is an incremental check-in of work-in-progress. check-in: 72f8e77612 user: drh tags: sub-cgi | |
| 19:17 | Make sure an HTTP request always has at least a single "/" in the pathname. check-in: 35d609a0ba user: drh tags: trunk | |
| 18:20 | Fix over-length lines in the logic.c source file. No logical changes. check-in: cd11f92186 user: drh tags: trunk | |
Changes to src/cgi.c.
| ︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - - - - - + + + + + + + + + + | ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** |
| ︙ | |||
979 980 981 982 983 984 985 | 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 | - - - - - - - - - - - - + - - - - |
g.zIpAddr = mprintf("%s", z);
}
len = atoi(PD("CONTENT_LENGTH", "0"));
g.zContentType = zType = P("CONTENT_TYPE");
blob_zero(&g.cgiIn);
if( len>0 && zType ){
|
| ︙ | |||
1022 1023 1024 1025 1026 1027 1028 | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 | + + - - + + + + + + + + + + + + + + + + + + + + + + |
GET/POST arguments. i prefer for GET entries to take precedence
over like-named POST entries, but in order for that to happen we
need to process QUERY_STRING _after_ reading the POST data.
*/
cgi_set_content_type(json_guess_content_type());
}
#endif /* FOSSIL_ENABLE_JSON */
else{
blob_read_from_channel(&g.cgiIn, g.httpIn, len);
|
| ︙ |
Changes to src/dispatch.c.
| ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | + | #define CMDFLAG_TEST 0x0004 /* Commands for testing only */ #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */ #define CMDFLAG_COMMAND 0x0010 /* A command */ #define CMDFLAG_SETTING 0x0020 /* A setting */ #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */ #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */ #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */ #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */ /**************************************************************************/ /* Values for the 2nd parameter to dispatch_name_search() */ #define CMDFLAG_ANY 0x0038 /* Match anything */ #define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */ #endif /* INTERFACE */ |
| ︙ |
Changes to src/doc.c.
| ︙ | |||
527 528 529 530 531 532 533 534 535 536 537 538 539 540 | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
blob_append(cgi_output_blob(), &z[base], i-base);
blob_appendf(cgi_output_blob(), "%R");
base = i+5;
}
}
blob_append(cgi_output_blob(), &z[base], i-base);
}
/*
** Render a document as the reply to the HTTP request. The body
** of the document is contained in pBody. The body might be binary.
** The mimetype is in zMimetype.
*/
void document_render(
Blob *pBody, /* Document content */
const char *zMime, /* MIME-type */
const char *zDefaultTitle, /* Default title */
const char *zFilename /* Name of the file being rendered */
){
Blob title;
blob_init(&title,0,0);
if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){
Blob tail;
style_adunit_config(ADUNIT_RIGHT_OK);
if( wiki_find_title(pBody, &title, &tail) ){
style_header("%s", blob_str(&title));
wiki_convert(&tail, 0, WIKI_BUTTONS);
}else{
style_header("%s", zDefaultTitle);
wiki_convert(pBody, 0, WIKI_BUTTONS);
}
style_footer();
}else if( fossil_strcmp(zMime, "text/x-markdown")==0 ){
Blob tail = BLOB_INITIALIZER;
markdown_to_html(pBody, &title, &tail);
if( blob_size(&title)>0 ){
style_header("%s", blob_str(&title));
}else{
style_header("%s", zDefaultTitle);
}
convert_href_and_output(&tail);
style_footer();
}else if( fossil_strcmp(zMime, "text/plain")==0 ){
style_header("%s", zDefaultTitle);
@ <blockquote><pre>
@ %h(blob_str(pBody))
@ </pre></blockquote>
style_footer();
}else if( fossil_strcmp(zMime, "text/html")==0
&& doc_is_embedded_html(pBody, &title) ){
if( blob_size(&title)==0 ) blob_append(&title,zFilename,-1);
style_header("%s", blob_str(&title));
convert_href_and_output(pBody);
style_footer();
#ifdef FOSSIL_ENABLE_TH1_DOCS
}else if( Th_AreDocsEnabled() &&
fossil_strcmp(zMime, "application/x-th1")==0 ){
int raw = P("raw")!=0;
if( !raw ){
Blob tail;
blob_zero(&tail);
if( wiki_find_title(pBody, &title, &tail) ){
style_header("%s", blob_str(&title));
Th_Render(blob_str(&tail));
blob_reset(&tail);
}else{
style_header("%h", zName);
Th_Render(blob_str(pBody));
}
}else{
Th_Render(blob_str(pBody));
}
if( !raw ){
style_footer();
}
#endif
}else{
cgi_set_content_type(zMime);
cgi_set_content(pBody);
}
}
/*
** WEBPAGE: uv
** WEBPAGE: doc
** URL: /uv/FILE
** URL: /doc/CHECKIN/FILE
**
|
| ︙ | |||
616 617 618 619 620 621 622 623 624 625 626 627 628 629 | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | + |
zCheckin = mprintf("%.*s", i, zName);
if( fossil_strcmp(zCheckin,"ckout")==0 && g.localOpen==0 ){
zCheckin = "tip";
}
}
if( nMiss==count(azSuffix) ){
zName = "404.md";
zDfltTitle = "Not Found";
}else if( zName[i]==0 ){
assert( nMiss>=0 && nMiss<count(azSuffix) );
zName = azSuffix[nMiss];
}else if( !isUV ){
zName += i;
}
while( zName[0]=='/' ){ zName++; }
|
| ︙ | |||
688 689 690 691 692 693 694 | 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
Th_Store("doc_name", zName);
if( vid ){
Th_Store("doc_version", db_text(0, "SELECT '[' || substr(uuid,1,10) || ']'"
" FROM blob WHERE rid=%d", vid));
Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event"
" WHERE objid=%d AND type='ci'", vid));
}
|
| ︙ |
Added src/extcgi.c.