Changeset 7795 for trunk/src/dot/proxy

Show
Ignore:
Timestamp:
03/26/07 09:28:08 (22 months ago)
Author:
BradNeuberg
Message:

Created way to have JavaScript? layer 'query' to see if the PAC file has been updated yet -- if not, we tell the user to restart their browser

Location:
trunk/src/dot/proxy
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/dot/proxy/http_parse.c

    r7618 r7795  
    14701470urlIsLocal(const char *url, int len) 
    14711471{ 
    1472     return (len > 0 && url[0] == '/'); 
     1472    return (len >= 13 && strstr(url, "pac_check.txt")) || 
     1473            (len > 0 && url[0] == '/'); 
    14731474} 
    14741475 
     
    14761477urlIsSpecial(const char *url, int len) 
    14771478{ 
    1478     return (len >= 8 && memcmp(url, "/polipo/", 8) == 0); 
     1479    return  (len >= 13 && strstr(url, "pac_check.txt")) || 
     1480            (len >= 8 && memcmp(url, "/polipo/", 8) == 0); 
    14791481} 
    14801482 
  • trunk/src/dot/proxy/local.c

    r7743 r7795  
    351351                     "\r\nServer: polipo" 
    352352                     "\r\nContent-Type: text/javascript"); 
     353        }else if(isPACCheck(object) == 1){ 
     354                hlen = snnprintf(buffer, 0, 1024, 
     355                     "\r\nServer: polipo" 
     356                     "\r\nContent-Type: text/plain"); 
    353357        }else{ 
    354358        hlen = snnprintf(buffer, 0, 1024, 
     
    376380#ifndef NO_OFFLINE_SUPPORT 
    377381    } else if(disableOfflineSupport == 0 &&  
    378               matchUrl("/polipo/offline", object)) { 
    379             handleOfflineAPI(object, requestor); 
     382            matchUrl("/polipo/offline", object)) { 
     383        handleOfflineAPI(object, requestor); 
    380384#endif 
     385    } else if(isPACCheck(object) == 1) { 
     386        printf("pac_check.txt was requested"); 
     387        objectPrintf(object, 0,  
     388                    "the web application is inside the PAC file"); 
     389        object->length = object->size;         
    381390    } else if(matchUrl("/polipo/status", object)) { 
    382391        objectPrintf(object, 0, 
     
    678687} 
    679688 
     689int 
     690isPACCheck(ObjectPtr object) 
     691{ 
     692    char *testUrl; 
     693    printf("isPACCheck\n"); 
     694     
     695    if(disableOfflineSupport == 1) 
     696        return 0; 
     697         
     698    /* object->key doesn't use a null terminator, which 
     699       strstr requires; copy it over and add a null 
     700       terminator. */ 
     701    testUrl = (char *)malloc((unsigned)(object->key_size + 1));  
     702    memcpy(testUrl, object->key, object->key_size); 
     703    testUrl[object->key_size] = '\0'; 
     704    printf("testUrl=%s\n", testUrl); 
     705    if(strstr(testUrl, "pac_check.txt") != NULL) 
     706        return 1; 
     707    else 
     708        return 0; 
     709} 
     710 
    680711#ifdef HAVE_FORK 
    681712static void 
  • trunk/src/dot/proxy/local.h

    r7618 r7795  
    4848                                 StreamRequestPtr srequest); 
    4949int httpSpecialDoSideFinish(AtomPtr data, HTTPRequestPtr requestor); 
     50int isPACCheck(ObjectPtr object); 
     51