You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Michael B Allen <io...@gmail.com> on 2009/03/23 02:43:35 UTC

Obtaining a Unique Connection ID?

Hi Again,

In the near term absence of getRemotePort, I am struggling to
determine a method for storing and retrieving per-connection state.

Can anyone recommend another method for acquiring a unique connection
identifier? I would be satisfied with a platform specific method at
this point.

Just to be clear as to why this is necessary, NTLMSSP is a three
request "handshake". So if you have a frameset with 5 frames, IE will
create 5 separate connections but will use the same session ID. So I
cannot simply store the state of the authentication in the session
because the multiple simultaneous authentication requests will
incorrectly read or overwrite that state and cause strange concurrency
errors. I need to store the authentication state in the session using
a unique connection ID (normally getRemoteAddr+getRemotePort) to keep
the simultaneous authentication requests straight.

Any ideas?

Is there a mod_jk or Tomcat specific feature that would allow me to
get the socket file descriptor value, or port, or unique ID through
HttpServletRequest.getAttribute()?

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Obtaining a Unique Connection ID?

Posted by Michael B Allen <io...@gmail.com>.
On Fri, Mar 27, 2009 at 5:43 AM, Rainer Jung <ra...@kippdata.de> wrote:
> On 27.03.2009 01:21, Michael B Allen wrote:
>>
>> On Mon, Mar 23, 2009 at 10:38 AM, Michael B Allen<io...@gmail.com>
>>  wrote:
>>>
>>> On Mon, Mar 23, 2009 at 3:41 AM, Rainer Jung<ra...@kippdata.de>
>>>  wrote:
>>>>
>>>> Others might have better ideas, but as mentioned in the previous thread,
>>>> you
>>>> can forward the remote port with
>>>>
>>>> JkEnvVar REMOTE_PORT
>>>>
>>>> and retrieve it in Tomcat with
>>>>
>>>> request.getAttribute("REMOTE_PORT")
>>>>
>>>> Doesn't that work?
>>>
>>> Yes, it sounds like precisely what I'm looking for. I just didn't
>>> understand the significance of your previous message. I never used
>>> mod_jk before so I'll have to look into this JkEnvVar thing.
>>
>> Now I have someone using the ISAPI filter in IIS with Tomcat who is
>> also seeing getRemotePort return -1.
>>
>> Is there a work-around for IIS?
>>
>> I've modified our code to look for the REMOTE_PORT attribute. Is there
>> a way to export the REMOTE_PORT attribute with the ISAPI filter?
>
> Not at the moment. I expect us to fix this with the next version (then by
> already activating it by default).

Is there an ETA on that?

Will the dll of the fixed version work with and provide the
REMOTE_PORT to an older installation of Tomcat?

If not, is there absolutely no way to come up with a unique connection
id for a request in Tomcat if it runs through the ISAPI filter?

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Obtaining a Unique Connection ID?

Posted by Rainer Jung <ra...@kippdata.de>.
On 27.03.2009 01:21, Michael B Allen wrote:
> On Mon, Mar 23, 2009 at 10:38 AM, Michael B Allen<io...@gmail.com>  wrote:
>> On Mon, Mar 23, 2009 at 3:41 AM, Rainer Jung<ra...@kippdata.de>  wrote:
>>> Others might have better ideas, but as mentioned in the previous thread, you
>>> can forward the remote port with
>>>
>>> JkEnvVar REMOTE_PORT
>>>
>>> and retrieve it in Tomcat with
>>>
>>> request.getAttribute("REMOTE_PORT")
>>>
>>> Doesn't that work?
>> Yes, it sounds like precisely what I'm looking for. I just didn't
>> understand the significance of your previous message. I never used
>> mod_jk before so I'll have to look into this JkEnvVar thing.
>
> Now I have someone using the ISAPI filter in IIS with Tomcat who is
> also seeing getRemotePort return -1.
>
> Is there a work-around for IIS?
>
> I've modified our code to look for the REMOTE_PORT attribute. Is there
> a way to export the REMOTE_PORT attribute with the ISAPI filter?

Not at the moment. I expect us to fix this with the next version (then 
by already activating it by default).

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Obtaining a Unique Connection ID?

