rfeedparser 0.9.93 → 0.9.931

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/rfeedparser.rb +9 -26
  2. metadata +1 -1
@@ -56,7 +56,7 @@ include FeedParserUtilities
56
56
 
57
57
 
58
58
  module FeedParser
59
- Version = "0.9.93"
59
+ Version = "0.9.931"
60
60
 
61
61
  License = """Copyright (c) 2002-2006, Mark Pilgrim, All rights reserved.
62
62
 
@@ -151,7 +151,7 @@ module FeedParser
151
151
  result['feed'] = FeedParserDict.new
152
152
  result['entries'] = []
153
153
  if options[:modified]
154
- options[:modified] = Time.parse(options[:modified]).rfc2822
154
+ options[:modified] = Time.parse(options[:modified]).utc.rfc2822
155
155
  # FIXME this ignores all of our time parsing work. Does it matter?
156
156
  end
157
157
  result['bozo'] = false
@@ -188,31 +188,13 @@ module FeedParser
188
188
  data = ''
189
189
  f = nil
190
190
  end
191
- begin
192
- if f.meta
193
- result['etag'] = options[:etag] || f.meta['etag']
194
- result['modified'] = options[:modified] || f.last_modified
191
+ if f.respond_to?(:meta)
192
+ result['etag'] = f.meta['etag']
193
+ result['modified'] = f.meta['modified']
195
194
  result['url'] = f.base_uri.to_s
196
195
  result['status'] = f.status[0] || 200
197
196
  result['headers'] = f.meta
198
- result['headers']['content-location'] ||= options[:content_location] unless options[:content_location].nil?
199
- result['headers']['content-language'] ||= options[:content_language] unless options[:content_language].nil?
200
- result['headers']['content-type'] ||= options[:content_type] unless options[:content_type].nil?
201
- end
202
- rescue NoMethodError
203
- result['headers'] = {}
204
- result['etag'] = result['headers']['etag'] = options[:etag] unless options[:etag].nil?
205
- result['modified'] = result['headers']['last-modified'] = options[:modified] unless options[:modified].nil?
206
- unless options[:content_location].nil?
207
- result['headers']['content-location'] = options[:content_location]
208
- end
209
- unless options[:content_language].nil?
210
- result['headers']['content-language'] = options[:content_language]
211
197
  end
212
- unless options[:content_type].nil?
213
- result['headers']['content-type'] = options[:content_type]
214
- end
215
- end
216
198
 
217
199
 
218
200
  # there are four encodings to keep track of:
@@ -220,12 +202,12 @@ module FeedParser
220
202
  # - xml_encoding is the encoding declared in the <?xml declaration
221
203
  # - sniffed_encoding is the encoding sniffed from the first 4 bytes of the XML data
222
204
  # - result['encoding'] is the actual encoding, as per RFC 3023 and a variety of other conflicting specifications
223
- http_headers = result['headers']
205
+ http_headers = result['headers'] || {}
224
206
  result['encoding'], http_encoding, xml_encoding, sniffed_xml_encoding, acceptable_content_type =
225
207
  self.getCharacterEncoding(f,data)
226
208
 
227
- if not http_headers.empty? and not acceptable_content_type
228
- if http_headers.has_key?('content-type')
209
+ if not http_headers.blank? and not acceptable_content_type
210
+ unless http_headers['content-type'].nil?
229
211
  bozo_message = "#{http_headers['content-type']} is not an XML media type"
230
212
  else
231
213
  bozo_message = 'no Content-type specified'
@@ -234,6 +216,7 @@ module FeedParser
234
216
  result['bozo_exception'] = NonXMLContentType.new(bozo_message) # I get to care about this, cuz Mark says I should.
235
217
  end
236
218
  result['version'], data = self.stripDoctype(data)
219
+
237
220
  baseuri = http_headers['content-location'] || result['href']
238
221
  baselang = http_headers['content-language']
239
222
 
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: rfeedparser
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.93
6
+ version: 0.9.931
7
7
  date: 2007-07-21 00:00:00 -07:00
8
8
  summary: Parse RSS and Atom feeds in Ruby
9
9
  require_paths: