]> git.sesse.net Git - vlc/blob - modules/stream_out/rtsp.c
Implement the Timestamp header
[vlc] / modules / stream_out / rtsp.c
1 /*****************************************************************************
2  * rtsp.c: RTSP support for RTP stream output module
3  *****************************************************************************
4  * Copyright (C) 2003-2007 the VideoLAN team
5  * $Id: rtp.c 21407 2007-08-22 20:10:41Z courmisch $
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <vlc/vlc.h>
28 #include <vlc_sout.h>
29
30 #include <vlc_httpd.h>
31 #include <vlc_url.h>
32 #include <vlc_network.h>
33 #include <assert.h>
34
35 #include "rtp.h"
36
37 typedef struct rtsp_session_t rtsp_session_t;
38
39 struct rtsp_stream_t
40 {
41     vlc_mutex_t     lock;
42     sout_stream_t  *owner;
43     httpd_host_t   *host;
44     httpd_url_t    *url;
45     char           *psz_control;
46     char           *psz_path;
47
48     int             sessionc;
49     rtsp_session_t **sessionv;
50 };
51
52
53 static int  RtspCallback( httpd_callback_sys_t *p_args,
54                           httpd_client_t *cl,
55                           httpd_message_t *answer, httpd_message_t *query );
56 static int  RtspCallbackId( httpd_callback_sys_t *p_args,
57                             httpd_client_t *cl,
58                             httpd_message_t *answer, httpd_message_t *query );
59 static void RtspClientDel( rtsp_stream_t *rtsp, rtsp_session_t *session );
60
61 rtsp_stream_t *RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url )
62 {
63     rtsp_stream_t *rtsp = malloc( sizeof( *rtsp ) );
64
65     if( rtsp == NULL )
66         return NULL;
67
68     rtsp->owner = p_stream;
69     rtsp->sessionc = 0;
70     rtsp->sessionv = NULL;
71     vlc_mutex_init( p_stream, &rtsp->lock );
72
73     msg_Dbg( p_stream, "rtsp setup: %s : %d / %s\n",
74              url->psz_host, url->i_port, url->psz_path );
75
76     rtsp->psz_path = strdup( url->psz_path ? url->psz_path : "/" );
77     if( rtsp->psz_path == NULL )
78         goto error;
79
80     if( asprintf( &rtsp->psz_control, "rtsp://%s:%d%s",
81                   url->psz_host,  url->i_port > 0 ? url->i_port : 554,
82                   rtsp->psz_path ) == -1 )
83     {
84         rtsp->psz_control = NULL;
85         goto error;
86     }
87
88     rtsp->host = httpd_HostNew( VLC_OBJECT(p_stream), url->psz_host,
89                                 url->i_port > 0 ? url->i_port : 554 );
90     if( rtsp->host == NULL )
91         goto error;
92
93     rtsp->url = httpd_UrlNewUnique( rtsp->host, rtsp->psz_path, NULL, NULL,
94                                     NULL );
95     if( rtsp->url == NULL )
96         goto error;
97
98     httpd_UrlCatch( rtsp->url, HTTPD_MSG_DESCRIBE, RtspCallback, (void*)rtsp );
99     httpd_UrlCatch( rtsp->url, HTTPD_MSG_SETUP,    RtspCallback, (void*)rtsp );
100     httpd_UrlCatch( rtsp->url, HTTPD_MSG_PLAY,     RtspCallback, (void*)rtsp );
101     httpd_UrlCatch( rtsp->url, HTTPD_MSG_PAUSE,    RtspCallback, (void*)rtsp );
102     httpd_UrlCatch( rtsp->url, HTTPD_MSG_TEARDOWN, RtspCallback, (void*)rtsp );
103     return rtsp;
104
105 error:
106     RtspUnsetup( rtsp );
107     return NULL;
108 }
109
110
111 void RtspUnsetup( rtsp_stream_t *rtsp )
112 {
113     while( rtsp->sessionc > 0 )
114         RtspClientDel( rtsp, rtsp->sessionv[0] );
115
116     if( rtsp->url )
117         httpd_UrlDelete( rtsp->url );
118
119     if( rtsp->host )
120         httpd_HostDelete( rtsp->host );
121
122     vlc_mutex_destroy( &rtsp->lock );
123 }
124
125
126 struct rtsp_stream_id_t
127 {
128     rtsp_stream_t    *stream;
129     sout_stream_id_t *sout_id;
130     httpd_url_t      *url;
131     const char       *dst;
132     int               ttl;
133     unsigned          loport, hiport;
134 };
135
136
137 typedef struct rtsp_strack_t rtsp_strack_t;
138
139 /* For unicast streaming */
140 struct rtsp_session_t
141 {
142     rtsp_stream_t *stream;
143
144     /* output (id-access) */
145     int            trackc;
146     rtsp_strack_t *trackv;
147
148     char name[0];
149 };
150
151
152 /* Unicast session track */
153 struct rtsp_strack_t
154 {
155     sout_stream_id_t  *id;
156     sout_access_out_t *access;
157     vlc_bool_t         playing;
158 };
159
160
161 rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
162                              unsigned num,
163                              /* Multicast stuff - TODO: cleanup */
164                              const char *dst, int ttl,
165                              unsigned loport, unsigned hiport )
166 {
167     char urlbuf[strlen( rtsp->psz_control ) + 1 + 10];
168     rtsp_stream_id_t *id = malloc( sizeof( *id ) );
169     httpd_url_t *url;
170
171     if( id == NULL )
172         return NULL;
173
174     id->stream = rtsp;
175     id->sout_id = sid;
176     /* TODO: can we assume that this need not be strdup'd? */
177     id->dst = dst;
178     if( id->dst != NULL )
179     {
180         id->ttl = ttl;
181         id->loport = loport;
182         id->hiport = hiport;
183     }
184
185     sprintf( urlbuf, "%s/trackID=%d", rtsp->psz_path, num );
186     msg_Dbg( rtsp->owner, "RTSP: adding %s\n", urlbuf );
187     url = id->url = httpd_UrlNewUnique( rtsp->host, urlbuf, NULL, NULL, NULL );
188
189     if( url == NULL )
190     {
191         free( id );
192         return NULL;
193     }
194
195     httpd_UrlCatch( url, HTTPD_MSG_DESCRIBE, RtspCallbackId, (void *)id );
196     httpd_UrlCatch( url, HTTPD_MSG_SETUP,    RtspCallbackId, (void *)id );
197     httpd_UrlCatch( url, HTTPD_MSG_PLAY,     RtspCallbackId, (void *)id );
198     httpd_UrlCatch( url, HTTPD_MSG_PAUSE,    RtspCallbackId, (void *)id );
199     httpd_UrlCatch( url, HTTPD_MSG_TEARDOWN, RtspCallbackId, (void *)id );
200
201     return id;
202 }
203
204
205 void RtspDelId( rtsp_stream_t *rtsp, rtsp_stream_id_t *id )
206 {
207     vlc_mutex_lock( &rtsp->lock );
208     for( int i = 0; i < rtsp->sessionc; i++ )
209     {
210         rtsp_session_t *ses = rtsp->sessionv[i];
211
212         for( int j = 0; j < ses->trackc; j++ )
213         {
214             if( ses->trackv[j].id == id->sout_id )
215             {
216                 rtsp_strack_t *tr = ses->trackv + j;
217                 sout_AccessOutDelete( tr->access );
218                 REMOVE_ELEM( ses->trackv, ses->trackc, j );
219                 /* FIXME: are we supposed to notify the client? */
220             }
221         }
222     }
223
224     vlc_mutex_unlock( &rtsp->lock );
225     httpd_UrlDelete( id->url );
226     free( id );
227 }
228
229
230 /** rtsp must be locked */
231 static
232 rtsp_session_t *RtspClientNew( rtsp_stream_t *rtsp, const char *name )
233 {
234     rtsp_session_t *s = malloc( sizeof( *s ) + strlen( name ) + 1 );
235
236     s->stream = rtsp;
237     s->trackc = 0;
238     s->trackv = NULL;
239     strcpy( s->name, name );
240
241     TAB_APPEND( rtsp->sessionc, rtsp->sessionv, s );
242
243     return s;
244 }
245
246
247 /** rtsp must be locked */
248 static
249 rtsp_session_t *RtspClientGet( rtsp_stream_t *rtsp, const char *name )
250 {
251     int i;
252
253     if( name == NULL )
254         return NULL;
255
256     /* FIXME: use a hash/dictionary */
257     for( i = 0; i < rtsp->sessionc; i++ )
258     {
259         if( !strcmp( rtsp->sessionv[i]->name, name ) )
260             return rtsp->sessionv[i];
261     }
262     return NULL;
263 }
264
265
266 /** rtsp must be locked */
267 static
268 void RtspClientDel( rtsp_stream_t *rtsp, rtsp_session_t *session )
269 {
270     int i;
271     TAB_REMOVE( rtsp->sessionc, rtsp->sessionv, session );
272
273     for( i = 0; i < session->trackc; i++ )
274     {
275         rtp_del_sink( session->trackv[i].id, session->trackv[i].access );
276         sout_AccessOutDelete( session->trackv[i].access );
277     }
278
279     free( session->trackv );
280     free( session );
281 }
282
283
284 /** Aggregate RTSP callback */
285 static int RtspCallback( httpd_callback_sys_t *p_args,
286                          httpd_client_t *cl,
287                          httpd_message_t *answer, httpd_message_t *query )
288 {
289     rtsp_stream_t *rtsp = (rtsp_stream_t *)p_args;
290     const char *psz_session = NULL, *psz;
291
292     if( answer == NULL || query == NULL )
293     {
294         return VLC_SUCCESS;
295     }
296     //fprintf( stderr, "RtspCallback query: type=%d\n", query->i_type );
297
298     answer->i_proto = HTTPD_PROTO_RTSP;
299     answer->i_version= query->i_version;
300     answer->i_type   = HTTPD_MSG_ANSWER;
301     answer->i_body = 0;
302     answer->p_body = NULL;
303
304     if( httpd_MsgGet( query, "Require" ) != NULL )
305     {
306         answer->i_status = 551;
307         httpd_MsgAdd( query, "Unsupported", "%s",
308                       httpd_MsgGet( query, "Require" ) );
309     }
310     else
311     switch( query->i_type )
312     {
313         case HTTPD_MSG_DESCRIBE:
314         {
315             char *psz_sdp = SDPGenerate( rtsp->owner, rtsp->psz_control );
316
317             answer->i_status = 200;
318             httpd_MsgAdd( answer, "Content-Type",  "%s", "application/sdp" );
319             httpd_MsgAdd( answer, "Content-Base",  "%s", rtsp->psz_control );
320             answer->p_body = (uint8_t *)psz_sdp;
321             answer->i_body = strlen( psz_sdp );
322             break;
323         }
324
325         case HTTPD_MSG_SETUP:
326             answer->i_status = 459;
327             break;
328
329         case HTTPD_MSG_PLAY:
330         {
331             rtsp_session_t *ses;
332             answer->i_status = 200;
333
334             psz_session = httpd_MsgGet( query, "Session" );
335             if( httpd_MsgGet( query, "Range" ) != NULL )
336             {
337                 answer->i_status = 456; /* cannot seek */
338                 break;
339             }
340
341             vlc_mutex_lock( &rtsp->lock );
342             ses = RtspClientGet( rtsp, psz_session );
343             if( ses != NULL )
344             {
345                 for( int i = 0; i < ses->trackc; i++ )
346                 {
347                     rtsp_strack_t *tr = ses->trackv + i;
348                     if( !tr->playing )
349                     {
350                         tr->playing = VLC_TRUE;
351                         rtp_add_sink( tr->id, tr->access );
352                     }
353                 }
354             }
355             vlc_mutex_unlock( &rtsp->lock );
356
357             if( httpd_MsgGet( query, "Scale" ) != NULL )
358                 httpd_MsgAdd( answer, "Scale", "1." );
359             break;
360         }
361
362         case HTTPD_MSG_PAUSE:
363             answer->i_status = 405;
364             httpd_MsgAdd( answer, "Allow", "DESCRIBE, PLAY, TEARDOWN" );
365             break;
366
367         case HTTPD_MSG_TEARDOWN:
368         {
369             rtsp_session_t *ses;
370
371             /* for now only multicast so easy again */
372             answer->i_status = 200;
373
374             psz_session = httpd_MsgGet( query, "Session" );
375
376             vlc_mutex_lock( &rtsp->lock );
377             ses = RtspClientGet( rtsp, psz_session );
378             if( ses != NULL )
379                 RtspClientDel( rtsp, ses );
380             vlc_mutex_unlock( &rtsp->lock );
381             break;
382         }
383
384         default:
385             return VLC_EGENERIC;
386     }
387
388     httpd_MsgAdd( answer, "Server", "%s", PACKAGE_STRING );
389     httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body );
390
391     psz = httpd_MsgGet( query, "Cseq" );
392     if( psz != NULL )
393         httpd_MsgAdd( answer, "Cseq", "%s", psz );
394     psz = httpd_MsgGet( query, "Timestamp" );
395     if( psz != NULL )
396         httpd_MsgAdd( answer, "Timestamp", "%s", psz );
397
398     httpd_MsgAdd( answer, "Cache-Control", "%s", "no-cache" );
399
400     if( psz_session )
401         httpd_MsgAdd( answer, "Session", "%s;timeout=5", psz_session );
402     return VLC_SUCCESS;
403 }
404
405
406 /** Finds the next transport choice */
407 static inline const char *transport_next( const char *str )
408 {
409     /* Looks for comma */
410     str = strchr( str, ',' );
411     if( str == NULL )
412         return NULL; /* No more transport options */
413
414     str++; /* skips comma */
415     while( strchr( "\r\n\t ", *str ) )
416         str++;
417
418     return (*str) ? str : NULL;
419 }
420
421
422 /** Finds the next transport parameter */
423 static inline const char *parameter_next( const char *str )
424 {
425     while( strchr( ",;", *str ) == NULL )
426         str++;
427
428     return (*str == ';') ? (str + 1) : NULL;
429 }
430
431
432 /** Non-aggregate RTSP callback */
433 static int RtspCallbackId( httpd_callback_sys_t *p_args,
434                            httpd_client_t *cl,
435                            httpd_message_t *answer, httpd_message_t *query )
436 {
437     rtsp_stream_id_t *id = (rtsp_stream_id_t *)p_args;
438     rtsp_stream_t    *rtsp = id->stream;
439     sout_stream_t    *p_stream = id->stream->owner;
440     char psz_session_init[21];
441     const char *psz_session, *psz;
442
443     if( answer == NULL || query == NULL )
444         return VLC_SUCCESS;
445     //fprintf( stderr, "RtspCallback query: type=%d\n", query->i_type );
446
447     /* */
448     answer->i_proto = HTTPD_PROTO_RTSP;
449     answer->i_version= query->i_version;
450     answer->i_type   = HTTPD_MSG_ANSWER;
451     answer->i_body = 0;
452     answer->p_body = NULL;
453
454     /* Create new session ID if needed */
455     psz_session = httpd_MsgGet( query, "Session" );
456     if( psz_session == NULL )
457     {
458         /* FIXME: should be somewhat secure randomness */
459         snprintf( psz_session_init, sizeof(psz_session_init), I64Fu,
460                   NTPtime64() + rand() );
461     }
462
463     if( httpd_MsgGet( query, "Require" ) != NULL )
464     {
465         answer->i_status = 551;
466         httpd_MsgAdd( query, "Unsupported", "%s",
467                       httpd_MsgGet( query, "Require" ) );
468     }
469     else
470     switch( query->i_type )
471     {
472         case HTTPD_MSG_SETUP:
473         {
474             answer->i_status = 461;
475
476             for( const char *tpt = httpd_MsgGet( query, "Transport" );
477                  tpt != NULL;
478                  tpt = transport_next( tpt ) )
479             {
480                 vlc_bool_t b_multicast = VLC_TRUE, b_unsupp = VLC_FALSE;
481                 unsigned loport = 5004, hiport = 5005; /* from RFC3551 */
482
483                 /* Check transport protocol. */
484                 /* Currently, we only support RTP/AVP over UDP */
485                 if( strncmp( tpt, "RTP/AVP", 7 ) )
486                     continue;
487                 tpt += 7;
488                 if( strncmp( tpt, "/UDP", 4 ) == 0 )
489                     tpt += 4;
490                 if( strchr( ";,", *tpt ) == NULL )
491                     continue;
492
493                 /* Parse transport options */
494                 for( const char *opt = parameter_next( tpt );
495                      opt != NULL;
496                      opt = parameter_next( opt ) )
497                 {
498                     if( strncmp( opt, "multicast", 9 ) == 0)
499                         b_multicast = VLC_TRUE;
500                     else
501                     if( strncmp( opt, "unicast", 7 ) == 0 )
502                         b_multicast = VLC_FALSE;
503                     else
504                     if( sscanf( opt, "client_port=%u-%u", &loport, &hiport ) == 2 )
505                         ;
506                     else
507                     if( strncmp( opt, "mode=", 5 ) == 0 )
508                     {
509                         if( strncasecmp( opt + 5, "play", 4 )
510                          && strncasecmp( opt + 5, "\"PLAY\"", 6 ) )
511                         {
512                             /* Not playing?! */
513                             b_unsupp = VLC_TRUE;
514                             break;
515                         }
516                     }
517                     else
518                     {
519                     /*
520                      * Every other option is unsupported:
521                      *
522                      * "source" and "append" are invalid.
523                      *
524                      * For multicast, "port", "layers", "ttl" are set by the
525                      * stream output configuration.
526                      *
527                      * For unicast, we do not allow "destination" as it
528                      * carries a DoS risk, and we decide on "server_port".
529                      *
530                      * "interleaved" and "ssrc" are not implemented.
531                      */
532                         b_unsupp = VLC_TRUE;
533                         break;
534                     }
535                 }
536
537                 if( b_unsupp )
538                     continue;
539
540                 if( b_multicast )
541                 {
542                     const char *dst = id->dst;
543                     if( dst == NULL )
544                         continue;
545
546                     answer->i_status = 200;
547
548                     httpd_MsgAdd( answer, "Transport",
549                                   "RTP/AVP/UDP;destination=%s;port=%u-%u;"
550                                   "ttl=%d;mode=play",
551                                   dst, id->loport, id->hiport,
552                                   ( id->ttl > 0 ) ? id->ttl : 1 );
553                 }
554                 else
555                 {
556                     char ip[NI_MAXNUMERICHOST], url[NI_MAXNUMERICHOST + 8];
557                     static const char access[] = "udp{raw,rtcp}";
558                     rtsp_session_t *ses = NULL;
559                     rtsp_strack_t track = { id->sout_id, NULL, VLC_FALSE };
560
561                     if( httpd_ClientIP( cl, ip ) == NULL )
562                     {
563                         answer->i_status = 500;
564                         continue;
565                     }
566
567                     snprintf( url, sizeof( url ),
568                               ( strchr( ip, ':' ) != NULL ) ? "[%s]:%d" : "%s:%d",
569                               ip, loport );
570
571                     track.access = sout_AccessOutNew( p_stream->p_sout,
572                                                       access, url );
573                     if( track.access == NULL )
574                     {
575                         msg_Err( p_stream,
576                                  "cannot create access output for %s://%s",
577                                  access, url );
578                         answer->i_status = 500;
579                         continue;
580                     }
581
582                     char *src = var_GetNonEmptyString( track.access, "src-addr" );
583                     int sport = var_GetInteger( track.access, "src-port" );
584
585                     vlc_mutex_lock( &rtsp->lock );
586                     if( psz_session == NULL )
587                     {
588                         psz_session = psz_session_init;
589                         ses = RtspClientNew( rtsp, psz_session );
590                     }
591                     else
592                     {
593                         /* FIXME: we probably need to remove an access out,
594                          * if there is already one for the same ID */
595                         ses = RtspClientGet( rtsp, psz_session );
596                         if( ses == NULL )
597                         {
598                             answer->i_status = 454;
599                             vlc_mutex_unlock( &rtsp->lock );
600                             continue;
601                         }
602                     }
603
604                     INSERT_ELEM( ses->trackv, ses->trackc, ses->trackc, track );
605                     vlc_mutex_unlock( &rtsp->lock );
606
607                     httpd_ServerIP( cl, ip );
608
609                     if( ( src != NULL ) && strcmp( src, ip ) )
610                     {
611                         /* Specify source IP if it is different from the RTSP
612                          * control connection server address */
613                         char *ptr = strchr( src, '%' );
614                         if( ptr != NULL ) *ptr = '\0'; /* remove scope ID */
615
616                         httpd_MsgAdd( answer, "Transport",
617                                       "RTP/AVP/UDP;unicast;source=%s;"
618                                       "client_port=%u-%u;server_port=%u-%u;"
619                                       "mode=play",
620                                       src, loport, loport + 1, sport, sport + 1 );
621                     }
622                     else
623                     {
624                         httpd_MsgAdd( answer, "Transport",
625                                       "RTP/AVP/UDP;unicast;"
626                                       "client_port=%u-%u;server_port=%u-%u;"
627                                       "mode=play",
628                                       loport, loport + 1, sport, sport + 1 );
629                     }
630
631                     answer->i_status = 200;
632                     free( src );
633                 }
634                 break;
635             }
636             break;
637         }
638
639         case HTTPD_MSG_PLAY:
640         {
641             rtsp_session_t *ses;
642             answer->i_status = 200;
643
644             psz_session = httpd_MsgGet( query, "Session" );
645             if( httpd_MsgGet( query, "Range" ) != NULL )
646             {
647                 answer->i_status = 456; /* cannot seek */
648                 break;
649             }
650
651             vlc_mutex_lock( &rtsp->lock );
652             ses = RtspClientGet( rtsp, psz_session );
653             if( ses != NULL )
654             {
655                 for( int i = 0; i < ses->trackc; i++ )
656                 {
657                     rtsp_strack_t *tr = ses->trackv + i;
658                     if( !tr->playing && ( tr->id == id->sout_id ) )
659                     {
660                         tr->playing = VLC_TRUE;
661                         rtp_add_sink( tr->id, tr->access );
662                     }
663                 }
664             }
665             vlc_mutex_unlock( &rtsp->lock );
666
667             if( httpd_MsgGet( query, "Scale" ) != NULL )
668                 httpd_MsgAdd( answer, "Scale", "1." );
669             break;
670         }
671
672         case HTTPD_MSG_PAUSE:
673             answer->i_status = 405;
674             httpd_MsgAdd( answer, "Allow", "SETUP, PLAY, TEARDOWN" );
675             break;
676
677         case HTTPD_MSG_TEARDOWN:
678         {
679             rtsp_session_t *ses;
680
681             answer->i_status = 200;
682
683             psz_session = httpd_MsgGet( query, "Session" );
684
685             vlc_mutex_lock( &rtsp->lock );
686             ses = RtspClientGet( rtsp, psz_session );
687             if( ses != NULL )
688             {
689                 for( int i = 0; i < ses->trackc; i++ )
690                 {
691                     if( ses->trackv[i].id == id->sout_id )
692                     {
693                         rtp_del_sink( id->sout_id, ses->trackv[i].access );
694                         sout_AccessOutDelete( ses->trackv[i].access );
695                         REMOVE_ELEM( ses->trackv, ses->trackc, i );
696                     }
697                 }
698             }
699             vlc_mutex_unlock( &rtsp->lock );
700             break;
701         }
702
703         default:
704             answer->i_status = 460;
705             break;
706     }
707
708     psz = httpd_MsgGet( query, "Cseq" );
709     if( psz != NULL )
710         httpd_MsgAdd( answer, "Cseq", "%s", psz );
711     psz = httpd_MsgGet( query, "Timestamp" );
712     if( psz != NULL )
713         httpd_MsgAdd( answer, "Timestamp", "%s", psz );
714     httpd_MsgAdd( answer, "Server", "%s", PACKAGE_STRING );
715     httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body );
716     httpd_MsgAdd( answer, "Cache-Control", "%s", "no-cache" );
717
718     if( psz_session )
719         httpd_MsgAdd( answer, "Session", "%s"/*;timeout=5*/, psz_session );
720     return VLC_SUCCESS;
721 }