From e53bd9ae65256e67b9532b978440cd5f74c91d4a Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 9 Oct 2005 03:00:11 +0000 Subject: [PATCH] Patch for http-access2, maybe workaround for a problem that is actually in MediaWiki --- http-access2.rb.diff | 24 ++++++++++++++++++++++++ stadtwiki-upcoming | 7 ++++--- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 http-access2.rb.diff diff --git a/http-access2.rb.diff b/http-access2.rb.diff new file mode 100644 index 0000000..fae2c25 --- /dev/null +++ b/http-access2.rb.diff @@ -0,0 +1,24 @@ +--- http-access2.rb.orig 2005-10-05 21:55:04.000000000 +0200 ++++ http-access2.rb 2005-10-05 22:49:05.000000000 +0200 +@@ -1464,6 +1464,14 @@ + timeout(@receive_timeout) do + begin + initial_line = socket.gets("\n") ++ if initial_line == "0\r\n" ++ # Regetting initial_line ++ initial_line = socket.gets("\n") ++ if initial_line == "\r\n" ++ # Regetting initial_line, again ++ initial_line = socket.gets("\n") ++ end ++ end + if initial_line.nil? + raise KeepAliveDisconnected.new + end +@@ -1586,3 +1594,5 @@ + + + HTTPClient = HTTPAccess2::Client ++ ++# vim:tabstop=8 + diff --git a/stadtwiki-upcoming b/stadtwiki-upcoming index ccbdb85..72d052a 100755 --- a/stadtwiki-upcoming +++ b/stadtwiki-upcoming @@ -10,11 +10,12 @@ if ARGV.size() != 2 exit(1) end -$ical_url = "http://upcoming.org/calendar/metro/1551" +$ical_url = "webcal://upcoming.org/calendar/metro/1551" +$web_url = "http://upcoming.org/metro/de/bawue/ka/" def get_events() @client = HTTPAccess2::Client.new() - ical = @client.get_content($ical_url) + ical = @client.get_content($ical_url.gsub(/^webcal:/, "http:")) events = [] Icalendar.decode(ical).each do |publish| publish.events.each do |event| @@ -24,7 +25,7 @@ def get_events() return events end -body = "Folgende Termine stammen von #{$ical_url}:\n\n" +body = "Folgende Termine stammen von #{$web_url} ([#{$ical_url} iCal]):\n\n" get_events().each do |event| body += "* #{event.dtstart.mday}.#{event.dtstart.month}. #{event.summary}\n" end