[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Anil Kumar Myla (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13920284#comment-13920284
 ] 

Anil Kumar Myla commented on TS-2609:
-

TO-URL FROM-URL and ORIGIN-URL are too generic in the sense, that they can be 
broken down into respective components like scheme, host, port, path, query as 
I explained before. Does it make sense to get rid of the URL condition since it 
is not implemented yet?

> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Leif Hedstrom (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13920232#comment-13920232
 ] 

Leif Hedstrom commented on TS-2609:
---

Sounds good.

> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Anil Kumar Myla (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13920136#comment-13920136
 ] 

Anil Kumar Myla commented on TS-2609:
-

HOST is really ambiguous, it can refer to the requesting host or the proxying 
host or the origin host. We should probably map them like this

requestUrl -> ORIGIN-HOST
mapFromUrl -> FROM-HOST
mapToUrl -> TO-HOST

> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Leif Hedstrom (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919680#comment-13919680
 ] 

Leif Hedstrom commented on TS-2609:
---

Right, significant portions of the URL / CLIENT-URL features are not 
implemented.

Also, looking at the docs, it seems the intent was to implement these three:

{code}
header_rewrite.en.rst:  cond %{HOST} operand  
[condition_flags]
header_rewrite.en.rst:  cond %{FROMHOST} operand   [condition_flags]
header_rewrite.en.rst:  cond %{TOHOST} operand 
[condition_flags]
{code}

I'm pretty sure each of those would correlate (in remap plugins) to each of 
these from the RRI struct:

{code}
TSMLoc requestUrl;
TSMLoc mapFromUrl;
TSMLoc mapToUrl;
{code}


So, your original patch, the condition would be named "HOST" I think? Also, I 
feel that to be consistent, the three conditions ought to be be named

{code}
HOST
FROM-HOST
TO-HOST
{code}

That seems more in line with how we do this for e.g. HEADER / CLIENT-HEADER and 
URL / CLIENT-URL.

Finally, the intent probably also was (just as with URL / CLIENT-URL) that we'd 
have one class implementing "HOST", and have it use a flag to indicate which 
type of HOST it would use.

Wdyt ?

Oh, and thanks for all the input, this is a good discussion!


> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Anil Kumar Myla (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919588#comment-13919588
 ] 

Anil Kumar Myla commented on TS-2609:
-

To add to your comments, in a remap rule, URL:Host is pretty much equal to 
HEADER:Host (let me know if you think otherwise) while the CLIENT-URL:Host can 
be the origin server.

But we need to justify implementing URL/CLIENT-URL conditions because of the 
following replacements that we can use (in the context of a remap rule)
URL:Scheme == SCHEME (unimplemented)
URL:Host == HEADER:Host (?correct?)
URL:Port == PORT (unimplemented)
URL:Path == PATH
URL:Query== QUERY

CLIENT-URL:Scheme == SCHEME (unimplemented)
CLIENT-URL:Host == ? (unimplemented) --> TOHOST (patch)
CLIENT-URL:Port == PORT (unimplemented)
CLIENT-URL:Path == URL:Path == PATH
CLIENT-URL:Query== URL:Query == QUERY

We need to implement SCHEME or PORT (add CLIENT-SCHEME / CLIENT-PORT for remap 
rules) for this to be complete.

> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Anil Kumar Myla (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919558#comment-13919558
 ] 

Anil Kumar Myla commented on TS-2609:
-

When we have plugin chaining mapToUrl can be different from requestUrl. Let's 
say we have a regex plugin before the header rewrite plugin, and the regex 
plugin rewrites it to regex.x.y.com instead of the origin.x.y.com

map x.y.com origin.x.y.com  

_rri->mapToUrl = origin.x.y.com/request_url
_rri->requestUrl = regex.x.y.com/regex_modified_url

You are right, these would ideally be
%{URL:Host}
%{CLIENT-URL:Host}

But from the plugin documentation, I'm thinking the URL/CLIENT-URL conditions 
have already been broken down into SCHEME (unimplemented), HOST, PORT 
(unimplemented), PATH ,QUERY conditions. Do we really need the URL/CLIENT-URL 
conditions ? :)

Let me know what you think.

> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Leif Hedstrom (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919230#comment-13919230
 ] 

Leif Hedstrom commented on TS-2609:
---

Hmmm, I see what you are getting at. However, the patch does not do that I'm 
pretty sure:

{code}
+  const char *to_host = TSUrlHostGet(res._rri->requestBufp, 
res._rri->requestUrl, &to_host_len);
{code}

In your case, with pristine host headers, the requestUrl's Host would still be 
x.y.com. To do what you are saying, I believe you would have to change this 
code to _rri->mapToUrl. Now, we also have the URL and CLIENT-URL directives, 
that might overlap here ? E.g.

{code}
%{URL:Host}
{code}

However, looking at the code, it seems the URL conditions are not implemented 
at all. We'll happy take patches here too! :-).

Also, as the patch is written, the TOHOST condition would only work as a remap 
rule.  That is fine, but would need to be properly documented. And if possible, 
we should make conditions and operators generic. But, the more I look at this, 
maybe the answer is to finish the URL / CLIENT-URL (and perhaps TO-URL and 
FROM-URL ?) conditions ?

What do you think?


> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Anil Kumar Myla (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919164#comment-13919164
 ] 

Anil Kumar Myla commented on TS-2609:
-

It is indeed different from CLIENT-HEADER:Host

Let's say we have this remap rule which preserves the Host header to the origin 
server
map x.y.com origin.x.y.com @pristine_host_hdr=1 . 

Then
CLIENT-HEADER:Host = x.y.com
TOHOST = origin.x.y.com

Let me know if I'm wrong in my understanding

> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Leif Hedstrom (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919162#comment-13919162
 ] 

Leif Hedstrom commented on TS-2609:
---

[~bcall] pointed out that the TOHOST is already documented, but not 
implemented. I claim ignorance, but I suspect when we first wrote this, we 
intended to implement TOHOST, but then realized HEADER / CLIENT-HEADER would 
suffice ?

> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-04 Thread Leif Hedstrom (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919156#comment-13919156
 ] 

Leif Hedstrom commented on TS-2609:
---

I'm not against this patch, but I do have a question. Is this fundamental 
different than doing e.g.

{code}
cond %{CLIENT-HEADER:Host} =www.ogre.com
{code}

My preference is probably to not have more than one way to achieve the same 
thing (*cough* Perl *cough*), but if there are good reasons to add the TOHOST 
directive, I'd be ok with that. Fwiw, I feel it ought to be named TO-HOST or 
CLIENT-HOST or even just HOST if we go this path :).

Also, if you look at how we have an "adaptive" HEADER condition, a 
functionality like %{HOST} would similarly adapt to the hook it's in, whereas 
CLIENT-HOST would be anchored to the client request header.

What do you think?

> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Assignee: Leif Hedstrom
>Priority: Minor
> Fix For: 5.0.0
>
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (TS-2609) Header rewrite plugin TOHOST condition

2014-03-03 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-2609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13919010#comment-13919010
 ] 

ASF GitHub Bot commented on TS-2609:


GitHub user anilkumarmyla opened a pull request:

https://github.com/apache/trafficserver/pull/54

[TS-2609] Header rewrite plugin TOHOST condition

Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
conditioned on the final origin server will be supported.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/anilkumarmyla/trafficserver master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/trafficserver/pull/54.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #54


commit 40907b8b31bd3821267edd913675ebaff56973a2
Author: Anil Kumar Myla 
Date:   2014-03-04T04:04:48Z

TS-2609 enhance header_rewrite plugin to support TOHOST condition

commit f611ae1e5e71f7204c71502ec6ba1a9f05560170
Author: Anil Kumar Myla 
Date:   2014-03-04T04:36:13Z

Merge branch 'to_host'




> Header rewrite plugin TOHOST condition
> --
>
> Key: TS-2609
> URL: https://issues.apache.org/jira/browse/TS-2609
> Project: Traffic Server
>  Issue Type: Improvement
>  Components: Plugins
>Reporter: Anil Kumar Myla
>Priority: Minor
>
> Enhance header rewrite plugin to support TOHOST condition. Header rewrites 
> conditioned on the final origin server will be supported.



--
This message was sent by Atlassian JIRA
(v6.2#6252)