You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2014/04/28 12:55:22 UTC
svn commit: r1590597 [1/14] - in /httpd/httpd/trunk/modules/spdy: ./ apache/
apache/filters/ apache/testing/ common/ common/testing/ support/
support/base/ support/base/metrics/ support/build/ support/install/
support/install/common/ support/install/de...
Author: jim
Date: Mon Apr 28 10:55:17 2014
New Revision: 1590597
URL: http://svn.apache.org/r1590597
Log:
Fold in mod_spdy source
NOTE: THIS IS THE INITIAL LOAD OF THE SRC AS-IS AND AS DONATED
Added:
httpd/httpd/trunk/modules/spdy/
httpd/httpd/trunk/modules/spdy/apache/
httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.cc
httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.h (with props)
httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.cc
httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.h (with props)
httpd/httpd/trunk/modules/spdy/apache/config_commands.cc
httpd/httpd/trunk/modules/spdy/apache/config_commands.h (with props)
httpd/httpd/trunk/modules/spdy/apache/config_util.cc
httpd/httpd/trunk/modules/spdy/apache/config_util.h (with props)
httpd/httpd/trunk/modules/spdy/apache/filters/
httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.cc
httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.h (with props)
httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter_test.cc
httpd/httpd/trunk/modules/spdy/apache/filters/server_push_filter.cc
httpd/httpd/trunk/modules/spdy/apache/filters/server_push_filter.h (with props)
httpd/httpd/trunk/modules/spdy/apache/filters/server_push_filter_test.cc
httpd/httpd/trunk/modules/spdy/apache/filters/spdy_to_http_filter.cc
httpd/httpd/trunk/modules/spdy/apache/filters/spdy_to_http_filter.h (with props)
httpd/httpd/trunk/modules/spdy/apache/filters/spdy_to_http_filter_test.cc
httpd/httpd/trunk/modules/spdy/apache/id_pool.cc
httpd/httpd/trunk/modules/spdy/apache/id_pool.h (with props)
httpd/httpd/trunk/modules/spdy/apache/id_pool_test.cc
httpd/httpd/trunk/modules/spdy/apache/log_message_handler.cc
httpd/httpd/trunk/modules/spdy/apache/log_message_handler.h (with props)
httpd/httpd/trunk/modules/spdy/apache/master_connection_context.cc
httpd/httpd/trunk/modules/spdy/apache/master_connection_context.h (with props)
httpd/httpd/trunk/modules/spdy/apache/pool_util.cc
httpd/httpd/trunk/modules/spdy/apache/pool_util.h (with props)
httpd/httpd/trunk/modules/spdy/apache/pool_util_test.cc
httpd/httpd/trunk/modules/spdy/apache/slave_connection.cc
httpd/httpd/trunk/modules/spdy/apache/slave_connection.h (with props)
httpd/httpd/trunk/modules/spdy/apache/slave_connection_api.cc
httpd/httpd/trunk/modules/spdy/apache/slave_connection_api.h (with props)
httpd/httpd/trunk/modules/spdy/apache/slave_connection_context.cc
httpd/httpd/trunk/modules/spdy/apache/slave_connection_context.h (with props)
httpd/httpd/trunk/modules/spdy/apache/sockaddr_util.cc
httpd/httpd/trunk/modules/spdy/apache/sockaddr_util.h (with props)
httpd/httpd/trunk/modules/spdy/apache/sockaddr_util_test.cc
httpd/httpd/trunk/modules/spdy/apache/ssl_util.cc
httpd/httpd/trunk/modules/spdy/apache/ssl_util.h (with props)
httpd/httpd/trunk/modules/spdy/apache/testing/
httpd/httpd/trunk/modules/spdy/apache/testing/dummy_util_filter.cc
httpd/httpd/trunk/modules/spdy/apache/testing/spdy_apache_test_main.cc
httpd/httpd/trunk/modules/spdy/common/
httpd/httpd/trunk/modules/spdy/common/VERSION
httpd/httpd/trunk/modules/spdy/common/executor.cc
httpd/httpd/trunk/modules/spdy/common/executor.h (with props)
httpd/httpd/trunk/modules/spdy/common/http_request_visitor_interface.cc
httpd/httpd/trunk/modules/spdy/common/http_request_visitor_interface.h (with props)
httpd/httpd/trunk/modules/spdy/common/http_response_parser.cc
httpd/httpd/trunk/modules/spdy/common/http_response_parser.h (with props)
httpd/httpd/trunk/modules/spdy/common/http_response_parser_test.cc
httpd/httpd/trunk/modules/spdy/common/http_response_visitor_interface.cc
httpd/httpd/trunk/modules/spdy/common/http_response_visitor_interface.h (with props)
httpd/httpd/trunk/modules/spdy/common/http_string_builder.cc
httpd/httpd/trunk/modules/spdy/common/http_string_builder.h (with props)
httpd/httpd/trunk/modules/spdy/common/http_to_spdy_converter.cc
httpd/httpd/trunk/modules/spdy/common/http_to_spdy_converter.h (with props)
httpd/httpd/trunk/modules/spdy/common/http_to_spdy_converter_test.cc
httpd/httpd/trunk/modules/spdy/common/protocol_util.cc
httpd/httpd/trunk/modules/spdy/common/protocol_util.h (with props)
httpd/httpd/trunk/modules/spdy/common/protocol_util_test.cc
httpd/httpd/trunk/modules/spdy/common/server_push_discovery_learner.cc
httpd/httpd/trunk/modules/spdy/common/server_push_discovery_learner.h (with props)
httpd/httpd/trunk/modules/spdy/common/server_push_discovery_learner_test.cc
httpd/httpd/trunk/modules/spdy/common/server_push_discovery_session.cc
httpd/httpd/trunk/modules/spdy/common/server_push_discovery_session.h (with props)
httpd/httpd/trunk/modules/spdy/common/server_push_discovery_session_test.cc
httpd/httpd/trunk/modules/spdy/common/shared_flow_control_window.cc
httpd/httpd/trunk/modules/spdy/common/shared_flow_control_window.h (with props)
httpd/httpd/trunk/modules/spdy/common/shared_flow_control_window_test.cc
httpd/httpd/trunk/modules/spdy/common/spdy_frame_priority_queue.cc
httpd/httpd/trunk/modules/spdy/common/spdy_frame_priority_queue.h (with props)
httpd/httpd/trunk/modules/spdy/common/spdy_frame_priority_queue_test.cc
httpd/httpd/trunk/modules/spdy/common/spdy_frame_queue.cc
httpd/httpd/trunk/modules/spdy/common/spdy_frame_queue.h (with props)
httpd/httpd/trunk/modules/spdy/common/spdy_frame_queue_test.cc
httpd/httpd/trunk/modules/spdy/common/spdy_server_config.cc
httpd/httpd/trunk/modules/spdy/common/spdy_server_config.h (with props)
httpd/httpd/trunk/modules/spdy/common/spdy_server_push_interface.cc
httpd/httpd/trunk/modules/spdy/common/spdy_server_push_interface.h (with props)
httpd/httpd/trunk/modules/spdy/common/spdy_session.cc
httpd/httpd/trunk/modules/spdy/common/spdy_session.h (with props)
httpd/httpd/trunk/modules/spdy/common/spdy_session_io.cc
httpd/httpd/trunk/modules/spdy/common/spdy_session_io.h (with props)
httpd/httpd/trunk/modules/spdy/common/spdy_session_test.cc
httpd/httpd/trunk/modules/spdy/common/spdy_stream.cc
httpd/httpd/trunk/modules/spdy/common/spdy_stream.h (with props)
httpd/httpd/trunk/modules/spdy/common/spdy_stream_task_factory.cc
httpd/httpd/trunk/modules/spdy/common/spdy_stream_task_factory.h (with props)
httpd/httpd/trunk/modules/spdy/common/spdy_stream_test.cc
httpd/httpd/trunk/modules/spdy/common/spdy_to_http_converter.cc
httpd/httpd/trunk/modules/spdy/common/spdy_to_http_converter.h (with props)
httpd/httpd/trunk/modules/spdy/common/spdy_to_http_converter_test.cc
httpd/httpd/trunk/modules/spdy/common/testing/
httpd/httpd/trunk/modules/spdy/common/testing/async_task_runner.cc
httpd/httpd/trunk/modules/spdy/common/testing/async_task_runner.h (with props)
httpd/httpd/trunk/modules/spdy/common/testing/notification.cc
httpd/httpd/trunk/modules/spdy/common/testing/notification.h (with props)
httpd/httpd/trunk/modules/spdy/common/testing/spdy_frame_matchers.cc
httpd/httpd/trunk/modules/spdy/common/testing/spdy_frame_matchers.h (with props)
httpd/httpd/trunk/modules/spdy/common/thread_pool.cc
httpd/httpd/trunk/modules/spdy/common/thread_pool.h (with props)
httpd/httpd/trunk/modules/spdy/common/thread_pool_test.cc
httpd/httpd/trunk/modules/spdy/common/version.h.in (with props)
httpd/httpd/trunk/modules/spdy/mod_spdy.cc
httpd/httpd/trunk/modules/spdy/mod_spdy.gyp
httpd/httpd/trunk/modules/spdy/mod_spdy.h (with props)
httpd/httpd/trunk/modules/spdy/support/
httpd/httpd/trunk/modules/spdy/support/DEPS
httpd/httpd/trunk/modules/spdy/support/base/
httpd/httpd/trunk/modules/spdy/support/base/base.gyp
httpd/httpd/trunk/modules/spdy/support/base/metrics/
httpd/httpd/trunk/modules/spdy/support/base/metrics/stats_table.cc
httpd/httpd/trunk/modules/spdy/support/build/
httpd/httpd/trunk/modules/spdy/support/build/all.gyp
httpd/httpd/trunk/modules/spdy/support/build/build_config.h (with props)
httpd/httpd/trunk/modules/spdy/support/build/build_util.gyp
httpd/httpd/trunk/modules/spdy/support/build/common.gypi
httpd/httpd/trunk/modules/spdy/support/build/compiler_version.py (with props)
httpd/httpd/trunk/modules/spdy/support/build/dir_exists.py (with props)
httpd/httpd/trunk/modules/spdy/support/build/features_override.gypi
httpd/httpd/trunk/modules/spdy/support/build/gyp_chromium
httpd/httpd/trunk/modules/spdy/support/build/gyp_helper.py (with props)
httpd/httpd/trunk/modules/spdy/support/build/install.gyp
httpd/httpd/trunk/modules/spdy/support/build/output_dll_copy.rules (with props)
httpd/httpd/trunk/modules/spdy/support/build/release.gypi
httpd/httpd/trunk/modules/spdy/support/build/version.py (with props)
httpd/httpd/trunk/modules/spdy/support/build_modssl_with_npn.sh (with props)
httpd/httpd/trunk/modules/spdy/support/install/
httpd/httpd/trunk/modules/spdy/support/install/common/
httpd/httpd/trunk/modules/spdy/support/install/common/BRANDING
httpd/httpd/trunk/modules/spdy/support/install/common/apt.include
httpd/httpd/trunk/modules/spdy/support/install/common/installer.include
httpd/httpd/trunk/modules/spdy/support/install/common/mod-spdy.info
httpd/httpd/trunk/modules/spdy/support/install/common/repo.cron
httpd/httpd/trunk/modules/spdy/support/install/common/rpm.include
httpd/httpd/trunk/modules/spdy/support/install/common/rpmrepo.cron
httpd/httpd/trunk/modules/spdy/support/install/common/spdy.conf.template
httpd/httpd/trunk/modules/spdy/support/install/common/spdy.load.template
httpd/httpd/trunk/modules/spdy/support/install/common/ssl.load.template
httpd/httpd/trunk/modules/spdy/support/install/common/updater (with props)
httpd/httpd/trunk/modules/spdy/support/install/common/variables.include
httpd/httpd/trunk/modules/spdy/support/install/debian/
httpd/httpd/trunk/modules/spdy/support/install/debian/build.sh (with props)
httpd/httpd/trunk/modules/spdy/support/install/debian/changelog.template
httpd/httpd/trunk/modules/spdy/support/install/debian/conffiles.template
httpd/httpd/trunk/modules/spdy/support/install/debian/control.template
httpd/httpd/trunk/modules/spdy/support/install/debian/postinst (with props)
httpd/httpd/trunk/modules/spdy/support/install/debian/postrm (with props)
httpd/httpd/trunk/modules/spdy/support/install/debian/preinst
httpd/httpd/trunk/modules/spdy/support/install/debian/prerm (with props)
httpd/httpd/trunk/modules/spdy/support/install/rpm/
httpd/httpd/trunk/modules/spdy/support/install/rpm/build.sh (with props)
httpd/httpd/trunk/modules/spdy/support/install/rpm/mod-spdy.spec.template
httpd/httpd/trunk/modules/spdy/support/net/
httpd/httpd/trunk/modules/spdy/support/net/instaweb/
httpd/httpd/trunk/modules/spdy/support/net/net.gyp
httpd/httpd/trunk/modules/spdy/support/scripts/
httpd/httpd/trunk/modules/spdy/support/scripts/loadtest.py (with props)
httpd/httpd/trunk/modules/spdy/support/scripts/mod_ssl_with_npn.patch
httpd/httpd/trunk/modules/spdy/support/third_party/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/apr.gyp
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/linux/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/linux/ia32/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/linux/ia32/include/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/linux/ia32/include/apr.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/linux/ia32/include/apr_private.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/linux/x64/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/linux/x64/include/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/linux/x64/include/apr.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/linux/x64/include/apr_private.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/mac/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/mac/ia32/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/mac/ia32/include/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/mac/ia32/include/apr.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/apr/gen/arch/mac/ia32/include/apr_private.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/aprutil.gyp
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/ia32/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/ia32/include/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/ia32/include/apr_ldap.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/ia32/include/apu.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/ia32/include/apu_want.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/ia32/include/private/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/ia32/include/private/apu_config.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/ia32/include/private/apu_select_dbm.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/x64/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/x64/include/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/x64/include/apr_ldap.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/x64/include/apu.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/x64/include/apu_want.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/x64/include/private/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/x64/include/private/apu_config.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/linux/x64/include/private/apu_select_dbm.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/mac/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/mac/ia32/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/mac/ia32/include/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/mac/ia32/include/apr_ldap.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/mac/ia32/include/apu.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/mac/ia32/include/apu_want.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/mac/ia32/include/private/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/mac/ia32/include/private/apu_config.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/aprutil/gen/arch/mac/ia32/include/private/apu_select_dbm.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/linux/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/linux/ia32/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/linux/ia32/include/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/linux/ia32/include/ap_config_auto.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/linux/ia32/include/ap_config_layout.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/linux/x64/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/linux/x64/include/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/linux/x64/include/ap_config_auto.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/linux/x64/include/ap_config_layout.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/mac/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/mac/ia32/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/mac/ia32/include/
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/mac/ia32/include/ap_config_auto.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/gen/arch/mac/ia32/include/ap_config_layout.h (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/apache/httpd/httpd.gyp
httpd/httpd/trunk/modules/spdy/support/third_party/mod_diagnostics/
httpd/httpd/trunk/modules/spdy/support/third_party/mod_diagnostics/mod_diagnostics.c (with props)
httpd/httpd/trunk/modules/spdy/support/third_party/mod_diagnostics/mod_diagnostics.gyp
Added: httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.cc
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.cc?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.cc (added)
+++ httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.cc Mon Apr 28 10:55:17 2014
@@ -0,0 +1,187 @@
+// Copyright 2011 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "mod_spdy/apache/apache_spdy_session_io.h"
+
+#include "apr_buckets.h"
+#include "http_log.h"
+#include "util_filter.h"
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "mod_spdy/apache/pool_util.h" // for AprStatusString
+#include "mod_spdy/common/protocol_util.h" // for FrameData
+#include "net/spdy/buffered_spdy_framer.h"
+#include "net/spdy/spdy_protocol.h"
+
+namespace mod_spdy {
+
+namespace {
+
+// How many bytes to ask for at a time when pulling data from the connection
+// input filters. We use non-blocking reads, so we'll sometimes get less than
+// this.
+const apr_off_t kReadBytes = 4096;
+
+} // namespace
+
+ApacheSpdySessionIO::ApacheSpdySessionIO(conn_rec* connection)
+ : connection_(connection),
+ input_brigade_(apr_brigade_create(connection_->pool,
+ connection_->bucket_alloc)),
+ output_brigade_(apr_brigade_create(connection_->pool,
+ connection_->bucket_alloc)) {}
+
+ApacheSpdySessionIO::~ApacheSpdySessionIO() {}
+
+bool ApacheSpdySessionIO::IsConnectionAborted() {
+ return static_cast<bool>(connection_->aborted);
+}
+
+SpdySessionIO::ReadStatus ApacheSpdySessionIO::ProcessAvailableInput(
+ bool block, net::BufferedSpdyFramer* framer) {
+ const apr_read_type_e read_type = block ? APR_BLOCK_READ : APR_NONBLOCK_READ;
+
+ // Make sure the input brigade we're using is empty.
+ if (!APR_BRIGADE_EMPTY(input_brigade_)) {
+ LOG(DFATAL) << "input_brigade_ should be empty";
+ apr_brigade_cleanup(input_brigade_);
+ }
+
+ // Try to read some data into the brigade.
+ {
+ const apr_status_t status = ap_get_brigade(
+ connection_->input_filters, input_brigade_, AP_MODE_READBYTES,
+ read_type, kReadBytes);
+ if (status == APR_SUCCESS) {
+ // Success; we'll process the brigade below.
+ } else if (APR_STATUS_IS_EAGAIN(status)) {
+ // EAGAIN probably indicates that we did a non-blocking read and no data
+ // was available. So, just press on and process the brigade (it should
+ // be empty, but maybe there'll be metadata buckets or something). Most
+ // likely we'll end up returning READ_NO_DATA at the end of this method.
+ } else if (APR_STATUS_IS_TIMEUP(status)) {
+ // TIMEUP tends to occur for blocking reads, if some upstream filter set
+ // a timeout. Just like with EAGAIN, we'll press on and process the
+ // probably-empty brigade, but since these seem to be rare, let's VLOG
+ // here so that we can see when they happen.
+ VLOG(3) << "ap_get_brigade returned TIMEUP";
+ } else {
+ // Otherwise, something has gone wrong and we should consider the
+ // connection closed. If the client merely closed the connection on us,
+ // we'll get an EOF error, which is fine; otherwise, something may be
+ // wrong, so we should log an error.
+ if (APR_STATUS_IS_EOF(status)) {
+ VLOG(2) << "ap_get_brigade returned EOF";
+ } else {
+ LOG(ERROR) << "ap_get_brigade failed with status " << status << ": "
+ << AprStatusString(status);
+ }
+ apr_brigade_cleanup(input_brigade_);
+ return READ_CONNECTION_CLOSED;
+ }
+ }
+
+ bool pushed_any_data = false;
+ while (!APR_BRIGADE_EMPTY(input_brigade_)) {
+ apr_bucket* bucket = APR_BRIGADE_FIRST(input_brigade_);
+
+ if (APR_BUCKET_IS_METADATA(bucket)) {
+ // Metadata bucket. We don't care about EOS or FLUSH buckets here (or
+ // other, unknown metadata buckets), and there's no further filter to
+ // pass it to, so we just ignore it.
+ } else {
+ // Data bucket -- get ready to read.
+ const char* data = NULL;
+ apr_size_t data_length = 0;
+ const apr_status_t status = apr_bucket_read(bucket, &data, &data_length,
+ read_type);
+ if (status != APR_SUCCESS) {
+ // TODO(mdsteele): In what situations might apr_bucket_read fail here?
+ // These buckets are almost certainly coming from mod_ssl, which
+ // seems to only use transient buckets, for which apr_bucket_read
+ // will always succeed. However, in theory there could be another
+ // filter between us and mod_ssl, and in theory it could be sending
+ // us bucket types for which non-blocking reads can fail.
+ LOG(ERROR) << "apr_bucket_read failed with status " << status << ": "
+ << AprStatusString(status);
+ }
+
+ const size_t consumed = framer->ProcessInput(data, data_length);
+ // If the SpdyFramer encountered an error (i.e. the client sent us
+ // malformed data), then we can't recover.
+ if (framer->HasError()) {
+ apr_brigade_cleanup(input_brigade_);
+ return READ_ERROR;
+ }
+ // If there was no error, the framer will have consumed all the data.
+ // TODO(mdsteele): Is that true? I think it's true.
+ DCHECK(consumed == data_length);
+ pushed_any_data |= consumed > 0;
+ }
+
+ // Delete this bucket and move on to the next one.
+ apr_bucket_delete(bucket);
+ }
+
+ // We deleted buckets as we went, so the brigade should be empty now.
+ DCHECK(APR_BRIGADE_EMPTY(input_brigade_));
+
+ return pushed_any_data ? READ_SUCCESS : READ_NO_DATA;
+}
+
+SpdySessionIO::WriteStatus ApacheSpdySessionIO::SendFrameRaw(
+ const net::SpdySerializedFrame& frame) {
+ // Make sure the output brigade we're using is empty.
+ if (!APR_BRIGADE_EMPTY(output_brigade_)) {
+ LOG(DFATAL) << "output_brigade_ should be empty";
+ apr_brigade_cleanup(output_brigade_);
+ }
+
+ // Put the frame data into the output brigade.
+ APR_BRIGADE_INSERT_TAIL(output_brigade_, apr_bucket_transient_create(
+ frame.data(), frame.size(), output_brigade_->bucket_alloc));
+
+ // Append a flush bucket to the end of the brigade, to make sure that this
+ // frame makes it all the way out to the client.
+ APR_BRIGADE_INSERT_TAIL(output_brigade_, apr_bucket_flush_create(
+ output_brigade_->bucket_alloc));
+
+ // Send the brigade through the connection's output filter chain.
+ const apr_status_t status =
+ ap_pass_brigade(connection_->output_filters, output_brigade_);
+ apr_brigade_cleanup(output_brigade_);
+ DCHECK(APR_BRIGADE_EMPTY(output_brigade_));
+
+ // If we sent the data successfully, great; otherwise, consider the
+ // connection closed.
+ if (status == APR_SUCCESS) {
+ return WRITE_SUCCESS;
+ } else {
+ // ECONNABORTED and EPIPE (broken pipe) are two common symptoms of the
+ // connection having been closed; those are no cause for concern. For any
+ // other non-success status, log an error (for now).
+ if (APR_STATUS_IS_ECONNABORTED(status)) {
+ VLOG(2) << "ap_pass_brigade returned ECONNABORTED";
+ } else if (APR_STATUS_IS_EPIPE(status)) {
+ VLOG(2) << "ap_pass_brigade returned EPIPE";
+ } else {
+ LOG(ERROR) << "ap_pass_brigade failed with status " << status << ": "
+ << AprStatusString(status);
+ }
+ return WRITE_CONNECTION_CLOSED;
+ }
+}
+
+} // namespace mod_spdy
Added: httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.h?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.h (added)
+++ httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.h Mon Apr 28 10:55:17 2014
@@ -0,0 +1,51 @@
+// Copyright 2011 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef MOD_SPDY_APACHE_APACHE_SPDY_SESSION_IO_H_
+#define MOD_SPDY_APACHE_APACHE_SPDY_SESSION_IO_H_
+
+#include "httpd.h"
+
+#include "base/basictypes.h"
+#include "mod_spdy/common/spdy_session_io.h"
+
+namespace net {
+class BufferedSpdyFramer;
+class SpdyFrame;
+} // namespace net
+
+namespace mod_spdy {
+
+class ApacheSpdySessionIO : public SpdySessionIO {
+ public:
+ explicit ApacheSpdySessionIO(conn_rec* connection);
+ ~ApacheSpdySessionIO();
+
+ // SpdySessionIO methods:
+ virtual bool IsConnectionAborted();
+ virtual ReadStatus ProcessAvailableInput(bool block,
+ net::BufferedSpdyFramer* framer);
+ virtual WriteStatus SendFrameRaw(const net::SpdySerializedFrame& frame);
+
+ private:
+ conn_rec* const connection_;
+ apr_bucket_brigade* const input_brigade_;
+ apr_bucket_brigade* const output_brigade_;
+
+ DISALLOW_COPY_AND_ASSIGN(ApacheSpdySessionIO);
+};
+
+} // namespace mod_spdy
+
+#endif // MOD_SPDY_APACHE_APACHE_SPDY_SESSION_IO_H_
Propchange: httpd/httpd/trunk/modules/spdy/apache/apache_spdy_session_io.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.cc
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.cc?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.cc (added)
+++ httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.cc Mon Apr 28 10:55:17 2014
@@ -0,0 +1,163 @@
+// Copyright 2011 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "mod_spdy/apache/apache_spdy_stream_task_factory.h"
+
+#include "apr_buckets.h"
+#include "apr_network_io.h"
+#include "http_log.h"
+#include "util_filter.h"
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "mod_spdy/apache/config_util.h"
+#include "mod_spdy/apache/filters/http_to_spdy_filter.h"
+#include "mod_spdy/apache/filters/spdy_to_http_filter.h"
+#include "mod_spdy/apache/log_message_handler.h"
+#include "mod_spdy/apache/pool_util.h"
+#include "mod_spdy/apache/slave_connection.h"
+#include "mod_spdy/apache/slave_connection_context.h"
+#include "mod_spdy/common/spdy_stream.h"
+#include "net/instaweb/util/public/function.h"
+
+namespace mod_spdy {
+
+namespace {
+
+// These global variables store the filter handles for our filters. Normally,
+// global variables would be very dangerous in a concurrent environment like
+// Apache, but these ones are okay because they are assigned just once, at
+// start-up (during which Apache is running single-threaded; see TAMB 2.2.1),
+// and are read-only thereafter.
+ap_filter_rec_t* gHttpToSpdyFilterHandle = NULL;
+ap_filter_rec_t* gSpdyToHttpFilterHandle = NULL;
+
+// See TAMB 8.4.2
+apr_status_t SpdyToHttpFilterFunc(ap_filter_t* filter,
+ apr_bucket_brigade* brigade,
+ ap_input_mode_t mode,
+ apr_read_type_e block,
+ apr_off_t readbytes) {
+ mod_spdy::SpdyToHttpFilter* spdy_to_http_filter =
+ static_cast<mod_spdy::SpdyToHttpFilter*>(filter->ctx);
+ return spdy_to_http_filter->Read(filter, brigade, mode, block, readbytes);
+}
+
+// See TAMB 8.4.1
+apr_status_t HttpToSpdyFilterFunc(ap_filter_t* filter,
+ apr_bucket_brigade* input_brigade) {
+ mod_spdy::HttpToSpdyFilter* http_to_spdy_filter =
+ static_cast<mod_spdy::HttpToSpdyFilter*>(filter->ctx);
+ return http_to_spdy_filter->Write(filter, input_brigade);
+}
+
+// A task to be returned by ApacheSpdyStreamTaskFactory::NewStreamTask().
+class ApacheStreamTask : public net_instaweb::Function {
+ public:
+ // The task does not take ownership of the arguments.
+ ApacheStreamTask(SlaveConnectionFactory* conn_factory,
+ SpdyStream* stream);
+ virtual ~ApacheStreamTask();
+
+ protected:
+ // net_instaweb::Function methods:
+ virtual void Run();
+ virtual void Cancel();
+
+ private:
+ SpdyStream* const stream_;
+ scoped_ptr<SlaveConnection> slave_connection_;
+
+ DISALLOW_COPY_AND_ASSIGN(ApacheStreamTask);
+};
+
+ApacheStreamTask::ApacheStreamTask(SlaveConnectionFactory* conn_factory,
+ SpdyStream* stream)
+ : stream_(stream),
+ slave_connection_(conn_factory->Create()) {
+ const SpdyServerConfig* config =
+ GetServerConfig(slave_connection_->apache_connection());
+
+ // SlaveConnectionFactory::Create must have attached a slave context.
+ SlaveConnectionContext* slave_context =
+ slave_connection_->GetSlaveConnectionContext();
+ slave_context->set_slave_stream(stream);
+
+ // Create our filters to hook us up to the slave connection.
+ SpdyToHttpFilter* spdy_to_http_filter = new SpdyToHttpFilter(stream);
+ PoolRegisterDelete(slave_connection_->apache_connection()->pool,
+ spdy_to_http_filter);
+ slave_context->SetInputFilter(gSpdyToHttpFilterHandle, spdy_to_http_filter);
+
+ HttpToSpdyFilter* http_to_spdy_filter = new HttpToSpdyFilter(config, stream);
+ PoolRegisterDelete(slave_connection_->apache_connection()->pool,
+ http_to_spdy_filter);
+ slave_context->SetOutputFilter(gHttpToSpdyFilterHandle, http_to_spdy_filter);
+}
+
+ApacheStreamTask::~ApacheStreamTask() {
+}
+
+void ApacheStreamTask::Run() {
+ ScopedStreamLogHandler log_handler(
+ slave_connection_->apache_connection(), stream_);
+ VLOG(3) << "Starting stream task";
+ if (!stream_->is_aborted()) {
+ slave_connection_->Run();
+ }
+ VLOG(3) << "Finishing stream task";
+}
+
+void ApacheStreamTask::Cancel() {
+ if (VLOG_IS_ON(3)) {
+ ScopedStreamLogHandler log_handler(
+ slave_connection_->apache_connection(), stream_);
+ VLOG(3) << "Cancelling stream task";
+ }
+}
+
+} // namespace
+
+ApacheSpdyStreamTaskFactory::ApacheSpdyStreamTaskFactory(conn_rec* connection)
+ : connection_factory_(connection) {}
+
+ApacheSpdyStreamTaskFactory::~ApacheSpdyStreamTaskFactory() {}
+
+void ApacheSpdyStreamTaskFactory::InitFilters() {
+ // Register our input filter, and store the filter handle into a global
+ // variable so we can use it later to instantiate our filter into a filter
+ // chain. The "filter type" argument below determines where in the filter
+ // chain our filter will be placed. We use AP_FTYPE_NETWORK so that we will
+ // be at the very end of the input chain for slave connections, in place of
+ // the usual core input filter.
+ gSpdyToHttpFilterHandle = ap_register_input_filter(
+ "SPDY_TO_HTTP", // name
+ SpdyToHttpFilterFunc, // filter function
+ NULL, // init function (n/a in our case)
+ AP_FTYPE_NETWORK); // filter type
+
+ // Now register our output filter, analogously to the input filter above.
+ gHttpToSpdyFilterHandle = ap_register_output_filter(
+ "HTTP_TO_SPDY", // name
+ HttpToSpdyFilterFunc, // filter function
+ NULL, // init function (n/a in our case)
+ AP_FTYPE_NETWORK); // filter type
+}
+
+net_instaweb::Function* ApacheSpdyStreamTaskFactory::NewStreamTask(
+ SpdyStream* stream) {
+ return new ApacheStreamTask(&connection_factory_, stream);
+}
+
+} // namespace mod_spdy
Added: httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.h?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.h (added)
+++ httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.h Mon Apr 28 10:55:17 2014
@@ -0,0 +1,50 @@
+// Copyright 2011 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef MOD_SPDY_APACHE_APACHE_SPDY_STREAM_TASK_FACTORY_H_
+#define MOD_SPDY_APACHE_APACHE_SPDY_STREAM_TASK_FACTORY_H_
+
+#include "httpd.h"
+
+#include "base/basictypes.h"
+#include "mod_spdy/apache/slave_connection.h"
+#include "mod_spdy/common/spdy_stream_task_factory.h"
+
+namespace net_instaweb { class Function; }
+
+namespace mod_spdy {
+
+class SpdyStream;
+
+class ApacheSpdyStreamTaskFactory : public SpdyStreamTaskFactory {
+ public:
+ explicit ApacheSpdyStreamTaskFactory(conn_rec* connection);
+ ~ApacheSpdyStreamTaskFactory();
+
+ // This must be called from hooks registration to create the filters
+ // this class needs to route bytes between Apache & mod_spdy.
+ static void InitFilters();
+
+ // SpdyStreamTaskFactory methods:
+ virtual net_instaweb::Function* NewStreamTask(SpdyStream* stream);
+
+ private:
+ SlaveConnectionFactory connection_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ApacheSpdyStreamTaskFactory);
+};
+
+} // namespace mod_spdy
+
+#endif // MOD_SPDY_APACHE_APACHE_SPDY_STREAM_TASK_FACTORY_H_
Propchange: httpd/httpd/trunk/modules/spdy/apache/apache_spdy_stream_task_factory.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: httpd/httpd/trunk/modules/spdy/apache/config_commands.cc
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/config_commands.cc?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/config_commands.cc (added)
+++ httpd/httpd/trunk/modules/spdy/apache/config_commands.cc Mon Apr 28 10:55:17 2014
@@ -0,0 +1,171 @@
+// Copyright 2010 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "mod_spdy/apache/config_commands.h"
+
+#include "apr_strings.h"
+
+#include "base/strings/string_number_conversions.h"
+
+#include "mod_spdy/apache/config_util.h"
+#include "mod_spdy/apache/pool_util.h"
+#include "mod_spdy/common/spdy_server_config.h"
+#include "mod_spdy/common/protocol_util.h"
+
+namespace mod_spdy {
+
+void* CreateSpdyServerConfig(apr_pool_t* pool, server_rec* server) {
+ SpdyServerConfig* config = new SpdyServerConfig;
+ PoolRegisterDelete(pool, config);
+ return config;
+}
+
+void* MergeSpdyServerConfigs(apr_pool_t* pool, void* base, void* add) {
+ SpdyServerConfig* config = new SpdyServerConfig;
+ PoolRegisterDelete(pool, config);
+ config->MergeFrom(*static_cast<SpdyServerConfig*>(base),
+ *static_cast<SpdyServerConfig*>(add));
+ return config;
+}
+
+namespace {
+
+// A function suitable for for passing to AP_INIT_TAKE1 (and hence to
+// SPDY_CONFIG_COMMAND) for a config option that requires a boolean argument
+// ("on" or "off", case-insensitive; other strings will be rejected). The
+// template argument is a setter method on SpdyServerConfig that takes a bool.
+template <void(SpdyServerConfig::*setter)(bool)>
+const char* SetBoolean(cmd_parms* cmd, void* dir, const char* arg) {
+ if (0 == apr_strnatcasecmp(arg, "on")) {
+ (GetServerConfig(cmd)->*setter)(true);
+ return NULL;
+ } else if (0 == apr_strnatcasecmp(arg, "off")) {
+ (GetServerConfig(cmd)->*setter)(false);
+ return NULL;
+ } else {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name, " on|off", NULL);
+ }
+}
+
+// A function suitable for for passing to AP_INIT_TAKE1 (and hence to
+// SPDY_CONFIG_COMMAND) for a config option that requires a positive integer
+// argument. The template argument is a setter method on SpdyServerConfig that
+// takes an int; the method will only ever be called with a positive argument
+// (if the user gives a non-positive argument, or a string that isn't even an
+// integer, this function will reject it with an error message).
+template <void(SpdyServerConfig::*setter)(int)>
+const char* SetPositiveInt(cmd_parms* cmd, void* dir, const char* arg) {
+ int value;
+ if (!base::StringToInt(arg, &value) || value < 1) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ " must specify a positive integer", NULL);
+ }
+ (GetServerConfig(cmd)->*setter)(value);
+ return NULL;
+}
+
+// Like SetPositiveInt, but allows any non-negative value, not just positive.
+template <void(SpdyServerConfig::*setter)(int)>
+const char* SetNonNegativeInt(cmd_parms* cmd, void* dir, const char* arg) {
+ int value;
+ if (!base::StringToInt(arg, &value) || value < 0) {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ " must specify a non-negative integer", NULL);
+ }
+ (GetServerConfig(cmd)->*setter)(value);
+ return NULL;
+}
+
+const char* SetUseSpdyForNonSslConnections(cmd_parms* cmd, void* dir,
+ const char* arg) {
+ spdy::SpdyVersion value;
+ if (0 == apr_strnatcasecmp(arg, "off")) {
+ value = spdy::SPDY_VERSION_NONE;
+ } else if (0 == apr_strnatcasecmp(arg, "2")) {
+ value = spdy::SPDY_VERSION_2;
+ } else if (0 == apr_strnatcasecmp(arg, "3")) {
+ value = spdy::SPDY_VERSION_3;
+ } else if (0 == apr_strnatcasecmp(arg, "3.1")) {
+ value = spdy::SPDY_VERSION_3_1;
+ } else {
+ return apr_pstrcat(cmd->pool, cmd->cmd->name,
+ " must be 2, 3, 3.1, or off", NULL);
+ }
+ GetServerConfig(cmd)->set_use_spdy_version_without_ssl(value);
+ return NULL;
+}
+
+// This template can be wrapped around any of the above functions to restrict
+// the directive to being used only at the top level (as opposed to within a
+// <VirtualHost> directive).
+template <const char*(*setter)(cmd_parms*, void*, const char*)>
+const char* GlobalOnly(cmd_parms* cmd, void* dir, const char* arg) {
+ const char* error = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+ return error != NULL ? error : (*setter)(cmd, dir, arg);
+}
+
+} // namespace
+
+// The reinterpret_cast is there because Apache's AP_INIT_TAKE1 macro needs to
+// take an old-style C function type with unspecified arguments. The
+// static_cast, then, is just to enforce that we pass the correct type of
+// function -- it will give a compile-time error if we pass a function with the
+// wrong signature.
+#define SPDY_CONFIG_COMMAND(name, fn, help) \
+ AP_INIT_TAKE1( \
+ name, \
+ reinterpret_cast<const char*(*)()>( \
+ static_cast<const char*(*)(cmd_parms*,void*,const char*)>(fn)), \
+ NULL, RSRC_CONF, help)
+
+const command_rec kSpdyConfigCommands[] = {
+ SPDY_CONFIG_COMMAND(
+ "SpdyEnabled", SetBoolean<&SpdyServerConfig::set_spdy_enabled>,
+ "Enable SPDY support"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyMaxStreamsPerConnection",
+ SetPositiveInt<&SpdyServerConfig::set_max_streams_per_connection>,
+ "Maxiumum number of simultaneous SPDY streams per connection"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyMinThreadsPerProcess",
+ GlobalOnly<SetPositiveInt<
+ &SpdyServerConfig::set_min_threads_per_process> >,
+ "Miniumum number of worker threads to spawn per child process"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyMaxThreadsPerProcess",
+ GlobalOnly<SetPositiveInt<
+ &SpdyServerConfig::set_max_threads_per_process> >,
+ "Maximum number of worker threads to spawn per child process"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyMaxServerPushDepth",
+ SetNonNegativeInt<
+ &SpdyServerConfig::set_max_server_push_depth>,
+ "Maximum number of recursive levels to follow X-Associated-Content header. 0 Disables. Defaults to 1."),
+ SPDY_CONFIG_COMMAND(
+ "SpdySendVersionHeader",
+ SetBoolean<&SpdyServerConfig::set_send_version_header>,
+ "Send an x-mod-spdy header with the module version number"),
+ // Debugging commands, which should not be used in production:
+ SPDY_CONFIG_COMMAND(
+ "SpdyDebugLoggingVerbosity",
+ GlobalOnly<SetNonNegativeInt<&SpdyServerConfig::set_vlog_level> >,
+ "Set the verbosity of mod_spdy logging"),
+ SPDY_CONFIG_COMMAND(
+ "SpdyDebugUseSpdyForNonSslConnections",
+ SetUseSpdyForNonSslConnections,
+ "Use SPDY even over non-SSL connections; DO NOT USE IN PRODUCTION"),
+ {NULL}
+};
+
+} // namespace mod_spdy
Added: httpd/httpd/trunk/modules/spdy/apache/config_commands.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/config_commands.h?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/config_commands.h (added)
+++ httpd/httpd/trunk/modules/spdy/apache/config_commands.h Mon Apr 28 10:55:17 2014
@@ -0,0 +1,37 @@
+// Copyright 2010 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef MOD_SPDY_APACHE_CONFIG_COMMANDS_H_
+#define MOD_SPDY_APACHE_CONFIG_COMMANDS_H_
+
+#include "httpd.h"
+#include "http_config.h"
+
+namespace mod_spdy {
+
+// An array of configuration command objects, to be placed into an Apache
+// module object. See TAMB 9.4.
+extern const command_rec kSpdyConfigCommands[];
+
+// A function to create new server config objects, with a function signature
+// appropriate to be placed into an Apache module object. See TAMB 9.3.1.
+void* CreateSpdyServerConfig(apr_pool_t* pool, server_rec* server);
+
+// A function to merge existing server config objects, with a signature
+// appropriate to be placed into an Apache module object. See TAMB 9.5.
+void* MergeSpdyServerConfigs(apr_pool_t* pool, void* base, void* add);
+
+} // namespace mod_spdy
+
+#endif // MOD_SPDY_APACHE_CONFIG_COMMANDS_H_
Propchange: httpd/httpd/trunk/modules/spdy/apache/config_commands.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: httpd/httpd/trunk/modules/spdy/apache/config_util.cc
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/config_util.cc?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/config_util.cc (added)
+++ httpd/httpd/trunk/modules/spdy/apache/config_util.cc Mon Apr 28 10:55:17 2014
@@ -0,0 +1,139 @@
+// Copyright 2010 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "mod_spdy/apache/config_util.h"
+
+#include "httpd.h"
+#include "http_config.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+
+#include "mod_spdy/apache/master_connection_context.h"
+#include "mod_spdy/apache/pool_util.h"
+#include "mod_spdy/apache/slave_connection_context.h"
+#include "mod_spdy/common/spdy_server_config.h"
+
+extern "C" {
+ extern module AP_MODULE_DECLARE_DATA spdy_module;
+}
+
+namespace mod_spdy {
+
+namespace {
+
+struct ConnectionContext {
+ // Exactly one of the fields below should be set.
+ scoped_ptr<MasterConnectionContext> master_context;
+ scoped_ptr<SlaveConnectionContext> slave_context;
+};
+
+SpdyServerConfig* GetServerConfigInternal(server_rec* server) {
+ void* ptr = ap_get_module_config(server->module_config, &spdy_module);
+ CHECK(ptr) << "mod_spdy server config pointer is NULL";
+ return static_cast<SpdyServerConfig*>(ptr);
+}
+
+ConnectionContext* GetConnContextInternal(conn_rec* connection) {
+ return static_cast<ConnectionContext*>(
+ ap_get_module_config(connection->conn_config, &spdy_module));
+}
+
+ConnectionContext* SetConnContextInternal(
+ conn_rec* connection,
+ MasterConnectionContext* master_context,
+ SlaveConnectionContext* slave_context) {
+ DCHECK((master_context == NULL) ^ (slave_context == NULL));
+ DCHECK(GetConnContextInternal(connection) == NULL);
+ ConnectionContext* context = new ConnectionContext;
+ PoolRegisterDelete(connection->pool, context);
+ context->master_context.reset(master_context);
+ context->slave_context.reset(slave_context);
+
+ // Place the context object in the connection's configuration vector, so that
+ // other hook functions with access to this connection can get hold of the
+ // context object. See TAMB 4.2 for details.
+ ap_set_module_config(connection->conn_config, // configuration vector
+ &spdy_module, // module with which to associate
+ context); // pointer to store (any void* we want)
+
+ return context;
+}
+
+MasterConnectionContext* GetMasterConnectionContextInternal(
+ conn_rec* connection) {
+ ConnectionContext* context = GetConnContextInternal(connection);
+ return (context != NULL) ? context->master_context.get() : NULL;
+}
+
+SlaveConnectionContext* GetSlaveConnectionContextInternal(
+ conn_rec* connection) {
+ ConnectionContext* context = GetConnContextInternal(connection);
+ return (context != NULL) ? context->slave_context.get() : NULL;
+}
+
+} // namespace
+
+const SpdyServerConfig* GetServerConfig(server_rec* server) {
+ return GetServerConfigInternal(server);
+}
+
+const SpdyServerConfig* GetServerConfig(conn_rec* connection) {
+ return GetServerConfigInternal(connection->base_server);
+}
+
+const SpdyServerConfig* GetServerConfig(request_rec* request) {
+ return GetServerConfigInternal(request->server);
+}
+
+SpdyServerConfig* GetServerConfig(cmd_parms* command) {
+ return GetServerConfigInternal(command->server);
+}
+
+MasterConnectionContext* CreateMasterConnectionContext(conn_rec* connection,
+ bool using_ssl) {
+ ConnectionContext* context = SetConnContextInternal(
+ connection, new MasterConnectionContext(using_ssl), NULL);
+ return context->master_context.get();
+}
+
+SlaveConnectionContext* CreateSlaveConnectionContext(conn_rec* connection) {
+ ConnectionContext* context = SetConnContextInternal(
+ connection, NULL, new SlaveConnectionContext());
+ return context->slave_context.get();
+}
+
+bool HasMasterConnectionContext(conn_rec* connection) {
+ return GetMasterConnectionContextInternal(connection) != NULL;
+}
+
+bool HasSlaveConnectionContext(conn_rec* connection) {
+ return GetSlaveConnectionContextInternal(connection) != NULL;
+}
+
+MasterConnectionContext* GetMasterConnectionContext(conn_rec* connection) {
+ MasterConnectionContext* context =
+ GetMasterConnectionContextInternal(connection);
+ DCHECK(context != NULL);
+ return context;
+}
+
+SlaveConnectionContext* GetSlaveConnectionContext(conn_rec* connection) {
+ SlaveConnectionContext* context =
+ GetSlaveConnectionContextInternal(connection);
+ DCHECK(context != NULL);
+ return context;
+}
+
+} // namespace mod_spdy
Added: httpd/httpd/trunk/modules/spdy/apache/config_util.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/config_util.h?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/config_util.h (added)
+++ httpd/httpd/trunk/modules/spdy/apache/config_util.h Mon Apr 28 10:55:17 2014
@@ -0,0 +1,74 @@
+// Copyright 2010 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef MOD_SPDY_APACHE_CONFIG_UTIL_H_
+#define MOD_SPDY_APACHE_CONFIG_UTIL_H_
+
+#include "httpd.h"
+#include "http_config.h"
+
+namespace mod_spdy {
+
+class MasterConnectionContext;
+class SlaveConnectionContext;
+class SpdyServerConfig;
+class SpdyStream;
+
+// Get the server configuration associated with the given object. The
+// configuration object is returned const, since by the time these functions
+// are being used, the configuration should be treated as read-only.
+const SpdyServerConfig* GetServerConfig(server_rec* server);
+const SpdyServerConfig* GetServerConfig(conn_rec* connection);
+const SpdyServerConfig* GetServerConfig(request_rec* request);
+
+// Get the server configuration associated with the given configuration command
+// parameters. Since this is for setting the configuration (rather than just
+// reading it), the configuration object is returned non-const.
+SpdyServerConfig* GetServerConfig(cmd_parms* command);
+
+// Allocate a new MasterConnectionContext object for a master connection in the given
+// connection's pool, attach it to the connection's config vector, and return
+// it. Cannot be called on connection which previously was passed to
+// Create[Master|Slave]ConnectionContext.
+MasterConnectionContext* CreateMasterConnectionContext(
+ conn_rec* connection, bool using_ssl);
+
+// Allocate a new ConnectionContext object for a slave connection in the given
+// connection's pool, attach it to the connection's config vector, and return
+// it. Cannot be called on connection which previously was passed to
+// Create[Master|Slave]ConnectionContext.
+SlaveConnectionContext* CreateSlaveConnectionContext(conn_rec* connection);
+
+// Returns true if the connection has had a master connection context set.
+// We expect the result to be true for outgoing connections for which
+// mod_spdy is enabled on the server and which are using SSL, and on which
+// the pre-connection hook has fired.
+bool HasMasterConnectionContext(conn_rec* connection);
+
+// Returns true if the connection has had a slave connection context set.
+bool HasSlaveConnectionContext(conn_rec* connection);
+
+// Get the master connection context that was set on this connection
+// by a call to CreateMasterConnectionContext. Precondition:
+// HasMasterConnectionContext has been called, and returned true.
+MasterConnectionContext* GetMasterConnectionContext(conn_rec* connection);
+
+// Get the slave connection context that was set on this connection
+// by a call to CreateSlaveConnectionContext.
+// Precondition: HasSlaveConnectionContext has been called, and returned true.
+SlaveConnectionContext* GetSlaveConnectionContext(conn_rec* connection);
+
+} // namespace mod_spdy
+
+#endif // MOD_SPDY_APACHE_CONFIG_UTIL_H_
Propchange: httpd/httpd/trunk/modules/spdy/apache/config_util.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.cc
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.cc?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.cc (added)
+++ httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.cc Mon Apr 28 10:55:17 2014
@@ -0,0 +1,223 @@
+// Copyright 2010 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// There are a number of things that every output filter should do, according
+// to <http://httpd.apache.org/docs/2.3/developer/output-filters.html>. In
+// short, these things are:
+//
+// - Respect FLUSH and EOS metadata buckets, and pass other metadata buckets
+// down the chain. Ignore all buckets after an EOS.
+//
+// - Don't allocate long-lived memory on every invocation. In particular, if
+// you need a temp brigade, allocate it once and then reuse it each time.
+//
+// - Never pass an empty brigade down the chain, but be ready to accept one
+// and do nothing.
+//
+// - Calling apr_brigade_destroy can be dangerous; prefer using
+// apr_brigade_cleanup instead.
+//
+// - Don't read the entire brigade into memory at once; the brigade may, for
+// example, contain a FILE bucket representing a 42 GB file. Instead, use
+// apr_bucket_read to read a reasonable portion of the bucket, put the
+// resulting (small) bucket into a temp brigade, pass it down the chain,
+// and then clean up the temp brigade before continuing.
+//
+// - If a bucket is to be saved beyond the scope of the filter invocation
+// that first received it, it must be "set aside" using the
+// apr_bucket_setaside macro.
+//
+// - When reading a bucket, first use a non-blocking read; if it fails with
+// APR_EAGAIN, send a FLUSH bucket down the chain, and then read the bucket
+// with a blocking read.
+//
+// This code attempts to follow these rules.
+
+#include "mod_spdy/apache/filters/http_to_spdy_filter.h"
+
+#include "apr_strings.h"
+
+#include "base/logging.h"
+#include "mod_spdy/apache/pool_util.h" // for AprStatusString
+#include "mod_spdy/common/protocol_util.h"
+#include "mod_spdy/common/spdy_server_config.h"
+#include "mod_spdy/common/spdy_stream.h"
+#include "mod_spdy/common/version.h"
+#include "net/spdy/spdy_protocol.h"
+
+namespace {
+
+const char* kModSpdyVersion = MOD_SPDY_VERSION_STRING "-" LASTCHANGE_STRING;
+
+} // namespace
+
+namespace mod_spdy {
+
+HttpToSpdyFilter::HttpToSpdyFilter(const SpdyServerConfig* config,
+ SpdyStream* stream)
+ : receiver_(config, stream),
+ converter_(stream->spdy_version(), &receiver_),
+ eos_bucket_received_(false) {}
+
+HttpToSpdyFilter::~HttpToSpdyFilter() {}
+
+// Check if the SPDY stream has been aborted; if so, mark the connection object
+// as having been aborted and return APR_ECONNABORTED. Hopefully, this will
+// convince Apache to shut down processing for this (slave) connection, thus
+// allowing this stream's thread to complete and exit.
+#define RETURN_IF_STREAM_ABORT(filter) \
+ do { \
+ if ((filter)->c->aborted || receiver_.stream_->is_aborted()) { \
+ (filter)->c->aborted = true; \
+ return APR_ECONNABORTED; \
+ } \
+ } while (false)
+
+apr_status_t HttpToSpdyFilter::Write(ap_filter_t* filter,
+ apr_bucket_brigade* input_brigade) {
+ // This is a NETWORK-level filter, so there shouldn't be any filter after us.
+ if (filter->next != NULL) {
+ LOG(WARNING) << "HttpToSpdyFilter is not the last filter in the chain "
+ << "(it is followed by " << filter->next->frec->name << ")";
+ }
+
+ // According to the page at
+ // http://httpd.apache.org/docs/2.3/developer/output-filters.html
+ // we should never pass an empty brigade down the chain, but to be safe, we
+ // should be prepared to accept one and do nothing.
+ if (APR_BRIGADE_EMPTY(input_brigade)) {
+ LOG(INFO) << "HttpToSpdyFilter received an empty brigade.";
+ return APR_SUCCESS;
+ }
+
+ // Loop through the brigade, reading and sending data. We delete each bucket
+ // once we have successfully consumed it, before moving on to the next
+ // bucket. There are two reasons to delete buckets as we go:
+ //
+ // 1) Some output filters (such as mod_deflate) that come before us will
+ // expect us to empty out the brigade that they give us before we
+ // return. If we don't do so, the second time they call us we'll see
+ // all those same buckets again (along with the new buckets).
+ //
+ // 2) Some bucket types such as FILE don't store their data in memory, and
+ // when read, split into two buckets: one containing some data, and the
+ // other representing the rest of the file. If we read in all buckets
+ // in the brigade without deleting ones we're done with, we will
+ // eventually read the whole file into memory; by deleting buckets as we
+ // go, only a portion of the file is in memory at a time.
+ while (!APR_BRIGADE_EMPTY(input_brigade)) {
+ apr_bucket* bucket = APR_BRIGADE_FIRST(input_brigade);
+
+ if (APR_BUCKET_IS_METADATA(bucket)) {
+ if (APR_BUCKET_IS_EOS(bucket)) {
+ // EOS bucket -- there should be no more data buckets in this stream.
+ eos_bucket_received_ = true;
+ RETURN_IF_STREAM_ABORT(filter);
+ converter_.Flush();
+ } else if (APR_BUCKET_IS_FLUSH(bucket)) {
+ // FLUSH bucket -- call Send() immediately and flush the data buffer.
+ RETURN_IF_STREAM_ABORT(filter);
+ converter_.Flush();
+ } else {
+ // Unknown metadata bucket. This bucket has no meaning to us, and
+ // there's no further filter to pass it to, so we just ignore it.
+ }
+ } else if (eos_bucket_received_) {
+ // We shouldn't be getting any data buckets after an EOS (since this is a
+ // connection-level filter, we do sometimes see other metadata buckets
+ // after the EOS). If we do get them, ignore them.
+ LOG(INFO) << "HttpToSpdyFilter received " << bucket->type->name
+ << " bucket after an EOS (and ignored it).";
+ } else {
+ // Data bucket -- get ready to read.
+ const char* data = NULL;
+ apr_size_t data_length = 0;
+
+ // First, try a non-blocking read.
+ apr_status_t status = apr_bucket_read(bucket, &data, &data_length,
+ APR_NONBLOCK_READ);
+ if (status == APR_SUCCESS) {
+ RETURN_IF_STREAM_ABORT(filter);
+ if (!converter_.ProcessInput(data, static_cast<size_t>(data_length))) {
+ // Parse failure. The parser will have already logged an error.
+ return APR_EGENERAL;
+ }
+ } else if (APR_STATUS_IS_EAGAIN(status)) {
+ // Non-blocking read failed with EAGAIN, so try again with a blocking
+ // read (but flush first, in case we block for a long time).
+ RETURN_IF_STREAM_ABORT(filter);
+ converter_.Flush();
+ status = apr_bucket_read(bucket, &data, &data_length, APR_BLOCK_READ);
+ if (status != APR_SUCCESS) {
+ LOG(ERROR) << "Blocking read failed with status " << status << ": "
+ << AprStatusString(status);
+ // Since we didn't successfully consume this bucket, don't delete it;
+ // rather, leave it (and any remaining buckets) in the brigade.
+ return status; // failure
+ }
+ RETURN_IF_STREAM_ABORT(filter);
+ if (!converter_.ProcessInput(data, static_cast<size_t>(data_length))) {
+ // Parse failure. The parser will have already logged an error.
+ return APR_EGENERAL;
+ }
+ } else {
+ // Since we didn't successfully consume this bucket, don't delete it;
+ // rather, leave it (and any remaining buckets) in the brigade.
+ return status; // failure
+ }
+ }
+
+ // We consumed this bucket successfully, so delete it and move on to the
+ // next.
+ apr_bucket_delete(bucket);
+ }
+
+ // We went through the whole brigade successfully, so it must be empty when
+ // we return (see http://code.google.com/p/mod-spdy/issues/detail?id=17).
+ DCHECK(APR_BRIGADE_EMPTY(input_brigade));
+ return APR_SUCCESS;
+}
+
+HttpToSpdyFilter::ReceiverImpl::ReceiverImpl(const SpdyServerConfig* config,
+ SpdyStream* stream)
+ : config_(config), stream_(stream) {
+ DCHECK(config_);
+ DCHECK(stream_);
+}
+
+HttpToSpdyFilter::ReceiverImpl::~ReceiverImpl() {}
+
+void HttpToSpdyFilter::ReceiverImpl::ReceiveSynReply(
+ net::SpdyHeaderBlock* headers, bool flag_fin) {
+ DCHECK(headers);
+ if (config_->send_version_header()) {
+ (*headers)[http::kXModSpdy] = kModSpdyVersion;
+ }
+ // For client-requested streams, we should send a SYN_REPLY. For
+ // server-pushed streams, the SpdySession has already sent an initial
+ // SYN_STREAM with FLAG_UNIDIRECTIONAL and minimal server push headers, so we
+ // now follow up with a HEADERS frame with the response headers.
+ if (stream_->is_server_push()) {
+ stream_->SendOutputHeaders(*headers, flag_fin);
+ } else {
+ stream_->SendOutputSynReply(*headers, flag_fin);
+ }
+}
+
+void HttpToSpdyFilter::ReceiverImpl::ReceiveData(
+ base::StringPiece data, bool flag_fin) {
+ stream_->SendOutputDataFrame(data, flag_fin);
+}
+
+} // namespace mod_spdy
Added: httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.h?rev=1590597&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.h (added)
+++ httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.h Mon Apr 28 10:55:17 2014
@@ -0,0 +1,81 @@
+// Copyright 2010 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef MOD_SPDY_APACHE_FILTERS_HTTP_TO_SPDY_FILTER_H_
+#define MOD_SPDY_APACHE_FILTERS_HTTP_TO_SPDY_FILTER_H_
+
+#include <string>
+
+#include "apr_buckets.h"
+#include "util_filter.h"
+
+#include "base/basictypes.h"
+#include "mod_spdy/common/http_to_spdy_converter.h"
+
+namespace mod_spdy {
+
+class SpdyServerConfig;
+class SpdyStream;
+
+// An Apache filter for converting HTTP data into SPDY frames and sending them
+// to the output queue of a SpdyStream object. This is intended to be the
+// outermost filter in the output chain of one of our slave connections,
+// essentially taking the place of the network socket.
+//
+// In a previous implementation of this filter, we made this a TRANSCODE-level
+// filter rather than a NETWORK-level filter; this had the advantage that we
+// could pull HTTP header data directly from the Apache request object, rather
+// than having to parse the headers. However, it had the disadvantage of being
+// fragile -- for example, we had an additional output filter whose sole job
+// was to deceive Apache into not chunking the response body, and several
+// different hooks to try to make sure our output filters stayed in place even
+// in the face of Apache's weird error-handling paths. Also, using a
+// NETWORK-level filter decreases the likelihood that we'll break other modules
+// that try to use connection-level filters.
+class HttpToSpdyFilter {
+ public:
+ HttpToSpdyFilter(const SpdyServerConfig* config, SpdyStream* stream);
+ ~HttpToSpdyFilter();
+
+ // Read data from the given brigade and write the result through the given
+ // filter. This method is responsible for driving the HTTP to SPDY conversion
+ // process.
+ apr_status_t Write(ap_filter_t* filter, apr_bucket_brigade* input_brigade);
+
+ private:
+ class ReceiverImpl : public HttpToSpdyConverter::SpdyReceiver {
+ public:
+ ReceiverImpl(const SpdyServerConfig* config, SpdyStream* stream);
+ virtual ~ReceiverImpl();
+ virtual void ReceiveSynReply(net::SpdyHeaderBlock* headers, bool flag_fin);
+ virtual void ReceiveData(base::StringPiece data, bool flag_fin);
+
+ private:
+ friend class HttpToSpdyFilter;
+ const SpdyServerConfig* config_;
+ SpdyStream* const stream_;
+
+ DISALLOW_COPY_AND_ASSIGN(ReceiverImpl);
+ };
+
+ ReceiverImpl receiver_;
+ HttpToSpdyConverter converter_;
+ bool eos_bucket_received_;
+
+ DISALLOW_COPY_AND_ASSIGN(HttpToSpdyFilter);
+};
+
+} // namespace mod_spdy
+
+#endif // MOD_SPDY_APACHE_FILTERS_HTTP_TO_SPDY_FILTER_H_
Propchange: httpd/httpd/trunk/modules/spdy/apache/filters/http_to_spdy_filter.h
------------------------------------------------------------------------------
svn:eol-style = native
Re: svn commit: r1590597 [1/14] - in /httpd/httpd/trunk/modules/spdy:
./ apache/ apache/filters/ apache/testing/ common/ common/testing/ support/
support/base/ support/base/metrics/ support/build/ support/install/ support/install/common/
support/install/de...
Posted by Ruediger Pluem <rp...@apache.org>.
jim@apache.org wrote:
> Author: jim
> Date: Mon Apr 28 10:55:17 2014
> New Revision: 1590597
>
> URL: http://svn.apache.org/r1590597
> Log:
> Fold in mod_spdy source
> NOTE: THIS IS THE INITIAL LOAD OF THE SRC AS-IS AND AS DONATED
>
>
I understand that this is the initial load, but I am little bit confused about the C++ code. Will this be converted to C?
Regards
RĂ¼diger