Changes in url.c [6fda350:b7d3cc34]
Legend:
- Unmodified
- Added
- Removed
-
url.c
r6fda350 rb7d3cc34 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2001-200 5Wilmer van der Gaast and others *4 * Copyright 2001-2004 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 30 30 { 31 31 char s[MAX_STRING]; 32 char *i ;32 char *i, *j; 33 33 34 34 /* protocol:// */ … … 42 42 if( g_strncasecmp( set_url, "http", i - set_url ) == 0 ) 43 43 url->proto = PROTO_HTTP; 44 else if( g_strncasecmp( set_url, "https", i - set_url ) == 0 )45 url->proto = PROTO_HTTPS;46 44 else if( g_strncasecmp( set_url, "socks4", i - set_url ) == 0 ) 47 45 url->proto = PROTO_SOCKS4; … … 58 56 if( ( i = strchr( s, '/' ) ) == NULL ) 59 57 { 60 strcpy( url-> file, "/" );58 strcpy( url->dir, "/" ); 61 59 } 62 60 else 63 61 { 64 strncpy( url->file, i, MAX_STRING );65 62 *i = 0; 63 g_snprintf( url->dir, MAX_STRING, "/%s", i + 1 ); 64 if( url->proto == PROTO_HTTP ) 65 http_encode( url->dir ); 66 66 } 67 67 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 } 68 85 69 86 /* Check for username in host field */ … … 79 96 else 80 97 { 81 *url->user = *url->pass = 0; 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 } 82 107 } 83 108 … … 92 117 { 93 118 *i = 0; 94 sscanf( i + 1, "% d", &url->port );119 sscanf( i + 1, "%i", &url->port ); 95 120 } 121 /* Take default port numbers from /etc/services */ 96 122 else 97 123 { 98 124 if( url->proto == PROTO_HTTP ) 99 url->port = 80; 100 else if( url->proto == PROTO_HTTPS ) 101 url->port = 443; 125 url->port = 8080; 102 126 else if( url->proto == PROTO_SOCKS4 || url->proto == PROTO_SOCKS4 ) 103 127 url->port = 1080;
Note: See TracChangeset
for help on using the changeset viewer.