├── .gitignore ├── COPYRIGHT.GPL ├── COPYRIGHT.MIT ├── LICENSE ├── README.md ├── S1_lf.hh ├── S5_lf.hh ├── _strc.h ├── accept.cpp ├── add_to_langcfg.pl ├── adminr.cpp ├── arhbb.cpp ├── bin2s ├── bin2s.cpp ├── bvprintf.cpp ├── bvprintf.h ├── bvprintfv.cpp ├── c4char.pl ├── cdde.cpp ├── conf.cpp ├── config.h ├── configure ├── cres.cpp ├── crt0pe.s ├── cstat.cpp ├── debian ├── changelog ├── control ├── copyright ├── rules ├── shs-vpnclient.manpages ├── smallsrv.manpages ├── vpnc.changelog └── vpnc.control ├── def4str.pl ├── def4str2.pl ├── desc.htm ├── descr.htm ├── descu.htm ├── dgpp_quote.h ├── dhcp.h ├── dhcpd.cpp ├── dhhosts.h ├── djgpphelper ├── c1.bat ├── c1rr.bat ├── copyres.exe ├── cpres.exe ├── crt0pe.o ├── djgppe.djl ├── djgppew.djl ├── make_pe.exe ├── nd.o ├── ndp.o ├── sa ├── sar ├── sc0 ├── upl.o ├── ya └── yc ├── dnsd.cpp ├── en └── shs_lang.cfg ├── fcgi.cpp ├── fcgi.h ├── fix_langpack.pl ├── ftpd.cpp ├── fwnd.cpp ├── g4s1.hh ├── g4strhtm.hh ├── get4def.pl ├── getstr ├── getstr.cpp ├── gnutls_sert_templ ├── gz.cpp ├── gz.h ├── heap.cpp ├── hton.h ├── http.exe.manifest ├── httpd.cfg ├── httpd.exe.1 ├── httpd_usage.1.in ├── icfg.cpp ├── icfg_vpnclient.cpp ├── icfghtm.cpp ├── icfgjs.cpp ├── icfgrus.cpp ├── ico.h ├── ico2.h ├── isapi.cpp ├── isapi.h ├── lS1_lf.cfg ├── lS2_lf.cfg ├── lS3_lf.cfg ├── lS5_lf.cfg ├── lang_notes.txt ├── license.ssl ├── license06.txt ├── licr06.txt ├── mailip.cpp ├── makefile ├── makefile.bsd ├── makefile.dj ├── makefile.in ├── md5.cpp ├── md5.h ├── mdef.h ├── mkfakelib.pl ├── mkfakelib64.pl ├── mkfakelib_arm.pl ├── mkfakelib_cros.pl ├── mlist.h ├── mrc.cpp ├── mrc.h ├── msprintfchk.cpp ├── mstring1.cpp ├── mstring1.h ├── mstring2.cpp ├── musers.cpp ├── ndp.s ├── ndpdbg.s ├── nommc_dlfcn.h ├── notes.ssl ├── onelog.cpp ├── openssl_sert_templ ├── pe_m.h ├── pkbig.cpp ├── pklz.cpp ├── pop3d.cpp ├── proxy.cpp ├── prxcach.cpp ├── qsort.cpp ├── realloc.s ├── regular.cpp ├── regular.h ├── req.cpp ├── reqfunc.cpp ├── ress1.s ├── restart.cpp ├── ru └── shs_lang.cfg ├── rulst.cpp ├── rungnutls.cpp ├── runssl.cpp ├── runssl111.cpp ├── sa ├── sar ├── sc0 ├── script_examples ├── vpn_if_client_down.bat ├── vpn_if_client_down.sh ├── vpn_if_client_up.bat ├── vpn_if_client_up.sh ├── vpn_if_up.bat └── vpn_if_up.sh ├── secdll.h ├── seplog.cpp ├── sethttp3.cpp ├── shs_vpnclient.1 ├── shs_vpnclient_usage.1.in ├── slib.h ├── slloop.cpp ├── slloop_vpnclient.cpp ├── smptps.cpp ├── smtpcl.cpp ├── sndmsg.1 ├── sndmsg.cpp ├── sndmsg_usage.1.in ├── srv.h ├── srv0a.cpp ├── srv0a_vpnclient.cpp ├── srv_cgi.cpp ├── srv_ssi.cpp ├── srvars.cpp ├── srvdat.cpp ├── srvdat_vpnclient.cpp ├── srvmd5.cpp ├── stat.cpp ├── statusr.cpp ├── stpdta.s ├── stpdta_vpn.s ├── stpdtai.s ├── stpdtamg.s ├── stpdtar.s ├── stpdtari.s ├── strc.h ├── strcwm.h ├── strcwmr.h ├── strtoul.cpp ├── strvar.cpp ├── t3_g4strc.h ├── telnet.cpp ├── tlsdll.h ├── tlsm.cpp ├── to_linux.cpp ├── to_linux.h ├── to_win.h ├── to_win_djpp.h ├── tools.cpp ├── uninst.cpp ├── updr.rc ├── vpn.cpp ├── vpn.h ├── vpnclient.cfg ├── wgnuext.cpp ├── winclude ├── nethdr.h ├── tap-windows.h ├── winsock_IPv6.h ├── zconf.h └── zlib.h ├── winpr.cpp ├── wmbx.cpp ├── wndcfg.cpp ├── xx31.ico ├── ya └── yc /.gitignore: -------------------------------------------------------------------------------- 1 | depend.cpp 2 | makefile.orig 3 | Makefile 4 | t2icfghtm.cpp 5 | o 6 | oo 7 | o64 8 | wo 9 | arm 10 | fakelibs64 11 | fakelibs 12 | config.h.default 13 | httpd.cfg.default 14 | index.htm 15 | indexr.htm 16 | t2icfg.cpp 17 | g4strc.h 18 | S2_lf.hh 19 | lS2_lf.cfg 20 | g4strc.h 21 | S3_lf.hh 22 | lS3_lf.cfg 23 | g4strcwm.h 24 | fix_desk.pl 25 | fix_rdesk.pl 26 | fix_udesk.pl 27 | genpg6.pl 28 | -------------------------------------------------------------------------------- /COPYRIGHT.MIT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2014 OpenVPN Technologies, Inc. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the “Software”), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /S5_lf.hh: -------------------------------------------------------------------------------- 1 | 2 | /* Generated file. Do not edit it. */ 3 | #ifndef S5_lf_hh 4 | #define S5_lf_hh 5 | {"S5T_158416789", & lS5T_158416789}, 6 | {"S5t2T_622313", & lS5t2T_622313}, 7 | {"S5t2T_4129147", & lS5t2T_4129147}, 8 | {"S5t2T_622312", & lS5t2T_622312}, 9 | {"S5t2T_467549", & lS5t2T_467549}, 10 | {"S5t2T_0", & lS5t2T_0}, 11 | {"S5t2T_4675490", & lS5t2T_4675490}, 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /_strc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/_strc.h -------------------------------------------------------------------------------- /add_to_langcfg.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # 4 | # Copyright (C) 1999-2020 Maksim Feoktistov. 5 | # 6 | # This file is part of Small HTTP server project. 7 | # Author: Maksim Feoktistov 8 | # 9 | # 10 | # Small HTTP server is free software: you can redistribute it and/or modify it 11 | # under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License. 13 | # 14 | # Small HTTP server is distributed in the hope that it will be useful, but 15 | # WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see https://www.gnu.org/licenses/ 21 | # 22 | # Contact addresses for Email: support@smallsrv.com 23 | # 24 | # 25 | # 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | if($#ARGV<1) 37 | { 38 | die "Command line:\nadd_to_langcfg.pl srcfile.cfg dstfile.cfg [outfile.cfg]\n"; 39 | } 40 | 41 | %src= LoadLangFile($ARGV[0]); 42 | %dst= LoadLangFile($ARGV[1]); 43 | $ofile=$ARGV[1]; 44 | $ofile=$ARGV[2] if($#ARGV>=2); 45 | 46 | 47 | open FILE , ">>$ofile" || die ("Cant open dst $ofile\n"); 48 | 49 | $i=0; 50 | foreach $t (keys %src) 51 | { 52 | if(! $dst{$t} ) 53 | { 54 | 55 | print FILE "$t=$src{$t}\n\n"; 56 | $i++; 57 | } 58 | 59 | } 60 | 61 | 62 | close FILE; 63 | print STDERR "Added $i lines\n"; 64 | exit 0; 65 | 66 | sub LoadLangFile 67 | { 68 | my ($fname) = @_; 69 | my($t,%r,$x,$y,$l,$n); 70 | 71 | open FILE, "<$fname" || die ("Cant open src $fname\n"); 72 | 73 | $t=''; 74 | $l=1; 75 | $n=0; 76 | while() 77 | { 78 | s/[\r\n]+//g; 79 | s/^[ \t]+//g; 80 | 81 | 82 | 83 | 84 | if($_ eq '') 85 | { 86 | 87 | # if($t =~ /^([A-Za-z_0-9]+)=()/) 88 | 89 | ($x,$y)=split(/=/,$t,2); 90 | 91 | if($y ne '' && $x ne '') 92 | { 93 | $r{$x}=$y; 94 | $n++; 95 | } 96 | elsif($t ne '') 97 | { 98 | print STDERR "$fname:Bad line $l: $t\n"; 99 | } 100 | 101 | $t=''; 102 | 103 | } 104 | else 105 | { 106 | $t .= "\n " if($t ne ''); 107 | $t .= $_; 108 | } 109 | 110 | $l++; 111 | } 112 | 113 | 114 | 115 | close FILE; 116 | 117 | print STDERR "$fname: $l lines, $n strings loaded\n"; 118 | 119 | %r ; 120 | 121 | } 122 | 123 | 124 | # 125 | # sub SaveLangFile 126 | # { 127 | # my ($fname) = @_; 128 | # my($t,$y); 129 | # 130 | # open FILE, ">$fname" || die ("Cant open dst $fname\n"); 131 | # 132 | # close FILE; 133 | # 134 | # } 135 | -------------------------------------------------------------------------------- /adminr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/adminr.cpp -------------------------------------------------------------------------------- /bin2s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/bin2s -------------------------------------------------------------------------------- /bin2s.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //gcc -m32 -O3 -s bin2s.cpp -o bin2s.exe 26 | 27 | #include 28 | #include "mdef.h" 29 | 30 | extern "C" { 31 | #pragma GCC diagnostic ignored "-Wformat" 32 | //#pragma GCC diagnostic ignored "-Wcomment" 33 | //#pragma GCC diagnostic ignored "-Wwrite-strings" 34 | //#pragma GCC diagnostic ignored "-Wformat-security" 35 | #pragma GCC diagnostic ignored "-Wformat-extra-args" 36 | //#pragma GCC diagnostic ignored "-Wunused-result" 37 | //#pragma GCC diagnostic ignored "-Wwrite-strings" 38 | //#pragma GCC diagnostic ignored "-Wnarrowing" 39 | //#pragma GCC diagnostic ignored "-Wliteral-suffix" 40 | 41 | #define die(a,b...) { printf(a,b); return 1;}; 42 | 43 | #define PAGE_SIZE 4096 44 | #define lPAGE_SIZE 1024 45 | 46 | static union{ 47 | char tbc[PAGE_SIZE+8]; 48 | uint tbl[lPAGE_SIZE*2]; 49 | }; 50 | 51 | int main(int argc,char *argv[] ) 52 | { 53 | FILE *fout; 54 | FILE *fin; 55 | int b,bb,i,n=0; 56 | if(argc < 3)die("Command line: %s srcfile dstfile\r\n",argv[0]); 57 | if(! (fin=fopen(argv[1],"rb") ) )die("Could not open source %s...",argv[1]); 58 | if(! (fout=fopen(argv[2],"w")) )die("Could not open target %s...",argv[2]); 59 | 60 | // fprintf(fout,"%s" s_head); 61 | 62 | do 63 | { 64 | b=fread(tbc,1,PAGE_SIZE,fin); 65 | if(b<=0)break; 66 | bb=(b+3)>>2; 67 | DWORD_PTR(tbc[b])=0; 68 | for(i=0;i 30 | 31 | extern "C" 32 | { 33 | 34 | #define BFR_LIM 0x800 35 | 36 | #if defined(x86_64) || defined(AT_ARM) || defined(DJGPP) || A_64 37 | #define V_CDECL 38 | #else 39 | #define V_CDECL __attribute__((cdecl)) 40 | #endif 41 | 42 | typedef int (*PrintFlush)(void *,char *,ulong); 43 | 44 | struct BFILE 45 | { 46 | void *par; 47 | char *bfr,*t; 48 | PrintFlush Flush; 49 | void Init(void *p,PrintFlush f,char *b ){par=p; Flush=f; bfr=t=b; } 50 | 51 | 52 | 53 | #ifdef USEVALIST 54 | int bvprintf(const char *fmt, va_list v); 55 | #define mva_list va_list 56 | #else 57 | int bvprintf(const char *fmt, void *v) ; 58 | #undef mva_list 59 | #define mva_list void ** 60 | #endif 61 | 62 | int bprintf(const char *fmt,...) V_CDECL 63 | #ifdef BPRINTF_INLINE 64 | { 65 | #ifdef USEVALIST 66 | va_list a; 67 | int r; 68 | 69 | va_start(a, fmt); 70 | r=bvprintf(fmt,a); 71 | va_end(a); 72 | return r; 73 | #else 74 | return bvprintf(fmt,(void **) ((&fmt)+1 )) ; 75 | #endif 76 | 77 | } 78 | #endif 79 | ; 80 | int fflush() 81 | { int r; 82 | if( (r=t-bfr) ) 83 | { r=Flush(par,bfr,r); 84 | t=bfr; 85 | } 86 | return r; 87 | } 88 | 89 | }; 90 | 91 | int mvsprintfchk(char *t,char *et,const char *fmt, mva_list v); 92 | int msprintfchk(char *t,char *et,const char *fmt,...); 93 | int msprintf(char *t, const char *fmt,...); 94 | 95 | } 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /c4char.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # 4 | # Copyright (C) 1999-2020 Maksim Feoktistov. 5 | # 6 | # This file is part of Small HTTP server project. 7 | # Author: Maksim Feoktistov 8 | # 9 | # 10 | # Small HTTP server is free software: you can redistribute it and/or modify it 11 | # under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License. 13 | # 14 | # Small HTTP server is distributed in the hope that it will be useful, but 15 | # WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see https://www.gnu.org/licenses/ 21 | # 22 | # Contact addresses for Email: support@smallsrv.com 23 | # 24 | # 25 | # 26 | 27 | 28 | 29 | sub upc 30 | { 31 | my ($t)=@_; 32 | 33 | @a = unpack("cccc",$t); 34 | $t=sprintf '0x%2.2X%2.2X%2.2X%2.2X x4CHAR("%s") ',$a[3],$a[2],$a[1],$a[0],$t; 35 | $t ; 36 | } 37 | 38 | while(<>) 39 | { 40 | # s/C4CHAR\(\"(.+)\"\)/sprintf('0x%X ', unpack("cccc",$1)) /eg ; 41 | while( s/C4CHAR\(\"(.+)\"\)/upc($1) /eg ){ print STDERR "found $1\n" ;}; 42 | print $_; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /cdde.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | 27 | struct DirChk 28 | { 29 | ulong DirChkSum,DirChkSum2, 30 | // DirChkSumS,DirChkSum2S, 31 | DirChkSumX,DirChkSum2X, 32 | DirChkLngh; 33 | }; 34 | DirChk dirchk; 35 | void CalcDirChkSum(char *bb) 36 | { 37 | WIN32_FIND_DATA fnds; 38 | HANDLE hdl; 39 | int i; 40 | char *p; 41 | 42 | p=bb+strlen(bb); 43 | strcpy(p,"\\*.*"); 44 | if( ( hdl=FindFirstFile(bb,&fnds) )!=INVALID_HANDLE_VALUE ) 45 | { 46 | do 47 | { 48 | if( WORD_PTR(fnds.cFileName[0])!=0x2E && WORD_PTR(fnds.cFileName[0])!=0x2E2E ) 49 | { 50 | for(i=0;fnds.cFileName[i];++i) 51 | { dirchk.DirChkSum ^= ((1+i)<<5) * (fnds.cFileName[i]&~0x20); 52 | dirchk.DirChkSum2^=((ulong)(fnds.cFileName[i]&~0x20))<<(i%25); 53 | if(i<6) 54 | { dirchk.DirChkSumX ^=(fnds.cFileName[i]&~0x20)* ((i<<7)+1); 55 | dirchk.DirChkSum2X^=(fnds.cFileName[i]&~0x20)<<(i<<4); 56 | } 57 | } 58 | /* 59 | for(i=0;fnds.cAlternateFileName[i];++i) 60 | { dirchk.DirChkSumS +=(fnds.cAlternateFileName[i]&~0x20)* (1+(i<<5)); 61 | dirchk.DirChkSum2S^=(fnds.cAlternateFileName[i]&~0x20)<<(i%25); 62 | } 63 | */ 64 | if( !(fnds.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) 65 | dirchk.DirChkLngh+=fnds.nFileSizeLow; 66 | else 67 | { wsprintf(p,"\\%s",fnds.cFileName); 68 | CalcDirChkSum(bb); 69 | *p=0; 70 | } 71 | } 72 | }while(FindNextFile(hdl,&fnds)); 73 | FindClose(hdl); 74 | } 75 | *p=0; 76 | 77 | } -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CONFIG_H 3 | #define CONFIG_H 4 | 5 | #ifdef CONFIG_CURRENT_DIR 6 | 7 | #define CONFIG_BASE "" 8 | #define CONFIG_APPDIR "" 9 | #define CONFIG_LANG "" 10 | #define CONFIG_DATA "" 11 | #define CONFIG_CONFIG "" 12 | #define CONFIG_LOG "" 13 | #define CONFIG_TMP "" 14 | 15 | #elif ! defined(SYSUNIX) 16 | // Windows definitions 17 | 18 | #define CONFIG_BASE "c:\\shttps\\" 19 | #define CONFIG_APPDIR CONFIG_BASE 20 | #define CONFIG_SHARE CONFIG_BASE 21 | #define CONFIG_DATA CONFIG_BASE 22 | #define CONFIG_CONFIG CONFIG_BASE 23 | #define CONFIG_LOG CONFIG_BASE 24 | #define CONFIG_TMP CONFIG_BASE 25 | 26 | #else 27 | 28 | #define CONFIG_CONFIG "/etc/smallsrv/" 29 | #define CONFIG_BASE "/usr/local/" 30 | #define CONFIG_DATA "/var" 31 | #define CONFIG_SHARE "/usr/local/share/smallsrv/" 32 | #define CONFIG_LOG "/var/log/smallsrv/" 33 | #define CONFIG_APPDIR "/usr/local/lib/smallsrv/" 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /cres.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #include "pe_m.h" 27 | 28 | struct Rres{ 29 | ulong Flags; 30 | ulong TimeDateStamp; 31 | ulong Version; 32 | ushort NameEntry; 33 | ushort ID_NumEntry; 34 | ulong RVA[3]; 35 | } __attribute__ ((packed)); 36 | 37 | 38 | uchar *RCBase; 39 | //#define RCBase ((uchar *)(((PEAOUTHDR *)(0x400074+FILHSZ))->DataDirectory[2][0]+0x400000)) 40 | //end 41 | long DeltaRes; 42 | void UpdateRES(Rres *r) 43 | { 44 | int i; 45 | i=(r->NameEntry+r->ID_NumEntry)*2 +1; 46 | r->TimeDateStamp=0; 47 | r->Version=0; 48 | while(i>2) 49 | {i-=2; 50 | if(r->RVA[i]&0x80000000) 51 | {UpdateRES((Rres *) (RCBase+(r->RVA[i]&0xFFFF) ) ); } 52 | else 53 | {//r->RVA[i]+=DeltaRes; 54 | DWORD_PTR(RCBase[r->RVA[i]])+=DeltaRes; 55 | } 56 | } 57 | } 58 | 59 | 60 | int BindRes(PEAOUTHDR *PE1,PEAOUTHDR *PE2,FILHDR *FH2,int l) 61 | { 62 | int i1,i2,j; 63 | 64 | SCNHDR *SH1,*SH2; 65 | SH1=(SCNHDR *) &(PE1[1]); 66 | SH2=(SCNHDR *) &(PE2[1]); 67 | j=SH2->s_vaddr+ (SH2->s_paddr+0xFFF)&0xFFFFf000; 68 | memcpy(++SH2,SH1+1,sizeof(SCNHDR)); 69 | SH2->s_vaddr=j; 70 | FH2->f_nscns++; 71 | DeltaRes=j-SH1[1].s_vaddr; 72 | UpdateRES((Rres *)RCBase); 73 | PE2->DataDirectory[2][0]=j; 74 | PE2->DataDirectory[2][1]=PE1->DataDirectory[2][1]; 75 | // if(SH2->s_size > SH2->s_paddr)SH2->s_size=(SH2->s_paddr+0x1FF)&0xFFFFE00; 76 | PE2->SizeOfImage+=(SH2->s_size+0xFFF)&0xFFFFf000; 77 | SH2->s_scnptr=l; 78 | SH2->s_flags=0x40000040; 79 | return SH2->s_size; 80 | } 81 | 82 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: smallsrv 2 | Section: net 3 | Priority: standard 4 | Maintainer: Maksim Feoktistov 5 | Build-Depends: debhelper-compat (= 12) 6 | Standards-Version: 4.5.0 7 | Homepage: https://smallsrv.com 8 | 9 | Package: smallsrv 10 | Version: 3.06.29 11 | Architecture: any 12 | Multi-Arch: foreign 13 | Depends: libc6 (>= 2.14), libgnutls30 (>= 3.0.0), libssl1.1 (>= 1.1.0), ${misc:Depends}, ${shlibs:Depends} 14 | Description: Web, Mail, DNS, FTP, DHCP servers, HTTPS VPN server and client. 15 | HTTP server support: 16 | Server Side Includes. Regular expression in SSI. 17 | CGI and FastCGI interfaces for scripts 18 | ISAPI interface. 19 | Virtual hosts and directories 20 | Mail server support: 21 | POP3 server. 22 | SMTP server. 23 | Anti-spam filters. Good, bad, and gray lists common and personal 24 | for each user. 25 | Forwarding and possibilities to execute scripts for income messages. 26 | Execute external anti-virus 27 | FTP server support: 28 | Virtual directories for FTP 29 | FTP proxy. 30 | HTTP proxy server support: 31 | HTTP, FTP, HTTPS request supported 32 | Store lot of traffic, fast access. 33 | Internal continues downloading when connection broken. 34 | Server can request compressed and unpack reply on fly (with Zlib library) 35 | DNS server support: 36 | Reqursion from root DNS or from DNS of provider. Caching. 37 | Can dinamicaly check a serverice on remote host and if the service 38 | down, change one IP address to other. 39 | Option for autoreply to request to resolve IPv6 name. 40 | DNSBL server (work with SMTP) 41 | DNS over HTTP(S) aka DoH (RFC8484) 42 | DHCP server. 43 | HTTP TLS VPN server and client. 44 | Suport TUN and TAP interfaces. 45 | Run Up and Down scripted to configure interfaces, routing, DNS, etc. 46 | Full detail statistics. Include statiscs by countries. 47 | Web administration. 48 | IPv6 support 49 | SSL/TLS support with an external library. 50 | GZip compression support with an external Zlib library. 51 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # You must remove unused comment lines for the released package. 3 | #export DH_VERBOSE = 1 4 | #export DEB_BUILD_MAINT_OPTIONS = hardening=+all 5 | #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic 6 | #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed 7 | 8 | %: 9 | dh $@ 10 | -------------------------------------------------------------------------------- /debian/shs-vpnclient.manpages: -------------------------------------------------------------------------------- 1 | shs_vpnclient.1 2 | -------------------------------------------------------------------------------- /debian/smallsrv.manpages: -------------------------------------------------------------------------------- 1 | httpd.exe.1 2 | sndmsg.1 3 | -------------------------------------------------------------------------------- /debian/vpnc.changelog: -------------------------------------------------------------------------------- 1 | shs-vpnclient (3.06.36) unstable; urgency=low 2 | 3 | * Created separated package for VPN client 4 | * Little fix 5 | 6 | -- Maksim Feoktistov Sat, 15 Feb 2025 14:27:02 +0400 7 | -------------------------------------------------------------------------------- /debian/vpnc.control: -------------------------------------------------------------------------------- 1 | Source: shs-vpnclient 2 | Section: net 3 | Priority: standard 4 | Maintainer: Maksim Feoktistov 5 | Build-Depends: debhelper-compat (= 12) 6 | Standards-Version: 4.5.0 7 | Homepage: https://smallsrv.com 8 | 9 | Package: shs-vpnclient 10 | Version: 3.06.29 11 | Architecture: any 12 | Multi-Arch: foreign 13 | Depends: libc6 (>= 2.14), libgnutls30 (>= 3.0.0), libssl1.1 (>= 1.1.0), ${misc:Depends}, ${shlibs:Depends} 14 | Description: VPN client for Small HTTP server 15 | Can connect to Small HTTP server, by https protocol and setup VPN channel. 16 | -------------------------------------------------------------------------------- /def4str.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # 4 | # Copyright (C) 1999-2020 Maksim Feoktistov. 5 | # 6 | # This file is part of Small HTTP server project. 7 | # Author: Maksim Feoktistov 8 | # 9 | # 10 | # Small HTTP server is free software: you can redistribute it and/or modify it 11 | # under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License. 13 | # 14 | # Small HTTP server is distributed in the hope that it will be useful, but 15 | # WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see https://www.gnu.org/licenses/ 21 | # 22 | # Contact addresses for Email: support@smallsrv.com 23 | # 24 | # 25 | # 26 | 27 | 28 | $coment=0; 29 | 30 | $pref='STRx'; 31 | $pref=$ARGV[0] if($#ARGV>=0) ; 32 | $lpref="l$pref"; 33 | 34 | ; 35 | 36 | if($#ARGV>=1) 37 | { 38 | open LANGFILEC, ">$ARGV[1]\.hh" || die("Can't open ${pref}_lf\.hh"); 39 | open LANGCFG, ">$ARGV[1].cfg" || die("Can't open $ARGV[1]"); 40 | } 41 | else 42 | { 43 | open LANGFILEC, ">${pref}_lf\.hh" || die("Can't open ${pref}_lf\.hh"); 44 | open LANGCFG, ">${lpref}_lf\.cfg" || die("Can't open ${lpref}_lf\.cfg"); 45 | } 46 | $tif=''; 47 | $eif=0; 48 | while() 49 | { 50 | # 51 | # if(/^[ \t]+\/\*/ ) 52 | # { 53 | # $coment=1; 54 | # } 55 | # 56 | # if(/^[ \t]+\/\*/ ) 57 | # { 58 | # $coment=0; 59 | # } 60 | # 61 | 62 | if(/^#if/) 63 | { 64 | $tif.=$_; 65 | $eif++; 66 | } 67 | elsif(/^(#else|#endif)/) 68 | { 69 | $taa=$1; 70 | # $tif=$_ if($tif eq ''); 71 | if($tif eq '' && $eif>0) 72 | { 73 | # printf LANGFILEC $_ ; 74 | $eif-- if($taa eq '#endif'); 75 | } 76 | else 77 | { 78 | $tif=''; 79 | $eif--; 80 | } 81 | $eif=0 if($eif<0); 82 | 83 | } 84 | elsif( (! /^[ \t]*\/\//) && ! /DONT_AUTO_CHANGE/ ) 85 | { 86 | if( /^[ \t]*#define[ \t]+([A-z_0-9]+)[ \t]+(".+)[\r\n]/ ) 87 | { 88 | ($a,$b)=($1,$2); 89 | 90 | while($b =~ /\\$/ ) 91 | { 92 | $c=; 93 | exit 0 if(! $c) ; 94 | $c =~ s/[\r\n]+//gm; 95 | $b .= "\n $c"; 96 | } 97 | 98 | $b=~ s/\\\n/\n/gm; 99 | print "#ifdef MAINSTR\n char $pref$a\[\] = $b;\n" ; 100 | 101 | if($b =~ /[ \t\-]/) 102 | { 103 | 104 | 105 | print " char *$lpref$a = $pref$a;\n#else\n extern char *$lpref$a;\n extern char $pref$a\[\];\n#endif\n" ; 106 | 107 | printf LANGFILEC '%s{"%s",& %s}, 108 | ',$tif , "$pref$a" , "$lpref$a"; 109 | $tif=''; 110 | 111 | $b =~ s/\\"/__Q__/mg; 112 | $b =~ s/"//mg; 113 | $b =~ s/__Q__/"/mg; 114 | printf LANGCFG ' 115 | %s=%s 116 | ',"$pref$a",$b ; 117 | $_ = "#define $a $lpref$a\n#define x_$a $pref$a\n\n"; 118 | } 119 | else 120 | { 121 | print "#else\nextern char *$pref$a;\n#endif\n" ; 122 | $_ = "#define $a $pref$a\n#define x_$a $b\n"; 123 | 124 | } 125 | } 126 | } 127 | 128 | print $_; 129 | } 130 | 131 | 132 | close LANGFILEC ; 133 | close LANGCFG ; 134 | 135 | exit(0); 136 | -------------------------------------------------------------------------------- /descr.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/descr.htm -------------------------------------------------------------------------------- /dgpp_quote.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef DJGPP_QUOTE 3 | 4 | #ifdef DJGPP 5 | #define DJGPP_QUOTE " 6 | #else 7 | #define DJGPP_QUOTE 8 | #endif 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /dhcp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | /* 26 | RFC 1532 Clarifications and Extensions for BOOTP October 1993 27 | 28 | 29 | 0 1 2 3 30 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 31 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 32 | | op (1) | htype (1) | hlen (1) | hops (1) | 33 | +---------------+---------------+---------------+---------------+ 34 | | xid (4) | 35 | +-------------------------------+-------------------------------+ 36 | | secs (2) | flags (2) | 37 | +-------------------------------+-------------------------------+ 38 | | ciaddr (4) | 39 | +---------------------------------------------------------------+ 40 | | yiaddr (4) | 41 | +---------------------------------------------------------------+ 42 | | siaddr (4) | 43 | +---------------------------------------------------------------+ 44 | | giaddr (4) | 45 | +---------------------------------------------------------------+ 46 | | | 47 | | chaddr (16) | 48 | | | 49 | | | 50 | +---------------------------------------------------------------+ 51 | | | 52 | | sname (64) | 53 | +---------------------------------------------------------------+ 54 | | | 55 | | file (128) | 56 | +---------------------------------------------------------------+ 57 | | | 58 | | vend (64) | 59 | +---------------------------------------------------------------+ 60 | 61 | 62 | */ 63 | 64 | struct dhcpPacket{ 65 | uchar op; 66 | uchar htype; 67 | uchar hlen; 68 | uchar hops; 69 | ulong xid; 70 | ushort secs; 71 | ushort flags; 72 | ulong ciaddr; 73 | ulong yiaddr; 74 | ulong siaddr; 75 | ulong giaddr; 76 | uchar chaddr[16]; 77 | char sname[64]; 78 | uchar file[128]; 79 | uchar vend[1222]; 80 | } __attribute__ ((packed)); 81 | 82 | -------------------------------------------------------------------------------- /dhhosts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | 27 | extern struct DNS_FILEHEAD{ 28 | ulong dns_basetime; 29 | int dns_incache; 30 | }dns_filehead; 31 | 32 | 33 | 34 | extern ulong *dns_ip,redirect_dns[3],*dip,*dcache,pval; 35 | extern uchar *dtime; 36 | 37 | #define dns_basetime dns_filehead.dns_basetime 38 | #define dns_incache dns_filehead.dns_incache 39 | 40 | 41 | struct d_msg{ 42 | ushort id,flags; 43 | uchar t1,qdcount, 44 | t2,ancount, 45 | t3,nscount, 46 | t4,arcount; 47 | char buf[500]; 48 | } __attribute__ ((packed)); 49 | 50 | struct d_msgs{ 51 | ushort id,flags; 52 | uchar t1,qdcount, 53 | t2,ancount, 54 | t3,nscount, 55 | t4,arcount; 56 | char buf[2]; 57 | } __attribute__ ((packed)); 58 | #define d_msgDOH 1 59 | 60 | 61 | struct DHCPbase{ 62 | DHCPbase *next; 63 | union{ 64 | ulong flg; 65 | uchar tt[4]; 66 | }; 67 | #define dhcpReleased 1 68 | #define dhcpDeleted 2 69 | #define dhcpTry 4 70 | 71 | union{ 72 | ulong ip; 73 | uchar ipc[4]; 74 | }; 75 | char domain[64]; 76 | time_t t; 77 | union{ 78 | ulong hw_typeLengh; 79 | uchar hw_t[2]; 80 | }; 81 | uchar hw[16]; 82 | 83 | }; 84 | 85 | extern struct DHCPbase *dhcp_ar; 86 | 87 | extern int dhcpd_s,dhcpc_s; 88 | extern ulong first_dhcp_ip,total_dhcp_ip,last_dhcp_ip,allocated_dhcp_ip, gateway,netmask,dhcp_dns[3]; 89 | extern char *DhcpServerName; 90 | extern char *first_dhcpc; 91 | extern char *gatewayc; 92 | extern char *netmaskc; 93 | extern char *dhcp_dnsc; 94 | extern char *dhcp_fname; 95 | 96 | 97 | #ifdef SYSUNIX 98 | void* zalloc(uint a); 99 | #define ALLOC(a) Malloc(a) 100 | #else 101 | #define ALLOC(a) malloc(a) 102 | #endif 103 | 104 | #define FREE(a) free(a) 105 | 106 | void OptDHCP(); 107 | ulong WINAPI DHCPServ(void * fwrk); 108 | int InitDHCP(); 109 | void SaveDHCP(); 110 | void DelDHCPIP(ulong ip,char *n,char *t); 111 | 112 | -------------------------------------------------------------------------------- /djgpphelper/c1.bat: -------------------------------------------------------------------------------- 1 | gcc @yc -DRICON 2 | gcc @ya -DRICON 3 | make_pe.exe -p 0x3C00000 -o http.exe a.out 4 | cpres.exe copyres.exe http.exe 5 | bin2c.exe http.exe http.bin 6 | as stpdta.s -o stpdta.o 7 | gcc @sc0 -DRICON 8 | gcc @sa -DRICON 9 | make_pe.exe -o shttp3.exe a.out 10 | cpres.exe copyres.exe shttp3.exe 11 | -------------------------------------------------------------------------------- /djgpphelper/c1rr.bat: -------------------------------------------------------------------------------- 1 | as stpdtar.s -o stpdtar.o 2 | gcc @sc0 -DRUS -DRICON 3 | gcc @sar -DRICON 4 | make_pe.exe -o shttp3r.exe a.out 5 | cpres.exe copyres.exe shttp3r.exe 6 | -------------------------------------------------------------------------------- /djgpphelper/copyres.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/djgpphelper/copyres.exe -------------------------------------------------------------------------------- /djgpphelper/cpres.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/djgpphelper/cpres.exe -------------------------------------------------------------------------------- /djgpphelper/crt0pe.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/djgpphelper/crt0pe.o -------------------------------------------------------------------------------- /djgpphelper/djgppe.djl: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("coff-go32") 2 | ENTRY(PEStart) 3 | SECTIONS 4 | { 5 | .text 0x401000 : { 6 | crt0pe.o(.text) 7 | . = ALIGN(0x4); 8 | djgpp_first_ctor = . ; 9 | *(.ctor0) 10 | *(.ctor1) 11 | *(.ctor2) 12 | *(.ctor) 13 | djgpp_last_ctor = . ; 14 | djgpp_first_dtor = . ; 15 | *(.dtor) 16 | djgpp_last_dtor = . ; 17 | _beg_code = .; 18 | ndp.o(.text) 19 | upl.o(.text) 20 | *(.text) 21 | _end_code = . - 16; 22 | etext = . ; _etext = .; 23 | . = ALIGN(0x10); 24 | } 25 | .data ADDR(.text)+SIZEOF(.text) : { 26 | *(.data) 27 | edata = . ; _edata = .; 28 | } 29 | .bss SIZEOF(.data) + ADDR(.data) : 30 | { 31 | *(.datan) 32 | . = ALIGN(0x10); 33 | first_bss = . ; 34 | *(.bss) 35 | end = . ; _end = .; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /djgpphelper/djgppew.djl: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("coff-go32") 2 | ENTRY(PEStart) 3 | SECTIONS 4 | { 5 | .text 0x401000 : { 6 | crt0pe.o(.text) 7 | . = ALIGN(0x4); 8 | djgpp_first_ctor = . ; 9 | *(.ctor0) 10 | *(.ctor1) 11 | *(.ctor2) 12 | *(.ctor) 13 | djgpp_last_ctor = . ; 14 | djgpp_first_dtor = . ; 15 | *(.dtor) 16 | djgpp_last_dtor = . ; 17 | _beg_code = .; 18 | djo/ndp.o(.text) 19 | djo/pkoulz.o(.text) 20 | *(.text) 21 | _end_code = . - 16; 22 | etext = . ; _etext = .; 23 | . = ALIGN(0x10); 24 | } 25 | .data ADDR(.text)+SIZEOF(.text) : { 26 | *(.data) 27 | edata = . ; _edata = .; 28 | } 29 | .bss SIZEOF(.data) + ADDR(.data) : 30 | { 31 | *(.datan) 32 | . = ALIGN(0x10); 33 | first_bss = . ; 34 | *(.bss) 35 | end = . ; _end = .; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /djgpphelper/make_pe.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/djgpphelper/make_pe.exe -------------------------------------------------------------------------------- /djgpphelper/nd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/djgpphelper/nd.o -------------------------------------------------------------------------------- /djgpphelper/ndp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/djgpphelper/ndp.o -------------------------------------------------------------------------------- /djgpphelper/sa: -------------------------------------------------------------------------------- 1 | -fpack-struct 2 | -m486 3 | -s 4 | -O2 5 | -malign-loops=0 6 | -malign-jumps=0 7 | -malign-functions=0 8 | -fno-verbose-asm 9 | -fno-implicit-templates 10 | -mno-svr3-shlib 11 | -mno-align-double 12 | -mno-fancy-math-387 13 | -static 14 | -fsjlj-exceptions 15 | -Zpe 16 | -Xlinker -Map -Xlinker flxmaps 17 | -nostartfiles 18 | -fconserve-space 19 | -ID:\DJGPP\INCLUDE\WIN32 20 | -DSERVICE 21 | -mrtd 22 | ndp.o upl.o stpdta.o sethttp3.o 23 | -luser -lkern -lgdi -lshell -lcdlg -lwadv 24 | -------------------------------------------------------------------------------- /djgpphelper/sar: -------------------------------------------------------------------------------- 1 | -fpack-struct 2 | -m486 3 | -s 4 | -O2 5 | -malign-loops=0 6 | -malign-jumps=0 7 | -malign-functions=0 8 | -fno-verbose-asm 9 | -fno-implicit-templates 10 | -mno-svr3-shlib 11 | -mno-align-double 12 | -mno-fancy-math-387 13 | -static 14 | -fsjlj-exceptions 15 | -Zpe 16 | -Xlinker -Map -Xlinker flxmaps 17 | -nostartfiles 18 | -fconserve-space 19 | -ID:\DJGPP\INCLUDE\WIN32 20 | -DSERVICE 21 | -mrtd 22 | ndp.o upl.o stpdtar.o sethttp3.o 23 | -luser -lkern -lgdi -lshell -lcdlg -lwadv 24 | -------------------------------------------------------------------------------- /djgpphelper/sc0: -------------------------------------------------------------------------------- 1 | -c 2 | -fpack-struct 3 | -m486 4 | -s 5 | -O2 6 | -fno-implicit-templates 7 | -fsjlj-exceptions 8 | -Zpe 9 | -fconserve-space 10 | -ID:\DJGPP\INCLUDE\WIN32 11 | -DSERVICE=1 12 | -mrtd 13 | sethttp3.cpp 14 | -o sethttp3.o 15 | -------------------------------------------------------------------------------- /djgpphelper/upl.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/djgpphelper/upl.o -------------------------------------------------------------------------------- /djgpphelper/ya: -------------------------------------------------------------------------------- 1 | -fpack-struct 2 | -m486 3 | -s 4 | -O2 5 | -malign-loops=0 6 | -malign-jumps=0 7 | -malign-functions=0 8 | -fno-verbose-asm 9 | -fno-implicit-templates 10 | -mno-svr3-shlib 11 | -mno-align-double 12 | -mno-fancy-math-387 13 | -static 14 | -fsjlj-exceptions 15 | -Zpe 16 | -ID:\DJGPP\INCLUDE\WIN32 17 | -Xlinker -Map -Xlinker flxmap 18 | -nostartfiles 19 | -nodefaultlibs 20 | -fconserve-space -DONEFILE -DSERVICE -DFREE_VER -DV_FULL=1 -DUSE_IPV6 21 | -mrtd 22 | ndp.o upl.o srv0a.o 23 | -luser -lkern -lsock -lgdi -lshell -lcdlg -lwadv 24 | 25 | -------------------------------------------------------------------------------- /djgpphelper/yc: -------------------------------------------------------------------------------- 1 | -c 2 | -fpack-struct 3 | -m486 4 | -s 5 | -O2 6 | -malign-loops=0 7 | -malign-jumps=0 8 | -malign-functions=0 9 | -fno-verbose-asm 10 | -fno-implicit-templates 11 | -mno-svr3-shlib 12 | -mno-align-double 13 | -mno-fancy-math-387 14 | -static 15 | -fsjlj-exceptions 16 | -Zpe 17 | -ID:\DJGPP\INCLUDE\WIN32 18 | -fconserve-space -DONEFILE -DSERVICE -DFREE_VER -DFREEVER -DV_FULL=1 -DUSE_IPV6 -DSEPLOG -DSELECT1 19 | -mrtd 20 | srv0a.cpp 21 | 22 | -------------------------------------------------------------------------------- /fcgi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2023 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #ifndef _FCGI_H 27 | #define _FCGI_H 28 | 29 | #ifndef _PACKED 30 | #define PACKED __attribute__((packed)) 31 | #endif 32 | 33 | 34 | struct FCGI_Header{ 35 | unsigned char version; 36 | unsigned char type; 37 | unsigned short Id; 38 | unsigned short contentLength; 39 | unsigned char paddingLength; 40 | unsigned char reserved; 41 | //unsigned 42 | char data[0]; 43 | void Normalize(){ 44 | #ifndef BIG_ENDIAN 45 | contentLength = htons(contentLength); 46 | #endif 47 | } 48 | } PACKED ; 49 | 50 | #define FCGI_MAX_LENGTH 0xffff 51 | 52 | /* 53 | * Value for version component of FCGI_Header 54 | */ 55 | #define FCGI_VERSION_1 1 56 | 57 | /* 58 | * Values for type component of FCGI_Header 59 | */ 60 | #define FCGI_BEGIN_REQUEST 1 61 | #define FCGI_ABORT_REQUEST 2 62 | #define FCGI_END_REQUEST 3 63 | #define FCGI_PARAMS 4 64 | #define FCGI_STDIN 5 65 | #define FCGI_STDOUT 6 66 | #define FCGI_STDERR 7 67 | #define FCGI_DATA 8 68 | #define FCGI_GET_VALUES 9 69 | #define FCGI_GET_VALUES_RESULT 10 70 | #define FCGI_UNKNOWN_TYPE 11 71 | #define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE) 72 | 73 | 74 | 75 | struct FCGI_BeginRequestBody { 76 | unsigned char rez; 77 | unsigned char roleB; 78 | unsigned char flags; 79 | unsigned char reserved[5]; 80 | } ; 81 | 82 | typedef struct { 83 | FCGI_Header header; 84 | FCGI_BeginRequestBody body; 85 | } FCGI_BeginRequestRecord; 86 | 87 | /* 88 | * Mask for flags component of FCGI_BeginRequestBody 89 | */ 90 | #define FCGI_KEEP_CONN 1 91 | 92 | /* 93 | * Values for role component of FCGI_BeginRequestBody 94 | */ 95 | #define FCGI_RESPONDER 1 96 | #define FCGI_AUTHORIZER 2 97 | #define FCGI_FILTER 3 98 | 99 | 100 | struct FCGI_EndRequestBody{ 101 | unsigned int appStatus; 102 | unsigned char protocolStatus; 103 | unsigned char reserved[3]; 104 | 105 | void Normalize(){ 106 | #ifndef BIG_ENDIAN 107 | appStatus = htonl(appStatus); 108 | #endif 109 | } 110 | } ; 111 | 112 | typedef struct { 113 | FCGI_Header header; 114 | FCGI_EndRequestBody body; 115 | } FCGI_EndRequestRecord; 116 | 117 | /* 118 | * Values for protocolStatus component of FCGI_EndRequestBody 119 | */ 120 | #define FCGI_REQUEST_COMPLETE 0 121 | #define FCGI_CANT_MPX_CONN 1 122 | #define FCGI_OVERLOADED 2 123 | #define FCGI_UNKNOWN_ROLE 3 124 | 125 | 126 | /* 127 | * Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records 128 | */ 129 | #define FCGI_MAX_CONNS "FCGI_MAX_CONNS" 130 | #define FCGI_MAX_REQS "FCGI_MAX_REQS" 131 | #define FCGI_MPXS_CONNS "FCGI_MPXS_CONNS" 132 | 133 | 134 | typedef struct { 135 | unsigned char type; 136 | unsigned char reserved[7]; 137 | } FCGI_UnknownTypeBody; 138 | 139 | typedef struct { 140 | FCGI_Header header; 141 | FCGI_UnknownTypeBody body; 142 | } FCGI_UnknownTypeRecord; 143 | 144 | struct FCGI_Record 145 | { 146 | FCGI_Header header; 147 | union { 148 | char data[1]; 149 | FCGI_BeginRequestBody beg; 150 | FCGI_EndRequestBody end; 151 | }; 152 | } PACKED ; 153 | 154 | #endif /* _FCGI_H */ 155 | 156 | -------------------------------------------------------------------------------- /fix_langpack.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # 4 | # Copyright (C) 1999-2020 Maksim Feoktistov. 5 | # 6 | # This file is part of Small HTTP server project. 7 | # Author: Maksim Feoktistov 8 | # 9 | # 10 | # Small HTTP server is free software: you can redistribute it and/or modify it 11 | # under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License. 13 | # 14 | # Small HTTP server is distributed in the hope that it will be useful, but 15 | # WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see https://www.gnu.org/licenses/ 21 | # 22 | # Contact addresses for Email: support@smallsrv.com 23 | # 24 | # 25 | # 26 | 27 | 28 | 29 | if($#ARGV<1) 30 | { 31 | die("Comand line: src_lang_pack1.cfg src_lang_pack1.cfg >dst_lang_pack.cfg") 32 | } 33 | 34 | # open SRC1, "<$ARGV[0]" || die("Can't open $ARGV[0]"); 35 | # open SRC2, "<$ARGV[1]" || die("Can't open $ARGV[1]"); 36 | %src1 = LoadLang($ARGV[0]); 37 | %src2 = LoadLang($ARGV[1]); 38 | 39 | # open DST, ">$ARGV[2]" || die("Can't open $ARGV[2]"); 40 | 41 | if($#ARGV >=2 ) 42 | { 43 | open SRC, "<$ARGV[2]" || die("Can't open $ARGV[0]"); 44 | $cnt=0; 45 | $cnt2=0; 46 | while() 47 | { 48 | $z=$_; 49 | L1: foreach $k ( keys(%src1) ) 50 | { 51 | $y= substr($k,2); 52 | if( ( ! $src2{$k}) && 53 | # $z =~ # /$k/xi ) 54 | /(.+)$y/x ) 55 | { 56 | $n=$1; 57 | # $pref=substr($k,0,2); 58 | $x= mk_hash_back($n); 59 | 60 | for($i=1; $i<=3 ; $i++) 61 | { 62 | $xx="S$i" . "t2T_$x"; 63 | if($src2{$xx}) 64 | { 65 | print "$k=$src2{$xx}\n\n"; 66 | $dst{$k} = $src2{$xx} ; 67 | # print STDERR " Found!!! $k=$xx $src2{$xx} == $src1{$k}\n"; 68 | $cnt2++; 69 | goto L2; 70 | } 71 | } 72 | print STDERR " Not found $k $xx $y $src1{$k}\n"; 73 | 74 | L2: 75 | $cnt++; 76 | last L1; 77 | } 78 | 79 | } 80 | 81 | } 82 | print STDERR " total $cnt vars in file found $cnt2\n"; 83 | 84 | } 85 | 86 | 87 | $cnt = 0; 88 | foreach $k ( keys(%src1) ) 89 | { 90 | if($src2{$k}) 91 | { 92 | $dst{$k} = $src2{$k} ; 93 | } 94 | elsif( ! $dst{$k} ) 95 | { 96 | # print "$k=$src1{$k}\n\n"; 97 | $dst{$k} = $src1{$k} ; 98 | $cnt++; 99 | } 100 | 101 | print "$k=$dst{$k}\n\n"; 102 | 103 | } 104 | print STDERR "\n\n $cnt vars absent ($#ARGV)\n\n"; 105 | 106 | 107 | sub LoadLang 108 | { 109 | my ($file) = @_ ; 110 | my (%lf ); 111 | my ($name,$value,$cnt); 112 | 113 | $cnt=0; 114 | open SRC1, "<$file" || die("Can't open $file"); 115 | $name=''; 116 | $value=''; 117 | while() 118 | { 119 | s/[\r\n]+//g; 120 | if( $name ne '' ) 121 | { 122 | if($_ eq '') 123 | { 124 | $lf{$name}=$value; 125 | $name=''; 126 | $value=''; 127 | $cnt++; 128 | } 129 | else 130 | { 131 | $value .= "\n$_"; 132 | } 133 | } 134 | elsif(/([^ \t=]+)=(.+)/) 135 | { 136 | ($name,$value)=($1,$2); 137 | 138 | } 139 | 140 | 141 | } 142 | 143 | close SRC1; 144 | print STDERR "$file: $cnt vars loaded\n" ; 145 | %lf ; 146 | } 147 | 148 | 149 | sub mk_hash_back 150 | { 151 | my ($str) = @_ ; 152 | 153 | my($r,$i,$p,$t) ; 154 | $r=0; 155 | $i=1; 156 | $p= length($str) - 1; 157 | while($p>=0 ) 158 | { 159 | $t = ord( substr($str,$p,1) ) ; 160 | # if( $t != ' ' && $t != '\t' && $t<128 ) 161 | if( $t > 0x20 && $t<128 ) 162 | { 163 | $r+=($t-0x21)*$i; 164 | $i+=95; 165 | if($i> 22369621 ) #(0x7FFFffff/96)) 166 | { 167 | $i=($i+1)%95; 168 | } 169 | } 170 | $p--; 171 | } 172 | 173 | $r; 174 | } -------------------------------------------------------------------------------- /g4strhtm.hh: -------------------------------------------------------------------------------- 1 | 2 | /* Generated file. Do not edit it. */ 3 | #ifndef g4strhtm_hh 4 | #define g4strhtm_hh 5 | 6 | #ifdef MAINSTR 7 | char S5T_158416789[] = "

VPN Limit status:

\n" 8 | "" 9 | ""; 17 | char *lS5T_158416789 = S5T_158416789; 18 | #else 19 | extern char *lS5T_158416789; 20 | extern char S5T_158416789[]; 21 | #endif 22 | #define T_158416789 lS5T_158416789 23 | #define x_T_158416789 S5T_158416789 24 | 25 | 26 | #ifdef MAINSTR 27 | char S5t2T_622313[] = ""; 30 | char *lS5t2T_622313 = S5t2T_622313; 31 | #else 32 | extern char *lS5t2T_622313; 33 | extern char S5t2T_622313[]; 34 | #endif 35 | #define t2T_622313 lS5t2T_622313 36 | #define x_t2T_622313 S5t2T_622313 37 | 38 | 39 | #ifdef MAINSTR 40 | char S5t2T_4129147[] = "Keep-Alive Sleep"; 41 | char *lS5t2T_4129147 = S5t2T_4129147; 42 | #else 43 | extern char *lS5t2T_4129147; 44 | extern char S5t2T_4129147[]; 45 | #endif 46 | #define t2T_4129147 lS5t2T_4129147 47 | #define x_t2T_4129147 S5t2T_4129147 48 | 49 | 50 | #ifdef MAINSTR 51 | char S5t2T_622312[] = "HTTP/1.1 200 Ok\r\n" 52 | "Pragma: no-cache\r\n" 53 | "Content-Type: text/html%s\r\n" 54 | "\r\n" 55 | "\n" 65 | "Administration of Small HTTP server

Small HTTP server


Administration" 67 | " page.

" 10 | "IP/user" 11 | "Total in/out (Mb)" 12 | "left per hour (Mb)" 13 | "left per day (Mb)" 14 | "left per month (Mb)" 15 | "  " 16 | "
SettingUsers & Virtual HostsCurrent Log
%s
Current" 69 | " statistics / pagesCurrent stateSummary statisticsLogout
"; 73 | char *lS5t2T_622312 = S5t2T_622312; 74 | #else 75 | extern char *lS5t2T_622312; 76 | extern char S5t2T_622312[]; 77 | #endif 78 | #define t2T_622312 lS5t2T_622312 79 | #define x_t2T_622312 S5t2T_622312 80 | 81 | 82 | #ifdef MAINSTR 83 | char S5t2T_467549[] = "TLS VPN:%s: %u.%u.%u.%u"; 84 | char *lS5t2T_467549 = S5t2T_467549; 85 | #else 86 | extern char *lS5t2T_467549; 87 | extern char S5t2T_467549[]; 88 | #endif 89 | #define t2T_467549 lS5t2T_467549 90 | #define x_t2T_467549 S5t2T_467549 91 | 92 | 93 | #ifdef MAINSTR 94 | char S5t2T_0[] = "

Now connected:

