Documentation Source Text
Check-in [8d5d89e6db]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:8d5d89e6db164590482827b0677e366d07bddbb2
Date: 2012-11-10 12:38:19
User: drh
Comment:Change the way that user-agent restrictions are handled in althttpd.c.
Tags And Properties
Changes
hide diffs unified diffs patch

Changes to misc/althttpd.c

157 static void FixupUserAgent(void){ 157 static void FixupUserAgent(void){ 158 int i; 158 int i; 159 if( zAgent==0 || zAgent[0]==0 ) zAgent = "*"; 159 if( zAgent==0 || zAgent[0]==0 ) zAgent = "*"; 160 for(i=0; zAgent[i]; i++){ 160 for(i=0; zAgent[i]; i++){ 161 int c = zAgent[i]; 161 int c = zAgent[i]; 162 if( c<'!' || c>'~' ){ zAgent[i] = '_'; } 162 if( c<'!' || c>'~' ){ zAgent[i] = '_'; } 163 } 163 } 164 #if 0 < 165 if( strncmp(zAgent,"msnbot",6)==0 ){ < 166 exit(0); < 167 } < 168 #endif < 169 for(i=0; zAgent[i]; i++){ < 170 if( zAgent[i]=='W' && strncmp(&zAgent[i],"Windows_9",9)==0 ){ < 171 exit(0); < 172 } < 173 if( zAgent[i]=='D' && strncmp(&zAgent[i],"Download_Master",15)==0 ){ < 174 exit(0); < 175 } < 176 } < 177 } 164 } 178 165 179 /* 166 /* 180 ** Make an entry in the log file. If the HTTP connection should be 167 ** Make an entry in the log file. If the HTTP connection should be 181 ** closed, then terminate this process. Otherwise return. 168 ** closed, then terminate this process. Otherwise return. 182 */ 169 */ 183 static void MakeLogEntry(int a){ 170 static void MakeLogEntry(int a){ ................................................................................................................................................................................ 977 zServerPort = StrDup(zRealPort); 964 zServerPort = StrDup(zRealPort); 978 } 965 } 979 }else if( strcasecmp(zFieldName,"Authorization:")==0 ){ 966 }else if( strcasecmp(zFieldName,"Authorization:")==0 ){ 980 zAuthType = GetFirstElement(StrDup(zVal), &zAuthArg); 967 zAuthType = GetFirstElement(StrDup(zVal), &zAuthArg); 981 } 968 } 982 } 969 } 983 970 984 /* Disallow referring from certain servers */ | 971 /* Disallow referring from certain clients */ > 972 if( zAgent ){ > 973 if( strstr(zAgent, "Windows_9")!=0 > 974 || strstr(zAgent, "Download_Master")!=0 > 975 ){ > 976 strcpy(zReplyStatus, "997"); > 977 closeConnection = 1; > 978 MakeLogEntry(0); > 979 } > 980 } 985 #if 0 981 #if 0 986 if( zReferer ){ 982 if( zReferer ){ 987 static const char *azDisallow[] = { 983 static const char *azDisallow[] = { 988 "skidrowcrack.com", 984 "skidrowcrack.com", 989 "hoshiyuugi.tistory.com", 985 "hoshiyuugi.tistory.com", 990 "skidrowgames.net", 986 "skidrowgames.net", 991 }; 987 };