summaryrefslogtreecommitdiffstats
path: root/stream/network.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/network.c')
-rw-r--r--stream/network.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/stream/network.c b/stream/network.c
index 801bebaf24..15a0a9ba84 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -98,7 +98,7 @@ streaming_ctrl_new(void) {
streaming_ctrl_t *streaming_ctrl;
streaming_ctrl = malloc(sizeof(streaming_ctrl_t));
if( streaming_ctrl==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return NULL;
}
memset( streaming_ctrl, 0, sizeof(streaming_ctrl_t) );
@@ -135,15 +135,15 @@ check4proxies( URL_t *url ) {
URL_t *proxy_url = url_new( proxy );
if( proxy_url==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_WARN,
- MSGTR_MPDEMUX_NW_InvalidProxySettingTryingWithout);
+ mp_tmsg(MSGT_NETWORK,MSGL_WARN,
+ "Invalid proxy setting... Trying without proxy.\n");
return url_out;
}
#ifdef HAVE_AF_INET6
if (network_ipv4_only_proxy && (gethostbyname(url->hostname)==NULL)) {
- mp_msg(MSGT_NETWORK,MSGL_WARN,
- MSGTR_MPDEMUX_NW_CantResolvTryingWithoutProxy);
+ mp_tmsg(MSGT_NETWORK,MSGL_WARN,
+ "Could not resolve remote hostname for AF_INET. Trying without proxy.\n");
url_free(proxy_url);
return url_out;
}
@@ -153,7 +153,7 @@ check4proxies( URL_t *url ) {
len = strlen( proxy_url->hostname ) + strlen( url->url ) + 20; // 20 = http_proxy:// + port
new_url = malloc( len+1 );
if( new_url==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
url_free(proxy_url);
return url_out;
}
@@ -238,7 +238,7 @@ http_send_request( URL_t *url, off_t pos ) {
ret = send( fd, http_hdr->buffer, http_hdr->buffer_size, 0 );
if( ret!=(int)http_hdr->buffer_size ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ErrSendingHTTPRequest);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Error while sending HTTP request: Didn't send all the request.\n");
goto err_out;
}
@@ -267,12 +267,12 @@ http_read_response( int fd ) {
do {
i = recv( fd, response, BUFFER_SIZE, 0 );
if( i<0 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Read failed.\n");
http_free( http_hdr );
return NULL;
}
if( i==0 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_Read0CouldBeEOF);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"http_read_response read 0 (i.e. EOF).\n");
http_free( http_hdr );
return NULL;
}
@@ -286,8 +286,14 @@ int
http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry) {
char *aut;
+#define MPDEMUX_NW_AuthFailed _(\
+"Authentication failed. Please use the -user and -passwd options to provide your\n"\
+"username/password for a list of URLs, or form an URL like:\n"\
+"http://username:password@hostname/file\n")
+
+
if( *auth_retry==1 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_AuthFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,MPDEMUX_NW_AuthFailed);
return -1;
}
if( *auth_retry>0 ) {
@@ -306,28 +312,28 @@ http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry) {
char *aut_space;
aut_space = strstr(aut, "realm=");
if( aut_space!=NULL ) aut_space += 6;
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_AuthRequiredFor, aut_space);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Authentication required for %s\n", aut_space);
} else {
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_AuthRequired);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Authentication required.\n");
}
if( network_username ) {
url->username = strdup(network_username);
if( url->username==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return -1;
}
} else {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_AuthFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,MPDEMUX_NW_AuthFailed);
return -1;
}
if( network_password ) {
url->password = strdup(network_password);
if( url->password==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return -1;
}
} else {
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_NoPasswdProvidedTryingBlank);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"No password provided, trying blank password.\n");
}
(*auth_retry)++;
return 0;
@@ -360,7 +366,7 @@ http_seek( stream_t *stream, off_t pos ) {
}
break;
default:
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ErrServerReturned, http_hdr->status_code, http_hdr->reason_phrase );
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Server returns %d: %s\n", http_hdr->status_code, http_hdr->reason_phrase );
close( fd );
fd = -1;
}
@@ -382,7 +388,7 @@ streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size) {
//printf("streaming_bufferize\n");
streaming_ctrl->buffer = malloc(size);
if( streaming_ctrl->buffer==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return -1;
}
memcpy( streaming_ctrl->buffer, buffer, size );
@@ -442,7 +448,7 @@ void fixup_network_stream_cache(stream_t *stream) {
stream_cache_size = (stream->streaming_ctrl->prebuffer_size/1024)*5;
if( stream_cache_size<64 ) stream_cache_size = 64; // 16KBytes min buffer
}
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_CacheSizeSetTo, stream_cache_size);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Cache size set to %d KBytes\n", stream_cache_size);
}
}