Module: Groat::SMTPD::Extensions::Chunking

Defined in:
lib/groat/smtpd/extensions/chunking.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



25
26
27
28
29
# File 'lib/groat/smtpd/extensions/chunking.rb', line 25

def self.included mod
  puts "Included RFC 3030: CHUNKING"
  mod.ehlo_keyword :chunking
  mod.verb :bdat, :smtp_verb_bdat
end

Instance Method Details

#smtp_verb_bdat(args) ⇒ Object

BDAT is unusual in that the sender just shoves data at us We need to grab that data before we response so as not to try to parse it as commands



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/groat/smtpd/extensions/chunking.rb', line 34

def smtp_verb_bdat(args)
  arglist = args.split(' ')
  # No size means nothing to do
  if arglist.count < 1
    response_syntax_error :message => "Chunk size must be specified"
  end
  # The chunk size must be numeric
  if arglist[0] !~ /\A[0-9]+\Z/
    response_syntax_error :message => "Bad chunk size"
  end
  # Basic sanity passed, we must grab the data
  data = getdata(arglist[0].to_i)
  return response_no_valid_rcpt if @rcptto.count < 1
  if arglist.count > 2
    response_syntax_error
  elsif arglist.count == 2 and arglist[1].upcase != "LAST"
    response_syntax_error :message => "Bad end marker"
  end
  response_ok
end