void HttpSM::handle_server_setup_error(int event, void* data) Handles setting t_state.current.state and calling Transact in between opening an origin server connection and receiving the response header (in the case of the POST, a post tunnel happens in between the sending request header and reading the response header
| 6111 | // request header and reading the response header |
| 6112 | // |
| 6113 | void |
| 6114 | HttpSM::handle_server_setup_error(int event, void *data) |
| 6115 | { |
| 6116 | VIO *vio = static_cast<VIO *>(data); |
| 6117 | ink_assert(vio != nullptr); |
| 6118 | |
| 6119 | STATE_ENTER(&HttpSM::handle_server_setup_error, event); |
| 6120 | |
| 6121 | // If there is POST or PUT tunnel wait for the tunnel |
| 6122 | // to figure out that things have gone to hell |
| 6123 | |
| 6124 | if (tunnel.is_tunnel_active()) { |
| 6125 | ink_assert(server_entry->read_vio == data || server_entry->write_vio == data); |
| 6126 | SMDbg(dbg_ctl_http, "forwarding event %s to post tunnel", HttpDebugNames::get_event_name(event)); |
| 6127 | HttpTunnelConsumer *c = tunnel.get_consumer(server_entry->vc); |
| 6128 | // it is possible only user agent post->post transform is set up |
| 6129 | // this happened for Linux iocore where NET_EVENT_OPEN was returned |
| 6130 | // for a non-existing listening port. the hack is to pass the error |
| 6131 | // event for server connection to post_transform_info |
| 6132 | if (c == nullptr && post_transform_info.vc) { |
| 6133 | c = tunnel.get_consumer(post_transform_info.vc); |
| 6134 | // c->handler_state = HTTP_SM_TRANSFORM_FAIL; |
| 6135 | |
| 6136 | // No point in proceeding if there is no consumer |
| 6137 | // Do we need to do additional clean up in the c == NULL case? |
| 6138 | if (c != nullptr) { |
| 6139 | HttpTunnelProducer *ua_producer = c->producer; |
| 6140 | ink_assert(_ua.get_entry()->vc == ua_producer->vc); |
| 6141 | |
| 6142 | _ua.get_entry()->vc_read_handler = &HttpSM::state_watch_for_client_abort; |
| 6143 | _ua.get_entry()->vc_write_handler = &HttpSM::state_watch_for_client_abort; |
| 6144 | _ua.get_entry()->read_vio = ua_producer->vc->do_io_read(this, INT64_MAX, c->producer->read_buffer); |
| 6145 | ua_producer->vc->do_io_shutdown(IO_SHUTDOWN_READ); |
| 6146 | |
| 6147 | ua_producer->alive = false; |
| 6148 | ua_producer->handler_state = HTTP_SM_POST_SERVER_FAIL; |
| 6149 | tunnel.handleEvent(VC_EVENT_ERROR, c->write_vio); |
| 6150 | return; |
| 6151 | } |
| 6152 | } else { |
| 6153 | // c could be null here as well |
| 6154 | if (c != nullptr) { |
| 6155 | tunnel.handleEvent(event, c->write_vio); |
| 6156 | return; |
| 6157 | } |
| 6158 | } |
| 6159 | // If there is no consumer, let the event pass through to shutdown |
| 6160 | } else { |
| 6161 | if (post_transform_info.vc) { |
| 6162 | HttpTunnelConsumer *c = tunnel.get_consumer(post_transform_info.vc); |
| 6163 | if (c && c->handler_state == HTTP_SM_TRANSFORM_OPEN) { |
| 6164 | vc_table.cleanup_entry(post_transform_info.entry); |
| 6165 | post_transform_info.entry = nullptr; |
| 6166 | tunnel.deallocate_buffers(); |
| 6167 | tunnel.reset(); |
| 6168 | } |
| 6169 | } |
| 6170 | } |
nothing calls this directly
no test coverage detected