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 2013/08/21 23:58:52 UTC
[1/3] git commit: TS-2116: Making buffer_upload compile
Updated Branches:
refs/heads/master 0f585e999 -> db31fe532
TS-2116: Making buffer_upload compile
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/fdfdc624
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/fdfdc624
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/fdfdc624
Branch: refs/heads/master
Commit: fdfdc624348d02eecc606b68e2d4390fed2249bf
Parents: 0f585e9
Author: Kit Chan <ch...@gmail.com>
Authored: Tue Aug 20 09:23:03 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Aug 21 14:58:04 2013 -0700
----------------------------------------------------------------------
configure.ac | 1 +
plugins/experimental/Makefile.am | 1 +
plugins/experimental/buffer_upload/Makefile.am | 21 ++++++++
.../experimental/buffer_upload/buffer_upload.cc | 53 +++++++++++++-------
4 files changed, 57 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fdfdc624/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 015380e..8765984 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1846,6 +1846,7 @@ AC_CONFIG_FILES([
plugins/conf_remap/Makefile
plugins/experimental/Makefile
plugins/experimental/authproxy/Makefile
+ plugins/experimental/buffer_upload/Makefile
plugins/experimental/channel_stats/Makefile
plugins/experimental/custom_redirect/Makefile
plugins/experimental/esi/Makefile
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fdfdc624/plugins/experimental/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/Makefile.am b/plugins/experimental/Makefile.am
index d284623..bb97af1 100644
--- a/plugins/experimental/Makefile.am
+++ b/plugins/experimental/Makefile.am
@@ -17,6 +17,7 @@
if BUILD_EXPERIMENTAL_PLUGINS
SUBDIRS = \
lua \
+ buffer_upload \
esi \
rfc5861 \
tcp_info \
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fdfdc624/plugins/experimental/buffer_upload/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/buffer_upload/Makefile.am b/plugins/experimental/buffer_upload/Makefile.am
new file mode 100644
index 0000000..d21c09e
--- /dev/null
+++ b/plugins/experimental/buffer_upload/Makefile.am
@@ -0,0 +1,21 @@
+# 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 $(top_srcdir)/build/plugins.mk
+
+pkglib_LTLIBRARIES = buffer_upload.la
+buffer_upload_la_SOURCES = buffer_upload.cc
+buffer_upload_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fdfdc624/plugins/experimental/buffer_upload/buffer_upload.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/buffer_upload/buffer_upload.cc b/plugins/experimental/buffer_upload/buffer_upload.cc
index 847c519..373818c 100644
--- a/plugins/experimental/buffer_upload/buffer_upload.cc
+++ b/plugins/experimental/buffer_upload/buffer_upload.cc
@@ -40,6 +40,7 @@
#include <dirent.h>
#include <unistd.h>
#include <stdlib.h>
+#include <inttypes.h>
#define true 1
#define false 0
@@ -64,7 +65,6 @@
#define VALID_PTR(X) (X != NULL)
#define NOT_VALID_PTR(X) (X == NULL)
-
struct upload_config_t
{
bool use_disk_buffer;
@@ -181,7 +181,7 @@ write_buffer_to_disk(TSIOBufferReader reader, pvc_state * my_state, TSCont contp
LOG_ERROR_AND_RETURN("TSAIOWrite");
}
memcpy(pBuf, ptr, size);
- if (TSAIOWrite(my_state->fd, my_state->write_offset, pBuf, size, contp) < 0) {
+ if (TSAIOWrite(my_state->fd, my_state->write_offset, pBuf, size, contp) == TS_ERROR) {
LOG_ERROR_AND_RETURN("TSAIOWrite");
}
my_state->write_offset += size;
@@ -675,7 +675,7 @@ convert_url_func(TSMBuffer req_bufp, TSMLoc req_loc)
}
static int
-attach_pvc_plugin(TSCont contp, TSEvent event, void *edata)
+attach_pvc_plugin(TSCont /* contp ATS_UNUSED */, TSEvent event, void *edata)
{
TSHttpTxn txnp = (TSHttpTxn) edata;
TSMutex mutex;
@@ -690,30 +690,41 @@ attach_pvc_plugin(TSCont contp, TSEvent event, void *edata)
int content_length = 0;
const char *method;
int method_len;
- const char *str;
- int str_len;
-
+ const char *host_str;
+ int host_str_len;
+ const char *host_hdr_str_val;
+ int host_hdr_str_val_len;
+
+ TSDebug(DEBUG_TAG, "inside attach_pvc_plugin");
switch (event) {
case TS_EVENT_HTTP_READ_REQUEST_PRE_REMAP:
// if the request is issued by the TSHttpConnect() in this plugin, don't get in the endless cycle.
- if (TSHttpIsInternalRequest(txnp)) {
+ if (TSHttpIsInternalRequest(txnp) == TS_SUCCESS) {
+ TSDebug(DEBUG_TAG, "internal request");
break;
}
- if (!TSHttpTxnClientReqGet(txnp, &req_bufp, &req_loc)) {
+ if (TSHttpTxnClientReqGet(txnp, &req_bufp, &req_loc) == TS_ERROR) {
LOG_ERROR("Error while retrieving client request header");
break;
}
method = TSHttpHdrMethodGet(req_bufp, req_loc, &method_len);
+ TSDebug(DEBUG_TAG, "inside handler");
if (NOT_VALID_PTR(method) || method_len == 0) {
+ TSDebug(DEBUG_TAG, "invalid method");
+
TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
break;
}
// only deal with POST method
+ TSDebug(DEBUG_TAG, "method: %s", method);
+
if (static_cast<size_t>(method_len) != strlen(TS_HTTP_METHOD_POST) || strncasecmp(method, TS_HTTP_METHOD_POST, method_len) != 0) {
+ TSDebug(DEBUG_TAG, "Not POST method");
+
//TSHandleStringRelease(req_bufp, req_loc, method);
TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
break;
@@ -727,9 +738,11 @@ attach_pvc_plugin(TSCont contp, TSEvent event, void *edata)
// check against URL list
if (TSHttpHdrUrlGet(req_bufp, req_loc, &url_loc) == TS_ERROR) {
LOG_ERROR("Couldn't get the url");
+ TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
+ break;
}
- str = TSUrlHostGet(req_bufp, url_loc, &str_len);
- if (NOT_VALID_PTR(str) || str_len <= 0) {
+ host_str = TSUrlHostGet(req_bufp, url_loc, &host_str_len);
+ if (NOT_VALID_PTR(host_str) || host_str_len <= 0) {
// reverse proxy mode
field_loc = TSMimeHdrFieldFind(req_bufp, req_loc, TS_MIME_FIELD_HOST, -1);
if (NOT_VALID_PTR(field_loc)) {
@@ -740,8 +753,8 @@ attach_pvc_plugin(TSCont contp, TSEvent event, void *edata)
TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
break;
}
- str = TSMimeHdrFieldValueStringGet(req_bufp, req_loc, field_loc, 0, &str_len);
- if (NOT_VALID_PTR(str) || str_len <= 0) {
+ host_hdr_str_val = TSMimeHdrFieldValueStringGet(req_bufp, req_loc, field_loc, 0, &host_hdr_str_val_len);
+ if (NOT_VALID_PTR(host_hdr_str_val) || host_hdr_str_val_len <= 0) {
//if (VALID_PTR(str))
// TSHandleStringRelease(req_bufp, field_loc, str);
TSHandleMLocRelease(req_bufp, req_loc, field_loc);
@@ -750,12 +763,12 @@ attach_pvc_plugin(TSCont contp, TSEvent event, void *edata)
break;
}
- char replacement_host_str[str_len + 1];
+ char replacement_host_str[host_hdr_str_val_len + 1];
memset(replacement_host_str, 0, sizeof replacement_host_str);
- memcpy(replacement_host_str, str, str_len);
+ memcpy(replacement_host_str, host_hdr_str_val, host_hdr_str_val_len);
TSDebug(DEBUG_TAG, "Adding host to request url: %s", replacement_host_str);
- TSUrlHostSet(req_bufp, url_loc, str, str_len);
+ TSUrlHostSet(req_bufp, url_loc, host_hdr_str_val, host_hdr_str_val_len);
//TSHandleStringRelease(req_bufp, field_loc, str);
TSHandleMLocRelease(req_bufp, req_loc, field_loc);
@@ -778,7 +791,7 @@ attach_pvc_plugin(TSCont contp, TSEvent event, void *edata)
}
}
- //TSHandleStringRelease(req_bufp, url_loc, url);
+ TSfree(url);
}
TSHandleMLocRelease(req_bufp, req_loc, url_loc);
@@ -794,8 +807,8 @@ attach_pvc_plugin(TSCont contp, TSEvent event, void *edata)
convert_url_func(req_bufp, req_loc);
}
- if ((field_loc = TSMimeHdrFieldFind(req_bufp, req_loc, TS_MIME_FIELD_CONTENT_LENGTH, TS_MIME_LEN_CONTENT_LENGTH)) ||
- field_loc == NULL) {
+ field_loc = TSMimeHdrFieldFind(req_bufp, req_loc, TS_MIME_FIELD_CONTENT_LENGTH, TS_MIME_LEN_CONTENT_LENGTH);
+ if(field_loc == NULL) {
TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc);
LOG_ERROR("TSMimeHdrFieldRetrieve");
break;
@@ -875,7 +888,7 @@ attach_pvc_plugin(TSCont contp, TSEvent event, void *edata)
if (!uconfig->use_disk_buffer && my_state->req_size > uconfig->mem_buffer_size) {
TSDebug(DEBUG_TAG,
- "The request size %lu is larger than memory buffer size %lu, bypass upload proxy feature for this request.",
+ "The request size %" PRId64 " is larger than memory buffer size %" PRId64 ", bypass upload proxy feature for this request.",
my_state->req_size, uconfig->mem_buffer_size);
pvc_cleanup(new_cont, my_state);
@@ -1193,6 +1206,7 @@ read_upload_config(const char *file_name)
// default value
uconfig->thread_num = 4;
}
+
return true;
}
@@ -1249,3 +1263,4 @@ TSPluginInit(int argc, const char *argv[])
contp = TSContCreate(attach_pvc_plugin, NULL);
TSHttpHookAdd(TS_HTTP_READ_REQUEST_PRE_REMAP_HOOK, contp);
}
+
[2/3] git commit: TS-2114: removing true/false definition
Posted by jp...@apache.org.
TS-2114: removing true/false definition
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/04e5a40a
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/04e5a40a
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/04e5a40a
Branch: refs/heads/master
Commit: 04e5a40a372378c5804d694bc80912380fd5096c
Parents: fdfdc62
Author: Kit Chan <ch...@gmail.com>
Authored: Tue Aug 20 09:38:21 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Aug 21 14:58:08 2013 -0700
----------------------------------------------------------------------
plugins/experimental/buffer_upload/buffer_upload.cc | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/04e5a40a/plugins/experimental/buffer_upload/buffer_upload.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/buffer_upload/buffer_upload.cc b/plugins/experimental/buffer_upload/buffer_upload.cc
index 373818c..ae82135 100644
--- a/plugins/experimental/buffer_upload/buffer_upload.cc
+++ b/plugins/experimental/buffer_upload/buffer_upload.cc
@@ -42,9 +42,6 @@
#include <stdlib.h>
#include <inttypes.h>
-#define true 1
-#define false 0
-
/* #define DEBUG 1 */
#define DEBUG_TAG "buffer_upload-dbg"
[3/3] git commit: update CHANGES for TS-2114 and TS-2116
Posted by jp...@apache.org.
update CHANGES for TS-2114 and TS-2116
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/db31fe53
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/db31fe53
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/db31fe53
Branch: refs/heads/master
Commit: db31fe532632e3033f32f918c2c319342ea1b0bf
Parents: 04e5a40
Author: James Peach <jp...@apache.org>
Authored: Wed Aug 21 14:56:01 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Aug 21 14:58:08 2013 -0700
----------------------------------------------------------------------
CHANGES | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db31fe53/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ea531a2..c2e5d1b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,12 @@
Changes with Apache Traffic Server 4.1.0
+ *) [TS-2114] buffer_upload plugin defines true and false
+ Author: Kit Chan <ch...@gmail.com>
+
+ *) [TS-2116] buffer_upload plugin is in the source tree but does not build
+ Author: Kit Chan <ch...@gmail.com>
+
*) [TS-2094] eliminate xcrun warnings at configure time
*) [TS-2141] Inconsistent euid cause bad mgmtapi/eventapi sockets.