You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sj...@apache.org on 2010/05/29 10:18:17 UTC
svn commit: r949353 - in /trafficserver/traffic/trunk: CHANGES
proxy/http2/HttpBodyFactory.cc proxy/http2/HttpBodyFactory.h
proxy/http2/HttpTransact.cc
Author: sjiang
Date: Sat May 29 08:18:16 2010
New Revision: 949353
URL: http://svn.apache.org/viewvc?rev=949353&view=rev
Log:
TS-290: Fix body factory returning truncated Content-Type
Added buf size to function signatures.
Modified:
trafficserver/traffic/trunk/CHANGES
trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.cc
trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.h
trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc
Modified: trafficserver/traffic/trunk/CHANGES
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/CHANGES?rev=949353&r1=949352&r2=949353&view=diff
==============================================================================
--- trafficserver/traffic/trunk/CHANGES (original)
+++ trafficserver/traffic/trunk/CHANGES Sat May 29 08:18:16 2010
@@ -15,6 +15,8 @@ Changes with Apache Traffic Server 2.1.1
*) HTTP state machine is now 64-bit "clean", allowing for caching and
proxying documents larger than 2GB [TS-34].
+
+ *) Fix for truncated Content-Type on TS-generated responses [TS-290].
Changes with Apache Traffic Server 2.1.0
Modified: trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.cc?rev=949353&r1=949352&r2=949353&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.cc Sat May 29 08:18:16 2010
@@ -60,8 +60,10 @@
char *
HttpBodyFactory::fabricate_with_old_api(const char *type, HttpTransact::State * context,
int64 max_buffer_length, int64 *resulting_buffer_length,
- char content_language_out[256],
- char content_type_out[256],
+ char* content_language_out_buf,
+ size_t content_language_buf_size,
+ char* content_type_out_buf,
+ size_t content_type_buf_size,
HTTPStatus status_code, const char *reason_or_null, const char *format, va_list ap)
{
char *buffer = NULL;
@@ -76,8 +78,8 @@ HttpBodyFactory::fabricate_with_old_api(
*resulting_buffer_length = 0;
- ink_strncpy(content_language_out, "en", sizeof(content_language_out));
- ink_strncpy(content_type_out, "text/html", sizeof(content_type_out));
+ ink_strncpy(content_language_out_buf, "en", content_language_buf_size);
+ ink_strncpy(content_type_out_buf, "text/html", content_type_buf_size);
///////////////////////////////////////////////////////////////////
// if logging turned on, buffer up the URL string for simplicity //
@@ -165,8 +167,8 @@ HttpBodyFactory::fabricate_with_old_api(
if (buffer) // got an instantiated template
{
if (!plain_flag) {
- snprintf(content_language_out, sizeof(content_language_out), "%s", lang_ptr);
- snprintf(content_type_out, sizeof(content_type_out), "text/html; charset=%s", charset_ptr);
+ snprintf(content_language_out_buf, content_language_buf_size, "%s", lang_ptr);
+ snprintf(content_type_out_buf, content_type_buf_size, "text/html; charset=%s", charset_ptr);
}
if (enable_logging && !context->traffic_net_req) {
Modified: trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.h?rev=949353&r1=949352&r2=949353&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.h (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpBodyFactory.h Sat May 29 08:18:16 2010
@@ -158,21 +158,27 @@ public:
///////////////////////
char *fabricate_with_old_api(const char *type, HttpTransact::State * context,
int64 max_buffer_length, int64 *resulting_buffer_length,
- char content_language_out[256],
- char content_type_out[256],
+ char* content_language_out_buf,
+ size_t content_language_buf_size,
+ char* content_type_out_buf,
+ size_t content_type_buf_size,
HTTPStatus status_code, const char *reason_or_null, const char *format, va_list ap);
char *fabricate_with_old_api_build_va(const char *type, HttpTransact::State * context,
int64 max_buffer_length, int64 *resulting_buffer_length,
- char content_language_out[256],
- char content_type_out[256],
+ char* content_language_out_buf,
+ size_t content_language_buf_size,
+ char* content_type_out_buf,
+ size_t content_type_buf_size,
HTTPStatus status_code, const char *reason_or_null, const char *format, ...)
{
va_list ap;
va_start(ap, format);
return (fabricate_with_old_api(type, context, max_buffer_length,
resulting_buffer_length,
- content_language_out, content_type_out, status_code, reason_or_null, format, ap));
+ content_language_out_buf, content_language_buf_size,
+ content_type_out_buf, content_type_buf_size,
+ status_code, reason_or_null, format, ap));
}
void dump_template_tables(FILE * fp = stderr);
Modified: trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc?rev=949353&r1=949352&r2=949353&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc (original)
+++ trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc Sat May 29 08:18:16 2010
@@ -8806,7 +8806,9 @@ HttpTransact::build_error_response(State
s->internal_msg_buffer =
body_factory->fabricate_with_old_api(error_body_type, s, 8192,
&(s->internal_msg_buffer_size),
- body_language, body_type, status_code, reason_phrase, format, ap);
+ body_language, sizeof(body_language),
+ body_type, sizeof(body_type),
+ status_code, reason_phrase, format, ap);
s->hdr_info.client_response.value_set(MIME_FIELD_CONTENT_TYPE, MIME_LEN_CONTENT_TYPE, body_type, strlen(body_type));
@@ -8902,7 +8904,9 @@ HttpTransact::build_redirect_response(St
body_factory->
fabricate_with_old_api_build_va("redirect#moved_temporarily", s, 8192,
&(s->internal_msg_buffer_size),
- body_language, body_type, status_code,
+ body_language, sizeof(body_language),
+ body_type, sizeof(body_type),
+ status_code,
reason_phrase,
"%s <a href=\"%s\">%s</a>. %s.",
"The document you requested is now",