[Mplayer-cvslog] CVS: main/libmpdemux network.c,1.25,1.26 network.h,1.8,1.9 open.c,1.29,1.30
Bertrand Baudet
bertrand at mplayer.dev.hu
Mon Jan 14 07:44:45 CET 2002
- Previous message: [Mplayer-cvslog] CVS: main/libmpdemux asf_streaming.c,1.19,1.20 network.c,1.24,1.25
- Next message: [Mplayer-cvslog] CVS: main/mp3lib decode_i586.c,NONE,1.1 Makefile,1.18,1.19 decode_i586.s,1.1.1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv7606
Modified Files:
network.c network.h open.c
Log Message:
Added support for the environment variable http_proxy.
Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- network.c 14 Jan 2002 01:12:44 -0000 1.25
+++ network.c 14 Jan 2002 06:44:30 -0000 1.26
@@ -173,6 +173,49 @@
return socket_server_fd;
}
+URL_t*
+check4proxies( URL_t *url ) {
+ if( !strcasecmp(url->protocol, "http_proxy") ) {
+ printf("Using HTTP proxy: http://%s:%d\n", url->hostname, url->port );
+ return url;
+ }
+ // Check if the http_proxy environment variable is set.
+ if( !strcasecmp(url->protocol, "http") ) {
+ char *proxy;
+ proxy = getenv("http_proxy");
+ if( proxy!=NULL ) {
+ // We got a proxy, build the URL to use it
+ int len;
+ char *new_url;
+ URL_t *tmp_url;
+ URL_t *proxy_url = url_new( proxy );
+
+ if( proxy_url==NULL ) {
+ printf("Invalid proxy setting...Trying without proxy.\n");
+ return url;
+ }
+
+ printf("Using HTTP proxy: %s\n", proxy_url->url );
+ len = strlen( proxy_url->hostname ) + strlen( url->url ) + 20; // 20 = http_proxy:// + port
+ new_url = malloc( len+1 );
+ if( new_url==NULL ) {
+ printf("Memory allocation failed\n");
+ return url;
+ }
+ sprintf( new_url, "http_proxy://%s:%d/%s", proxy_url->hostname, proxy_url->port, url->url);
+ tmp_url = url_new( new_url );
+ if( tmp_url==NULL ) {
+ return url;
+ }
+ url_free( url );
+ url = tmp_url;
+ free( new_url );
+ url_free( proxy_url );
+ }
+ }
+ return url;
+}
+
int
http_send_request( URL_t *url ) {
HTTP_header_t *http_hdr;
@@ -326,8 +369,6 @@
// HTTP based protocol
if( !strcasecmp(url->protocol, "http") || !strcasecmp(url->protocol, "http_proxy") ) {
- //if( url->port==0 ) url->port = 80;
-
fd = http_send_request( url );
if( fd<0 ) {
return -1;
Index: network.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- network.h 8 Jan 2002 07:31:29 -0000 1.8
+++ network.h 14 Jan 2002 06:44:30 -0000 1.9
@@ -42,6 +42,7 @@
void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl );
int autodetectProtocol( streaming_ctrl_t *streaming_ctrl, int *fd_out, int *file_format );
+URL_t* check4proxies( URL_t *url );
//int streaming_start( stream_t *stream, int demuxer_type );
Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- open.c 8 Jan 2002 07:31:29 -0000 1.29
+++ open.c 14 Jan 2002 06:44:30 -0000 1.30
@@ -375,6 +375,7 @@
streaming_ctrl_t *streaming_ctrl;
streaming_ctrl = streaming_ctrl_new();
if( streaming_ctrl==NULL ) return NULL;
+ url = check4proxies( url );
streaming_ctrl->url = url_copy( url );
if( autodetectProtocol( streaming_ctrl, &f, file_format )<0 ) {
mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_UnableOpenURL, filename );
- Previous message: [Mplayer-cvslog] CVS: main/libmpdemux asf_streaming.c,1.19,1.20 network.c,1.24,1.25
- Next message: [Mplayer-cvslog] CVS: main/mp3lib decode_i586.c,NONE,1.1 Makefile,1.18,1.19 decode_i586.s,1.1.1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list