[ 
https://issues.apache.org/jira/browse/CAMEL-27799?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27799:
--------------------------------
    Description: 
Found while improving the option descriptions of camel-chatscript for 
CAMEL-23832 (commit 
https://github.com/apache/camel/commit/8a5ecaf41ffca0f81f3d680155485d5214951a59,
 pull request https://github.com/apache/camel/pull/31137).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. The conversation start is sent once per endpoint, not per user
In {{ChatScriptBot}}, the {{initialized}} flag belongs to the one bot of the 
endpoint. Only the first message through the endpoint gets the empty message 
that starts a conversation; later messages for another username go out without 
one, which the code comments and the doc say the protocol requires. The flag is 
not thread-safe either: with resetChat=true, concurrent exchanges reset and set 
it against each other.
Proposed change: keep the started users in a concurrent set keyed by username.

h4. 2. chatscript:host:1024/ gives an empty bot name
getPath() is "/", so the URI checks pass and botName becomes "" although it is 
required.
Proposed change: check botName after substring(1).

h4. 3. Minor
The reply is read with a single readLine(), so a reply with a line break is 
cut; request and reply use the platform default charset; a failed :reset is 
only logged as WARN; the 30 s connect and read timeouts are hard-coded.


_Claude Code on behalf of davsclaus_

  was:
Found while improving the option descriptions of camel-chatscript for 
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31137).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. The conversation start is sent once per endpoint, not per user
In {{ChatScriptBot}}, the {{initialized}} flag belongs to the one bot of the 
endpoint. Only the first message through the endpoint gets the empty message 
that starts a conversation; later messages for another username go out without 
one, which the code comments and the doc say the protocol requires. The flag is 
not thread-safe either: with resetChat=true, concurrent exchanges reset and set 
it against each other.
Proposed change: keep the started users in a concurrent set keyed by username.

h4. 2. chatscript:host:1024/ gives an empty bot name
getPath() is "/", so the URI checks pass and botName becomes "" although it is 
required.
Proposed change: check botName after substring(1).

h4. 3. Minor
The reply is read with a single readLine(), so a reply with a line break is 
cut; request and reply use the platform default charset; a failed :reset is 
only logged as WARN; the 30 s connect and read timeouts are hard-coded.


_Claude Code on behalf of davsclaus_


> camel-chatscript: the conversation start is sent once per endpoint, not per 
> user; an empty bot name passes
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27799
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27799
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-chatscript for 
> CAMEL-23832 (commit 
> https://github.com/apache/camel/commit/8a5ecaf41ffca0f81f3d680155485d5214951a59,
>  pull request https://github.com/apache/camel/pull/31137).
> These are separate problems of the component; the descriptions change only 
> documents the current behavior.
> h4. 1. The conversation start is sent once per endpoint, not per user
> In {{ChatScriptBot}}, the {{initialized}} flag belongs to the one bot of the 
> endpoint. Only the first message through the endpoint gets the empty message 
> that starts a conversation; later messages for another username go out 
> without one, which the code comments and the doc say the protocol requires. 
> The flag is not thread-safe either: with resetChat=true, concurrent exchanges 
> reset and set it against each other.
> Proposed change: keep the started users in a concurrent set keyed by username.
> h4. 2. chatscript:host:1024/ gives an empty bot name
> getPath() is "/", so the URI checks pass and botName becomes "" although it 
> is required.
> Proposed change: check botName after substring(1).
> h4. 3. Minor
> The reply is read with a single readLine(), so a reply with a line break is 
> cut; request and reply use the platform default charset; a failed :reset is 
> only logged as WARN; the 30 s connect and read timeouts are hard-coded.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to