~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to modules/access/dvb/http.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
/*****************************************************************************
25
25
 * Preamble
26
26
 *****************************************************************************/
27
 
#include <vlc/vlc.h>
28
 
#include <vlc/input.h>
 
27
#ifdef HAVE_CONFIG_H
 
28
# include "config.h"
 
29
#endif
 
30
 
 
31
#include <vlc_common.h>
 
32
#include <vlc_access.h>
29
33
 
30
34
#ifdef HAVE_UNISTD_H
31
35
#   include <unistd.h>
75
79
/*****************************************************************************
76
80
 * HTTPOpen: Start the internal HTTP server
77
81
 *****************************************************************************/
78
 
int E_(HTTPOpen)( access_t *p_access )
 
82
int HTTPOpen( access_t *p_access )
79
83
{
80
 
#define FREE( x )                                                           \
81
 
    if ( (x) != NULL )                                                      \
82
 
        free( x );
83
 
 
84
84
    access_sys_t *p_sys = p_access->p_sys;
85
85
    char          *psz_address, *psz_cert = NULL, *psz_key = NULL,
86
86
                  *psz_ca = NULL, *psz_crl = NULL, *psz_user = NULL,
90
90
    vlc_acl_t     *p_acl = NULL;
91
91
    httpd_file_sys_t *f;
92
92
 
93
 
    vlc_mutex_init( p_access, &p_sys->httpd_mutex );
 
93
    vlc_mutex_init( &p_sys->httpd_mutex );
94
94
    vlc_cond_init( p_access, &p_sys->httpd_cond );
95
 
    p_sys->b_request_frontend_info = p_sys->b_request_mmi_info = VLC_FALSE;
 
95
    p_sys->b_request_frontend_info = p_sys->b_request_mmi_info = false;
96
96
    p_sys->i_httpd_timeout = 0;
97
97
 
98
 
    psz_address = var_GetString( p_access, "dvb-http-host" );
99
 
    if( psz_address != NULL && *psz_address )
 
98
    psz_address = var_GetNonEmptyString( p_access, "dvb-http-host" );
 
99
    if( psz_address != NULL )
100
100
    {
101
101
        char *psz_parser = strchr( psz_address, ':' );
102
102
        if( psz_parser )
106
106
        }
107
107
    }
108
108
    else
109
 
    {
110
 
        if ( psz_address != NULL ) free( psz_address );
111
109
        return VLC_SUCCESS;
112
 
    }
113
110
 
114
111
    /* determine SSL configuration */
115
 
    psz_cert = var_GetString( p_access, "dvb-http-intf-cert" );
116
 
    if ( psz_cert != NULL && *psz_cert )
 
112
    psz_cert = var_GetNonEmptyString( p_access, "dvb-http-intf-cert" );
 
113
    if ( psz_cert != NULL )
117
114
    {
118
115
        msg_Dbg( p_access, "enabling TLS for HTTP interface (cert file: %s)",
119
116
                 psz_cert );
126
123
    }
127
124
    else
128
125
    {
129
 
        if ( !*psz_cert )
130
 
        {
131
 
            free( psz_cert );
132
 
            psz_cert = NULL;
133
 
        }
134
126
        if ( i_port <= 0 )
135
127
            i_port= 8082;
136
128
    }
144
136
    p_sys->p_httpd_host = httpd_TLSHostNew( VLC_OBJECT(p_access), psz_address,
145
137
                                            i_port, psz_cert, psz_key, psz_ca,
146
138
                                            psz_crl );
147
 
    FREE( psz_cert );
148
 
    FREE( psz_key );
149
 
    FREE( psz_ca );
150
 
    FREE( psz_crl );
 
139
    free( psz_cert );
 
140
    free( psz_key );
 
141
    free( psz_ca );
 
142
    free( psz_crl );
151
143
 
152
144
    if ( p_sys->p_httpd_host == NULL )
153
145
    {
157
149
    }
158
150
    free( psz_address );
159
151
 
160
 
    psz_user = var_GetString( p_access, "dvb-http-user" );
