[lastbash-cvs] SF.net SVN: lastbash: [240] lastbash
Status: Beta
Brought to you by:
cstroie
From: <cs...@us...> - 2008-01-14 13:19:42
|
Revision: 240 http://lastbash.svn.sourceforge.net/lastbash/?rev=240&view=rev Author: cstroie Date: 2008-01-14 05:19:23 -0800 (Mon, 14 Jan 2008) Log Message: ----------- Added support for 'nc' as http client. Modified Paths: -------------- lastbash/VERSION lastbash/lastbash lastbash/lastbash.config.in Modified: lastbash/VERSION =================================================================== --- lastbash/VERSION 2007-11-26 09:15:30 UTC (rev 239) +++ lastbash/VERSION 2008-01-14 13:19:23 UTC (rev 240) @@ -1 +1 @@ -0.3.2 +0.3.3 Modified: lastbash/lastbash =================================================================== --- lastbash/lastbash 2007-11-26 09:15:30 UTC (rev 239) +++ lastbash/lastbash 2008-01-14 13:19:23 UTC (rev 240) @@ -67,7 +67,7 @@ # Internal stuff PLAYERS="mplayer" -HTTP_CLIENTS="wget curl" +HTTP_CLIENTS="wget curl nc" REQ_PROGRAMS="rm date tput stty md5sum dd chmod" HTML_TEMPLATE="${HOME_DIR}/lastbash_template.html" PLAYER_PID="" @@ -520,6 +520,7 @@ case "${HTTP_CLIENT}" in "wget") HTTP_CLIENT_FUNCTION="http_get_wget" ;; "curl") HTTP_CLIENT_FUNCTION="http_get_curl" ;; + "nc") HTTP_CLIENT_FUNCTION="http_get_nc" ;; *) HTTP_CLIENT_FUNCTION="http_get_builtin" ;; esac @@ -660,6 +661,32 @@ return "${RET}" } +# Function: HTTP GET method: nc implementation {{{1 +#----------------------------------------------------------------------------- +function http_get_nc() +{ + # $1 - output file + # $2 - host + # $3 - port + # $4 - path + + local REQUEST RET="0" + + # Construct the request + REQUEST="GET $4 HTTP/1.0\r\nHost: $2:$3\r\nUser-Agent: ${PROG_TITLE}/${PROG_VER}\r\nConnection: Close\r\n\r\n" + + # Send the request + if echo -ne "${REQUEST}" | nc -w "5" "$2" "$3" > "$1" + then + RET="0" + else + RET="1" + fi + + # Return the status code + return "${RET}" +} + # Function: HTTP GET method: builtin implementation {{{1 #----------------------------------------------------------------------------- function http_get_builtin() Modified: lastbash/lastbash.config.in =================================================================== --- lastbash/lastbash.config.in 2007-11-26 09:15:30 UTC (rev 239) +++ lastbash/lastbash.config.in 2008-01-14 13:19:23 UTC (rev 240) @@ -22,7 +22,7 @@ # Automatically start playing. Possible values: 'y' or 'n' AUTO_PLAY="y" -# HTTP client to use. Possible values: 'wget', 'curl', 'builtin', 'auto' +# HTTP client to use. Possible values: 'wget', 'curl', 'nc', 'builtin', 'auto' HTTP_CLIENT="auto" # Save the metadata (artist-track) of the current playing track to a file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |