Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Jetty Http Request/Response Header Size Configuration #266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions server/src/main/scala/com/cloudera/livy/LivyConf.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ object LivyConf {

val SERVER_HOST = Entry("livy.server.host", "0.0.0.0")
val SERVER_PORT = Entry("livy.server.port", 8998)
val HTTP_REQUEST_HEADER_SIZE = Entry("livy.http.request.header.size", 131072)
val HTTP_RESPONSE_HEADER_SIZE = Entry("livy.http.response.header.size", 131072)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename the configurations to "livy.server.request_header.size" and "livy.server.response_header.size", also it would be better to add some comments for these two configurations to describe why we have to change the default size.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

livy.server.request-header.size
livy.server.response-header.size

val CSRF_PROTECTION = LivyConf.Entry("livy.server.csrf_protection.enabled", false)

val IMPERSONATION_ENABLED = Entry("livy.impersonation.enabled", false)
Expand Down
10 changes: 9 additions & 1 deletion server/src/main/scala/com/cloudera/livy/server/WebServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,20 @@ class WebServer(livyConf: LivyConf, var host: String, var port: Int) extends Log
server.setStopTimeout(1000)
server.setStopAtShutdown(true)

val requestHeaderSize = livyConf.getInt(LivyConf.HTTP_REQUEST_HEADER_SIZE)
val responseHeaderSize = livyConf.getInt(LivyConf.HTTP_RESPONSE_HEADER_SIZE)

val (connector, protocol) = Option(livyConf.get(WebServer.KeystoreKey)) match {
case None =>
(new ServerConnector(server), "http")
val http = new HttpConfiguration()
http.setRequestHeaderSize(requestHeaderSize)
http.setResponseHeaderSize(responseHeaderSize)
(new ServerConnector(server, new HttpConnectionFactory(http)), "http")

case Some(keystore) =>
val https = new HttpConfiguration()
https.setRequestHeaderSize(requestHeaderSize)
https.setResponseHeaderSize(responseHeaderSize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this HttpConfiguration to above to remove the duplications.

https.addCustomizer(new SecureRequestCustomizer())

val sslContextFactory = new SslContextFactory()
Expand Down