Time (ms)"; 101 | char *lS5t2T_0 = S5t2T_0; 102 | #else 103 | extern char *lS5t2T_0; 104 | extern char S5t2T_0[]; 105 | #endif 106 | #define t2T_0 lS5t2T_0 107 | #define x_t2T_0 S5t2T_0 108 | 109 | 110 | #ifdef MAINSTR 111 | char S5t2T_4675490[] = "VPN Client: %u.%u.%u.%u"; 112 | char *lS5t2T_4675490 = S5t2T_4675490; 113 | #else 114 | extern char *lS5t2T_4675490; 115 | extern char S5t2T_4675490[]; 116 | #endif 117 | #define t2T_4675490 lS5t2T_4675490 118 | #define x_t2T_4675490 S5t2T_4675490 119 | 120 | 121 | #endif 122 | -------------------------------------------------------------------------------- /get4def.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # 4 | # Copyright (C) 1999-2020 Maksim Feoktistov. 5 | # 6 | # This file is part of Small HTTP server project. 7 | # Author: Maksim Feoktistov 8 | # 9 | # 10 | # Small HTTP server is free software: you can redistribute it and/or modify it 11 | # under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation, either version 3 of the License. 13 | # 14 | # Small HTTP server is distributed in the hope that it will be useful, but 15 | # WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see https://www.gnu.org/licenses/ 21 | # 22 | # Contact addresses for Email: support@smallsrv.com 23 | # 24 | # 25 | # 26 | 27 | 28 | $coment=0; 29 | 30 | $pref='STRx'; 31 | $pref=$ARGV[0] if($#ARGV>=0) ; 32 | $lpref="l$pref"; 33 | 34 | ; 35 | 36 | if($#ARGV>=1) 37 | { 38 | open LANGFILEC, ">$ARGV[1]\.hh" || die("Can't open ${pref}_lf\.hh"); 39 | open LANGCFG, ">$ARGV[1].cfg" || die("Can't open $ARGV[1]"); 40 | } 41 | else 42 | { 43 | open LANGFILEC, ">${pref}_lf\.hh" || die("Can't open ${pref}_lf\.hh"); 44 | open LANGCFG, ">${lpref}_lf\.cfg" || die("Can't open ${lpref}_lf\.cfg"); 45 | } 46 | 47 | while() 48 | { 49 | 50 | if(/^[ \t]+\/\*/ ) 51 | { 52 | $coment=1; 53 | } 54 | 55 | if(/^[ \t]+\/\*/ ) 56 | { 57 | $coment=0; 58 | } 59 | 60 | 61 | if( (!$coment) && ! /^[ \t]*\/\// ) 62 | { 63 | if( /"(.+)"(.*)/ ) 64 | { 65 | ($a,$b)=($1,$2); 66 | 67 | while($b ne '"' ) 68 | { 69 | $a .= '\\' if($a =~ /\\$/); 70 | $c=; 71 | exit 0 if(! $c) ; 72 | if( $c =~ /(.*)([\r\n"])/ ) 73 | { 74 | $b .= "\n $c"; 75 | 76 | } 77 | else 78 | { 79 | $b .= "\n$c\n"; 80 | } 81 | $c =~ s/[\r\n]+//gm; 82 | } 83 | 84 | $b=~ s/\\\n/\n/gm; 85 | print "#ifdef MAINSTR\n char $pref$a\[\] = $b;\n" ; 86 | 87 | if($b =~ /[ \t\-]/) 88 | { 89 | 90 | 91 | print "char * $lpref$a = $pref$a;\n #else\n extern char * $lpref$a;\n #endif\n" ; 92 | 93 | printf LANGFILEC '{"%s",& %s}, 94 | ' , "$pref$a" , "$lpref$a"; 95 | 96 | $b =~ s/\\"/__Q__/mg; 97 | $b =~ s/"//mg; 98 | $b =~ s/__Q__/"/mg; 99 | printf LANGCFG ' 100 | %s=%s 101 | ',"$pref$a",$b ; 102 | $_ = "#define $a $lpref$a\n"; 103 | } 104 | else 105 | { 106 | print "#else\nextern char *$pref$a;\n#endif\n" ; 107 | $_ = "#define $a $pref$a\n"; 108 | 109 | } 110 | } 111 | } 112 | 113 | print $_; 114 | } 115 | 116 | close LANGFILEC ; 117 | close LANGCFG ; 118 | 119 | -------------------------------------------------------------------------------- /getstr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/getstr -------------------------------------------------------------------------------- /gnutls_sert_templ: -------------------------------------------------------------------------------- 1 | organization = "Best organization" 2 | locality = "All World" 3 | state = None 4 | country = AW 5 | 6 | # common name 7 | cn = "Temp sertificate" 8 | 9 | serial = 123456789 10 | expiration_days = 3650 11 | 12 | # subjectAltNames 13 | dns_name = noname.net 14 | -------------------------------------------------------------------------------- /gz.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | 27 | #ifndef GZ_H 28 | #define GZ_H 29 | 30 | 31 | #if defined(MIPS) || defined(LPC_ARM) 32 | #include "uclinux/zlib.h" 33 | #else 34 | #include 35 | #endif 36 | #define ZBOSIZE 0x10000 37 | #ifndef EXTERN 38 | #define EXTERN extern 39 | #endif 40 | 41 | typedef int (* tgzfunc)(z_streamp strm, int flush); 42 | typedef int (* tgzfunc2)(z_streamp strm); 43 | typedef int (* tgzfunc3)( 44 | //z_streamp strm, int flush,const char *version, int stream_size 45 | z_streamp strm, int level, int method, 46 | int windowBits, int memLevel, 47 | int strategy, const char *version, 48 | int stream_size 49 | ); 50 | typedef int (* tgzfunc4)(z_streamp strm,int,const char *version, int stream_size); 51 | 52 | typedef int (* transfunc)(void *x,void *b, int l); 53 | 54 | EXTERN tgzfunc ZPack,ZUnpack; 55 | EXTERN tgzfunc3 ZPackInit; 56 | EXTERN tgzfunc2 ZPackEnd,ZUnpackEnd; 57 | EXTERN tgzfunc4 ZUnpackInit; 58 | 59 | EXTERN char *zlib; 60 | 61 | #ifndef MINGW 62 | #define HINSTANCE void * 63 | //typedef void *HINSTANCE; 64 | #endif 65 | 66 | EXTERN HINSTANCE hZlib; 67 | EXTERN int zlibstate; 68 | EXTERN char * NoGZSuf; 69 | EXTERN uint GZSizeLow; 70 | 71 | 72 | struct GZObj 73 | { 74 | z_stream z; 75 | tgzfunc f; 76 | tgzfunc2 fe; 77 | transfunc tf; 78 | void *par; 79 | int h2; 80 | ulong crc,totallen; 81 | char b[ZBOSIZE+8]; 82 | char last[8]; 83 | int lflg; 84 | int chustate,chul; 85 | #define UseChuke 1 86 | #define ChukeWaitLF 2 87 | #define InChuke 4 88 | 89 | 90 | int Get(void *t,int l); 91 | int Put(const void *t,int l); 92 | void End(); 93 | int InitPack(transfunc tff,void *pp); 94 | int InitUnpack(transfunc tff,void *pp); 95 | int ChuInit(char *x,int ll); 96 | //int InitUnpack(transfunc tff,void *pp){tf=tff; par=pp; f=ZUnpack; fe=ZUnpackEnd; (ZUnpackInit)(&z,"1",sizeof(z)); }; 97 | }; 98 | 99 | int GZSndSkip(Req *th,uchar *b,int l); 100 | 101 | int InitZLib(); 102 | EXTERN const uchar gz_head[10+sizeof("Content-Encoding: gzip\r\n\r\n")-1 ]; 103 | #endif 104 | -------------------------------------------------------------------------------- /heap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //g++ heap.cpp -DTESTMEM -o testt 26 | 27 | #define MEM_USED 0x80000000 28 | //#define DBG_SIGN 0x55aa1122 29 | #include "mdef.h" 30 | // #define DBGMEM 31 | 32 | struct Heap 33 | { 34 | ulong size; 35 | ulong d[0]; 36 | 37 | void *Alloc(ulong s); 38 | void Free(void *p); 39 | int Compact(); 40 | void Init(ulong s){size=s-2; d[0]=--s; d[s]=s|MEM_USED; }; 41 | 42 | 43 | void TestOut(); 44 | void CheckMem(); 45 | 46 | }; 47 | 48 | void memset4(ulong *t,ulong v,ulong l) 49 | { 50 | register ulong *b=t; 51 | t+=l; 52 | while(b>2; 65 | 66 | // CheckMem(); 67 | do{ 68 | for(i=0;i=s && ! (d[i]&MEM_USED) ) 71 | { 72 | if(d[i]>s) 73 | { 74 | j=i+s; 75 | d[j]=d[i]-s; 76 | d[i]=s; 77 | } 78 | d[i]|=MEM_USED; 79 | #ifdef DBGMEM 80 | d[i+s-1]=DBG_SIGN; 81 | memset4(d+i+1,0,s-2); 82 | #else 83 | memset4(d+i+1,0,s-1); 84 | #endif 85 | 86 | 87 | 88 | return d+i+1; 89 | } 90 | } 91 | }while(Compact()>=s); 92 | return 0; 93 | }; 94 | 95 | int Heap::Compact() 96 | { 97 | ulong i,j,r; 98 | 99 | r=0; 100 | 101 | for(i=0;i=size)break; 109 | } 110 | if(r=size)break; 137 | } 138 | 139 | } 140 | }; 141 | 142 | 143 | /* 144 | 145 | Init(100); -> 146 | 147 | size=100 148 | 149 | 150 | 151 | */ 152 | 153 | #ifdef DBGMEM 154 | 155 | 156 | void Heap::CheckMem() 157 | { 158 | int i; 159 | for(i=0;i %u %X\n",i,d[i]&~MEM_USED,d[i]); 163 | debug("Detected memory error: %u size %u addr %X %.128s",i,d[i]&~MEM_USED,d+i+1,d+i+1 ); 164 | } 165 | } 166 | 167 | #endif 168 | 169 | #ifdef TESTMEM 170 | 171 | #include 172 | 173 | 174 | void Heap::TestOut() 175 | { 176 | int i; 177 | printf("\n\nHeap out\n"); 178 | for(i=0;i %u %X\n",i,d[i]&~MEM_USED,d[i]); 181 | } 182 | } 183 | 184 | 185 | union{ 186 | Heap hp; 187 | ulong bbb[200]; 188 | } u; 189 | 190 | int main() 191 | { 192 | ulong *a[5]; 193 | int i,j; 194 | 195 | u.hp.Init(100); 196 | u.hp.TestOut(); 197 | for(i=0;i<5;++i) 198 | { 199 | a[i]=(ulong *) u.hp.Alloc(5+i); 200 | u.hp.TestOut(); 201 | } 202 | 203 | u.hp.Free(a[2]); 204 | u.hp.TestOut(); 205 | u.hp.Free(a[3]); 206 | u.hp.TestOut(); 207 | u.hp.Compact(); 208 | // u.hp.Free(a[1]); 209 | u.hp.TestOut(); 210 | a[4]=(ulong *) u.hp.Alloc(30); 211 | u.hp.TestOut(); 212 | 213 | return 0; 214 | 215 | } 216 | 217 | 218 | 219 | #endif 220 | 221 | -------------------------------------------------------------------------------- /hton.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | 27 | 28 | #if defined(NOTINTEL) && ! defined(x86_64) 29 | 30 | 31 | inline void XCHG(void *a,void *b) 32 | { 33 | int c; 34 | c=*(int *)a; 35 | *(int *)a=*(int *)b; 36 | *(int *)b=c; 37 | } 38 | inline void XCHGP(void **a,void **b) 39 | { 40 | void *c; 41 | c=*a; 42 | *a=*b; 43 | *b=c; 44 | } 45 | #define xchg(a,b) XCHG(&(a),&(b)) 46 | #define xchgp(a,b) XCHGP( (void **) &(a), (void **) &(b)) 47 | 48 | inline int MULDIV(uint a,uint b,uint c) 49 | { 50 | return (unsigned long long )a * (unsigned long long) b / c ; 51 | } 52 | 53 | inline int IMULDIV(int a,int b,int c) 54 | { 55 | return (long long )a * (long long) b / c ; 56 | } 57 | 58 | inline ulong rol(ulong a,int b){ 59 | b&=0x1F; 60 | return (a<>(32-b)); 61 | } 62 | 63 | 64 | inline ulong ror(ulong a,int b){ 65 | b&=0x1F; 66 | return (a>>b)|(a<<(32-b)); 67 | } 68 | 69 | 70 | #ifdef __cplusplus 71 | 72 | inline ulong DIVMODLL(ulong a,ulong b,ulong d, 73 | ulong &m) 74 | { 75 | union { 76 | ulong l[2]; 77 | long long ll; 78 | } ; 79 | l[0]=a; l[1]=b; 80 | m= ll%d; 81 | return ll/d; 82 | } 83 | #endif 84 | 85 | 86 | #else 87 | inline int intel16(int a) 88 | { 89 | asm volatile("xchgb %%ah,%%al":"=&a" (a) 90 | :"0" (a) 91 | // :"%eax" 92 | ); 93 | return a; 94 | } 95 | inline int intel32(int a) 96 | { 97 | asm volatile("xchgb %%ah,%%al\n" 98 | " roll $16,%%eax\n" 99 | " xchgb %%ah,%%al\n" 100 | " ":"=&a" (a) 101 | :"0" (a) 102 | // :"%eax" 103 | ); 104 | return a; 105 | } 106 | 107 | #if defined(x86_64) 108 | 109 | inline void XCHGP(void *a,void *b) 110 | { 111 | asm volatile( "movq (%%rax),%%rcx\n" 112 | " xchgq (%%rdx),%%rcx\n" 113 | " movq %%rcx, (%%rax)\n" 114 | " ":"=&a" (a),"=&d" (b) 115 | :"0" (a),"1" (b) 116 | :"%rcx" 117 | ); 118 | }; 119 | 120 | inline void XCHG(void *a,void *b) 121 | { 122 | asm volatile("movl (%%rax),%%ecx\n" 123 | " xchgl (%%rdx),%%ecx\n" 124 | " movl %%ecx, (%%rax)\n" 125 | " ":"=&a" (a),"=&d" (b) 126 | :"0" (a),"1" (b) 127 | :"%rcx" 128 | ); 129 | }; 130 | 131 | #define xchg(a,b) XCHG(&a,&b) 132 | #define xchgp(a,b) XCHGP(&a,&b) 133 | 134 | #else 135 | 136 | inline void XCHG(void *a,void *b) 137 | { 138 | asm volatile("movl (%%eax),%%ecx\n" 139 | " xchgl (%%edx),%%ecx\n" 140 | " movl %%ecx, (%%eax)\n" 141 | " ":"=&a" (a),"=&d" (b) 142 | :"0" (a),"1" (b) 143 | :"%ecx" 144 | ); 145 | }; 146 | 147 | #define xchg(a,b) XCHG(&a,&b) 148 | #define xchgp(a,b) XCHG(&a,&b) 149 | 150 | 151 | #endif 152 | 153 | inline int MULDIV(uint a,uint b,uint c) 154 | { 155 | asm volatile( 156 | "mull %2\n" 157 | " divl %3\n" 158 | " ":"=&a" (a) 159 | : "0"(a), "m" (b), "m" (c) 160 | :"%edx" 161 | ); 162 | return a; 163 | }; 164 | inline int IMULDIV(int a,int b,int c) 165 | { 166 | asm volatile( 167 | "imull %2\n" 168 | " idivl %3\n" 169 | " ":"=&a" (a) 170 | : "0"(a), "m" (b), "m" (c) 171 | :"%edx" 172 | ); 173 | return a; 174 | }; 175 | #undef htonl 176 | #undef htons 177 | #define htonl intel32 178 | #define htons intel16 179 | 180 | inline ulong rol(ulong a,int b){ 181 | asm volatile("\n" 182 | " roll %%cl,%%eax\n" 183 | "":"=&a"(a),"=&c"(b) 184 | :"0"(a),"1"(b) 185 | ); 186 | return a; 187 | }; 188 | inline ulong ror(ulong a,int b){ 189 | asm volatile("\n" 190 | " rorl %%cl,%%eax\n" 191 | "":"=&a"(a),"=&c"(b) 192 | :"0"(a),"1"(b) 193 | ); 194 | return a; 195 | } 196 | 197 | #ifdef __cplusplus 198 | inline ulong DIVMODLL(ulong a,ulong b,ulong d,ulong &m) 199 | { asm volatile("\n" 200 | " divl %%ecx\n" 201 | " ":"=&a" (a), "=&d" (m) , "=&c" (d) 202 | :"0" (a), "1"(b), "2"(d) 203 | ); 204 | return a; 205 | } 206 | #else 207 | inline ulong DIVMODLL(ulong a,ulong b,ulong d,ulong *m) 208 | { asm volatile("\n" 209 | " divl %%ecx\n" 210 | " ":"=&a" (a), "=&d" (*m) , "=&c" (d) 211 | :"0" (a), "1"(b), "2"(d) 212 | ); 213 | return a; 214 | } 215 | #endif 216 | 217 | #endif 218 | -------------------------------------------------------------------------------- /http.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /httpd.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | # General setting: 4 | log=/var/log/smallsrv/httpd.log 5 | detail 6 | logday 7 | # Uncomment next line to enable Web administration 8 | # radmin 9 | 10 | # Direct IPs from that Web administration will be avilable: 11 | adm_range="127.0.0.1,192.168.0.0-192.168.255.254,10.0.0.0-10.255.255.254" 12 | adm_deny="" 13 | 14 | 15 | # HTTP server setting: 16 | max=32 17 | port=80 18 | dir="/var/www" 19 | def="index.*" 20 | 21 | # Other 22 | 23 | # Change "none" to your password 24 | user=admin;none;/var/smallsrv;A 25 | 26 | -------------------------------------------------------------------------------- /httpd_usage.1.in: -------------------------------------------------------------------------------- 1 | [NAME] 2 | smallsrv -- Small HTTP Server 3 | 4 | [SYNOPSIS] 5 | httpd.exe [--v][--c config_file|@config_file][--h|?] [{Params }] 6 | 7 | httpd.exopenssl [--v][--c config_file|@config_file][--h|?] [{Params }] 8 | 9 | httpd.exgnutls [--v][--c config_file|@config_file][--h|?] [{Params }] 10 | 11 | 12 | [DESCRIPTION] 13 | The program included Web-server, Mail server (POP3/SMTP), DNS server, FTP server, DHCP server, HTTPS VPN server and client. 14 | 15 | httpd.exopenssl is built to work with the OpenSSL security library. 16 | 17 | httpd.exgnutls is built to work with the GNUTLS security library. 18 | 19 | httpd.exe allows you to select a security library in the configuration. (lib/smallsrv/libsec111.so or lib/smallsrv/libsecgnutls.so) 20 | 21 | [OPTIONS] 22 | 23 | [FILES] 24 | /etc/smallsrv/httpd.cfg -- config file 25 | 26 | /etc/smallsrv/shs_lang.cfg -- language pack, may be present as link to /usr/local/share/smallsrv//shs_lang.cfg 27 | 28 | Without this file English language used. 29 | 30 | Names of another files can be changed in httpd.cfg 31 | 32 | If the /etc/smallsrv/httpd.cfg is absent the program find it in the current directory. 33 | 34 | If used `--c config_file` key, the program will be use only this. 35 | 36 | [SIGNALS] 37 | 38 | SIGHUP -- Toggle VPN client connection (Connect/Disconnect) 39 | 40 | SIGUSR1 -- Flush logs to files 41 | 42 | [AUTHOR] 43 | Written by Maksim Feoktistov 44 | 45 | [REPORTING BUGS] 46 | Maksim Feoktistov 47 | 48 | [SEE ALSO] 49 | The full description is maintained as a html file in /usr[/local]/share/smallsrv/descu.htm 50 | Last version at https://smallsrv.com/descu.htm 51 | 52 | If the program runed and HTTP server enabled, Web administration available at http://127.0.0.1/$_admin_$conf 53 | 54 | -------------------------------------------------------------------------------- /icfghtm.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/icfghtm.cpp -------------------------------------------------------------------------------- /icfgjs.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/icfgjs.cpp -------------------------------------------------------------------------------- /icfgrus.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/icfgrus.cpp -------------------------------------------------------------------------------- /ico.h: -------------------------------------------------------------------------------- 1 | 2 | 119, 119, 125, 221, 135, 199, 124, 204, 122, 170, 119, 136, 135, 204, 124, 119, 3 | 122, 170, 135, 119, 119, 124, 204, 119, 119, 136, 135, 119, 204, 119, 199, 119, 4 | 119, 119, 119, 119, 124, 199, 119, 119, 119, 119, 119, 124, 119, 204, 119, 119, 5 | 119, 120, 124, 119, 204, 199, 119, 119, 120, 136, 124, 199, 199, 119, 119, 119, 6 | 119, 119, 119, 204, 199, 119, 119, 119, 119, 124, 199, 124, 119, 119, 119, 119, 7 | 119, 119, 204, 119, 15, 255, 255, 7, 119, 199, 124, 199, 240, 255, 240, 248, 8 | 199, 124, 204, 119, 255, 0, 15, 248, 204, 124, 119, 119, 255, 255, 255, 248, 9 | 124, 204, 119, 119, 255, 255, 255, 248, 119, 199, 119, 119, 120, 136, 136, 136, 10 | 11 | -------------------------------------------------------------------------------- /ico2.h: -------------------------------------------------------------------------------- 1 | 2 | 127, 255, 255, 0, 255, 248, 7, 255, 255, 248, 11, 255, 255, 255, 87, 255, 3 | 255, 254, 171, 255, 240, 31, 255, 255, 240, 31, 255, 255, 240, 23, 249, 255, 4 | 240, 15, 252, 255, 253, 87, 254, 127, 254, 175, 255, 63, 255, 255, 187, 31, 5 | 255, 255, 156, 63, 131, 255, 204, 255, 131, 255, 225, 255, 129, 249, 241, 255, 6 | 131, 252, 251, 255, 213, 254, 127, 255, 235, 255, 63, 255, 255, 187, 31, 255, 7 | 255, 156, 63, 255, 255, 204, 255, 255, 255, 225, 170, 171, 249, 241, 31, 243, 8 | 252, 251, 207, 231, 254, 127, 103, 205, 255, 63, 243, 158, 187, 31, 120, 61, 9 | 156, 63, 252, 126, 204, 255, 127, 253, 225, 255, 255, 254, 241, 255, 85, 85, 10 | 11 | -------------------------------------------------------------------------------- /isapi.h: -------------------------------------------------------------------------------- 1 | /***************** 2 | * Copyright (c) 1995 Process Software Corporation 3 | * Copyright (c) 1995 Microsoft Corporation 4 | * Module Name : HttpExt.h 5 | * Abstract : This module contains the structure definitions and 6 | * prototypes for the HTTP Server Extension interface. 7 | ******************/ 8 | // Edited by Max Feoktistov for Small HTTP server project. 9 | // Copyright (C) 1999-2020 Maksim Feoktistov. 10 | 11 | #ifndef _HTTPEXT_H 12 | #define _HTTPEXT_H 13 | #define HSE_VERSION_MAJOR 1 // major version number of this spec 14 | #define HSE_VERSION_MINOR 0 // minor version number of this spec 15 | #define HSE_LOG_BUFFER_LEN 80 16 | #define MAX_EXT_DLL_NAME_LEN 256 17 | 18 | #ifdef SYSUNIX 19 | 20 | 21 | typedef void * LPVOID; 22 | typedef char * LPSTR; 23 | typedef char * LPTR; 24 | typedef uchar * LPBYTE; 25 | typedef ulong * LPDWORD; 26 | 27 | #undef BOOL 28 | #define BOOL int 29 | 30 | #undef CHAR 31 | #define CHAR char 32 | 33 | #undef DWORD 34 | #define DWORD unsigned long 35 | 36 | #define WINAPI 37 | struct Req; 38 | 39 | #define TRUE 1 40 | #define FALSE 0 41 | 42 | #endif 43 | 44 | typedef LPVOID HCONN; 45 | // status codes returned by the Extension DLL 46 | #define HSE_STATUS_SUCCESS 1 47 | #define HSE_STATUS_SUCCESS_AND_KEEP_CONN 2 48 | #define HSE_STATUS_STATUS_PENDING 3 49 | #define HSE_STATUS_STATUS_ERROR 4 50 | // request services values for ServerSupportFunction. 51 | // Values from 0 to 1000 are reserved for future versions 52 | #define HSE_REQ_BASE 0 53 | #define HSE_REQ_SEND_URL_REDIRECT_RESP ( HSE_REQ_BASE + 1 ) 54 | #define HSE_REQ_SEND_URL ( HSE_REQ_BASE + 2 ) 55 | #define HSE_REQ_SEND_RESPONSE_HEADER ( HSE_REQ_BASE + 3 ) 56 | #define HSE_REQ_DONE_WITH_SESSION ( HSE_REQ_BASE + 4 ) 57 | #define HSE_REQ_END_RESERVED 1000 58 | 59 | // passed to GetExtensionVersion 60 | typedef struct _HSE_VERSION_INFO { 61 | DWORD dwExtensionVersion; // Hiword = Major 62 | // Loword = minor 63 | char lpszExtensionDesc[MAX_EXT_DLL_NAME_LEN]; 64 | // Null terminated name of max 256 chars 65 | } HSE_VERSION_INFO, *LPHSE_VERSION_INFO; 66 | 67 | // passed to extension procedure on a new request 68 | typedef BOOL ( *TGetServerVariable)( HCONN hConn,LPSTR lpszVariableName,LPVOID lpvBuffer,LPDWORD lpdwSize ) WINAPI; 69 | typedef BOOL ( *TWriteClient)( HCONN ConnID,LPVOID Buffer,LPDWORD lpdwBytes,DWORD dwReserved ) WINAPI; 70 | typedef BOOL ( *TReadClient)( HCONN ConnID,LPVOID lpvBuffer,LPDWORD lpdwSize ) WINAPI; 71 | typedef BOOL ( *TServerSupportFunction)( HCONN hConn,DWORD dwHSERRequest,LPVOID lpvBuffer,LPDWORD lpdwSize,LPDWORD lpdwDataType ) WINAPI; 72 | 73 | typedef struct _EXTENSION_CONTROL_BLOCK 74 | { 75 | DWORD cbSize; // size of this struct. 76 | DWORD dwVersion ; // version info of this spec 77 | HCONN ConnID; // Context number DO NOT CHANGE! 78 | DWORD dwHttpStatusCode; // HTTP Status code 79 | char lpszLogData[HSE_LOG_BUFFER_LEN]; 80 | // null-terminated log info specific 81 | // to this Extension DLL 82 | LPSTR lpszMethod; // REQUEST_METHOD 83 | LPSTR lpszQuery_string; // QUERY_STRING 84 | LPSTR lpszPathInfo; // PATH_INFO 85 | LPSTR lpszPathTranslated; // PATH_TRANSLATED 86 | DWORD cbTotalBytes; // Total bytes available 87 | DWORD cbAvailable; // available number of bytes 88 | LPBYTE lpbData; // pointer to client data of 89 | // cbAvailable number of bytes 90 | LPSTR lpszContentType; // Content data type 91 | TGetServerVariable GetServerVariable; 92 | TWriteClient WriteClient; 93 | TReadClient ReadClient; 94 | TServerSupportFunction ServerSupportFunction; 95 | 96 | //--- My extention-- (M.F.) 97 | Req *sock; 98 | // int sock; 99 | int state; 100 | char **hv; 101 | char *snm; 102 | char *bf; 103 | 104 | } EXTENSION_CONTROL_BLOCK, *LPEXTENSION_CONTROL_BLOCK; 105 | // 106 | // these prototypes must be exported from the extension DLL 107 | // 108 | BOOL WINAPI GetExtensionVersion( HSE_VERSION_INFO *pVer ); 109 | DWORD WINAPI HttpExtensionProc( EXTENSION_CONTROL_BLOCK *pECB ); 110 | // type declarations for the server side 111 | typedef int (* PFN_GETEXTENSIONVERSION)( HSE_VERSION_INFO *pVer ) WINAPI ; 112 | typedef int (* PFN_HTTPEXTENSIONPROC )( EXTENSION_CONTROL_BLOCK *pECB) WINAPI ; 113 | typedef int (* PFN_DllRegisterServer )() WINAPI ; 114 | #endif // end definition _HTTPEXT_H_ 115 | // the following additional functions are specific to this WEB 116 | #define HSE_GET_COUNTER_FOR_GET_METHOD 1001 117 | #define HSE_GET_COUNTER_FOR_POST_METHOD 1002 118 | #define HSE_GET_COUNTER_FOR_HEAD_METHOD 1003 119 | #define HSE_GET_COUNTER_FOR_ALL_METHODS 1004 120 | /*** 121 | dwHSERequest = HSE_GET_COUNTER_FOR_GET_METHOD 122 | lpvBuffer --- contains a null terminated string of the server 123 | name as returned by the CGI variable SERVER_NAME. 124 | lpdwSize --- size of the string pointed by lpvBuffer 125 | lpdwDataType -- contains a DWORD of the total number of GET 126 | methods served by the server mentioned in lpvBuffer. 127 | dwHSERequest = HSE_GET_COUNTER_FOR_GET_METHOD 128 | Exactly same as above except that this function returns 129 | the number of POST methods serviced by the server mentioned in 130 | lpvBuffer. 131 | dwHSERequest = HSE_GET_COUNTER_FOR_HEAD_METHOD 132 | Exactly same as above except that this function returns 133 | the number of HEAD methods serviced by the server mentioned in 134 | lpvBuffer. 135 | dwHSERequest = HSE_GET_COUNTER_FOR_ALL_METHODS 136 | Exactly same as above except that this function returns 137 | the total number of requests serviced by the server mentioned in 138 | lpvBuffer. 139 | *****/ 140 | -------------------------------------------------------------------------------- /lS5_lf.cfg: -------------------------------------------------------------------------------- 1 | 2 | S5T_158416789=\n