Posted by Michael B Allen <io...@gmail.com>.
On Mon, Mar 23, 2009 at 10:38 AM, Michael B Allen <io...@gmail.com> wrote:
> On Mon, Mar 23, 2009 at 3:41 AM, Rainer Jung <ra...@kippdata.de> wrote:
>> Others might have better ideas, but as mentioned in the previous thread, you
>> can forward the remote port with
>>
>> JkEnvVar REMOTE_PORT
>>
>> and retrieve it in Tomcat with
>>
>> request.getAttribute("REMOTE_PORT")
>>
>> Doesn't that work?
>
> Yes, it sounds like precisely what I'm looking for. I just didn't
> understand the significance of your previous message. I never used
> mod_jk before so I'll have to look into this JkEnvVar thing.

Now I have someone using the ISAPI filter in IIS with Tomcat who is
also seeing getRemotePort return -1.

Is there a work-around for IIS?

I've modified our code to look for the REMOTE_PORT attribute. Is there
a way to export the REMOTE_PORT attribute with the ISAPI filter?

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Obtaining a Unique Connection ID?

Posted by Michael B Allen <io...@gmail.com>.
On Mon, Mar 23, 2009 at 3:41 AM, Rainer Jung <ra...@kippdata.de> wrote:
> Others might have better ideas, but as mentioned in the previous thread, you
> can forward the remote port with
>
> JkEnvVar REMOTE_PORT
>
> and retrieve it in Tomcat with
>
> request.getAttribute("REMOTE_PORT")
>
> Doesn't that work?

Yes, it sounds like precisely what I'm looking for. I just didn't
understand the significance of your previous message. I never used
mod_jk before so I'll have to look into this JkEnvVar thing.

I'll try it.

Thanks,
Mike

> On 23.03.2009 02:43, Michael B Allen wrote:
>>
>> Hi Again,
>>
>> In the near term absence of getRemotePort, I am struggling to
>> determine a method for storing and retrieving per-connection state.
>>
>> Can anyone recommend another method for acquiring a unique connection
>> identifier? I would be satisfied with a platform specific method at
>> this point.
>>
>> Just to be clear as to why this is necessary, NTLMSSP is a three
>> request "handshake". So if you have a frameset with 5 frames, IE will
>> create 5 separate connections but will use the same session ID. So I
>> cannot simply store the state of the authentication in the session
>> because the multiple simultaneous authentication requests will
>> incorrectly read or overwrite that state and cause strange concurrency
>> errors. I need to store the authentication state in the session using
>> a unique connection ID (normally getRemoteAddr+getRemotePort) to keep
>> the simultaneous authentication requests straight.
>>
>> Any ideas?
>>
>> Is there a mod_jk or Tomcat specific feature that would allow me to
>> get the socket file descriptor value, or port, or unique ID through
>> HttpServletRequest.getAttribute()?
>>
>> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>



-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Obtaining a Unique Connection ID?

Posted by Rainer Jung <ra...@kippdata.de>.
Others might have better ideas, but as mentioned in the previous thread, 
you can forward the remote port with

JkEnvVar REMOTE_PORT

and retrieve it in Tomcat with

request.getAttribute("REMOTE_PORT")

Doesn't that work?

Regards,

Rainer

On 23.03.2009 02:43, Michael B Allen wrote:
> Hi Again,
>
> In the near term absence of getRemotePort, I am struggling to
> determine a method for storing and retrieving per-connection state.
>
> Can anyone recommend another method for acquiring a unique connection
> identifier? I would be satisfied with a platform specific method at
> this point.
>
> Just to be clear as to why this is necessary, NTLMSSP is a three
> request "handshake". So if you have a frameset with 5 frames, IE will
> create 5 separate connections but will use the same session ID. So I
> cannot simply store the state of the authentication in the session
> because the multiple simultaneous authentication requests will
> incorrectly read or overwrite that state and cause strange concurrency
> errors. I need to store the authentication state in the session using
> a unique connection ID (normally getRemoteAddr+getRemotePort) to keep
> the simultaneous authentication requests straight.
>
> Any ideas?
>
> Is there a mod_jk or Tomcat specific feature that would allow me to
> get the socket file descriptor value, or port, or unique ID through
> HttpServletRequest.getAttribute()?
>
> Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org