I'm attempting to do remap in a regular plugin by rewriting the url in the 
PRE_REMAP step.  Doesn't seem to work that way.  Am I missing a step?


switch (event) {
  case TS_EVENT_HTTP_PRE_REMAP:

   ...

    if (TSHttpHdrUrlGet(bufp, hdr_loc, &url_loc)!=TS_SUCCESS) {
        TSError("couldn't retrieve request url");
        TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
        return;
    }

    if (TSUrlSchemeSet(bufp, url_loc, TS_URL_SCHEME_HTTP, -1) == TS_ERROR) {
        TSError("Unable to set scheme in URL in the HTTP Header");
    }
    if (TSUrlHostSet(bufp, url_loc, "www.w3.org", -1) == TS_ERROR) {
        TSError("Unable to set host in URL in the HTTP Header");
    }
    if (TSUrlPortSet(bufp, url_loc, 80) == TS_ERROR) {
        TSError("Unable to set port in URL in the HTTP Header");
    }
    if (TSUrlPathSet(bufp, url_loc, "/", -1) == TS_ERROR) {
        TSError("Unable to set path in URL in the HTTP Header");
    }

Reply via email to