Browse Source

Add back the SNI addr reconstructor

pull/2010/head
Max Lv 7 years ago
parent
commit
66ed595c52
1 changed files with 14 additions and 0 deletions
  1. 14
      src/local.c

14
src/local.c

@ -826,6 +826,20 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
// Not bypass
if (remote == NULL) {
remote = create_remote(server->listener, NULL);
if (sni_detected) {
// Reconstruct address buffer
abuf->len = 0;
abuf->data[abuf->len++] = 3;
abuf->data[abuf->len++] = ret;
memcpy(abuf->data + abuf->len, hostname, ret);
abuf->len += ret;
dst_port = htons(dst_port);
memcpy(abuf->data + abuf->len, &dst_port, 2);
abuf->len += 2;
ss_free(hostname);
}
}
if (remote == NULL) {

Loading…
Cancel
Save