Schau mal ob das dich weiterbringt:
Code: Alles auswählen
Index: netfile.cpp
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/netfile.cpp,v
retrieving revision 1.28
diff -u -r1.28 netfile.cpp
--- netfile.cpp 5 Jun 2006 23:36:21 -0000 1.28
+++ netfile.cpp 12 Apr 2007 20:59:53 -0000
@@ -56,11 +56,15 @@
| shoutcast example: |
| |
| fd = fopen("icy://find.me:666/funky/station/", "r"); |
+| or |
+| fd = fopen("icy://dXNlcjpwYXNzd29yZA==@find.me:666/station", "r"); |
| |
| This is a low level mechanism that can be used for all |
| shoutcast servers, but it mainly is intended to be used for |
| private radio stations which are not listed in the official |
| shoutcast directory. The stream is opened read-only. |
+| The second format contains a base64 encoded string before '@' |
+| of username:passwort to be sent for basic authentication. |
| |
| file access modes, selectable by the fopen 'access type': |
| |
@@ -94,6 +98,8 @@
\******************************************************************************/
#include "netfile.h"
#include "global.h"
+
+#include "resolv.h"
/*
TODO:
- ICECAST support
@@ -381,9 +387,24 @@
send(url->fd, str, strlen(str), 0);
}
- sprintf(str, "User-Agent: %s\r\n\r\n", "RealPlayer/4.0");
- dprintf(stderr, "> %s", str);
- send(url->fd, str, strlen(str), 0);
+ sprintf(str, "User-Agent: %s\r\n", "RealPlayer/4.0");
+ dprintf(stderr, "> %s", str);
+ send(url->fd, str, strlen(str), 0);
+
+ if (url->logindata[0])
+ {
+ char coded_data[2048];
+ if(b64_ntop((const u_char*)url->logindata, strlen(url->logindata), coded_data, sizeof(coded_data)) < 0)
+ sprintf(str, "Authorization: Basic %s\r\n", url->logindata);
+ else
+ sprintf(str, "Authorization: Basic %s\r\n", coded_data);
+ dprintf(stderr, "> %s", str);
+ send(url->fd, str, strlen(str), 0);
+ }
+
+ sprintf(str, "\r\n"); /* end of headers to send */
+ dprintf(stderr, "> %s", str);
+ send(url->fd, str, strlen(str), 0);
if( (meta_int = parse_response(url, &id3, &tmp)) < 0)
return -1;
@@ -1756,6 +1777,7 @@
/**************************** utility functions ******************************/
void parseURL_url(URL& url) {
+ char buffer[2048];
/* now lets see what we have ... */
@@ -1767,6 +1789,7 @@
strcpy(url.file, url.url);
url.host[0] = 0;
url.port = 0;
+ url.logindata[0] = 0;
}
else
{
@@ -1800,6 +1823,17 @@
ptr = strchr(url.host, '/');
if(ptr) *ptr = 0;
+ if ((ptr = strchr(url.host, '@')))
+ {
+ *ptr = 0;
+ strcpy(url.logindata, url.host);
+ strcpy(buffer, ptr + 1);
+ strcpy(url.host, buffer);
+ }
+ else
+ url.logindata[0] = 0;
+
+
ptr = strrchr(url.host, ':');
if(ptr)
Index: netfile.h
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/netfile.h,v
retrieving revision 1.9
diff -u -r1.9 netfile.h
--- netfile.h 16 May 2005 00:15:18 -0000 1.9
+++ netfile.h 12 Apr 2007 20:59:53 -0000
@@ -102,6 +102,7 @@
char entity[2048]; /* data to send on POST requests */
int fd; /* filedescriptor of the file*/
FILE *stream; /* streamdescriptor */
+ char logindata[2048];/* login data (username:password) */
} URL;
typedef struct
und dass noch (upnp/xml wieder rausnehmen)
Code: Alles auswählen
Index: Makefile.am
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/src/Makefile.am,v
retrieving revision 1.33
diff -u -r1.33 Makefile.am
--- Makefile.am 5 Mar 2007 07:03:39 -0000 1.33
+++ Makefile.am 12 Apr 2007 20:55:29 -0000
@@ -10,6 +10,7 @@
@CONFIGFILE_CFLAGS@ \
@NET_CFLAGS@ \
@ZAPIT_CFLAGS@ \
+ @UPNPCLIENT_CFLAGS@ \
@TUXTXT_CFLAGS@
bin_PROGRAMS = neutrino
@@ -49,6 +50,9 @@
@MPEGTOOLS_LIBS@ \
@VORBISIDEC_LIBS@ \
@TUXTXT_LIBS@ \
+ @XMLTREE_LIBS@ \
+ @UPNPCLIENT_LIBS@ \
+ -lresolv \
-ljpeg \
-lpthread \
@XML_LIBS@