Changeset 7735
- Timestamp:
- 03/21/07 19:35:12 (22 months ago)
- Location:
- trunk/src/dot
- Files:
-
- 13 modified
-
Makefile (modified) (1 diff)
-
proxy-build/mac/x86/config (modified) (1 diff)
-
proxy-build/mac/x86/dot (modified) (previous)
-
proxy-build/win/config (modified) (1 diff)
-
proxy-build/win/dot.exe (modified) (previous)
-
proxy/client.c (modified) (2 diffs)
-
proxy/client.h (modified) (1 diff)
-
proxy/config.mac (modified) (1 diff)
-
proxy/config.sample (modified) (1 diff)
-
proxy/config.win (modified) (1 diff)
-
proxy/http.c (modified) (2 diffs)
-
proxy/http.h (modified) (1 diff)
-
proxy/local.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dot/Makefile
r7625 r7735 35 35 cp -f proxy/config.win proxy-build/win/config 36 36 cp -f proxy/default-pac proxy-build/win/.offline-pac 37 cp -f proxy/default-pac proxy-build/win/offline-pac 37 38 38 39 run: -
trunk/src/dot/proxy-build/mac/x86/config
r7727 r7735 41 41 # socksParentProxy = "localhost:9050" 42 42 # socksProxyType = socks5 43 44 # A test URL that will actually resolve to the address given by 45 # 'testDomainAddress'; useful because Polipo does not resolve your local 46 # etc/hosts.conf file, which can 47 # make testing disconnected web applications running on your local machine 48 # difficult 49 testDomain = "brad.com" 50 testDomainAddress = "127.0.0.1" 43 51 44 52 -
trunk/src/dot/proxy-build/win/config
r7728 r7735 41 41 # socksParentProxy = "localhost:9050" 42 42 # socksProxyType = socks5 43 44 # A test URL that will actually resolve to the address given by 45 # 'testDomainAddress'; useful because Polipo does not resolve your local 46 # etc/hosts.conf file, which can 47 # make testing disconnected web applications running on your local machine 48 # difficult 49 testDomain = "brad.com" 50 testDomainAddress = "192.168.1.108" 43 51 44 52 -
trunk/src/dot/proxy/client.c
r7727 r7735 870 870 URL then remove it. */ 871 871 url = removeBrowserBust(url); 872 873 /* if the domain is a fake domain, such as brad.com, that should 874 actually resolve against the local host then transform it. */ 875 url = handleTestDomain(url); 872 876 873 877 i = httpParseHeaders(1, url, … … 2321 2325 return internAtom(buffer); 2322 2326 } 2327 2328 /** Inside of the Polipo configuration file, a fake 'testDomain' 2329 can be specified that will actually resolve to the address 2330 given in 'testDomainAddress', such as 127.0.0.1; this can be 2331 useful for testing disconnected web applications that are 2332 running on your local laptop. */ 2333 AtomPtr handleTestDomain(AtomPtr url){ 2334 char buffer[4096]; 2335 char *paramLoc = NULL; 2336 char *testDomainPtr = NULL; 2337 int finalLength, end, urlLoc, bufferLoc, finishedFinding = 0; 2338 2339 assert(url != NULL); 2340 2341 if(urlIsLocal(url->string, url->length)) 2342 return url; 2343 2344 if(testDomain == NULL || testDomainAddress == NULL) 2345 return url; 2346 2347 /* prevent buffer overflow attack */ 2348 /* the length after we have replaced the domain in 2349 'testDomain' with 'testDomainAddress' */ 2350 finalLength = url->length - testDomain->length 2351 + testDomainAddress->length; 2352 if(finalLength >= 4095) 2353 return url; 2354 2355 /* do we have the test domain in our url? */ 2356 paramLoc = strstr(url->string, testDomain->string); 2357 if(paramLoc == NULL) 2358 return url; 2359 2360 /* convert this into an actual location now using 2361 pointer arithmetic */ 2362 end = paramLoc - url->string; 2363 2364 /* copy up to this into our buffer */ 2365 strncpy(buffer, url->string, end); 2366 buffer[end] = '\0'; 2367 2368 /* now add the new address */ 2369 strncat(buffer, testDomainAddress->string, 2370 testDomainAddress->length); 2371 bufferLoc = strlen(buffer); 2372 2373 /* in the original string, find where the end of 2374 testDomain is */ 2375 testDomainPtr = testDomain->string; 2376 while(finishedFinding == 0){ 2377 if(*testDomainPtr != *paramLoc){ 2378 finishedFinding = 1; 2379 break; 2380 } 2381 paramLoc++; 2382 testDomainPtr++; 2383 } 2384 urlLoc = paramLoc - url->string; 2385 2386 /* now add the rest of this to our buffer */ 2387 while(urlLoc < url->length){ 2388 buffer[bufferLoc] = url->string[urlLoc]; 2389 bufferLoc++; 2390 urlLoc++; 2391 } 2392 buffer[bufferLoc] = '\0'; 2393 2394 /* decommision the old AtomPtr and create a new one */ 2395 releaseAtom(url); 2396 return internAtom(buffer); 2397 } -
trunk/src/dot/proxy/client.h
r7690 r7735 67 67 StreamRequestPtr srequest); 68 68 AtomPtr removeBrowserBust(AtomPtr url); 69 AtomPtr handleTestDomain(AtomPtr url); -
trunk/src/dot/proxy/config.mac
r7727 r7735 41 41 # socksParentProxy = "localhost:9050" 42 42 # socksProxyType = socks5 43 44 # A test URL that will actually resolve to the address given by 45 # 'testDomainAddress'; useful because Polipo does not resolve your local 46 # etc/hosts.conf file, which can 47 # make testing disconnected web applications running on your local machine 48 # difficult 49 testDomain = "brad.com" 50 testDomainAddress = "127.0.0.1" 43 51 44 52 -
trunk/src/dot/proxy/config.sample
r7622 r7735 42 42 # socksProxyType = socks5 43 43 44 # A test URL that will actually resolve to the address given by 45 # 'testDomainAddress'; useful because Polipo does not resolve your local 46 # etc/hosts.conf file, which can 47 # make testing disconnected web applications running on your local machine 48 # difficult 49 # testDomain = "brad.com" 50 # testDomainAddress = "127.0.0.1" 44 51 45 52 ### Memory -
trunk/src/dot/proxy/config.win
r7727 r7735 41 41 # socksParentProxy = "localhost:9050" 42 42 # socksProxyType = socks5 43 44 # A test URL that will actually resolve to the address given by 45 # 'testDomainAddress'; useful because Polipo does not resolve your local 46 # etc/hosts.conf file, which can 47 # make testing disconnected web applications running on your local machine 48 # difficult 49 testDomain = "brad.com" 50 testDomainAddress = "192.168.1.108" 43 51 44 52 -
trunk/src/dot/proxy/http.c
r7727 r7735 69 69 70 70 int disableVia = 1; 71 72 AtomPtr testDomain = NULL; 73 AtomPtr testDomainAddress = NULL; 71 74 72 75 /* 0 means that all failures lead to errors. 1 means that failures to … … 124 127 CONFIG_VARIABLE(dontTrustVaryETag, CONFIG_TRISTATE, 125 128 "Whether to trust the ETag when there's Vary."); 129 CONFIG_VARIABLE(testDomain, CONFIG_ATOM, 130 "Fake domain for resolving against 'testDomainAddress' for testing purposes."); 131 CONFIG_VARIABLE(testDomainAddress, CONFIG_ATOM, 132 "The address to resolve for 'testDomain'."); 126 133 preinitHttpParser(); 127 134 } -
trunk/src/dot/proxy/http.h
r7727 r7735 142 142 extern int disableVia; 143 143 extern int dontTrustVaryETag; 144 extern AtomPtr testDomain; 145 extern AtomPtr testDomainAddress; 144 146 145 147 void preinitHttp(void); -
trunk/src/dot/proxy/local.c
r7627 r7735 173 173 cut_length = (cut_end - cut_start) + 2; 174 174 host_ptr = (char *)malloc((unsigned) cut_length); 175 if(host_ptr == NULL) 176 return -1; 175 177 cut_ptr = host_ptr; 176 178 for(index = cut_start; index <= cut_end … … 186 188 187 189 *host_results = host_ptr; 190 191 /* if we have a 'testDomain', transform this host into 192 our 'testDomainAddress' value given in the config file. */ 193 if(testDomain == NULL || testDomainAddress == NULL) 194 return 1; 195 196 if(strlen(host_ptr) != testDomain->length) 197 return 1; 198 199 if(strcmp(host_ptr, testDomain->string) != 0) 200 return 1; 201 202 /* change the host to our full testDomainAddress */ 203 free(host_ptr); 204 host_ptr = (char *)malloc((unsigned int)(testDomainAddress->length + 1)); 205 if(host_ptr == NULL) 206 return -1; 207 strcpy(host_ptr, testDomainAddress->string); 208 *host_results = host_ptr; 209 188 210 return 1; 189 211 }