diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index c45e292..081504f 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -98,11 +98,15 @@ function nntp2_open($nserver=0,$nport=0) { } else { if(isset($CONFIG['socks_host']) && $CONFIG['socks_host'] !== '') { $ns=fsocks4asockopen($CONFIG['socks_host'], $CONFIG['socks_port'], $nserver, $nport); + } elseif(isset($CONFIG['http_host']) && $CONFIG['http_host'] !== '') { + $ns=fhttpsockopen($CONFIG['http_host'], $CONFIG['http_port'], $nserver, $nport); } else { $ns=@fsockopen('tcp://'.$nserver.":".$nport); } } -// $ns=@fsockopen($nserver,$nport); + if(isset($CONFIG['http_host']) && $CONFIG['http_host'] !== '') { + fputs($ns, "MODE reader\r\n"); + } $weg=line_read($ns); // kill the first line if (substr($weg,0,2) != "20") { echo "

".$text_error["error:"].$weg."

"; @@ -147,11 +151,27 @@ function fsocks4asockopen($proxyHostname, $proxyPort, $targetHostname, $targetPo if($values["ret"] == 0x5a) return $sock; else { - fclose(sock); + fclose($sock); return false; } } +function fhttpsockopen($proxyHostname, $proxyPort, $targetHostname, $targetPort) +{ + $sock = fsockopen($proxyHostname, $proxyPort); + if($sock === false) + return false; + fwrite($sock, 'CONNECT '.$targetHostname.':'.$targetPort.' HTTP/1.0'); + fwrite($sock, "\r\n"); + fwrite($sock, "\r\n"); + $weg=line_read($sock); + while (substr($weg,0,2) != "20") { + echo $weg."\r\n"; + $weg=line_read($sock); + } + return $sock; +} + /* * Close a NNTP connection * diff --git a/Rocksolid_Light/rslight/rslight.inc.php b/Rocksolid_Light/rslight/rslight.inc.php index 998af8c..2a8ba71 100644 --- a/Rocksolid_Light/rslight/rslight.inc.php +++ b/Rocksolid_Light/rslight/rslight.inc.php @@ -5,6 +5,8 @@ return [ 'remote_ssl' => '', 'socks_host' => '', 'socks_port' => '', + 'http_host' => '', + 'http_port' => '', 'remote_auth_user' => 'username', 'remote_auth_pass' => 'password', 'enable_nntp' => '1', diff --git a/Rocksolid_Light/rslight/scripts/setuphelper.php b/Rocksolid_Light/rslight/scripts/setuphelper.php index c5001b9..c0a09a2 100644 --- a/Rocksolid_Light/rslight/scripts/setuphelper.php +++ b/Rocksolid_Light/rslight/scripts/setuphelper.php @@ -13,6 +13,8 @@ return [ 'remote_auth_pass' => 'Password to authenticate to remote server', 'socks_host' => 'ip address of your socks4a server (use this for tor)', 'socks_port' => 'port for your socks4a server', +'http_host' => 'ip address of your http proxy server (use this for i2p or create client tunnel)', +'http_port' => 'port for your http proxy server', # LOCAL server configuration 'enable_nntp' => 'Enable local nntp server (1=true, blank=false)', diff --git a/Rocksolid_Light/rslight/scripts/spoolnews.php b/Rocksolid_Light/rslight/scripts/spoolnews.php index 8261521..587563e 100755 --- a/Rocksolid_Light/rslight/scripts/spoolnews.php +++ b/Rocksolid_Light/rslight/scripts/spoolnews.php @@ -138,7 +138,6 @@ function get_articles($ns, $group) { $banned_names = file("/etc/rslight/banned_names.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $nocem_check="@@NCM"; - # Check if group exists. Open it if it does fputs($ns, "group ".$group."\r\n"); $response = line_read($ns); @@ -223,6 +222,10 @@ function get_articles($ns, $group) { if (strcmp(substr($response,0,3),"220") != 0) { echo "\n".$response."\n"; file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Unexpected response to ARTICLE command: ".$response, FILE_APPEND); + if(trim($response) == '') { + fclose($ns); + break; + } $article++; continue; }