Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ergo sending BATCH to the client without previous negotiation #2066

Closed
julio-b opened this issue May 26, 2023 · 1 comment
Closed

Ergo sending BATCH to the client without previous negotiation #2066

julio-b opened this issue May 26, 2023 · 1 comment
Milestone

Comments

@julio-b
Copy link

julio-b commented May 26, 2023

Steps to reproduce

request draft/chathistory but do not request batch

Actual behavior

trimmed down a bit

C: CAP REQ :draft/chathistory
...
C: CHATHISTORY TARGETS timestamp=2023-01-01T00:00:00.000Z timestamp=2023-01-02T00:00:00.000Z 50
S: ergo BATCH +1 draft/chathistory-targets
S: ergo BATCH -1

Expected behavior

server should never send BATCH to the client because it was never requested

Code

As you can see in irc/handlers.go:657 batch is used without checking client's capabilities.

@slingamn
Copy link
Member

Thanks! It looks like for normal chathistory subcommands (LATEST, AFTER, etc.), this is properly gated on the capability:

ergo/irc/responsebuffer.go

Lines 224 to 233 in bf33fba

func (rb *ResponseBuffer) StartNestedHistoryBatch(params ...string) (batchID string) {
var batchType string
if rb.session.capabilities.Has(caps.Batch) {
batchType = "chathistory"
}
if batchType != "" {
batchID = rb.StartNestedBatch(batchType, params...)
}
return
}

but I forgot to do it for TARGETS.

@slingamn slingamn added this to the v2.12.0 milestone May 28, 2023
slingamn added a commit that referenced this issue May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants