Skip to content

Commit 4407e57

Browse files
committed
TS-2888: remove fabricate_old_api_va
1 parent 01ba7a5 commit 4407e57

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

proxy/http/HttpBodyFactory.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ char *
6363
HttpBodyFactory::fabricate_with_old_api(const char *type, HttpTransact::State *context, int64_t max_buffer_length,
6464
int64_t *resulting_buffer_length, char *content_language_out_buf,
6565
size_t content_language_buf_size, char *content_type_out_buf, size_t content_type_buf_size,
66-
int format_size, const char *format, va_list ap)
66+
int format_size, const char *format)
6767
{
6868
char *buffer = nullptr;
6969
const char *lang_ptr = nullptr;

proxy/http/HttpBodyFactory.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,10 @@ class HttpBodyFactory
157157
///////////////////////
158158
char *fabricate_with_old_api(const char *type, HttpTransact::State *context, int64_t max_buffer_length,
159159
int64_t *resulting_buffer_length, char *content_language_out_buf, size_t content_language_buf_size,
160-
char *content_type_out_buf, size_t content_type_buf_size, int format_size, const char *format,
161-
va_list ap);
160+
char *content_type_out_buf, size_t content_type_buf_size, int format_size, const char *format);
162161

163162
char *
164-
fabricate_with_old_api_build_va(const char *type, HttpTransact::State *context, int64_t max_buffer_length,
165-
int64_t *resulting_buffer_length, char *content_language_out_buf,
166-
size_t content_language_buf_size, char *content_type_out_buf, size_t content_type_buf_size,
167-
const char *format, ...)
163+
getFormat(int64_t max_buffer_length, int64_t *resulting_buffer_length, const char *format, ...)
168164
{
169165
char *msg = nullptr;
170166
va_list ap;
@@ -177,11 +173,7 @@ class HttpBodyFactory
177173
*resulting_buffer_length = ink_bvsprintf(msg, format, ap) - 1;
178174
}
179175
}
180-
char *buf = fabricate_with_old_api(type, context, max_buffer_length, resulting_buffer_length, content_language_out_buf,
181-
content_language_buf_size, content_type_out_buf, content_type_buf_size,
182-
*resulting_buffer_length, msg, ap);
183-
ats_free(msg);
184-
return buf;
176+
return msg;
185177
}
186178

187179
void dump_template_tables(FILE *fp = stderr);

proxy/http/HttpTransact.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8200,7 +8200,7 @@ HttpTransact::build_error_response(State *s, HTTPStatus status_code, const char
82008200

82018201
new_msg = body_factory->fabricate_with_old_api(error_body_type, s, 8192, &len, body_language, sizeof(body_language), body_type,
82028202
sizeof(body_type), s->internal_msg_buffer_size,
8203-
s->internal_msg_buffer_size ? s->internal_msg_buffer : nullptr, nullptr);
8203+
s->internal_msg_buffer_size ? s->internal_msg_buffer : nullptr);
82048204

82058205
// After the body factory is called, a new "body" is allocated, and we must replace it. It is
82068206
// unfortunate that there's no way to avoid this fabrication even when there is no substitutions...
@@ -8254,7 +8254,6 @@ HttpTransact::build_redirect_response(State *s)
82548254
const char *new_url = nullptr;
82558255
int new_url_len;
82568256
char *to_free = nullptr;
8257-
char body_language[256], body_type[256];
82588257

82598258
HTTPStatus status_code = HTTP_STATUS_MOVED_TEMPORARILY;
82608259
char *reason_phrase = (char *)(http_hdr_reason_lookup(status_code));
@@ -8292,10 +8291,9 @@ HttpTransact::build_redirect_response(State *s)
82928291
//////////////////////////
82938292
s->free_internal_msg_buffer();
82948293
s->internal_msg_buffer_fast_allocator_size = -1;
8295-
s->internal_msg_buffer = body_factory->fabricate_with_old_api_build_va(
8296-
"redirect#moved_temporarily", s, 8192, &s->internal_msg_buffer_size, body_language, sizeof(body_language), body_type,
8297-
sizeof(body_type), "%s <a href=\"%s\">%s</a>. %s.", "The document you requested is now", new_url, new_url,
8298-
"Please update your documents and bookmarks accordingly", NULL);
8294+
s->internal_msg_buffer = body_factory->getFormat(8192, &s->internal_msg_buffer_size, "%s <a href=\"%s\">%s</a>. %s.",
8295+
"The document you requested is now", new_url, new_url,
8296+
"Please update your documents and bookmarks accordingly", NULL);
82998297

83008298
h->set_content_length(s->internal_msg_buffer_size);
83018299
h->value_set(MIME_FIELD_CONTENT_TYPE, MIME_LEN_CONTENT_TYPE, "text/html", 9);

0 commit comments

Comments
 (0)