| 3921 | } |
| 3922 | |
| 3923 | int |
| 3924 | HttpSM::tunnel_handler_post_server(int event, HttpTunnelConsumer *c) |
| 3925 | { |
| 3926 | STATE_ENTER(&HttpSM::tunnel_handler_post_server, event); |
| 3927 | |
| 3928 | // If is_using_post_buffer has been used, then this handler gets called |
| 3929 | // twice, once with the buffered request body bytes and a second time with |
| 3930 | // the (now) zero length user agent buffer. See wait_for_full_body where |
| 3931 | // these bytes are read. Don't clobber the server_request_body_bytes with |
| 3932 | // zero on that second read. |
| 3933 | if (server_request_body_bytes == 0) { |
| 3934 | server_request_body_bytes = c->bytes_written; |
| 3935 | } |
| 3936 | |
| 3937 | switch (event) { |
| 3938 | case VC_EVENT_EOS: |
| 3939 | case VC_EVENT_ERROR: |
| 3940 | case VC_EVENT_INACTIVITY_TIMEOUT: |
| 3941 | case VC_EVENT_ACTIVE_TIMEOUT: |
| 3942 | |
| 3943 | switch (event) { |
| 3944 | case VC_EVENT_INACTIVITY_TIMEOUT: |
| 3945 | t_state.current.state = HttpTransact::INACTIVE_TIMEOUT; |
| 3946 | t_state.set_connect_fail(ETIMEDOUT); |
| 3947 | break; |
| 3948 | case VC_EVENT_ACTIVE_TIMEOUT: |
| 3949 | t_state.current.state = HttpTransact::ACTIVE_TIMEOUT; |
| 3950 | t_state.set_connect_fail(ETIMEDOUT); |
| 3951 | break; |
| 3952 | case VC_EVENT_EOS: |
| 3953 | t_state.current.state = HttpTransact::CONNECTION_CLOSED; |
| 3954 | t_state.set_connect_fail(EPIPE); |
| 3955 | break; |
| 3956 | case VC_EVENT_ERROR: |
| 3957 | t_state.current.state = HttpTransact::CONNECTION_CLOSED; |
| 3958 | t_state.set_connect_fail(server_txn->get_netvc()->lerrno); |
| 3959 | break; |
| 3960 | default: |
| 3961 | break; |
| 3962 | } |
| 3963 | |
| 3964 | // Did not complete post tunneling |
| 3965 | // |
| 3966 | // In the http case, we don't want to close |
| 3967 | // the connection because the |
| 3968 | // destroys the header buffer which may |
| 3969 | // a response even though the tunnel failed. |
| 3970 | |
| 3971 | // Shutdown both sides of the connection. This prevents us |
| 3972 | // from getting any further events and signals to client |
| 3973 | // that POST data will not be forwarded to the server. Doing |
| 3974 | // shutdown on the write side will likely generate a TCP |
| 3975 | // reset to the client but if the proxy wasn't here this is |
| 3976 | // exactly what would happen. |
| 3977 | // we should wait to shutdown read side of the |
| 3978 | // client to prevent sending a reset |
| 3979 | server_entry->eos = true; |
| 3980 | c->vc->do_io_shutdown(IO_SHUTDOWN_WRITE); |
nothing calls this directly
no test coverage detected