Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • url.c

    rb7d3cc34 r6fda350  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2001-2004 Wilmer van der Gaast and others                *
     4  * Copyright 2001-2005 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    3030{
    3131        char s[MAX_STRING];
    32         char *i, *j;
     32        char *i;
    3333       
    3434        /* protocol://                                                  */
     
    4242                if( g_strncasecmp( set_url, "http", i - set_url ) == 0 )
    4343                        url->proto = PROTO_HTTP;
     44                else if( g_strncasecmp( set_url, "https", i - set_url ) == 0 )
     45                        url->proto = PROTO_HTTPS;
    4446                else if( g_strncasecmp( set_url, "socks4", i - set_url ) == 0 )
    4547                        url->proto = PROTO_SOCKS4;
     
    5658        if( ( i = strchr( s, '/' ) ) == NULL )
    5759        {
    58                 strcpy( url->dir, "/" );
     60                strcpy( url->file, "/" );
    5961        }
    6062        else
    6163        {
     64                strncpy( url->file, i, MAX_STRING );
    6265                *i = 0;
    63                 g_snprintf( url->dir, MAX_STRING, "/%s", i + 1 );
    64                 if( url->proto == PROTO_HTTP )
    65                         http_encode( url->dir );
    6666        }
    6767        strncpy( url->host, s, MAX_STRING );
    68         j = strchr( url->dir, '?' );
    69         if( j != NULL )
    70                 *j = 0;
    71         i = strrchr( url->dir, '/' );
    72         *i = 0;
    73         if( j != NULL )
    74                 *j = '?';
    75         if( i == NULL )
    76         {
    77                 strcpy( url->file, url->dir );
    78                 strcpy( url->dir, "/" );
    79         }
    80         else
    81         {
    82                 strcpy( url->file, i + 1 );
    83                 strcat( url->dir, "/" );
    84         }
    8568       
    8669        /* Check for username in host field                             */
     
    9679        else
    9780        {
    98                 if( url->proto == PROTO_FTP )
    99                 {
    100                         strcpy( url->user, "anonymous" );
    101                         strcpy( url->pass, "-p.artmaps@lintux.cx" );
    102                 }
    103                 else
    104                 {
    105                         *url->user = *url->pass = 0;
    106                 }
     81                *url->user = *url->pass = 0;
    10782        }
    10883       
     
    11792        {
    11893                *i = 0;
    119                 sscanf( i + 1, "%i", &url->port );
     94                sscanf( i + 1, "%d", &url->port );
    12095        }
    121         /* Take default port numbers from /etc/services                 */
    12296        else
    12397        {
    12498                if( url->proto == PROTO_HTTP )
    125                         url->port = 8080;
     99                        url->port = 80;
     100                else if( url->proto == PROTO_HTTPS )
     101                        url->port = 443;
    126102                else if( url->proto == PROTO_SOCKS4 || url->proto == PROTO_SOCKS4 )
    127103                        url->port = 1080;
Note: See TracChangeset for help on using the changeset viewer.