I'm not in my office, but I'm fairly certain that you can't change the HTTP headers (including status code) once the transform has started. Maybe someone else with docs / code can confirm.
-- Leif On Jun 29, 2011, at 5:16 AM, aniket ray <[email protected]> wrote: > I'm trying to process the response data inside a transformation and > based on the processing send a 301 response header to the client with > a different redirect URL each time. > The code was unfortunately crashing (even on TS 3.0) > > In an attempt to locate the crash i created a minimalistic code which > is an amalgamation of null transform and redirect-1 plugin codes > (attached). > > This code compiles and crashes with the following callstack > > #0 operator= (this=0x464ec250, p=0x464ec380) at ../../lib/ts/Ptr.h:414 > #1 clone_reader (this=0x464ec250, p=0x464ec380) at > ../../iocore/eventsystem/P_IOBuffer.h:859 > #2 HttpTunnel::producer_run (this=0x464ec250, p=0x464ec380) at > HttpTunnel.cc:821 > #3 0x081a4a21 in HttpTunnel::tunnel_run (this=0x464ec250, p_arg=0x0) > at HttpTunnel.cc:694 > #4 0x0816cab0 in HttpSM::setup_internal_transfer (this=0x464eaa90, > handler_arg=(int (HttpSM::*)(HttpSM *, int, void *)) 0x81549b0 > <HttpSM::tunnel_handler(int, void*)>) > at HttpSM.cc:5477 > #5 0x0816cfe7 in HttpSM::handle_api_return (this=0x464eaa90) at > HttpSM.cc:1574 > #6 0x081642c8 in HttpSM::state_api_callout (this=0x464eaa90, > event=60000, data=0x0) at HttpSM.cc:1448 > #7 0x081693bf in HttpSM::state_api_callback (this=0x464eaa90, > event=60000, data=0x0) at HttpSM.cc:1267 > #8 0x080e3ea9 in TSHttpTxnReenable (txnp=0x464eaa90, > event=TS_EVENT_HTTP_CONTINUE) at InkAPI.cc:5350 > #9 0x4005a1ad in handle_response (contp=0x453a4360, > event=TS_EVENT_HTTP_SEND_RESPONSE_HDR, edata=0x464eaa90) at > redirect-1.c:133 > #10 redirect_plugin (contp=0x453a4360, > event=TS_EVENT_HTTP_SEND_RESPONSE_HDR, edata=0x464eaa90) at > redirect-1.c:152 > #11 0x08164534 in HttpSM::state_api_callout (this=0x464eaa90, event=0, > data=0x0) at HttpSM.cc:1374 > #12 0x0816e5c7 in HttpSM::do_api_callout() () > #13 0x0816ba6b in HttpSM::set_next_state (this=0x464eaa90) at HttpSM.cc:6684 > #14 0x08154e1b in HttpSM::call_transact_and_set_next_state > (this=0x464eaa90, f=0x8189ed0 > <HttpTransact::HandleApiErrorJump(HttpTransact::State*)>) at > HttpSM.cc:6325 > #15 0x08164427 in HttpSM::state_api_callout (this=0x464eaa90, > event=60001, data=0x0) at HttpSM.cc:1460 > #16 0x081693bf in HttpSM::state_api_callback (this=0x464eaa90, > event=60001, data=0x0) at HttpSM.cc:1267 > #17 0x080e3ea9 in TSHttpTxnReenable (txnp=0x464eaa90, > event=TS_EVENT_HTTP_ERROR) at InkAPI.cc:5350 > #18 0x4005a376 in handle_transform (contp=0x973fff0, > event=TS_EVENT_IMMEDIATE, edata=0x46395dd0) at redirect-1.c:271 > #19 eventHandler (contp=0x973fff0, event=TS_EVENT_IMMEDIATE, > edata=0x46395dd0) at redirect-1.c:371 > #20 0x082e8702 in handleEvent (this=0x40b4e008, e=0x46395dd0, > calling_code=1) at I_Continuation.h:146 > #21 EThread::process_event (this=0x40b4e008, e=0x46395dd0, > calling_code=1) at UnixEThread.cc:140 > #22 0x082e912c in EThread::execute (this=0x40b4e008) at UnixEThread.cc:189 > #23 0x082e6604 in spawn_thread_internal (a=0x96f0fa8) at Thread.cc:88 > #24 0x40063cc9 in start_thread (arg=0x40e50b70) at pthread_create.c:304 > #25 0x4057069e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130 > > > I think I am not using TSHttpTxnReenable the way it should be. I'd > like to know what the proper way to abort the transformation and place > the HTTP State Machine to the SEND_RESPONSE state would be. > > Thanks, > Aniket Ray > <redirect-1.c>
