Roxen.git / server / modules / tags / insert_cached_href.pike

version» Context lines:

Roxen.git/server/modules/tags/insert_cached_href.pike:1:   // This is a roxen module. Copyright © 2000 - 2004, Roxen IS.   //      #include <module.h>   inherit "module";      //<locale-token project="mod_insert_cached_href">LOCALE</locale-token>   #define LOCALE(X,Y) _DEF_LOCALE("mod_insert_cached_href",X,Y)    - constant cvs_version = "$Id: insert_cached_href.pike,v 1.25 2009/11/11 15:42:25 stewa Exp $"; + constant cvs_version = "$Id: insert_cached_href.pike,v 1.26 2010/04/01 09:42:49 grubba Exp $";      constant thread_safe = 1;   constant module_type = MODULE_TAG;   LocaleString module_name = LOCALE(1, "Tags: Insert cached href");   LocaleString module_doc = LOCALE(2, "This module contains the RXML tag \"insert "    "cached-href\". Useful when implementing e.g."    " RSS syndication.");      #if DEBUG_INSERT_CACHED_HREF   #define DWRITE(x) report_debug("INSERT_CACHED_HREF: " + x + "\n")
Roxen.git/server/modules/tags/insert_cached_href.pike:190:       int counter;    string location = client->con->headers->location;       if (!location || !sizeof(location))    return decode_data(client->data(), client->con->headers);       DWRITE("Following redirect from " + (string)client->url +    " to " + location);    +  // Normalize; Some sites (dn.se) use relative locations. +  location = (string)Standards.URI(location, client->url); +     args["cached-href"] = location;    HTTPClient new_client = HTTPClient(args, header);       new_client->orig_url = (string)client->url;    new_client->run();    counter++;       while (is_redirect(new_client->status) && counter < MAX_REDIRECTS) {    location = new_client->con->headers->location;       if (!location || !sizeof(location))    return decode_data(new_client->data(), new_client->con->headers);       DWRITE("Following redirect from " + (string)new_client->url +    " to " + location);    -  +  location = (string)Standards.URI(location, new_client->url); +     args["cached-href"] = location;    new_client = HTTPClient(args, header);    new_client->orig_url = (string)client->url;    new_client->run();    counter++;    }       return decode_data(new_client->data(), new_client->con->headers);   }   
Roxen.git/server/modules/tags/insert_cached_href.pike:235:    string location = client->con->headers->location;       if (redirects > MAX_REDIRECTS ||    !location ||    !sizeof(location))    return;       DWRITE("Following redirect from " + (string)client->url +    " to " + location);    +  // Normalize; Some sites (dn.se) use relative locations. +  location = (string)Standards.URI(location, client->url); +     args["cached-href"] = location;    HTTPClient new_client = HTTPClient(args, header);       new_client->orig_url = client->orig_url;    new_client->redirects = redirects;    new_client->run();   }      public void|string fetch_url(mapping(string:mixed) to_fetch, void|mapping header) {    DWRITE(sprintf("fetch_url(): To fetch: %s, with timeout: %d", to_fetch["url"],