Changeset dd34575 for lib/url.c


Ignore:
Timestamp:
2008-04-02T13:28:23Z (16 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
6ff51ff, 85d7b85
Parents:
0db75ad (diff), fa75134 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/url.c

    r0db75ad rdd34575  
    2626#include "url.h"
    2727
    28 /* Convert an URL to a url_t structure                                  */
     28/* Convert an URL to a url_t structure */
    2929int url_set( url_t *url, char *set_url )
    3030{
    31         char s[MAX_STRING];
     31        char s[MAX_STRING+1];
    3232        char *i;
    3333       
    34         /* protocol://                                                  */
     34        memset( url, 0, sizeof( url_t ) );
     35        memset( s, 0, sizeof( s ) );
     36       
     37        /* protocol:// */
    3538        if( ( i = strstr( set_url, "://" ) ) == NULL )
    3639        {
     
    4952                        url->proto = PROTO_SOCKS5;
    5053                else
    51                 {
    52                         return( 0 );
    53                 }
     54                        return 0;
     55               
    5456                strncpy( s, i + 3, MAX_STRING );
    5557        }
    5658       
    57         /* Split                                                        */
     59        /* Split */
    5860        if( ( i = strchr( s, '/' ) ) == NULL )
    5961        {
     
    6769        strncpy( url->host, s, MAX_STRING );
    6870       
    69         /* Check for username in host field                             */
     71        /* Check for username in host field */
    7072        if( strrchr( url->host, '@' ) != NULL )
    7173        {
     
    7678                *url->pass = 0;
    7779        }
    78         /* If not: Fill in defaults                                     */
     80        /* If not: Fill in defaults */
    7981        else
    8082        {
     
    8284        }
    8385       
    84         /* Password?                                                    */
     86        /* Password? */
    8587        if( ( i = strchr( url->user, ':' ) ) != NULL )
    8688        {
     
    8890                strcpy( url->pass, i + 1 );
    8991        }
    90         /* Port number?                                                 */
     92        /* Port number? */
    9193        if( ( i = strchr( url->host, ':' ) ) != NULL )
    9294        {
Note: See TracChangeset for help on using the changeset viewer.