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