distribustream 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,15 @@
1
+ Version 0.4.0
2
+ * Change PDTP::Client#run to take an instance of PDTP::Client::Callbacks rather
3
+ than the name of the class to instantiate
4
+
5
+ * Register PDTP::Server's Mongrel StatusHandler before the file service handler
6
+ in order to prevent a potential conflict when displaying the status page.
7
+
8
+ * Client / File Service HttpHandlers now check for knowledge of requested
9
+ URIs and return 404 if an unknown resource is requested
10
+
11
+ * Client / File Service now properly handle interal exceptions
12
+
1
13
  Version 0.3.0
2
14
  * dsseed now factored into server.rb. Remote seeds will not be supported until
3
15
  protocol changes can be made to support authenticating remote seeds, remote
@@ -2,8 +2,8 @@ require 'rubygems'
2
2
 
3
3
  GEMSPEC = Gem::Specification.new do |s|
4
4
  s.name = "distribustream"
5
- s.version = "0.3.1"
6
- s.date = "2008-11-09"
5
+ s.version = "0.4.0"
6
+ s.date = "2008-11-15"
7
7
  s.summary = "DistribuStream is a fully open peercasting system allowing on-demand or live streaming media to be delivered at a fraction of the normal cost"
8
8
  s.email = "tony@clickcaster.com"
9
9
  s.homepage = "http://distribustream.org"
@@ -66,13 +66,12 @@ module PDTP
66
66
  )
67
67
 
68
68
  @client.transfers << transfer
69
- transfer.handle_header
69
+ return unless transfer.handle_header
70
+ transfer.send_completed_message transfer.hash
70
71
  rescue Exception => e
71
72
  raise e if transfer.nil?
72
73
  transfer.write_http_exception(e)
73
74
  end
74
-
75
- transfer.send_completed_message transfer.hash
76
75
  end
77
76
 
78
77
  # Returns true if the given message refers to the given transfer
@@ -54,11 +54,8 @@ module PDTP
54
54
 
55
55
  # Takes an HTTP range and returns a ruby Range object
56
56
  def parse_http_range(string)
57
- begin
58
- raise "Can't parse range string: #{string}" unless string =~ /bytes=([0-9]+)-([0-9]+)/
59
- (($1).to_i)..(($2).to_i)
60
- rescue nil
61
- end
57
+ raise RuntimeError, "Can't parse range string: #{string}" unless string =~ /bytes=([0-9]+)-([0-9]+)/
58
+ (($1).to_i)..(($2).to_i)
62
59
  end
63
60
 
64
61
  # Notify the server of transfer completion.
@@ -120,8 +117,10 @@ module PDTP
120
117
  path=@request.params["REQUEST_PATH"]
121
118
  vhost=@request.params["HTTP_HOST"]
122
119
  @url="http://"+vhost+path
120
+
121
+ # 404 unless we know about this URL
122
+ return unless @file_service.get_info(@url)
123
123
 
124
- return unless request.params["HTTP_RANGE"]
125
124
  @byte_range=parse_http_range(request.params["HTTP_RANGE"])
126
125
  @peer_id=@request.params["HTTP_X_PDTP_PEER_ID"]
127
126
 
@@ -132,6 +131,9 @@ module PDTP
132
131
 
133
132
  send_ask_verify_message
134
133
  @response.pending = true
134
+
135
+ # return true meaning the URL and header info were accepted
136
+ true
135
137
  end
136
138
 
137
139
  # Called after receiving verification message from the server
@@ -173,9 +175,7 @@ module PDTP
173
175
  else
174
176
  raise HTTPException.new(405,"Invalid method: #{@method}")
175
177
  end
176
-
177
178
  end
178
-
179
179
  end
180
180
 
181
181
  # Implements http transfer between two peers from the connector's (client) perspective
data/lib/pdtp/common.rb CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # Namespace for all PDTP components
24
24
  module PDTP
25
- PDTP::VERSION = '0.3.1' unless defined? PDTP::VERSION
25
+ PDTP::VERSION = '0.4.0' unless defined? PDTP::VERSION
26
26
  def self.version() VERSION end
27
27
 
28
28
  PDTP::DEFAULT_PORT = 6086 unless defined? PDTP::DEFAULT_PORT
@@ -290,8 +290,9 @@ module PDTP
290
290
  )
291
291
  when "completed"
292
292
  my_id = client_info(connection).client_id
293
- transfer_id= Transfer::gen_transfer_id(
294
- my_id,message["peer_id"],
293
+ transfer_id = Transfer::gen_transfer_id(
294
+ my_id,
295
+ message["peer_id"],
295
296
  message["url"],
296
297
  message["range"]
297
298
  )
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: distribustream
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.1
7
- date: 2008-11-09 00:00:00 -07:00
6
+ version: 0.4.0
7
+ date: 2008-11-15 00:00:00 -07:00
8
8
  summary: DistribuStream is a fully open peercasting system allowing on-demand or live streaming media to be delivered at a fraction of the normal cost
9
9
  require_paths:
10
10
  - lib