| 74 | } |
| 75 | |
| 76 | void |
| 77 | FetchSM::httpConnect() |
| 78 | { |
| 79 | PluginIdentity *pi = dynamic_cast<PluginIdentity *>(contp); |
| 80 | const char *tag = pi ? pi->getPluginTag() : "fetchSM"; |
| 81 | int64_t id = pi ? pi->getPluginId() : 0; |
| 82 | |
| 83 | Dbg(dbg_ctl, "[%s] calling httpconnect write pi=%p tag=%s id=%" PRId64, __FUNCTION__, pi, tag, id); |
| 84 | TSHttpConnectOptions options{.connect_type = TS_CONNECT_PLUGIN, |
| 85 | .addr = &_addr.sa, |
| 86 | .tag = tag, |
| 87 | .id = id, |
| 88 | .buffer_index = TS_IOBUFFER_SIZE_INDEX_32K, |
| 89 | .buffer_water_mark = TS_IOBUFFER_WATER_MARK_PLUGIN_VC_DEFAULT}; |
| 90 | http_vc = PluginHttpConnectInternal(&options); |
| 91 | if (http_vc == nullptr) { |
| 92 | Dbg(dbg_ctl, "Not ready to use"); |
| 93 | if (contp) { |
| 94 | if (fetch_flags & TS_FETCH_FLAGS_STREAM) { |
| 95 | return InvokePluginExt(TS_EVENT_ERROR); |
| 96 | } |
| 97 | InvokePlugin(callback_events.failure_event_id, nullptr); |
| 98 | } |
| 99 | cleanUp(); |
| 100 | return; |
| 101 | } |
| 102 | |
| 103 | /* |
| 104 | * TS-2906: We need a way to unset internal request when using FetchSM, the use case for this |
| 105 | * is H2 when it creates outgoing requests it uses FetchSM and the outgoing requests |
| 106 | * are spawned via H2 SYN packets which are definitely not internal requests. |
| 107 | */ |
| 108 | if (!is_internal_request) { |
| 109 | PluginVC *other_side = reinterpret_cast<PluginVC *>(http_vc)->get_other_side(); |
| 110 | if (other_side != nullptr) { |
| 111 | other_side->set_is_internal_request(false); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | if (fetch_flags & TS_FETCH_FLAGS_SKIP_REMAP) { |
| 116 | PluginVC *other_side = reinterpret_cast<PluginVC *>(http_vc)->get_other_side(); |
| 117 | other_side->set_is_unmanaged_request(true); |
| 118 | } |
| 119 | |
| 120 | read_vio = http_vc->do_io_read(this, INT64_MAX, resp_buffer); |
| 121 | write_vio = http_vc->do_io_write(this, getReqLen() + req_content_length, req_reader); |
| 122 | } |
| 123 | |
| 124 | char * |
| 125 | FetchSM::resp_get(int *length) |
no test coverage detected