12: def handle(ctx, params)
13: response = params[:response]
14: response_body = params[:response_body]
15: uri = params[:uri]
16:
17: content_type = nil
18: unless response['Content-Type'].nil?
19: data = response['Content-Type'].match(/^([^;]*)/)
20: content_type = data[1].downcase.split(',')[0] unless data.nil?
21: end
22:
23:
24: params[:page] = @pluggable_parser.parser(content_type).new(
25: uri,
26: response,
27: response_body,
28: response.code
29: ) { |parser|
30: parser.mech = params[:agent] if parser.respond_to? :mech=
31: if parser.respond_to?(:watch_for_set=) && @watch_for_set
32: parser.watch_for_set = @watch_for_set
33: end
34: }
35: super
36: end