~ubuntu-branches/ubuntu/edgy/gstreamer0.10-ffmpeg/edgy

« back to all changes in this revision

Viewing changes to gst-libs/ext/ffmpeg/libavformat/http.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-04-01 16:13:43 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20060401161343-n621cgjlujio0otg
Tags: upstream-0.10.1
Import upstream version 0.10.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *
15
15
 * You should have received a copy of the GNU Lesser General Public
16
16
 * License along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 */
19
19
#include "avformat.h"
20
20
#include <unistd.h>
73
73
    h->priv_data = s;
74
74
 
75
75
    proxy_path = getenv("http_proxy");
76
 
    use_proxy = (proxy_path != NULL) && !getenv("no_proxy") && 
 
76
    use_proxy = (proxy_path != NULL) && !getenv("no_proxy") &&
77
77
        strstart(proxy_path, "http://", NULL);
78
78
 
79
79
    /* fill the dest addr */
80
80
 redo:
81
81
    /* needed in any case to build the host string */
82
 
    url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port, 
 
82
    url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
83
83
              path1, sizeof(path1), uri);
84
84
    if (port > 0) {
85
85
        snprintf(hoststr, sizeof(hoststr), "%s:%d", hostname, port);
88
88
    }
89
89
 
90
90
    if (use_proxy) {
91
 
        url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port, 
 
91
        url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
92
92
                  NULL, 0, proxy_path);
93
93
        path = uri;
94
94
    } else {
142
142
static int process_line(HTTPContext *s, char *line, int line_count)
143
143
{
144
144
    char *tag, *p;
145
 
    
 
145
 
146
146
    /* end of header */
147
147
    if (line[0] == '\0')
148
148
        return 0;
160
160
    } else {
161
161
        while (*p != '\0' && *p != ':')
162
162
            p++;
163
 
        if (*p != ':') 
 
163
        if (*p != ':')
164
164
            return 1;
165
 
        
 
165
 
166
166
        *p = '\0';
167
167
        tag = line;
168
168
        p++;
198
198
             LIBAVFORMAT_IDENT,
199
199
             hoststr,
200
200
             b64_encode(auth));
201
 
    
 
201
 
202
202
    if (http_write(h, s->buffer, strlen(s->buffer)) < 0)
203
203
        return AVERROR_IO;
204
 
        
 
204
 
205
205
    /* init input buffer */
206
206
    s->buf_ptr = s->buffer;
207
207
    s->buf_end = s->buffer;
211
211
        sleep(1);
212
212
        return 0;
213
213
    }
214
 
    
 
214
 
215
215
    /* wait for header */
216
216
    q = line;
217
217
    for(;;) {
286
286
/*****************************************************************************
287
287
 * b64_encode: stolen from VLC's http.c
288
288
 *****************************************************************************/
289
 
                                                                                
 
289
 
290
290
static char *b64_encode( const unsigned char *src )
291
291
{
292
292
    static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
317
317
            *dst++ = '=';
318
318
            break;
319
319
        }
320
 
                                                                                
 
320
 
321
321
        while( i_shift >= 6 )
322
322
        {
323
323
            i_shift -= 6;
324
324
            *dst++ = b64[(i_bits >> i_shift)&0x3f];
325
325
        }
326
326
    }
327
 
                                                                                
 
327
 
328
328
    *dst++ = '\0';
329
 
                                                                                
 
329
 
330
330
    return ret;
331
331
}
332
332