File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -274,15 +274,17 @@ const handlers = {
274274 saslAuth . account + '\0' +
275275 saslAuth . password ;
276276 const b = Buffer . from ( auth_str , 'utf8' ) ;
277- let b64 = b . toString ( 'base64' ) ;
277+ const b64 = b . toString ( 'base64' ) ;
278278
279- while ( b64 . length >= 400 ) {
280- handler . connection . write ( 'AUTHENTICATE ' + b64 . slice ( 0 , 399 ) ) ;
281- b64 = b64 . slice ( 399 ) ;
279+ // https://ircv3.net/specs/extensions/sasl-3.1#the-authenticate-command
280+ const singleAuthCommandLength = 400 ;
281+ let sliceOffset = 0 ;
282+
283+ while ( b64 . length > sliceOffset ) {
284+ handler . connection . write ( 'AUTHENTICATE ' + b64 . substr ( sliceOffset , singleAuthCommandLength ) ) ;
285+ sliceOffset += singleAuthCommandLength ;
282286 }
283- if ( b64 . length > 0 ) {
284- handler . connection . write ( 'AUTHENTICATE ' + b64 ) ;
285- } else {
287+ if ( b64 . length === sliceOffset ) {
286288 handler . connection . write ( 'AUTHENTICATE +' ) ;
287289 }
288290 } ,
You can’t perform that action at this time.
0 commit comments