You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mc...@apache.org on 2020/08/27 21:47:29 UTC
[openwhisk] 01/01: Add defensive code to the controller for when it
gets bad query parameters
This is an automated email from the ASF dual-hosted git repository.
mcdan pushed a commit to branch mcdan/controller-params-parsing
in repository https://gitbox.apache.org/repos/asf/openwhisk.git
commit 98d4d109f3223eaa7110572be03b17f83d7e211a
Author: mcweeney <mc...@adobe.com>
AuthorDate: Thu Aug 27 15:19:48 2020 -0400
Add defensive code to the controller for when it gets bad query parameters
---
.../scala/org/apache/openwhisk/http/BasicHttpService.scala | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/common/scala/src/main/scala/org/apache/openwhisk/http/BasicHttpService.scala b/common/scala/src/main/scala/org/apache/openwhisk/http/BasicHttpService.scala
index 27f1be9..352fb5e 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/http/BasicHttpService.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/http/BasicHttpService.scala
@@ -120,7 +120,15 @@ trait BasicHttpService extends Directives {
protected def logRequestInfo(req: HttpRequest)(implicit tid: TransactionId): LogEntry = {
val m = req.method.name
val p = req.uri.path.toString
- val q = req.uri.query().toString
+
+ val q: String = {
+ try {
+ req.uri.query().toString
+ } catch {
+ case e: IllegalUriException => s"Bad query parameters:${req.uri.toString()}"
+ case e: Exception => s"Query parsing error: ${e.getMessage}"
+ }
+ }
val l = loglevelForRoute(p)
LogEntry(s"[$tid] $m $p $q", l)
}