Skip to content

Commit

Permalink
fix for centos ncat and debian default netcat (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
neil authored Oct 19, 2016
1 parent caa2e45 commit c9febbd
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions acme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1231,14 +1231,29 @@ _startserver() {

_debug "_NC" "$_NC"

#for centos ncat
if _contains "$nchelp" "nmap.org" ; then
_debug "Using ncat: nmap.org"
if [ "$DEBUG" ] ; then
if printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC $Le_HTTPPort ; then
return
fi
else
if printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC $Le_HTTPPort > /dev/null 2>&1; then
return
fi
fi
_err "ncat listen error."
fi

# while true ; do
if [ "$DEBUG" ] ; then
if ! printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC $Le_HTTPPort ; then
printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC -p $Le_HTTPPort ;
if ! printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC -p $Le_HTTPPort ; then
printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC $Le_HTTPPort ;
fi
else
if ! printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC $Le_HTTPPort > /dev/null 2>&1; then
printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC -p $Le_HTTPPort > /dev/null 2>&1
if ! printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC -p $Le_HTTPPort > /dev/null 2>&1; then
printf "HTTP/1.1 200 OK\r\n\r\n$content" | $_NC $Le_HTTPPort > /dev/null 2>&1
fi
fi
if [ "$?" != "0" ] ; then
Expand Down

0 comments on commit c9febbd

Please sign in to comment.