Skip to content
Snippets Groups Projects
  • Andy Green's avatar
    d526c50c
    introduce vhosts · d526c50c
    Andy Green authored
    
    This patch splits out some lws_context members into a new lws_vhost struct.
    
     - ssl state and options per vhost
     - SSL_CTX for serving and client per vhost
     - protocols[] per vhost
     - extensions[] per vhost
    
    lws_context maintains a linked list of lws_vhosts.
    
    The same lws_context_creation_info struct is used to regulate both the
    context creation and to create vhosts: for backward compatibility if you
    didn't provide the new LWS_SERVER_OPTION_EXPLICIT_VHOSTS option, then
    a default vhost is created at context creation time using the same info
    data as the context itself.
    
    If you will have multiple vhosts though, you should give the
    LWS_SERVER_OPTION_EXPLICIT_VHOSTS option at context creation time,
    create the context first and then the vhosts afterwards using
    
      lws_create_vhost(contest, &info);
    
    Although there is a lot of housekeeping to implement this change, there
    is almost no additional overhead if you don't use multiple vhosts and
    very little api impact (no changes to test apps).
    
    Signed-off-by: default avatarAndy Green <andy@warmcat.com>
    d526c50c
    History
    introduce vhosts
    Andy Green authored
    
    This patch splits out some lws_context members into a new lws_vhost struct.
    
     - ssl state and options per vhost
     - SSL_CTX for serving and client per vhost
     - protocols[] per vhost
     - extensions[] per vhost
    
    lws_context maintains a linked list of lws_vhosts.
    
    The same lws_context_creation_info struct is used to regulate both the
    context creation and to create vhosts: for backward compatibility if you
    didn't provide the new LWS_SERVER_OPTION_EXPLICIT_VHOSTS option, then
    a default vhost is created at context creation time using the same info
    data as the context itself.
    
    If you will have multiple vhosts though, you should give the
    LWS_SERVER_OPTION_EXPLICIT_VHOSTS option at context creation time,
    create the context first and then the vhosts afterwards using
    
      lws_create_vhost(contest, &info);
    
    Although there is a lot of housekeeping to implement this change, there
    is almost no additional overhead if you don't use multiple vhosts and
    very little api impact (no changes to test apps).
    
    Signed-off-by: default avatarAndy Green <andy@warmcat.com>