kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From granthe...@apache.org
Subject [kudu] 01/02: webserver: update to latest squeasel build
Date Tue, 02 Jul 2019 01:28:41 GMT
This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit c82ba1cf7a55156f1b58e9c42eb287a93849f328
Author: Todd Lipcon <todd@apache.org>
AuthorDate: Tue Jun 25 13:55:10 2019 -0700

    webserver: update to latest squeasel build
    
    The newest version of squeasel changes the callback API to allow for
    keepalive and fixes a few SSL-related items:
    
    6868951 Fix memory leak of ECDH key
    8c9db13 Remove compile-time checks for OpenSSL > 1.0.0
    f59d50f Fix vargs usage
    89897f8 Allow request callbacks to specify whether the connection is in a valid state
    a0a04ca Fix shutdown to proceed quickly when keepalive is enabled
    61adce4 Don't send HTTP 500 when closing keepalive connection
    d237491 Don't log EAGAIN when reading
    8aa6177 Add support for ECDH ciphers
    0f61227 Add contribution guidelines
    
    Change-Id: Iab0ba2e4ae5fbd0e0c1ed688b9706c4e4423b179
    Reviewed-on: http://gerrit.cloudera.org:8080/13728
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
---
 src/kudu/server/webserver.cc | 31 +++++++++++++++++--------------
 src/kudu/server/webserver.h  | 22 +++++++++++-----------
 thirdparty/vars.sh           |  2 +-
 3 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/src/kudu/server/webserver.cc b/src/kudu/server/webserver.cc
index 7e92a3e..794aa26 100644
--- a/src/kudu/server/webserver.cc
+++ b/src/kudu/server/webserver.cc
@@ -438,14 +438,16 @@ int Webserver::LogMessageCallbackStatic(const struct sq_connection*
/*connection
   return 0;
 }
 
-int Webserver::BeginRequestCallbackStatic(struct sq_connection* connection) {
+sq_callback_result_t Webserver::BeginRequestCallbackStatic(
+    struct sq_connection* connection) {
   struct sq_request_info* request_info = sq_get_request_info(connection);
   Webserver* instance = reinterpret_cast<Webserver*>(request_info->user_data);
   return instance->BeginRequestCallback(connection, request_info);
 }
 
-int Webserver::BeginRequestCallback(struct sq_connection* connection,
-                                    struct sq_request_info* request_info) {
+sq_callback_result_t Webserver::BeginRequestCallback(
+    struct sq_connection* connection,
+    struct sq_request_info* request_info) {
   if (opts_.require_spnego) {
     const char* authz_header = sq_get_header(connection, "Authorization");
     string resp_header, authn_princ;
@@ -454,7 +456,7 @@ int Webserver::BeginRequestCallback(struct sq_connection* connection,
       SendPlainResponse(connection, "401 Authentication Required",
                          "Must authenticate with SPNEGO.",
                          { resp_header });
-      return 1;
+      return SQ_HANDLED_OK;
     }
     if (s.ok() && authn_princ.empty()) {
       s = Status::RuntimeError("SPNEGO indicated complete, but got empty principal");
@@ -473,7 +475,7 @@ int Webserver::BeginRequestCallback(struct sq_connection* connection,
           "500 Internal Server Error";
 
       SendPlainResponse(connection, http_status, s.ToString(), {});
-      return 1;
+      return SQ_HANDLED_OK;
     }
 
     if (opts_.spnego_post_authn_callback) {
@@ -537,13 +539,13 @@ int Webserver::BeginRequestCallback(struct sq_connection* connection,
       // to the default handler which will serve files.
       if (!opts_.doc_root.empty() && opts_.enable_doc_root) {
         VLOG(2) << "HTTP File access: " << request_info->uri;
-        return 0;
+        return SQ_CONTINUE_HANDLING;
       }
       sq_printf(connection,
                 "HTTP/1.1 %s\r\nContent-Type: text/plain\r\n\r\n",
                 HttpStatusCodeToString(HttpStatusCode::NotFound).c_str());
       sq_printf(connection, "No handler for URI %s\r\n\r\n", request_info->uri);
-      return 1;
+      return SQ_HANDLED_OK;
     }
     handler = it->second;
   }
@@ -551,9 +553,10 @@ int Webserver::BeginRequestCallback(struct sq_connection* connection,
   return RunPathHandler(*handler, connection, request_info);
 }
 
-int Webserver::RunPathHandler(const PathHandler& handler,
-                              struct sq_connection* connection,
-                              struct sq_request_info* request_info) {
+sq_callback_result_t Webserver::RunPathHandler(
+    const PathHandler& handler,
+    struct sq_connection* connection,
+    struct sq_request_info* request_info) {
   // Should we render with css styles?
   bool use_style = true;
 
@@ -571,7 +574,7 @@ int Webserver::RunPathHandler(const PathHandler& handler,
       sq_printf(connection,
                 "HTTP/1.1 %s\r\n",
                 HttpStatusCodeToString(HttpStatusCode::LengthRequired).c_str());
-      return 1;
+      return SQ_HANDLED_CLOSE_CONNECTION;
     }
     if (content_len > FLAGS_webserver_max_post_length_bytes) {
       // TODO(wdb): for this and other HTTP requests, we should log the
@@ -580,7 +583,7 @@ int Webserver::RunPathHandler(const PathHandler& handler,
       sq_printf(connection,
                 "HTTP/1.1 %s\r\n",
                 HttpStatusCodeToString(HttpStatusCode::RequestEntityTooLarge).c_str());
-      return 1;
+      return SQ_HANDLED_CLOSE_CONNECTION;
     }
 
     char buf[8192];
@@ -594,7 +597,7 @@ int Webserver::RunPathHandler(const PathHandler& handler,
         sq_printf(connection,
                   "HTTP/1.1 %s\r\n",
                   HttpStatusCodeToString(HttpStatusCode::InternalServerError).c_str());
-        return 1;
+        return SQ_HANDLED_CLOSE_CONNECTION;
       }
 
       req.post_data.append(buf, n);
@@ -666,7 +669,7 @@ int Webserver::RunPathHandler(const PathHandler& handler,
   // Make sure to use sq_write for printing the body; sq_printf truncates at 8KB.
   sq_write(connection, headers.c_str(), headers.length());
   sq_write(connection, full_content.c_str(), full_content.length());
-  return 1;
+  return SQ_HANDLED_OK;
 }
 
 void Webserver::RegisterPathHandler(const string& path, const string& alias,
diff --git a/src/kudu/server/webserver.h b/src/kudu/server/webserver.h
index 0c47479..728b539 100644
--- a/src/kudu/server/webserver.h
+++ b/src/kudu/server/webserver.h
@@ -23,6 +23,8 @@
 #include <utility>
 #include <vector>
 
+#include <squeasel.h>
+
 #include "kudu/gutil/port.h"
 #include "kudu/server/webserver_options.h"
 #include "kudu/util/net/sockaddr.h"
@@ -30,10 +32,6 @@
 #include "kudu/util/status.h"
 #include "kudu/util/web_callback_registry.h"
 
-struct sq_connection; // IWYU pragma: keep
-struct sq_request_info; // IWYU pragma: keep
-struct sq_context; // IWYU pragma: keep
-
 namespace kudu {
 
 class EasyJson;
@@ -138,13 +136,15 @@ class Webserver : public WebCallbackRegistry {
 
   // Dispatch point for all incoming requests.
   // Static so that it can act as a function pointer, and then call the next method
-  static int BeginRequestCallbackStatic(struct sq_connection* connection);
-  int BeginRequestCallback(struct sq_connection* connection,
-                           struct sq_request_info* request_info);
-
-  int RunPathHandler(const PathHandler& handler,
-                     struct sq_connection* connection,
-                     struct sq_request_info* request_info);
+  static sq_callback_result_t BeginRequestCallbackStatic(struct sq_connection* connection);
+  sq_callback_result_t BeginRequestCallback(
+      struct sq_connection* connection,
+      struct sq_request_info* request_info);
+
+  sq_callback_result_t RunPathHandler(
+      const PathHandler& handler,
+      struct sq_connection* connection,
+      struct sq_request_info* request_info);
 
   // Callback to funnel mongoose logs through glog.
   static int LogMessageCallbackStatic(const struct sq_connection* connection,
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index ed8303e..fdabdaa 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -97,7 +97,7 @@ RAPIDJSON_SOURCE=$TP_SOURCE_DIR/$RAPIDJSON_NAME
 #  export NAME=squeasel-$(git rev-parse HEAD)
 #  git archive HEAD --prefix=$NAME/ -o /tmp/$NAME.tar.gz
 #  s3cmd put -P /tmp/$NAME.tar.gz s3://cloudera-thirdparty-libs/$NAME.tar.gz
-SQUEASEL_VERSION=9335b81317a6451d5a37c5dc7ec088eecbf68c82
+SQUEASEL_VERSION=7973705170f4744d1806e32695f7ea1e8308ee95
 SQUEASEL_NAME=squeasel-$SQUEASEL_VERSION
 SQUEASEL_SOURCE=$TP_SOURCE_DIR/$SQUEASEL_NAME
 


Mime
View raw message