I've sort of managed how to fix it, but i'm afraid it's a wrong one. In "client_try" method I've made these changes: ssl_start(c);
if (c->opt->protocol) { if(redirect(c)) { /* process "redirect" first */ s_log(LOG_NOTICE, "Redirecting connection"); /* c->connect_addr.addr may be allocated in protocol negotiations */ str_free(c->connect_addr.addr); addrlist_dup(&c->connect_addr, &c->opt->redirect_addr); } else if(c->opt->protocol_middle) { c->opt->protocol_middle(c); } }
remote_start(c);
instead of: ssl_start(c);
if(c->opt->protocol_middle) { c->opt->protocol_middle(c); }
remote_start(c); ---
It works, but in the log I see a doubled "Redirecting connection" message, however it redirects only once.
Sorry, I'm not a fully C coder.