- Timestamp:
- 2005-12-17T18:55:46Z (19 years ago)
- Branches:
- master
- Children:
- 2db811a
- Parents:
- 8a9afe4 (diff), b5a22e3 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
url.c
r8a9afe4 r52b3a99 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2001-200 4Wilmer van der Gaast and others *4 * Copyright 2001-2005 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 30 30 { 31 31 char s[MAX_STRING]; 32 char *i , *j;32 char *i; 33 33 34 34 /* protocol:// */ … … 40 40 else 41 41 { 42 if( g_strncasecmp( set_url, "http", i - set_url ) == 0 ) 42 if( g_strncasecmp( set_url, "https", i - set_url ) == 0 ) 43 url->proto = PROTO_HTTPS; 44 else if( g_strncasecmp( set_url, "http", i - set_url ) == 0 ) 43 45 url->proto = PROTO_HTTP; 44 46 else if( g_strncasecmp( set_url, "socks4", i - set_url ) == 0 ) … … 56 58 if( ( i = strchr( s, '/' ) ) == NULL ) 57 59 { 58 strcpy( url-> dir, "/" );60 strcpy( url->file, "/" ); 59 61 } 60 62 else 61 63 { 64 strncpy( url->file, i, MAX_STRING ); 62 65 *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 else81 {82 strcpy( url->file, i + 1 );83 strcat( url->dir, "/" );84 }85 68 86 69 /* Check for username in host field */ … … 96 79 else 97 80 { 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; 107 82 } 108 83 … … 117 92 { 118 93 *i = 0; 119 sscanf( i + 1, "% i", &url->port );94 sscanf( i + 1, "%d", &url->port ); 120 95 } 121 /* Take default port numbers from /etc/services */122 96 else 123 97 { 124 98 if( url->proto == PROTO_HTTP ) 125 url->port = 8080; 99 url->port = 80; 100 else if( url->proto == PROTO_HTTPS ) 101 url->port = 443; 126 102 else if( url->proto == PROTO_SOCKS4 || url->proto == PROTO_SOCKS4 ) 127 103 url->port = 1080;
Note: See TracChangeset
for help on using the changeset viewer.