]> git.sesse.net Git - vlc/blob - modules/control/http/util.c
Die !
[vlc] / modules / control / http / util.c
1 /*****************************************************************************
2  * util.c : Utility functions for HTTP interface
3  *****************************************************************************
4  * Copyright (C) 2001-2005 the VideoLAN team
5  * $Id: http.c 12225 2005-08-18 10:01:30Z massiot $
6  *
7  * Authors: Gildas Bazin <gbazin@netcourrier.com>
8  *          Laurent Aimar <fenrir@via.ecp.fr>
9  *          Christophe Massiot <massiot@via.ecp.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 #include "http.h"
27
28 /****************************************************************************
29  * File and directory functions
30  ****************************************************************************/
31
32 /* ToUrl: create a good name for an url from filename */
33 char *E_(FileToUrl)( char *name, vlc_bool_t *pb_index )
34 {
35     char *url, *p;
36
37     url = p = malloc( strlen( name ) + 1 );
38
39     *pb_index = VLC_FALSE;
40     if( !url || !p )
41     {
42         return NULL;
43     }
44
45 #ifdef WIN32
46     while( *name == '\\' || *name == '/' )
47 #else
48     while( *name == '/' )
49 #endif
50     {
51         name++;
52     }
53
54     *p++ = '/';
55     strcpy( p, name );
56
57 #ifdef WIN32
58     /* convert '\\' into '/' */
59     name = p;
60     while( *name )
61     {
62         if( *name == '\\' )
63         {
64             *p++ = '/';
65         }
66         name++;
67     }
68 #endif
69
70     /* index.* -> / */
71     if( ( p = strrchr( url, '/' ) ) != NULL )
72     {
73         if( !strncmp( p, "/index.", 7 ) )
74         {
75             p[1] = '\0';
76             *pb_index = VLC_TRUE;
77         }
78     }
79     return url;
80 }
81
82 /* Load a file */
83 int E_(FileLoad)( FILE *f, char **pp_data, int *pi_data )
84 {
85     int i_read;
86
87     /* just load the file */
88     *pi_data = 0;
89     *pp_data = malloc( 1025 );  /* +1 for \0 */
90     while( ( i_read = fread( &(*pp_data)[*pi_data], 1, 1024, f ) ) == 1024 )
91     {
92         *pi_data += 1024;
93         *pp_data = realloc( *pp_data, *pi_data  + 1025 );
94     }
95     if( i_read > 0 )
96     {
97         *pi_data += i_read;
98     }
99     (*pp_data)[*pi_data] = '\0';
100
101     return VLC_SUCCESS;
102 }
103
104 /* Parse a directory and recursively add files */
105 int E_(ParseDirectory)( intf_thread_t *p_intf, char *psz_root,
106                            char *psz_dir )
107 {
108     intf_sys_t     *p_sys = p_intf->p_sys;
109     char           dir[MAX_DIR_SIZE];
110 #ifdef HAVE_SYS_STAT_H
111     struct stat   stat_info;
112 #endif
113     DIR           *p_dir;
114     struct dirent *p_dir_content;
115     vlc_acl_t     *p_acl;
116     FILE          *file;
117
118     char          *user = NULL;
119     char          *password = NULL;
120
121     int           i_dirlen;
122
123 #ifdef HAVE_SYS_STAT_H
124     if( stat( psz_dir, &stat_info ) == -1 || !S_ISDIR( stat_info.st_mode ) )
125     {
126         return VLC_EGENERIC;
127     }
128 #endif
129
130     if( ( p_dir = opendir( psz_dir ) ) == NULL )
131     {
132         msg_Err( p_intf, "cannot open dir (%s)", psz_dir );
133         return VLC_EGENERIC;
134     }
135
136     i_dirlen = strlen( psz_dir );
137     if( i_dirlen + 10 > MAX_DIR_SIZE )
138     {
139         msg_Warn( p_intf, "skipping too deep dir (%s)", psz_dir );
140         return 0;
141     }
142
143     msg_Dbg( p_intf, "dir=%s", psz_dir );
144
145     sprintf( dir, "%s/.access", psz_dir );
146     if( ( file = fopen( dir, "r" ) ) != NULL )
147     {
148         char line[1024];
149         int  i_size;
150
151         msg_Dbg( p_intf, "find .access in dir=%s", psz_dir );
152
153         i_size = fread( line, 1, 1023, file );
154         if( i_size > 0 )
155         {
156             char *p;
157             while( i_size > 0 && ( line[i_size-1] == '\n' ||
158                    line[i_size-1] == '\r' ) )
159             {
160                 i_size--;
161             }
162
163             line[i_size] = '\0';
164
165             p = strchr( line, ':' );
166             if( p )
167             {
168                 *p++ = '\0';
169                 user = strdup( line );
170                 password = strdup( p );
171             }
172         }
173         msg_Dbg( p_intf, "using user=%s password=%s (read=%d)",
174                  user, password, i_size );
175
176         fclose( file );
177     }
178
179     sprintf( dir, "%s/.hosts", psz_dir );
180     p_acl = ACL_Create( p_intf, VLC_FALSE );
181     if( ACL_LoadFile( p_acl, dir ) )
182     {
183         ACL_Destroy( p_acl );
184         p_acl = NULL;
185     }
186
187     for( ;; )
188     {
189         /* parse psz_src dir */
190         if( ( p_dir_content = readdir( p_dir ) ) == NULL )
191         {
192             break;
193         }
194
195         if( ( p_dir_content->d_name[0] == '.' )
196          || ( i_dirlen + strlen( p_dir_content->d_name ) > MAX_DIR_SIZE ) )
197             continue;
198
199         sprintf( dir, "%s/%s", psz_dir, p_dir_content->d_name );
200         if( E_(ParseDirectory)( p_intf, psz_root, dir ) )
201         {
202             httpd_file_sys_t *f = malloc( sizeof( httpd_file_sys_t ) );
203             vlc_bool_t b_index;
204             char *psz_tmp;
205
206             f->p_intf  = p_intf;
207             f->p_file = NULL;
208             f->p_redir = NULL;
209             f->p_redir2 = NULL;
210             psz_tmp = vlc_fix_readdir_charset( p_intf, dir );
211             f->file = E_(FromUTF8)( p_intf, psz_tmp );
212             free( psz_tmp );
213             psz_tmp = vlc_fix_readdir_charset( p_intf,
214                                                &dir[strlen( psz_root )] );
215             f->name = E_(FileToUrl)( psz_tmp, &b_index );
216             free( psz_tmp );
217             f->b_html = strstr( &dir[strlen( psz_root )], ".htm" ) ? VLC_TRUE : VLC_FALSE;
218
219             if( !f->name )
220             {
221                 msg_Err( p_intf , "unable to parse directory" );
222                 closedir( p_dir );
223                 free( f );
224                 return( VLC_ENOMEM );
225             }
226             msg_Dbg( p_intf, "file=%s (url=%s)",
227                      f->file, f->name );
228
229             f->p_file = httpd_FileNew( p_sys->p_httpd_host,
230                                        f->name,
231                                        f->b_html ? p_sys->psz_html_type : NULL,
232                                        user, password, p_acl,
233                                        E_(HttpCallback), f );
234
235             if( f->p_file )
236             {
237                 TAB_APPEND( p_sys->i_files, p_sys->pp_files, f );
238             }
239             /* for url that ends by / add
240              *  - a redirect from rep to rep/
241              *  - in case of index.* rep/index.html to rep/ */
242             if( f && f->name[strlen(f->name) - 1] == '/' )
243             {
244                 char *psz_redir = strdup( f->name );
245                 char *p;
246                 psz_redir[strlen( psz_redir ) - 1] = '\0';
247
248                 msg_Dbg( p_intf, "redir=%s -> %s", psz_redir, f->name );
249                 f->p_redir = httpd_RedirectNew( p_sys->p_httpd_host, f->name, psz_redir );
250                 free( psz_redir );
251
252                 if( b_index && ( p = strstr( f->file, "index." ) ) )
253                 {
254                     asprintf( &psz_redir, "%s%s", f->name, p );
255
256                     msg_Dbg( p_intf, "redir=%s -> %s", psz_redir, f->name );
257                     f->p_redir2 = httpd_RedirectNew( p_sys->p_httpd_host,
258                                                      f->name, psz_redir );
259
260                     free( psz_redir );
261                 }
262             }
263         }
264     }
265
266     if( user )
267     {
268         free( user );
269     }
270     if( password )
271     {
272         free( password );
273     }
274
275     ACL_Destroy( p_acl );
276     closedir( p_dir );
277
278     return VLC_SUCCESS;
279 }
280
281
282 /**************************************************************************
283  * Locale functions
284  **************************************************************************/
285 char *E_(FromUTF8)( intf_thread_t *p_intf, char *psz_utf8 )
286 {
287     intf_sys_t    *p_sys = p_intf->p_sys;
288
289     if ( p_sys->iconv_from_utf8 != (vlc_iconv_t)-1 )
290     {
291         char *psz_in = psz_utf8;
292         size_t i_in = strlen(psz_in);
293         size_t i_out = i_in * 2;
294         char *psz_local = malloc(i_out + 1);
295         char *psz_out = psz_local;
296
297         size_t i_ret = vlc_iconv( p_sys->iconv_from_utf8, &psz_in, &i_in,
298                                   &psz_out, &i_out );
299         if( i_ret == (size_t)-1 || i_in )
300         {
301             msg_Warn( p_intf,
302                       "failed to convert \"%s\" to desired charset (%s)",
303                       psz_utf8, strerror(errno) );
304             free( psz_local );
305             return strdup( psz_utf8 );
306         }
307
308         *psz_out = '\0';
309         return psz_local;
310     }
311     else
312         return strdup( psz_utf8 );
313 }
314
315 char *E_(ToUTF8)( intf_thread_t *p_intf, char *psz_local )
316 {
317     intf_sys_t    *p_sys = p_intf->p_sys;
318
319     if ( p_sys->iconv_to_utf8 != (vlc_iconv_t)-1 )
320     {
321         char *psz_in = psz_local;
322         size_t i_in = strlen(psz_in);
323         size_t i_out = i_in * 6;
324         char *psz_utf8 = malloc(i_out + 1);
325         char *psz_out = psz_utf8;
326
327         size_t i_ret = vlc_iconv( p_sys->iconv_to_utf8, &psz_in, &i_in,
328                                   &psz_out, &i_out );
329         if( i_ret == (size_t)-1 || i_in )
330         {
331             msg_Warn( p_intf,
332                       "failed to convert \"%s\" to desired charset (%s)",
333                       psz_local, strerror(errno) );
334             free( psz_utf8 );
335             return strdup( psz_local );
336         }
337
338         *psz_out = '\0';
339         return psz_utf8;
340     }
341     else
342         return strdup( psz_local );
343 }
344
345 /*************************************************************************
346  * Playlist stuff
347  *************************************************************************/
348 void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
349                            playlist_item_t *p_node, char *name, mvar_t *s,
350                            int i_depth )
351 {
352     if( p_node != NULL )
353     {
354         if( p_node->i_children == -1 )
355         {
356             char value[512];
357             char *psz;
358             mvar_t *itm = mvar_New( name, "set" );
359
360             sprintf( value, "%d", ( p_pl->status.p_item == p_node )? 1 : 0 );
361             mvar_AppendNewVar( itm, "current", value );
362
363             sprintf( value, "%d", p_node->input.i_id );
364             mvar_AppendNewVar( itm, "index", value );
365
366             psz = E_(FromUTF8)( p_intf, p_node->input.psz_name );
367             mvar_AppendNewVar( itm, "name", psz );
368             free( psz );
369
370             psz = E_(FromUTF8)( p_intf, p_node->input.psz_uri );
371             mvar_AppendNewVar( itm, "uri", psz );
372             free( psz );
373
374             sprintf( value, "Item");
375             mvar_AppendNewVar( itm, "type", value );
376
377             sprintf( value, "%d", i_depth );
378             mvar_AppendNewVar( itm, "depth", value );
379
380             mvar_AppendVar( s, itm );
381         }
382         else
383         {
384             char value[512];
385             char *psz;
386             int i_child;
387             mvar_t *itm = mvar_New( name, "set" );
388
389             psz = E_(FromUTF8)( p_intf, p_node->input.psz_name );
390             mvar_AppendNewVar( itm, "name", psz );
391             mvar_AppendNewVar( itm, "uri", psz );
392             free( psz );
393
394             sprintf( value, "Node" );
395             mvar_AppendNewVar( itm, "type", value );
396
397             sprintf( value, "%d", p_node->input.i_id );
398             mvar_AppendNewVar( itm, "index", value );
399
400             sprintf( value, "%d", p_node->i_children);
401             mvar_AppendNewVar( itm, "i_children", value );
402
403             sprintf( value, "%d", i_depth );
404             mvar_AppendNewVar( itm, "depth", value );
405
406             mvar_AppendVar( s, itm );
407
408             for (i_child = 0 ; i_child < p_node->i_children ; i_child++)
409                 E_(PlaylistListNode)( p_intf, p_pl,
410                                       p_node->pp_children[i_child],
411                                       name, s, i_depth + 1);
412
413         }
414     }
415 }
416
417 /****************************************************************************
418  * Seek command parsing handling
419  ****************************************************************************/
420
421 void E_(Seek)( intf_thread_t *p_intf, char *p_value )
422 {
423     intf_sys_t     *p_sys = p_intf->p_sys;
424     vlc_value_t val;
425     int i_stock = 0;
426     uint64_t i_length;
427     int i_value = 0;
428     int i_relative = 0;
429 #define POSITION_ABSOLUTE 12
430 #define POSITION_REL_FOR 13
431 #define POSITION_REL_BACK 11
432 #define VL_TIME_ABSOLUTE 0
433 #define VL_TIME_REL_FOR 1
434 #define VL_TIME_REL_BACK -1
435     if( p_sys->p_input )
436     {
437         var_Get( p_sys->p_input, "length", &val );
438         i_length = val.i_time;
439
440         while( p_value[0] != '\0' )
441         {
442             switch(p_value[0])
443             {
444                 case '+':
445                 {
446                     i_relative = VL_TIME_REL_FOR;
447                     p_value++;
448                     break;
449                 }
450                 case '-':
451                 {
452                     i_relative = VL_TIME_REL_BACK;
453                     p_value++;
454                     break;
455                 }
456                 case '0': case '1': case '2': case '3': case '4':
457                 case '5': case '6': case '7': case '8': case '9':
458                 {
459                     i_stock = strtol( p_value , &p_value , 10 );
460                     break;
461                 }
462                 case '%': /* for percentage ie position */
463                 {
464                     i_relative += POSITION_ABSOLUTE;
465                     i_value = i_stock;
466                     i_stock = 0;
467                     p_value[0] = '\0';
468                     break;
469                 }
470                 case ':':
471                 {
472                     i_value = 60 * (i_value + i_stock) ;
473                     i_stock = 0;
474                     p_value++;
475                     break;
476                 }
477                 case 'h': case 'H': /* hours */
478                 {
479                     i_value += 3600 * i_stock;
480                     i_stock = 0;
481                     /* other characters which are not numbers are not important */
482                     while( ((p_value[0] < '0') || (p_value[0] > '9')) && (p_value[0] != '\0') )
483                     {
484                         p_value++;
485                     }
486                     break;
487                 }
488                 case 'm': case 'M': case '\'': /* minutes */
489                 {
490                     i_value += 60 * i_stock;
491                     i_stock = 0;
492                     p_value++;
493                     while( ((p_value[0] < '0') || (p_value[0] > '9')) && (p_value[0] != '\0') )
494                     {
495                         p_value++;
496                     }
497                     break;
498                 }
499                 case 's': case 'S': case '"':  /* seconds */
500                 {
501                     i_value += i_stock;
502                     i_stock = 0;
503                     while( ((p_value[0] < '0') || (p_value[0] > '9')) && (p_value[0] != '\0') )
504                     {
505                         p_value++;
506                     }
507                     break;
508                 }
509                 default:
510                 {
511                     p_value++;
512                     break;
513                 }
514             }
515         }
516
517         /* if there is no known symbol, I consider it as seconds. Otherwise, i_stock = 0 */
518         i_value += i_stock;
519
520         switch(i_relative)
521         {
522             case VL_TIME_ABSOLUTE:
523             {
524                 if( (uint64_t)( i_value ) * 1000000 <= i_length )
525                     val.i_time = (uint64_t)( i_value ) * 1000000;
526                 else
527                     val.i_time = i_length;
528
529                 var_Set( p_sys->p_input, "time", val );
530                 msg_Dbg( p_intf, "requested seek position: %dsec", i_value );
531                 break;
532             }
533             case VL_TIME_REL_FOR:
534             {
535                 var_Get( p_sys->p_input, "time", &val );
536                 if( (uint64_t)( i_value ) * 1000000 + val.i_time <= i_length )
537                 {
538                     val.i_time = ((uint64_t)( i_value ) * 1000000) + val.i_time;
539                 } else
540                 {
541                     val.i_time = i_length;
542                 }
543                 var_Set( p_sys->p_input, "time", val );
544                 msg_Dbg( p_intf, "requested seek position forward: %dsec", i_value );
545                 break;
546             }
547             case VL_TIME_REL_BACK:
548             {
549                 var_Get( p_sys->p_input, "time", &val );
550                 if( (int64_t)( i_value ) * 1000000 > val.i_time )
551                 {
552                     val.i_time = 0;
553                 } else
554                 {
555                     val.i_time = val.i_time - ((uint64_t)( i_value ) * 1000000);
556                 }
557                 var_Set( p_sys->p_input, "time", val );
558                 msg_Dbg( p_intf, "requested seek position backward: %dsec", i_value );
559                 break;
560             }
561             case POSITION_ABSOLUTE:
562             {
563                 val.f_float = __MIN( __MAX( ((float) i_value ) / 100.0 , 0.0 ) , 100.0 );
564                 var_Set( p_sys->p_input, "position", val );
565                 msg_Dbg( p_intf, "requested seek percent: %d", i_value );
566                 break;
567             }
568             case POSITION_REL_FOR:
569             {
570                 var_Get( p_sys->p_input, "position", &val );
571                 val.f_float += __MIN( __MAX( ((float) i_value ) / 100.0 , 0.0 ) , 100.0 );
572                 var_Set( p_sys->p_input, "position", val );
573                 msg_Dbg( p_intf, "requested seek percent forward: %d", i_value );
574                 break;
575             }
576             case POSITION_REL_BACK:
577             {
578                 var_Get( p_sys->p_input, "position", &val );
579                 val.f_float -= __MIN( __MAX( ((float) i_value ) / 100.0 , 0.0 ) , 100.0 );
580                 var_Set( p_sys->p_input, "position", val );
581                 msg_Dbg( p_intf, "requested seek percent backward: %d", i_value );
582                 break;
583             }
584             default:
585             {
586                 msg_Dbg( p_intf, "requested seek: what the f*** is going on here ?" );
587                 break;
588             }
589         }
590     }
591 #undef POSITION_ABSOLUTE
592 #undef POSITION_REL_FOR
593 #undef POSITION_REL_BACK
594 #undef VL_TIME_ABSOLUTE
595 #undef VL_TIME_REL_FOR
596 #undef VL_TIME_REL_BACK
597 }
598
599
600 /****************************************************************************
601  * URI Parsing functions
602  ****************************************************************************/
603 int E_(uri_test_param)( char *psz_uri, const char *psz_name )
604 {
605     char *p = psz_uri;
606
607     while( (p = strstr( p, psz_name )) )
608     {
609         /* Verify that we are dealing with a post/get argument */
610         if( (p == psz_uri || *(p - 1) == '&' || *(p - 1) == '\n')
611               && p[strlen(psz_name)] == '=' )
612         {
613             return VLC_TRUE;
614         }
615         p++;
616     }
617
618     return VLC_FALSE;
619 }
620 char *E_(uri_extract_value)( char *psz_uri, const char *psz_name,
621                              char *psz_value, int i_value_max )
622 {
623     char *p = psz_uri;
624
625     while( (p = strstr( p, psz_name )) )
626     {
627         /* Verify that we are dealing with a post/get argument */
628         if( (p == psz_uri || *(p - 1) == '&' || *(p - 1) == '\n')
629               && p[strlen(psz_name)] == '=' )
630             break;
631         p++;
632     }
633
634     if( p )
635     {
636         int i_len;
637
638         p += strlen( psz_name );
639         if( *p == '=' ) p++;
640
641         if( strchr( p, '&' ) )
642         {
643             i_len = strchr( p, '&' ) - p;
644         }
645         else
646         {
647             /* for POST method */
648             if( strchr( p, '\n' ) )
649             {
650                 i_len = strchr( p, '\n' ) - p;
651                 if( i_len && *(p+i_len-1) == '\r' ) i_len--;
652             }
653             else
654             {
655                 i_len = strlen( p );
656             }
657         }
658         i_len = __MIN( i_value_max - 1, i_len );
659         if( i_len > 0 )
660         {
661             strncpy( psz_value, p, i_len );
662             psz_value[i_len] = '\0';
663         }
664         else
665         {
666             strncpy( psz_value, "", i_value_max );
667         }
668         p += i_len;
669     }
670     else
671     {
672         strncpy( psz_value, "", i_value_max );
673     }
674
675     return p;
676 }
677
678 void E_(uri_decode_url_encoded)( char *psz )
679 {
680     char *dup = strdup( psz );
681     char *p = dup;
682
683     while( *p )
684     {
685         if( *p == '%' )
686         {
687             char val[3];
688             p++;
689             if( !*p )
690             {
691                 break;
692             }
693
694             val[0] = *p++;
695             val[1] = *p++;
696             val[2] = '\0';
697
698             *psz++ = strtol( val, NULL, 16 );
699         }
700         else if( *p == '+' )
701         {
702             *psz++ = ' ';
703             p++;
704         }
705         else
706         {
707             *psz++ = *p++;
708         }
709     }
710     *psz++ = '\0';
711     free( dup );
712 }
713
714 /* Since the resulting string is smaller we can work in place, so it is
715  * permitted to have psz == new. new points to the first word of the
716  * string, the function returns the remaining string. */
717 char *E_(FirstWord)( char *psz, char *new )
718 {
719     vlc_bool_t b_end;
720
721     while( *psz == ' ' )
722         psz++;
723
724     while( *psz != '\0' && *psz != ' ' )
725     {
726         if( *psz == '\'' )
727         {
728             char c = *psz++;
729             while( *psz != '\0' && *psz != c )
730             {
731                 if( *psz == '\\' && psz[1] != '\0' )
732                     psz++;
733                 *new++ = *psz++;
734             }
735             if( *psz == c )
736                 psz++;
737         }
738         else
739         {
740             if( *psz == '\\' && psz[1] != '\0' )
741                 psz++;
742             *new++ = *psz++;
743         }
744     }
745     b_end = !*psz;
746
747     *new++ = '\0';
748     if( !b_end )
749         return psz + 1;
750     else
751         return NULL;
752 }
753
754 /**********************************************************************
755  * parse_MRL: parse the MRL, find the mrl string and the options,
756  * create an item with all information in it, and return the item.
757  * return NULL if there is an error.
758  **********************************************************************/
759 playlist_item_t *E_(MRLParse)( intf_thread_t *p_intf, char *_psz,
760                                    char *psz_name )
761 {
762     char *psz = strdup( _psz );
763     char *s_mrl = psz;
764     char *s_temp;
765     playlist_item_t * p_item = NULL;
766
767     /* extract the mrl */
768     s_temp = E_(FirstWord)( s_mrl, s_mrl );
769     if( s_temp == NULL )
770     {
771         s_temp = s_mrl + strlen( s_mrl );
772     }
773
774     p_item = playlist_ItemNew( p_intf, s_mrl, psz_name );
775     s_mrl = s_temp;
776
777     /* now we can take care of the options */
778     while( *s_mrl != '\0' )
779     {
780         s_temp = E_(FirstWord)( s_mrl, s_mrl );
781         if( s_mrl == '\0' )
782             break;
783         if( s_temp == NULL )
784         {
785             s_temp = s_mrl + strlen( s_mrl );
786         }
787         if( *s_mrl != ':' )
788             msg_Warn( p_intf, "invalid MRL option: %s", s_mrl );
789         else
790             playlist_ItemAddOption( p_item, s_mrl );
791         s_mrl = s_temp;
792     }
793
794     free( psz );
795     return p_item;
796 }