Skip to content

Commit

Permalink
Fix SORT and THREAD command when UTF8=ACCEPT.
Browse files Browse the repository at this point in the history
Looks like Errata 4029 was misinterpreted here.
SORT and THREAD have mandatory charset requirements,
therefore we MUST send the UTF-8 specifier.
  • Loading branch information
mrubinsk committed Mar 2, 2019
1 parent 4bd22d8 commit 8658aa5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/Horde/Imap/Client/Socket.php
Expand Up @@ -2405,10 +2405,12 @@ protected function _search($query, $options)
$cmd->add($tmp);

/* Charset is mandatory for SORT (RFC 5256 [3]).
* However, if UTF-8 support is activated, a client MUST NOT
* send the charset specification (RFC 6855 [3]; Errata 4029). */
* If UTF-8 support is activated, a client MUST ONLY
* send the 'UTF-8' specification (RFC 6855 [3]; Errata 4029). */
if (!$this->_capability()->isEnabled('UTF8=ACCEPT')) {
$cmd->add($charset);
} else {
$cmd->add('UTF-8');
}
} else {
$cmd = $this->_command(
Expand Down Expand Up @@ -2753,11 +2755,14 @@ protected function _thread($options)
empty($options['sequence']) ? 'UID THREAD' : 'THREAD'
)->add($tsort);

/* If UTF-8 support is activated, a client MUST NOT
* send the charset specification (RFC 6855 [3]; Errata 4029). */
/* If UTF-8 support is activated, a client MUST send the UTF-8
* charset specification since charset is mandatory for this
* command (RFC 6855 [3]; Errata 4029). */
if (empty($options['search'])) {
if (!$this->_capability()->isEnabled('UTF8=ACCEPT')) {
$cmd->add('US-ASCII');
} else {
$cmd->add('UTF-8');
}
$cmd->add('ALL');
} else {
Expand Down

0 comments on commit 8658aa5

Please sign in to comment.