barx 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/proxri +6 -2
- data/lib/xri_resolver.rb +33 -10
- metadata +2 -2
data/examples/proxri
CHANGED
@@ -30,9 +30,13 @@ begin
|
|
30
30
|
end
|
31
31
|
else
|
32
32
|
unless ar.to_urilist.empty?
|
33
|
-
|
33
|
+
if URI.parse(ar.to_urilist.first).scheme
|
34
|
+
cgi.out("Location" => ar.to_urilist.first) { ar.to_urilist.first }
|
35
|
+
else
|
36
|
+
cgi.out("text/plain") { "an XRI error occurred: #{ar.to_urilist.join(' ')}" }
|
37
|
+
end
|
34
38
|
else
|
35
|
-
cgi.out("text/plain") { "
|
39
|
+
cgi.out("text/plain") { "an XRI error occurred" }
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
data/lib/xri_resolver.rb
CHANGED
@@ -183,7 +183,22 @@ module XriResolver
|
|
183
183
|
end
|
184
184
|
|
185
185
|
def to_urilist
|
186
|
-
|
186
|
+
if (code = get_xrd_status_code(self.last_xrd)) == '100'
|
187
|
+
urilist = SEPSelector.select(self, self.last_xrd, @req).to_urilist
|
188
|
+
if urilist.empty?
|
189
|
+
code = '241'
|
190
|
+
error = Array.new
|
191
|
+
error << code
|
192
|
+
error << ResponseStatus[code]
|
193
|
+
else
|
194
|
+
urilist
|
195
|
+
end
|
196
|
+
else
|
197
|
+
text = get_xrd_status_text(self.last_xrd)
|
198
|
+
error = Array.new
|
199
|
+
error << code
|
200
|
+
error << text unless text.empty?
|
201
|
+
end
|
187
202
|
end
|
188
203
|
|
189
204
|
private
|
@@ -208,7 +223,7 @@ module XriResolver
|
|
208
223
|
end
|
209
224
|
|
210
225
|
def get_xrd_status_text(xrd)
|
211
|
-
REXML::XPath.match(xrd, "*[local-name()='Status']", XRDNS).first.
|
226
|
+
REXML::XPath.match(xrd, "*[local-name()='Status']", XRDNS).first.text rescue ''
|
212
227
|
end
|
213
228
|
|
214
229
|
def get_xrd_query_string(xrd)
|
@@ -374,14 +389,16 @@ module XriResolver
|
|
374
389
|
end
|
375
390
|
else
|
376
391
|
REXML::XPath.match(xrd[0], "*[local-name()='Status']", XRDNS).each do |status|
|
377
|
-
status.add_attribute('
|
392
|
+
status.add_attribute('code', '262')
|
378
393
|
status.text = 'REF_CYCLE_DETECTED'
|
379
394
|
end
|
380
395
|
end
|
381
396
|
@stack.pop
|
382
397
|
else
|
383
398
|
REXML::XPath.match(xrd[0], "*[local-name()='Status']", XRDNS).each do |status|
|
384
|
-
|
399
|
+
code = '262'
|
400
|
+
status.add_attribute('code', code)
|
401
|
+
status.text = ResponseStatus[code]
|
385
402
|
end
|
386
403
|
end
|
387
404
|
end
|
@@ -505,7 +522,7 @@ module XriResolver
|
|
505
522
|
end
|
506
523
|
|
507
524
|
newxrdeles = xrd.elements.partition do |x|
|
508
|
-
after = xrd.elements['
|
525
|
+
after = xrd.elements['Query']
|
509
526
|
xrd.elements.index(x) <= xrd.elements.index(after)
|
510
527
|
end
|
511
528
|
|
@@ -606,7 +623,7 @@ module XriResolver
|
|
606
623
|
'202' => 'LIMIT_EXCEEDED',
|
607
624
|
'210' => 'INVALID_INPUT',
|
608
625
|
'211' => 'INVALID_QXRI',
|
609
|
-
'212' => '
|
626
|
+
'212' => 'INVALID_OUTPUT_FORMAT',
|
610
627
|
'213' => 'INVALID_SEP_TYPE',
|
611
628
|
'214' => 'INVALID_SEP_MEDIA_TYPE',
|
612
629
|
'215' => 'UNKNOWN_ROOT',
|
@@ -614,6 +631,7 @@ module XriResolver
|
|
614
631
|
'221' => 'AUTH_RES_NOT_FOUND',
|
615
632
|
'222' => 'QUERY_NOT_FOUND',
|
616
633
|
'223' => 'UNEXPECTED_XRD',
|
634
|
+
'224' => 'INACTIVE',
|
617
635
|
'230' => 'TRUSTED_RES_ERROR',
|
618
636
|
'231' => 'HTTPS_RES_NOT_FOUND',
|
619
637
|
'232' => 'SAML_RES_NOT_FOUND',
|
@@ -621,8 +639,13 @@ module XriResolver
|
|
621
639
|
'234' => 'UNVERIFIED_SIGNATURE',
|
622
640
|
'240' => 'SEP_SELECTION_ERROR',
|
623
641
|
'241' => 'SEP_NOT_FOUND',
|
624
|
-
'250' => '
|
625
|
-
'251' => '
|
642
|
+
'250' => 'REDIRECT_ERROR',
|
643
|
+
'251' => 'INVALID_REDIRECT',
|
644
|
+
'252' => 'INVALID_HTTPS_REDIRECT',
|
645
|
+
'253' => 'REDIRECT_VERIFY_FAILED',
|
646
|
+
'260' => 'REF_ERROR',
|
647
|
+
'261' => 'INVALID_REF',
|
648
|
+
'262' => 'REF_NOT_FOLLOWED',
|
626
649
|
'300' => 'TEMPORARY_FAIL',
|
627
650
|
'301' => 'TIMEOUT_ERROR',
|
628
651
|
'320' => 'NETWORK_ERROR',
|
@@ -936,7 +959,7 @@ module XriResolver
|
|
936
959
|
@nodefault_p = has_true_value?(param_inputs[:nodefault_p]) ? true : false
|
937
960
|
@nodefault_t = has_true_value?(param_inputs[:nodefault_t]) ? true : false
|
938
961
|
@nodefault_m = has_true_value?(param_inputs[:nodefault_m]) ? true : false
|
939
|
-
@refs = param_inputs[:refs]
|
962
|
+
@refs = has_false_value?(param_inputs[:refs]) ? 'false' : 'true'
|
940
963
|
@https = has_true_value?(param_inputs[:https]) ? true : false
|
941
964
|
@saml = has_true_value?(param_inputs[:saml]) ? true : false
|
942
965
|
else
|
@@ -947,7 +970,7 @@ module XriResolver
|
|
947
970
|
@nodefault_p = has_true_value?(header_inputs[:nodefault_p]) ? true : false
|
948
971
|
@nodefault_t = has_true_value?(header_inputs[:nodefault_t]) ? true : false
|
949
972
|
@nodefault_m = has_true_value?(header_inputs[:nodefault_m]) ? true : false
|
950
|
-
@refs = header_inputs[:refs]
|
973
|
+
@refs = has_false_value?(header_inputs[:refs]) ? 'false' : 'true'
|
951
974
|
@https = has_true_value?(header_inputs[:https]) ? true : false
|
952
975
|
@saml = has_true_value?(header_inputs[:saml]) ? true : false
|
953
976
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: barx
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-10-
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2007-10-20 00:00:00 +00:00
|
8
8
|
summary: Provides XRI resolution services. Read more about XRI resolution at http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xri.
|
9
9
|
require_paths:
|
10
10
|
- lib
|