You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by James Peach <jp...@apache.org> on 2012/04/12 06:59:25 UTC
marshall buffers for TSRemapRequestInfo members
Hi all,
I'm looking at TSRemapRequestInfo and wondering which marshall buffer callers are supposed to use when manipulating mapFromUrl and mapToUrl. All the TSUrl APIs need a marshall buffer, but afaict, requestBufp is not the right one. I don't see any remap plugins using these URLs ...
J
Re: marshall buffers for TSRemapRequestInfo members
Posted by Leif Hedstrom <zw...@apache.org>.
On Apr 13, 2012, at 9:22 AM, James Peach <ja...@me.com> wrote:
> On Apr 13, 2012, at 6:01 AM, Leif Hedstrom wrote:
>
>> On Apr 12, 2012, at 10:17 PM, Conan <co...@gmail.com> wrote:
>>
>>> hi, I use requestBufp to read the request. But mapFromUrl/requestUrl will
>>> be changed in a situation, which is not what you want. here is my email
>>> last year.
>>
>>
>> Hmmm, no the To and From URLs should never change, or be changed. Ideally they should be const, but those changes would have been invasive. These URLs are from remap.config, not the request.
>
>> James, maybe we (I.e you) should see if we can either fix this by providing for a special remap.config "reqp" constant (it should be constant, and the same for all threads and requests), or making To and From URLs constant?
>
> It doesn't matter to me right now, but I'll need to test Conan's case eventually. I was hoping to be able to cache the to and from URLs, but obviously if they change I can't do that.
>
They can change when the remap.config is reloaded . But, a reload of remap.config also reinstates the plugin, so it should be safe to keep the To and From URLs as Lua objects for as long as the plugin instance is used (you get called when you are unloaded).
If To and From URLs change, it does sound like a bug. I can take a look later, omw to Moab now.
-- Leif
Re: marshall buffers for TSRemapRequestInfo members
Posted by James Peach <ja...@me.com>.
On Apr 13, 2012, at 6:01 AM, Leif Hedstrom wrote:
> On Apr 12, 2012, at 10:17 PM, Conan <co...@gmail.com> wrote:
>
>> hi, I use requestBufp to read the request. But mapFromUrl/requestUrl will
>> be changed in a situation, which is not what you want. here is my email
>> last year.
>
>
> Hmmm, no the To and From URLs should never change, or be changed. Ideally they should be const, but those changes would have been invasive. These URLs are from remap.config, not the request.
> James, maybe we (I.e you) should see if we can either fix this by providing for a special remap.config "reqp" constant (it should be constant, and the same for all threads and requests), or making To and From URLs constant?
It doesn't matter to me right now, but I'll need to test Conan's case eventually. I was hoping to be able to cache the to and from URLs, but obviously if they change I can't do that.
Given your description above, it sounds like the behaviour Conan describes would be a bug, but I can almost imagine it being a feature :)
>
> -- Leif
>
>>
>> From Conan <co...@gmail.com>
>> Subject remap plugin question when pristine_host_hdr is enabled
>> Date Fri, 29 Jul 2011 15:25:25 GMT
>>
>> In proxy/http/remap/RemapPlugins.cc, line 147 say "plugin did not change
>> host, port or path, copying from mapping rule" when TSRemapDoRemap return
>> TSREMAP_NO_REMAP or TSREMAP_NO_REMAP_STOP.
>>
>> If url_remap.pristine_host_hdr is enabled, I think host should not
>> be copied(changed). This affects mapFromUrl/requestUrl (or more)
>> of TSRemapRequestInfo. In a remap plugin chain, second plugin will get
>> a "copied" Url if first plugin return TSREMAP_NO_REMAP, which maybe
>> not reasonable.
>>
>> 2012/4/13 James Peach <ja...@me.com>
>>
>>> On 12/04/2012, at 10:18 AM, Leif Hedstrom wrote:
>>>
>>>> On 4/12/12 9:54 AM, James Peach wrote:
>>>>> On Apr 12, 2012, at 7:43 AM, Leif Hedstrom wrote:
>>>>>
>>>>>> I think when I fiddled with this, using the reqbufp was ok.
>>>>> Alright, I'll take that for a spin ...
>>>>
>>>>
>>>> If you get it to work, let us know. We might need to document this, I
>>> had the same confusion too (and I wrote the damn thing...).
>>>
>>> Yep requestBufp works; which actually worries me a bit because that's
>>> definitely not the right marshall buffer. I guess that the buffer is only
>>> used if you modify the URL?
>>>
>>> J
>>>
Re: marshall buffers for TSRemapRequestInfo members
Posted by Leif Hedstrom <zw...@apache.org>.
On Apr 12, 2012, at 10:17 PM, Conan <co...@gmail.com> wrote:
> hi, I use requestBufp to read the request. But mapFromUrl/requestUrl will
> be changed in a situation, which is not what you want. here is my email
> last year.
Hmmm, no the To and From URLs should never change, or be changed. Ideally they should be const, but those changes would have been invasive. These URLs are from remap.config, not the request.
James, maybe we (I.e you) should see if we can either fix this by providing for a special remap.config "reqp" constant (it should be constant, and the same for all threads and requests), or making To and From URLs constant?
-- Leif
>
> From Conan <co...@gmail.com>
> Subject remap plugin question when pristine_host_hdr is enabled
> Date Fri, 29 Jul 2011 15:25:25 GMT
>
> In proxy/http/remap/RemapPlugins.cc, line 147 say "plugin did not change
> host, port or path, copying from mapping rule" when TSRemapDoRemap return
> TSREMAP_NO_REMAP or TSREMAP_NO_REMAP_STOP.
>
> If url_remap.pristine_host_hdr is enabled, I think host should not
> be copied(changed). This affects mapFromUrl/requestUrl (or more)
> of TSRemapRequestInfo. In a remap plugin chain, second plugin will get
> a "copied" Url if first plugin return TSREMAP_NO_REMAP, which maybe
> not reasonable.
>
> 2012/4/13 James Peach <ja...@me.com>
>
>> On 12/04/2012, at 10:18 AM, Leif Hedstrom wrote:
>>
>>> On 4/12/12 9:54 AM, James Peach wrote:
>>>> On Apr 12, 2012, at 7:43 AM, Leif Hedstrom wrote:
>>>>
>>>>> I think when I fiddled with this, using the reqbufp was ok.
>>>> Alright, I'll take that for a spin ...
>>>
>>>
>>> If you get it to work, let us know. We might need to document this, I
>> had the same confusion too (and I wrote the damn thing...).
>>
>> Yep requestBufp works; which actually worries me a bit because that's
>> definitely not the right marshall buffer. I guess that the buffer is only
>> used if you modify the URL?
>>
>> J
>>
Re: marshall buffers for TSRemapRequestInfo members
Posted by Conan <co...@gmail.com>.
hi, I use requestBufp to read the request. But mapFromUrl/requestUrl will
be changed in a situation, which is not what you want. here is my email
last year.
>From Conan <co...@gmail.com>
Subject remap plugin question when pristine_host_hdr is enabled
Date Fri, 29 Jul 2011 15:25:25 GMT
In proxy/http/remap/RemapPlugins.cc, line 147 say "plugin did not change
host, port or path, copying from mapping rule" when TSRemapDoRemap return
TSREMAP_NO_REMAP or TSREMAP_NO_REMAP_STOP.
If url_remap.pristine_host_hdr is enabled, I think host should not
be copied(changed). This affects mapFromUrl/requestUrl (or more)
of TSRemapRequestInfo. In a remap plugin chain, second plugin will get
a "copied" Url if first plugin return TSREMAP_NO_REMAP, which maybe
not reasonable.
2012/4/13 James Peach <ja...@me.com>
> On 12/04/2012, at 10:18 AM, Leif Hedstrom wrote:
>
> > On 4/12/12 9:54 AM, James Peach wrote:
> >> On Apr 12, 2012, at 7:43 AM, Leif Hedstrom wrote:
> >>
> >>> I think when I fiddled with this, using the reqbufp was ok.
> >> Alright, I'll take that for a spin ...
> >
> >
> > If you get it to work, let us know. We might need to document this, I
> had the same confusion too (and I wrote the damn thing...).
>
> Yep requestBufp works; which actually worries me a bit because that's
> definitely not the right marshall buffer. I guess that the buffer is only
> used if you modify the URL?
>
> J
>
Re: marshall buffers for TSRemapRequestInfo members
Posted by James Peach <ja...@me.com>.
On 12/04/2012, at 10:18 AM, Leif Hedstrom wrote:
> On 4/12/12 9:54 AM, James Peach wrote:
>> On Apr 12, 2012, at 7:43 AM, Leif Hedstrom wrote:
>>
>>> I think when I fiddled with this, using the reqbufp was ok.
>> Alright, I'll take that for a spin ...
>
>
> If you get it to work, let us know. We might need to document this, I had the same confusion too (and I wrote the damn thing...).
Yep requestBufp works; which actually worries me a bit because that's definitely not the right marshall buffer. I guess that the buffer is only used if you modify the URL?
J
Re: marshall buffers for TSRemapRequestInfo members
Posted by Leif Hedstrom <le...@godaddy.com>.
On 4/12/12 9:54 AM, James Peach wrote:
> On Apr 12, 2012, at 7:43 AM, Leif Hedstrom wrote:
>
>> I think when I fiddled with this, using the reqbufp was ok.
> Alright, I'll take that for a spin ...
If you get it to work, let us know. We might need to document this, I had
the same confusion too (and I wrote the damn thing...).
-- leif
Re: marshall buffers for TSRemapRequestInfo members
Posted by James Peach <ja...@me.com>.
On Apr 12, 2012, at 7:43 AM, Leif Hedstrom wrote:
> I think when I fiddled with this, using the reqbufp was ok.
Alright, I'll take that for a spin ...
> Since these URLs are "static" it shouldn't matter? If not, I guess we have to provide a bufp that ties into the global config.
>
> -- Leif
>
> On Apr 11, 2012, at 10:59 PM, James Peach <jp...@apache.org> wrote:
>
>> Hi all,
>>
>> I'm looking at TSRemapRequestInfo and wondering which marshall buffer callers are supposed to use when manipulating mapFromUrl and mapToUrl. All the TSUrl APIs need a marshall buffer, but afaict, requestBufp is not the right one. I don't see any remap plugins using these URLs ...
>>
>> J
Re: marshall buffers for TSRemapRequestInfo members
Posted by Leif Hedstrom <zw...@apache.org>.
I think when I fiddled with this, using the reqbufp was ok. Since these URLs are "static" it shouldn't matter? If not, I guess we have to provide a bufp that ties into the global config.
-- Leif
On Apr 11, 2012, at 10:59 PM, James Peach <jp...@apache.org> wrote:
> Hi all,
>
> I'm looking at TSRemapRequestInfo and wondering which marshall buffer callers are supposed to use when manipulating mapFromUrl and mapToUrl. All the TSUrl APIs need a marshall buffer, but afaict, requestBufp is not the right one. I don't see any remap plugins using these URLs ...
>
> J