161
 
    psz_password = var_GetString( p_access, "dvb-http-password" );
162
 
    psz_acl = var_GetString( p_access, "dvb-http-acl" );
 
152
    psz_user = var_GetNonEmptyString( p_access, "dvb-http-user" );
 
153
    psz_password = var_GetNonEmptyString( p_access, "dvb-http-password" );
 
154
    psz_acl = var_GetNonEmptyString( p_access, "dvb-http-acl" );
163
155
 
164
156
    if ( psz_acl != NULL )
165
157
    {
166
 
        p_acl = ACL_Create( p_access, VLC_FALSE );
 
158
        p_acl = ACL_Create( p_access, false );
167
159
        if( ACL_LoadFile( p_acl, psz_acl ) )
168
160
        {
169
161
            ACL_Destroy( p_acl );
179
171
                               psz_user, psz_password, p_acl,
180
172
                               HttpCallback, f );
181
173
 
182
 
    FREE( psz_user );
183
 
    FREE( psz_password );
184
 
    FREE( psz_acl );
 
174
    free( psz_user );
 
175
    free( psz_password );
 
176
    free( psz_acl );
185
177
    if ( p_acl != NULL )
186
178
        ACL_Destroy( p_acl );
187
179
 
196
188
    p_sys->p_httpd_redir = httpd_RedirectNew( p_sys->p_httpd_host,
197
189
                                              "/index.html", "/" );
198
190
 
199
 
#undef FREE
200
 
 
201
191
    return VLC_SUCCESS;
202
192
}
203
193
 
204
194
/*****************************************************************************
205
195
 * HTTPClose: Stop the internal HTTP server
206
196
 *****************************************************************************/
207
 
void E_(HTTPClose)( access_t *p_access )
 
197
void HTTPClose( access_t *p_access )
208
198
{
209
199
    access_sys_t *p_sys = p_access->p_sys;
210
200
 
214
204
        {
215
205
            /* Unlock the thread if it is stuck in HttpCallback */
216
206
            vlc_mutex_lock( &p_sys->httpd_mutex );
217
 
            if ( p_sys->b_request_frontend_info == VLC_TRUE )
 
207
            if ( p_sys->b_request_frontend_info == true )
218
208
            {
219
 
                p_sys->b_request_frontend_info = VLC_FALSE;
 
209
                p_sys->b_request_frontend_info = false;
220
210
                p_sys->psz_frontend_info = strdup("");
221
211
            }
222
 
            if ( p_sys->b_request_mmi_info == VLC_TRUE )
 
212
            if ( p_sys->b_request_mmi_info == true )
223
213
            {
224
 
                p_sys->b_request_mmi_info = VLC_FALSE;
 
214
                p_sys->b_request_mmi_info = false;
225
215
                p_sys->psz_mmi_info = strdup("");
226
216
            }
227
217
            vlc_cond_signal( &p_sys->httpd_cond );
265
255
 
266
256
    vlc_mutex_lock( &p_sys->httpd_mutex );
267
257
 
268
 
    p_sys->i_httpd_timeout = mdate() + I64C(3000000); /* 3 s */
 
258
    p_sys->i_httpd_timeout = mdate() + INT64_C(3000000); /* 3 s */
269
259
    p_sys->psz_request = psz_request;
270
 
    p_sys->b_request_frontend_info = VLC_TRUE;
 
260
    p_sys->b_request_frontend_info = true;
271
261
    if ( p_sys->i_ca_handle )
272
262
    {
273
 
        p_sys->b_request_mmi_info = VLC_TRUE;
 
263
        p_sys->b_request_mmi_info = true;
274
264
    }
275
265
    else
276
266
    {
305
295
/****************************************************************************
306
296
 * HTTPExtractValue: Extract a GET variable from psz_request
307
297
 ****************************************************************************/
308
 
char *E_(HTTPExtractValue)( char *psz_uri, const char *psz_name,
 
298
char *HTTPExtractValue( char *psz_uri, const char *psz_name,
309
299
                            char *psz_value, int i_value_max )
310
300
{
311
301
    char *p = psz_uri;