Revision 29:ec9750e9cceb src/pithos/content/connection.js
b/src/pithos/content/connection.js | ||
---|---|---|
1 |
connection_obj = null; |
|
1 |
connection_obj = null;
|
|
2 | 2 |
|
3 | 3 |
function ConnectionObject() { |
4 | 4 |
// public properties |
... | ... | |
60 | 60 |
return d; |
61 | 61 |
} |
62 | 62 |
|
63 |
// accepts |
|
63 |
this.load_file_metadata = function(uri) { |
|
64 |
var fm_obj = null; |
|
65 |
|
|
66 |
if ( isRemoteDirectory(uri) ) { |
|
67 |
var req = this.rest_request_get(uri); |
|
68 |
|
|
69 |
} else if ( isLocalDirectory(uri) ) { |
|
70 |
fm_obj = loadLocalFile(uri); |
|
71 |
} |
|
72 |
|
|
73 |
return fm_obj; |
|
74 |
} |
|
75 |
|
|
64 | 76 |
this.create_request_get = function(rest_req) { |
65 | 77 |
if ( isRemoteDirectory(rest_req) ) { |
66 | 78 |
var gmtstring = (new Date()).toGMTString(); |
67 | 79 |
var sign_url = rest_req.replace(this.rest_url, ""); |
68 |
return rest_req + '?Date=' + gmtstring + '&Authorization=' + this.username + ' ' + sign(this.token, sign_url, gmtstring); |
|
80 |
var hash = sign(this.token, sign_url, gmtstring); |
|
81 |
|
|
82 |
return rest_req + ('?Date=' + encodeURIComponent(gmtstring) + '&Authorization=' + this.username + '%20' + encodeURIComponent(hash)); |
|
69 | 83 |
} else { |
70 | 84 |
if ( isUnix() ) { |
71 | 85 |
return 'file://' + rest_req; |
... | ... | |
86 | 100 |
return rest_request_generic(rest_req, "POST", data, false, null, null, null); |
87 | 101 |
} |
88 | 102 |
|
103 |
this.rest_request_get = function(rest_req) { |
|
104 |
return this.rest_request_sync(rest_req); |
|
105 |
} |
|
106 |
|
|
89 | 107 |
this.rest_request_sync = function(rest_req) { |
90 | 108 |
return rest_request_generic(rest_req, "GET", null, false, null, null, null); |
91 | 109 |
} |
... | ... | |
116 | 134 |
} |
117 | 135 |
req.setRequestHeader('Authorization', current.username + " " + sign(current.token, sign_url, gmtstring)); |
118 | 136 |
req.setRequestHeader('X-GSS-Date', gmtstring); |
137 |
|
|
119 | 138 |
if (method == "GET" || method == "HEAD") { |
120 | 139 |
req.send(null); |
121 | 140 |
} |
... | ... | |
129 | 148 |
return req; |
130 | 149 |
} |
131 | 150 |
|
132 |
function check_null_result(r,d) { |
|
151 |
function check_null_result(r, d) {
|
|
133 | 152 |
var res = r.exec(d); |
134 | 153 |
if (res == null) { return 'ERROR: no connection data'; } |
135 | 154 |
|
... | ... | |
226 | 245 |
|
227 | 246 |
/* |
228 | 247 |
[{"username":"ebstest@grnet-hq.admin.grnet.gr","uri":"http://pithos.grnet.gr/pithos/rest/aaitest@grnet-hq.admin.grnet.gr/others/ebstest@grnet-hq.admin.grnet.gr"},{"username":"louridas@grnet-hq.admin.grnet.gr","uri":"http://pithos.grnet.gr/pithos/rest/aaitest@grnet-hq.admin.grnet.gr/others/louridas@grnet-hq.admin.grnet.gr"}] |
229 |
*/ |
|
248 |
*/ |
Also available in: Unified diff