Changeset 6181

Show
Ignore:
Timestamp:
05/22/10 10:00:53 (3 years ago)
Author:
Cyrus
Message:

ustream: Unify SSL handling

Location:
luci2/libustream
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • luci2/libustream/protocol/http.c

    r6180 r6181  
    121121    ustream_uhtbl_set(&http->header, "Connection", "close", 5); 
    122122 
     123    if (stream->handler == &handler_https 
     124    && !(http->ssl = ustream_tls_new())) { 
     125        return -errno; 
     126    } 
     127 
    123128    return 0; 
    124129} 
     
    147152 
    148153    if (stream->handler == &handler_https) { 
    149         if (!http->ssl) { 
    150             if (!(http->ssl = ustream_tls_new(http->socket))) { 
    151                 close(http->socket); 
    152                 goto error; 
    153             } 
    154         } 
     154        SSL_set_fd(http->ssl, http->socket); 
    155155        int stat; 
    156156        if ((stat = SSL_connect(http->ssl)) <= 0) { 
  • luci2/libustream/tls.c

    r6160 r6181  
    7878} 
    7979 
    80 USTREAM_LOCAL SSL* ustream_tls_new(int fd) { 
    81     SSL *ssl = SSL_new(ctx); 
    82     if (ssl) { 
    83         SSL_set_fd(ssl, fd); 
    84     } 
    85     return ssl; 
     80USTREAM_LOCAL SSL* ustream_tls_new() { 
     81    return SSL_new(ctx); 
    8682}