Changeset 509

Show
Ignore:
Timestamp:
07/24/08 14:53:43 (4 months ago)
Author:
bellmich
Message:

avoid trouble if one parameter is NULL

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libsyncml/transports/http_client.c

    r491 r509  
    240240        SmlTransportHttpClientEnv *env = data; 
    241241        SmlError *error = NULL; 
     242        smlAssert(env->tsp->context); 
    242243 
    243244        env->connectDone = FALSE; 
    244245 
    245 //      if ((env->proxy != NULL && strlen(env->proxy) > 0) || 
    246 //          (env->cafile != NULL && strlen(env->cafile) > 0)) 
    247 //      { 
    248 //              smlTrace(TRACE_INTERNAL, "%s - proxy or cafile", __func__); 
    249                 env->session = soup_session_async_new_with_options( 
     246        if (env->proxy != NULL && strlen(env->proxy) > 0) 
     247        { 
     248                if (env->cafile != NULL && strlen(env->cafile)) 
     249                { 
     250                       env->session = soup_session_async_new_with_options( 
    250251                                        SOUP_SESSION_ASYNC_CONTEXT, env->tsp->context, 
    251252                                        SOUP_SESSION_PROXY_URI, env->proxy, 
    252253                                        SOUP_SESSION_SSL_CA_FILE, env->cafile, 
    253254                                        NULL); 
    254 //      } else { 
    255 //              smlTrace(TRACE_INTERNAL, "%s - no proxy, no cafile", __func__); 
    256 //              env->session = soup_session_async_new(); 
    257 //      } 
     255                         
     256                } else { 
     257                        env->session = soup_session_async_new_with_options( 
     258                                        SOUP_SESSION_ASYNC_CONTEXT, env->tsp->context, 
     259                                        SOUP_SESSION_PROXY_URI, env->proxy, 
     260                                        NULL); 
     261                } 
     262        } else { 
     263                if (env->cafile != NULL && strlen(env->cafile)) 
     264                { 
     265                        env->session = soup_session_async_new_with_options( 
     266                                        SOUP_SESSION_ASYNC_CONTEXT, env->tsp->context, 
     267                                        SOUP_SESSION_SSL_CA_FILE, env->cafile, 
     268                                        NULL); 
     269                } else { 
     270                        env->session = soup_session_async_new_with_options( 
     271                                        SOUP_SESSION_ASYNC_CONTEXT, env->tsp->context, 
     272                                        NULL); 
     273                } 
     274        } 
    258275        if (!env->session) { 
    259276                smlErrorSet(&error, SML_ERROR_GENERIC, "Unable to create new session");