some fixes
This commit is contained in:
parent
8c20f8435f
commit
cb321d68ed
3 changed files with 35 additions and 31 deletions
|
|
@ -90,7 +90,8 @@ def _uudecode_file(file, outfile)
|
|||
next if line =~ /[a-z]/
|
||||
next if line == nil
|
||||
next unless ((((line[0].ord - 32) & 077) + 2) / 3).to_i == (line.length/4).to_i
|
||||
line.unpack("u").each{|x| outfile.print x}
|
||||
#line.unpack("u").each{|x| outfile.print x}
|
||||
line.unpack("u").each{|x| outfile.write x}
|
||||
end
|
||||
|
||||
puts "No \"end\" found!!!"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
# $Dwarf: article.rb,v 1.114 2005/05/12 07:39:53 ward Exp $
|
||||
# $Source$
|
||||
|
||||
#
|
||||
# Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Ward Wouts <ward@wouts.nl>
|
||||
#
|
||||
|
|
@ -23,7 +20,7 @@ require Pathname.new(__FILE__).dirname + '../news/newsrc'
|
|||
require 'tempfile'
|
||||
require 'timeout'
|
||||
#require 'yaml'
|
||||
require 'profiler'
|
||||
#require 'profiler' # removed from ruby?
|
||||
|
||||
class ArticleError < RuntimeError; end
|
||||
class TempError < ArticleError; end
|
||||
|
|
@ -152,7 +149,7 @@ def initialize(nntpservers, groupname, newsrc="~/.newsrc", maxage=0)
|
|||
# p server
|
||||
# p Time.now
|
||||
begin
|
||||
timeout(60) do
|
||||
Timeout.timeout(60) do
|
||||
#p "connecting"
|
||||
@connections[server]["nntp"] = Net::KANNTP.new(server, 119, @serverpasses[server]['user'], @serverpasses[server]['pass'])
|
||||
end
|
||||
|
|
@ -180,7 +177,7 @@ def reconnect(server)
|
|||
retries = 0
|
||||
begin
|
||||
puts "Trying to kill old connection #{Time.now}"
|
||||
timeout(10) do
|
||||
Timeout.timeout(10) do
|
||||
@connections[server]["nntp"].quit
|
||||
end
|
||||
puts "Killed old connection #{Time.now}"
|
||||
|
|
@ -192,7 +189,7 @@ def reconnect(server)
|
|||
puts "Trying to reconnect #{Time.now}"
|
||||
sleep 3
|
||||
#timeout(180) do
|
||||
timeout(60) do
|
||||
Timeout.timeout(60) do
|
||||
@connections[server]["nntp"] = Net::KANNTP.new(server, 119, @serverpasses[server]['user'], @serverpasses[server]['pass'])
|
||||
end
|
||||
resp = @connections[server]["nntp"].mode_reader
|
||||
|
|
@ -391,7 +388,7 @@ def get_group_info(server)
|
|||
first = ""
|
||||
last = ""
|
||||
begin
|
||||
timeout(30) do
|
||||
Timeout.timeout(30) do
|
||||
begin
|
||||
resp, count, first, last, name = @connections[server]["nntp"].group(@group)
|
||||
rescue Net::NNTPReplyError
|
||||
|
|
@ -425,7 +422,7 @@ def get_xhdr(server, range, header)
|
|||
resp = ""
|
||||
lines = []
|
||||
begin
|
||||
timeout(180) do
|
||||
Timeout.timeout(180) do
|
||||
begin
|
||||
p Time.now if Debuglevel > 1
|
||||
puts "getting headers: #{header}, #{range}" if Debuglevel > 1
|
||||
|
|
@ -481,7 +478,7 @@ def get_xover(server, range)
|
|||
ed = start
|
||||
end
|
||||
begin
|
||||
timeout(180) do
|
||||
Timeout.timeout(180) do
|
||||
begin
|
||||
p Time.now if Debuglevel > 1
|
||||
puts "getting headers: #{range}" if Debuglevel > 1
|
||||
|
|
@ -539,7 +536,7 @@ def get_body(server, message)
|
|||
messid = ""
|
||||
list = []
|
||||
begin
|
||||
timeout(180) do
|
||||
Timeout.timeout(180) do
|
||||
begin
|
||||
list = []
|
||||
resp, id, messid, list = @connections[server]["nntp"].body(message)
|
||||
|
|
|
|||
|
|
@ -547,11 +547,17 @@ def get_multi(subj, group)
|
|||
# puts "inside thread post pass\n"
|
||||
if UUEncode.is_uuencoded(tbody)
|
||||
puts " UUDecoding..."
|
||||
begin
|
||||
if tfile
|
||||
tmode, tfilename, tbody = UUEncode.uudecode(tfile, tfileout)
|
||||
else
|
||||
tmode, tfilename, tbody = UUEncode.uudecode(tbody)
|
||||
end
|
||||
rescue Encoding::UndefinedConversionError
|
||||
puts "#{$!}"
|
||||
puts " Skipping article..."
|
||||
Thread.current.exit
|
||||
end
|
||||
elsif YEnc.is_yencoded(tbody)
|
||||
puts " YDecoding..."
|
||||
begin
|
||||
|
|
@ -683,7 +689,7 @@ def get_max_file_length(tempdir=".")
|
|||
name = "a"*500
|
||||
name = "#$$#{name}"
|
||||
begin
|
||||
file = File.new("#{tempdir}/#{name}", "w", 0644).close
|
||||
File.new("#{tempdir}/#{name}", "w", 0644).close
|
||||
FileUtils.rm("#{tempdir}/#{name}")
|
||||
rescue Errno::ENAMETOOLONG
|
||||
name = name[0...-1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue