Ticket #229: patch_ngx_http_upstream_ssl_init_connection_SNI.diff

File patch_ngx_http_upstream_ssl_init_connection_SNI.diff, 1.1 KB (added by Jakob Praher, 14 years ago)

Patch for calling SSL_set_tlsext_host_name in ngx_http_upstream.c (revision 4888)

  • src/http/ngx_http_upstream.c

     
    12511251                                           NGX_HTTP_INTERNAL_SERVER_ERROR);
    12521252        return;
    12531253    }
     1254   
     1255#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
     1256    if (u->resolved) {
     1257        char *host = (char*) malloc(sizeof(char) * u->resolved->host.len + 1);
     1258        memset(host, 0, u->resolved->host.len + 1);
     1259        memcpy(host, u->resolved->host.data, sizeof(char) * u->resolved->host.len);
    12541260
     1261        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
     1262                                           "http upstream set tlsext host name \"%s.\"", host);
     1263     
     1264        if (!SSL_set_tlsext_host_name(c->ssl->connection,host))
     1265        {
     1266            ngx_log_error(NGX_LOG_WARN, c->log, 0,
     1267                          "SSL_set_tlsext_host_name(\"%s\") failed", u->conf->upstream->host.data );
     1268        }
     1269        free(host);
     1270    }
     1271#endif   
     1272
    12551273    c->sendfile = 0;
    12561274    u->output.sendfile = 0;
    12571275