| 69 | } // end anonymous namespace |
| 70 | |
| 71 | char * |
| 72 | HttpBodyFactory::fabricate_with_old_api(const char *type, HttpTransact::State *context, int64_t max_buffer_length, |
| 73 | int64_t *resulting_buffer_length, char *content_language_out_buf, |
| 74 | size_t content_language_buf_size, char *content_type_out_buf, size_t content_type_buf_size, |
| 75 | int format_size, const char *format) |
| 76 | { |
| 77 | char *buffer = nullptr; |
| 78 | const char *lang_ptr = nullptr; |
| 79 | const char *charset_ptr = nullptr; |
| 80 | char url[1024]; |
| 81 | const char *set = nullptr; |
| 82 | bool found_requested_template = false; |
| 83 | bool plain_flag = false; |
| 84 | |
| 85 | *resulting_buffer_length = 0; |
| 86 | |
| 87 | ink_strlcpy(content_language_out_buf, "en", content_language_buf_size); |
| 88 | ink_strlcpy(content_type_out_buf, "text/html", content_type_buf_size); |
| 89 | |
| 90 | /////////////////////////////////////////////////////////////////// |
| 91 | // if logging turned on, buffer up the URL string for simplicity // |
| 92 | /////////////////////////////////////////////////////////////////// |
| 93 | if (enable_logging) { |
| 94 | url[0] = '\0'; |
| 95 | URL *u = context->hdr_info.client_request.url_get(); |
| 96 | |
| 97 | if (u->valid()) { /* if url exists, copy the string into buffer */ |
| 98 | size_t i; |
| 99 | char *s = u->string_get(&context->arena); |
| 100 | for (i = 0; (i < sizeof(url) - 1) && s[i]; i++) { |
| 101 | url[i] = s[i]; |
| 102 | } |
| 103 | url[i] = '\0'; |
| 104 | if (s) { |
| 105 | context->arena.str_free(s); |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | /////////////////////////////////////////////// |
| 111 | // if suppressing this response, return NULL // |
| 112 | /////////////////////////////////////////////// |
| 113 | if (is_response_suppressed(context)) { |
| 114 | if (enable_logging) { |
| 115 | Log::error("BODY_FACTORY: suppressing '%s' response for url '%s'", type, url); |
| 116 | } |
| 117 | return nullptr; |
| 118 | } |
| 119 | |
| 120 | lock(); // body factory lock |
| 121 | |
| 122 | ////////////////////////////////////////////////////////////////////////////////// |
| 123 | // if language-targeting activated, get client Accept-Language & Accept-Charset // |
| 124 | ////////////////////////////////////////////////////////////////////////////////// |
| 125 | |
| 126 | StrList acpt_language_list(false); |
| 127 | StrList acpt_charset_list(false); |
| 128 |
no test coverage detected