Thanks! Didn't seem to work, though. I'm using 2.1.8-unstable if that makes a difference. Does what I'm trying to do seem like it should work? bufp comes from the incoming TSHttpTxn Do I need to create a new URL to make this work?
On 6/12/11 2:58 PM, "Eric Balsa" <[email protected]> wrote: >Did you remember to use TSSkipRemappingSet(TSHttpTxn txnp, int flag) I >added a while back so the SM jumps to POST_REMAP instead of requiring >a remap? Give that a try... > >--Eric > >On Sun, Jun 12, 2011 at 2:48 PM, Earle, Erik <[email protected]> >wrote: >> 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"); >> }
