You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2014/04/28 23:32:08 UTC
[1/6] git commit: TS-2746: remove the P_ prefix from SPDY headers
Repository: trafficserver
Updated Branches:
refs/heads/master 7b08eb804 -> 81390c57b
TS-2746: remove the P_ prefix from SPDY headers
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7f036b4a
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7f036b4a
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7f036b4a
Branch: refs/heads/master
Commit: 7f036b4a5a07f2c84ecb6644f3ec843f295bb67f
Parents: 20eb9ad
Author: James Peach <jp...@apache.org>
Authored: Thu Apr 24 13:38:26 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 28 14:19:21 2014 -0700
----------------------------------------------------------------------
proxy/http/HttpProxyServerMain.cc | 2 +-
proxy/spdy/Makefile.am | 8 +-
proxy/spdy/P_SpdyCallbacks.h | 269 ---------------------------------
proxy/spdy/P_SpdyCommon.h | 96 ------------
proxy/spdy/P_SpdySM.h | 147 ------------------
proxy/spdy/P_SpdySessionAccept.h | 46 ------
proxy/spdy/SpdyCallbacks.cc | 4 +-
proxy/spdy/SpdyCallbacks.h | 269 +++++++++++++++++++++++++++++++++
proxy/spdy/SpdyCommon.cc | 4 +-
proxy/spdy/SpdyCommon.h | 96 ++++++++++++
proxy/spdy/SpdySM.cc | 2 +-
proxy/spdy/SpdySM.h | 147 ++++++++++++++++++
proxy/spdy/SpdySessionAccept.cc | 4 +-
proxy/spdy/SpdySessionAccept.h | 46 ++++++
14 files changed, 570 insertions(+), 570 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/http/HttpProxyServerMain.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc
index a881f86..6496672 100644
--- a/proxy/http/HttpProxyServerMain.cc
+++ b/proxy/http/HttpProxyServerMain.cc
@@ -36,7 +36,7 @@
#include "Tokenizer.h"
#include "P_SSLNextProtocolAccept.h"
#include "P_ProtocolProbeSessionAccept.h"
-#include "P_SpdySessionAccept.h"
+#include "SpdySessionAccept.h"
HttpSessionAccept *plugin_http_accept = NULL;
HttpSessionAccept *plugin_http_transparent_accept = 0;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/spdy/Makefile.am b/proxy/spdy/Makefile.am
index ddf336e..ec6e6e8 100644
--- a/proxy/spdy/Makefile.am
+++ b/proxy/spdy/Makefile.am
@@ -34,14 +34,14 @@ AM_CPPFLAGS = \
noinst_LIBRARIES = libspdy.a
libspdy_a_SOURCES = \
- P_SpdySessionAccept.h \
+ SpdySessionAccept.h \
SpdySessionAccept.cc
if BUILD_SPDY
libspdy_a_SOURCES += \
- P_SpdyCallbacks.h \
- P_SpdyCommon.h \
- P_SpdySM.h \
+ SpdyCallbacks.h \
+ SpdyCommon.h \
+ SpdySM.h \
SpdyCallbacks.cc \
SpdyCommon.cc \
SpdySM.cc
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/P_SpdyCallbacks.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdyCallbacks.h b/proxy/spdy/P_SpdyCallbacks.h
deleted file mode 100644
index c7a2a93..0000000
--- a/proxy/spdy/P_SpdyCallbacks.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/** @file
-
- P_SpdyCallbacks.h
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 __P_SPDY_CALLBACKS_H__
-#define __P_SPDY_CALLBACKS_H__
-
-#include <spdylay/spdylay.h>
-class SpdySM;
-
-void spdy_callbacks_init(spdylay_session_callbacks *callbacks);
-void spdy_prepare_status_response(SpdySM *sm, int stream_id, const char *status);
-
-/**
- * @functypedef
- *
- * Callback function invoked when |session| wants to send data to the
- * remote peer. The implementation of this function must send at most
- * |length| bytes of data stored in |data|. The |flags| is currently
- * not used and always 0. It must return the number of bytes sent if
- * it succeeds. If it cannot send any single byte without blocking,
- * it must return :enum:`SPDYLAY_ERR_WOULDBLOCK`. For other errors, it
- * must return :enum:`SPDYLAY_ERR_CALLBACK_FAILURE`.
- */
-ssize_t spdy_send_callback
-(spdylay_session *session,
- const uint8_t *data, size_t length, int flags, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when |session| wants to receive data from
- * the remote peer. The implementation of this function must read at
- * most |length| bytes of data and store it in |buf|. The |flags| is
- * currently not used and always 0. It must return the number of bytes
- * written in |buf| if it succeeds. If it cannot read any single byte
- * without blocking, it must return :enum:`SPDYLAY_ERR_WOULDBLOCK`. If
- * it gets EOF before it reads any single byte, it must return
- * :enum:`SPDYLAY_ERR_EOF`. For other errors, it must return
- * :enum:`SPDYLAY_ERR_CALLBACK_FAILURE`.
- */
-ssize_t spdy_recv_callback
-(spdylay_session *session,
- uint8_t *buf, size_t length, int flags, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked by `spdylay_session_recv()` when a
- * control frame is received.
- */
-void spdy_on_ctrl_recv_callback
-(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
- void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked by `spdylay_session_recv()` when an
- * invalid control frame is received. The |status_code| is one of the
- * :enum:`spdylay_status_code` and indicates the error. When this
- * callback function is invoked, the library automatically submits
- * either RST_STREAM or GOAWAY frame.
- */
-void spdy_on_invalid_ctrl_recv_callback
-(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
- uint32_t status_code, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when a chunk of data in DATA frame is
- * received. The |stream_id| is the stream ID this DATA frame belongs
- * to. The |flags| is the flags of DATA frame which this data chunk is
- * contained. ``(flags & SPDYLAY_DATA_FLAG_FIN) != 0`` does not
- * necessarily mean this chunk of data is the last one in the
- * stream. You should use :type:`spdylay_on_data_recv_callback` to
- * know all data frames are received.
- */
-void spdy_on_data_chunk_recv_callback
-(spdylay_session *session, uint8_t flags, int32_t stream_id,
- const uint8_t *data, size_t len, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when DATA frame is received. The actual
- * data it contains are received by
- * :type:`spdylay_on_data_chunk_recv_callback`.
- */
-void spdy_on_data_recv_callback
-(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length,
- void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked before the control frame |frame| of type
- * |type| is sent. This may be useful, for example, to know the stream
- * ID of SYN_STREAM frame (see also
- * `spdylay_session_get_stream_user_data()`), which is not assigned
- * when it was queued.
- */
-void spdy_before_ctrl_send_callback
-(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
- void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked after the control frame |frame| of type
- * |type| is sent.
- */
-void spdy_on_ctrl_send_callback
-(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
- void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked after the control frame |frame| of type
- * |type| is not sent because of the error. The error is indicated by
- * the |error_code|, which is one of the values defined in
- * :type:`spdylay_error`.
- */
-void spdy_on_ctrl_not_send_callback
-(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
- int error_code, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked after DATA frame is sent.
- */
-void spdy_on_data_send_callback
-(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length,
- void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when the stream |stream_id| is
- * closed. The reason of closure is indicated by the
- * |status_code|. The stream_user_data, which was specified in
- * `spdylay_submit_request()` or `spdylay_submit_syn_stream()`, is
- * still available in this function.
- */
-void spdy_on_stream_close_callback
-(spdylay_session *session, int32_t stream_id, spdylay_status_code status_code,
- void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when the library needs the cryptographic
- * proof that the client has possession of the private key associated
- * with the certificate for the given |origin|. If called with
- * |prooflen| == 0, the implementation of this function must return
- * the length of the proof in bytes. If called with |prooflen| > 0,
- * write proof into |proof| exactly |prooflen| bytes and return 0.
- *
- * Because the client certificate vector has limited number of slots,
- * the application code may be required to pass the same proof more
- * than once.
- */
-ssize_t spdy_get_credential_proof
-(spdylay_session *session, const spdylay_origin *origin,
- uint8_t *proof, size_t prooflen, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when the library needs the length of the
- * client certificate chain for the given |origin|. The
- * implementation of this function must return the length of the
- * client certificate chain. If no client certificate is required for
- * the given |origin|, return 0. If positive integer is returned,
- * :type:`spdylay_get_credential_proof` and
- * :type:`spdylay_get_credential_cert` callback functions will be used
- * to get the cryptographic proof and certificate respectively.
- */
-ssize_t spdy_get_credential_ncerts
-(spdylay_session *session, const spdylay_origin *origin, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when the library needs the client
- * certificate for the given |origin|. The |idx| is the index of the
- * certificate chain and 0 means the leaf certificate of the chain.
- * If called with |certlen| == 0, the implementation of this function
- * must return the length of the certificate in bytes. If called with
- * |certlen| > 0, write certificate into |cert| exactly |certlen|
- * bytes and return 0.
- */
-ssize_t spdy_get_credential_cert
-(spdylay_session *session, const spdylay_origin *origin, size_t idx,
- uint8_t *cert, size_t certlen, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when the request from the remote peer is
- * received. In other words, the frame with FIN flag set is received.
- * In HTTP, this means HTTP request, including request body, is fully
- * received.
- */
-void spdy_on_request_recv_callback
-(spdylay_session *session, int32_t stream_id, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when the received control frame octets
- * could not be parsed correctly. The |type| indicates the type of
- * received control frame. The |head| is the pointer to the header of
- * the received frame. The |headlen| is the length of the
- * |head|. According to the SPDY spec, the |headlen| is always 8. In
- * other words, the |head| is the first 8 bytes of the received frame.
- * The |payload| is the pointer to the data portion of the received
- * frame. The |payloadlen| is the length of the |payload|. This is
- * the data after the length field. The |error_code| is one of the
- * error code defined in :enum:`spdylay_error` and indicates the
- * error.
- */
-void spdy_on_ctrl_recv_parse_error_callback
-(spdylay_session *session, spdylay_frame_type type,
- const uint8_t *head, size_t headlen,
- const uint8_t *payload, size_t payloadlen,
- int error_code, void *user_data);
-
-/**
- * @functypedef
- *
- * Callback function invoked when the received control frame type is
- * unknown. The |head| is the pointer to the header of the received
- * frame. The |headlen| is the length of the |head|. According to the
- * SPDY spec, the |headlen| is always 8. In other words, the |head| is
- * the first 8 bytes of the received frame. The |payload| is the
- * pointer to the data portion of the received frame. The
- * |payloadlen| is the length of the |payload|. This is the data after
- * the length field.
- */
-void spdy_on_unknown_ctrl_recv_callback
-(spdylay_session *session,
- const uint8_t *head, size_t headlen,
- const uint8_t *payload, size_t payloadlen,
- void *user_data);
-
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/P_SpdyCommon.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdyCommon.h b/proxy/spdy/P_SpdyCommon.h
deleted file mode 100644
index 6a1f0de..0000000
--- a/proxy/spdy/P_SpdyCommon.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/** @file
-
- P_SpdyCommon.h
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 __P_SPDY_COMMON_H__
-#define __P_SPDY_COMMON_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <limits.h>
-#include <string.h>
-#include <string>
-#include <vector>
-#include <map>
-
-#include "P_Net.h"
-#include "ts/ts.h"
-#include "ts/libts.h"
-#include "ts/experimental.h"
-#include <spdylay/spdylay.h>
-using namespace std;
-
-#define STATUS_200 "200 OK"
-#define STATUS_304 "304 Not Modified"
-#define STATUS_400 "400 Bad Request"
-#define STATUS_404 "404 Not Found"
-#define STATUS_405 "405 Method Not Allowed"
-#define STATUS_500 "500 Internal Server Error"
-#define DEFAULT_HTML "index.html"
-#define SPDYD_SERVER "ATS Spdylay/" SPDYLAY_VERSION
-
-#define atomic_fetch_and_add(a, b) __sync_fetch_and_add(&a, b)
-#define atomic_fetch_and_sub(a, b) __sync_fetch_and_sub(&a, b)
-#define atomic_inc(a) atomic_fetch_and_add(a, 1)
-#define atomic_dec(a) atomic_fetch_and_sub(a, 1)
-
-struct SpdyConfig {
- bool verbose;
- bool enable_tls;
- bool keep_host_port;
- int serv_port;
- int max_concurrent_streams;
- int initial_window_size;
- spdylay_session_callbacks callbacks;
-};
-
-struct Config {
- SpdyConfig spdy;
- int nr_accept_threads;
- int accept_no_activity_timeout;
- int no_activity_timeout_in;
-};
-
-// Spdy Name/Value pairs
-class SpdyNV {
-public:
-
- SpdyNV(TSFetchSM fetch_sm);
- ~SpdyNV();
-
-public:
- const char **nv;
-
-private:
- SpdyNV();
- void *mime_hdr;
- char status[64];
- char version[64];
-};
-
-string http_date(time_t t);
-int spdy_config_load();
-
-extern Config SPDY_CFG;
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/P_SpdySM.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdySM.h b/proxy/spdy/P_SpdySM.h
deleted file mode 100644
index e66e642..0000000
--- a/proxy/spdy/P_SpdySM.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/** @file
-
- P_SpdySM.h
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 __P_SPDY_SM_H__
-#define __P_SPDY_SM_H__
-
-#include "P_SpdyCommon.h"
-#include "P_SpdyCallbacks.h"
-#include <openssl/md5.h>
-
-class SpdySM;
-typedef int (*SpdySMHandler) (TSCont contp, TSEvent event, void *data);
-
-class SpdyRequest
-{
-public:
- SpdyRequest():
- spdy_sm(NULL), stream_id(-1), fetch_sm(NULL),
- has_submitted_data(false), need_resume_data(false),
- fetch_data_len(0), delta_window_size(0),
- fetch_body_completed(false)
- {
- }
-
- SpdyRequest(SpdySM *sm, int id):
- spdy_sm(NULL), stream_id(-1), fetch_sm(NULL),
- has_submitted_data(false), need_resume_data(false),
- fetch_data_len(0), delta_window_size(0),
- fetch_body_completed(false)
- {
- init(sm, id);
- }
-
- ~SpdyRequest()
- {
- clear();
- }
-
- void init(SpdySM *sm, int id)
- {
- spdy_sm = sm;
- stream_id = id;
- headers.clear();
-
- MD5_Init(&recv_md5);
- start_time = TShrtime();
- }
-
- void clear();
-
- void append_nv(char **nv)
- {
- for(int i = 0; nv[i]; i += 2) {
- headers.push_back(make_pair(nv[i], nv[i+1]));
- }
- }
-
-public:
- int event;
- SpdySM *spdy_sm;
- int stream_id;
- TSHRTime start_time;
- TSFetchSM fetch_sm;
- bool has_submitted_data;
- bool need_resume_data;
- int fetch_data_len;
- int delta_window_size;
- bool fetch_body_completed;
- vector<pair<string, string> > headers;
-
- string url;
- string host;
- string path;
- string scheme;
- string method;
- string version;
-
- MD5_CTX recv_md5;
-};
-
-class SpdySM
-{
-
-public:
-
- SpdySM();
- SpdySM(TSVConn conn);
- ~SpdySM()
- {
- clear();
- }
-
- void init(TSVConn conn);
- void clear();
-
-public:
-
- int64_t sm_id;
- uint64_t total_size;
- TSHRTime start_time;
-
- TSVConn net_vc;
- TSCont contp;
-
- TSIOBuffer req_buffer;
- TSIOBufferReader req_reader;
-
- TSIOBuffer resp_buffer;
- TSIOBufferReader resp_reader;
-
- TSVIO read_vio;
- TSVIO write_vio;
-
- SpdySMHandler current_handler;
-
- int event;
- spdylay_session *session;
-
- map<int32_t, SpdyRequest*> req_map;
-};
-
-void spdy_sm_create(TSVConn cont);
-
-extern ClassAllocator<SpdySM> spdySMAllocator;
-extern ClassAllocator<SpdyRequest> spdyRequestAllocator;
-
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/P_SpdySessionAccept.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdySessionAccept.h b/proxy/spdy/P_SpdySessionAccept.h
deleted file mode 100644
index 960c771..0000000
--- a/proxy/spdy/P_SpdySessionAccept.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/** @file
-
- SpdySessionAccept
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 P_SpdySessionAccept_H_
-#define P_SpdySessionAccept_H_
-
-#include "P_Net.h"
-#include "P_EventSystem.h"
-#include "P_UnixNet.h"
-#include "I_IOBuffer.h"
-
-class SpdySessionAccept: public SessionAccept
-{
-public:
- SpdySessionAccept(Continuation *ep);
- ~SpdySessionAccept() {}
-
-private:
- int mainEvent(int event, void *netvc);
- SpdySessionAccept(const SpdySessionAccept &); // disabled
- SpdySessionAccept& operator =(const SpdySessionAccept&); // disabled
-
- Continuation *endpoint;
-};
-
-#endif /* P_SpdySessionAccept_H_ */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/SpdyCallbacks.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyCallbacks.cc b/proxy/spdy/SpdyCallbacks.cc
index 6f2de17..4a80685 100644
--- a/proxy/spdy/SpdyCallbacks.cc
+++ b/proxy/spdy/SpdyCallbacks.cc
@@ -21,8 +21,8 @@
limitations under the License.
*/
-#include "P_SpdyCallbacks.h"
-#include "P_SpdySM.h"
+#include "SpdyCallbacks.h"
+#include "SpdySM.h"
#include <arpa/inet.h>
void
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/SpdyCallbacks.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyCallbacks.h b/proxy/spdy/SpdyCallbacks.h
new file mode 100644
index 0000000..017eb41
--- /dev/null
+++ b/proxy/spdy/SpdyCallbacks.h
@@ -0,0 +1,269 @@
+/** @file
+
+ SpdyCallbacks.h
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 __P_SPDY_CALLBACKS_H__
+#define __P_SPDY_CALLBACKS_H__
+
+#include <spdylay/spdylay.h>
+class SpdySM;
+
+void spdy_callbacks_init(spdylay_session_callbacks *callbacks);
+void spdy_prepare_status_response(SpdySM *sm, int stream_id, const char *status);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when |session| wants to send data to the
+ * remote peer. The implementation of this function must send at most
+ * |length| bytes of data stored in |data|. The |flags| is currently
+ * not used and always 0. It must return the number of bytes sent if
+ * it succeeds. If it cannot send any single byte without blocking,
+ * it must return :enum:`SPDYLAY_ERR_WOULDBLOCK`. For other errors, it
+ * must return :enum:`SPDYLAY_ERR_CALLBACK_FAILURE`.
+ */
+ssize_t spdy_send_callback
+(spdylay_session *session,
+ const uint8_t *data, size_t length, int flags, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when |session| wants to receive data from
+ * the remote peer. The implementation of this function must read at
+ * most |length| bytes of data and store it in |buf|. The |flags| is
+ * currently not used and always 0. It must return the number of bytes
+ * written in |buf| if it succeeds. If it cannot read any single byte
+ * without blocking, it must return :enum:`SPDYLAY_ERR_WOULDBLOCK`. If
+ * it gets EOF before it reads any single byte, it must return
+ * :enum:`SPDYLAY_ERR_EOF`. For other errors, it must return
+ * :enum:`SPDYLAY_ERR_CALLBACK_FAILURE`.
+ */
+ssize_t spdy_recv_callback
+(spdylay_session *session,
+ uint8_t *buf, size_t length, int flags, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked by `spdylay_session_recv()` when a
+ * control frame is received.
+ */
+void spdy_on_ctrl_recv_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked by `spdylay_session_recv()` when an
+ * invalid control frame is received. The |status_code| is one of the
+ * :enum:`spdylay_status_code` and indicates the error. When this
+ * callback function is invoked, the library automatically submits
+ * either RST_STREAM or GOAWAY frame.
+ */
+void spdy_on_invalid_ctrl_recv_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ uint32_t status_code, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when a chunk of data in DATA frame is
+ * received. The |stream_id| is the stream ID this DATA frame belongs
+ * to. The |flags| is the flags of DATA frame which this data chunk is
+ * contained. ``(flags & SPDYLAY_DATA_FLAG_FIN) != 0`` does not
+ * necessarily mean this chunk of data is the last one in the
+ * stream. You should use :type:`spdylay_on_data_recv_callback` to
+ * know all data frames are received.
+ */
+void spdy_on_data_chunk_recv_callback
+(spdylay_session *session, uint8_t flags, int32_t stream_id,
+ const uint8_t *data, size_t len, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when DATA frame is received. The actual
+ * data it contains are received by
+ * :type:`spdylay_on_data_chunk_recv_callback`.
+ */
+void spdy_on_data_recv_callback
+(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked before the control frame |frame| of type
+ * |type| is sent. This may be useful, for example, to know the stream
+ * ID of SYN_STREAM frame (see also
+ * `spdylay_session_get_stream_user_data()`), which is not assigned
+ * when it was queued.
+ */
+void spdy_before_ctrl_send_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked after the control frame |frame| of type
+ * |type| is sent.
+ */
+void spdy_on_ctrl_send_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked after the control frame |frame| of type
+ * |type| is not sent because of the error. The error is indicated by
+ * the |error_code|, which is one of the values defined in
+ * :type:`spdylay_error`.
+ */
+void spdy_on_ctrl_not_send_callback
+(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
+ int error_code, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked after DATA frame is sent.
+ */
+void spdy_on_data_send_callback
+(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the stream |stream_id| is
+ * closed. The reason of closure is indicated by the
+ * |status_code|. The stream_user_data, which was specified in
+ * `spdylay_submit_request()` or `spdylay_submit_syn_stream()`, is
+ * still available in this function.
+ */
+void spdy_on_stream_close_callback
+(spdylay_session *session, int32_t stream_id, spdylay_status_code status_code,
+ void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the library needs the cryptographic
+ * proof that the client has possession of the private key associated
+ * with the certificate for the given |origin|. If called with
+ * |prooflen| == 0, the implementation of this function must return
+ * the length of the proof in bytes. If called with |prooflen| > 0,
+ * write proof into |proof| exactly |prooflen| bytes and return 0.
+ *
+ * Because the client certificate vector has limited number of slots,
+ * the application code may be required to pass the same proof more
+ * than once.
+ */
+ssize_t spdy_get_credential_proof
+(spdylay_session *session, const spdylay_origin *origin,
+ uint8_t *proof, size_t prooflen, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the library needs the length of the
+ * client certificate chain for the given |origin|. The
+ * implementation of this function must return the length of the
+ * client certificate chain. If no client certificate is required for
+ * the given |origin|, return 0. If positive integer is returned,
+ * :type:`spdylay_get_credential_proof` and
+ * :type:`spdylay_get_credential_cert` callback functions will be used
+ * to get the cryptographic proof and certificate respectively.
+ */
+ssize_t spdy_get_credential_ncerts
+(spdylay_session *session, const spdylay_origin *origin, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the library needs the client
+ * certificate for the given |origin|. The |idx| is the index of the
+ * certificate chain and 0 means the leaf certificate of the chain.
+ * If called with |certlen| == 0, the implementation of this function
+ * must return the length of the certificate in bytes. If called with
+ * |certlen| > 0, write certificate into |cert| exactly |certlen|
+ * bytes and return 0.
+ */
+ssize_t spdy_get_credential_cert
+(spdylay_session *session, const spdylay_origin *origin, size_t idx,
+ uint8_t *cert, size_t certlen, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the request from the remote peer is
+ * received. In other words, the frame with FIN flag set is received.
+ * In HTTP, this means HTTP request, including request body, is fully
+ * received.
+ */
+void spdy_on_request_recv_callback
+(spdylay_session *session, int32_t stream_id, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the received control frame octets
+ * could not be parsed correctly. The |type| indicates the type of
+ * received control frame. The |head| is the pointer to the header of
+ * the received frame. The |headlen| is the length of the
+ * |head|. According to the SPDY spec, the |headlen| is always 8. In
+ * other words, the |head| is the first 8 bytes of the received frame.
+ * The |payload| is the pointer to the data portion of the received
+ * frame. The |payloadlen| is the length of the |payload|. This is
+ * the data after the length field. The |error_code| is one of the
+ * error code defined in :enum:`spdylay_error` and indicates the
+ * error.
+ */
+void spdy_on_ctrl_recv_parse_error_callback
+(spdylay_session *session, spdylay_frame_type type,
+ const uint8_t *head, size_t headlen,
+ const uint8_t *payload, size_t payloadlen,
+ int error_code, void *user_data);
+
+/**
+ * @functypedef
+ *
+ * Callback function invoked when the received control frame type is
+ * unknown. The |head| is the pointer to the header of the received
+ * frame. The |headlen| is the length of the |head|. According to the
+ * SPDY spec, the |headlen| is always 8. In other words, the |head| is
+ * the first 8 bytes of the received frame. The |payload| is the
+ * pointer to the data portion of the received frame. The
+ * |payloadlen| is the length of the |payload|. This is the data after
+ * the length field.
+ */
+void spdy_on_unknown_ctrl_recv_callback
+(spdylay_session *session,
+ const uint8_t *head, size_t headlen,
+ const uint8_t *payload, size_t payloadlen,
+ void *user_data);
+
+#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/SpdyCommon.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyCommon.cc b/proxy/spdy/SpdyCommon.cc
index 1e0dff5..65f5cfc 100644
--- a/proxy/spdy/SpdyCommon.cc
+++ b/proxy/spdy/SpdyCommon.cc
@@ -21,8 +21,8 @@
limitations under the License.
*/
-#include "P_SpdyCommon.h"
-#include "P_SpdyCallbacks.h"
+#include "SpdyCommon.h"
+#include "SpdyCallbacks.h"
Config SPDY_CFG;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/SpdyCommon.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyCommon.h b/proxy/spdy/SpdyCommon.h
new file mode 100644
index 0000000..50d8fa4
--- /dev/null
+++ b/proxy/spdy/SpdyCommon.h
@@ -0,0 +1,96 @@
+/** @file
+
+ SpdyCommon.h
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 __P_SPDY_COMMON_H__
+#define __P_SPDY_COMMON_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <limits.h>
+#include <string.h>
+#include <string>
+#include <vector>
+#include <map>
+
+#include "P_Net.h"
+#include "ts/ts.h"
+#include "ts/libts.h"
+#include "ts/experimental.h"
+#include <spdylay/spdylay.h>
+using namespace std;
+
+#define STATUS_200 "200 OK"
+#define STATUS_304 "304 Not Modified"
+#define STATUS_400 "400 Bad Request"
+#define STATUS_404 "404 Not Found"
+#define STATUS_405 "405 Method Not Allowed"
+#define STATUS_500 "500 Internal Server Error"
+#define DEFAULT_HTML "index.html"
+#define SPDYD_SERVER "ATS Spdylay/" SPDYLAY_VERSION
+
+#define atomic_fetch_and_add(a, b) __sync_fetch_and_add(&a, b)
+#define atomic_fetch_and_sub(a, b) __sync_fetch_and_sub(&a, b)
+#define atomic_inc(a) atomic_fetch_and_add(a, 1)
+#define atomic_dec(a) atomic_fetch_and_sub(a, 1)
+
+struct SpdyConfig {
+ bool verbose;
+ bool enable_tls;
+ bool keep_host_port;
+ int serv_port;
+ int max_concurrent_streams;
+ int initial_window_size;
+ spdylay_session_callbacks callbacks;
+};
+
+struct Config {
+ SpdyConfig spdy;
+ int nr_accept_threads;
+ int accept_no_activity_timeout;
+ int no_activity_timeout_in;
+};
+
+// Spdy Name/Value pairs
+class SpdyNV {
+public:
+
+ SpdyNV(TSFetchSM fetch_sm);
+ ~SpdyNV();
+
+public:
+ const char **nv;
+
+private:
+ SpdyNV();
+ void *mime_hdr;
+ char status[64];
+ char version[64];
+};
+
+string http_date(time_t t);
+int spdy_config_load();
+
+extern Config SPDY_CFG;
+#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/SpdySM.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdySM.cc b/proxy/spdy/SpdySM.cc
index 1a6814c..8372d5b 100644
--- a/proxy/spdy/SpdySM.cc
+++ b/proxy/spdy/SpdySM.cc
@@ -21,7 +21,7 @@
limitations under the License.
*/
-#include "P_SpdySM.h"
+#include "SpdySM.h"
#include "I_Net.h"
ClassAllocator<SpdySM> spdySMAllocator("SpdySMAllocator");
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/SpdySM.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdySM.h b/proxy/spdy/SpdySM.h
new file mode 100644
index 0000000..f80b4d9
--- /dev/null
+++ b/proxy/spdy/SpdySM.h
@@ -0,0 +1,147 @@
+/** @file
+
+ SpdySM.h
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 __P_SPDY_SM_H__
+#define __P_SPDY_SM_H__
+
+#include "SpdyCommon.h"
+#include "SpdyCallbacks.h"
+#include <openssl/md5.h>
+
+class SpdySM;
+typedef int (*SpdySMHandler) (TSCont contp, TSEvent event, void *data);
+
+class SpdyRequest
+{
+public:
+ SpdyRequest():
+ spdy_sm(NULL), stream_id(-1), fetch_sm(NULL),
+ has_submitted_data(false), need_resume_data(false),
+ fetch_data_len(0), delta_window_size(0),
+ fetch_body_completed(false)
+ {
+ }
+
+ SpdyRequest(SpdySM *sm, int id):
+ spdy_sm(NULL), stream_id(-1), fetch_sm(NULL),
+ has_submitted_data(false), need_resume_data(false),
+ fetch_data_len(0), delta_window_size(0),
+ fetch_body_completed(false)
+ {
+ init(sm, id);
+ }
+
+ ~SpdyRequest()
+ {
+ clear();
+ }
+
+ void init(SpdySM *sm, int id)
+ {
+ spdy_sm = sm;
+ stream_id = id;
+ headers.clear();
+
+ MD5_Init(&recv_md5);
+ start_time = TShrtime();
+ }
+
+ void clear();
+
+ void append_nv(char **nv)
+ {
+ for(int i = 0; nv[i]; i += 2) {
+ headers.push_back(make_pair(nv[i], nv[i+1]));
+ }
+ }
+
+public:
+ int event;
+ SpdySM *spdy_sm;
+ int stream_id;
+ TSHRTime start_time;
+ TSFetchSM fetch_sm;
+ bool has_submitted_data;
+ bool need_resume_data;
+ int fetch_data_len;
+ int delta_window_size;
+ bool fetch_body_completed;
+ vector<pair<string, string> > headers;
+
+ string url;
+ string host;
+ string path;
+ string scheme;
+ string method;
+ string version;
+
+ MD5_CTX recv_md5;
+};
+
+class SpdySM
+{
+
+public:
+
+ SpdySM();
+ SpdySM(TSVConn conn);
+ ~SpdySM()
+ {
+ clear();
+ }
+
+ void init(TSVConn conn);
+ void clear();
+
+public:
+
+ int64_t sm_id;
+ uint64_t total_size;
+ TSHRTime start_time;
+
+ TSVConn net_vc;
+ TSCont contp;
+
+ TSIOBuffer req_buffer;
+ TSIOBufferReader req_reader;
+
+ TSIOBuffer resp_buffer;
+ TSIOBufferReader resp_reader;
+
+ TSVIO read_vio;
+ TSVIO write_vio;
+
+ SpdySMHandler current_handler;
+
+ int event;
+ spdylay_session *session;
+
+ map<int32_t, SpdyRequest*> req_map;
+};
+
+void spdy_sm_create(TSVConn cont);
+
+extern ClassAllocator<SpdySM> spdySMAllocator;
+extern ClassAllocator<SpdyRequest> spdyRequestAllocator;
+
+#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/SpdySessionAccept.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdySessionAccept.cc b/proxy/spdy/SpdySessionAccept.cc
index 601ad47..1b41e5d 100644
--- a/proxy/spdy/SpdySessionAccept.cc
+++ b/proxy/spdy/SpdySessionAccept.cc
@@ -21,9 +21,9 @@
limitations under the License.
*/
-#include "P_SpdySessionAccept.h"
+#include "SpdySessionAccept.h"
#if TS_HAS_SPDY
-#include "P_SpdySM.h"
+#include "SpdySM.h"
#endif
SpdySessionAccept::SpdySessionAccept(Continuation *ep)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7f036b4a/proxy/spdy/SpdySessionAccept.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdySessionAccept.h b/proxy/spdy/SpdySessionAccept.h
new file mode 100644
index 0000000..a0fc822
--- /dev/null
+++ b/proxy/spdy/SpdySessionAccept.h
@@ -0,0 +1,46 @@
+/** @file
+
+ SpdySessionAccept
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 SpdySessionAccept_H_
+#define SpdySessionAccept_H_
+
+#include "P_Net.h"
+#include "P_EventSystem.h"
+#include "P_UnixNet.h"
+#include "I_IOBuffer.h"
+
+class SpdySessionAccept: public SessionAccept
+{
+public:
+ SpdySessionAccept(Continuation *ep);
+ ~SpdySessionAccept() {}
+
+private:
+ int mainEvent(int event, void *netvc);
+ SpdySessionAccept(const SpdySessionAccept &); // disabled
+ SpdySessionAccept& operator =(const SpdySessionAccept&); // disabled
+
+ Continuation *endpoint;
+};
+
+#endif /* SpdySessionAccept_H_ */
[4/6] git commit: TS-2746: rename HttpAcceptCont to HttpSessionAccept
Posted by jp...@apache.org.
TS-2746: rename HttpAcceptCont to HttpSessionAccept
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/0d988fd9
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/0d988fd9
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/0d988fd9
Branch: refs/heads/master
Commit: 0d988fd9e0f9f381d5543c9a9d990978bed4966e
Parents: 523aa13
Author: James Peach <jp...@apache.org>
Authored: Thu Apr 24 13:14:36 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 28 14:19:21 2014 -0700
----------------------------------------------------------------------
proxy/InkAPI.cc | 6 +-
proxy/SocksProxy.cc | 6 +-
proxy/http/HttpAcceptCont.cc | 98 ----------------
proxy/http/HttpAcceptCont.h | 198 ---------------------------------
proxy/http/HttpProxyServerMain.cc | 20 ++--
proxy/http/HttpSessionAccept.cc | 98 ++++++++++++++++
proxy/http/HttpSessionAccept.h | 198 +++++++++++++++++++++++++++++++++
proxy/http/Makefile.am | 4 +-
8 files changed, 314 insertions(+), 314 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0d988fd9/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 501d931..44d37b9 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -51,7 +51,7 @@
#include "PluginVC.h"
#include "api/ts/experimental.h"
#include "ICP.h"
-#include "HttpAcceptCont.h"
+#include "HttpSessionAccept.h"
#include "PluginVC.h"
#include "FetchSM.h"
#include "HttpDebugNames.h"
@@ -6084,8 +6084,8 @@ TSClientProtoStackCreate(TSProtoType ptype, ...)
ink_release_assert(0);
}
-extern HttpAcceptCont *plugin_http_accept;
-extern HttpAcceptCont *plugin_http_transparent_accept;
+extern HttpSessionAccept *plugin_http_accept;
+extern HttpSessionAccept *plugin_http_transparent_accept;
TSVConn
TSHttpConnect(sockaddr const* addr)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0d988fd9/proxy/SocksProxy.cc
----------------------------------------------------------------------
diff --git a/proxy/SocksProxy.cc b/proxy/SocksProxy.cc
index d855689..64079ca 100644
--- a/proxy/SocksProxy.cc
+++ b/proxy/SocksProxy.cc
@@ -31,7 +31,7 @@
#include "StatSystem.h"
#include "P_Net.h"
#include "I_OneWayTunnel.h"
-#include "HttpAcceptCont.h"
+#include "HttpSessionAccept.h"
enum
{
@@ -145,14 +145,14 @@ SocksProxy::mainEvent(int event, void *data)
switch (state) {
case HTTP_REQ:{
- HttpAcceptCont::Options ha_opt;
+ HttpSessionAccept::Options ha_opt;
//This is a WRITE_COMPLETE. vio->nbytes == vio->ndone is true
SOCKSPROXY_INC_STAT(socksproxy_http_connections_stat);
Debug("SocksProxy", "Handing over the HTTP request\n");
ha_opt.transport_type = clientVC->attributes;
- HttpAcceptCont http_accept(ha_opt);
+ HttpSessionAccept http_accept(ha_opt);
http_accept.mainEvent(NET_EVENT_ACCEPT, clientVC);
state = ALL_DONE;
break;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0d988fd9/proxy/http/HttpAcceptCont.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpAcceptCont.cc b/proxy/http/HttpAcceptCont.cc
deleted file mode 100644
index d3744e7..0000000
--- a/proxy/http/HttpAcceptCont.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 "HttpAcceptCont.h"
-#include "IPAllow.h"
-#include "HttpClientSession.h"
-#include "I_Machine.h"
-#include "Error.h"
-
-int
-HttpAcceptCont::mainEvent(int event, void *data)
-{
- ink_release_assert(event == NET_EVENT_ACCEPT || event == EVENT_ERROR);
- ink_release_assert((event == NET_EVENT_ACCEPT) ? (data != 0) : (1));
-
- if (event == NET_EVENT_ACCEPT) {
- ////////////////////////////////////////////////////
- // if client address forbidden, close immediately //
- ////////////////////////////////////////////////////
- NetVConnection *netvc = static_cast<NetVConnection *>(data);
- sockaddr const* client_ip = netvc->get_remote_addr();
- uint32_t acl_method_mask = 0;
- ip_port_text_buffer ipb;
- IpAllow::scoped_config ipallow;
-
- // The backdoor port is now only bound to "localhost", so no
- // reason to check for if it's incoming from "localhost" or not.
- if (backdoor) {
- acl_method_mask = IpAllow::AllMethodMask();
- } else if (ipallow && ((acl_method_mask = ipallow->match(client_ip)) == 0)) {
- Warning("client '%s' prohibited by ip-allow policy", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
- netvc->do_io_close();
-
- return VC_EVENT_CONT;
- }
-
- netvc->attributes = transport_type;
-
- if (is_debug_tag_set("http_seq"))
- Debug("http_seq", "[HttpAcceptCont:mainEvent %p] accepted connection from %s transport type = %d", netvc, ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
-
- HttpClientSession *new_session = THREAD_ALLOC_INIT(httpClientSessionAllocator, netvc->thread);
-
- // copy over session related data.
- new_session->f_outbound_transparent = f_outbound_transparent;
- new_session->f_transparent_passthrough = f_transparent_passthrough;
- new_session->outbound_ip4 = outbound_ip4;
- new_session->outbound_ip6 = outbound_ip6;
- new_session->outbound_port = outbound_port;
- new_session->host_res_style = ats_host_res_from(client_ip->sa_family, host_res_preference);
- new_session->acl_method_mask = acl_method_mask;
-
- new_session->new_connection(netvc, backdoor);
-
- return EVENT_CONT;
- }
-
- /////////////////
- // EVENT_ERROR //
- /////////////////
- if (((long) data) == -ECONNABORTED) {
- /////////////////////////////////////////////////
- // Under Solaris, when accept() fails and sets //
- // errno to EPROTO, it means the client has //
- // sent a TCP reset before the connection has //
- // been accepted by the server... Note that //
- // in 2.5.1 with the Internet Server Supplement//
- // and also in 2.6 the errno for this case has //
- // changed from EPROTO to ECONNABORTED. //
- /////////////////////////////////////////////////
-
- // FIX: add time to user_agent_hangup
- HTTP_SUM_DYN_STAT(http_ua_msecs_counts_errors_pre_accept_hangups_stat, 0);
- }
-
- MachineFatal("HTTP accept received fatal error: errno = %d", -((int)(intptr_t)data));
- return EVENT_CONT;
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0d988fd9/proxy/http/HttpAcceptCont.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpAcceptCont.h b/proxy/http/HttpAcceptCont.h
deleted file mode 100644
index fcaa9e5..0000000
--- a/proxy/http/HttpAcceptCont.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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.
- */
-
-#if !defined (_HttpAcceptCont_h_)
-#define _HttpAcceptCont_h_
-
-#include "libts.h"
-#include "P_EventSystem.h"
-#include "HttpConfig.h"
-#include "HTTP.h"
-#include "I_Net.h"
-
-namespace detail {
- /** Options for @c HttpAcceptCont.
-
- @internal This is done as a separate class for two reasons.
-
- The first is that in current usage many instances are created
- with the same options so (for the client) this is easier and
- more efficient than passing options directly to the @c
- HttpAcceptCont or calling setters.
-
- The second is that @c HttpAcceptCont is not provided with any thread
- safety because it is intended as an immutable object. Putting
- the setters here and not there makes that clearer.
-
- We don't do this directly as nested class because we want to
- inherit the data members rather than duplicate the declarations
- and initializations.
- */
- class HttpAcceptContOptions {
- private:
- typedef HttpAcceptContOptions self; ///< Self reference type.
- public:
- HttpAcceptContOptions();
-
- // Connection type (HttpProxyPort::TransportType)
- int transport_type;
- /// Set the transport type.
- self& setTransportType(int);
- /// Local address to bind for outbound connections.
- IpAddr outbound_ip4;
- /// Local address to bind for outbound connections.
- IpAddr outbound_ip6;
- /// Set the outbound IP address to @a ip.
- self& setOutboundIp(IpAddr& ip);
- /// Set the outbound IP address to @a ip.
- self& setOutboundIp(IpEndpoint* ip);
- /// Local port for outbound connection.
- uint16_t outbound_port;
- /// Set outbound port.
- self& setOutboundPort(uint16_t);
- /// Outbound transparent.
- bool f_outbound_transparent;
- /// Set outbound transparency.
- self& setOutboundTransparent(bool);
- /// Transparent pass-through.
- bool f_transparent_passthrough;
- /// Set transparent passthrough.
- self& setTransparentPassthrough(bool);
- /// Accepting backdoor connections.
- bool backdoor;
- /// Set backdoor accept.
- self& setBackdoor(bool);
- /// Host address resolution preference order.
- HostResPreferenceOrder host_res_preference;
- /// Set the host query preference.
- self& setHostResPreference(HostResPreferenceOrder const);
- };
-
- inline HttpAcceptContOptions::HttpAcceptContOptions()
- : transport_type(0)
- , outbound_port(0)
- , f_outbound_transparent(false)
- , f_transparent_passthrough(false)
- , backdoor(false)
- {
- memcpy(host_res_preference, host_res_default_preference_order, sizeof(host_res_preference));
- }
-
- inline HttpAcceptContOptions&
- HttpAcceptContOptions::setTransportType(int type) {
- transport_type = type;
- return *this;
- }
-
- inline HttpAcceptContOptions&
- HttpAcceptContOptions::setOutboundIp(IpAddr& ip) {
- if (ip.isIp4()) outbound_ip4 = ip;
- else if (ip.isIp6()) outbound_ip6 = ip;
- return *this;
- }
-
- inline HttpAcceptContOptions&
- HttpAcceptContOptions::setOutboundIp(IpEndpoint* ip) {
- if (ip->isIp4()) outbound_ip4 = *ip;
- else if (ip->isIp6()) outbound_ip6 = *ip;
- return *this;
- }
-
- inline HttpAcceptContOptions&
- HttpAcceptContOptions::setOutboundPort(uint16_t port) {
- outbound_port = port;
- return *this;
- }
-
- inline HttpAcceptContOptions&
- HttpAcceptContOptions::setOutboundTransparent(bool flag) {
- f_outbound_transparent = flag;
- return *this;
- }
-
- inline HttpAcceptContOptions&
- HttpAcceptContOptions::setTransparentPassthrough(bool flag) {
- f_transparent_passthrough = flag;
- return *this;
- }
-
- inline HttpAcceptContOptions&
- HttpAcceptContOptions::setBackdoor(bool flag) {
- backdoor = flag;
- return *this;
- }
-
- inline HttpAcceptContOptions&
- HttpAcceptContOptions::setHostResPreference(HostResPreferenceOrder const order) {
- memcpy(host_res_preference, order, sizeof(host_res_preference));
- return *this;
- }
-}
-
-/**
- The continuation mutex is NULL to allow parellel accepts in NT. No
- state is recorded by the handler and values are required to be set
- during construction via the @c Options struct and never changed. So
- a NULL mutex is safe.
-
- Most of the state is simply passed on to the @c ClientSession after
- an accept. It is done here because this is the least bad pathway
- from the top level configuration to the HTTP session.
-*/
-
-class HttpAcceptCont: public SessionAccept, private detail::HttpAcceptContOptions
-{
-private:
- typedef HttpAcceptCont self; ///< Self reference type.
-public:
- /** Construction options.
- Provide an easier to remember typedef for clients.
- */
- typedef detail::HttpAcceptContOptions Options;
-
- /** Default constructor.
- @internal We don't use a static default options object because of
- initialization order issues. It is important to pick up data that is read
- from the config file and a static is initialized long before that point.
- */
- HttpAcceptCont(Options const& opt = Options())
- : SessionAccept(NULL)
- , detail::HttpAcceptContOptions(opt) // copy these.
- {
- SET_HANDLER(&HttpAcceptCont::mainEvent);
- return;
- }
-
- ~HttpAcceptCont()
- {
- return;
- }
-
- int mainEvent(int event, void *netvc);
-
-private:
- HttpAcceptCont(const HttpAcceptCont &);
- HttpAcceptCont & operator =(const HttpAcceptCont &);
-};
-
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0d988fd9/proxy/http/HttpProxyServerMain.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc
index 449418a..21e12ed 100644
--- a/proxy/http/HttpProxyServerMain.cc
+++ b/proxy/http/HttpProxyServerMain.cc
@@ -26,7 +26,7 @@
#include "Main.h"
#include "Error.h"
#include "HttpConfig.h"
-#include "HttpAcceptCont.h"
+#include "HttpSessionAccept.h"
#include "ReverseProxy.h"
#include "HttpSessionManager.h"
#include "HttpUpdateSM.h"
@@ -38,8 +38,8 @@
#include "P_ProtocolAcceptCont.h"
#include "P_SpdyAcceptCont.h"
-HttpAcceptCont *plugin_http_accept = NULL;
-HttpAcceptCont *plugin_http_transparent_accept = 0;
+HttpSessionAccept *plugin_http_accept = NULL;
+HttpSessionAccept *plugin_http_transparent_accept = 0;
static SLL<SSLNextProtocolAccept> ssl_plugin_acceptors;
static ink_mutex ssl_plugin_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -137,7 +137,7 @@ static void
MakeHttpProxyAcceptor(HttpProxyAcceptor& acceptor, HttpProxyPort& port, unsigned nthreads)
{
NetProcessor::AcceptOptions& net_opt = acceptor._net_opt;
- HttpAcceptCont::Options accept_opt;
+ HttpSessionAccept::Options accept_opt;
net_opt = make_net_accept_options(port, nthreads);
net_opt.create_default_NetAccept = false;
@@ -163,7 +163,7 @@ MakeHttpProxyAcceptor(HttpProxyAcceptor& acceptor, HttpProxyPort& port, unsigned
accept_opt.outbound_ip6 = HttpConfig::m_master.outbound_ip6;
}
- HttpAcceptCont *http = NEW(new HttpAcceptCont(accept_opt));
+ HttpSessionAccept *http = NEW(new HttpSessionAccept(accept_opt));
SpdyAcceptCont *spdy = NEW(new SpdyAcceptCont(http));
SSLNextProtocolAccept *ssl = NEW(new SSLNextProtocolAccept(http));
ProtocolAcceptCont *proto = NEW(new ProtocolAcceptCont());
@@ -214,14 +214,14 @@ init_HttpProxyServer(int n_accept_threads)
// port but without going through the operating system
//
if (plugin_http_accept == NULL) {
- plugin_http_accept = NEW(new HttpAcceptCont);
+ plugin_http_accept = NEW(new HttpSessionAccept);
plugin_http_accept->mutex = new_ProxyMutex();
}
// Same as plugin_http_accept except outbound transparent.
if (! plugin_http_transparent_accept) {
- HttpAcceptCont::Options ha_opt;
+ HttpSessionAccept::Options ha_opt;
ha_opt.setOutboundTransparent(true);
- plugin_http_transparent_accept = NEW(new HttpAcceptCont(ha_opt));
+ plugin_http_transparent_accept = NEW(new HttpSessionAccept(ha_opt));
plugin_http_transparent_accept->mutex = new_ProxyMutex();
}
ink_mutex_init(&ssl_plugin_mutex, "SSL Acceptor List");
@@ -279,7 +279,7 @@ void
start_HttpProxyServerBackDoor(int port, int accept_threads)
{
NetProcessor::AcceptOptions opt;
- HttpAcceptCont::Options ha_opt;
+ HttpSessionAccept::Options ha_opt;
opt.local_port = port;
opt.accept_threads = accept_threads;
@@ -288,5 +288,5 @@ start_HttpProxyServerBackDoor(int port, int accept_threads)
opt.backdoor = true;
// The backdoor only binds the loopback interface
- netProcessor.main_accept(NEW(new HttpAcceptCont(ha_opt)), NO_FD, opt);
+ netProcessor.main_accept(NEW(new HttpSessionAccept(ha_opt)), NO_FD, opt);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0d988fd9/proxy/http/HttpSessionAccept.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSessionAccept.cc b/proxy/http/HttpSessionAccept.cc
new file mode 100644
index 0000000..ec8dc28
--- /dev/null
+++ b/proxy/http/HttpSessionAccept.cc
@@ -0,0 +1,98 @@
+/** @file
+
+ A brief file description
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 "HttpSessionAccept.h"
+#include "IPAllow.h"
+#include "HttpClientSession.h"
+#include "I_Machine.h"
+#include "Error.h"
+
+int
+HttpSessionAccept::mainEvent(int event, void *data)
+{
+ ink_release_assert(event == NET_EVENT_ACCEPT || event == EVENT_ERROR);
+ ink_release_assert((event == NET_EVENT_ACCEPT) ? (data != 0) : (1));
+
+ if (event == NET_EVENT_ACCEPT) {
+ ////////////////////////////////////////////////////
+ // if client address forbidden, close immediately //
+ ////////////////////////////////////////////////////
+ NetVConnection *netvc = static_cast<NetVConnection *>(data);
+ sockaddr const* client_ip = netvc->get_remote_addr();
+ uint32_t acl_method_mask = 0;
+ ip_port_text_buffer ipb;
+ IpAllow::scoped_config ipallow;
+
+ // The backdoor port is now only bound to "localhost", so no
+ // reason to check for if it's incoming from "localhost" or not.
+ if (backdoor) {
+ acl_method_mask = IpAllow::AllMethodMask();
+ } else if (ipallow && ((acl_method_mask = ipallow->match(client_ip)) == 0)) {
+ Warning("client '%s' prohibited by ip-allow policy", ats_ip_ntop(client_ip, ipb, sizeof(ipb)));
+ netvc->do_io_close();
+
+ return VC_EVENT_CONT;
+ }
+
+ netvc->attributes = transport_type;
+
+ if (is_debug_tag_set("http_seq"))
+ Debug("http_seq", "[HttpSessionAccept:mainEvent %p] accepted connection from %s transport type = %d", netvc, ats_ip_nptop(client_ip, ipb, sizeof(ipb)), netvc->attributes);
+
+ HttpClientSession *new_session = THREAD_ALLOC_INIT(httpClientSessionAllocator, netvc->thread);
+
+ // copy over session related data.
+ new_session->f_outbound_transparent = f_outbound_transparent;
+ new_session->f_transparent_passthrough = f_transparent_passthrough;
+ new_session->outbound_ip4 = outbound_ip4;
+ new_session->outbound_ip6 = outbound_ip6;
+ new_session->outbound_port = outbound_port;
+ new_session->host_res_style = ats_host_res_from(client_ip->sa_family, host_res_preference);
+ new_session->acl_method_mask = acl_method_mask;
+
+ new_session->new_connection(netvc, backdoor);
+
+ return EVENT_CONT;
+ }
+
+ /////////////////
+ // EVENT_ERROR //
+ /////////////////
+ if (((long) data) == -ECONNABORTED) {
+ /////////////////////////////////////////////////
+ // Under Solaris, when accept() fails and sets //
+ // errno to EPROTO, it means the client has //
+ // sent a TCP reset before the connection has //
+ // been accepted by the server... Note that //
+ // in 2.5.1 with the Internet Server Supplement//
+ // and also in 2.6 the errno for this case has //
+ // changed from EPROTO to ECONNABORTED. //
+ /////////////////////////////////////////////////
+
+ // FIX: add time to user_agent_hangup
+ HTTP_SUM_DYN_STAT(http_ua_msecs_counts_errors_pre_accept_hangups_stat, 0);
+ }
+
+ MachineFatal("HTTP accept received fatal error: errno = %d", -((int)(intptr_t)data));
+ return EVENT_CONT;
+}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0d988fd9/proxy/http/HttpSessionAccept.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSessionAccept.h b/proxy/http/HttpSessionAccept.h
new file mode 100644
index 0000000..49947af
--- /dev/null
+++ b/proxy/http/HttpSessionAccept.h
@@ -0,0 +1,198 @@
+/** @file
+
+ A brief file description
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ */
+
+#if !defined (_HttpSessionAccept_h_)
+#define _HttpSessionAccept_h_
+
+#include "libts.h"
+#include "P_EventSystem.h"
+#include "HttpConfig.h"
+#include "HTTP.h"
+#include "I_Net.h"
+
+namespace detail {
+ /** Options for @c HttpSessionAccept.
+
+ @internal This is done as a separate class for two reasons.
+
+ The first is that in current usage many instances are created
+ with the same options so (for the client) this is easier and
+ more efficient than passing options directly to the @c
+ HttpSessionAccept or calling setters.
+
+ The second is that @c HttpSessionAccept is not provided with any thread
+ safety because it is intended as an immutable object. Putting
+ the setters here and not there makes that clearer.
+
+ We don't do this directly as nested class because we want to
+ inherit the data members rather than duplicate the declarations
+ and initializations.
+ */
+ class HttpSessionAcceptOptions {
+ private:
+ typedef HttpSessionAcceptOptions self; ///< Self reference type.
+ public:
+ HttpSessionAcceptOptions();
+
+ // Connection type (HttpProxyPort::TransportType)
+ int transport_type;
+ /// Set the transport type.
+ self& setTransportType(int);
+ /// Local address to bind for outbound connections.
+ IpAddr outbound_ip4;
+ /// Local address to bind for outbound connections.
+ IpAddr outbound_ip6;
+ /// Set the outbound IP address to @a ip.
+ self& setOutboundIp(IpAddr& ip);
+ /// Set the outbound IP address to @a ip.
+ self& setOutboundIp(IpEndpoint* ip);
+ /// Local port for outbound connection.
+ uint16_t outbound_port;
+ /// Set outbound port.
+ self& setOutboundPort(uint16_t);
+ /// Outbound transparent.
+ bool f_outbound_transparent;
+ /// Set outbound transparency.
+ self& setOutboundTransparent(bool);
+ /// Transparent pass-through.
+ bool f_transparent_passthrough;
+ /// Set transparent passthrough.
+ self& setTransparentPassthrough(bool);
+ /// Accepting backdoor connections.
+ bool backdoor;
+ /// Set backdoor accept.
+ self& setBackdoor(bool);
+ /// Host address resolution preference order.
+ HostResPreferenceOrder host_res_preference;
+ /// Set the host query preference.
+ self& setHostResPreference(HostResPreferenceOrder const);
+ };
+
+ inline HttpSessionAcceptOptions::HttpSessionAcceptOptions()
+ : transport_type(0)
+ , outbound_port(0)
+ , f_outbound_transparent(false)
+ , f_transparent_passthrough(false)
+ , backdoor(false)
+ {
+ memcpy(host_res_preference, host_res_default_preference_order, sizeof(host_res_preference));
+ }
+
+ inline HttpSessionAcceptOptions&
+ HttpSessionAcceptOptions::setTransportType(int type) {
+ transport_type = type;
+ return *this;
+ }
+
+ inline HttpSessionAcceptOptions&
+ HttpSessionAcceptOptions::setOutboundIp(IpAddr& ip) {
+ if (ip.isIp4()) outbound_ip4 = ip;
+ else if (ip.isIp6()) outbound_ip6 = ip;
+ return *this;
+ }
+
+ inline HttpSessionAcceptOptions&
+ HttpSessionAcceptOptions::setOutboundIp(IpEndpoint* ip) {
+ if (ip->isIp4()) outbound_ip4 = *ip;
+ else if (ip->isIp6()) outbound_ip6 = *ip;
+ return *this;
+ }
+
+ inline HttpSessionAcceptOptions&
+ HttpSessionAcceptOptions::setOutboundPort(uint16_t port) {
+ outbound_port = port;
+ return *this;
+ }
+
+ inline HttpSessionAcceptOptions&
+ HttpSessionAcceptOptions::setOutboundTransparent(bool flag) {
+ f_outbound_transparent = flag;
+ return *this;
+ }
+
+ inline HttpSessionAcceptOptions&
+ HttpSessionAcceptOptions::setTransparentPassthrough(bool flag) {
+ f_transparent_passthrough = flag;
+ return *this;
+ }
+
+ inline HttpSessionAcceptOptions&
+ HttpSessionAcceptOptions::setBackdoor(bool flag) {
+ backdoor = flag;
+ return *this;
+ }
+
+ inline HttpSessionAcceptOptions&
+ HttpSessionAcceptOptions::setHostResPreference(HostResPreferenceOrder const order) {
+ memcpy(host_res_preference, order, sizeof(host_res_preference));
+ return *this;
+ }
+}
+
+/**
+ The continuation mutex is NULL to allow parellel accepts in NT. No
+ state is recorded by the handler and values are required to be set
+ during construction via the @c Options struct and never changed. So
+ a NULL mutex is safe.
+
+ Most of the state is simply passed on to the @c ClientSession after
+ an accept. It is done here because this is the least bad pathway
+ from the top level configuration to the HTTP session.
+*/
+
+class HttpSessionAccept: public SessionAccept, private detail::HttpSessionAcceptOptions
+{
+private:
+ typedef HttpSessionAccept self; ///< Self reference type.
+public:
+ /** Construction options.
+ Provide an easier to remember typedef for clients.
+ */
+ typedef detail::HttpSessionAcceptOptions Options;
+
+ /** Default constructor.
+ @internal We don't use a static default options object because of
+ initialization order issues. It is important to pick up data that is read
+ from the config file and a static is initialized long before that point.
+ */
+ HttpSessionAccept(Options const& opt = Options())
+ : SessionAccept(NULL)
+ , detail::HttpSessionAcceptOptions(opt) // copy these.
+ {
+ SET_HANDLER(&HttpSessionAccept::mainEvent);
+ return;
+ }
+
+ ~HttpSessionAccept()
+ {
+ return;
+ }
+
+ int mainEvent(int event, void *netvc);
+
+private:
+ HttpSessionAccept(const HttpSessionAccept &);
+ HttpSessionAccept & operator =(const HttpSessionAccept &);
+};
+
+#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0d988fd9/proxy/http/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/http/Makefile.am b/proxy/http/Makefile.am
index a71d287..b77604f 100644
--- a/proxy/http/Makefile.am
+++ b/proxy/http/Makefile.am
@@ -38,8 +38,8 @@ noinst_HEADERS = HttpProxyServerMain.h
noinst_LIBRARIES = libhttp.a
libhttp_a_SOURCES = \
- HttpAcceptCont.cc \
- HttpAcceptCont.h \
+ HttpSessionAccept.cc \
+ HttpSessionAccept.h \
HttpBodyFactory.cc \
HttpBodyFactory.h \
HttpCacheSM.cc \
[6/6] git commit: TS-2746: CHANGES
Posted by jp...@apache.org.
TS-2746: CHANGES
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/81390c57
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/81390c57
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/81390c57
Branch: refs/heads/master
Commit: 81390c57b0563b9b603e543e7e2dfdbf37738c75
Parents: 7f036b4
Author: James Peach <jp...@apache.org>
Authored: Mon Apr 28 14:29:36 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 28 14:29:36 2014 -0700
----------------------------------------------------------------------
CHANGES | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/81390c57/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index cd35151..b9b6d1d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 5.0.0
+ *) [TS-2746] Rename session accept layer with a standard convention.
+
*) [TS-2754] Emit a tcpinfo log on TS_EVENT_HTTP_TXN_CLOSE.
*) [TS-2760] Add TSFetchClientProtoStackSet/Get() API in experimental.h.
[5/6] git commit: TS-2746: rename SpdyAcceptCont to SpdySessionAccept
Posted by jp...@apache.org.
TS-2746: rename SpdyAcceptCont to SpdySessionAccept
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5ec5921b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5ec5921b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5ec5921b
Branch: refs/heads/master
Commit: 5ec5921b180e31c478892f2879d780f40979ebe8
Parents: 0d988fd
Author: James Peach <jp...@apache.org>
Authored: Thu Apr 24 13:23:06 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 28 14:19:21 2014 -0700
----------------------------------------------------------------------
proxy/http/HttpProxyServerMain.cc | 4 +--
proxy/spdy/Makefile.am | 4 +--
proxy/spdy/P_SpdyAcceptCont.h | 46 ---------------------------------
proxy/spdy/P_SpdySessionAccept.h | 46 +++++++++++++++++++++++++++++++++
proxy/spdy/SpdyAcceptCont.cc | 47 ----------------------------------
proxy/spdy/SpdySessionAccept.cc | 47 ++++++++++++++++++++++++++++++++++
6 files changed, 97 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ec5921b/proxy/http/HttpProxyServerMain.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc
index 21e12ed..9c7b866 100644
--- a/proxy/http/HttpProxyServerMain.cc
+++ b/proxy/http/HttpProxyServerMain.cc
@@ -36,7 +36,7 @@
#include "Tokenizer.h"
#include "P_SSLNextProtocolAccept.h"
#include "P_ProtocolAcceptCont.h"
-#include "P_SpdyAcceptCont.h"
+#include "P_SpdySessionAccept.h"
HttpSessionAccept *plugin_http_accept = NULL;
HttpSessionAccept *plugin_http_transparent_accept = 0;
@@ -164,7 +164,7 @@ MakeHttpProxyAcceptor(HttpProxyAcceptor& acceptor, HttpProxyPort& port, unsigned
}
HttpSessionAccept *http = NEW(new HttpSessionAccept(accept_opt));
- SpdyAcceptCont *spdy = NEW(new SpdyAcceptCont(http));
+ SpdySessionAccept *spdy = NEW(new SpdySessionAccept(http));
SSLNextProtocolAccept *ssl = NEW(new SSLNextProtocolAccept(http));
ProtocolAcceptCont *proto = NEW(new ProtocolAcceptCont());
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ec5921b/proxy/spdy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/spdy/Makefile.am b/proxy/spdy/Makefile.am
index a85dc61..ddf336e 100644
--- a/proxy/spdy/Makefile.am
+++ b/proxy/spdy/Makefile.am
@@ -34,8 +34,8 @@ AM_CPPFLAGS = \
noinst_LIBRARIES = libspdy.a
libspdy_a_SOURCES = \
- P_SpdyAcceptCont.h \
- SpdyAcceptCont.cc
+ P_SpdySessionAccept.h \
+ SpdySessionAccept.cc
if BUILD_SPDY
libspdy_a_SOURCES += \
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ec5921b/proxy/spdy/P_SpdyAcceptCont.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdyAcceptCont.h b/proxy/spdy/P_SpdyAcceptCont.h
deleted file mode 100644
index f7a00ab..0000000
--- a/proxy/spdy/P_SpdyAcceptCont.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/** @file
-
- SpdyAcceptCont
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 P_SpdyAcceptCont_H_
-#define P_SpdyAcceptCont_H_
-
-#include "P_Net.h"
-#include "P_EventSystem.h"
-#include "P_UnixNet.h"
-#include "I_IOBuffer.h"
-
-class SpdyAcceptCont: public SessionAccept
-{
-public:
- SpdyAcceptCont(Continuation *ep);
- ~SpdyAcceptCont() {}
-
-private:
- int mainEvent(int event, void *netvc);
- SpdyAcceptCont(const SpdyAcceptCont &); // disabled
- SpdyAcceptCont& operator =(const SpdyAcceptCont&); // disabled
-
- Continuation *endpoint;
-};
-
-#endif /* P_SpdyAcceptCont_H_ */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ec5921b/proxy/spdy/P_SpdySessionAccept.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdySessionAccept.h b/proxy/spdy/P_SpdySessionAccept.h
new file mode 100644
index 0000000..960c771
--- /dev/null
+++ b/proxy/spdy/P_SpdySessionAccept.h
@@ -0,0 +1,46 @@
+/** @file
+
+ SpdySessionAccept
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 P_SpdySessionAccept_H_
+#define P_SpdySessionAccept_H_
+
+#include "P_Net.h"
+#include "P_EventSystem.h"
+#include "P_UnixNet.h"
+#include "I_IOBuffer.h"
+
+class SpdySessionAccept: public SessionAccept
+{
+public:
+ SpdySessionAccept(Continuation *ep);
+ ~SpdySessionAccept() {}
+
+private:
+ int mainEvent(int event, void *netvc);
+ SpdySessionAccept(const SpdySessionAccept &); // disabled
+ SpdySessionAccept& operator =(const SpdySessionAccept&); // disabled
+
+ Continuation *endpoint;
+};
+
+#endif /* P_SpdySessionAccept_H_ */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ec5921b/proxy/spdy/SpdyAcceptCont.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyAcceptCont.cc b/proxy/spdy/SpdyAcceptCont.cc
deleted file mode 100644
index 5f1aa3c..0000000
--- a/proxy/spdy/SpdyAcceptCont.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-/** @file
-
- SpdyNetAccept
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 "P_SpdyAcceptCont.h"
-#if TS_HAS_SPDY
-#include "P_SpdySM.h"
-#endif
-
-SpdyAcceptCont::SpdyAcceptCont(Continuation *ep)
- : SessionAccept(new_ProxyMutex()), endpoint(ep)
-{
-#if TS_HAS_SPDY
- spdy_config_load();
-#endif
- SET_HANDLER(&SpdyAcceptCont::mainEvent);
-}
-
-int
-SpdyAcceptCont::mainEvent(int /* event */, void *netvc)
-{
-#if TS_HAS_SPDY
- spdy_sm_create((TSCont)netvc);
-#else
- (void)(netvc);
-#endif
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5ec5921b/proxy/spdy/SpdySessionAccept.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdySessionAccept.cc b/proxy/spdy/SpdySessionAccept.cc
new file mode 100644
index 0000000..601ad47
--- /dev/null
+++ b/proxy/spdy/SpdySessionAccept.cc
@@ -0,0 +1,47 @@
+/** @file
+
+ SpdyNetAccept
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 "P_SpdySessionAccept.h"
+#if TS_HAS_SPDY
+#include "P_SpdySM.h"
+#endif
+
+SpdySessionAccept::SpdySessionAccept(Continuation *ep)
+ : SessionAccept(new_ProxyMutex()), endpoint(ep)
+{
+#if TS_HAS_SPDY
+ spdy_config_load();
+#endif
+ SET_HANDLER(&SpdySessionAccept::mainEvent);
+}
+
+int
+SpdySessionAccept::mainEvent(int /* event */, void *netvc)
+{
+#if TS_HAS_SPDY
+ spdy_sm_create((TSCont)netvc);
+#else
+ (void)(netvc);
+#endif
+ return 0;
+}
[3/6] git commit: TS-2746: rename AcceptCont to SessionAccept
Posted by jp...@apache.org.
TS-2746: rename AcceptCont to SessionAccept
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/523aa13c
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/523aa13c
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/523aa13c
Branch: refs/heads/master
Commit: 523aa13cdb3ecd61135e9997d294eeeb97b7ddce
Parents: 7b08eb8
Author: James Peach <jp...@apache.org>
Authored: Thu Apr 24 09:50:25 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 28 14:19:21 2014 -0700
----------------------------------------------------------------------
iocore/net/AcceptCont.cc | 41 --------------------------
iocore/net/I_AcceptCont.h | 48 ------------------------------
iocore/net/I_Net.h | 2 +-
iocore/net/I_SessionAccept.h | 49 +++++++++++++++++++++++++++++++
iocore/net/Makefile.am | 4 +--
iocore/net/P_ProtocolAcceptCont.h | 6 ++--
iocore/net/P_SSLNextProtocolAccept.h | 2 +-
iocore/net/SSLNextProtocolAccept.cc | 2 +-
iocore/net/SessionAccept.cc | 41 ++++++++++++++++++++++++++
iocore/net/UnixNetProcessor.cc | 2 +-
proxy/http/HttpAcceptCont.h | 4 +--
proxy/spdy/P_SpdyAcceptCont.h | 2 +-
proxy/spdy/SpdyAcceptCont.cc | 2 +-
13 files changed, 103 insertions(+), 102 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/AcceptCont.cc
----------------------------------------------------------------------
diff --git a/iocore/net/AcceptCont.cc b/iocore/net/AcceptCont.cc
deleted file mode 100644
index e112230..0000000
--- a/iocore/net/AcceptCont.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-/** @file
-
- AcceptCont
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 "I_AcceptCont.h"
-#include "P_Net.h"
-
-AcceptCont::AcceptCont(ProxyMutex *amutex)
- : Continuation(amutex)
-{
- SET_HANDLER(&AcceptCont::mainEvent);
-}
-
-AcceptCont::~AcceptCont()
-{
-}
-
-void *
-AcceptCont::createNetAccept()
-{
- return (NEW(new NetAccept));
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/I_AcceptCont.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_AcceptCont.h b/iocore/net/I_AcceptCont.h
deleted file mode 100644
index 2d59e1e..0000000
--- a/iocore/net/I_AcceptCont.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
-
- AcceptCont
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 I_AcceptCont_H_
-#define I_AcceptCont_H_
-#include "I_Net.h"
-#include "I_VConnection.h"
-
-class AcceptCont: public Continuation
-{
-public:
- AcceptCont(ProxyMutex *amutex);
- ~AcceptCont();
-
- //
- // Virtual function allows creation of an SSLNetAccept
- // or NetAccept transparent to NetProcessor.
- //
- // This function should return a pointer
- // of NetAccept or its subclass.
- //
- virtual void *createNetAccept();
-
-private:
- virtual int mainEvent(int event, void * netvc) = 0;
-};
-
-#endif /* I_AcceptCont_H_ */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/I_Net.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_Net.h b/iocore/net/I_Net.h
index c52d041..333f24b 100644
--- a/iocore/net/I_Net.h
+++ b/iocore/net/I_Net.h
@@ -83,7 +83,7 @@ extern int net_config_poll_timeout;
#include "I_NetVConnection.h"
#include "I_NetProcessor.h"
-#include "I_AcceptCont.h"
+#include "I_SessionAccept.h"
void ink_net_init(ModuleVersion version);
#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/I_SessionAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_SessionAccept.h b/iocore/net/I_SessionAccept.h
new file mode 100644
index 0000000..c7fc9c1
--- /dev/null
+++ b/iocore/net/I_SessionAccept.h
@@ -0,0 +1,49 @@
+/** @file
+
+ SessionAccept
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 I_SessionAccept_H_
+#define I_SessionAccept_H_
+
+#include "I_Net.h"
+#include "I_VConnection.h"
+
+class SessionAccept: public Continuation
+{
+public:
+ SessionAccept(ProxyMutex *amutex);
+ ~SessionAccept();
+
+ //
+ // Virtual function allows creation of an SSLNetAccept
+ // or NetAccept transparent to NetProcessor.
+ //
+ // This function should return a pointer
+ // of NetAccept or its subclass.
+ //
+ virtual void *createNetAccept();
+
+private:
+ virtual int mainEvent(int event, void * netvc) = 0;
+};
+
+#endif /* I_SessionAccept_H_ */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am
index efbfa86..4657620 100644
--- a/iocore/net/Makefile.am
+++ b/iocore/net/Makefile.am
@@ -52,8 +52,8 @@ libinknet_a_SOURCES = \
I_UDPNet.h \
I_UDPPacket.h \
Inline.cc \
- I_AcceptCont.h \
- AcceptCont.cc \
+ I_SessionAccept.h \
+ SessionAccept.cc \
Net.cc \
NetVConnection.cc \
P_CompletionUtil.h \
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/P_ProtocolAcceptCont.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_ProtocolAcceptCont.h b/iocore/net/P_ProtocolAcceptCont.h
index 8b25cd8..4400ea1 100644
--- a/iocore/net/P_ProtocolAcceptCont.h
+++ b/iocore/net/P_ProtocolAcceptCont.h
@@ -24,12 +24,12 @@
#ifndef P_ProtocolAcceptCont_H_
#define P_ProtocolAcceptCont_H_
-#include "I_AcceptCont.h"
+#include "I_SessionAccept.h"
-class ProtocolAcceptCont: public AcceptCont
+class ProtocolAcceptCont: public SessionAccept
{
public:
- ProtocolAcceptCont(): AcceptCont(NULL)
+ ProtocolAcceptCont(): SessionAccept(NULL)
{
memset(endpoint, 0, sizeof(endpoint));
SET_HANDLER(&ProtocolAcceptCont::mainEvent);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/P_SSLNextProtocolAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNextProtocolAccept.h b/iocore/net/P_SSLNextProtocolAccept.h
index 342485a..1e0a96d 100644
--- a/iocore/net/P_SSLNextProtocolAccept.h
+++ b/iocore/net/P_SSLNextProtocolAccept.h
@@ -31,7 +31,7 @@
#include "P_SSLNextProtocolSet.h"
#include "I_IOBuffer.h"
-class SSLNextProtocolAccept: public AcceptCont
+class SSLNextProtocolAccept: public SessionAccept
{
public:
SSLNextProtocolAccept(Continuation *);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/SSLNextProtocolAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNextProtocolAccept.cc b/iocore/net/SSLNextProtocolAccept.cc
index 746995b..31c8cd4 100644
--- a/iocore/net/SSLNextProtocolAccept.cc
+++ b/iocore/net/SSLNextProtocolAccept.cc
@@ -147,7 +147,7 @@ SSLNextProtocolAccept::unregisterEndpoint(
}
SSLNextProtocolAccept::SSLNextProtocolAccept(Continuation * ep)
- : AcceptCont(NULL), buffer(new_empty_MIOBuffer()), endpoint(ep)
+ : SessionAccept(NULL), buffer(new_empty_MIOBuffer()), endpoint(ep)
{
SET_HANDLER(&SSLNextProtocolAccept::mainEvent);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/SessionAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SessionAccept.cc b/iocore/net/SessionAccept.cc
new file mode 100644
index 0000000..351ffff
--- /dev/null
+++ b/iocore/net/SessionAccept.cc
@@ -0,0 +1,41 @@
+/** @file
+
+ SessionAccept
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 "I_SessionAccept.h"
+#include "P_Net.h"
+
+SessionAccept::SessionAccept(ProxyMutex *amutex)
+ : Continuation(amutex)
+{
+ SET_HANDLER(&SessionAccept::mainEvent);
+}
+
+SessionAccept::~SessionAccept()
+{
+}
+
+void *
+SessionAccept::createNetAccept()
+{
+ return (NEW(new NetAccept));
+}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/iocore/net/UnixNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index ce59bbe..825db85 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -86,7 +86,7 @@ Action *
UnixNetProcessor::accept_internal(Continuation *cont, int fd, AcceptOptions const& opt)
{
EventType upgraded_etype = opt.etype; // setEtype requires non-const ref.
- AcceptCont *acceptCont = static_cast<AcceptCont *>(cont);
+ SessionAccept *acceptCont = static_cast<SessionAccept *>(cont);
EThread *thread = this_ethread();
ProxyMutex *mutex = thread->mutex;
int accept_threads = opt.accept_threads; // might be changed.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/proxy/http/HttpAcceptCont.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpAcceptCont.h b/proxy/http/HttpAcceptCont.h
index 5b8c437..fcaa9e5 100644
--- a/proxy/http/HttpAcceptCont.h
+++ b/proxy/http/HttpAcceptCont.h
@@ -160,7 +160,7 @@ namespace detail {
from the top level configuration to the HTTP session.
*/
-class HttpAcceptCont: public AcceptCont, private detail::HttpAcceptContOptions
+class HttpAcceptCont: public SessionAccept, private detail::HttpAcceptContOptions
{
private:
typedef HttpAcceptCont self; ///< Self reference type.
@@ -176,7 +176,7 @@ public:
from the config file and a static is initialized long before that point.
*/
HttpAcceptCont(Options const& opt = Options())
- : AcceptCont(NULL)
+ : SessionAccept(NULL)
, detail::HttpAcceptContOptions(opt) // copy these.
{
SET_HANDLER(&HttpAcceptCont::mainEvent);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/proxy/spdy/P_SpdyAcceptCont.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/P_SpdyAcceptCont.h b/proxy/spdy/P_SpdyAcceptCont.h
index 88aea02..f7a00ab 100644
--- a/proxy/spdy/P_SpdyAcceptCont.h
+++ b/proxy/spdy/P_SpdyAcceptCont.h
@@ -29,7 +29,7 @@
#include "P_UnixNet.h"
#include "I_IOBuffer.h"
-class SpdyAcceptCont: public AcceptCont
+class SpdyAcceptCont: public SessionAccept
{
public:
SpdyAcceptCont(Continuation *ep);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/523aa13c/proxy/spdy/SpdyAcceptCont.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyAcceptCont.cc b/proxy/spdy/SpdyAcceptCont.cc
index 95bfe03..5f1aa3c 100644
--- a/proxy/spdy/SpdyAcceptCont.cc
+++ b/proxy/spdy/SpdyAcceptCont.cc
@@ -27,7 +27,7 @@
#endif
SpdyAcceptCont::SpdyAcceptCont(Continuation *ep)
- : AcceptCont(new_ProxyMutex()), endpoint(ep)
+ : SessionAccept(new_ProxyMutex()), endpoint(ep)
{
#if TS_HAS_SPDY
spdy_config_load();
[2/6] git commit: TS-2746: rename ProtocolAcceptCont to
ProtocolProbeSessionAccept
Posted by jp...@apache.org.
TS-2746: rename ProtocolAcceptCont to ProtocolProbeSessionAccept
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/20eb9adb
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/20eb9adb
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/20eb9adb
Branch: refs/heads/master
Commit: 20eb9adbb6bfaeaebc26d552afd3ee816e778dc6
Parents: 5ec5921
Author: James Peach <jp...@apache.org>
Authored: Thu Apr 24 13:30:22 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 28 14:19:21 2014 -0700
----------------------------------------------------------------------
iocore/net/Makefile.am | 4 +-
iocore/net/P_ProtocolAcceptCont.h | 50 ------------------
iocore/net/P_ProtocolProbeSessionAccept.h | 50 ++++++++++++++++++
iocore/net/ProtocolAcceptCont.cc | 73 --------------------------
iocore/net/ProtocolProbeSessionAccept.cc | 73 ++++++++++++++++++++++++++
proxy/http/HttpProxyServerMain.cc | 4 +-
6 files changed, 127 insertions(+), 127 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/20eb9adb/iocore/net/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am
index 4657620..376ec9d 100644
--- a/iocore/net/Makefile.am
+++ b/iocore/net/Makefile.am
@@ -64,7 +64,7 @@ libinknet_a_SOURCES = \
P_NetAccept.h \
P_NetVConnection.h \
P_ProtocolNetAccept.h \
- P_ProtocolAcceptCont.h \
+ P_ProtocolProbeSessionAccept.h \
P_Socks.h \
P_SSLCertLookup.h \
P_SSLConfig.h \
@@ -87,7 +87,7 @@ libinknet_a_SOURCES = \
P_UnixPollDescriptor.h \
P_UnixUDPConnection.h \
ProtocolNetAccept.cc \
- ProtocolAcceptCont.cc \
+ ProtocolProbeSessionAccept.cc \
Socks.cc \
SSLCertLookup.cc \
SSLConfig.cc \
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/20eb9adb/iocore/net/P_ProtocolAcceptCont.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_ProtocolAcceptCont.h b/iocore/net/P_ProtocolAcceptCont.h
deleted file mode 100644
index 4400ea1..0000000
--- a/iocore/net/P_ProtocolAcceptCont.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
-
- ProtocolAcceptCont
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 P_ProtocolAcceptCont_H_
-#define P_ProtocolAcceptCont_H_
-
-#include "I_SessionAccept.h"
-
-class ProtocolAcceptCont: public SessionAccept
-{
-public:
- ProtocolAcceptCont(): SessionAccept(NULL)
- {
- memset(endpoint, 0, sizeof(endpoint));
- SET_HANDLER(&ProtocolAcceptCont::mainEvent);
- }
- ~ProtocolAcceptCont() {}
-
- void *createNetAccept();
- void registerEndpoint(TSProtoType type, Continuation *ep);
-
-private:
- int mainEvent(int event, void * netvc);
- ProtocolAcceptCont(const ProtocolAcceptCont &); // disabled
- ProtocolAcceptCont& operator =(const ProtocolAcceptCont&); // disabled
-
- Continuation *endpoint[sizeof(TSClientProtoStack) * CHAR_BIT];
-};
-
-#endif /* P_ProtocolAcceptCont_H_ */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/20eb9adb/iocore/net/P_ProtocolProbeSessionAccept.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_ProtocolProbeSessionAccept.h b/iocore/net/P_ProtocolProbeSessionAccept.h
new file mode 100644
index 0000000..424751c
--- /dev/null
+++ b/iocore/net/P_ProtocolProbeSessionAccept.h
@@ -0,0 +1,50 @@
+/** @file
+
+ ProtocolProbeSessionAccept
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 P_ProtocolProbeSessionAccept_H_
+#define P_ProtocolProbeSessionAccept_H_
+
+#include "I_SessionAccept.h"
+
+class ProtocolProbeSessionAccept: public SessionAccept
+{
+public:
+ ProtocolProbeSessionAccept(): SessionAccept(NULL)
+ {
+ memset(endpoint, 0, sizeof(endpoint));
+ SET_HANDLER(&ProtocolProbeSessionAccept::mainEvent);
+ }
+ ~ProtocolProbeSessionAccept() {}
+
+ void *createNetAccept();
+ void registerEndpoint(TSProtoType type, Continuation *ep);
+
+private:
+ int mainEvent(int event, void * netvc);
+ ProtocolProbeSessionAccept(const ProtocolProbeSessionAccept &); // disabled
+ ProtocolProbeSessionAccept& operator =(const ProtocolProbeSessionAccept&); // disabled
+
+ Continuation *endpoint[sizeof(TSClientProtoStack) * CHAR_BIT];
+};
+
+#endif /* P_ProtocolProbeSessionAccept_H_ */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/20eb9adb/iocore/net/ProtocolAcceptCont.cc
----------------------------------------------------------------------
diff --git a/iocore/net/ProtocolAcceptCont.cc b/iocore/net/ProtocolAcceptCont.cc
deleted file mode 100644
index 2e73b77..0000000
--- a/iocore/net/ProtocolAcceptCont.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
-
- ProtocolAcceptCont
-
- @section license License
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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 "P_ProtocolAcceptCont.h"
-#include "P_SSLNextProtocolAccept.h"
-#include "P_Net.h"
-#include "I_Machine.h"
-#include "Error.h"
-
-void *
-ProtocolAcceptCont::createNetAccept()
-{
- return ((NetAccept *) NEW(new ProtocolNetAccept));
-}
-
-void
-ProtocolAcceptCont::registerEndpoint(TSProtoType type, Continuation *ep)
-{
- endpoint[type] = ep;
-}
-
-int
-ProtocolAcceptCont::mainEvent(int event, void *netvc)
-{
- ink_release_assert(event == NET_EVENT_ACCEPT || event == EVENT_ERROR);
- ink_release_assert((event == NET_EVENT_ACCEPT) ? (netvc!= 0) : (1));
-
- if (event == NET_EVENT_ACCEPT) {
- TSProtoType proto_type;
- UnixNetVConnection *vc = (UnixNetVConnection *)netvc;
-
- if (vc->proto_stack & (1u << TS_PROTO_TLS)) {
- proto_type = TS_PROTO_TLS;
- } else if (vc->proto_stack & (1u << TS_PROTO_HTTP)) {
- proto_type = TS_PROTO_HTTP;
- } else if (vc->proto_stack & (1u << TS_PROTO_SPDY)) {
- proto_type = TS_PROTO_SPDY;
- } else {
- Warning("Invalid protocol stack:%x", vc->proto_stack);
- return EVENT_CONT;
- }
-
- if (endpoint[proto_type])
- endpoint[proto_type]->handleEvent(NET_EVENT_ACCEPT, netvc);
- else
- Warning("Unregistered protocol type:%x", proto_type);
-
- return EVENT_CONT;
- }
-
- MachineFatal("Protocol Accept received fatal error: errno = %d", -((int)(intptr_t)netvc));
- return EVENT_CONT;
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/20eb9adb/iocore/net/ProtocolProbeSessionAccept.cc
----------------------------------------------------------------------
diff --git a/iocore/net/ProtocolProbeSessionAccept.cc b/iocore/net/ProtocolProbeSessionAccept.cc
new file mode 100644
index 0000000..a7aee6e
--- /dev/null
+++ b/iocore/net/ProtocolProbeSessionAccept.cc
@@ -0,0 +1,73 @@
+/** @file
+
+ ProtocolProbeSessionAccept
+
+ @section license License
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 "P_ProtocolProbeSessionAccept.h"
+#include "P_SSLNextProtocolAccept.h"
+#include "P_Net.h"
+#include "I_Machine.h"
+#include "Error.h"
+
+void *
+ProtocolProbeSessionAccept::createNetAccept()
+{
+ return ((NetAccept *) NEW(new ProtocolNetAccept));
+}
+
+void
+ProtocolProbeSessionAccept::registerEndpoint(TSProtoType type, Continuation *ep)
+{
+ endpoint[type] = ep;
+}
+
+int
+ProtocolProbeSessionAccept::mainEvent(int event, void *netvc)
+{
+ ink_release_assert(event == NET_EVENT_ACCEPT || event == EVENT_ERROR);
+ ink_release_assert((event == NET_EVENT_ACCEPT) ? (netvc!= 0) : (1));
+
+ if (event == NET_EVENT_ACCEPT) {
+ TSProtoType proto_type;
+ UnixNetVConnection *vc = (UnixNetVConnection *)netvc;
+
+ if (vc->proto_stack & (1u << TS_PROTO_TLS)) {
+ proto_type = TS_PROTO_TLS;
+ } else if (vc->proto_stack & (1u << TS_PROTO_HTTP)) {
+ proto_type = TS_PROTO_HTTP;
+ } else if (vc->proto_stack & (1u << TS_PROTO_SPDY)) {
+ proto_type = TS_PROTO_SPDY;
+ } else {
+ Warning("Invalid protocol stack:%x", vc->proto_stack);
+ return EVENT_CONT;
+ }
+
+ if (endpoint[proto_type])
+ endpoint[proto_type]->handleEvent(NET_EVENT_ACCEPT, netvc);
+ else
+ Warning("Unregistered protocol type:%x", proto_type);
+
+ return EVENT_CONT;
+ }
+
+ MachineFatal("Protocol Accept received fatal error: errno = %d", -((int)(intptr_t)netvc));
+ return EVENT_CONT;
+}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/20eb9adb/proxy/http/HttpProxyServerMain.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc
index 9c7b866..a881f86 100644
--- a/proxy/http/HttpProxyServerMain.cc
+++ b/proxy/http/HttpProxyServerMain.cc
@@ -35,7 +35,7 @@
#include "HttpTunnel.h"
#include "Tokenizer.h"
#include "P_SSLNextProtocolAccept.h"
-#include "P_ProtocolAcceptCont.h"
+#include "P_ProtocolProbeSessionAccept.h"
#include "P_SpdySessionAccept.h"
HttpSessionAccept *plugin_http_accept = NULL;
@@ -166,7 +166,7 @@ MakeHttpProxyAcceptor(HttpProxyAcceptor& acceptor, HttpProxyPort& port, unsigned
HttpSessionAccept *http = NEW(new HttpSessionAccept(accept_opt));
SpdySessionAccept *spdy = NEW(new SpdySessionAccept(http));
SSLNextProtocolAccept *ssl = NEW(new SSLNextProtocolAccept(http));
- ProtocolAcceptCont *proto = NEW(new ProtocolAcceptCont());
+ ProtocolProbeSessionAccept *proto = NEW(new ProtocolProbeSessionAccept());
proto->registerEndpoint(TS_PROTO_TLS, ssl);
proto->registerEndpoint(TS_PROTO_HTTP, http);