VPN Limit status:

\n 3 |
Remote" 96 | " IPPortin/out (bytes)info" 100 | "  
4 | 11 | 12 | 13 | S5t2T_622313= 16 | 17 | 18 | S5t2T_4129147=Keep-Alive Sleep 19 | 20 | 21 | S5t2T_622312=HTTP/1.1 200 Ok\r\n 22 | Pragma: no-cache\r\n 23 | Content-Type: text/html%s\r\n 24 | \r\n 25 | \n 35 | Administration of Small HTTP server

Small HTTP server


Administration 37 | page.

5 | IP/user 6 | per hour (Mb) 7 | per day (Mb) 8 | per month (Mb) 9 |   10 |
SettingUsers & Virtual HostsCurrent Log
%s
Current 39 | statistics / pagesCurrent stateSummary statisticsLogout
43 | 44 | 45 | S5t2T_467549=TLS VPN:%s: %u.%u.%u.%u 46 | 47 | 48 | S5t2T_0=

Now connected:

55 | 56 | 57 | S5t2T_4675490=VPN Client: %u.%u.%u.%u 58 | 59 | -------------------------------------------------------------------------------- /lang_notes.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Notes for multi languages support 5 | 6 | The Small HTTP server ver 3.06 support separate language file. This 7 | give possibility to make any localisation of the program. The language file 8 | named 'shs_lang.cfg'. The file is the same for Windows and for Linux 9 | versions. If this file is placed in the same directory where placed 10 | configuration file, the program load strings from this file. Localisation 11 | files that are already available, placed into 'langpacks' directory. 12 | If the file for your language is not precent there, then you can make 13 | it yourself, just translate the file from some other language. If you do it, 14 | then you may send me the result, it will be including in the next packages 15 | and it will be a vailable for download on the site. 16 | 17 | shs_lang.cfg file format: 18 | 19 | It is text file. The file including the records for strings constant 20 | that using the program. Each record it is: 21 | 22 | MNEMOTIC_NAME=some text 23 | 24 | ( -- mean new line) The records separated by empty line. The text 25 | into the record may be multiline, but all new line characters will be 26 | removed when loading. To insert new line in the string use '\n' 27 | construction. Also if you would like to include backslash in the text then 28 | use two backslash '\\' instead. Another interpreted char it is \r, \",\' . 29 | Some strings used for format output. In these strings the % sign must 30 | be replaced to %% (two procent sing). 31 | Some string include HTML formatting and in some case HTTP header. 32 | Please, be careful, do not change this parts of string, otherwise the 33 | program will not work correct. 34 | 35 | And very importing record it is: 36 | 37 | charset=; charset=windows-1250 38 | 39 | There you may direct the charset that will be using. If the charset is 40 | utf-8 the Windows version of the program will try to convert the strings for 41 | dialog-windows to unicode. 42 | -------------------------------------------------------------------------------- /licr06.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/licr06.txt -------------------------------------------------------------------------------- /makefile.bsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | OPT= -s -O2 -pipe -malign-loops=0 -malign-jumps=0 -malign-functions=0 \ 4 | -fno-verbose-asm -fno-implicit-templates -mno-align-double \ 5 | -mno-fancy-math-387 -fwritable-strings -fconserve-space -DUSE_IPV6 -DUSE_POOL -DFREEVER -DWITHMD5 -DFIX_EXCEPT -DVPN_LINUX -DTLSVPN 6 | 7 | 8 | #-nostdinc++ 9 | 10 | 11 | #LOPT= -Xlinker -N -Xlinker --unique -Xlinker --gc-sections -Xlinker --unique -Xlinker -N 12 | LOPT= -Xlinker -call_shared -Xlinker -x -Xlinker -X -Xlinker -Map -Xlinker flxmap 13 | # -Xlinker -Map -Xlinker flxmap -Xlinker -dy -Xlinker -s -Xlinker -S -dynamic-linker -shared 14 | 15 | LIB= -lc_r 16 | #-lpthread -lc 17 | # -dynamic-linker /lib/libc.so.6 18 | #OBJS=pkoulzl.o to_linux.o mstring1.o srv_cgi.o srv0a.o req.o adminr.o restart.o proxy.o conf.o icfgjs.o ftpd.o smptps.o smtpcl.o mailip.o icfg.o stat.o srv_ssi.o icfghtm.o musers.o srvdns.o 19 | 20 | OBJS=to_linux.o srv0a.o srv_ssi.o srv_cgi.o req.o accept.o tools.o adminr.o restart.o proxy.o musers.o conf.o t2icfg.o stat.o icfgjs.o ftpd.o smptps.o smtpcl.o mailip.o dnsd.o tlsm.o gz.o dhcpd.o wmbx.o bvprintfv.o md5.o msprintfchk.o fcgi.o vpn.o 21 | 22 | 23 | .cpp.o: 24 | g++ -c -DSYSUNIX -DV_FULL=1 $(OPT) $< 25 | 26 | httpd.exe: $(OBJS) 27 | g++ $(OPT) $(LOPT) $(OBJS) -o httpd.exe $(LIB) 28 | 29 | srv0a.o: strc.h srv0a.cpp slloop.cpp 30 | adminr.o: adminr.cpp icfghtm.cpp 31 | 32 | 33 | -------------------------------------------------------------------------------- /makefile.dj: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 1999-2020 Maksim Feoktistov. 3 | # 4 | # This file is part of Small HTTP server project. 5 | # Author: Maksim Feoktistov 6 | # 7 | # 8 | # Small HTTP server is free software: you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License. 11 | # 12 | # Small HTTP server is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see https://www.gnu.org/licenses/ 19 | # 20 | # Contact addresses for Email: support@smallsrv.com 21 | # 22 | # 23 | # 24 | 25 | 26 | 27 | 28 | CFLAGS= -fpack-struct -m486 -s -O2 -malign-loops=0 -malign-jumps=0 -malign-functions=0 -fno-verbose-asm -fno-implicit-templates -mno-svr3-shlib -mno-align-double \ 29 | -mno-fancy-math-387 -static -fsjlj-exceptions -fconserve-space -ID:\DJGPP\INCLUDE\WIN32 -mrtd -Zpe 30 | 31 | LFLAGS= -s -Zpe -mrtd -static -fsjlj-exceptions -fpack-struct -m486 -O2 -malign-jumps=0 -malign-functions=0 -fno-verbose-asm -fno-implicit-templates -mno-svr3-shlib -mno-align-double -mno-fancy-math-387 -fconserve-space -LD:\DJGPP\LIB 32 | 33 | SOBJ= ndp.o pkoulz.o stpdta.o sethttp3.o 34 | SOBJR= ndp.o pkoulz.o stpdtar.o sethttp3r.o 35 | OBJ= ndp.o pkoulz.o srv0a.o 36 | DEF= -DRICON -DONEFILE -DSERVICE -DFREE_VER -DFREEVER -DV_FULL=1 -DUSE_IPV6 37 | # LIB= -luser -lkern -lgdi -lshell -lcdlg -lwadv 38 | # -luser -lkern -lsock -lgdi -lshell -lcdlg -lwadv 39 | 40 | OOBJS=$(addprefix djo/,$(OBJ)) 41 | OSOBJS=$(addprefix djo/,$(SOBJ)) 42 | OSROBJS=$(addprefix djo/,$(SOBJR)) 43 | 44 | all: djo/http.exe djo/shttp3.exe djo/shttp3r.exe 45 | 46 | djo/http.exe: $(OOBJS) 47 | gcc -specs=specs.dj -o djo/a.out $(LFLAGS) -nostartfiles -nodefaultlibs -Xlinker -Map -Xlinker djo/flxmap $^ -luser -lkern -lws2 -lgdi -lshell -lcdlg -lwadv 48 | make_pe.exe -p 0x3C00000 -o $@ djo/a.out 49 | cpres.exe copyres.exe $@ 50 | 51 | 52 | djo/shttp3.exe: $(OSOBJS) 53 | gcc -specs=specs.dj -o djo/a.out $(LFLAGS) -nostartfiles -nodefaultlibs $^ -luser -lkern -lgdi -lshell -lcdlg -lwadv 54 | make_pe.exe -o $@ djo/a.out 55 | cpres.exe copyres.exe $@ 56 | 57 | djo/shttp3r.exe: $(OSROBJS) 58 | gcc -specs=specs.dj -o djo/a.out $(LFLAGS) -nostartfiles -nodefaultlibs $^ -luser -lkern -lgdi -lshell -lcdlg -lwadv 59 | make_pe.exe -o $@ djo/a.out 60 | cpres.exe copyres.exe $@ 61 | 62 | 63 | djo/%.o: %.cpp 64 | gcc -specs=specs.dj -c $(CFLAGS) $(DEF) $^ -o $@ 65 | 66 | djo/sethttp3r.o: sethttp3.cpp 67 | gcc -specs=specs.dj -c $(CFLAGS) $(DEF) -DRUS $^ -o $@ 68 | 69 | djo/%.o: %.s 70 | as $^ -o $@ 71 | 72 | djo/stpdta.o: stpdta.s djo/http.bin djo/uninst.bin djo/http.bin djo/ind1.bin djo/eshs_lang.bin djo/shs_lang.bin djo/lnotes.bin djo/lic.bin 73 | cd djo ; as ../stpdta.s -o stpdta.o ; cd .. 74 | 75 | djo/stpdtar.o: stpdtar.s djo/uninst.bin djo/http.bin djo/ind1r.bin djo/eshs_lang.bin djo/shs_lang.bin djo/lnotes.bin djo/licr.bin 76 | cd djo ; as ../stpdtar.s -o stpdtar.o ; cd .. 77 | 78 | 79 | 80 | djo/http.bin: djo/http.exe 81 | bin2c $< $@ 82 | 83 | djo/uninst.bin: uninst.exe 84 | bin2c $< $@ 85 | 86 | djo/%.bin: %.htm 87 | bin2c $< $@ 88 | 89 | djo/%.bin: %.txt 90 | bin2c $< $@ 91 | 92 | djo/%.bin: %.htm 93 | bin2c $< $@ 94 | 95 | djo/licr.bin : licr06.txt 96 | bin2c $< $@ 97 | 98 | djo/lic.bin : license06.txt 99 | bin2c $< $@ 100 | 101 | djo/shs_lang.bin : ru/shs_lang.cfg 102 | bin2c $< $@ 103 | 104 | djo/eshs_lang.bin : en/shs_lang.cfg 105 | bin2c $< $@ 106 | 107 | djo/lnotes.bin : lang_notes.txt 108 | bin2c $< $@ 109 | 110 | 111 | -------------------------------------------------------------------------------- /md5.h: -------------------------------------------------------------------------------- 1 | /* MD5.H - header file for MD5C.C 2 | */ 3 | 4 | /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 5 | rights reserved. 6 | 7 | License to copy and use this software is granted provided that it 8 | is identified as the "RSA Data Security, Inc. MD5 Message-Digest 9 | Algorithm" in all material mentioning or referencing this software 10 | or this function. 11 | 12 | License is also granted to make and use derivative works provided 13 | that such works are identified as "derived from the RSA Data 14 | Security, Inc. MD5 Message-Digest Algorithm" in all material 15 | mentioning or referencing the derived work. 16 | 17 | RSA Data Security, Inc. makes no representations concerning either 18 | the merchantability of this software or the suitability of this 19 | software for any particular purpose. It is provided "as is" 20 | without express or implied warranty of any kind. 21 | 22 | 23 | 24 | 25 | Rivest [Page 8] 26 | 27 | RFC 1321 MD5 Message-Digest Algorithm April 1992 28 | 29 | 30 | These notices must be retained in any copies of any part of this 31 | documentation and/or software. 32 | */ 33 | #ifndef PROTOTYPES 34 | #define PROTOTYPES 1 35 | #endif 36 | 37 | extern "C" { 38 | 39 | 40 | /* POINTER defines a generic pointer type */ 41 | typedef unsigned char *POINTER; 42 | 43 | /* UINT2 defines a two byte word */ 44 | typedef unsigned short int UINT2; 45 | 46 | /* UINT4 defines a four byte word */ 47 | typedef unsigned int UINT4; 48 | 49 | /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. 50 | If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it 51 | returns an empty list. 52 | */ 53 | #if PROTOTYPES 54 | #define PROTO_LIST(list) list 55 | #else 56 | #define PROTO_LIST(list) () 57 | #endif 58 | 59 | /* MD5 context. */ 60 | typedef struct { 61 | UINT4 state[4]; /* state (ABCD) */ 62 | UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ 63 | unsigned char buffer[64]; /* input buffer */ 64 | } MD5_CTX; 65 | 66 | void MD5Init PROTO_LIST ((MD5_CTX *)); 67 | void MD5Update PROTO_LIST 68 | ((MD5_CTX *, unsigned char *, unsigned int)); 69 | void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /mkfakelib.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Copyright (C) Maksim Feoktistov (max@smallsrv.com) 4 | # 5 | # This script is free for commercial and non-commercial use. 6 | # 7 | 8 | 9 | $cflag=0; 10 | $cmd = 'Command line: 11 | mkfakelib.pl libxx.so [TARGET_DIR] [-c] 12 | '; 13 | 14 | die($cmd) if($#ARGV<0 || $ARGV[0] !~ /(.*)\.so/ ); 15 | 16 | $bname = $1 ; 17 | $bname =~ s/.*\///g; 18 | $soname = $ARGV[0] ; 19 | $soname =~ s/.*\///g; 20 | 21 | $data= "\n\n.data\n\n"; 22 | 23 | $pref=''; 24 | 25 | if($#ARGV>0) 26 | { 27 | $pref=$ARGV[1] ; 28 | $pref .= "./" if($pref !~ /\/$/); 29 | if($#ARGV>1 && $ARGV[2] eq '-c' ) 30 | { 31 | $cflag=1 ; 32 | $data= "\n"; 33 | }; 34 | } 35 | 36 | 37 | print "src: $ARGV[0] base:$bname target: $pref$bname.c\n" ; 38 | 39 | 40 | 41 | 42 | # open FILEC, ">$pref$bname.c" || die("Can't open $pref$bname.c"); 43 | $tsrcname=($cflag) ? "$pref$bname.c" : "$pref$bname.s" ; 44 | open FILEC,">$tsrcname" || die("Can't open $pref$bname.s"); 45 | print FILEC "\n\n"; 46 | print FILEC "\n\n.text\n\n"; 47 | 48 | @str = `readelf --wide --dyn-syms $ARGV[0] `; 49 | # while(`readelf --dyn-syms $ARGV[0] `) 50 | foreach $_ (@str) 51 | { 52 | 53 | # FUNC WEAK DEFAULT 13 mktemp@@GLIBC_2.0 54 | # print $_; 55 | if(/FUNC[ \t]+.*[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+(.+)\@\@/) 56 | { 57 | $n=$1; 58 | # print FILEC "void $n(){}; \n"; 59 | print FILEC ($cflag)? "void $n(){}; \n" : 60 | " .globl $n\n .type $n, \@function\n$n:\n .cfi_startproc\n ret\n .cfi_endproc\n .size $n, .-$n\n"; 61 | # print FILEC ".globl $n\n.type $n, \@function\n$n: .cfi_startproc\n ret\n .cfi_endproc\n"; 62 | 63 | } 64 | # 1398: 001b3dbc 4 OBJECT GLOBAL DEFAULT 34 __environ@@GLIBC_2.0 65 | elsif(/[0-9]+:[ \t]+([0-9a-f]+)[ \t]+[0-9]+[ \t]+OBJECT[ \t]+(GLOBAL|WEAK)[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+(.+)\@\@/) 66 | { 67 | ($offs,$n)=($1,$3); 68 | if($offs =~ /[1-9a-f]/ ) 69 | { 70 | # print FILEC "void * $n;\n"; 71 | # print FILEC "\nint $n;\n"; 72 | # $data .= ".globl $n\n$n: .long 0\n" 73 | # $data .= "\n .comm $n,4,4\n" 74 | $data .= ($cflag) ? "void * $n;\n" : 75 | "\n .align 4\n .globl $n\n .type $n, \@object\n .size $n, 4\n$n: \n .long 0\n" ; 76 | 77 | } 78 | 79 | } 80 | 81 | } 82 | 83 | # print FILEC (cflag)?$data : "\n\n.data\n\n$data\n"; 84 | print FILEC $data ; 85 | 86 | print FILEC "\n\n\n"; 87 | close FILEC ; 88 | 89 | # $r = `gcc -m32 -o $pref$bname.so -fno-builtin -fPIC -shared -O2 $pref$bname.c -Wl,-soname=$soname` ; 90 | # $r = `gcc -m32 -o $pref$bname.so -fno-builtin -fno-rtti -fno-threadsafe-statics -fno-access-control -fno-nonansi-builtins -fno-elide-constructors -shared -O2 $pref$bname.c -Wl,-soname=$soname` ; 91 | $r = ($cflag)? 92 | `gcc -m32 -o $pref$bname.so -fno-builtin -fPIC -fno-rtti -fno-threadsafe-statics -fno-access-control -fno-nonansi-builtins -fno-elide-constructors -shared -O2 $tsrcname -Wl,-soname=$soname` 93 | : `gcc -m32 -o $pref$bname.so -fno-builtin -fPIC -shared -O2 $tsrcname -Wl,-soname=$soname` ; 94 | 95 | print $r ; 96 | 97 | exit(0); 98 | 99 | -------------------------------------------------------------------------------- /mkfakelib64.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Copyright (C) Maksim Feoktistov (max@smallsrv.com) 4 | # 5 | # This script is free for commercial and non-commercial use. 6 | # 7 | 8 | 9 | $cflag=0; 10 | $cmd = 'Command line: 11 | mkfakelib64.pl libxx.so [TARGET_DIR] [-c] 12 | '; 13 | 14 | die($cmd) if($#ARGV<0 || $ARGV[0] !~ /(.*)\.so/ ); 15 | 16 | $bname = $1 ; 17 | $bname =~ s/.*\///g; 18 | $soname = $ARGV[0] ; 19 | $soname =~ s/.*\///g; 20 | 21 | $data= "\n\n.data\n\n"; 22 | 23 | $pref=''; 24 | 25 | if($#ARGV>0) 26 | { 27 | $pref=$ARGV[1] ; 28 | $pref .= "./" if($pref !~ /\/$/); 29 | if($#ARGV>1 && $ARGV[2] eq '-c' ) 30 | { 31 | $cflag=1 ; 32 | $data= "\n"; 33 | }; 34 | } 35 | 36 | 37 | print "src: $ARGV[0] base:$bname target: $pref$bname.c\n" ; 38 | 39 | 40 | 41 | 42 | # open FILEC, ">$pref$bname.c" || die("Can't open $pref$bname.c"); 43 | $tsrcname=($cflag) ? "$pref$bname.c" : "$pref$bname.s" ; 44 | open FILEC,">$tsrcname" || die("Can't open $pref$bname.s"); 45 | print FILEC "\n\n"; 46 | print FILEC "\n\n.text\n\n" if(!$cflag); 47 | @str = `readelf --wide --dyn-syms $ARGV[0] `; 48 | # while(`readelf --dyn-syms $ARGV[0] `) 49 | $all=' '; 50 | 51 | foreach $_ (@str) 52 | { 53 | 54 | # FUNC WEAK DEFAULT 13 mktemp@@GLIBC_2.0 55 | # if(/FUNC[ \t]+.*[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+(.+)\@\@/) 56 | if(/FUNC[ \t]+.*[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+([^@ \t\n\r]+)/) 57 | { 58 | $n=$1; 59 | # print "($n)$_"; 60 | if( $all =~ / $n /) 61 | { 62 | print "function $n ( $_ ) already exist\n"; 63 | } 64 | else 65 | { 66 | # print FILEC "void $n(){}; \n"; 67 | print FILEC ($cflag)? "void $n(){}; \n" : 68 | " .globl $n\n .type $n, \@function\n$n:\n .cfi_startproc\n ret\n .cfi_endproc\n .size $n, .-$n\n"; 69 | # print FILEC ".globl $n\n.type $n, \@function\n$n: .cfi_startproc\n ret\n .cfi_endproc\n"; 70 | $all .= "$n "; 71 | } 72 | 73 | } 74 | # 1398: 001b3dbc 4 OBJECT GLOBAL DEFAULT 34 __environ@@GLIBC_2.0 75 | # elsif(/[0-9]+:[ \t]+([0-9a-f]+)[ \t]+[0-9]+[ \t]+OBJECT[ \t]+(GLOBAL|WEAK)[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+(.+)\@\@/) 76 | elsif(/[0-9]+:[ \t]+([0-9a-f]+)[ \t]+[0-9]+[ \t]+OBJECT[ \t]+(GLOBAL|WEAK)[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+([^@ \t\n\r]+)/) 77 | { 78 | ($offs,$n)=($1,$3); 79 | if($offs =~ /[1-9a-f]/ ) 80 | { 81 | # print FILEC "void * $n;\n"; 82 | # print FILEC "\nint $n;\n"; 83 | # $data .= ".globl $n\n$n: .long 0\n" 84 | # $data .= "\n .comm $n,4,4\n" 85 | $data .= ($cflag) ? "void * $n;\n" : 86 | "\n .align 8\n .globl $n\n .type $n, \@object\n .size $n, 4\n$n: \n .long 0\n" ; 87 | 88 | } 89 | 90 | } 91 | 92 | } 93 | 94 | # print FILEC (cflag)?$data : "\n\n.data\n\n$data\n"; 95 | print FILEC $data ; 96 | 97 | print FILEC "\n\n\n"; 98 | close FILEC ; 99 | 100 | # $r = `gcc -m32 -o $pref$bname.so -fno-builtin -fPIC -shared -O2 $pref$bname.c -Wl,-soname=$soname` ; 101 | # $r = `gcc -m32 -o $pref$bname.so -fno-builtin -fno-rtti -fno-threadsafe-statics -fno-access-control -fno-nonansi-builtins -fno-elide-constructors -shared -O2 $pref$bname.c -Wl,-soname=$soname` ; 102 | 103 | 104 | # $r = ($cflag)? 105 | # `gcc -m64 -o $pref$bname.so -fno-builtin -fno-rtti -fno-threadsafe-statics -fno-access-control -fno-nonansi-builtins -fno-elide-constructors -shared -O2 $tsrcname -Wl,-soname=$soname` 106 | # : `gcc -m64 -o $pref$bname.so -fno-builtin -shared -O2 $tsrcname -Wl,-soname=$soname` ; 107 | # 108 | 109 | $cmd = ($cflag)? 110 | "gcc -m64 -pipe -o $pref$bname.so -fno-builtin -fPIC -nostartfiles -nodefaultlibs -shared -O2 $tsrcname -Wl,-soname=$soname" 111 | : "gcc -m64 -pipe -o $pref$bname.so -fno-builtin -fPIC -nostartfiles -nodefaultlibs -shared -O2 $tsrcname -Wl,-soname=$soname" ; 112 | 113 | print "$cmd\n" ; 114 | $r = `$cmd` ; 115 | 116 | print $r ; 117 | 118 | exit(0); 119 | 120 | -------------------------------------------------------------------------------- /mkfakelib_arm.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Copyright (C) Maksim Feoktistov (max@smallsrv.com) 4 | # 5 | # This script is free for commercial and non-commercial use. 6 | # 7 | 8 | 9 | $cflag=0; 10 | $cmd = 'Command line: 11 | mkfakelib_arm.pl libxx.so [TARGET_DIR] [-c] 12 | '; 13 | 14 | die($cmd) if($#ARGV<0 || $ARGV[0] !~ /(.*)\.so/ ); 15 | 16 | $bname = $1 ; 17 | $bname =~ s/.*\///g; 18 | $soname = $ARGV[0] ; 19 | $soname =~ s/.*\///g; 20 | 21 | $data= "\n\n.data\n\n"; 22 | 23 | $pref=''; 24 | 25 | if($#ARGV>0) 26 | { 27 | $pref=$ARGV[1] ; 28 | $pref .= "./" if($pref !~ /\/$/); 29 | if($#ARGV>1 && $ARGV[2] eq '-c' ) 30 | { 31 | $cflag=1 ; 32 | $data= "\n"; 33 | }; 34 | } 35 | 36 | 37 | print "src: $ARGV[0] base:$bname target: $pref$bname.c\n" ; 38 | 39 | 40 | 41 | 42 | # open FILEC, ">$pref$bname.c" || die("Can't open $pref$bname.c"); 43 | $tsrcname=($cflag) ? "$pref$bname.c" : "$pref$bname.s" ; 44 | open FILEC,">$tsrcname" || die("Can't open $pref$bname.s"); 45 | print FILEC "\n\n"; 46 | print FILEC "\n\n.text\n\n" if(!$cflag); 47 | @str = `readelf --wide --dyn-syms $ARGV[0] `; 48 | # while(`readelf --dyn-syms $ARGV[0] `) 49 | $all=' '; 50 | 51 | foreach $_ (@str) 52 | { 53 | 54 | # FUNC WEAK DEFAULT 13 mktemp@@GLIBC_2.0 55 | # if(/FUNC[ \t]+.*[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+(.+)\@\@/) 56 | if(/FUNC[ \t]+.*[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+([^@ \t\n\r]+)/) 57 | { 58 | $n=$1; 59 | # print "($n)$_"; 60 | if( $all =~ / $n /) 61 | { 62 | print "function $n ( $_ ) already exist\n"; 63 | } 64 | else 65 | { 66 | # print FILEC "void $n(){}; \n"; 67 | print FILEC ($cflag)? "void $n(){}; \n" : 68 | " .globl $n\n .type $n, \@function\n$n:\n .cfi_startproc\n ret\n .cfi_endproc\n .size $n, .-$n\n"; 69 | # print FILEC ".globl $n\n.type $n, \@function\n$n: .cfi_startproc\n ret\n .cfi_endproc\n"; 70 | $all .= "$n "; 71 | } 72 | 73 | } 74 | # 1398: 001b3dbc 4 OBJECT GLOBAL DEFAULT 34 __environ@@GLIBC_2.0 75 | # elsif(/[0-9]+:[ \t]+([0-9a-f]+)[ \t]+[0-9]+[ \t]+OBJECT[ \t]+(GLOBAL|WEAK)[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+(.+)\@\@/) 76 | elsif(/[0-9]+:[ \t]+([0-9a-f]+)[ \t]+[0-9]+[ \t]+OBJECT[ \t]+(GLOBAL|WEAK)[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+([^@ \t\n\r]+)/) 77 | { 78 | ($offs,$n)=($1,$3); 79 | if($offs =~ /[1-9a-f]/ ) 80 | { 81 | # print FILEC "void * $n;\n"; 82 | # print FILEC "\nint $n;\n"; 83 | # $data .= ".globl $n\n$n: .long 0\n" 84 | # $data .= "\n .comm $n,4,4\n" 85 | $data .= ($cflag) ? "void * $n;\n" : 86 | "\n .align 8\n .globl $n\n .type $n, \@object\n .size $n, 4\n$n: \n .long 0\n" ; 87 | 88 | } 89 | 90 | } 91 | 92 | } 93 | 94 | # print FILEC (cflag)?$data : "\n\n.data\n\n$data\n"; 95 | print FILEC $data ; 96 | 97 | print FILEC "\n\n\n"; 98 | close FILEC ; 99 | 100 | # $r = `gcc -m32 -o $pref$bname.so -fno-builtin -fPIC -shared -O2 $pref$bname.c -Wl,-soname=$soname` ; 101 | # $r = `gcc -m32 -o $pref$bname.so -fno-builtin -fno-rtti -fno-threadsafe-statics -fno-access-control -fno-nonansi-builtins -fno-elide-constructors -shared -O2 $pref$bname.c -Wl,-soname=$soname` ; 102 | 103 | 104 | # $r = ($cflag)? 105 | # `gcc -m64 -o $pref$bname.so -fno-builtin -fno-rtti -fno-threadsafe-statics -fno-access-control -fno-nonansi-builtins -fno-elide-constructors -shared -O2 $tsrcname -Wl,-soname=$soname` 106 | # : `gcc -m64 -o $pref$bname.so -fno-builtin -shared -O2 $tsrcname -Wl,-soname=$soname` ; 107 | # 108 | 109 | $cmd = ($cflag)? 110 | "arm-linux-gnueabi-gcc -pipe -o $pref$bname.so -fno-builtin -fPIC -nostartfiles -nodefaultlibs -shared -O2 $tsrcname -Wl,-soname=$soname" 111 | : "arm-linux-gnueabi-gcc -pipe -o $pref$bname.so -fno-builtin -fPIC -nostartfiles -nodefaultlibs -shared -O2 $tsrcname -Wl,-soname=$soname" ; 112 | 113 | print "$cmd\n" ; 114 | $r = `$cmd` ; 115 | 116 | print $r ; 117 | 118 | exit(0); 119 | 120 | 121 | -------------------------------------------------------------------------------- /mkfakelib_cros.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Copyright (C) Maksim Feoktistov (max@smallsrv.com) 4 | # 5 | # This script is free for commercial and non-commercial use. 6 | # 7 | 8 | 9 | $cflag=0; 10 | $cmd = "Command line: 11 | $0 libxx.so prefix_gcc [TARGET_DIR] [-c] 12 | "; 13 | 14 | die($cmd) if($#ARGV<1 || $ARGV[0] !~ /(.*)\.so/ ); 15 | 16 | $bname = $1 ; 17 | $bname =~ s/.*\///g; 18 | $soname = $ARGV[0] ; 19 | $soname =~ s/.*\///g; 20 | $prefix_gcc = $ARGV[1]; 21 | 22 | $data= "\n\n.data\n\n"; 23 | 24 | $pref=''; 25 | 26 | if($#ARGV>1) 27 | { 28 | $pref=$ARGV[2] ; 29 | $pref .= "./" if($pref !~ /\/$/); 30 | if($#ARGV>1 && $ARGV[3] eq '-c' ) 31 | { 32 | $cflag=1 ; 33 | $data= "\n"; 34 | }; 35 | } 36 | 37 | 38 | print "src: $ARGV[0] base:$bname target: $pref$bname.c\n" ; 39 | 40 | 41 | 42 | 43 | # open FILEC, ">$pref$bname.c" || die("Can't open $pref$bname.c"); 44 | $tsrcname=($cflag) ? "$pref$bname.c" : "$pref$bname.s" ; 45 | open FILEC,">$tsrcname" || die("Can't open $pref$bname.s"); 46 | print FILEC "\n\n"; 47 | print FILEC "\n\n.text\n\n" if(!$cflag); 48 | @str = `readelf --wide --dyn-syms $ARGV[0] `; 49 | # while(`readelf --dyn-syms $ARGV[0] `) 50 | $all=' '; 51 | 52 | foreach $_ (@str) 53 | { 54 | 55 | # FUNC WEAK DEFAULT 13 mktemp@@GLIBC_2.0 56 | # if(/FUNC[ \t]+.*[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+(.+)\@\@/) 57 | if(/FUNC[ \t]+.*[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+([^@ \t\n\r]+)/) 58 | { 59 | $n=$1; 60 | # print "($n)$_"; 61 | if( $all =~ / $n /) 62 | { 63 | print "function $n ( $_ ) already exist\n"; 64 | } 65 | else 66 | { 67 | # print FILEC "void $n(){}; \n"; 68 | print FILEC ($cflag)? "void $n(){}; \n" : 69 | " .globl $n\n .type $n, \@function\n$n:\n .cfi_startproc\n ret\n .cfi_endproc\n .size $n, .-$n\n"; 70 | # print FILEC ".globl $n\n.type $n, \@function\n$n: .cfi_startproc\n ret\n .cfi_endproc\n"; 71 | $all .= "$n "; 72 | } 73 | 74 | } 75 | # 1398: 001b3dbc 4 OBJECT GLOBAL DEFAULT 34 __environ@@GLIBC_2.0 76 | # elsif(/[0-9]+:[ \t]+([0-9a-f]+)[ \t]+[0-9]+[ \t]+OBJECT[ \t]+(GLOBAL|WEAK)[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+(.+)\@\@/) 77 | elsif(/[0-9]+:[ \t]+([0-9a-f]+)[ \t]+[0-9]+[ \t]+OBJECT[ \t]+(GLOBAL|WEAK)[ \t]+DEFAULT[ \t]+[0-9]+[ \t]+([^@ \t\n\r]+)/) 78 | { 79 | ($offs,$n)=($1,$3); 80 | if($offs =~ /[1-9a-f]/ ) 81 | { 82 | # print FILEC "void * $n;\n"; 83 | # print FILEC "\nint $n;\n"; 84 | # $data .= ".globl $n\n$n: .long 0\n" 85 | # $data .= "\n .comm $n,4,4\n" 86 | $data .= ($cflag) ? "void * $n;\n" : 87 | "\n .align 8\n .globl $n\n .type $n, \@object\n .size $n, 4\n$n: \n .long 0\n" ; 88 | 89 | } 90 | 91 | } 92 | 93 | } 94 | 95 | # print FILEC (cflag)?$data : "\n\n.data\n\n$data\n"; 96 | print FILEC $data ; 97 | 98 | print FILEC "\n\n\n"; 99 | close FILEC ; 100 | 101 | # $r = `gcc -m32 -o $pref$bname.so -fno-builtin -fPIC -shared -O2 $pref$bname.c -Wl,-soname=$soname` ; 102 | # $r = `gcc -m32 -o $pref$bname.so -fno-builtin -fno-rtti -fno-threadsafe-statics -fno-access-control -fno-nonansi-builtins -fno-elide-constructors -shared -O2 $pref$bname.c -Wl,-soname=$soname` ; 103 | 104 | 105 | # $r = ($cflag)? 106 | # `gcc -m64 -o $pref$bname.so -fno-builtin -fno-rtti -fno-threadsafe-statics -fno-access-control -fno-nonansi-builtins -fno-elide-constructors -shared -O2 $tsrcname -Wl,-soname=$soname` 107 | # : `gcc -m64 -o $pref$bname.so -fno-builtin -shared -O2 $tsrcname -Wl,-soname=$soname` ; 108 | # 109 | 110 | $cmd = ($cflag)? 111 | "${prefix_gcc}gcc -pipe -o $pref$bname.so -fno-builtin -fPIC -nostartfiles -nodefaultlibs -shared -O2 $tsrcname -Wl,-soname=$soname" 112 | : "${prefix_gcc}gcc -pipe -o $pref$bname.so -fno-builtin -fPIC -nostartfiles -nodefaultlibs -shared -O2 $tsrcname -Wl,-soname=$soname" ; 113 | 114 | print "$cmd\n" ; 115 | $r = `$cmd` ; 116 | 117 | print $r ; 118 | 119 | exit(0); 120 | 121 | 122 | -------------------------------------------------------------------------------- /mlist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2022 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #ifdef SYSUNIX 27 | #define MALLOC Malloc 28 | #define REALLOC realloc 29 | #else 30 | extern "C" void *id_heap; 31 | #define MALLOC(n) HeapAlloc(id_heap,HEAP_ZERO_MEMORY,n) 32 | #define REALLOC(p,n) HeapReAlloc(id_heap,HEAP_ZERO_MEMORY,p,n) 33 | 34 | #endif 35 | 36 | struct LimitBase 37 | { 38 | ulong first,cnt; 39 | int CheckLimit(ulong t1,ulong lst_tim); 40 | 41 | }; 42 | 43 | struct LimitCntr : public LimitBase 44 | { 45 | 46 | ulong ip; 47 | }; 48 | 49 | struct IPv6c 50 | { 51 | 52 | union{ 53 | in6_addr ip; 54 | unsigned long long s6_addr64[2]; 55 | }; 56 | // */ 57 | 58 | int operator==(in6_addr &sip){return !memcmp(&ip,&sip,16); } 59 | void Set(unsigned long long *addr64) 60 | { 61 | s6_addr64[0] = addr64[0]; 62 | s6_addr64[1] = addr64[1]; 63 | } 64 | void Set(in6_addr &sa){Set((unsigned long long *) sa.s6_addr32 );} 65 | void Set(in6_addr *sa){Set((unsigned long long *) sa->s6_addr32 );} 66 | }; 67 | struct LimitCntrIPv6: public LimitBase 68 | { 69 | IPv6c ip; 70 | 71 | void Set(in6_addr &sa){ip.Set((u_long long *) sa.s6_addr32 );} 72 | void Set(in6_addr *sa){ip.Set((u_long long *) sa->s6_addr32 );} 73 | }; 74 | 75 | // Template version workung too slow and required more memory, -- bad code has been generated. 76 | // So, each 'template' has been replaced to 'define' ... 77 | // And I don't recomend to use template in any case... 78 | 79 | 80 | #ifdef WITHOUTTEMPL 81 | 82 | #define X LimitCntr 83 | #define ITEMS 1024 84 | struct MListCntr 85 | 86 | #else 87 | 88 | // Upd. In modern version of gcc template without virtual member functions working better, just like defines. 89 | // Ok. Now I try to use it carefull... 90 | 91 | extern "C++" template struct MList 92 | #endif 93 | { 94 | public: 95 | ulong l,n; 96 | X *d; 97 | X *Push() 98 | {X *r; 99 | if(n>=l) 100 | {l+=ITEMS; 101 | d=(X *) 102 | ((d)?REALLOC(d,sizeof(X)*l): MALLOC(sizeof(X)*l)); 103 | } 104 | memset(r=d+n++,0,sizeof(X)); 105 | return r; 106 | }; 107 | void Pop(){--n;} 108 | // void FreeAll(){X *r,*e; for(e=(r=d)+n;rFree(); n=0;} 109 | void Del(X *x) {--n; if(n)memcpy(x,d+n,sizeof(X)); } 110 | 111 | #ifndef WITHOUTTEMPL 112 | template X *FindT(Y x) {X *r,*e; for(e=(r=d)+n;rip==x)return r; return 0;} ; 113 | #endif 114 | void FreeOldT(ulong told){ X *r,*e; for(e=(r=d)+n;rfirst X * MList::Find(ulong x) 121 | {X *r,*e; for(e=(r=d)+n;rip==x)return r; return 0;} 122 | template void MList::FreeOld(ulong told) 123 | { X *r,*e; for(e=(r=d)+n;rfirst 137 | { 138 | LimitCntr *Find(ulong x); 139 | void FreeOld(ulong told); 140 | }; 141 | 142 | struct MListCntrIPv6: public MList 143 | { 144 | LimitCntrIPv6 *Find(in6_addr &x); 145 | void FreeOld(ulong told); 146 | }; 147 | 148 | extern MListCntr ipcnts[10]; 149 | extern MListCntrIPv6 ipv6cnts[10]; 150 | 151 | #define hack6 ipv6cnts[5] 152 | #define dns6DoS ipv6cnts[8] 153 | 154 | #endif 155 | 156 | #define hack ipcnts[5] 157 | #define dnsDoS ipcnts[8] 158 | extern ulong ltime[10],ip_limit[10],limit[10],net_limit[10]; 159 | 160 | #define smtp_ip_limit ip_limit[0] 161 | #define smtp_net_limit net_limit[0] 162 | #define smtp_ltime ltime[0] 163 | #define smtp_limit limit[0] 164 | 165 | 166 | #define prxy_ip_limit ip_limit[2] 167 | #define prxy_net_limit net_limit[2] 168 | #define prxy_ltime ltime[2] 169 | #define prxy_limit limit[2] 170 | 171 | #define ftpi_ip_limit ip_limit[3] 172 | #define ftpi_net_limit net_limit[3] 173 | #define ftpi_ltime ltime[3] 174 | #define ftpi_limit limit[3] 175 | 176 | #define ftpo_ip_limit ip_limit[4] 177 | #define ftpo_net_limit net_limit[4] 178 | #define ftpo_ltime ltime[4] 179 | #define ftpo_limit limit[4] 180 | 181 | 182 | #define http_ip_limit ip_limit[7] 183 | #define http_net_limit net_limit[7] 184 | #define http_ltime ltime[7] 185 | #define http_limit limit[7] 186 | 187 | LimitBase * AddToList(int i,sockaddr_in *sa,int c=0); 188 | 189 | 190 | 191 | -------------------------------------------------------------------------------- /mrc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #include 27 | #include "mdef.h" 28 | #include "mrc.h" 29 | 30 | #ifdef DJGPP 31 | #define HINST_CAST(a) a 32 | #define HMENU_CAST(a) a 33 | #else 34 | #define HINST_CAST(a) (HINSTANCE__*) a 35 | #define HMENU_CAST(a) (HMENU__*) a 36 | #endif 37 | 38 | //extern "C" { 39 | 40 | HWND MkDlg(const mrc_obj *mj,HWND parent,long font) 41 | { 42 | HWND r; 43 | if( !(r=CreateWindowEx(mj->ExStyle, 44 | mj->xClassName, 45 | mj->name, 46 | mj->Style, 47 | mj->x,mj->y,mj->w,mj->h, 48 | parent, 49 | (HMENU ) mj->id, 50 | HINST_CAST(hinstance), 51 | 0 52 | ) ) )return 0; 53 | SendMessage(r,WM_SETFONT,font,0); 54 | for(mj++;mj->xClassName;mj++) 55 | { 56 | SendMessage( 57 | CreateWindowEx( mj->ExStyle, 58 | mj->xClassName, 59 | mj->name, 60 | mj->Style, 61 | mj->x*2,mj->y*2,mj->w*2,mj->h*2, 62 | r, 63 | (HMENU ) mj->id, 64 | HINST_CAST(hinstance), 65 | 0 66 | ) 67 | ,WM_SETFONT,font,0) 68 | ; 69 | }; 70 | return r; 71 | }; 72 | 73 | 74 | HMENU MkMnu(//const 75 | mrc_mnu *mr,TCreateMenu crm) 76 | { 77 | int next_id; 78 | HMENU r=(crm)(); //CreateMenu(); 79 | while(mr->id) 80 | { 81 | if(mr->flg&MF_POPUP && (ulong)mr->id<128) 82 | { 83 | next_id=mr[mr->id].id; 84 | ((mrc_mnu *)mr)[mr->id].id=0; 85 | AppendMenu(r,mr->flg,(ulong)MkMnu(mr+1),mr->name); 86 | mr+=mr->id; 87 | ((mrc_mnu *)mr)->id=next_id; 88 | } 89 | else{ 90 | AppendMenu(r,mr->flg,mr->id,mr->name); 91 | mr++; 92 | } 93 | } 94 | return r; 95 | }; 96 | 97 | //} 98 | 99 | -------------------------------------------------------------------------------- /mrc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #ifndef MRC_H 27 | #define MRC_H 28 | 29 | //extern "C" { 30 | //extern HANDLE hinstance; 31 | extern HINSTANCE hinstance; 32 | 33 | struct mrc_obj 34 | { 35 | char *name; 36 | ulong id; 37 | char *xClassName; 38 | ulong Style; 39 | ushort x,y,w,h; 40 | ulong ExStyle; 41 | }; 42 | 43 | HWND MkDlg(const mrc_obj *,HWND ,long font); 44 | 45 | struct mrc_mnu 46 | { 47 | ushort flg; 48 | ushort id; 49 | char *name; 50 | }; 51 | 52 | //HMENU MkMnu(mrc_mnu *); 53 | typedef HMENU WINAPI (*TCreateMenu)(); 54 | HMENU MkMnu(//const 55 | mrc_mnu *mr,TCreateMenu crm=CreateMenu); 56 | 57 | 58 | //} 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /msprintfchk.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2025 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | 27 | #include 28 | 29 | 30 | #include "mstring1.h" 31 | //#include "mstring.h" 32 | #include "srv.h" 33 | #include "mdef.h" 34 | 35 | #include "bvprintf.h" 36 | 37 | extern "C" 38 | { 39 | 40 | struct SprintfPars 41 | { 42 | char *t; 43 | ulong l; 44 | }; 45 | 46 | int SPrintChkFlush(SprintfPars *th,char *t,ulong l) 47 | { 48 | if(th->l < l)l=th->l; 49 | if((int)l>0) 50 | { 51 | memcpy(th->t,t,l); 52 | th->l-=l; 53 | th->t+=l; 54 | } 55 | return l; 56 | }; 57 | 58 | int mvsprintfchk(char *t,char *et,const char *fmt, mva_list v) 59 | { 60 | SprintfPars th; 61 | BFILE bf; 62 | int r; 63 | char b[BFR_LIM*2]; 64 | th.t=t; 65 | th.l=et-t-1; 66 | bf.Init(&th,(PrintFlush)SPrintChkFlush,b); 67 | r=bf.bvprintf(fmt,v); 68 | bf.fflush(); 69 | *(th.t)=0; 70 | return r; 71 | } 72 | 73 | int msprintfchk(char *t,char *et,const char *fmt,...) 74 | { 75 | #ifdef USEVALIST 76 | va_list a; 77 | int r; 78 | 79 | va_start(a, fmt); 80 | r=mvsprintfchk(t,et,fmt,a); 81 | va_end(a); 82 | return r; 83 | #else 84 | return mvsprintfchk(t,et,fmt,(void **) ((&fmt)+1 ) ) ; 85 | #endif 86 | 87 | 88 | } 89 | 90 | int msprintf(char *t, const char *fmt,...) 91 | { 92 | #ifdef USEVALIST 93 | va_list a; 94 | int r; 95 | 96 | va_start(a, fmt); 97 | r = mvsprintfchk(t, t + 0x10000, fmt, a); 98 | va_end(a); 99 | return r; 100 | #else 101 | return mvsprintfchk(t, t + 0x10000, fmt, (void **) ((&fmt)+1 ) ) ; 102 | #endif 103 | } 104 | 105 | } 106 | 107 | -------------------------------------------------------------------------------- /mstring2.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | /* by M. Feoktistov (C) 1999 */ 26 | 27 | 28 | 29 | #include "mstring1.h" 30 | 31 | 32 | #define NULL 0 33 | 34 | char * strcat(char *_s1, const char *_s2) 35 | { 36 | asm volatile("cld; 37 | movl $-1,%%ecx; 38 | xor %%al,%%al; 39 | repne;scasb; 40 | decl %%edi; 41 | 1: 42 | lodsb 43 | stosb 44 | orb %%al,%%al 45 | jnz 1b" 46 | :"=&D" (_s2),"=&S" (_s2) 47 | :"0" (_s1),"1" (_s2) 48 | :"%ecx","%eax" 49 | //"%edi","%ecx","%esi","%eax" 50 | ); 51 | return _s1; 52 | }; 53 | //------ 54 | char * strrchr(const char *_s, int _c) 55 | { 56 | asm volatile("cld; 57 | xorb %%ah,%%ah; 58 | xorl %%edx,%%edx; 59 | 2: cmp (%%edi),%%ah; 60 | je 3f; 61 | scasb; 62 | jne 2b; 63 | lea -1(%%edi),%%edx; 64 | jmp 2b; 65 | 3:" 66 | :"=d" (_s),"=&D" (_c),"=&a" (_c) 67 | :"1" (_s),"2" (_c) 68 | // :"%edi","%eax" 69 | ); 70 | return (char *)_s; 71 | }; 72 | //--------*/ 73 | char * strstr(const char *_s1, const char *_s2) 74 | { 75 | asm volatile("cld 76 | 2: movl %%edx,%%esi 77 | movl %%ecx,%%edi 78 | 3: lodsb 79 | orb %%al,%%al 80 | jz 1f 81 | scasb 82 | je 3b 83 | incl %%ecx 84 | cmpb $0,(%%ecx) 85 | jne 2b 86 | xorl %%ecx,%%ecx 87 | 1: 88 | ":"=&c"(_s1),"=&d"(_s2) 89 | :"0"(_s1),"1"(_s2) 90 | :"%edi","%esi","%eax" 91 | ); 92 | return (char *) _s1; 93 | } 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /ndp.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //as ndp.s -o ndp.o 26 | 27 | .text 28 | .globl _id_heap 29 | _id_heap: 30 | id_heap: .long 0; 31 | 32 | heap_cnt: .long 0 33 | 34 | .globl ___builtin_vec_new 35 | .globl ___init_vec_new 36 | .globl malloc 37 | .globl _malloc 38 | .globl ___builtin_new 39 | 40 | 41 | ___init_vec_new: 42 | call _GetProcessHeap 43 | mov %eax,id_heap 44 | ret 45 | 46 | _malloc: 47 | malloc: 48 | ___builtin_new: 49 | ___builtin_vec_new: 50 | pushl 4(%esp) 51 | pushl $8 52 | pushl id_heap 53 | call _HeapAlloc 54 | ret $4 55 | 2: ;//Error 56 | xorl %eax,%eax 57 | ret $4 58 | 59 | .globl ___builtin_delete 60 | .globl ___builtin_vec_delete 61 | .globl _free 62 | .globl free 63 | free: 64 | _free: 65 | ___builtin_delete: 66 | ___builtin_vec_delete: 67 | pushl 4(%esp) 68 | pushl $0 69 | pushl id_heap 70 | call _HeapFree 71 | ;// incl heap_cnt 72 | ;// andl $0xF,heap_cnt 73 | ;// jnz 1f 74 | pushl $0 75 | pushl id_heap 76 | call _HeapCompact 77 | ;// 1: 78 | ret $4 79 | 80 | .globl _Get_nd_Func 81 | _Get_nd_Func: movl $l1,%edx 82 | jmp _OptFunc; 83 | l1: .long 0 84 | .asciz "kernel32.dll" 85 | 86 | .globl _GetProcessHeap 87 | _GetProcessHeap: call _Get_nd_Func 88 | .asciz "GetProcessHeap" 89 | .globl _HeapAlloc 90 | _HeapAlloc: call _Get_nd_Func 91 | .asciz "HeapAlloc" 92 | .globl _HeapFree 93 | _HeapFree: call _Get_nd_Func 94 | .asciz "HeapFree" 95 | .globl _HeapCompact 96 | _HeapCompact: call _Get_nd_Func 97 | .asciz "HeapCompact" 98 | 99 | .section .ctor0 100 | .long ___init_vec_new 101 | -------------------------------------------------------------------------------- /ndpdbg.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //as ndpdbg.s -o ndp.o 26 | 27 | .text 28 | .globl _id_heap 29 | _id_heap: 30 | id_heap: .long 0; 31 | 32 | heap_cnt: .long 0 33 | 34 | .globl ___builtin_vec_new 35 | .globl ___init_vec_new 36 | ___init_vec_new: 37 | call _GetProcessHeap 38 | mov %eax,id_heap 39 | ret 40 | 41 | ___builtin_vec_new: 42 | addl $8,4(%esp) 43 | pushl 4(%esp) 44 | pushl $8 45 | pushl id_heap 46 | call _HeapAlloc 47 | movl -4(%esp),%ecx 48 | movl %ecx,(%eax) 49 | movl $0x12345678,-8(%eax,%ecx,1) 50 | addl $4,%eax 51 | ret $4 52 | 2: ;//Error 53 | xorl %eax,%eax 54 | ret $4 55 | 56 | .globl ___builtin_delete 57 | ___builtin_delete: 58 | movl 4(%esp),%eax 59 | subl $4,%eax 60 | pushl %eax 61 | movl (%eax),%ecx 62 | cmpl $0x12345678,-8(%eax,%ecx,1) 63 | je 2f 64 | pushl %ecx 65 | pushl %eax 66 | call _DbgMemError 67 | 2: 68 | 69 | pushl $0 70 | pushl id_heap 71 | call _HeapFree 72 | ;// incl heap_cnt 73 | ;// andl $0xF,heap_cnt 74 | ;// jnz 1f 75 | pushl $0 76 | pushl id_heap 77 | call _HeapCompact 78 | ;// 1: 79 | ret $4 80 | 81 | .globl _Get_nd_Func 82 | _Get_nd_Func: movl $l1,%edx 83 | jmp _OptFunc; 84 | l1: .long 0 85 | .asciz "kernel32.dll" 86 | 87 | .globl _GetProcessHeap 88 | _GetProcessHeap: call _Get_nd_Func 89 | .asciz "GetProcessHeap" 90 | .globl _HeapAlloc 91 | _HeapAlloc: call _Get_nd_Func 92 | .asciz "HeapAlloc" 93 | .globl _HeapFree 94 | _HeapFree: call _Get_nd_Func 95 | .asciz "HeapFree" 96 | .globl _HeapCompact 97 | _HeapCompact: call _Get_nd_Func 98 | .asciz "HeapCompact" 99 | 100 | .section .ctor0 101 | .long ___init_vec_new 102 | -------------------------------------------------------------------------------- /nommc_dlfcn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | 27 | #define dlopen(a,b) 0 28 | #define dlsym(a,b) 0 29 | #define dlerror() "library unsupported" 30 | 31 | -------------------------------------------------------------------------------- /notes.ssl: -------------------------------------------------------------------------------- 1 | 2 | Notes for this release of "libsec.so", "libsec111.so" and "libsecgnutls.so" libraries 3 | 4 | Introduction: 5 | 6 | The shared library libsec.so was compiled for work with OpenSSL library versions 9.8 or early. 7 | The shared library libsec111.so was compiled for work with OpenSSL library versions 1.1.1 8 | The shared library libsecgnutls.so was compiled for work with GnuTLS library. 9 | OpenSSL sources are available here: http://www.openssl.org/ 10 | GnuTLS sources are available here: https://www.gnutls.org/ 11 | Loot of Linux distributing packages already included OpenSSL as 12 | binaries /usr/bin/openssl and shared library named e.g. 13 | /usr/lib/libssl.so.0.9.7 Libsec.so request this, but also it may work 14 | with preveous, and probably with next OpenSSL versions. 15 | 16 | In any case, you may get the sources and compile it by your self 17 | with any options up you like. 18 | 19 | Interface: 20 | 21 | The libsec*.so has easy interface: 22 | 23 | int STDCALL InitLib( 24 | int (* F_printf)(char *fmt,...), // Callback to printf like C printf 25 | int (* F_send)(void *param,void *bfr,int len), // Callback function for send 26 | int (* F_recv)(void *param,void *bfr,int len), // Callback function for receive 27 | char *CApath, // patch for CA-files 28 | char *CAfile, // CAfile 29 | char * s_cert_file, // cert file 30 | char * s_key_file // key file 31 | ); // This function return 1 if success, 0 if fail 32 | 33 | 34 | typedef struct _SecConnection 35 | {int state; 36 | void *CallbackParam; // Callback param for F_send, F_recv functions 37 | void *con; 38 | void *io,*ssl_bio,*sbio; 39 | } SecConnection; 40 | 41 | 42 | int STDCALL SecAccept(SecConnection *s); // In this function .so 43 | // allocate memory for new connection This function return 1 if success, 0 if fail. 44 | 45 | 46 | int STDCALL SecRecv (SecConnection *s,char *bfr,int l); // This function 47 | // encode bfr data and send it to user trough F_send callback. 48 | // s->callback must be set to param for F_send, F_recv functions 49 | // Function return number of sent bytes, 0 if connection closed, negative if error. 50 | int STDCALL SecSend (SecConnection *s,char *bfr,int l); // This function 51 | // receive data trough F_recv callback decode it to the bfr. 52 | // Function return number of bytes placed to the bfr, 0 if connection closed, negative if error. 53 | int STDCALL SecClose (SecConnection *s ); 54 | //This function release memory allocated for connection. 55 | 56 | void STDCALL SetPriority(char *t); //This function Sets priorities for the ciphers, key exchange methods, and macs. 57 | 58 | int STDCALL SecConnect(OpenSSLConnection *s, int flags, char *verfyhost); // This function prepare client TLS connection 59 | // Flags: 60 | #define tbtAnon 0x1 /* Don't use server sertificate */ 61 | #define tbtVerfyRequired 0x4 /* Verfy hostname */ 62 | #define tbtDontVerfyTyme 0x8 /* GNUTLS only. Don't verfy timestamp */ 63 | #define tbtDontVerfySigner 0x10 /* GNUTLS only. Don't verfy issuer */ 64 | #define tbtSSHstyleVerfy 0x20 /* GNUTLS only. SSH style. First time new host will be valid, and public key will be stored */ 65 | // verfyhost must be NULL if don't verfy, or name of remote host for verfication. 66 | // This function return 1 if success, 0 if fail. 67 | 68 | int STDCALL SecUpdateCB(OpenSSLConnection *s); // Function that must be call when address of caller object changed. 69 | 70 | 71 | 72 | Copyrights: 73 | 74 | OpenSSL Copyright (C) 1995-2019 Eric Young (eay@cryptsoft.com) 75 | This product includes software developed by the OpenSSL Project for use 76 | in the OpenSSL Toolkit. (http://www.openssl.org/) 77 | This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). 78 | This product includes software written by Tim Hudson (tjh@cryptsoft.com). 79 | This product includes software written by Dr Stephen N Henson (shenson@bigfoot.com). 80 | 81 | Since GnuTLS version 3.1.10, the core library is released under 82 | the GNU Lesser General Public License (LGPL) version 2.1 or later 83 | (see doc/COPYING.LESSER for the license terms). 84 | List of GnuTLS authors available on https://www.gnutls.org/contrib.html 85 | GnuTLS is available because of the efforts of many people. The development team is listed below. 86 | 87 | Nikos Mavrogiannopoulos 88 | Tim Rühsen 89 | Daiki Ueno 90 | Simon Josefsson 91 | Dmitry Eremin-Solenikov 92 | 93 | 94 | 95 | Best regards, Max Feoktistov 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /openssl_sert_templ: -------------------------------------------------------------------------------- 1 | AW 2 | All 3 | World 4 | SHS 5 | Temp sertificate 6 | temp.cer 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /pklz.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | #define FRAME_SIZE (0x3fff-256) 26 | #define CACHE_SIZE 0x80000 27 | #define CASHE_SHIFT 6 28 | 29 | inline void AddBits(uchar *t,int &c,int v,int n) 30 | { 31 | DWORD_PTR(t[c>>3])|=v<<(c&7); 32 | c+=n; 33 | }; 34 | 35 | int PackBits(uchar *t,uchar *s, int l) 36 | { 37 | int c=0,i,n,j,m,msk; 38 | memset(t,0,l //*(CASHE_SHIFT+8)/16 39 | ); 40 | for(i=0;i msk){++n; msk=(msk<<1)|1;} 45 | AddBits(t,c,s[i],(i&1)?n:8); 46 | } 47 | return (c>>3)+5; 48 | } 49 | 50 | int LZEncode(ushort *t,uchar *s,int l) 51 | { 52 | int i,j,k,n,xx; 53 | ulong c,cb,ch; 54 | uchar *cache; 55 | 56 | 57 | cache=new uchar[CACHE_SIZE]; 58 | 59 | // t[0]=*s++; 60 | // t[1]=*s++; 61 | k=0; 62 | for(i=0;i=2) 74 | { 75 | ch=((t[k-1]+t[k-2])^(t[k-2]<<8))&(CACHE_SIZE-1); 76 | if( cache[ch] ) 77 | { 78 | c=DWORD_PTR(t[k-2]); 79 | if( (n=t[k-2])n )n=cb; 82 | #if 1 83 | xx=k-3; 84 | for(j+=n;j>CASHE_SHIFT)+1; 117 | } 118 | } 119 | 120 | j=PackBits(cache,(uchar *)t,k*2); 121 | memcpy(t+2,cache,j); 122 | DWORD_PTR(*t)=k; 123 | delete cache; 124 | return j; 125 | // return k<<1; 126 | } 127 | -------------------------------------------------------------------------------- /prxcach.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | -------------------------------------------------------------------------------- /qsort.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | #ifdef DJGPP 25 | #include "dgpp_quote.h" 26 | #else 27 | #define DJGPP_QUOTE 28 | #endif 29 | //#include "mstring.h" 30 | 31 | inline void XCHG_s(char *a, char *b,int l ) 32 | { 33 | #ifdef DJGPP 34 | asm volatile( 35 | DJGPP_QUOTE jecxz 2f; 36 | subl %%edi,%%edx 37 | cld 38 | 1: 39 | movb (%%edi),%%al 40 | xchgb %%al,(%%edi,%%edx,1) 41 | stosb 42 | loop 1b 43 | 2: DJGPP_QUOTE 44 | :"=&D" (a),"=&c" (l),"=&d" (b) 45 | :"0" (a), "1"(l),"2" (b) 46 | ); 47 | #else 48 | asm volatile( 49 | " jecxz 2f \n" 50 | #if defined(x86_64) 51 | " subll %%rdi,%%rdx\n" 52 | " cld\n" 53 | "1: \n" 54 | " movb (%%rdi),%%al\n" 55 | " xchgb %%al,(%%rdi,%%rdx,1)\n" 56 | #else 57 | " subl %%edi,%%edx\n" 58 | " cld\n" 59 | "1: \n" 60 | " movb (%%edi),%%al\n" 61 | " xchgb %%al,(%%edi,%%edx,1)\n" 62 | #endif 63 | " stosb\n" 64 | " loop 1b\n" 65 | " 2:\n" 66 | :"=&D" (a),"=&c" (l),"=&d" (b) 67 | :"0" (a), "1"(l),"2" (b) 68 | ); 69 | #endif 70 | 71 | } 72 | 73 | #ifndef DJGPP 74 | 75 | typedef unsigned int size_t ; 76 | 77 | #endif 78 | 79 | extern "C" { 80 | void qsort(void *base, size_t nelem, size_t size, 81 | int (*cmp)(const void *e1, const void *e2)) 82 | { 83 | int i,j,k; 84 | long *pos; 85 | char *tmp,*p; 86 | k=nelem-1; 87 | #define E(a) (((char*)base)+(a)*size) 88 | for(i=0;i0)XCHG_s(E(i),E(j),size); 93 | } 94 | } 95 | }; 96 | 97 | } 98 | -------------------------------------------------------------------------------- /realloc.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | /* 26 | * realloc.s realloc function for C library 27 | */ 28 | ;//as realloc.s -o realloc.o 29 | 30 | .text 31 | _realloc: 32 | pushl 8(%esp) 33 | pushl 8(%esp) 34 | pushl $8 35 | pushl id_heap 36 | call _HeapReAlloc 37 | ret $8 38 | -------------------------------------------------------------------------------- /regular.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #ifndef REGULAR_H 27 | #define REGULAR_H 28 | 29 | 30 | struct RegVar 31 | { 32 | char *v; 33 | int l; 34 | }; 35 | 36 | struct Req; 37 | struct RegVars 38 | { 39 | RegVar rv[11]; 40 | int nrv; 41 | char *last_str; 42 | int last_before; 43 | char **vl1; 44 | char **vl2; 45 | int req_counter; 46 | int st; 47 | #define RV_FLG_NEW 0x2000 48 | #define RV_FLG_SUB 0x1000 49 | #define RV_FLG_ICASE 0x20 50 | 51 | char *aa[4]; 52 | char *bb[4]; 53 | char *end; 54 | int pos; 55 | char last_char; 56 | Req *req; 57 | 58 | 59 | int IsRegular(char *s0,char *p); 60 | char *FindRegular(char *s,char *pat); 61 | int LogAn(char *ls); 62 | int cmp(char *a,char *b); 63 | int isVar(char *&a,char **xx); 64 | void Init(char **v1,char **v2,Req *rr) 65 | {memset(this,0,sizeof(*this) ); /*st|=0x20;*/ vl1=v1; vl2=v2; req=rr; } 66 | char * SubstVar(char *t,char *s); 67 | char * FindEnd(char * &t); 68 | void PrintEnv(Req* s); 69 | char * isFunc(char *ls); 70 | }; 71 | 72 | char *strchr_meta(char *p,int c); 73 | int SlashSeq(char * &b); 74 | int IsInGrp(char *b,int c); 75 | int OutVarTbl(int s,char **tv,char *xbbf); 76 | char *SkipSpace(char *a); 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /ress1.s: -------------------------------------------------------------------------------- 1 | 2 | 3 | .globl resurce 4 | .globl _resurce 5 | resurce: 6 | _resurce: 7 | .long 0x00000000,0x00000000,0x00000000,0x00020000,0x00000003,0x80000020,0x0000000E,0x80000038 8 | .long 0x00000000,0x00000000,0x00000000,0x00010000,0x00000001,0x80000050,0x00000000,0x00000000 9 | .long 0x00000000,0x00010000,0x000001F6,0x80000068,0x00000000,0x00000000,0x00000000,0x00010000 10 | .long 0x00000409,0x00000080,0x00000000,0x00000000,0x00000000,0x00010000,0x00000409,0x00000090 11 | .long 0x0000D0A0,0x000002E8,0x00000000,0x00000000,0x0000D388,0x00000014,0x00000000,0x00000000 12 | .long 0x00000028,0x00000020,0x00000040,0x00040001,0x00000000,0x00000280,0x00000000,0x00000000 13 | .long 0x00000000,0x00000000,0x00000000,0x00800000,0x00008000,0x00808000,0x00000080,0x00800080 14 | .long 0x00008080,0x00C0C0C0,0x00808080,0x00FF0000,0x0000FF00,0x00FFFF00,0x000000FF,0x00FF00FF 15 | .long 0x0000FFFF,0x00FFFFFF,0x777C7777,0x77777777,0x88888877,0x88888888,0xC7CC7777,0x77777777 16 | .long 0x88888877,0x88888888,0xC7CC7C77,0x77777777,0xFFFFFF7F,0x88FFFFFF,0xCC77CC77,0x77777777 17 | .long 0xFFFFFF7F,0x88FFFFFF,0xCC77C77C,0x777777CC,0x00FFFF7F,0x88FFFF0F,0x777C777C,0x7777C7CC 18 | .long 0x00F0FF7F,0x88FFFF00,0x77777777,0x777777CC,0xFF00FF7F,0x88FF0FF0,0x7C777777,0x777777C7 19 | .long 0xFF0FF07F,0x88FF00FF,0xCC777777,0x777C7777,0xFFFF007F,0x770FF0FF,0xC77C7777,0xC7CC7777 20 | .long 0xFFFF0F70,0x7700FFFF,0x77777777,0xC7CC7C77,0x77777777,0x77777777,0x77777777,0xCC77CC77 21 | .long 0x77777777,0x77777777,0x77777777,0xCC77C77C,0x777777CC,0x77777777,0x77777777,0x777C777C 22 | .long 0x7777C7CC,0x77777777,0x87888877,0x77777777,0x777777CC,0x77777777,0x87888877,0x7C777777 23 | .long 0x777777C7,0x77777777,0x87EEEE7E,0xCC777777,0x777C7777,0x77777777,0x87EEEE7E,0xC77C7777 24 | .long 0xC7CC7777,0x77777777,0x77EEEE7E,0x77777777,0xC7CC7C77,0x77777777,0x77EEEE7E,0x77777777 25 | .long 0xCC77CC77,0x77777777,0x77777777,0x77777777,0xCC77C77C,0x777777CC,0x77777777,0x77777777 26 | .long 0x777C777C,0x7777C7CC,0x88777777,0x77878888,0x77777777,0x777777CC,0x88777777,0x77878888 27 | .long 0x7C777777,0x777777C7,0xAAAA7777,0x7787A8AA,0xCC777777,0x77777777,0xAAAA7777,0x7787A8AA 28 | .long 0xC77C7777,0x77777777,0xAAAA7777,0x7777A7AA,0x77777777,0x77777777,0xAAAA7777,0x7777A7AA 29 | .long 0x77777777,0x77777777,0x77777777,0x78777777,0x77888888,0x77777777,0x77777777,0x78777777 30 | .long 0x77888888,0x77777777,0x77777777,0xDD7D7777,0x7788DDDD,0x77777777,0x77777777,0xDD7D7777 31 | .long 0x7788DDDD,0x77777777,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 32 | .long 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 33 | .long 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 34 | .long 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 35 | .long 0x00000000,0x00000000,0x00010000,0x20200001,0x00010010,0x02E80004,0x00010000,0x00000000 36 | 37 | -------------------------------------------------------------------------------- /restart.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/restart.cpp -------------------------------------------------------------------------------- /ru/shs_lang.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/ru/shs_lang.cfg -------------------------------------------------------------------------------- /rulst.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #if 0 27 | uchar reg_usr_hi[32]={5,10,7,19,11,6,2,10,11,2,15,22,11,8,11,10,17,8,2,8,5,3,19,10,6,12,3,8,8,9,12,15}; 28 | 29 | uchar reg_usr_lo[]={224, 30 | 146,134,236,254,48,211,41,229,62,192,181,17,61,161,19,24, 31 | 138,132,130,218,222,88,137,219,24,27,23,48,83,189,207,145, 32 | 34,245,75,28,10,59,74,247,186,202,54,158,171,46,247,190, 33 | 55,152,125,248,85,97,4,238,214,163,202,73,66,229,70,193, 34 | 209,166,32,71,113,160,177,142,188,38,234,18,200,143,104,65, 35 | 16,210,231,167,153,35,146,201,245,74,105,99,226,172,181,51, 36 | 183,235,127,236,13,41,142,102,105,66,175,243,107,227,100,253, 37 | 115,148,79,179,77,152,237,114,39,63,210,80,5,48,9,62, 38 | 232,163,57,32,105,209,185,188,17,205,151,195,137,95,16,20, 39 | 226,124,204,182,174,189,110,220,39,71,61,111,143,125,108,121, 40 | 95,133,82,83,32,73,26,31,220,199,56,253,94,69,149,128, 41 | 203,51,16,191,169,146,226,165,153,55,208,220,115,118,133,168, 42 | 168,255,111,249,18,71,71,40,12,50,153,120,63,236,127,46, 43 | 140,73,222,192,245,6,185,93,65,159,49,180,219,164,250,249, 44 | 248,218,241,63,38,37,227,18,92,81,5,117,217,216,7,203, 45 | 210,171,26,47,63,44,14,65,58,114,40,49,179,191,226,229, 46 | 181,233,161,57,122,73,8,221,230,128,132,20,110,92,55,225, 47 | 241,241,163,237,215,220,243,157,90,97,10,214,131,212,92,26, 48 | 12,218,70,149,255,73,9,152,23,196,189,110,50,240,98,163}; 49 | 50 | uchar reg_usr_lo2[]={16, 51 | 98,144,99,54,205,180,184,213,82,123,206,97,168,175,155,45, 52 | 230,168,196,67,249,49,17,247,143,129,65,148,164,16,213,130, 53 | 18,199,131,159,55,30,241,123,89,47,46,28,160,202,210,141, 54 | 209,32,55,115,195,161,0,1,74,149,88,79,37,84,111,92, 55 | 45,74,163,247,71,94,158,42,172,175,96,252,191,37,127,78, 56 | 110,86,48,254,71,57,222,12,132,1,141,42,141,213,248,119, 57 | 112,220,102,9,40,246,168,44,147,132,217,245,251,168,60,117, 58 | 148,72,5,251,12,52,40,70,178,206,239,47,84,233,191,155, 59 | 93,74,5,107,205,153,218,23,33,194,212,127,194,146,118,77, 60 | 107,66,88,222,240,12,127}; 61 | 62 | #else 63 | 64 | 65 | ulong RusrLst[]= 66 | { 67 | 0x51F2983, 0x72B41027, 0xA65F6F79, 0x402ECD7, 0xD9DF1C37, 0x59A026F, 68 | 0xCAB34E55, 0x9BE041C1, 0x1D84D109, 0x513BBFD, 0x5F49882B, 0x40B401DD, 69 | 0xE1DB0D1F, 0x7546B2FB, 0x2F051861, 0x646C6771, 0xDA98925, 0x83EE3767, 70 | 0xF3B06FEF, 0x816228A7, 0x8AEE07B, 0x89F24B5D, 0x1C3AA5B1, 0xB751446B, 71 | 0xB1CE0C09, 0xB7FAC213, 0x2DC8F035, 0x8EC0281B, 0xE4ADDF5, 0x9DB02ECD, 72 | 0x1E3E69C5, 0x4AF4F91, 0x952F369, 0x631878B3, 0x87BA534D, 0xF5EC5D43, 73 | 0x29CDF9D9, 0x6CBF6ED, 0xB6AAD353, 0x136C4183, 0xF41B0CF, 0xB4A15FEB, 0x98D0949, 74 | 0x32AE3497, 0x6A814545, 0xFC56BBAD, 0x9EC44F55, 0x8914D0A1, 0x35B32DC9, 75 | 0x99B2A039, 0x454D7A2B, 0xC5853F53, 0x65BDB9A9, 0xFDD9C749, 0x28E9B0B1, 76 | 0x6ED22BCB, 0x754DAA2D, 0xCB96795, 0x5B60CFAF, 0x8E9EBD61, 0x3A581C53, 77 | 0x6A54D8C9, 0x190CD79D, 0x507CA75, 0x76BB8C7, 0x42900B2D, 0x3586E17, 0xC5BDD90B, 78 | 0x30326FF, 0x2A4E4B1, 0xC27C45F7, 0x4CE9C235, 0x95867873, 0x3980D2A1, 79 | 0x180D94DD, 0xB084FB3, 0x4B82387, 0x34D2219, 0x98D9997F, 0x113BC667, 0xFEF1E90F, 80 | 0x35879C95, 0x3494FED5, 0xE08E41B1, 0x89CC2B6D, 0x2AFA5D33, 0x30F5531, 81 | 0x20A9C301, 0x1692D84F, 0x2679EDA1, 0x897942A9, 0x35F5BF7, 0x5C29A05, 82 | 0x9FD4DEE1, 0x60CA9D3, 0x4FC32B5, 0x81BA5B7B, 0x900BA109, 0x2171570B, 83 | 0x112CEED5, 0x44E3304B, 0x9C89C615, 0xD102935B, 0xC9A8F181, 0xC1B52427, 84 | 0x688B1841, 0x3B3ACB9F, 0x15371AD9, 0x8008E01, 0xF12D08B, 0x733141D, 0xFDB2DE7D, 85 | 0x14419145, 0x47C22F7, 0x270A867, 0xCFE83AE1, 0x60E90DA7, 0xB8C7EEC1, 86 | 0x41397FC1, 0xA5025071, 0x63B9FE1, 0x425DE90F, 0x7C971895, 0x99336959, 87 | 0x403A2BF1, 0x6637FFCF, 0xE4B18DF1, 0x66DC7143, 0x48A0C54F, 0x36063E4D, 88 | 0x1CD4373D, 0x7213E7C3, 0x7E37CDE9, 0xBE3DF4BB, 0xE97C7CF, 0xD48AD50F, 89 | 0x86FA984D, 0x7CFBB503, 0xE418D579, 0x45D79371, 0x7037CCBD, 0x98A909B, 90 | 0x511EDBF7, 0x81AA18E7, 0x20E59077, 0x30C8E4D5, 0xA9A930F, 0x53478A19, 91 | 0x7D579F21, 0xE3B29E3F, 0xF049AB9, 0x669161D7, 0x6DA7D2D9, 0xFA5FE2F, 92 | 0x24F95171, 0x8F76FADF, 0xA96B5609, 0xD7DD3B4D, 0x97C26FBF, 0x41277DD, 93 | 0xEAFD649, 0xA7BA6E13, 0xF5B6623B, 0xE88F991, 0x43897E7, 0xA8CBF5F, 0x7BA3BC17, 94 | 0x5CB9001, 0xB9E248B, 0x908AAAB, 0x62F6359, 0x49378E9D, 0x49378E9D, 0x728296D, 95 | 0xC51210CB, 0x124D12F3, 0xD206D67F, 0xCB885FC5, 0x5E1846A5, 0x1ABF356B, 96 | 0x1ABF356B, 0x2D69E93, 0x3D0687A5, 0x5D63565, 0x37B46B79, 0x34227A79, 0x7ABCD09, 97 | 0x33B25E11, 0x98BABDA7, 0x46682D35, 0x100C984F, 0x134425D9, 0x3419F467, 98 | 0x96B86F7F, 0x631DA611, 0xD8A35A75, 0x4E22D59, 0x4A805D1F, 0x31D6C477, 99 | 0x19A5D4B, 0x164B57D, 0x3BB9F24, 0x5CFBC3C, 0x48C0B8C, 0x18DF633D, 0x25F0564F, 100 | 0xCB512C05, 0xA76141D7, 0xE339A235, 0x37FF2203, 0xE629A6FF, 0x53C3B13F, 101 | 0x22A78135, 0x8E45FC19, 0xFED55D81, 0x5945040B, 0x88EE08F, 0x7ECDBA1, 102 | 0x70A783B3, 0x853EA75, 0xA17820F, 0x820EEFBF, 0x1C95A969, 0x27E6A81B, 103 | 0x2229160F, 0x13DF2BB, 0x7B1A4ED7, 0x1CACC4AF, 0x31EA425, 0x8115F30B, 0x1799B2F, 104 | 0x44A66B3, 0x29AF0BF, 0x219D9 105 | 106 | }; 107 | 108 | // total: 232 from 446 repeat 36 = 8% 109 | #endif 110 | 111 | -------------------------------------------------------------------------------- /sa: -------------------------------------------------------------------------------- 1 | -fpack-struct 2 | -m486 3 | -s 4 | -O2 5 | -malign-loops=0 6 | -malign-jumps=0 7 | -malign-functions=0 8 | -fno-verbose-asm 9 | -fno-implicit-templates 10 | -mno-svr3-shlib 11 | -mno-align-double 12 | -mno-fancy-math-387 13 | -static 14 | -fsjlj-exceptions 15 | -Zpe 16 | -Xlinker -Map -Xlinker flxmaps 17 | -nostartfiles 18 | -fconserve-space 19 | -ID:\DJGPP\INCLUDE\WIN32 20 | -DSERVICE 21 | -mrtd 22 | ndp.o upl.o stpdta.o sethttp3.o 23 | -luser -lkern -lgdi -lshell -lcdlg -lwadv 24 | -------------------------------------------------------------------------------- /sar: -------------------------------------------------------------------------------- 1 | -fpack-struct 2 | -m486 3 | -s 4 | -O2 5 | -malign-loops=0 6 | -malign-jumps=0 7 | -malign-functions=0 8 | -fno-verbose-asm 9 | -fno-implicit-templates 10 | -mno-svr3-shlib 11 | -mno-align-double 12 | -mno-fancy-math-387 13 | -static 14 | -fsjlj-exceptions 15 | -Zpe 16 | -Xlinker -Map -Xlinker flxmaps 17 | -nostartfiles 18 | -fconserve-space 19 | -ID:\DJGPP\INCLUDE\WIN32 20 | -DSERVICE 21 | -mrtd 22 | ndp.o upl.o stpdtar.o sethttp3.o 23 | -luser -lkern -lgdi -lshell -lcdlg -lwadv 24 | -------------------------------------------------------------------------------- /sc0: -------------------------------------------------------------------------------- 1 | -c 2 | -fpack-struct 3 | -m486 4 | -s 5 | -O2 6 | -fno-implicit-templates 7 | -fsjlj-exceptions 8 | -Zpe 9 | -fconserve-space 10 | -ID:\DJGPP\INCLUDE\WIN32 11 | -DSERVICE=1 12 | -mrtd 13 | sethttp3.cpp 14 | -o sethttp3.o 15 | -------------------------------------------------------------------------------- /script_examples/vpn_if_client_down.bat: -------------------------------------------------------------------------------- 1 | rem Example of script that server call when VPN connection closed 2 | rem Arguments: 3 | rem 4 | 5 | echo ON 6 | 7 | rem !!! Drect yuor original gateway in next line: 8 | rem set ORIGINAL_GW=192.168.12.5 9 | 10 | echo if:%1 ip:%2 11 | 12 | rem Uncomment next 2 lines to direct all IP4 trafic to original GW 13 | rem route DELETE 0.0.0.0 14 | rem route ADD 0.0.0.0 MASK 0.0.0.0 %ORIGINAL_GW% 15 | 16 | -------------------------------------------------------------------------------- /script_examples/vpn_if_client_down.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Example of script that server call when connection estabilished 4 | # Arguments: 5 | # 6 | 7 | echo -e "\n\nVPN client interface DOWN scrpt\n" 8 | 9 | CURENT_GW_IF=$(route -n | awk '/^0.0.0.0/ {print $8 }') 10 | ORIGINAL_GW=$(route -n | awk "/^$2/ {print \$1 }" ) 11 | 12 | if [[ $# -gt 2 ]] ; then 13 | vpn_server=$3 14 | fi 15 | 16 | 17 | echo "if:$1 ip:$2 ip_of_vpn_server:$vpn_server ORIGINAL_GW:$ORIGINAL_GW CURENT_GW_IF:$CURENT_GW_IF" 18 | 19 | # Uncomment next lines to return back all IP4 trafic to original gateway 20 | # if [[ -n "$ORIGINAL_GW" && $CURENT_GW_IF == $1 ]] ; then 21 | # route del default 22 | # route add default gw $ORIGINAL_GW 23 | # fi 24 | 25 | # Uncomment next lines to return back your DNS 26 | # if [[ -e /etc/resolv.conf.orig ]] ; then 27 | # mv -f /etc/resolv.conf.orig /etc/resolv.conf 28 | # fi 29 | 30 | 31 | exit 0 32 | 33 | -------------------------------------------------------------------------------- /script_examples/vpn_if_client_up.bat: -------------------------------------------------------------------------------- 1 | rem Example of script that server call when connection estabilished 2 | rem Arguments: 3 | rem "" 4 | 5 | echo ON 6 | 7 | rem !!!Drect yuor original gateway in next line:!!! 8 | rem set ORIGINAL_GW=192.168.1.1 9 | 10 | netsh interface ipv4 set address name=%1 static %2 %3 %4 11 | 12 | echo if:%1 ip:%2 mask:%3 gw:%4 dns:%5 remote:%6 13 | 14 | rem !!! Uncomment next 4 lines to redirect all IP4 trafic to VPN !!! 15 | rem route ADD %6 MASK 255.255.255.255 %ORIGINAL_GW% 16 | rem route DELETE 0.0.0.0 MASK 0.0.0.0 %ORIGINAL_GW% 17 | rem route ADD 0.0.0.0 MASK 0.0.0.0 %4 18 | rem netsh interface ipv4 add dnsserver %1 address=8.8.8.8 index=1 19 | 20 | 21 | -------------------------------------------------------------------------------- /script_examples/vpn_if_client_up.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Example of script that server call when connection estabilished 4 | # Arguments: 5 | # '' 6 | 7 | echo -e "\n\nVPN client interface UP scrpt\n" 8 | 9 | ORIGINAL_GW=$(route -n | awk '/^0.0.0.0/ {print $1 }') 10 | 11 | if [[ $# -gt 5 ]] ; then 12 | vpn_server=$6 13 | fi 14 | 15 | 16 | echo "if:$1 ip:$2 mask:$3 gw:$4 dns:$5 ip_of_vpn_server:$vpn_server usnet:$USNET wan_if:$WAN_IF" 17 | 18 | # Uncomment next 3 lines to redirect all IP4 trafic to VPN 19 | # route add -host $6 gw $ORIGINAL_GW 20 | # route del default 21 | # route add default gw %3 22 | 23 | # Uncomment next lines to update your DNS 24 | # if [[ -n $5 ]] ; then 25 | # DNS=${5//[,;]/ } 26 | # if [[ ! -e /etc/resolv.conf.orig ]] ; then 27 | # mv /etc/resolv.conf /etc/resolv.conf.orig 28 | # fi 29 | # for i in $DNS ; do 30 | # echo "nameserver $i" 31 | # done > /etc/resolv.conf 32 | # fi 33 | 34 | 35 | exit 0 36 | 37 | -------------------------------------------------------------------------------- /script_examples/vpn_if_up.bat: -------------------------------------------------------------------------------- 1 | rem Example of script that server call when connection estabilished 2 | rem Arguments: 3 | rem '' 4 | 5 | echo ON 6 | netsh interface ipv4 set address name="%1" static %2 %3 %4 7 | rem netsh interface ipv4 set address name="Local Area Connection 4" static 192.168.111.1 255.255.255.0 192.168.111.1 8 | 9 | rem netsh interface ipv4 add dnsservers %1 address=8.8.8.8 index=1 10 | 11 | -------------------------------------------------------------------------------- /script_examples/vpn_if_up.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Example of script that server call when server VPN interface up 4 | # Arguments: 5 | # 6 | 7 | echo -e "\n\nVPN interface UP scrpt\n" 8 | 9 | WAN_IF=$(route -n | awk '/^0.0.0.0/ {print $8 }') 10 | USNET=$(perl -e '$a=pack("C4",split(/[.]/,$ARGV[0])) & ($m=pack("C4",split(/[.]/,$ARGV[1]))); $m=unpack("L",$m); for($i=0;$m;$i++){$m=$m>>1;} printf "%u.%u.%u.%u/$i", unpack("C4",$a); ' $2 $3) 11 | 12 | echo "if:$1 ip:$2 mask:$3 gw:$4 usnet:$USNET wan_if:$WAN_IF" 13 | 14 | # Uncoment next lines to share internet to VPN users: 15 | # echo "1" > /proc/sys/net/ipv4/ip_forward 16 | # if ! iptables -t nat -L -v -n | grep $USNET then 17 | # iptables -t nat -A POSTROUTING -o $WAN_IF -s $USNET -j MASQUERADE 18 | # fi 19 | 20 | 21 | # Uncoment next lines to create common bridge with VPN TAP and your LAN interface (for TAP interface only!): 22 | # LAN_IF=eth1 23 | # LAN_IP=$2 24 | # LAN_MASK=$3 25 | # BR=br0 26 | # ifconfig $1 0.0.0.0 27 | # if ! grep $BR /proc/net/dev ; then 28 | # brctl addbr $BR 29 | # ifconfig $LAN_IF 0.0.0.0 30 | # ifconfig $BR $LAN_IP netmask $LAN_MASK 31 | # brctl addif $BR $LAN_IF 32 | # fi 33 | # brctl addif $BR $1 34 | 35 | 36 | exit 0 37 | 38 | -------------------------------------------------------------------------------- /secdll.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #ifndef _SECDLL_H_ 27 | #define _SECDLL_H_ 28 | 29 | typedef struct _SecConnection 30 | {int state; 31 | void *CallbackParam; // Callback param for F_send, F_recv functions 32 | void *con; 33 | void *io,*ssl_bio,*sbio; 34 | } SecConnection; 35 | 36 | #ifndef STDCALL 37 | #define STDCALL 38 | #endif 39 | 40 | int STDCALL InitLib( 41 | int (* F_printf)(char *fmt,...), // Callback to printf like C printf 42 | int (* F_send)(void *param,void *bfr,int len), // Callback function for send 43 | int (* F_recv)(void *param,void *bfr,int len), // Callback function for receive 44 | char *CApath, // patch for CA-files 45 | char *CAfile, // CAfile 46 | char * s_cert_file, // cert file 47 | char * s_key_file // key file 48 | ); // This function return 1 if success, 0 if fail 49 | 50 | int STDCALL SecAccept(SecConnection *s); // In this function DLL 51 | // allocate memory for new connection This function return 1 if success, 0 if fail. 52 | 53 | 54 | int STDCALL SecRecv (SecConnection *s,char *bfr,int l); // This function 55 | // encode bfr data and send it to user trough F_send callback. 56 | // s->callback must be set to param for F_send, F_recv functions 57 | // Function return nuber of sent bytes , 0 if connection closed, negative if error. 58 | int STDCALL SecSend (SecConnection *s,char *bfr,int l); // This function 59 | // receive data trough F_recv callback decode it to the bfr. 60 | // Function return number of bytes placed to the bfr, 0 if connection closed, negative if error. 61 | int STDCALL SecClose (SecConnection *s ); 62 | //This function release memory allocated for connection. 63 | 64 | int STDCALL SecConnect(OpenSSLConnection *s, int flags, char *verfyhost); // This function prepare client TLS connection 65 | // Flags: 66 | #define tbtAnon 0x1 /* Don't use server sertificate */ 67 | #define tbtVerfyRequired 0x4 /* Verfy hostname */ 68 | #define tbtDontVerfyTyme 0x8 /* GNUTLS only. Don't verfy timestamp */ 69 | #define tbtDontVerfySigner 0x10 /* GNUTLS only. Don't verfy issuer */ 70 | #define tbtSSHstyleVerfy 0x20 /* GNUTLS only. SSH style. First time new host will be valid, and public key will be stored */ 71 | // verfyhost must be NULL if don't verfy, or name of remote host for verfication. 72 | // This function return 1 if success, 0 if fail. 73 | 74 | int STDCALL SecUpdateCB(OpenSSLConnection *s); // Function that must be call when address of caller object changed. 75 | 76 | 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /sethttp3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/sethttp3.cpp -------------------------------------------------------------------------------- /shs_vpnclient.1: -------------------------------------------------------------------------------- 1 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. 2 | .TH SHS_VPNCLIENT "1" "April 2025" "Small HTTP Server ver. 3.06.36" "User Commands" 3 | .SH NAME 4 | shs_vpnclient -- VPN client for Small HTTP Server 5 | 6 | .SH SYNOPSIS 7 | shs_vpnclient [--v][--c config_file|@config_file][--h|?] [{Params }] 8 | 9 | .SH DESCRIPTION 10 | VPN client for Small HTTP Server 11 | 12 | shs_vpnclient.exopenssl is built to work with the OpenSSL security library. 13 | 14 | shs_vpnclient.exgnutls is built to work with the GNUTLS security library. 15 | 16 | shs_vpnclient allows you to select a security library in the configuration. (lib/smallsrv/libsec111.so or lib/smallsrv/libsecgnutls.so) 17 | 18 | .PP 19 | Small HTTP Server ver. 3.06.36 20 | .SH OPTIONS 21 | 22 | .TP 23 | \fB\-\-v\fR 24 | print version and exit 25 | .TP 26 | \fB\-\-c\fR config_file 27 | use directed config file instead default 28 | .TP 29 | @config_file 30 | use directed config file after default 31 | .TP 32 | \fB\-\-h\fR, \fB\-\-\fR? 33 | print this help and exit 34 | .PP 35 | \&'Param' the same as the params in config file: 36 | .SS "General setting:" 37 | .TP 38 | noicon 39 | Don't out log to terminal. 40 | .TP 41 | hide 42 | Start as daimon. 43 | .SS "TLS/SSL:" 44 | .TP 45 | tls_lib=path 46 | DLL library with TLS/SSL. E.g. libsec111.dll 47 | .TP 48 | tls_cert_file=path 49 | Certificate file 50 | .TP 51 | tls_key_file=path 52 | Key file 53 | .TP 54 | tls_capath=path 55 | CA\-Path 56 | .TP 57 | tls_cafile=path 58 | CA\-file 59 | .TP 60 | tls_priority=value 61 | Sets priorities for the ciphers, key exchange methods, and macs 62 | .SS "HTTP TLS VPN Client:" 63 | .TP 64 | vpnclient 65 | Enable to connect to TLS VPN remote host 66 | .TP 67 | vpn_remote_host=value 68 | Host to connect to remote TLS VPN server 69 | .TP 70 | vpn_client_port=value 71 | TLS VPN remote port. (Usually 443) 72 | .TP 73 | vpn_client_url=value 74 | TLS VPN URL name (direct only local part of URL e.g. "/$_vpn_$"). Must be the same as directed on the remote server 75 | .TP 76 | vpn_remote_user=value 77 | TLS VPN User name 78 | .TP 79 | vpn_remote_passw=value 80 | TLS VPN Password 81 | .TP 82 | vpncln_tap 83 | VPN client to Tap. (Otherwise Tun) 84 | .TP 85 | vpn_tuntap_number=value 86 | TLS VPN client Tun/Tap device number 87 | .TP 88 | vpn_client_mtu=value 89 | TLS VPN MTU for client. 90 | .TP 91 | tuntap_ip=value 92 | Set client VPN interface IP address 93 | .TP 94 | tuntap_nmask=value 95 | Set client VPN interface netmask 96 | .TP 97 | vpncln_script_up=path 98 | Run init script when VPN connection estabilished 99 | .TP 100 | vpncln_script_down=path 101 | Run deinit script when VPN connection closed 102 | .TP 103 | vpncln_chktls 104 | Validate remote TLS sertificate, check host name 105 | .TP 106 | vpncln_tlsigntime 107 | Don't check remote sertificate time. Ignore expired. (GNUTLS only) 108 | .TP 109 | vpncln_tlsssign 110 | Accept self signed sertificate. (GNUTLS only) 111 | .TP 112 | vpncln_tlssshstyle 113 | SSH style of sertificate validate. (GNUTLS only. Public keys of new untracted remote will be stored in ~/.gnutls/known_hosts) 114 | .SH FILES 115 | /etc/smallsrv/vpnclient.cfg -- config file 116 | 117 | /etc/smallsrv/shs_lang.cfg -- language pack, may be present as link to /usr/local/share/smallsrv//shs_lang.cfg 118 | 119 | Without this file English language used. 120 | 121 | Names of another files can be changed in vpnclient.cfg 122 | 123 | If the /etc/smallsrv/vpnclient.cfg is absent the program find it in the current directory. 124 | 125 | If used `--c config_file` key, the program will be use only this. 126 | 127 | .SH AUTHOR 128 | Written by Maksim Feoktistov 129 | 130 | .SH "REPORTING BUGS" 131 | Maksim Feoktistov 132 | 133 | .SH "SEE ALSO" 134 | The full description is maintained as a html file in /usr[/local]/share/smallsrv/descu.htm 135 | Last version at https://smallsrv.com/descu.htm 136 | 137 | 138 | -------------------------------------------------------------------------------- /shs_vpnclient_usage.1.in: -------------------------------------------------------------------------------- 1 | [NAME] 2 | shs_vpnclient -- VPN client for Small HTTP Server 3 | 4 | [SYNOPSIS] 5 | shs_vpnclient [--v][--c config_file|@config_file][--h|?] [{Params }] 6 | 7 | [DESCRIPTION] 8 | VPN client for Small HTTP Server 9 | 10 | shs_vpnclient.exopenssl is built to work with the OpenSSL security library. 11 | 12 | shs_vpnclient.exgnutls is built to work with the GNUTLS security library. 13 | 14 | shs_vpnclient allows you to select a security library in the configuration. (lib/smallsrv/libsec111.so or lib/smallsrv/libsecgnutls.so) 15 | 16 | [OPTIONS] 17 | 18 | [FILES] 19 | /etc/smallsrv/vpnclient.cfg -- config file 20 | 21 | /etc/smallsrv/shs_lang.cfg -- language pack, may be present as link to /usr/local/share/smallsrv//shs_lang.cfg 22 | 23 | Without this file English language used. 24 | 25 | Names of another files can be changed in vpnclient.cfg 26 | 27 | If the /etc/smallsrv/vpnclient.cfg is absent the program find it in the current directory. 28 | 29 | If used `--c config_file` key, the program will be use only this. 30 | 31 | [AUTHOR] 32 | Written by Maksim Feoktistov 33 | 34 | [REPORTING BUGS] 35 | Maksim Feoktistov 36 | 37 | [SEE ALSO] 38 | The full description is maintained as a html file in /usr[/local]/share/smallsrv/descu.htm 39 | Last version at https://smallsrv.com/descu.htm 40 | 41 | 42 | -------------------------------------------------------------------------------- /slib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #ifndef SLIB_H 27 | #define SLIB_H 28 | 29 | extern "C" { 30 | 31 | 32 | uint atoui(const char *a); 33 | uint atouix(const char *a); 34 | uint atouix2(const char *a); 35 | uint atouisc(const char *&a); 36 | inline uint atouis(char *&a){return atouisc( (const char *&) a); }; 37 | 38 | unsigned long strtoul(const char *s, char **e, int base); 39 | 40 | #if (!defined(_STDLIB_H)) && (!defined(_STDLIB_H_)) && (!defined(MINGW)) 41 | char * malloc(int l); 42 | char * realloc(void *,int l); 43 | void free(void *); 44 | 45 | #endif 46 | 47 | } 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /sndmsg.1: -------------------------------------------------------------------------------- 1 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. 2 | .TH SNDMSG "1" "June 2024" "version 1.0" "User Commands" 3 | .SH NAME 4 | sndmsg -- sendmail emulator for Small HTTP server 5 | 6 | .SH SYNOPSIS 7 | sndmsg {Keys} [to@address] 8 | 9 | 10 | .SH DESCRIPTION 11 | The program send mail message with help Small HTTP server, or with help another SMTP server. 12 | 13 | .PP 14 | SndMsg \fB\-\-\fR sendmail emulator for Small HTTP server. 15 | .SH OPTIONS 16 | 17 | 18 | .TP 19 | \fB\-t\fR 20 | read recipients from message 21 | .TP 22 | \fB\-o\fR \fI\,/var/smallsrv/outbox\/\fP 23 | outbox subderectory in Small HTTP server or 24 | .TP 25 | \fB\-o\fR smtp://smtp.address[:25] 26 | out to SMTP server (default smtp://127.0.0.1:25) 27 | .TP 28 | \fB\-f\fR from@address 29 | from address 30 | .TP 31 | \fB\-F\fR "full name" 32 | name 33 | .TP 34 | \fB\-s\fR 35 | save From lines in headers 36 | .TP 37 | \fB\-m\fR filename 38 | message file instead stdin 39 | .TP 40 | \fB\-a\fR filename 41 | attach binary file 42 | .PP 43 | (C) 2002\-2023 by M.Feoktistov 44 | .SH AUTHOR 45 | Written by Maksim Feoktistov 46 | 47 | .SH "REPORTING BUGS" 48 | Maksim Feoktistov 49 | 50 | .SH "SEE ALSO" 51 | 52 | httpd.exe(1) 53 | 54 | The full description of Small HTTP server is maintained as a html file in [..]/share/smallsrv/descu.htm 55 | 56 | Last version at https://smallsrv.com/descu.htm 57 | -------------------------------------------------------------------------------- /sndmsg_usage.1.in: -------------------------------------------------------------------------------- 1 | 2 | [NAME] 3 | sndmsg -- sendmail emulator for Small HTTP server 4 | 5 | [SYNOPSIS] 6 | sndmsg {Keys} [to@address] 7 | 8 | 9 | [DESCRIPTION] 10 | The program send mail message with help Small HTTP server, or with help another SMTP server. 11 | 12 | [OPTIONS] 13 | 14 | 15 | [AUTHOR] 16 | Written by Maksim Feoktistov 17 | 18 | [REPORTING BUGS] 19 | Maksim Feoktistov 20 | 21 | [SEE ALSO] 22 | 23 | httpd.exe(1) 24 | 25 | The full description of Small HTTP server is maintained as a html file in [..]/share/smallsrv/descu.htm 26 | 27 | Last version at https://smallsrv.com/descu.htm 28 | -------------------------------------------------------------------------------- /srvdat.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/srvdat.cpp -------------------------------------------------------------------------------- /srvdat_vpnclient.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2021 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #ifndef SRV_H 27 | #include "srv.h" 28 | #endif 29 | 30 | 31 | 32 | mrc_mnu mnu2[]= 33 | { 34 | {0,125,"&Open Window" }, 35 | #ifndef CD_VER 36 | {0,126,"&Settings..." }, 37 | // {0,346,"&Reconnect" }, 38 | {MF_SEPARATOR,1,0}, 39 | {0,98,"&VPN Client connect" }, 40 | {0,99,"VPN Client &disconnect" }, 41 | 42 | {MF_SEPARATOR,1,0}, 43 | {0,352,"Description (&Local)" }, 44 | {0,350,"What &new? (Online)" }, 45 | {MF_SEPARATOR,1,0}, 46 | #endif 47 | 48 | {0,344,"&About" }, 49 | {MF_SEPARATOR,1,0}, 50 | {0,150,"E&xit" }, 51 | {0,0,0} 52 | }; 53 | 54 | mrc_mnu mnu3[]= 55 | { 56 | {0,3900,"&General" }, 57 | {0,3901,"&TLS/SSL"}, 58 | {0,3902,"VPN C&lient"}, 59 | {MF_HELP,710,"O&k" }, 60 | {MF_HELP,150,"&Cancel" }, 61 | {0,0,0} 62 | }; 63 | 64 | 65 | 66 | #ifndef CD_VER 67 | const char *url_desc[]= 68 | { 69 | "http://smallsrv.com/index.htm#new",// "What &new? (Online)" }, 70 | "http://smallsrv.com/news.htm",// "Description (&Online)" }, 71 | // "http://smallsrv.com/desc.htm",// "Description (&Online)" }, 72 | "desc.htm", // 73 | "http://smallsrv.com/donation.shtml", // "&Order regestration (Online)" 74 | }; 75 | #endif 76 | 77 | char fnamebuf[512]; 78 | char hstflt[]="*.*\x00*.*\x00"; 79 | OPENFILENAME ofn={ 80 | sizeof(OPENFILENAME) ,// DWORD lStructSize; 81 | 0,// HWND hwndOwner; 82 | 0,// HINSTANCE hInstance; 83 | hstflt, // lpstrFilter; 84 | 0,// LPTSTR lpstrCustomFilter; 85 | 0,// DWORD nMaxCustFilter; 86 | 0,// DWORD nFilterIndex; 87 | fnamebuf,// LPTSTR lpstrFile; 88 | 256,// DWORD nMaxFile; 89 | 0, // LPTSTR lpstrFileTitle; 90 | 0, // DWORD nMaxFileTitle; 91 | 0, // LPCTSTR lpstrInitialDir; 92 | 0,// LPCTSTR lpstrTitle; 93 | 0, //OFN_PATHMUSTEXIST ,// DWORD Flags; 94 | 0, // WORD nFileOffset; 95 | 0, // WORD nFileExtension; 96 | 0, // LPCTSTR lpstrDefExt; 97 | 0, // DWORD lCustData; 98 | 0, // LPOFNHOOKPROC lpfnHook; 99 | 0 // LPCTSTR lpTemplateName 100 | }; 101 | 102 | BROWSEINFO binf={ 0,0,fnamebuf,"Select",0,0,0,0}; 103 | 104 | HMENU hmnu,hmmnu; 105 | #if ! defined(FREEVER) 106 | HWND dwnd2=0; 107 | #endif 108 | HWND dwndc; 109 | -------------------------------------------------------------------------------- /stat.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/stat.cpp -------------------------------------------------------------------------------- /statusr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/statusr.cpp -------------------------------------------------------------------------------- /stpdta.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //as stpdta.s -o stpdta.o 26 | .data 27 | .globl _fe_ind 28 | .globl _fb_ind 29 | .globl _fb_http 30 | .globl _fe_http 31 | .globl _fb_uttp 32 | .globl _fe_uttp 33 | .globl _fb_lis 34 | .globl _fe_lis 35 | .globl _fb_lang 36 | .globl _fe_lang 37 | .globl _fb_lange 38 | .globl _fe_lange 39 | .globl _fb_s1 40 | .globl _fb_s2 41 | .globl _fb_s3 42 | .globl _fe_s1 43 | .globl _fe_s2 44 | .globl _fe_s3 45 | .globl _fb_vpnc 46 | .globl _fe_vpnc 47 | 48 | /*.globl _fb_ipbase 49 | .globl _fe_ipbase*/ 50 | .globl _fb_lnotes 51 | .globl _fe_lnotes 52 | .align 0 53 | _fb_uttp: 54 | .include "uninst.bin" 55 | _fe_uttp: 56 | _fb_http: 57 | .include "http.bin" 58 | _fe_http: 59 | _fb_ind: 60 | .include "ind1.bin" 61 | _fe_ind: 62 | _fb_ipbase: 63 | /* .include "ipbase.s" */ 64 | _fe_ipbase: 65 | _fb_lange: 66 | .include "eshs_lang.bin" 67 | _fe_lange: 68 | _fb_lang: 69 | .include "shs_lang.bin" 70 | _fe_lang: 71 | _fb_lnotes: 72 | .include "lnotes.bin" 73 | _fe_lnotes: 74 | _fb_lis: 75 | .include "lic.bin" 76 | _fe_lis: 77 | _fb_s1: 78 | .include "vpn_if_up.bin" 79 | _fe_s1: 80 | _fb_s2: 81 | .include "vpn_if_client_up.bin" 82 | _fe_s2: 83 | _fb_s3: 84 | .include "vpn_if_client_down.bin" 85 | _fe_s3: 86 | 87 | _fb_vpnc: 88 | .include "vpnclient.bin" 89 | _fe_vpnc: 90 | 91 | .globl _fb_sert 92 | .globl _fe_sert 93 | 94 | _fb_sert: 95 | .include "temp_sert.bin" 96 | _fe_sert: 97 | 98 | .globl _fb_s4 99 | .globl _fe_s4 100 | _fb_s4: 101 | .include "manifest.bin" 102 | _fe_s4: 103 | 104 | .long 0 105 | //.space 1024,0 106 | 107 | 108 | -------------------------------------------------------------------------------- /stpdta_vpn.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //as stpdta.s -o stpdta.o 26 | .data 27 | .globl _fe_ind 28 | .globl _fb_ind 29 | .globl _fb_uttp 30 | .globl _fe_uttp 31 | .globl _fb_lis 32 | .globl _fe_lis 33 | .globl _fb_lang 34 | .globl _fe_lang 35 | .globl _fb_lange 36 | .globl _fe_lange 37 | .globl _fb_s1 38 | .globl _fb_s2 39 | .globl _fb_s3 40 | .globl _fe_s1 41 | .globl _fe_s2 42 | .globl _fe_s3 43 | .globl _fb_vpnc 44 | .globl _fe_vpnc 45 | 46 | /*.globl _fb_ipbase 47 | .globl _fe_ipbase*/ 48 | .globl _fb_lnotes 49 | .globl _fe_lnotes 50 | .align 0 51 | _fb_uttp: 52 | .include "uninst.bin" 53 | _fe_uttp: 54 | _fb_ind: 55 | .include "ind1.bin" 56 | _fe_ind: 57 | _fb_ipbase: 58 | /* .include "ipbase.s" */ 59 | _fe_ipbase: 60 | _fb_lange: 61 | .include "eshs_lang.bin" 62 | _fe_lange: 63 | _fb_lang: 64 | .include "shs_lang.bin" 65 | _fe_lang: 66 | _fb_lnotes: 67 | .include "lnotes.bin" 68 | _fe_lnotes: 69 | _fb_lis: 70 | .include "lic.bin" 71 | _fe_lis: 72 | _fb_s2: 73 | .include "vpn_if_client_up.bin" 74 | _fe_s2: 75 | _fb_s3: 76 | .include "vpn_if_client_down.bin" 77 | _fe_s3: 78 | 79 | _fb_vpnc: 80 | .include "vpnclient.bin" 81 | _fe_vpnc: 82 | 83 | .globl _fb_sert 84 | .globl _fe_sert 85 | 86 | _fb_sert: 87 | .include "temp_sert.bin" 88 | _fe_sert: 89 | 90 | .globl _fb_s4 91 | .globl _fe_s4 92 | _fb_s4: 93 | .include "manifest.bin" 94 | _fe_s4: 95 | 96 | .long 0 97 | //.space 1024,0 98 | 99 | 100 | -------------------------------------------------------------------------------- /stpdtai.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //as stpdta.s -o stpdta.o 26 | .data 27 | .globl _fe_ind 28 | .globl _fb_ind 29 | .globl _fb_http 30 | .globl _fe_http 31 | .globl _fb_uttp 32 | .globl _fe_uttp 33 | .globl _fb_lis 34 | .globl _fe_lis 35 | .globl _fb_lang 36 | .globl _fe_lang 37 | .globl _fb_lange 38 | .globl _fe_lange 39 | .globl _fb_ipbase 40 | .globl _fe_ipbase 41 | .globl _fb_lnotes 42 | .globl _fe_lnotes 43 | .globl _fb_s1 44 | .globl _fb_s2 45 | .globl _fb_s3 46 | .globl _fe_s1 47 | .globl _fe_s2 48 | .globl _fe_s3 49 | .globl _fb_vpnc 50 | .globl _fe_vpnc 51 | 52 | .align 0 53 | 54 | _fb_uttp: 55 | .include "uninst.bin" 56 | _fe_uttp: 57 | _fb_http: 58 | .include "http.bin" 59 | _fe_http: 60 | _fb_ind: 61 | .include "ind1.bin" 62 | _fe_ind: 63 | _fb_ipbase: 64 | .include "ipbase.s" 65 | _fe_ipbase: 66 | _fb_lange: 67 | .include "eshs_lang.bin" 68 | _fe_lange: 69 | _fb_lang: 70 | .include "shs_lang.bin" 71 | _fe_lang: 72 | _fb_lnotes: 73 | .include "lnotes.bin" 74 | _fe_lnotes: 75 | _fb_lis: 76 | .include "lic.bin" 77 | _fe_lis: 78 | _fb_s1: 79 | .include "vpn_if_up.bin" 80 | _fe_s1: 81 | _fb_s2: 82 | .include "vpn_if_client_up.bin" 83 | _fe_s2: 84 | _fb_s3: 85 | .include "vpn_if_client_down.bin" 86 | _fe_s3: 87 | 88 | _fb_vpnc: 89 | .include "vpnclient.bin" 90 | _fe_vpnc: 91 | 92 | .globl _fb_sert 93 | .globl _fe_sert 94 | 95 | _fb_sert: 96 | .include "temp_sert.bin" 97 | _fe_sert: 98 | 99 | .globl _fb_s4 100 | .globl _fe_s4 101 | _fb_s4: 102 | .include "manifest.bin" 103 | _fe_s4: 104 | 105 | 106 | .long 0 107 | //.space 1024,0 108 | 109 | 110 | -------------------------------------------------------------------------------- /stpdtamg.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //as stpdta.s -o stpdta.o 26 | .data 27 | .globl _fe_ind 28 | .globl _fb_ind 29 | .globl _fb_http 30 | .globl _fe_http 31 | .globl _fb_uttp 32 | .globl _fe_uttp 33 | .globl _fb_lis 34 | .globl _fe_lis 35 | .globl _fb_lang 36 | .globl _fe_lang 37 | .globl _fb_lange 38 | .globl _fe_lange 39 | .globl _fb_lnotes 40 | .globl _fe_lnotes 41 | .globl _fb_s1 42 | .globl _fb_s2 43 | .globl _fb_s3 44 | .globl _fe_s1 45 | .globl _fe_s2 46 | .globl _fe_s3 47 | .globl _fb_vpnc 48 | .globl _fe_vpnc 49 | 50 | 51 | .align 0 52 | 53 | _fb_uttp: 54 | .include "uninst.bin" 55 | _fe_uttp: 56 | _fb_http: 57 | .include "http.bin" 58 | _fe_http: 59 | _fb_ind: 60 | .include "ind1.bin" 61 | _fe_ind: 62 | _fb_lange: 63 | .include "eshs_lang.bin" 64 | _fe_lange: 65 | _fb_lang: 66 | .include "shs_lang.bin" 67 | _fe_lang: 68 | _fb_lnotes: 69 | .include "lnotes.bin" 70 | _fe_lnotes: 71 | _fb_lis: 72 | .include "lic.bin" 73 | _fe_lis: 74 | _fb_s1: 75 | .include "vpn_if_up.bin" 76 | _fe_s1: 77 | _fb_s2: 78 | .include "vpn_if_client_up.bin" 79 | _fe_s2: 80 | _fb_s3: 81 | .include "vpn_if_client_down.bin" 82 | _fe_s3: 83 | 84 | _fb_vpnc: 85 | .include "vpnclient.bin" 86 | _fe_vpnc: 87 | 88 | .globl _fb_sert 89 | .globl _fe_sert 90 | 91 | _fb_sert: 92 | .include "temp_sert.bin" 93 | _fe_sert: 94 | 95 | .globl _fb_s4 96 | .globl _fe_s4 97 | _fb_s4: 98 | .include "manifest.bin" 99 | _fe_s4: 100 | 101 | 102 | .long 0 103 | //.space 1024,0 104 | 105 | 106 | -------------------------------------------------------------------------------- /stpdtar.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //as stpdta.s -o stpdta.o 26 | .data 27 | .globl _fe_ind 28 | .globl _fb_ind 29 | .globl _fb_http 30 | .globl _fe_http 31 | .globl _fb_lis 32 | .globl _fe_lis 33 | .globl _fb_uttp 34 | .globl _fe_uttp 35 | .globl _fb_lang 36 | .globl _fe_lang 37 | .globl _fb_lange 38 | .globl _fe_lange 39 | .globl _fb_lnotes 40 | .globl _fe_lnotes 41 | .globl _fb_s1 42 | .globl _fb_s2 43 | .globl _fb_s3 44 | .globl _fe_s1 45 | .globl _fe_s2 46 | .globl _fe_s3 47 | .globl _fb_vpnc 48 | .globl _fe_vpnc 49 | 50 | .align 0 51 | 52 | /*.globl _fb_ipbase 53 | .globl _fe_ipbase*/ 54 | _fb_uttp: 55 | .include "uninst.bin" 56 | _fe_uttp: 57 | _fb_http: 58 | .include "http.bin" 59 | _fe_http: 60 | _fb_ind: 61 | .include "ind1r.bin" 62 | _fe_ind: 63 | _fb_ipbase: 64 | /* .include "ipbase.s" */ 65 | _fe_ipbase: 66 | _fb_lang: 67 | .include "shs_lang.bin" 68 | _fe_lang: 69 | _fb_lange: 70 | .include "eshs_lang.bin" 71 | _fe_lange: 72 | _fb_lnotes: 73 | .include "lnotes.bin" 74 | _fe_lnotes: 75 | _fb_lis: 76 | .include "licr.bin" 77 | _fe_lis: 78 | _fb_s1: 79 | .include "vpn_if_up.bin" 80 | _fe_s1: 81 | _fb_s2: 82 | .include "vpn_if_client_up.bin" 83 | _fe_s2: 84 | _fb_s3: 85 | .include "vpn_if_client_down.bin" 86 | _fe_s3: 87 | 88 | _fb_vpnc: 89 | .include "vpnclient.bin" 90 | _fe_vpnc: 91 | 92 | .globl _fb_sert 93 | .globl _fe_sert 94 | 95 | _fb_sert: 96 | .include "temp_sert.bin" 97 | _fe_sert: 98 | 99 | .globl _fb_s4 100 | .globl _fe_s4 101 | _fb_s4: 102 | .include "manifest.bin" 103 | _fe_s4: 104 | 105 | .long 0 106 | //.space 1024,0 107 | 108 | 109 | -------------------------------------------------------------------------------- /stpdtari.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //as stpdta.s -o stpdta.o 26 | .data 27 | .globl _fe_ind 28 | .globl _fb_ind 29 | .globl _fb_http 30 | .globl _fe_http 31 | .globl _fb_lis 32 | .globl _fe_lis 33 | .globl _fb_uttp 34 | .globl _fe_uttp 35 | .globl _fb_lang 36 | .globl _fe_lang 37 | .globl _fb_lange 38 | .globl _fe_lange 39 | .globl _fb_lnotes 40 | .globl _fe_lnotes 41 | .globl _fb_ipbase 42 | .globl _fe_ipbase 43 | .globl _fb_s1 44 | .globl _fb_s2 45 | .globl _fb_s3 46 | .globl _fe_s1 47 | .globl _fe_s2 48 | .globl _fe_s3 49 | .globl _fb_vpnc 50 | .globl _fe_vpnc 51 | 52 | .align 0 53 | 54 | _fb_uttp: 55 | .include "uninst.bin" 56 | _fe_uttp: 57 | _fb_http: 58 | .include "http.bin" 59 | _fe_http: 60 | _fb_ind: 61 | .include "ind1r.bin" 62 | _fe_ind: 63 | _fb_ipbase: 64 | .include "ipbase.s" 65 | _fe_ipbase: 66 | _fb_lang: 67 | .include "shs_lang.bin" 68 | _fe_lang: 69 | _fb_lange: 70 | .include "eshs_lang.bin" 71 | _fe_lange: 72 | _fb_lnotes: 73 | .include "lnotes.bin" 74 | _fe_lnotes: 75 | _fb_lis: 76 | .include "licr.bin" 77 | _fe_lis: 78 | _fb_s1: 79 | .include "vpn_if_up.bin" 80 | _fe_s1: 81 | _fb_s2: 82 | .include "vpn_if_client_up.bin" 83 | _fe_s2: 84 | _fb_s3: 85 | .include "vpn_if_client_down.bin" 86 | _fe_s3: 87 | 88 | _fb_vpnc: 89 | .include "vpnclient.bin" 90 | _fe_vpnc: 91 | 92 | .globl _fb_sert 93 | .globl _fe_sert 94 | 95 | _fb_sert: 96 | .include "temp_sert.bin" 97 | _fe_sert: 98 | 99 | .globl _fb_s4 100 | .globl _fe_s4 101 | _fb_s4: 102 | .include "manifest.bin" 103 | _fe_s4: 104 | 105 | .long 0 106 | //.space 1024,0 107 | 108 | 109 | -------------------------------------------------------------------------------- /strcwmr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/strcwmr.h -------------------------------------------------------------------------------- /strtoul.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #include "mdef.h" 27 | 28 | extern "C" { 29 | 30 | ulong strtoul(const char *a, char **e, int base) 31 | { 32 | register uint r=0,l; 33 | do{ 34 | if(*a>'9' && *a<'A')break; 35 | if((l=*a-'0')>9) 36 | if((l-='A'-10-'0')>base) 37 | if((l-='a'-'A')<10 ) break; 38 | if(l>=(uint)base)break; 39 | r=r*base+l;a++; 40 | }while(1); 41 | if(e)*e=(char *)a; 42 | return r; 43 | 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /strvar.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #ifndef SRV_H 27 | //#include 28 | #include "srv.h" 29 | #endif 30 | 31 | char * StrVar(char *p,char *n) 32 | {char bf[128]; 33 | int l,i; 34 | l=sprintf(bf,"%.98s:",n); 35 | for(n=p; (n=stristr(n,bf) ); ) 36 | {i= (n==p || n[-1]=='\n'); 37 | n+=l; 38 | while(*n==' ')++n; 39 | if(i)break; 40 | } 41 | return n; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /t3_g4strc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/t3_g4strc.h -------------------------------------------------------------------------------- /tlsdll.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | extern "C" { 27 | struct OpenSSLConnection 28 | {int state; 29 | #define ST_CONNECTION_CLOSED 0x80 30 | void *CallbackParam; 31 | void *con; 32 | void *io,*ssl_bio,*sbio; 33 | }; 34 | 35 | typedef int (* TFprintf)(char *param,...); 36 | typedef int (* TFtransfer)(void *param,void *bfr,int l); 37 | 38 | 39 | int InitLib( TFprintf prnt,TFtransfer fsend,TFtransfer frecv,char *CApath,char *CAfile, 40 | char * s_cert_file, 41 | char * s_key_file 42 | // ,char * s_dcert_file, 43 | // char * s_dkey_file 44 | // ,int s_server_verify 45 | ); 46 | 47 | #ifdef TLSWODLL 48 | int InitLib( TFprintf prnt,TFtransfer fsend,TFtransfer frecv, 49 | char *CApath,char *CAfile, 50 | char * s_cert_file,char * s_key_file); 51 | int SecAccept(OpenSSLConnection *s); 52 | int SecRecv (OpenSSLConnection *s,char *b,int l); 53 | int SecSend (OpenSSLConnection *s,char *b,int l); 54 | int SecClose (OpenSSLConnection *s); 55 | int SecConnect(OpenSSLConnection *s, int anon, char *verfyhost); 56 | int SecUpdateCB(OpenSSLConnection *s); 57 | void SetPriority(char *t); 58 | #else 59 | 60 | extern int (*PInitLib)( TFprintf prnt,TFtransfer fsend,TFtransfer frecv, 61 | char *CApath,char *CAfile, char * s_cert_file,char * s_key_file); 62 | extern int (*PSecAccept)(OpenSSLConnection *s); 63 | extern int (*PSecConnect)(OpenSSLConnection *s, int anon, char *verfyhost); 64 | extern int (*PSecRecv )(OpenSSLConnection *s,char *b,int l); 65 | extern int (*PSecSend )(OpenSSLConnection *s,char *b,int l); 66 | extern int (*PSecClose )(OpenSSLConnection *s); 67 | extern int (*PSecUpdateCB )(OpenSSLConnection *s); 68 | 69 | typedef int (*TSecAccept)(OpenSSLConnection *s); 70 | typedef int (*TSecConnect)(OpenSSLConnection *s, int anon, char *verfyhost); 71 | typedef int (*TSecRecv )(OpenSSLConnection *s,char *b,int l); 72 | typedef int (*TSecSend )(OpenSSLConnection *s,char *b,int l); 73 | typedef int (*TSecClose )(OpenSSLConnection *s); 74 | typedef int (*TSecUpdateCB)(OpenSSLConnection *s); 75 | typedef int (*TSetPriority )(char *s); 76 | typedef int (*TInitLib )( TFprintf prnt,TFtransfer fsend,TFtransfer frecv, 77 | char *CApath,char *CAfile, char * s_cert_file,char * s_key_file); 78 | 79 | 80 | #define SecAccept (PSecAccept) 81 | #define SecConnect (PSecConnect) 82 | #define SecRecv (PSecRecv ) 83 | #define SecSend (PSecSend ) 84 | #define SecClose (PSecClose ) 85 | #define SecUpdateCB (PSecUpdateCB ) 86 | #define InitLib (PInitLib ) 87 | 88 | #endif 89 | 90 | 91 | } 92 | 93 | 94 | -------------------------------------------------------------------------------- /uninst.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | 26 | #ifdef DJGPP 27 | typedef void * HKEY; 28 | #else 29 | 30 | #pragma GCC diagnostic ignored "-Wformat" 31 | #pragma GCC diagnostic ignored "-Wcomment" 32 | #pragma GCC diagnostic ignored "-Wwrite-strings" 33 | #pragma GCC diagnostic ignored "-Wformat-security" 34 | #pragma GCC diagnostic ignored "-Wformat-extra-args" 35 | #pragma GCC diagnostic ignored "-Wunused-result" 36 | #pragma GCC diagnostic ignored "-Wwrite-strings" 37 | #pragma GCC diagnostic ignored "-Wnarrowing" 38 | #pragma GCC diagnostic ignored "-Wliteral-suffix" 39 | 40 | #endif 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #include "mdef.h" 48 | //#include "mstring.h" 49 | 50 | #define sprintf wsprintf 51 | #define APPNAME "Small HTTP server" 52 | #define APPMENU "Small HTTP server" 53 | 54 | char *files[]= 55 | { 56 | "desc.htm", 57 | "license.txt", 58 | "http.cfg", 59 | "http.exe", 60 | "lang_notes.txt", 61 | "vpn_if_up.bat", 62 | "vpn_if_client_up.bat", 63 | "vpn_if_client_down.bat", 64 | "http.exe.manifest", 65 | "vpnclient.exe", 66 | "vpnclient.exe.manifest", 67 | "temp_sert.pem", 68 | "shs_lang.cfg", 69 | "ipbase.bin", 70 | "langpacks\\ru\\shs_lang.cfg", 71 | "langpacks\\en\\shs_lang.cfg", 72 | 0 73 | }; 74 | 75 | char *dirs[]= 76 | { 77 | "langpacks\\ru", 78 | "langpacks\\en", 79 | "langpacks" 80 | }; 81 | struct DTT 82 | { 83 | ulong sifn[2]; 84 | char dir[512]; 85 | }dtt= 86 | {0x4D4D4D4D,0x46464646}; 87 | 88 | #ifdef SERVICE 89 | #include 90 | SC_HANDLE sch; 91 | HANDLE hs; 92 | QUERY_SERVICE_CONFIG Service; 93 | #endif 94 | HKEY startup=0; 95 | 96 | 97 | #ifdef MINGW 98 | extern "C" { 99 | //int WINAPI WinMain( HINSTANCE hinst, HANDLE prev_inst, LPSTR cmline, int cmdshow ); 100 | void start() 101 | { 102 | 103 | ExitProcess(WinMain(GetModuleHandle(NULL) ,// hinstanse, 104 | 0, 105 | GetCommandLine() //cmdline 106 | ,0)); 107 | } 108 | 109 | }; 110 | 111 | 112 | 113 | #endif 114 | 115 | extern "C" { 116 | 117 | #ifdef MINGW 118 | #define TYPE_SC_HANDLE (SC_HANDLE__*) 119 | int WINAPI WinMain(HINSTANCE__*hinst, HINSTANCE__*prev_inst, CHAR*cmdline, int cmdshow) 120 | #else 121 | #define TYPE_SC_HANDLE 122 | int WINAPI WinMain( HANDLE hinst, HANDLE prev_inst, LPSTR cmdline, int cmdshow ) 123 | #endif 124 | { 125 | char uninst[1024]; 126 | char bfr[1024]; 127 | int i,nt; 128 | _ITEMIDLIST *x; 129 | HANDLE h; 130 | union{ 131 | WIN32_FIND_DATA fd; 132 | SERVICE_STATUS SerStat; 133 | }; 134 | 135 | 136 | if(MessageBox(0,"Do you want to remove " APPNAME "?","Are you sure?", MB_YESNO )==IDYES ) 137 | { 138 | 139 | #ifdef SERVICE 140 | if(!(nt=GetVersion() & 0x80000000)) 141 | if((sch=OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS))) 142 | {if((hs=OpenService(sch,"shttps",SERVICE_ALL_ACCESS))) 143 | { ControlService(TYPE_SC_HANDLE hs,SERVICE_CONTROL_STOP,&SerStat); 144 | DeleteService(TYPE_SC_HANDLE hs); 145 | } 146 | } 147 | else MessageBox(0,"Can't open SCM","Error",MB_OK); 148 | #endif 149 | 150 | RegOpenKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",&startup); 151 | if(startup) 152 | {RegDeleteValue(startup,"http.exe"); 153 | RegCloseKey(startup); 154 | } 155 | 156 | for(i=0;files[i];++i) 157 | {sprintf(bfr,"%s%s",dtt.dir,files[i]); 158 | DeleteFile(bfr); 159 | } 160 | 161 | for(i=0; dirs[i]; ++i) 162 | { 163 | sprintf(bfr,"%s%s",dtt.dir, dirs[i]); 164 | RemoveDirectory(bfr); 165 | } 166 | 167 | i=CSIDL_PROGRAMS; 168 | lbNT: 169 | if((!SHGetSpecialFolderLocation(0,i,&x)) && (SHGetPathFromIDList(x,bfr), 170 | sprintf(uninst,"%s\\" APPMENU "\\*.*",bfr), 171 | ( (h=FindFirstFile(uninst,&fd) ) != INVALID_HANDLE_VALUE) 172 | ) 173 | ) 174 | { 175 | // MessageBox(0,uninst,bfr,MB_OK); 176 | do{ 177 | if(fd.cFileName[0]!='.') 178 | {sprintf(uninst,"%s\\" APPMENU "\\%s",bfr,fd.cFileName); 179 | // MessageBox(0,uninst,bfr,MB_OK); 180 | DeleteFile(uninst); 181 | } 182 | }while( FindNextFile(h,&fd) ); 183 | FindClose(h); 184 | sprintf(uninst,"%s\\" APPMENU ,bfr); 185 | RemoveDirectory(uninst); 186 | } 187 | else if(i!=CSIDL_COMMON_PROGRAMS){i=CSIDL_COMMON_PROGRAMS; goto lbNT;} 188 | }; 189 | return 0; 190 | } 191 | 192 | } 193 | 194 | -------------------------------------------------------------------------------- /updr.rc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | //wrc /bt=nt /r updr.rc 25 | //#include 26 | 27 | 502 ICON "xx31.ico" 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /vpnclient.cfg: -------------------------------------------------------------------------------- 1 | 2 | # General setting 3 | detail 4 | 5 | # TLS/SSL server 6 | tls_lib="/usr/local/lib/smallsrv/libsecgnutls.so" 7 | tls_cert_file="my.cer" 8 | tls_key_file="my.key" 9 | tls_cafile= 10 | tls_priority="NORMAL:+ANON-DH:+VERS-TLS1.2:-VERS-TLS1.3" 11 | 12 | # HTTP TLS VPN Client 13 | vpnclient 14 | vpn_remote_host="your_vpn_host.com" 15 | vpn_client_port=443 16 | vpn_client_url="/$_vpn_$" 17 | vpn_remote_user="username" 18 | vpn_remote_passw="password" 19 | vpncln_tap 20 | vpn_tuntap_number=1 21 | vpn_client_mtu=9000 22 | tuntap_ip="192.168.10.2" 23 | tuntap_nmask="255.255.255.0" 24 | vpncln_script_up="/etc/smallsrv/vpn_if_up.sh" 25 | vpncln_chktls 26 | vpncln_tlssshstyle 27 | 28 | -------------------------------------------------------------------------------- /wgnuext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1999-2020 Maksim Feoktistov. 3 | * 4 | * This file is part of Small HTTP server project. 5 | * Author: Maksim Feoktistov 6 | * 7 | * 8 | * Small HTTP server is free software: you can redistribute it and/or modify it 9 | * under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License. 11 | * 12 | * Small HTTP server is distributed in the hope that it will be useful, but 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see https://www.gnu.org/licenses/ 19 | * 20 | * Contact addresses for Email: support@smallsrv.com 21 | * 22 | * 23 | */ 24 | 25 | //gcc -c -S -O2 -fpack-struct wgnuext.cpp 26 | 27 | struct ExtBlock 28 | { 29 | int Sign; 30 | void *beg; 31 | void *end; 32 | }; 33 | 34 | 35 | struct SEHRec 36 | { 37 | void *r1; 38 | void *esp; 39 | void *r2; 40 | void *ecept_list; 41 | void *handler; 42 | void *b; 43 | int Sign; 44 | 45 | inline void BegTry(void *hndlr); 46 | inline void EndTry(); 47 | }; 48 | 49 | 50 | int pSign=-1; 51 | inline void SEHRec::BegTry(void *hndlr) 52 | { 53 | int t; 54 | asm volatile(" movl %%esp,(%%eax)\n" 55 | // movl %%esp,8(%%eax) 56 | " addl $8,%%eax\n" 57 | " movl %%fs:0,%%ecx\n" 58 | " movl %%ecx,(%%eax)\n" 59 | " movl %%eax,%%fs:0\n" 60 | :"=&a" (t) 61 | :"0" (&esp) 62 | ://"%eax", 63 | "%ecx" 64 | ); 65 | ecept_list=0; 66 | handler=hndlr; 67 | b=&pSign; 68 | Sign=0; 69 | }; 70 | 71 | inline void SEHRec::EndTry() 72 | {Sign=-1; 73 | asm volatile(" movl %%eax,%%fs:0 \n" 74 | :"=&a" (ecept_list) 75 | :"0" (ecept_list) 76 | // :"%eax" 77 | ); 78 | 79 | } 80 | 81 | #pragma GCC diagnostic ignored "-Wreturn-type" 82 | 83 | inline int except() 84 | { 85 | asm volatile( 86 | // movl 4(%%esp),%%eax\n" 87 | " movl 8(%%esp),%%ecx\n" 88 | " leal 0x10(%%ecx),%%ebp\n" 89 | : 90 | : 91 | :"%ecx"); 92 | }; 93 | 94 | #if 0 95 | int TstPrg(char *a, int b) 96 | { 97 | SEHRec stry; 98 | 99 | while(*a++) 100 | { 101 | stry.BegTry( &&lbErr); 102 | 103 | if(!b)break; 104 | --b; 105 | } 106 | lbErr: 107 | return b; 108 | }; 109 | 110 | #endif 111 | 112 | -------------------------------------------------------------------------------- /winclude/nethdr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * This file is part of Small HTTP server project. 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License version 2 7 | * as published by the Free Software Foundation. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program (see the file COPYING included with this 16 | * distribution); if not, write to the Free Software Foundation, Inc., 17 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | #ifndef NETHDR_H 20 | #define NETHDR_H 21 | 22 | #include 23 | 24 | #ifndef PACKED 25 | #define PACKED __attribute__((packed)) 26 | #endif 27 | 28 | 29 | #define ETHER_ADDR_LEN 6 30 | 31 | struct ether_header { 32 | u_int8_t ether_dhost[ETHER_ADDR_LEN]; 33 | u_int8_t ether_shost[ETHER_ADDR_LEN]; 34 | u_int16_t ether_type; 35 | } PACKED; 36 | 37 | #define ETHERTYPE_IP 0x0800 38 | #define ETHERTYPE_ARP 0x0806 39 | #define ETHERTYPE_RARP 0x8035 40 | #define ETHERTYPE_8021Q_TAG 0x8100 41 | #define ETHERTYPE_IPV6 0x86DD 42 | #define ETHERTYPE_FLOW_CONTROL 0x8808 43 | 44 | 45 | /* File for little endian, windows */ 46 | struct iphdr { 47 | u_int8_t ihl:4, 48 | version:4; 49 | u_int8_t tos; 50 | u_int16_t tot_len; 51 | u_int16_t id; 52 | u_int16_t frag_off; 53 | u_int8_t ttl; 54 | u_int8_t protocol; 55 | u_int16_t check; 56 | u_int32_t saddr; 57 | u_int32_t daddr; 58 | /*The options start here. */ 59 | } PACKED; 60 | 61 | 62 | struct ip6_hdr 63 | { 64 | union 65 | { 66 | struct ip6_hdrctl 67 | { 68 | u_int32_t ip6_un1_flow; /* 4 bits version, 8 bits TC, 69 | 20 bits flow-ID */ 70 | u_int16_t ip6_un1_plen; /* payload length */ 71 | u_int8_t ip6_un1_nxt; /* next header */ 72 | u_int8_t ip6_un1_hlim; /* hop limit */ 73 | } ip6_un1; 74 | u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits tclass */ 75 | } ip6_ctlun; 76 | struct in6_addr ip6_src; /* source address */ 77 | struct in6_addr ip6_dst; /* destination address */ 78 | } PACKED; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /winclude/tap-windows.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TAP-Windows -- A kernel driver to provide virtual tap 3 | * device functionality on Windows. 4 | * 5 | * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson. 6 | * 7 | * This source code is Copyright (C) 2002-2014 OpenVPN Technologies, Inc., 8 | * and is released under the GPL version 2 (see below). This particular file 9 | * (tap-windows.h) is also licensed using the MIT license (see COPYRIGHT.MIT). 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License version 2 13 | * as published by the Free Software Foundation. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program (see the file COPYING included with this 22 | * distribution); if not, write to the Free Software Foundation, Inc., 23 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | */ 25 | #ifndef __TAP_WIN_H 26 | #define __TAP_WIN_H 27 | 28 | /* 29 | * ============= 30 | * TAP IOCTLs 31 | * ============= 32 | */ 33 | 34 | #define TAP_WIN_CONTROL_CODE(request,method) \ 35 | CTL_CODE (FILE_DEVICE_UNKNOWN, request, method, FILE_ANY_ACCESS) 36 | 37 | /* Present in 8.1 */ 38 | 39 | #define TAP_WIN_IOCTL_GET_MAC TAP_WIN_CONTROL_CODE (1, METHOD_BUFFERED) 40 | #define TAP_WIN_IOCTL_GET_VERSION TAP_WIN_CONTROL_CODE (2, METHOD_BUFFERED) 41 | #define TAP_WIN_IOCTL_GET_MTU TAP_WIN_CONTROL_CODE (3, METHOD_BUFFERED) 42 | #define TAP_WIN_IOCTL_GET_INFO TAP_WIN_CONTROL_CODE (4, METHOD_BUFFERED) 43 | #define TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT TAP_WIN_CONTROL_CODE (5, METHOD_BUFFERED) 44 | #define TAP_WIN_IOCTL_SET_MEDIA_STATUS TAP_WIN_CONTROL_CODE (6, METHOD_BUFFERED) 45 | #define TAP_WIN_IOCTL_CONFIG_DHCP_MASQ TAP_WIN_CONTROL_CODE (7, METHOD_BUFFERED) 46 | #define TAP_WIN_IOCTL_GET_LOG_LINE TAP_WIN_CONTROL_CODE (8, METHOD_BUFFERED) 47 | #define TAP_WIN_IOCTL_CONFIG_DHCP_SET_OPT TAP_WIN_CONTROL_CODE (9, METHOD_BUFFERED) 48 | 49 | /* Added in 8.2 */ 50 | 51 | /* obsoletes TAP_WIN_IOCTL_CONFIG_POINT_TO_POINT */ 52 | #define TAP_WIN_IOCTL_CONFIG_TUN TAP_WIN_CONTROL_CODE (10, METHOD_BUFFERED) 53 | 54 | /* Control whether 802.1Q headers are added for priority */ 55 | #define TAP_WIN_IOCTL_PRIORITY_BEHAVIOR TAP_WIN_CONTROL_CODE (11, METHOD_BUFFERED) 56 | #define TAP_PRIORITY_BEHAVIOR_NOPRIORITY 0 57 | #define TAP_PRIORITY_BEHAVIOR_ENABLED 1 58 | #define TAP_PRIORITY_BEHAVIOR_ADDALWAYS 2 59 | #define TAP_PRIORITY_BEHAVIOR_MAX 2 60 | 61 | /* 62 | * ================= 63 | * Registry keys 64 | * ================= 65 | */ 66 | 67 | #define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}" 68 | 69 | #define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}" 70 | 71 | /* 72 | * ====================== 73 | * Filesystem prefixes 74 | * ====================== 75 | */ 76 | 77 | #define USERMODEDEVICEDIR "\\\\.\\Global\\" 78 | #define SYSDEVICEDIR "\\Device\\" 79 | #define USERDEVICEDIR "\\DosDevices\\Global\\" 80 | #define TAP_WIN_SUFFIX ".tap" 81 | 82 | #endif // __TAP_WIN_H 83 | -------------------------------------------------------------------------------- /wmbx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/wmbx.cpp -------------------------------------------------------------------------------- /wndcfg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/wndcfg.cpp -------------------------------------------------------------------------------- /xx31.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MaxFeoktistov/smallsrv/d5290e5bf77223606249d2f3e7389d7a955e9206/xx31.ico -------------------------------------------------------------------------------- /ya: -------------------------------------------------------------------------------- 1 | -fpack-struct 2 | -m486 3 | -s 4 | -O2 5 | -malign-loops=0 6 | -malign-jumps=0 7 | -malign-functions=0 8 | -fno-verbose-asm 9 | -fno-implicit-templates 10 | -mno-svr3-shlib 11 | -mno-align-double 12 | -mno-fancy-math-387 13 | -static 14 | -fsjlj-exceptions 15 | -Zpe 16 | -ID:\DJGPP\INCLUDE\WIN32 17 | -Xlinker -Map -Xlinker flxmap 18 | -nostartfiles 19 | -nodefaultlibs 20 | -fconserve-space -DONEFILE -DSERVICE -DFREE_VER -DV_FULL=1 -DUSE_IPV6 21 | -mrtd 22 | ndp.o upl.o srv0a.o 23 | -luser -lkern -lsock -lgdi -lshell -lcdlg -lwadv 24 | 25 | -------------------------------------------------------------------------------- /yc: -------------------------------------------------------------------------------- 1 | -c 2 | -fpack-struct 3 | -m486 4 | -s 5 | -O2 6 | -malign-loops=0 7 | -malign-jumps=0 8 | -malign-functions=0 9 | -fno-verbose-asm 10 | -fno-implicit-templates 11 | -mno-svr3-shlib 12 | -mno-align-double 13 | -mno-fancy-math-387 14 | -static 15 | -fsjlj-exceptions 16 | -Zpe 17 | -ID:\DJGPP\INCLUDE\WIN32 18 | -fconserve-space -DONEFILE -DSERVICE -DFREE_VER -DFREEVER -DV_FULL=1 -DUSE_IPV6 -DSEPLOG -DSELECT1 19 | -mrtd 20 | srv0a.cpp 21 | 22 | --------------------------------------------------------------------------------
Remote 50 | IPPortTime (ms)in/out (bytes)info 54 |