trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leif Hedstrom <>
Subject Re: Calling an arbitrary http entpoint for advice in a remap plugin
Date Wed, 04 Apr 2012 15:11:49 GMT
On 4/4/12 6:36 AM, Servalan eq wrote:
> I am writing a remap plugin to do a hybrid reverse proxy / redirection task.In some circumstances
I want to call out to a seperate http server (not related to the requests) do decide how to
handle the requests.
> I've coded this up using libcurl, which works but seems very slow - creating and destroying
a curl_easy_init object per call. Is there a way to call an HTTP GET during a plugin's process,
just passing some request parameters and headers using the internal ATSfunctionality? 
> It seems TSFetchRespGet or TSFetchURL might work, but I can't see any way to make a new
tsapi_httptxn with my call in it.
> thanks very much,

Yeah, none of this will work (well) in a remap plugin. You need to 
rewrite this as e.g. a read-request-header hook, and then use 
TSHttpConnect() (most likely) to fetch the content. This also implies 
you have to yield and reschedule your continuation while waiting and 
processing the response. If not (and as you probably have noticed with 
your remap plugin), you will block the net-thread for the duration of 
the request. This is very bad, because all clients on that thread are 
now stalled until your (curl) request finishes.

-- Leif

View raw message