[xiph-cvs] cvs commit: libshout/src shout.c shout_private.h
Brendan
brendan at xiph.org
Tue Jan 14 23:31:29 PST 2003
brendan 03/01/15 02:31:29
Modified: src shout.c shout_private.h
Log:
Have libshout set the user to "source" by default.
More indentation fixes, sorry Mike.
Revision Changes Path
1.15 +29 -23 libshout/src/shout.c
Index: shout.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/shout.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- shout.c 13 Jan 2003 04:32:29 -0000 1.14
+++ shout.c 15 Jan 2003 07:31:29 -0000 1.15
@@ -31,8 +31,14 @@
return NULL;
}
- if (!(self->host = util_strdup(LIBSHOUT_DEFAULT_HOST))) {
- free(self);
+ if (shout_set_host(self, LIBSHOUT_DEFAULT_HOST) != SHOUTERR_SUCCESS) {
+ shout_free(self);
+
+ return NULL;
+ }
+ if (shout_set_user(self, LIBSHOUT_DEFAULT_USER) != SHOUTERR_SUCCESS) {
+ shout_free(self);
+
return NULL;
}
@@ -658,7 +664,7 @@
static int send_http_request(shout_t *self, char *username, char *password)
{
- if (!sock_write(self->socket, "SOURCE %s HTTP/1.0\r\n", self->mount))
+ if (!sock_write(self->socket, "SOURCE %s HTTP/1.0\r\n", self->mount))
return SHOUTERR_SOCKET;
if (!sock_write(self->socket, "ice-name: %s\r\n", self->name != NULL ? self->name : "no name"))
@@ -679,10 +685,10 @@
if (!sock_write(self->socket, "ice-description: %s\r\n", self->description))
return SHOUTERR_SOCKET;
}
- if (self->useragent) {
- if (!sock_write(self->socket, "User-Agent: %s\r\n", self->useragent))
- return SHOUTERR_SOCKET;
- }
+ if (self->useragent) {
+ if (!sock_write(self->socket, "User-Agent: %s\r\n", self->useragent))
+ return SHOUTERR_SOCKET;
+ }
if (self->format == SHOUT_FORMAT_VORBIS) {
if (!sock_write(self->socket, "Content-Type: application/x-ogg\r\n"))
return SHOUTERR_SOCKET;
@@ -690,22 +696,22 @@
if (!sock_write(self->socket, "Content-Type: audio/mpeg\r\n"))
return SHOUTERR_SOCKET;
}
- if (username && password) {
- char *data;
- int len = strlen(username) + strlen(password) + 2;
- char *orig = malloc(len);
- strcpy(orig, username);
- strcat(orig, ":");
- strcat(orig, password);
-
- data = util_base64_encode(orig);
-
- if(!sock_write(self->socket, "Authorization: Basic %s\r\n", data)) {
- free(data);
- return SHOUTERR_SOCKET;
- }
- free(data);
- }
+ if (username && password) {
+ char *data;
+ int len = strlen(username) + strlen(password) + 2;
+ char *orig = malloc(len);
+ strcpy(orig, username);
+ strcat(orig, ":");
+ strcat(orig, password);
+
+ data = util_base64_encode(orig);
+
+ if(!sock_write(self->socket, "Authorization: Basic %s\r\n", data)) {
+ free(data);
+ return SHOUTERR_SOCKET;
+ }
+ free(data);
+ }
if (!sock_write(self->socket, "\r\n"))
return SHOUTERR_SOCKET;
<p><p>1.5 +1 -0 libshout/src/shout_private.h
Index: shout_private.h
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/shout_private.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- shout_private.h 7 Jan 2003 03:23:57 -0000 1.4
+++ shout_private.h 15 Jan 2003 07:31:29 -0000 1.5
@@ -35,6 +35,7 @@
#define LIBSHOUT_DEFAULT_PORT 8000
#define LIBSHOUT_DEFAULT_FORMAT SHOUT_FORMAT_VORBIS
#define LIBSHOUT_DEFAULT_PROTOCOL SHOUT_PROTOCOL_ICE
+#define LIBSHOUT_DEFAULT_USER "source"
struct shout {
/* hostname or IP of icecast server */
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list