Mercurial > mplayer.hg
annotate stream/url.c @ 20966:dc1a02e98cb6
clarify syncpoint placement recommanditions
(note i would also like to add a "there MUST be 1 syncpoint per second" rule)
author | michael |
---|---|
date | Fri, 17 Nov 2006 13:32:45 +0000 |
parents | 720206eef78b |
children | 4aff19cc00bb |
rev | line source |
---|---|
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
1 /* |
902 | 2 * URL Helper |
3 * by Bertrand Baudet <bertrand_baudet@yahoo.com> | |
4 * (C) 2001, MPlayer team. | |
5 * | |
6 */ | |
7 | |
833 | 8 #include <string.h> |
9 #include <stdlib.h> | |
10 #include <stdio.h> | |
12391 | 11 #include <ctype.h> |
18558
4928dd61f136
Fix potential integer overflows in memory allocation.
rtogni
parents:
17048
diff
changeset
|
12 #include <inttypes.h> |
833 | 13 |
14 #include "url.h" | |
5933 | 15 #include "mp_msg.h" |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16421
diff
changeset
|
16 #include "help_mp.h" |
833 | 17 |
18671 | 18 #ifndef SIZE_MAX |
19 #define SIZE_MAX ((size_t)-1) | |
20 #endif | |
21 | |
20784
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
22 URL_t *url_redirect(URL_t **url, const char *redir) { |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
23 URL_t *u = *url; |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
24 URL_t *res; |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
25 if (!strchr(redir, '/')) { |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
26 char *tmp; |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
27 char *newurl = malloc(strlen(u->url) + strlen(redir) + 1); |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
28 strcpy(newurl, u->url); |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
29 tmp = strrchr(newurl, '/'); |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
30 if (tmp) tmp[1] = 0; |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
31 strcat(newurl, redir); |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
32 res = url_new(newurl); |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
33 free(newurl); |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
34 } else |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
35 res = url_new(redir); |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
36 url_free(u); |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
37 *url = res; |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
38 return res; |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
39 } |
720206eef78b
Support URL redirections that do not specify full URL.
reimar
parents:
19271
diff
changeset
|
40 |
833 | 41 URL_t* |
9690
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
42 url_new(const char* url) { |
11771
827cae571c5c
Fix long standing bug where last (and sometimes first) char of the
albeu
parents:
11412
diff
changeset
|
43 int pos1, pos2,v6addr = 0; |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
44 URL_t* Curl = NULL; |
12391 | 45 char *escfilename=NULL; |
11771
827cae571c5c
Fix long standing bug where last (and sometimes first) char of the
albeu
parents:
11412
diff
changeset
|
46 char *ptr1=NULL, *ptr2=NULL, *ptr3=NULL, *ptr4=NULL; |
10056
88c855a174f3
Added some special-case code for checking for "sip:" URLs (because they
rsf
parents:
9924
diff
changeset
|
47 int jumpSize = 3; |
833 | 48 |
4653
d2a7fcfeec6f
Removed the url_copy function , since it was badly implemented,
bertrand
parents:
4119
diff
changeset
|
49 if( url==NULL ) return NULL; |
d2a7fcfeec6f
Removed the url_copy function , since it was badly implemented,
bertrand
parents:
4119
diff
changeset
|
50 |
18558
4928dd61f136
Fix potential integer overflows in memory allocation.
rtogni
parents:
17048
diff
changeset
|
51 if (strlen(url) > (SIZE_MAX / 3 - 1)) { |
4928dd61f136
Fix potential integer overflows in memory allocation.
rtogni
parents:
17048
diff
changeset
|
52 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
4928dd61f136
Fix potential integer overflows in memory allocation.
rtogni
parents:
17048
diff
changeset
|
53 goto err_out; |
4928dd61f136
Fix potential integer overflows in memory allocation.
rtogni
parents:
17048
diff
changeset
|
54 } |
12391 | 55 escfilename=malloc(strlen(url)*3+1); |
56 if (!escfilename ) { | |
16908
bd4cac0d5e0e
Changed MSGTR_MPDEMUX_URL_MallocFailed to MSGTR_MemAllocFailed (msg defined two times in help_mp-en.h)
ptt
parents:
16882
diff
changeset
|
57 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
58 goto err_out; |
12391 | 59 } |
60 | |
833 | 61 // Create the URL container |
18879 | 62 Curl = malloc(sizeof(URL_t)); |
833 | 63 if( Curl==NULL ) { |
16908
bd4cac0d5e0e
Changed MSGTR_MPDEMUX_URL_MallocFailed to MSGTR_MemAllocFailed (msg defined two times in help_mp-en.h)
ptt
parents:
16882
diff
changeset
|
64 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
65 goto err_out; |
833 | 66 } |
12391 | 67 |
840 | 68 // Initialisation of the URL container members |
902 | 69 memset( Curl, 0, sizeof(URL_t) ); |
840 | 70 |
17048
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
71 url_escape_string(escfilename,url); |
12391 | 72 |
833 | 73 // Copy the url in the URL container |
12391 | 74 Curl->url = strdup(escfilename); |
833 | 75 if( Curl->url==NULL ) { |
16908
bd4cac0d5e0e
Changed MSGTR_MPDEMUX_URL_MallocFailed to MSGTR_MemAllocFailed (msg defined two times in help_mp-en.h)
ptt
parents:
16882
diff
changeset
|
76 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
77 goto err_out; |
833 | 78 } |
12391 | 79 mp_msg(MSGT_OPEN,MSGL_V,"Filename for url is now %s\n",escfilename); |
833 | 80 |
81 // extract the protocol | |
12391 | 82 ptr1 = strstr(escfilename, "://"); |
833 | 83 if( ptr1==NULL ) { |
10056
88c855a174f3
Added some special-case code for checking for "sip:" URLs (because they
rsf
parents:
9924
diff
changeset
|
84 // Check for a special case: "sip:" (without "//"): |
12391 | 85 if (strstr(escfilename, "sip:") == escfilename) { |
11412 | 86 ptr1 = (char *)&url[3]; // points to ':' |
10056
88c855a174f3
Added some special-case code for checking for "sip:" URLs (because they
rsf
parents:
9924
diff
changeset
|
87 jumpSize = 1; |
88c855a174f3
Added some special-case code for checking for "sip:" URLs (because they
rsf
parents:
9924
diff
changeset
|
88 } else { |
88c855a174f3
Added some special-case code for checking for "sip:" URLs (because they
rsf
parents:
9924
diff
changeset
|
89 mp_msg(MSGT_NETWORK,MSGL_V,"Not an URL!\n"); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
90 goto err_out; |
10056
88c855a174f3
Added some special-case code for checking for "sip:" URLs (because they
rsf
parents:
9924
diff
changeset
|
91 } |
833 | 92 } |
12391 | 93 pos1 = ptr1-escfilename; |
18879 | 94 Curl->protocol = malloc(pos1+1); |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
95 if( Curl->protocol==NULL ) { |
16908
bd4cac0d5e0e
Changed MSGTR_MPDEMUX_URL_MallocFailed to MSGTR_MemAllocFailed (msg defined two times in help_mp-en.h)
ptt
parents:
16882
diff
changeset
|
96 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
97 goto err_out; |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
98 } |
12637 | 99 strncpy(Curl->protocol, escfilename, pos1); |
833 | 100 Curl->protocol[pos1] = '\0'; |
101 | |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
102 // jump the "://" |
10056
88c855a174f3
Added some special-case code for checking for "sip:" URLs (because they
rsf
parents:
9924
diff
changeset
|
103 ptr1 += jumpSize; |
88c855a174f3
Added some special-case code for checking for "sip:" URLs (because they
rsf
parents:
9924
diff
changeset
|
104 pos1 += jumpSize; |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
105 |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
106 // check if a username:password is given |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
107 ptr2 = strstr(ptr1, "@"); |
7330
2f3fe8274028
Applied patch from Gregory Kovriga <gkovriga@techunix.technion.ac.il>
bertrand
parents:
6513
diff
changeset
|
108 ptr3 = strstr(ptr1, "/"); |
2f3fe8274028
Applied patch from Gregory Kovriga <gkovriga@techunix.technion.ac.il>
bertrand
parents:
6513
diff
changeset
|
109 if( ptr3!=NULL && ptr3<ptr2 ) { |
2f3fe8274028
Applied patch from Gregory Kovriga <gkovriga@techunix.technion.ac.il>
bertrand
parents:
6513
diff
changeset
|
110 // it isn't really a username but rather a part of the path |
2f3fe8274028
Applied patch from Gregory Kovriga <gkovriga@techunix.technion.ac.il>
bertrand
parents:
6513
diff
changeset
|
111 ptr2 = NULL; |
2f3fe8274028
Applied patch from Gregory Kovriga <gkovriga@techunix.technion.ac.il>
bertrand
parents:
6513
diff
changeset
|
112 } |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
113 if( ptr2!=NULL ) { |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
114 // We got something, at least a username... |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
115 int len = ptr2-ptr1; |
18879 | 116 Curl->username = malloc(len+1); |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
117 if( Curl->username==NULL ) { |
16908
bd4cac0d5e0e
Changed MSGTR_MPDEMUX_URL_MallocFailed to MSGTR_MemAllocFailed (msg defined two times in help_mp-en.h)
ptt
parents:
16882
diff
changeset
|
118 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
119 goto err_out; |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
120 } |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
121 strncpy(Curl->username, ptr1, len); |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
122 Curl->username[len] = '\0'; |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
123 |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
124 ptr3 = strstr(ptr1, ":"); |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
125 if( ptr3!=NULL && ptr3<ptr2 ) { |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
126 // We also have a password |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
127 int len2 = ptr2-ptr3-1; |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
128 Curl->username[ptr3-ptr1]='\0'; |
18879 | 129 Curl->password = malloc(len2+1); |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
130 if( Curl->password==NULL ) { |
16908
bd4cac0d5e0e
Changed MSGTR_MPDEMUX_URL_MallocFailed to MSGTR_MemAllocFailed (msg defined two times in help_mp-en.h)
ptt
parents:
16882
diff
changeset
|
131 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
132 goto err_out; |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
133 } |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
134 strncpy( Curl->password, ptr3+1, len2); |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
135 Curl->password[len2]='\0'; |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
136 } |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
137 ptr1 = ptr2+1; |
12391 | 138 pos1 = ptr1-escfilename; |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
139 } |
9690
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
140 |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
141 // before looking for a port number check if we have an IPv6 type numeric address |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
142 // in IPv6 URL the numeric address should be inside square braces. |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
143 ptr2 = strstr(ptr1, "["); |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
144 ptr3 = strstr(ptr1, "]"); |
11771
827cae571c5c
Fix long standing bug where last (and sometimes first) char of the
albeu
parents:
11412
diff
changeset
|
145 ptr4 = strstr(ptr1, "/"); |
827cae571c5c
Fix long standing bug where last (and sometimes first) char of the
albeu
parents:
11412
diff
changeset
|
146 if( ptr2!=NULL && ptr3!=NULL && ptr2 < ptr3 && (!ptr4 || ptr4 > ptr3)) { |
9690
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
147 // we have an IPv6 numeric address |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
148 ptr1++; |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
149 pos1++; |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
150 ptr2 = ptr3; |
11771
827cae571c5c
Fix long standing bug where last (and sometimes first) char of the
albeu
parents:
11412
diff
changeset
|
151 v6addr = 1; |
9690
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
152 } else { |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
153 ptr2 = ptr1; |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
154 |
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
155 } |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
156 |
833 | 157 // look if the port is given |
9690
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
158 ptr2 = strstr(ptr2, ":"); |
3494
fb9de639ed30
Applied the patch from Alban Bedel <albeu@free.fr>.
bertrand
parents:
3040
diff
changeset
|
159 // If the : is after the first / it isn't the port |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
160 ptr3 = strstr(ptr1, "/"); |
3494
fb9de639ed30
Applied the patch from Alban Bedel <albeu@free.fr>.
bertrand
parents:
3040
diff
changeset
|
161 if(ptr3 && ptr3 - ptr2 < 0) ptr2 = NULL; |
833 | 162 if( ptr2==NULL ) { |
163 // No port is given | |
164 // Look if a path is given | |
9690
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
165 if( ptr3==NULL ) { |
833 | 166 // No path/filename |
167 // So we have an URL like http://www.hostname.com | |
12391 | 168 pos2 = strlen(escfilename); |
833 | 169 } else { |
170 // We have an URL like http://www.hostname.com/file.txt | |
12391 | 171 pos2 = ptr3-escfilename; |
833 | 172 } |
173 } else { | |
174 // We have an URL beginning like http://www.hostname.com:1212 | |
175 // Get the port number | |
176 Curl->port = atoi(ptr2+1); | |
12391 | 177 pos2 = ptr2-escfilename; |
833 | 178 } |
11771
827cae571c5c
Fix long standing bug where last (and sometimes first) char of the
albeu
parents:
11412
diff
changeset
|
179 if( v6addr ) pos2--; |
833 | 180 // copy the hostname in the URL container |
18879 | 181 Curl->hostname = malloc(pos2-pos1+1); |
833 | 182 if( Curl->hostname==NULL ) { |
16908
bd4cac0d5e0e
Changed MSGTR_MPDEMUX_URL_MallocFailed to MSGTR_MemAllocFailed (msg defined two times in help_mp-en.h)
ptt
parents:
16882
diff
changeset
|
183 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
184 goto err_out; |
833 | 185 } |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
186 strncpy(Curl->hostname, ptr1, pos2-pos1); |
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
187 Curl->hostname[pos2-pos1] = '\0'; |
833 | 188 |
189 // Look if a path is given | |
6513
6e9d7a6b1806
Added support for URLs that contain an username:password
bertrand
parents:
5933
diff
changeset
|
190 ptr2 = strstr(ptr1, "/"); |
833 | 191 if( ptr2!=NULL ) { |
192 // A path/filename is given | |
193 // check if it's not a trailing '/' | |
194 if( strlen(ptr2)>1 ) { | |
195 // copy the path/filename in the URL container | |
3612 | 196 Curl->file = strdup(ptr2); |
840 | 197 if( Curl->file==NULL ) { |
16908
bd4cac0d5e0e
Changed MSGTR_MPDEMUX_URL_MallocFailed to MSGTR_MemAllocFailed (msg defined two times in help_mp-en.h)
ptt
parents:
16882
diff
changeset
|
198 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
199 goto err_out; |
833 | 200 } |
201 } | |
869
e350849ff400
Url given without a filename/path get the filename/path '/'
bertrand
parents:
840
diff
changeset
|
202 } |
9690
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
203 // Check if a filename was given or set, else set it with '/' |
869
e350849ff400
Url given without a filename/path get the filename/path '/'
bertrand
parents:
840
diff
changeset
|
204 if( Curl->file==NULL ) { |
18879 | 205 Curl->file = malloc(2); |
869
e350849ff400
Url given without a filename/path get the filename/path '/'
bertrand
parents:
840
diff
changeset
|
206 if( Curl->file==NULL ) { |
16908
bd4cac0d5e0e
Changed MSGTR_MPDEMUX_URL_MallocFailed to MSGTR_MemAllocFailed (msg defined two times in help_mp-en.h)
ptt
parents:
16882
diff
changeset
|
207 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
208 goto err_out; |
869
e350849ff400
Url given without a filename/path get the filename/path '/'
bertrand
parents:
840
diff
changeset
|
209 } |
e350849ff400
Url given without a filename/path get the filename/path '/'
bertrand
parents:
840
diff
changeset
|
210 strcpy(Curl->file, "/"); |
833 | 211 } |
212 | |
12391 | 213 free(escfilename); |
833 | 214 return Curl; |
16421
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
215 err_out: |
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
216 if (escfilename) free(escfilename); |
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
217 if (Curl) url_free(Curl); |
c41e22d77214
memleak fix, escfilename was not freed for an invalid url
reimar
parents:
12637
diff
changeset
|
218 return NULL; |
833 | 219 } |
220 | |
221 void | |
902 | 222 url_free(URL_t* url) { |
1530
3effaac0ddb7
silly bug fixed - thanx Szekeres Istvan <szekeres@webvilag.com>
arpi
parents:
997
diff
changeset
|
223 if(!url) return; |
833 | 224 if(url->url) free(url->url); |
225 if(url->protocol) free(url->protocol); | |
226 if(url->hostname) free(url->hostname); | |
840 | 227 if(url->file) free(url->file); |
902 | 228 if(url->username) free(url->username); |
229 if(url->password) free(url->password); | |
833 | 230 free(url); |
231 } | |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
232 |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
233 |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
234 /* Replace escape sequences in an URL (or a part of an URL) */ |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
235 /* works like strcpy(), but without return argument */ |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
236 void |
9690
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
237 url_unescape_string(char *outbuf, const char *inbuf) |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
238 { |
12391 | 239 unsigned char c,c1,c2; |
240 int i,len=strlen(inbuf); | |
241 for (i=0;i<len;i++){ | |
242 c = inbuf[i]; | |
243 if (c == '%' && i<len-2) { //must have 2 more chars | |
244 c1 = toupper(inbuf[i+1]); // we need uppercase characters | |
245 c2 = toupper(inbuf[i+2]); | |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
246 if ( ((c1>='0' && c1<='9') || (c1>='A' && c1<='F')) && |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
247 ((c2>='0' && c2<='9') || (c2>='A' && c2<='F')) ) { |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
248 if (c1>='0' && c1<='9') c1-='0'; |
11771
827cae571c5c
Fix long standing bug where last (and sometimes first) char of the
albeu
parents:
11412
diff
changeset
|
249 else c1-='A'-10; |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
250 if (c2>='0' && c2<='9') c2-='0'; |
11771
827cae571c5c
Fix long standing bug where last (and sometimes first) char of the
albeu
parents:
11412
diff
changeset
|
251 else c2-='A'-10; |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
252 c = (c1<<4) + c2; |
12391 | 253 i=i+2; //only skip next 2 chars if valid esc |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
254 } |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
255 } |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
256 *outbuf++ = c; |
12391 | 257 } |
258 *outbuf++='\0'; //add nullterm to string | |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
259 } |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
260 |
17048
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
261 static void |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
262 url_escape_string_part(char *outbuf, const char *inbuf) { |
12391 | 263 unsigned char c,c1,c2; |
264 int i,len=strlen(inbuf); | |
265 | |
266 for (i=0;i<len;i++) { | |
267 c = inbuf[i]; | |
268 if ((c=='%') && i<len-2 ) { //need 2 more characters | |
269 c1=toupper(inbuf[i+1]); c2=toupper(inbuf[i+2]); // need uppercase chars | |
270 } else { | |
271 c1=129; c2=129; //not escape chars | |
272 } | |
273 | |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
274 if( (c >= 'A' && c <= 'Z') || |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
275 (c >= 'a' && c <= 'z') || |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
276 (c >= '0' && c <= '9') || |
17048
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
277 (c >= 0x7f)) { |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
278 *outbuf++ = c; |
12391 | 279 } else if ( c=='%' && ((c1 >= '0' && c1 <= '9') || (c1 >= 'A' && c1 <= 'F')) && |
280 ((c2 >= '0' && c2 <= '9') || (c2 >= 'A' && c2 <= 'F'))) { | |
281 // check if part of an escape sequence | |
282 *outbuf++=c; // already | |
283 | |
284 // dont escape again | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16421
diff
changeset
|
285 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_URL_StringAlreadyEscaped,c,c1,c2); |
12391 | 286 // error as this should not happen against RFC 2396 |
287 // to escape a string twice | |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
288 } else { |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
289 /* all others will be escaped */ |
12391 | 290 c1 = ((c & 0xf0) >> 4); |
291 c2 = (c & 0x0f); | |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
292 if (c1 < 10) c1+='0'; |
9924 | 293 else c1+='A'-10; |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
294 if (c2 < 10) c2+='0'; |
9924 | 295 else c2+='A'-10; |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
296 *outbuf++ = '%'; |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
297 *outbuf++ = c1; |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
298 *outbuf++ = c2; |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
299 } |
12391 | 300 } |
301 *outbuf++='\0'; | |
3496
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
302 } |
5c8a533dfa09
Added 2 functions to escape/unescape the url as described in the RFC 2396.
bertrand
parents:
3494
diff
changeset
|
303 |
17048
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
304 /* Replace specific characters in the URL string by an escape sequence */ |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
305 /* works like strcpy(), but without return argument */ |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
306 void |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
307 url_escape_string(char *outbuf, const char *inbuf) { |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
308 unsigned char c; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
309 int i = 0,j,len = strlen(inbuf); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
310 char* tmp,*unesc = NULL, *in; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
311 |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
312 // Look if we have an ip6 address, if so skip it there is |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
313 // no need to escape anything in there. |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
314 tmp = strstr(inbuf,"://["); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
315 if(tmp) { |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
316 tmp = strchr(tmp+4,']'); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
317 if(tmp && (tmp[1] == '/' || tmp[1] == ':' || |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
318 tmp[1] == '\0')) { |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
319 i = tmp+1-inbuf; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
320 strncpy(outbuf,inbuf,i); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
321 outbuf += i; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
322 tmp = NULL; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
323 } |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
324 } |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
325 |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
326 while(i < len) { |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
327 // look for the next char that must be kept |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
328 for (j=i;j<len;j++) { |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
329 c = inbuf[j]; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
330 if(c=='-' || c=='_' || c=='.' || c=='!' || c=='~' || /* mark characters */ |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
331 c=='*' || c=='\'' || c=='(' || c==')' || /* do not touch escape character */ |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
332 c==';' || c=='/' || c=='?' || c==':' || c=='@' || /* reserved characters */ |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
333 c=='&' || c=='=' || c=='+' || c=='$' || c==',') /* see RFC 2396 */ |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
334 break; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
335 } |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
336 // we are on a reserved char, write it out |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
337 if(j == i) { |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
338 *outbuf++ = c; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
339 i++; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
340 continue; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
341 } |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
342 // we found one, take that part of the string |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
343 if(j < len) { |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
344 if(!tmp) tmp = malloc(len+1); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
345 strncpy(tmp,inbuf+i,j-i); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
346 tmp[j-i] = '\0'; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
347 in = tmp; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
348 } else // take the rest of the string |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
349 in = (char*)inbuf+i; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
350 |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
351 if(!unesc) unesc = malloc(len+1); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
352 // unescape first to avoid escaping escape |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
353 url_unescape_string(unesc,in); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
354 // then escape, including mark and other reserved chars |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
355 // that can come from escape sequences |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
356 url_escape_string_part(outbuf,unesc); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
357 outbuf += strlen(outbuf); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
358 i += strlen(in); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
359 } |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
360 *outbuf = '\0'; |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
361 if(tmp) free(tmp); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
362 if(unesc) free(unesc); |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
363 } |
9e02b9cb171b
Fix URL escaping to correctly handle URL containing an ip6 address or
albeu
parents:
16908
diff
changeset
|
364 |
4119
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
365 #ifdef __URL_DEBUG |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
366 void |
9690
a9b7b6055563
Added support for IPv6 numeric url like: http://[3ffe:400:100::1]:80/file
bertrand
parents:
7809
diff
changeset
|
367 url_debug(const URL_t *url) { |
4119
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
368 if( url==NULL ) { |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
369 printf("URL pointer NULL\n"); |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
370 return; |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
371 } |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
372 if( url->url!=NULL ) { |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
373 printf("url=%s\n", url->url ); |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
374 } |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
375 if( url->protocol!=NULL ) { |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
376 printf("protocol=%s\n", url->protocol ); |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
377 } |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
378 if( url->hostname!=NULL ) { |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
379 printf("hostname=%s\n", url->hostname ); |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
380 } |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
381 printf("port=%d\n", url->port ); |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
382 if( url->file!=NULL ) { |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
383 printf("file=%s\n", url->file ); |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
384 } |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
385 if( url->username!=NULL ) { |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
386 printf("username=%s\n", url->username ); |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
387 } |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
388 if( url->password!=NULL ) { |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
389 printf("password=%s\n", url->password ); |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
390 } |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
391 } |
639b3b47b138
Added a debug function to print the struct's variables.
bertrand
parents:
3612
diff
changeset
|
392 #endif //__URL_DEBUG |