مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-01-20 06:39:47 +00:00
fix(smtp_server): updated line split logic, normalize all linebreaks to \r\n (#897)
Co-authored-by: Vishnu S <vishnu@zerodha.com>
هذا الالتزام موجود في:
@@ -147,15 +147,16 @@ module Postal
|
|||||||
# Client went away
|
# Client went away
|
||||||
eof = true
|
eof = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Normalize all \r\n and \n to \r\n
|
||||||
|
buffers[io] = buffers[io].encode(buffers[io].encoding, universal_newline: true).encode(buffers[io].encoding, crlf_newline: true)
|
||||||
|
|
||||||
# We line buffer, so look to see if we have received a newline
|
# We line buffer, so look to see if we have received a newline
|
||||||
# and keep doing so until all buffered lines have been processed.
|
# and keep doing so until all buffered lines have been processed.
|
||||||
while buffers[io].index("\n")
|
while buffers[io].index("\r\n")
|
||||||
# Extract the line
|
# Extract the line
|
||||||
if buffers[io].index("\r\n")
|
line, buffers[io] = buffers[io].split("\r\n", 2)
|
||||||
line, buffers[io] = buffers[io].split("\r\n", 2)
|
|
||||||
else
|
|
||||||
line, buffers[io] = buffers[io].split("\n", 2)
|
|
||||||
end
|
|
||||||
# Send the received line to the client object for processing
|
# Send the received line to the client object for processing
|
||||||
result = client.handle(line)
|
result = client.handle(line)
|
||||||
# If the client object returned some data, write it back to the client
|
# If the client object returned some data, write it back to the client
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم