Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith257 committed Sep 28, 2024
1 parent 90499c9 commit 68149dd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion zio-http/shared/src/main/scala/zio/http/Routes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,16 @@ final case class Routes[-Env, +Err](routes: Chunk[zio.http.Route[Env, Err]]) { s
private def validateHeaders(req: Request): Handler[Any, Response, Request, Response] = {
val invalidHeaderChars = Set('\r', '\n', '\u0000')

ZIO.logInfo(s"Validating headers for request: ${req.headers}")

// Check if any header contains invalid characters
val hasInvalidChar = req.headers.toList.exists { header =>
header.renderedValue.exists(invalidHeaderChars.contains)
// header.renderedValue.exists(invalidHeaderChars.contains)
val hasInvalid = header.renderedValue.exists(invalidHeaderChars.contains)
if (hasInvalid) {
ZIO.logInfo(s"Invalid header found: ${header.name} -> ${header.renderedValue}")
}
hasInvalid
}

if (hasInvalidChar) {
Expand Down

0 comments on commit 68149dd

Please sign in to comment.