pjfanning commented on code in PR #799:
URL: https://github.com/apache/pekko-http/pull/799#discussion_r2382417527


##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/parsing/BodyPartParser.scala:
##########
@@ -359,11 +359,30 @@ private[http] object BodyPartParser {
 
     override def defineOnce(byteString: ByteString): EndOfLineConfiguration = {
       // Hypothesis: There is either CRLF or LF as EOL, no mix possible
-      val crLfNeedle = ByteString(s"$boundary\r\n")
-      val lfNeedle = ByteString(s"$boundary\n")
-      if (byteString.containsSlice(crLfNeedle)) 
DefinedEndOfLineConfiguration("\r\n", boundary)
-      else if (byteString.containsSlice(lfNeedle)) 
DefinedEndOfLineConfiguration("\n", boundary)
-      else this
+      checkForBoundary(byteString) match {
+        case CR => DefinedEndOfLineConfiguration("\r\n", boundary)
+        case LF => DefinedEndOfLineConfiguration("\n", boundary)
+        case _  => this
+      }
+    }
+
+    private val CR = '\r'.toByte
+    private val LF = '\n'.toByte

Review Comment:
   I created HttpConstants and will follow up with another PR that makes more 
use if it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to