| 205 | } |
| 206 | |
| 207 | bool |
| 208 | ContData::init() |
| 209 | { |
| 210 | if (initialized) { |
| 211 | TSError("[esi][%s] ContData already initialized!", __FUNCTION__); |
| 212 | return false; |
| 213 | } |
| 214 | |
| 215 | checkXformStatus(); |
| 216 | |
| 217 | bool retval = false; |
| 218 | |
| 219 | if (!xform_closed) { |
| 220 | // Get upstream VIO |
| 221 | input_vio = TSVConnWriteVIOGet(contp); |
| 222 | if (!input_vio) { |
| 223 | TSError("[esi][%s] Error while getting input vio", __FUNCTION__); |
| 224 | goto lReturn; |
| 225 | } |
| 226 | input_reader = TSVIOReaderGet(input_vio); |
| 227 | |
| 228 | // get downstream VIO |
| 229 | TSVConn output_conn; |
| 230 | output_conn = TSTransformOutputVConnGet(contp); |
| 231 | if (!output_conn) { |
| 232 | TSError("[esi][%s] Error while getting transform VC", __FUNCTION__); |
| 233 | goto lReturn; |
| 234 | } |
| 235 | output_buffer = TSIOBufferCreate(); |
| 236 | output_reader = TSIOBufferReaderAlloc(output_buffer); |
| 237 | |
| 238 | // we don't know how much data we are going to write, so INT_MAX |
| 239 | output_vio = TSVConnWrite(output_conn, contp, output_reader, INT64_MAX); |
| 240 | |
| 241 | string fetcher_tag, vars_tag, expr_tag, proc_tag, gzip_tag, gunzip_tag; |
| 242 | if (!data_fetcher) { |
| 243 | data_fetcher = new HttpDataFetcherImpl(contp, client_addr, FETCHER_DEBUG_TAG); |
| 244 | } |
| 245 | if (!esi_vars) { |
| 246 | esi_vars = new Variables(contp, gAllowlistCookies); |
| 247 | } |
| 248 | |
| 249 | esi_proc = new EsiProcessor(contp, *data_fetcher, *esi_vars, *gHandlerManager, option_info->max_doc_size); |
| 250 | |
| 251 | esi_gzip = new EsiGzip(); |
| 252 | esi_gunzip = new EsiGunzip(); |
| 253 | |
| 254 | CONT_DATA_DBG(this, "[%s] Set input data type to [%s]", __FUNCTION__, DATA_TYPE_NAMES_[input_type]); |
| 255 | |
| 256 | retval = true; |
| 257 | } else { |
| 258 | CONT_DATA_DBG(this, "[%s] Transformation closed during initialization; Returning false", __FUNCTION__); |
| 259 | } |
| 260 | |
| 261 | lReturn: |
| 262 | initialized = true; |
| 263 | return retval; |
| 264 | } |
no test coverage detected