You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Leif Hedstrom <zw...@apache.org> on 2014/04/02 17:33:54 UTC

[API proposal] TSRedirectRetriesGet()

Hi,

I’d like to extend these two (existing) APIs

	void TSRedirectUrlSet(TSHttpTxn txnp, const char* url, const int url_len);
 	const char* TSRedirectUrlGet(TSHttpTxn txnp, int *url_len_ptr);  


with this addition:

	int TSRedirectRetriesGet()


This allows for a plugin using these API to do for example

	1. Apply different changes to the redirection based on which attempt it is (e.g. try a.example.com on the first try, and b.example.com on the second try).
	2. Allow it to stop retrying at will, before we hit the max number of retries (e.g. avoid trying one host, a.example.com, repeatedly)

The naming of this API is a little less than ideal (I think these should have been member of the Http / Txn family), but I picked a name that’s inline with the existing APIs for consistency (stay within the “family”). I don’t think it makes sense to have a Set() method on this, since this is an internal counter.

I’ve filed a Radar on this:

	https://issues.apache.org/jira/browse/TS-2692


— Leif


Re: [API proposal] TSRedirectRetriesGet()

Posted by James Peach <jp...@apache.org>.
On Apr 2, 2014, at 8:33 AM, Leif Hedstrom <zw...@apache.org> wrote:

> Hi,
> 
> I’d like to extend these two (existing) APIs
> 
> 	void TSRedirectUrlSet(TSHttpTxn txnp, const char* url, const int url_len);
> 	const char* TSRedirectUrlGet(TSHttpTxn txnp, int *url_len_ptr);  
> 
> 
> with this addition:
> 
> 	int TSRedirectRetriesGet()
> 
> 
> This allows for a plugin using these API to do for example
> 
> 	1. Apply different changes to the redirection based on which attempt it is (e.g. try a.example.com on the first try, and b.example.com on the second try).
> 	2. Allow it to stop retrying at will, before we hit the max number of retries (e.g. avoid trying one host, a.example.com, repeatedly)
> 
> The naming of this API is a little less than ideal (I think these should have been member of the Http / Txn family), but I picked a name that’s inline with the existing APIs for consistency (stay within the “family”). I don’t think it makes sense to have a Set() method on this, since this is an internal counter.

This seems reasonable. I'd want the return value to be unsigned, though that would not be consistent with other APIs. How does this interact with the "redirect" remap type?

J