# HG changeset patch # User bertrand # Date 1008362730 0 # Node ID fb9de639ed3035b045d827644da69f12b4cef8d8 # Parent a4721884eaf5071fdc0f5d769328902f61edd773 Applied the patch from Alban Bedel . He added some errors checking on network code. Added a check on the port number parsing in the url. diff -r a4721884eaf5 -r fb9de639ed30 libmpdemux/asf_streaming.c --- a/libmpdemux/asf_streaming.c Fri Dec 14 20:14:59 2001 +0000 +++ b/libmpdemux/asf_streaming.c Fri Dec 14 20:45:30 2001 +0000 @@ -2,6 +2,7 @@ #include #include #include +#include #include "config.h" @@ -468,13 +469,16 @@ //http_hdr = asf_http_request( url ); http_hdr = asf_http_request( stream->streaming_ctrl ); printf("Request [%s]\n", http_hdr->buffer ); - write( fd, http_hdr->buffer, http_hdr->buffer_size ); -printf("1\n"); + for(i=0; i < http_hdr->buffer_size ; ) { + int r = write( fd, http_hdr->buffer+i, http_hdr->buffer_size-i ); + if(r <0) { + printf("Socket write error : %s\n",strerror(errno)); + return -1; + } + i += r; + } // http_free( http_hdr ); -printf("2\n"); - http_hdr = http_new_header(); -printf("3\n"); do { i = read( fd, buffer, BUFFER_SIZE ); printf("read: %d\n", i ); diff -r a4721884eaf5 -r fb9de639ed30 libmpdemux/network.c --- a/libmpdemux/network.c Fri Dec 14 20:14:59 2001 +0000 +++ b/libmpdemux/network.c Fri Dec 14 20:45:30 2001 +0000 @@ -137,6 +137,17 @@ // Turn back the socket as blocking fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) & ~O_NONBLOCK ); + // Check if there were any error + err_len = sizeof(int); + ret = getsockopt(socket_server_fd,SOL_SOCKET,SO_ERROR,&err,&err_len); + if(ret < 0) { + printf("getsockopt failed : %s\n",strerror(errno)); + return -1; + } + if(err > 0) { + printf("Connect error : %s\n",strerror(err)); + return -1; + } return socket_server_fd; } @@ -356,8 +367,8 @@ if( len