You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Walt Karas <wk...@verizonmedia.com.INVALID> on 2020/09/29 14:28:31 UTC

Proposal for new TS plugin API function: TSUrlPortGet

This gets the port string in the URL. If the port is not in the URL, it
returns nullptr (and sets length to zeor). Note this is subtly different
from TSUrlPortGet which always returns a valid port, the canonical port for
the scheme if the port is not specified. Currently there is no way to
detect this from a plugin.

char const* TSUrlPortGet(TSMBuffer, TSMLoc, int* length);

Re: [E] Proposal for new TS plugin API function: TSUrlPortGet

Posted by Alan Carroll <so...@verizonmedia.com.INVALID>.
In the first case it should return 0.

In the second case it should return 61000.

On Tue, Oct 6, 2020 at 4:02 PM Walt Karas <wk...@verizonmedia.com> wrote:

> The current behavior that I'm seeing for TSUrlPortGet() is that for this
> request:
>
> printf "GET / HTTP/1.1\r\nHost: mYhOsT.teSt:61000\r\n\r\n" | nc localhost
> 61001
>
> it returns 80.  Should TSUrlRawPortGet() return -1 ?
>
> For this request:
>
> printf "GET http://mYhOsT.teSt:61000/ <http://myhost.test:61000/> HTTP/1.1\r\n\r\n"
> | nc localhost 61001
>
> TSUrlPortGet() returns 61000.  Should TSUrlRawPortGet() also return 6100 ?
>
> On Thu, Oct 1, 2020 at 1:31 PM Alan Carroll <
> solidwallofcode@verizonmedia.com> wrote:
>
>> After discussions, this will be changed to TSUrlRawPortGet that returns 0
>> if the port is not explicitly present in the URL.
>>
>> On Tue, Sep 29, 2020 at 9:28 AM Walt Karas
>> <wk...@verizonmedia.com.invalid> wrote:
>>
>>> This gets the port string in the URL. If the port is not in the URL, it
>>> returns nullptr (and sets length to zeor). Note this is subtly different
>>> from TSUrlPortGet which always returns a valid port, the canonical port
>>> for
>>> the scheme if the port is not specified. Currently there is no way to
>>> detect this from a plugin.
>>>
>>> char const* TSUrlPortGet(TSMBuffer, TSMLoc, int* length);
>>>
>>

Re: [E] Proposal for new TS plugin API function: TSUrlPortGet

Posted by Walt Karas <wk...@verizonmedia.com.INVALID>.
The current behavior that I'm seeing for TSUrlPortGet() is that for this
request:

printf "GET / HTTP/1.1\r\nHost: mYhOsT.teSt:61000\r\n\r\n" | nc localhost
61001

it returns 80.  Should TSUrlRawPortGet() return -1 ?

For this request:

printf "GET http://mYhOsT.teSt:61000/ <http://myhost.test:61000/>
HTTP/1.1\r\n\r\n"
| nc localhost 61001

TSUrlPortGet() returns 61000.  Should TSUrlRawPortGet() also return 6100 ?

On Thu, Oct 1, 2020 at 1:31 PM Alan Carroll <
solidwallofcode@verizonmedia.com> wrote:

> After discussions, this will be changed to TSUrlRawPortGet that returns 0
> if the port is not explicitly present in the URL.
>
> On Tue, Sep 29, 2020 at 9:28 AM Walt Karas <wk...@verizonmedia.com.invalid>
> wrote:
>
>> This gets the port string in the URL. If the port is not in the URL, it
>> returns nullptr (and sets length to zeor). Note this is subtly different
>> from TSUrlPortGet which always returns a valid port, the canonical port
>> for
>> the scheme if the port is not specified. Currently there is no way to
>> detect this from a plugin.
>>
>> char const* TSUrlPortGet(TSMBuffer, TSMLoc, int* length);
>>
>

Re: [E] Proposal for new TS plugin API function: TSUrlPortGet

Posted by Alan Carroll <so...@verizonmedia.com.INVALID>.
After discussions, this will be changed to TSUrlRawPortGet that returns 0
if the port is not explicitly present in the URL.

On Tue, Sep 29, 2020 at 9:28 AM Walt Karas <wk...@verizonmedia.com.invalid>
wrote:

> This gets the port string in the URL. If the port is not in the URL, it
> returns nullptr (and sets length to zeor). Note this is subtly different
> from TSUrlPortGet which always returns a valid port, the canonical port for
> the scheme if the port is not specified. Currently there is no way to
> detect this from a plugin.
>
> char const* TSUrlPortGet(TSMBuffer, TSMLoc, int* length);
>