Changeset 42651
- Timestamp:
- Aug 12, 2018, 8:04:37 PM (2 years ago)
- Location:
- titan
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/tithek/tithek.h
r42645 r42651 578 578 } 579 579 580 gethttpreal(node->host, node->page, node->port, node->filename, node->auth, NULL, 0, NULL, NULL, node->timeout, 0); 580 if(node->cmd != NULL) 581 tmpstr = command(node->cmd); 582 else 583 gethttpreal(node->host, node->page, node->port, node->filename, node->auth, NULL, 0, NULL, NULL, node->timeout, 0); 581 584 if(ostrcmp(node->filename, "/media/hdd/.tithek/python.tar") == 0 || ostrcmp(node->filename, "/var/swap/.tithek/python.tar") == 0 || ostrcmp(node->filename, "/mnt/.tithek/python.tar") == 0) 582 585 printf("[tithek] download done: %s\n", node->filename); … … 639 642 640 643 end: 644 645 free(node->cmd); node->cmd = NULL; 641 646 free(node->host); node->host = NULL; 642 647 free(node->page); node->page = NULL; … … 653 658 char* tithekdownload(char* link, char* localname, char* pw, int pic, int flag) 654 659 { 655 int ret = 1, port = 80, timeout = 10000, ssl = 0, cloudflare= 0;660 int ret = 1, port = 80, timeout = 10000, ssl = 0, usecmd = 0; 656 661 char* ip = NULL, *pos = NULL, *path = NULL; 657 662 char* tmpstr = NULL, *localfile = NULL; 658 663 659 664 if(link == NULL) return NULL; 660 if(ostrncmp("http://", link, 7) && ostrncmp("https://", link, 8)) return NULL; 661 /* 662 if(ostrncmp("http://", link, 7) && ostrncmp("https://", link, 8) && ostrncmp("/tmp/localhoster/hoster.sh get", link, 30)) return NULL; 663 664 if(!ostrncmp("/tmp/localhoster/hoster.sh get", link, 30)) 665 cloudflare = 1; 665 if(ostrncmp("http://", link, 7) && ostrncmp("https://", link, 8) && ostrncmp("/tmp/localhoster/hoster.sh", link, 26)) return NULL; 666 667 if(!ostrncmp("/tmp/localhoster/hoster.sh", link, 26)) 668 usecmd = 1; 666 669 else if(!ostrncmp("https://", link, 8)) 667 */668 if(!ostrncmp("https://", link, 8))669 670 ssl = 1; 670 671 else … … 730 731 { 731 732 if(pic == 1) 732 { 733 if(cloudflare == 1) 734 { 735 char* cmd = NULL; 736 cmd = ostrcat(link, " > ", 0, 0); 737 cmd = ostrcat(cmd, localfile, 1, 0); 738 debug(99, "cmd: %s", cmd); 739 tmpstr = command(cmd); 740 free(cmd), cmd = NULL; 741 } 742 else if(ssl == 1) 733 { 734 if(ssl == 1) 743 735 gethttps(link, localfile, NULL, NULL, NULL, NULL, 0); 744 else if( tithekdownloadcount >= 24) //start max 24 threads736 else if(usecmd == 0 && tithekdownloadcount >= 24) //start max 24 threads 745 737 gethttp(ip, path, port, localfile, pw, timeout, NULL, 0); 746 738 else … … 750 742 if(dnode != NULL) 751 743 { 744 if(usecmd == 1) 745 dnode->cmd = ostrcat(link, NULL, 0, 0); 752 746 dnode->host = ostrcat(ip, NULL, 0, 0); 753 747 dnode->page = ostrcat(path, NULL, 0, 0); … … 764 758 else 765 759 { 766 if(ssl == 1) 760 if(usecmd == 1) 761 { 762 debug(99, "cmd: %s", link); 763 tmpstr = command(link); 764 } 765 elif(ssl == 1) 767 766 gethttps(link, localfile, NULL, NULL, NULL, NULL, 0); 768 767 else -
titan/titan/struct.h
r42625 r42651 669 669 struct download 670 670 { 671 char* cmd; 671 672 char* host; 672 673 char* page;
Note: See TracChangeset
for help on using the changeset viewer.